--- old/src/java.activation/share/classes/META-INF/mailcap.default 2018-01-30 20:15:51.000000000 -0500 +++ /dev/null 2018-01-30 20:15:51.000000000 -0500 @@ -1,7 +0,0 @@ -# -# This is a very simple 'mailcap' file -# -image/gif;; x-java-view=com.sun.activation.viewers.ImageViewer -image/jpeg;; x-java-view=com.sun.activation.viewers.ImageViewer -text/*;; x-java-view=com.sun.activation.viewers.TextViewer -text/*;; x-java-edit=com.sun.activation.viewers.TextEditor --- old/src/java.activation/share/classes/META-INF/mimetypes.default 2018-01-30 20:15:51.000000000 -0500 +++ /dev/null 2018-01-30 20:15:52.000000000 -0500 @@ -1,25 +0,0 @@ -# -# A simple, old format, mime.types file -# -text/html html htm HTML HTM -text/plain txt text TXT TEXT -image/gif gif GIF -image/ief ief -image/jpeg jpeg jpg jpe JPG -image/tiff tiff tif -image/png png PNG -image/x-xwindowdump xwd -application/postscript ai eps ps -application/rtf rtf -application/x-tex tex -application/x-texinfo texinfo texi -application/x-troff t tr roff -audio/basic au -audio/midi midi mid -audio/x-aifc aifc -audio/x-aiff aif aiff -audio/x-mpeg mpeg mpg -audio/x-wav wav -video/mpeg mpeg mpg mpe -video/quicktime qt mov -video/x-msvideo avi --- old/src/java.activation/share/classes/com/sun/activation/registries/LogSupport.java 2018-01-30 20:15:52.000000000 -0500 +++ /dev/null 2018-01-30 20:15:52.000000000 -0500 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2003, 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.activation.registries; - -import java.io.*; -import java.util.logging.*; - -/** - * Logging related methods. - */ -public class LogSupport { - private static boolean debug = false; - private static Logger logger; - private static final Level level = Level.FINE; - - static { - try { - debug = Boolean.getBoolean("javax.activation.debug"); - } catch (Throwable t) { - // ignore any errors - } - logger = Logger.getLogger("javax.activation"); - } - - /** - * Constructor. - */ - private LogSupport() { - // private constructor, can't create instances - } - - public static void log(String msg) { - if (debug) - System.out.println(msg); - logger.log(level, msg); - } - - public static void log(String msg, Throwable t) { - if (debug) - System.out.println(msg + "; Exception: " + t); - logger.log(level, msg, t); - } - - public static boolean isLoggable() { - return debug || logger.isLoggable(level); - } -} --- old/src/java.activation/share/classes/com/sun/activation/registries/MailcapFile.java 2018-01-30 20:15:53.000000000 -0500 +++ /dev/null 2018-01-30 20:15:53.000000000 -0500 @@ -1,563 +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.activation.registries; - -import java.io.*; -import java.util.*; - -public class MailcapFile { - - /** - * A Map indexed by MIME type (string) that references - * a Map of commands for each type. The comand Map - * is indexed by the command name and references a List of - * class names (strings) for each command. - */ - private Map type_hash = new HashMap(); - - /** - * Another Map like above, but for fallback entries. - */ - private Map fallback_hash = new HashMap(); - - /** - * A Map indexed by MIME type (string) that references - * a List of native commands (string) corresponding to the type. - */ - private Map native_commands = new HashMap(); - - private static boolean addReverse = false; - - static { - try { - addReverse = Boolean.getBoolean("javax.activation.addreverse"); - } catch (Throwable t) { - // ignore any errors - } - } - - /** - * The constructor that takes a filename as an argument. - * - * @param new_fname The file name of the mailcap file. - */ - public MailcapFile(String new_fname) throws IOException { - if (LogSupport.isLoggable()) - LogSupport.log("new MailcapFile: file " + new_fname); - FileReader reader = null; - try { - reader = new FileReader(new_fname); - parse(new BufferedReader(reader)); - } finally { - if (reader != null) { - try { - reader.close(); - } catch (IOException ex) { } - } - } - } - - /** - * The constructor that takes an input stream as an argument. - * - * @param is the input stream - */ - public MailcapFile(InputStream is) throws IOException { - if (LogSupport.isLoggable()) - LogSupport.log("new MailcapFile: InputStream"); - parse(new BufferedReader(new InputStreamReader(is, "iso-8859-1"))); - } - - /** - * Mailcap file default constructor. - */ - public MailcapFile() { - if (LogSupport.isLoggable()) - LogSupport.log("new MailcapFile: default"); - } - - /** - * Get the Map of MailcapEntries based on the MIME type. - * - *

- * Semantics: First check for the literal mime type, - * if that fails looks for wildcard /\* and return that. Return the - * list of all that hit. - */ - public Map getMailcapList(String mime_type) { - Map search_result = null; - Map wildcard_result = null; - - // first try the literal - search_result = (Map)type_hash.get(mime_type); - - // ok, now try the wildcard - int separator = mime_type.indexOf('/'); - String subtype = mime_type.substring(separator + 1); - if (!subtype.equals("*")) { - String type = mime_type.substring(0, separator + 1) + "*"; - wildcard_result = (Map)type_hash.get(type); - - if (wildcard_result != null) { // damn, we have to merge!!! - if (search_result != null) - search_result = - mergeResults(search_result, wildcard_result); - else - search_result = wildcard_result; - } - } - return search_result; - } - - /** - * Get the Map of fallback MailcapEntries based on the MIME type. - * - *

- * Semantics: First check for the literal mime type, - * if that fails looks for wildcard /\* and return that. Return the - * list of all that hit. - */ - public Map getMailcapFallbackList(String mime_type) { - Map search_result = null; - Map wildcard_result = null; - - // first try the literal - search_result = (Map)fallback_hash.get(mime_type); - - // ok, now try the wildcard - int separator = mime_type.indexOf('/'); - String subtype = mime_type.substring(separator + 1); - if (!subtype.equals("*")) { - String type = mime_type.substring(0, separator + 1) + "*"; - wildcard_result = (Map)fallback_hash.get(type); - - if (wildcard_result != null) { // damn, we have to merge!!! - if (search_result != null) - search_result = - mergeResults(search_result, wildcard_result); - else - search_result = wildcard_result; - } - } - return search_result; - } - - /** - * Return all the MIME types known to this mailcap file. - */ - public String[] getMimeTypes() { - Set types = new HashSet(type_hash.keySet()); - types.addAll(fallback_hash.keySet()); - types.addAll(native_commands.keySet()); - String[] mts = new String[types.size()]; - mts = (String[])types.toArray(mts); - return mts; - } - - /** - * Return all the native comands for the given MIME type. - */ - public String[] getNativeCommands(String mime_type) { - String[] cmds = null; - List v = - (List)native_commands.get(mime_type.toLowerCase(Locale.ENGLISH)); - if (v != null) { - cmds = new String[v.size()]; - cmds = (String[])v.toArray(cmds); - } - return cmds; - } - - /** - * Merge the first hash into the second. - * This merge will only effect the hashtable that is - * returned, we don't want to touch the one passed in since - * its integrity must be maintained. - */ - private Map mergeResults(Map first, Map second) { - Iterator verb_enum = second.keySet().iterator(); - Map clonedHash = new HashMap(first); - - // iterate through the verbs in the second map - while (verb_enum.hasNext()) { - String verb = (String)verb_enum.next(); - List cmdVector = (List)clonedHash.get(verb); - if (cmdVector == null) { - clonedHash.put(verb, second.get(verb)); - } else { - // merge the two - List oldV = (List)second.get(verb); - cmdVector = new ArrayList(cmdVector); - cmdVector.addAll(oldV); - clonedHash.put(verb, cmdVector); - } - } - return clonedHash; - } - - /** - * appendToMailcap: Append to this Mailcap DB, use the mailcap - * format: - * Comment == "# comment string - * Entry == "mimetype; javabeanclass - * - * Example: - * # this is a comment - * image/gif jaf.viewers.ImageViewer - */ - public void appendToMailcap(String mail_cap) { - if (LogSupport.isLoggable()) - LogSupport.log("appendToMailcap: " + mail_cap); - try { - parse(new StringReader(mail_cap)); - } catch (IOException ex) { - // can't happen - } - } - - /** - * parse file into a hash table of MC Type Entry Obj - */ - private void parse(Reader reader) throws IOException { - BufferedReader buf_reader = new BufferedReader(reader); - String line = null; - String continued = null; - - while ((line = buf_reader.readLine()) != null) { - // LogSupport.log("parsing line: " + line); - - line = line.trim(); - - try { - if (line.charAt(0) == '#') - continue; - if (line.charAt(line.length() - 1) == '\\') { - if (continued != null) - continued += line.substring(0, line.length() - 1); - else - continued = line.substring(0, line.length() - 1); - } else if (continued != null) { - // handle the two strings - continued = continued + line; - // LogSupport.log("parse: " + continued); - try { - parseLine(continued); - } catch (MailcapParseException e) { - //e.printStackTrace(); - } - continued = null; - } - else { - // LogSupport.log("parse: " + line); - try { - parseLine(line); - // LogSupport.log("hash.size = " + type_hash.size()); - } catch (MailcapParseException e) { - //e.printStackTrace(); - } - } - } catch (StringIndexOutOfBoundsException e) {} - } - } - - /** - * A routine to parse individual entries in a Mailcap file. - * - * Note that this routine does not handle line continuations. - * They should have been handled prior to calling this routine. - */ - protected void parseLine(String mailcapEntry) - throws MailcapParseException, IOException { - MailcapTokenizer tokenizer = new MailcapTokenizer(mailcapEntry); - tokenizer.setIsAutoquoting(false); - - if (LogSupport.isLoggable()) - LogSupport.log("parse: " + mailcapEntry); - // parse the primary type - int currentToken = tokenizer.nextToken(); - if (currentToken != MailcapTokenizer.STRING_TOKEN) { - reportParseError(MailcapTokenizer.STRING_TOKEN, currentToken, - tokenizer.getCurrentTokenValue()); - } - String primaryType = - tokenizer.getCurrentTokenValue().toLowerCase(Locale.ENGLISH); - String subType = "*"; - - // parse the '/' between primary and sub - // if it's not present that's ok, we just don't have a subtype - currentToken = tokenizer.nextToken(); - if ((currentToken != MailcapTokenizer.SLASH_TOKEN) && - (currentToken != MailcapTokenizer.SEMICOLON_TOKEN)) { - reportParseError(MailcapTokenizer.SLASH_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, currentToken, - tokenizer.getCurrentTokenValue()); - } - - // only need to look for a sub type if we got a '/' - if (currentToken == MailcapTokenizer.SLASH_TOKEN) { - // parse the sub type - currentToken = tokenizer.nextToken(); - if (currentToken != MailcapTokenizer.STRING_TOKEN) { - reportParseError(MailcapTokenizer.STRING_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - subType = - tokenizer.getCurrentTokenValue().toLowerCase(Locale.ENGLISH); - - // get the next token to simplify the next step - currentToken = tokenizer.nextToken(); - } - - String mimeType = primaryType + "/" + subType; - - if (LogSupport.isLoggable()) - LogSupport.log(" Type: " + mimeType); - - // now setup the commands hashtable - Map commands = new LinkedHashMap(); // keep commands in order found - - // parse the ';' that separates the type from the parameters - if (currentToken != MailcapTokenizer.SEMICOLON_TOKEN) { - reportParseError(MailcapTokenizer.SEMICOLON_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - // eat it - - // parse the required view command - tokenizer.setIsAutoquoting(true); - currentToken = tokenizer.nextToken(); - tokenizer.setIsAutoquoting(false); - if ((currentToken != MailcapTokenizer.STRING_TOKEN) && - (currentToken != MailcapTokenizer.SEMICOLON_TOKEN)) { - reportParseError(MailcapTokenizer.STRING_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, currentToken, - tokenizer.getCurrentTokenValue()); - } - - if (currentToken == MailcapTokenizer.STRING_TOKEN) { - // have a native comand, save the entire mailcap entry - //String nativeCommand = tokenizer.getCurrentTokenValue(); - List v = (List)native_commands.get(mimeType); - if (v == null) { - v = new ArrayList(); - v.add(mailcapEntry); - native_commands.put(mimeType, v); - } else { - // XXX - check for duplicates? - v.add(mailcapEntry); - } - } - - // only have to get the next token if the current one isn't a ';' - if (currentToken != MailcapTokenizer.SEMICOLON_TOKEN) { - currentToken = tokenizer.nextToken(); - } - - // look for a ';' which will indicate whether - // a parameter list is present or not - if (currentToken == MailcapTokenizer.SEMICOLON_TOKEN) { - boolean isFallback = false; - do { - // eat the ';' - - // parse the parameter name - currentToken = tokenizer.nextToken(); - if (currentToken != MailcapTokenizer.STRING_TOKEN) { - reportParseError(MailcapTokenizer.STRING_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - String paramName = tokenizer.getCurrentTokenValue(). - toLowerCase(Locale.ENGLISH); - - // parse the '=' which separates the name from the value - currentToken = tokenizer.nextToken(); - if ((currentToken != MailcapTokenizer.EQUALS_TOKEN) && - (currentToken != MailcapTokenizer.SEMICOLON_TOKEN) && - (currentToken != MailcapTokenizer.EOI_TOKEN)) { - reportParseError(MailcapTokenizer.EQUALS_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, - MailcapTokenizer.EOI_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - - // we only have a useful command if it is named - if (currentToken == MailcapTokenizer.EQUALS_TOKEN) { - // eat it - - // parse the parameter value (which is autoquoted) - tokenizer.setIsAutoquoting(true); - currentToken = tokenizer.nextToken(); - tokenizer.setIsAutoquoting(false); - if (currentToken != MailcapTokenizer.STRING_TOKEN) { - reportParseError(MailcapTokenizer.STRING_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - String paramValue = - tokenizer.getCurrentTokenValue(); - - // add the class to the list iff it is one we care about - if (paramName.startsWith("x-java-")) { - String commandName = paramName.substring(7); - // 7 == "x-java-".length - - if (commandName.equals("fallback-entry") && - paramValue.equalsIgnoreCase("true")) { - isFallback = true; - } else { - - // setup the class entry list - if (LogSupport.isLoggable()) - LogSupport.log(" Command: " + commandName + - ", Class: " + paramValue); - List classes = (List)commands.get(commandName); - if (classes == null) { - classes = new ArrayList(); - commands.put(commandName, classes); - } - if (addReverse) - classes.add(0, paramValue); - else - classes.add(paramValue); - } - } - - // set up the next iteration - currentToken = tokenizer.nextToken(); - } - } while (currentToken == MailcapTokenizer.SEMICOLON_TOKEN); - - Map masterHash = isFallback ? fallback_hash : type_hash; - Map curcommands = - (Map)masterHash.get(mimeType); - if (curcommands == null) { - masterHash.put(mimeType, commands); - } else { - if (LogSupport.isLoggable()) - LogSupport.log("Merging commands for type " + mimeType); - // have to merge current and new commands - // first, merge list of classes for commands already known - Iterator cn = curcommands.keySet().iterator(); - while (cn.hasNext()) { - String cmdName = (String)cn.next(); - List ccv = (List)curcommands.get(cmdName); - List cv = (List)commands.get(cmdName); - if (cv == null) - continue; - // add everything in cv to ccv, if it's not already there - Iterator cvn = cv.iterator(); - while (cvn.hasNext()) { - String clazz = (String)cvn.next(); - if (!ccv.contains(clazz)) - if (addReverse) - ccv.add(0, clazz); - else - ccv.add(clazz); - } - } - // now, add commands not previously known - cn = commands.keySet().iterator(); - while (cn.hasNext()) { - String cmdName = (String)cn.next(); - if (curcommands.containsKey(cmdName)) - continue; - List cv = (List)commands.get(cmdName); - curcommands.put(cmdName, cv); - } - } - } else if (currentToken != MailcapTokenizer.EOI_TOKEN) { - reportParseError(MailcapTokenizer.EOI_TOKEN, - MailcapTokenizer.SEMICOLON_TOKEN, - currentToken, tokenizer.getCurrentTokenValue()); - } - } - - protected static void reportParseError(int expectedToken, int actualToken, - String actualTokenValue) throws MailcapParseException { - throw new MailcapParseException("Encountered a " + - MailcapTokenizer.nameForToken(actualToken) + " token (" + - actualTokenValue + ") while expecting a " + - MailcapTokenizer.nameForToken(expectedToken) + " token."); - } - - protected static void reportParseError(int expectedToken, - int otherExpectedToken, int actualToken, String actualTokenValue) - throws MailcapParseException { - throw new MailcapParseException("Encountered a " + - MailcapTokenizer.nameForToken(actualToken) + " token (" + - actualTokenValue + ") while expecting a " + - MailcapTokenizer.nameForToken(expectedToken) + " or a " + - MailcapTokenizer.nameForToken(otherExpectedToken) + " token."); - } - - protected static void reportParseError(int expectedToken, - int otherExpectedToken, int anotherExpectedToken, int actualToken, - String actualTokenValue) throws MailcapParseException { - if (LogSupport.isLoggable()) - LogSupport.log("PARSE ERROR: " + "Encountered a " + - MailcapTokenizer.nameForToken(actualToken) + " token (" + - actualTokenValue + ") while expecting a " + - MailcapTokenizer.nameForToken(expectedToken) + ", a " + - MailcapTokenizer.nameForToken(otherExpectedToken) + ", or a " + - MailcapTokenizer.nameForToken(anotherExpectedToken) + " token."); - throw new MailcapParseException("Encountered a " + - MailcapTokenizer.nameForToken(actualToken) + " token (" + - actualTokenValue + ") while expecting a " + - MailcapTokenizer.nameForToken(expectedToken) + ", a " + - MailcapTokenizer.nameForToken(otherExpectedToken) + ", or a " + - MailcapTokenizer.nameForToken(anotherExpectedToken) + " token."); - } - - /** for debugging - public static void main(String[] args) throws Exception { - Map masterHash = new HashMap(); - for (int i = 0; i < args.length; ++i) { - System.out.println("Entry " + i + ": " + args[i]); - parseLine(args[i], masterHash); - } - - Enumeration types = masterHash.keys(); - while (types.hasMoreElements()) { - String key = (String)types.nextElement(); - System.out.println("MIME Type: " + key); - - Map commandHash = (Map)masterHash.get(key); - Enumeration commands = commandHash.keys(); - while (commands.hasMoreElements()) { - String command = (String)commands.nextElement(); - System.out.println(" Command: " + command); - - Vector classes = (Vector)commandHash.get(command); - for (int i = 0; i < classes.size(); ++i) { - System.out.println(" Class: " + - (String)classes.elementAt(i)); - } - } - - System.out.println(""); - } - } - */ -} --- old/src/java.activation/share/classes/com/sun/activation/registries/MailcapParseException.java 2018-01-30 20:15:53.000000000 -0500 +++ /dev/null 2018-01-30 20:15:54.000000000 -0500 @@ -1,40 +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.activation.registries; - -/** - * A class to encapsulate Mailcap parsing related exceptions - */ -public class MailcapParseException extends Exception { - - public MailcapParseException() { - super(); - } - - public MailcapParseException(String inInfo) { - super(inInfo); - } -} --- old/src/java.activation/share/classes/com/sun/activation/registries/MailcapTokenizer.java 2018-01-30 20:15:54.000000000 -0500 +++ /dev/null 2018-01-30 20:15:54.000000000 -0500 @@ -1,321 +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.activation.registries; - -/** - * A tokenizer for strings in the form of "foo/bar; prop1=val1; ... ". - * Useful for parsing MIME content types. - */ -public class MailcapTokenizer { - - public static final int UNKNOWN_TOKEN = 0; - public static final int START_TOKEN = 1; - public static final int STRING_TOKEN = 2; - public static final int EOI_TOKEN = 5; - public static final int SLASH_TOKEN = '/'; - public static final int SEMICOLON_TOKEN = ';'; - public static final int EQUALS_TOKEN = '='; - - /** - * Constructor - * - * @param inputString the string to tokenize - */ - public MailcapTokenizer(String inputString) { - data = inputString; - dataIndex = 0; - dataLength = inputString.length(); - - currentToken = START_TOKEN; - currentTokenValue = ""; - - isAutoquoting = false; - autoquoteChar = ';'; - } - - /** - * Set whether auto-quoting is on or off. - * - * Auto-quoting means that all characters after the first - * non-whitespace, non-control character up to the auto-quote - * terminator character or EOI (minus any whitespace immediatley - * preceeding it) is considered a token. - * - * This is required for handling command strings in a mailcap entry. - */ - public void setIsAutoquoting(boolean value) { - isAutoquoting = value; - } - - /** - * Retrieve current token. - * - * @return The current token value - */ - public int getCurrentToken() { - return currentToken; - } - - /* - * Get a String that describes the given token. - */ - public static String nameForToken(int token) { - String name = "really unknown"; - - switch(token) { - case UNKNOWN_TOKEN: - name = "unknown"; - break; - case START_TOKEN: - name = "start"; - break; - case STRING_TOKEN: - name = "string"; - break; - case EOI_TOKEN: - name = "EOI"; - break; - case SLASH_TOKEN: - name = "'/'"; - break; - case SEMICOLON_TOKEN: - name = "';'"; - break; - case EQUALS_TOKEN: - name = "'='"; - break; - } - - return name; - } - - /* - * Retrieve current token value. - * - * @return A String containing the current token value - */ - public String getCurrentTokenValue() { - return currentTokenValue; - } - /* - * Process the next token. - * - * @return the next token - */ - public int nextToken() { - if (dataIndex < dataLength) { - // skip white space - while ((dataIndex < dataLength) && - (isWhiteSpaceChar(data.charAt(dataIndex)))) { - ++dataIndex; - } - - if (dataIndex < dataLength) { - // examine the current character and see what kind of token we have - char c = data.charAt(dataIndex); - if (isAutoquoting) { - if (c == ';' || c == '=') { - currentToken = c; - currentTokenValue = new Character(c).toString(); - ++dataIndex; - } else { - processAutoquoteToken(); - } - } else { - if (isStringTokenChar(c)) { - processStringToken(); - } else if ((c == '/') || (c == ';') || (c == '=')) { - currentToken = c; - currentTokenValue = new Character(c).toString(); - ++dataIndex; - } else { - currentToken = UNKNOWN_TOKEN; - currentTokenValue = new Character(c).toString(); - ++dataIndex; - } - } - } else { - currentToken = EOI_TOKEN; - currentTokenValue = null; - } - } else { - currentToken = EOI_TOKEN; - currentTokenValue = null; - } - - return currentToken; - } - - private void processStringToken() { - // capture the initial index - int initialIndex = dataIndex; - - // skip to 1st non string token character - while ((dataIndex < dataLength) && - isStringTokenChar(data.charAt(dataIndex))) { - ++dataIndex; - } - - currentToken = STRING_TOKEN; - currentTokenValue = data.substring(initialIndex, dataIndex); - } - - private void processAutoquoteToken() { - // capture the initial index - int initialIndex = dataIndex; - - // now skip to the 1st non-escaped autoquote termination character - // XXX - doesn't actually consider escaping - boolean foundTerminator = false; - while ((dataIndex < dataLength) && !foundTerminator) { - char c = data.charAt(dataIndex); - if (c != autoquoteChar) { - ++dataIndex; - } else { - foundTerminator = true; - } - } - - currentToken = STRING_TOKEN; - currentTokenValue = - fixEscapeSequences(data.substring(initialIndex, dataIndex)); - } - - private static boolean isSpecialChar(char c) { - boolean lAnswer = false; - - switch(c) { - case '(': - case ')': - case '<': - case '>': - case '@': - case ',': - case ';': - case ':': - case '\\': - case '"': - case '/': - case '[': - case ']': - case '?': - case '=': - lAnswer = true; - break; - } - - return lAnswer; - } - - private static boolean isControlChar(char c) { - return Character.isISOControl(c); - } - - private static boolean isWhiteSpaceChar(char c) { - return Character.isWhitespace(c); - } - - private static boolean isStringTokenChar(char c) { - return !isSpecialChar(c) && !isControlChar(c) && !isWhiteSpaceChar(c); - } - - private static String fixEscapeSequences(String inputString) { - int inputLength = inputString.length(); - StringBuffer buffer = new StringBuffer(); - buffer.ensureCapacity(inputLength); - - for (int i = 0; i < inputLength; ++i) { - char currentChar = inputString.charAt(i); - if (currentChar != '\\') { - buffer.append(currentChar); - } else { - if (i < inputLength - 1) { - char nextChar = inputString.charAt(i + 1); - buffer.append(nextChar); - - // force a skip over the next character too - ++i; - } else { - buffer.append(currentChar); - } - } - } - - return buffer.toString(); - } - - private String data; - private int dataIndex; - private int dataLength; - private int currentToken; - private String currentTokenValue; - private boolean isAutoquoting; - private char autoquoteChar; - - /* - public static void main(String[] args) { - for (int i = 0; i < args.length; ++i) { - MailcapTokenizer tokenizer = new MailcapTokenizer(args[i]); - - System.out.println("Original: |" + args[i] + "|"); - - int currentToken = tokenizer.nextToken(); - while (currentToken != EOI_TOKEN) { - switch(currentToken) { - case UNKNOWN_TOKEN: - System.out.println(" Unknown Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case START_TOKEN: - System.out.println(" Start Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case STRING_TOKEN: - System.out.println(" String Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case EOI_TOKEN: - System.out.println(" EOI Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case SLASH_TOKEN: - System.out.println(" Slash Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case SEMICOLON_TOKEN: - System.out.println(" Semicolon Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - case EQUALS_TOKEN: - System.out.println(" Equals Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - default: - System.out.println(" Really Unknown Token: |" + tokenizer.getCurrentTokenValue() + "|"); - break; - } - - currentToken = tokenizer.nextToken(); - } - - System.out.println(""); - } - } - */ -} --- old/src/java.activation/share/classes/com/sun/activation/registries/MimeTypeEntry.java 2018-01-30 20:15:55.000000000 -0500 +++ /dev/null 2018-01-30 20:15:55.000000000 -0500 @@ -1,50 +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.activation.registries; - -import java.lang.*; - -public class MimeTypeEntry { - private String type; - private String extension; - - public MimeTypeEntry(String mime_type, String file_ext) { - type = mime_type; - extension = file_ext; - } - - public String getMIMEType() { - return type; - } - - public String getFileExtension() { - return extension; - } - - public String toString() { - return "MIMETypeEntry: " + type + ", " + extension; - } -} --- old/src/java.activation/share/classes/com/sun/activation/registries/MimeTypeFile.java 2018-01-30 20:15:55.000000000 -0500 +++ /dev/null 2018-01-30 20:15:55.000000000 -0500 @@ -1,317 +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.activation.registries; - -import java.io.*; -import java.util.*; - -public class MimeTypeFile { - private String fname = null; - private Hashtable type_hash = new Hashtable(); - - /** - * The construtor that takes a filename as an argument. - * - * @param new_fname The file name of the mime types file. - */ - public MimeTypeFile(String new_fname) throws IOException { - File mime_file = null; - FileReader fr = null; - - fname = new_fname; // remember the file name - - mime_file = new File(fname); // get a file object - - fr = new FileReader(mime_file); - - try { - parse(new BufferedReader(fr)); - } finally { - try { - fr.close(); // close it - } catch (IOException e) { - // ignore it - } - } - } - - public MimeTypeFile(InputStream is) throws IOException { - parse(new BufferedReader(new InputStreamReader(is, "iso-8859-1"))); - } - - /** - * Creates an empty DB. - */ - public MimeTypeFile() { - } - - /** - * get the MimeTypeEntry based on the file extension - */ - public MimeTypeEntry getMimeTypeEntry(String file_ext) { - return (MimeTypeEntry)type_hash.get((Object)file_ext); - } - - /** - * Get the MIME type string corresponding to the file extension. - */ - public String getMIMETypeString(String file_ext) { - MimeTypeEntry entry = this.getMimeTypeEntry(file_ext); - - if (entry != null) - return entry.getMIMEType(); - else - return null; - } - - /** - * Appends string of entries to the types registry, must be valid - * .mime.types format. - * A mime.types entry is one of two forms: - * - * type/subtype ext1 ext2 ... - * or - * type=type/subtype desc="description of type" exts=ext1,ext2,... - * - * Example: - * # this is a test - * audio/basic au - * text/plain txt text - * type=application/postscript exts=ps,eps - */ - public void appendToRegistry(String mime_types) { - try { - parse(new BufferedReader(new StringReader(mime_types))); - } catch (IOException ex) { - // can't happen - } - } - - /** - * Parse a stream of mime.types entries. - */ - private void parse(BufferedReader buf_reader) throws IOException { - String line = null, prev = null; - - while ((line = buf_reader.readLine()) != null) { - if (prev == null) - prev = line; - else - prev += line; - int end = prev.length(); - if (prev.length() > 0 && prev.charAt(end - 1) == '\\') { - prev = prev.substring(0, end - 1); - continue; - } - this.parseEntry(prev); - prev = null; - } - if (prev != null) - this.parseEntry(prev); - } - - /** - * Parse single mime.types entry. - */ - private void parseEntry(String line) { - String mime_type = null; - String file_ext = null; - line = line.trim(); - - if (line.length() == 0) // empty line... - return; // BAIL! - - // check to see if this is a comment line? - if (line.charAt(0) == '#') - return; // then we are done! - - // is it a new format line or old format? - if (line.indexOf('=') > 0) { - // new format - LineTokenizer lt = new LineTokenizer(line); - while (lt.hasMoreTokens()) { - String name = lt.nextToken(); - String value = null; - if (lt.hasMoreTokens() && lt.nextToken().equals("=") && - lt.hasMoreTokens()) - value = lt.nextToken(); - if (value == null) { - if (LogSupport.isLoggable()) - LogSupport.log("Bad .mime.types entry: " + line); - return; - } - if (name.equals("type")) - mime_type = value; - else if (name.equals("exts")) { - StringTokenizer st = new StringTokenizer(value, ","); - while (st.hasMoreTokens()) { - file_ext = st.nextToken(); - MimeTypeEntry entry = - new MimeTypeEntry(mime_type, file_ext); - type_hash.put(file_ext, entry); - if (LogSupport.isLoggable()) - LogSupport.log("Added: " + entry.toString()); - } - } - } - } else { - // old format - // count the tokens - StringTokenizer strtok = new StringTokenizer(line); - int num_tok = strtok.countTokens(); - - if (num_tok == 0) // empty line - return; - - mime_type = strtok.nextToken(); // get the MIME type - - while (strtok.hasMoreTokens()) { - MimeTypeEntry entry = null; - - file_ext = strtok.nextToken(); - entry = new MimeTypeEntry(mime_type, file_ext); - type_hash.put(file_ext, entry); - if (LogSupport.isLoggable()) - LogSupport.log("Added: " + entry.toString()); - } - } - } - - // for debugging - /* - public static void main(String[] argv) throws Exception { - MimeTypeFile mf = new MimeTypeFile(argv[0]); - System.out.println("ext " + argv[1] + " type " + - mf.getMIMETypeString(argv[1])); - System.exit(0); - } - */ -} - -class LineTokenizer { - private int currentPosition; - private int maxPosition; - private String str; - private Vector stack = new Vector(); - private static final String singles = "="; // single character tokens - - /** - * Constructs a tokenizer for the specified string. - *

- * - * @param str a string to be parsed. - */ - public LineTokenizer(String str) { - currentPosition = 0; - this.str = str; - maxPosition = str.length(); - } - - /** - * Skips white space. - */ - private void skipWhiteSpace() { - while ((currentPosition < maxPosition) && - Character.isWhitespace(str.charAt(currentPosition))) { - currentPosition++; - } - } - - /** - * Tests if there are more tokens available from this tokenizer's string. - * - * @return true if there are more tokens available from this - * tokenizer's string; false otherwise. - */ - public boolean hasMoreTokens() { - if (stack.size() > 0) - return true; - skipWhiteSpace(); - return (currentPosition < maxPosition); - } - - /** - * Returns the next token from this tokenizer. - * - * @return the next token from this tokenizer. - * @exception NoSuchElementException if there are no more tokens in this - * tokenizer's string. - */ - public String nextToken() { - int size = stack.size(); - if (size > 0) { - String t = (String)stack.elementAt(size - 1); - stack.removeElementAt(size - 1); - return t; - } - skipWhiteSpace(); - - if (currentPosition >= maxPosition) { - throw new NoSuchElementException(); - } - - int start = currentPosition; - char c = str.charAt(start); - if (c == '"') { - currentPosition++; - boolean filter = false; - while (currentPosition < maxPosition) { - c = str.charAt(currentPosition++); - if (c == '\\') { - currentPosition++; - filter = true; - } else if (c == '"') { - String s; - - if (filter) { - StringBuffer sb = new StringBuffer(); - for (int i = start + 1; i < currentPosition - 1; i++) { - c = str.charAt(i); - if (c != '\\') - sb.append(c); - } - s = sb.toString(); - } else - s = str.substring(start + 1, currentPosition - 1); - return s; - } - } - } else if (singles.indexOf(c) >= 0) { - currentPosition++; - } else { - while ((currentPosition < maxPosition) && - singles.indexOf(str.charAt(currentPosition)) < 0 && - !Character.isWhitespace(str.charAt(currentPosition))) { - currentPosition++; - } - } - return str.substring(start, currentPosition); - } - - public void pushToken(String token) { - stack.addElement(token); - } -} --- old/src/java.activation/share/classes/javax/activation/ActivationDataFlavor.java 2018-01-30 20:15:56.000000000 -0500 +++ /dev/null 2018-01-30 20:15:56.000000000 -0500 @@ -1,249 +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 javax.activation; - -import java.awt.datatransfer.DataFlavor; -import java.io.IOException; -import javax.activation.MimeType; - -/** - * The ActivationDataFlavor class is a special subclass of - * {@code java.awt.datatransfer.DataFlavor}. It allows the JAF to - * set all three values stored by the DataFlavor class via a new - * constructor. It also contains improved MIME parsing in the {@code equals} - * method. Except for the improved parsing, its semantics are - * identical to that of the JDK's DataFlavor class. - * - * @since 1.6 - */ - -public class ActivationDataFlavor extends DataFlavor { - - /* - * Raison d'etre: - * - * The DataFlavor class included in JDK 1.1 has several limitations - * including piss poor MIME type parsing, and the limitation of - * only supporting serialized objects and InputStreams as - * representation objects. This class 'fixes' that. - */ - - // I think for now I'll keep copies of all the variables and - // then later I may choose try to better coexist with the base - // class *sigh* - private String mimeType = null; - private MimeType mimeObject = null; - private String humanPresentableName = null; - private Class representationClass = null; - - /** - * Construct a DataFlavor that represents an arbitrary - * Java object. This constructor is an extension of the - * JDK's DataFlavor in that it allows the explicit setting - * of all three DataFlavor attributes. - *

- * The returned DataFlavor will have the following characteristics: - *

- * representationClass = representationClass
- * mimeType = mimeType
- * humanName = humanName - * - * @param representationClass the class used in this DataFlavor - * @param mimeType the MIME type of the data represented by this class - * @param humanPresentableName the human presentable name of the flavor - */ - public ActivationDataFlavor(Class representationClass, - String mimeType, String humanPresentableName) { - super(mimeType, humanPresentableName); // need to call super - - // init private variables: - this.mimeType = mimeType; - this.humanPresentableName = humanPresentableName; - this.representationClass = representationClass; - } - - /** - * Construct a DataFlavor that represents a MimeType. - *

- * The returned DataFlavor will have the following characteristics: - *

- * If the mimeType is "application/x-java-serialized-object; - * class=", the result is the same as calling new - * DataFlavor(Class.forName()) as above. - *

- * otherwise: - *

- * representationClass = InputStream

- * mimeType = mimeType - * - * @param representationClass the class used in this DataFlavor - * @param humanPresentableName the human presentable name of the flavor - */ - public ActivationDataFlavor(Class representationClass, - String humanPresentableName) { - super(representationClass, humanPresentableName); - this.mimeType = super.getMimeType(); - this.representationClass = representationClass; - this.humanPresentableName = humanPresentableName; - } - - /** - * Construct a DataFlavor that represents a MimeType. - *

- * The returned DataFlavor will have the following characteristics: - *

- * If the mimeType is "application/x-java-serialized-object; class=", - * the result is the same as calling new DataFlavor(Class.forName()) as - * above, otherwise: - *

- * representationClass = InputStream

- * mimeType = mimeType - * - * @param mimeType the MIME type of the data represented by this class - * @param humanPresentableName the human presentable name of the flavor - */ - public ActivationDataFlavor(String mimeType, String humanPresentableName) { - super(mimeType, humanPresentableName); - this.mimeType = mimeType; - try { - this.representationClass = Class.forName("java.io.InputStream"); - } catch (ClassNotFoundException ex) { - // XXX - should never happen, ignore it - } - this.humanPresentableName = humanPresentableName; - } - - /** - * Return the MIME type for this DataFlavor. - * - * @return the MIME type - */ - public String getMimeType() { - return mimeType; - } - - /** - * Return the representation class. - * - * @return the representation class - */ - public Class getRepresentationClass() { - return representationClass; - } - - /** - * Return the Human Presentable name. - * - * @return the human presentable name - */ - public String getHumanPresentableName() { - return humanPresentableName; - } - - /** - * Set the human presentable name. - * - * @param humanPresentableName the name to set - */ - public void setHumanPresentableName(String humanPresentableName) { - this.humanPresentableName = humanPresentableName; - } - - /** - * Compares the DataFlavor passed in with this DataFlavor; calls - * the {@code isMimeTypeEqual} method. - * - * @param dataFlavor the DataFlavor to compare with - * @return true if the MIME type and representation class - * are the same - */ - public boolean equals(DataFlavor dataFlavor) { - return (isMimeTypeEqual(dataFlavor) && - dataFlavor.getRepresentationClass() == representationClass); - } - - /** - * Is the string representation of the MIME type passed in equivalent - * to the MIME type of this DataFlavor.

- * - * ActivationDataFlavor delegates the comparison of MIME types to - * the MimeType class included as part of the JavaBeans Activation - * Framework. This provides a more robust comparison than is normally - * available in the DataFlavor class. - * - * @param mimeType the MIME type - * @return true if the same MIME type - */ - public boolean isMimeTypeEqual(String mimeType) { - MimeType mt = null; - try { - if (mimeObject == null) - mimeObject = new MimeType(this.mimeType); - mt = new MimeType(mimeType); - } catch (MimeTypeParseException e) { - // something didn't parse, do a crude comparison - return this.mimeType.equalsIgnoreCase(mimeType); - } - - return mimeObject.match(mt); - } - - /** - * Called on DataFlavor for every MIME Type parameter to allow DataFlavor - * subclasses to handle special parameters like the text/plain charset - * parameters, whose values are case insensitive. (MIME type parameter - * values are supposed to be case sensitive). - *

- * This method is called for each parameter name/value pair and should - * return the normalized representation of the parameterValue. - * This method is never invoked by this implementation. - * - * @param parameterName the parameter name - * @param parameterValue the parameter value - * @return the normalized parameter value - * @deprecated - */ - protected String normalizeMimeTypeParameter(String parameterName, - String parameterValue) { - return parameterValue; - } - - /** - * Called for each MIME type string to give DataFlavor subtypes the - * opportunity to change how the normalization of MIME types is - * accomplished. - * One possible use would be to add default parameter/value pairs in cases - * where none are present in the MIME type string passed in. - * This method is never invoked by this implementation. - * - * @param mimeType the MIME type - * @return the normalized MIME type - * @deprecated - */ - protected String normalizeMimeType(String mimeType) { - return mimeType; - } -} --- old/src/java.activation/share/classes/javax/activation/CommandInfo.java 2018-01-30 20:15:57.000000000 -0500 +++ /dev/null 2018-01-30 20:15:57.000000000 -0500 @@ -1,233 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 javax.activation; - -import java.io.*; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedAction; - -/** - * The CommandInfo class is used by CommandMap implementations to - * describe the results of command requests. It provides the requestor - * with both the verb requested, as well as an instance of the - * bean. There is also a method that will return the name of the - * class that implements the command but it is not guaranteed to - * return a valid value. The reason for this is to allow CommandMap - * implmentations that subclass CommandInfo to provide special - * behavior. For example a CommandMap could dynamically generate - * JavaBeans. In this case, it might not be possible to create an - * object with all the correct state information solely from the class - * name. - * - * @since 1.6 - */ - -public class CommandInfo { - private String verb; - private String className; - - /** - * The Constructor for CommandInfo. - * @param verb The command verb this CommandInfo decribes. - * @param className The command's fully qualified class name. - */ - public CommandInfo(String verb, String className) { - this.verb = verb; - this.className = className; - } - - /** - * Return the command verb. - * - * @return the command verb. - */ - public String getCommandName() { - return verb; - } - - /** - * Return the command's class name. This method MAY return null in - * cases where a CommandMap subclassed CommandInfo for its - * own purposes. In other words, it might not be possible to - * create the correct state in the command by merely knowing - * its class name. DO NOT DEPEND ON THIS METHOD RETURNING - * A VALID VALUE! - * - * @return The class name of the command, or null - */ - public String getCommandClass() { - return className; - } - - /** - * Return the instantiated JavaBean component. - *

- * If {@code java.beans.Beans} is visible then it's - * {@code java.beans.Beans#instantiate} method is invoked to instantiate - * the component as a JavaBeans component. - * When {@code java.beans.Beans} is not visible (when {@code java.desktop} - * module is not readable or when the runtime image does not contain the - * {@code java.desktop} module) then the command's class is loaded and - * instantiated with its public no-args constructor. - *

- * The component class needs to be public. - *

- * If the bean implements the {@code javax.activation.CommandObject} - * interface, call its {@code setCommandContext} method. - *

- * If the DataHandler parameter is null, then the bean is - * instantiated with no data. NOTE: this may be useful - * if for some reason the DataHandler that is passed in - * throws IOExceptions when this method attempts to - * access its InputStream. It will allow the caller to - * retrieve a reference to the bean if it can be - * instantiated. - *

- * If the bean does NOT implement the CommandObject interface, - * this method will check if it implements the - * java.io.Externalizable interface. If it does, the bean's - * readExternal method will be called if an InputStream - * can be acquired from the DataHandler. - * - * @param dh The DataHandler that describes the data to be - * passed to the command. - * @param loader The ClassLoader to be used to instantiate the bean. - * @return The bean - * @exception IOException for failures reading data - * @exception ClassNotFoundException if command object class can't - * be found - * @see java.beans.Beans#instantiate - * @see javax.activation.CommandObject - */ - public Object getCommandObject(DataHandler dh, ClassLoader loader) - throws IOException, ClassNotFoundException { - Object new_bean = null; - - // try to instantiate the bean - new_bean = Beans.instantiate(loader, className); - - // if we got one and it is a CommandObject - if (new_bean != null) { - if (new_bean instanceof CommandObject) { - ((CommandObject)new_bean).setCommandContext(verb, dh); - } else if (new_bean instanceof Externalizable) { - if (dh != null) { - InputStream is = dh.getInputStream(); - if (is != null) { - ((Externalizable)new_bean).readExternal( - new ObjectInputStream(is)); - } - } - } - } - - return new_bean; - } - - /** - * Helper class to invoke Beans.instantiate reflectively or the equivalent - * with core reflection when module java.desktop is not readable. - */ - private static final class Beans { - static final Method instantiateMethod; - - static { - Method m; - try { - Class c = Class.forName("java.beans.Beans"); - m = c.getDeclaredMethod("instantiate", ClassLoader.class, String.class); - } catch (ClassNotFoundException e) { - m = null; - } catch (NoSuchMethodException e) { - m = null; - } - instantiateMethod = m; - } - - /** - * Equivalent to invoking java.beans.Beans.instantiate(loader, cn) - */ - static Object instantiate(ClassLoader loader, String cn) - throws IOException, ClassNotFoundException { - - Exception exception; - - if (instantiateMethod != null) { - - // invoke Beans.instantiate - try { - return instantiateMethod.invoke(null, loader, cn); - } catch (InvocationTargetException e) { - exception = e; - } catch (IllegalAccessException e) { - exception = e; - } - - } else { - - SecurityManager security = System.getSecurityManager(); - if (security != null) { - // if it's ok with the SecurityManager, it's ok with me. - String cname = cn.replace('/', '.'); - if (cname.startsWith("[")) { - int b = cname.lastIndexOf('[') + 2; - if (b > 1 && b < cname.length()) { - cname = cname.substring(b); - } - } - int i = cname.lastIndexOf('.'); - if (i != -1) { - security.checkPackageAccess(cname.substring(0, i)); - } - } - - // Beans.instantiate specified to use SCL when loader is null - if (loader == null) { - loader = (ClassLoader) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - ClassLoader cl = null; - try { - cl = ClassLoader.getSystemClassLoader(); - } catch (SecurityException ex) { } - return cl; - } - }); - } - Class beanClass = Class.forName(cn, false, loader); - try { - return beanClass.getDeclaredConstructor().newInstance(); - } catch (Exception ex) { - throw new ClassNotFoundException(beanClass + ": " + ex, ex); - } - - } - return null; - } - } -} --- old/src/java.activation/share/classes/javax/activation/CommandMap.java 2018-01-30 20:15:57.000000000 -0500 +++ /dev/null 2018-01-30 20:15:57.000000000 -0500 @@ -1,235 +0,0 @@ -/* - * 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 javax.activation; - -import java.util.Map; -import java.util.WeakHashMap; - - -/** - * The CommandMap class provides an interface to a registry of - * command objects available in the system. - * Developers are expected to either use the CommandMap - * implementation included with this package (MailcapCommandMap) or - * develop their own. Note that some of the methods in this class are - * abstract. - * - * @since 1.6 - */ -public abstract class CommandMap { - private static CommandMap defaultCommandMap = null; - private static Map map = - new WeakHashMap(); - - /** - * Get the default CommandMap. - * - *

- * - * @return the CommandMap - */ - public static synchronized CommandMap getDefaultCommandMap() { - if (defaultCommandMap != null) - return defaultCommandMap; - - // fetch per-thread-context-class-loader default - ClassLoader tccl = SecuritySupport.getContextClassLoader(); - CommandMap def = map.get(tccl); - if (def == null) { - def = new MailcapCommandMap(); - map.put(tccl, def); - } - return def; - } - - /** - * Set the default CommandMap. Reset the CommandMap to the default by - * calling this method with {@code null}. - * - * @param commandMap The new default CommandMap. - * @exception SecurityException if the caller doesn't have permission - * to change the default - */ - public static synchronized void setDefaultCommandMap(CommandMap commandMap) { - SecurityManager security = System.getSecurityManager(); - if (security != null) { - try { - // if it's ok with the SecurityManager, it's ok with me... - security.checkSetFactory(); - } catch (SecurityException ex) { - // otherwise, we also allow it if this code and the - // factory come from the same (non-system) class loader (e.g., - // the JAF classes were loaded with the applet classes). - ClassLoader cl = CommandMap.class.getClassLoader(); - if (cl == null || cl.getParent() == null || - cl != commandMap.getClass().getClassLoader()) { - throw ex; - } - } - } - // remove any per-thread-context-class-loader CommandMap - map.remove(SecuritySupport.getContextClassLoader()); - defaultCommandMap = commandMap; - } - - /** - * Get the preferred command list from a MIME Type. The actual semantics - * are determined by the implementation of the CommandMap. - * - * @param mimeType the MIME type - * @return the CommandInfo classes that represent the command Beans. - */ - abstract public CommandInfo[] getPreferredCommands(String mimeType); - - /** - * Get the preferred command list from a MIME Type. The actual semantics - * are determined by the implementation of the CommandMap.

- * - * The {@code DataSource} provides extra information, such as - * the file name, that a CommandMap implementation may use to further - * refine the list of commands that are returned. The implementation - * in this class simply calls the {@code getPreferredCommands} - * method that ignores this argument. - * - * @param mimeType the MIME type - * @param ds a DataSource for the data - * @return the CommandInfo classes that represent the command Beans. - * @since 1.6, JAF 1.1 - */ - public CommandInfo[] getPreferredCommands(String mimeType, DataSource ds) { - return getPreferredCommands(mimeType); - } - - /** - * Get all the available commands for this type. This method - * should return all the possible commands for this MIME type. - * - * @param mimeType the MIME type - * @return the CommandInfo objects representing all the commands. - */ - abstract public CommandInfo[] getAllCommands(String mimeType); - - /** - * Get all the available commands for this type. This method - * should return all the possible commands for this MIME type.

- * - * The {@code DataSource} provides extra information, such as - * the file name, that a CommandMap implementation may use to further - * refine the list of commands that are returned. The implementation - * in this class simply calls the {@code getAllCommands} - * method that ignores this argument. - * - * @param mimeType the MIME type - * @param ds a DataSource for the data - * @return the CommandInfo objects representing all the commands. - * @since 1.6, JAF 1.1 - */ - public CommandInfo[] getAllCommands(String mimeType, DataSource ds) { - return getAllCommands(mimeType); - } - - /** - * Get the default command corresponding to the MIME type. - * - * @param mimeType the MIME type - * @param cmdName the command name - * @return the CommandInfo corresponding to the command. - */ - abstract public CommandInfo getCommand(String mimeType, String cmdName); - - /** - * Get the default command corresponding to the MIME type.

- * - * The {@code DataSource} provides extra information, such as - * the file name, that a CommandMap implementation may use to further - * refine the command that is chosen. The implementation - * in this class simply calls the {@code getCommand} - * method that ignores this argument. - * - * @param mimeType the MIME type - * @param cmdName the command name - * @param ds a DataSource for the data - * @return the CommandInfo corresponding to the command. - * @since 1.6, JAF 1.1 - */ - public CommandInfo getCommand(String mimeType, String cmdName, - DataSource ds) { - return getCommand(mimeType, cmdName); - } - - /** - * Locate a DataContentHandler that corresponds to the MIME type. - * The mechanism and semantics for determining this are determined - * by the implementation of the particular CommandMap. - * - * @param mimeType the MIME type - * @return the DataContentHandler for the MIME type - */ - abstract public DataContentHandler createDataContentHandler(String - mimeType); - - /** - * Locate a DataContentHandler that corresponds to the MIME type. - * The mechanism and semantics for determining this are determined - * by the implementation of the particular CommandMap.

- * - * The {@code DataSource} provides extra information, such as - * the file name, that a CommandMap implementation may use to further - * refine the choice of DataContentHandler. The implementation - * in this class simply calls the {@code createDataContentHandler} - * method that ignores this argument. - * - * @param mimeType the MIME type - * @param ds a DataSource for the data - * @return the DataContentHandler for the MIME type - * @since 1.6, JAF 1.1 - */ - public DataContentHandler createDataContentHandler(String mimeType, - DataSource ds) { - return createDataContentHandler(mimeType); - } - - /** - * Get all the MIME types known to this command map. - * If the command map doesn't support this operation, - * null is returned. - * - * @return array of MIME types as strings, or null if not supported - * @since 1.6, JAF 1.1 - */ - public String[] getMimeTypes() { - return null; - } -} --- old/src/java.activation/share/classes/javax/activation/CommandObject.java 2018-01-30 20:15:58.000000000 -0500 +++ /dev/null 2018-01-30 20:15:58.000000000 -0500 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 javax.activation; - -import java.io.IOException; - -/** - * JavaBeans components that are Activation Framework aware implement - * this interface to find out which command verb they're being asked - * to perform, and to obtain the DataHandler representing the - * data they should operate on. JavaBeans that don't implement - * this interface may be used as well. Such commands may obtain - * the data using the Externalizable interface, or using an - * application-specific method. - * - * @since 1.6 - */ -public interface CommandObject { - - /** - * Initialize the Command with the verb it is requested to handle - * and the DataHandler that describes the data it will - * operate on. NOTE: it is acceptable for the caller - * to pass null as the value for {@code DataHandler}. - * - * @param verb The Command Verb this object refers to. - * @param dh The DataHandler. - * @exception IOException for failures accessing data - */ - public void setCommandContext(String verb, DataHandler dh) - throws IOException; -} --- old/src/java.activation/share/classes/javax/activation/DataContentHandler.java 2018-01-30 20:15:59.000000000 -0500 +++ /dev/null 2018-01-30 20:15:59.000000000 -0500 @@ -1,106 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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 javax.activation; - -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import javax.activation.DataSource; - -/** - *

The DataContentHandler interface is implemented by objects that can - * be used to extend the capabilities of the DataHandler's implementation - * of the Transferable interface. Through DataContentHandlers - * the framework can be extended to convert streams in to objects, and - * to write objects to streams.

- * - *

An implementation of DataContentHandler should be a public class - * with a public no-arg constructor. If the implementation class is in - * a named module then it should be in an API package that is exported - * to the module {@code java.activation}.

- * - *

Applications don't generally call the methods in DataContentHandlers - * directly. Instead, an application calls the equivalent methods in - * DataHandler. The DataHandler will attempt to find an appropriate - * DataContentHandler that corresponds to its MIME type using the - * current DataContentHandlerFactory. The DataHandler then calls - * through to the methods in the DataContentHandler.

- * - * @since 1.6 - */ - -public interface DataContentHandler { - /** - * Returns an array of DataFlavor objects indicating the flavors the - * data can be provided in. The array should be ordered according to - * preference for providing the data (from most richly descriptive to - * least descriptive). - * - * @return The DataFlavors. - */ - public DataFlavor[] getTransferDataFlavors(); - - /** - * Returns an object which represents the data to be transferred. - * The class of the object returned is defined by the representation class - * of the flavor. - * - * @param df The DataFlavor representing the requested type. - * @param ds The DataSource representing the data to be converted. - * @return The constructed Object. - * @exception UnsupportedFlavorException if the handler doesn't - * support the requested flavor - * @exception IOException if the data can't be accessed - */ - public Object getTransferData(DataFlavor df, DataSource ds) - throws UnsupportedFlavorException, IOException; - - /** - * Return an object representing the data in its most preferred form. - * Generally this will be the form described by the first DataFlavor - * returned by the getTransferDataFlavors method. - * - * @param ds The DataSource representing the data to be converted. - * @return The constructed Object. - * @exception IOException if the data can't be accessed - */ - public Object getContent(DataSource ds) throws IOException; - - /** - * Convert the object to a byte stream of the specified MIME type - * and write it to the output stream. - * - * @param obj The object to be converted. - * @param mimeType The requested MIME type of the resulting byte stream. - * @param os The output stream into which to write the converted - * byte stream. - * @exception IOException errors writing to the stream - */ - public void writeTo(Object obj, String mimeType, OutputStream os) - throws IOException; -} --- old/src/java.activation/share/classes/javax/activation/DataContentHandlerFactory.java 2018-01-30 20:15:59.000000000 -0500 +++ /dev/null 2018-01-30 20:15:59.000000000 -0500 @@ -1,48 +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 javax.activation; - -/** - * This interface defines a factory for DataContentHandlers. An - * implementation of this interface should map a MIME type into an - * instance of DataContentHandler. The design pattern for classes implementing - * this interface is the same as for the ContentHandler mechanism used in - * java.net.URL. - * - * @since 1.6 - */ - -public interface DataContentHandlerFactory { - - /** - * Creates a new DataContentHandler object for the MIME type. - * - * @param mimeType the MIME type to create the DataContentHandler for. - * @return The new DataContentHandler, or null - * if none are found. - */ - public DataContentHandler createDataContentHandler(String mimeType); -} --- old/src/java.activation/share/classes/javax/activation/DataHandler.java 2018-01-30 20:16:00.000000000 -0500 +++ /dev/null 2018-01-30 20:16:00.000000000 -0500 @@ -1,900 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 javax.activation; - -import java.io.InputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; -import java.io.OutputStreamWriter; -import java.net.URL; -import java.awt.datatransfer.Transferable; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.UnsupportedFlavorException; - -/** - * The DataHandler class provides a consistent interface to data - * available in many different sources and formats. - * It manages simple stream to string conversions and related operations - * using DataContentHandlers. - * It provides access to commands that can operate on the data. - * The commands are found using a CommandMap.

- * - * DataHandler and the Transferable Interface

- * DataHandler implements the Transferable interface so that data can - * be used in AWT data transfer operations, such as cut and paste and - * drag and drop. The implementation of the Transferable interface - * relies on the availability of an installed DataContentHandler - * object corresponding to the MIME type of the data represented in - * the specific instance of the DataHandler.

- * - * DataHandler and CommandMaps

- * The DataHandler keeps track of the current CommandMap that it uses to - * service requests for commands ({@code getCommand, getAllCommands, - * getPreferredCommands}). - * Each instance of a DataHandler may have a CommandMap associated with - * it using the {@code setCommandMap} method. If a CommandMap was - * not set, DataHandler calls the {@code getDefaultCommandMap} - * method in CommandMap and uses the value it returns. See - * CommandMap for more information.

- * - * DataHandler and URLs

- * The current DataHandler implementation creates a private - * instance of URLDataSource when it is constructed with a URL. - * - * @see javax.activation.CommandMap - * @see javax.activation.DataContentHandler - * @see javax.activation.DataSource - * @see javax.activation.URLDataSource - * - * @since 1.6 - */ - -public class DataHandler implements Transferable { - - // Use the datasource to indicate whether we were started via the - // DataSource constructor or the object constructor. - private DataSource dataSource = null; - private DataSource objDataSource = null; - - // The Object and mimetype from the constructor (if passed in). - // object remains null if it was instantiated with a - // DataSource. - private Object object = null; - private String objectMimeType = null; - - // Keep track of the CommandMap - private CommandMap currentCommandMap = null; - - // our transfer flavors - private static final DataFlavor emptyFlavors[] = new DataFlavor[0]; - private DataFlavor transferFlavors[] = emptyFlavors; - - // our DataContentHandler - private DataContentHandler dataContentHandler = null; - private DataContentHandler factoryDCH = null; - - // our DataContentHandlerFactory - private static DataContentHandlerFactory factory = null; - private DataContentHandlerFactory oldFactory = null; - // the short representation of the ContentType (sans params) - private String shortType = null; - - /** - * Create a {@code DataHandler} instance referencing the - * specified DataSource. The data exists in a byte stream form. - * The DataSource will provide an InputStream to access the data. - * - * @param ds the DataSource - */ - public DataHandler(DataSource ds) { - // save a reference to the incoming DS - dataSource = ds; - oldFactory = factory; // keep track of the factory - } - - /** - * Create a {@code DataHandler} instance representing an object - * of this MIME type. This constructor is - * used when the application already has an in-memory representation - * of the data in the form of a Java Object. - * - * @param obj the Java Object - * @param mimeType the MIME type of the object - */ - public DataHandler(Object obj, String mimeType) { - object = obj; - objectMimeType = mimeType; - oldFactory = factory; // keep track of the factory - } - - /** - * Create a {@code DataHandler} instance referencing a URL. - * The DataHandler internally creates a {@code URLDataSource} - * instance to represent the URL. - * - * @param url a URL object - */ - public DataHandler(URL url) { - dataSource = new URLDataSource(url); - oldFactory = factory; // keep track of the factory - } - - /** - * Return the CommandMap for this instance of DataHandler. - */ - private synchronized CommandMap getCommandMap() { - if (currentCommandMap != null) - return currentCommandMap; - else - return CommandMap.getDefaultCommandMap(); - } - - /** - * Return the DataSource associated with this instance - * of DataHandler. - *

- * For DataHandlers that have been instantiated with a DataSource, - * this method returns the DataSource that was used to create the - * DataHandler object. In other cases the DataHandler - * constructs a DataSource from the data used to construct - * the DataHandler. DataSources created for DataHandlers not - * instantiated with a DataSource are cached for performance - * reasons. - * - * @return a valid DataSource object for this DataHandler - */ - public DataSource getDataSource() { - if (dataSource == null) { - // create one on the fly - if (objDataSource == null) - objDataSource = new DataHandlerDataSource(this); - return objDataSource; - } - return dataSource; - } - - /** - * Return the name of the data object. If this DataHandler - * was created with a DataSource, this method calls through - * to the {@code DataSource.getName} method, otherwise it - * returns null. - * - * @return the name of the object - */ - public String getName() { - if (dataSource != null) - return dataSource.getName(); - else - return null; - } - - /** - * Return the MIME type of this object as retrieved from - * the source object. Note that this is the full - * type with parameters. - * - * @return the MIME type - */ - public String getContentType() { - if (dataSource != null) // data source case - return dataSource.getContentType(); - else - return objectMimeType; // obj/type case - } - - /** - * Get the InputStream for this object.

- * - * For DataHandlers instantiated with a DataSource, the DataHandler - * calls the {@code DataSource.getInputStream} method and - * returns the result to the caller. - *

- * For DataHandlers instantiated with an Object, the DataHandler - * first attempts to find a DataContentHandler for the Object. If - * the DataHandler can not find a DataContentHandler for this MIME - * type, it throws an UnsupportedDataTypeException. If it is - * successful, it creates a pipe and a thread. The thread uses the - * DataContentHandler's {@code writeTo} method to write the - * stream data into one end of the pipe. The other end of the pipe - * is returned to the caller. Because a thread is created to copy - * the data, IOExceptions that may occur during the copy can not be - * propagated back to the caller. The result is an empty stream. - * - * @return the InputStream representing this data - * @exception IOException if an I/O error occurs - * - * @see javax.activation.DataContentHandler#writeTo - * @see javax.activation.UnsupportedDataTypeException - */ - public InputStream getInputStream() throws IOException { - InputStream ins = null; - - if (dataSource != null) { - ins = dataSource.getInputStream(); - } else { - DataContentHandler dch = getDataContentHandler(); - // we won't even try if we can't get a dch - if (dch == null) - throw new UnsupportedDataTypeException( - "no DCH for MIME type " + getBaseType()); - - if (dch instanceof ObjectDataContentHandler) { - if (((ObjectDataContentHandler)dch).getDCH() == null) - throw new UnsupportedDataTypeException( - "no object DCH for MIME type " + getBaseType()); - } - // there is none but the default^^^^^^^^^^^^^^^^ - final DataContentHandler fdch = dch; - - // from bill s. - // ce n'est pas une pipe! - // - // NOTE: This block of code needs to throw exceptions, but - // can't because it is in another thread!!! ARG! - // - final PipedOutputStream pos = new PipedOutputStream(); - PipedInputStream pin = new PipedInputStream(pos); - new Thread( - new Runnable() { - public void run() { - try { - fdch.writeTo(object, objectMimeType, pos); - } catch (IOException e) { - - } finally { - try { - pos.close(); - } catch (IOException ie) { } - } - } - }, - "DataHandler.getInputStream").start(); - ins = pin; - } - - return ins; - } - - /** - * Write the data to an {@code OutputStream}.

- * - * If the DataHandler was created with a DataSource, writeTo - * retrieves the InputStream and copies the bytes from the - * InputStream to the OutputStream passed in. - *

- * If the DataHandler was created with an object, writeTo - * retrieves the DataContentHandler for the object's type. - * If the DataContentHandler was found, it calls the - * {@code writeTo} method on the {@code DataContentHandler}. - * - * @param os the OutputStream to write to - * @exception IOException if an I/O error occurs - */ - public void writeTo(OutputStream os) throws IOException { - // for the DataSource case - if (dataSource != null) { - InputStream is = null; - byte data[] = new byte[8*1024]; - int bytes_read; - - is = dataSource.getInputStream(); - - try { - while ((bytes_read = is.read(data)) > 0) { - os.write(data, 0, bytes_read); - } - } finally { - is.close(); - is = null; - } - } else { // for the Object case - DataContentHandler dch = getDataContentHandler(); - dch.writeTo(object, objectMimeType, os); - } - } - - /** - * Get an OutputStream for this DataHandler to allow overwriting - * the underlying data. - * If the DataHandler was created with a DataSource, the - * DataSource's {@code getOutputStream} method is called. - * Otherwise, {@code null} is returned. - * - * @return the OutputStream - * @exception IOException for failures creating the OutputStream - * - * @see javax.activation.DataSource#getOutputStream - * @see javax.activation.URLDataSource - */ - public OutputStream getOutputStream() throws IOException { - if (dataSource != null) - return dataSource.getOutputStream(); - else - return null; - } - - /** - * Return the DataFlavors in which this data is available.

- * - * Returns an array of DataFlavor objects indicating the flavors - * the data can be provided in. The array is usually ordered - * according to preference for providing the data, from most - * richly descriptive to least richly descriptive.

- * - * The DataHandler attempts to find a DataContentHandler that - * corresponds to the MIME type of the data. If one is located, - * the DataHandler calls the DataContentHandler's - * {@code getTransferDataFlavors} method.

- * - * If a DataContentHandler can not be located, and if the - * DataHandler was created with a DataSource (or URL), one - * DataFlavor is returned that represents this object's MIME type - * and the {@code java.io.InputStream} class. If the - * DataHandler was created with an object and a MIME type, - * getTransferDataFlavors returns one DataFlavor that represents - * this object's MIME type and the object's class. - * - * @return an array of data flavors in which this data can be transferred - * @see javax.activation.DataContentHandler#getTransferDataFlavors - */ - public synchronized DataFlavor[] getTransferDataFlavors() { - if (factory != oldFactory) // if the factory has changed, clear cache - transferFlavors = emptyFlavors; - - // if it's not set, set it... - if (transferFlavors == emptyFlavors) - transferFlavors = getDataContentHandler().getTransferDataFlavors(); - - if (transferFlavors == emptyFlavors) - return transferFlavors; - else - return transferFlavors.clone(); - - } - - /** - * Returns whether the specified data flavor is supported - * for this object.

- * - * This method iterates through the DataFlavors returned from - * {@code getTransferDataFlavors}, comparing each with - * the specified flavor. - * - * @param flavor the requested flavor for the data - * @return true if the data flavor is supported - * @see javax.activation.DataHandler#getTransferDataFlavors - */ - public boolean isDataFlavorSupported(DataFlavor flavor) { - DataFlavor[] lFlavors = getTransferDataFlavors(); - - for (int i = 0; i < lFlavors.length; i++) { - if (lFlavors[i].equals(flavor)) - return true; - } - return false; - } - - /** - * Returns an object that represents the data to be - * transferred. The class of the object returned is defined by the - * representation class of the data flavor.

- * - * For DataHandler's created with DataSources or URLs:

- * - * The DataHandler attempts to locate a DataContentHandler - * for this MIME type. If one is found, the passed in DataFlavor - * and the type of the data are passed to its {@code getTransferData} - * method. If the DataHandler fails to locate a DataContentHandler - * and the flavor specifies this object's MIME type and the - * {@code java.io.InputStream} class, this object's InputStream - * is returned. - * Otherwise it throws an UnsupportedFlavorException.

- * - * For DataHandler's created with Objects:

- * - * The DataHandler attempts to locate a DataContentHandler - * for this MIME type. If one is found, the passed in DataFlavor - * and the type of the data are passed to its getTransferData - * method. If the DataHandler fails to locate a DataContentHandler - * and the flavor specifies this object's MIME type and its class, - * this DataHandler's referenced object is returned. - * Otherwise it throws an UnsupportedFlavorException. - * - * @param flavor the requested flavor for the data - * @return the object - * @exception UnsupportedFlavorException if the data could not be - * converted to the requested flavor - * @exception IOException if an I/O error occurs - * @see javax.activation.ActivationDataFlavor - */ - public Object getTransferData(DataFlavor flavor) - throws UnsupportedFlavorException, IOException { - return getDataContentHandler().getTransferData(flavor, dataSource); - } - - /** - * Set the CommandMap for use by this DataHandler. - * Setting it to {@code null} causes the CommandMap to revert - * to the CommandMap returned by the - * {@code CommandMap.getDefaultCommandMap} method. - * Changing the CommandMap, or setting it to {@code null}, - * clears out any data cached from the previous CommandMap. - * - * @param commandMap the CommandMap to use in this DataHandler - * - * @see javax.activation.CommandMap#setDefaultCommandMap - */ - public synchronized void setCommandMap(CommandMap commandMap) { - if (commandMap != currentCommandMap || commandMap == null) { - // clear cached values... - transferFlavors = emptyFlavors; - dataContentHandler = null; - - currentCommandMap = commandMap; - } - } - - /** - * Return the preferred commands for this type of data. - * This method calls the {@code getPreferredCommands} method - * in the CommandMap associated with this instance of DataHandler. - * This method returns an array that represents a subset of - * available commands. In cases where multiple commands for the - * MIME type represented by this DataHandler are present, the - * installed CommandMap chooses the appropriate commands. - * - * @return the CommandInfo objects representing the preferred commands - * - * @see javax.activation.CommandMap#getPreferredCommands - */ - public CommandInfo[] getPreferredCommands() { - if (dataSource != null) - return getCommandMap().getPreferredCommands(getBaseType(), - dataSource); - else - return getCommandMap().getPreferredCommands(getBaseType()); - } - - /** - * Return all the commands for this type of data. - * This method returns an array containing all commands - * for the type of data represented by this DataHandler. The - * MIME type for the underlying data represented by this DataHandler - * is used to call through to the {@code getAllCommands} method - * of the CommandMap associated with this DataHandler. - * - * @return the CommandInfo objects representing all the commands - * - * @see javax.activation.CommandMap#getAllCommands - */ - public CommandInfo[] getAllCommands() { - if (dataSource != null) - return getCommandMap().getAllCommands(getBaseType(), dataSource); - else - return getCommandMap().getAllCommands(getBaseType()); - } - - /** - * Get the command cmdName. Use the search semantics as - * defined by the CommandMap installed in this DataHandler. The - * MIME type for the underlying data represented by this DataHandler - * is used to call through to the {@code getCommand} method - * of the CommandMap associated with this DataHandler. - * - * @param cmdName the command name - * @return the CommandInfo corresponding to the command - * - * @see javax.activation.CommandMap#getCommand - */ - public CommandInfo getCommand(String cmdName) { - if (dataSource != null) - return getCommandMap().getCommand(getBaseType(), cmdName, - dataSource); - else - return getCommandMap().getCommand(getBaseType(), cmdName); - } - - /** - * Return the data in its preferred Object form.

- * - * If the DataHandler was instantiated with an object, return - * the object.

- * - * If the DataHandler was instantiated with a DataSource, - * this method uses a DataContentHandler to return the content - * object for the data represented by this DataHandler. If no - * {@code DataContentHandler} can be found for the - * the type of this data, the DataHandler returns an - * InputStream for the data. - * - * @return the content. - * @exception IOException if an IOException occurs during - * this operation. - */ - public Object getContent() throws IOException { - if (object != null) - return object; - else - return getDataContentHandler().getContent(getDataSource()); - } - - /** - * A convenience method that takes a CommandInfo object - * and instantiates the corresponding command, usually - * a JavaBean component. - *

- * This method calls the CommandInfo's {@code getCommandObject} - * method with the {@code ClassLoader} used to load - * the {@code javax.activation.DataHandler} class itself. - * - * @param cmdinfo the CommandInfo corresponding to a command - * @return the instantiated command object - */ - public Object getBean(CommandInfo cmdinfo) { - Object bean = null; - - try { - // make the bean - ClassLoader cld = null; - // First try the "application's" class loader. - cld = SecuritySupport.getContextClassLoader(); - if (cld == null) - cld = this.getClass().getClassLoader(); - bean = cmdinfo.getCommandObject(this, cld); - } catch (IOException e) { - } catch (ClassNotFoundException e) { } - - return bean; - } - - /** - * Get the DataContentHandler for this DataHandler:

- * - * If a DataContentHandlerFactory is set, use it. - * Otherwise look for an object to serve DCH in the - * following order:

- * - * 1) if a factory is set, use it

- * 2) if a CommandMap is set, use it

- * 3) use the default CommandMap

- * - * In any case, wrap the real DataContentHandler with one of our own - * to handle any missing cases, fill in defaults, and to ensure that - * we always have a non-null DataContentHandler. - * - * @return the requested DataContentHandler - */ - private synchronized DataContentHandler getDataContentHandler() { - - // make sure the factory didn't change - if (factory != oldFactory) { - oldFactory = factory; - factoryDCH = null; - dataContentHandler = null; - transferFlavors = emptyFlavors; - } - - if (dataContentHandler != null) - return dataContentHandler; - - String simpleMT = getBaseType(); - - if (factoryDCH == null && factory != null) - factoryDCH = factory.createDataContentHandler(simpleMT); - - if (factoryDCH != null) - dataContentHandler = factoryDCH; - - if (dataContentHandler == null) { - if (dataSource != null) - dataContentHandler = getCommandMap(). - createDataContentHandler(simpleMT, dataSource); - else - dataContentHandler = getCommandMap(). - createDataContentHandler(simpleMT); - } - - // getDataContentHandler always uses these 'wrapper' handlers - // to make sure it returns SOMETHING meaningful... - if (dataSource != null) - dataContentHandler = new DataSourceDataContentHandler( - dataContentHandler, - dataSource); - else - dataContentHandler = new ObjectDataContentHandler( - dataContentHandler, - object, - objectMimeType); - return dataContentHandler; - } - - /** - * Use the MimeType class to extract the MIME type/subtype, - * ignoring the parameters. The type is cached. - */ - private synchronized String getBaseType() { - if (shortType == null) { - String ct = getContentType(); - try { - MimeType mt = new MimeType(ct); - shortType = mt.getBaseType(); - } catch (MimeTypeParseException e) { - shortType = ct; - } - } - return shortType; - } - - /** - * Sets the DataContentHandlerFactory. The DataContentHandlerFactory - * is called first to find DataContentHandlers. - * The DataContentHandlerFactory can only be set once. - *

- * If the DataContentHandlerFactory has already been set, - * this method throws an Error. - * - * @param newFactory the DataContentHandlerFactory - * @exception Error if the factory has already been defined. - * - * @see javax.activation.DataContentHandlerFactory - */ - public static synchronized void setDataContentHandlerFactory( - DataContentHandlerFactory newFactory) { - if (factory != null) - throw new Error("DataContentHandlerFactory already defined"); - - SecurityManager security = System.getSecurityManager(); - if (security != null) { - try { - // if it's ok with the SecurityManager, it's ok with me... - security.checkSetFactory(); - } catch (SecurityException ex) { - // otherwise, we also allow it if this code and the - // factory come from the same class loader (e.g., - // the JAF classes were loaded with the applet classes). - if (DataHandler.class.getClassLoader() != - newFactory.getClass().getClassLoader()) - throw ex; - } - } - factory = newFactory; - } -} - -/** - * The DataHanderDataSource class implements the - * DataSource interface when the DataHandler is constructed - * with an Object and a mimeType string. - */ -class DataHandlerDataSource implements DataSource { - DataHandler dataHandler = null; - - /** - * The constructor. - */ - public DataHandlerDataSource(DataHandler dh) { - this.dataHandler = dh; - } - - /** - * Returns an {@code InputStream} representing this object. - * @return the {@code InputStream} - */ - public InputStream getInputStream() throws IOException { - return dataHandler.getInputStream(); - } - - /** - * Returns the {@code OutputStream} for this object. - * @return the {@code OutputStream} - */ - public OutputStream getOutputStream() throws IOException { - return dataHandler.getOutputStream(); - } - - /** - * Returns the MIME type of the data represented by this object. - * @return the MIME type - */ - public String getContentType() { - return dataHandler.getContentType(); - } - - /** - * Returns the name of this object. - * @return the name of this object - */ - public String getName() { - return dataHandler.getName(); // what else would it be? - } -} - -/* - * DataSourceDataContentHandler - * - * This is a private DataContentHandler that wraps the real - * DataContentHandler in the case where the DataHandler was instantiated - * with a DataSource. - */ -class DataSourceDataContentHandler implements DataContentHandler { - private DataSource ds = null; - private DataFlavor transferFlavors[] = null; - private DataContentHandler dch = null; - - /** - * The constructor. - */ - public DataSourceDataContentHandler(DataContentHandler dch, DataSource ds) { - this.ds = ds; - this.dch = dch; - } - - /** - * Return the DataFlavors for this {@code DataContentHandler}. - * @return the DataFlavors - */ - public DataFlavor[] getTransferDataFlavors() { - - if (transferFlavors == null) { - if (dch != null) { // is there a dch? - transferFlavors = dch.getTransferDataFlavors(); - } else { - transferFlavors = new DataFlavor[1]; - transferFlavors[0] = - new ActivationDataFlavor(ds.getContentType(), - ds.getContentType()); - } - } - return transferFlavors; - } - - /** - * Return the Transfer Data of type DataFlavor from InputStream. - * @param df the DataFlavor - * @param ds the DataSource - * @return the constructed Object - */ - public Object getTransferData(DataFlavor df, DataSource ds) throws - UnsupportedFlavorException, IOException { - - if (dch != null) - return dch.getTransferData(df, ds); - else if (df.equals(getTransferDataFlavors()[0])) // only have one now - return ds.getInputStream(); - else - throw new UnsupportedFlavorException(df); - } - - public Object getContent(DataSource ds) throws IOException { - - if (dch != null) - return dch.getContent(ds); - else - return ds.getInputStream(); - } - - /** - * Write the object to the output stream. - */ - public void writeTo(Object obj, String mimeType, OutputStream os) - throws IOException { - if (dch != null) - dch.writeTo(obj, mimeType, os); - else - throw new UnsupportedDataTypeException( - "no DCH for content type " + ds.getContentType()); - } -} - -/* - * ObjectDataContentHandler - * - * This is a private DataContentHandler that wraps the real - * DataContentHandler in the case where the DataHandler was instantiated - * with an object. - */ -class ObjectDataContentHandler implements DataContentHandler { - private DataFlavor transferFlavors[] = null; - private Object obj; - private String mimeType; - private DataContentHandler dch = null; - - /** - * The constructor. - */ - public ObjectDataContentHandler(DataContentHandler dch, - Object obj, String mimeType) { - this.obj = obj; - this.mimeType = mimeType; - this.dch = dch; - } - - /** - * Return the DataContentHandler for this object. - * Used only by the DataHandler class. - */ - public DataContentHandler getDCH() { - return dch; - } - - /** - * Return the DataFlavors for this {@code DataContentHandler}. - * @return the DataFlavors - */ - public synchronized DataFlavor[] getTransferDataFlavors() { - if (transferFlavors == null) { - if (dch != null) { - transferFlavors = dch.getTransferDataFlavors(); - } else { - transferFlavors = new DataFlavor[1]; - transferFlavors[0] = new ActivationDataFlavor(obj.getClass(), - mimeType, mimeType); - } - } - return transferFlavors; - } - - /** - * Return the Transfer Data of type DataFlavor from InputStream. - * @param df the DataFlavor - * @param ds the DataSource - * @return the constructed Object - */ - public Object getTransferData(DataFlavor df, DataSource ds) - throws UnsupportedFlavorException, IOException { - - if (dch != null) - return dch.getTransferData(df, ds); - else if (df.equals(getTransferDataFlavors()[0])) // only have one now - return obj; - else - throw new UnsupportedFlavorException(df); - - } - - public Object getContent(DataSource ds) { - return obj; - } - - /** - * Write the object to the output stream. - */ - public void writeTo(Object obj, String mimeType, OutputStream os) - throws IOException { - if (dch != null) - dch.writeTo(obj, mimeType, os); - else if (obj instanceof byte[]) - os.write((byte[])obj); - else if (obj instanceof String) { - OutputStreamWriter osw = new OutputStreamWriter(os); - osw.write((String)obj); - osw.flush(); - } else throw new UnsupportedDataTypeException( - "no object DCH for MIME type " + this.mimeType); - } -} --- old/src/java.activation/share/classes/javax/activation/DataSource.java 2018-01-30 20:16:01.000000000 -0500 +++ /dev/null 2018-01-30 20:16:01.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 javax.activation; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.IOException; - -/** - * The DataSource interface provides the JavaBeans Activation Framework - * with an abstraction of an arbitrary collection of data. It - * provides a type for that data as well as access - * to it in the form of InputStreams and - * OutputStreams where appropriate. - * - * @since 1.6 - */ - -public interface DataSource { - - /** - * This method returns an InputStream representing - * the data and throws the appropriate exception if it can - * not do so. Note that a new InputStream object must be - * returned each time this method is called, and the stream must be - * positioned at the beginning of the data. - * - * @return an InputStream - * @exception IOException for failures creating the InputStream - */ - public InputStream getInputStream() throws IOException; - - /** - * This method returns an OutputStream where the - * data can be written and throws the appropriate exception if it can - * not do so. Note that a new OutputStream object must - * be returned each time this method is called, and the stream must - * be positioned at the location the data is to be written. - * - * @return an OutputStream - * @exception IOException for failures creating the OutputStream - */ - public OutputStream getOutputStream() throws IOException; - - /** - * This method returns the MIME type of the data in the form of a - * string. It should always return a valid type. It is suggested - * that getContentType return "application/octet-stream" if the - * DataSource implementation can not determine the data type. - * - * @return the MIME Type - */ - public String getContentType(); - - /** - * Return the name of this object where the name of the object - * is dependant on the nature of the underlying objects. DataSources - * encapsulating files may choose to return the filename of the object. - * (Typically this would be the last component of the filename, not an - * entire pathname.) - * - * @return the name of the object. - */ - public String getName(); -} --- old/src/java.activation/share/classes/javax/activation/FileDataSource.java 2018-01-30 20:16:01.000000000 -0500 +++ /dev/null 2018-01-30 20:16:01.000000000 -0500 @@ -1,158 +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 javax.activation; - -import java.io.InputStream; -import java.io.OutputStream; -import java.io.File; -import java.io.FileDescriptor; -import java.io.FileNotFoundException; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import com.sun.activation.registries.MimeTypeFile; - -/** - * The FileDataSource class implements a simple DataSource object - * that encapsulates a file. It provides data typing services via - * a FileTypeMap object.

- * - * FileDataSource Typing Semantics

- * - * The FileDataSource class delegates data typing of files - * to an object subclassed from the FileTypeMap class. - * The setFileTypeMap method can be used to explicitly - * set the FileTypeMap for an instance of FileDataSource. If no - * FileTypeMap is set, the FileDataSource will call the FileTypeMap's - * getDefaultFileTypeMap method to get the System's default FileTypeMap. - * - * @see javax.activation.DataSource - * @see javax.activation.FileTypeMap - * @see javax.activation.MimetypesFileTypeMap - * - * @since 1.6 - */ -public class FileDataSource implements DataSource { - - // keep track of original 'ref' passed in, non-null - // one indicated which was passed in: - private File _file = null; - private FileTypeMap typeMap = null; - - /** - * Creates a FileDataSource from a File object. Note: - * The file will not actually be opened until a method is - * called that requires the file to be opened. - * - * @param file the file - */ - public FileDataSource(File file) { - _file = file; // save the file Object... - } - - /** - * Creates a FileDataSource from - * the specified path name. Note: - * The file will not actually be opened until a method is - * called that requires the file to be opened. - * - * @param name the system-dependent file name. - */ - public FileDataSource(String name) { - this(new File(name)); // use the file constructor - } - - /** - * This method will return an InputStream representing the - * the data and will throw an IOException if it can - * not do so. This method will return a new - * instance of InputStream with each invocation. - * - * @return an InputStream - */ - public InputStream getInputStream() throws IOException { - return new FileInputStream(_file); - } - - /** - * This method will return an OutputStream representing the - * the data and will throw an IOException if it can - * not do so. This method will return a new instance of - * OutputStream with each invocation. - * - * @return an OutputStream - */ - public OutputStream getOutputStream() throws IOException { - return new FileOutputStream(_file); - } - - /** - * This method returns the MIME type of the data in the form of a - * string. This method uses the currently installed FileTypeMap. If - * there is no FileTypeMap explictly set, the FileDataSource will - * call the getDefaultFileTypeMap method on - * FileTypeMap to acquire a default FileTypeMap. Note: By - * default, the FileTypeMap used will be a MimetypesFileTypeMap. - * - * @return the MIME Type - * @see javax.activation.FileTypeMap#getDefaultFileTypeMap - */ - public String getContentType() { - // check to see if the type map is null? - if (typeMap == null) - return FileTypeMap.getDefaultFileTypeMap().getContentType(_file); - else - return typeMap.getContentType(_file); - } - - /** - * Return the name of this object. The FileDataSource - * will return the file name of the object. - * - * @return the name of the object. - * @see javax.activation.DataSource - */ - public String getName() { - return _file.getName(); - } - - /** - * Return the File object that corresponds to this FileDataSource. - * @return the File object for the file represented by this object. - */ - public File getFile() { - return _file; - } - - /** - * Set the FileTypeMap to use with this FileDataSource - * - * @param map The FileTypeMap for this object. - */ - public void setFileTypeMap(FileTypeMap map) { - typeMap = map; - } -} --- old/src/java.activation/share/classes/javax/activation/FileTypeMap.java 2018-01-30 20:16:02.000000000 -0500 +++ /dev/null 2018-01-30 20:16:02.000000000 -0500 @@ -1,132 +0,0 @@ -/* - * 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 javax.activation; - -import java.io.File; -import java.util.Map; -import java.util.WeakHashMap; - -/** - * The FileTypeMap is an abstract class that provides a data typing - * interface for files. Implementations of this class will - * implement the getContentType methods which will derive a content - * type from a file name or a File object. FileTypeMaps could use any - * scheme to determine the data type, from examining the file extension - * of a file (like the MimetypesFileTypeMap) to opening the file and - * trying to derive its type from the contents of the file. The - * FileDataSource class uses the default FileTypeMap (a MimetypesFileTypeMap - * unless changed) to determine the content type of files. - * - * @see javax.activation.FileTypeMap - * @see javax.activation.FileDataSource - * @see javax.activation.MimetypesFileTypeMap - * - * @since 1.6 - */ - -public abstract class FileTypeMap { - - private static FileTypeMap defaultMap = null; - private static Map map = - new WeakHashMap(); - - /** - * The default constructor. - */ - public FileTypeMap() { - super(); - } - - /** - * Return the type of the file object. This method should - * always return a valid MIME type. - * - * @param file A file to be typed. - * @return The content type. - */ - abstract public String getContentType(File file); - - /** - * Return the type of the file passed in. This method should - * always return a valid MIME type. - * - * @param filename the pathname of the file. - * @return The content type. - */ - abstract public String getContentType(String filename); - - /** - * Sets the default FileTypeMap for the system. This instance - * will be returned to callers of getDefaultFileTypeMap. - * - * @param fileTypeMap The FileTypeMap. - * @exception SecurityException if the caller doesn't have permission - * to change the default - */ - public static synchronized void setDefaultFileTypeMap(FileTypeMap fileTypeMap) { - SecurityManager security = System.getSecurityManager(); - if (security != null) { - try { - // if it's ok with the SecurityManager, it's ok with me... - security.checkSetFactory(); - } catch (SecurityException ex) { - // otherwise, we also allow it if this code and the - // factory come from the same (non-system) class loader (e.g., - // the JAF classes were loaded with the applet classes). - ClassLoader cl = FileTypeMap.class.getClassLoader(); - if (cl == null || cl.getParent() == null || - cl != fileTypeMap.getClass().getClassLoader()) - throw ex; - } - } - // remove any per-thread-context-class-loader FileTypeMap - map.remove(SecuritySupport.getContextClassLoader()); - defaultMap = fileTypeMap; - } - - /** - * Return the default FileTypeMap for the system. - * If setDefaultFileTypeMap was called, return - * that instance, otherwise return an instance of - * MimetypesFileTypeMap. - * - * @return The default FileTypeMap - * @see javax.activation.FileTypeMap#setDefaultFileTypeMap - */ - public static synchronized FileTypeMap getDefaultFileTypeMap() { - if (defaultMap != null) - return defaultMap; - - // fetch per-thread-context-class-loader default - ClassLoader tccl = SecuritySupport.getContextClassLoader(); - FileTypeMap def = map.get(tccl); - if (def == null) { - def = new MimetypesFileTypeMap(); - map.put(tccl, def); - } - return def; - } -} --- old/src/java.activation/share/classes/javax/activation/MailcapCommandMap.java 2018-01-30 20:16:03.000000000 -0500 +++ /dev/null 2018-01-30 20:16:03.000000000 -0500 @@ -1,721 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 javax.activation; - -import java.util.*; -import java.io.*; -import java.net.*; -import java.security.AccessController; -import java.security.PrivilegedAction; -import com.sun.activation.registries.MailcapFile; -import com.sun.activation.registries.LogSupport; - -/** - * MailcapCommandMap extends the CommandMap - * abstract class. It implements a CommandMap whose configuration - * is based on mailcap files - * (RFC 1524). - * The MailcapCommandMap can be configured both programmatically - * and via configuration files. - *

- * Mailcap file search order:

- * The MailcapCommandMap looks in various places in the user's - * system for mailcap file entries. When requests are made - * to search for commands in the MailcapCommandMap, it searches - * mailcap files in the following order: - *

    - *
  1. Programatically added entries to the MailcapCommandMap instance. - *
  2. The file {@code .mailcap} in the user's home directory. - *
  3. The file {@code mailcap} in the Java runtime. - *
  4. The file or resources named {@code META-INF/mailcap}. - *
  5. The file or resource named {@code META-INF/mailcap.default} - * (usually found only in the {@code activation.jar} file). - *
- *

- * (The current implementation looks for the {@code mailcap} file - * in the Java runtime in the directory java.home{@code /conf} - * if it exists, and otherwise in the directory - * java.home{@code /lib}, where java.home is the value - * of the "java.home" System property. Note that the "conf" directory was - * introduced in JDK 9.) - *

- * Mailcap file format:

- * - * Mailcap files must conform to the mailcap - * file specification (RFC 1524, A User Agent Configuration Mechanism - * For Multimedia Mail Format Information). - * The file format consists of entries corresponding to - * particular MIME types. In general, the specification - * specifies applications for clients to use when they - * themselves cannot operate on the specified MIME type. The - * MailcapCommandMap extends this specification by using a parameter mechanism - * in mailcap files that allows JavaBeans(tm) components to be specified as - * corresponding to particular commands for a MIME type.

- * - * When a mailcap file is - * parsed, the MailcapCommandMap recognizes certain parameter signatures, - * specifically those parameter names that begin with {@code x-java-}. - * The MailcapCommandMap uses this signature to find - * command entries for inclusion into its registries. - * Parameter names with the form {@code x-java-} - * are read by the MailcapCommandMap as identifying a command - * with the name name. When the name is {@code - * content-handler} the MailcapCommandMap recognizes the class - * signified by this parameter as a DataContentHandler. - * All other commands are handled generically regardless of command - * name. The command implementation is specified by a fully qualified - * class name of a JavaBean(tm) component. For example; a command for viewing - * some data can be specified as: {@code x-java-view=com.foo.ViewBean}.

- * - * When the command name is {@code fallback-entry}, the value of - * the command may be {@code true} or {@code false}. An - * entry for a MIME type that includes a parameter of - * {@code x-java-fallback-entry=true} defines fallback commands - * for that MIME type that will only be used if no non-fallback entry - * can be found. For example, an entry of the form {@code text/*; ; - * x-java-fallback-entry=true; x-java-view=com.sun.TextViewer} - * specifies a view command to be used for any text MIME type. This - * view command would only be used if a non-fallback view command for - * the MIME type could not be found.

- * - * MailcapCommandMap aware mailcap files have the - * following general form: - *

{@code
- * # Comments begin with a '#' and continue to the end of the line.
- * ; ; 
- * # Where a parameter list consists of one or more parameters,
- * # where parameters look like: x-java-view=com.sun.TextViewer
- * # and a parameter list looks like:
- * text/plain; ; x-java-view=com.sun.TextViewer; x-java-edit=com.sun.TextEdit
- * # Note that mailcap entries that do not contain 'x-java' parameters
- * # and comply to RFC 1524 are simply ignored:
- * image/gif; /usr/dt/bin/sdtimage %s
- * }
- * - * @author Bart Calder - * @author Bill Shannon - * - * @since 1.6 - */ - -public class MailcapCommandMap extends CommandMap { - /* - * We manage a collection of databases, searched in order. - */ - private MailcapFile[] DB; - private static final int PROG = 0; // programmatically added entries - - private static final String confDir; - - static { - String dir = null; - try { - dir = (String)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - String home = System.getProperty("java.home"); - String newdir = home + File.separator + "conf"; - File conf = new File(newdir); - if (conf.exists()) - return newdir + File.separator; - else - return home + File.separator + "lib" + File.separator; - } - }); - } catch (Exception ex) { - // ignore any exceptions - } - confDir = dir; - } - - /** - * The default Constructor. - */ - public MailcapCommandMap() { - super(); - List dbv = new ArrayList(5); // usually 5 or less databases - MailcapFile mf = null; - dbv.add(null); // place holder for PROG entry - - LogSupport.log("MailcapCommandMap: load HOME"); - try { - String user_home = System.getProperty("user.home"); - - if (user_home != null) { - String path = user_home + File.separator + ".mailcap"; - mf = loadFile(path); - if (mf != null) - dbv.add(mf); - } - } catch (SecurityException ex) {} - - LogSupport.log("MailcapCommandMap: load SYS"); - try { - // check system's home - if (confDir != null) { - mf = loadFile(confDir + "mailcap"); - if (mf != null) - dbv.add(mf); - } - } catch (SecurityException ex) {} - - LogSupport.log("MailcapCommandMap: load JAR"); - // load from the app's jar file - loadAllResources(dbv, "META-INF/mailcap"); - - LogSupport.log("MailcapCommandMap: load DEF"); - mf = loadResource("/META-INF/mailcap.default"); - - if (mf != null) - dbv.add(mf); - - DB = new MailcapFile[dbv.size()]; - DB = (MailcapFile[])dbv.toArray(DB); - } - - /** - * Load from the named resource. - */ - private MailcapFile loadResource(String name) { - InputStream clis = null; - try { - clis = SecuritySupport.getResourceAsStream(this.getClass(), name); - if (clis != null) { - MailcapFile mf = new MailcapFile(clis); - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: successfully loaded " + - "mailcap file: " + name); - return mf; - } else { - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: not loading " + - "mailcap file: " + name); - } - } catch (IOException e) { - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: can't load " + name, e); - } catch (SecurityException sex) { - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: can't load " + name, sex); - } finally { - try { - if (clis != null) - clis.close(); - } catch (IOException ex) { } // ignore it - } - return null; - } - - /** - * Load all of the named resource. - */ - private void loadAllResources(List v, String name) { - boolean anyLoaded = false; - try { - URL[] urls; - ClassLoader cld = null; - // First try the "application's" class loader. - cld = SecuritySupport.getContextClassLoader(); - if (cld == null) - cld = this.getClass().getClassLoader(); - if (cld != null) - urls = SecuritySupport.getResources(cld, name); - else - urls = SecuritySupport.getSystemResources(name); - if (urls != null) { - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: getResources"); - for (int i = 0; i < urls.length; i++) { - URL url = urls[i]; - InputStream clis = null; - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: URL " + url); - try { - clis = SecuritySupport.openStream(url); - if (clis != null) { - v.add(new MailcapFile(clis)); - anyLoaded = true; - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: " + - "successfully loaded " + - "mailcap file from URL: " + - url); - } else { - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: " + - "not loading mailcap " + - "file from URL: " + url); - } - } catch (IOException ioex) { - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: can't load " + - url, ioex); - } catch (SecurityException sex) { - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: can't load " + - url, sex); - } finally { - try { - if (clis != null) - clis.close(); - } catch (IOException cex) { } - } - } - } - } catch (Exception ex) { - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: can't load " + name, ex); - } - - // if failed to load anything, fall back to old technique, just in case - if (!anyLoaded) { - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: !anyLoaded"); - MailcapFile mf = loadResource("/" + name); - if (mf != null) - v.add(mf); - } - } - - /** - * Load from the named file. - */ - private MailcapFile loadFile(String name) { - MailcapFile mtf = null; - - try { - mtf = new MailcapFile(name); - } catch (IOException e) { - // e.printStackTrace(); - } - return mtf; - } - - /** - * Constructor that allows the caller to specify the path - * of a mailcap file. - * - * @param fileName The name of the mailcap file to open - * @exception IOException if the file can't be accessed - */ - public MailcapCommandMap(String fileName) throws IOException { - this(); - - if (LogSupport.isLoggable()) - LogSupport.log("MailcapCommandMap: load PROG from " + fileName); - if (DB[PROG] == null) { - DB[PROG] = new MailcapFile(fileName); - } - } - - - /** - * Constructor that allows the caller to specify an InputStream - * containing a mailcap file. - * - * @param is InputStream of the mailcap file to open - */ - public MailcapCommandMap(InputStream is) { - this(); - - LogSupport.log("MailcapCommandMap: load PROG"); - if (DB[PROG] == null) { - try { - DB[PROG] = new MailcapFile(is); - } catch (IOException ex) { - // XXX - should throw it - } - } - } - - /** - * Get the preferred command list for a MIME Type. The MailcapCommandMap - * searches the mailcap files as described above under - * Mailcap file search order.

- * - * The result of the search is a proper subset of available - * commands in all mailcap files known to this instance of - * MailcapCommandMap. The first entry for a particular command - * is considered the preferred command. - * - * @param mimeType the MIME type - * @return the CommandInfo objects representing the preferred commands. - */ - public synchronized CommandInfo[] getPreferredCommands(String mimeType) { - List cmdList = new ArrayList(); - if (mimeType != null) - mimeType = mimeType.toLowerCase(Locale.ENGLISH); - - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - Map cmdMap = DB[i].getMailcapList(mimeType); - if (cmdMap != null) - appendPrefCmdsToList(cmdMap, cmdList); - } - - // now add the fallback commands - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - Map cmdMap = DB[i].getMailcapFallbackList(mimeType); - if (cmdMap != null) - appendPrefCmdsToList(cmdMap, cmdList); - } - - CommandInfo[] cmdInfos = new CommandInfo[cmdList.size()]; - cmdInfos = (CommandInfo[])cmdList.toArray(cmdInfos); - - return cmdInfos; - } - - /** - * Put the commands that are in the hash table, into the list. - */ - private void appendPrefCmdsToList(Map cmdHash, List cmdList) { - Iterator verb_enum = cmdHash.keySet().iterator(); - - while (verb_enum.hasNext()) { - String verb = (String)verb_enum.next(); - if (!checkForVerb(cmdList, verb)) { - List cmdList2 = (List)cmdHash.get(verb); // get the list - String className = (String)cmdList2.get(0); - cmdList.add(new CommandInfo(verb, className)); - } - } - } - - /** - * Check the cmdList to see if this command exists, return - * true if the verb is there. - */ - private boolean checkForVerb(List cmdList, String verb) { - Iterator ee = cmdList.iterator(); - while (ee.hasNext()) { - String enum_verb = - (String)((CommandInfo)ee.next()).getCommandName(); - if (enum_verb.equals(verb)) - return true; - } - return false; - } - - /** - * Get all the available commands in all mailcap files known to - * this instance of MailcapCommandMap for this MIME type. - * - * @param mimeType the MIME type - * @return the CommandInfo objects representing all the commands. - */ - public synchronized CommandInfo[] getAllCommands(String mimeType) { - List cmdList = new ArrayList(); - if (mimeType != null) - mimeType = mimeType.toLowerCase(Locale.ENGLISH); - - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - Map cmdMap = DB[i].getMailcapList(mimeType); - if (cmdMap != null) - appendCmdsToList(cmdMap, cmdList); - } - - // now add the fallback commands - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - Map cmdMap = DB[i].getMailcapFallbackList(mimeType); - if (cmdMap != null) - appendCmdsToList(cmdMap, cmdList); - } - - CommandInfo[] cmdInfos = new CommandInfo[cmdList.size()]; - cmdInfos = (CommandInfo[])cmdList.toArray(cmdInfos); - - return cmdInfos; - } - - /** - * Put the commands that are in the hash table, into the list. - */ - private void appendCmdsToList(Map typeHash, List cmdList) { - Iterator verb_enum = typeHash.keySet().iterator(); - - while (verb_enum.hasNext()) { - String verb = (String)verb_enum.next(); - List cmdList2 = (List)typeHash.get(verb); - Iterator cmd_enum = ((List)cmdList2).iterator(); - - while (cmd_enum.hasNext()) { - String cmd = (String)cmd_enum.next(); - cmdList.add(new CommandInfo(verb, cmd)); - // cmdList.add(0, new CommandInfo(verb, cmd)); - } - } - } - - /** - * Get the command corresponding to {@code cmdName} for the MIME type. - * - * @param mimeType the MIME type - * @param cmdName the command name - * @return the CommandInfo object corresponding to the command. - */ - public synchronized CommandInfo getCommand(String mimeType, - String cmdName) { - if (mimeType != null) - mimeType = mimeType.toLowerCase(Locale.ENGLISH); - - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - Map cmdMap = DB[i].getMailcapList(mimeType); - if (cmdMap != null) { - // get the cmd list for the cmd - List v = (List)cmdMap.get(cmdName); - if (v != null) { - String cmdClassName = (String)v.get(0); - - if (cmdClassName != null) - return new CommandInfo(cmdName, cmdClassName); - } - } - } - - // now try the fallback list - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - Map cmdMap = DB[i].getMailcapFallbackList(mimeType); - if (cmdMap != null) { - // get the cmd list for the cmd - List v = (List)cmdMap.get(cmdName); - if (v != null) { - String cmdClassName = (String)v.get(0); - - if (cmdClassName != null) - return new CommandInfo(cmdName, cmdClassName); - } - } - } - return null; - } - - /** - * Add entries to the registry. Programmatically - * added entries are searched before other entries.

- * - * The string that is passed in should be in mailcap - * format. - * - * @param mail_cap a correctly formatted mailcap string - */ - public synchronized void addMailcap(String mail_cap) { - // check to see if one exists - LogSupport.log("MailcapCommandMap: add to PROG"); - if (DB[PROG] == null) - DB[PROG] = new MailcapFile(); - - DB[PROG].appendToMailcap(mail_cap); - } - - /** - * Return the DataContentHandler for the specified MIME type. - * - * @param mimeType the MIME type - * @return the DataContentHandler - */ - public synchronized DataContentHandler createDataContentHandler( - String mimeType) { - if (LogSupport.isLoggable()) - LogSupport.log( - "MailcapCommandMap: createDataContentHandler for " + mimeType); - if (mimeType != null) - mimeType = mimeType.toLowerCase(Locale.ENGLISH); - - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - if (LogSupport.isLoggable()) - LogSupport.log(" search DB #" + i); - Map cmdMap = DB[i].getMailcapList(mimeType); - if (cmdMap != null) { - List v = (List)cmdMap.get("content-handler"); - if (v != null) { - String name = (String)v.get(0); - DataContentHandler dch = getDataContentHandler(name); - if (dch != null) - return dch; - } - } - } - - // now try the fallback entries - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - if (LogSupport.isLoggable()) - LogSupport.log(" search fallback DB #" + i); - Map cmdMap = DB[i].getMailcapFallbackList(mimeType); - if (cmdMap != null) { - List v = (List)cmdMap.get("content-handler"); - if (v != null) { - String name = (String)v.get(0); - DataContentHandler dch = getDataContentHandler(name); - if (dch != null) - return dch; - } - } - } - return null; - } - - private DataContentHandler getDataContentHandler(String name) { - if (LogSupport.isLoggable()) - LogSupport.log(" got content-handler"); - if (LogSupport.isLoggable()) - LogSupport.log(" class " + name); - try { - ClassLoader cld = null; - // First try the "application's" class loader. - cld = SecuritySupport.getContextClassLoader(); - if (cld == null) - cld = this.getClass().getClassLoader(); - Class cl = null; - try { - cl = cld.loadClass(name); - } catch (Exception ex) { - // if anything goes wrong, do it the old way - cl = Class.forName(name); - } - return (DataContentHandler) cl.newInstance(); - } catch (IllegalAccessException e) { - if (LogSupport.isLoggable()) - LogSupport.log("Can't load DCH " + name, e); - } catch (ClassNotFoundException e) { - if (LogSupport.isLoggable()) - LogSupport.log("Can't load DCH " + name, e); - } catch (InstantiationException e) { - if (LogSupport.isLoggable()) - LogSupport.log("Can't load DCH " + name, e); - } - return null; - } - - /** - * Get all the MIME types known to this command map. - * - * @return array of MIME types as strings - * @since 1.6, JAF 1.1 - */ - public synchronized String[] getMimeTypes() { - List mtList = new ArrayList(); - - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - String[] ts = DB[i].getMimeTypes(); - if (ts != null) { - for (int j = 0; j < ts.length; j++) { - // eliminate duplicates - if (!mtList.contains(ts[j])) - mtList.add(ts[j]); - } - } - } - - String[] mts = new String[mtList.size()]; - mts = (String[])mtList.toArray(mts); - - return mts; - } - - /** - * Get the native commands for the given MIME type. - * Returns an array of strings where each string is - * an entire mailcap file entry. The application - * will need to parse the entry to extract the actual - * command as well as any attributes it needs. See - * RFC 1524 - * for details of the mailcap entry syntax. Only mailcap - * entries that specify a view command for the specified - * MIME type are returned. - * - * @param mimeType the MIME type - * @return array of native command entries - * @since 1.6, JAF 1.1 - */ - public synchronized String[] getNativeCommands(String mimeType) { - List cmdList = new ArrayList(); - if (mimeType != null) - mimeType = mimeType.toLowerCase(Locale.ENGLISH); - - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - String[] cmds = DB[i].getNativeCommands(mimeType); - if (cmds != null) { - for (int j = 0; j < cmds.length; j++) { - // eliminate duplicates - if (!cmdList.contains(cmds[j])) - cmdList.add(cmds[j]); - } - } - } - - String[] cmds = new String[cmdList.size()]; - cmds = (String[])cmdList.toArray(cmds); - - return cmds; - } - - /** - * for debugging... - * - public static void main(String[] argv) throws Exception { - MailcapCommandMap map = new MailcapCommandMap(); - CommandInfo[] cmdInfo; - - cmdInfo = map.getPreferredCommands(argv[0]); - System.out.println("Preferred Commands:"); - for (int i = 0; i < cmdInfo.length; i++) - System.out.println("Command " + cmdInfo[i].getCommandName() + " [" + - cmdInfo[i].getCommandClass() + "]"); - cmdInfo = map.getAllCommands(argv[0]); - System.out.println(); - System.out.println("All Commands:"); - for (int i = 0; i < cmdInfo.length; i++) - System.out.println("Command " + cmdInfo[i].getCommandName() + " [" + - cmdInfo[i].getCommandClass() + "]"); - DataContentHandler dch = map.createDataContentHandler(argv[0]); - if (dch != null) - System.out.println("DataContentHandler " + - dch.getClass().toString()); - System.exit(0); - } - */ -} --- old/src/java.activation/share/classes/javax/activation/MimeType.java 2018-01-30 20:16:03.000000000 -0500 +++ /dev/null 2018-01-30 20:16:03.000000000 -0500 @@ -1,346 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 javax.activation; - -import java.io.*; -import java.util.Locale; - -/** - * A Multipurpose Internet Mail Extension (MIME) type, as defined - * in RFC 2045 and 2046. - * - * @since 1.6 - */ -public class MimeType implements Externalizable { - - private String primaryType; - private String subType; - private MimeTypeParameterList parameters; - - /** - * A string that holds all the special chars. - */ - private static final String TSPECIALS = "()<>@,;:/[]?=\\\""; - - /** - * Default constructor. - */ - public MimeType() { - primaryType = "application"; - subType = "*"; - parameters = new MimeTypeParameterList(); - } - - /** - * Constructor that builds a MimeType from a String. - * - * @param rawdata the MIME type string - * @exception MimeTypeParseException if the MIME type can't be parsed - */ - public MimeType(String rawdata) throws MimeTypeParseException { - parse(rawdata); - } - - /** - * Constructor that builds a MimeType with the given primary and sub type - * but has an empty parameter list. - * - * @param primary the primary MIME type - * @param sub the MIME sub-type - * @exception MimeTypeParseException if the primary type or subtype - * is not a valid token - */ - public MimeType(String primary, String sub) throws MimeTypeParseException { - // check to see if primary is valid - if (isValidToken(primary)) { - primaryType = primary.toLowerCase(Locale.ENGLISH); - } else { - throw new MimeTypeParseException("Primary type is invalid."); - } - - // check to see if sub is valid - if (isValidToken(sub)) { - subType = sub.toLowerCase(Locale.ENGLISH); - } else { - throw new MimeTypeParseException("Sub type is invalid."); - } - - parameters = new MimeTypeParameterList(); - } - - /** - * A routine for parsing the MIME type out of a String. - */ - private void parse(String rawdata) throws MimeTypeParseException { - int slashIndex = rawdata.indexOf('/'); - int semIndex = rawdata.indexOf(';'); - if ((slashIndex < 0) && (semIndex < 0)) { - // neither character is present, so treat it - // as an error - throw new MimeTypeParseException("Unable to find a sub type."); - } else if ((slashIndex < 0) && (semIndex >= 0)) { - // we have a ';' (and therefore a parameter list), - // but no '/' indicating a sub type is present - throw new MimeTypeParseException("Unable to find a sub type."); - } else if ((slashIndex >= 0) && (semIndex < 0)) { - // we have a primary and sub type but no parameter list - primaryType = rawdata.substring(0, slashIndex).trim(). - toLowerCase(Locale.ENGLISH); - subType = rawdata.substring(slashIndex + 1).trim(). - toLowerCase(Locale.ENGLISH); - parameters = new MimeTypeParameterList(); - } else if (slashIndex < semIndex) { - // we have all three items in the proper sequence - primaryType = rawdata.substring(0, slashIndex).trim(). - toLowerCase(Locale.ENGLISH); - subType = rawdata.substring(slashIndex + 1, semIndex).trim(). - toLowerCase(Locale.ENGLISH); - parameters = new MimeTypeParameterList(rawdata.substring(semIndex)); - } else { - // we have a ';' lexically before a '/' which means we - // have a primary type and a parameter list but no sub type - throw new MimeTypeParseException("Unable to find a sub type."); - } - - // now validate the primary and sub types - - // check to see if primary is valid - if (!isValidToken(primaryType)) - throw new MimeTypeParseException("Primary type is invalid."); - - // check to see if sub is valid - if (!isValidToken(subType)) - throw new MimeTypeParseException("Sub type is invalid."); - } - - /** - * Retrieve the primary type of this object. - * - * @return the primary MIME type - */ - public String getPrimaryType() { - return primaryType; - } - - /** - * Set the primary type for this object to the given String. - * - * @param primary the primary MIME type - * @exception MimeTypeParseException if the primary type - * is not a valid token - */ - public void setPrimaryType(String primary) throws MimeTypeParseException { - // check to see if primary is valid - if (!isValidToken(primaryType)) - throw new MimeTypeParseException("Primary type is invalid."); - primaryType = primary.toLowerCase(Locale.ENGLISH); - } - - /** - * Retrieve the subtype of this object. - * - * @return the MIME subtype - */ - public String getSubType() { - return subType; - } - - /** - * Set the subtype for this object to the given String. - * - * @param sub the MIME subtype - * @exception MimeTypeParseException if the subtype - * is not a valid token - */ - public void setSubType(String sub) throws MimeTypeParseException { - // check to see if sub is valid - if (!isValidToken(subType)) - throw new MimeTypeParseException("Sub type is invalid."); - subType = sub.toLowerCase(Locale.ENGLISH); - } - - /** - * Retrieve this object's parameter list. - * - * @return a MimeTypeParameterList object representing the parameters - */ - public MimeTypeParameterList getParameters() { - return parameters; - } - - /** - * Retrieve the value associated with the given name, or null if there - * is no current association. - * - * @param name the parameter name - * @return the paramter's value - */ - public String getParameter(String name) { - return parameters.get(name); - } - - /** - * Set the value to be associated with the given name, replacing - * any previous association. - * - * @param name the parameter name - * @param value the paramter's value - */ - public void setParameter(String name, String value) { - parameters.set(name, value); - } - - /** - * Remove any value associated with the given name. - * - * @param name the parameter name - */ - public void removeParameter(String name) { - parameters.remove(name); - } - - /** - * Return the String representation of this object. - */ - public String toString() { - return getBaseType() + parameters.toString(); - } - - /** - * Return a String representation of this object - * without the parameter list. - * - * @return the MIME type and sub-type - */ - public String getBaseType() { - return primaryType + "/" + subType; - } - - /** - * Determine if the primary and sub type of this object is - * the same as what is in the given type. - * - * @param type the MimeType object to compare with - * @return true if they match - */ - public boolean match(MimeType type) { - return primaryType.equals(type.getPrimaryType()) - && (subType.equals("*") - || type.getSubType().equals("*") - || (subType.equals(type.getSubType()))); - } - - /** - * Determine if the primary and sub type of this object is - * the same as the content type described in rawdata. - * - * @param rawdata the MIME type string to compare with - * @return true if they match - * @exception MimeTypeParseException if the MIME type can't be parsed - */ - public boolean match(String rawdata) throws MimeTypeParseException { - return match(new MimeType(rawdata)); - } - - /** - * The object implements the writeExternal method to save its contents - * by calling the methods of DataOutput for its primitive values or - * calling the writeObject method of ObjectOutput for objects, strings - * and arrays. - * - * @param out the ObjectOutput object to write to - * @exception IOException Includes any I/O exceptions that may occur - */ - public void writeExternal(ObjectOutput out) throws IOException { - out.writeUTF(toString()); - out.flush(); - } - - /** - * The object implements the readExternal method to restore its - * contents by calling the methods of DataInput for primitive - * types and readObject for objects, strings and arrays. The - * readExternal method must read the values in the same sequence - * and with the same types as were written by writeExternal. - * - * @param in the ObjectInput object to read from - * @exception ClassNotFoundException If the class for an object being - * restored cannot be found. - */ - public void readExternal(ObjectInput in) - throws IOException, ClassNotFoundException { - try { - parse(in.readUTF()); - } catch (MimeTypeParseException e) { - throw new IOException(e.toString()); - } - } - - // below here be scary parsing related things - - /** - * Determine whether or not a given character belongs to a legal token. - */ - private static boolean isTokenChar(char c) { - return ((c > 040) && (c < 0177)) && (TSPECIALS.indexOf(c) < 0); - } - - /** - * Determine whether or not a given string is a legal token. - */ - private boolean isValidToken(String s) { - int len = s.length(); - if (len > 0) { - for (int i = 0; i < len; ++i) { - char c = s.charAt(i); - if (!isTokenChar(c)) { - return false; - } - } - return true; - } else { - return false; - } - } - - /** - * A simple parser test, - * for debugging... - * - public static void main(String[] args) - throws MimeTypeParseException, IOException { - for (int i = 0; i < args.length; ++i) { - System.out.println("Original: " + args[i]); - - MimeType type = new MimeType(args[i]); - - System.out.println("Short: " + type.getBaseType()); - System.out.println("Parsed: " + type.toString()); - System.out.println(); - } - } - */ -} --- old/src/java.activation/share/classes/javax/activation/MimeTypeParameterList.java 2018-01-30 20:16:04.000000000 -0500 +++ /dev/null 2018-01-30 20:16:04.000000000 -0500 @@ -1,341 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 javax.activation; - -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.Locale; - -/** - * A parameter list of a MimeType - * as defined in RFC 2045 and 2046. The Primary type of the - * object must already be stripped off. - * - * @see javax.activation.MimeType - * - * @since 1.6 - */ -public class MimeTypeParameterList { - private Hashtable parameters; - - /** - * A string that holds all the special chars. - */ - private static final String TSPECIALS = "()<>@,;:/[]?=\\\""; - - - /** - * Default constructor. - */ - public MimeTypeParameterList() { - parameters = new Hashtable(); - } - - /** - * Constructs a new MimeTypeParameterList with the passed in data. - * - * @param parameterList an RFC 2045, 2046 compliant parameter list. - * @exception MimeTypeParseException if the MIME type can't be parsed - */ - public MimeTypeParameterList(String parameterList) - throws MimeTypeParseException { - parameters = new Hashtable(); - - // now parse rawdata - parse(parameterList); - } - - /** - * A routine for parsing the parameter list out of a String. - * - * @param parameterList an RFC 2045, 2046 compliant parameter list. - * @exception MimeTypeParseException if the MIME type can't be parsed - */ - protected void parse(String parameterList) throws MimeTypeParseException { - if (parameterList == null) - return; - - int length = parameterList.length(); - if (length <= 0) - return; - - int i; - char c; - for (i = skipWhiteSpace(parameterList, 0); - i < length && (c = parameterList.charAt(i)) == ';'; - i = skipWhiteSpace(parameterList, i)) { - int lastIndex; - String name; - String value; - - // eat the ';' - i++; - - // now parse the parameter name - - // skip whitespace - i = skipWhiteSpace(parameterList, i); - - // tolerate trailing semicolon, even though it violates the spec - if (i >= length) - return; - - // find the end of the token char run - lastIndex = i; - while ((i < length) && isTokenChar(parameterList.charAt(i))) - i++; - - name = parameterList.substring(lastIndex, i). - toLowerCase(Locale.ENGLISH); - - // now parse the '=' that separates the name from the value - i = skipWhiteSpace(parameterList, i); - - if (i >= length || parameterList.charAt(i) != '=') - throw new MimeTypeParseException( - "Couldn't find the '=' that separates a " + - "parameter name from its value."); - - // eat it and parse the parameter value - i++; - i = skipWhiteSpace(parameterList, i); - - if (i >= length) - throw new MimeTypeParseException( - "Couldn't find a value for parameter named " + name); - - // now find out whether or not we have a quoted value - c = parameterList.charAt(i); - if (c == '"') { - // yup it's quoted so eat it and capture the quoted string - i++; - if (i >= length) - throw new MimeTypeParseException( - "Encountered unterminated quoted parameter value."); - - lastIndex = i; - - // find the next unescaped quote - while (i < length) { - c = parameterList.charAt(i); - if (c == '"') - break; - if (c == '\\') { - // found an escape sequence - // so skip this and the - // next character - i++; - } - i++; - } - if (c != '"') - throw new MimeTypeParseException( - "Encountered unterminated quoted parameter value."); - - value = unquote(parameterList.substring(lastIndex, i)); - // eat the quote - i++; - } else if (isTokenChar(c)) { - // nope it's an ordinary token so it - // ends with a non-token char - lastIndex = i; - while (i < length && isTokenChar(parameterList.charAt(i))) - i++; - value = parameterList.substring(lastIndex, i); - } else { - // it ain't a value - throw new MimeTypeParseException( - "Unexpected character encountered at index " + i); - } - - // now put the data into the hashtable - parameters.put(name, value); - } - if (i < length) { - throw new MimeTypeParseException( - "More characters encountered in input than expected."); - } - } - - /** - * Return the number of name-value pairs in this list. - * - * @return the number of parameters - */ - public int size() { - return parameters.size(); - } - - /** - * Determine whether or not this list is empty. - * - * @return true if there are no parameters - */ - public boolean isEmpty() { - return parameters.isEmpty(); - } - - /** - * Retrieve the value associated with the given name, or null if there - * is no current association. - * - * @param name the parameter name - * @return the parameter's value - */ - public String get(String name) { - return (String)parameters.get(name.trim().toLowerCase(Locale.ENGLISH)); - } - - /** - * Set the value to be associated with the given name, replacing - * any previous association. - * - * @param name the parameter name - * @param value the parameter's value - */ - public void set(String name, String value) { - parameters.put(name.trim().toLowerCase(Locale.ENGLISH), value); - } - - /** - * Remove any value associated with the given name. - * - * @param name the parameter name - */ - public void remove(String name) { - parameters.remove(name.trim().toLowerCase(Locale.ENGLISH)); - } - - /** - * Retrieve an enumeration of all the names in this list. - * - * @return an enumeration of all parameter names - */ - public Enumeration getNames() { - return parameters.keys(); - } - - /** - * Return a string representation of this object. - */ - public String toString() { - StringBuffer buffer = new StringBuffer(); - buffer.ensureCapacity(parameters.size() * 16); - // heuristic: 8 characters per field - - Enumeration keys = parameters.keys(); - while (keys.hasMoreElements()) { - String key = (String)keys.nextElement(); - buffer.append("; "); - buffer.append(key); - buffer.append('='); - buffer.append(quote((String)parameters.get(key))); - } - - return buffer.toString(); - } - - // below here be scary parsing related things - - /** - * Determine whether or not a given character belongs to a legal token. - */ - private static boolean isTokenChar(char c) { - return ((c > 040) && (c < 0177)) && (TSPECIALS.indexOf(c) < 0); - } - - /** - * return the index of the first non white space character in - * rawdata at or after index i. - */ - private static int skipWhiteSpace(String rawdata, int i) { - int length = rawdata.length(); - while ((i < length) && Character.isWhitespace(rawdata.charAt(i))) - i++; - return i; - } - - /** - * A routine that knows how and when to quote and escape the given value. - */ - private static String quote(String value) { - boolean needsQuotes = false; - - // check to see if we actually have to quote this thing - int length = value.length(); - for (int i = 0; (i < length) && !needsQuotes; i++) { - needsQuotes = !isTokenChar(value.charAt(i)); - } - - if (needsQuotes) { - StringBuffer buffer = new StringBuffer(); - buffer.ensureCapacity((int)(length * 1.5)); - - // add the initial quote - buffer.append('"'); - - // add the properly escaped text - for (int i = 0; i < length; ++i) { - char c = value.charAt(i); - if ((c == '\\') || (c == '"')) - buffer.append('\\'); - buffer.append(c); - } - - // add the closing quote - buffer.append('"'); - - return buffer.toString(); - } else { - return value; - } - } - - /** - * A routine that knows how to strip the quotes and - * escape sequences from the given value. - */ - private static String unquote(String value) { - int valueLength = value.length(); - StringBuffer buffer = new StringBuffer(); - buffer.ensureCapacity(valueLength); - - boolean escaped = false; - for (int i = 0; i < valueLength; ++i) { - char currentChar = value.charAt(i); - if (!escaped && (currentChar != '\\')) { - buffer.append(currentChar); - } else if (escaped) { - buffer.append(currentChar); - escaped = false; - } else { - escaped = true; - } - } - - return buffer.toString(); - } -} --- old/src/java.activation/share/classes/javax/activation/MimeTypeParseException.java 2018-01-30 20:16:04.000000000 -0500 +++ /dev/null 2018-01-30 20:16:05.000000000 -0500 @@ -1,50 +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 javax.activation; - -/** - * A class to encapsulate MimeType parsing related exceptions. - * - * @since 1.6 - */ -public class MimeTypeParseException extends Exception { - - /** - * Constructs a MimeTypeParseException with no specified detail message. - */ - public MimeTypeParseException() { - super(); - } - - /** - * Constructs a MimeTypeParseException with the specified detail message. - * - * @param s the detail message. - */ - public MimeTypeParseException(String s) { - super(s); - } -} --- old/src/java.activation/share/classes/javax/activation/MimetypesFileTypeMap.java 2018-01-30 20:16:05.000000000 -0500 +++ /dev/null 2018-01-30 20:16:05.000000000 -0500 @@ -1,360 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 javax.activation; - -import java.io.*; -import java.net.*; -import java.util.*; -import java.security.AccessController; -import java.security.PrivilegedAction; -import com.sun.activation.registries.MimeTypeFile; -import com.sun.activation.registries.LogSupport; - -/** - * This class extends FileTypeMap and provides data typing of files - * via their file extension. It uses the {@code .mime.types} format.

- * - * MIME types file search order:

- * The MimetypesFileTypeMap looks in various places in the user's - * system for MIME types file entries. When requests are made - * to search for MIME types in the MimetypesFileTypeMap, it searches - * MIME types files in the following order: - *

    - *
  1. Programmatically added entries to the MimetypesFileTypeMap instance. - *
  2. The file {@code .mime.types} in the user's home directory. - *
  3. The file {@code mime.types} in the Java runtime. - *
  4. The file or resources named {@code META-INF/mime.types}. - *
  5. The file or resource named {@code META-INF/mimetypes.default} - * (usually found only in the {@code activation.jar} file). - *
- *

- * (The current implementation looks for the {@code mime.types} file - * in the Java runtime in the directory java.home{@code /conf} - * if it exists, and otherwise in the directory - * java.home{@code /lib}, where java.home is the value - * of the "java.home" System property. Note that the "conf" directory was - * introduced in JDK 9.) - *

- * MIME types file format: - * - *

{@code
- * # comments begin with a '#'
- * # the format is  
- * # for example:
- * text/plain    txt text TXT
- * # this would map file.txt, file.text, and file.TXT to
- * # the mime type "text/plain"
- * }
- * - * @author Bart Calder - * @author Bill Shannon - * - * @since 1.6 - */ -public class MimetypesFileTypeMap extends FileTypeMap { - /* - * We manage a collection of databases, searched in order. - */ - private MimeTypeFile[] DB; - private static final int PROG = 0; // programmatically added entries - - private static final String defaultType = "application/octet-stream"; - - private static final String confDir; - - static { - String dir = null; - try { - dir = (String)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - String home = System.getProperty("java.home"); - String newdir = home + File.separator + "conf"; - File conf = new File(newdir); - if (conf.exists()) - return newdir + File.separator; - else - return home + File.separator + "lib" + File.separator; - } - }); - } catch (Exception ex) { - // ignore any exceptions - } - confDir = dir; - } - - /** - * The default constructor. - */ - public MimetypesFileTypeMap() { - Vector dbv = new Vector(5); // usually 5 or less databases - MimeTypeFile mf = null; - dbv.addElement(null); // place holder for PROG entry - - LogSupport.log("MimetypesFileTypeMap: load HOME"); - try { - String user_home = System.getProperty("user.home"); - - if (user_home != null) { - String path = user_home + File.separator + ".mime.types"; - mf = loadFile(path); - if (mf != null) - dbv.addElement(mf); - } - } catch (SecurityException ex) {} - - LogSupport.log("MimetypesFileTypeMap: load SYS"); - try { - // check system's home - if (confDir != null) { - mf = loadFile(confDir + "mime.types"); - if (mf != null) - dbv.addElement(mf); - } - } catch (SecurityException ex) {} - - LogSupport.log("MimetypesFileTypeMap: load JAR"); - // load from the app's jar file - loadAllResources(dbv, "META-INF/mime.types"); - - LogSupport.log("MimetypesFileTypeMap: load DEF"); - mf = loadResource("/META-INF/mimetypes.default"); - - if (mf != null) - dbv.addElement(mf); - - DB = new MimeTypeFile[dbv.size()]; - dbv.copyInto(DB); - } - - /** - * Load from the named resource. - */ - private MimeTypeFile loadResource(String name) { - InputStream clis = null; - try { - clis = SecuritySupport.getResourceAsStream(this.getClass(), name); - if (clis != null) { - MimeTypeFile mf = new MimeTypeFile(clis); - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: successfully " + - "loaded mime types file: " + name); - return mf; - } else { - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: not loading " + - "mime types file: " + name); - } - } catch (IOException e) { - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: can't load " + name, e); - } catch (SecurityException sex) { - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: can't load " + name, sex); - } finally { - try { - if (clis != null) - clis.close(); - } catch (IOException ex) { } // ignore it - } - return null; - } - - /** - * Load all of the named resource. - */ - private void loadAllResources(Vector v, String name) { - boolean anyLoaded = false; - try { - URL[] urls; - ClassLoader cld = null; - // First try the "application's" class loader. - cld = SecuritySupport.getContextClassLoader(); - if (cld == null) - cld = this.getClass().getClassLoader(); - if (cld != null) - urls = SecuritySupport.getResources(cld, name); - else - urls = SecuritySupport.getSystemResources(name); - if (urls != null) { - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: getResources"); - for (int i = 0; i < urls.length; i++) { - URL url = urls[i]; - InputStream clis = null; - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: URL " + url); - try { - clis = SecuritySupport.openStream(url); - if (clis != null) { - v.addElement(new MimeTypeFile(clis)); - anyLoaded = true; - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: " + - "successfully loaded " + - "mime types from URL: " + url); - } else { - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: " + - "not loading " + - "mime types from URL: " + url); - } - } catch (IOException ioex) { - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: can't load " + - url, ioex); - } catch (SecurityException sex) { - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: can't load " + - url, sex); - } finally { - try { - if (clis != null) - clis.close(); - } catch (IOException cex) { } - } - } - } - } catch (Exception ex) { - if (LogSupport.isLoggable()) - LogSupport.log("MimetypesFileTypeMap: can't load " + name, ex); - } - - // if failed to load anything, fall back to old technique, just in case - if (!anyLoaded) { - LogSupport.log("MimetypesFileTypeMap: !anyLoaded"); - MimeTypeFile mf = loadResource("/" + name); - if (mf != null) - v.addElement(mf); - } - } - - /** - * Load the named file. - */ - private MimeTypeFile loadFile(String name) { - MimeTypeFile mtf = null; - - try { - mtf = new MimeTypeFile(name); - } catch (IOException e) { - // e.printStackTrace(); - } - return mtf; - } - - /** - * Construct a MimetypesFileTypeMap with programmatic entries - * added from the named file. - * - * @param mimeTypeFileName the file name - * @exception IOException for errors reading the file - */ - public MimetypesFileTypeMap(String mimeTypeFileName) throws IOException { - this(); - DB[PROG] = new MimeTypeFile(mimeTypeFileName); - } - - /** - * Construct a MimetypesFileTypeMap with programmatic entries - * added from the InputStream. - * - * @param is the input stream to read from - */ - public MimetypesFileTypeMap(InputStream is) { - this(); - try { - DB[PROG] = new MimeTypeFile(is); - } catch (IOException ex) { - // XXX - really should throw it - } - } - - /** - * Prepend the MIME type values to the registry. - * - * @param mime_types A .mime.types formatted string of entries. - */ - public synchronized void addMimeTypes(String mime_types) { - // check to see if we have created the registry - if (DB[PROG] == null) - DB[PROG] = new MimeTypeFile(); // make one - - DB[PROG].appendToRegistry(mime_types); - } - - /** - * Return the MIME type of the file object. - * The implementation in this class calls - * {@code getContentType(f.getName())}. - * - * @param f the file - * @return the file's MIME type - */ - public String getContentType(File f) { - return this.getContentType(f.getName()); - } - - /** - * Return the MIME type based on the specified file name. - * The MIME type entries are searched as described above under - * MIME types file search order. - * If no entry is found, the type "application/octet-stream" is returned. - * - * @param filename the file name - * @return the file's MIME type - */ - public synchronized String getContentType(String filename) { - int dot_pos = filename.lastIndexOf("."); // period index - - if (dot_pos < 0) - return defaultType; - - String file_ext = filename.substring(dot_pos + 1); - if (file_ext.length() == 0) - return defaultType; - - for (int i = 0; i < DB.length; i++) { - if (DB[i] == null) - continue; - String result = DB[i].getMIMETypeString(file_ext); - if (result != null) - return result; - } - return defaultType; - } - - /** - * for debugging... - * - public static void main(String[] argv) throws Exception { - MimetypesFileTypeMap map = new MimetypesFileTypeMap(); - System.out.println("File " + argv[0] + " has MIME type " + - map.getContentType(argv[0])); - System.exit(0); - } - */ -} --- old/src/java.activation/share/classes/javax/activation/SecuritySupport.java 2018-01-30 20:16:06.000000000 -0500 +++ /dev/null 2018-01-30 20:16:06.000000000 -0500 @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2002, 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 javax.activation; - -import java.security.*; -import java.net.*; -import java.io.*; -import java.util.*; - -/** - * Security related methods that only work on J2SE 1.2 and newer. - * - * @since 1.6 - */ -class SecuritySupport { - - private SecuritySupport() { - // private constructor, can't create an instance - } - - public static ClassLoader getContextClassLoader() { - return (ClassLoader) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - ClassLoader cl = null; - try { - cl = Thread.currentThread().getContextClassLoader(); - } catch (SecurityException ex) { } - return cl; - } - }); - } - - public static InputStream getResourceAsStream(final Class c, - final String name) throws IOException { - try { - return (InputStream) - AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws IOException { - return c.getResourceAsStream(name); - } - }); - } catch (PrivilegedActionException e) { - throw (IOException)e.getException(); - } - } - - public static URL[] getResources(final ClassLoader cl, final String name) { - return (URL[]) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - URL[] ret = null; - try { - List v = new ArrayList(); - Enumeration e = cl.getResources(name); - while (e != null && e.hasMoreElements()) { - URL url = (URL)e.nextElement(); - if (url != null) - v.add(url); - } - if (v.size() > 0) { - ret = new URL[v.size()]; - ret = (URL[])v.toArray(ret); - } - } catch (IOException ioex) { - } catch (SecurityException ex) { } - return ret; - } - }); - } - - public static URL[] getSystemResources(final String name) { - return (URL[]) - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - URL[] ret = null; - try { - List v = new ArrayList(); - Enumeration e = ClassLoader.getSystemResources(name); - while (e != null && e.hasMoreElements()) { - URL url = (URL)e.nextElement(); - if (url != null) - v.add(url); - } - if (v.size() > 0) { - ret = new URL[v.size()]; - ret = (URL[])v.toArray(ret); - } - } catch (IOException ioex) { - } catch (SecurityException ex) { } - return ret; - } - }); - } - - public static InputStream openStream(final URL url) throws IOException { - try { - return (InputStream) - AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws IOException { - return url.openStream(); - } - }); - } catch (PrivilegedActionException e) { - throw (IOException)e.getException(); - } - } -} --- old/src/java.activation/share/classes/javax/activation/URLDataSource.java 2018-01-30 20:16:06.000000000 -0500 +++ /dev/null 2018-01-30 20:16:06.000000000 -0500 @@ -1,137 +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 javax.activation; - -import java.net.URL; -import java.net.URLConnection; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.IOException; - -/** - * The URLDataSource class provides an object that wraps a URL - * object in a DataSource interface. URLDataSource simplifies the handling - * of data described by URLs within the JavaBeans Activation Framework - * because this class can be used to create new DataHandlers. NOTE: The - * DataHandler object creates a URLDataSource internally, - * when it is constructed with a URL. - * - * @see javax.activation.DataSource - * @see javax.activation.DataHandler - * - * @since 1.6 - */ -public class URLDataSource implements DataSource { - private URL url = null; - private URLConnection url_conn = null; - - /** - * URLDataSource constructor. The URLDataSource class will - * not open a connection to the URL until a method requiring it - * to do so is called. - * - * @param url The URL to be encapsulated in this object. - */ - public URLDataSource(URL url) { - this.url = url; - } - - /** - * Returns the value of the URL content-type header field. - * It calls the URL's URLConnection.getContentType method - * after retrieving a URLConnection object. - * Note: this method attempts to call the openConnection - * method on the URL. If this method fails, or if a content type is not - * returned from the URLConnection, getContentType returns - * "application/octet-stream" as the content type. - * - * @return the content type. - */ - public String getContentType() { - String type = null; - - try { - if (url_conn == null) - url_conn = url.openConnection(); - } catch (IOException e) { } - - if (url_conn != null) - type = url_conn.getContentType(); - - if (type == null) - type = "application/octet-stream"; - - return type; - } - - /** - * Calls the getFile method on the URL used to - * instantiate the object. - * - * @return the result of calling the URL's getFile method. - */ - public String getName() { - return url.getFile(); - } - - /** - * The getInputStream method from the URL. Calls the - * openStream method on the URL. - * - * @return the InputStream. - */ - public InputStream getInputStream() throws IOException { - return url.openStream(); - } - - /** - * The getOutputStream method from the URL. First an attempt is - * made to get the URLConnection object for the URL. If that - * succeeds, the getOutputStream method on the URLConnection - * is returned. - * - * @return the OutputStream. - */ - public OutputStream getOutputStream() throws IOException { - // get the url connection if it is available - url_conn = url.openConnection(); - - if (url_conn != null) { - url_conn.setDoOutput(true); - return url_conn.getOutputStream(); - } else - return null; - } - - /** - * Return the URL used to create this DataSource. - * - * @return The URL. - */ - public URL getURL() { - return url; - } -} --- old/src/java.activation/share/classes/javax/activation/UnsupportedDataTypeException.java 2018-01-30 20:16:07.000000000 -0500 +++ /dev/null 2018-01-30 20:16:07.000000000 -0500 @@ -1,57 +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 javax.activation; - -import java.io.IOException; - -/** - * Signals that the requested operation does not support the - * requested data type. - * - * @see javax.activation.DataHandler - * - * @since 1.6 - */ - -public class UnsupportedDataTypeException extends IOException { - /** - * Constructs an UnsupportedDataTypeException with no detail - * message. - */ - public UnsupportedDataTypeException() { - super(); - } - - /** - * Constructs an UnsupportedDataTypeException with the specified - * message. - * - * @param s The detail message. - */ - public UnsupportedDataTypeException(String s) { - super(s); - } -} --- old/src/java.activation/share/classes/module-info.java 2018-01-30 20:16:08.000000000 -0500 +++ /dev/null 2018-01-30 20:16:08.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2014, 2017, 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. - */ - -/** - * Defines the JavaBeans Activation Framework (JAF) API. - * - *

This module is upgradeable. - * - * @moduleGraph - * @since 9 - */ -@Deprecated(since="9", forRemoval=true) -module java.activation { - requires java.logging; - - requires transitive java.datatransfer; - - exports javax.activation; -} - --- old/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/GIOP.idl 2018-01-30 20:16:08.000000000 -0500 +++ /dev/null 2018-01-30 20:16:08.000000000 -0500 @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2000, 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. - */ - -#include "IOP.idl" - -module GIOP { // IDL extended for version 1.1 and 1.2 - - struct Version { - octet major; - octet minor; - }; - - - // GIOP 1.0 - - struct MessageHeader_1_0 { // Renamed from MessageHeader - char magic [4]; - Version GIOP_version; - boolean byte_order; - octet message_type; - unsigned long message_size; - }; - - // GIOP 1.1 - - struct MessageHeader_1_1 { - char magic [4]; - Version GIOP_version; - octet flags; // GIOP 1.1 change - octet message_type; - unsigned long message_size; - }; - - // GIOP 1.2 - // Same Header contents for 1.1 and 1.2 - typedef MessageHeader_1_1 MessageHeader_1_2; - - - // GIOP 1.0 - struct RequestHeader_1_0 { // Renamed from RequestHeader - IOP::ServiceContextList service_context; - unsigned long request_id; - boolean response_expected; - sequence object_key; - string operation; - sequence requesting_principal; - }; - - // GIOP 1.1 - struct RequestHeader_1_1 { - IOP::ServiceContextList service_context; - unsigned long request_id; - boolean response_expected; - octet reserved[3]; // Added in GIOP 1.1 - sequence object_key; - string operation; - sequence requesting_principal; - }; - - // GIOP 1.2 - typedef short AddressingDisposition; - const short KeyAddr = 0; - const short ProfileAddr = 1; - const short ReferenceAddr = 2; - struct IORAddressingInfo { - unsigned long selected_profile_index; - IOP::IOR ior; - }; - union TargetAddress switch (AddressingDisposition) { - case KeyAddr: sequence object_key; - case ProfileAddr: IOP::TaggedProfile profile; - case ReferenceAddr: IORAddressingInfo ior; - }; - struct RequestHeader_1_2 { - unsigned long request_id; - octet response_flags; - octet reserved[3]; - TargetAddress target; - string operation; - IOP::ServiceContextList service_context; - // Principal not in GIOP 1.2 - }; - - - #ifndef GIOP_1_2 //We're supporting all versions - - // GIOP 1.0 and 1.1 - enum ReplyStatusType_1_0 { // Renamed from ReplyStatusType - NO_EXCEPTION, - USER_EXCEPTION, - SYSTEM_EXCEPTION, - LOCATION_FORWARD - }; - - // GIOP 1.0 - struct ReplyHeader_1_0 { // Renamed from ReplyHeader - IOP::ServiceContextList service_context; - unsigned long request_id; - ReplyStatusType_1_0 reply_status; - }; - - // GIOP 1.1 - // Same Header contents for 1.0 and 1.1 - typedef ReplyHeader_1_0 ReplyHeader_1_1; - - #else - - // GIOP 1.2 - enum ReplyStatusType_1_2 { - NO_EXCEPTION, - USER_EXCEPTION, - SYSTEM_EXCEPTION, - LOCATION_FORWARD, - LOCATION_FORWARD_PERM,// new value for 1.2 - NEEDS_ADDRESSING_MODE // new value for 1.2 - }; - - struct ReplyHeader_1_2 { - unsigned long request_id; - ReplyStatusType_1_2 reply_status; - IOP::ServiceContextList service_context; - }; - - #endif // GIOP_1_2 - - - struct SystemExceptionReplyBody { - string exception_id; - unsigned long minor_code_value; - unsigned long completion_status; - }; - - - - struct CancelRequestHeader { - unsigned long request_id; - }; - - - - // GIOP 1.0 - struct LocateRequestHeader_1_0 { // Renamed LocationRequestHeader - unsigned long request_id; - sequence object_key; - }; - - // GIOP 1.1 - // Same Header contents for 1.0 and 1.1 - typedef LocateRequestHeader_1_0 LocateRequestHeader_1_1; - - // GIOP 1.2 - struct LocateRequestHeader_1_2 { - unsigned long request_id; - TargetAddress target; - }; - - - #ifndef GIOP_1_2 // We're supporting all versions - - // GIOP 1.0 and 1.1 - enum LocateStatusType_1_0 { // Renamed from LocateStatusType - UNKNOWN_OBJECT, - OBJECT_HERE, - OBJECT_FORWARD - }; - - - // GIOP 1.0 - struct LocateReplyHeader_1_0 { // Renamed from LocateReplyHeader - unsigned long request_id; - LocateStatusType_1_0 locate_status; - }; - - // GIOP 1.1 - // same Header contents for 1.0 and 1.1 - typedef LocateReplyHeader_1_0 LocateReplyHeader_1_1; - - #else - - // GIOP 1.2 - enum LocateStatusType_1_2 { - UNKNOWN_OBJECT, - OBJECT_HERE, - OBJECT_FORWARD, - OBJECT_FORWARD_PERM, // new value for GIOP 1.2 - LOC_SYSTEM_EXCEPTION, // new value for GIOP 1.2 - LOC_NEEDS_ADDRESSING_MODE // new value for GIOP 1.2 - }; - - struct LocateReplyHeader_1_2 { - unsigned long request_id; - LocateStatusType_1_2 locate_status; - }; - - #endif // GIOP_1_2 - - - // GIOP 1.2 - struct FragmentHeader_1_2 { - unsigned long request_id; - }; -}; --- old/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/messages.idl 2018-01-30 20:16:09.000000000 -0500 +++ /dev/null 2018-01-30 20:16:09.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2000, 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. - */ - -/* - * @(#)GIOP.idl 1.0 00/05/21 - * - */ - -#include "IOP.idl" - -module messages { - - typedef short AddressingDisposition; - const short KeyAddr = 0; - const short ProfileAddr = 1; - const short ReferenceAddr = 2; - struct IORAddressingInfo { - unsigned long selected_profile_index; - IOP::IOR ior; - }; - union TargetAddress switch (AddressingDisposition) { - case KeyAddr: sequence object_key; - case ProfileAddr: IOP::TaggedProfile profile; - case ReferenceAddr: IORAddressingInfo ior; - }; -}; --- old/src/java.corba/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl 2018-01-30 20:16:10.000000000 -0500 +++ /dev/null 2018-01-30 20:16:10.000000000 -0500 @@ -1,408 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 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. - */ - -#include "Interceptors.idl" - -module PortableActivationIDL { - /** Possible values for endpointType argument on Server.getEndpoint() - * If you change the value of this constant then update - * core.EndPoint accordingly. It has a duplicate definition - * to avoid a compilation dependency. - */ - const string IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT"; - - /** Raised if getEndpoint is called on a server callback object for - * an invalid endpoint type - */ - exception NoSuchEndPoint {} ; - - /** Raised if an attempt is made to retrieve ports corresponding to - * non-registered ORB - */ - exception InvalidORBid {} ; - - /** Raised if an operation is attempted against an invalid server ID. - */ - exception ServerNotRegistered { - PortableInterceptor::ServerId serverId ; - }; - - /** Raised if an operation is attempted for a server that is not running, - * and the server is required to be running for the operation. - */ - exception ServerNotActive { - PortableInterceptor::ServerId serverId ; - }; - - /** Raised if an operation is attempted against a server that is in a - * hold down state. A server becomes held down if it fails to activate - * within 10 seconds. - */ - exception ServerHeldDown { - PortableInterceptor::ServerId serverId ; - }; - - /** Raised if an attempt is made to activate a server that is already - * running. - */ - exception ServerAlreadyActive{ - PortableInterceptor::ServerId serverId ; - }; - - /** Raised if an attempt is made to register a serverdef with the - * same applicationName as an existing serverdef. - */ - exception ServerAlreadyRegistered { - PortableInterceptor::ServerId serverId; - }; - - /** Raised if an attempt is made to install a server that is currently - * installed. Note that a newly created server starts out in an uninstalled - * state. - */ - exception ServerAlreadyInstalled { - PortableInterceptor::ServerId serverId; - } ; - - /** Raised if an attempt is made to uninstall a server that is currently - * uninstalled. Note that a newly created server starts out in an - * uninstalled - * state. - */ - exception ServerAlreadyUninstalled { - PortableInterceptor::ServerId serverId; - } ; - - /** Raised if an attempt is made to register an invalid serverdef. - */ - exception BadServerDefinition { - string reason; - }; - - /** Raised if an attempt is made to register endpoints for the - * same ORB again - */ - exception ORBAlreadyRegistered { - PortableInterceptor::ORBId orbId; - }; - - /** Type of TCP port number, used in structures that describe - * transport endpoints. The valid range is actually 0-65535, but - * we use a long here to avoid signed/unsigned conversion headaches - * in Java. - */ - typedef long TCPPort ; - - /** Sequence of server Ids, used for queries about servers. - */ - typedef sequence ServerIds; - - /** End point information for one particular kind of port associated with an - * an ORB. This is only used in the - * Activator interface, which must always run on the same host as the daemon, - * therefore we do not need the host name here. - */ - struct EndPointInfo { - string endpointType; - TCPPort port; - }; - - /** A list of endpoint information for a particular ORB. - */ - typedef sequence EndpointInfoList; - - /** struct contain ORB and port info for a particular type of endpoint. - * This is only used in the - * Activator interface, which must always run on the same host as the daemon, - * therefore we do not need the host name here. - */ - struct ORBPortInfo { - PortableInterceptor::ORBId orbId; - TCPPort port; - }; - - /** A list of ORB and port information for a particular endpoint type. - */ - typedef sequence ORBPortInfoList; - - /** A list of ORB IDs. - */ - typedef sequence ORBidList; - - /** Server callback interface, passed to Activator in registerServer method. - */ - interface ServerProxy { - /** Shutdown this server. Returns after orb.shutdown() completes. - */ - void shutdown(); - - /** Install the server. Returns after the install hook completes - * execution in the server. - */ - void install(); - - /** Uninstall the server. Returns after the uninstall hook - * completes execution. - */ - void uninstall(); - }; - - /** ORB callback interface, passed to Activator in registerORB method. - */ - interface ORBProxy { - /** Method used to cause ORB to activate the named adapter, if possible. - * This will cause the named POA to register itself with the activator as - * a side effect. This should always happen before this call can complete. - * This method returns true if adapter activation succeeded, otherwise it - * returns false. - */ - boolean activate_adapter( in PortableInterceptor::AdapterName name ) ; - } ; - - interface Activator { - /******************************************************* - * Server State Change Methods - ********************************************************/ - - /** A new ORB started server registers itself with the Activator - */ - void registerServer(in PortableInterceptor::ServerId serverId, in ServerProxy serverObj) - raises (ServerNotRegistered); - - /** A server is shutting down that was started by this activator. - * Complete termination of the server is detected by the death of the - * process implementing the server. - */ - void serverGoingDown( in PortableInterceptor::ServerId serverId ) ; - - /** Called whenever an ORB instance is created. This registers - * the transport endpoints and the ORB proxy callback object. - * Note that we cannot detect when an ORB shuts down, although - * all of the POA shutdowns should still be reported. - */ - void registerORB( in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId, - in ORBProxy orb, in EndpointInfoList endPointInfo) - raises (ServerNotRegistered,NoSuchEndPoint, ORBAlreadyRegistered) ; - - /** Construct or find an ORBD object template corresponding to the - * server's object template and return it. Called whenever a - * persistent POA is created. - */ - PortableInterceptor::ObjectReferenceTemplate registerPOA( - in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId, - in PortableInterceptor::ObjectReferenceTemplate poaTemplate ) ; - - /** Called whenever a POA is destroyed. - */ - void poaDestroyed( - in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId, - in PortableInterceptor::ObjectReferenceTemplate poaTemplate ) ; - - /******************************************************* - * Server Control Methods - ********************************************************/ - - /** If the server is not running, start it up. This is allowed - * whether or not the server has been installed. - */ - void activate(in PortableInterceptor::ServerId serverId) - raises (ServerAlreadyActive, ServerNotRegistered, ServerHeldDown); - - /** If the server is running, shut it down - */ - void shutdown(in PortableInterceptor::ServerId serverId) - raises (ServerNotActive, ServerNotRegistered); - - /** Invoke the server install hook. If the server is not - * currently running, this method will activate it. - */ - void install(in PortableInterceptor::ServerId serverId) - raises (ServerNotRegistered, ServerHeldDown, - ServerAlreadyInstalled); - - /** Invoke the server uninstall hook. If the server is not - * currently running, this method will activate it. - * After this hook completes, the server may still be running. - */ - void uninstall(in PortableInterceptor::ServerId serverId) - raises (ServerNotRegistered, ServerHeldDown, - ServerAlreadyUninstalled); - - /******************************************************* - * Accessors - ********************************************************/ - - /** list active servers - */ - ServerIds getActiveServers(); - - /** list all registered ORBs for a server - */ - ORBidList getORBNames(in PortableInterceptor::ServerId serverId) - raises (ServerNotRegistered); - - /** Find the server template that corresponds to the ORBD's - * adapter id. - */ - PortableInterceptor::ObjectReferenceTemplate lookupPOATemplate( - in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId, - in PortableInterceptor::AdapterName orbAdapterName ) ; - }; - - interface Locator { - /** struct to return the list of endpoints for a server for a specific - * endpoint type. - */ - struct ServerLocationPerType { - string hostname; - ORBPortInfoList ports; - }; - - /** struct to return the list of endpoints for a server for a specific - * ORB - */ - struct ServerLocationPerORB { - string hostname; - EndpointInfoList ports; - }; - - /** locate server - returns the port with a specific type for all registered - * ORBs of an active server. - * Starts the server if it is not already running. - */ - ServerLocationPerType locateServer( - in PortableInterceptor::ServerId serverId, - in string endPoint) - raises(NoSuchEndPoint, ServerNotRegistered, ServerHeldDown); - - /** locate server - returns all ports registered with a specified ORB for - * an active server - * Starts the server if it is not already running. - */ - ServerLocationPerORB locateServerForORB( - in PortableInterceptor::ServerId serverId, - in PortableInterceptor::ORBId orbId) - raises(InvalidORBid, ServerNotRegistered, ServerHeldDown); - - /** get the port for the endpoint of the locator - */ - TCPPort getEndpoint(in string endPointType) - raises(NoSuchEndPoint); - - /** Useful from external BadServerIdHandlers which need - * to pick a particular port type. - */ - TCPPort getServerPortForType( - in ServerLocationPerORB location, - in string endPointType) - raises(NoSuchEndPoint); - }; - - /** Interface used to combine the Activator and Locator when both are - * implemented together in the same process, as is currently the case - * for our implementation. - */ - interface ServerManager : Activator, Locator { }; - - /** Interface used to support binding references in the bootstrap name - * service. - */ - interface InitialNameService { - exception NameAlreadyBound {}; - - /** bind initial name - */ - void bind ( - in string name, - in Object obj, - in boolean isPersistant) raises (NameAlreadyBound); - }; - - interface Repository { - /** server program definition. - */ - struct ServerDef { - string applicationName; // alias used for servers with identical - // serverName values. - string serverName; // Class name of server's main class. - string serverClassPath; // class path used to run the server. - string serverArgs; // arguments passed to the server - string serverVmArgs; // arguments passed to the server's Java VM1 - boolean isInstalled; // Whether or not the server has been installed - }; - - /** register server definition. - * This returns the serverId of the server. A newly created server is - * always uninstalled. - */ - PortableInterceptor::ServerId registerServer (in ServerDef serverDef) - raises (ServerAlreadyRegistered, BadServerDefinition); - - /** unregister server definition - */ - void unregisterServer (in PortableInterceptor::ServerId serverId) - raises (ServerNotRegistered); - - /** get server definition - */ - ServerDef getServer(in PortableInterceptor::ServerId serverId) - raises (ServerNotRegistered); - - /** Return whether the server has been installed - */ - boolean isInstalled( in PortableInterceptor::ServerId serverId ) - raises (ServerNotRegistered); - - /** Mark the server as being installed. Raises ServerAlreadyInstalled - * if the server is currently marked as installed. - */ - void install( in PortableInterceptor::ServerId serverId ) - raises (ServerNotRegistered, ServerAlreadyInstalled) ; - - /** Mark the server as being uninstalled. Raises ServerAlreadyUninstalled - * if the server is currently marked as uninstalled. - */ - void uninstall( in PortableInterceptor::ServerId serverId ) - raises (ServerNotRegistered, ServerAlreadyUninstalled) ; - - /** list registered servers - */ - ServerIds listRegisteredServers (); - - /** Type used for a list of application names - */ - typedef sequence AppNames ; - - /** Returns list of ALL applicationNames defined in ServerDefs of registered - * servers. - */ - AppNames getApplicationNames(); - - /** Find the ServerID associated with the given application name. - */ - PortableInterceptor::ServerId getServerID( in string applicationName ) - raises (ServerNotRegistered) ; - }; -}; --- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/CommandHandler.java 2018-01-30 20:16:10.000000000 -0500 +++ /dev/null 2018-01-30 20:16:10.000000000 -0500 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1997, 2002, 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.corba.se.impl.activation; - -import org.omg.CORBA.ORB; - -import java.io.PrintStream; - -/** - * @author Rohit Garg - * @since JDK1.2 - */ - -public interface CommandHandler -{ - String getCommandName(); - - public final static boolean shortHelp = true; - public final static boolean longHelp = false; - - void printCommandHelp(PrintStream out, boolean helpType); - - public final static boolean parseError = true; - public final static boolean commandDone = false; - - boolean processCommand(String[] cmd, ORB orb, PrintStream out); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/NameServiceStartThread.java 2018-01-30 20:16:11.000000000 -0500 +++ /dev/null 2018-01-30 20:16:11.000000000 -0500 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.activation; - - -import java.io.File; - -import org.omg.CosNaming.NamingContext; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.impl.naming.pcosnaming.NameService; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -// REVISIT: After Merlin to see if we can get rid of this Thread and -// make the registration of PNameService for INS and BootStrap neat. -public class NameServiceStartThread extends java.lang.Thread -{ - private ORB orb; - private File dbDir; - - public NameServiceStartThread( ORB theOrb, File theDir ) - { - orb = theOrb; - dbDir = theDir; - } - - public void run( ) - { - try { - // start Name Service - NameService nameService = new NameService(orb, dbDir ); - NamingContext rootContext = nameService.initialNamingContext(); - orb.register_initial_reference( - ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext ); - } catch( Exception e ) { - System.err.println( - "NameService did not start successfully" ); - e.printStackTrace( ); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ORBD.java 2018-01-30 20:16:12.000000000 -0500 +++ /dev/null 2018-01-30 20:16:12.000000000 -0500 @@ -1,352 +0,0 @@ -/* - * Copyright (c) 1997, 2004, 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.corba.se.impl.activation; - -import java.io.File; -import java.util.Properties; - -import org.omg.CORBA.INITIALIZE; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.CosNaming.NamingContext; -import org.omg.PortableServer.POA; - -import com.sun.corba.se.pept.transport.Acceptor; - -import com.sun.corba.se.spi.activation.Repository; -import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef; -import com.sun.corba.se.spi.activation.Locator; -import com.sun.corba.se.spi.activation.LocatorHelper; -import com.sun.corba.se.spi.activation.Activator; -import com.sun.corba.se.spi.activation.ActivatorHelper; -import com.sun.corba.se.spi.activation.ServerAlreadyRegistered; -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo; -import com.sun.corba.se.spi.transport.SocketInfo; -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl; -import com.sun.corba.se.impl.naming.cosnaming.TransientNameService; -import com.sun.corba.se.impl.naming.pcosnaming.NameService; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.CorbaResourceUtil; -import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl; - -/** - * - * @author Rohit Garg - * @since JDK1.2 - */ -public class ORBD -{ - private int initSvcPort; - - protected void initializeBootNaming(ORB orb) - { - // create a bootstrap server - initSvcPort = orb.getORBData().getORBInitialPort(); - - Acceptor acceptor; - // REVISIT: see ORBConfigurator. use factory in TransportDefault. - if (orb.getORBData().getLegacySocketFactory() == null) { - acceptor = - new SocketOrChannelAcceptorImpl( - orb, - initSvcPort, - LegacyServerSocketEndPointInfo.BOOT_NAMING, - SocketInfo.IIOP_CLEAR_TEXT); - } else { - acceptor = - new SocketFactoryAcceptorImpl( - orb, - initSvcPort, - LegacyServerSocketEndPointInfo.BOOT_NAMING, - SocketInfo.IIOP_CLEAR_TEXT); - } - orb.getCorbaTransportManager().registerAcceptor(acceptor); - } - - protected ORB createORB(String[] args) - { - Properties props = System.getProperties(); - - // For debugging. - //props.put( ORBConstants.DEBUG_PROPERTY, "naming" ) ; - //props.put( ORBConstants.DEBUG_PROPERTY, "transport,giop,naming" ) ; - - props.put( ORBConstants.SERVER_ID_PROPERTY, "1000" ) ; - props.put( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, - props.getProperty( ORBConstants.ORBD_PORT_PROPERTY, - Integer.toString( - ORBConstants.DEFAULT_ACTIVATION_PORT ) ) ) ; - - // See Bug 4396928 for more information about why we are initializing - // the ORBClass to PIORB (now ORBImpl, but should check the bugid). - props.put("org.omg.CORBA.ORBClass", - "com.sun.corba.se.impl.orb.ORBImpl"); - - return (ORB) ORB.init(args, props); - } - - private void run(String[] args) - { - try { - // parse the args and try setting the values for these - // properties - processArgs(args); - - ORB orb = createORB(args); - - if (orb.orbdDebugFlag) - System.out.println( "ORBD begins initialization." ) ; - - boolean firstRun = createSystemDirs( ORBConstants.DEFAULT_DB_DIR ); - - startActivationObjects(orb); - - if (firstRun) // orbd is being run the first time - installOrbServers(getRepository(), getActivator()); - - if (orb.orbdDebugFlag) { - System.out.println( "ORBD is ready." ) ; - System.out.println("ORBD serverid: " + - System.getProperty(ORBConstants.SERVER_ID_PROPERTY)); - System.out.println("activation dbdir: " + - System.getProperty(ORBConstants.DB_DIR_PROPERTY)); - System.out.println("activation port: " + - System.getProperty(ORBConstants.ORBD_PORT_PROPERTY)); - - String pollingTime = System.getProperty( - ORBConstants.SERVER_POLLING_TIME); - if( pollingTime == null ) { - pollingTime = Integer.toString( - ORBConstants.DEFAULT_SERVER_POLLING_TIME ); - } - System.out.println("activation Server Polling Time: " + - pollingTime + " milli-seconds "); - - String startupDelay = System.getProperty( - ORBConstants.SERVER_STARTUP_DELAY); - if( startupDelay == null ) { - startupDelay = Integer.toString( - ORBConstants.DEFAULT_SERVER_STARTUP_DELAY ); - } - System.out.println("activation Server Startup Delay: " + - startupDelay + " milli-seconds " ); - } - - // The following two lines start the Persistent NameService - NameServiceStartThread theThread = - new NameServiceStartThread( orb, dbDir ); - theThread.start( ); - - orb.run(); - } catch( org.omg.CORBA.COMM_FAILURE cex ) { - System.out.println( CorbaResourceUtil.getText("orbd.commfailure")); - System.out.println( cex ); - cex.printStackTrace(); - } catch( org.omg.CORBA.INTERNAL iex ) { - System.out.println( CorbaResourceUtil.getText( - "orbd.internalexception")); - System.out.println( iex ); - iex.printStackTrace(); - } catch (Exception ex) { - System.out.println(CorbaResourceUtil.getText( - "orbd.usage", "orbd")); - System.out.println( ex ); - ex.printStackTrace(); - } - } - - private void processArgs(String[] args) - { - Properties props = System.getProperties(); - for (int i=0; i < args.length; i++) { - if (args[i].equals("-port")) { - if ((i+1) < args.length) { - props.put(ORBConstants.ORBD_PORT_PROPERTY, args[++i]); - } else { - System.out.println(CorbaResourceUtil.getText( - "orbd.usage", "orbd")); - } - } else if (args[i].equals("-defaultdb")) { - if ((i+1) < args.length) { - props.put(ORBConstants.DB_DIR_PROPERTY, args[++i]); - } else { - System.out.println(CorbaResourceUtil.getText( - "orbd.usage", "orbd")); - } - } else if (args[i].equals("-serverid")) { - if ((i+1) < args.length) { - props.put(ORBConstants.SERVER_ID_PROPERTY, args[++i]); - } else { - System.out.println(CorbaResourceUtil.getText( - "orbd.usage", "orbd")); - } - } else if (args[i].equals("-serverPollingTime")) { - if ((i+1) < args.length) { - props.put(ORBConstants.SERVER_POLLING_TIME, args[++i]); - } else { - System.out.println(CorbaResourceUtil.getText( - "orbd.usage", "orbd")); - } - } else if (args[i].equals("-serverStartupDelay")) { - if ((i+1) < args.length) { - props.put(ORBConstants.SERVER_STARTUP_DELAY, args[++i]); - } else { - System.out.println(CorbaResourceUtil.getText( - "orbd.usage", "orbd")); - } - } - } - } - - /** - * Ensure that the Db directory exists. If not, create the Db - * and the log directory and return true. Otherwise return false. - */ - protected boolean createSystemDirs(String defaultDbDir) - { - boolean dirCreated = false; - Properties props = System.getProperties(); - String fileSep = props.getProperty("file.separator"); - - // determine the ORB db directory - dbDir = new File (props.getProperty( ORBConstants.DB_DIR_PROPERTY, - props.getProperty("user.dir") + fileSep + defaultDbDir)); - - // create the db and the logs directories - dbDirName = dbDir.getAbsolutePath(); - props.put(ORBConstants.DB_DIR_PROPERTY, dbDirName); - if (!dbDir.exists()) { - dbDir.mkdir(); - dirCreated = true; - } - - File logDir = new File (dbDir, ORBConstants.SERVER_LOG_DIR ) ; - if (!logDir.exists()) logDir.mkdir(); - - return dirCreated; - } - - protected File dbDir; - protected File getDbDir() - { - return dbDir; - } - - private String dbDirName; - protected String getDbDirName() - { - return dbDirName; - } - - protected void startActivationObjects(ORB orb) throws Exception - { - // create Initial Name Service object - initializeBootNaming(orb); - - // create Repository object - repository = new RepositoryImpl(orb, dbDir, orb.orbdDebugFlag ); - orb.register_initial_reference( ORBConstants.SERVER_REPOSITORY_NAME, repository ); - - // create Locator and Activator objects - ServerManagerImpl serverMgr = - new ServerManagerImpl( orb, - orb.getCorbaTransportManager(), - repository, - getDbDirName(), - orb.orbdDebugFlag ); - - locator = LocatorHelper.narrow(serverMgr); - orb.register_initial_reference( ORBConstants.SERVER_LOCATOR_NAME, locator ); - - activator = ActivatorHelper.narrow(serverMgr); - orb.register_initial_reference( ORBConstants.SERVER_ACTIVATOR_NAME, activator ); - - // start Name Service - TransientNameService nameService = new TransientNameService(orb, - ORBConstants.TRANSIENT_NAME_SERVICE_NAME); - } - - protected Locator locator; - protected Locator getLocator() - { - return locator; - } - - protected Activator activator; - protected Activator getActivator() - { - return activator; - } - - protected RepositoryImpl repository; - protected RepositoryImpl getRepository() - { - return repository; - } - - /** - * Go through the list of ORB Servers and initialize and start - * them up. - */ - protected void installOrbServers(RepositoryImpl repository, - Activator activator) - { - int serverId; - String[] server; - ServerDef serverDef; - - for (int i=0; i < orbServers.length; i++) { - try { - server = orbServers[i]; - serverDef = new ServerDef(server[1], server[2], - server[3], server[4], server[5] ); - - serverId = Integer.valueOf(orbServers[i][0]).intValue(); - - repository.registerServer(serverDef, serverId); - - activator.activate(serverId); - - } catch (Exception ex) {} - } - } - - public static void main(String[] args) { - ORBD orbd = new ORBD(); - orbd.run(args); - } - - /** - * List of servers to be auto registered and started by the ORBd. - * - * Each server entry is of the form {id, name, path, args, vmargs}. - */ - private static String[][] orbServers = { - {""} - }; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ProcessMonitorThread.java 2018-01-30 20:16:13.000000000 -0500 +++ /dev/null 2018-01-30 20:16:13.000000000 -0500 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.impl.activation; - -import java.util.*; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -/** ProcessMonitorThread is started when ServerManager is instantiated. The - * thread wakes up every minute (This can be changed by setting sleepTime) and - * makes sure that all the processes (Servers) registered with the ServerTool - * are healthy. If not the state in ServerTableEntry will be changed to - * De-Activated. - * Note: This thread can be killed from the main thread by calling - * interrupThread() - */ -public class ProcessMonitorThread extends java.lang.Thread { - private HashMap serverTable; - private int sleepTime; - private static ProcessMonitorThread instance = null; - - private ProcessMonitorThread( HashMap ServerTable, int SleepTime ) { - serverTable = ServerTable; - sleepTime = SleepTime; - } - - public void run( ) { - while( true ) { - try { - // Sleep's for a specified time, before checking - // the Servers health. This will repeat as long as - // the ServerManager (ORBD) is up and running. - Thread.sleep( sleepTime ); - } catch( java.lang.InterruptedException e ) { - break; - } - Iterator serverList; - synchronized ( serverTable ) { - // Check each ServerTableEntry to make sure that they - // are in the right state. - serverList = serverTable.values().iterator(); - } - try { - checkServerHealth( serverList ); - } catch( ConcurrentModificationException e ) { - break; - } - } - } - - private void checkServerHealth( Iterator serverList ) { - if( serverList == null ) return; - while (serverList.hasNext( ) ) { - ServerTableEntry entry = (ServerTableEntry) serverList.next(); - entry.checkProcessHealth( ); - } - } - - static void start( HashMap serverTable ) { - int sleepTime = ORBConstants.DEFAULT_SERVER_POLLING_TIME; - - String pollingTime = System.getProperties().getProperty( - ORBConstants.SERVER_POLLING_TIME ); - - if ( pollingTime != null ) { - try { - sleepTime = Integer.parseInt( pollingTime ); - } catch (Exception e ) { - // Too late to complain, Just use the default - // sleepTime - } - } - - instance = new ProcessMonitorThread( serverTable, - sleepTime ); - instance.setDaemon( true ); - instance.start(); - } - - static void interruptThread( ) { - instance.interrupt(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/activation/RepositoryImpl.java 2018-01-30 20:16:13.000000000 -0500 +++ /dev/null 2018-01-30 20:16:13.000000000 -0500 @@ -1,474 +0,0 @@ -/* - * Copyright (c) 1997, 2004, 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.corba.se.impl.activation; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.Properties; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.Vector; - -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.INITIALIZE; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.spi.activation.BadServerDefinition; -import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef; -import com.sun.corba.se.spi.activation._RepositoryImplBase; -import com.sun.corba.se.spi.activation.ServerAlreadyRegistered; -import com.sun.corba.se.spi.activation.ServerAlreadyInstalled; -import com.sun.corba.se.spi.activation.ServerAlreadyUninstalled; -import com.sun.corba.se.spi.activation.ServerNotRegistered; -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo; -import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.impl.logging.ActivationSystemException; - -/** - * - * @author Rohit Garg - * @since JDK1.2 - */ -public class RepositoryImpl extends _RepositoryImplBase - implements Serializable -{ - - // added serialver computed by the tool - private static final long serialVersionUID = 8458417785209341858L; - - RepositoryImpl(ORB orb, File dbDir, boolean debug) - { - this.debug = debug ; - this.orb = orb; - wrapper = ActivationSystemException.get( orb, CORBALogDomains.ORBD_REPOSITORY ) ; - - // if databse does not exist, create it otherwise read it in - File dbFile = new File(dbDir, "servers.db"); - if (!dbFile.exists()) { - db = new RepositoryDB(dbFile); - db.flush(); - } else { - try { - FileInputStream fis = new FileInputStream(dbFile); - ObjectInputStream ois = new ObjectInputStream(fis); - db = (RepositoryDB) ois.readObject(); - ois.close(); - } catch (Exception e) { - throw wrapper.cannotReadRepositoryDb( e ) ; - } - } - - // export the repository - orb.connect(this); - } - - private String printServerDef( ServerDef sd ) - { - return "ServerDef[applicationName=" + sd.applicationName + - " serverName=" + sd.serverName + - " serverClassPath=" + sd.serverClassPath + - " serverArgs=" + sd. serverArgs + - " serverVmArgs=" + sd.serverVmArgs + - "]" ; - } - - public int registerServer(ServerDef serverDef, int theServerId) - throws ServerAlreadyRegistered - { - int serverId; - DBServerDef server = null; - - synchronized (db) { - - // check if server already registered - Enumeration enumeration = db.serverTable.elements(); - while (enumeration.hasMoreElements()) { - server = (DBServerDef) enumeration.nextElement(); - if (serverDef.applicationName.equals(server.applicationName)) { - if (debug) - System.out.println( - "RepositoryImpl: registerServer called " + - "to register ServerDef " + - printServerDef( serverDef ) + - " with " + ((theServerId==illegalServerId) ? - "a new server Id" : ("server Id " + theServerId)) + - " FAILED because it is already registered." ) ; - - throw (new ServerAlreadyRegistered(server.id)); - } - } - - // generate a new server id - if (theServerId == illegalServerId) - serverId = db.incrementServerIdCounter(); - else - serverId = theServerId; - - // add server def to the database - server = new DBServerDef(serverDef, serverId); - db.serverTable.put(new Integer(serverId), server); - db.flush(); - - if (debug) - if (theServerId==illegalServerId) - System.out.println( "RepositoryImpl: registerServer called " + - "to register ServerDef " + printServerDef( serverDef ) + - " with new serverId " + serverId ) ; - else - System.out.println( "RepositoryImpl: registerServer called " + - "to register ServerDef " + printServerDef( serverDef ) + - " with assigned serverId " + serverId ) ; - - return serverId; - } - } - - public int registerServer(ServerDef serverDef) - throws ServerAlreadyRegistered, BadServerDefinition - { - // verify that the entry is valid - LegacyServerSocketEndPointInfo endpoint = - orb.getLegacyServerSocketManager() - .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING); - int initSvcPort = ((SocketOrChannelAcceptor)endpoint) - .getServerSocket().getLocalPort(); - ServerTableEntry entry = new ServerTableEntry( wrapper, - illegalServerId, serverDef, (int) initSvcPort, "", true, debug ); - - switch (entry.verify()) { - case ServerMain.OK: - break; - case ServerMain.MAIN_CLASS_NOT_FOUND: - throw new BadServerDefinition("main class not found."); - case ServerMain.NO_MAIN_METHOD: - throw new BadServerDefinition("no main method found."); - case ServerMain.APPLICATION_ERROR: - throw new BadServerDefinition("server application error."); - default: - throw new BadServerDefinition("unknown Exception."); - } - - return registerServer(serverDef, illegalServerId); - } - - public void unregisterServer(int serverId) throws ServerNotRegistered { - - DBServerDef server = null; - Integer id = new Integer(serverId); - - synchronized (db) { - - // check to see if the server is registered - server = (DBServerDef) db.serverTable.get(id); - if (server == null) { - if (debug) - System.out.println( - "RepositoryImpl: unregisterServer for serverId " + - serverId + " called: server not registered" ) ; - - throw (new ServerNotRegistered()); - } - - // remove server from the database - db.serverTable.remove(id); - db.flush(); - } - - if (debug) - System.out.println( - "RepositoryImpl: unregisterServer for serverId " + serverId + - " called" ) ; - } - - private DBServerDef getDBServerDef(int serverId) throws ServerNotRegistered - { - Integer id = new Integer(serverId); - DBServerDef server = (DBServerDef) db.serverTable.get(id); - - if (server == null) - throw new ServerNotRegistered( serverId ); - - return server ; - } - - public ServerDef getServer(int serverId) throws ServerNotRegistered - { - DBServerDef server = getDBServerDef( serverId ) ; - - ServerDef serverDef = new ServerDef(server.applicationName, server.name, - server.classPath, server.args, server.vmArgs); - - if (debug) - System.out.println( - "RepositoryImpl: getServer for serverId " + serverId + - " returns " + printServerDef( serverDef ) ) ; - - return serverDef; - } - - public boolean isInstalled(int serverId) throws ServerNotRegistered { - DBServerDef server = getDBServerDef( serverId ) ; - return server.isInstalled ; - } - - public void install( int serverId ) - throws ServerNotRegistered, ServerAlreadyInstalled - { - DBServerDef server = getDBServerDef( serverId ) ; - - if (server.isInstalled) - throw new ServerAlreadyInstalled( serverId ) ; - else { - server.isInstalled = true ; - db.flush() ; - } - } - - public void uninstall( int serverId ) - throws ServerNotRegistered, ServerAlreadyUninstalled - { - DBServerDef server = getDBServerDef( serverId ) ; - - if (!server.isInstalled) - throw new ServerAlreadyUninstalled( serverId ) ; - else { - server.isInstalled = false ; - db.flush() ; - } - } - - public int[] listRegisteredServers() { - synchronized (db) { - int i=0; - - int servers[] = new int[db.serverTable.size()]; - - Enumeration enumeration = db.serverTable.elements(); - - while (enumeration.hasMoreElements()) { - DBServerDef server = (DBServerDef) enumeration.nextElement(); - servers[i++] = server.id; - } - - if (debug) { - StringBuffer sb = new StringBuffer() ; - for (int ctr=0; ctr "); - - try { - int i = 0; - String cmd[] = null; - - String cmdLine = in.readLine(); - - if (cmdLine != null) { - StringTokenizer st = new StringTokenizer(cmdLine); - if (st.countTokens() != 0) { - cmd = new String[st.countTokens()]; - while (st.hasMoreTokens()) cmd[i++] = st.nextToken(); - } - } - - return cmd; - } catch (Exception ex) { - System.out.println(CorbaResourceUtil.getText("servertool.usage", "servertool")); - System.out.println(); - ex.printStackTrace(); - } - - return null; - } - - void printAvailableCommands() - { - CommandHandler handler; - - // print short help - System.out.println(CorbaResourceUtil.getText("servertool.shorthelp")); - - for (int i=0; i < handlers.size(); i++) { - handler = (CommandHandler) handlers.elementAt(i); - System.out.print("\t" + handler.getCommandName()); - for (int j=handler.getCommandName().length(); - j < maxNameLen; j++) System.out.print(" "); - System.out.print(" - "); - handler.printCommandHelp(System.out, - CommandHandler.shortHelp); - } - - System.out.println(); - } - - void executeCommand(String[] cmd) - { - boolean result; - CommandHandler handler; - - // handle the help command - if (cmd[0].equals(helpCommand)) { - if (cmd.length == 1) printAvailableCommands(); - else { - // print long help for a specific command - for (int i=0; i < handlers.size(); i++) { - handler = (CommandHandler) handlers.elementAt(i); - if (handler.getCommandName().equals(cmd[1])) { - handler.printCommandHelp(System.out, - CommandHandler.longHelp); - } - } - } - - return; - } - - // determine the subcommand and execute it - for (int i=0; i < handlers.size(); i++) { - handler = (CommandHandler) handlers.elementAt(i); - if (handler.getCommandName().equals(cmd[0])) { - String[] cmdArgs = new String[cmd.length - 1]; - - // construct args to the command - for (int j=0; j < cmdArgs.length; j++) - cmdArgs[j] = cmd[j+1]; - - // execute the command - try { - System.out.println(); - - result = handler.processCommand(cmdArgs, orb, System.out); - - if (result == CommandHandler.parseError) { - handler.printCommandHelp(System.out, - CommandHandler.longHelp); - } - - System.out.println(); - - } catch (Exception ex) {} - - return; - } - } - - // unknown command - print available commands - printAvailableCommands(); - } - - final private static boolean debug = false; - - ORB orb = null; - - static Vector handlers; - static int maxNameLen; - - static { - handlers = new Vector(); - handlers.addElement(new RegisterServer()); - handlers.addElement(new UnRegisterServer()); - handlers.addElement(new GetServerID()); - handlers.addElement(new ListServers()); - handlers.addElement(new ListAliases()); - handlers.addElement(new ListActiveServers()); - handlers.addElement(new LocateServer()); - handlers.addElement(new LocateServerForORB()); - handlers.addElement(new ListORBs()); - handlers.addElement(new ShutdownServer()); - handlers.addElement(new StartServer()); - handlers.addElement(new Help()); - handlers.addElement(new Quit()); - - // determine longest command name - maxNameLen = 0; - int cmdNameLen; - for (int i=0; i < handlers.size(); i++) { - CommandHandler handler = (CommandHandler) handlers.elementAt(i); - cmdNameLen = handler.getCommandName().length(); - if (cmdNameLen > maxNameLen) maxNameLen = cmdNameLen; - } - } -} - -class RegisterServer implements CommandHandler -{ - public String getCommandName() {return "register";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.register")); - } else { - out.println(CorbaResourceUtil.getText("servertool.register1")); - } - } - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - int i=0; - String applicationName = ""; - String name = ""; - String classpath = ""; - String args = ""; - String vmargs = ""; - int serverId = 0; - - // parse register server command - String arg; - while (i < cmdArgs.length) { - - arg = cmdArgs[i++]; - - if (arg.equals("-server")) { - if (i < cmdArgs.length) name = cmdArgs[i++]; - else return parseError; - } else if (arg.equals("-applicationName")) { - if (i < cmdArgs.length) applicationName = cmdArgs[i++]; - else return parseError; - } else if (arg.equals("-classpath")) { - if (i < cmdArgs.length) classpath = cmdArgs[i++]; - else return parseError; - } else if (arg.equals("-args")) { - while ((i < cmdArgs.length) && !cmdArgs[i].equals("-vmargs")){ - args = args.equals("") ? cmdArgs[i] : - args + " " + cmdArgs[i]; - i++; - } - if (args.equals("")) return parseError; - } else if (arg.equals("-vmargs")) { - while ((i < cmdArgs.length) && !cmdArgs[i].equals("-args")){ - vmargs = vmargs.equals("") ? cmdArgs[i] : - vmargs + " " + cmdArgs[i]; - i++; - } - if (vmargs.equals("")) return parseError; - } else return parseError; - } - - // minimally the server class name has to be specified - if (name.equals("")) return parseError; - - // register server and activate it - try { - // register the server with the repository - Repository repository = RepositoryHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME )); - - ServerDef server = new ServerDef(applicationName, name, classpath, args, vmargs); - serverId = repository.registerServer(server); - - // activate the server - Activator activator = ActivatorHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME )); - activator.activate(serverId); - activator.install(serverId); - - // print success message - out.println(CorbaResourceUtil.getText("servertool.register2", serverId)); - } catch (ServerNotRegistered ex) { - } catch (ServerAlreadyActive ex) { - } catch (ServerHeldDown ex) { - out.println(CorbaResourceUtil.getText("servertool.register3", serverId)); - } catch (ServerAlreadyRegistered ex) { - out.println(CorbaResourceUtil.getText("servertool.register4", serverId)); - } catch (BadServerDefinition ex) { - out.println(CorbaResourceUtil.getText("servertool.baddef", ex.reason)); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return commandDone; - } -} - -class UnRegisterServer implements CommandHandler -{ - public String getCommandName() {return "unregister";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.unregister")); - } else { - out.println(CorbaResourceUtil.getText("servertool.unregister1")); - } -} - - final static int illegalServerId = -1; - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - int serverId = illegalServerId; - - try { - if (cmdArgs.length == 2) { - if (cmdArgs[0].equals("-serverid")) - serverId = (Integer.valueOf(cmdArgs[1])).intValue(); - else if (cmdArgs[0].equals("-applicationName")) - serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ; - } - - // the server id has to be specified - if (serverId == illegalServerId) - return parseError; - - // deactivate server, hold it down and and unregister it - // deactivate the server - try { - Activator activator = ActivatorHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME )); - activator.uninstall(serverId); - } catch (ServerHeldDown ex) {} - - // unregister the server from the repository - Repository repository = RepositoryHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME )); - repository.unregisterServer(serverId); - - // print success message - out.println(CorbaResourceUtil.getText("servertool.unregister2")); - } catch (ServerNotRegistered ex) { - out.println(CorbaResourceUtil.getText("servertool.nosuchserver")); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return commandDone; - } -} - -class LocateServer implements CommandHandler -{ - public String getCommandName() {return "locate";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.locate")); - } else { - out.println(CorbaResourceUtil.getText("servertool.locate1")); - } - } - - final static int illegalServerId = -1; - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - int serverId = illegalServerId; - - String endPointType = IIOP_CLEAR_TEXT.value; - try { - - // parse command - String arg; - int i = 0; - while (i < cmdArgs.length) { - - arg = cmdArgs[i++]; - - if (arg.equals("-serverid")) { - if (i < cmdArgs.length) - serverId = (Integer.valueOf(cmdArgs[i++])).intValue(); - else - return parseError; - } else if (arg.equals("-applicationName")) { - if (i < cmdArgs.length) - serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[i++] ) ; - else - return parseError; - } else if (arg.equals("-endpointType")) { - if (i < cmdArgs.length) - endPointType = cmdArgs[i++]; - } - } - - // the server id has to be specified - if (serverId == illegalServerId) - return parseError; - - // locate the server - // deactivate the server - Locator locator = LocatorHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_LOCATOR_NAME )); - - ServerLocation location = locator.locateServer(serverId, endPointType); - - // print success message - out.println(CorbaResourceUtil.getText("servertool.locate2", location.hostname)); - int numEntries = location.ports.length; - for (i = 0; i < numEntries; i++) { - ORBPortInfo orbPort = location.ports[i]; - out.println("\t\t"+ orbPort.port + "\t\t" + endPointType + "\t\t" + orbPort.orbId ); - } - } catch (NoSuchEndPoint ex) { - } catch (ServerHeldDown ex) { - out.println(CorbaResourceUtil.getText("servertool.helddown")); - } catch (ServerNotRegistered ex) { - out.println(CorbaResourceUtil.getText("servertool.nosuchserver")); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return commandDone; - } -} - -class LocateServerForORB implements CommandHandler -{ - public String getCommandName() {return "locateperorb";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.locateorb")); - } else { - out.println(CorbaResourceUtil.getText("servertool.locateorb1")); - } - } - - final static int illegalServerId = -1; - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - int serverId = illegalServerId; - - String orbId = ""; - try { - - // parse command - String arg; - int i = 0; - while (i < cmdArgs.length) { - - arg = cmdArgs[i++]; - - if (arg.equals("-serverid")) { - if (i < cmdArgs.length) - serverId = (Integer.valueOf(cmdArgs[i++])).intValue(); - else - return parseError; - } else if (arg.equals("-applicationName")) { - if (i < cmdArgs.length) - serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[i++] ) ; - else - return parseError; - } else if (arg.equals("-orbid")) { - if (i < cmdArgs.length) - orbId = cmdArgs[i++]; - } - } - - // the server id has to be specified - if (serverId == illegalServerId) - return parseError; - - // locate the server - // deactivate the server - Locator locator = LocatorHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_LOCATOR_NAME )); - - ServerLocationPerORB location = locator.locateServerForORB(serverId, - orbId); - - // print success message - out.println(CorbaResourceUtil.getText("servertool.locateorb2", location.hostname)); - int numEntries = location.ports.length; - for (i = 0; i < numEntries; i++) { - EndPointInfo Port = location.ports[i]; - out.println("\t\t"+ Port.port + "\t\t" + Port.endpointType + "\t\t" + orbId ); - } - } catch (InvalidORBid ex) { - out.println(CorbaResourceUtil.getText("servertool.nosuchorb")); - } catch (ServerHeldDown ex) { - out.println(CorbaResourceUtil.getText("servertool.helddown")); - } catch (ServerNotRegistered ex) { - out.println(CorbaResourceUtil.getText("servertool.nosuchserver")); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return commandDone; - } -} - -class GetServerID implements CommandHandler -{ - public String getCommandName() {return "getserverid" ; } - - public void printCommandHelp( PrintStream out, boolean helpType ) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.getserverid")); - } else { - out.println(CorbaResourceUtil.getText("servertool.getserverid1")); - } - } - - public boolean processCommand( String[] cmdArgs, ORB orb, PrintStream out ) - { - if ((cmdArgs.length == 2) && cmdArgs[0].equals( "-applicationName" )) { - String str = (String)cmdArgs[1] ; - - try { - Repository repository = RepositoryHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME )); - - try { - int result = repository.getServerID( str ) ; - out.println() ; - out.println(CorbaResourceUtil.getText("servertool.getserverid2", str, Integer.toString(result))); - out.println() ; - } catch (ServerNotRegistered e) { - out.println(CorbaResourceUtil.getText("servertool.nosuchserver")); - } - } catch (Exception ex) { - ex.printStackTrace() ; - } - - return commandDone ; - } else - return parseError ; - } -} - -class ListServers implements CommandHandler -{ - public String getCommandName() {return "list";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.list")); - } else { - out.println(CorbaResourceUtil.getText("servertool.list1")); - } - } - - final static int illegalServerId = -1; - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - int serverId = illegalServerId; - boolean listOneServer = false; - ServerDef serverDef; - - // determine if list single server or all servers - listOneServer = (cmdArgs.length!=0) ; - if ((cmdArgs.length == 2) && cmdArgs[0].equals("-serverid")) - serverId = (Integer.valueOf(cmdArgs[1])).intValue(); - - if ((serverId == illegalServerId) && listOneServer) - return parseError; - - // process the list server command - try { - Repository repository = RepositoryHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME )); - - if (listOneServer) { - - try { - serverDef = repository.getServer(serverId); - out.println(); - printServerDef(serverDef, serverId, out); - out.println(); - } catch (ServerNotRegistered e) { - out.println(CorbaResourceUtil.getText("servertool.nosuchserver")); - } - - } else { - int[] servers = repository.listRegisteredServers(); - out.println(CorbaResourceUtil.getText("servertool.list2")); - - sortServers(servers); - for (int i=0; i < servers.length; i++) { - try { - serverDef = repository.getServer(servers[i]); - out.println("\t " + servers[i] + "\t\t" + - serverDef.serverName + "\t\t" - + serverDef.applicationName); - } catch (ServerNotRegistered e) {} - } - - } - } catch (Exception ex) { - ex.printStackTrace(); - } - - return commandDone; - } - -static void printServerDef(ServerDef serverDef, int serverId, - PrintStream out) -{ - out.println(CorbaResourceUtil.getText("servertool.appname", serverDef.applicationName)); - out.println(CorbaResourceUtil.getText("servertool.name", serverDef.serverName)); - out.println(CorbaResourceUtil.getText("servertool.classpath", serverDef.serverClassPath)); - out.println(CorbaResourceUtil.getText("servertool.args", serverDef.serverArgs)); - out.println(CorbaResourceUtil.getText("servertool.vmargs", serverDef.serverVmArgs)); - out.println(CorbaResourceUtil.getText("servertool.serverid", serverId)); -} - -/** - * Do a simple bubble sort to sort the server ids in ascending - * order. - */ -static void sortServers(int[] serverIds) -{ - int size = serverIds.length; - int lowest; - - for (int i=0; i < size; i++) { - - lowest = i; - - for (int j=i+1; j < size; j++) { - if (serverIds[j] < serverIds[lowest]) lowest = j; - } - - if (lowest != i) { - int temp = serverIds[i]; - serverIds[i] = serverIds[lowest]; - serverIds[lowest] = temp; - } - } -} -} - -class ListActiveServers implements CommandHandler -{ - public String getCommandName() {return "listactive";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.listactive")); - } else { - out.println(CorbaResourceUtil.getText("servertool.listactive1")); - } - } - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - ServerDef serverDef; - - // process the list active servers command - try { - Repository repository = RepositoryHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME )); - - Activator activator = ActivatorHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME )); - - int[] servers = activator.getActiveServers(); - - out.println(CorbaResourceUtil.getText("servertool.list2")); - - ListServers.sortServers(servers); - for (int i=0; i < servers.length; i++) { - try { - serverDef = repository.getServer(servers[i]); - out.println("\t " + servers[i] + "\t\t" + - serverDef.serverName + "\t\t" + - serverDef.applicationName); - } catch (ServerNotRegistered e) {} - } - } catch (Exception ex) { - ex.printStackTrace(); - } - - return commandDone; - } -} - -class ListAliases implements CommandHandler -{ - public String getCommandName() {return "listappnames";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.listappnames")); - } else { - out.println(CorbaResourceUtil.getText("servertool.listappnames1")); - } - } - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - try { - Repository repository = RepositoryHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME )); - - String[] applicationNames = repository.getApplicationNames(); - - out.println(CorbaResourceUtil.getText("servertool.listappnames2")); - out.println(); - for (int i=0; i < applicationNames.length; i++) - out.println( "\t" + applicationNames[i] ) ; - } catch (Exception ex) { - ex.printStackTrace(); - } - - return commandDone; - } -} - -class ShutdownServer implements CommandHandler -{ - public String getCommandName() {return "shutdown";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.shutdown")); - } else { - out.println(CorbaResourceUtil.getText("servertool.shutdown1")); - } - } - - final static int illegalServerId = -1; - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - int serverId = illegalServerId; - - try { - // determine the server id - if (cmdArgs.length == 2) - if (cmdArgs[0].equals("-serverid")) - serverId = (Integer.valueOf(cmdArgs[1])).intValue(); - else if (cmdArgs[0].equals("-applicationName")) - serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ; - - if (serverId == illegalServerId) - return parseError; - - // shutdown the server - Activator activator = ActivatorHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME )); - activator.shutdown(serverId); - - out.println(CorbaResourceUtil.getText("servertool.shutdown2")); - } catch (ServerNotActive ex) { - out.println(CorbaResourceUtil.getText("servertool.servernotrunning")); - } catch (ServerNotRegistered ex) { - out.println(CorbaResourceUtil.getText("servertool.nosuchserver")); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return commandDone; - } -} - -class StartServer implements CommandHandler -{ - public String getCommandName() {return "startup";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.startserver")); - } else { - out.println(CorbaResourceUtil.getText("servertool.startserver1")); - } - } - - final static int illegalServerId = -1; - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - int serverId = illegalServerId; - - try { - // determine the server id - if (cmdArgs.length == 2) - if (cmdArgs[0].equals("-serverid")) - serverId = (Integer.valueOf(cmdArgs[1])).intValue(); - else if (cmdArgs[0].equals("-applicationName")) - serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ; - - if (serverId == illegalServerId) - return parseError; - - // startup the server - Activator activator = ActivatorHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME )); - activator.activate(serverId); - - out.println(CorbaResourceUtil.getText("servertool.startserver2")); - } catch (ServerNotRegistered ex) { - out.println(CorbaResourceUtil.getText("servertool.nosuchserver")); - } catch (ServerAlreadyActive ex) { - out.println(CorbaResourceUtil.getText("servertool.serverup")); - } catch (ServerHeldDown ex) { - out.println(CorbaResourceUtil.getText("servertool.helddown")); - } catch (Exception ex) { - ex.printStackTrace(); - } - return commandDone; - } -} - -class Quit implements CommandHandler -{ - public String getCommandName() {return "quit";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.quit")); - } else { - out.println(CorbaResourceUtil.getText("servertool.quit1")); - } - } - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - System.exit(0); - - return commandDone; - } -} - -class Help implements CommandHandler -{ - public String getCommandName() {return "help";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.help")); - } else { - out.println(CorbaResourceUtil.getText("servertool.help1")); - } - } - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - return commandDone; - } -} - -class ListORBs implements CommandHandler -{ - public String getCommandName() {return "orblist";} - - public void printCommandHelp(PrintStream out, boolean helpType) - { - if (helpType == longHelp) { - out.println(CorbaResourceUtil.getText("servertool.orbidmap")); - } else { - out.println(CorbaResourceUtil.getText("servertool.orbidmap1")); - } - } - - final static int illegalServerId = -1; - - public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out) - { - - int serverId = illegalServerId; - - try { - if (cmdArgs.length == 2) { - if (cmdArgs[0].equals("-serverid")) - serverId = (Integer.valueOf(cmdArgs[1])).intValue(); - else if (cmdArgs[0].equals("-applicationName")) - serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ; - } - - // the server id has to be specified - if (serverId == illegalServerId) - return parseError; - // activate the server - Activator activator = ActivatorHelper.narrow( - orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME )); - - String[] orbList = activator.getORBNames(serverId); - - out.println(CorbaResourceUtil.getText("servertool.orbidmap2")); - - for (int i = 0; i < orbList.length ; i++) { - out.println("\t "+ orbList[i]); - } - } catch (ServerNotRegistered ex) { - out.println("\tno such server found."); - } catch (Exception ex) { - ex.printStackTrace(); - } - - return commandDone; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/CopierManagerImpl.java 2018-01-30 20:16:17.000000000 -0500 +++ /dev/null 2018-01-30 20:16:17.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.copyobject ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.impl.orbutil.DenseIntMapImpl ; - -import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ; -import com.sun.corba.se.spi.copyobject.CopierManager ; -import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ; - -public class CopierManagerImpl implements CopierManager -{ - private int defaultId ; - private DenseIntMapImpl map ; - private ORB orb ; - - public CopierManagerImpl( ORB orb ) - { - defaultId = 0 ; - map = new DenseIntMapImpl() ; - this.orb = orb ; - } - - public void setDefaultId( int id ) - { - defaultId = id ; - } - - public int getDefaultId() - { - return defaultId ; - } - - public ObjectCopierFactory getObjectCopierFactory( int id ) - { - return (ObjectCopierFactory)(map.get( id )) ; - } - - public ObjectCopierFactory getDefaultObjectCopierFactory() - { - return (ObjectCopierFactory)(map.get( defaultId )) ; - } - - public void registerObjectCopierFactory( ObjectCopierFactory factory, int id ) - { - map.set( id, factory ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java 2018-01-30 20:16:17.000000000 -0500 +++ /dev/null 2018-01-30 20:16:17.000000000 -0500 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.copyobject ; - -import com.sun.corba.se.spi.copyobject.ObjectCopier ; -import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ; - -/** Trys a first ObjectCopier. If the first throws a ReflectiveCopyException, - * falls back and tries a second ObjectCopier. - */ -public class FallbackObjectCopierImpl implements ObjectCopier -{ - private ObjectCopier first ; - private ObjectCopier second ; - - public FallbackObjectCopierImpl( ObjectCopier first, - ObjectCopier second ) - { - this.first = first ; - this.second = second ; - } - - public Object copy( Object src ) throws ReflectiveCopyException - { - try { - return first.copy( src ) ; - } catch (ReflectiveCopyException rce ) { - // XXX log this fallback at a low level - return second.copy( src ) ; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java 2018-01-30 20:16:18.000000000 -0500 +++ /dev/null 2018-01-30 20:16:18.000000000 -0500 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.copyobject ; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import java.io.Serializable; -import java.rmi.Remote; -import java.rmi.MarshalException; - -import java.io.InputStream ; -import java.io.OutputStream ; -import java.io.ByteArrayInputStream ; -import java.io.ByteArrayOutputStream ; -import java.io.ObjectInputStream ; -import java.io.ObjectOutputStream ; - -import org.omg.CORBA.ORB ; - -import com.sun.corba.se.spi.copyobject.ObjectCopier ; -import com.sun.corba.se.impl.util.Utility; - -public class JavaStreamObjectCopierImpl implements ObjectCopier { - - public JavaStreamObjectCopierImpl( ORB orb ) - { - this.orb = orb ; - } - - public Object copy(Object obj) { - if (obj instanceof Remote) { - // Yes, so make sure it is connected and converted - // to a stub (if needed)... - return Utility.autoConnect(obj,orb,true); - } - - try { - ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ; - ObjectOutputStream oos = new ObjectOutputStream( os ) ; - oos.writeObject( obj ) ; - - byte[] arr = os.toByteArray() ; - InputStream is = new ByteArrayInputStream( arr ) ; - ObjectInputStream ois = new ObjectInputStream( is ) ; - - return ois.readObject(); - } catch (Exception exc) { - System.out.println( "Failed with exception:" + exc ) ; - return null ; - } - } - - private ORB orb; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java 2018-01-30 20:16:19.000000000 -0500 +++ /dev/null 2018-01-30 20:16:19.000000000 -0500 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.copyobject ; - -import java.util.logging.Level; -import java.util.logging.Logger; - -import java.io.Serializable; -import java.rmi.Remote; -import java.rmi.MarshalException; - -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA.ORB ; - -import com.sun.corba.se.spi.copyobject.ObjectCopier ; -import com.sun.corba.se.impl.util.Utility; - -public class ORBStreamObjectCopierImpl implements ObjectCopier { - - public ORBStreamObjectCopierImpl( ORB orb ) - { - this.orb = orb ; - } - - public Object copy(Object obj) { - if (obj instanceof Remote) { - // Yes, so make sure it is connected and converted - // to a stub (if needed)... - return Utility.autoConnect(obj,orb,true); - } - - OutputStream out = (OutputStream)orb.create_output_stream(); - out.write_value((Serializable)obj); - InputStream in = (InputStream)out.create_input_stream(); - return in.read_value(); - } - - private ORB orb; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java 2018-01-30 20:16:20.000000000 -0500 +++ /dev/null 2018-01-30 20:16:20.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.copyobject ; - -import com.sun.corba.se.spi.copyobject.ObjectCopier ; - -public class ReferenceObjectCopierImpl implements ObjectCopier -{ - public Object copy( Object obj ) - { - return obj ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java 2018-01-30 20:16:20.000000000 -0500 +++ /dev/null 2018-01-30 20:16:20.000000000 -0500 @@ -1,1351 +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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.List ; -import java.util.ArrayList ; - -import org.omg.CORBA.Principal ; -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.CompletionStatus ; -import org.omg.CORBA.TCKind ; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.TypeCodePackage.BadKind; -import org.omg.CORBA.TypeCodePackage.Bounds; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter; - -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.EncapsInputStream; -import com.sun.corba.se.impl.encoding.EncapsOutputStream; -import com.sun.corba.se.impl.io.ValueUtility; -import com.sun.corba.se.impl.orbutil.RepositoryIdFactory; -import com.sun.corba.se.impl.orbutil.RepositoryIdStrings; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -// subclasses must provide a matching helper class -public class AnyImpl extends Any -{ - private static final class AnyInputStream extends EncapsInputStream - { - public AnyInputStream(EncapsInputStream theStream ) - { - super( theStream ); - } - } - - private static final class AnyOutputStream extends EncapsOutputStream - { - public AnyOutputStream(ORB orb) - { - super((ORB)orb); - } - - public org.omg.CORBA.portable.InputStream create_input_stream() { - final org.omg.CORBA.portable.InputStream is = super - .create_input_stream(); - AnyInputStream aIS = AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public AnyInputStream run() { - return new AnyInputStream( - (com.sun.corba.se.impl.encoding.EncapsInputStream) is); - } - }); - return aIS; - } - } - - // - // Always valid. - // - private TypeCodeImpl typeCode; - protected ORB orb; - private ORBUtilSystemException wrapper ; - - // - // Validity depends upon typecode. The 'value' and 'object' instance - // members are used to hold immutable types as defined by the - // isStreamed[] table below. Otherwise, 'stream' is non-null and - // holds the value in CDR marshaled format. As an optimization, the - // stream type is an Any extension of CDR stream that is used to - // detect an optimization in read_value(). - // - private CDRInputStream stream; - private long value; - private java.lang.Object object; - - // Setting the typecode via the type() accessor wipes out the value. - // An attempt to extract before the value is set will result - // in a BAD_OPERATION exception being raised. - private boolean isInitialized = false; - - private static final int DEFAULT_BUFFER_SIZE = 32; - - /* - * This boolean array tells us if a given typecode must be - * streamed. Objects that are immutable don't have to be streamed. - */ - static boolean isStreamed[] = { - false, // null - false, // void - false, // short - false, // long - false, // ushort - false, // ulong - false, // float - false, // double - false, // boolean - false, // char - false, // octet - false, // any - false, // TypeCode - true, // Principal - false, // objref - true, // struct - true, // union - false, // enum - false, // string - true, // sequence - true, // array - true, // alias - true, // except - false, // longlong - false, // ulonglong - false, // longdouble - false, // wchar - false, // wstring - false, // fixed - false, // value - false, // value_box (used to be true) - false, // native - false // abstract interface - }; - - static AnyImpl convertToNative(ORB orb, Any any) { - if (any instanceof AnyImpl) { - return (AnyImpl)any; - } else { - AnyImpl anyImpl = new AnyImpl(orb, any); - anyImpl.typeCode = TypeCodeImpl.convertToNative(orb, anyImpl.typeCode); - return anyImpl; - } - } - - /////////////////////////////////////////////////////////////////////////// - // Constructors - - /** - * A constructor that sets the Any to contain a null. It also marks - * the value as being invalid so that extractions throw an exception - * until an insertion has been performed. - */ - public AnyImpl(ORB orb) - { - this.orb = orb; - wrapper = ORBUtilSystemException.get( (com.sun.corba.se.spi.orb.ORB)orb, - CORBALogDomains.RPC_PRESENTATION ) ; - - typeCode = orb.get_primitive_tc(TCKind._tk_null); - stream = null; - object = null; - value = 0; - // null is a valid value - isInitialized = true; - } - - // - // Create a new AnyImpl which is a copy of obj. - // - public AnyImpl(ORB orb, Any obj) { - this(orb); - - if ((obj instanceof AnyImpl)) { - AnyImpl objImpl = (AnyImpl)obj; - typeCode = objImpl.typeCode; - value = objImpl.value; - object = objImpl.object; - isInitialized = objImpl.isInitialized; - - if (objImpl.stream != null) - stream = objImpl.stream.dup(); - - } else { - read_value(obj.create_input_stream(), obj.type()); - } - } - - /////////////////////////////////////////////////////////////////////////// - // basic accessors - - /** - * returns the type of the element contained in the Any. - * - * @return the TypeCode for the element in the Any - */ - public TypeCode type() { - return typeCode; - } - - private TypeCode realType() { - return realType(typeCode); - } - - private TypeCode realType(TypeCode aType) { - TypeCode realType = aType; - try { - // Note: Indirect types are handled in kind() method - while (realType.kind().value() == TCKind._tk_alias) { - realType = realType.content_type(); - } - } catch (BadKind bad) { // impossible - throw wrapper.badkindCannotOccur( bad ) ; - } - return realType; - } - - /** - * sets the type of the element to be contained in the Any. - * - * @param tc the TypeCode for the element in the Any - */ - public void type(TypeCode tc) - { - //debug.log ("type2"); - // set the typecode - typeCode = TypeCodeImpl.convertToNative(orb, tc); - - stream = null; - value = 0; - object = null; - // null is the only legal value this Any can have after resetting the type code - isInitialized = (tc.kind().value() == TCKind._tk_null); - } - - /** - * checks for equality between Anys. - * - * @param otherAny the Any to be compared with. - * @return true if the Anys are equal, false otherwise. - */ - public boolean equal(Any otherAny) - { - //debug.log ("equal"); - - if (otherAny == this) - return true; - - // first check for typecode equality. - // note that this will take aliases into account - if (!typeCode.equal(otherAny.type())) - return false; - - // Resolve aliases here - TypeCode realType = realType(); - - // _REVISIT_ Possible optimization for the case where - // otherAny is a AnyImpl and the endianesses match. - // Need implementation of CDRInputStream.equals() - // For now we disable this to encourage testing the generic, - // unoptimized code below. - // Unfortunately this generic code needs to copy the whole stream - // at least once. - // if (AnyImpl.isStreamed[realType.kind().value()]) { - // if (otherAny instanceof AnyImpl) { - // return ((AnyImpl)otherAny).stream.equals(stream); - // } - // } - switch (realType.kind().value()) { - // handle primitive types - case TCKind._tk_null: - case TCKind._tk_void: - return true; - case TCKind._tk_short: - return (extract_short() == otherAny.extract_short()); - case TCKind._tk_long: - return (extract_long() == otherAny.extract_long()); - case TCKind._tk_ushort: - return (extract_ushort() == otherAny.extract_ushort()); - case TCKind._tk_ulong: - return (extract_ulong() == otherAny.extract_ulong()); - case TCKind._tk_float: - return (extract_float() == otherAny.extract_float()); - case TCKind._tk_double: - return (extract_double() == otherAny.extract_double()); - case TCKind._tk_boolean: - return (extract_boolean() == otherAny.extract_boolean()); - case TCKind._tk_char: - return (extract_char() == otherAny.extract_char()); - case TCKind._tk_wchar: - return (extract_wchar() == otherAny.extract_wchar()); - case TCKind._tk_octet: - return (extract_octet() == otherAny.extract_octet()); - case TCKind._tk_any: - return extract_any().equal(otherAny.extract_any()); - case TCKind._tk_TypeCode: - return extract_TypeCode().equal(otherAny.extract_TypeCode()); - case TCKind._tk_string: - return extract_string().equals(otherAny.extract_string()); - case TCKind._tk_wstring: - return (extract_wstring().equals(otherAny.extract_wstring())); - case TCKind._tk_longlong: - return (extract_longlong() == otherAny.extract_longlong()); - case TCKind._tk_ulonglong: - return (extract_ulonglong() == otherAny.extract_ulonglong()); - - case TCKind._tk_objref: - return (extract_Object().equals(otherAny.extract_Object())); - case TCKind._tk_Principal: - return (extract_Principal().equals(otherAny.extract_Principal())); - - case TCKind._tk_enum: - return (extract_long() == otherAny.extract_long()); - case TCKind._tk_fixed: - return (extract_fixed().compareTo(otherAny.extract_fixed()) == 0); - case TCKind._tk_except: - case TCKind._tk_struct: - case TCKind._tk_union: - case TCKind._tk_sequence: - case TCKind._tk_array: - InputStream copyOfMyStream = this.create_input_stream(); - InputStream copyOfOtherStream = otherAny.create_input_stream(); - return equalMember(realType, copyOfMyStream, copyOfOtherStream); - - // Too complicated to handle value types the way we handle - // other complex types above. Don't try to decompose it here - // for faster comparison, just use Object.equals(). - case TCKind._tk_value: - case TCKind._tk_value_box: - return extract_Value().equals(otherAny.extract_Value()); - - case TCKind._tk_alias: - throw wrapper.errorResolvingAlias() ; - - case TCKind._tk_longdouble: - // Unspecified for Java - throw wrapper.tkLongDoubleNotSupported() ; - - default: - throw wrapper.typecodeNotSupported() ; - } - } - - // Needed for equal() in order to achieve linear performance for complex types. - // Uses up (recursively) copies of the InputStream in both Anys that got created in equal(). - private boolean equalMember(TypeCode memberType, InputStream myStream, InputStream otherStream) { - // Resolve aliases here - TypeCode realType = realType(memberType); - - try { - switch (realType.kind().value()) { - // handle primitive types - case TCKind._tk_null: - case TCKind._tk_void: - return true; - case TCKind._tk_short: - return (myStream.read_short() == otherStream.read_short()); - case TCKind._tk_long: - return (myStream.read_long() == otherStream.read_long()); - case TCKind._tk_ushort: - return (myStream.read_ushort() == otherStream.read_ushort()); - case TCKind._tk_ulong: - return (myStream.read_ulong() == otherStream.read_ulong()); - case TCKind._tk_float: - return (myStream.read_float() == otherStream.read_float()); - case TCKind._tk_double: - return (myStream.read_double() == otherStream.read_double()); - case TCKind._tk_boolean: - return (myStream.read_boolean() == otherStream.read_boolean()); - case TCKind._tk_char: - return (myStream.read_char() == otherStream.read_char()); - case TCKind._tk_wchar: - return (myStream.read_wchar() == otherStream.read_wchar()); - case TCKind._tk_octet: - return (myStream.read_octet() == otherStream.read_octet()); - case TCKind._tk_any: - return myStream.read_any().equal(otherStream.read_any()); - case TCKind._tk_TypeCode: - return myStream.read_TypeCode().equal(otherStream.read_TypeCode()); - case TCKind._tk_string: - return myStream.read_string().equals(otherStream.read_string()); - case TCKind._tk_wstring: - return (myStream.read_wstring().equals(otherStream.read_wstring())); - case TCKind._tk_longlong: - return (myStream.read_longlong() == otherStream.read_longlong()); - case TCKind._tk_ulonglong: - return (myStream.read_ulonglong() == otherStream.read_ulonglong()); - - case TCKind._tk_objref: - return (myStream.read_Object().equals(otherStream.read_Object())); - case TCKind._tk_Principal: - return (myStream.read_Principal().equals(otherStream.read_Principal())); - - case TCKind._tk_enum: - return (myStream.read_long() == otherStream.read_long()); - case TCKind._tk_fixed: - return (myStream.read_fixed().compareTo(otherStream.read_fixed()) == 0); - case TCKind._tk_except: - case TCKind._tk_struct: { - int length = realType.member_count(); - for (int i=0; i() { - @Override - public AnyOutputStream run() { - return new AnyOutputStream(finalorb); - } - }); - } - - /** - * returns an input stream that an Any value can be marshaled out of. - * - * @return the InputStream to marshal value of Any out of. - */ - public org.omg.CORBA.portable.InputStream create_input_stream() - { - // - // We create a new InputStream so that multiple threads can call here - // and read the streams in parallel without thread safety problems. - // - //debug.log ("create_input_stream"); - if (AnyImpl.isStreamed[realType().kind().value()]) { - return stream.dup(); - } else { - OutputStream os = (OutputStream)orb.create_output_stream(); - TCUtility.marshalIn(os, realType(), value, object); - - return os.create_input_stream(); - } - } - - /////////////////////////////////////////////////////////////////////////// - // marshaling/unmarshaling routines - - // - // If the InputStream is a CDRInputStream then we can copy the bytes - // since it is in our format and does not have alignment issues. - // - public void read_value(org.omg.CORBA.portable.InputStream in, TypeCode tc) - { - //debug.log ("read_value"); - // - // Assume that someone isn't going to think they can keep reading - // from this stream after calling us. That would be likely for - // an IIOPInputStream but if it is an AnyInputStream then they - // presumably obtained it via our create_output_stream() so they could - // write the contents of an IDL data type to it and then call - // create_input_stream() for us to read it. This is how Helper classes - // typically implement the insert() method. - // We should probably document this behavior in the 1.1 revision - // task force. - // - - typeCode = TypeCodeImpl.convertToNative(orb, tc); - int kind = realType().kind().value(); - if (kind >= isStreamed.length) { - throw wrapper.invalidIsstreamedTckind( CompletionStatus.COMPLETED_MAYBE, - new Integer(kind)) ; - } - - if (AnyImpl.isStreamed[kind]) { - if ( in instanceof AnyInputStream ) { - // could only have been created here - stream = (CDRInputStream)in; - } else { - org.omg.CORBA_2_3.portable.OutputStream out = - (org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream(); - typeCode.copy((org.omg.CORBA_2_3.portable.InputStream)in, out); - stream = (CDRInputStream)out.create_input_stream(); - } - } else { - java.lang.Object[] objholder = new java.lang.Object[1]; - objholder[0] = object; - long[] longholder = new long[1]; - TCUtility.unmarshalIn(in, realType(), longholder, objholder); - value = longholder[0]; - object = objholder[0]; - stream = null; - } - isInitialized = true; - } - - - // - // We could optimize this by noticing whether the target stream - // has ever had anything marshaled on it that required an - // alignment of greater than 4 (was write_double() ever called on it). - // If not, then we can just do a byte array copy without having to - // drive the remarshaling through typecode interpretation. - // - public void write_value(OutputStream out) - { - //debug.log ("write_value"); - if (AnyImpl.isStreamed[realType().kind().value()]) { - typeCode.copy(stream.dup(), out); - } else { - // _REVISIT_ check isInitialized whether all we write is TypeCode! - TCUtility.marshalIn(out, realType(), value, object); - } - } - - /** - * takes a streamable and inserts its reference into the any - * - * @param s the streamable to insert - */ - public void insert_Streamable(Streamable s) - { - //debug.log ("insert_Streamable"); - typeCode = TypeCodeImpl.convertToNative(orb, s._type()); - object = s; - isInitialized = true; - } - - public Streamable extract_Streamable() - { - //debug.log( "extract_Streamable" ) ; - return (Streamable)object; - } - - /////////////////////////////////////////////////////////////////////////// - // insertion/extraction/replacement for all basic types - - /** - * See the description of the general Any operations. - */ - public void insert_short(short s) - { - //debug.log ("insert_short"); - typeCode = orb.get_primitive_tc(TCKind._tk_short); - value = s; - isInitialized = true; - } - - private String getTCKindName( int tc ) - { - if ((tc >= 0) && (tc < TypeCodeImpl.kindNames.length)) - return TypeCodeImpl.kindNames[tc] ; - else - return "UNKNOWN(" + tc + ")" ; - } - - private void checkExtractBadOperation( int expected ) - { - if (!isInitialized) - throw wrapper.extractNotInitialized() ; - - int tc = realType().kind().value() ; - if (tc != expected) { - String tcName = getTCKindName( tc ) ; - String expectedName = getTCKindName( expected ) ; - throw wrapper.extractWrongType( expectedName, tcName ) ; - } - } - - private void checkExtractBadOperationList( int[] expected ) - { - if (!isInitialized) - throw wrapper.extractNotInitialized() ; - - int tc = realType().kind().value() ; - for (int ctr=0; ctrgeneral Any operations. - */ - public short extract_short() - { - //debug.log ("extract_short"); - checkExtractBadOperation( TCKind._tk_short ) ; - return (short)value; - } - - /** - * See the description of the general Any operations. - */ - public void insert_long(int l) - { - //debug.log ("insert_long"); - // A long value is applicable to enums as well, so don't erase the enum type code - // in case it was initialized that way before. - int kind = realType().kind().value(); - if (kind != TCKind._tk_long && kind != TCKind._tk_enum) { - typeCode = orb.get_primitive_tc(TCKind._tk_long); - } - value = l; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public int extract_long() - { - //debug.log ("extract_long"); - checkExtractBadOperationList( new int[] { TCKind._tk_long, TCKind._tk_enum } ) ; - return (int)value; - } - - /** - * See the description of the general Any operations. - */ - public void insert_ushort(short s) - { - //debug.log ("insert_ushort"); - typeCode = orb.get_primitive_tc(TCKind._tk_ushort); - value = s; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public short extract_ushort() - { - //debug.log ("extract_ushort"); - checkExtractBadOperation( TCKind._tk_ushort ) ; - return (short)value; - } - - /** - * See the description of the general Any operations. - */ - public void insert_ulong(int l) - { - //debug.log ("insert_ulong"); - typeCode = orb.get_primitive_tc(TCKind._tk_ulong); - value = l; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public int extract_ulong() - { - //debug.log ("extract_ulong"); - checkExtractBadOperation( TCKind._tk_ulong ) ; - return (int)value; - } - - /** - * See the description of the general Any operations. - */ - public void insert_float(float f) - { - //debug.log ("insert_float"); - typeCode = orb.get_primitive_tc(TCKind._tk_float); - value = Float.floatToIntBits(f); - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public float extract_float() - { - //debug.log ("extract_float"); - checkExtractBadOperation( TCKind._tk_float ) ; - return Float.intBitsToFloat((int)value); - } - - /** - * See the description of the general Any operations. - */ - public void insert_double(double d) - { - //debug.log ("insert_double"); - typeCode = orb.get_primitive_tc(TCKind._tk_double); - value = Double.doubleToLongBits(d); - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public double extract_double() - { - //debug.log ("extract_double"); - checkExtractBadOperation( TCKind._tk_double ) ; - return Double.longBitsToDouble(value); - } - - /** - * See the description of the general Any operations. - */ - public void insert_longlong(long l) - { - //debug.log ("insert_longlong"); - typeCode = orb.get_primitive_tc(TCKind._tk_longlong); - value = l; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public long extract_longlong() - { - //debug.log ("extract_longlong"); - checkExtractBadOperation( TCKind._tk_longlong ) ; - return value; - } - - /** - * See the description of the general Any operations. - */ - public void insert_ulonglong(long l) - { - //debug.log ("insert_ulonglong"); - typeCode = orb.get_primitive_tc(TCKind._tk_ulonglong); - value = l; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public long extract_ulonglong() - { - //debug.log ("extract_ulonglong"); - checkExtractBadOperation( TCKind._tk_ulonglong ) ; - return value; - } - - /** - * See the description of the general Any operations. - */ - public void insert_boolean(boolean b) - { - //debug.log ("insert_boolean"); - typeCode = orb.get_primitive_tc(TCKind._tk_boolean); - value = (b)? 1:0; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public boolean extract_boolean() - { - //debug.log ("extract_boolean"); - checkExtractBadOperation( TCKind._tk_boolean ) ; - return (value == 0)? false: true; - } - - /** - * See the description of the general Any operations. - */ - public void insert_char(char c) - { - //debug.log ("insert_char"); - typeCode = orb.get_primitive_tc(TCKind._tk_char); - value = c; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public char extract_char() - { - //debug.log ("extract_char"); - checkExtractBadOperation( TCKind._tk_char ) ; - return (char)value; - } - - /** - * See the description of the general Any operations. - */ - public void insert_wchar(char c) - { - //debug.log ("insert_wchar"); - typeCode = orb.get_primitive_tc(TCKind._tk_wchar); - value = c; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public char extract_wchar() - { - //debug.log ("extract_wchar"); - checkExtractBadOperation( TCKind._tk_wchar ) ; - return (char)value; - } - - - /** - * See the description of the general Any operations. - */ - public void insert_octet(byte b) - { - //debug.log ("insert_octet"); - typeCode = orb.get_primitive_tc(TCKind._tk_octet); - value = b; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public byte extract_octet() - { - //debug.log ("extract_octet"); - checkExtractBadOperation( TCKind._tk_octet ) ; - return (byte)value; - } - - /** - * See the description of the general Any operations. - */ - public void insert_string(String s) - { - //debug.log ("insert_string"); - // Make sure type code information for bounded strings is not erased - if (typeCode.kind() == TCKind.tk_string) { - int length = 0; - try { - length = typeCode.length(); - } catch (BadKind bad) { - throw wrapper.badkindCannotOccur() ; - } - - // Check if bounded strings length is not exceeded - if (length != 0 && s != null && s.length() > length) { - throw wrapper.badStringBounds( new Integer(s.length()), - new Integer(length) ) ; - } - } else { - typeCode = orb.get_primitive_tc(TCKind._tk_string); - } - object = s; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public String extract_string() - { - //debug.log ("extract_string"); - checkExtractBadOperation( TCKind._tk_string ) ; - return (String)object; - } - - /** - * See the description of the general Any operations. - */ - public void insert_wstring(String s) - { - //debug.log ("insert_wstring"); - // Make sure type code information for bounded strings is not erased - if (typeCode.kind() == TCKind.tk_wstring) { - int length = 0; - try { - length = typeCode.length(); - } catch (BadKind bad) { - throw wrapper.badkindCannotOccur() ; - } - - // Check if bounded strings length is not exceeded - if (length != 0 && s != null && s.length() > length) { - throw wrapper.badStringBounds( new Integer(s.length()), - new Integer(length) ) ; - } - } else { - typeCode = orb.get_primitive_tc(TCKind._tk_wstring); - } - object = s; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public String extract_wstring() - { - //debug.log ("extract_wstring"); - checkExtractBadOperation( TCKind._tk_wstring ) ; - return (String)object; - } - - /** - * See the description of the general Any operations. - */ - public void insert_any(Any a) - { - //debug.log ("insert_any"); - typeCode = orb.get_primitive_tc(TCKind._tk_any); - object = a; - stream = null; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public Any extract_any() - { - //debug.log ("extract_any"); - checkExtractBadOperation( TCKind._tk_any ) ; - return (Any)object; - } - - /** - * See the description of the general Any operations. - */ - public void insert_Object(org.omg.CORBA.Object o) - { - //debug.log ("insert_Object"); - if ( o == null ) { - typeCode = orb.get_primitive_tc(TCKind._tk_objref); - } else { - if (StubAdapter.isStub(o)) { - String[] ids = StubAdapter.getTypeIds( o ) ; - typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], ""); - } else { - throw wrapper.badInsertobjParam( - CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ; - } - } - - object = o; - isInitialized = true; - } - - /** - * A variant of the insertion operation that takes a typecode - * argument as well. - */ - public void insert_Object(org.omg.CORBA.Object o, TypeCode tc) - { - //debug.log ("insert_Object2"); - try { - if ( tc.id().equals("IDL:omg.org/CORBA/Object:1.0") || o._is_a(tc.id()) ) - { - typeCode = TypeCodeImpl.convertToNative(orb, tc); - object = o; - } - else { - throw wrapper.insertObjectIncompatible() ; - } - } catch ( Exception ex ) { - throw wrapper.insertObjectFailed(ex) ; - } - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public org.omg.CORBA.Object extract_Object() - { - //debug.log ("extract_Object"); - if (!isInitialized) - throw wrapper.extractNotInitialized() ; - - // Check if the object contained here is of the type in typeCode - org.omg.CORBA.Object obj = null; - try { - obj = (org.omg.CORBA.Object) object; - if (typeCode.id().equals("IDL:omg.org/CORBA/Object:1.0") || obj._is_a(typeCode.id())) { - return obj; - } else { - throw wrapper.extractObjectIncompatible() ; - } - } catch ( Exception ex ) { - throw wrapper.extractObjectFailed(ex); - } - } - - /** - * See the description of the general Any operations. - */ - public void insert_TypeCode(TypeCode tc) - { - //debug.log ("insert_TypeCode"); - typeCode = orb.get_primitive_tc(TCKind._tk_TypeCode); - object = tc; - isInitialized = true; - } - - /** - * See the description of the general Any operations. - */ - public TypeCode extract_TypeCode() - { - //debug.log ("extract_TypeCode"); - checkExtractBadOperation( TCKind._tk_TypeCode ) ; - return (TypeCode)object; - } - - /** - * @deprecated - */ - @Deprecated - public void insert_Principal(Principal p) - { - typeCode = orb.get_primitive_tc(TCKind._tk_Principal); - object = p; - isInitialized = true; - } - - /** - * @deprecated - */ - @Deprecated - public Principal extract_Principal() - { - checkExtractBadOperation( TCKind._tk_Principal ) ; - return (Principal)object; - } - - /** - * Note that the Serializable really should be an IDLEntity of - * some kind. It shouldn't just be an RMI-IIOP type. Currently, - * we accept and will produce RMI repIds with the latest - * calculations if given a non-IDLEntity Serializable. - */ - public Serializable extract_Value() - { - //debug.log ("extract_Value"); - checkExtractBadOperationList( new int[] { TCKind._tk_value, - TCKind._tk_value_box, TCKind._tk_abstract_interface } ) ; - return (Serializable)object; - } - - public void insert_Value(Serializable v) - { - //debug.log ("insert_Value"); - object = v; - - TypeCode tc; - - if ( v == null ) { - tc = orb.get_primitive_tc (TCKind.tk_value); - } else { - // See note in getPrimitiveTypeCodeForClass. We - // have to use the latest type code fixes in this - // case since there is no way to know what ORB will - // actually send this Any. In RMI-IIOP, when using - // Util.writeAny, we can do the versioning correctly, - // and use the insert_Value(Serializable, TypeCode) - // method. - // - // The ORB singleton uses the latest version. - tc = createTypeCodeForClass (v.getClass(), (ORB)ORB.init()); - } - - typeCode = TypeCodeImpl.convertToNative(orb, tc); - isInitialized = true; - } - - public void insert_Value(Serializable v, org.omg.CORBA.TypeCode t) - { - //debug.log ("insert_Value2"); - object = v; - typeCode = TypeCodeImpl.convertToNative(orb, t); - isInitialized = true; - } - - public void insert_fixed(java.math.BigDecimal value) { - typeCode = TypeCodeImpl.convertToNative(orb, - orb.create_fixed_tc(TypeCodeImpl.digits(value), TypeCodeImpl.scale(value))); - object = value; - isInitialized = true; - } - - public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type) - { - try { - if (TypeCodeImpl.digits(value) > type.fixed_digits() || - TypeCodeImpl.scale(value) > type.fixed_scale()) - { - throw wrapper.fixedNotMatch() ; - } - } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) { - // type isn't even of kind fixed - throw wrapper.fixedBadTypecode( bk ) ; - } - typeCode = TypeCodeImpl.convertToNative(orb, type); - object = value; - isInitialized = true; - } - - public java.math.BigDecimal extract_fixed() { - checkExtractBadOperation( TCKind._tk_fixed ) ; - return (BigDecimal)object; - } - - /** - * Utility method for insert_Value and Util.writeAny. - * - * The ORB passed in should have the desired ORBVersion. It - * is used to generate the type codes. - */ - public TypeCode createTypeCodeForClass (java.lang.Class c, ORB tcORB) - { - // Look in the cache first - TypeCodeImpl classTC = tcORB.getTypeCodeForClass(c); - if (classTC != null) - return classTC; - - // All cases need to be able to create repository IDs. - // - // See bug 4391648 for more info about the tcORB in this - // case. - RepositoryIdStrings repStrs - = RepositoryIdFactory.getRepIdStringsFactory(); - - - // Assertion: c instanceof Serializable? - - if ( c.isArray() ) { - // Arrays - may recurse for multi-dimensional arrays - Class componentClass = c.getComponentType(); - TypeCode embeddedType; - if ( componentClass.isPrimitive() ) { - embeddedType = getPrimitiveTypeCodeForClass(componentClass, - tcORB); - } else { - embeddedType = createTypeCodeForClass (componentClass, - tcORB); - } - TypeCode t = tcORB.create_sequence_tc (0, embeddedType); - - String id = repStrs.createForJavaType(c); - - return tcORB.create_value_box_tc (id, "Sequence", t); - } else if ( c == java.lang.String.class ) { - // Strings - TypeCode t = tcORB.create_string_tc (0); - - String id = repStrs.createForJavaType(c); - - return tcORB.create_value_box_tc (id, "StringValue", t); - } - - // Anything else - // We know that this is a TypeCodeImpl since it is our ORB - classTC = (TypeCodeImpl)ValueUtility.createTypeCodeForClass( - tcORB, c, ORBUtility.createValueHandler()); - // Intruct classTC to store its buffer - classTC.setCaching(true); - // Update the cache - tcORB.setTypeCodeForClass(c, classTC); - return classTC; - } - - /** - * It looks like this was copied from io.ValueUtility at some - * point. - * - * It's used by createTypeCodeForClass. The tcORB passed in - * should have the desired ORB version, and is used to - * create the type codes. - */ - private TypeCode getPrimitiveTypeCodeForClass (Class c, ORB tcORB) - { - //debug.log ("getPrimitiveTypeCodeForClass"); - - if (c == Integer.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_long); - } else if (c == Byte.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_octet); - } else if (c == Long.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_longlong); - } else if (c == Float.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_float); - } else if (c == Double.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_double); - } else if (c == Short.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_short); - } else if (c == Character.TYPE) { - // For Merlin or later JDKs, or for foreign ORBs, - // we correctly say that a Java char maps to a - // CORBA wchar. For backwards compatibility - // with our older ORBs, we say it maps to a - // CORBA char. This is only used in RMI-IIOP - // in our javax.rmi.CORBA.Util delegate's - // writeAny method. In Java IDL, there's no way - // to know the ORB version that the Any will be - // sent out with -- it could be different than - // the one used to create the Any -- so we use the - // most recent version (see insert_Value). - if (ORBVersionFactory.getFOREIGN().compareTo(tcORB.getORBVersion()) == 0 || - ORBVersionFactory.getNEWER().compareTo(tcORB.getORBVersion()) <= 0) - return tcORB.get_primitive_tc(TCKind.tk_wchar); - else - return tcORB.get_primitive_tc(TCKind.tk_char); - } else if (c == Boolean.TYPE) { - return tcORB.get_primitive_tc (TCKind.tk_boolean); - } else { - // _REVISIT_ Not sure if this is right. - return tcORB.get_primitive_tc (TCKind.tk_any); - } - } - - // Extracts a member value according to the given TypeCode from the given complex Any - // (at the Anys current internal stream position, consuming the anys stream on the way) - // and returns it wrapped into a new Any - public Any extractAny(TypeCode memberType, ORB orb) { - Any returnValue = orb.create_any(); - OutputStream out = returnValue.create_output_stream(); - TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out); - returnValue.read_value(out.create_input_stream(), memberType); - return returnValue; - } - - // This method could very well be moved into TypeCodeImpl or a common utility class, - // but is has to be in this package. - static public Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) { - Any returnValue = orb.create_any(); - OutputStream out = returnValue.create_output_stream(); - TypeCodeImpl.convertToNative(orb, memberType).copy(input, out); - returnValue.read_value(out.create_input_stream(), memberType); - return returnValue; - } - - // There is no other way for DynAnys to find out whether the Any is initialized. - public boolean isInitialized() { - return isInitialized; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImplHelper.java 2018-01-30 20:16:21.000000000 -0500 +++ /dev/null 2018-01-30 20:16:21.000000000 -0500 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1999, 2002, 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. - */ -/* - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -abstract public class AnyImplHelper -{ - private static String _id = "IDL:omg.org/CORBA/Any:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Any that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.Any extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.Any read (org.omg.CORBA.portable.InputStream istream) - { - return istream.read_any (); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any value) - { - ostream.write_any (value); - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AsynchInvoke.java 2018-01-30 20:16:22.000000000 -0500 +++ /dev/null 2018-01-30 20:16:22.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import com.sun.corba.se.spi.orb.ORB ; - -/////////////////////////////////////////////////////////////////////////// -// helper class for deferred invocations - -/* - * The AsynchInvoke class allows for the support of asynchronous - * invocations. Instances of these are created with a request object, - * and when run, perform an invocation. The instance is also - * responsible for waking up a client that might be waiting on the - * 'get_response' method. - */ - -public class AsynchInvoke implements Runnable { - - private RequestImpl _req; - private ORB _orb; - private boolean _notifyORB; - - public AsynchInvoke (ORB o, RequestImpl reqToInvokeOn, boolean n) - { - _orb = o; - _req = reqToInvokeOn; - _notifyORB = n; - }; - - - /* - * The run operation calls the invocation on the request object, - * updates the RequestImpl state to indicate that the asynchronous - * invocation is complete, and wakes up any client that might be - * waiting on a 'get_response' call. - * - */ - - public void run() - { - // do the actual invocation - _req.doInvocation(); - - // for the asynchronous case, note that the response has been - // received. - synchronized (_req) - { - // update local boolean indicator - _req.gotResponse = true; - - // notify any client waiting on a 'get_response' - _req.notify(); - } - - if (_notifyORB == true) { - _orb.notifyORB() ; - } - } - -}; - -/////////////////////////////////////////////////////////////////////////// --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/CORBAObjectImpl.java 2018-01-30 20:16:22.000000000 -0500 +++ /dev/null 2018-01-30 20:16:22.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1997, 2002, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -// -// Bare implementation of CORBA Object. -// -public class CORBAObjectImpl extends org.omg.CORBA_2_3.portable.ObjectImpl { - public String[] _ids() { - String[] typeids = new String[1]; - typeids[0] = "IDL:omg.org/CORBA/Object:1.0"; - return typeids; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextImpl.java 2018-01-30 20:16:23.000000000 -0500 +++ /dev/null 2018-01-30 20:16:23.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import org.omg.CORBA.Any; -import org.omg.CORBA.Context; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.NVList; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public final class ContextImpl extends Context { - - private org.omg.CORBA.ORB _orb; - private ORBUtilSystemException wrapper ; - - public ContextImpl(org.omg.CORBA.ORB orb) - { - _orb = orb; - wrapper = ORBUtilSystemException.get( - (com.sun.corba.se.spi.orb.ORB)orb, - CORBALogDomains.RPC_PRESENTATION ) ; - } - - public ContextImpl(Context parent) - { - throw wrapper.contextNotImplemented() ; - } - - public String context_name() - { - throw wrapper.contextNotImplemented() ; - } - - public Context parent() - { - throw wrapper.contextNotImplemented() ; - } - - public Context create_child(String name) - { - throw wrapper.contextNotImplemented() ; - } - - public void set_one_value(String propName, Any propValue) - { - throw wrapper.contextNotImplemented() ; - } - - public void set_values(NVList values) - { - throw wrapper.contextNotImplemented() ; - } - - - public void delete_values(String propName) - { - throw wrapper.contextNotImplemented() ; - } - - public NVList get_values(String startScope, - int opFlags, - String propName) - { - throw wrapper.contextNotImplemented() ; - } -}; --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextListImpl.java 2018-01-30 20:16:24.000000000 -0500 +++ /dev/null 2018-01-30 20:16:24.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1996, 2002, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import java.util.Vector; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.Bounds; -import org.omg.CORBA.ORB; - -public class ContextListImpl extends ContextList -{ - private final int INITIAL_CAPACITY = 2; - private final int CAPACITY_INCREMENT = 2; - - private org.omg.CORBA.ORB _orb; - private Vector _contexts; - - public ContextListImpl(org.omg.CORBA.ORB orb) - { - // Note: This orb could be an instanceof ORBSingleton or ORB - _orb = orb; - _contexts = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT); - } - - public int count() - { - return _contexts.size(); - } - - public void add(String ctxt) - { - _contexts.addElement(ctxt); - } - - public String item(int index) - throws Bounds - { - try { - return (String) _contexts.elementAt(index); - } catch (ArrayIndexOutOfBoundsException e) { - throw new Bounds(); - } - } - - public void remove(int index) - throws Bounds - { - try { - _contexts.removeElementAt(index); - } catch (ArrayIndexOutOfBoundsException e) { - throw new Bounds(); - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/EnvironmentImpl.java 2018-01-30 20:16:24.000000000 -0500 +++ /dev/null 2018-01-30 20:16:24.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1996, 2002, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import org.omg.CORBA.Environment; -import org.omg.CORBA.UserException; -import org.omg.CORBA.ORB; - -public class EnvironmentImpl extends Environment { - - private Exception _exc; - - public EnvironmentImpl() - { - } - - public Exception exception() - { - return _exc; - } - - public void exception(Exception exc) - { - _exc = exc; - } - - public void clear() - { - _exc = null; - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ExceptionListImpl.java 2018-01-30 20:16:25.000000000 -0500 +++ /dev/null 2018-01-30 20:16:25.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1996, 2002, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import java.util.Vector; - -import org.omg.CORBA.Bounds; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.ORB; - - -public class ExceptionListImpl extends ExceptionList { - - private final int INITIAL_CAPACITY = 2; - private final int CAPACITY_INCREMENT = 2; - - private Vector _exceptions; - - public ExceptionListImpl() { - _exceptions = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT); - } - - public int count() - { - return _exceptions.size(); - } - - public void add(TypeCode tc) - { - _exceptions.addElement(tc); - } - - public TypeCode item(int index) - throws Bounds - { - try { - return (TypeCode) _exceptions.elementAt(index); - } catch (ArrayIndexOutOfBoundsException e) { - throw new Bounds(); - } - } - - public void remove(int index) - throws Bounds - { - try { - _exceptions.removeElementAt(index); - } catch (ArrayIndexOutOfBoundsException e) { - throw new Bounds(); - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NVListImpl.java 2018-01-30 20:16:26.000000000 -0500 +++ /dev/null 2018-01-30 20:16:26.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import java.util.Vector; - -import org.omg.CORBA.Any; -import org.omg.CORBA.Bounds; -import org.omg.CORBA.NVList; -import org.omg.CORBA.NamedValue; - -import com.sun.corba.se.spi.orb.ORB ; - -public class NVListImpl extends NVList -{ - private final int INITIAL_CAPACITY = 4; - private final int CAPACITY_INCREMENT = 2; - - private Vector _namedValues; - private ORB orb; - - public NVListImpl(ORB orb) - { - // Note: This orb could be an instanceof ORBSingleton or ORB - this.orb = orb; - _namedValues = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT); - } - - public NVListImpl(ORB orb, int size) - { - this.orb = orb; - - // Note: the size arg is only a hint of the size of the NVList. - _namedValues = new Vector(size); - } - - - public int count() - { - return _namedValues.size(); - } - - public NamedValue add(int flags) - { - NamedValue tmpVal = new NamedValueImpl(orb, "", new AnyImpl(orb), flags); - _namedValues.addElement(tmpVal); - return tmpVal; - } - - public NamedValue add_item(String itemName, int flags) - { - NamedValue tmpVal = new NamedValueImpl(orb, itemName, new AnyImpl(orb), - flags); - _namedValues.addElement(tmpVal); - return tmpVal; - } - - public NamedValue add_value(String itemName, Any val, int flags) - { - NamedValue tmpVal = new NamedValueImpl(orb, itemName, val, flags); - _namedValues.addElement(tmpVal); - return tmpVal; - } - - public NamedValue item(int index) - throws Bounds - { - try { - return (NamedValue) _namedValues.elementAt(index); - } catch (ArrayIndexOutOfBoundsException e) { - throw new Bounds(); - } - } - - public void remove(int index) - throws Bounds - { - try { - _namedValues.removeElementAt(index); - } catch (ArrayIndexOutOfBoundsException e) { - throw new Bounds(); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NamedValueImpl.java 2018-01-30 20:16:26.000000000 -0500 +++ /dev/null 2018-01-30 20:16:26.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.Any; - -import com.sun.corba.se.spi.orb.ORB ; - -public class NamedValueImpl extends NamedValue -{ - private String _name; - private Any _value; - private int _flags; - private ORB _orb; - - public NamedValueImpl(ORB orb) - { - // Note: This orb could be an instanceof ORBSingleton or ORB - _orb = orb; - _value = new AnyImpl(_orb); - } - - public NamedValueImpl(ORB orb, - String name, - Any value, - int flags) - { - // Note: This orb could be an instanceof ORBSingleton or ORB - _orb = orb; - _name = name; - _value = value; - _flags = flags; - } - - public String name() - { - return _name; - } - - public Any value() - { - return _value; - } - - public int flags() - { - return _flags; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/PrincipalImpl.java 2018-01-30 20:16:27.000000000 -0500 +++ /dev/null 2018-01-30 20:16:27.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1997, 2002, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - - -public class PrincipalImpl extends org.omg.CORBA.Principal -{ - private byte[] value; - - public void name(byte[] value) - { - this.value = value; - } - - public byte[] name() - { - return value; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/RequestImpl.java 2018-01-30 20:16:28.000000000 -0500 +++ /dev/null 2018-01-30 20:16:28.000000000 -0500 @@ -1,374 +0,0 @@ -/* - * Copyright (c) 1996, 2015, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - - -import org.omg.CORBA.Any; -import org.omg.CORBA.ARG_IN; -import org.omg.CORBA.ARG_OUT; -import org.omg.CORBA.ARG_INOUT; -import org.omg.CORBA.Context; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.Environment; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.NVList; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.Request; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.TCKind; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.TypeCodePackage.BadKind; -import org.omg.CORBA.UnknownUserException; -import org.omg.CORBA.Bounds; -import org.omg.CORBA.UNKNOWN; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.WrongTransaction; - -import org.omg.CORBA.portable.ApplicationException ; -import org.omg.CORBA.portable.RemarshalException ; -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.corba.AsynchInvoke; - -public class RequestImpl - extends Request -{ - /////////////////////////////////////////////////////////////////////////// - // data members - - protected org.omg.CORBA.Object _target; - protected String _opName; - protected NVList _arguments; - protected ExceptionList _exceptions; - private NamedValue _result; - protected Environment _env; - private Context _ctx; - private ContextList _ctxList; - protected ORB _orb; - private ORBUtilSystemException _wrapper; - - // invocation-specific stuff - protected boolean _isOneWay = false; - private int[] _paramCodes; - private long[] _paramLongs; - private java.lang.Object[] _paramObjects; - - // support for deferred invocations. - // protected instead of private since it needs to be set by the - // thread object doing the asynchronous invocation. - protected boolean gotResponse = false; - - /////////////////////////////////////////////////////////////////////////// - // constructor - - // REVISIT - used to be protected. Now public so it can be - // accessed from xgiop. - public RequestImpl (ORB orb, - org.omg.CORBA.Object targetObject, - Context ctx, - String operationName, - NVList argumentList, - NamedValue resultContainer, - ExceptionList exceptionList, - ContextList ctxList) - { - - // initialize the orb - _orb = orb; - _wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.OA_INVOCATION ) ; - - // initialize target, context and operation name - _target = targetObject; - _ctx = ctx; - _opName = operationName; - - // initialize argument list if not passed in - if (argumentList == null) - _arguments = new NVListImpl(_orb); - else - _arguments = argumentList; - - // set result container. - _result = resultContainer; - - // initialize exception list if not passed in - if (exceptionList == null) - _exceptions = new ExceptionListImpl(); - else - _exceptions = exceptionList; - - // initialize context list if not passed in - if (ctxList == null) - _ctxList = new ContextListImpl(_orb); - else - _ctxList = ctxList; - - // initialize environment - _env = new EnvironmentImpl(); - - } - - public org.omg.CORBA.Object target() - { - return _target; - } - - public String operation() - { - return _opName; - } - - public NVList arguments() - { - return _arguments; - } - - public NamedValue result() - { - return _result; - } - - public Environment env() - { - return _env; - } - - public ExceptionList exceptions() - { - return _exceptions; - } - - public ContextList contexts() - { - return _ctxList; - } - - public synchronized Context ctx() - { - if (_ctx == null) - _ctx = new ContextImpl(_orb); - return _ctx; - } - - public synchronized void ctx(Context newCtx) - { - _ctx = newCtx; - } - - public synchronized Any add_in_arg() - { - return _arguments.add(org.omg.CORBA.ARG_IN.value).value(); - } - - public synchronized Any add_named_in_arg(String name) - { - return _arguments.add_item(name, org.omg.CORBA.ARG_IN.value).value(); - } - - public synchronized Any add_inout_arg() - { - return _arguments.add(org.omg.CORBA.ARG_INOUT.value).value(); - } - - public synchronized Any add_named_inout_arg(String name) - { - return _arguments.add_item(name, org.omg.CORBA.ARG_INOUT.value).value(); - } - - public synchronized Any add_out_arg() - { - return _arguments.add(org.omg.CORBA.ARG_OUT.value).value(); - } - - public synchronized Any add_named_out_arg(String name) - { - return _arguments.add_item(name, org.omg.CORBA.ARG_OUT.value).value(); - } - - public synchronized void set_return_type(TypeCode tc) - { - if (_result == null) - _result = new NamedValueImpl(_orb); - _result.value().type(tc); - } - - public synchronized Any return_value() - { - if (_result == null) - _result = new NamedValueImpl(_orb); - return _result.value(); - } - - public synchronized void add_exception(TypeCode exceptionType) - { - _exceptions.add(exceptionType); - } - - public synchronized void invoke() - { - doInvocation(); - } - - public synchronized void send_oneway() - { - _isOneWay = true; - doInvocation(); - } - - public synchronized void send_deferred() - { - AsynchInvoke invokeObject = new AsynchInvoke(_orb, this, false); - new Thread(null, invokeObject, "Async-Request-Invoker-Thread", 0, false).start(); - } - - public synchronized boolean poll_response() - { - // this method has to be synchronized even though it seems - // "readonly" since the thread object doing the asynchronous - // invocation can potentially update this variable in parallel. - // updates are currently simply synchronized againt the request - // object. - return gotResponse; - } - - public synchronized void get_response() - throws org.omg.CORBA.WrongTransaction - { - while (gotResponse == false) { - // release the lock. wait to be notified by the thread that is - // doing the asynchronous invocation. - try { - wait(); - } - catch (InterruptedException e) {} - } - } - - /////////////////////////////////////////////////////////////////////////// - // private helper methods - - /* - * The doInvocation operation is where the real mechanics of - * performing the request invocation is done. - */ - protected void doInvocation() - { - org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate( - _target ) ; - - // Initiate Client Portable Interceptors. Inform the PIHandler that - // this is a DII request so that it knows to ignore the second - // inevitable call to initiateClientPIRequest in createRequest. - // Also, save the RequestImpl object for later use. - _orb.getPIHandler().initiateClientPIRequest( true ); - _orb.getPIHandler().setClientPIInfo( this ); - - InputStream $in = null; - try { - OutputStream $out = delegate.request(null, _opName, !_isOneWay); - // Marshal args - try { - for (int i=0; i<_arguments.count() ; i++) { - NamedValue nv = _arguments.item(i); - switch (nv.flags()) { - case ARG_IN.value: - nv.value().write_value($out); - break; - case ARG_OUT.value: - break; - case ARG_INOUT.value: - nv.value().write_value($out); - break; - } - } - } catch ( org.omg.CORBA.Bounds ex ) { - throw _wrapper.boundsErrorInDiiRequest( ex ) ; - } - - $in = delegate.invoke(null, $out); - } catch (ApplicationException e) { - // REVISIT - minor code. - // This is already handled in subcontract. - // REVISIT - uncomment. - //throw new INTERNAL(); - } catch (RemarshalException e) { - doInvocation(); - } catch( SystemException ex ) { - _env.exception(ex); - // NOTE: The exception should not be thrown. - // However, JDK 1.4 and earlier threw the exception, - // so we keep the behavior to be compatible. - throw ex; - } finally { - delegate.releaseReply(null, $in); - } - } - - // REVISIT - make protected after development - so xgiop can get it. - public void unmarshalReply(InputStream is) - { - // First unmarshal the return value if it is not void - if ( _result != null ) { - Any returnAny = _result.value(); - TypeCode returnType = returnAny.type(); - if ( returnType.kind().value() != TCKind._tk_void ) - returnAny.read_value(is, returnType); - } - - // Now unmarshal the out/inout args - try { - for ( int i=0; i<_arguments.count() ; i++) { - NamedValue nv = _arguments.item(i); - switch( nv.flags() ) { - case ARG_IN.value: - break; - case ARG_OUT.value: - case ARG_INOUT.value: - Any any = nv.value(); - any.read_value(is, any.type()); - break; - } - } - } - catch ( org.omg.CORBA.Bounds ex ) { - // Cannot happen since we only iterate till _arguments.count() - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ServerRequestImpl.java 2018-01-30 20:16:28.000000000 -0500 +++ /dev/null 2018-01-30 20:16:28.000000000 -0500 @@ -1,257 +0,0 @@ -/* - * Copyright (c) 1996, 2004, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import org.omg.CORBA.Any; -import org.omg.CORBA.Context; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.NVList; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.TCKind; -import org.omg.CORBA.ServerRequest; -import org.omg.CORBA.Bounds; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public class ServerRequestImpl extends ServerRequest { - - /////////////////////////////////////////////////////////////////////////// - // data members - - private ORB _orb = null; - private ORBUtilSystemException _wrapper = null; - private String _opName = null; - private NVList _arguments = null; - private Context _ctx = null; - private InputStream _ins = null; - - // booleans to check for various operation invocation restrictions - private boolean _paramsCalled = false; - private boolean _resultSet = false; - private boolean _exceptionSet = false; - private Any _resultAny = null; - private Any _exception = null; - - - public ServerRequestImpl (CorbaMessageMediator req, ORB orb) { - _opName = req.getOperationName(); - _ins = (InputStream)req.getInputObject(); - _ctx = null; // if we support contexts, this would - // presumably also be available on - // the server invocation - _orb = orb; - _wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.OA_INVOCATION ) ; - } - - public String operation() { - return _opName; - } - - public void arguments(NVList args) - { - if (_paramsCalled) - throw _wrapper.argumentsCalledMultiple() ; - - if (_exceptionSet) - throw _wrapper.argumentsCalledAfterException() ; - - if (args == null ) - throw _wrapper.argumentsCalledNullArgs() ; - - _paramsCalled = true; - - NamedValue arg = null; - for (int i=0; i < args.count() ; i++) { - try { - arg = args.item(i); - } catch (Bounds e) { - throw _wrapper.boundsCannotOccur(e) ; - } - - try { - if ((arg.flags() == org.omg.CORBA.ARG_IN.value) || - (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) { - // unmarshal the value into the Any - arg.value().read_value(_ins, arg.value().type()); - } - } catch ( Exception ex ) { - throw _wrapper.badArgumentsNvlist( ex ) ; - } - } - - // hang on to the NVList for marshaling the result - _arguments = args; - - _orb.getPIHandler().setServerPIInfo( _arguments ); - _orb.getPIHandler().invokeServerPIIntermediatePoint(); - } - - public void set_result(Any res) { - // check for invocation restrictions - if (!_paramsCalled) - throw _wrapper.argumentsNotCalled() ; - if (_resultSet) - throw _wrapper.setResultCalledMultiple() ; - if (_exceptionSet) - throw _wrapper.setResultAfterException() ; - if ( res == null ) - throw _wrapper.setResultCalledNullArgs() ; - - _resultAny = res; - _resultSet = true; - - // Notify portable interceptors of the result so that - // ServerRequestInfo.result() functions as desired. - _orb.getPIHandler().setServerPIInfo( _resultAny ); - - // actual marshaling of the reply msg header and params takes place - // after the DSI returns control to the ORB. - } - - public void set_exception(Any exc) - { - // except can be called by the DIR at any time (CORBA 2.2 section 6.3). - - if ( exc == null ) - throw _wrapper.setExceptionCalledNullArgs() ; - - // Ensure that the Any contains a SystemException or a - // UserException. If the UserException is not a declared exception, - // the client will get an UNKNOWN exception. - TCKind kind = exc.type().kind(); - if ( kind != TCKind.tk_except ) - throw _wrapper.setExceptionCalledBadType() ; - - _exception = exc; - - // Inform Portable interceptors of the exception that was set - // so sending_exception can return the right value. - _orb.getPIHandler().setServerPIExceptionInfo( _exception ); - - // The user can only call arguments once and not at all after - // set_exception. (internal flags ensure this). However, the user - // can call set_exception multiple times. Therefore, we only - // invoke receive_request the first time set_exception is - // called (if they haven't already called arguments). - if( !_exceptionSet && !_paramsCalled ) { - // We need to invoke intermediate points here. - _orb.getPIHandler().invokeServerPIIntermediatePoint(); - } - - _exceptionSet = true; - - // actual marshaling of the reply msg header and exception takes place - // after the DSI returns control to the ORB. - } - - - /** This is called from the ORB after the DynamicImplementation.invoke - * returns. Here we set the result if result() has not already been called. - * @return the exception if there is one (then ORB will not call - * marshalReplyParams()) otherwise return null. - */ - public Any checkResultCalled() - { - // Two things to be checked (CORBA 2.2 spec, section 6.3): - // 1. Unless it calls set_exception(), the DIR must call arguments() - // exactly once, even if the operation signature contains - // no parameters. - // 2. Unless set_exception() is called, if the invoked operation has a - // non-void result type, set_result() must be called exactly once - // before the DIR returns. - - if ( _paramsCalled && _resultSet ) // normal invocation return - return null; - else if ( _paramsCalled && !_resultSet && !_exceptionSet ) { - try { - // Neither a result nor an exception has been set. - // Assume that the return type is void. If this is not so, - // the client will throw a MARSHAL exception while - // unmarshaling the return value. - TypeCode result_tc = _orb.get_primitive_tc( - org.omg.CORBA.TCKind.tk_void); - _resultAny = _orb.create_any(); - _resultAny.type(result_tc); - _resultSet = true; - - return null; - } catch ( Exception ex ) { - throw _wrapper.dsiResultException( - CompletionStatus.COMPLETED_MAYBE, ex ) ; - } - } else if ( _exceptionSet ) - return _exception; - else { - throw _wrapper.dsimethodNotcalled( - CompletionStatus.COMPLETED_MAYBE ) ; - } - } - - /** This is called from the ORB after the DynamicImplementation.invoke - * returns. Here we marshal the return value and inout/out params. - */ - public void marshalReplyParams(OutputStream os) - { - // marshal the operation return value - _resultAny.write_value(os); - - // marshal the inouts/outs - NamedValue arg = null; - - for (int i=0; i < _arguments.count() ; i++) { - try { - arg = _arguments.item(i); - } catch (Bounds e) {} - - if ((arg.flags() == org.omg.CORBA.ARG_OUT.value) || - (arg.flags() == org.omg.CORBA.ARG_INOUT.value)) { - arg.value().write_value(os); - } - } - } - - public Context ctx() - { - if ( !_paramsCalled || _resultSet || _exceptionSet ) - throw _wrapper.contextCalledOutOfOrder() ; - - throw _wrapper.contextNotImplemented() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TCUtility.java 2018-01-30 20:16:29.000000000 -0500 +++ /dev/null 2018-01-30 20:16:29.000000000 -0500 @@ -1,329 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.corba; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.UserException; -import org.omg.CORBA.TCKind; -import org.omg.CORBA.UNKNOWN; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.Any; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.TypeCodePackage.BadKind; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.NoSuchElementException; - -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream; -import java.io.Serializable; -import java.math.BigDecimal; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * Static functions for TypeCode interpretation. - */ -public final class TCUtility { - - static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, long l, Object o) { - switch (typeCode.kind().value()) { - case TCKind._tk_null: - case TCKind._tk_void: - case TCKind._tk_native: - // nothing to write - break; - - case TCKind._tk_short: - s.write_short((short)(l & 0xFFFFL)); - break; - - case TCKind._tk_ushort: - s.write_ushort((short)(l & 0xFFFFL)); - break; - - case TCKind._tk_enum: - case TCKind._tk_long: - s.write_long((int)(l & 0xFFFFFFFFL)); - break; - - case TCKind._tk_ulong: - s.write_ulong((int)(l & 0xFFFFFFFFL)); - break; - - case TCKind._tk_float: - s.write_float(Float.intBitsToFloat((int)(l & 0xFFFFFFFFL))); - break; - - case TCKind._tk_double: - s.write_double(Double.longBitsToDouble(l)); - break; - - case TCKind._tk_boolean: - if ( l == 0 ) - s.write_boolean(false); - else - s.write_boolean(true); - break; - - case TCKind._tk_char: - s.write_char((char)(l & 0xFFFFL)); - break; - - case TCKind._tk_octet: - s.write_octet((byte)(l & 0xFFL)); - break; - - case TCKind._tk_any: - s.write_any((Any)o); - break; - - case TCKind._tk_TypeCode: - s.write_TypeCode((TypeCode)o); - break; - - case TCKind._tk_Principal: - s.write_Principal((Principal)o); - break; - - case TCKind._tk_objref: - s.write_Object((org.omg.CORBA.Object)o); - break; - - case TCKind._tk_longlong: - s.write_longlong(l); - break; - - case TCKind._tk_ulonglong: - s.write_ulonglong(l); - break; - - case TCKind._tk_wchar: - s.write_wchar((char)(l & 0xFFFFL)); - break; - - case TCKind._tk_string: - s.write_string((String)o); - break; - - case TCKind._tk_wstring: - s.write_wstring((String)o); - break; - - case TCKind._tk_value: - case TCKind._tk_value_box: - ((org.omg.CORBA_2_3.portable.OutputStream)s).write_value((Serializable)o); - break; - - case TCKind._tk_fixed: - // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to - // OutputStream, this check will be unnecessary - if (s instanceof CDROutputStream) { - try { - ((CDROutputStream)s).write_fixed((BigDecimal)o, - typeCode.fixed_digits(), - typeCode.fixed_scale()); - } catch (BadKind badKind) { // impossible - } - } else { - s.write_fixed((BigDecimal)o); - } - break; - - case TCKind._tk_struct: - case TCKind._tk_union: - case TCKind._tk_sequence: - case TCKind._tk_array: - case TCKind._tk_alias: - case TCKind._tk_except: - ((Streamable)o)._write(s); - break; - - case TCKind._tk_abstract_interface: - ((org.omg.CORBA_2_3.portable.OutputStream)s).write_abstract_interface(o); - break; - - case TCKind._tk_longdouble: - // Unspecified for Java - default: - ORBUtilSystemException wrapper = ORBUtilSystemException.get( - (com.sun.corba.se.spi.orb.ORB)s.orb(), - CORBALogDomains.RPC_PRESENTATION ) ; - throw wrapper.typecodeNotSupported() ; - } - } - - static void unmarshalIn(org.omg.CORBA.portable.InputStream s, TypeCode typeCode, long[] la, Object[] oa) - { - int type = typeCode.kind().value(); - long l=0; - Object o=oa[0]; - - switch (type) { - case TCKind._tk_null: - case TCKind._tk_void: - case TCKind._tk_native: - // Nothing to read - break; - - case TCKind._tk_short: - l = s.read_short() & 0xFFFFL; - break; - - case TCKind._tk_ushort: - l = s.read_ushort() & 0xFFFFL; - break; - - case TCKind._tk_enum: - case TCKind._tk_long: - l = s.read_long() & 0xFFFFFFFFL; - break; - - case TCKind._tk_ulong: - l = s.read_ulong() & 0xFFFFFFFFL; - break; - - case TCKind._tk_float: - l = Float.floatToIntBits(s.read_float()) & 0xFFFFFFFFL; - break; - - case TCKind._tk_double: - l = Double.doubleToLongBits(s.read_double()); - break; - - case TCKind._tk_char: - l = s.read_char() & 0xFFFFL; - break; - - case TCKind._tk_octet: - l = s.read_octet() & 0xFFL; - break; - - case TCKind._tk_boolean: - if ( s.read_boolean() ) - l = 1; - else - l = 0; - break; - - case TCKind._tk_any: - o = s.read_any(); - break; - - case TCKind._tk_TypeCode: - o = s.read_TypeCode(); - break; - - case TCKind._tk_Principal: - o = s.read_Principal(); - break; - - case TCKind._tk_objref: - if (o instanceof Streamable) - ((Streamable)o)._read(s); - else - o = s.read_Object(); - break; - - case TCKind._tk_longlong: - l = s.read_longlong(); - break; - - case TCKind._tk_ulonglong: - l = s.read_ulonglong(); - break; - - case TCKind._tk_wchar: - l = s.read_wchar() & 0xFFFFL; - break; - - case TCKind._tk_string: - o = s.read_string(); - break; - - case TCKind._tk_wstring: - o = s.read_wstring(); - break; - - case TCKind._tk_value: - case TCKind._tk_value_box: - o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_value (); - break; - - case TCKind._tk_fixed: - try { - // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to - // InputStream, this check will be unnecessary - if (s instanceof CDRInputStream) { - o = ((CDRInputStream)s).read_fixed(typeCode.fixed_digits(), - typeCode.fixed_scale()); - } else { - BigDecimal bigDecimal = s.read_fixed(); - o = bigDecimal.movePointLeft((int)typeCode.fixed_scale()); - } - } catch (BadKind badKind) { // impossible - } - break; - - case TCKind._tk_struct: - case TCKind._tk_union: - case TCKind._tk_sequence: - case TCKind._tk_array: - case TCKind._tk_alias: - case TCKind._tk_except: - ((Streamable)o)._read(s); - break; - - case TCKind._tk_abstract_interface: - o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_abstract_interface(); - break; - - case TCKind._tk_longdouble: - // Unspecified for Java - default: - ORBUtilSystemException wrapper = ORBUtilSystemException.get( - (com.sun.corba.se.spi.orb.ORB)s.orb(), - CORBALogDomains.RPC_PRESENTATION ) ; - throw wrapper.typecodeNotSupported() ; - } - - oa[0] = o; - la[0] = l; - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeFactory.java 2018-01-30 20:16:30.000000000 -0500 +++ /dev/null 2018-01-30 20:16:30.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.corba; - -public interface TypeCodeFactory { - void setTypeCode(String id, TypeCodeImpl code); - - TypeCodeImpl getTypeCode(String id); - - void setTypeCodeForClass( Class c, TypeCodeImpl tcimpl ) ; - - TypeCodeImpl getTypeCodeForClass( Class c ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java 2018-01-30 20:16:30.000000000 -0500 +++ /dev/null 2018-01-30 20:16:30.000000000 -0500 @@ -1,2413 +0,0 @@ -/* - * Copyright (c) 1996, 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.corba.se.impl.corba; - -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import java.util.List; -import java.util.Collections; -import java.util.ArrayList; -import java.io.IOException; -import java.io.PrintStream; -import java.io.ByteArrayOutputStream; -import java.math.BigDecimal; -import java.math.BigInteger; - -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.StructMember ; -import org.omg.CORBA.UnionMember ; -import org.omg.CORBA.ValueMember ; -import org.omg.CORBA.TCKind ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.Principal ; -import org.omg.CORBA.BAD_TYPECODE ; -import org.omg.CORBA.BAD_PARAM ; -import org.omg.CORBA.BAD_OPERATION ; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.MARSHAL ; -import org.omg.CORBA.TypeCodePackage.BadKind ; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.encoding.MarshalInputStream; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream; -import com.sun.corba.se.impl.encoding.TypeCodeInputStream; -import com.sun.corba.se.impl.encoding.TypeCodeOutputStream; -import com.sun.corba.se.impl.encoding.TypeCodeReader; -import com.sun.corba.se.impl.encoding.WrapperInputStream; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -// no chance of subclasses, so no problems with runtime helper lookup -public final class TypeCodeImpl extends TypeCode -{ - //static final boolean debug = false; - - // the indirection TCKind, needed for recursive typecodes. - protected static final int tk_indirect = 0xFFFFFFFF; - - // typecode encodings have three different categories that determine - // how the encoding should be done. - - private static final int EMPTY = 0; // no parameters - private static final int SIMPLE = 1; // simple parameters. - private static final int COMPLEX = 2; // complex parameters. need to - // use CDR encapsulation for - // parameters - - // a table storing the encoding category for the various typecodes. - - private static final int typeTable[] = { - EMPTY, // tk_null - EMPTY, // tk_void - EMPTY, // tk_short - EMPTY, // tk_long - EMPTY, // tk_ushort - EMPTY, // tk_ulong - EMPTY, // tk_float - EMPTY, // tk_double - EMPTY, // tk_boolean - EMPTY, // tk_char - EMPTY, // tk_octet - EMPTY, // tk_any - EMPTY, // tk_typecode - EMPTY, // tk_principal - COMPLEX, // tk_objref - COMPLEX, // tk_struct - COMPLEX, // tk_union - COMPLEX, // tk_enum - SIMPLE, // tk_string - COMPLEX, // tk_sequence - COMPLEX, // tk_array - COMPLEX, // tk_alias - COMPLEX, // tk_except - EMPTY, // tk_longlong - EMPTY, // tk_ulonglong - EMPTY, // tk_longdouble - EMPTY, // tk_wchar - SIMPLE, // tk_wstring - SIMPLE, // tk_fixed - COMPLEX, // tk_value - COMPLEX, // tk_value_box - COMPLEX, // tk_native - COMPLEX // tk_abstract_interface - }; - - // Maps TCKind values to names - // This is also used in AnyImpl. - static final String[] kindNames = { - "null", - "void", - "short", - "long", - "ushort", - "ulong", - "float", - "double", - "boolean", - "char", - "octet", - "any", - "typecode", - "principal", - "objref", - "struct", - "union", - "enum", - "string", - "sequence", - "array", - "alias", - "exception", - "longlong", - "ulonglong", - "longdouble", - "wchar", - "wstring", - "fixed", - "value", - "valueBox", - "native", - "abstractInterface" - }; - - private int _kind = 0; // the typecode kind - - // data members for representing the various kinds of typecodes. - private String _id = ""; // the typecode repository id - private String _name = ""; // the typecode name - private int _memberCount = 0; // member count - private String _memberNames[] = null; // names of members - private TypeCodeImpl _memberTypes[] = null; // types of members - private AnyImpl _unionLabels[] = null; // values of union labels - private TypeCodeImpl _discriminator = null; // union discriminator type - private int _defaultIndex = -1; // union default index - private int _length = 0; // string/seq/array length - private TypeCodeImpl _contentType = null; // seq/array/alias type - // fixed - private short _digits = 0; - private short _scale = 0; - // value type - // _REVISIT_ We might want to keep references to the ValueMember classes - // passed in at initialization instead of copying the relevant data. - // Is the data immutable? What about StructMember, UnionMember etc.? - private short _type_modifier = -1; // VM_NONE, VM_CUSTOM, - // VM_ABSTRACT, VM_TRUNCATABLE - private TypeCodeImpl _concrete_base = null; // concrete base type - private short _memberAccess[] = null; // visibility of ValueMember - // recursive sequence support - private TypeCodeImpl _parent = null; // the enclosing type code - private int _parentOffset = 0; // the level of enclosure - // recursive type code support - private TypeCodeImpl _indirectType = null; - - // caches the byte buffer written in write_value for quick remarshaling... - private byte[] outBuffer = null; - // ... but only if caching is enabled - private boolean cachingEnabled = false; - - // the ORB instance: may be instanceof ORBSingleton or ORB - private ORB _orb; - private ORBUtilSystemException wrapper ; - - /////////////////////////////////////////////////////////////////////////// - // Constructors... - - public TypeCodeImpl(ORB orb) - { - // initialized to tk_null - _orb = orb; - wrapper = ORBUtilSystemException.get( - (com.sun.corba.se.spi.orb.ORB)orb, CORBALogDomains.RPC_PRESENTATION ) ; - } - - public TypeCodeImpl(ORB orb, TypeCode tc) - // to handle conversion of "remote" typecodes into "native" style. - // also see the 'convertToNative(ORB orb, TypeCode tc)' function - { - this(orb) ; - - // This is a protection against misuse of this constructor. - // Should only be used if tc is not an instance of this class! - // Otherwise we run into problems with recursive/indirect type codes. - // _REVISIT_ We should make this constructor private - if (tc instanceof TypeCodeImpl) { - TypeCodeImpl tci = (TypeCodeImpl)tc; - if (tci._kind == tk_indirect) - throw wrapper.badRemoteTypecode() ; - if (tci._kind == TCKind._tk_sequence && tci._contentType == null) - throw wrapper.badRemoteTypecode() ; - } - - // set up kind - _kind = tc.kind().value(); - - try { - // set up parameters - switch (_kind) { - case TCKind._tk_value: - _type_modifier = tc.type_modifier(); - // concrete base may be null - TypeCode tccb = tc.concrete_base_type(); - if (tccb != null) { - _concrete_base = convertToNative(_orb, tccb); - } else { - _concrete_base = null; - } - //_memberAccess = tc._memberAccess; - // Need to reconstruct _memberAccess using member_count() and member_visibility() - _memberAccess = new short[tc.member_count()]; - for (int i=0; i < tc.member_count(); i++) { - _memberAccess[i] = tc.member_visibility(i); - } - case TCKind._tk_except: - case TCKind._tk_struct: - case TCKind._tk_union: - // set up member types - _memberTypes = new TypeCodeImpl[tc.member_count()]; - for (int i=0; i < tc.member_count(); i++) { - _memberTypes[i] = convertToNative(_orb, tc.member_type(i)); - _memberTypes[i].setParent(this); - } - case TCKind._tk_enum: - // set up member names - _memberNames = new String[tc.member_count()]; - for (int i=0; i < tc.member_count(); i++) { - _memberNames[i] = tc.member_name(i); - } - // set up member count - _memberCount = tc.member_count(); - case TCKind._tk_objref: - case TCKind._tk_alias: - case TCKind._tk_value_box: - case TCKind._tk_native: - case TCKind._tk_abstract_interface: - setId(tc.id()); - _name = tc.name(); - break; - } - - // set up stuff for unions - switch (_kind) { - case TCKind._tk_union: - _discriminator = convertToNative(_orb, tc.discriminator_type()); - _defaultIndex = tc.default_index(); - _unionLabels = new AnyImpl[_memberCount]; - for (int i=0; i < _memberCount; i++) - _unionLabels[i] = new AnyImpl(_orb, tc.member_label(i)); - break; - } - - // set up length - switch (_kind) { - case TCKind._tk_string: - case TCKind._tk_wstring: - case TCKind._tk_sequence: - case TCKind._tk_array: - _length = tc.length(); - } - - // set up content type - switch (_kind) { - case TCKind._tk_sequence: - case TCKind._tk_array: - case TCKind._tk_alias: - case TCKind._tk_value_box: - _contentType = convertToNative(_orb, tc.content_type()); - } - } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {} catch (BadKind e) {} - // dont have to worry about these since code ensures we dont step - // out of bounds. - } - - public TypeCodeImpl(ORB orb, int creationKind) - // for primitive types - { - this(orb); - - // private API. dont bother checking that - // (creationKind < 0 || creationKind > typeTable.length) - - _kind = creationKind; - - // do initialization for special cases - switch (_kind) { - case TCKind._tk_objref: - { - // this is being used to create typecode for CORBA::Object - setId("IDL:omg.org/CORBA/Object:1.0"); - _name = "Object"; - break; - } - - case TCKind._tk_string: - case TCKind._tk_wstring: - { - _length =0; - break; - } - - case TCKind._tk_value: - { - _concrete_base = null; - break; - } - } - } - - public TypeCodeImpl(ORB orb, - int creationKind, - String id, - String name, - StructMember[] members) - // for structs and exceptions - { - this(orb); - - if ((creationKind == TCKind._tk_struct) || (creationKind == TCKind._tk_except)) { - _kind = creationKind; - setId(id); - _name = name; - _memberCount = members.length; - - _memberNames = new String[_memberCount]; - _memberTypes = new TypeCodeImpl[_memberCount]; - - for (int i = 0 ; i < _memberCount ; i++) { - _memberNames[i] = members[i].name; - _memberTypes[i] = convertToNative(_orb, members[i].type); - _memberTypes[i].setParent(this); - } - } // else initializes to null - } - - public TypeCodeImpl(ORB orb, - int creationKind, - String id, - String name, - TypeCode discriminator_type, - UnionMember[] members) - // for unions - { - this(orb) ; - - if (creationKind == TCKind._tk_union) { - _kind = creationKind; - setId(id); - _name = name; - _memberCount = members.length; - _discriminator = convertToNative(_orb, discriminator_type); - - _memberNames = new String[_memberCount]; - _memberTypes = new TypeCodeImpl[_memberCount]; - _unionLabels = new AnyImpl[_memberCount]; - - for (int i = 0 ; i < _memberCount ; i++) { - _memberNames[i] = members[i].name; - _memberTypes[i] = convertToNative(_orb, members[i].type); - _memberTypes[i].setParent(this); - _unionLabels[i] = new AnyImpl(_orb, members[i].label); - // check whether this is the default branch. - if (_unionLabels[i].type().kind() == TCKind.tk_octet) { - if (_unionLabels[i].extract_octet() == (byte)0) { - _defaultIndex = i; - } - } - } - } // else initializes to null - } - - public TypeCodeImpl(ORB orb, - int creationKind, - String id, - String name, - short type_modifier, - TypeCode concrete_base, - ValueMember[] members) - // for value types - { - this(orb) ; - - if (creationKind == TCKind._tk_value) { - _kind = creationKind; - setId(id); - _name = name; - _type_modifier = type_modifier; - if (concrete_base != null) { - _concrete_base = convertToNative(_orb, concrete_base); - } - _memberCount = members.length; - - _memberNames = new String[_memberCount]; - _memberTypes = new TypeCodeImpl[_memberCount]; - _memberAccess = new short[_memberCount]; - - for (int i = 0 ; i < _memberCount ; i++) { - _memberNames[i] = members[i].name; - _memberTypes[i] = convertToNative(_orb, members[i].type); - _memberTypes[i].setParent(this); - _memberAccess[i] = members[i].access; - } - } // else initializes to null - } - - - public TypeCodeImpl(ORB orb, - int creationKind, - String id, - String name, - String[] members) - // for enums - { - this(orb) ; - - if (creationKind == TCKind._tk_enum) - { - _kind = creationKind; - setId(id); - _name = name; - _memberCount = members.length; - - _memberNames = new String[_memberCount]; - - for (int i = 0 ; i < _memberCount ; i++) - _memberNames[i] = members[i]; - } // else initializes to null - } - - public TypeCodeImpl(ORB orb, - int creationKind, - String id, - String name, - TypeCode original_type) - // for aliases and value boxes - { - this(orb) ; - - if ( creationKind == TCKind._tk_alias || creationKind == TCKind._tk_value_box ) - { - _kind = creationKind; - setId(id); - _name = name; - _contentType = convertToNative(_orb, original_type); - } - // else initializes to null - - } - - public TypeCodeImpl(ORB orb, - int creationKind, - String id, - String name) - { - this(orb) ; - - if (creationKind == TCKind._tk_objref || - creationKind == TCKind._tk_native || - creationKind == TCKind._tk_abstract_interface) - { - _kind = creationKind; - setId(id); - _name = name; - } // else initializes to null - } - - - public TypeCodeImpl(ORB orb, - int creationKind, - int bound) - // for strings - { - this(orb) ; - - if (bound < 0) - throw wrapper.negativeBounds() ; - - if ((creationKind == TCKind._tk_string) || (creationKind == TCKind._tk_wstring)) { - _kind = creationKind; - _length = bound; - } // else initializes to null - } - - public TypeCodeImpl(ORB orb, - int creationKind, - int bound, - TypeCode element_type) - // for sequences and arrays - { - this(orb) ; - - if ( creationKind == TCKind._tk_sequence || creationKind == TCKind._tk_array ) { - _kind = creationKind; - _length = bound; - _contentType = convertToNative(_orb, element_type); - } // else initializes to null - } - - public TypeCodeImpl(ORB orb, - int creationKind, - int bound, - int offset) - // for recursive sequences - { - this(orb) ; - - if (creationKind == TCKind._tk_sequence) { - _kind = creationKind; - _length = bound; - _parentOffset = offset; - } // else initializes to null - } - - public TypeCodeImpl(ORB orb, - String id) - // for recursive type codes - { - this(orb) ; - - _kind = tk_indirect; - // This is the type code of the type we stand in for, not our own. - _id = id; - // Try to resolve it now. May return null in which case - // we try again later (see indirectType()). - tryIndirectType(); - } - - public TypeCodeImpl(ORB orb, - int creationKind, - short digits, - short scale) - // for fixed - { - this(orb) ; - - //if (digits < 1 || digits > 31) - //throw new BAD_TYPECODE(); - - if (creationKind == TCKind._tk_fixed) { - _kind = creationKind; - _digits = digits; - _scale = scale; - } // else initializes to null - } - - /////////////////////////////////////////////////////////////////////////// - // Other creation functions... - - // Optimization: - // If we checked for and returned constant primitive typecodes - // here we could reduce object creation and also enable more - // efficient typecode comparisons for primitive typecodes. - // - protected static TypeCodeImpl convertToNative(ORB orb, - TypeCode tc) - { - if (tc instanceof TypeCodeImpl) - return (TypeCodeImpl) tc; - else - return new TypeCodeImpl(orb, tc); - } - - public static CDROutputStream newOutputStream(ORB orb) { - TypeCodeOutputStream tcos = - sun.corba.OutputStreamFactory.newTypeCodeOutputStream(orb); - //if (debug) System.out.println("Created TypeCodeOutputStream " + tcos + - // " with no parent"); - return tcos; - } - - // Support for indirect/recursive type codes - - private TypeCodeImpl indirectType() { - _indirectType = tryIndirectType(); - if (_indirectType == null) { - // Nothing we can do about that. - throw wrapper.unresolvedRecursiveTypecode() ; - } - return _indirectType; - } - - private TypeCodeImpl tryIndirectType() { - // Assert that _kind == tk_indirect - if (_indirectType != null) - return _indirectType; - - setIndirectType(_orb.getTypeCode(_id)); - - return _indirectType; - } - - private void setIndirectType(TypeCodeImpl newType) { - _indirectType = newType; - if (_indirectType != null) { - try { - _id = _indirectType.id(); - } catch (BadKind e) { - // can't happen - throw wrapper.badkindCannotOccur() ; - } - } - } - - private void setId(String newID) { - _id = newID; - if (_orb instanceof TypeCodeFactory) { - ((TypeCodeFactory)_orb).setTypeCode(_id, this); - } - // check whether return value != this which would indicate that the - // repository id isn't unique. - } - - private void setParent(TypeCodeImpl parent) { - _parent = parent; - } - - private TypeCodeImpl getParentAtLevel(int level) { - if (level == 0) - return this; - - if (_parent == null) - throw wrapper.unresolvedRecursiveTypecode() ; - - return _parent.getParentAtLevel(level - 1); - } - - private TypeCodeImpl lazy_content_type() { - if (_contentType == null) { - if (_kind == TCKind._tk_sequence && _parentOffset > 0 && _parent != null) { - // This is an unresolved recursive sequence tc. - // Try to resolve it now if the hierarchy is complete. - TypeCodeImpl realParent = getParentAtLevel(_parentOffset); - if (realParent != null && realParent._id != null) { - // Create a recursive type code object as the content type. - // This is when the recursive sequence typecode morphes - // into a sequence typecode containing a recursive typecode. - _contentType = new TypeCodeImpl((ORB)_orb, realParent._id); - } - } - } - return _contentType; - } - - // Other private functions - - private TypeCode realType(TypeCode aType) { - TypeCode realType = aType; - try { - // Note: Indirect types are handled in kind() method - while (realType.kind().value() == TCKind._tk_alias) { - realType = realType.content_type(); - } - } catch (BadKind bad) { - // impossible - throw wrapper.badkindCannotOccur() ; - } - return realType; - } - - /////////////////////////////////////////////////////////////////////////// - // TypeCode operations - - public final boolean equal(TypeCode tc) - // _REVISIT_ for all optional names/ids, we might want to check that - // they are equal in case both are non-nil. - { - if (tc == this) - return true; - - try { - - if (_kind == tk_indirect) { - //return indirectType().equal(tc); - if (_id != null && tc.id() != null) - return _id.equals(tc.id()); - return (_id == null && tc.id() == null); - } - - // make sure kinds are identical. - if (_kind != tc.kind().value()) { - return false; - } - - switch (typeTable[_kind]) { - case EMPTY: - // no parameters to check. - return true; - - case SIMPLE: - switch (_kind) { - case TCKind._tk_string: - case TCKind._tk_wstring: - // check for bound. - return (_length == tc.length()); - - case TCKind._tk_fixed: - return (_digits == tc.fixed_digits() && _scale == tc.fixed_scale()); - default: - return false; - } - - case COMPLEX: - - switch(_kind) { - - case TCKind._tk_objref: - { - // check for logical id. - if (_id.compareTo(tc.id()) == 0) { - return true; - } - - if (_id.compareTo( - (_orb.get_primitive_tc(_kind)).id()) == 0) - { - return true; - } - - if (tc.id().compareTo( - (_orb.get_primitive_tc(_kind)).id()) == 0) - { - return true; - } - - return false; - } - - case TCKind._tk_native: - case TCKind._tk_abstract_interface: - { - // check for logical id. - if (_id.compareTo(tc.id()) != 0) { - return false; - - } - // ignore name since its optional. - return true; - } - - case TCKind._tk_struct: - case TCKind._tk_except: - { - // check for member count - if (_memberCount != tc.member_count()) - return false; - // check for repository id - if (_id.compareTo(tc.id()) != 0) - return false; - // check for member types. - for (int i = 0 ; i < _memberCount ; i++) - if (! _memberTypes[i].equal(tc.member_type(i))) - return false; - // ignore id and names since those are optional. - return true; - } - - case TCKind._tk_union: - { - // check for member count - if (_memberCount != tc.member_count()) - return false; - // check for repository id - if (_id.compareTo(tc.id()) != 0) - return false; - // check for default index - if (_defaultIndex != tc.default_index()) - return false; - // check for discriminator type - if (!_discriminator.equal(tc.discriminator_type())) - return false; - // check for label types and values - for (int i = 0 ; i < _memberCount ; i++) - if (! _unionLabels[i].equal(tc.member_label(i))) - return false; - // check for branch types - for (int i = 0 ; i < _memberCount ; i++) - if (! _memberTypes[i].equal(tc.member_type(i))) - return false; - // ignore id and names since those are optional. - return true; - } - - case TCKind._tk_enum: - { - // check for repository id - if (_id.compareTo(tc.id()) != 0) - return false; - // check member count - if (_memberCount != tc.member_count()) - return false; - // ignore names since those are optional. - return true; - } - - case TCKind._tk_sequence: - case TCKind._tk_array: - { - // check bound/length - if (_length != tc.length()) { - return false; - } - // check content type - if (! lazy_content_type().equal(tc.content_type())) { - return false; - } - // ignore id and name since those are optional. - return true; - } - - case TCKind._tk_value: - { - // check for member count - if (_memberCount != tc.member_count()) - return false; - // check for repository id - if (_id.compareTo(tc.id()) != 0) - return false; - // check for member types. - for (int i = 0 ; i < _memberCount ; i++) - if (_memberAccess[i] != tc.member_visibility(i) || - ! _memberTypes[i].equal(tc.member_type(i))) - return false; - if (_type_modifier == tc.type_modifier()) - return false; - // concrete_base may be null - TypeCode tccb = tc.concrete_base_type(); - if ((_concrete_base == null && tccb != null) || - (_concrete_base != null && tccb == null) || - ! _concrete_base.equal(tccb)) - { - return false; - } - // ignore id and names since those are optional. - return true; - } - - case TCKind._tk_alias: - case TCKind._tk_value_box: - { - // check for repository id - if (_id.compareTo(tc.id()) != 0) { - return false; - } - // check for equality with the true type - return _contentType.equal(tc.content_type()); - } - } - } - } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {} catch (BadKind e) {} - // dont have to worry about these since the code ensures these dont - // arise. - return false; - } - - /** - * The equivalent operation is used by the ORB when determining type equivalence - * for values stored in an IDL any. - */ - public boolean equivalent(TypeCode tc) { - if (tc == this) { - return true; - } - - // If the result of the kind operation on either TypeCode is tk_alias, recursively - // replace the TypeCode with the result of calling content_type, until the kind - // is no longer tk_alias. - // Note: Always resolve indirect types first! - TypeCode myRealType = (_kind == tk_indirect ? indirectType() : this); - myRealType = realType(myRealType); - TypeCode otherRealType = realType(tc); - - // If results of the kind operation on each typecode differ, - // equivalent returns false. - if (myRealType.kind().value() != otherRealType.kind().value()) { - return false; - } - - String myID = null; - String otherID = null; - try { - myID = this.id(); - otherID = tc.id(); - // At this point the id operation is valid for both TypeCodes. - - // Return true if the results of id for both TypeCodes are non-empty strings - // and both strings are equal. - // If both ids are non-empty but are not equal, then equivalent returns FALSE. - if (myID != null && otherID != null) { - return (myID.equals(otherID)); - } - } catch (BadKind e) { - // id operation is not valid for either or both TypeCodes - } - - // If either or both id is an empty string, or the TypeCode kind does not support - // the id operation, perform a structural comparison of the TypeCodes. - - int myKind = myRealType.kind().value(); - try { - if (myKind == TCKind._tk_struct || - myKind == TCKind._tk_union || - myKind == TCKind._tk_enum || - myKind == TCKind._tk_except || - myKind == TCKind._tk_value) - { - if (myRealType.member_count() != otherRealType.member_count()) - return false; - } - if (myKind == TCKind._tk_union) - { - if (myRealType.default_index() != otherRealType.default_index()) - return false; - } - if (myKind == TCKind._tk_string || - myKind == TCKind._tk_wstring || - myKind == TCKind._tk_sequence || - myKind == TCKind._tk_array) - { - if (myRealType.length() != otherRealType.length()) - return false; - } - if (myKind == TCKind._tk_fixed) - { - if (myRealType.fixed_digits() != otherRealType.fixed_digits() || - myRealType.fixed_scale() != otherRealType.fixed_scale()) - return false; - } - if (myKind == TCKind._tk_union) - { - for (int i=0; i typeTable.length) && _kind != tk_indirect) { - throw wrapper.cannotMarshalBadTckind() ; - } - - // Don't do any work if this is native - if (_kind == TCKind._tk_native) - throw wrapper.cannotMarshalNative() ; - - // We have to remember the stream and position for EVERY type code - // in case some recursive or indirect type code references it. - TypeCodeReader topStream = tcis.getTopLevelStream(); - - if (_kind == tk_indirect) { - int streamOffset = tcis.read_long(); - if (streamOffset > -4) - throw wrapper.invalidIndirection( new Integer(streamOffset) ) ; - - // The encoding used for indirection is the same as that used for recursive , - // TypeCodes i.e., a 0xffffffff indirection marker followed by a long offset - // (in units of octets) from the beginning of the long offset. - int topPos = tcis.getTopLevelPosition(); - // substract 4 to get back to the beginning of the long offset. - int indirectTypePosition = topPos - 4 + streamOffset; - - // Now we have to find the referenced type - // by its indirectTypePosition within topStream. - //if (debug) System.out.println( - // "TypeCodeImpl looking up indirection at position topPos " + - //topPos + " - 4 + offset " + streamOffset + " = " + indirectTypePosition); - TypeCodeImpl type = topStream.getTypeCodeAtPosition(indirectTypePosition); - if (type == null) - throw wrapper.indirectionNotFound( new Integer(indirectTypePosition) ) ; - setIndirectType(type); - return false; - } - - topStream.addTypeCodeAtPosition(this, myPosition); - return true; - } - - void read_value_kind(InputStream is) { - // unmarshal the kind - _kind = is.read_long(); - - // check validity of kind - if ((_kind < 0 || _kind > typeTable.length) && _kind != tk_indirect) { - throw wrapper.cannotMarshalBadTckind() ; - } - // Don't do any work if this is native - if (_kind == TCKind._tk_native) - throw wrapper.cannotMarshalNative() ; - - if (_kind == tk_indirect) { - throw wrapper.recursiveTypecodeError() ; - } - } - - void read_value_body(InputStream is) { - // start unmarshaling the rest of the typecode, based on the - // encoding (empty, simple or complex). - - switch (typeTable[_kind]) { - case EMPTY: - // nothing to unmarshal - break; - - case SIMPLE: - switch (_kind) { - case TCKind._tk_string: - case TCKind._tk_wstring: - _length = is.read_long(); - break; - case TCKind._tk_fixed: - _digits = is.read_ushort(); - _scale = is.read_short(); - break; - default: - throw wrapper.invalidSimpleTypecode() ; - } - break; - - case COMPLEX: - { - TypeCodeInputStream _encap = TypeCodeInputStream.readEncapsulation(is, - is.orb()); - - switch(_kind) { - - case TCKind._tk_objref: - case TCKind._tk_abstract_interface: - { - // get the repository id - setId(_encap.read_string()); - // get the name - _name = _encap.read_string(); - } - break; - - case TCKind._tk_union: - { - // get the repository id - setId(_encap.read_string()); - - // get the name - _name = _encap.read_string(); - - // discriminant typecode - _discriminator = new TypeCodeImpl((ORB)is.orb()); - _discriminator.read_value_recursive(_encap); - - // default index - _defaultIndex = _encap.read_long(); - - // get the number of members - _memberCount = _encap.read_long(); - - // create arrays for the label values, names and types of members - _unionLabels = new AnyImpl[_memberCount]; - _memberNames = new String[_memberCount]; - _memberTypes = new TypeCodeImpl[_memberCount]; - - // read off label values, names and types - for (int i=0; i < _memberCount; i++) { - _unionLabels[i] = new AnyImpl((ORB)is.orb()); - if (i == _defaultIndex) - // for the default case, read off the zero octet - _unionLabels[i].insert_octet(_encap.read_octet()); - else { - switch (realType(_discriminator).kind().value()) { - case TCKind._tk_short: - _unionLabels[i].insert_short(_encap.read_short()); - break; - case TCKind._tk_long: - _unionLabels[i].insert_long(_encap.read_long()); - break; - case TCKind._tk_ushort: - _unionLabels[i].insert_ushort(_encap.read_short()); - break; - case TCKind._tk_ulong: - _unionLabels[i].insert_ulong(_encap.read_long()); - break; - case TCKind._tk_float: - _unionLabels[i].insert_float(_encap.read_float()); - break; - case TCKind._tk_double: - _unionLabels[i].insert_double(_encap.read_double()); - break; - case TCKind._tk_boolean: - _unionLabels[i].insert_boolean(_encap.read_boolean()); - break; - case TCKind._tk_char: - _unionLabels[i].insert_char(_encap.read_char()); - break; - case TCKind._tk_enum: - _unionLabels[i].type(_discriminator); - _unionLabels[i].insert_long(_encap.read_long()); - break; - case TCKind._tk_longlong: - _unionLabels[i].insert_longlong(_encap.read_longlong()); - break; - case TCKind._tk_ulonglong: - _unionLabels[i].insert_ulonglong(_encap.read_longlong()); - break; - // _REVISIT_ figure out long double mapping - // case TCKind.tk_longdouble: - // _unionLabels[i].insert_longdouble(_encap.getDouble()); - // break; - case TCKind._tk_wchar: - _unionLabels[i].insert_wchar(_encap.read_wchar()); - break; - default: - throw wrapper.invalidComplexTypecode() ; - } - } - _memberNames[i] = _encap.read_string(); - _memberTypes[i] = new TypeCodeImpl((ORB)is.orb()); - _memberTypes[i].read_value_recursive(_encap); - _memberTypes[i].setParent(this); - } - } - break; - - case TCKind._tk_enum: - { - // get the repository id - setId(_encap.read_string()); - - // get the name - _name = _encap.read_string(); - - // get the number of members - _memberCount = _encap.read_long(); - - // create arrays for the identifier names - _memberNames = new String[_memberCount]; - - // read off identifier names - for (int i=0; i < _memberCount; i++) - _memberNames[i] = _encap.read_string(); - } - break; - - case TCKind._tk_sequence: - { - // get the type of the sequence - _contentType = new TypeCodeImpl((ORB)is.orb()); - _contentType.read_value_recursive(_encap); - - // get the bound on the length of the sequence - _length = _encap.read_long(); - } - break; - - case TCKind._tk_array: - { - // get the type of the array - _contentType = new TypeCodeImpl((ORB)is.orb()); - _contentType.read_value_recursive(_encap); - - // get the length of the array - _length = _encap.read_long(); - } - break; - - case TCKind._tk_alias: - case TCKind._tk_value_box: - { - // get the repository id - setId(_encap.read_string()); - - // get the name - _name = _encap.read_string(); - - // get the type aliased - _contentType = new TypeCodeImpl((ORB)is.orb()); - _contentType.read_value_recursive(_encap); - } - break; - - case TCKind._tk_except: - case TCKind._tk_struct: - { - // get the repository id - setId(_encap.read_string()); - - // get the name - _name = _encap.read_string(); - - // get the number of members - _memberCount = _encap.read_long(); - - // create arrays for the names and types of members - _memberNames = new String[_memberCount]; - _memberTypes = new TypeCodeImpl[_memberCount]; - - // read off member names and types - for (int i=0; i < _memberCount; i++) { - _memberNames[i] = _encap.read_string(); - _memberTypes[i] = new TypeCodeImpl((ORB)is.orb()); - //if (debug) System.out.println("TypeCode " + _name + - // " reading member " + _memberNames[i]); - _memberTypes[i].read_value_recursive(_encap); - _memberTypes[i].setParent(this); - } - } - break; - - case TCKind._tk_value: - { - // get the repository id - setId(_encap.read_string()); - - // get the name - _name = _encap.read_string(); - - // get the type modifier - _type_modifier = _encap.read_short(); - - // get the type aliased - _concrete_base = new TypeCodeImpl((ORB)is.orb()); - _concrete_base.read_value_recursive(_encap); - if (_concrete_base.kind().value() == TCKind._tk_null) { - _concrete_base = null; - } - - // get the number of members - _memberCount = _encap.read_long(); - - // create arrays for the names, types and visibility of members - _memberNames = new String[_memberCount]; - _memberTypes = new TypeCodeImpl[_memberCount]; - _memberAccess = new short[_memberCount]; - - // read off value member visibilities - for (int i=0; i < _memberCount; i++) { - _memberNames[i] = _encap.read_string(); - _memberTypes[i] = new TypeCodeImpl((ORB)is.orb()); - //if (debug) System.out.println("TypeCode " + _name + - // " reading member " + _memberNames[i]); - _memberTypes[i].read_value_recursive(_encap); - _memberTypes[i].setParent(this); - _memberAccess[i] = _encap.read_short(); - } - } - break; - - default: - throw wrapper.invalidTypecodeKindMarshal() ; - } - break; - } - } - } - - public void write_value(OutputStream os) { - // Wrap OutputStream into TypeCodeOutputStream. - // This test shouldn't be necessary according to the Java language spec. - if (os instanceof TypeCodeOutputStream) { - this.write_value((TypeCodeOutputStream)os); - } else { - TypeCodeOutputStream wrapperOutStream = null; - - if (outBuffer == null) { - wrapperOutStream = TypeCodeOutputStream.wrapOutputStream(os); - this.write_value(wrapperOutStream); - if (cachingEnabled) { - // Cache the buffer for repeated writes - outBuffer = wrapperOutStream.getTypeCodeBuffer(); - //if (outBuffer != null) - //System.out.println("Caching outBuffer with length = " + - //outBuffer.length + " for id = " + _id); - } - } else { - //System.out.println("Using cached outBuffer: length = " + outBuffer.length + - //", id = " + _id); - } - // Write the first 4 bytes first to trigger alignment. - // We know that it is the kind. - if (cachingEnabled && outBuffer != null) { - os.write_long(_kind); - os.write_octet_array(outBuffer, 0, outBuffer.length); - } else { - //System.out.println("Buffer is empty for " + _id); - wrapperOutStream.writeRawBuffer(os, _kind); - } - } - } - - public void write_value(TypeCodeOutputStream tcos) { - - // Don't do any work if this is native - if (_kind == TCKind._tk_native) - throw wrapper.cannotMarshalNative() ; - - TypeCodeOutputStream topStream = tcos.getTopLevelStream(); - //if (debug) tcos.printBuffer(); - - if (_kind == tk_indirect) { - //if (debug) System.out.println("Writing indirection " + _name + "to " + _id); - // The encoding used for indirection is the same as that used for recursive , - // TypeCodes i.e., a 0xffffffff indirection marker followed by a long offset - // (in units of octets) from the beginning of the long offset. - int pos = topStream.getPositionForID(_id); - int topPos = tcos.getTopLevelPosition(); - //if (debug) System.out.println("TypeCodeImpl " + tcos + - // " writing indirection " + _id + - //" to position " + pos + " at position " + topPos); - tcos.writeIndirection(tk_indirect, pos); - // All that gets written is _kind and offset. - return; - } - - // The original approach changed for 5034649 - // topStream.addIDAtPosition(_id, tcos.getTopLevelPosition()); - - // marshal the kind - tcos.write_long(_kind); - - //if (debug) System.out.println("Writing " + _name + " with id " + _id); - // We have to remember the stream and position for EVERY type code - // in case some recursive or indirect type code references it. - // - // Bug fix 5034649: - // Do this AFTER the write of the _kind in case the alignment - // for the long changes the position. - topStream.addIDAtPosition(_id, tcos.getTopLevelPosition()-4); - - switch (typeTable[_kind]) { - case EMPTY: - // nothing more to marshal - break; - - case SIMPLE: - switch (_kind) { - case TCKind._tk_string: - case TCKind._tk_wstring: - // marshal the bound on string length - tcos.write_long(_length); - break; - case TCKind._tk_fixed: - tcos.write_ushort(_digits); - tcos.write_short(_scale); - break; - default: - // unknown typecode kind - throw wrapper.invalidSimpleTypecode() ; - } - break; - - case COMPLEX: - { - // create an encapsulation - TypeCodeOutputStream _encap = tcos.createEncapsulation(tcos.orb()); - - switch(_kind) { - - case TCKind._tk_objref: - case TCKind._tk_abstract_interface: - { - // put the repository id - _encap.write_string(_id); - - // put the name - _encap.write_string(_name); - } - break; - - case TCKind._tk_union: - { - // put the repository id - _encap.write_string(_id); - - // put the name - _encap.write_string(_name); - - // discriminant typecode - _discriminator.write_value(_encap); - - // default index - _encap.write_long(_defaultIndex); - - // put the number of members - _encap.write_long(_memberCount); - - // marshal label values, names and types - for (int i=0; i < _memberCount; i++) { - - // for the default case, marshal the zero octet - if (i == _defaultIndex) - _encap.write_octet(_unionLabels[i].extract_octet()); - - else { - switch (realType(_discriminator).kind().value()) { - case TCKind._tk_short: - _encap.write_short(_unionLabels[i].extract_short()); - break; - case TCKind._tk_long: - _encap.write_long(_unionLabels[i].extract_long()); - break; - case TCKind._tk_ushort: - _encap.write_short(_unionLabels[i].extract_ushort()); - break; - case TCKind._tk_ulong: - _encap.write_long(_unionLabels[i].extract_ulong()); - break; - case TCKind._tk_float: - _encap.write_float(_unionLabels[i].extract_float()); - break; - case TCKind._tk_double: - _encap.write_double(_unionLabels[i].extract_double()); - break; - case TCKind._tk_boolean: - _encap.write_boolean(_unionLabels[i].extract_boolean()); - break; - case TCKind._tk_char: - _encap.write_char(_unionLabels[i].extract_char()); - break; - case TCKind._tk_enum: - _encap.write_long(_unionLabels[i].extract_long()); - break; - case TCKind._tk_longlong: - _encap.write_longlong(_unionLabels[i].extract_longlong()); - break; - case TCKind._tk_ulonglong: - _encap.write_longlong(_unionLabels[i].extract_ulonglong()); - break; - // _REVISIT_ figure out long double mapping - // case TCKind.tk_longdouble: - // _encap.putDouble(_unionLabels[i].extract_longdouble()); - // break; - case TCKind._tk_wchar: - _encap.write_wchar(_unionLabels[i].extract_wchar()); - break; - default: - throw wrapper.invalidComplexTypecode() ; - } - } - _encap.write_string(_memberNames[i]); - _memberTypes[i].write_value(_encap); - } - } - break; - - case TCKind._tk_enum: - { - // put the repository id - _encap.write_string(_id); - - // put the name - _encap.write_string(_name); - - // put the number of members - _encap.write_long(_memberCount); - - // marshal identifier names - for (int i=0; i < _memberCount; i++) - _encap.write_string(_memberNames[i]); - } - break; - - case TCKind._tk_sequence: - { - // put the type of the sequence - lazy_content_type().write_value(_encap); - - // put the bound on the length of the sequence - _encap.write_long(_length); - } - break; - - case TCKind._tk_array: - { - // put the type of the array - _contentType.write_value(_encap); - - // put the length of the array - _encap.write_long(_length); - } - break; - - case TCKind._tk_alias: - case TCKind._tk_value_box: - { - // put the repository id - _encap.write_string(_id); - - // put the name - _encap.write_string(_name); - - // put the type aliased - _contentType.write_value(_encap); - } - break; - - case TCKind._tk_struct: - case TCKind._tk_except: - { - // put the repository id - _encap.write_string(_id); - - // put the name - _encap.write_string(_name); - - // put the number of members - _encap.write_long(_memberCount); - - // marshal member names and types - for (int i=0; i < _memberCount; i++) { - _encap.write_string(_memberNames[i]); - //if (debug) System.out.println("TypeCode " + _name + - // " writing member " + _memberNames[i]); - _memberTypes[i].write_value(_encap); - } - } - break; - - case TCKind._tk_value: - { - // put the repository id - _encap.write_string(_id); - - // put the name - _encap.write_string(_name); - - // put the type modifier - _encap.write_short(_type_modifier); - - // put the type aliased - if (_concrete_base == null) { - _orb.get_primitive_tc(TCKind._tk_null).write_value(_encap); - } else { - _concrete_base.write_value(_encap); - } - - // put the number of members - _encap.write_long(_memberCount); - - // marshal member names and types - for (int i=0; i < _memberCount; i++) { - _encap.write_string(_memberNames[i]); - //if (debug) System.out.println("TypeCode " + _name + - // " writing member " + _memberNames[i]); - _memberTypes[i].write_value(_encap); - _encap.write_short(_memberAccess[i]); - } - } - break; - - default: - throw wrapper.invalidTypecodeKindMarshal() ; - } - - // marshal the encapsulation - _encap.writeOctetSequenceTo(tcos); - break; - } - } - } - - /** - * This is not a copy of the TypeCodeImpl objects, but instead it - * copies the value this type code is representing. - * See AnyImpl read_value and write_value for usage. - * The state of this TypeCodeImpl instance isn't changed, only used - * by the Any to do the correct copy. - */ - protected void copy(org.omg.CORBA.portable.InputStream src, - org.omg.CORBA.portable.OutputStream dst) - { - switch (_kind) { - - case TCKind._tk_null: - case TCKind._tk_void: - case TCKind._tk_native: - case TCKind._tk_abstract_interface: - break; - - case TCKind._tk_short: - case TCKind._tk_ushort: - dst.write_short(src.read_short()); - break; - - case TCKind._tk_long: - case TCKind._tk_ulong: - dst.write_long(src.read_long()); - break; - - case TCKind._tk_float: - dst.write_float(src.read_float()); - break; - - case TCKind._tk_double: - dst.write_double(src.read_double()); - break; - - case TCKind._tk_longlong: - case TCKind._tk_ulonglong: - dst.write_longlong(src.read_longlong()); - break; - - case TCKind._tk_longdouble: - throw wrapper.tkLongDoubleNotSupported() ; - - case TCKind._tk_boolean: - dst.write_boolean(src.read_boolean()); - break; - - case TCKind._tk_char: - dst.write_char(src.read_char()); - break; - - case TCKind._tk_wchar: - dst.write_wchar(src.read_wchar()); - break; - - case TCKind._tk_octet: - dst.write_octet(src.read_octet()); - break; - - case TCKind._tk_string: - { - String s; - s = src.read_string(); - // make sure length bound in typecode is not violated - if ((_length != 0) && (s.length() > _length)) - throw wrapper.badStringBounds( new Integer(s.length()), - new Integer(_length) ) ; - dst.write_string(s); - } - break; - - case TCKind._tk_wstring: - { - String s; - s = src.read_wstring(); - // make sure length bound in typecode is not violated - if ((_length != 0) && (s.length() > _length)) - throw wrapper.badStringBounds( new Integer(s.length()), - new Integer(_length) ) ; - dst.write_wstring(s); - } - break; - - case TCKind._tk_fixed: - { - dst.write_ushort(src.read_ushort()); - dst.write_short(src.read_short()); - } - break; - - case TCKind._tk_any: - { - //Any tmp = new AnyImpl(_orb); - Any tmp = ((CDRInputStream)src).orb().create_any(); - TypeCodeImpl t = new TypeCodeImpl((ORB)dst.orb()); - t.read_value((org.omg.CORBA_2_3.portable.InputStream)src); - t.write_value((org.omg.CORBA_2_3.portable.OutputStream)dst); - tmp.read_value(src, t); - tmp.write_value(dst); - break; - } - - case TCKind._tk_TypeCode: - { - dst.write_TypeCode(src.read_TypeCode()); - break; - } - - case TCKind._tk_Principal: - { - dst.write_Principal(src.read_Principal()); - break; - } - - case TCKind._tk_objref: - { - dst.write_Object(src.read_Object()); - break; - } - - case TCKind._tk_except: - // Copy repositoryId - dst.write_string(src.read_string()); - - // Fall into ... - // _REVISIT_ what about the inherited members of this values concrete base type? - case TCKind._tk_value: - case TCKind._tk_struct: - { - // copy each element, using the corresponding member type - for (int i=0; i < _memberTypes.length; i++) { - _memberTypes[i].copy(src, dst); - } - break; - } - case TCKind._tk_union: - /* _REVISIT_ More generic code? - { - Any discriminator = new AnyImpl(_orb); - discriminator.read_value(src, _discriminator); - discriminator.write_value(dst); - int labelIndex = currentUnionMemberIndex(discriminator); - if (labelIndex == -1) { - // check if label has not been found - if (_defaultIndex == -1) - // throw exception if default was not expected - throw new MARSHAL(); - else - // must be of the default branch type - _memberTypes[_defaultIndex].copy(src, dst); - } else { - _memberTypes[labelIndex].copy(src, dst); - } - } - */ - { - Any tagValue = new AnyImpl( (ORB)src.orb()); - - switch (realType(_discriminator).kind().value()) { - case TCKind._tk_short: - { - short value = src.read_short(); - tagValue.insert_short(value); - dst.write_short(value); - break; - } - case TCKind._tk_long: - { - int value = src.read_long(); - tagValue.insert_long(value); - dst.write_long(value); - break; - } - case TCKind._tk_ushort: - { - short value = src.read_short(); - tagValue.insert_ushort(value); - dst.write_short(value); - break; - } - case TCKind._tk_ulong: - { - int value = src.read_long(); - tagValue.insert_ulong(value); - dst.write_long(value); - break; - } - case TCKind._tk_float: - { - float value = src.read_float(); - tagValue.insert_float(value); - dst.write_float(value); - break; - } - case TCKind._tk_double: - { - double value = src.read_double(); - tagValue.insert_double(value); - dst.write_double(value); - break; - } - case TCKind._tk_boolean: - { - boolean value = src.read_boolean(); - tagValue.insert_boolean(value); - dst.write_boolean(value); - break; - } - case TCKind._tk_char: - { - char value = src.read_char(); - tagValue.insert_char(value); - dst.write_char(value); - break; - } - case TCKind._tk_enum: - { - int value = src.read_long(); - tagValue.type(_discriminator); - tagValue.insert_long(value); - dst.write_long(value); - break; - } - case TCKind._tk_longlong: - { - long value = src.read_longlong(); - tagValue.insert_longlong(value); - dst.write_longlong(value); - break; - } - case TCKind._tk_ulonglong: - { - long value = src.read_longlong(); - tagValue.insert_ulonglong(value); - dst.write_longlong(value); - break; - } - // _REVISIT_ figure out long double mapping - // case TCKind.tk_longdouble: - // { - // double value = src.read_double(); - // tagValue.insert_longdouble(value); - // dst.putDouble(value); - // break; - //} - case TCKind._tk_wchar: - { - char value = src.read_wchar(); - tagValue.insert_wchar(value); - dst.write_wchar(value); - break; - } - default: - throw wrapper.illegalUnionDiscriminatorType() ; - } - - // using the value of the tag, find out the type of the value - // following. - - int labelIndex; - for (labelIndex = 0; labelIndex < _unionLabels.length; labelIndex++) { - // use equality over anys - if (tagValue.equal(_unionLabels[labelIndex])) { - _memberTypes[labelIndex].copy(src, dst); - break; - } - } - - if (labelIndex == _unionLabels.length) { - // check if label has not been found - if (_defaultIndex != -1) - // must be of the default branch type - _memberTypes[_defaultIndex].copy(src, dst); - } - break; - } - - case TCKind._tk_enum: - dst.write_long(src.read_long()); - break; - - case TCKind._tk_sequence: - // get the length of the sequence - int seqLength = src.read_long(); - - // check for sequence bound violated - if ((_length != 0) && (seqLength > _length)) - throw wrapper.badSequenceBounds( new Integer(seqLength), - new Integer(_length) ) ; - - // write the length of the sequence - dst.write_long(seqLength); - - // copy each element of the seq using content type - lazy_content_type(); // make sure it's resolved - for (int i=0; i < seqLength; i++) - _contentType.copy(src, dst); - break; - - case TCKind._tk_array: - // copy each element of the array using content type - for (int i=0; i < _length; i++) - _contentType.copy(src, dst); - break; - - case TCKind._tk_alias: - case TCKind._tk_value_box: - // follow the alias - _contentType.copy(src, dst); - break; - - case tk_indirect: - // need to follow offset, get unmarshal typecode from that - // offset, and use that to do the copy - // Don't need to read type code before using it to do the copy. - // It should be fully usable. - indirectType().copy(src, dst); - break; - - default: - throw wrapper.invalidTypecodeKindMarshal() ; - } - } - - - static protected short digits(java.math.BigDecimal value) { - if (value == null) - return 0; - short length = (short)value.unscaledValue().toString().length(); - if (value.signum() == -1) - length--; - return length; - } - - static protected short scale(java.math.BigDecimal value) { - if (value == null) - return 0; - return (short)value.scale(); - } - - // Utility methods - - // Only for union type. Returns the index of the union member - // corresponding to the discriminator. If not found returns the - // default index or -1 if there is no default index. - int currentUnionMemberIndex(Any discriminatorValue) throws BadKind { - if (_kind != TCKind._tk_union) - throw new BadKind(); - - try { - for (int i=0; i"); - s.println(" " + _memberNames[i] + ";"); - } - s.print(indent(level) + "}"); - break; - - case TCKind._tk_union: - s.print("union " + _name + "..."); - break; - - case TCKind._tk_enum: - s.print("enum " + _name + "..."); - break; - - case TCKind._tk_string: - if (_length == 0) - s.print("unbounded string " + _name); - else - s.print("bounded string(" + _length + ") " + _name); - break; - - case TCKind._tk_sequence: - case TCKind._tk_array: - s.println(kindNames[_kind] + "[" + _length + "] " + _name + " = {"); - s.print(indent(level + 1)); - if (lazy_content_type() != null) { - lazy_content_type().printStream(s, level + 1); - } - s.println(indent(level) + "}"); - break; - - case TCKind._tk_alias: - s.print("alias " + _name + " = " + - (_contentType != null ? _contentType._name : "")); - break; - - case TCKind._tk_wstring: - s.print("wstring[" + _length + "] " + _name); - break; - - case TCKind._tk_fixed: - s.print("fixed(" + _digits + ", " + _scale + ") " + _name); - break; - - case TCKind._tk_value_box: - s.print("valueBox " + _name + "..."); - break; - - case TCKind._tk_abstract_interface: - s.print("abstractInterface " + _name + "..."); - break; - - default: - s.print(""); - break; - } - } - - private String indent(int level) { - String indent = ""; - for(int i=0; i create config data - b. parse props -> create config data -> create components - - However, long-term bean persistence can be used in either model. Separation of - concerns (and the large size of the ORB class) argues for separating data from - components. - -2. get configuration out of ORB (except for finding config class) - ORB responsibility: - - gather all property, arg data together and make it available - - load the ORB configurator and let it process the data, generate a config object - - ORB is central registry, so ORB configurator store config data in ORB - -3. Extensibility is required - - The ORB will have large subsystems that are pluggable components (examples: aobject adaptors, - transport plugins). Individual instances of these frameworks will have their own configuration - data. To solve this, the ORB class will provide (read-only perhaps?) access to the collected - properties. - - While the component config data is not needed in the ORB, it is needed in the ORB config data - so that bean persistence can be used to create an XML version of the data. - - problem: properties vs. config data: same or not? - - properties: easier to use, also necessary to indicate where to get config data if not default - config data: more powerful - -4. Basic principle: A parser performs an action A based on a value V when it matches a property P. - Actions can be: - - configObject.setP( V ) - configObject.setP( A(V) ) - A(V) - -5. ParserActions are composable - - Basic action: Object parse( String arg, String value ) - which nicely handles prefix parsing and sharing of actions across multiple keys - - interface Operation { - Object operate( String arg, String value ) - } - - interface OperationFactory { - Operation booleanAction() ; - - Operation integerAction() ; - - Operation stringAction() ; - - Operation integerRangeAction( int min, int max ) ; - - Operation listAction( char sep, Operation act ) ; - } - - interface ParserAction { - void parse( String arg, String value ) ; - } - - interface ParserActionFactory { - ParserAction setFieldAction( String fieldName ) ; - - ParserAction setFieldAction( String fieldName, Operation op ) ; - - ParserAction operationAction( Operation op ) ; - } - -6. Parsers are created incrementally: - - Constructor: - new Parser( Class configurationDataClass ) - - has the parser class available for useful defaults - - interface PropertyParser { - /** Option must look like a standard property name, which we require here to - * be ( JavaIdent "." ) * JavaIdent. The last java ident we will call the tail. - * If tail starts with "ORB", this option will be used in augmentWithArguments. - * This match operates as follows: - * Let name = tail stripped of its ORB prefix. - * (e.g. if tail = ORBLowWaterMark, name = LowWaterMark). - * Then if option is matched, a conversion to the result type of the method named - * get is performed, and set is called on the data object to set the - * result. - */ - void addMatch( String option ) ; - - void addMatch( String option, ParserAction pa ) - - void addPrefixMatch( String prefix, ParserAction pa ) - - /** First constructs a new property object that has props as its default, - * then enters args into new property object that correspond to property - * names registered in match() calls. - */ - Properties augmentWithArguments( Properties props, String[] args ) ; - - /** Parse all matched properties in props, updating data as required - * by the actions. - */ - void parse( Properties props, ORBConfigurationData data ) ; - } - -7. A useful model: - - Provide - - abstract class ConfigDataBase { - ConfigDataBase( Properties props ) - { - ... - } - } - - and then a specific class - - public class ORBConfigData extends ConfigDataBase { - ORBConfigData( Properties props ) - { - super( props ) ; - } - - private int foo1 = fooDefault ; - private String foo2 = fooDefault2 ; - private boolean foo3 = fooDefault3 ; - private SomeObject foo4 = fooDefault4 ; - - public int getFoo1() { return foo1 ; } - // and similarly - } - - The constructor then uses reflection to automatically handle all of these variables with a number of - assumptions: - a. Standard names: - private foo { = } - public getFoo() { return foo ; } - as argument: -ORBfoo - as property: com.sun.CORBA.foo (problems here) - b. type specific parsing - int: from Integer - String: no-op - boolean: true/false (from Boolean) - Class: must be able to load class - class XXX: XXX must have a public XXX( String ) constructor - - Custom parsing? - - What are valid prefixes? - 1. provide com.sun.corba.prefix.XXX where XXX defines a prefix to look for - (some security implications) - 2. Extend security model to ORB implementation (I like this approach best so far) - -8. ORB config - - public interface ORBConfigurator { - /** This method is called from ORB.init after all ORB properties have been - * collected. The corba.ORB constructor will make sure that all required - * registries are initialized and empty. This constructor will also initialize - * some data used in the corba ORB public API, such as support for deferred - * asynchronous invocation. However, all regisitration including things like - * the dyanmic any factory should take place in the configurator. This method - * is resonsible for making PI ORBInitializer calls, if PI is configured. - */ - void configure( com.sun.corba.se.impl.core.ORB orb ) ; - } - - The ORB will have a default configurator named - - com.sun.corba.se.impl.core.ORBConfiguratorImpl - - and also a property - - com.sun.CORBA.ORBConfiguratorClass - - than can be set to the name of the ORB configurator class to use. Note that this - implementation can either be a straight Java implementation, or something more - interpretive, such as an XML-based config description. - -9. We need to construct a list of all properties, and then make sure that security is respected. - The basic security check is just: - - SecurityManager sman = System.getSecurityManager() ; - if (sman != null) - sman.checkPropertyAccess( key ) - - and also - - sman.checkPropertiesAccess() - - We can construct a list of all properties as we do now, which allows the ORB - to call System.getProperties() inside a doPrivileged() block. Then we create - a subclass of java.util.Properties that overrides getProperty to - do the checkPropertyAccess( key ) call. We also need to overload the - enumerate method, either to make it illegal, call sman.checkPropertiesAccess, - or just filter it to include only the accessible properties. - And we also need to overload store, because it does not call enumerate internally. - - This allows us to provide all properties to an ORBConfigurator, while still preserving - the security model. Then anyone that needs security can set up property permissions - like com.foo.corba.* to allow access to only the properties they care about. - -10. ORB APIs - - The ORB needs registry support including: - getSubcontractRegistry - getServiceContextRegistry - - The ORB needs to provide access to a basic (and extensible) ORB configuration object, - which supports at a minimum all of the standard CORBA defined properties. - - Also need registries for: - ObjectAdapter (actually already in SubcontractRegistry, but needs extensions to - ObjectAdapterFactory to work fully) - TaggedComponentFactory - TaggedProfileFactory - - What does an empty ORB provide? - - Registration of all ORB components - - Request dispatching to object adapters - - Access to ORB properties data (as secure Properties object) - - Access to ORB arguments - - Access to ORB configuration data (base class, plus collections of base config - data for plugins such as OAs and transports) - - shutdown support (separate tracking of invocations vs. OA tracking in POA case? - How should this be designed?) - - INS support? (perhaps this could be pluggable too?) - - How does create_output_stream get plugged in? - - Can we separate the current IIOP transport into a TransportPluging? - - PI support - - CORBA::ORB API - - NVList, DII - - object <-> string (which includes INS?) - - (dis)connect API for TOA (move all impl to TOAImpl?) - - typecode/any - - FVD - - initial services registry - - value factory registry - - logging, other M&M support as needed - -ORB classes: - - core.ORB: abstract class providing internal interface - corba.ORBImpl: internal implementation of CORBA APIs - corba.ORBSingleton: the singleton ORB (not much change needed) - corba.ConfigurationDataCollector: collects all source of config data and canonicalizes it - Interceptor.PIHandler: the interface for PI - Interceptor.PIHandlerImpl: standard implementation of PIHandler - corba.ORBConfigurationData: extensible bean containing all ORB config data - -11. RequestHandler and ORB - - The RH interface is currently implemented in the ORB class, but might better be a separate - class. The API is currently almost the same as a ServerSubcontract. Should we regularize - this? Also, the API would need to be extended to handle shutdown properly. - - Extended API: - - void run(): does not return until shutdown(boolean) is called. - - shutdown(boolean) needs to be here so that requests can be - synchhronized with shutdown. This is also a point where OAs - need to be included (currently in shutdownServants) - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java 2018-01-30 20:16:32.000000000 -0500 +++ /dev/null 2018-01-30 20:16:32.000000000 -0500 @@ -1,636 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.dynamicany; - -import org.omg.CORBA.Any; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.TypeCodePackage.BadKind; -import org.omg.CORBA.TCKind; - -import org.omg.DynamicAny.*; -import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; -import org.omg.DynamicAny.DynAnyPackage.InvalidValue; -import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public class DynAnyBasicImpl extends DynAnyImpl -{ - // - // Constructors - // - - private DynAnyBasicImpl() { - this(null, (Any)null, false); - } - - protected DynAnyBasicImpl(ORB orb, Any any, boolean copyValue) { - super(orb, any, copyValue); - // set the current position to 0 if any has components, otherwise to -1. - index = NO_INDEX; - } - - protected DynAnyBasicImpl(ORB orb, TypeCode typeCode) { - super(orb, typeCode); - // set the current position to 0 if any has components, otherwise to -1. - index = NO_INDEX; - } - - // - // DynAny interface methods - // - - public void assign (org.omg.DynamicAny.DynAny dyn_any) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - super.assign(dyn_any); - index = NO_INDEX; - } - - public void from_any (org.omg.CORBA.Any value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - super.from_any(value); - index = NO_INDEX; - } - - // Spec: Returns a copy of the internal Any - public org.omg.CORBA.Any to_any() { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - return DynAnyUtil.copy(any, orb); - } - - public boolean equal (org.omg.DynamicAny.DynAny dyn_any) { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (dyn_any == this) { - return true; - } - // If the other DynAny is a constructed one we don't want it to have - // to create its Any representation just for this test. - if ( ! any.type().equal(dyn_any.type())) { - return false; - } - //System.out.println("Comparing anys"); - return any.equal(getAny(dyn_any)); - } - - public void destroy() { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (status == STATUS_DESTROYABLE) { - status = STATUS_DESTROYED; - } - } - - public org.omg.DynamicAny.DynAny copy() { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - // The flag "true" indicates copying the Any value - try { - return DynAnyUtil.createMostDerivedDynAny(any, orb, true); - } catch (InconsistentTypeCode ictc) { - return null; // impossible - } - } - - public org.omg.DynamicAny.DynAny current_component() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch - { - return null; - } - - public int component_count() { - return 0; - } - - public boolean next() { - return false; - } - - public boolean seek(int index) { - return false; - } - - public void rewind() { - } - - public void insert_boolean(boolean value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_boolean) - throw new TypeMismatch(); - any.insert_boolean(value); - } - - public void insert_octet(byte value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_octet) - throw new TypeMismatch(); - any.insert_octet(value); - } - - public void insert_char(char value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_char) - throw new TypeMismatch(); - any.insert_char(value); - } - - public void insert_short(short value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_short) - throw new TypeMismatch(); - any.insert_short(value); - } - - public void insert_ushort(short value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_ushort) - throw new TypeMismatch(); - any.insert_ushort(value); - } - - public void insert_long(int value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_long) - throw new TypeMismatch(); - any.insert_long(value); - } - - public void insert_ulong(int value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_ulong) - throw new TypeMismatch(); - any.insert_ulong(value); - } - - public void insert_float(float value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_float) - throw new TypeMismatch(); - any.insert_float(value); - } - - public void insert_double(double value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_double) - throw new TypeMismatch(); - any.insert_double(value); - } - - public void insert_string(String value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_string) - throw new TypeMismatch(); - if (value == null) - throw new InvalidValue(); - // Throw InvalidValue if this is a bounded string and the length is exceeded - try { - if (any.type().length() > 0 && any.type().length() < value.length()) - throw new InvalidValue(); - } catch (BadKind bad) { // impossible - } - any.insert_string(value); - } - - public void insert_reference(org.omg.CORBA.Object value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_objref) - throw new TypeMismatch(); - any.insert_Object(value); - } - - public void insert_typecode(org.omg.CORBA.TypeCode value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_TypeCode) - throw new TypeMismatch(); - any.insert_TypeCode(value); - } - - public void insert_longlong(long value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_longlong) - throw new TypeMismatch(); - any.insert_longlong(value); - } - - public void insert_ulonglong(long value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_ulonglong) - throw new TypeMismatch(); - any.insert_ulonglong(value); - } - - public void insert_wchar(char value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_wchar) - throw new TypeMismatch(); - any.insert_wchar(value); - } - - public void insert_wstring(String value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_wstring) - throw new TypeMismatch(); - if (value == null) - throw new InvalidValue(); - // Throw InvalidValue if this is a bounded string and the length is exceeded - try { - if (any.type().length() > 0 && any.type().length() < value.length()) - throw new InvalidValue(); - } catch (BadKind bad) { // impossible - } - any.insert_wstring(value); - } - - public void insert_any(org.omg.CORBA.Any value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_any) - throw new TypeMismatch(); - any.insert_any(value); - } - - public void insert_dyn_any (org.omg.DynamicAny.DynAny value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_any) - throw new TypeMismatch(); - // _REVISIT_ Copy value here? - any.insert_any(value.to_any()); - } - - public void insert_val(java.io.Serializable value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - int kind = any.type().kind().value(); - if (kind != TCKind._tk_value && kind != TCKind._tk_value_box) - throw new TypeMismatch(); - any.insert_Value(value); - } - - public java.io.Serializable get_val() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - int kind = any.type().kind().value(); - if (kind != TCKind._tk_value && kind != TCKind._tk_value_box) - throw new TypeMismatch(); - return any.extract_Value(); - } - - public boolean get_boolean() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_boolean) - throw new TypeMismatch(); - return any.extract_boolean(); - } - - public byte get_octet() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_octet) - throw new TypeMismatch(); - return any.extract_octet(); - } - - public char get_char() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_char) - throw new TypeMismatch(); - return any.extract_char(); - } - - public short get_short() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_short) - throw new TypeMismatch(); - return any.extract_short(); - } - - public short get_ushort() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_ushort) - throw new TypeMismatch(); - return any.extract_ushort(); - } - - public int get_long() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_long) - throw new TypeMismatch(); - return any.extract_long(); - } - - public int get_ulong() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_ulong) - throw new TypeMismatch(); - return any.extract_ulong(); - } - - public float get_float() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_float) - throw new TypeMismatch(); - return any.extract_float(); - } - - public double get_double() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_double) - throw new TypeMismatch(); - return any.extract_double(); - } - - public String get_string() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_string) - throw new TypeMismatch(); - return any.extract_string(); - } - - public org.omg.CORBA.Object get_reference() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_objref) - throw new TypeMismatch(); - return any.extract_Object(); - } - - public org.omg.CORBA.TypeCode get_typecode() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_TypeCode) - throw new TypeMismatch(); - return any.extract_TypeCode(); - } - - public long get_longlong() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_longlong) - throw new TypeMismatch(); - return any.extract_longlong(); - } - - public long get_ulonglong() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_ulonglong) - throw new TypeMismatch(); - return any.extract_ulonglong(); - } - - public char get_wchar() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_wchar) - throw new TypeMismatch(); - return any.extract_wchar(); - } - - public String get_wstring() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_wstring) - throw new TypeMismatch(); - return any.extract_wstring(); - } - - public org.omg.CORBA.Any get_any() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_any) - throw new TypeMismatch(); - return any.extract_any(); - } - - public org.omg.DynamicAny.DynAny get_dyn_any() - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (any.type().kind().value() != TCKind._tk_any) - throw new TypeMismatch(); - // _REVISIT_ Copy value here? - try { - return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true); - } catch (InconsistentTypeCode ictc) { - // The spec doesn't allow us to throw back this exception - // incase the anys any if of type Principal, native or abstract interface. - return null; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java 2018-01-30 20:16:33.000000000 -0500 +++ /dev/null 2018-01-30 20:16:33.000000000 -0500 @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.dynamicany; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Any; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.TypeCodePackage.BadKind; -import org.omg.CORBA.TypeCodePackage.Bounds; -import org.omg.DynamicAny.*; -import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; -import org.omg.DynamicAny.DynAnyPackage.InvalidValue; -import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -abstract class DynAnyCollectionImpl extends DynAnyConstructedImpl -{ - // - // Instance variables - // - - // Keep in sync with DynAny[] components at all times. - Any[] anys = null; - - // - // Constructors - // - - private DynAnyCollectionImpl() { - this(null, (Any)null, false); - } - - protected DynAnyCollectionImpl(ORB orb, Any any, boolean copyValue) { - super(orb, any, copyValue); - } - - protected DynAnyCollectionImpl(ORB orb, TypeCode typeCode) { - super(orb, typeCode); - } - - // - // Utility methods - // - - protected void createDefaultComponentAt(int i, TypeCode contentType) { - try { - components[i] = DynAnyUtil.createMostDerivedDynAny(contentType, orb); - } catch (InconsistentTypeCode itc) { // impossible - } - // get a hold of the default initialized Any without copying - anys[i] = getAny(components[i]); - } - - protected TypeCode getContentType() { - try { - return any.type().content_type(); - } catch (BadKind badKind) { // impossible - return null; - } - } - - // This method has a different meaning for sequence and array: - // For sequence value of 0 indicates an unbounded sequence, - // values > 0 indicate a bounded sequence. - // For array any value indicates the boundary. - protected int getBound() { - try { - return any.type().length(); - } catch (BadKind badKind) { // impossible - return 0; - } - } - - // - // DynAny interface methods - // - - // _REVISIT_ More efficient copy operation - - // - // Collection methods - // - - public org.omg.CORBA.Any[] get_elements () { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - return (checkInitComponents() ? anys : null); - } - - protected abstract void checkValue(Object[] value) - throws org.omg.DynamicAny.DynAnyPackage.InvalidValue; - - // Initializes the elements of the ordered collection. - // If value does not contain the same number of elements as the array dimension, - // the operation raises InvalidValue. - // If one or more elements have a type that is inconsistent with the collections TypeCode, - // the operation raises TypeMismatch. - // This operation does not change the current position. - public void set_elements (org.omg.CORBA.Any[] value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - checkValue(value); - - components = new DynAny[value.length]; - anys = value; - - // We know that this is of kind tk_sequence or tk_array - TypeCode expectedTypeCode = getContentType(); - for (int i=0; i= names.length) { - throw new InvalidValue(); - } - return names[index]; - } - - public TCKind current_member_kind () - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if( ! checkInitComponents() || index < 0 || index >= components.length) { - throw new InvalidValue(); - } - return components[index].type().kind(); - } - - // Creates references to the parameter instead of copying it. - public void set_members (org.omg.DynamicAny.NameValuePair[] value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (value == null || value.length == 0) { - clearData(); - return; - } - - Any memberAny; - DynAny memberDynAny = null; - String memberName; - // We know that this is of kind tk_struct - TypeCode expectedTypeCode = any.type(); - - int expectedMemberCount = 0; - try { - expectedMemberCount = expectedTypeCode.member_count(); - } catch (BadKind badKind) { // impossible - } - if (expectedMemberCount != value.length) { - clearData(); - throw new InvalidValue(); - } - - allocComponents(value); - - for (int i=0; i= 0 && index < components.length) { - return true; - } else { - index = NO_INDEX; - return false; - } - } - - public boolean seek(int newIndex) { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - if (newIndex < 0) { - this.index = NO_INDEX; - return false; - } - if (checkInitComponents() == false) { - return false; - } - if (newIndex < components.length) { - index = newIndex; - return true; - } - return false; - } - - public void rewind() { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - this.seek(0); - } - - // - // Utility methods - // - - protected void clearData() { - super.clearData(); - // _REVISIT_ What about status? - components = emptyComponents; - index = NO_INDEX; - representations = REPRESENTATION_NONE; - } - - protected void writeAny(OutputStream out) { - // If all we got is TypeCode representation (no value) - // then we don't want to force creating a default value - //System.out.println(this + " checkInitAny before writeAny"); - checkInitAny(); - super.writeAny(out); - } - - // Makes sure that the components representation is initialized - protected boolean checkInitComponents() { - if ((representations & REPRESENTATION_COMPONENTS) == 0) { - if ((representations & REPRESENTATION_ANY) != 0) { - if (initializeComponentsFromAny()) { - representations |= REPRESENTATION_COMPONENTS; - } else { - return false; - } - } else if ((representations & REPRESENTATION_TYPECODE) != 0) { - if (initializeComponentsFromTypeCode()) { - representations |= REPRESENTATION_COMPONENTS; - } else { - return false; - } - } - } - return true; - } - - // Makes sure that the Any representation is initialized - protected void checkInitAny() { - if ((representations & REPRESENTATION_ANY) == 0) { - //System.out.println(this + " checkInitAny: reps does not have REPRESENTATION_ANY"); - if ((representations & REPRESENTATION_COMPONENTS) != 0) { - //System.out.println(this + " checkInitAny: reps has REPRESENTATION_COMPONENTS"); - if (initializeAnyFromComponents()) { - representations |= REPRESENTATION_ANY; - } - } else if ((representations & REPRESENTATION_TYPECODE) != 0) { - //System.out.println(this + " checkInitAny: reps has REPRESENTATION_TYPECODE"); - if (representations == REPRESENTATION_TYPECODE && isRecursive()) - return; - if (initializeComponentsFromTypeCode()) { - representations |= REPRESENTATION_COMPONENTS; - } - if (initializeAnyFromComponents()) { - representations |= REPRESENTATION_ANY; - } - } - } else { - //System.out.println(this + " checkInitAny: reps != REPRESENTATION_ANY"); - } - return; - } - - protected abstract boolean initializeComponentsFromAny(); - protected abstract boolean initializeComponentsFromTypeCode(); - - // Collapses the whole DynAny hierarchys values into one single streamed Any - protected boolean initializeAnyFromComponents() { - //System.out.println(this + " initializeAnyFromComponents"); - OutputStream out = any.create_output_stream(); - for (int i=0; i= memberCount()) { - throw new InvalidValue(); - } - currentEnumeratorIndex = value; - any.insert_long(value); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynFixedImpl.java 2018-01-30 20:16:38.000000000 -0500 +++ /dev/null 2018-01-30 20:16:39.000000000 -0500 @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.dynamicany; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Any; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.DynamicAny.*; -import org.omg.DynamicAny.DynAnyPackage.*; -import java.math.BigDecimal; -import java.math.BigInteger; -import org.omg.CORBA.TypeCodePackage.BadKind; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public class DynFixedImpl extends DynAnyBasicImpl implements DynFixed -{ - // - // Constructors - // - - private DynFixedImpl() { - this(null, (Any)null, false); - } - - protected DynFixedImpl(ORB orb, Any any, boolean copyValue) { - super(orb, any, copyValue); - } - - // Sets the current position to -1 and the value to zero. - protected DynFixedImpl(ORB orb, TypeCode typeCode) { - super(orb, typeCode); - index = NO_INDEX; - } - - // - // DynAny interface methods - // -/* - public int component_count() { - return 0; - } -*/ - // - // DynFixed interface methods - // - - public String get_value () { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - return any.extract_fixed().toString(); - } - - // Initializes the value of the DynFixed. - // The val string must contain a fixed string constant in the same format - // as used for IDL fixed-point literals. - // - // It may consist of an integer part, an optional decimal point, - // a fraction part and an optional letter d or D. - // The integer and fraction parts both must be sequences of decimal (base 10) digits. - // Either the integer part or the fraction part, but not both, may be missing. - // - // If val contains a value whose scale exceeds that of the DynFixed or is not initialized, - // the operation raises InvalidValue. - // The return value is true if val can be represented as the DynFixed without loss of precision. - // If val has more fractional digits than can be represented in the DynFixed, - // fractional digits are truncated and the return value is false. - // If val does not contain a valid fixed-point literal or contains extraneous characters - // other than leading or trailing white space, the operation raises TypeMismatch. - // - public boolean set_value (String val) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - int digits = 0; - int scale = 0; - boolean preservedPrecision = true; - try { - digits = any.type().fixed_digits(); - scale = any.type().fixed_scale(); - } catch (BadKind ex) { // impossible - } - // First get rid of leading or trailing whitespace which is allowed - String string = val.trim(); - if (string.length() == 0) - throw new TypeMismatch(); - // Now scan for the sign - String sign = ""; - if (string.charAt(0) == '-') { - sign = "-"; - string = string.substring(1); - } else if (string.charAt(0) == '+') { - sign = "+"; - string = string.substring(1); - } - // Now get rid of the letter d or D. - int dIndex = string.indexOf('d'); - if (dIndex == -1) { - dIndex = string.indexOf('D'); - } - if (dIndex != -1) { - string = string.substring(0, dIndex); - } - // Just to be sure - if (string.length() == 0) - throw new TypeMismatch(); - // Now look for the dot to determine the integer part - String integerPart; - String fractionPart; - int currentScale; - int currentDigits; - int dotIndex = string.indexOf('.'); - if (dotIndex == -1) { - integerPart = string; - fractionPart = null; - currentScale = 0; - currentDigits = integerPart.length(); - } else if (dotIndex == 0 ) { - integerPart = null; - fractionPart = string; - currentScale = fractionPart.length(); - currentDigits = currentScale; - } else { - integerPart = string.substring(0, dotIndex); - fractionPart = string.substring(dotIndex + 1); - currentScale = fractionPart.length(); - currentDigits = integerPart.length() + currentScale; - } - // Let's see if we have to drop some precision - if (currentDigits > digits) { - preservedPrecision = false; - // truncate the fraction part - if (integerPart.length() < digits) { - fractionPart = fractionPart.substring(0, digits - integerPart.length()); - } else if (integerPart.length() == digits) { - // currentScale > 0 - // drop the fraction completely - fractionPart = null; - } else { - // integerPart.length() > digits - // unable to truncate fraction part - throw new InvalidValue(); - } - } - // If val contains a value whose scale exceeds that of the DynFixed or is not initialized, - // the operation raises InvalidValue. - // Reinterpreted to mean raise InvalidValue only if the integer part exceeds precision, - // which is handled above (integerPart.length() > digits) -/* - if (currentScale > scale) { - throw new InvalidValue("Scale exceeds " + scale); - } -*/ - // Now check whether both parts are valid numbers - BigDecimal result; - try { - new BigInteger(integerPart); - if (fractionPart == null) { - result = new BigDecimal(sign + integerPart); - } else { - new BigInteger(fractionPart); - result = new BigDecimal(sign + integerPart + "." + fractionPart); - } - } catch (NumberFormatException nfe) { - throw new TypeMismatch(); - } - any.insert_fixed(result, any.type()); - return preservedPrecision; - } - - public String toString() { - int digits = 0; - int scale = 0; - try { - digits = any.type().fixed_digits(); - scale = any.type().fixed_scale(); - } catch (BadKind ex) { // impossible - } - return "DynFixed with value=" + this.get_value() + ", digits=" + digits + ", scale=" + scale; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java 2018-01-30 20:16:39.000000000 -0500 +++ /dev/null 2018-01-30 20:16:39.000000000 -0500 @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.dynamicany; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Any; -import org.omg.CORBA.BAD_OPERATION; -import org.omg.CORBA.TypeCodePackage.BadKind; -import org.omg.CORBA.TypeCodePackage.Bounds; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.DynamicAny.*; -import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; -import org.omg.DynamicAny.DynAnyPackage.InvalidValue; -import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -// _REVIST_ Could make this a subclass of DynArrayImpl -// But that would mean that an object that implements DynSequence also implements DynArray -// which the spec doesn't mention (it also doesn't forbid it). -public class DynSequenceImpl extends DynAnyCollectionImpl implements DynSequence -{ - // - // Constructors - // - - private DynSequenceImpl() { - this(null, (Any)null, false); - } - - protected DynSequenceImpl(ORB orb, Any any, boolean copyValue) { - super(orb, any, copyValue); - } - - // Sets the current position to -1 and creates an empty sequence. - protected DynSequenceImpl(ORB orb, TypeCode typeCode) { - super(orb, typeCode); - } - - // Initializes components and anys representation - // from the Any representation - protected boolean initializeComponentsFromAny() { - // This typeCode is of kind tk_sequence. - TypeCode typeCode = any.type(); - int length; - TypeCode contentType = getContentType(); - InputStream input; - - try { - input = any.create_input_stream(); - } catch (BAD_OPERATION e) { - return false; - } - - length = input.read_long(); - components = new DynAny[length]; - anys = new Any[length]; - - for (int i=0; i 0 && len > bound) { - throw new InvalidValue(); - } - - checkInitComponents(); - - int oldLength = components.length; - if (len > oldLength) { - // Increase length - DynAny[] newComponents = new DynAny[len]; - Any[] newAnys = new Any[len]; - System.arraycopy(components, 0, newComponents, 0, oldLength); - System.arraycopy(anys, 0, newAnys, 0, oldLength); - components = newComponents; - anys = newAnys; - - // Newly added elements are default-initialized - TypeCode contentType = getContentType(); - for (int i=oldLength; i= len) { - index = NO_INDEX; - } - } else { - // Length unchanged - // Maybe components is now default initialized from type code - if (index == NO_INDEX && len > 0) { - index = 0; - } - } - } - - // Initializes the elements of the sequence. - // The length of the DynSequence is set to the length of value. - // The current position is set to zero if value has non-zero length - // and to -1 if value is a zero-length sequence. - // If the length of value exceeds the bound of a bounded sequence, - // the operation raises InvalidValue. - // If value contains one or more elements whose TypeCode is not equivalent - // to the element TypeCode of the DynSequence, the operation raises TypeMismatch. -/* - public void set_elements(org.omg.CORBA.Any[] value) - throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch, - org.omg.DynamicAny.DynAnyPackage.InvalidValue; -*/ - - // - // Utility methods - // - - protected void checkValue(Object[] value) - throws org.omg.DynamicAny.DynAnyPackage.InvalidValue - { - if (value == null || value.length == 0) { - clearData(); - index = NO_INDEX; - return; - } else { - index = 0; - } - int bound = getBound(); - if (bound > 0 && value.length > bound) { - throw new InvalidValue(); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynStructImpl.java 2018-01-30 20:16:40.000000000 -0500 +++ /dev/null 2018-01-30 20:16:40.000000000 -0500 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.dynamicany; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.TCKind; -import org.omg.CORBA.Any; -import org.omg.CORBA.TypeCodePackage.BadKind; -import org.omg.CORBA.TypeCodePackage.Bounds; -import org.omg.DynamicAny.*; -import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; -import org.omg.DynamicAny.DynAnyPackage.InvalidValue; -import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public class DynStructImpl extends DynAnyComplexImpl implements DynStruct -{ - // - // Constructors - // - - private DynStructImpl() { - this(null, (Any)null, false); - } - - protected DynStructImpl(ORB orb, Any any, boolean copyValue) { - // We can be sure that typeCode is of kind tk_struct - super(orb, any, copyValue); - // Initialize components lazily, on demand. - // This is an optimization in case the user is only interested in storing Anys. - } - - protected DynStructImpl(ORB orb, TypeCode typeCode) { - // We can be sure that typeCode is of kind tk_struct - super(orb, typeCode); - // For DynStruct, the operation sets the current position to -1 - // for empty exceptions and to zero for all other TypeCodes. - // The members (if any) are (recursively) initialized to their default values. - index = 0; - } - - // - // Methods differing from DynValues - // - - public org.omg.DynamicAny.NameValuePair[] get_members () { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - checkInitComponents(); - return nameValuePairs; - } - - public org.omg.DynamicAny.NameDynAnyPair[] get_members_as_dyn_any () { - if (status == STATUS_DESTROYED) { - throw wrapper.dynAnyDestroyed() ; - } - checkInitComponents(); - return nameDynAnyPairs; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynUnionImpl.java 2018-01-30 20:16:40.000000000 -0500 +++ /dev/null 2018-01-30 20:16:40.000000000 -0500 @@ -1,385 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.dynamicany; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.TCKind; -import org.omg.CORBA.Any; -import org.omg.CORBA.TypeCodePackage.BadKind; -import org.omg.CORBA.TypeCodePackage.Bounds; -import org.omg.CORBA.portable.InputStream; -import org.omg.DynamicAny.*; -import org.omg.DynamicAny.DynAnyPackage.TypeMismatch; -import org.omg.DynamicAny.DynAnyPackage.InvalidValue; -import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public class DynUnionImpl extends DynAnyConstructedImpl implements DynUnion -{ - // - // Instance variables - // - - DynAny discriminator = null; - // index either points to the discriminator or the named member is it exists. - // The currently active member, which is of the same type as the discriminator. - DynAny currentMember = null; - int currentMemberIndex = NO_INDEX; - - // - // Constructors - // - - private DynUnionImpl() { - this(null, (Any)null, false); - } - - protected DynUnionImpl(ORB orb, Any any, boolean copyValue) { - // We can be sure that typeCode is of kind tk_union - super(orb, any, copyValue); - } - - protected DynUnionImpl(ORB orb, TypeCode typeCode) { - // We can be sure that typeCode is of kind tk_union - super(orb, typeCode); - } - - protected boolean initializeComponentsFromAny() { - try { - InputStream input = any.create_input_stream(); - Any discriminatorAny = DynAnyUtil.extractAnyFromStream(discriminatorType(), input, orb); - discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false); - currentMemberIndex = currentUnionMemberIndex(discriminatorAny); - Any memberAny = DynAnyUtil.extractAnyFromStream(memberType(currentMemberIndex), input, orb); - currentMember = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false); - components = new DynAny[] {discriminator, currentMember}; - } catch (InconsistentTypeCode ictc) { // impossible - } - return true; - } - - // Sets the current position to zero. - // The discriminator value is set to a value consistent with the first named member - // of the union. That member is activated and (recursively) initialized to its default value. - protected boolean initializeComponentsFromTypeCode() { - //System.out.println(this + " initializeComponentsFromTypeCode"); - try { - // We can be sure that memberCount() > 0 according to the IDL language spec - discriminator = DynAnyUtil.createMostDerivedDynAny(memberLabel(0), orb, false); - index = 0; - currentMemberIndex = 0; - currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(0), orb); - components = new DynAny[] {discriminator, currentMember}; - } catch (InconsistentTypeCode ictc) { // impossible - } - return true; - } - - // - // Convenience methods - // - - private TypeCode discriminatorType() { - TypeCode discriminatorType = null; - try { - discriminatorType = any.type().discriminator_type(); - } catch (BadKind bad) { - } - return discriminatorType; - } - - private int memberCount() { - int memberCount = 0; - try { - memberCount = any.type().member_count(); - } catch (BadKind bad) { - } - return memberCount; - } - - private Any memberLabel(int i) { - Any memberLabel = null; - try { - memberLabel = any.type().member_label(i); - } catch (BadKind bad) { - } catch (Bounds bounds) { - } - return memberLabel; - } - - private TypeCode memberType(int i) { - TypeCode memberType = null; - try { - memberType = any.type().member_type(i); - } catch (BadKind bad) { - } catch (Bounds bounds) { - } - return memberType; - } - - private String memberName(int i) { - String memberName = null; - try { - memberName = any.type().member_name(i); - } catch (BadKind bad) { - } catch (Bounds bounds) { - } - return memberName; - } - - private int defaultIndex() { - int defaultIndex = -1; - try { - defaultIndex = any.type().default_index(); - } catch (BadKind bad) { - } - return defaultIndex; - } - - private int currentUnionMemberIndex(Any discriminatorValue) { - int memberCount = memberCount(); - Any memberLabel; - for (int i=0; i 0; - } - - /** - * Returns the correct buffer size for this type of - * buffer manager as set in the ORB. - */ - public int getBufferSize() { - return orb.getORBData().getGIOPFragmentSize(); - } - - public void overflow (ByteBufferWithInfo bbwi) - { - // Set the fragment's moreFragments field to true - MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT); - - try { - sendFragment(false); - } catch(SystemException se){ - orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.SYSTEM_EXCEPTION, se); - throw se; - } - - // Reuse the old buffer - - // REVISIT - need to account for case when needed > available - // even after fragmenting. This is the large array case, so - // the caller should retry when it runs out of space. - bbwi.position(0); - bbwi.buflen = bbwi.byteBuffer.limit(); - bbwi.fragmented = true; - - // Now we must marshal in the fragment header/GIOP header - - // REVISIT - we can optimize this by not creating the fragment message - // each time. - - FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage(); - - header.write(((CDROutputObject)outputObject)); - } - - private void sendFragment(boolean isLastFragment) - { - Connection conn = ((OutputObject)outputObject).getMessageMediator().getConnection(); - - // REVISIT: need an ORB - //System.out.println("sendFragment: last?: " + isLastFragment); - conn.writeLock(); - - try { - // Send the fragment - conn.sendWithoutLock(((OutputObject)outputObject)); - - fragmentCount++; - - } finally { - - conn.writeUnlock(); - } - - } - - // Sends the last fragment - public void sendMessage () - { - sendFragment(true); - - sentFullMessage = true; - } - - /** - * Close the BufferManagerWrite and do any outstanding cleanup. - * - * No work to do for a BufferManagerWriteStream - */ - public void close(){}; - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferQueue.java 2018-01-30 20:16:48.000000000 -0500 +++ /dev/null 2018-01-30 20:16:49.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.encoding; - -import java.util.LinkedList; -import java.util.NoSuchElementException; -import java.util.LinkedList; - -/** - * Simple unsynchronized queue implementation for ByteBufferWithInfos. - */ -// XREVISIT - Should be in orbutil or package private -public class BufferQueue -{ - private LinkedList list = new LinkedList(); - - public void enqueue(ByteBufferWithInfo item) - { - list.addLast(item); - } - - public ByteBufferWithInfo dequeue() throws NoSuchElementException - { - return (ByteBufferWithInfo)list.removeFirst(); - } - - public int size() - { - return list.size(); - } - - // Adds the given ByteBufferWithInfo to the front - // of the queue. - public void push(ByteBufferWithInfo item) - { - list.addFirst(item); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java 2018-01-30 20:16:49.000000000 -0500 +++ /dev/null 2018-01-30 20:16:49.000000000 -0500 @@ -1,257 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.encoding; - -import java.nio.ByteBuffer; - - -import com.sun.corba.se.impl.encoding.BufferManagerWrite; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.pept.transport.ByteBufferPool; -import com.sun.corba.se.spi.orb.ORB; - - -// Notes about the class. -// Assumptions, the ByteBuffer's position is set by the constructor's -// index variable and the ByteBuffer's limit points to the end of the -// data. Also, since the index variable tracks the current empty -// position in the buffer, the ByteBuffer's position is updated -// any time there's a call to this class's position(). -// Although, a ByteBuffer's length is it's capacity(), the context in -// which length is used in this object, this.buflen is actually the -// ByteBuffer limit(). - -public class ByteBufferWithInfo -{ - private ORB orb; - private boolean debug; - // REVISIT - index should eventually be replaced with byteBuffer.position() - private int index; // Current empty position in buffer. - // REVISIT - CHANGE THESE TO PRIVATE - public ByteBuffer byteBuffer;// Marshal buffer. - public int buflen; // Total length of buffer. // Unnecessary... - public int needed; // How many more bytes are needed on overflow. - public boolean fragmented; // Did the overflow operation fragment? - - public ByteBufferWithInfo(org.omg.CORBA.ORB orb, - ByteBuffer byteBuffer, - int index) - { - this.orb = (com.sun.corba.se.spi.orb.ORB)orb; - debug = this.orb.transportDebugFlag; - this.byteBuffer = byteBuffer; - if (byteBuffer != null) - { - this.buflen = byteBuffer.limit(); - } - position(index); - this.needed = 0; - this.fragmented = false; - } - - public ByteBufferWithInfo(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer) - { - this(orb, byteBuffer, 0); - } - - public ByteBufferWithInfo(org.omg.CORBA.ORB orb, - BufferManagerWrite bufferManager) - { - this(orb, bufferManager, true); - } - - // Right now, EncapsOutputStream's do not use pooled byte buffers. - // EncapsOutputStream's is the only one that does not use pooled - // byte buffers. Hence, the reason for the boolean 'usePooledByteBuffers'. - // See EncapsOutputStream for additional information. - - public ByteBufferWithInfo(org.omg.CORBA.ORB orb, - BufferManagerWrite bufferManager, - boolean usePooledByteBuffers) - { - this.orb = (com.sun.corba.se.spi.orb.ORB)orb; - debug = this.orb.transportDebugFlag; - - int bufferSize = bufferManager.getBufferSize(); - - if (usePooledByteBuffers) - { - ByteBufferPool byteBufferPool = this.orb.getByteBufferPool(); - this.byteBuffer = byteBufferPool.getByteBuffer(bufferSize); - - if (debug) - { - // print address of ByteBuffer gotten from pool - int bbAddress = System.identityHashCode(byteBuffer); - StringBuffer sb = new StringBuffer(80); - sb.append("constructor (ORB, BufferManagerWrite) - got ") - .append("ByteBuffer id (").append(bbAddress) - .append(") from ByteBufferPool."); - String msgStr = sb.toString(); - dprint(msgStr); - } - } - else - { - // don't allocate from pool, allocate non-direct ByteBuffer - this.byteBuffer = ByteBuffer.allocate(bufferSize); - } - - position(0); - this.buflen = bufferSize; - this.byteBuffer.limit(this.buflen); - this.needed = 0; - this.fragmented = false; - } - - // Shallow copy constructor - public ByteBufferWithInfo (ByteBufferWithInfo bbwi) - { - this.orb = bbwi.orb; - this.debug = bbwi.debug; - this.byteBuffer = bbwi.byteBuffer; - this.buflen = bbwi.buflen; - this.byteBuffer.limit(this.buflen); - position(bbwi.position()); - this.needed = bbwi.needed; - this.fragmented = bbwi.fragmented; - } - - // So IIOPOutputStream seems more intuitive - public int getSize() - { - return position(); - } - - // accessor to buflen - public int getLength() - { - return buflen; - } - - // get position in this buffer - public int position() - { - // REVISIT - This should be changed to return the - // value of byteBuffer.position() rather - // than this.index. But, byteBuffer.position - // is manipulated via ByteBuffer writes, reads, - // gets and puts. These locations need to be - // investigated and updated before - // byteBuffer.position() can be returned here. - // return byteBuffer.position(); - return index; - } - - // set position in this buffer - public void position(int newPosition) - { - // REVISIT - This should be changed to set only the - // value of byteBuffer.position rather - // than this.index. This change should be made - // in conjunction with the change to this.position(). - byteBuffer.position(newPosition); - index = newPosition; - } - - // mutator to buflen - public void setLength(int theLength) - { - buflen = theLength; - byteBuffer.limit(buflen); - } - - // Grow byteBuffer to a size larger than position() + needed - public void growBuffer(com.sun.corba.se.spi.orb.ORB orb) - { - // This code used to live directly in CDROutputStream.grow. - - // Recall that the byteBuffer size is 'really' the limit or - // buflen. - - int newLength = byteBuffer.limit() * 2; - - while (position() + needed >= newLength) - newLength = newLength * 2; - - ByteBufferPool byteBufferPool = orb.getByteBufferPool(); - ByteBuffer newBB = byteBufferPool.getByteBuffer(newLength); - - if (debug) - { - // print address of ByteBuffer just gotten - int newbbAddress = System.identityHashCode(newBB); - StringBuffer sb = new StringBuffer(80); - sb.append("growBuffer() - got ByteBuffer id ("); - sb.append(newbbAddress).append(") from ByteBufferPool."); - String msgStr = sb.toString(); - dprint(msgStr); - } - - byteBuffer.position(0); - newBB.put(byteBuffer); - - // return 'old' byteBuffer reference to the ByteBuffer pool - if (debug) - { - // print address of ByteBuffer being released - int bbAddress = System.identityHashCode(byteBuffer); - StringBuffer sb = new StringBuffer(80); - sb.append("growBuffer() - releasing ByteBuffer id ("); - sb.append(bbAddress).append(") to ByteBufferPool."); - String msgStr2 = sb.toString(); - dprint(msgStr2); - } - byteBufferPool.releaseByteBuffer(byteBuffer); - - // update the byteBuffer with a larger ByteBuffer - byteBuffer = newBB; - - // limit and buflen must be set to newLength. - buflen = newLength; - byteBuffer.limit(buflen); - } - - public String toString() - { - StringBuffer str = new StringBuffer("ByteBufferWithInfo:"); - - str.append(" buflen = " + buflen); - str.append(" byteBuffer.limit = " + byteBuffer.limit()); - str.append(" index = " + index); - str.append(" position = " + position()); - str.append(" needed = " + needed); - str.append(" byteBuffer = " + (byteBuffer == null ? "null" : "not null")); - str.append(" fragmented = " + fragmented); - - return str.toString(); - } - - protected void dprint(String msg) - { - ORBUtility.dprint("ByteBufferWithInfo", msg); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputObject.java 2018-01-30 20:16:50.000000000 -0500 +++ /dev/null 2018-01-30 20:16:50.000000000 -0500 @@ -1,267 +0,0 @@ -/* - * Copyright (c) 2001, 2004, 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.corba.se.impl.encoding; - -import java.nio.ByteBuffer; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.pept.encoding.InputObject; - -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.transport.CorbaConnection; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.impl.encoding.BufferManagerFactory; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.encoding.CDRInputStream; - -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.logging.OMGSystemException; - -import com.sun.corba.se.impl.orbutil.ORBUtility; - -/** - * @author Harold Carr - */ -public class CDRInputObject extends CDRInputStream - implements - InputObject -{ - private CorbaConnection corbaConnection; - private Message header; - private boolean unmarshaledHeader; - private ORB orb ; - private ORBUtilSystemException wrapper ; - private OMGSystemException omgWrapper ; - - public CDRInputObject(ORB orb, - CorbaConnection corbaConnection, - ByteBuffer byteBuffer, - Message header) - { - super(orb, byteBuffer, header.getSize(), header.isLittleEndian(), - header.getGIOPVersion(), header.getEncodingVersion(), - BufferManagerFactory.newBufferManagerRead( - header.getGIOPVersion(), - header.getEncodingVersion(), - orb)); - - this.corbaConnection = corbaConnection; - this.orb = orb ; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_ENCODING ) ; - this.omgWrapper = OMGSystemException.get( orb, - CORBALogDomains.RPC_ENCODING ) ; - - if (orb.transportDebugFlag) { - dprint(".CDRInputObject constructor:"); - } - - getBufferManager().init(header); - - this.header = header; - - unmarshaledHeader = false; - - setIndex(Message.GIOPMessageHeaderLength); - - setBufferLength(header.getSize()); - } - - // REVISIT - think about this some more. - // This connection normally is accessed from the message mediator. - // However, giop input needs to get code set info from the connetion - // *before* the message mediator is available. - public final CorbaConnection getConnection() - { - return corbaConnection; - } - - // XREVISIT - Should the header be kept in the stream or the - // message mediator? Or should we not have a header and - // have the information stored in the message mediator - // directly? - public Message getMessageHeader() - { - return header; - } - - /** - * Unmarshal the extended GIOP header - * NOTE: May be fragmented, so should not be called by the ReaderThread. - * See CorbaResponseWaitingRoomImpl.waitForResponse. It is done - * there in the client thread. - */ - public void unmarshalHeader() - { - // Unmarshal the extended GIOP message from the buffer. - - if (!unmarshaledHeader) { - try { - if (((ORB)orb()).transportDebugFlag) { - dprint(".unmarshalHeader->: " + getMessageHeader()); - } - getMessageHeader().read(this); - unmarshaledHeader= true; - } catch (RuntimeException e) { - if (((ORB)orb()).transportDebugFlag) { - dprint(".unmarshalHeader: !!ERROR!!: " - + getMessageHeader() - + ": " + e); - } - throw e; - } finally { - if (((ORB)orb()).transportDebugFlag) { - dprint(".unmarshalHeader<-: " + getMessageHeader()); - } - } - } - } - - public final boolean unmarshaledHeader() - { - return unmarshaledHeader; - } - - /** - * Override the default CDR factory behavior to get the - * negotiated code sets from the connection. - * - * These are only called once per message, the first time needed. - * - * In the local case, there is no Connection, so use the - * local code sets. - */ - protected CodeSetConversion.BTCConverter createCharBTCConverter() { - CodeSetComponentInfo.CodeSetContext codesets = getCodeSets(); - - // If the connection doesn't have its negotiated - // code sets by now, fall back on the defaults defined - // in CDRInputStream. - if (codesets == null) - return super.createCharBTCConverter(); - - OSFCodeSetRegistry.Entry charSet - = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet()); - - if (charSet == null) - throw wrapper.unknownCodeset( charSet ) ; - - return CodeSetConversion.impl().getBTCConverter(charSet, isLittleEndian()); - } - - protected CodeSetConversion.BTCConverter createWCharBTCConverter() { - - CodeSetComponentInfo.CodeSetContext codesets = getCodeSets(); - - // If the connection doesn't have its negotiated - // code sets by now, we have to throw an exception. - // See CORBA formal 00-11-03 13.9.2.6. - if (codesets == null) { - if (getConnection().isServer()) - throw omgWrapper.noClientWcharCodesetCtx() ; - else - throw omgWrapper.noServerWcharCodesetCmp() ; - } - - OSFCodeSetRegistry.Entry wcharSet - = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet()); - - if (wcharSet == null) - throw wrapper.unknownCodeset( wcharSet ) ; - - // For GIOP 1.2 and UTF-16, use big endian if there is no byte - // order marker. (See issue 3405b) - // - // For GIOP 1.1 and UTF-16, use the byte order the stream if - // there isn't (and there shouldn't be) a byte order marker. - // - // GIOP 1.0 doesn't have wchars. If we're talking to a legacy ORB, - // we do what our old ORBs did. - if (wcharSet == OSFCodeSetRegistry.UTF_16) { - if (getGIOPVersion().equals(GIOPVersion.V1_2)) - return CodeSetConversion.impl().getBTCConverter(wcharSet, false); - } - - return CodeSetConversion.impl().getBTCConverter(wcharSet, isLittleEndian()); - } - - // If we're local and don't have a Connection, use the - // local code sets, otherwise get them from the connection. - // If the connection doesn't have negotiated code sets - // yet, then we use ISO8859-1 for char/string and wchar/wstring - // are illegal. - private CodeSetComponentInfo.CodeSetContext getCodeSets() { - if (getConnection() == null) - return CodeSetComponentInfo.LOCAL_CODE_SETS; - else - return getConnection().getCodeSetContext(); - } - - public final CodeBase getCodeBase() { - if (getConnection() == null) - return null; - else - return getConnection().getCodeBase(); - } - - // ----------------------------------------------------------- - // Below this point are commented out methods with features - // from the old stream. We must find ways to address - // these issues in the future. - // ----------------------------------------------------------- - - // XREVISIT -// private XIIOPInputStream(XIIOPInputStream stream) { -// super(stream); - -// this.conn = stream.conn; -// this.msg = stream.msg; -// this.unmarshaledHeader = stream.unmarshaledHeader; -// } - - public CDRInputStream dup() { - // XREVISIT - return null; - // return new XIIOPInputStream(this); - } - - protected void dprint(String msg) - { - ORBUtility.dprint("CDRInputObject", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream.java 2018-01-30 20:16:51.000000000 -0500 +++ /dev/null 2018-01-30 20:16:51.000000000 -0500 @@ -1,544 +0,0 @@ -/* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.corba.se.impl.encoding; - -import java.io.IOException; -import java.io.Serializable; -import java.math.BigDecimal; -import java.nio.ByteBuffer; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; - -/** - * This is delegates to the real implementation. - * - * NOTE: - * - * Before using the stream for valuetype unmarshaling, one must call - * performORBVersionSpecificInit(). - */ -public abstract class CDRInputStream - extends org.omg.CORBA_2_3.portable.InputStream - implements com.sun.corba.se.impl.encoding.MarshalInputStream, - org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream -{ - protected CorbaMessageMediator messageMediator; - private CDRInputStreamBase impl; - - // We can move this out somewhere later. For now, it serves its purpose - // to create a concrete CDR delegate based on the GIOP version. - private static class InputStreamFactory { - - public static CDRInputStreamBase newInputStream( - ORB orb, GIOPVersion version, byte encodingVersion) { - switch(version.intValue()) { - case GIOPVersion.VERSION_1_0: - return new CDRInputStream_1_0(); - case GIOPVersion.VERSION_1_1: - return new CDRInputStream_1_1(); - case GIOPVersion.VERSION_1_2: - if (encodingVersion != Message.CDR_ENC_VERSION) { - return - new IDLJavaSerializationInputStream(encodingVersion); - } - return new CDRInputStream_1_2(); - // else fall through and report exception. - default: - ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_ENCODING ) ; - throw wrapper.unsupportedGiopVersion( version ) ; - } - } - } - - // Required for the case when a ClientResponseImpl is - // created with a SystemException due to a dead server/closed - // connection with no warning. Note that the stream will - // not be initialized in this case. - // - // Probably also required by ServerRequestImpl. - // - // REVISIT. - public CDRInputStream() { - } - - public CDRInputStream(CDRInputStream is) { - impl = is.impl.dup(); - impl.setParent(this); - } - - public CDRInputStream(org.omg.CORBA.ORB orb, - ByteBuffer byteBuffer, - int size, - boolean littleEndian, - GIOPVersion version, - byte encodingVersion, - BufferManagerRead bufMgr) - { - impl = InputStreamFactory.newInputStream((ORB)orb, version, - encodingVersion); - - impl.init(orb, byteBuffer, size, littleEndian, bufMgr); - - impl.setParent(this); - } - - // org.omg.CORBA.portable.InputStream - public final boolean read_boolean() { - return impl.read_boolean(); - } - - public final char read_char() { - return impl.read_char(); - } - - public final char read_wchar() { - return impl.read_wchar(); - } - - public final byte read_octet() { - return impl.read_octet(); - } - - public final short read_short() { - return impl.read_short(); - } - - public final short read_ushort() { - return impl.read_ushort(); - } - - public final int read_long() { - return impl.read_long(); - } - - public final int read_ulong() { - return impl.read_ulong(); - } - - public final long read_longlong() { - return impl.read_longlong(); - } - - public final long read_ulonglong() { - return impl.read_ulonglong(); - } - - public final float read_float() { - return impl.read_float(); - } - - public final double read_double() { - return impl.read_double(); - } - - public final String read_string() { - return impl.read_string(); - } - - public final String read_wstring() { - return impl.read_wstring(); - } - - public final void read_boolean_array(boolean[] value, int offset, int length) { - impl.read_boolean_array(value, offset, length); - } - - public final void read_char_array(char[] value, int offset, int length) { - impl.read_char_array(value, offset, length); - } - - public final void read_wchar_array(char[] value, int offset, int length) { - impl.read_wchar_array(value, offset, length); - } - - public final void read_octet_array(byte[] value, int offset, int length) { - impl.read_octet_array(value, offset, length); - } - - public final void read_short_array(short[] value, int offset, int length) { - impl.read_short_array(value, offset, length); - } - - public final void read_ushort_array(short[] value, int offset, int length) { - impl.read_ushort_array(value, offset, length); - } - - public final void read_long_array(int[] value, int offset, int length) { - impl.read_long_array(value, offset, length); - } - - public final void read_ulong_array(int[] value, int offset, int length) { - impl.read_ulong_array(value, offset, length); - } - - public final void read_longlong_array(long[] value, int offset, int length) { - impl.read_longlong_array(value, offset, length); - } - - public final void read_ulonglong_array(long[] value, int offset, int length) { - impl.read_ulonglong_array(value, offset, length); - } - - public final void read_float_array(float[] value, int offset, int length) { - impl.read_float_array(value, offset, length); - } - - public final void read_double_array(double[] value, int offset, int length) { - impl.read_double_array(value, offset, length); - } - - public final org.omg.CORBA.Object read_Object() { - return impl.read_Object(); - } - - public final TypeCode read_TypeCode() { - return impl.read_TypeCode(); - } - public final Any read_any() { - return impl.read_any(); - } - - public final Principal read_Principal() { - return impl.read_Principal(); - } - - public final int read() throws java.io.IOException { - return impl.read(); - } - - public final java.math.BigDecimal read_fixed() { - return impl.read_fixed(); - } - - public final org.omg.CORBA.Context read_Context() { - return impl.read_Context(); - } - - public final org.omg.CORBA.Object read_Object(java.lang.Class clz) { - return impl.read_Object(clz); - } - - public final org.omg.CORBA.ORB orb() { - return impl.orb(); - } - - // org.omg.CORBA_2_3.portable.InputStream - public final java.io.Serializable read_value() { - return impl.read_value(); - } - - public final java.io.Serializable read_value(java.lang.Class clz) { - return impl.read_value(clz); - } - - public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) { - return impl.read_value(factory); - } - - public final java.io.Serializable read_value(java.lang.String rep_id) { - return impl.read_value(rep_id); - } - - public final java.io.Serializable read_value(java.io.Serializable value) { - return impl.read_value(value); - } - - public final java.lang.Object read_abstract_interface() { - return impl.read_abstract_interface(); - } - - public final java.lang.Object read_abstract_interface(java.lang.Class clz) { - return impl.read_abstract_interface(clz); - } - // com.sun.corba.se.impl.encoding.MarshalInputStream - - public final void consumeEndian() { - impl.consumeEndian(); - } - - public final int getPosition() { - return impl.getPosition(); - } - - // org.omg.CORBA.DataInputStream - - public final java.lang.Object read_Abstract () { - return impl.read_Abstract(); - } - - public final java.io.Serializable read_Value () { - return impl.read_Value(); - } - - public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) { - impl.read_any_array(seq, offset, length); - } - - public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) { - impl.read_boolean_array(seq, offset, length); - } - - public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) { - impl.read_char_array(seq, offset, length); - } - - public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) { - impl.read_wchar_array(seq, offset, length); - } - - public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) { - impl.read_octet_array(seq, offset, length); - } - - public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) { - impl.read_short_array(seq, offset, length); - } - - public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) { - impl.read_ushort_array(seq, offset, length); - } - - public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) { - impl.read_long_array(seq, offset, length); - } - - public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) { - impl.read_ulong_array(seq, offset, length); - } - - public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) { - impl.read_ulonglong_array(seq, offset, length); - } - - public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) { - impl.read_longlong_array(seq, offset, length); - } - - public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) { - impl.read_float_array(seq, offset, length); - } - - public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) { - impl.read_double_array(seq, offset, length); - } - - // org.omg.CORBA.portable.ValueBase - public final String[] _truncatable_ids() { - return impl._truncatable_ids(); - } - - // java.io.InputStream - public final int read(byte b[]) throws IOException { - return impl.read(b); - } - - public final int read(byte b[], int off, int len) throws IOException { - return impl.read(b, off, len); - } - - public final long skip(long n) throws IOException { - return impl.skip(n); - } - - public final int available() throws IOException { - return impl.available(); - } - - public final void close() throws IOException { - impl.close(); - } - - public final void mark(int readlimit) { - impl.mark(readlimit); - } - - public final void reset() { - impl.reset(); - } - - public final boolean markSupported() { - return impl.markSupported(); - } - - public abstract CDRInputStream dup(); - - // Needed by TCUtility - public final java.math.BigDecimal read_fixed(short digits, short scale) { - return impl.read_fixed(digits, scale); - } - - public final boolean isLittleEndian() { - return impl.isLittleEndian(); - } - - protected final ByteBuffer getByteBuffer() { - return impl.getByteBuffer(); - } - - protected final void setByteBuffer(ByteBuffer byteBuffer) { - impl.setByteBuffer(byteBuffer); - } - - protected final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { - impl.setByteBufferWithInfo(bbwi); - } - - /** - * return true if our ByteBuffer is sharing/equal to bb - */ - protected final boolean isSharing(ByteBuffer bb) { - return (getByteBuffer() == bb); - } - - public final int getBufferLength() { - return impl.getBufferLength(); - } - - protected final void setBufferLength(int value) { - impl.setBufferLength(value); - } - - protected final int getIndex() { - return impl.getIndex(); - } - - protected final void setIndex(int value) { - impl.setIndex(value); - } - - public final void orb(org.omg.CORBA.ORB orb) { - impl.orb(orb); - } - - public final GIOPVersion getGIOPVersion() { - return impl.getGIOPVersion(); - } - - public final BufferManagerRead getBufferManager() { - return impl.getBufferManager(); - } - - // This should be overridden by any stream (ex: IIOPInputStream) - // which wants to read values. Thus, TypeCodeInputStream doesn't - // have to do this. - public CodeBase getCodeBase() { - return null; - } - - // Use Latin-1 for GIOP 1.0 or when code set negotiation was not - // performed. - protected CodeSetConversion.BTCConverter createCharBTCConverter() { - return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1, - impl.isLittleEndian()); - } - - // Subclasses must decide what to do here. It's inconvenient to - // make the class and this method abstract because of dup(). - protected abstract CodeSetConversion.BTCConverter createWCharBTCConverter(); - - // Prints the current buffer in a human readable form - void printBuffer() { - impl.printBuffer(); - } - - /** - * Aligns the current position on the given octet boundary - * if there are enough bytes available to do so. Otherwise, - * it just returns. This is used for some (but not all) - * GIOP 1.2 message headers. - */ - public void alignOnBoundary(int octetBoundary) { - impl.alignOnBoundary(octetBoundary); - } - - // Needed by request and reply messages for GIOP versions >= 1.2 only. - public void setHeaderPadding(boolean headerPadding) { - impl.setHeaderPadding(headerPadding); - } - - /** - * This must be called after determining the proper ORB version, - * and setting it on the stream's ORB instance. It can be called - * after reading the service contexts, since that is the only place - * we can get the ORB version info. - * - * Trying to unmarshal things requiring repository IDs before calling - * this will result in NullPtrExceptions. - */ - public void performORBVersionSpecificInit() { - // In the case of SystemExceptions, a stream is created - // with its default constructor (and thus no impl is set). - if (impl != null) - impl.performORBVersionSpecificInit(); - } - - /** - * Resets any internal references to code set converters. - * This is useful for forcing the CDR stream to reacquire - * converters (probably from its subclasses) when state - * has changed. - */ - public void resetCodeSetConverters() { - impl.resetCodeSetConverters(); - } - - public void setMessageMediator(MessageMediator messageMediator) - { - this.messageMediator = (CorbaMessageMediator) messageMediator; - } - - public MessageMediator getMessageMediator() - { - return messageMediator; - } - - // ValueInputStream ----------------------------- - - public void start_value() { - impl.start_value(); - } - - public void end_value() { - impl.end_value(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStreamBase.java 2018-01-30 20:16:51.000000000 -0500 +++ /dev/null 2018-01-30 20:16:51.000000000 -0500 @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.encoding; - -import java.io.IOException; -import java.io.Serializable; -import java.math.BigDecimal; -import java.nio.ByteBuffer; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.org.omg.SendingContext.CodeBase; - -/** - * Describes CDRInputStream delegates and provides some - * implementation. Non-default constructors are avoided in - * the delegation to separate instantiation from initialization, - * so we use init methods. - */ -abstract class CDRInputStreamBase extends java.io.InputStream -{ - protected CDRInputStream parent; - - public void setParent(CDRInputStream parent) { - this.parent = parent; - } - - public abstract void init(org.omg.CORBA.ORB orb, - ByteBuffer byteBuffer, - int size, - boolean littleEndian, - BufferManagerRead bufferManager); - - // org.omg.CORBA.portable.InputStream - public abstract boolean read_boolean(); - public abstract char read_char(); - public abstract char read_wchar(); - public abstract byte read_octet(); - public abstract short read_short(); - public abstract short read_ushort(); - public abstract int read_long(); - public abstract int read_ulong(); - public abstract long read_longlong(); - public abstract long read_ulonglong(); - public abstract float read_float(); - public abstract double read_double(); - public abstract String read_string(); - public abstract String read_wstring(); - public abstract void read_boolean_array(boolean[] value, int offset, int length); - public abstract void read_char_array(char[] value, int offset, int length); - public abstract void read_wchar_array(char[] value, int offset, int length); - public abstract void read_octet_array(byte[] value, int offset, int length); - public abstract void read_short_array(short[] value, int offset, int length); - public abstract void read_ushort_array(short[] value, int offset, int length); - public abstract void read_long_array(int[] value, int offset, int length); - public abstract void read_ulong_array(int[] value, int offset, int length); - public abstract void read_longlong_array(long[] value, int offset, int length); - public abstract void read_ulonglong_array(long[] value, int offset, int length); - public abstract void read_float_array(float[] value, int offset, int length); - public abstract void read_double_array(double[] value, int offset, int length); - public abstract org.omg.CORBA.Object read_Object(); - public abstract TypeCode read_TypeCode(); - public abstract Any read_any(); - public abstract Principal read_Principal(); - public int read() throws java.io.IOException { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - public abstract java.math.BigDecimal read_fixed(); - public org.omg.CORBA.Context read_Context() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - public abstract org.omg.CORBA.Object read_Object(java.lang.Class clz); - public abstract org.omg.CORBA.ORB orb(); - - // org.omg.CORBA_2_3.portable.InputStream - public abstract java.io.Serializable read_value(); - public abstract java.io.Serializable read_value(java.lang.Class clz); - public abstract java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory); - public abstract java.io.Serializable read_value(java.lang.String rep_id); - public abstract java.io.Serializable read_value(java.io.Serializable value); - public abstract java.lang.Object read_abstract_interface(); - public abstract java.lang.Object read_abstract_interface(java.lang.Class clz); - - // com.sun.corba.se.impl.encoding.MarshalInputStream - public abstract void consumeEndian(); - public abstract int getPosition(); - - // org.omg.CORBA.DataInputStream - public abstract java.lang.Object read_Abstract (); - public abstract java.io.Serializable read_Value (); - public abstract void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length); - public abstract void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length); - public abstract void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length); - public abstract void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length); - public abstract void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length); - public abstract void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length); - public abstract void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length); - public abstract void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length); - public abstract void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length); - public abstract void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length); - public abstract void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length); - public abstract void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length); - public abstract void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length); - - // org.omg.CORBA.portable.ValueBase - public abstract String[] _truncatable_ids(); - - // java.io.InputStream - // REVISIT - should we make these throw UnsupportedOperationExceptions? - // Right now, they'll go up to the java.io versions! - -// public abstract int read(byte b[]) throws IOException; -// public abstract int read(byte b[], int off, int len) throws IOException -// public abstract long skip(long n) throws IOException; -// public abstract int available() throws IOException; -// public abstract void close() throws IOException; - public abstract void mark(int readlimit); - public abstract void reset(); - - // This should return false so that outside users (people using the JDK) - // don't have any guarantees that mark/reset will work in their - // custom marshaling code. This is necessary since they could do things - // like expect obj1a == obj1b in the following code: - // - // is.mark(10000); - // Object obj1a = is.readObject(); - // is.reset(); - // Object obj1b = is.readObject(); - // - public boolean markSupported() { return false; } - - // Needed by AnyImpl and ServiceContexts - public abstract CDRInputStreamBase dup(); - - // Needed by TCUtility - public abstract java.math.BigDecimal read_fixed(short digits, short scale); - - // Needed by TypeCodeImpl - public abstract boolean isLittleEndian(); - - // Needed by request and reply messages for GIOP versions >= 1.2 only. - abstract void setHeaderPadding(boolean headerPadding); - - // Needed by IIOPInputStream and other subclasses - - public abstract ByteBuffer getByteBuffer(); - public abstract void setByteBuffer(ByteBuffer byteBuffer); - - public abstract void setByteBufferWithInfo(ByteBufferWithInfo bbwi); - - public abstract int getBufferLength(); - public abstract void setBufferLength(int value); - - public abstract int getIndex(); - public abstract void setIndex(int value); - - public abstract void orb(org.omg.CORBA.ORB orb); - - public abstract BufferManagerRead getBufferManager(); - public abstract GIOPVersion getGIOPVersion(); - - abstract CodeBase getCodeBase(); - - abstract void printBuffer(); - - abstract void alignOnBoundary(int octetBoundary); - - abstract void performORBVersionSpecificInit(); - - public abstract void resetCodeSetConverters(); - - // ValueInputStream ------------------------- - public abstract void start_value(); - public abstract void end_value(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java 2018-01-30 20:16:52.000000000 -0500 +++ /dev/null 2018-01-30 20:16:52.000000000 -0500 @@ -1,2399 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.encoding; - -import java.io.IOException; -import java.io.Serializable; -import java.io.ByteArrayInputStream; -import java.io.ObjectInputStream; -import java.io.IOException; -import java.io.StreamCorruptedException; -import java.io.OptionalDataException; -import java.io.IOException; - -import java.util.Stack; - -import java.net.URL; -import java.net.MalformedURLException; - -import java.nio.ByteBuffer; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -import java.math.BigDecimal; - -import java.rmi.Remote; -import java.rmi.StubNotFoundException; - -import java.security.AccessController; -import java.security.PrivilegedExceptionAction; -import java.security.PrivilegedActionException; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.Object; -import org.omg.CORBA.Principal; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Any; -import org.omg.CORBA.portable.Delegate; -import org.omg.CORBA.portable.ValueBase; -import org.omg.CORBA.portable.IndirectionException; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.TCKind; -import org.omg.CORBA.TypeCodePackage.BadKind; -import org.omg.CORBA.CustomMarshal; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; -import org.omg.CORBA.portable.BoxedValueHelper; -import org.omg.CORBA.portable.ValueFactory; -import org.omg.CORBA.portable.CustomValue; -import org.omg.CORBA.portable.StreamableValue; -import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.portable.IDLEntity; - -import javax.rmi.PortableRemoteObject; -import javax.rmi.CORBA.Tie; -import javax.rmi.CORBA.Util; -import javax.rmi.CORBA.ValueHandler; - -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.ByteBufferPool; - -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry; -import com.sun.corba.se.spi.protocol.CorbaClientDelegate; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.orb.ORBVersion; - -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.presentation.rmi.PresentationManager; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter; -import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.logging.OMGSystemException; - -import com.sun.corba.se.impl.corba.PrincipalImpl; -import com.sun.corba.se.impl.corba.TypeCodeImpl; -import com.sun.corba.se.impl.corba.CORBAObjectImpl; - -import com.sun.corba.se.impl.encoding.CDROutputObject; -import com.sun.corba.se.impl.encoding.CodeSetConversion; - -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.util.RepositoryId; - -import com.sun.corba.se.impl.orbutil.RepositoryIdStrings; -import com.sun.corba.se.impl.orbutil.RepositoryIdInterface; -import com.sun.corba.se.impl.orbutil.RepositoryIdUtility; -import com.sun.corba.se.impl.orbutil.RepositoryIdFactory; - -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.orbutil.CacheTable; - - -import com.sun.org.omg.CORBA.portable.ValueHelper; - -import com.sun.org.omg.SendingContext.CodeBase; - -public class CDRInputStream_1_0 extends CDRInputStreamBase - implements RestorableInputStream -{ - private static final String kReadMethod = "read"; - private static final int maxBlockLength = 0x7fffff00; - - protected BufferManagerRead bufferManagerRead; - protected ByteBufferWithInfo bbwi; - - // Set to the ORB's transportDebugFlag value. This value is - // used if the ORB is null. - private boolean debug = false; - - protected boolean littleEndian; - protected ORB orb; - protected ORBUtilSystemException wrapper ; - protected OMGSystemException omgWrapper ; - protected ValueHandler valueHandler = null; - - // Value cache - private CacheTable valueCache = null; - - // Repository ID cache - private CacheTable repositoryIdCache = null; - - // codebase cache - private CacheTable codebaseCache = null; - - // Current Class Stack (repository Ids of current class being read) - // private Stack currentStack = null; - - // Length of current chunk, or a large positive number if not in a chunk - protected int blockLength = maxBlockLength; - - // Read end flag (value nesting depth) - protected int end_flag = 0; - - // Beginning with the resolution to interop issue 3526 (4328?), - // only enclosing chunked valuetypes are taken into account - // when computing the nesting level. However, we still need - // the old computation around for interoperability with our - // older ORBs. - private int chunkedValueNestingLevel = 0; - - // Flag used to determine whether blocksize was zero - // private int checkForNullBlock = -1; - - // In block flag - // private boolean inBlock = false; - - // Indicates whether we are inside a value - // private boolean outerValueDone = true; - - // Int used by read_value(Serializable) that is set by this class - // before calling ValueFactory.read_value - protected int valueIndirection = 0; - - // Int set by readStringOrIndirection to communicate the actual - // offset of the string length field back to the caller - protected int stringIndirection = 0; - - // Flag indicating whether we are unmarshalling a chunked value - protected boolean isChunked = false; - - // Repository ID handlers - private RepositoryIdUtility repIdUtil; - private RepositoryIdStrings repIdStrs; - - // Code set converters (created when first needed) - private CodeSetConversion.BTCConverter charConverter; - private CodeSetConversion.BTCConverter wcharConverter; - - // RMI-IIOP stream format version 2 case in which we know - // that there is no more optional data available. If the - // Serializable's readObject method tries to read anything, - // we must throw a MARSHAL with the special minor code - // so that the ValueHandler can give the correct exception - // to readObject. The state is cleared when the ValueHandler - // calls end_value after the readObject method exits. - private boolean specialNoOptionalDataState = false; - - // Template method - public CDRInputStreamBase dup() - { - CDRInputStreamBase result = null ; - - try { - result = (CDRInputStreamBase)this.getClass().newInstance(); - } catch (Exception e) { - throw wrapper.couldNotDuplicateCdrInputStream( e ) ; - } - result.init(this.orb, - this.bbwi.byteBuffer, - this.bbwi.buflen, - this.littleEndian, - this.bufferManagerRead); - - ((CDRInputStream_1_0)result).bbwi.position(this.bbwi.position()); - // To ensure we keep bbwi.byteBuffer.limit in sync with bbwi.buflen. - ((CDRInputStream_1_0)result).bbwi.byteBuffer.limit(this.bbwi.buflen); - - return result; - } - - /** - * NOTE: size passed to init means buffer size - */ - public void init(org.omg.CORBA.ORB orb, - ByteBuffer byteBuffer, - int size, - boolean littleEndian, - BufferManagerRead bufferManager) - { - this.orb = (ORB)orb; - this.wrapper = ORBUtilSystemException.get( (ORB)orb, - CORBALogDomains.RPC_ENCODING ) ; - this.omgWrapper = OMGSystemException.get( (ORB)orb, - CORBALogDomains.RPC_ENCODING ) ; - this.littleEndian = littleEndian; - this.bufferManagerRead = bufferManager; - this.bbwi = new ByteBufferWithInfo(orb,byteBuffer,0); - this.bbwi.buflen = size; - this.bbwi.byteBuffer.limit(bbwi.buflen); - this.markAndResetHandler = bufferManagerRead.getMarkAndResetHandler(); - - debug = ((ORB)orb).transportDebugFlag; - } - - // See description in CDRInputStream - void performORBVersionSpecificInit() { - createRepositoryIdHandlers(); - } - - private final void createRepositoryIdHandlers() - { - repIdUtil = RepositoryIdFactory.getRepIdUtility(); - repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(); - } - - public GIOPVersion getGIOPVersion() { - return GIOPVersion.V1_0; - } - - // Called by Request and Reply message. Valid for GIOP versions >= 1.2 only. - // Illegal for GIOP versions < 1.2. - void setHeaderPadding(boolean headerPadding) { - throw wrapper.giopVersionError(); - } - - protected final int computeAlignment(int index, int align) { - if (align > 1) { - int incr = index & (align - 1); - if (incr != 0) - return align - incr; - } - - return 0; - } - - public int getSize() - { - return bbwi.position(); - } - - protected void checkBlockLength(int align, int dataSize) { - // Since chunks can end at arbitrary points (though not within - // primitive CDR types, arrays of primitives, strings, wstrings, - // or indirections), - // we must check here for termination of the current chunk. - if (!isChunked) - return; - - // RMI-IIOP stream format version 2 case in which we know - // that there is no more optional data available. If the - // Serializable's readObject method tries to read anything, - // we must throw a MARSHAL exception with the special minor code - // so that the ValueHandler can give the correct exception - // to readObject. The state is cleared when the ValueHandler - // calls end_value after the readObject method exits. - if (specialNoOptionalDataState) { - throw omgWrapper.rmiiiopOptionalDataIncompatible1() ; - } - - boolean checkForEndTag = false; - - // Are we at the end of the current chunk? If so, - // try to interpret the next long as a chunk length. - // (It has to be either a chunk length, end tag, - // or valuetag.) - // - // If it isn't a chunk length, blockLength will - // remain set to maxBlockLength. - if (blockLength == get_offset()) { - - blockLength = maxBlockLength; - start_block(); - - // What's next is either a valuetag or - // an end tag. If it's a valuetag, we're - // probably being called as part of the process - // to read the valuetag. If it's an end tag, - // then there isn't enough data left in - // this valuetype to read! - if (blockLength == maxBlockLength) - checkForEndTag = true; - - } else - if (blockLength < get_offset()) { - // Are we already past the end of the current chunk? - // This is always an error. - throw wrapper.chunkOverflow() ; - } - - // If what's next on the wire isn't a chunk length or - // what we want to read (which can't be split across chunks) - // won't fit in the current chunk, throw this exception. - // This probably means that we're in an RMI-IIOP - // Serializable's readObject method or a custom marshaled - // IDL type is reading too much/in an incorrect order - int requiredNumBytes = - computeAlignment(bbwi.position(), align) + dataSize; - - if (blockLength != maxBlockLength && - blockLength < get_offset() + requiredNumBytes) { - throw omgWrapper.rmiiiopOptionalDataIncompatible2() ; - } - - // REVISIT - We should look at using the built in advancement - // of using ByteBuffer.get() rather than explicitly - // advancing the ByteBuffer's position. - // This is true for anywhere we are incrementing - // the ByteBuffer's position. - if (checkForEndTag) { - int nextLong = read_long(); - bbwi.position(bbwi.position() - 4); - - // It was an end tag, so there wasn't enough data - // left in the valuetype's encoding on the wire - // to read what we wanted - if (nextLong < 0) - throw omgWrapper.rmiiiopOptionalDataIncompatible3() ; - } - } - - protected void alignAndCheck(int align, int n) { - - checkBlockLength(align, n); - - // WARNING: Must compute real alignment after calling - // checkBlockLength since it may move the position - int alignResult = computeAlignment(bbwi.position(), align); - bbwi.position(bbwi.position() + alignResult); - - if (bbwi.position() + n > bbwi.buflen) - grow(align, n); - } - - // - // This can be overridden.... - // - protected void grow(int align, int n) { - - bbwi.needed = n; - - bbwi = bufferManagerRead.underflow(bbwi); - - } - - // - // Marshal primitives. - // - - public final void consumeEndian() { - littleEndian = read_boolean(); - } - - // No such type in java - public final double read_longdouble() { - throw wrapper.longDoubleNotImplemented( CompletionStatus.COMPLETED_MAYBE); - } - - public final boolean read_boolean() { - return (read_octet() != 0); - } - - public final char read_char() { - alignAndCheck(1, 1); - - return getConvertedChars(1, getCharConverter())[0]; - } - - public char read_wchar() { - - // Don't allow transmission of wchar/wstring data with - // foreign ORBs since it's against the spec. - if (ORBUtility.isForeignORB((ORB)orb)) { - throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE); - } - - // If we're talking to one of our legacy ORBs, do what - // they did: - int b1, b2; - - alignAndCheck(2, 2); - - if (littleEndian) { - b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF; - bbwi.position(bbwi.position() + 1); - b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF; - bbwi.position(bbwi.position() + 1); - } else { - b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF; - bbwi.position(bbwi.position() + 1); - b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF; - bbwi.position(bbwi.position() + 1); - } - - return (char)((b1 << 8) + (b2 << 0)); - } - - public final byte read_octet() { - - alignAndCheck(1, 1); - - byte b = bbwi.byteBuffer.get(bbwi.position()); - bbwi.position(bbwi.position() + 1); - - return b; - } - - public final short read_short() { - int b1, b2; - - alignAndCheck(2, 2); - - if (littleEndian) { - b2 = (bbwi.byteBuffer.get(bbwi.position()) << 0) & 0x000000FF; - bbwi.position(bbwi.position() + 1); - b1 = (bbwi.byteBuffer.get(bbwi.position()) << 8) & 0x0000FF00; - bbwi.position(bbwi.position() + 1); - } else { - b1 = (bbwi.byteBuffer.get(bbwi.position()) << 8) & 0x0000FF00; - bbwi.position(bbwi.position() + 1); - b2 = (bbwi.byteBuffer.get(bbwi.position()) << 0) & 0x000000FF; - bbwi.position(bbwi.position() + 1); - } - - return (short)(b1 | b2); - } - - public final short read_ushort() { - return read_short(); - } - - public final int read_long() { - int b1, b2, b3, b4; - - alignAndCheck(4, 4); - - int bufPos = bbwi.position(); - if (littleEndian) { - b4 = bbwi.byteBuffer.get(bufPos++) & 0xFF; - b3 = bbwi.byteBuffer.get(bufPos++) & 0xFF; - b2 = bbwi.byteBuffer.get(bufPos++) & 0xFF; - b1 = bbwi.byteBuffer.get(bufPos++) & 0xFF; - } else { - b1 = bbwi.byteBuffer.get(bufPos++) & 0xFF; - b2 = bbwi.byteBuffer.get(bufPos++) & 0xFF; - b3 = bbwi.byteBuffer.get(bufPos++) & 0xFF; - b4 = bbwi.byteBuffer.get(bufPos++) & 0xFF; - } - bbwi.position(bufPos); - - return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4; - } - - public final int read_ulong() { - return read_long(); - } - - public final long read_longlong() { - long i1, i2; - - alignAndCheck(8, 8); - - if (littleEndian) { - i2 = read_long() & 0xFFFFFFFFL; - i1 = (long)read_long() << 32; - } else { - i1 = (long)read_long() << 32; - i2 = read_long() & 0xFFFFFFFFL; - } - - return (i1 | i2); - } - - public final long read_ulonglong() { - return read_longlong(); - } - - public final float read_float() { - return Float.intBitsToFloat(read_long()); - } - - public final double read_double() { - return Double.longBitsToDouble(read_longlong()); - } - - protected final void checkForNegativeLength(int length) { - if (length < 0) - throw wrapper.negativeStringLength( CompletionStatus.COMPLETED_MAYBE, - new Integer(length) ) ; - } - - protected final String readStringOrIndirection(boolean allowIndirection) { - - int len = read_long(); - - // - // Check for indirection - // - if (allowIndirection) { - if (len == 0xffffffff) - return null; - else - stringIndirection = get_offset() - 4; - } - - checkForNegativeLength(len); - - return internalReadString(len); - } - - private final String internalReadString(int len) { - // Workaround for ORBs which send string lengths of - // zero to mean empty string. - // - // IMPORTANT: Do not replace 'new String("")' with "", it may result - // in a Serialization bug (See serialization.zerolengthstring) and - // bug id: 4728756 for details - if (len == 0) - return new String(""); - - char[] result = getConvertedChars(len - 1, getCharConverter()); - - // Skip over the 1 byte null - read_octet(); - - return new String(result, 0, getCharConverter().getNumChars()); - } - - public final String read_string() { - return readStringOrIndirection(false); - } - - public String read_wstring() { - // Don't allow transmission of wchar/wstring data with - // foreign ORBs since it's against the spec. - if (ORBUtility.isForeignORB((ORB)orb)) { - throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE); - } - - int len = read_long(); - - // - // Workaround for ORBs which send string lengths of - // zero to mean empty string. - // - // - // IMPORTANT: Do not replace 'new String("")' with "", it may result - // in a Serialization bug (See serialization.zerolengthstring) and - // bug id: 4728756 for details - if (len == 0) - return new String(""); - - checkForNegativeLength(len); - - len--; - char[] c = new char[len]; - - for (int i = 0; i < len; i++) - c[i] = read_wchar(); - - // skip the two null terminator bytes - read_wchar(); - // bbwi.position(bbwi.position() + 2); - - return new String(c); - } - - public final void read_octet_array(byte[] b, int offset, int length) { - if ( b == null ) - throw wrapper.nullParam() ; - - // Must call alignAndCheck at least once to ensure - // we aren't at the end of a chunk. Of course, we - // should only call it if we actually need to read - // something, otherwise we might end up with an - // exception at the end of the stream. - if (length == 0) - return; - - alignAndCheck(1, 1); - - int n = offset; - while (n < length+offset) { - int avail; - int bytes; - int wanted; - - avail = bbwi.buflen - bbwi.position(); - if (avail <= 0) { - grow(1, 1); - avail = bbwi.buflen - bbwi.position(); - } - wanted = (length + offset) - n; - bytes = (wanted < avail) ? wanted : avail; - // Microbenchmarks are showing a loop of ByteBuffer.get(int) being - // faster than ByteBuffer.get(byte[], int, int). - for (int i = 0; i < bytes; i++) { - b[n+i] = bbwi.byteBuffer.get(bbwi.position() + i); - } - - bbwi.position(bbwi.position() + bytes); - - n += bytes; - } - } - - public Principal read_Principal() { - int len = read_long(); - byte[] pvalue = new byte[len]; - read_octet_array(pvalue,0,len); - - Principal p = new PrincipalImpl(); - p.name(pvalue); - return p; - } - - public TypeCode read_TypeCode() { - TypeCodeImpl tc = new TypeCodeImpl(orb); - tc.read_value(parent); - return tc; - } - - public Any read_any() { - Any any = orb.create_any(); - TypeCodeImpl tc = new TypeCodeImpl(orb); - - // read off the typecode - - // REVISIT We could avoid this try-catch if we could peek the typecode - // kind off this stream and see if it is a tk_value. Looking at the - // code we know that for tk_value the Any.read_value() below - // ignores the tc argument anyway (except for the kind field). - // But still we would need to make sure that the whole typecode, - // including encapsulations, is read off. - try { - tc.read_value(parent); - } catch (MARSHAL ex) { - if (tc.kind().value() != TCKind._tk_value) - throw ex; - // We can be sure that the whole typecode encapsulation has been - // read off. - dprintThrowable(ex); - } - // read off the value of the any - any.read_value(parent, tc); - - return any; - } - - public org.omg.CORBA.Object read_Object() { - return read_Object(null); - } - - // ------------ RMI related methods -------------------------- - - // IDL to Java ptc-00-01-08 1.21.4.1 - // - // The clz argument to read_Object can be either a stub - // Class or the "Class object for the RMI/IDL interface type - // that is statically expected." - // This functions as follows: - // 1. If clz==null, just use the repository ID from the stub - // 2. If clz is a stub class, just use it as a static factory. - // clz is a stub class iff StubAdapter.isStubClass( clz ). - // In addition, clz is a IDL stub class iff - // IDLEntity.class.isAssignableFrom( clz ). - // 3. If clz is an interface, use it to create the appropriate - // stub factory. - - public org.omg.CORBA.Object read_Object(Class clz) - { - // In any case, we must first read the IOR. - IOR ior = IORFactories.makeIOR(parent) ; - if (ior.isNil()) { - return null ; - } - - PresentationManager.StubFactoryFactory sff = ORB.getStubFactoryFactory() ; - String codeBase = ior.getProfile().getCodebase() ; - PresentationManager.StubFactory stubFactory = null ; - - if (clz == null) { - RepositoryId rid = RepositoryId.cache.getId( ior.getTypeId() ) ; - String className = rid.getClassName() ; - orb.validateIORClass(className); - boolean isIDLInterface = rid.isIDLType() ; - - if (className == null || className.equals( "" )) - stubFactory = null ; - else - try { - stubFactory = sff.createStubFactory( className, - isIDLInterface, codeBase, (Class)null, - (ClassLoader)null ); - } catch (Exception exc) { - // Could not create stubFactory, so use null. - // XXX stubFactory handling is still too complex: - // Can we resolve the stubFactory question once in - // a single place? - stubFactory = null ; - } - } else if (StubAdapter.isStubClass( clz )) { - stubFactory = PresentationDefaults.makeStaticStubFactory( - clz ) ; - } else { - // clz is an interface class - boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ; - stubFactory = sff.createStubFactory( clz.getName(), - isIDL, codeBase, clz, clz.getClassLoader() ) ; - } - return internalIORToObject( ior, stubFactory, orb ) ; - } - - /* - * This is used as a general utility (e.g., the PortableInterceptor - * implementation uses it. If stubFactory is null, the ior's - * IIOPProfile must support getServant. - */ - public static org.omg.CORBA.Object internalIORToObject( - IOR ior, PresentationManager.StubFactory stubFactory, ORB orb) - { - ORBUtilSystemException wrapper = ORBUtilSystemException.get( - (ORB)orb, CORBALogDomains.RPC_ENCODING ) ; - - java.lang.Object servant = ior.getProfile().getServant() ; - if (servant != null ) { - if (servant instanceof Tie) { - String codebase = ior.getProfile().getCodebase(); - org.omg.CORBA.Object objref = (org.omg.CORBA.Object) - Utility.loadStub( (Tie)servant, stubFactory, codebase, - false); - - // If we managed to load a stub, return it, otherwise we - // must fail... - if (objref != null) { - return objref; - } else { - throw wrapper.readObjectException() ; - } - } else if (servant instanceof org.omg.CORBA.Object) { - if (!(servant instanceof - org.omg.CORBA.portable.InvokeHandler)) { - return (org.omg.CORBA.Object) servant; - } - } else - throw wrapper.badServantReadObject() ; - } - - CorbaClientDelegate del = ORBUtility.makeClientDelegate( ior ) ; - org.omg.CORBA.Object objref = null ; - try { - objref = stubFactory.makeStub() ; - } catch (Throwable e) { - wrapper.stubCreateError( e ) ; - - if (e instanceof ThreadDeath) { - throw (ThreadDeath) e; - } - - // Return the "default" stub... - objref = new CORBAObjectImpl() ; - } - - StubAdapter.setDelegate( objref, del ) ; - return objref; - } - - public java.lang.Object read_abstract_interface() - { - return read_abstract_interface(null); - } - - public java.lang.Object read_abstract_interface(java.lang.Class clz) - { - boolean object = read_boolean(); - - if (object) { - return read_Object(clz); - } else { - return read_value(); - } - } - - public Serializable read_value() - { - return read_value((Class)null); - } - - private Serializable handleIndirection() { - int indirection = read_long() + get_offset() - 4; - if (valueCache != null && valueCache.containsVal(indirection)) { - - java.io.Serializable cachedValue - = (java.io.Serializable)valueCache.getKey(indirection); - return cachedValue; - } else { - // In RMI-IIOP the ValueHandler will recognize this - // exception and use the provided indirection value - // to lookup a possible indirection to an object - // currently on the deserialization stack. - throw new IndirectionException(indirection); - } - } - - private String readRepositoryIds(int valueTag, - Class expectedType, - String expectedTypeRepId) { - return readRepositoryIds(valueTag, expectedType, - expectedTypeRepId, null); - } - - /** - * Examines the valuetag to see how many (if any) repository IDs - * are present on the wire. If no repository ID information - * is on the wire but the expectedType or expectedTypeRepId - * is known, it will return one of those (favoring the - * expectedType's repId). Failing that, it uses the supplied - * BoxedValueHelper to obtain the repository ID, as a last resort. - */ - private String readRepositoryIds(int valueTag, - Class expectedType, - String expectedTypeRepId, - BoxedValueHelper factory) { - switch(repIdUtil.getTypeInfo(valueTag)) { - case RepositoryIdUtility.NO_TYPE_INFO : - // Throw an exception if we have no repository ID info and - // no expectedType to work with. Otherwise, how would we - // know what to unmarshal? - if (expectedType == null) { - if (expectedTypeRepId != null) { - return expectedTypeRepId; - } else if (factory != null) { - return factory.get_id(); - } else { - throw wrapper.expectedTypeNullAndNoRepId( - CompletionStatus.COMPLETED_MAYBE); - } - } - return repIdStrs.createForAnyType(expectedType); - case RepositoryIdUtility.SINGLE_REP_TYPE_INFO : - return read_repositoryId(); - case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO : - return read_repositoryIds(); - default: - throw wrapper.badValueTag( CompletionStatus.COMPLETED_MAYBE, - Integer.toHexString(valueTag) ) ; - } - } - - public Serializable read_value(Class expectedType) { - - // Read value tag - int vType = readValueTag(); - - // Is value null? - if (vType == 0) - return null; - - // Is this an indirection to a previously - // read valuetype? - if (vType == 0xffffffff) - return handleIndirection(); - - // Save where this valuetype started so we - // can put it in the indirection valueCache - // later - int indirection = get_offset() - 4; - - // Need to save this special marker variable - // to restore its value during recursion - boolean saveIsChunked = isChunked; - - isChunked = repIdUtil.isChunkedEncoding(vType); - - java.lang.Object value = null; - - String codebase_URL = null; - if (repIdUtil.isCodeBasePresent(vType)) { - codebase_URL = read_codebase_URL(); - } - - // Read repository id(s) - String repositoryIDString - = readRepositoryIds(vType, expectedType, null); - - // If isChunked was determined to be true based - // on the valuetag, this will read a chunk length - start_block(); - - // Remember that end_flag keeps track of all nested - // valuetypes and is used for older ORBs - end_flag--; - if (isChunked) - chunkedValueNestingLevel--; - - if (repositoryIDString.equals(repIdStrs.getWStringValueRepId())) { - value = read_wstring(); - } else - if (repositoryIDString.equals(repIdStrs.getClassDescValueRepId())) { - // read in the class whether with the old ClassDesc or the - // new one - value = readClass(); - } else { - - Class valueClass = expectedType; - - // By this point, either the expectedType or repositoryIDString - // is guaranteed to be non-null. - if (expectedType == null || - !repositoryIDString.equals(repIdStrs.createForAnyType(expectedType))) { - - valueClass = getClassFromString(repositoryIDString, - codebase_URL, - expectedType); - } - - if (valueClass == null) { - // No point attempting to use value handler below, since the - // class information is not available. - throw wrapper.couldNotFindClass( - CompletionStatus.COMPLETED_MAYBE, - new ClassNotFoundException()); - } - - if (valueClass != null && - org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(valueClass)) { - - value = readIDLValue(indirection, - repositoryIDString, - valueClass, - codebase_URL); - - } else { - - // Must be some form of RMI-IIOP valuetype - - try { - if (valueHandler == null) - valueHandler = ORBUtility.createValueHandler(); - - value = valueHandler.readValue(parent, - indirection, - valueClass, - repositoryIDString, - getCodeBase()); - - } catch(SystemException sysEx) { - // Just rethrow any CORBA system exceptions - // that come out of the ValueHandler - throw sysEx; - } catch(Exception ex) { - throw wrapper.valuehandlerReadException( - CompletionStatus.COMPLETED_MAYBE, ex ) ; - } catch(Error e) { - throw wrapper.valuehandlerReadError( - CompletionStatus.COMPLETED_MAYBE, e ) ; - } - } - } - - // Skip any remaining chunks until we get to - // an end tag or a valuetag. If we see a valuetag, - // that means there was another valuetype in the sender's - // version of this class that we need to skip over. - handleEndOfValue(); - - // Read and process the end tag if we're chunking. - // Assumes that we're at the position of the end tag - // (handleEndOfValue should assure this) - readEndTag(); - - // Cache the valuetype that we read - if (valueCache == null) - valueCache = new CacheTable(orb,false); - valueCache.put(value, indirection); - - // Allow for possible continuation chunk. - // If we're a nested valuetype inside of a chunked - // valuetype, and that enclosing valuetype has - // more data to write, it will need to have this - // new chunk begin after we wrote our end tag. - isChunked = saveIsChunked; - start_block(); - - return (java.io.Serializable)value; - } - - public Serializable read_value(BoxedValueHelper factory) { - - // Read value tag - int vType = readValueTag(); - - if (vType == 0) - return null; // value is null - else if (vType == 0xffffffff) { // Indirection tag - int indirection = read_long() + get_offset() - 4; - if (valueCache != null && valueCache.containsVal(indirection)) - { - java.io.Serializable cachedValue = - (java.io.Serializable)valueCache.getKey(indirection); - return cachedValue; - } - else { - throw new IndirectionException(indirection); - } - } - else { - int indirection = get_offset() - 4; - - // end_block(); - - boolean saveIsChunked = isChunked; - isChunked = repIdUtil.isChunkedEncoding(vType); - - java.lang.Object value = null; - - String codebase_URL = null; - if (repIdUtil.isCodeBasePresent(vType)){ - codebase_URL = read_codebase_URL(); - } - - // Read repository id - String repositoryIDString - = readRepositoryIds(vType, null, null, factory); - - // Compare rep. ids to see if we should use passed helper - if (!repositoryIDString.equals(factory.get_id())) - factory = Utility.getHelper(null, codebase_URL, repositoryIDString); - - start_block(); - end_flag--; - if (isChunked) - chunkedValueNestingLevel--; - - if (factory instanceof ValueHelper) { - value = readIDLValueWithHelper((ValueHelper)factory, indirection); - } else { - valueIndirection = indirection; // for callback - value = factory.read_value(parent); - } - - handleEndOfValue(); - readEndTag(); - - // Put into valueCache - if (valueCache == null) - valueCache = new CacheTable(orb,false); - valueCache.put(value, indirection); - - // allow for possible continuation chunk - isChunked = saveIsChunked; - start_block(); - - return (java.io.Serializable)value; - } - } - - private boolean isCustomType(ValueHelper helper) { - try{ - TypeCode tc = helper.get_type(); - int kind = tc.kind().value(); - if (kind == TCKind._tk_value) { - return (tc.type_modifier() == org.omg.CORBA.VM_CUSTOM.value); - } - } catch(BadKind ex) { - throw wrapper.badKind(ex) ; - } - - return false; - } - - // This method is actually called indirectly by - // read_value(String repositoryId). - // Therefore, it is not a truly independent read call that handles - // header information itself. - public java.io.Serializable read_value(java.io.Serializable value) { - - // Put into valueCache using valueIndirection - if (valueCache == null) - valueCache = new CacheTable(orb,false); - valueCache.put(value, valueIndirection); - - if (value instanceof StreamableValue) - ((StreamableValue)value)._read(parent); - else if (value instanceof CustomValue) - ((CustomValue)value).unmarshal(parent); - - return value; - } - - public java.io.Serializable read_value(java.lang.String repositoryId) { - - // if (inBlock) - // end_block(); - - // Read value tag - int vType = readValueTag(); - - if (vType == 0) - return null; // value is null - else if (vType == 0xffffffff) { // Indirection tag - int indirection = read_long() + get_offset() - 4; - if (valueCache != null && valueCache.containsVal(indirection)) - { - java.io.Serializable cachedValue = - (java.io.Serializable)valueCache.getKey(indirection); - return cachedValue; - } - else { - throw new IndirectionException(indirection); - } - } - else { - int indirection = get_offset() - 4; - - // end_block(); - - boolean saveIsChunked = isChunked; - isChunked = repIdUtil.isChunkedEncoding(vType); - - java.lang.Object value = null; - - String codebase_URL = null; - if (repIdUtil.isCodeBasePresent(vType)){ - codebase_URL = read_codebase_URL(); - } - - // Read repository id - String repositoryIDString - = readRepositoryIds(vType, null, repositoryId); - - ValueFactory factory = - Utility.getFactory(null, codebase_URL, orb, repositoryIDString); - - start_block(); - end_flag--; - if (isChunked) - chunkedValueNestingLevel--; - - valueIndirection = indirection; // for callback - value = factory.read_value(parent); - - handleEndOfValue(); - readEndTag(); - - // Put into valueCache - if (valueCache == null) - valueCache = new CacheTable(orb,false); - valueCache.put(value, indirection); - - // allow for possible continuation chunk - isChunked = saveIsChunked; - start_block(); - - return (java.io.Serializable)value; - } - } - - private Class readClass() { - - String codebases = null, classRepId = null; - - if (orb == null || - ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || - ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { - - codebases = (String)read_value(java.lang.String.class); - classRepId = (String)read_value(java.lang.String.class); - } else { - // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID - // and codebase strings in the wrong order. - classRepId = (String)read_value(java.lang.String.class); - codebases = (String)read_value(java.lang.String.class); - } - - if (debug) { - dprint("readClass codebases: " - + codebases - + " rep Id: " - + classRepId); - } - - Class cl = null; - - RepositoryIdInterface repositoryID - = repIdStrs.getFromString(classRepId); - - try { - cl = repositoryID.getClassFromType(codebases); - } catch(ClassNotFoundException cnfe) { - throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE, - cnfe, repositoryID.getClassName() ) ; - } catch(MalformedURLException me) { - throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE, - me, repositoryID.getClassName(), codebases ) ; - } - - return cl; - } - - private java.lang.Object readIDLValueWithHelper(ValueHelper helper, int indirection) - { - // look for two-argument static read method - Method readMethod; - try { - Class argTypes[] = {org.omg.CORBA.portable.InputStream.class, helper.get_class()}; - readMethod = helper.getClass().getDeclaredMethod(kReadMethod, argTypes); - } - catch(NoSuchMethodException nsme) { // must be boxed value helper - java.lang.Object result = helper.read_value(parent); - return result; - } - - // found two-argument read method, so must be non-boxed value... - // ...create a blank instance - java.lang.Object val = null; - try { - val = helper.get_class().newInstance(); - } catch(java.lang.InstantiationException ie) { - throw wrapper.couldNotInstantiateHelper( ie, - helper.get_class() ) ; - } catch(IllegalAccessException iae){ - // Value's constructor is protected or private - // - // So, use the helper to read the value. - // - // NOTE : This means that in this particular case a recursive ref. - // would fail. - return helper.read_value(parent); - } - - // add blank instance to cache table - if (valueCache == null) - valueCache = new CacheTable(orb,false); - valueCache.put(val, indirection); - - // if custom type, call unmarshal method - if (val instanceof CustomMarshal && isCustomType(helper)) { - ((CustomMarshal)val).unmarshal(parent); - return val; - } - - // call two-argument read method using reflection - try { - java.lang.Object args[] = {parent, val}; - readMethod.invoke(helper, args); - return val; - } catch(IllegalAccessException iae2) { - throw wrapper.couldNotInvokeHelperReadMethod( iae2, helper.get_class() ) ; - } catch(InvocationTargetException ite){ - throw wrapper.couldNotInvokeHelperReadMethod( ite, helper.get_class() ) ; - } - } - - private java.lang.Object readBoxedIDLEntity(Class clazz, String codebase) - { - Class cls = null ; - - try { - ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader()); - - cls = Utility.loadClassForClass(clazz.getName()+"Helper", codebase, - clazzLoader, clazz, clazzLoader); - final Class helperClass = cls ; - - final Class argTypes[] = {org.omg.CORBA.portable.InputStream.class}; - - // getDeclaredMethod requires RuntimePermission accessDeclaredMembers - // if a different class loader is used (even though the javadoc says otherwise) - Method readMethod = null; - try { - readMethod = (Method)AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public java.lang.Object run() throws NoSuchMethodException { - return helperClass.getDeclaredMethod(kReadMethod, argTypes); - } - } - ); - } catch (PrivilegedActionException pae) { - // this gets caught below - throw (NoSuchMethodException)pae.getException(); - } - - java.lang.Object args[] = {parent}; - return readMethod.invoke(null, args); - - } catch (ClassNotFoundException cnfe) { - throw wrapper.couldNotInvokeHelperReadMethod( cnfe, cls ) ; - } catch(NoSuchMethodException nsme) { - throw wrapper.couldNotInvokeHelperReadMethod( nsme, cls ) ; - } catch(IllegalAccessException iae) { - throw wrapper.couldNotInvokeHelperReadMethod( iae, cls ) ; - } catch(InvocationTargetException ite) { - throw wrapper.couldNotInvokeHelperReadMethod( ite, cls ) ; - } - } - - private java.lang.Object readIDLValue(int indirection, String repId, - Class clazz, String codebase) - { - ValueFactory factory ; - - // Always try to find a ValueFactory first, as required by the spec. - // There are some complications here in the IDL 3.0 mapping (see 1.13.8), - // but basically we must always be able to override the DefaultFactory - // or Helper mappings that are also used. This appears to be the case - // even in the boxed value cases. The original code only did the lookup - // in the case of class implementing either StreamableValue or CustomValue, - // but abstract valuetypes only implement ValueBase, and really require - // the use of the repId to find a factory (including the DefaultFactory). - try { - // use new-style OBV support (factory object) - factory = Utility.getFactory(clazz, codebase, orb, repId); - } catch (MARSHAL marshal) { - // XXX log marshal at one of the INFO levels - - // Could not get a factory, so try alternatives - if (!StreamableValue.class.isAssignableFrom(clazz) && - !CustomValue.class.isAssignableFrom(clazz) && - ValueBase.class.isAssignableFrom(clazz)) { - // use old-style OBV support (helper object) - BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId); - if (helper instanceof ValueHelper) - return readIDLValueWithHelper((ValueHelper)helper, indirection); - else - return helper.read_value(parent); - } else { - // must be a boxed IDLEntity, so make a reflective call to the - // helper's static read method... - return readBoxedIDLEntity(clazz, codebase); - } - } - - // If there was no error in getting the factory, use it. - valueIndirection = indirection; // for callback - return factory.read_value(parent); - } - - /** - * End tags are only written for chunked valuetypes. - * - * Before Merlin, our ORBs wrote end tags which took into account - * all enclosing valuetypes. This was changed by an interop resolution - * (see details around chunkedValueNestingLevel) to only include - * enclosing chunked types. - * - * ORB versioning and end tag compaction are handled here. - */ - private void readEndTag() { - if (isChunked) { - - // Read the end tag - int anEndTag = read_long(); - - // End tags should always be negative, and the outermost - // enclosing chunked valuetype should have a -1 end tag. - // - // handleEndOfValue should have assured that we were - // at the end tag position! - if (anEndTag >= 0) { - throw wrapper.positiveEndTag( CompletionStatus.COMPLETED_MAYBE, - new Integer(anEndTag), new Integer( get_offset() - 4 ) ) ; - } - - // If the ORB is null, or if we're sure we're talking to - // a foreign ORB, Merlin, or something more recent, we - // use the updated end tag computation, and are more strenuous - // about the values. - if (orb == null || - ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || - ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { - - // If the end tag we read was less than what we were expecting, - // then the sender must think it's sent more enclosing - // chunked valuetypes than we have. Throw an exception. - if (anEndTag < chunkedValueNestingLevel) - throw wrapper.unexpectedEnclosingValuetype( - CompletionStatus.COMPLETED_MAYBE, new Integer( anEndTag ), - new Integer( chunkedValueNestingLevel ) ) ; - - // If the end tag is bigger than what we expected, but - // still negative, then the sender has done some end tag - // compaction. We back up the stream 4 bytes so that the - // next time readEndTag is called, it will get down here - // again. Even with fragmentation, we'll always be able - // to do this. - if (anEndTag != chunkedValueNestingLevel) { - bbwi.position(bbwi.position() - 4); - } - - } else { - - // When talking to Kestrel or Ladybird, we use our old - // end tag rules and are less strict. If the end tag - // isn't what we expected, we back up, assuming - // compaction. - if (anEndTag != end_flag) { - bbwi.position(bbwi.position() - 4); - } - } - - // This only keeps track of the enclosing chunked - // valuetypes - chunkedValueNestingLevel++; - } - - // This keeps track of all enclosing valuetypes - end_flag++; - } - - protected int get_offset() { - return bbwi.position(); - } - - private void start_block() { - - // if (outerValueDone) - if (!isChunked) - return; - - // if called from alignAndCheck, need to reset blockLength - // to avoid an infinite recursion loop on read_long() call - blockLength = maxBlockLength; - - blockLength = read_long(); - - // Must remember where we began the chunk to calculate how far - // along we are. See notes above about chunkBeginPos. - - if (blockLength > 0 && blockLength < maxBlockLength) { - blockLength += get_offset(); // _REVISIT_ unsafe, should use a Java long - - // inBlock = true; - } else { - - // System.out.println("start_block snooped a " + Integer.toHexString(blockLength)); - - // not a chunk length field - blockLength = maxBlockLength; - - bbwi.position(bbwi.position() - 4); - } - } - - // Makes sure that if we were reading a chunked value, we end up - // at the right place in the stream, no matter how little the - // unmarshalling code read. - // - // After calling this method, if we are chunking, we should be - // in position to read the end tag. - private void handleEndOfValue() { - - // If we're not chunking, we don't have to worry about - // skipping remaining chunks or finding end tags - if (!isChunked) - return; - - // Skip any remaining chunks - while (blockLength != maxBlockLength) { - end_block(); - start_block(); - } - - // Now look for the end tag - - // This is a little wasteful since we're reading - // this long up to 3 times in the worst cases (once - // in start_block, once here, and once in readEndTag - // - // Peek next long - int nextLong = read_long(); - bbwi.position(bbwi.position() - 4); - - // We did find an end tag, so we're done. readEndTag - // should take care of making sure it's the correct - // end tag, etc. Remember that since end tags, - // chunk lengths, and valuetags have non overlapping - // ranges, we can tell by the value what the longs are. - if (nextLong < 0) - return; - - if (nextLong == 0 || nextLong >= maxBlockLength) { - - // A custom marshaled valuetype left extra data - // on the wire, and that data had another - // nested value inside of it. We've just - // read the value tag or null of that nested value. - // - // In an attempt to get by it, we'll try to call - // read_value() to get the nested value off of - // the wire. Afterwards, we must call handleEndOfValue - // recursively to read any further chunks that the containing - // valuetype might still have after the nested - // value. - read_value(); - handleEndOfValue(); - } else { - // This probably means that the code to skip chunks has - // an error, and ended up setting blockLength to something - // other than maxBlockLength even though we weren't - // starting a new chunk. - throw wrapper.couldNotSkipBytes( CompletionStatus.COMPLETED_MAYBE, - new Integer( nextLong ), new Integer( get_offset() ) ) ; - } - } - - private void end_block() { - - // if in a chunk, check for underflow or overflow - if (blockLength != maxBlockLength) { - if (blockLength == get_offset()) { - // Chunk ended correctly - blockLength = maxBlockLength; - } else { - // Skip over anything left by bad unmarshaling code (ex: - // a buggy custom unmarshaler). See handleEndOfValue. - if (blockLength > get_offset()) { - skipToOffset(blockLength); - } else { - throw wrapper.badChunkLength( new Integer( blockLength ), - new Integer( get_offset() ) ) ; - } - } - } - } - - private int readValueTag(){ - // outerValueDone = false; - return read_long(); - } - - public org.omg.CORBA.ORB orb() { - return orb; - } - - // ------------ End RMI related methods -------------------------- - - public final void read_boolean_array(boolean[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_boolean(); - } - } - - public final void read_char_array(char[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_char(); - } - } - - public final void read_wchar_array(char[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_wchar(); - } - } - - public final void read_short_array(short[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_short(); - } - } - - public final void read_ushort_array(short[] value, int offset, int length) { - read_short_array(value, offset, length); - } - - public final void read_long_array(int[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_long(); - } - } - - public final void read_ulong_array(int[] value, int offset, int length) { - read_long_array(value, offset, length); - } - - public final void read_longlong_array(long[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_longlong(); - } - } - - public final void read_ulonglong_array(long[] value, int offset, int length) { - read_longlong_array(value, offset, length); - } - - public final void read_float_array(float[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_float(); - } - } - - public final void read_double_array(double[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_double(); - } - } - - public final void read_any_array(org.omg.CORBA.Any[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_any(); - } - } - - //--------------------------------------------------------------------// - // CDRInputStream state management. - // - - /** - * Are we at the end of the input stream? - */ -// public final boolean isAtEnd() { -// return bbwi.position() == bbwi.buflen; -// } - -// public int available() throws IOException { -// return bbwi.buflen - bbwi.position(); -// } - - private String read_repositoryIds() { - - // Read # of repository ids - int numRepIds = read_long(); - if (numRepIds == 0xffffffff) { - int indirection = read_long() + get_offset() - 4; - if (repositoryIdCache != null && repositoryIdCache.containsOrderedVal(indirection)) - return (String)repositoryIdCache.getKey(indirection); - else - throw wrapper.unableToLocateRepIdArray( new Integer( indirection ) ) ; - } else { - - // read first array element and store it as an indirection to the whole array - int indirection = get_offset(); - String repID = read_repositoryId(); - if (repositoryIdCache == null) - repositoryIdCache = new CacheTable(orb,false); - repositoryIdCache.put(repID, indirection); - - // read and ignore the subsequent array elements, but put them in the - // indirection table in case there are later indirections back to them - for (int i = 1; i < numRepIds; i++) { - read_repositoryId(); - } - - return repID; - } - } - - private final String read_repositoryId() - { - String result = readStringOrIndirection(true); - - if (result == null) { // Indirection - int indirection = read_long() + get_offset() - 4; - - if (repositoryIdCache != null && repositoryIdCache.containsOrderedVal(indirection)) - return (String)repositoryIdCache.getKey(indirection); - else - throw wrapper.badRepIdIndirection( CompletionStatus.COMPLETED_MAYBE, - new Integer(bbwi.position()) ) ; - } else { - if (repositoryIdCache == null) - repositoryIdCache = new CacheTable(orb,false); - repositoryIdCache.put(result, stringIndirection); - } - - return result ; - } - - private final String read_codebase_URL() - { - String result = readStringOrIndirection(true); - - if (result == null) { // Indirection - int indirection = read_long() + get_offset() - 4; - - if (codebaseCache != null && codebaseCache.containsVal(indirection)) - return (String)codebaseCache.getKey(indirection); - else - throw wrapper.badCodebaseIndirection( - CompletionStatus.COMPLETED_MAYBE, - new Integer(bbwi.position()) ) ; - } else { - if (codebaseCache == null) - codebaseCache = new CacheTable(orb,false); - codebaseCache.put(result, stringIndirection); - } - - return result; - } - - /* DataInputStream methods */ - - public java.lang.Object read_Abstract () { - return read_abstract_interface(); - } - - public java.io.Serializable read_Value () { - return read_value(); - } - - public void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) { - read_any_array(seq.value, offset, length); - } - - public void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) { - read_boolean_array(seq.value, offset, length); - } - - public void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) { - read_char_array(seq.value, offset, length); - } - - public void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) { - read_wchar_array(seq.value, offset, length); - } - - public void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) { - read_octet_array(seq.value, offset, length); - } - - public void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) { - read_short_array(seq.value, offset, length); - } - - public void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) { - read_ushort_array(seq.value, offset, length); - } - - public void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) { - read_long_array(seq.value, offset, length); - } - - public void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) { - read_ulong_array(seq.value, offset, length); - } - - public void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) { - read_ulonglong_array(seq.value, offset, length); - } - - public void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) { - read_longlong_array(seq.value, offset, length); - } - - public void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) { - read_float_array(seq.value, offset, length); - } - - public void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) { - read_double_array(seq.value, offset, length); - } - - public java.math.BigDecimal read_fixed(short digits, short scale) { - // digits isn't really needed here - StringBuffer buffer = read_fixed_buffer(); - if (digits != buffer.length()) - throw wrapper.badFixed( new Integer(digits), - new Integer(buffer.length()) ) ; - buffer.insert(digits - scale, '.'); - return new BigDecimal(buffer.toString()); - } - - // This method is unable to yield the correct scale. - public java.math.BigDecimal read_fixed() { - return new BigDecimal(read_fixed_buffer().toString()); - } - - // Each octet contains (up to) two decimal digits. - // If the fixed type has an odd number of decimal digits, then the representation - // begins with the first (most significant) digit. - // Otherwise, this first half-octet is all zero, and the first digit - // is in the second half-octet. - // The sign configuration, in the last half-octet of the representation, - // is 0xD for negative numbers and 0xC for positive and zero values. - private StringBuffer read_fixed_buffer() { - StringBuffer buffer = new StringBuffer(64); - byte doubleDigit; - int firstDigit; - int secondDigit; - boolean wroteFirstDigit = false; - boolean more = true; - while (more) { - doubleDigit = this.read_octet(); - firstDigit = (int)((doubleDigit & 0xf0) >> 4); - secondDigit = (int)(doubleDigit & 0x0f); - if (wroteFirstDigit || firstDigit != 0) { - buffer.append(Character.forDigit(firstDigit, 10)); - wroteFirstDigit = true; - } - if (secondDigit == 12) { - // positive number or zero - if ( ! wroteFirstDigit) { - // zero - return new StringBuffer("0.0"); - } else { - // positive number - // done - } - more = false; - } else if (secondDigit == 13) { - // negative number - buffer.insert(0, '-'); - more = false; - } else { - buffer.append(Character.forDigit(secondDigit, 10)); - wroteFirstDigit = true; - } - } - return buffer; - } - - private final static String _id = "IDL:omg.org/CORBA/DataInputStream:1.0"; - private final static String[] _ids = { _id }; - - public String[] _truncatable_ids() { - if (_ids == null) - return null; - - return (String[])_ids.clone(); - } - - /* for debugging */ - - public void printBuffer() { - CDRInputStream_1_0.printBuffer(this.bbwi); - } - - public static void printBuffer(ByteBufferWithInfo bbwi) { - - System.out.println("----- Input Buffer -----"); - System.out.println(); - System.out.println("Current position: " + bbwi.position()); - System.out.println("Total length : " + bbwi.buflen); - System.out.println(); - - try { - - char[] charBuf = new char[16]; - - for (int i = 0; i < bbwi.buflen; i += 16) { - - int j = 0; - - // For every 16 bytes, there is one line - // of output. First, the hex output of - // the 16 bytes with each byte separated - // by a space. - while (j < 16 && j + i < bbwi.buflen) { - int k = bbwi.byteBuffer.get(i + j); - if (k < 0) - k = 256 + k; - String hex = Integer.toHexString(k); - if (hex.length() == 1) - hex = "0" + hex; - System.out.print(hex + " "); - j++; - } - - // Add any extra spaces to align the - // text column in case we didn't end - // at 16 - while (j < 16) { - System.out.print(" "); - j++; - } - - // Now output the ASCII equivalents. Non-ASCII - // characters are shown as periods. - int x = 0; - while (x < 16 && x + i < bbwi.buflen) { - if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x))) - charBuf[x] = (char)bbwi.byteBuffer.get(i + x); - else - charBuf[x] = '.'; - x++; - } - System.out.println(new String(charBuf, 0, x)); - } - - } catch (Throwable t) { - t.printStackTrace(); - } - - System.out.println("------------------------"); - } - - public ByteBuffer getByteBuffer() { - ByteBuffer result = null; - if (bbwi != null) { - result = bbwi.byteBuffer; - } - return result; - } - - public int getBufferLength() { - return bbwi.buflen; - } - - public void setBufferLength(int value) { - bbwi.buflen = value; - bbwi.byteBuffer.limit(bbwi.buflen); - } - - public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { - this.bbwi = bbwi; - } - - public void setByteBuffer(ByteBuffer byteBuffer) { - bbwi.byteBuffer = byteBuffer; - } - - public int getIndex() { - return bbwi.position(); - } - - public void setIndex(int value) { - bbwi.position(value); - } - - public boolean isLittleEndian() { - return littleEndian; - } - - public void orb(org.omg.CORBA.ORB orb) { - this.orb = (ORB)orb; - } - - public BufferManagerRead getBufferManager() { - return bufferManagerRead; - } - - private void skipToOffset(int offset) { - - // Number of bytes to skip - int len = offset - get_offset(); - - int n = 0; - - while (n < len) { - int avail; - int bytes; - int wanted; - - avail = bbwi.buflen - bbwi.position(); - if (avail <= 0) { - grow(1, 1); - avail = bbwi.buflen - bbwi.position(); - } - - wanted = len - n; - bytes = (wanted < avail) ? wanted : avail; - bbwi.position(bbwi.position() + bytes); - n += bytes; - } - } - - - // Mark and reset ------------------------------------------------- - - protected MarkAndResetHandler markAndResetHandler = null; - - protected class StreamMemento - { - // These are the fields that may change after marking - // the stream position, so we need to save them. - private int blockLength_; - private int end_flag_; - private int chunkedValueNestingLevel_; - private int valueIndirection_; - private int stringIndirection_; - private boolean isChunked_; - private javax.rmi.CORBA.ValueHandler valueHandler_; - private ByteBufferWithInfo bbwi_; - private boolean specialNoOptionalDataState_; - - public StreamMemento() - { - blockLength_ = blockLength; - end_flag_ = end_flag; - chunkedValueNestingLevel_ = chunkedValueNestingLevel; - valueIndirection_ = valueIndirection; - stringIndirection_ = stringIndirection; - isChunked_ = isChunked; - valueHandler_ = valueHandler; - specialNoOptionalDataState_ = specialNoOptionalDataState; - bbwi_ = new ByteBufferWithInfo(bbwi); - } - } - - public java.lang.Object createStreamMemento() { - return new StreamMemento(); - } - - public void restoreInternalState(java.lang.Object streamMemento) { - - StreamMemento mem = (StreamMemento)streamMemento; - - blockLength = mem.blockLength_; - end_flag = mem.end_flag_; - chunkedValueNestingLevel = mem.chunkedValueNestingLevel_; - valueIndirection = mem.valueIndirection_; - stringIndirection = mem.stringIndirection_; - isChunked = mem.isChunked_; - valueHandler = mem.valueHandler_; - specialNoOptionalDataState = mem.specialNoOptionalDataState_; - bbwi = mem.bbwi_; - } - - public int getPosition() { - return get_offset(); - } - - public void mark(int readlimit) { - markAndResetHandler.mark(this); - } - - public void reset() { - markAndResetHandler.reset(); - } - - // ---------------------------------- end Mark and Reset - - // Provides a hook so subclasses of CDRInputStream can provide - // a CodeBase. This ultimately allows us to grab a Connection - // instance in IIOPInputStream, the only subclass where this - // is actually used. - CodeBase getCodeBase() { - return parent.getCodeBase(); - } - - /** - * Attempts to find the class described by the given - * repository ID string and expected type. The first - * attempt is to find the class locally, falling back - * on the URL that came with the value. The second - * attempt is to use a URL from the remote CodeBase. - */ - private Class getClassFromString(String repositoryIDString, - String codebaseURL, - Class expectedType) - { - RepositoryIdInterface repositoryID - = repIdStrs.getFromString(repositoryIDString); - - try { - try { - // First try to load the class locally, then use - // the provided URL (if it isn't null) - return repositoryID.getClassFromType(expectedType, - codebaseURL); - } catch (ClassNotFoundException cnfeOuter) { - - try { - - if (getCodeBase() == null) { - return null; // class cannot be loaded remotely. - } - - // Get a URL from the remote CodeBase and retry - codebaseURL = getCodeBase().implementation(repositoryIDString); - - // Don't bother trying to find it locally again if - // we got a null URL - if (codebaseURL == null) - return null; - - return repositoryID.getClassFromType(expectedType, - codebaseURL); - } catch (ClassNotFoundException cnfeInner) { - dprintThrowable(cnfeInner); - // Failed to load the class - return null; - } - } - } catch (MalformedURLException mue) { - // Always report a bad URL - throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE, - mue, repositoryIDString, codebaseURL ) ; - } - } - - /** - * Attempts to find the class described by the given - * repository ID string. At most, three attempts are made: - * Try to find it locally, through the provided URL, and - * finally, via a URL from the remote CodeBase. - */ - private Class getClassFromString(String repositoryIDString, - String codebaseURL) - { - RepositoryIdInterface repositoryID - = repIdStrs.getFromString(repositoryIDString); - - for (int i = 0; i < 3; i++) { - - try { - - switch (i) - { - case 0: - // First try to load the class locally - return repositoryID.getClassFromType(); - case 1: - // Try to load the class using the provided - // codebase URL (falls out below) - break; - case 2: - // Try to load the class using a URL from the - // remote CodeBase - codebaseURL = getCodeBase().implementation(repositoryIDString); - break; - } - - // Don't bother if the codebaseURL is null - if (codebaseURL == null) - continue; - - return repositoryID.getClassFromType(codebaseURL); - - } catch(ClassNotFoundException cnfe) { - // Will ultimately return null if all three - // attempts fail, but don't do anything here. - } catch (MalformedURLException mue) { - throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE, - mue, repositoryIDString, codebaseURL ) ; - } - } - - // If we get here, we have failed to load the class - dprint("getClassFromString failed with rep id " - + repositoryIDString - + " and codebase " - + codebaseURL); - - return null; - } - - // Utility method used to get chars from bytes - char[] getConvertedChars(int numBytes, - CodeSetConversion.BTCConverter converter) { - - // REVISIT - Look at CodeSetConversion.BTCConverter to see - // if it can work with an NIO ByteBuffer. We should - // avoid getting the bytes into an array if possible. - - // To be honest, I doubt this saves much real time - if (bbwi.buflen - bbwi.position() >= numBytes) { - // If the entire string is in this buffer, - // just convert directly from the bbwi rather than - // allocating and copying. - byte[] tmpBuf; - if (bbwi.byteBuffer.hasArray()) - { - tmpBuf = bbwi.byteBuffer.array(); - } - else - { - tmpBuf = new byte[bbwi.buflen]; - // Microbenchmarks are showing a loop of ByteBuffer.get(int) - // being faster than ByteBuffer.get(byte[], int, int). - for (int i = 0; i < bbwi.buflen; i++) - tmpBuf[i] = bbwi.byteBuffer.get(i); - } - char[] result = converter.getChars(tmpBuf,bbwi.position(),numBytes); - - bbwi.position(bbwi.position() + numBytes); - return result; - } else { - // Stretches across buffers. Unless we provide an - // incremental conversion interface, allocate and - // copy the bytes. - byte[] bytes = new byte[numBytes]; - read_octet_array(bytes, 0, bytes.length); - - return converter.getChars(bytes, 0, numBytes); - } - } - - protected CodeSetConversion.BTCConverter getCharConverter() { - if (charConverter == null) - charConverter = parent.createCharBTCConverter(); - - return charConverter; - } - - protected CodeSetConversion.BTCConverter getWCharConverter() { - if (wcharConverter == null) - wcharConverter = parent.createWCharBTCConverter(); - - return wcharConverter; - } - - protected void dprintThrowable(Throwable t) { - if (debug && t != null) - t.printStackTrace(); - } - - protected void dprint(String msg) { - if (debug) { - ORBUtility.dprint(this, msg); - } - } - - /** - * Aligns the current position on the given octet boundary - * if there are enough bytes available to do so. Otherwise, - * it just returns. This is used for some (but not all) - * GIOP 1.2 message headers. - */ - - void alignOnBoundary(int octetBoundary) { - int needed = computeAlignment(bbwi.position(), octetBoundary); - - if (bbwi.position() + needed <= bbwi.buflen) - { - bbwi.position(bbwi.position() + needed); - } - } - - public void resetCodeSetConverters() { - charConverter = null; - wcharConverter = null; - } - - public void start_value() { - // Read value tag - int vType = readValueTag(); - - if (vType == 0) { - // Stream needs to go into a state where it - // throws standard exception until end_value - // is called. This means the sender didn't - // send any custom data. If the reader here - // tries to read more, we need to throw an - // exception before reading beyond where - // we're supposed to - specialNoOptionalDataState = true; - - return; - } - - if (vType == 0xffffffff) { - // One should never indirect to a custom wrapper - throw wrapper.customWrapperIndirection( - CompletionStatus.COMPLETED_MAYBE); - } - - if (repIdUtil.isCodeBasePresent(vType)) { - throw wrapper.customWrapperWithCodebase( - CompletionStatus.COMPLETED_MAYBE); - } - - if (repIdUtil.getTypeInfo(vType) - != RepositoryIdUtility.SINGLE_REP_TYPE_INFO) { - throw wrapper.customWrapperNotSingleRepid( - CompletionStatus.COMPLETED_MAYBE); - } - - - // REVISIT - Could verify repository ID even though - // it isn't used elsewhere - read_repositoryId(); - - // Note: isChunked should be true here. Should have - // been set to true in the containing value's read_value - // method. - - start_block(); - end_flag--; - chunkedValueNestingLevel--; - } - - public void end_value() { - - if (specialNoOptionalDataState) { - specialNoOptionalDataState = false; - return; - } - - handleEndOfValue(); - readEndTag(); - - // Note that isChunked should still be true here. - // If the containing valuetype is the highest - // chunked value, it will get set to false - // at the end of read_value. - - // allow for possible continuation chunk - start_block(); - } - - public void close() throws IOException - { - - // tell BufferManagerRead to release any ByteBuffers - getBufferManager().close(bbwi); - - // It's possible bbwi.byteBuffer is shared between - // this InputStream and an OutputStream. Thus, we check - // if the Input/Output streams are using the same ByteBuffer. - // If they sharing the same ByteBuffer we need to ensure only - // one of those ByteBuffers are released to the ByteBufferPool. - - if (bbwi != null && getByteBuffer() != null) - { - MessageMediator messageMediator = parent.getMessageMediator(); - if (messageMediator != null) - { - CDROutputObject outputObj = - (CDROutputObject)messageMediator.getOutputObject(); - if (outputObj != null) - { - if (outputObj.isSharing(getByteBuffer())) - { - // Set OutputStream's ByteBuffer and bbwi to null - // so its ByteBuffer cannot be released to the pool - outputObj.setByteBuffer(null); - outputObj.setByteBufferWithInfo(null); - } - } - } - - // release this stream's ByteBuffer to the pool - ByteBufferPool byteBufferPool = orb.getByteBufferPool(); - if (debug) - { - // print address of ByteBuffer being released - int bbAddress = System.identityHashCode(bbwi.byteBuffer); - StringBuffer sb = new StringBuffer(80); - sb.append(".close - releasing ByteBuffer id ("); - sb.append(bbAddress).append(") to ByteBufferPool."); - String msg = sb.toString(); - dprint(msg); - } - byteBufferPool.releaseByteBuffer(bbwi.byteBuffer); - bbwi.byteBuffer = null; - bbwi = null; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java 2018-01-30 20:16:53.000000000 -0500 +++ /dev/null 2018-01-30 20:16:53.000000000 -0500 @@ -1,189 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.encoding; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -public class CDRInputStream_1_1 extends CDRInputStream_1_0 -{ - // See notes in CDROutputStream - protected int fragmentOffset = 0; - - public GIOPVersion getGIOPVersion() { - return GIOPVersion.V1_1; - } - - // Template method - public CDRInputStreamBase dup() { - CDRInputStreamBase result = super.dup(); - - ((CDRInputStream_1_1)result).fragmentOffset = this.fragmentOffset; - - return result; - } - - protected int get_offset() { - return bbwi.position() + fragmentOffset; - } - - protected void alignAndCheck(int align, int n) { - - - checkBlockLength(align, n); - - // WARNING: Must compute real alignment after calling - // checkBlockLength since it may move the position - int alignment = computeAlignment(bbwi.position(), align); - - if (bbwi.position() + n + alignment > bbwi.buflen) { - - // Some other ORBs may have found a way to send 1.1 - // fragments which put alignment bytes at the end - // of a fragment - if (bbwi.position() + alignment == bbwi.buflen) - { - bbwi.position(bbwi.position() + alignment); - } - - grow(align, n); - - // We must recalculate the alignment after a possible - // fragmentation since the new bbwi.position() (after the header) - // may require a different alignment. - - alignment = computeAlignment(bbwi.position(), align); - } - - bbwi.position(bbwi.position() + alignment); - } - - // - // This can be overridden.... - // - protected void grow(int align, int n) { - - bbwi.needed = n; - - // Save the size of the current buffer for - // possible fragmentOffset calculation - int oldSize = bbwi.position(); - - bbwi = bufferManagerRead.underflow(bbwi); - - if (bbwi.fragmented) { - - // By this point we should be guaranteed to have - // a new fragment whose header has already been - // unmarshalled. bbwi.position() should point to the - // end of the header. - fragmentOffset += (oldSize - bbwi.position()); - - markAndResetHandler.fragmentationOccured(bbwi); - - // Clear the flag - bbwi.fragmented = false; - } - } - - // Mark/reset --------------------------------------- - - private class FragmentableStreamMemento extends StreamMemento - { - private int fragmentOffset_; - - public FragmentableStreamMemento() - { - super(); - - fragmentOffset_ = fragmentOffset; - } - } - - public java.lang.Object createStreamMemento() { - return new FragmentableStreamMemento(); - } - - public void restoreInternalState(java.lang.Object streamMemento) - { - super.restoreInternalState(streamMemento); - - fragmentOffset - = ((FragmentableStreamMemento)streamMemento).fragmentOffset_; - } - - // -------------------------------------------------- - - public char read_wchar() { - // In GIOP 1.1, interoperability with wchar is limited - // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6. - // WARNING: For UTF-16, this means that there can be no - // byte order marker, so it must default to big endian! - alignAndCheck(2, 2); - - // Because of the alignAndCheck, we should be guaranteed - // 2 bytes of real data. - char[] result = getConvertedChars(2, getWCharConverter()); - - // Did the provided bytes convert to more than one - // character? This may come up as more unicode values are - // assigned, and a single 16 bit Java char isn't enough. - // Better to use strings for i18n purposes. - if (getWCharConverter().getNumChars() > 1) - throw wrapper.btcResultMoreThanOneChar() ; - - return result[0]; - } - - public String read_wstring() { - // In GIOP 1.1, interoperability with wchar is limited - // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6. - int len = read_long(); - - // Workaround for ORBs which send string lengths of - // zero to mean empty string. - // - // IMPORTANT: Do not replace 'new String("")' with "", it may result - // in a Serialization bug (See serialization.zerolengthstring) and - // bug id: 4728756 for details - if (len == 0) - return new String(""); - - checkForNegativeLength(len); - - // Don't include the two byte null for the - // following computations. Remember that since we're limited - // to a 2 byte fixed width code set, the "length" was the - // number of such 2 byte code points plus a 2 byte null. - len = len - 1; - - char[] result = getConvertedChars(len * 2, getWCharConverter()); - - // Skip over the 2 byte null - read_short(); - - return new String(result, 0, getWCharConverter().getNumChars()); - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java 2018-01-30 20:16:53.000000000 -0500 +++ /dev/null 2018-01-30 20:16:53.000000000 -0500 @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.encoding; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -public class CDRInputStream_1_2 extends CDRInputStream_1_1 -{ - // Indicates whether the header is padded. In GIOP 1.2 and above, - // the body must be aligned on an 8-octet boundary, and so the header is - // padded appropriately. However, if there is no body to a request or reply - // message, there is no header padding, in the unfragmented case. - protected boolean headerPadding; - - // used to remember headerPadding flag when mark() and restore() are used. - protected boolean restoreHeaderPadding; - - // Called by RequestMessage_1_2 or ReplyMessage_1_2 classes only. - void setHeaderPadding(boolean headerPadding) { - this.headerPadding = headerPadding; - } - - // the mark and reset methods have been overridden to remember the - // headerPadding flag. - - public void mark(int readlimit) { - super.mark(readlimit); - restoreHeaderPadding = headerPadding; - } - - public void reset() { - super.reset(); - headerPadding = restoreHeaderPadding; - restoreHeaderPadding = false; - } - - // Template method - // This method has been overriden to ensure that the duplicated stream - // inherits the headerPadding flag, in case of GIOP 1.2 and above, streams. - public CDRInputStreamBase dup() { - CDRInputStreamBase result = super.dup(); - ((CDRInputStream_1_2)result).headerPadding = this.headerPadding; - return result; - } - - protected void alignAndCheck(int align, int n) { - - // headerPadding bit is set by read method of the RequestMessage_1_2 - // or ReplyMessage_1_2 classes. When set, the very first body read - // operation (from the stub code) would trigger an alignAndCheck - // method call, that would in turn skip the header padding that was - // inserted during the earlier write operation by the sender. The - // padding ensures that the body is aligned on an 8-octet boundary, - // for GIOP versions 1.2 and beyond. - if (headerPadding == true) { - headerPadding = false; - alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT); - } - - checkBlockLength(align, n); - - // WARNING: Must compute real alignment after calling - // checkBlockLength since it may move the position - - // In GIOP 1.2, a fragment may end with some alignment - // padding (which leads to all fragments ending perfectly - // on evenly divisible 8 byte boundaries). A new fragment - // never requires alignment with the header since it ends - // on an 8 byte boundary. - - int alignIncr = computeAlignment(bbwi.position(),align); - bbwi.position(bbwi.position() + alignIncr); - - if (bbwi.position() + n > bbwi.buflen) { - grow(1, n); - } - } - - public GIOPVersion getGIOPVersion() { - return GIOPVersion.V1_2; - } - - public char read_wchar() { - // In GIOP 1.2, a wchar is encoded as an unsigned octet length - // followed by the octets of the converted wchar. - int numBytes = read_octet(); - - char[] result = getConvertedChars(numBytes, getWCharConverter()); - - // Did the provided bytes convert to more than one - // character? This may come up as more unicode values are - // assigned, and a single 16 bit Java char isn't enough. - // Better to use strings for i18n purposes. - if (getWCharConverter().getNumChars() > 1) - throw wrapper.btcResultMoreThanOneChar() ; - - return result[0]; - } - - public String read_wstring() { - // In GIOP 1.2, wstrings are not terminated by a null. The - // length is the number of octets in the converted format. - // A zero length string is represented with the 4 byte length - // value of 0. - - int len = read_long(); - - // - // IMPORTANT: Do not replace 'new String("")' with "", it may result - // in a Serialization bug (See serialization.zerolengthstring) and - // bug id: 4728756 for details - if (len == 0) - return new String(""); - - checkForNegativeLength(len); - - return new String(getConvertedChars(len, getWCharConverter()), - 0, - getWCharConverter().getNumChars()); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputObject.java 2018-01-30 20:16:54.000000000 -0500 +++ /dev/null 2018-01-30 20:16:54.000000000 -0500 @@ -1,323 +0,0 @@ -/* - * Copyright (c) 2001, 2004, 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.corba.se.impl.encoding; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import org.omg.CORBA.Any; -import org.omg.CORBA.Principal; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.InputStream; - -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.encoding.CorbaOutputObject ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.pept.transport.ByteBufferPool; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.impl.encoding.BufferManagerFactory; -import com.sun.corba.se.impl.encoding.ByteBufferWithInfo; -import com.sun.corba.se.impl.encoding.CDROutputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream_1_0; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.logging.OMGSystemException; - -/** - * @author Harold Carr - */ -public class CDROutputObject extends CorbaOutputObject -{ - private Message header; - private ORB orb; - private ORBUtilSystemException wrapper; - private OMGSystemException omgWrapper; - - // REVISIT - only used on sendCancelRequest. - private CorbaConnection connection; - - private CDROutputObject( - ORB orb, GIOPVersion giopVersion, Message header, - BufferManagerWrite manager, byte streamFormatVersion, - CorbaMessageMediator mediator) - { - super(orb, giopVersion, header.getEncodingVersion(), - false, manager, streamFormatVersion, - ((mediator != null && mediator.getConnection() != null) ? - ((CorbaConnection)mediator.getConnection()). - shouldUseDirectByteBuffers() : false)); - - this.header = header; - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ; - this.omgWrapper = OMGSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ; - - getBufferManager().setOutputObject(this); - this.corbaMessageMediator = mediator; - } - - public CDROutputObject(ORB orb, - MessageMediator messageMediator, - Message header, - byte streamFormatVersion) - { - this( - orb, - ((CorbaMessageMediator)messageMediator).getGIOPVersion(), - header, - BufferManagerFactory.newBufferManagerWrite( - ((CorbaMessageMediator)messageMediator).getGIOPVersion(), - header.getEncodingVersion(), - orb), - streamFormatVersion, - (CorbaMessageMediator)messageMediator); - } - - // NOTE: - // Used in SharedCDR (i.e., must be grow). - // Used in msgtypes test. - public CDROutputObject(ORB orb, - MessageMediator messageMediator, - Message header, - byte streamFormatVersion, - int strategy) - { - this( - orb, - ((CorbaMessageMediator)messageMediator).getGIOPVersion(), - header, - BufferManagerFactory. - newBufferManagerWrite(strategy, - header.getEncodingVersion(), - orb), - streamFormatVersion, - (CorbaMessageMediator)messageMediator); - } - - // REVISIT - // Used on sendCancelRequest. - // Used for needs addressing mode. - public CDROutputObject(ORB orb, CorbaMessageMediator mediator, - GIOPVersion giopVersion, - CorbaConnection connection, Message header, - byte streamFormatVersion) - { - this( - orb, - giopVersion, - header, - BufferManagerFactory. - newBufferManagerWrite(giopVersion, - header.getEncodingVersion(), - orb), - streamFormatVersion, - mediator); - this.connection = connection ; - } - - // XREVISIT - // Header should only be in message mediator. - // Another possibility: merge header and message mediator. - // REVISIT - make protected once all encoding together - public Message getMessageHeader() { - return header; - } - - public final void finishSendingMessage() { - getBufferManager().sendMessage(); - } - - /** - * Write the contents of the CDROutputStream to the specified - * output stream. Has the side-effect of pushing any current - * Message onto the Message list. - * @param connection The output stream to write to. - */ - public void writeTo(CorbaConnection connection) - throws java.io.IOException - { - - // - // Update the GIOP MessageHeader size field. - // - - ByteBufferWithInfo bbwi = getByteBufferWithInfo(); - - getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize()); - - if (orb() != null) { - if (((ORB)orb()).transportDebugFlag) { - dprint(".writeTo: " + connection); - } - if (((ORB)orb()).giopDebugFlag) { - CDROutputStream_1_0.printBuffer(bbwi); - } - } - bbwi.byteBuffer.position(0).limit(bbwi.getSize()); - connection.write(bbwi.byteBuffer); - } - - /** overrides create_input_stream from CDROutputStream */ - public org.omg.CORBA.portable.InputStream create_input_stream() - { - // XREVISIT - return null; - //return new XIIOPInputStream(orb(), getByteBuffer(), getIndex(), - //isLittleEndian(), getMessageHeader(), conn); - } - - public CorbaConnection getConnection() - { - // REVISIT - only set when doing sendCancelRequest. - if (connection != null) { - return connection; - } - return (CorbaConnection) corbaMessageMediator.getConnection(); - } - - // XREVISIT - If CDROutputObject doesn't live in the iiop - // package, it will need this, here, to give package access - // to xgiop. - // REVISIT - make protected once all encoding together - public final ByteBufferWithInfo getByteBufferWithInfo() { - return super.getByteBufferWithInfo(); - } - - // REVISIT - make protected once all encoding together - public final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { - super.setByteBufferWithInfo(bbwi); - } - - /** - * Override the default CDR factory behavior to get the - * negotiated code sets from the connection. - * - * These are only called once per message, the first time needed. - * - * In the local case, there is no Connection, so use the - * local code sets. - */ - protected CodeSetConversion.CTBConverter createCharCTBConverter() { - CodeSetComponentInfo.CodeSetContext codesets = getCodeSets(); - - // If the connection doesn't have its negotiated - // code sets by now, fall back on the defaults defined - // in CDRInputStream. - if (codesets == null) - return super.createCharCTBConverter(); - - OSFCodeSetRegistry.Entry charSet - = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet()); - - if (charSet == null) - throw wrapper.unknownCodeset( charSet ) ; - - return CodeSetConversion.impl().getCTBConverter(charSet, - isLittleEndian(), - false); - } - - protected CodeSetConversion.CTBConverter createWCharCTBConverter() { - - CodeSetComponentInfo.CodeSetContext codesets = getCodeSets(); - - // If the connection doesn't have its negotiated - // code sets by now, we have to throw an exception. - // See CORBA formal 00-11-03 13.9.2.6. - if (codesets == null) { - if (getConnection().isServer()) - throw omgWrapper.noClientWcharCodesetCtx() ; - else - throw omgWrapper.noServerWcharCodesetCmp() ; - } - - OSFCodeSetRegistry.Entry wcharSet - = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet()); - - if (wcharSet == null) - throw wrapper.unknownCodeset( wcharSet ) ; - - boolean useByteOrderMarkers - = ((ORB)orb()).getORBData().useByteOrderMarkers(); - - // With UTF-16: - // - // For GIOP 1.2, we can put byte order markers if we want to, and - // use the default of big endian otherwise. (See issue 3405b) - // - // For GIOP 1.1, we don't use BOMs and use the endianness of - // the stream. - if (wcharSet == OSFCodeSetRegistry.UTF_16) { - if (getGIOPVersion().equals(GIOPVersion.V1_2)) { - return CodeSetConversion.impl().getCTBConverter(wcharSet, - false, - useByteOrderMarkers); - } - - if (getGIOPVersion().equals(GIOPVersion.V1_1)) { - return CodeSetConversion.impl().getCTBConverter(wcharSet, - isLittleEndian(), - false); - } - } - - // In the normal case, let the converter system handle it - return CodeSetConversion.impl().getCTBConverter(wcharSet, - isLittleEndian(), - useByteOrderMarkers); - } - - // If we're local and don't have a Connection, use the - // local code sets, otherwise get them from the connection. - // If the connection doesn't have negotiated code sets - // yet, then we use ISO8859-1 for char/string and wchar/wstring - // are illegal. - private CodeSetComponentInfo.CodeSetContext getCodeSets() { - if (getConnection() == null) - return CodeSetComponentInfo.LOCAL_CODE_SETS; - else - return getConnection().getCodeSetContext(); - } - - protected void dprint(String msg) - { - ORBUtility.dprint("CDROutputObject", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream.java 2018-01-30 20:16:55.000000000 -0500 +++ /dev/null 2018-01-30 20:16:55.000000000 -0500 @@ -1,438 +0,0 @@ -/* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.corba.se.impl.encoding; - -import java.io.IOException; -import java.io.Serializable; -import java.math.BigDecimal; -import java.nio.ByteBuffer; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; - -/** - * This is delegates to the real implementation. - */ -public abstract class CDROutputStream - extends org.omg.CORBA_2_3.portable.OutputStream - implements com.sun.corba.se.impl.encoding.MarshalOutputStream, - org.omg.CORBA.DataOutputStream, org.omg.CORBA.portable.ValueOutputStream -{ - private CDROutputStreamBase impl; - protected ORB orb ; - protected ORBUtilSystemException wrapper ; - protected CorbaMessageMediator corbaMessageMediator; - - - // We can move this out somewhere later. For now, it serves its purpose - // to create a concrete CDR delegate based on the GIOP version. - private static class OutputStreamFactory { - - public static CDROutputStreamBase newOutputStream( - ORB orb, GIOPVersion version, byte encodingVersion) { - switch(version.intValue()) { - case GIOPVersion.VERSION_1_0: - return new CDROutputStream_1_0(); - case GIOPVersion.VERSION_1_1: - return new CDROutputStream_1_1(); - case GIOPVersion.VERSION_1_2: - if (encodingVersion != Message.CDR_ENC_VERSION) { - return - new IDLJavaSerializationOutputStream(encodingVersion); - } - return new CDROutputStream_1_2(); - default: - ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_ENCODING ) ; - // REVISIT - what is appropriate? INTERNAL exceptions - // are really hard to track later. - throw wrapper.unsupportedGiopVersion( version ) ; - } - } - } - - // REVISIT - These two constructors should be re-factored to better hide - // the fact that someone extending this class 'can' construct a CDROutputStream - // that does not use pooled ByteBuffers. Right now, only EncapsOutputStream - // does _not_ use pooled ByteBuffers, see EncapsOutputStream. - - // NOTE: When a stream is constructed for non-channel-backed sockets - // it notifies the constructor not to use pooled (i.e, direct) - // ByteBuffers. - - public CDROutputStream(ORB orb, - GIOPVersion version, - byte encodingVersion, - boolean littleEndian, - BufferManagerWrite bufferManager, - byte streamFormatVersion, - boolean usePooledByteBuffers) - { - impl = OutputStreamFactory.newOutputStream(orb, version, - encodingVersion); - impl.init(orb, littleEndian, bufferManager, - streamFormatVersion, usePooledByteBuffers); - - impl.setParent(this); - this.orb = orb ; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_ENCODING ) ; - } - - public CDROutputStream(ORB orb, - GIOPVersion version, - byte encodingVersion, - boolean littleEndian, - BufferManagerWrite bufferManager, - byte streamFormatVersion) - { - this(orb, version, encodingVersion, littleEndian, - bufferManager, streamFormatVersion, true); - } - - // org.omg.CORBA.portable.OutputStream - - // Provided by IIOPOutputStream and EncapsOutputStream - public abstract org.omg.CORBA.portable.InputStream create_input_stream(); - - public final void write_boolean(boolean value) { - impl.write_boolean(value); - } - public final void write_char(char value) { - impl.write_char(value); - } - public final void write_wchar(char value) { - impl.write_wchar(value); - } - public final void write_octet(byte value) { - impl.write_octet(value); - } - public final void write_short(short value) { - impl.write_short(value); - } - public final void write_ushort(short value) { - impl.write_ushort(value); - } - public final void write_long(int value) { - impl.write_long(value); - } - public final void write_ulong(int value) { - impl.write_ulong(value); - } - public final void write_longlong(long value) { - impl.write_longlong(value); - } - public final void write_ulonglong(long value) { - impl.write_ulonglong(value); - } - public final void write_float(float value) { - impl.write_float(value); - } - public final void write_double(double value) { - impl.write_double(value); - } - public final void write_string(String value) { - impl.write_string(value); - } - public final void write_wstring(String value) { - impl.write_wstring(value); - } - - public final void write_boolean_array(boolean[] value, int offset, int length) { - impl.write_boolean_array(value, offset, length); - } - public final void write_char_array(char[] value, int offset, int length) { - impl.write_char_array(value, offset, length); - } - public final void write_wchar_array(char[] value, int offset, int length) { - impl.write_wchar_array(value, offset, length); - } - public final void write_octet_array(byte[] value, int offset, int length) { - impl.write_octet_array(value, offset, length); - } - public final void write_short_array(short[] value, int offset, int length) { - impl.write_short_array(value, offset, length); - } - public final void write_ushort_array(short[] value, int offset, int length){ - impl.write_ushort_array(value, offset, length); - } - public final void write_long_array(int[] value, int offset, int length) { - impl.write_long_array(value, offset, length); - } - public final void write_ulong_array(int[] value, int offset, int length) { - impl.write_ulong_array(value, offset, length); - } - public final void write_longlong_array(long[] value, int offset, int length) { - impl.write_longlong_array(value, offset, length); - } - public final void write_ulonglong_array(long[] value, int offset,int length) { - impl.write_ulonglong_array(value, offset, length); - } - public final void write_float_array(float[] value, int offset, int length) { - impl.write_float_array(value, offset, length); - } - public final void write_double_array(double[] value, int offset, int length) { - impl.write_double_array(value, offset, length); - } - public final void write_Object(org.omg.CORBA.Object value) { - impl.write_Object(value); - } - public final void write_TypeCode(TypeCode value) { - impl.write_TypeCode(value); - } - public final void write_any(Any value) { - impl.write_any(value); - } - - public final void write_Principal(Principal value) { - impl.write_Principal(value); - } - - public final void write(int b) throws java.io.IOException { - impl.write(b); - } - - public final void write_fixed(java.math.BigDecimal value) { - impl.write_fixed(value); - } - - public final void write_Context(org.omg.CORBA.Context ctx, - org.omg.CORBA.ContextList contexts) { - impl.write_Context(ctx, contexts); - } - - public final org.omg.CORBA.ORB orb() { - return impl.orb(); - } - - // org.omg.CORBA_2_3.portable.OutputStream - public final void write_value(java.io.Serializable value) { - impl.write_value(value); - } - - public final void write_value(java.io.Serializable value, java.lang.Class clz) { - impl.write_value(value, clz); - } - - public final void write_value(java.io.Serializable value, String repository_id) { - impl.write_value(value, repository_id); - } - - public final void write_value(java.io.Serializable value, - org.omg.CORBA.portable.BoxedValueHelper factory) { - impl.write_value(value, factory); - } - - public final void write_abstract_interface(java.lang.Object obj) { - impl.write_abstract_interface(obj); - } - - // java.io.OutputStream - public final void write(byte b[]) throws IOException { - impl.write(b); - } - - public final void write(byte b[], int off, int len) throws IOException { - impl.write(b, off, len); - } - - public final void flush() throws IOException { - impl.flush(); - } - - public final void close() throws IOException { - impl.close(); - } - - // com.sun.corba.se.impl.encoding.MarshalOutputStream - public final void start_block() { - impl.start_block(); - } - - public final void end_block() { - impl.end_block(); - } - - public final void putEndian() { - impl.putEndian(); - } - - public void writeTo(java.io.OutputStream s) - throws IOException - { - impl.writeTo(s); - } - - public final byte[] toByteArray() { - return impl.toByteArray(); - } - - // org.omg.CORBA.DataOutputStream - public final void write_Abstract (java.lang.Object value) { - impl.write_Abstract(value); - } - - public final void write_Value (java.io.Serializable value) { - impl.write_Value(value); - } - - public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) { - impl.write_any_array(seq, offset, length); - } - - public void setMessageMediator(MessageMediator messageMediator) - { - this.corbaMessageMediator = (CorbaMessageMediator) messageMediator; - } - - public MessageMediator getMessageMediator() - { - return corbaMessageMediator; - } - - // org.omg.CORBA.portable.ValueBase - public final String[] _truncatable_ids() { - return impl._truncatable_ids(); - } - - // Other - protected final int getSize() { - return impl.getSize(); - } - - protected final int getIndex() { - return impl.getIndex(); - } - - protected int getRealIndex(int index) { - // Used in indirections. Overridden by TypeCodeOutputStream. - return index; - } - - protected final void setIndex(int value) { - impl.setIndex(value); - } - - protected final ByteBuffer getByteBuffer() { - return impl.getByteBuffer(); - } - - protected final void setByteBuffer(ByteBuffer byteBuffer) { - impl.setByteBuffer(byteBuffer); - } - - /** - * return true if our ByteBuffer is sharing/equal to bb - */ - protected final boolean isSharing(ByteBuffer bb) { - return (getByteBuffer() == bb); - } - - public final boolean isLittleEndian() { - return impl.isLittleEndian(); - } - - // XREVISIT - return to final if possible - // REVISIT - was protected - need access from msgtypes test. - public ByteBufferWithInfo getByteBufferWithInfo() { - return impl.getByteBufferWithInfo(); - } - - protected void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { - impl.setByteBufferWithInfo(bbwi); - } - - // REVISIT: was protected - but need to access from xgiop. - public final BufferManagerWrite getBufferManager() { - return impl.getBufferManager(); - } - - public final void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) { - impl.write_fixed(bigDecimal, digits, scale); - } - - public final void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) { - impl.writeOctetSequenceTo(s); - } - - public final GIOPVersion getGIOPVersion() { - return impl.getGIOPVersion(); - } - - public final void writeIndirection(int tag, int posIndirectedTo) { - impl.writeIndirection(tag, posIndirectedTo); - } - - // Use Latin-1 for GIOP 1.0 or when code set negotiation was not - // performed. - protected CodeSetConversion.CTBConverter createCharCTBConverter() { - return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1); - } - - // Subclasses must decide what to do here. It's inconvenient to - // make the class and this method abstract because of dup(). - protected abstract CodeSetConversion.CTBConverter createWCharCTBConverter(); - - protected final void freeInternalCaches() { - impl.freeInternalCaches(); - } - - void printBuffer() { - impl.printBuffer(); - } - - public void alignOnBoundary(int octetBoundary) { - impl.alignOnBoundary(octetBoundary); - } - - // Needed by request and reply messages for GIOP versions >= 1.2 only. - public void setHeaderPadding(boolean headerPadding) { - impl.setHeaderPadding(headerPadding); - } - - // ValueOutputStream ----------------------------- - - public void start_value(String rep_id) { - impl.start_value(rep_id); - } - - public void end_value() { - impl.end_value(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStreamBase.java 2018-01-30 20:16:55.000000000 -0500 +++ /dev/null 2018-01-30 20:16:55.000000000 -0500 @@ -1,176 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.encoding; - -import java.io.IOException; -import java.io.Serializable; -import java.math.BigDecimal; -import java.nio.ByteBuffer; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; - -/** - * Describes CDROutputStream delegates and provides some - * implementation. Non-default constructors are avoided in - * the delegation to separate instantiation from initialization, - * so we use init methods. - */ -abstract class CDROutputStreamBase extends java.io.OutputStream -{ - protected CDROutputStream parent; - - // Required by parent CDROutputStream - public void setParent(CDROutputStream parent) { - this.parent = parent; - } - - public void init(org.omg.CORBA.ORB orb, - BufferManagerWrite bufferManager, - byte streamFormatVersion) { - init(orb, false, bufferManager, streamFormatVersion, true); - } - - // See EncapsOutputStream, the only one that uses the - // non-pooled ByteBuffers, for additional info. - protected abstract void init(org.omg.CORBA.ORB orb, - boolean littleEndian, - BufferManagerWrite bufferManager, - byte streamFormatVersion, - boolean usePooledByteBuffers); - - public abstract void write_boolean(boolean value); - public abstract void write_char(char value); - public abstract void write_wchar(char value); - public abstract void write_octet(byte value); - public abstract void write_short(short value); - public abstract void write_ushort(short value); - public abstract void write_long(int value); - public abstract void write_ulong(int value); - public abstract void write_longlong(long value); - public abstract void write_ulonglong(long value); - public abstract void write_float(float value); - public abstract void write_double(double value); - public abstract void write_string(String value); - public abstract void write_wstring(String value); - public abstract void write_boolean_array(boolean[] value, int offset, int length); - public abstract void write_char_array(char[] value, int offset, int length); - public abstract void write_wchar_array(char[] value, int offset, int length); - public abstract void write_octet_array(byte[] value, int offset, int length); - public abstract void write_short_array(short[] value, int offset, int length); - public abstract void write_ushort_array(short[] value, int offset, int length); - public abstract void write_long_array(int[] value, int offset, int length); - public abstract void write_ulong_array(int[] value, int offset, int length); - public abstract void write_longlong_array(long[] value, int offset, int length); - public abstract void write_ulonglong_array(long[] value, int offset, int length); - public abstract void write_float_array(float[] value, int offset, int length); - public abstract void write_double_array(double[] value, int offset, int length); - public abstract void write_Object(org.omg.CORBA.Object value); - public abstract void write_TypeCode(TypeCode value); - public abstract void write_any(Any value); - public abstract void write_Principal(Principal value); - public void write(int b) throws java.io.IOException { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - public abstract void write_fixed(java.math.BigDecimal value); - public void write_Context(org.omg.CORBA.Context ctx, - org.omg.CORBA.ContextList contexts) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - public abstract org.omg.CORBA.ORB orb(); - - // org.omg.CORBA_2_3.portable.OutputStream - public abstract void write_value(java.io.Serializable value); - public abstract void write_value(java.io.Serializable value, java.lang.Class clz); - public abstract void write_value(java.io.Serializable value, String repository_id); - public abstract void write_value(java.io.Serializable value, - org.omg.CORBA.portable.BoxedValueHelper factory); - public abstract void write_abstract_interface(java.lang.Object obj); - - // java.io.OutputStream -// public abstract void write(byte b[]) throws IOException; -// public abstract void write(byte b[], int off, int len) throws IOException; -// public abstract void flush() throws IOException; -// public abstract void close() throws IOException; - - // com.sun.corba.se.impl.encoding.MarshalOutputStream - public abstract void start_block(); - public abstract void end_block(); - public abstract void putEndian(); - public abstract void writeTo(java.io.OutputStream s) - throws IOException; - public abstract byte[] toByteArray(); - - // org.omg.CORBA.DataOutputStream - public abstract void write_Abstract (java.lang.Object value); - public abstract void write_Value (java.io.Serializable value); - public abstract void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length); - - // org.omg.CORBA.portable.ValueBase - public abstract String[] _truncatable_ids(); - - // Needed by request and reply messages for GIOP versions >= 1.2 only. - abstract void setHeaderPadding(boolean headerPadding); - - // Required by IIOPOutputStream and other subclasses - public abstract int getSize(); - - public abstract int getIndex(); - public abstract void setIndex(int value); - - public abstract ByteBuffer getByteBuffer(); - public abstract void setByteBuffer(ByteBuffer byteBuffer); - - public abstract boolean isLittleEndian(); - - public abstract ByteBufferWithInfo getByteBufferWithInfo(); - public abstract void setByteBufferWithInfo(ByteBufferWithInfo bbwi); - - public abstract BufferManagerWrite getBufferManager(); - - public abstract void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale); - public abstract void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s); - - public abstract GIOPVersion getGIOPVersion(); - - public abstract void writeIndirection(int tag, int posIndirectedTo); - - abstract void freeInternalCaches(); - - abstract void printBuffer(); - - abstract void alignOnBoundary(int octetBoundary); - - // org.omg.CORBA.portable.ValueOutputStream - - public abstract void start_value(String rep_id); - - public abstract void end_value(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java 2018-01-30 20:16:56.000000000 -0500 +++ /dev/null 2018-01-30 20:16:56.000000000 -0500 @@ -1,1929 +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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.encoding; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.Serializable; -import java.io.ByteArrayOutputStream; -import java.io.ObjectOutputStream; -import java.io.IOException; -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; -import java.math.BigDecimal; -import java.nio.ByteBuffer; -import java.rmi.Remote; -import java.security.AccessController; -import java.security.PrivilegedExceptionAction; -import java.security.PrivilegedActionException; -import java.util.Hashtable; -import java.util.Stack; - -import javax.rmi.CORBA.Util; -import javax.rmi.CORBA.ValueHandler; -import javax.rmi.CORBA.ValueHandlerMultiFormat; - -import org.omg.CORBA.CustomMarshal; -import org.omg.CORBA.DataOutputStream; -import org.omg.CORBA.TypeCodePackage.BadKind; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.Object; -import org.omg.CORBA.Principal; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Any; -import org.omg.CORBA.VM_CUSTOM; -import org.omg.CORBA.VM_TRUNCATABLE; -import org.omg.CORBA.VM_NONE; -import org.omg.CORBA.portable.IDLEntity; -import org.omg.CORBA.portable.CustomValue; -import org.omg.CORBA.portable.StreamableValue; -import org.omg.CORBA.portable.BoxedValueHelper; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.portable.ValueBase; - -import com.sun.org.omg.CORBA.portable.ValueHelper; - -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.ByteBufferPool; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.orb.ORBVersion; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.encoding.ByteBufferWithInfo; -import com.sun.corba.se.impl.encoding.MarshalOutputStream; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.corba.TypeCodeImpl; -import com.sun.corba.se.impl.orbutil.CacheTable; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.orbutil.RepositoryIdStrings; -import com.sun.corba.se.impl.orbutil.RepositoryIdUtility; -import com.sun.corba.se.impl.orbutil.RepositoryIdFactory; -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -public class CDROutputStream_1_0 extends CDROutputStreamBase -{ - private static final int INDIRECTION_TAG = 0xffffffff; - - protected boolean littleEndian; - protected BufferManagerWrite bufferManagerWrite; - ByteBufferWithInfo bbwi; - - protected ORB orb; - protected ORBUtilSystemException wrapper ; - - protected boolean debug = false; - - protected int blockSizeIndex = -1; - protected int blockSizePosition = 0; - - protected byte streamFormatVersion; - - private static final int DEFAULT_BUFFER_SIZE = 1024; - private static final String kWriteMethod = "write"; - - // Codebase cache - private CacheTable codebaseCache = null; - - // Value cache - private CacheTable valueCache = null; - - // Repository ID cache - private CacheTable repositoryIdCache = null; - - // Write end flag - private int end_flag = 0; - - // Beginning with the resolution to interop issue 3526, - // only enclosing chunked valuetypes are taken into account - // when computing the nesting level. However, we still need - // the old computation around for interoperability with our - // older ORBs. - private int chunkedValueNestingLevel = 0; - - private boolean mustChunk = false; - - // In block marker - protected boolean inBlock = false; - - // Last end tag position - private int end_flag_position = 0; - private int end_flag_index = 0; - - // ValueHandler - private ValueHandler valueHandler = null; - - // Repository ID handlers - private RepositoryIdUtility repIdUtil; - private RepositoryIdStrings repIdStrs; - - // Code set converters (created when first needed) - private CodeSetConversion.CTBConverter charConverter; - private CodeSetConversion.CTBConverter wcharConverter; - - // REVISIT - This should be re-factored so that including whether - // to use pool byte buffers or not doesn't need to be known. - public void init(org.omg.CORBA.ORB orb, - boolean littleEndian, - BufferManagerWrite bufferManager, - byte streamFormatVersion, - boolean usePooledByteBuffers) - { - // ORB must not be null. See CDROutputStream constructor. - this.orb = (ORB)orb; - this.wrapper = ORBUtilSystemException.get( this.orb, - CORBALogDomains.RPC_ENCODING ) ; - debug = this.orb.transportDebugFlag; - - this.littleEndian = littleEndian; - this.bufferManagerWrite = bufferManager; - this.bbwi = new ByteBufferWithInfo(orb, bufferManager, usePooledByteBuffers); - this.streamFormatVersion = streamFormatVersion; - - createRepositoryIdHandlers(); - } - - public void init(org.omg.CORBA.ORB orb, - boolean littleEndian, - BufferManagerWrite bufferManager, - byte streamFormatVersion) - { - init(orb, littleEndian, bufferManager, streamFormatVersion, true); - } - - private final void createRepositoryIdHandlers() - { - repIdUtil = RepositoryIdFactory.getRepIdUtility(); - repIdStrs = RepositoryIdFactory.getRepIdStringsFactory(); - } - - public BufferManagerWrite getBufferManager() - { - return bufferManagerWrite; - } - - public byte[] toByteArray() { - byte[] it; - - it = new byte[bbwi.position()]; - - // Micro-benchmarks show ByteBuffer.get(int) out perform the bulk - // ByteBuffer.get(byte[], offset, length). - for (int i = 0; i < bbwi.position(); i++) - it[i] = bbwi.byteBuffer.get(i); - - return it; - } - - public GIOPVersion getGIOPVersion() { - return GIOPVersion.V1_0; - } - - // Called by Request and Reply message. Valid for GIOP versions >= 1.2 only. - // Illegal for GIOP versions < 1.2. - void setHeaderPadding(boolean headerPadding) { - throw wrapper.giopVersionError(); - } - - protected void handleSpecialChunkBegin(int requiredSize) - { - // No-op for GIOP 1.0 - } - - protected void handleSpecialChunkEnd() - { - // No-op for GIOP 1.0 - } - - protected final int computeAlignment(int align) { - if (align > 1) { - int incr = bbwi.position() & (align - 1); - if (incr != 0) - return align - incr; - } - - return 0; - } - - protected void alignAndReserve(int align, int n) { - - bbwi.position(bbwi.position() + computeAlignment(align)); - - if (bbwi.position() + n > bbwi.buflen) - grow(align, n); - } - - // - // Default implementation of grow. Subclassers may override this. - // Always grow the single buffer. This needs to delegate - // fragmentation policy for IIOP 1.1. - // - protected void grow(int align, int n) - { - bbwi.needed = n; - - bufferManagerWrite.overflow(bbwi); - } - - public final void putEndian() throws SystemException { - write_boolean(littleEndian); - } - - public final boolean littleEndian() { - return littleEndian; - } - - void freeInternalCaches() { - if (codebaseCache != null) - codebaseCache.done(); - - if (valueCache != null) - valueCache.done(); - - if (repositoryIdCache != null) - repositoryIdCache.done(); - } - - // No such type in java - public final void write_longdouble(double x) - { - throw wrapper.longDoubleNotImplemented( - CompletionStatus.COMPLETED_MAYBE ) ; - } - - public void write_octet(byte x) - { - // The 'if' stmt is commented out since we need the alignAndReserve to - // be called, particularly when the first body byte is written, - // to induce header padding to align the body on a 8-octet boundary, - // for GIOP versions 1.2 and above. Refer to internalWriteOctetArray() - // method that also has a similar change. - //if (bbwi.position() + 1 > bbwi.buflen) - alignAndReserve(1, 1); - -// REVISIT - Should just use ByteBuffer.put(byte) and let it -// increment the ByteBuffer position. This is true -// for all write operations in this file. - - bbwi.byteBuffer.put(bbwi.position(), x); - bbwi.position(bbwi.position() + 1); - - } - - public final void write_boolean(boolean x) - { - write_octet(x? (byte)1:(byte)0); - } - - public void write_char(char x) - { - CodeSetConversion.CTBConverter converter = getCharConverter(); - - converter.convert(x); - - // CORBA formal 99-10-07 15.3.1.6: "In the case of multi-byte encodings - // of characters, a single instance of the char type may only - // hold one octet of any multi-byte character encoding." - if (converter.getNumBytes() > 1) - throw wrapper.invalidSingleCharCtb(CompletionStatus.COMPLETED_MAYBE); - - write_octet(converter.getBytes()[0]); - } - - // These wchar methods are only used when talking to - // legacy ORBs, now. - private final void writeLittleEndianWchar(char x) { - bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF)); - bbwi.position(bbwi.position() + 2); - } - - private final void writeBigEndianWchar(char x) { - bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 8) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 1, (byte)(x & 0xFF)); - bbwi.position(bbwi.position() + 2); - } - - private final void writeLittleEndianShort(short x) { - bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF)); - bbwi.position(bbwi.position() + 2); - } - - private final void writeBigEndianShort(short x) { - bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 8) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 1, (byte)(x & 0xFF)); - bbwi.position(bbwi.position() + 2); - } - - private final void writeLittleEndianLong(int x) { - bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 16) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 24) & 0xFF)); - bbwi.position(bbwi.position() + 4); - } - - private final void writeBigEndianLong(int x) { - bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 24) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 16) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 8) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 3, (byte)(x & 0xFF)); - bbwi.position(bbwi.position() + 4); - } - - private final void writeLittleEndianLongLong(long x) { - bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 16) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 24) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 4, (byte)((x >>> 32) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 5, (byte)((x >>> 40) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 6, (byte)((x >>> 48) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 7, (byte)((x >>> 56) & 0xFF)); - bbwi.position(bbwi.position() + 8); - } - - private final void writeBigEndianLongLong(long x) { - bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 56) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 48) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 40) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 32) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 4, (byte)((x >>> 24) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 5, (byte)((x >>> 16) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 6, (byte)((x >>> 8) & 0xFF)); - bbwi.byteBuffer.put(bbwi.position() + 7, (byte)(x & 0xFF)); - bbwi.position(bbwi.position() + 8); - } - - public void write_wchar(char x) - { - // Don't allow transmission of wchar/wstring data with - // foreign ORBs since it's against the spec. - if (ORBUtility.isForeignORB(orb)) { - throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE); - } - - // If it's one of our legacy ORBs, do what they did: - alignAndReserve(2, 2); - - if (littleEndian) { - writeLittleEndianWchar(x); - } else { - writeBigEndianWchar(x); - } - } - - public void write_short(short x) - { - alignAndReserve(2, 2); - - if (littleEndian) { - writeLittleEndianShort(x); - } else { - writeBigEndianShort(x); - } - } - - public final void write_ushort(short x) - { - write_short(x); - } - - public void write_long(int x) - { - alignAndReserve(4, 4); - - if (littleEndian) { - writeLittleEndianLong(x); - } else { - writeBigEndianLong(x); - } - } - - public final void write_ulong(int x) - { - write_long(x); - } - - public void write_longlong(long x) - { - alignAndReserve(8, 8); - - if (littleEndian) { - writeLittleEndianLongLong(x); - } else { - writeBigEndianLongLong(x); - } - } - - public final void write_ulonglong(long x) - { - write_longlong(x); - } - - public final void write_float(float x) - { - write_long(Float.floatToIntBits(x)); - } - - public final void write_double(double x) - { - write_longlong(Double.doubleToLongBits(x)); - } - - public void write_string(String value) - { - writeString(value); - } - - protected int writeString(String value) - { - if (value == null) { - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - } - - CodeSetConversion.CTBConverter converter = getCharConverter(); - - converter.convert(value); - - // A string is encoded as an unsigned CORBA long for the - // number of bytes to follow (including a terminating null). - // There is only one octet per character in the string. - int len = converter.getNumBytes() + 1; - - handleSpecialChunkBegin(computeAlignment(4) + 4 + len); - - write_long(len); - int indirection = get_offset() - 4; - - internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes()); - - // Write the null ending - write_octet((byte)0); - - handleSpecialChunkEnd(); - return indirection; - } - - public void write_wstring(String value) - { - if (value == null) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // Don't allow transmission of wchar/wstring data with - // foreign ORBs since it's against the spec. - if (ORBUtility.isForeignORB(orb)) { - throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE); - } - - // When talking to our legacy ORBs, do what they did: - int len = value.length() + 1; - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(4 + (len * 2) + computeAlignment(4)); - - write_long(len); - - for (int i = 0; i < len - 1; i++) - write_wchar(value.charAt(i)); - - // Write the null ending - write_short((short)0); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - // Performs no checks and doesn't tamper with chunking - void internalWriteOctetArray(byte[] value, int offset, int length) - { - int n = offset; - - // This flag forces the alignAndReserve method to be called the - // first time an octet is written. This is necessary to ensure - // that the body is aligned on an 8-octet boundary. Note the 'if' - // condition inside the 'while' loop below. Also, refer to the - // write_octet() method that has a similar change. - boolean align = true; - - while (n < length+offset) { - int avail; - int bytes; - int wanted; - - if ((bbwi.position() + 1 > bbwi.buflen) || align) { - align = false; - alignAndReserve(1, 1); - } - avail = bbwi.buflen - bbwi.position(); - wanted = (length + offset) - n; - bytes = (wanted < avail) ? wanted : avail; - for (int i = 0; i < bytes; i++) - bbwi.byteBuffer.put(bbwi.position() + i, value[n+i]); - bbwi.position(bbwi.position() + bytes); - n += bytes; - } - } - - public final void write_octet_array(byte b[], int offset, int length) - { - if ( b == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(length); - - internalWriteOctetArray(b, offset, length); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - public void write_Principal(Principal p) - { - write_long(p.name().length); - write_octet_array(p.name(), 0, p.name().length); - } - - public void write_any(Any any) - { - if ( any == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - write_TypeCode(any.type()); - any.write_value(parent); - } - - public void write_TypeCode(TypeCode tc) - { - if ( tc == null ) { - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - } - TypeCodeImpl tci; - if (tc instanceof TypeCodeImpl) { - tci = (TypeCodeImpl)tc; - } - else { - tci = new TypeCodeImpl(orb, tc); - } - - tci.write_value((org.omg.CORBA_2_3.portable.OutputStream)parent); - } - - public void write_Object(org.omg.CORBA.Object ref) - { - if (ref == null) { - IOR nullIOR = IORFactories.makeIOR( orb ) ; - nullIOR.write(parent); - return; - } - - // IDL to Java formal 01-06-06 1.21.4.2 - if (ref instanceof org.omg.CORBA.LocalObject) - throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE); - - IOR ior = ORBUtility.connectAndGetIOR( orb, ref ) ; - ior.write(parent); - return; - } - - // ------------ RMI related methods -------------------------- - - public void write_abstract_interface(java.lang.Object obj) { - boolean corbaObject = false; // Assume value type. - org.omg.CORBA.Object theObject = null; - - // Is it a CORBA.Object? - - if (obj != null && obj instanceof org.omg.CORBA.Object) { - - // Yes. - - theObject = (org.omg.CORBA.Object)obj; - corbaObject = true; - } - - // Write our flag... - - write_boolean(corbaObject); - - // Now write out the object... - - if (corbaObject) { - write_Object(theObject); - } else { - try { - write_value((java.io.Serializable)obj); - } catch(ClassCastException cce) { - if (obj instanceof java.io.Serializable) - throw cce; - else - ORBUtility.throwNotSerializableForCorba(obj.getClass().getName()); - } - } - } - - public void write_value(Serializable object, Class clz) { - - write_value(object); - } - - private void writeWStringValue(String string) { - - int indirection = writeValueTag(mustChunk, true, null); - - // Write WStringValue's repository ID - write_repositoryId(repIdStrs.getWStringValueRepId()); - - // Add indirection for object to indirection table - updateIndirectionTable(indirection, string, string); - - // Write Value chunk - if (mustChunk) { - start_block(); - end_flag--; - chunkedValueNestingLevel--; - } else - end_flag--; - - write_wstring(string); - - if (mustChunk) - end_block(); - - // Write end tag - writeEndTag(mustChunk); - } - - private void writeArray(Serializable array, Class clazz) { - - if (valueHandler == null) - valueHandler = ORBUtility.createValueHandler(); //d11638 - - // Write value_tag - int indirection = writeValueTag(mustChunk, true, - Util.getCodebase(clazz)); - - // Write repository ID - write_repositoryId(repIdStrs.createSequenceRepID(clazz)); - - // Add indirection for object to indirection table - updateIndirectionTable(indirection, array, array); - - // Write Value chunk - if (mustChunk) { - start_block(); - end_flag--; - chunkedValueNestingLevel--; - } else - end_flag--; - - if (valueHandler instanceof ValueHandlerMultiFormat) { - ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler; - vh.writeValue(parent, array, streamFormatVersion); - } else - valueHandler.writeValue(parent, array); - - if (mustChunk) - end_block(); - - // Write end tag - writeEndTag(mustChunk); - } - - private void writeValueBase(org.omg.CORBA.portable.ValueBase object, - Class clazz) { - // _REVISIT_ could check to see whether chunking really needed - mustChunk = true; - - // Write value_tag - int indirection = writeValueTag(true, true, Util.getCodebase(clazz)); - - // Get rep id - String repId = ((ValueBase)object)._truncatable_ids()[0]; - - // Write rep id - write_repositoryId(repId); - - // Add indirection for object to indirection table - updateIndirectionTable(indirection, object, object); - - // Write Value chunk - start_block(); - end_flag--; - chunkedValueNestingLevel--; - writeIDLValue(object, repId); - end_block(); - - // Write end tag - writeEndTag(true); - } - - private void writeRMIIIOPValueType(Serializable object, Class clazz) { - if (valueHandler == null) - valueHandler = ORBUtility.createValueHandler(); //d11638 - - Serializable key = object; - - // Allow the ValueHandler to call writeReplace on - // the Serializable (if the method is present) - object = valueHandler.writeReplace(key); - - if (object == null) { - // Write null tag and return - write_long(0); - return; - } - - if (object != key) { - if (valueCache != null && valueCache.containsKey(object)) { - writeIndirection(INDIRECTION_TAG, valueCache.getVal(object)); - return; - } - - clazz = object.getClass(); - } - - if (mustChunk || valueHandler.isCustomMarshaled(clazz)) { - mustChunk = true; - } - - // Write value_tag - int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz)); - - // Write rep. id - write_repositoryId(repIdStrs.createForJavaType(clazz)); - - // Add indirection for object to indirection table - updateIndirectionTable(indirection, object, key); - - if (mustChunk) { - // Write Value chunk - end_flag--; - chunkedValueNestingLevel--; - start_block(); - } else - end_flag--; - - if (valueHandler instanceof ValueHandlerMultiFormat) { - ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler; - vh.writeValue(parent, object, streamFormatVersion); - } else - valueHandler.writeValue(parent, object); - - if (mustChunk) - end_block(); - - // Write end tag - writeEndTag(mustChunk); - } - - public void write_value(Serializable object, String repository_id) { - - // Handle null references - if (object == null) { - // Write null tag and return - write_long(0); - return; - } - - // Handle shared references - if (valueCache != null && valueCache.containsKey(object)) { - writeIndirection(INDIRECTION_TAG, valueCache.getVal(object)); - return; - } - - Class clazz = object.getClass(); - boolean oldMustChunk = mustChunk; - - if (mustChunk) - mustChunk = true; - - if (inBlock) - end_block(); - - if (clazz.isArray()) { - // Handle arrays - writeArray(object, clazz); - } else if (object instanceof org.omg.CORBA.portable.ValueBase) { - // Handle IDL Value types - writeValueBase((org.omg.CORBA.portable.ValueBase)object, clazz); - } else if (shouldWriteAsIDLEntity(object)) { - writeIDLEntity((IDLEntity)object); - } else if (object instanceof java.lang.String) { - writeWStringValue((String)object); - } else if (object instanceof java.lang.Class) { - writeClass(repository_id, (Class)object); - } else { - // RMI-IIOP value type - writeRMIIIOPValueType(object, clazz); - } - - mustChunk = oldMustChunk; - - // Check to see if we need to start another block for a - // possible outer value - if (mustChunk) - start_block(); - - } - - public void write_value(Serializable object) - { - write_value(object, (String)null); - } - - public void write_value(Serializable object, org.omg.CORBA.portable.BoxedValueHelper factory) - { - // Handle null references - if (object == null) { - // Write null tag and return - write_long(0); - return; - } - - // Handle shared references - if ((valueCache != null) && valueCache.containsKey(object)) { - writeIndirection(INDIRECTION_TAG, valueCache.getVal(object)); - return; - } - - boolean oldMustChunk = mustChunk; - - boolean isCustom = false; - if (factory instanceof ValueHelper) { - short modifier; - try { - modifier = ((ValueHelper)factory).get_type().type_modifier(); - } catch(BadKind ex) { // tk_value_box - modifier = VM_NONE.value; - } - if (object instanceof CustomMarshal && - modifier == VM_CUSTOM.value) { - isCustom = true; - mustChunk = true; - } - if (modifier == VM_TRUNCATABLE.value) - mustChunk = true; - } - - if (mustChunk) { - - if (inBlock) - end_block(); - - // Write value_tag - int indirection = writeValueTag(true, - orb.getORBData().useRepId(), - Util.getCodebase(object.getClass()) - ); - - if (orb.getORBData().useRepId()) { - write_repositoryId(factory.get_id()); - } - - // Add indirection for object to indirection table - updateIndirectionTable(indirection, object, object); - - // Write Value chunk - start_block(); - end_flag--; - chunkedValueNestingLevel--; - if (isCustom) - ((CustomMarshal)object).marshal(parent); - else - factory.write_value(parent, object); - end_block(); - - // Write end tag - writeEndTag(true); - } - else { - // Write value_tag - int indirection = writeValueTag(false, - orb.getORBData().useRepId(), - Util.getCodebase(object.getClass()) - ); - - if (orb.getORBData().useRepId()) { - write_repositoryId(factory.get_id()); - } - - // Add indirection for object to indirection table - updateIndirectionTable(indirection, object, object); - - // Write Value chunk - end_flag--; - // no need to test for custom on the non-chunked path - factory.write_value(parent, object); - - // Write end tag - writeEndTag(false); - } - - mustChunk = oldMustChunk; - - // Check to see if we need to start another block for a - // possible outer value - if (mustChunk) - start_block(); - - } - - public int get_offset() { - return bbwi.position(); - } - - public void start_block() { - if (debug) { - dprint("CDROutputStream_1_0 start_block, position" + bbwi.position()); - } - - //Move inBlock=true to after write_long since write_long might - //trigger grow which will lead to erroneous behavior with a - //missing blockSizeIndex. - //inBlock = true; - - // Save space in the buffer for block size - write_long(0); - - //Has to happen after write_long since write_long could - //trigger grow which is overridden by supper classes to - //depend on inBlock. - inBlock = true; - - blockSizePosition = get_offset(); - - // Remember where to put the size of the endblock less 4 - blockSizeIndex = bbwi.position(); - - if (debug) { - dprint("CDROutputStream_1_0 start_block, blockSizeIndex " - + blockSizeIndex); - } - - } - - // Utility method which will hopefully decrease chunking complexity - // by allowing us to end_block and update chunk lengths without - // calling alignAndReserve. Otherwise, it's possible to get into - // recursive scenarios which lose the chunking state. - protected void writeLongWithoutAlign(int x) { - if (littleEndian) { - writeLittleEndianLong(x); - } else { - writeBigEndianLong(x); - } - } - - public void end_block() { - if (debug) { - dprint("CDROutputStream_1_0.java end_block"); - } - - if (!inBlock) - return; - - if (debug) { - dprint("CDROutputStream_1_0.java end_block, in a block"); - } - - inBlock = false; - - // Test to see if the block was of zero length - // If so, remove the block instead of ending it - // (This can happen if the last field written - // in a value was another value) - if (get_offset() == blockSizePosition) { - // Need to assert that blockSizeIndex == bbwi.position()? REVISIT - - bbwi.position(bbwi.position() - 4); - blockSizeIndex = -1; - blockSizePosition = -1; - return; - } - - int oldSize = bbwi.position(); - bbwi.position(blockSizeIndex - 4); - - writeLongWithoutAlign(oldSize - blockSizeIndex); - - bbwi.position(oldSize); - blockSizeIndex = -1; - blockSizePosition = -1; - - // System.out.println(" post end_block: " + get_offset() + " " + bbwi.position()); - } - - public org.omg.CORBA.ORB orb() - { - return orb; - } - - // ------------ End RMI related methods -------------------------- - - public final void write_boolean_array(boolean[]value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(length); - - for (int i = 0; i < length; i++) - write_boolean(value[offset + i]); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - public final void write_char_array(char[]value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(length); - - for (int i = 0; i < length; i++) - write_char(value[offset + i]); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - public void write_wchar_array(char[]value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(computeAlignment(2) + (length * 2)); - - for (int i = 0; i < length; i++) - write_wchar(value[offset + i]); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - public final void write_short_array(short[]value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(computeAlignment(2) + (length * 2)); - - for (int i = 0; i < length; i++) - write_short(value[offset + i]); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - public final void write_ushort_array(short[]value, int offset, int length) { - write_short_array(value, offset, length); - } - - public final void write_long_array(int[]value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(computeAlignment(4) + (length * 4)); - - for (int i = 0; i < length; i++) - write_long(value[offset + i]); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - public final void write_ulong_array(int[]value, int offset, int length) { - write_long_array(value, offset, length); - } - - public final void write_longlong_array(long[]value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(computeAlignment(8) + (length * 8)); - - for (int i = 0; i < length; i++) - write_longlong(value[offset + i]); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - public final void write_ulonglong_array(long[]value, int offset, int length) { - write_longlong_array(value, offset, length); - } - - public final void write_float_array(float[]value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(computeAlignment(4) + (length * 4)); - - for (int i = 0; i < length; i++) - write_float(value[offset + i]); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - public final void write_double_array(double[]value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - // This will only have an effect if we're already chunking - handleSpecialChunkBegin(computeAlignment(8) + (length * 8)); - - for (int i = 0; i < length; i++) - write_double(value[offset + i]); - - // This will only have an effect if we're already chunking - handleSpecialChunkEnd(); - } - - public void write_string_array(String[] value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - for(int i = 0; i < length; i++) - write_string(value[offset + i]); - } - - public void write_wstring_array(String[] value, int offset, int length) { - if ( value == null ) - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - - for(int i = 0; i < length; i++) - write_wstring(value[offset + i]); - } - - public final void write_any_array(org.omg.CORBA.Any value[], int offset, int length) - { - for(int i = 0; i < length; i++) - write_any(value[offset + i]); - } - - //--------------------------------------------------------------------// - // CDROutputStream state management. - // - - public void writeTo(java.io.OutputStream s) - throws java.io.IOException - { - byte[] tmpBuf = null; - - if (bbwi.byteBuffer.hasArray()) - { - tmpBuf = bbwi.byteBuffer.array(); - } - else - { - int size = bbwi.position(); - tmpBuf = new byte[size]; - // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is - // faster than ByteBuffer.get(byte[], offset, length) - for (int i = 0; i < size; i++) - tmpBuf[i] = bbwi.byteBuffer.get(i); - } - - s.write(tmpBuf, 0, bbwi.position()); - } - - public void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) { - - byte[] buf = null; - - if (bbwi.byteBuffer.hasArray()) - { - buf = bbwi.byteBuffer.array(); - } - else - { - int size = bbwi.position(); - buf = new byte[size]; - // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is - // faster than ByteBuffer.get(byte[], offset, length) - for (int i = 0; i < size; i++) - buf[i] = bbwi.byteBuffer.get(i); - } - - s.write_long(bbwi.position()); - s.write_octet_array(buf, 0, bbwi.position()); - - } - - public final int getSize() { - return bbwi.position(); - } - - public int getIndex() { - return bbwi.position(); - } - - public boolean isLittleEndian() { - return littleEndian; - } - - public void setIndex(int value) { - bbwi.position(value); - } - - public ByteBufferWithInfo getByteBufferWithInfo() { - return bbwi; - } - - public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { - this.bbwi = bbwi; - } - - public ByteBuffer getByteBuffer() { - ByteBuffer result = null;; - if (bbwi != null) { - result = bbwi.byteBuffer; - } - return result; - } - - public void setByteBuffer(ByteBuffer byteBuffer) { - bbwi.byteBuffer = byteBuffer; - } - - private final void updateIndirectionTable(int indirection, java.lang.Object object, - java.lang.Object key) { - // int indirection = get_offset(); - if (valueCache == null) - valueCache = new CacheTable(orb,true); - valueCache.put(object, indirection); - if (key != object) - valueCache.put(key, indirection); - } - - private final void write_repositoryId(String id) { - // Use an indirection if available - if (repositoryIdCache != null && repositoryIdCache.containsKey(id)) { - writeIndirection(INDIRECTION_TAG, repositoryIdCache.getVal(id)); - return; - } - - // Write it as a string. Note that we have already done the - // special case conversion of non-Latin-1 characters to escaped - // Latin-1 sequences in RepositoryId. - - // It's not a good idea to cache them now that we can have - // multiple code sets. - int indirection = writeString(id); - - // Add indirection for id to indirection table - if (repositoryIdCache == null) - repositoryIdCache = new CacheTable(orb,true); - repositoryIdCache.put(id, indirection); - } - - private void write_codebase(String str, int pos) { - if (codebaseCache != null && codebaseCache.containsKey(str)) { - writeIndirection(INDIRECTION_TAG, codebaseCache.getVal(str)); - } - else { - write_string(str); - if (codebaseCache == null) - codebaseCache = new CacheTable(orb,true); - codebaseCache.put(str, pos); - } - } - - private final int writeValueTag(boolean chunkIt, boolean useRepId, - String codebase) { - int indirection = 0; - if (chunkIt && !useRepId){ - if (codebase == null) { - write_long(repIdUtil.getStandardRMIChunkedNoRepStrId()); - indirection = get_offset() - 4; - } else { - write_long(repIdUtil.getCodeBaseRMIChunkedNoRepStrId()); - indirection = get_offset() - 4; - write_codebase(codebase, get_offset()); - } - } else if (chunkIt && useRepId){ - if (codebase == null) { - write_long(repIdUtil.getStandardRMIChunkedId()); - indirection = get_offset() - 4; - } else { - write_long(repIdUtil.getCodeBaseRMIChunkedId()); - indirection = get_offset() - 4; - write_codebase(codebase, get_offset()); - } - } else if (!chunkIt && !useRepId) { - if (codebase == null) { - write_long(repIdUtil.getStandardRMIUnchunkedNoRepStrId()); - indirection = get_offset() - 4; - } else { - write_long(repIdUtil.getCodeBaseRMIUnchunkedNoRepStrId()); - indirection = get_offset() - 4; - write_codebase(codebase, get_offset()); - } - } else if (!chunkIt && useRepId) { - if (codebase == null) { - write_long(repIdUtil.getStandardRMIUnchunkedId()); - indirection = get_offset() - 4; - } else { - write_long(repIdUtil.getCodeBaseRMIUnchunkedId()); - indirection = get_offset() - 4; - write_codebase(codebase, get_offset()); - } - } - return indirection; - } - - private void writeIDLValue(Serializable object, String repID) - { - if (object instanceof StreamableValue) { - ((StreamableValue)object)._write(parent); - - } else if (object instanceof CustomValue) { - ((CustomValue)object).marshal(parent); - - } else { - BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID); - boolean isCustom = false; - if (helper instanceof ValueHelper && object instanceof CustomMarshal) { - try { - if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value) - isCustom = true; - } catch(BadKind ex) { - throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE, - ex ) ; - } - } - if (isCustom) - ((CustomMarshal)object).marshal(parent); - else - helper.write_value(parent, object); - } - } - - // Handles end tag compaction... - private void writeEndTag(boolean chunked){ - - if (chunked) { - if (get_offset() == end_flag_position) { - - if (bbwi.position() == end_flag_index) { - - // We are exactly at the same position and index as the - // end of the last end tag. Thus, we can back up over it - // and compact the tags. - bbwi.position(bbwi.position() - 4); - - } else { - - // Special case in which we're at the beginning of a new - // fragment, but the position is the same. We can't back up, - // so we just write the new end tag without compaction. This - // occurs when a value ends and calls start_block to open a - // continuation chunk, but it's called at the very end of - // a fragment. - } - } - - writeNestingLevel(); - - // Remember the last index and position. These are only used when chunking. - end_flag_index = bbwi.position(); - end_flag_position = get_offset(); - - chunkedValueNestingLevel++; - } - - // Increment the nesting level - end_flag++; - } - - /** - * Handles ORB versioning of the end tag. Should only - * be called if chunking. - * - * If talking to our older ORBs (Standard Extension, - * Kestrel, and Ladybird), write the end flag that takes - * into account all enclosing valuetypes. - * - * If talking a newer or foreign ORB, or if the orb - * instance is null, write the end flag that only takes - * into account the enclosing chunked valuetypes. - */ - private void writeNestingLevel() { - if (orb == null || - ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || - ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { - - write_long(chunkedValueNestingLevel); - - } else { - write_long(end_flag); - } - } - - private void writeClass(String repository_id, Class clz) { - - if (repository_id == null) - repository_id = repIdStrs.getClassDescValueRepId(); - - // Write value_tag - int indirection = writeValueTag(mustChunk, true, null); - updateIndirectionTable(indirection, clz, clz); - - write_repositoryId(repository_id); - - if (mustChunk) { - // Write Value chunk - start_block(); - end_flag--; - chunkedValueNestingLevel--; - } else - end_flag--; - - writeClassBody(clz); - - if (mustChunk) - end_block(); - - // Write end tag - writeEndTag(mustChunk); - } - - // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID - // and codebase strings in the wrong order. This handles - // backwards compatibility. - private void writeClassBody(Class clz) { - if (orb == null || - ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) || - ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) { - - write_value(Util.getCodebase(clz)); - write_value(repIdStrs.createForAnyType(clz)); - } else { - - write_value(repIdStrs.createForAnyType(clz)); - write_value(Util.getCodebase(clz)); - } - } - - // Casts and returns an Object as a Serializable - // This is required for JDK 1.1 only to avoid VerifyErrors when - // passing arrays as Serializable - // private java.io.Serializable make_serializable(java.lang.Object object) - // { - // return (java.io.Serializable)object; - // } - - private boolean shouldWriteAsIDLEntity(Serializable object) - { - return ((object instanceof IDLEntity) && (!(object instanceof ValueBase)) && - (!(object instanceof org.omg.CORBA.Object))); - - } - - private void writeIDLEntity(IDLEntity object) { - - // _REVISIT_ could check to see whether chunking really needed - mustChunk = true; - - String repository_id = repIdStrs.createForJavaType(object); - Class clazz = object.getClass(); - String codebase = Util.getCodebase(clazz); - - // Write value_tag - int indirection = writeValueTag(true, true, codebase); - updateIndirectionTable(indirection, object, object); - - // Write rep. id - write_repositoryId(repository_id); - - // Write Value chunk - end_flag--; - chunkedValueNestingLevel--; - start_block(); - - // Write the IDLEntity using reflection - try { - ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader()); - final Class helperClass = Utility.loadClassForClass(clazz.getName()+"Helper", codebase, - clazzLoader, clazz, clazzLoader); - final Class argTypes[] = {org.omg.CORBA.portable.OutputStream.class, clazz}; - // getDeclaredMethod requires RuntimePermission accessDeclaredMembers - // if a different class loader is used (even though the javadoc says otherwise) - Method writeMethod = null; - try { - writeMethod = (Method)AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public java.lang.Object run() throws NoSuchMethodException { - return helperClass.getDeclaredMethod(kWriteMethod, argTypes); - } - } - ); - } catch (PrivilegedActionException pae) { - // this gets caught below - throw (NoSuchMethodException)pae.getException(); - } - java.lang.Object args[] = {parent, object}; - writeMethod.invoke(null, args); - } catch (ClassNotFoundException cnfe) { - throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, cnfe ) ; - } catch(NoSuchMethodException nsme) { - throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, nsme ) ; - } catch(IllegalAccessException iae) { - throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, iae ) ; - } catch(InvocationTargetException ite) { - throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, ite ) ; - } - end_block(); - - // Write end tag - writeEndTag(true); - } - - /* DataOutputStream methods */ - - public void write_Abstract (java.lang.Object value) { - write_abstract_interface(value); - } - - public void write_Value (java.io.Serializable value) { - write_value(value); - } - - // This will stay a custom add-on until the java-rtf issue is resolved. - // Then it should be declared in org.omg.CORBA.portable.OutputStream. - // - // Pads the string representation of bigDecimal with zeros to fit the given - // digits and scale before it gets written to the stream. - public void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) { - String string = bigDecimal.toString(); - String integerPart; - String fractionPart; - StringBuffer stringBuffer; - - // Get rid of the sign - if (string.charAt(0) == '-' || string.charAt(0) == '+') { - string = string.substring(1); - } - - // Determine integer and fraction parts - int dotIndex = string.indexOf('.'); - if (dotIndex == -1) { - integerPart = string; - fractionPart = null; - } else if (dotIndex == 0 ) { - integerPart = null; - fractionPart = string; - } else { - integerPart = string.substring(0, dotIndex); - fractionPart = string.substring(dotIndex + 1); - } - - // Pad both parts with zeros as necessary - stringBuffer = new StringBuffer(digits); - if (fractionPart != null) { - stringBuffer.append(fractionPart); - } - while (stringBuffer.length() < scale) { - stringBuffer.append('0'); - } - if (integerPart != null) { - stringBuffer.insert(0, integerPart); - } - while (stringBuffer.length() < digits) { - stringBuffer.insert(0, '0'); - } - - // This string contains no sign or dot - this.write_fixed(stringBuffer.toString(), bigDecimal.signum()); - } - - // This method should be remove by the java-rtf issue. - // Right now the scale and digits information of the type code is lost. - public void write_fixed(java.math.BigDecimal bigDecimal) { - // This string might contain sign and/or dot - this.write_fixed(bigDecimal.toString(), bigDecimal.signum()); - } - - // The string may contain a sign and dot - public void write_fixed(String string, int signum) { - int stringLength = string.length(); - // Each octet contains (up to) two decimal digits - byte doubleDigit = 0; - char ch; - byte digit; - - // First calculate the length of the string without optional sign and dot - int numDigits = 0; - for (int i=0; i 0, fragmentOffset - // = sum i=[1,n] { bbwi_i-1_.size - buffer i header length } - // - protected int fragmentOffset = 0; - - protected void alignAndReserve(int align, int n) { - - // Notice that in 1.1, we won't end a fragment with - // alignment padding. We also won't guarantee that - // our fragments end on evenly divisible 8 byte - // boundaries. There may be alignment - // necessary with the header of the next fragment - // since the header isn't aligned on an 8 byte - // boundary, so we have to calculate it twice. - - int alignment = computeAlignment(align); - - if (bbwi.position() + n + alignment > bbwi.buflen) { - grow(align, n); - - // Must recompute the alignment after a grow. - // In the case of fragmentation, the alignment - // calculation may no longer be correct. - - // People shouldn't be able to set their fragment - // sizes so small that the fragment header plus - // this alignment fills the entire buffer. - alignment = computeAlignment(align); - } - - bbwi.position(bbwi.position() + alignment); - } - - protected void grow(int align, int n) { - // Save the current size for possible post-fragmentation calculation - int oldSize = bbwi.position(); - - super.grow(align, n); - - // At this point, if we fragmented, we should have a ByteBufferWithInfo - // with the fragment header already marshalled. The size and length fields - // should be updated accordingly, and the fragmented flag should be set. - if (bbwi.fragmented) { - - // Clear the flag - bbwi.fragmented = false; - - // Update fragmentOffset so indirections work properly. - // At this point, oldSize is the entire length of the - // previous buffer. bbwi.position() is the length of the - // fragment header of this buffer. - fragmentOffset += (oldSize - bbwi.position()); - } - } - - public int get_offset() { - return bbwi.position() + fragmentOffset; - } - - public GIOPVersion getGIOPVersion() { - return GIOPVersion.V1_1; - } - - public void write_wchar(char x) - { - // In GIOP 1.1, interoperability with wchar is limited - // to 2 byte fixed width encodings. CORBA formal 99-10-07 15.3.1.6. - // Note that the following code prohibits UTF-16 with a byte - // order marker (which would result in 4 bytes). - CodeSetConversion.CTBConverter converter = getWCharConverter(); - - converter.convert(x); - - if (converter.getNumBytes() != 2) - throw wrapper.badGiop11Ctb(CompletionStatus.COMPLETED_MAYBE); - - alignAndReserve(converter.getAlignment(), - converter.getNumBytes()); - - parent.write_octet_array(converter.getBytes(), - 0, - converter.getNumBytes()); - } - - public void write_wstring(String value) - { - if (value == null) { - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - } - - // The length is the number of code points (which are 2 bytes each) - // including the 2 byte null. See CORBA formal 99-10-07 15.3.2.7. - - int len = value.length() + 1; - - write_long(len); - - CodeSetConversion.CTBConverter converter = getWCharConverter(); - - converter.convert(value); - - internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes()); - - // Write the 2 byte null ending - write_short((short)0); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java 2018-01-30 20:16:57.000000000 -0500 +++ /dev/null 2018-01-30 20:16:57.000000000 -0500 @@ -1,359 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.encoding; - -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -public class CDROutputStream_1_2 extends CDROutputStream_1_1 -{ - // There's a situation with chunking with fragmentation - // in which the alignment for a primitive value is needed - // to fill fragment N, but the primitive won't fit so - // must go into fragment N + 1. The behavior is the same - // as that for specialChunks. - // - // Unfortunately, given the current code, we can't reuse - // specialChunk. If you wrap each of the following - // write calls with handleSpecialChunkBegin/End, you - // will lose your state because the primitive calls will - // change the variables, etc. - // - // All of the CDR code should be rewritten moving chunking - // to a different level, perhaps in the buffer managers. - // We want to move to a compositional model rather than - // using inheritance. - // - // Note that in the grow case, chunks are _NOT_ closed - // at grow points, now. - // - // **** NOTE **** - // Since we will not support valuetypes with GIOP 1.1, that - // also means we do not support chunking there. - // - protected boolean primitiveAcrossFragmentedChunk = false; - - // Used in chunking. Here's how this works: - // - // When chunking and writing an array of primitives, a string, or a - // wstring, _AND_ it won't fit in the buffer do the following. (As - // you can see, this is a very "special" chunk.) - // - // 1. Write the length of the chunk including the array length - // 2. Set specialChunk to true - // 3 applies to ALL chunking: - // 3. In grow, if we need to fragment and specialChunk is false - // a) call end_block - // b) fragment - // Now back to the array only case: - // [write the data] - // 4. if specialChunk is true - // a) Close the chunk - // b) Set specialChunk to false - - protected boolean specialChunk = false; - - // Indicates whether the header should be padded. In GIOP 1.2 and above, the - // body must be aligned on a 8-octet boundary, and so the header needs to be - // padded appropriately. However, if there is no body to a request or reply - // message, there is no need to pad the header, in the unfragmented case. - private boolean headerPadding; - - protected void handleSpecialChunkBegin(int requiredSize) - { - // If we're chunking and the item won't fit in the buffer - if (inBlock && requiredSize + bbwi.position() > bbwi.buflen) { - - // Duplicating some code from end_block. Compute - // and write the total chunk length. - - int oldSize = bbwi.position(); - bbwi.position(blockSizeIndex - 4); - - //write_long(oldSize - blockSizeIndex); - writeLongWithoutAlign((oldSize - blockSizeIndex) + requiredSize); - bbwi.position(oldSize); - - // Set the special flag so we don't end the chunk when - // we fragment - specialChunk = true; - } - } - - protected void handleSpecialChunkEnd() - { - // If we're in a chunk and the item spanned fragments - if (inBlock && specialChunk) { - - // This is unnecessary, but I just want to show that - // we're done with the current chunk. (the end_block - // call is inappropriate here) - inBlock = false; - blockSizeIndex = -1; - blockSizePosition = -1; - - // Start a new chunk since we fragmented during the item. - // Thus, no one can go back to add more to the chunk length - start_block(); - - // Now turn off the flag so we go back to the normal - // behavior of closing a chunk when we fragment and - // reopening afterwards. - specialChunk = false; - } - } - - // Called after writing primitives - private void checkPrimitiveAcrossFragmentedChunk() - { - if (primitiveAcrossFragmentedChunk) { - primitiveAcrossFragmentedChunk = false; - - inBlock = false; - - // It would be nice to have a StreamPosition - // abstraction if we could avoid allocation - // overhead. - blockSizeIndex = -1; - blockSizePosition = -1; - - // Start a new chunk - start_block(); - } - } - - - public void write_octet(byte x) { - super.write_octet(x); - checkPrimitiveAcrossFragmentedChunk(); - } - - public void write_short(short x) { - super.write_short(x); - checkPrimitiveAcrossFragmentedChunk(); - } - - public void write_long(int x) { - super.write_long(x); - checkPrimitiveAcrossFragmentedChunk(); - } - - public void write_longlong(long x) { - super.write_longlong(x); - checkPrimitiveAcrossFragmentedChunk(); - } - - // Called by RequestMessage_1_2 or ReplyMessage_1_2 classes only. - void setHeaderPadding(boolean headerPadding) { - this.headerPadding = headerPadding; - } - - protected void alignAndReserve(int align, int n) { - - // headerPadding bit is set by the write operation of RequestMessage_1_2 - // or ReplyMessage_1_2 classes. When set, the very first body write - // operation (from the stub code) would trigger an alignAndReserve - // method call, that would in turn add the appropriate header padding, - // such that the body is aligned on a 8-octet boundary. The padding - // is required for GIOP versions 1.2 and above, only if body is present. - if (headerPadding == true) { - headerPadding = false; - alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT); - } - - // In GIOP 1.2, we always end fragments at our - // fragment size, which is an "evenly divisible - // 8 byte boundary" (aka divisible by 16). A fragment can - // end with appropriate alignment padding, but no padding - // is needed with respect to the next GIOP fragment - // header since it ends on an 8 byte boundary. - - bbwi.position(bbwi.position() + computeAlignment(align)); - - if (bbwi.position() + n > bbwi.buflen) - grow(align, n); - } - - protected void grow(int align, int n) { - - // Save the current size for possible post-fragmentation calculation - int oldSize = bbwi.position(); - - // See notes where specialChunk is defined, as well as the - // above notes for primitiveAcrossFragmentedChunk. - // - // If we're writing a primitive and chunking, we need to update - // the chunk length to include the length of the primitive (unless - // this complexity is handled by specialChunk). - // - // Note that this is wasted processing in the grow case, but that - // we don't actually close the chunk in that case. - boolean handleChunk = (inBlock && !specialChunk); - if (handleChunk) { - int oldIndex = bbwi.position(); - - bbwi.position(blockSizeIndex - 4); - - writeLongWithoutAlign((oldIndex - blockSizeIndex) + n); - - bbwi.position(oldIndex); - } - - bbwi.needed = n; - bufferManagerWrite.overflow(bbwi); - - // At this point, if we fragmented, we should have a ByteBufferWithInfo - // with the fragment header already marshalled. The buflen and position - // should be updated accordingly, and the fragmented flag should be set. - - // Note that fragmented is only true in the streaming and collect cases. - if (bbwi.fragmented) { - - // Clear the flag - bbwi.fragmented = false; - - // Update fragmentOffset so indirections work properly. - // At this point, oldSize is the entire length of the - // previous buffer. bbwi.position() is the length of the - // fragment header of this buffer. - fragmentOffset += (oldSize - bbwi.position()); - - // We just fragmented, and need to signal that we should - // start a new chunk after writing the primitive. - if (handleChunk) - primitiveAcrossFragmentedChunk = true; - - } - } - - public GIOPVersion getGIOPVersion() { - return GIOPVersion.V1_2; - } - - public void write_wchar(char x) - { - // In GIOP 1.2, a wchar is encoded as an unsigned octet length - // followed by the octets of the converted wchar. This is good, - // but it causes problems with our chunking code. We don't - // want that octet to get put in a different chunk at the end - // of the previous fragment. - // - // Ensure that this won't happen by overriding write_wchar_array - // and doing our own handleSpecialChunkBegin/End here. - CodeSetConversion.CTBConverter converter = getWCharConverter(); - - converter.convert(x); - - handleSpecialChunkBegin(1 + converter.getNumBytes()); - - write_octet((byte)converter.getNumBytes()); - - byte[] result = converter.getBytes(); - - // Write the bytes without messing with chunking - // See CDROutputStream_1_0 - internalWriteOctetArray(result, 0, converter.getNumBytes()); - - handleSpecialChunkEnd(); - } - - public void write_wchar_array(char[] value, int offset, int length) - { - if (value == null) { - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - } - - CodeSetConversion.CTBConverter converter = getWCharConverter(); - - // Unfortunately, because of chunking, we have to convert the - // entire char[] to a byte[] array first so we can know how - // many bytes we're writing ahead of time. You can't split - // an array of primitives into multiple chunks. - int totalNumBytes = 0; - - // Remember that every wchar starts with an octet telling - // its length. The buffer size is an upper bound estimate. - int maxLength = (int)Math.ceil(converter.getMaxBytesPerChar() * length); - byte[] buffer = new byte[maxLength + length]; - - for (int i = 0; i < length; i++) { - // Convert one wchar - converter.convert(value[offset + i]); - - // Make sure to add the octet length - buffer[totalNumBytes++] = (byte)converter.getNumBytes(); - - // Copy it into our buffer - System.arraycopy(converter.getBytes(), 0, - buffer, totalNumBytes, - converter.getNumBytes()); - - totalNumBytes += converter.getNumBytes(); - } - - // Now that we know the total length, we can deal with chunking. - // Note that we don't have to worry about alignment since they're - // just octets. - handleSpecialChunkBegin(totalNumBytes); - - // Must use totalNumBytes rather than buffer.length since the - // buffer.length is only the upper bound estimate. - internalWriteOctetArray(buffer, 0, totalNumBytes); - - handleSpecialChunkEnd(); - } - - public void write_wstring(String value) { - if (value == null) { - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - } - - // In GIOP 1.2, wstrings are not terminated by a null. The - // length is the number of octets in the converted format. - // A zero length string is represented with the 4 byte length - // value of 0. - if (value.length() == 0) { - write_long(0); - return; - } - - CodeSetConversion.CTBConverter converter = getWCharConverter(); - - converter.convert(value); - - handleSpecialChunkBegin(computeAlignment(4) + 4 + converter.getNumBytes()); - - write_long(converter.getNumBytes()); - - // Write the octet array without tampering with chunking - internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes()); - - handleSpecialChunkEnd(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java 2018-01-30 20:16:58.000000000 -0500 +++ /dev/null 2018-01-30 20:16:58.000000000 -0500 @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2001, 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.corba.se.impl.encoding; - -import java.util.Hashtable; -import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription; -import com.sun.org.omg.SendingContext.CodeBase; -import com.sun.org.omg.SendingContext.CodeBaseHelper; -import com.sun.org.omg.SendingContext._CodeBaseImplBase; -import com.sun.org.omg.SendingContext._CodeBaseStub; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.orb.ORB; -/** - * Provides the reading side with a per connection cache of - * info obtained via calls to the remote CodeBase. - * - * Previously, most of this was in IIOPConnection. - * - * Features: - * Delays cache creation unless used - * Postpones remote calls until necessary - * Handles creating obj ref from IOR - * Maintains caches for the following maps: - * CodeBase IOR to obj ref (global) - * RepId to implementation URL(s) - * RepId to remote FVD - * RepId to superclass type list - * - * Needs cache management. - */ -public class CachedCodeBase extends _CodeBaseImplBase -{ - private Hashtable implementations, fvds, bases; - private volatile CodeBase delegate; - private CorbaConnection conn; - - private static Object iorMapLock = new Object(); - private static Hashtable iorMap = new Hashtable<>(); - - public static synchronized void cleanCache( ORB orb ) { - synchronized (iorMapLock) { - for (IOR ior : iorMap.keySet()) { - if (ior.getORB() == orb) { - iorMap.remove(ior); - } - } - } - } - - public CachedCodeBase(CorbaConnection connection) { - conn = connection; - } - - public com.sun.org.omg.CORBA.Repository get_ir () { - return null; - } - - public synchronized String implementation (String repId) { - String urlResult = null; - - if (implementations == null) - implementations = new Hashtable(); - else - urlResult = (String)implementations.get(repId); - - if (urlResult == null && connectedCodeBase()) { - urlResult = delegate.implementation(repId); - - if (urlResult != null) - implementations.put(repId, urlResult); - } - - return urlResult; - } - - public synchronized String[] implementations (String[] repIds) { - String[] urlResults = new String[repIds.length]; - - for (int i = 0; i < urlResults.length; i++) - urlResults[i] = implementation(repIds[i]); - - return urlResults; - } - - public synchronized FullValueDescription meta (String repId) { - FullValueDescription result = null; - - if (fvds == null) - fvds = new Hashtable(); - else - result = (FullValueDescription)fvds.get(repId); - - if (result == null && connectedCodeBase()) { - result = delegate.meta(repId); - - if (result != null) - fvds.put(repId, result); - } - - return result; - } - - public synchronized FullValueDescription[] metas (String[] repIds) { - FullValueDescription[] results - = new FullValueDescription[repIds.length]; - - for (int i = 0; i < results.length; i++) - results[i] = meta(repIds[i]); - - return results; - } - - public synchronized String[] bases (String repId) { - - String[] results = null; - - if (bases == null) - bases = new Hashtable(); - else - results = (String[])bases.get(repId); - - if (results == null && connectedCodeBase()) { - results = delegate.bases(repId); - - if (results != null) - bases.put(repId, results); - } - - return results; - } - - // Ensures that we've used the connection's IOR to create - // a valid CodeBase delegate. If this returns false, then - // it is not valid to access the delegate. - private synchronized boolean connectedCodeBase() { - if (delegate != null) - return true; - - // The delegate was null, so see if the connection's - // IOR was set. If so, then we just need to connect - // it. Otherwise, there is no hope of checking the - // remote code base. That could be bug if the - // service context processing didn't occur, or it - // could be that we're talking to a foreign ORB which - // doesn't include this optional service context. - if (conn.getCodeBaseIOR() == null) { - // REVISIT. Use Merlin logging service to report that - // codebase functionality was requested but unavailable. - if (conn.getBroker().transportDebugFlag) - conn.dprint("CodeBase unavailable on connection: " + conn); - - return false; - } - - synchronized(iorMapLock) { - - // Recheck the condition to make sure another - // thread didn't already do this while we waited - if (delegate != null) - return true; - - // Do we have a reference initialized by another connection? - delegate = CachedCodeBase.iorMap.get(conn.getCodeBaseIOR()); - - if (delegate != null) - return true; - - // Connect the delegate and update the cache - delegate = CodeBaseHelper.narrow(getObjectFromIOR()); - - // Save it for the benefit of other connections - CachedCodeBase.iorMap.put(conn.getCodeBaseIOR(), delegate); - } - - // It's now safe to use the delegate - return true; - } - - private final org.omg.CORBA.Object getObjectFromIOR() { - return CDRInputStream_1_0.internalIORToObject( - conn.getCodeBaseIOR(), null /*stubFactory*/, conn.getBroker()); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetCache.java 2018-01-30 20:16:59.000000000 -0500 +++ /dev/null 2018-01-30 20:16:59.000000000 -0500 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2001, 2004, 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.corba.se.impl.encoding; - -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.util.Map; -import java.util.WeakHashMap; - -/** - * Thread local cache of sun.io code set converters for performance. - * - * The thread local class contains a single reference to a Map[] - * containing two WeakHashMaps. One for CharsetEncoders and - * one for CharsetDecoders. Constants are defined for indexing. - * - * This is used internally by CodeSetConversion. - */ -class CodeSetCache -{ - /** - * The ThreadLocal data is a 2 element Map array indexed - * by BTC_CACHE_MAP and CTB_CACHE_MAP. - */ - private ThreadLocal converterCaches = new ThreadLocal() { - public java.lang.Object initialValue() { - return new Map[] { new WeakHashMap(), new WeakHashMap() }; - } - }; - - /** - * Index in the thread local converterCaches array for - * the byte to char converter Map. A key is the Java - * name corresponding to the desired code set. - */ - private static final int BTC_CACHE_MAP = 0; - - /** - * Index in the thread local converterCaches array for - * the char to byte converter Map. A key is the Java - * name corresponding to the desired code set. - */ - private static final int CTB_CACHE_MAP = 1; - - /** - * Retrieve a CharsetDecoder from the Map using the given key. - */ - CharsetDecoder getByteToCharConverter(Object key) { - Map btcMap = ((Map[])converterCaches.get())[BTC_CACHE_MAP]; - - return (CharsetDecoder)btcMap.get(key); - } - - /** - * Retrieve a CharsetEncoder from the Map using the given key. - */ - CharsetEncoder getCharToByteConverter(Object key) { - Map ctbMap = ((Map[])converterCaches.get())[CTB_CACHE_MAP]; - - return (CharsetEncoder)ctbMap.get(key); - } - - /** - * Stores the given CharsetDecoder in the thread local cache, - * and returns the same converter. - */ - CharsetDecoder setConverter(Object key, CharsetDecoder converter) { - Map btcMap = ((Map[])converterCaches.get())[BTC_CACHE_MAP]; - - btcMap.put(key, converter); - - return converter; - } - - /** - * Stores the given CharsetEncoder in the thread local cache, - * and returns the same converter. - */ - CharsetEncoder setConverter(Object key, CharsetEncoder converter) { - - Map ctbMap = ((Map[])converterCaches.get())[CTB_CACHE_MAP]; - - ctbMap.put(key, converter); - - return converter; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java 2018-01-30 20:17:00.000000000 -0500 +++ /dev/null 2018-01-30 20:17:00.000000000 -0500 @@ -1,340 +0,0 @@ -/* - * Copyright (c) 1998, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.encoding; - -import java.util.StringTokenizer; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.NoSuchElementException; -import org.omg.CORBA.INITIALIZE; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -public final class CodeSetComponentInfo { - - /** - * CodeSetComponent is part of an IOR multi-component profile. Two - * instances constitute a CodeSetComponentInfo (one for char and one - * for wchar data) - */ - public static final class CodeSetComponent { - int nativeCodeSet; - int[] conversionCodeSets; - - public boolean equals( Object obj ) - { - if (this == obj) - return true ; - - if (!(obj instanceof CodeSetComponent)) - return false ; - - CodeSetComponent other = (CodeSetComponent)obj ; - - return (nativeCodeSet == other.nativeCodeSet) && - Arrays.equals( conversionCodeSets, other.conversionCodeSets ) ; - } - - public int hashCode() - { - int result = nativeCodeSet ; - for (int ctr=0; ctr= 4) { - - int b1 = array[offset] & 0x00FF; - int b2 = array[offset + 1] & 0x00FF; - - char marker = (char)((b1 << 8) | (b2 << 0)); - - return (marker == UTF16_BE_MARKER || marker == UTF16_LE_MARKER); - } else - return false; - } - - /** - * The current solution for dealing with UTF-16 in CORBA - * is that if our sun.io converter requires byte order markers, - * and then we see a CORBA wstring/wchar without them, we - * switch to the sun.io converter that doesn't require them. - */ - private void switchToConverter(OSFCodeSetRegistry.Entry newCodeSet) { - - // Use the getConverter method from our superclass. - btc = super.getConverter(newCodeSet.getName()); - } - } - - /** - * CTB converter factory for single byte or variable length encodings. - */ - public CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset) { - int alignment = (!codeset.isFixedWidth() ? - 1 : - codeset.getMaxBytesPerChar()); - - return new JavaCTBConverter(codeset, alignment); - } - - /** - * CTB converter factory for multibyte (mainly fixed) encodings. - * - * Because of the awkwardness with byte order markers and the possibility of - * using UCS-2, you must specify both the endianness of the stream as well as - * whether or not to use byte order markers if applicable. UCS-2 has no byte - * order markers. UTF-16 has optional markers. - * - * If you select useByteOrderMarkers, there is no guarantee that the encoding - * will use the endianness specified. - * - */ - public CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset, - boolean littleEndian, - boolean useByteOrderMarkers) { - - // UCS2 doesn't have byte order markers, and we're encoding it - // as UTF-16 since UCS2 isn't available in all Java platforms. - // They should be identical with only minor differences in - // negative cases. - if (codeset == OSFCodeSetRegistry.UCS_2) - return new UTF16CTBConverter(littleEndian); - - // We can write UTF-16 with or without a byte order marker. - if (codeset == OSFCodeSetRegistry.UTF_16) { - if (useByteOrderMarkers) - return new UTF16CTBConverter(); - else - return new UTF16CTBConverter(littleEndian); - } - - // Everything else uses the generic JavaCTBConverter. - // - // Variable width encodings are aligned on 1 byte boundaries. - // A fixed width encoding with a max. of 4 bytes/char should - // align on a 4 byte boundary. Note that UTF-16 is a special - // case because of the optional byte order marker, so it's - // handled above. - // - // This doesn't matter for GIOP 1.2 wchars and wstrings - // since the encoded bytes are treated as an encapsulation. - int alignment = (!codeset.isFixedWidth() ? - 1 : - codeset.getMaxBytesPerChar()); - - return new JavaCTBConverter(codeset, alignment); - } - - /** - * BTCConverter factory for single byte or variable width encodings. - */ - public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset) { - return new JavaBTCConverter(codeset); - } - - /** - * BTCConverter factory for fixed width multibyte encodings. - */ - public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset, - boolean defaultToLittleEndian) { - - if (codeset == OSFCodeSetRegistry.UTF_16 || - codeset == OSFCodeSetRegistry.UCS_2) { - - return new UTF16BTCConverter(defaultToLittleEndian); - } else { - return new JavaBTCConverter(codeset); - } - } - - /** - * Follows the code set negotiation algorithm in CORBA formal 99-10-07 13.7.2. - * - * Returns the proper negotiated OSF character encoding number or - * CodeSetConversion.FALLBACK_CODESET. - */ - private int selectEncoding(CodeSetComponentInfo.CodeSetComponent client, - CodeSetComponentInfo.CodeSetComponent server) { - - // A "null" value for the server's nativeCodeSet means that - // the server desired not to indicate one. We'll take that - // to mean that it wants the first thing in its conversion list. - // If it's conversion list is empty, too, then use the fallback - // codeset. - int serverNative = server.nativeCodeSet; - - if (serverNative == 0) { - if (server.conversionCodeSets.length > 0) - serverNative = server.conversionCodeSets[0]; - else - return CodeSetConversion.FALLBACK_CODESET; - } - - if (client.nativeCodeSet == serverNative) { - // Best case -- client and server don't have to convert - return serverNative; - } - - // Is this client capable of converting to the server's - // native code set? - for (int i = 0; i < client.conversionCodeSets.length; i++) { - if (serverNative == client.conversionCodeSets[i]) { - // The client will convert to the server's - // native code set. - return serverNative; - } - } - - // Is the server capable of converting to the client's - // native code set? - for (int i = 0; i < server.conversionCodeSets.length; i++) { - if (client.nativeCodeSet == server.conversionCodeSets[i]) { - // The server will convert to the client's - // native code set. - return client.nativeCodeSet; - } - } - - // See if there are any code sets that both the server and client - // support (giving preference to the server). The order - // of conversion sets is from most to least desired. - for (int i = 0; i < server.conversionCodeSets.length; i++) { - for (int y = 0; y < client.conversionCodeSets.length; y++) { - if (server.conversionCodeSets[i] == client.conversionCodeSets[y]) { - return server.conversionCodeSets[i]; - } - } - } - - // Before using the fallback codesets, the spec calls for a - // compatibility check on the native code sets. It doesn't make - // sense because loss free communication is always possible with - // UTF8 and UTF16, the fall back code sets. It's also a lot - // of work to implement. In the case of incompatibility, the - // spec says to throw a CODESET_INCOMPATIBLE exception. - - // Use the fallback - return CodeSetConversion.FALLBACK_CODESET; - } - - /** - * Perform the code set negotiation algorithm and come up with - * the two encodings to use. - */ - public CodeSetComponentInfo.CodeSetContext negotiate(CodeSetComponentInfo client, - CodeSetComponentInfo server) { - int charData - = selectEncoding(client.getCharComponent(), - server.getCharComponent()); - - if (charData == CodeSetConversion.FALLBACK_CODESET) { - charData = OSFCodeSetRegistry.UTF_8.getNumber(); - } - - int wcharData - = selectEncoding(client.getWCharComponent(), - server.getWCharComponent()); - - if (wcharData == CodeSetConversion.FALLBACK_CODESET) { - wcharData = OSFCodeSetRegistry.UTF_16.getNumber(); - } - - return new CodeSetComponentInfo.CodeSetContext(charData, - wcharData); - } - - // No one should instantiate a CodeSetConversion but the singleton - // instance method - private CodeSetConversion() {} - - // initialize-on-demand holder - private static class CodeSetConversionHolder { - static final CodeSetConversion csc = new CodeSetConversion() ; - } - - /** - * CodeSetConversion is a singleton, and this is the access point. - */ - public final static CodeSetConversion impl() { - return CodeSetConversionHolder.csc ; - } - - // Singleton instance - private static CodeSetConversion implementation; - - // Number used internally to indicate the fallback code - // set. - private static final int FALLBACK_CODESET = 0; - - // Provides a thread local cache for the sun.io - // converters. - private CodeSetCache cache = new CodeSetCache(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java 2018-01-30 20:17:01.000000000 -0500 +++ /dev/null 2018-01-30 20:17:01.000000000 -0500 @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2001, 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.corba.se.impl.encoding; - -import java.nio.ByteBuffer; -import org.omg.CORBA.CompletionStatus; -import com.sun.org.omg.SendingContext.CodeBase; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.BufferManagerFactory; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -import sun.corba.EncapsInputStreamFactory; -/** - * Encapsulations are supposed to explicitly define their - * code sets and GIOP version. The original resolution to issue 2784 - * said that the defaults were UTF-8 and UTF-16, but that was not - * agreed upon. - * - * These streams currently use CDR 1.2 with ISO8859-1 for char/string and - * UTF16 for wchar/wstring. If no byte order marker is available, - * the endianness of the encapsulation is used. - * - * When more encapsulations arise that have their own special code - * sets defined, we can make all constructors take such parameters. - */ -public class EncapsInputStream extends CDRInputStream -{ - private ORBUtilSystemException wrapper ; - - // corba/EncapsOutputStream - // corba/ORBSingleton - // iiop/ORB - public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] buf, - int size, boolean littleEndian, - GIOPVersion version) { - super(orb, ByteBuffer.wrap(buf), size, littleEndian, - version, Message.CDR_ENC_VERSION, - BufferManagerFactory.newBufferManagerRead( - BufferManagerFactory.GROW, - Message.CDR_ENC_VERSION, - (ORB)orb)); - - wrapper = ORBUtilSystemException.get( (ORB)orb, - CORBALogDomains.RPC_ENCODING ) ; - - performORBVersionSpecificInit(); - } - - public EncapsInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer, - int size, boolean littleEndian, - GIOPVersion version) { - super(orb, byteBuffer, size, littleEndian, - version, Message.CDR_ENC_VERSION, - BufferManagerFactory.newBufferManagerRead( - BufferManagerFactory.GROW, - Message.CDR_ENC_VERSION, - (com.sun.corba.se.spi.orb.ORB)orb)); - - performORBVersionSpecificInit(); - } - - // ior/IdentifiableBase - // ior/IIOPProfile - // corba/ORBSingleton - // iiop/ORB - public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size) - { - this(orb, data, size, GIOPVersion.V1_2); - } - - // corba/AnyImpl - public EncapsInputStream(EncapsInputStream eis) - { - super(eis); - - wrapper = ORBUtilSystemException.get( (ORB)(eis.orb()), - CORBALogDomains.RPC_ENCODING ) ; - - performORBVersionSpecificInit(); - } - - // CDREncapsCodec - // ServiceContext - // - // Assumes big endian (can use consumeEndian to read and set - // the endianness if it is an encapsulation with a byte order - // mark at the beginning) - public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size, GIOPVersion version) - { - this(orb, data, size, false, version); - } - - /** - * Full constructor with a CodeBase parameter useful for - * unmarshaling RMI-IIOP valuetypes (technically against the - * intention of an encapsulation, but necessary due to OMG - * issue 4795. Used by ServiceContexts. - */ - public EncapsInputStream(org.omg.CORBA.ORB orb, - byte[] data, - int size, - GIOPVersion version, - CodeBase codeBase) { - super(orb, - ByteBuffer.wrap(data), - size, - false, - version, Message.CDR_ENC_VERSION, - BufferManagerFactory.newBufferManagerRead( - BufferManagerFactory.GROW, - Message.CDR_ENC_VERSION, - (ORB)orb)); - - this.codeBase = codeBase; - - performORBVersionSpecificInit(); - } - - public CDRInputStream dup() { - return EncapsInputStreamFactory.newEncapsInputStream(this); - } - - protected CodeSetConversion.BTCConverter createCharBTCConverter() { - return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1); - } - - protected CodeSetConversion.BTCConverter createWCharBTCConverter() { - // Wide characters don't exist in GIOP 1.0 - if (getGIOPVersion().equals(GIOPVersion.V1_0)) - throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE); - - // In GIOP 1.1, we shouldn't have byte order markers. Take the order - // of the stream if we don't see them. - if (getGIOPVersion().equals(GIOPVersion.V1_1)) - return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16, - isLittleEndian()); - - // Assume anything else adheres to GIOP 1.2 requirements. - // - // Our UTF_16 converter will work with byte order markers, and if - // they aren't present, it will use the provided endianness. - // - // With no byte order marker, it's big endian in GIOP 1.2. - // formal 00-11-03 15.3.16. - return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16, - false); - } - - public CodeBase getCodeBase() { - return codeBase; - } - - private CodeBase codeBase; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java 2018-01-30 20:17:02.000000000 -0500 +++ /dev/null 2018-01-30 20:17:02.000000000 -0500 @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2001, 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.corba.se.impl.encoding; - -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.encoding.CDROutputStream; -import com.sun.corba.se.impl.encoding.BufferManagerWrite; -import com.sun.corba.se.impl.encoding.BufferManagerFactory; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -import sun.corba.EncapsInputStreamFactory; - -/** - * Encapsulations are supposed to explicitly define their - * code sets and GIOP version. The original resolution to issue 2784 - * said that the defaults were UTF-8 and UTF-16, but that was not - * agreed upon. - * - * These streams currently use CDR 1.2 with ISO8859-1 for char/string and - * UTF16 for wchar/wstring. If no byte order marker is available, - * the endianness of the encapsulation is used. - * - * When more encapsulations arise that have their own special code - * sets defined, we can make all constructors take such parameters. - */ -public class EncapsOutputStream extends CDROutputStream -{ - - // REVISIT - Right now, EncapsOutputStream's do not use - // pooled byte buffers. This is controlled by the following - // static constant. This should be re-factored such that - // the EncapsOutputStream doesn't know it's using pooled - // byte buffers. - final static boolean usePooledByteBuffers = false; - - // REVISIT - Right now, valuetypes in encapsulations will - // only use stream format version 1, which may create problems - // for service contexts or codecs (?). - - // corba/ORB - // corba/ORBSingleton - // iiop/ORB - // iiop/GIOPImpl - // corba/AnyImpl - public EncapsOutputStream(ORB orb) { - // GIOP version 1.2 with no fragmentation, big endian, - // UTF8 for char data and UTF-16 for wide char data; - this(orb, GIOPVersion.V1_2); - } - - // CDREncapsCodec - // - // REVISIT. A UTF-16 encoding with GIOP 1.1 will not work - // with byte order markers. - public EncapsOutputStream(ORB orb, GIOPVersion version) { - this(orb, version, false); - } - - // Used by IIOPProfileTemplate - // - public EncapsOutputStream(ORB orb, boolean isLittleEndian) { - this(orb, GIOPVersion.V1_2, isLittleEndian); - } - - public EncapsOutputStream(ORB orb, - GIOPVersion version, - boolean isLittleEndian) - { - super(orb, version, Message.CDR_ENC_VERSION, isLittleEndian, - BufferManagerFactory.newBufferManagerWrite( - BufferManagerFactory.GROW, - Message.CDR_ENC_VERSION, - orb), - ORBConstants.STREAM_FORMAT_VERSION_1, - usePooledByteBuffers); - } - - public org.omg.CORBA.portable.InputStream create_input_stream() { - freeInternalCaches(); - - return EncapsInputStreamFactory.newEncapsInputStream(orb(), - getByteBuffer(), - getSize(), - isLittleEndian(), - getGIOPVersion()); - } - - protected CodeSetConversion.CTBConverter createCharCTBConverter() { - return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1); - } - - protected CodeSetConversion.CTBConverter createWCharCTBConverter() { - if (getGIOPVersion().equals(GIOPVersion.V1_0)) - throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE); - - // In the case of GIOP 1.1, we take the byte order of the stream and don't - // use byte order markers since we're limited to a 2 byte fixed width encoding. - if (getGIOPVersion().equals(GIOPVersion.V1_1)) - return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16, - isLittleEndian(), - false); - - // Assume anything else meets GIOP 1.2 requirements - // - // Use byte order markers? If not, use big endian in GIOP 1.2. - // (formal 00-11-03 15.3.16) - - boolean useBOM = ((ORB)orb()).getORBData().useByteOrderMarkersInEncapsulations(); - - return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16, - false, - useBOM); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java 2018-01-30 20:17:03.000000000 -0500 +++ /dev/null 2018-01-30 20:17:03.000000000 -0500 @@ -1,1083 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.encoding; - -import java.io.Serializable; -import java.io.ObjectInputStream; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.nio.ByteBuffer; -import java.math.BigDecimal; -import java.util.LinkedList; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter; -import com.sun.corba.se.spi.presentation.rmi.PresentationManager; -import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults; - -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.corba.TypeCodeImpl; -import com.sun.corba.se.impl.util.RepositoryId; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; - -import org.omg.CORBA.Any; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.portable.IDLEntity; - -/** - * Implementation class that uses Java serialization for input streams. - * This assumes a GIOP version 1.2 message format. - * - * This class uses a ByteArrayInputStream as the underlying buffer. The - * first 16 bytes are directly read out of the underlying buffer. This allows - * [GIOPHeader (12 bytes) + requestID (4 bytes)] to be read as bytes. - * Subsequent write operations on this output stream object uses - * ObjectInputStream class to read into the buffer. This allows unmarshaling - * complex types and graphs using the ObjectInputStream implementation. - * - * Note, this class assumes a GIOP 1.2 style header. Further, the first - * 12 bytes, that is, the GIOPHeader is read directly from the received - * message, before this stream object is called. So, this class effectively - * reads only the requestID (4 bytes) directly, and uses the - * ObjectInputStream for further unmarshaling. - * - * @author Ram Jeyaraman - */ -public class IDLJavaSerializationInputStream extends CDRInputStreamBase { - - private ORB orb; - private int bufSize; - private ByteBuffer buffer; - private byte encodingVersion; - private ObjectInputStream is; - private _ByteArrayInputStream bis; - private BufferManagerRead bufferManager; - - // [GIOPHeader(12) + requestID(4)] bytes - private final int directReadLength = Message.GIOPMessageHeaderLength + 4; - - // Used for mark / reset operations. - private boolean markOn; - private int peekIndex, peekCount; - private LinkedList markedItemQ = new LinkedList(); - - protected ORBUtilSystemException wrapper; - - class _ByteArrayInputStream extends ByteArrayInputStream { - - _ByteArrayInputStream(byte[] buf) { - super(buf); - } - - int getPosition() { - return this.pos; - } - - void setPosition(int value) { - if (value < 0 || value > count) { - throw new IndexOutOfBoundsException(); - } - this.pos = value; - } - } - - class MarshalObjectInputStream extends ObjectInputStream { - - ORB orb; - - MarshalObjectInputStream(java.io.InputStream out, ORB orb) - throws IOException { - - super(out); - this.orb = orb; - - java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { - // needs SerializablePermission("enableSubstitution") - enableResolveObject(true); - return null; - } - } - ); - } - - /** - * Connect the Stub to the ORB. - */ - protected final Object resolveObject(Object obj) throws IOException { - try { - if (StubAdapter.isStub(obj)) { - StubAdapter.connect(obj, orb); - } - } catch (java.rmi.RemoteException re) { - IOException ie = new IOException("resolveObject failed"); - ie.initCause(re); - throw ie; - } - return obj; - } - } - - public IDLJavaSerializationInputStream(byte encodingVersion) { - super(); - this.encodingVersion = encodingVersion; - } - - public void init(org.omg.CORBA.ORB orb, - ByteBuffer byteBuffer, - int bufSize, - boolean littleEndian, - BufferManagerRead bufferManager) { - this.orb = (ORB) orb; - this.bufSize = bufSize; - this.bufferManager = bufferManager; - buffer = byteBuffer; - wrapper = - ORBUtilSystemException.get((ORB)orb, CORBALogDomains.RPC_ENCODING); - - byte[] buf; - if (buffer.hasArray()) { - buf = buffer.array(); - } else { - buf = new byte[bufSize]; - buffer.get(buf); - } - // Note: at this point, the buffer position is zero. The setIndex() - // method call can be used to set a desired read index. - bis = new _ByteArrayInputStream(buf); - } - - // Called from read_octet or read_long or read_ulong method. - private void initObjectInputStream() { - //System.out.print(" is "); - if (is != null) { - throw wrapper.javaStreamInitFailed(); - } - try { - is = new MarshalObjectInputStream(bis, orb); - } catch (Exception e) { - throw wrapper.javaStreamInitFailed(e); - } - } - - // org.omg.CORBA.portable.InputStream - - // Primitive types. - - public boolean read_boolean() { - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return ((Boolean)markedItemQ.removeFirst()).booleanValue(); - } - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return ((Boolean)markedItemQ.get(peekIndex++)).booleanValue(); - } - try { - boolean value = is.readBoolean(); - if (markOn) { // enqueue - markedItemQ.addLast(Boolean.valueOf(value)); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_boolean"); - } - } - - public char read_char() { - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return ((Character)markedItemQ.removeFirst()).charValue(); - } - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return ((Character)markedItemQ.get(peekIndex++)).charValue(); - } - try { - char value = is.readChar(); - if (markOn) { // enqueue - markedItemQ.addLast(new Character(value)); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_char"); - } - } - - public char read_wchar() { - return this.read_char(); - } - - public byte read_octet() { - - // check if size < [ GIOPHeader(12) + requestID(4)] bytes - if (bis.getPosition() < directReadLength) { - byte b = (byte) bis.read(); - if (bis.getPosition() == directReadLength) { - initObjectInputStream(); - } - return b; - } - - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return ((Byte)markedItemQ.removeFirst()).byteValue(); - } - - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return ((Byte)markedItemQ.get(peekIndex++)).byteValue(); - } - - try { - byte value = is.readByte(); - if (markOn) { // enqueue - //markedItemQ.addLast(Byte.valueOf(value)); // only in JDK 1.5 - markedItemQ.addLast(new Byte(value)); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_octet"); - } - } - - public short read_short() { - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return ((Short)markedItemQ.removeFirst()).shortValue(); - } - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return ((Short)markedItemQ.get(peekIndex++)).shortValue(); - } - - try { - short value = is.readShort(); - if (markOn) { // enqueue - markedItemQ.addLast(new Short(value)); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_short"); - } - } - - public short read_ushort() { - return this.read_short(); - } - - public int read_long() { - - // check if size < [ GIOPHeader(12) + requestID(4)] bytes - if (bis.getPosition() < directReadLength) { - - // Use big endian (network byte order). This is fixed. - // Both the writer and reader use the same byte order. - int b1 = (bis.read() << 24) & 0xFF000000; - int b2 = (bis.read() << 16) & 0x00FF0000; - int b3 = (bis.read() << 8) & 0x0000FF00; - int b4 = (bis.read() << 0) & 0x000000FF; - - if (bis.getPosition() == directReadLength) { - initObjectInputStream(); - } else if (bis.getPosition() > directReadLength) { - // Cannot happen. All direct reads are contained - // within the first 16 bytes. - wrapper.javaSerializationException("read_long"); - } - - return (b1 | b2 | b3 | b4); - } - - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return ((Integer)markedItemQ.removeFirst()).intValue(); - } - - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return ((Integer)markedItemQ.get(peekIndex++)).intValue(); - } - - try { - int value = is.readInt(); - if (markOn) { // enqueue - markedItemQ.addLast(new Integer(value)); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_long"); - } - } - - public int read_ulong() { - return this.read_long(); - } - - public long read_longlong() { - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return ((Long)markedItemQ.removeFirst()).longValue(); - } - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return ((Long)markedItemQ.get(peekIndex++)).longValue(); - } - - try { - long value = is.readLong(); - if (markOn) { // enqueue - markedItemQ.addLast(new Long(value)); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_longlong"); - } - } - - public long read_ulonglong() { - return read_longlong(); - } - - public float read_float() { - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return ((Float)markedItemQ.removeFirst()).floatValue(); - } - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return ((Float)markedItemQ.get(peekIndex++)).floatValue(); - } - - try { - float value = is.readFloat(); - if (markOn) { // enqueue - markedItemQ.addLast(new Float(value)); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_float"); - } - } - - public double read_double() { - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return ((Double)markedItemQ.removeFirst()).doubleValue(); - } - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return ((Double)markedItemQ.get(peekIndex++)).doubleValue(); - } - - try { - double value = is.readDouble(); - if (markOn) { // enqueue - markedItemQ.addLast(new Double(value)); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_double"); - } - } - - // String types. - - public String read_string() { - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return (String) markedItemQ.removeFirst(); - } - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return (String) markedItemQ.get(peekIndex++); - } - try { - String value = is.readUTF(); - if (markOn) { // enqueue - markedItemQ.addLast(value); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_string"); - } - } - - public String read_wstring() { - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return (String) markedItemQ.removeFirst(); - } - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return (String) markedItemQ.get(peekIndex++); - } - try { - String value = (String) is.readObject(); - if (markOn) { // enqueue - markedItemQ.addLast(value); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_wstring"); - } - } - - // Array types. - - public void read_boolean_array(boolean[] value, int offset, int length){ - for(int i = 0; i < length; i++) { - value[i+offset] = read_boolean(); - } - } - - public void read_char_array(char[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_char(); - } - } - - public void read_wchar_array(char[] value, int offset, int length) { - read_char_array(value, offset, length); - } - - public void read_octet_array(byte[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_octet(); - } - /* // Cannot use this efficient read due to mark/reset support. - try { - while (length > 0) { - int n = is.read(value, offset, length); - offset += n; - length -= n; - } - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_octet_array"); - } - */ - } - - public void read_short_array(short[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_short(); - } - } - - public void read_ushort_array(short[] value, int offset, int length) { - read_short_array(value, offset, length); - } - - public void read_long_array(int[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_long(); - } - } - - public void read_ulong_array(int[] value, int offset, int length) { - read_long_array(value, offset, length); - } - - public void read_longlong_array(long[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_longlong(); - } - } - - public void read_ulonglong_array(long[] value, int offset, int length) { - read_longlong_array(value, offset, length); - } - - public void read_float_array(float[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_float(); - } - } - - public void read_double_array(double[] value, int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_double(); - } - } - - // Complex types. - - public org.omg.CORBA.Object read_Object() { - return read_Object(null); - } - - public TypeCode read_TypeCode() { - TypeCodeImpl tc = new TypeCodeImpl(orb); - tc.read_value(parent); - return tc; - } - - public Any read_any() { - - Any any = orb.create_any(); - TypeCodeImpl tc = new TypeCodeImpl(orb); - - // read off the typecode - - // REVISIT We could avoid this try-catch if we could peek the typecode - // kind off this stream and see if it is a tk_value. - // Looking at the code we know that for tk_value the Any.read_value() - // below ignores the tc argument anyway (except for the kind field). - // But still we would need to make sure that the whole typecode, - // including encapsulations, is read off. - try { - tc.read_value(parent); - } catch (org.omg.CORBA.MARSHAL ex) { - if (tc.kind().value() != org.omg.CORBA.TCKind._tk_value) { - throw ex; - } - // We can be sure that the whole typecode encapsulation has been - // read off. - ex.printStackTrace(); - } - - // read off the value of the any. - any.read_value(parent, tc); - - return any; - } - - public Principal read_Principal() { - // We don't need an implementation for this method, since principal - // is absent in GIOP version 1.2 or above. - int len = read_long(); - byte[] pvalue = new byte[len]; - read_octet_array(pvalue,0,len); - Principal p = new com.sun.corba.se.impl.corba.PrincipalImpl(); - p.name(pvalue); - return p; - } - - public BigDecimal read_fixed() { - return new BigDecimal(read_fixed_buffer().toString()); - } - - // Each octet contains (up to) two decimal digits. If the fixed type has - // an odd number of decimal digits, then the representation - // begins with the first (most significant) digit. - // Otherwise, this first half-octet is all zero, and the first digit - // is in the second half-octet. - // The sign configuration, in the last half-octet of the representation, - // is 0xD for negative numbers and 0xC for positive and zero values. - private StringBuffer read_fixed_buffer() { - StringBuffer buffer = new StringBuffer(64); - byte doubleDigit; - int firstDigit; - int secondDigit; - boolean wroteFirstDigit = false; - boolean more = true; - while (more) { - doubleDigit = read_octet(); - firstDigit = (int)((doubleDigit & 0xf0) >> 4); - secondDigit = (int)(doubleDigit & 0x0f); - if (wroteFirstDigit || firstDigit != 0) { - buffer.append(Character.forDigit(firstDigit, 10)); - wroteFirstDigit = true; - } - if (secondDigit == 12) { - // positive number or zero - if ( ! wroteFirstDigit) { - // zero - return new StringBuffer("0.0"); - } else { - // positive number - // done - } - more = false; - } else if (secondDigit == 13) { - // negative number - buffer.insert(0, '-'); - more = false; - } else { - buffer.append(Character.forDigit(secondDigit, 10)); - wroteFirstDigit = true; - } - } - return buffer; - } - - public org.omg.CORBA.Object read_Object(java.lang.Class clz) { - - // In any case, we must first read the IOR. - IOR ior = IORFactories.makeIOR(parent) ; - if (ior.isNil()) { - return null; - } - - PresentationManager.StubFactoryFactory sff = - ORB.getStubFactoryFactory(); - String codeBase = ior.getProfile().getCodebase(); - PresentationManager.StubFactory stubFactory = null; - - if (clz == null) { - RepositoryId rid = RepositoryId.cache.getId(ior.getTypeId() ); - String className = rid.getClassName(); - boolean isIDLInterface = rid.isIDLType(); - - if (className == null || className.equals( "" )) { - stubFactory = null; - } else { - try { - stubFactory = sff.createStubFactory(className, - isIDLInterface, codeBase, (Class) null, - (ClassLoader) null); - } catch (Exception exc) { - // Could not create stubFactory, so use null. - // XXX stubFactory handling is still too complex: - // Can we resolve the stubFactory question once in - // a single place? - stubFactory = null ; - } - } - } else if (StubAdapter.isStubClass(clz)) { - stubFactory = PresentationDefaults.makeStaticStubFactory(clz); - } else { - // clz is an interface class - boolean isIDL = IDLEntity.class.isAssignableFrom(clz); - - stubFactory = sff.createStubFactory( - clz.getName(), isIDL, codeBase, clz, clz.getClassLoader()); - } - - return CDRInputStream_1_0.internalIORToObject(ior, stubFactory, orb); - } - - public org.omg.CORBA.ORB orb() { - return this.orb; - } - - // org.omg.CORBA_2_3.portable.InputStream - - public java.io.Serializable read_value() { - if (!markOn && !(markedItemQ.isEmpty())) { // dequeue - return (Serializable) markedItemQ.removeFirst(); - } - if (markOn && !(markedItemQ.isEmpty()) && - (peekIndex < peekCount)) { // peek - return (Serializable) markedItemQ.get(peekIndex++); - } - try { - Serializable value = (java.io.Serializable) is.readObject(); - if (markOn) { // enqueue - markedItemQ.addLast(value); - } - return value; - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "read_value"); - } - } - - public java.io.Serializable read_value(java.lang.Class clz) { - return read_value(); - } - - public java.io.Serializable read_value( - org.omg.CORBA.portable.BoxedValueHelper factory) { - return read_value(); - } - - public java.io.Serializable read_value(java.lang.String rep_id) { - return read_value(); - } - - public java.io.Serializable read_value(java.io.Serializable value) { - return read_value(); - } - - public java.lang.Object read_abstract_interface() { - return read_abstract_interface(null); - } - - public java.lang.Object read_abstract_interface(java.lang.Class clz) { - boolean isObject = read_boolean(); - if (isObject) { - return read_Object(clz); - } else { - return read_value(); - } - } - - // com.sun.corba.se.impl.encoding.MarshalInputStream - public void consumeEndian() { - throw wrapper.giopVersionError(); - } - - public int getPosition() { - try { - return bis.getPosition(); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "getPosition"); - } - } - - // org.omg.CORBA.DataInputStream - public java.lang.Object read_Abstract() { - return read_abstract_interface(); - } - - public java.io.Serializable read_Value() { - return read_value(); - } - - public void read_any_array (org.omg.CORBA.AnySeqHolder seq, - int offset, int length) { - read_any_array(seq.value, offset, length); - } - - private final void read_any_array(org.omg.CORBA.Any[] value, - int offset, int length) { - for(int i=0; i < length; i++) { - value[i+offset] = read_any(); - } - } - - public void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, - int offset, int length){ - read_boolean_array(seq.value, offset, length); - } - - public void read_char_array (org.omg.CORBA.CharSeqHolder seq, - int offset, int length){ - read_char_array(seq.value, offset, length); - } - - public void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, - int offset, int length){ - read_wchar_array(seq.value, offset, length); - } - - public void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, - int offset, int length){ - read_octet_array(seq.value, offset, length); - } - - public void read_short_array (org.omg.CORBA.ShortSeqHolder seq, - int offset, int length){ - read_short_array(seq.value, offset, length); - } - - public void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, - int offset, int length){ - read_ushort_array(seq.value, offset, length); - } - - public void read_long_array (org.omg.CORBA.LongSeqHolder seq, - int offset, int length){ - read_long_array(seq.value, offset, length); - } - - public void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, - int offset, int length){ - read_ulong_array(seq.value, offset, length); - } - - public void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, - int offset, int length){ - read_ulonglong_array(seq.value, offset, length); - } - - public void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, - int offset, int length){ - read_longlong_array(seq.value, offset, length); - } - - public void read_float_array (org.omg.CORBA.FloatSeqHolder seq, - int offset, int length){ - read_float_array(seq.value, offset, length); - } - - public void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, - int offset, int length){ - read_double_array(seq.value, offset, length); - } - - // org.omg.CORBA.portable.ValueBase - - public String[] _truncatable_ids() { - throw wrapper.giopVersionError(); - } - - // java.io.InputStream - // REVISIT - should we make these throw UnsupportedOperationExceptions? - // Right now, they'll go up to the java.io versions! - - // public int read(byte b[]) throws IOException; - // public int read(byte b[], int off, int len) throws IOException - // public long skip(long n) throws IOException; - // public int available() throws IOException; - // public void close() throws IOException; - - public void mark(int readLimit) { - // Nested mark disallowed. - // Further, mark is not supported until first 16 bytes are read. - if (markOn || is == null) { - throw wrapper.javaSerializationException("mark"); - } - markOn = true; - if (!(markedItemQ.isEmpty())) { - peekIndex = 0; - peekCount = markedItemQ.size(); - } - /* - // Note: only ByteArrayInputStream supports mark/reset. - if (is == null || is.markSupported() == false) { - throw wrapper.javaSerializationException("mark"); - } - is.mark(readLimit); - */ - } - - public void reset() { - markOn = false; - peekIndex = 0; - peekCount = 0; - /* - // Note: only ByteArrayInputStream supports mark/reset. - if (is == null || is.markSupported() == false) { - throw wrapper.javaSerializationException("mark"); - } - try { - is.reset(); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "reset"); - } - */ - } - - // This should return false so that outside users (people using the JDK) - // don't have any guarantees that mark/reset will work in their - // custom marshaling code. This is necessary since they could do things - // like expect obj1a == obj1b in the following code: - // - // is.mark(10000); - // Object obj1a = is.readObject(); - // is.reset(); - // Object obj1b = is.readObject(); - // - public boolean markSupported() { - return true; - } - - // Needed by AnyImpl and ServiceContexts - public CDRInputStreamBase dup() { - - CDRInputStreamBase result = null ; - - try { - result = (CDRInputStreamBase) this.getClass().newInstance(); - } catch (Exception e) { - throw wrapper.couldNotDuplicateCdrInputStream(e); - } - - result.init(this.orb, this.buffer, this.bufSize, false, null); - - // Set the buffer position. - ((IDLJavaSerializationInputStream)result).skipBytes(getPosition()); - - // Set mark related data. - ((IDLJavaSerializationInputStream)result). - setMarkData(markOn, peekIndex, peekCount, - (LinkedList) markedItemQ.clone()); - - return result; - } - - // Used exclusively by the dup() method. - void skipBytes(int len) { - try { - is.skipBytes(len); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "skipBytes"); - } - } - - // Used exclusively by the dup() method. - void setMarkData(boolean markOn, int peekIndex, int peekCount, - LinkedList markedItemQ) { - this.markOn = markOn; - this.peekIndex = peekIndex; - this.peekCount = peekCount; - this.markedItemQ = markedItemQ; - } - - // Needed by TCUtility - public java.math.BigDecimal read_fixed(short digits, short scale) { - // digits isn't really needed here - StringBuffer buffer = read_fixed_buffer(); - if (digits != buffer.length()) - throw wrapper.badFixed( new Integer(digits), - new Integer(buffer.length()) ) ; - buffer.insert(digits - scale, '.'); - return new BigDecimal(buffer.toString()); - } - - // Needed by TypeCodeImpl - public boolean isLittleEndian() { - throw wrapper.giopVersionError(); - } - - // Needed by request and reply messages for GIOP versions >= 1.2 only. - void setHeaderPadding(boolean headerPadding) { - // no-op. We don't care about body alignment while using - // Java serialization. What the GIOP spec states does not apply here. - } - - // Needed by IIOPInputStream and other subclasses - - public ByteBuffer getByteBuffer() { - throw wrapper.giopVersionError(); - } - - public void setByteBuffer(ByteBuffer byteBuffer) { - throw wrapper.giopVersionError(); - } - - public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) { - throw wrapper.giopVersionError(); - } - - public int getBufferLength() { - return bufSize; - } - - public void setBufferLength(int value) { - // this is redundant, since buffer size was already specified - // as part of the init call. So, ignore. - } - - public int getIndex() { - return bis.getPosition(); - } - - public void setIndex(int value) { - try { - bis.setPosition(value); - } catch (IndexOutOfBoundsException e) { - throw wrapper.javaSerializationException(e, "setIndex"); - } - } - - public void orb(org.omg.CORBA.ORB orb) { - this.orb = (ORB) orb; - } - - public BufferManagerRead getBufferManager() { - return bufferManager; - } - - public GIOPVersion getGIOPVersion() { - return GIOPVersion.V1_2; - } - - com.sun.org.omg.SendingContext.CodeBase getCodeBase() { - return parent.getCodeBase(); - } - - void printBuffer() { - byte[] buf = this.buffer.array(); - - System.out.println("+++++++ Input Buffer ++++++++"); - System.out.println(); - System.out.println("Current position: " + getPosition()); - System.out.println("Total length : " + this.bufSize); - System.out.println(); - - char[] charBuf = new char[16]; - - try { - - for (int i = 0; i < buf.length; i += 16) { - - int j = 0; - - // For every 16 bytes, there is one line - // of output. First, the hex output of - // the 16 bytes with each byte separated - // by a space. - while (j < 16 && j + i < buf.length) { - int k = buf[i + j]; - if (k < 0) - k = 256 + k; - String hex = Integer.toHexString(k); - if (hex.length() == 1) - hex = "0" + hex; - System.out.print(hex + " "); - j++; - } - - // Add any extra spaces to align the - // text column in case we didn't end - // at 16 - while (j < 16) { - System.out.print(" "); - j++; - } - - // Now output the ASCII equivalents. Non-ASCII - // characters are shown as periods. - int x = 0; - - while (x < 16 && x + i < buf.length) { - if (ORBUtility.isPrintable((char)buf[i + x])) { - charBuf[x] = (char) buf[i + x]; - } else { - charBuf[x] = '.'; - } - x++; - } - System.out.println(new String(charBuf, 0, x)); - } - } catch (Throwable t) { - t.printStackTrace(); - } - System.out.println("++++++++++++++++++++++++++++++"); - } - - void alignOnBoundary(int octetBoundary) { - throw wrapper.giopVersionError(); - } - - void performORBVersionSpecificInit() { - // No-op. - } - - public void resetCodeSetConverters() { - // No-op. - } - - // ValueInputStream ------------------------- - - public void start_value() { - throw wrapper.giopVersionError(); - } - - public void end_value() { - throw wrapper.giopVersionError(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java 2018-01-30 20:17:04.000000000 -0500 +++ /dev/null 2018-01-30 20:17:04.000000000 -0500 @@ -1,798 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.encoding; - -import java.io.IOException; -import java.io.ObjectOutputStream; -import java.io.ByteArrayOutputStream; - -import java.nio.ByteBuffer; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter; - -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.corba.TypeCodeImpl; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; - -import org.omg.CORBA.Any; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.CompletionStatus; - -/** - * Implementation class that uses Java serialization for output streams. - * This assumes a GIOP version 1.2 message format. - * - * This class uses a ByteArrayOutputStream as the underlying buffer. The - * first 16 bytes are direct writes into the underlying buffer. This allows - * [GIOPHeader (12 bytes) + requestID (4 bytes)] to be written as bytes. - * Subsequent write operations on this output stream object uses - * ObjectOutputStream class to write into the buffer. This allows marshaling - * complex types and graphs using the ObjectOutputStream implementation. - * - * Note, this class assumes a GIOP 1.2 style header. Note, we expect that the - * first 16 bytes are written only using the write_octet, write_long or - * write_ulong method calls. - * - * @author Ram Jeyaraman - */ -final class IDLJavaSerializationOutputStream extends CDROutputStreamBase { - - private ORB orb; - private byte encodingVersion; - private ObjectOutputStream os; - private _ByteArrayOutputStream bos; - private BufferManagerWrite bufferManager; - - // [GIOPHeader(12) + requestID(4)] bytes - private final int directWriteLength = Message.GIOPMessageHeaderLength + 4; - - protected ORBUtilSystemException wrapper; - - class _ByteArrayOutputStream extends ByteArrayOutputStream { - - _ByteArrayOutputStream(int initialSize) { - super(initialSize); - } - - byte[] getByteArray() { - return this.buf; - } - } - - class MarshalObjectOutputStream extends ObjectOutputStream { - - ORB orb; - - MarshalObjectOutputStream(java.io.OutputStream out, ORB orb) - throws IOException { - - super(out); - this.orb = orb; - java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Object run() { - // needs SerializablePermission("enableSubstitution") - enableReplaceObject(true); - return null; - } - } - ); - } - - /** - * Checks for objects that are instances of java.rmi.Remote - * that need to be serialized as proxy (Stub) objects. - */ - protected final Object replaceObject(Object obj) throws IOException { - try { - if ((obj instanceof java.rmi.Remote) && - !(StubAdapter.isStub(obj))) { - return Utility.autoConnect(obj, orb, true); - } - } catch (Exception e) { - IOException ie = new IOException("replaceObject failed"); - ie.initCause(e); - throw ie; - } - return obj; - } - } - - public IDLJavaSerializationOutputStream(byte encodingVersion) { - super(); - this.encodingVersion = encodingVersion; - } - - public void init(org.omg.CORBA.ORB orb, boolean littleEndian, - BufferManagerWrite bufferManager, - byte streamFormatVersion, - boolean usePooledByteBuffers) { - this.orb = (ORB) orb; - this.bufferManager = bufferManager; - wrapper = ORBUtilSystemException.get((ORB) orb, - CORBALogDomains.RPC_ENCODING); - bos = - new _ByteArrayOutputStream(ORBConstants.GIOP_DEFAULT_BUFFER_SIZE); - } - - // Called from read_octet or read_long or read_ulong method. - private void initObjectOutputStream() { - //System.out.print(" os "); - if (os != null) { - throw wrapper.javaStreamInitFailed(); - } - try { - os = new MarshalObjectOutputStream(bos, orb); - } catch (Exception e) { - throw wrapper.javaStreamInitFailed(e); - } - } - - // org.omg.CORBA.portable.OutputStream - - // Primitive types. - - public final void write_boolean(boolean value) { - try { - os.writeBoolean(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_boolean"); - } - } - - public final void write_char(char value) { - try { - os.writeChar(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_char"); - } - } - - public final void write_wchar(char value) { - this.write_char(value); - } - - public final void write_octet(byte value) { - - // check if size < [ GIOPHeader(12) + requestID(4)] bytes - if (bos.size() < directWriteLength) { - bos.write(value); // direct write. - if (bos.size() == directWriteLength) { - initObjectOutputStream(); - } - return; - } - - try { - os.writeByte(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_octet"); - } - } - - public final void write_short(short value) { - try { - os.writeShort(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_short"); - } - } - - public final void write_ushort(short value) { - this.write_short(value); - } - - public final void write_long(int value) { - - // check if size < [ GIOPHeader(12) + requestID(4)] bytes - if (bos.size() < directWriteLength) { - - // Use big endian (network byte order). This is fixed. - // Both the writer and reader use the same byte order. - bos.write((byte)((value >>> 24) & 0xFF)); - bos.write((byte)((value >>> 16) & 0xFF)); - bos.write((byte)((value >>> 8) & 0xFF)); - bos.write((byte)((value >>> 0) & 0xFF)); - - if (bos.size() == directWriteLength) { - initObjectOutputStream(); - } else if (bos.size() > directWriteLength) { - // Cannot happen. All direct writes are contained - // within the first 16 bytes. - wrapper.javaSerializationException("write_long"); - } - return; - } - - try { - os.writeInt(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_long"); - } - } - - public final void write_ulong(int value) { - this.write_long(value); - } - - public final void write_longlong(long value) { - try { - os.writeLong(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_longlong"); - } - } - - public final void write_ulonglong(long value) { - this.write_longlong(value); - } - - public final void write_float(float value) { - try { - os.writeFloat(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_float"); - } - } - - public final void write_double(double value) { - try { - os.writeDouble(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_double"); - } - } - - // String types. - - public final void write_string(String value) { - try { - os.writeUTF(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_string"); - } - } - - public final void write_wstring(String value) { - try { - os.writeObject(value); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_wstring"); - } - } - - // Array types. - - public final void write_boolean_array(boolean[] value, - int offset, int length) { - for (int i = 0; i < length; i++) { - write_boolean(value[offset + i]); - } - } - - public final void write_char_array(char[] value, int offset, int length) { - for (int i = 0; i < length; i++) { - write_char(value[offset + i]); - } - } - - public final void write_wchar_array(char[] value, int offset, int length) { - write_char_array(value, offset, length); - } - - public final void write_octet_array(byte[] value, int offset, int length) { - try { - os.write(value, offset, length); - } catch (Exception e) { - throw wrapper.javaSerializationException(e, "write_octet_array"); - } - } - - public final void write_short_array(short[] value, - int offset, int length) { - for (int i = 0; i < length; i++) { - write_short(value[offset + i]); - } - } - - public final void write_ushort_array(short[] value, - int offset, int length){ - write_short_array(value, offset, length); - } - - public final void write_long_array(int[] value, int offset, int length) { - for (int i = 0; i < length; i++) { - write_long(value[offset + i]); - } - } - - public final void write_ulong_array(int[] value, int offset, int length) { - write_long_array(value, offset, length); - } - - public final void write_longlong_array(long[] value, - int offset, int length) { - for (int i = 0; i < length; i++) { - write_longlong(value[offset + i]); - } - } - - public final void write_ulonglong_array(long[] value, - int offset,int length) { - write_longlong_array(value, offset, length); - } - - public final void write_float_array(float[] value, - int offset, int length) { - for (int i = 0; i < length; i++) { - write_float(value[offset + i]); - } - } - - public final void write_double_array(double[] value, - int offset, int length) { - for (int i = 0; i < length; i++) { - write_double(value[offset + i]); - } - } - - // Complex types (objects and graphs). - - public final void write_Object(org.omg.CORBA.Object value) { - if (value == null) { - IOR nullIOR = IORFactories.makeIOR(orb); - nullIOR.write(parent); - return; - } - // IDL to Java formal 01-06-06 1.21.4.2 - if (value instanceof org.omg.CORBA.LocalObject) { - throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE); - } - IOR ior = ORBUtility.connectAndGetIOR(orb, value); - ior.write(parent); - return; - } - - public final void write_TypeCode(TypeCode tc) { - if (tc == null) { - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - } - TypeCodeImpl tci; - if (tc instanceof TypeCodeImpl) { - tci = (TypeCodeImpl) tc; - } else { - tci = new TypeCodeImpl(orb, tc); - } - tci.write_value((org.omg.CORBA_2_3.portable.OutputStream) parent); - } - - public final void write_any(Any any) { - if (any == null) { - throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE); - } - write_TypeCode(any.type()); - any.write_value(parent); - } - - public final void write_Principal(Principal p) { - // We don't need an implementation for this method, since principal - // is absent in GIOP version 1.2 or above. - write_long(p.name().length); - write_octet_array(p.name(), 0, p.name().length); - } - - public final void write_fixed(java.math.BigDecimal bigDecimal) { - // This string might contain sign and/or dot - this.write_fixed(bigDecimal.toString(), bigDecimal.signum()); - } - - // The string may contain a sign and dot - private void write_fixed(String string, int signum) { - - int stringLength = string.length(); - - // Each octet contains (up to) two decimal digits. - byte doubleDigit = 0; - char ch; - byte digit; - - // First calculate the string length without optional sign and dot. - int numDigits = 0; - for (int i=0; i= 1.2 only. - public void setHeaderPadding(boolean headerPadding) { - // no-op. We don't care about body alignment while using - // Java serialization. What the GIOP spec states does not apply here. - } - - // ValueOutputStream ----------------------------- - - public void start_value(String rep_id) { - throw wrapper.giopVersionError(); - } - - public void end_value() { - throw wrapper.giopVersionError(); - } - - // java.io.OutputStream - - // Note: These methods are defined in the super class and accessible. - - //public abstract void write(byte b[]) throws IOException; - //public abstract void write(byte b[], int off, int len) - // throws IOException; - //public abstract void flush() throws IOException; - //public abstract void close() throws IOException; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarkAndResetHandler.java 2018-01-30 20:17:04.000000000 -0500 +++ /dev/null 2018-01-30 20:17:04.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.encoding; - - -/** - * Defines an abstraction for a RestorableInputStream to - * implement mark/reset. - */ -interface MarkAndResetHandler -{ - void mark(RestorableInputStream inputStream); - - void fragmentationOccured(ByteBufferWithInfo newFragment); - - void reset(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalInputStream.java 2018-01-30 20:17:05.000000000 -0500 +++ /dev/null 2018-01-30 20:17:05.000000000 -0500 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 1998, 2003, 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.corba.se.impl.encoding; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -public interface MarshalInputStream { - public boolean read_boolean(); - public char read_char(); - public char read_wchar(); - public byte read_octet(); - public short read_short(); - public short read_ushort(); - public int read_long(); - public int read_ulong(); - public long read_longlong(); - public long read_ulonglong(); - public float read_float(); - public double read_double(); - public String read_string(); - public String read_wstring(); - - public void read_boolean_array(boolean[] value, int offset, int length); - public void read_char_array(char[] value, int offset, int length); - public void read_wchar_array(char[] value, int offset, int length); - public void read_octet_array(byte[] value, int offset, int length); - public void read_short_array(short[] value, int offset, int length); - public void read_ushort_array(short[] value, int offset, int length); - public void read_long_array(int[] value, int offset, int length); - public void read_ulong_array(int[] value, int offset, int length); - public void read_longlong_array(long[] value, int offset, int length); - public void read_ulonglong_array(long[] value, int offset, int length); - public void read_float_array(float[] value, int offset, int length); - public void read_double_array(double[] value, int offset, int length); - - public org.omg.CORBA.Object read_Object(); - public TypeCode read_TypeCode(); - public Any read_any(); - public Principal read_Principal(); - - /* - * The methods necessary to support RMI - */ - public org.omg.CORBA.Object read_Object(Class stubClass); - public java.io.Serializable read_value() throws Exception; - - /* - * Additional Methods - */ - public void consumeEndian(); - - // Determines the current byte stream position - // (also handles fragmented streams) - public int getPosition(); - - // mark/reset from java.io.InputStream - public void mark(int readAheadLimit); - public void reset(); - - /** - * This must be called once before unmarshaling valuetypes or anything - * that uses repository IDs. The ORB's version should be set - * to the desired value prior to calling. - */ - public void performORBVersionSpecificInit(); - - /** - * Tells the input stream to null any code set converter - * references, forcing it to reacquire them if it needs - * converters again. This is used when the server - * input stream needs to switch the connection's char code set - * converter to something different after reading the - * code set service context for the first time. Initially, - * we use ISO8859-1 to read the operation name (it can't - * be more than ASCII). - */ - public void resetCodeSetConverters(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalOutputStream.java 2018-01-30 20:17:06.000000000 -0500 +++ /dev/null 2018-01-30 20:17:06.000000000 -0500 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 1998, 2003, 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.corba.se.impl.encoding; - -import java.io.IOException; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -import org.omg.CORBA.portable.InputStream; - -public interface MarshalOutputStream { - - public InputStream create_input_stream(); - - public void write_boolean(boolean value); - public void write_char(char value); - public void write_wchar(char value); - public void write_octet(byte value); - public void write_short(short value); - public void write_ushort(short value); - public void write_long(int value); - public void write_ulong(int value); - public void write_longlong(long value); - public void write_ulonglong(long value); - public void write_float(float value); - public void write_double(double value); - public void write_string(String value); - public void write_wstring(String value); - - public void write_boolean_array(boolean[] value, int offset, int length); - public void write_char_array(char[] value, int offset, int length); - public void write_wchar_array(char[] value, int offset, int length); - public void write_octet_array(byte[] value, int offset, int length); - public void write_short_array(short[] value, int offset, int length); - public void write_ushort_array(short[] value, int offset, int length); - public void write_long_array(int[] value, int offset, int length); - public void write_ulong_array(int[] value, int offset, int length); - public void write_longlong_array(long[] value, int offset, int length); - public void write_ulonglong_array(long[] value, int offset, int length); - public void write_float_array(float[] value, int offset, int length); - public void write_double_array(double[] value, int offset, int length); - - public void write_Object(org.omg.CORBA.Object value); - public void write_TypeCode(TypeCode value); - public void write_any(Any value); - public void write_Principal(Principal value); - - - /* - * The methods necessary to support RMI - */ - public void write_value(java.io.Serializable value); - public void start_block(); - public void end_block(); - - /* - * Additional Methods - */ - - public void putEndian(); - public void writeTo(java.io.OutputStream s) - throws IOException; - - public byte[] toByteArray(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java 2018-01-30 20:17:06.000000000 -0500 +++ /dev/null 2018-01-30 20:17:06.000000000 -0500 @@ -1,230 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.impl.encoding; - -/** - * - * Information from the OSF code set registry version 1.2g. - * - * Use the Entry corresponding to the desired code set. - * - * Consider rename to CodeSetRegistry since OSF is dead. - */ -public final class OSFCodeSetRegistry -{ - // Numbers from the OSF code set registry version 1.2g. - // - // Please see the individual Entry definitions for - // more details. - public static final int ISO_8859_1_VALUE = 0x00010001; - public static final int UTF_16_VALUE = 0x00010109; - public static final int UTF_8_VALUE = 0x05010001; - public static final int UCS_2_VALUE = 0x00010100; - public static final int ISO_646_VALUE = 0x00010020; - - private OSFCodeSetRegistry() {} - - /** - * An entry in the OSF registry which allows users - * to find out the equivalent Java character encoding - * name as well as some other facts from the registry. - */ - public final static class Entry - { - private String javaName; - private int encodingNum; - private boolean isFixedWidth; - private int maxBytesPerChar; - - private Entry(String javaName, - int encodingNum, - boolean isFixedWidth, - int maxBytesPerChar) { - this.javaName = javaName; - this.encodingNum = encodingNum; - this.isFixedWidth = isFixedWidth; - this.maxBytesPerChar = maxBytesPerChar; - } - - /** - * Returns the Java equivalent name. If the encoding has - * an optional byte order marker, this name will map to the - * Java encoding that includes the marker. - */ - public String getName() { - return javaName; - } - - /** - * Get the OSF registry number for this code set. - */ - public int getNumber() { - return encodingNum; - } - - /** - * Is this a fixed or variable width code set? (In CORBA - * terms, "non-byte-oriented" or a "byte-oriented" - * code set, respectively) - */ - public boolean isFixedWidth() { - return isFixedWidth; - } - - public int getMaxBytesPerChar() { - return maxBytesPerChar; - } - - /** - * First checks reference equality since it's expected - * people will use the pre-defined constant Entries. - */ - public boolean equals(Object obj) { - if (this == obj) - return true; - - if (!(obj instanceof OSFCodeSetRegistry.Entry)) - return false; - - OSFCodeSetRegistry.Entry other - = (OSFCodeSetRegistry.Entry)obj; - - return (javaName.equals(other.javaName) && - encodingNum == other.encodingNum && - isFixedWidth == other.isFixedWidth && - maxBytesPerChar == other.maxBytesPerChar); - } - - /** - * Uses the registry number as the hash code. - */ - public int hashCode() { - return encodingNum; - } - } - - /** - * 8-bit encoding required for GIOP 1.0, and used as the char set - * when nothing else is specified. - */ - public static final Entry ISO_8859_1 - = new Entry("ISO-8859-1", - ISO_8859_1_VALUE, - true, - 1); - - /** - * UTF-16 as specified in the OSF registry has an optional - * byte order marker. UTF-16BE and UTF-16LE are not in the OSF - * registry since it is no longer being developed. When the OMG - * switches to the IANA registry, these can be public. Right - * now, they're used internally by CodeSetConversion. - */ - static final Entry UTF_16BE - = new Entry("UTF-16BE", - -1, - true, - 2); - - static final Entry UTF_16LE - = new Entry("UTF-16LE", - -2, - true, - 2); - - /** - * Fallback wchar code set. - * - * In the resolution of issue 3405b, UTF-16 defaults to big endian, so - * doesn't have to have a byte order marker. Unfortunately, this has to be - * a special case for compatibility. - */ - public static final Entry UTF_16 - = new Entry("UTF-16", - UTF_16_VALUE, - true, - 4); - - /** - * Fallback char code set. Also the code set for char data - * in encapsulations. However, since CORBA says chars are - * only one octet, it is really the same as Latin-1. - */ - public static final Entry UTF_8 - = new Entry("UTF-8", - UTF_8_VALUE, - false, - 6); - - /* - * At least in JDK 1.3, UCS-2 isn't one of the mandatory Java character - * encodings. However, our old ORBs require what they call UCS2, even - * though they didn't necessarily do the correct encoding of it. - * - * This is a special case for our legacy ORBs, and put as the last thing - * in our conversion list for wchar data. - * - * If a foreign ORB actually tries to speak UCS2 with us, it probably - * won't work! Beware! - */ - public static final Entry UCS_2 - = new Entry("UCS-2", - UCS_2_VALUE, - true, - 2); - - /** - * This is the encoding older JavaSoft ORBs advertised as their - * CORBA char code set. Actually, they took the lower byte of - * the Java char. This is a 7-bit encoding, so they - * were really sending ISO8859-1. - */ - public static final Entry ISO_646 - = new Entry("US-ASCII", - ISO_646_VALUE, - true, - 1); - - /** - * Given an OSF registry value, return the corresponding Entry. - * Returns null if an Entry for that value is unavailable. - */ - public static Entry lookupEntry(int encodingValue) { - switch(encodingValue) { - case ISO_8859_1_VALUE: - return OSFCodeSetRegistry.ISO_8859_1; - case UTF_16_VALUE: - return OSFCodeSetRegistry.UTF_16; - case UTF_8_VALUE: - return OSFCodeSetRegistry.UTF_8; - case ISO_646_VALUE: - return OSFCodeSetRegistry.ISO_646; - case UCS_2_VALUE: - return OSFCodeSetRegistry.UCS_2; - default: - return null; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/RestorableInputStream.java 2018-01-30 20:17:07.000000000 -0500 +++ /dev/null 2018-01-30 20:17:07.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.encoding; - -/** - * Defines the methods on an input stream which provide - * a way to get and restore its internal state without - * violating encapsulation. - */ -interface RestorableInputStream -{ - Object createStreamMemento(); - - void restoreInternalState(Object streamMemento); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java 2018-01-30 20:17:08.000000000 -0500 +++ /dev/null 2018-01-30 20:17:08.000000000 -0500 @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.encoding; - -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import java.util.List; -import java.util.Collections; -import java.util.ArrayList; -import java.io.IOException; -import java.io.PrintStream; -import java.io.ByteArrayOutputStream; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.nio.ByteBuffer; - -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.StructMember ; -import org.omg.CORBA.UnionMember ; -import org.omg.CORBA.ValueMember ; -import org.omg.CORBA.TCKind ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.Principal ; -import org.omg.CORBA.BAD_TYPECODE ; -import org.omg.CORBA.BAD_PARAM ; -import org.omg.CORBA.BAD_OPERATION ; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.MARSHAL ; - -import org.omg.CORBA.TypeCodePackage.BadKind ; - -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.corba.TypeCodeImpl; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream; -import com.sun.corba.se.impl.encoding.MarshalInputStream; - -import sun.corba.EncapsInputStreamFactory; - -public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader -{ - private Map typeMap = null; - private InputStream enclosure = null; - private boolean isEncapsulation = false; - - public TypeCodeInputStream(org.omg.CORBA.ORB orb, byte[] data, int size) { - super(orb, data, size); - } - - public TypeCodeInputStream(org.omg.CORBA.ORB orb, - byte[] data, - int size, - boolean littleEndian, - GIOPVersion version) { - super(orb, data, size, littleEndian, version); - } - - public TypeCodeInputStream(org.omg.CORBA.ORB orb, - ByteBuffer byteBuffer, - int size, - boolean littleEndian, - GIOPVersion version) { - super(orb, byteBuffer, size, littleEndian, version); - } - - public void addTypeCodeAtPosition(TypeCodeImpl tc, int position) { - if (typeMap == null) { - //if (TypeCodeImpl.debug) System.out.println("Creating typeMap"); - typeMap = new HashMap(16); - } - //if (TypeCodeImpl.debug) System.out.println(this + " adding tc " + tc + " at position " + position); - typeMap.put(new Integer(position), tc); - } - - public TypeCodeImpl getTypeCodeAtPosition(int position) { - if (typeMap == null) - return null; - //if (TypeCodeImpl.debug) { - //System.out.println("Getting tc " + (TypeCode)typeMap.get(new Integer(position)) + - //" at position " + position); - //} - return (TypeCodeImpl)typeMap.get(new Integer(position)); - } - - public void setEnclosingInputStream(InputStream enclosure) { - this.enclosure = enclosure; - } - - public TypeCodeReader getTopLevelStream() { - if (enclosure == null) - return this; - if (enclosure instanceof TypeCodeReader) - return ((TypeCodeReader)enclosure).getTopLevelStream(); - return this; - } - - public int getTopLevelPosition() { - if (enclosure != null && enclosure instanceof TypeCodeReader) { - // The enclosed stream has to consider if the enclosing stream - // had to read the enclosed stream completely when creating it. - // This is why the size of the enclosed stream needs to be substracted. - int topPos = ((TypeCodeReader)enclosure).getTopLevelPosition(); - // Substract getBufferLength from the parents pos because it read this stream - // from its own when creating it - int pos = topPos - getBufferLength() + getPosition(); - //if (TypeCodeImpl.debug) { - //System.out.println("TypeCodeInputStream.getTopLevelPosition using getTopLevelPosition " + topPos + - //(isEncapsulation ? " - encaps length 4" : "") + - //" - getBufferLength() " + getBufferLength() + - //" + getPosition() " + getPosition() + " = " + pos); - //} - return pos; - } - //if (TypeCodeImpl.debug) { - //System.out.println("TypeCodeInputStream.getTopLevelPosition returning getPosition() = " + - //getPosition() + " because enclosure is " + enclosure); - //} - return getPosition(); - } - - public static TypeCodeInputStream readEncapsulation(InputStream is, org.omg.CORBA.ORB _orb) { - // _REVISIT_ Would be nice if we didn't have to copy the buffer! - TypeCodeInputStream encap; - - int encapLength = is.read_long(); - - // read off part of the buffer corresponding to the encapsulation - byte[] encapBuffer = new byte[encapLength]; - is.read_octet_array(encapBuffer, 0, encapBuffer.length); - - // create an encapsulation using the marshal buffer - if (is instanceof CDRInputStream) { - encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb, - encapBuffer, encapBuffer.length, - ((CDRInputStream) is).isLittleEndian(), - ((CDRInputStream) is).getGIOPVersion()); - } else { - encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb, - encapBuffer, encapBuffer.length); - } - encap.setEnclosingInputStream(is); - encap.makeEncapsulation(); - //if (TypeCodeImpl.debug) { - //System.out.println("Created TypeCodeInputStream " + encap + " with parent " + is); - //encap.printBuffer(); - //} - return encap; - } - - protected void makeEncapsulation() { - // first entry in an encapsulation is the endianess - consumeEndian(); - isEncapsulation = true; - } - - public void printTypeMap() { - System.out.println("typeMap = {"); - Iterator i = typeMap.keySet().iterator(); - while (i.hasNext()) { - Integer pos = (Integer)i.next(); - TypeCodeImpl tci = (TypeCodeImpl)typeMap.get(pos); - System.out.println(" key = " + pos.intValue() + ", value = " + tci.description()); - } - System.out.println("}"); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java 2018-01-30 20:17:09.000000000 -0500 +++ /dev/null 2018-01-30 20:17:09.000000000 -0500 @@ -1,264 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.encoding; - -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.StructMember ; -import org.omg.CORBA.UnionMember ; -import org.omg.CORBA.ValueMember ; -import org.omg.CORBA.TCKind ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.Principal ; -import org.omg.CORBA.CompletionStatus ; - -import org.omg.CORBA.TypeCodePackage.BadKind ; - -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.encoding.MarshalInputStream; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.encoding.CodeSetConversion; - -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream; - -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import java.util.List; -import java.util.Collections; -import java.util.ArrayList; -import java.io.IOException; -import java.io.PrintStream; -import java.io.ByteArrayOutputStream; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.nio.ByteBuffer; - -import sun.corba.EncapsInputStreamFactory; - -public final class TypeCodeOutputStream extends EncapsOutputStream -{ - private OutputStream enclosure = null; - private Map typeMap = null; - private boolean isEncapsulation = false; - - public TypeCodeOutputStream(ORB orb) { - super(orb, false); - } - - public TypeCodeOutputStream(ORB orb, boolean littleEndian) { - super(orb, littleEndian); - } - - public org.omg.CORBA.portable.InputStream create_input_stream() - { - TypeCodeInputStream tcis = EncapsInputStreamFactory - .newTypeCodeInputStream((ORB) orb(), getByteBuffer(), - getIndex(), isLittleEndian(), getGIOPVersion()); - //if (TypeCodeImpl.debug) { - //System.out.println("Created TypeCodeInputStream " + tcis + " with no parent"); - //tcis.printBuffer(); - //} - return tcis; - } - - public void setEnclosingOutputStream(OutputStream enclosure) { - this.enclosure = enclosure; - } - - /* - public boolean isEncapsulatedIn(TypeCodeOutputStream outerEnclosure) { - if (outerEnclosure == this) - return true; - if (enclosure == null) - return false; - if (enclosure instanceof TypeCodeOutputStream) - return ((TypeCodeOutputStream)enclosure).isEncapsulatedIn(outerEnclosure); - // Last chance! Recursion ends with first non TypeCodeOutputStream. - return (enclosure == outerEnclosure); - } - */ - - public TypeCodeOutputStream getTopLevelStream() { - if (enclosure == null) - return this; - if (enclosure instanceof TypeCodeOutputStream) - return ((TypeCodeOutputStream)enclosure).getTopLevelStream(); - return this; - } - - public int getTopLevelPosition() { - if (enclosure != null && enclosure instanceof TypeCodeOutputStream) { - int pos = ((TypeCodeOutputStream)enclosure).getTopLevelPosition() + getPosition(); - // Add four bytes for the encaps length, not another 4 for the byte order - // which is included in getPosition(). - if (isEncapsulation) pos += 4; - //if (TypeCodeImpl.debug) { - //System.out.println("TypeCodeOutputStream.getTopLevelPosition using getTopLevelPosition " + - //((TypeCodeOutputStream)enclosure).getTopLevelPosition() + - //" + getPosition() " + getPosition() + - //(isEncapsulation ? " + encaps length 4" : "") + - //" = " + pos); - //} - return pos; - } - //if (TypeCodeImpl.debug) { - //System.out.println("TypeCodeOutputStream.getTopLevelPosition returning getPosition() = " + - //getPosition() + ", enclosure is " + enclosure); - //} - return getPosition(); - } - - public void addIDAtPosition(String id, int position) { - if (typeMap == null) - typeMap = new HashMap(16); - //if (TypeCodeImpl.debug) System.out.println(this + " adding id " + id + " at position " + position); - typeMap.put(id, new Integer(position)); - } - - public int getPositionForID(String id) { - if (typeMap == null) - throw wrapper.refTypeIndirType( CompletionStatus.COMPLETED_NO ) ; - //if (TypeCodeImpl.debug) System.out.println("Getting position " + ((Integer)typeMap.get(id)).intValue() + - //" for id " + id); - return ((Integer)typeMap.get(id)).intValue(); - } - - public void writeRawBuffer(org.omg.CORBA.portable.OutputStream s, int firstLong) { - // Writes this streams buffer to the given OutputStream - // without byte order flag and length as is the case for encapsulations. - - // Make sure to align s to 4 byte boundaries. - // Unfortunately we can't do just this: - // s.alignAndReserve(4, 4); - // So we have to take the first four bytes given in firstLong and write them - // with a call to write_long which will trigger the alignment. - // Then write the rest of the byte array. - - //if (TypeCodeImpl.debug) { - //System.out.println(this + ".writeRawBuffer(" + s + ", " + firstLong + ")"); - //if (s instanceof CDROutputStream) { - //System.out.println("Parent position before writing kind = " + ((CDROutputStream)s).getIndex()); - //} - //} - s.write_long(firstLong); - //if (TypeCodeImpl.debug) { - //if (s instanceof CDROutputStream) { - //System.out.println("Parent position after writing kind = " + ((CDROutputStream)s).getIndex()); - //} - //} - ByteBuffer byteBuffer = getByteBuffer(); - if (byteBuffer.hasArray()) - { - s.write_octet_array(byteBuffer.array(), 4, getIndex() - 4); - } - else - { - // get bytes from DirectByteBuffer - // NOTE: Microbenchmarks are showing it is faster to do - // a loop of ByteBuffer.get(int) than it is to do - // a bulk ByteBuffer.get(byte[], offset, length) - byte[] buf = new byte[byteBuffer.limit()]; - for (int i = 0; i < buf.length; i++) - buf[i] = byteBuffer.get(i); - s.write_octet_array(buf, 4, getIndex() - 4); - } - //if (TypeCodeImpl.debug) { - //if (s instanceof CDROutputStream) { - //System.out.println("Parent position after writing all " + getIndex() + " bytes = " + ((CDROutputStream)s).getIndex()); - //} - //} - } - - public TypeCodeOutputStream createEncapsulation(org.omg.CORBA.ORB _orb) { - TypeCodeOutputStream encap = - sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)_orb, isLittleEndian()); - encap.setEnclosingOutputStream(this); - encap.makeEncapsulation(); - //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + encap + " with parent " + this); - return encap; - } - - protected void makeEncapsulation() { - // first entry in an encapsulation is the endianess - putEndian(); - isEncapsulation = true; - } - - public static TypeCodeOutputStream wrapOutputStream(OutputStream os) { - boolean littleEndian = ((os instanceof CDROutputStream) ? ((CDROutputStream)os).isLittleEndian() : false); - TypeCodeOutputStream tos = - sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)os.orb(), littleEndian); - tos.setEnclosingOutputStream(os); - //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + tos + " with parent " + os); - return tos; - } - - public int getPosition() { - return getIndex(); - } - - public int getRealIndex(int index) { - int topPos = getTopLevelPosition(); - //if (TypeCodeImpl.debug) System.out.println("TypeCodeOutputStream.getRealIndex using getTopLevelPosition " + - //topPos + " instead of getPosition " + getPosition()); - return topPos; - } -/* - protected void printBuffer() { - super.printBuffer(); - } -*/ - public byte[] getTypeCodeBuffer() { - // Returns the buffer trimmed of the trailing zeros and without the - // known _kind value at the beginning. - ByteBuffer theBuffer = getByteBuffer(); - //System.out.println("outBuffer length = " + (getIndex() - 4)); - byte[] tcBuffer = new byte[getIndex() - 4]; - // Micro-benchmarks show that DirectByteBuffer.get(int) is faster - // than DirectByteBuffer.get(byte[], offset, length). - // REVISIT - May want to check if buffer is direct or non-direct - // and use array copy if ByteBuffer is non-direct. - for (int i = 0; i < tcBuffer.length; i++) - tcBuffer[i] = theBuffer.get(i+4); - return tcBuffer; - } - - public void printTypeMap() { - System.out.println("typeMap = {"); - Iterator i = typeMap.keySet().iterator(); - while (i.hasNext()) { - String id = (String)i.next(); - Integer pos = (Integer)typeMap.get(id); - System.out.println(" key = " + id + ", value = " + pos); - } - System.out.println("}"); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeReader.java 2018-01-30 20:17:10.000000000 -0500 +++ /dev/null 2018-01-30 20:17:10.000000000 -0500 @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.encoding; - -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import java.util.List; -import java.util.Collections; -import java.util.ArrayList; -import java.io.IOException; -import java.io.PrintStream; -import java.io.ByteArrayOutputStream; -import java.math.BigDecimal; -import java.math.BigInteger; - -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.StructMember ; -import org.omg.CORBA.UnionMember ; -import org.omg.CORBA.ValueMember ; -import org.omg.CORBA.TCKind ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.Principal ; -import org.omg.CORBA.BAD_TYPECODE ; -import org.omg.CORBA.BAD_PARAM ; -import org.omg.CORBA.BAD_OPERATION ; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.MARSHAL ; - -import org.omg.CORBA.TypeCodePackage.BadKind ; - -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.corba.TypeCodeImpl; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.encoding.MarshalInputStream; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream; - -public interface TypeCodeReader extends MarshalInputStream { - public void addTypeCodeAtPosition(TypeCodeImpl tc, int position); - public TypeCodeImpl getTypeCodeAtPosition(int position); - public void setEnclosingInputStream(InputStream enclosure); - public TypeCodeReader getTopLevelStream(); - public int getTopLevelPosition(); - // for debugging - //public void printBuffer(); - public int getPosition(); - public void printTypeMap(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/WrapperInputStream.java 2018-01-30 20:17:11.000000000 -0500 +++ /dev/null 2018-01-30 20:17:11.000000000 -0500 @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.encoding; - -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import java.util.List; -import java.util.Collections; -import java.util.ArrayList; -import java.io.IOException; -import java.io.PrintStream; -import java.io.ByteArrayOutputStream; -import java.math.BigDecimal; -import java.math.BigInteger; - -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.StructMember ; -import org.omg.CORBA.UnionMember ; -import org.omg.CORBA.ValueMember ; -import org.omg.CORBA.TCKind ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.Principal ; -import org.omg.CORBA.BAD_TYPECODE ; -import org.omg.CORBA.BAD_PARAM ; -import org.omg.CORBA.BAD_OPERATION ; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.MARSHAL ; - -import org.omg.CORBA.TypeCodePackage.BadKind ; - -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.corba.TypeCodeImpl; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.encoding.MarshalInputStream; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream; - -public class WrapperInputStream extends org.omg.CORBA_2_3.portable.InputStream implements TypeCodeReader -{ - private CDRInputStream stream; - private Map typeMap = null; - private int startPos = 0; - - public WrapperInputStream(CDRInputStream s) { - super(); - stream = s; - startPos = stream.getPosition(); - } - - public int read() throws IOException { return stream.read(); } - public int read(byte b[]) throws IOException { return stream.read(b); } - public int read(byte b[], int off, int len) throws IOException { - return stream.read(b, off, len); - } - public long skip(long n) throws IOException { return stream.skip(n); } - public int available() throws IOException { return stream.available(); } - public void close() throws IOException { stream.close(); } - public void mark(int readlimit) { stream.mark(readlimit); } - public void reset() { stream.reset(); } - public boolean markSupported() { return stream.markSupported(); } - public int getPosition() { return stream.getPosition(); } - public void consumeEndian() { stream.consumeEndian(); } - public boolean read_boolean() { return stream.read_boolean(); } - public char read_char() { return stream.read_char(); } - public char read_wchar() { return stream.read_wchar(); } - public byte read_octet() { return stream.read_octet(); } - public short read_short() { return stream.read_short(); } - public short read_ushort() { return stream.read_ushort(); } - public int read_long() { return stream.read_long(); } - public int read_ulong() { return stream.read_ulong(); } - public long read_longlong() { return stream.read_longlong(); } - public long read_ulonglong() { return stream.read_ulonglong(); } - public float read_float() { return stream.read_float(); } - public double read_double() { return stream.read_double(); } - public String read_string() { return stream.read_string(); } - public String read_wstring() { return stream.read_wstring(); } - - public void read_boolean_array(boolean[] value, int offset, int length) { - stream.read_boolean_array(value, offset, length); - } - public void read_char_array(char[] value, int offset, int length) { - stream.read_char_array(value, offset, length); - } - public void read_wchar_array(char[] value, int offset, int length) { - stream.read_wchar_array(value, offset, length); - } - public void read_octet_array(byte[] value, int offset, int length) { - stream.read_octet_array(value, offset, length); - } - public void read_short_array(short[] value, int offset, int length) { - stream.read_short_array(value, offset, length); - } - public void read_ushort_array(short[] value, int offset, int length) { - stream.read_ushort_array(value, offset, length); - } - public void read_long_array(int[] value, int offset, int length) { - stream.read_long_array(value, offset, length); - } - public void read_ulong_array(int[] value, int offset, int length) { - stream.read_ulong_array(value, offset, length); - } - public void read_longlong_array(long[] value, int offset, int length) { - stream.read_longlong_array(value, offset, length); - } - public void read_ulonglong_array(long[] value, int offset, int length) { - stream.read_ulonglong_array(value, offset, length); - } - public void read_float_array(float[] value, int offset, int length) { - stream.read_float_array(value, offset, length); - } - public void read_double_array(double[] value, int offset, int length) { - stream.read_double_array(value, offset, length); - } - - public org.omg.CORBA.Object read_Object() { return stream.read_Object(); } - public java.io.Serializable read_value() {return stream.read_value();} - public TypeCode read_TypeCode() { return stream.read_TypeCode(); } - public Any read_any() { return stream.read_any(); } - public Principal read_Principal() { return stream.read_Principal(); } - public java.math.BigDecimal read_fixed() { return stream.read_fixed(); } - public org.omg.CORBA.Context read_Context() { return stream.read_Context(); } - - public org.omg.CORBA.ORB orb() { return stream.orb(); } - - public void addTypeCodeAtPosition(TypeCodeImpl tc, int position) { - if (typeMap == null) { - //if (TypeCodeImpl.debug) System.out.println("Creating typeMap"); - typeMap = new HashMap(16); - } - //if (TypeCodeImpl.debug) System.out.println(this + " adding tc " + tc + " at position " + position); - typeMap.put(new Integer(position), tc); - } - - public TypeCodeImpl getTypeCodeAtPosition(int position) { - if (typeMap == null) - return null; - //if (TypeCodeImpl.debug) System.out.println("Getting tc " + (TypeCodeImpl)typeMap.get(new Integer(position)) + - //" at position " + position); - return (TypeCodeImpl)typeMap.get(new Integer(position)); - } - - public void setEnclosingInputStream(InputStream enclosure) { - // WrapperInputStream has no enclosure - } - - public TypeCodeReader getTopLevelStream() { - // WrapperInputStream has no enclosure - return this; - } - - public int getTopLevelPosition() { - //if (TypeCodeImpl.debug) System.out.println("WrapperInputStream.getTopLevelPosition " + - //"returning getPosition " + getPosition() + " - startPos " + startPos + - //" = " + (getPosition() - startPos)); - return getPosition() - startPos; - } - - public void performORBVersionSpecificInit() { - // This is never actually called on a WrapperInputStream, but - // exists to satisfy the interface requirement. - stream.performORBVersionSpecificInit(); - } - - public void resetCodeSetConverters() { - stream.resetCodeSetConverters(); - } - - //public void printBuffer() { stream.printBuffer(); } - - public void printTypeMap() { - System.out.println("typeMap = {"); - List sortedKeys = new ArrayList(typeMap.keySet()); - Collections.sort(sortedKeys); - Iterator i = sortedKeys.iterator(); - while (i.hasNext()) { - Integer pos = (Integer)i.next(); - TypeCodeImpl tci = (TypeCodeImpl)typeMap.get(pos); - System.out.println(" key = " + pos.intValue() + ", value = " + tci.description()); - } - System.out.println("}"); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java 2018-01-30 20:17:11.000000000 -0500 +++ /dev/null 2018-01-30 20:17:11.000000000 -0500 @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.interceptors; - -import org.omg.CORBA.Any; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.LocalObject; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import sun.corba.EncapsInputStreamFactory; - -import com.sun.corba.se.impl.corba.AnyImpl; -import com.sun.corba.se.impl.encoding.EncapsInputStream; -import com.sun.corba.se.impl.encoding.EncapsOutputStream; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -import org.omg.IOP.Codec; -import org.omg.IOP.CodecPackage.FormatMismatch; -import org.omg.IOP.CodecPackage.InvalidTypeForEncoding; -import org.omg.IOP.CodecPackage.TypeMismatch; - -/** - * CDREncapsCodec is an implementation of Codec, as described - * in orbos/99-12-02, that supports CDR encapsulation version 1.0, 1.1, and - * 1.2. - */ -public final class CDREncapsCodec - extends org.omg.CORBA.LocalObject - implements Codec -{ - // The ORB that created the factory this codec was created from - private ORB orb; - ORBUtilSystemException wrapper; - - // The GIOP version we are encoding for - private GIOPVersion giopVersion; - - /* - ******************************************************************* - * NOTE: CDREncapsCodec must remain immutable! This is so that we - * can pre-create CDREncapsCodecs for each version of GIOP in - * CodecFactoryImpl. - *******************************************************************/ - - /** - * Creates a new codec implementation. Uses the given ORB to create - * CDRInputStreams when necessary. - * - * @param orb The ORB to use to create a CDRInputStream or CDROutputStream - * @param major The major version of GIOP we are encoding for - * @param minor The minor version of GIOP we are encoding for - */ - public CDREncapsCodec( ORB orb, int major, int minor ) { - this.orb = orb; - wrapper = ORBUtilSystemException.get( - (com.sun.corba.se.spi.orb.ORB)orb, CORBALogDomains.RPC_PROTOCOL ) ; - - giopVersion = GIOPVersion.getInstance( (byte)major, (byte)minor ); - } - - /** - * Convert the given any into a CDR encapsulated octet sequence - */ - public byte[] encode( Any data ) - throws InvalidTypeForEncoding - { - if ( data == null ) - throw wrapper.nullParam() ; - return encodeImpl( data, true ); - } - - /** - * Decode the given octet sequence into an any based on a CDR - * encapsulated octet sequence. - */ - public Any decode ( byte[] data ) - throws FormatMismatch - { - if( data == null ) - throw wrapper.nullParam() ; - return decodeImpl( data, null ); - } - - /** - * Convert the given any into a CDR encapsulated octet sequence. Only - * the data is stored. The type code is not. - */ - public byte[] encode_value( Any data ) - throws InvalidTypeForEncoding - { - if( data == null ) - throw wrapper.nullParam() ; - return encodeImpl( data, false ); - } - - /** - * Decode the given octet sequence into an any based on a CDR - * encapsulated octet sequence. The type code is expected not to appear - * in the octet sequence, and the given type code is used instead. - */ - public Any decode_value( byte[] data, TypeCode tc ) - throws FormatMismatch, TypeMismatch - { - if( data == null ) - throw wrapper.nullParam() ; - if( tc == null ) - throw wrapper.nullParam() ; - return decodeImpl( data, tc ); - } - - /** - * Convert the given any into a CDR encapsulated octet sequence. - * If sendTypeCode is true, the type code is sent with the message, as in - * a standard encapsulation. If it is false, only the data is sent. - * Either way, the endian type is sent as the first part of the message. - */ - private byte[] encodeImpl( Any data, boolean sendTypeCode ) - throws InvalidTypeForEncoding - { - if( data == null ) - throw wrapper.nullParam() ; - - // _REVISIT_ Note that InvalidTypeForEncoding is never thrown in - // the body of this method. This is due to the fact that CDR*Stream - // will never throw an exception if the encoding is invalid. To - // fix this, the CDROutputStream must know the version of GIOP it - // is encoding for and it must check to ensure that, for example, - // wstring cannot be encoded in GIOP 1.0. - // - // As part of the GIOP 1.2 work, the CDRInput and OutputStream will - // be versioned. This can be handled once this work is complete. - - // Create output stream with default endianness. - EncapsOutputStream cdrOut = - sun.corba.OutputStreamFactory.newEncapsOutputStream( - (com.sun.corba.se.spi.orb.ORB)orb, giopVersion ); - - // This is an encapsulation, so put out the endian: - cdrOut.putEndian(); - - // Sometimes encode type code: - if( sendTypeCode ) { - cdrOut.write_TypeCode( data.type() ); - } - - // Encode value and return. - data.write_value( cdrOut ); - - return cdrOut.toByteArray(); - } - - /** - * Decode the given octet sequence into an any based on a CDR - * encapsulated octet sequence. If the type code is null, it is - * expected to appear in the octet sequence. Otherwise, the given - * type code is used. - */ - private Any decodeImpl( byte[] data, TypeCode tc ) - throws FormatMismatch - { - if( data == null ) - throw wrapper.nullParam() ; - - AnyImpl any = null; // return value - - // _REVISIT_ Currently there is no way for us to distinguish between - // a FormatMismatch and a TypeMismatch because we cannot get this - // information from the CDRInputStream. If a RuntimeException occurs, - // it is turned into a FormatMismatch exception. - - try { - EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream( orb, data, - data.length, giopVersion ); - - - cdrIn.consumeEndian(); - - // If type code not specified, read it from octet stream: - if( tc == null ) { - tc = cdrIn.read_TypeCode(); - } - - // Create a new Any object: - any = new AnyImpl( (com.sun.corba.se.spi.orb.ORB)orb ); - any.read_value( cdrIn, tc ); - } - catch( RuntimeException e ) { - // See above note. - throw new FormatMismatch(); - } - - return any; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java 2018-01-30 20:17:12.000000000 -0500 +++ /dev/null 2018-01-30 20:17:12.000000000 -0500 @@ -1,978 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.interceptors; - -import java.util.HashMap ; - -import org.omg.CORBA.Any; -import org.omg.CORBA.BAD_INV_ORDER; -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.Context; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.CTX_RESTRICT_SCOPE; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.LocalObject; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.NO_RESOURCES; -import org.omg.CORBA.NVList; -import org.omg.CORBA.Object; -import org.omg.CORBA.ParameterMode; -import org.omg.CORBA.Policy; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.UserException; -import org.omg.CORBA.portable.ApplicationException; -import org.omg.CORBA.portable.InputStream; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.servicecontext.UnknownServiceContext; - -import org.omg.IOP.ServiceContext; -import org.omg.IOP.ServiceContextHelper; -import org.omg.IOP.TaggedProfile; -import org.omg.IOP.TaggedProfileHelper; -import org.omg.IOP.TaggedComponent; -import org.omg.IOP.TaggedComponentHelper; -import org.omg.IOP.TAG_INTERNET_IOP; -import org.omg.Dynamic.Parameter; -import org.omg.PortableInterceptor.ClientRequestInfo; -import org.omg.PortableInterceptor.LOCATION_FORWARD; -import org.omg.PortableInterceptor.SUCCESSFUL; -import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; -import org.omg.PortableInterceptor.TRANSPORT_RETRY; -import org.omg.PortableInterceptor.USER_EXCEPTION; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.protocol.RetryType; -import com.sun.corba.se.spi.transport.CorbaContactInfo; -import com.sun.corba.se.spi.transport.CorbaContactInfoList; -import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator; - -import com.sun.corba.se.impl.encoding.CDROutputStream; -import com.sun.corba.se.impl.encoding.CDRInputStream_1_0; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.protocol.CorbaInvocationInfo; -import com.sun.corba.se.impl.util.RepositoryId; - -/** - * Implementation of the ClientRequestInfo interface as specified in - * orbos/99-12-02 section 5.4.2. - */ -public final class ClientRequestInfoImpl - extends RequestInfoImpl - implements ClientRequestInfo -{ - - // The available constants for startingPointCall - static final int CALL_SEND_REQUEST = 0; - static final int CALL_SEND_POLL = 1; - - // The available constants for endingPointCall - static final int CALL_RECEIVE_REPLY = 0; - static final int CALL_RECEIVE_EXCEPTION = 1; - static final int CALL_RECEIVE_OTHER = 2; - - ////////////////////////////////////////////////////////////////////// - // - // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); - // - ////////////////////////////////////////////////////////////////////// - - // The current retry request status. True if this request is being - // retried and this info object is to be reused, or false otherwise. - private RetryType retryRequest; - - // The number of times this info object has been (re)used. This is - // incremented every time a request is retried, and decremented every - // time a request is complete. When this reaches zero, the info object - // is popped from the ClientRequestInfoImpl ThreadLocal stack in the ORB. - private int entryCount = 0; - - // The RequestImpl is set when the call is DII based. - // The DII query calls like ParameterList, ExceptionList, - // ContextList will be delegated to RequestImpl. - private org.omg.CORBA.Request request; - - // Sources of client request information - private boolean diiInitiate; - private CorbaMessageMediator messageMediator; - - // Cached information: - private org.omg.CORBA.Object cachedTargetObject; - private org.omg.CORBA.Object cachedEffectiveTargetObject; - private Parameter[] cachedArguments; - private TypeCode[] cachedExceptions; - private String[] cachedContexts; - private String[] cachedOperationContext; - private String cachedReceivedExceptionId; - private Any cachedResult; - private Any cachedReceivedException; - private TaggedProfile cachedEffectiveProfile; - // key = Integer, value = IOP.ServiceContext. - private HashMap cachedRequestServiceContexts; - // key = Integer, value = IOP.ServiceContext. - private HashMap cachedReplyServiceContexts; - // key = Integer, value = TaggedComponent - private HashMap cachedEffectiveComponents; - - - protected boolean piCurrentPushed; - - ////////////////////////////////////////////////////////////////////// - // - // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); - // - ////////////////////////////////////////////////////////////////////// - - /** - * Reset the info object so that it can be reused for a retry, - * for example. - */ - void reset() { - super.reset(); - - // Please keep these in the same order that they're declared above. - - // 6763340 - retryRequest = RetryType.NONE; - - // Do not reset entryCount because we need to know when to pop this - // from the stack. - - request = null; - diiInitiate = false; - messageMediator = null; - - // Clear cached attributes: - cachedTargetObject = null; - cachedEffectiveTargetObject = null; - cachedArguments = null; - cachedExceptions = null; - cachedContexts = null; - cachedOperationContext = null; - cachedReceivedExceptionId = null; - cachedResult = null; - cachedReceivedException = null; - cachedEffectiveProfile = null; - cachedRequestServiceContexts = null; - cachedReplyServiceContexts = null; - cachedEffectiveComponents = null; - - piCurrentPushed = false; - - startingPointCall = CALL_SEND_REQUEST; - endingPointCall = CALL_RECEIVE_REPLY; - - } - - /* - ********************************************************************** - * Access protection - **********************************************************************/ - - // Method IDs for all methods in ClientRequestInfo. This allows for a - // convenient O(1) lookup for checkAccess(). - protected static final int MID_TARGET = MID_RI_LAST + 1; - protected static final int MID_EFFECTIVE_TARGET = MID_RI_LAST + 2; - protected static final int MID_EFFECTIVE_PROFILE = MID_RI_LAST + 3; - protected static final int MID_RECEIVED_EXCEPTION = MID_RI_LAST + 4; - protected static final int MID_RECEIVED_EXCEPTION_ID = MID_RI_LAST + 5; - protected static final int MID_GET_EFFECTIVE_COMPONENT = MID_RI_LAST + 6; - protected static final int MID_GET_EFFECTIVE_COMPONENTS - = MID_RI_LAST + 7; - protected static final int MID_GET_REQUEST_POLICY = MID_RI_LAST + 8; - protected static final int MID_ADD_REQUEST_SERVICE_CONTEXT - = MID_RI_LAST + 9; - - // ClientRequestInfo validity table (see ptc/00-08-06 table 21-1). - // Note: These must be in the same order as specified in contants. - private static final boolean validCall[][] = { - // LEGEND: - // s_req = send_request r_rep = receive_reply - // s_pol = send_poll r_exc = receive_exception - // r_oth = receive_other - // - // A true value indicates call is valid at specified point. - // A false value indicates the call is invalid. - // - // - // NOTE: If the order or number of columns change, update - // checkAccess() accordingly. - // - // { s_req, s_pol, r_rep, r_exc, r_oth } - // RequestInfo methods: - /*request_id*/ { true , true , true , true , true }, - /*operation*/ { true , true , true , true , true }, - /*arguments*/ { true , false, true , false, false }, - /*exceptions*/ { true , false, true , true , true }, - /*contexts*/ { true , false, true , true , true }, - /*operation_context*/ { true , false, true , true , true }, - /*result*/ { false, false, true , false, false }, - /*response_expected*/ { true , true , true , true , true }, - /*sync_scope*/ { true , false, true , true , true }, - /*reply_status*/ { false, false, true , true , true }, - /*forward_reference*/ { false, false, false, false, true }, - /*get_slot*/ { true , true , true , true , true }, - /*get_request_service_context*/ { true , false, true , true , true }, - /*get_reply_service_context*/ { false, false, true , true , true }, - // - // ClientRequestInfo methods:: - /*target*/ { true , true , true , true , true }, - /*effective_target*/ { true , true , true , true , true }, - /*effective_profile*/ { true , true , true , true , true }, - /*received_exception*/ { false, false, false, true , false }, - /*received_exception_id*/ { false, false, false, true , false }, - /*get_effective_component*/ { true , false, true , true , true }, - /*get_effective_components*/ { true , false, true , true , true }, - /*get_request_policy*/ { true , false, true , true , true }, - /*add_request_service_context*/ { true , false, false, false, false } - }; - - - /* - ********************************************************************** - * Public ClientRequestInfo interfaces - **********************************************************************/ - - /** - * Creates a new ClientRequestInfo implementation. - * The constructor is package scope since no other package need create - * an instance of this class. - */ - protected ClientRequestInfoImpl( ORB myORB ) { - super( myORB ); - startingPointCall = CALL_SEND_REQUEST; - endingPointCall = CALL_RECEIVE_REPLY; - } - - /** - * The object which the client called to perform the operation. - */ - public org.omg.CORBA.Object target (){ - // access is currently valid for all states: - //checkAccess( MID_TARGET ); - if (cachedTargetObject == null) { - CorbaContactInfo corbaContactInfo = (CorbaContactInfo) - messageMediator.getContactInfo(); - cachedTargetObject = - iorToObject(corbaContactInfo.getTargetIOR()); - } - return cachedTargetObject; - } - - /** - * The actual object on which the operation will be invoked. If the - * reply_status is LOCATION_FORWARD, then on subsequent requests, - * effective_target will contain the forwarded IOR while target will - * remain unchanged. - */ - public org.omg.CORBA.Object effective_target() { - // access is currently valid for all states: - //checkAccess( MID_EFFECTIVE_TARGET ); - - // Note: This is not necessarily the same as locatedIOR. - // Reason: See the way we handle COMM_FAILURES in - // ClientRequestDispatcher.createRequest, v1.32 - - if (cachedEffectiveTargetObject == null) { - CorbaContactInfo corbaContactInfo = (CorbaContactInfo) - messageMediator.getContactInfo(); - // REVISIT - get through chain like getLocatedIOR helper below. - cachedEffectiveTargetObject = - iorToObject(corbaContactInfo.getEffectiveTargetIOR()); - } - return cachedEffectiveTargetObject; - } - - /** - * The profile that will be used to send the request. If a location - * forward has occurred for this operation's object and that object's - * profile change accordingly, then this profile will be that located - * profile. - */ - public TaggedProfile effective_profile (){ - // access is currently valid for all states: - //checkAccess( MID_EFFECTIVE_PROFILE ); - - if( cachedEffectiveProfile == null ) { - CorbaContactInfo corbaContactInfo = (CorbaContactInfo) - messageMediator.getContactInfo(); - cachedEffectiveProfile = - corbaContactInfo.getEffectiveProfile().getIOPProfile(); - } - - // Good citizen: In the interest of efficiency, we assume interceptors - // will not modify the returned TaggedProfile in any way so we need - // not make a deep copy of it. - - return cachedEffectiveProfile; - } - - /** - * Contains the exception to be returned to the client. - */ - public Any received_exception (){ - checkAccess( MID_RECEIVED_EXCEPTION ); - - if( cachedReceivedException == null ) { - cachedReceivedException = exceptionToAny( exception ); - } - - // Good citizen: In the interest of efficiency, we assume interceptors - // will not modify the returned Any in any way so we need - // not make a deep copy of it. - - return cachedReceivedException; - } - - /** - * The CORBA::RepositoryId of the exception to be returned to the client. - */ - public String received_exception_id (){ - checkAccess( MID_RECEIVED_EXCEPTION_ID ); - - if( cachedReceivedExceptionId == null ) { - String result = null; - - if( exception == null ) { - // Note: exception should never be null here since we will - // throw a BAD_INV_ORDER if this is not called from - // receive_exception. - throw wrapper.exceptionWasNull() ; - } else if( exception instanceof SystemException ) { - String name = exception.getClass().getName(); - result = ORBUtility.repositoryIdOf(name); - } else if( exception instanceof ApplicationException ) { - result = ((ApplicationException)exception).getId(); - } - - // _REVISIT_ We need to be able to handle a UserException in the - // DII case. How do we extract the ID from a UserException? - - cachedReceivedExceptionId = result; - } - - return cachedReceivedExceptionId; - } - - /** - * Returns the IOP::TaggedComponent with the given ID from the profile - * selected for this request. IF there is more than one component for a - * given component ID, it is undefined which component this operation - * returns (get_effective_component should be called instead). - */ - public TaggedComponent get_effective_component (int id){ - checkAccess( MID_GET_EFFECTIVE_COMPONENT ); - - return get_effective_components( id )[0]; - } - - /** - * Returns all the tagged components with the given ID from the profile - * selected for this request. - */ - public TaggedComponent[] get_effective_components (int id){ - checkAccess( MID_GET_EFFECTIVE_COMPONENTS ); - Integer integerId = new Integer( id ); - TaggedComponent[] result = null; - boolean justCreatedCache = false; - - if( cachedEffectiveComponents == null ) { - cachedEffectiveComponents = new HashMap(); - justCreatedCache = true; - } - else { - // Look in cache: - result = (TaggedComponent[])cachedEffectiveComponents.get( - integerId ); - } - - // null could mean we cached null or not in cache. - if( (result == null) && - (justCreatedCache || - !cachedEffectiveComponents.containsKey( integerId ) ) ) - { - // Not in cache. Get it from the profile: - CorbaContactInfo corbaContactInfo = (CorbaContactInfo) - messageMediator.getContactInfo(); - IIOPProfileTemplate ptemp = - (IIOPProfileTemplate)corbaContactInfo.getEffectiveProfile(). - getTaggedProfileTemplate(); - result = ptemp.getIOPComponents(myORB, id); - cachedEffectiveComponents.put( integerId, result ); - } - - // As per ptc/00-08-06, section 21.3.13.6., If not found, raise - // BAD_PARAM with minor code INVALID_COMPONENT_ID. - if( (result == null) || (result.length == 0) ) { - throw stdWrapper.invalidComponentId( integerId ) ; - } - - // Good citizen: In the interest of efficiency, we will assume - // interceptors will not modify the returned TaggedCompoent[], or - // the TaggedComponents inside of it. Otherwise, we would need to - // clone the array and make a deep copy of its contents. - - return result; - } - - /** - * Returns the given policy in effect for this operation. - */ - public Policy get_request_policy (int type){ - checkAccess( MID_GET_REQUEST_POLICY ); - // _REVISIT_ Our ORB is not policy-based at this time. - throw wrapper.piOrbNotPolicyBased() ; - } - - /** - * Allows interceptors to add service contexts to the request. - *

- * There is no declaration of the order of the service contexts. They - * may or may not appear in the order they are added. - */ - public void add_request_service_context (ServiceContext service_context, - boolean replace) - { - checkAccess( MID_ADD_REQUEST_SERVICE_CONTEXT ); - - if( cachedRequestServiceContexts == null ) { - cachedRequestServiceContexts = new HashMap(); - } - - addServiceContext( cachedRequestServiceContexts, - messageMediator.getRequestServiceContexts(), - service_context, replace ); - } - - // NOTE: When adding a method, be sure to: - // 1. Add a MID_* constant for that method - // 2. Call checkAccess at the start of the method - // 3. Define entries in the validCall[][] table for interception points. - - /* - ********************************************************************** - * Public RequestInfo interfaces - * - * These are implemented here because they have differing - * implementations depending on whether this is a client or a server - * request info object. - **********************************************************************/ - - /** - * See RequestInfoImpl for javadoc. - */ - public int request_id (){ - // access is currently valid for all states: - //checkAccess( MID_REQUEST_ID ); - /* - * NOTE: The requestId in client interceptors is the same as the - * GIOP request id. This works because both interceptors and - * request ids are scoped by the ORB on the client side. - */ - return messageMediator.getRequestId(); - } - - /** - * See RequestInfoImpl for javadoc. - */ - public String operation (){ - // access is currently valid for all states: - //checkAccess( MID_OPERATION ); - return messageMediator.getOperationName(); - } - - /** - * See RequestInfoImpl for javadoc. - */ - public Parameter[] arguments (){ - checkAccess( MID_ARGUMENTS ); - - if( cachedArguments == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported1() ; - } - - // If it is DII request then get the arguments from the DII req - // and convert that into parameters. - cachedArguments = nvListToParameterArray( request.arguments() ); - } - - // Good citizen: In the interest of efficiency, we assume - // interceptors will be "good citizens" in that they will not - // modify the contents of the Parameter[] array. We also assume - // they will not change the values of the containing Anys. - - return cachedArguments; - } - - /** - * See RequestInfoImpl for javadoc. - */ - public TypeCode[] exceptions (){ - checkAccess( MID_EXCEPTIONS ); - - if( cachedExceptions == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported2() ; - } - - // Get the list of exceptions from DII request data, If there are - // no exceptions raised then this method will return null. - ExceptionList excList = request.exceptions( ); - int count = excList.count(); - TypeCode[] excTCList = new TypeCode[count]; - try { - for( int i = 0; i < count; i++ ) { - excTCList[i] = excList.item( i ); - } - } catch( Exception e ) { - throw wrapper.exceptionInExceptions( e ) ; - } - - cachedExceptions = excTCList; - } - - // Good citizen: In the interest of efficiency, we assume - // interceptors will be "good citizens" in that they will not - // modify the contents of the TypeCode[] array. We also assume - // they will not change the values of the containing TypeCodes. - - return cachedExceptions; - } - - /** - * See RequestInfoImpl for javadoc. - */ - public String[] contexts (){ - checkAccess( MID_CONTEXTS ); - - if( cachedContexts == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported3() ; - } - - // Get the list of contexts from DII request data, If there are - // no contexts then this method will return null. - ContextList ctxList = request.contexts( ); - int count = ctxList.count(); - String[] ctxListToReturn = new String[count]; - try { - for( int i = 0; i < count; i++ ) { - ctxListToReturn[i] = ctxList.item( i ); - } - } catch( Exception e ) { - throw wrapper.exceptionInContexts( e ) ; - } - - cachedContexts = ctxListToReturn; - } - - // Good citizen: In the interest of efficiency, we assume - // interceptors will be "good citizens" in that they will not - // modify the contents of the String[] array. - - return cachedContexts; - } - - /** - * See RequestInfoImpl for javadoc. - */ - public String[] operation_context (){ - checkAccess( MID_OPERATION_CONTEXT ); - - if( cachedOperationContext == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported4() ; - } - - // Get the list of contexts from DII request data, If there are - // no contexts then this method will return null. - Context ctx = request.ctx( ); - // _REVISIT_ The API for get_values is not compliant with the spec, - // Revisit this code once it's fixed. - // _REVISIT_ Our ORB doesn't support Operation Context, This code - // will not be excerscised until it's supported. - // The first parameter in get_values is the start_scope which - // if blank makes it as a global scope. - // The second parameter is op_flags which is set to RESTRICT_SCOPE - // As there is only one defined in the spec. - // The Third param is the pattern which is '*' requiring it to - // get all the contexts. - NVList nvList = ctx.get_values( "", CTX_RESTRICT_SCOPE.value,"*" ); - String[] context = new String[(nvList.count() * 2) ]; - if( ( nvList != null ) &&( nvList.count() != 0 ) ) { - // The String[] array will contain Name and Value for each - // context and hence double the size in the array. - int index = 0; - for( int i = 0; i < nvList.count(); i++ ) { - NamedValue nv; - try { - nv = nvList.item( i ); - } - catch (Exception e ) { - return (String[]) null; - } - context[index] = nv.name(); - index++; - context[index] = nv.value().extract_string(); - index++; - } - } - - cachedOperationContext = context; - } - - // Good citizen: In the interest of efficiency, we assume - // interceptors will be "good citizens" in that they will not - // modify the contents of the String[] array. - - return cachedOperationContext; - } - - /** - * See RequestInfoImpl for javadoc. - */ - public Any result (){ - checkAccess( MID_RESULT ); - - if( cachedResult == null ) { - if( request == null ) { - throw stdWrapper.piOperationNotSupported5() ; - } - // Get the result from the DII request data. - NamedValue nvResult = request.result( ); - - if( nvResult == null ) { - throw wrapper.piDiiResultIsNull() ; - } - - cachedResult = nvResult.value(); - } - - // Good citizen: In the interest of efficiency, we assume that - // interceptors will not modify the contents of the result Any. - // Otherwise, we would need to create a deep copy of the Any. - - return cachedResult; - } - - /** - * See RequestInfoImpl for javadoc. - */ - public boolean response_expected (){ - // access is currently valid for all states: - //checkAccess( MID_RESPONSE_EXPECTED ); - return ! messageMediator.isOneWay(); - } - - /** - * See RequestInfoImpl for javadoc. - */ - public Object forward_reference (){ - checkAccess( MID_FORWARD_REFERENCE ); - // Check to make sure we are in LOCATION_FORWARD - // state as per ptc/00-08-06, table 21-1 - // footnote 2. - if( replyStatus != LOCATION_FORWARD.value ) { - throw stdWrapper.invalidPiCall1() ; - } - - // Do not cache this value since if an interceptor raises - // forward request then the next interceptor in the - // list should see the new value. - IOR ior = getLocatedIOR(); - return iorToObject(ior); - } - - private IOR getLocatedIOR() - { - IOR ior; - CorbaContactInfoList contactInfoList = (CorbaContactInfoList) - messageMediator.getContactInfo().getContactInfoList(); - ior = contactInfoList.getEffectiveTargetIOR(); - return ior; - } - - protected void setLocatedIOR(IOR ior) - { - ORB orb = (ORB) messageMediator.getBroker(); - - CorbaContactInfoListIterator iterator = (CorbaContactInfoListIterator) - ((CorbaInvocationInfo)orb.getInvocationInfo()) - .getContactInfoListIterator(); - - // REVISIT - this most likely causes reportRedirect to happen twice. - // Once here and once inside the request dispatcher. - iterator.reportRedirect( - (CorbaContactInfo)messageMediator.getContactInfo(), - ior); - } - - /** - * See RequestInfoImpl for javadoc. - */ - public org.omg.IOP.ServiceContext get_request_service_context( int id ) { - checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT ); - - if( cachedRequestServiceContexts == null ) { - cachedRequestServiceContexts = new HashMap(); - } - - return getServiceContext(cachedRequestServiceContexts, - messageMediator.getRequestServiceContexts(), - id); - } - - /** - * does not contain an etry for that ID, BAD_PARAM with a minor code of - * TBD_BP is raised. - */ - public org.omg.IOP.ServiceContext get_reply_service_context( int id ) { - checkAccess( MID_GET_REPLY_SERVICE_CONTEXT ); - - if( cachedReplyServiceContexts == null ) { - cachedReplyServiceContexts = new HashMap(); - } - - // In the event this is called from a oneway, we will have no - // response object. - // - // In the event this is called after a IIOPConnection.purgeCalls, - // we will have a response object, but that object will - // not contain a header (which would hold the service context - // container). See bug 4624102. - // - // REVISIT: this is the only thing used - // from response at this time. However, a more general solution - // would avoid accessing other parts of response's header. - // - // Instead of throwing a NullPointer, we will - // "gracefully" handle these with a BAD_PARAM with minor code 25. - - try { - ServiceContexts serviceContexts = - messageMediator.getReplyServiceContexts(); - if (serviceContexts == null) { - throw new NullPointerException(); - } - return getServiceContext(cachedReplyServiceContexts, - serviceContexts, id); - } catch (NullPointerException e) { - // REVISIT how this is programmed - not what it does. - // See purge calls test. The waiter is woken up by the - // call to purge calls - but there is no reply containing - // service contexts. - throw stdWrapper.invalidServiceContextId( e ) ; - } - } - - // - // REVISIT - // Override RequestInfoImpl connection to work in framework. - // - - public com.sun.corba.se.spi.legacy.connection.Connection connection() - { - return (com.sun.corba.se.spi.legacy.connection.Connection) - messageMediator.getConnection(); - } - - - - /* - ********************************************************************** - * Package-scope interfaces - **********************************************************************/ - - protected void setInfo(MessageMediator messageMediator) - { - this.messageMediator = (CorbaMessageMediator)messageMediator; - // REVISIT - so mediator can handle DII in subcontract. - this.messageMediator.setDIIInfo(request); - } - - /** - * Set or reset the retry request flag. - */ - void setRetryRequest( RetryType retryRequest ) { - this.retryRequest = retryRequest; - } - - /** - * Retrieve the current retry request status. - */ - RetryType getRetryRequest() { - // 6763340 - return this.retryRequest; - } - - /** - * Increases the entry count by 1. - */ - void incrementEntryCount() { - this.entryCount++; - } - - /** - * Decreases the entry count by 1. - */ - void decrementEntryCount() { - this.entryCount--; - } - - /** - * Retrieve the current entry count - */ - int getEntryCount() { - return this.entryCount; - } - - /** - * Overridden from RequestInfoImpl. Calls the super class, then - * sets the ending point call depending on the reply status. - */ - protected void setReplyStatus( short replyStatus ) { - super.setReplyStatus( replyStatus ); - switch( replyStatus ) { - case SUCCESSFUL.value: - endingPointCall = CALL_RECEIVE_REPLY; - break; - case SYSTEM_EXCEPTION.value: - case USER_EXCEPTION.value: - endingPointCall = CALL_RECEIVE_EXCEPTION; - break; - case LOCATION_FORWARD.value: - case TRANSPORT_RETRY.value: - endingPointCall = CALL_RECEIVE_OTHER; - break; - } - } - - /** - * Sets DII request object in the RequestInfoObject. - */ - protected void setDIIRequest(org.omg.CORBA.Request req) { - request = req; - } - - /** - * Keeps track of whether initiate was called for a DII request. The ORB - * needs to know this so it knows whether to ignore a second call to - * initiateClientPIRequest or not. - */ - protected void setDIIInitiate( boolean diiInitiate ) { - this.diiInitiate = diiInitiate; - } - - /** - * See comment for setDIIInitiate - */ - protected boolean isDIIInitiate() { - return this.diiInitiate; - } - - /** - * The PICurrent stack should only be popped if it was pushed. - * This is generally the case. But exceptions which occur - * after the stub's entry to _request but before the push - * end up in _releaseReply which will try to pop unless told not to. - */ - protected void setPICurrentPushed( boolean piCurrentPushed ) { - this.piCurrentPushed = piCurrentPushed; - } - - protected boolean isPICurrentPushed() { - return this.piCurrentPushed; - } - - /** - * Overridden from RequestInfoImpl. - */ - protected void setException( Exception exception ) { - super.setException( exception ); - - // Clear cached values: - cachedReceivedException = null; - cachedReceivedExceptionId = null; - } - - protected boolean getIsOneWay() { - return ! response_expected(); - } - - /** - * See description for RequestInfoImpl.checkAccess - */ - protected void checkAccess( int methodID ) - throws BAD_INV_ORDER - { - // Make sure currentPoint matches the appropriate index in the - // validCall table: - int validCallIndex = 0; - switch( currentExecutionPoint ) { - case EXECUTION_POINT_STARTING: - switch( startingPointCall ) { - case CALL_SEND_REQUEST: - validCallIndex = 0; - break; - case CALL_SEND_POLL: - validCallIndex = 1; - break; - } - break; - case EXECUTION_POINT_ENDING: - switch( endingPointCall ) { - case CALL_RECEIVE_REPLY: - validCallIndex = 2; - break; - case CALL_RECEIVE_EXCEPTION: - validCallIndex = 3; - break; - case CALL_RECEIVE_OTHER: - validCallIndex = 4; - break; - } - break; - } - - // Check the validCall table: - if( !validCall[methodID][validCallIndex] ) { - throw stdWrapper.invalidPiCall2() ; - } - } - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java 2018-01-30 20:17:13.000000000 -0500 +++ /dev/null 2018-01-30 20:17:13.000000000 -0500 @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.interceptors; - -import org.omg.IOP.Codec; -import org.omg.IOP.CodecFactory; -import org.omg.IOP.CodecFactoryPackage.UnknownEncoding; -import org.omg.IOP.Encoding; -import org.omg.IOP.ENCODING_CDR_ENCAPS; - -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -import org.omg.CORBA.ORB; -import org.omg.CORBA.LocalObject; - -/** - * CodecFactoryImpl is the implementation of the Codec Factory, as described - * in orbos/99-12-02. - */ -public final class CodecFactoryImpl - extends org.omg.CORBA.LocalObject - implements CodecFactory -{ - // The ORB that created this Codec Factory - private ORB orb; - private ORBUtilSystemException wrapper ; - - // The maximum minor version of GIOP supported by this codec factory. - // Currently, this is 1.2. - private static final int MAX_MINOR_VERSION_SUPPORTED = 2; - - // The pre-created minor versions of Codec version 1.0, 1.1, ..., - // 1.(MAX_MINOR_VERSION_SUPPORTED) - private Codec codecs[] = new Codec[MAX_MINOR_VERSION_SUPPORTED + 1]; - - /** - * Creates a new CodecFactory implementation. Stores the ORB that - * created this factory, for later use by the Codec. - */ - public CodecFactoryImpl( ORB orb ) { - this.orb = orb; - wrapper = ORBUtilSystemException.get( - (com.sun.corba.se.spi.orb.ORB)orb, - CORBALogDomains.RPC_PROTOCOL ) ; - - // Precreate a codec for version 1.0 through - // 1.(MAX_MINOR_VERSION_SUPPORTED). This can be - // done since Codecs are immutable in their current implementation. - // This is an optimization that eliminates the overhead of creating - // a new Codec each time create_codec is called. - for( int minor = 0; minor <= MAX_MINOR_VERSION_SUPPORTED; minor++ ) { - codecs[minor] = new CDREncapsCodec( orb, 1, minor ); - } - } - - /** - * Creates a codec of the given encoding. The only format recognized - * by this factory is ENCODING_CDR_ENCAPS, versions 1.0 through - * 1.(MAX_MINOR_VERSION_SUPPORTED). - * - * @exception UnknownEncoding Thrown if this factory cannot create a - * Codec of the given encoding. - */ - public Codec create_codec ( Encoding enc ) - throws UnknownEncoding - { - if( enc == null ) nullParam(); - - Codec result = null; - - // This is the only format we can currently create codecs for: - if( (enc.format == ENCODING_CDR_ENCAPS.value) && - (enc.major_version == 1) ) - { - if( (enc.minor_version >= 0) && - (enc.minor_version <= MAX_MINOR_VERSION_SUPPORTED) ) - { - result = codecs[enc.minor_version]; - } - } - - if( result == null ) { - throw new UnknownEncoding(); - } - - return result; - } - - /** - * Called when an invalid null parameter was passed. Throws a - * BAD_PARAM with a minor code of 1 - */ - private void nullParam() - { - throw wrapper.nullParam() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/IORInfoImpl.java 2018-01-30 20:17:14.000000000 -0500 +++ /dev/null 2018-01-30 20:17:14.000000000 -0500 @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.interceptors; - -import java.util.Iterator ; - -import org.omg.IOP.TaggedComponent; - -import org.omg.CORBA.BAD_INV_ORDER; -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.INV_POLICY; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.Policy; -import org.omg.CORBA.LocalObject; - -import org.omg.PortableInterceptor.IORInfo; -import org.omg.PortableInterceptor.ObjectReferenceTemplate; -import org.omg.PortableInterceptor.ObjectReferenceFactory; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.oa.ObjectAdapter; - -import com.sun.corba.se.spi.legacy.interceptor.IORInfoExt; -import com.sun.corba.se.spi.legacy.interceptor.UnknownType; - -import com.sun.corba.se.spi.ior.IORTemplate; -import com.sun.corba.se.spi.ior.TaggedProfileTemplate; -import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.InterceptorsSystemException ; -import com.sun.corba.se.impl.logging.OMGSystemException ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * IORInfoImpl is the implementation of the IORInfo class, as described - * in orbos/99-12-02, section 7. - */ -public final class IORInfoImpl - extends LocalObject - implements IORInfo, IORInfoExt -{ - // State values that determine which methods are allowed. - // get_effective_policy, manager_id, and adapter_state are valid unless STATE_DONE - - // add_component, and add_component_to_profile are valid. - private static final int STATE_INITIAL = 0 ; - - // adapter_template, and R/W to current_factory are valid - private static final int STATE_ESTABLISHED = 1 ; - - // No methods are valid in this state - private static final int STATE_DONE = 2 ; - - // The current state of this object - private int state = STATE_INITIAL ; - - // The ObjectAdapter associated with this IORInfo object. - private ObjectAdapter adapter; - - private ORB orb ; - - private ORBUtilSystemException orbutilWrapper ; - private InterceptorsSystemException wrapper ; - private OMGSystemException omgWrapper ; - - /** - * Creates a new IORInfo implementation. This info object will establish - * tagged components with the template for the provided IOR Template. - */ - IORInfoImpl( ObjectAdapter adapter ) { - this.orb = adapter.getORB() ; - - orbutilWrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - wrapper = InterceptorsSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - omgWrapper = OMGSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - - this.adapter = adapter; - } - - /** - * An ORB service implementation may determine what server side policy - * of a particular type is in effect for an IOR being constructed by - * calling the get_effective_policy operation. When the IOR being - * constructed is for an object implemented using a POA, all Policy - * objects passed to the PortableServer::POA::create_POA call that - * created that POA are accessible via get_effective_policy. - *

- * If a policy for the given type is not known to the ORB, then this - * operation will raise INV_POLICY with a standard minor code of 2. - * - * @param type The CORBA::PolicyType specifying the type of policy to - * return. - * @return The effective CORBA::Policy object of the requested type. - * If the given policy type is known, but no policy of that tpye is - * in effect, then this operation will return a nil object reference. - */ - public Policy get_effective_policy (int type) { - checkState( STATE_INITIAL, STATE_ESTABLISHED ) ; - - return adapter.getEffectivePolicy( type ); - } - - /** - * A portable ORB service implementation calls this method from its - * implementation of establish_components to add a tagged component to - * the set which will be included when constructing IORs. The - * components in this set will be included in all profiles. - *

- * Any number of components may exist with the same component ID. - * - * @param tagged_component The IOP::TaggedComponent to add - */ - public void add_ior_component (TaggedComponent tagged_component) { - checkState( STATE_INITIAL ) ; - - if( tagged_component == null ) nullParam(); - addIORComponentToProfileInternal( tagged_component, - adapter.getIORTemplate().iterator()); - } - - /** - * A portable ORB service implementation calls this method from its - * implementation of establish_components to add a tagged component to - * the set which will be included when constructing IORs. The - * components in this set will be included in the specified profile. - *

- * Any number of components may exist with the same component ID. - *

- * If the given profile ID does not define a known profile or it is - * impossible to add components to thgat profile, BAD_PARAM is raised - * with a minor code of TBD_BP + 3. - * - * @param tagged_component The IOP::TaggedComponent to add. - * @param profile_id The IOP::ProfileId tof the profile to which this - * component will be added. - */ - public void add_ior_component_to_profile ( - TaggedComponent tagged_component, int profile_id ) - { - checkState( STATE_INITIAL ) ; - - if( tagged_component == null ) nullParam(); - addIORComponentToProfileInternal( - tagged_component, adapter.getIORTemplate().iteratorById( - profile_id ) ); - } - - /** - * @param type The type of the server port - * (see connection.ORBSocketFactory for discussion). - * @return The listen port number for that type. - * @throws UnknownType if no port of the given type is found. - */ - public int getServerPort(String type) - throws UnknownType - { - checkState( STATE_INITIAL, STATE_ESTABLISHED ) ; - - int port = - orb.getLegacyServerSocketManager() - .legacyGetTransientOrPersistentServerPort(type); - if (port == -1) { - throw new UnknownType(); - } - return port; - } - - public ObjectAdapter getObjectAdapter() - { - return adapter; - } - - public int manager_id() - { - checkState( STATE_INITIAL, STATE_ESTABLISHED) ; - - return adapter.getManagerId() ; - } - - public short state() - { - checkState( STATE_INITIAL, STATE_ESTABLISHED) ; - - return adapter.getState() ; - } - - public ObjectReferenceTemplate adapter_template() - { - checkState( STATE_ESTABLISHED) ; - - // At this point, the iortemp must contain only a single - // IIOPProfileTemplate. This is a restriction of our - // implementation. Also, note the the ObjectReferenceTemplate - // is called when a certain POA is created in a certain ORB - // in a certain server, so the server_id, orb_id, and - // poa_id operations must be well-defined no matter what - // kind of implementation is used: e.g., if a POA creates - // IORs with multiple profiles, they must still all agree - // about this information. Thus, we are justified in - // extracting the single IIOPProfileTemplate to create - // an ObjectReferenceTemplate here. - - return adapter.getAdapterTemplate() ; - } - - public ObjectReferenceFactory current_factory() - { - checkState( STATE_ESTABLISHED) ; - - return adapter.getCurrentFactory() ; - } - - public void current_factory( ObjectReferenceFactory factory ) - { - checkState( STATE_ESTABLISHED) ; - - adapter.setCurrentFactory( factory ) ; - } - - /** - * Internal utility method to add an IOR component to the set of profiles - * present in the iterator. - */ - private void addIORComponentToProfileInternal( - TaggedComponent tagged_component, Iterator iterator ) - { - // Convert the given IOP::TaggedComponent into the appropriate - // type for the TaggedProfileTemplate - TaggedComponentFactoryFinder finder = - orb.getTaggedComponentFactoryFinder(); - Object newTaggedComponent = finder.create( orb, tagged_component ); - - // Iterate through TaggedProfileTemplates and add the given tagged - // component to the appropriate one(s). - boolean found = false; - while( iterator.hasNext() ) { - found = true; - TaggedProfileTemplate taggedProfileTemplate = - (TaggedProfileTemplate)iterator.next(); - taggedProfileTemplate.add( newTaggedComponent ); - } - - // If no profile was found with the given id, throw a BAD_PARAM: - // (See orbos/00-08-06, section 21.5.3.3.) - if( !found ) { - throw omgWrapper.invalidProfileId() ; - } - } - - /** - * Called when an invalid null parameter was passed. Throws a - * BAD_PARAM with a minor code of 1 - */ - private void nullParam() - { - throw orbutilWrapper.nullParam() ; - } - - // REVISIT: add minor codes! - - private void checkState( int expectedState ) - { - if (expectedState != state) - throw wrapper.badState1( new Integer(expectedState), new Integer(state) ) ; - } - - private void checkState( int expectedState1, int expectedState2 ) - { - if ((expectedState1 != state) && (expectedState2 != state)) - throw wrapper.badState2( new Integer(expectedState1), - new Integer(expectedState2), new Integer(state) ) ; - } - - void makeStateEstablished() - { - checkState( STATE_INITIAL ) ; - - state = STATE_ESTABLISHED ; - } - - void makeStateDone() - { - checkState( STATE_ESTABLISHED ) ; - - state = STATE_DONE ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorInvoker.java 2018-01-30 20:17:14.000000000 -0500 +++ /dev/null 2018-01-30 20:17:14.000000000 -0500 @@ -1,662 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.interceptors; - -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.portable.Delegate; -import org.omg.PortableInterceptor.LOCATION_FORWARD; -import org.omg.PortableInterceptor.SUCCESSFUL; -import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; -import org.omg.PortableInterceptor.TRANSPORT_RETRY; -import org.omg.PortableInterceptor.USER_EXCEPTION; -import org.omg.PortableInterceptor.ClientRequestInfo; -import org.omg.PortableInterceptor.ClientRequestInterceptor; -import org.omg.PortableInterceptor.ForwardRequest; -import org.omg.PortableInterceptor.IORInterceptor; -import org.omg.PortableInterceptor.IORInterceptor_3_0; -import org.omg.PortableInterceptor.ServerRequestInfo; -import org.omg.PortableInterceptor.ServerRequestInterceptor; -import org.omg.PortableInterceptor.ObjectReferenceTemplate; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.oa.ObjectAdapter; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.impl.orbutil.ORBUtility; - -/** - * Handles invocation of interceptors. Has specific knowledge of how to - * invoke IOR, ClientRequest, and ServerRequest interceptors. - * Makes use of the InterceptorList to retrieve the list of interceptors to - * be invoked. Most methods in this class are package scope so that they - * may only be called from the PIHandlerImpl. - */ -public class InterceptorInvoker { - - // The ORB - private ORB orb; - - // The list of interceptors to be invoked - private InterceptorList interceptorList; - - // True if interceptors are to be invoked, or false if not - // Note: This is a global enable/disable flag, whereas the enable flag - // in the RequestInfoStack in PIHandlerImpl is only for a particular Thread. - private boolean enabled = false; - - // PICurrent variable. - private PICurrent current; - - // NOTE: Be careful about adding additional attributes to this class. - // Multiple threads may be calling methods on this invoker at the same - // time. - - /** - * Creates a new Interceptor Invoker. Constructor is package scope so - * only the ORB can create it. The invoker is initially disabled, and - * must be explicitly enabled using setEnabled(). - */ - InterceptorInvoker( ORB orb, InterceptorList interceptorList, - PICurrent piCurrent ) - { - this.orb = orb; - this.interceptorList = interceptorList; - this.enabled = false; - this.current = piCurrent; - } - - /** - * Enables or disables the interceptor invoker - */ - void setEnabled( boolean enabled ) { - this.enabled = enabled; - } - - /* - ********************************************************************** - * IOR Interceptor invocation - **********************************************************************/ - - /** - * Called when a new POA is created. - * - * @param oa The Object Adapter associated with the IOR interceptor. - */ - void objectAdapterCreated( ObjectAdapter oa ) { - // If invocation is not yet enabled, don't do anything. - if( enabled ) { - // Create IORInfo object to pass to IORInterceptors: - IORInfoImpl info = new IORInfoImpl( oa ); - - // Call each IORInterceptor: - IORInterceptor[] iorInterceptors = - (IORInterceptor[])interceptorList.getInterceptors( - InterceptorList.INTERCEPTOR_TYPE_IOR ); - int size = iorInterceptors.length; - - // Implementation note: - // This loop counts backwards for greater efficiency. - // Benchmarks have shown that counting down is more efficient - // than counting up in Java for loops, as a compare to zero is - // faster than a subtract and compare to zero. In this case, - // it doesn't really matter much, but it's simply a force of habit. - - for( int i = (size - 1); i >= 0; i-- ) { - IORInterceptor interceptor = iorInterceptors[i]; - try { - interceptor.establish_components( info ); - } - catch( Exception e ) { - // as per PI spec (orbos/99-12-02 sec 7.2.1), if - // establish_components throws an exception, ignore it. - } - } - - // Change the state so that only template operations are valid - info.makeStateEstablished() ; - - for( int i = (size - 1); i >= 0; i-- ) { - IORInterceptor interceptor = iorInterceptors[i]; - if (interceptor instanceof IORInterceptor_3_0) { - IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ; - // Note that exceptions here are NOT ignored, as per the - // ORT spec (orbos/01-01-04) - interceptor30.components_established( info ); - } - } - - // Change the state so that no operations are valid, - // in case a reference to info escapes this scope. - // This also completes the actions associated with the - // template interceptors on this POA. - info.makeStateDone() ; - } - } - - void adapterManagerStateChanged( int managerId, short newState ) - { - if (enabled) { - IORInterceptor[] interceptors = - (IORInterceptor[])interceptorList.getInterceptors( - InterceptorList.INTERCEPTOR_TYPE_IOR ); - int size = interceptors.length; - - for( int i = (size - 1); i >= 0; i-- ) { - try { - IORInterceptor interceptor = interceptors[i]; - if (interceptor instanceof IORInterceptor_3_0) { - IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ; - interceptor30.adapter_manager_state_changed( managerId, - newState ); - } - } catch (Exception exc) { - // No-op: ignore exception in this case - } - } - } - } - - void adapterStateChanged( ObjectReferenceTemplate[] templates, - short newState ) - { - if (enabled) { - IORInterceptor[] interceptors = - (IORInterceptor[])interceptorList.getInterceptors( - InterceptorList.INTERCEPTOR_TYPE_IOR ); - int size = interceptors.length; - - for( int i = (size - 1); i >= 0; i-- ) { - try { - IORInterceptor interceptor = interceptors[i]; - if (interceptor instanceof IORInterceptor_3_0) { - IORInterceptor_3_0 interceptor30 = (IORInterceptor_3_0)interceptor ; - interceptor30.adapter_state_changed( templates, newState ); - } - } catch (Exception exc) { - // No-op: ignore exception in this case - } - } - } - } - - /* - ********************************************************************** - * Client Interceptor invocation - **********************************************************************/ - - /** - * Invokes either send_request, or send_poll, depending on the value - * of info.getStartingPointCall() - */ - void invokeClientInterceptorStartingPoint( ClientRequestInfoImpl info ) { - // If invocation is not yet enabled, don't do anything. - if( enabled ) { - try { - // Make a a fresh slot table available to TSC in case - // interceptors need to make out calls. - // Client's TSC is now RSC via RequestInfo. - current.pushSlotTable( ); - info.setPICurrentPushed( true ); - info.setCurrentExecutionPoint( info.EXECUTION_POINT_STARTING ); - - // Get all ClientRequestInterceptors: - ClientRequestInterceptor[] clientInterceptors = - (ClientRequestInterceptor[])interceptorList. - getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT ); - int size = clientInterceptors.length; - - // We will assume that all interceptors returned successfully, - // and adjust the flowStackIndex to the appropriate value if - // we later discover otherwise. - int flowStackIndex = size; - boolean continueProcessing = true; - - // Determine whether we are calling send_request or send_poll: - // (This is currently commented out because our ORB does not - // yet support the Messaging specification, so send_poll will - // never occur. Once we have implemented messaging, this may - // be uncommented.) - // int startingPointCall = info.getStartingPointCall(); - for( int i = 0; continueProcessing && (i < size); i++ ) { - try { - clientInterceptors[i].send_request( info ); - - // Again, it is not necessary for a switch here, since - // there is only one starting point call type (see - // above comment). - - //switch( startingPointCall ) { - //case ClientRequestInfoImpl.CALL_SEND_REQUEST: - //clientInterceptors[i].send_request( info ); - //break; - //case ClientRequestInfoImpl.CALL_SEND_POLL: - //clientInterceptors[i].send_poll( info ); - //break; - //} - - } - catch( ForwardRequest e ) { - // as per PI spec (orbos/99-12-02 sec 5.2.1.), if - // interception point throws a ForwardRequest, - // no other Interceptors' send_request operations are - // called. - flowStackIndex = i; - info.setForwardRequest( e ); - info.setEndingPointCall( - ClientRequestInfoImpl.CALL_RECEIVE_OTHER ); - info.setReplyStatus( LOCATION_FORWARD.value ); - - updateClientRequestDispatcherForward( info ); - - // For some reason, using break here causes the VM on - // NT to lose track of the value of flowStackIndex - // after exiting the for loop. I changed this to - // check a boolean value instead and it seems to work - // fine. - continueProcessing = false; - } - catch( SystemException e ) { - // as per PI spec (orbos/99-12-02 sec 5.2.1.), if - // interception point throws a SystemException, - // no other Interceptors' send_request operations are - // called. - flowStackIndex = i; - info.setEndingPointCall( - ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); - info.setException( e ); - - // For some reason, using break here causes the VM on - // NT to lose track of the value of flowStackIndex - // after exiting the for loop. I changed this to - // check a boolean value instead and it seems to - // work fine. - continueProcessing = false; - } - } - - // Remember where we left off in the flow stack: - info.setFlowStackIndex( flowStackIndex ); - } - finally { - // Make the SlotTable fresh for the next interception point. - current.resetSlotTable( ); - } - } // end enabled check - } - - /** - * Invokes either receive_reply, receive_exception, or receive_other, - * depending on the value of info.getEndingPointCall() - */ - void invokeClientInterceptorEndingPoint( ClientRequestInfoImpl info ) { - // If invocation is not yet enabled, don't do anything. - if( enabled ) { - try { - // NOTE: It is assumed someplace else prepared a - // fresh TSC slot table. - - info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING ); - - // Get all ClientRequestInterceptors: - ClientRequestInterceptor[] clientInterceptors = - (ClientRequestInterceptor[])interceptorList. - getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT ); - int flowStackIndex = info.getFlowStackIndex(); - - // Determine whether we are calling receive_reply, - // receive_exception, or receive_other: - int endingPointCall = info.getEndingPointCall(); - - // If we would be calling RECEIVE_REPLY, but this is a - // one-way call, override this and call receive_other: - if( ( endingPointCall == - ClientRequestInfoImpl.CALL_RECEIVE_REPLY ) && - info.getIsOneWay() ) - { - endingPointCall = ClientRequestInfoImpl.CALL_RECEIVE_OTHER; - info.setEndingPointCall( endingPointCall ); - } - - // Only step through the interceptors whose starting points - // have successfully returned. - // Unlike the previous loop, this one counts backwards for a - // reason - we must execute these in the reverse order of the - // starting points. - for( int i = (flowStackIndex - 1); i >= 0; i-- ) { - - try { - switch( endingPointCall ) { - case ClientRequestInfoImpl.CALL_RECEIVE_REPLY: - clientInterceptors[i].receive_reply( info ); - break; - case ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION: - clientInterceptors[i].receive_exception( info ); - break; - case ClientRequestInfoImpl.CALL_RECEIVE_OTHER: - clientInterceptors[i].receive_other( info ); - break; - } - } - catch( ForwardRequest e ) { - - // as per PI spec (orbos/99-12-02 sec 5.2.1.), if - // interception point throws a ForwardException, - // ending point call changes to receive_other. - endingPointCall = - ClientRequestInfoImpl.CALL_RECEIVE_OTHER; - info.setEndingPointCall( endingPointCall ); - info.setReplyStatus( LOCATION_FORWARD.value ); - info.setForwardRequest( e ); - updateClientRequestDispatcherForward( info ); - } - catch( SystemException e ) { - - // as per PI spec (orbos/99-12-02 sec 5.2.1.), if - // interception point throws a SystemException, - // ending point call changes to receive_exception. - endingPointCall = - ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION; - info.setEndingPointCall( endingPointCall ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); - info.setException( e ); - } - } - } - finally { - // See doc for setPICurrentPushed as to why this is necessary. - // Check info for null in case errors happen before initiate. - if (info != null && info.isPICurrentPushed()) { - current.popSlotTable( ); - // After the pop, original client's TSC slot table - // remains avaiable via PICurrent. - } - } - } // end enabled check - } - - /* - ********************************************************************** - * Server Interceptor invocation - **********************************************************************/ - - /** - * Invokes receive_request_service_context interception points. - */ - void invokeServerInterceptorStartingPoint( ServerRequestInfoImpl info ) { - // If invocation is not yet enabled, don't do anything. - if( enabled ) { - try { - // Make a fresh slot table for RSC. - current.pushSlotTable(); - info.setSlotTable(current.getSlotTable()); - - // Make a fresh slot table for TSC in case - // interceptors need to make out calls. - current.pushSlotTable( ); - - info.setCurrentExecutionPoint( info.EXECUTION_POINT_STARTING ); - - // Get all ServerRequestInterceptors: - ServerRequestInterceptor[] serverInterceptors = - (ServerRequestInterceptor[])interceptorList. - getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER ); - int size = serverInterceptors.length; - - // We will assume that all interceptors returned successfully, - // and adjust the flowStackIndex to the appropriate value if - // we later discover otherwise. - int flowStackIndex = size; - boolean continueProcessing = true; - - // Currently, there is only one server-side starting point - // interceptor called receive_request_service_contexts. - for( int i = 0; continueProcessing && (i < size); i++ ) { - - try { - serverInterceptors[i]. - receive_request_service_contexts( info ); - } - catch( ForwardRequest e ) { - // as per PI spec (orbos/99-12-02 sec 5.3.1.), if - // interception point throws a ForwardRequest, - // no other Interceptors' starting points are - // called and send_other is called. - flowStackIndex = i; - info.setForwardRequest( e ); - info.setIntermediatePointCall( - ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE ); - info.setEndingPointCall( - ServerRequestInfoImpl.CALL_SEND_OTHER ); - info.setReplyStatus( LOCATION_FORWARD.value ); - - // For some reason, using break here causes the VM on - // NT to lose track of the value of flowStackIndex - // after exiting the for loop. I changed this to - // check a boolean value instead and it seems to work - // fine. - continueProcessing = false; - } - catch( SystemException e ) { - - // as per PI spec (orbos/99-12-02 sec 5.3.1.), if - // interception point throws a SystemException, - // no other Interceptors' starting points are - // called. - flowStackIndex = i; - info.setException( e ); - info.setIntermediatePointCall( - ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE ); - info.setEndingPointCall( - ServerRequestInfoImpl.CALL_SEND_EXCEPTION ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); - - // For some reason, using break here causes the VM on - // NT to lose track of the value of flowStackIndex - // after exiting the for loop. I changed this to - // check a boolean value instead and it seems to - // work fine. - continueProcessing = false; - } - - } - - // Remember where we left off in the flow stack: - info.setFlowStackIndex( flowStackIndex ); - } - finally { - // The remaining points, ServantManager and Servant - // all run in the same logical thread. - current.popSlotTable( ); - // Now TSC and RSC are equivalent. - } - } // end enabled check - } - - /** - * Invokes receive_request interception points - */ - void invokeServerInterceptorIntermediatePoint( - ServerRequestInfoImpl info ) - { - int intermediatePointCall = info.getIntermediatePointCall(); - // If invocation is not yet enabled, don't do anything. - if( enabled && ( intermediatePointCall != - ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE ) ) - { - // NOTE: do not touch the slotStack. The RSC and TSC are - // equivalent at this point. - - info.setCurrentExecutionPoint( info.EXECUTION_POINT_INTERMEDIATE ); - - // Get all ServerRequestInterceptors: - ServerRequestInterceptor[] serverInterceptors = - (ServerRequestInterceptor[]) - interceptorList.getInterceptors( - InterceptorList.INTERCEPTOR_TYPE_SERVER ); - int size = serverInterceptors.length; - - // Currently, there is only one server-side intermediate point - // interceptor called receive_request. - for( int i = 0; i < size; i++ ) { - - try { - serverInterceptors[i].receive_request( info ); - } - catch( ForwardRequest e ) { - - // as per PI spec (orbos/99-12-02 sec 5.3.1.), if - // interception point throws a ForwardRequest, - // no other Interceptors' intermediate points are - // called and send_other is called. - info.setForwardRequest( e ); - info.setEndingPointCall( - ServerRequestInfoImpl.CALL_SEND_OTHER ); - info.setReplyStatus( LOCATION_FORWARD.value ); - break; - } - catch( SystemException e ) { - - // as per PI spec (orbos/99-12-02 sec 5.3.1.), if - // interception point throws a SystemException, - // no other Interceptors' starting points are - // called. - info.setException( e ); - info.setEndingPointCall( - ServerRequestInfoImpl.CALL_SEND_EXCEPTION ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); - break; - } - } - } // end enabled check - } - - /** - * Invokes either send_reply, send_exception, or send_other, - * depending on the value of info.getEndingPointCall() - */ - void invokeServerInterceptorEndingPoint( ServerRequestInfoImpl info ) { - // If invocation is not yet enabled, don't do anything. - if( enabled ) { - try { - // NOTE: do not touch the slotStack. The RSC and TSC are - // equivalent at this point. - - // REVISIT: This is moved out to PIHandlerImpl until dispatch - // path is rearchitected. It must be there so that - // it always gets executed so if an interceptor raises - // an exception any service contexts added in earlier points - // this point get put in the exception reply (via the SC Q). - //info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING ); - - // Get all ServerRequestInterceptors: - ServerRequestInterceptor[] serverInterceptors = - (ServerRequestInterceptor[])interceptorList. - getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER ); - int flowStackIndex = info.getFlowStackIndex(); - - // Determine whether we are calling - // send_exception, or send_other: - int endingPointCall = info.getEndingPointCall(); - - // Only step through the interceptors whose starting points - // have successfully returned. - for( int i = (flowStackIndex - 1); i >= 0; i-- ) { - try { - switch( endingPointCall ) { - case ServerRequestInfoImpl.CALL_SEND_REPLY: - serverInterceptors[i].send_reply( info ); - break; - case ServerRequestInfoImpl.CALL_SEND_EXCEPTION: - serverInterceptors[i].send_exception( info ); - break; - case ServerRequestInfoImpl.CALL_SEND_OTHER: - serverInterceptors[i].send_other( info ); - break; - } - } - catch( ForwardRequest e ) { - // as per PI spec (orbos/99-12-02 sec 5.3.1.), if - // interception point throws a ForwardException, - // ending point call changes to receive_other. - endingPointCall = - ServerRequestInfoImpl.CALL_SEND_OTHER; - info.setEndingPointCall( endingPointCall ); - info.setForwardRequest( e ); - info.setReplyStatus( LOCATION_FORWARD.value ); - info.setForwardRequestRaisedInEnding(); - } - catch( SystemException e ) { - // as per PI spec (orbos/99-12-02 sec 5.3.1.), if - // interception point throws a SystemException, - // ending point call changes to send_exception. - endingPointCall = - ServerRequestInfoImpl.CALL_SEND_EXCEPTION; - info.setEndingPointCall( endingPointCall ); - info.setException( e ); - info.setReplyStatus( SYSTEM_EXCEPTION.value ); - } - } - - // Remember that all interceptors' starting and ending points - // have already been executed so we need not do anything. - info.setAlreadyExecuted( true ); - } - finally { - // Get rid of the Server side RSC. - current.popSlotTable(); - } - } // end enabled check - } - - /* - ********************************************************************** - * Private utility methods - **********************************************************************/ - - /** - * Update the client delegate in the event of a ForwardRequest, given the - * information in the passed-in info object. - */ - private void updateClientRequestDispatcherForward( - ClientRequestInfoImpl info ) - { - ForwardRequest forwardRequest = info.getForwardRequestException(); - - // ForwardRequest may be null if the forwarded IOR is set internal - // to the ClientRequestDispatcher rather than explicitly through Portable - // Interceptors. In this case, we need not update the client - // delegate ForwardRequest object. - if( forwardRequest != null ) { - org.omg.CORBA.Object object = forwardRequest.forward; - - // Convert the forward object into an IOR: - IOR ior = ORBUtility.getIOR( object ) ; - info.setLocatedIOR( ior ); - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorList.java 2018-01-30 20:17:15.000000000 -0500 +++ /dev/null 2018-01-30 20:17:15.000000000 -0500 @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.interceptors; - -import org.omg.PortableInterceptor.Interceptor; -import org.omg.PortableInterceptor.ORBInitInfo; -import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; - -import org.omg.CORBA.INTERNAL; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.lang.reflect.Array; - -import com.sun.corba.se.impl.logging.InterceptorsSystemException ; - -/** - * Provides a repository of registered Portable Interceptors, organized - * by type. This list is designed to be accessed as efficiently as - * possible during runtime, with the expense of added complexity during - * initialization and interceptor registration. The class is designed - * to easily allow for the addition of new interceptor types. - */ -public class InterceptorList { - - // Interceptor type list. If additional interceptors are needed, - // add additional types in numerical order (do not skip numbers), - // and update NUM_INTERCEPTOR_TYPES and classTypes accordingly. - // NUM_INTERCEPTOR_TYPES represents the number of interceptor - // types, so we know how many lists to maintain. - static final int INTERCEPTOR_TYPE_CLIENT = 0; - static final int INTERCEPTOR_TYPE_SERVER = 1; - static final int INTERCEPTOR_TYPE_IOR = 2; - - static final int NUM_INTERCEPTOR_TYPES = 3; - - // Array of class types for interceptors. This is used to create the - // appropriate array type for each interceptor type. These must - // match the indices of the constants declared above. - static final Class[] classTypes = { - org.omg.PortableInterceptor.ClientRequestInterceptor.class, - org.omg.PortableInterceptor.ServerRequestInterceptor.class, - org.omg.PortableInterceptor.IORInterceptor.class - }; - - // True if no further interceptors may be registered with this list. - private boolean locked = false; - private InterceptorsSystemException wrapper ; - - // List of interceptors currently registered. There are - // NUM_INTERCEPTOR_TYPES lists of registered interceptors. - // For example, interceptors[INTERCEPTOR_TYPE_CLIENT] contains an array - // of objects of type ClientRequestInterceptor. - private Interceptor[][] interceptors = - new Interceptor[NUM_INTERCEPTOR_TYPES][]; - - /** - * Creates a new Interceptor List. Constructor is package scope so - * only the ORB can create it. - */ - InterceptorList( InterceptorsSystemException wrapper ) { - this.wrapper = wrapper ; - // Create empty interceptors arrays for each type: - initInterceptorArrays(); - } - - /** - * Registers an interceptor of the given type into the interceptor list. - * The type is one of: - *

- * - * @exception DuplicateName Thrown if an interceptor of the given - * name already exists for the given type. - */ - void register_interceptor( Interceptor interceptor, int type ) - throws DuplicateName - { - // If locked, deny any further addition of interceptors. - if( locked ) { - throw wrapper.interceptorListLocked() ; - } - - // Cache interceptor name: - String interceptorName = interceptor.name(); - boolean anonymous = interceptorName.equals( "" ); - boolean foundDuplicate = false; - Interceptor[] interceptorList = interceptors[type]; - - // If this is not an anonymous interceptor, - // search for an interceptor of the same name in this category: - if( !anonymous ) { - int size = interceptorList.length; - - // An O(n) search will suffice because register_interceptor is not - // likely to be called often. - for( int i = 0; i < size; i++ ) { - Interceptor in = (Interceptor)interceptorList[i]; - if( in.name().equals( interceptorName ) ) { - foundDuplicate = true; - break; - } - } - } - - if( !foundDuplicate ) { - growInterceptorArray( type ); - interceptors[type][interceptors[type].length-1] = interceptor; - } - else { - throw new DuplicateName( interceptorName ); - } - } - - /** - * Locks this interceptor list so that no more interceptors may be - * registered. This method is called after all interceptors are - * registered for security reasons. - */ - void lock() { - locked = true; - } - - /** - * Retrieves an array of interceptors of the given type. For efficiency, - * the type parameter is assumed to be valid. - */ - Interceptor[] getInterceptors( int type ) { - return interceptors[type]; - } - - /** - * Returns true if there is at least one interceptor of the given type, - * or false if not. - */ - boolean hasInterceptorsOfType( int type ) { - return interceptors[type].length > 0; - } - - /** - * Initializes all interceptors arrays to zero-length arrays of the - * correct type, based on the classTypes list. - */ - private void initInterceptorArrays() { - for( int type = 0; type < NUM_INTERCEPTOR_TYPES; type++ ) { - Class classType = classTypes[type]; - - // Create a zero-length array for each type: - interceptors[type] = - (Interceptor[])Array.newInstance( classType, 0 ); - } - } - - /** - * Grows the given interceptor array by one: - */ - private void growInterceptorArray( int type ) { - Class classType = classTypes[type]; - int currentLength = interceptors[type].length; - Interceptor[] replacementArray; - - // Create new array to replace the old one. The new array will be - // one element larger but have the same type as the old one. - replacementArray = (Interceptor[]) - Array.newInstance( classType, currentLength + 1 ); - System.arraycopy( interceptors[type], 0, - replacementArray, 0, currentLength ); - interceptors[type] = replacementArray; - } - - /** - * Destroys all interceptors in this list by invoking their destroy() - * method. - */ - void destroyAll() { - int numTypes = interceptors.length; - - for( int i = 0; i < numTypes; i++ ) { - int numInterceptors = interceptors[i].length; - for( int j = 0; j < numInterceptors; j++ ) { - interceptors[i][j].destroy(); - } - } - } - - /** - * Sort interceptors. - */ - void sortInterceptors() { - List sorted = null; - List unsorted = null; - - int numTypes = interceptors.length; - - for( int i = 0; i < numTypes; i++ ) { - int numInterceptors = interceptors[i].length; - if (numInterceptors > 0) { - // Get fresh sorting bins for each non empty type. - sorted = new ArrayList(); // not synchronized like we want. - unsorted = new ArrayList(); - } - for( int j = 0; j < numInterceptors; j++ ) { - Interceptor interceptor = interceptors[i][j]; - if (interceptor instanceof Comparable) { - sorted.add(interceptor); - } else { - unsorted.add(interceptor); - } - } - if (numInterceptors > 0 && sorted.size() > 0) { - // Let the RuntimeExceptions thrown by sort - // (i.e., ClassCastException and UnsupportedOperationException) - // flow back to the user. - Collections.sort(sorted); - Iterator sortedIterator = sorted.iterator(); - Iterator unsortedIterator = unsorted.iterator(); - for( int j = 0; j < numInterceptors; j++ ) { - if (sortedIterator.hasNext()) { - interceptors[i][j] = - (Interceptor) sortedIterator.next(); - } else if (unsortedIterator.hasNext()) { - interceptors[i][j] = - (Interceptor) unsortedIterator.next(); - } else { - throw wrapper.sortSizeMismatch() ; - } - } - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java 2018-01-30 20:17:16.000000000 -0500 +++ /dev/null 2018-01-30 20:17:16.000000000 -0500 @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.interceptors; - -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.BAD_INV_ORDER; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.OBJECT_NOT_EXIST; -import org.omg.CORBA.LocalObject; -import org.omg.CORBA.Policy; -import org.omg.CORBA.PolicyError; -import org.omg.IOP.CodecFactory; -import org.omg.PortableInterceptor.ORBInitInfo; -import org.omg.PortableInterceptor.ClientRequestInterceptor; -import org.omg.PortableInterceptor.IORInterceptor; -import org.omg.PortableInterceptor.PolicyFactory; -import org.omg.PortableInterceptor.ServerRequestInterceptor; -import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; -import org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.legacy.interceptor.ORBInitInfoExt ; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.orbutil.ORBUtility; - -import com.sun.corba.se.impl.logging.InterceptorsSystemException; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.logging.OMGSystemException; - -/** - * ORBInitInfoImpl is the implementation of the ORBInitInfo class to be - * passed to ORBInitializers, as described in orbos/99-12-02. - */ -public final class ORBInitInfoImpl - extends org.omg.CORBA.LocalObject - implements ORBInitInfo, ORBInitInfoExt -{ - // The ORB we are initializing - private ORB orb; - - private InterceptorsSystemException wrapper ; - private ORBUtilSystemException orbutilWrapper ; - private OMGSystemException omgWrapper ; - - // The arguments passed to ORB_init - private String[] args; - - // The ID of the ORB being initialized - private String orbId; - - // The CodecFactory - private CodecFactory codecFactory; - - // The current stage of initialization - private int stage = STAGE_PRE_INIT; - - // The pre-initialization stage (pre_init() being called) - public static final int STAGE_PRE_INIT = 0; - - // The post-initialization stage (post_init() being called) - public static final int STAGE_POST_INIT = 1; - - // Reject all calls - this object should no longer be around. - public static final int STAGE_CLOSED = 2; - - // The description for the OBJECT_NOT_EXIST exception in STAGE_CLOSED - private static final String MESSAGE_ORBINITINFO_INVALID = - "ORBInitInfo object is only valid during ORB_init"; - - /** - * Creates a new ORBInitInfoImpl object (scoped to package) - * - * @param args The arguments passed to ORB_init. - */ - ORBInitInfoImpl( ORB orb, String[] args, - String orbId, CodecFactory codecFactory ) - { - this.orb = orb; - - wrapper = InterceptorsSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - orbutilWrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - omgWrapper = OMGSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - - this.args = args; - this.orbId = orbId; - this.codecFactory = codecFactory; - } - - /** Return the ORB behind this ORBInitInfo. This is defined in the - * ORBInitInfoExt interface. - */ - public ORB getORB() - { - return orb ; - } - - /** - * Sets the current stage we are in. This limits access to certain - * functionality. - */ - void setStage( int stage ) { - this.stage = stage; - } - - /** - * Throws an exception if the current stage is STAGE_CLOSED. - * This is called before any method is invoked to ensure that - * no method invocations are attempted after all calls to post_init() - * are completed. - */ - private void checkStage() { - if( stage == STAGE_CLOSED ) { - throw wrapper.orbinitinfoInvalid() ; - } - } - - /* - ******************************************************************* - * The following are implementations of the ORBInitInfo operations. - *******************************************************************/ - - /** - * This attribute contains the arguments passed to ORB_init. They may - * or may not contain the ORB's arguments - */ - public String[] arguments () { - checkStage(); - return args; - } - - /** - * This attribute is the ID of the ORB being initialized - */ - public String orb_id () { - checkStage(); - return orbId; - } - - /** - * This attribute is the IOP::CodecFactory. The CodecFactory is normally - * obtained via a call to ORB::resolve_initial_references( "CodecFactory" ) - * but since the ORB is not yet available and Interceptors, particularly - * when processing service contexts, will require a Codec, a means of - * obtaining a Codec is necessary during ORB intialization. - */ - public CodecFactory codec_factory () { - checkStage(); - return codecFactory; - } - - /** - * See orbos/99-12-02, Chapter 11, Dynamic Initial References on page - * 11-81. This operation is identical to ORB::register_initial_reference - * described there. This same functionality exists here because the ORB, - * not yet fully initialized, is not yet available but initial references - * may need to be registered as part of Interceptor registration. - *

- * This method may not be called during post_init. - */ - public void register_initial_reference( String id, - org.omg.CORBA.Object obj ) - throws InvalidName - { - checkStage(); - if( id == null ) nullParam(); - - // As per CORBA 3.0 section 21.8.1, - // if null is passed as the obj parameter, - // throw BAD_PARAM with minor code OMGSystemException.RIR_WITH_NULL_OBJECT. - // Though the spec is talking about IDL null, we will address both - // Java null and IDL null: - // Note: Local Objects can never be nil! - if( obj == null ) { - throw omgWrapper.rirWithNullObject() ; - } - - // This check was made to determine that the objref is a - // non-local objref that is fully - // initialized: this was called only for its side-effects of - // possibly throwing exceptions. However, registering - // local objects should be permitted! - // XXX/Revisit? - // IOR ior = ORBUtility.getIOR( obj ) ; - - // Delegate to ORB. If ORB version throws InvalidName, convert to - // equivalent Portable Interceptors InvalidName. - try { - orb.register_initial_reference( id, obj ); - } catch( org.omg.CORBA.ORBPackage.InvalidName e ) { - InvalidName exc = new InvalidName( e.getMessage() ); - exc.initCause( e ) ; - throw exc ; - } - } - - /** - * This operation is only valid during post_init. It is identical to - * ORB::resolve_initial_references. This same functionality exists here - * because the ORB, not yet fully initialized, is not yet available, - * but initial references may be required from the ORB as part - * of Interceptor registration. - *

- * (incorporates changes from errata in orbos/00-01-01) - *

- * This method may not be called during pre_init. - */ - public org.omg.CORBA.Object resolve_initial_references (String id) - throws InvalidName - { - checkStage(); - if( id == null ) nullParam(); - - if( stage == STAGE_PRE_INIT ) { - // Initializer is not allowed to invoke this method during - // this stage. - - // _REVISIT_ Spec issue: What exception should really be - // thrown here? - throw wrapper.rirInvalidPreInit() ; - } - - org.omg.CORBA.Object objRef = null; - - try { - objRef = orb.resolve_initial_references( id ); - } - catch( org.omg.CORBA.ORBPackage.InvalidName e ) { - // Convert PIDL to IDL exception: - throw new InvalidName(); - } - - return objRef; - } - - // New method from CORBA 3.1 - public void add_client_request_interceptor_with_policy ( - ClientRequestInterceptor interceptor, Policy[] policies ) - throws DuplicateName - { - // XXX ignore policies for now - add_client_request_interceptor( interceptor ) ; - } - - /** - * This operation is used to add a client-side request Interceptor to - * the list of client-side request Interceptors. - *

- * If a client-side request Interceptor has already been registered - * with this Interceptor's name, DuplicateName is raised. - */ - public void add_client_request_interceptor ( - ClientRequestInterceptor interceptor) - throws DuplicateName - { - checkStage(); - if( interceptor == null ) nullParam(); - - orb.getPIHandler().register_interceptor( interceptor, - InterceptorList.INTERCEPTOR_TYPE_CLIENT ); - } - - // New method from CORBA 3.1 - public void add_server_request_interceptor_with_policy ( - ServerRequestInterceptor interceptor, Policy[] policies ) - throws DuplicateName, PolicyError - { - // XXX ignore policies for now - add_server_request_interceptor( interceptor ) ; - } - - /** - * This operation is used to add a server-side request Interceptor to - * the list of server-side request Interceptors. - *

- * If a server-side request Interceptor has already been registered - * with this Interceptor's name, DuplicateName is raised. - */ - public void add_server_request_interceptor ( - ServerRequestInterceptor interceptor) - throws DuplicateName - { - checkStage(); - if( interceptor == null ) nullParam(); - - orb.getPIHandler().register_interceptor( interceptor, - InterceptorList.INTERCEPTOR_TYPE_SERVER ); - } - - // New method from CORBA 3.1 - public void add_ior_interceptor_with_policy ( - IORInterceptor interceptor, Policy[] policies ) - throws DuplicateName, PolicyError - { - // XXX ignore policies for now - add_ior_interceptor( interceptor ) ; - } - - /** - * This operation is used to add an IOR Interceptor to - * the list of IOR Interceptors. - *

- * If an IOR Interceptor has already been registered - * with this Interceptor's name, DuplicateName is raised. - */ - public void add_ior_interceptor ( - IORInterceptor interceptor ) - throws DuplicateName - { - checkStage(); - if( interceptor == null ) nullParam(); - - orb.getPIHandler().register_interceptor( interceptor, - InterceptorList.INTERCEPTOR_TYPE_IOR ); - } - - /** - * A service calls allocate_slot_id to allocate a slot on - * PortableInterceptor::Current. - * - * @return The index to the slot which has been allocated. - */ - public int allocate_slot_id () { - checkStage(); - - return ((PICurrent)orb.getPIHandler().getPICurrent()).allocateSlotId( ); - - } - - /** - * Register a PolicyFactory for the given PolicyType. - *

- * If a PolicyFactory already exists for the given PolicyType, - * BAD_INV_ORDER is raised with a minor code of TBD_BIO+2. - */ - public void register_policy_factory( int type, - PolicyFactory policy_factory ) - { - checkStage(); - if( policy_factory == null ) nullParam(); - orb.getPIHandler().registerPolicyFactory( type, policy_factory ); - } - - - /** - * Called when an invalid null parameter was passed. Throws a - * BAD_PARAM with a minor code of 1 - */ - private void nullParam() - throws BAD_PARAM - { - throw orbutilWrapper.nullParam() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PICurrent.java 2018-01-30 20:17:17.000000000 -0500 +++ /dev/null 2018-01-30 20:17:17.000000000 -0500 @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.interceptors; - -import com.sun.corba.se.spi.orb.ORB; -import org.omg.PortableInterceptor.Current; -import org.omg.PortableInterceptor.InvalidSlot; -import org.omg.CORBA.Any; -import org.omg.CORBA.BAD_INV_ORDER; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.OMGSystemException ; - -/** - * PICurrent is the implementation of Current as specified in the Portable - * Interceptors Spec orbos/99-12-02. - * IMPORTANT: PICurrent is implemented with the assumption that get_slot() - * or set_slot() will not be called in ORBInitializer.pre_init() and - * post_init(). - */ -public class PICurrent extends org.omg.CORBA.LocalObject - implements Current -{ - // slotCounter is used to keep track of ORBInitInfo.allocate_slot_id() - private int slotCounter; - - // The ORB associated with this PICurrent object. - private ORB myORB; - - private OMGSystemException wrapper ; - - // True if the orb is still initialzing and get_slot and set_slot are not - // to be called. - private boolean orbInitializing; - - // ThreadLocal contains a stack of SlotTable which are used - // for resolve_initial_references( "PICurrent" ); - private ThreadLocal threadLocalSlotTable - = new ThreadLocal( ) { - protected Object initialValue( ) { - SlotTable table = new SlotTable( myORB, slotCounter ); - return new SlotTableStack( myORB, table ); - } - }; - - /** - * PICurrent constructor which will be called for every ORB - * initialization. - */ - PICurrent( ORB myORB ) { - this.myORB = myORB; - wrapper = OMGSystemException.get( myORB, - CORBALogDomains.RPC_PROTOCOL ) ; - this.orbInitializing = true; - slotCounter = 0; - } - - - /** - * This method will be called from ORBInitInfo.allocate_slot_id( ). - * simply returns a slot id by incrementing slotCounter. - */ - int allocateSlotId( ) { - int slotId = slotCounter; - slotCounter = slotCounter + 1; - return slotId; - } - - - /** - * This method gets the SlotTable which is on the top of the - * ThreadLocalStack. - */ - SlotTable getSlotTable( ) { - SlotTable table = (SlotTable) - ((SlotTableStack)threadLocalSlotTable.get()).peekSlotTable(); - return table; - } - - /** - * This method pushes a SlotTable on the SlotTableStack. When there is - * a resolve_initial_references("PICurrent") after this call. The new - * PICurrent will be returned. - */ - void pushSlotTable( ) { - SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get(); - st.pushSlotTable( ); - } - - - /** - * This method pops a SlotTable on the SlotTableStack. - */ - void popSlotTable( ) { - SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get(); - st.popSlotTable( ); - } - - /** - * This method sets the slot data at the given slot id (index) in the - * Slot Table which is on the top of the SlotTableStack. - */ - public void set_slot( int id, Any data ) throws InvalidSlot - { - if( orbInitializing ) { - // As per ptc/00-08-06 if the ORB is still initializing, disallow - // calls to get_slot and set_slot. If an attempt is made to call, - // throw a BAD_INV_ORDER. - throw wrapper.invalidPiCall3() ; - } - - getSlotTable().set_slot( id, data ); - } - - /** - * This method gets the slot data at the given slot id (index) from the - * Slot Table which is on the top of the SlotTableStack. - */ - public Any get_slot( int id ) throws InvalidSlot - { - if( orbInitializing ) { - // As per ptc/00-08-06 if the ORB is still initializing, disallow - // calls to get_slot and set_slot. If an attempt is made to call, - // throw a BAD_INV_ORDER. - throw wrapper.invalidPiCall4() ; - } - - return getSlotTable().get_slot( id ); - } - - /** - * This method resets all the slot data to null in the - * Slot Table which is on the top of SlotTableStack. - */ - void resetSlotTable( ) { - getSlotTable().resetSlots(); - } - - /** - * Called from ORB when the ORBInitializers are about to start - * initializing. - */ - void setORBInitializing( boolean init ) { - this.orbInitializing = init; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java 2018-01-30 20:17:18.000000000 -0500 +++ /dev/null 2018-01-30 20:17:18.000000000 -0500 @@ -1,992 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.interceptors; - -import java.util.*; -import java.io.IOException; - -import org.omg.CORBA.Any; -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.BAD_POLICY; -import org.omg.CORBA.BAD_INV_ORDER; -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.NVList; -import org.omg.CORBA.OBJECT_NOT_EXIST; -import org.omg.CORBA.ORBPackage.InvalidName; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.UserException; -import org.omg.CORBA.UNKNOWN; - -import org.omg.CORBA.portable.ApplicationException; -import org.omg.CORBA.portable.RemarshalException; - -import org.omg.IOP.CodecFactory; - -import org.omg.PortableInterceptor.ForwardRequest; -import org.omg.PortableInterceptor.Current; -import org.omg.PortableInterceptor.Interceptor; -import org.omg.PortableInterceptor.LOCATION_FORWARD; -import org.omg.PortableInterceptor.ORBInitializer; -import org.omg.PortableInterceptor.ORBInitInfo; -import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName; -import org.omg.PortableInterceptor.SUCCESSFUL; -import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; -import org.omg.PortableInterceptor.TRANSPORT_RETRY; -import org.omg.PortableInterceptor.USER_EXCEPTION; -import org.omg.PortableInterceptor.PolicyFactory; -import org.omg.PortableInterceptor.ObjectReferenceTemplate; - -import com.sun.corba.se.pept.encoding.OutputObject; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate; -import com.sun.corba.se.spi.oa.ObjectAdapter; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orbutil.closure.ClosureFactory; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.protocol.ForwardException; -import com.sun.corba.se.spi.protocol.PIHandler; -import com.sun.corba.se.spi.protocol.RetryType; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.logging.InterceptorsSystemException; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.logging.OMGSystemException; -import com.sun.corba.se.impl.corba.RequestImpl; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.orbutil.StackImpl; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; - -/** - * Provides portable interceptor functionality. - */ -public class PIHandlerImpl implements PIHandler -{ - // REVISIT - delete these after framework merging. - boolean printPushPopEnabled = false; - int pushLevel = 0; - private void printPush() - { - if (! printPushPopEnabled) return; - printSpaces(pushLevel); - pushLevel++; - System.out.println("PUSH"); - } - private void printPop() - { - if (! printPushPopEnabled) return; - pushLevel--; - printSpaces(pushLevel); - System.out.println("POP"); - } - private void printSpaces(int n) - { - for (int i = 0; i < n; i++) { - System.out.print(" "); - } - } - - private ORB orb; - InterceptorsSystemException wrapper; - ORBUtilSystemException orbutilWrapper; - OMGSystemException omgWrapper; - - // A unique id used in ServerRequestInfo. - // This does not correspond to the GIOP request id. - private int serverRequestIdCounter = 0; - - // Stores the codec factory for producing codecs - CodecFactory codecFactory = null; - - // The arguments passed to the application's main method. May be null. - // This is used for ORBInitializers and set from set_parameters. - String[] arguments = null; - - // The list of portable interceptors, organized by type: - private InterceptorList interceptorList; - - // Cached information for optimization - do we have any interceptors - // registered of the given types? Set during ORB initialization. - private boolean hasIORInterceptors; - private boolean hasClientInterceptors; // temp always true - private boolean hasServerInterceptors; - - // The class responsible for invoking interceptors - private InterceptorInvoker interceptorInvoker; - - // There will be one PICurrent instantiated for every ORB. - private PICurrent current; - - // This table contains a list of PolicyFactories registered using - // ORBInitInfo.registerPolicyFactory() method. - // Key for the table is PolicyType which is an Integer - // Value is PolicyFactory. - private HashMap policyFactoryTable; - - // Table to convert from a ReplyMessage.? to a PI replyStatus short. - // Note that this table relies on the order and constants of - // ReplyMessage not to change. - private final static short REPLY_MESSAGE_TO_PI_REPLY_STATUS[] = { - SUCCESSFUL.value, // = ReplyMessage.NO_EXCEPTION - USER_EXCEPTION.value, // = ReplyMessage.USER_EXCEPTION - SYSTEM_EXCEPTION.value, // = ReplyMessage.SYSTEM_EXCEPTION - LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD - LOCATION_FORWARD.value, // = ReplyMessage.LOCATION_FORWARD_PERM - TRANSPORT_RETRY.value // = ReplyMessage.NEEDS_ADDRESSING_MODE - }; - - // ThreadLocal containing a stack to store client request info objects - // and a disable count. - private ThreadLocal threadLocalClientRequestInfoStack = - new ThreadLocal() { - protected Object initialValue() { - return new RequestInfoStack(); - } - }; - - // ThreadLocal containing the current server request info object. - private ThreadLocal threadLocalServerRequestInfoStack = - new ThreadLocal() { - protected Object initialValue() { - return new RequestInfoStack(); - } - }; - - public void close() { - orb = null; - wrapper = null; - orbutilWrapper = null; - omgWrapper = null; - codecFactory = null; - arguments = null; - interceptorList = null; - interceptorInvoker = null; - current = null; - policyFactoryTable = null; - threadLocalClientRequestInfoStack = null; - threadLocalServerRequestInfoStack = null; - } - - // Class to contain all ThreadLocal data for ClientRequestInfo - // maintenance. - // - // We use an ArrayList instead since it is not thread-safe. - // RequestInfoStack is used quite frequently. - private final class RequestInfoStack extends Stack { - // Number of times a request has been made to disable interceptors. - // When this reaches 0, interception hooks are disabled. Any higher - // value indicates they are enabled. - // NOTE: The is only currently used on the client side. - public int disableCount = 0; - } - - public PIHandlerImpl( ORB orb, String[] args ) { - this.orb = orb ; - wrapper = InterceptorsSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - orbutilWrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - omgWrapper = OMGSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - arguments = args ; - - // Create codec factory: - codecFactory = new CodecFactoryImpl( orb ); - - // Create new interceptor list: - interceptorList = new InterceptorList( wrapper ); - - // Create a new PICurrent. - current = new PICurrent( orb ); - - // Create new interceptor invoker, initially disabled: - interceptorInvoker = new InterceptorInvoker( orb, interceptorList, - current ); - - // Register the PI current and Codec factory objects - orb.getLocalResolver().register( ORBConstants.PI_CURRENT_NAME, - ClosureFactory.makeConstant( current ) ) ; - orb.getLocalResolver().register( ORBConstants.CODEC_FACTORY_NAME, - ClosureFactory.makeConstant( codecFactory ) ) ; - } - - public void initialize() { - // If we have any orb initializers, make use of them: - if( orb.getORBData().getORBInitializers() != null ) { - // Create the ORBInitInfo object to pass to ORB intializers: - ORBInitInfoImpl orbInitInfo = createORBInitInfo(); - - // Make sure get_slot and set_slot are not called from within - // ORB initializers: - current.setORBInitializing( true ); - - // Call pre_init on all ORB initializers: - preInitORBInitializers( orbInitInfo ); - - // Call post_init on all ORB initializers: - postInitORBInitializers( orbInitInfo ); - - // Proprietary: sort interceptors: - interceptorList.sortInterceptors(); - - // Re-enable get_slot and set_slot to be called from within - // ORB initializers: - current.setORBInitializing( false ); - - // Ensure nobody makes any more calls on this object. - orbInitInfo.setStage( ORBInitInfoImpl.STAGE_CLOSED ); - - // Set cached flags indicating whether we have interceptors - // registered of a given type. - hasIORInterceptors = interceptorList.hasInterceptorsOfType( - InterceptorList.INTERCEPTOR_TYPE_IOR ); - // XXX This must always be true, so that using the new generic - // RPC framework can pass info between the PI stack and the - // framework invocation stack. Temporary until Harold fixes - // this. Note that this must never be true until after the - // ORBInitializer instances complete executing. - //hasClientInterceptors = interceptorList.hasInterceptorsOfType( - //InterceptorList.INTERCEPTOR_TYPE_CLIENT ); - hasClientInterceptors = true; - hasServerInterceptors = interceptorList.hasInterceptorsOfType( - InterceptorList.INTERCEPTOR_TYPE_SERVER ); - - // Enable interceptor invoker (not necessary if no interceptors - // are registered). This should be the last stage of ORB - // initialization. - interceptorInvoker.setEnabled( true ); - } - } - - /** - * ptc/00-08-06 p 205: "When an application calls ORB::destroy, the ORB - * 1) waits for all requests in progress to complete - * 2) calls the Interceptor::destroy operation for each interceptor - * 3) completes destruction of the ORB" - * - * This must be called at the end of ORB.destroy. Note that this is not - * part of the PIHandler interface, since ORBImpl implements the ORB interface. - */ - public void destroyInterceptors() { - interceptorList.destroyAll(); - } - - public void objectAdapterCreated( ObjectAdapter oa ) - { - if (!hasIORInterceptors) - return ; - - interceptorInvoker.objectAdapterCreated( oa ) ; - } - - public void adapterManagerStateChanged( int managerId, - short newState ) - { - if (!hasIORInterceptors) - return ; - - interceptorInvoker.adapterManagerStateChanged( managerId, newState ) ; - } - - public void adapterStateChanged( ObjectReferenceTemplate[] - templates, short newState ) - { - if (!hasIORInterceptors) - return ; - - interceptorInvoker.adapterStateChanged( templates, newState ) ; - } - - /* - ***************** - * Client PI hooks - *****************/ - - public void disableInterceptorsThisThread() { - if( !hasClientInterceptors ) return; - - RequestInfoStack infoStack = - (RequestInfoStack)threadLocalClientRequestInfoStack.get(); - infoStack.disableCount++; - } - - public void enableInterceptorsThisThread() { - if( !hasClientInterceptors ) return; - - RequestInfoStack infoStack = - (RequestInfoStack)threadLocalClientRequestInfoStack.get(); - infoStack.disableCount--; - } - - public void invokeClientPIStartingPoint() - throws RemarshalException - { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; - - // Invoke the starting interception points and record exception - // and reply status info in the info object: - ClientRequestInfoImpl info = peekClientRequestInfoImplStack(); - interceptorInvoker.invokeClientInterceptorStartingPoint( info ); - - // Check reply status. If we will not have another chance later - // to invoke the client ending points, do it now. - short replyStatus = info.getReplyStatus(); - if( (replyStatus == SYSTEM_EXCEPTION.value) || - (replyStatus == LOCATION_FORWARD.value) ) - { - // Note: Transport retry cannot happen here since this happens - // before the request hits the wire. - - Exception exception = invokeClientPIEndingPoint( - convertPIReplyStatusToReplyMessage( replyStatus ), - info.getException() ); - if( exception == null ) { - // Do not throw anything. Otherwise, it must be a - // SystemException, UserException or RemarshalException. - } if( exception instanceof SystemException ) { - throw (SystemException)exception; - } else if( exception instanceof RemarshalException ) { - throw (RemarshalException)exception; - } else if( (exception instanceof UserException) || - (exception instanceof ApplicationException) ) { - // It should not be possible for an interceptor to throw - // a UserException. By asserting instead of throwing the - // UserException, we need not declare anything but - // RemarshalException in the throws clause. - throw wrapper.exceptionInvalid() ; - } - } - else if( replyStatus != ClientRequestInfoImpl.UNINITIALIZED ) { - throw wrapper.replyStatusNotInit() ; - } - } - - // Needed when an error forces a retry AFTER initiateClientPIRequest - // but BEFORE invokeClientPIStartingPoint. - public Exception makeCompletedClientRequest( int replyStatus, - Exception exception ) { - - // 6763340 - return handleClientPIEndingPoint( replyStatus, exception, false ) ; - } - - public Exception invokeClientPIEndingPoint( int replyStatus, - Exception exception ) { - - // 6763340 - return handleClientPIEndingPoint( replyStatus, exception, true ) ; - } - - public Exception handleClientPIEndingPoint( - int replyStatus, Exception exception, boolean invokeEndingPoint ) { - if( !hasClientInterceptors ) return exception; - if( !isClientPIEnabledForThisThread() ) return exception; - - // Translate ReplyMessage.replyStatus into PI replyStatus: - // Note: this is also an assertion to make sure a valid replyStatus - // is passed in (IndexOutOfBoundsException will be thrown otherwise) - short piReplyStatus = REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus]; - - // Invoke the ending interception points and record exception - // and reply status info in the info object: - ClientRequestInfoImpl info = peekClientRequestInfoImplStack(); - info.setReplyStatus( piReplyStatus ); - info.setException( exception ); - - if (invokeEndingPoint) { - // 6763340 - interceptorInvoker.invokeClientInterceptorEndingPoint( info ); - piReplyStatus = info.getReplyStatus(); - } - - // Check reply status: - if( (piReplyStatus == LOCATION_FORWARD.value) || - (piReplyStatus == TRANSPORT_RETRY.value) ) { - // If this is a forward or a retry, reset and reuse - // info object: - info.reset(); - - // fix for 6763340: - if (invokeEndingPoint) { - info.setRetryRequest( RetryType.AFTER_RESPONSE ) ; - } else { - info.setRetryRequest( RetryType.BEFORE_RESPONSE ) ; - } - - // ... and return a RemarshalException so the orb internals know - exception = new RemarshalException(); - } else if( (piReplyStatus == SYSTEM_EXCEPTION.value) || - (piReplyStatus == USER_EXCEPTION.value) ) { - exception = info.getException(); - } - - return exception; - } - - public void initiateClientPIRequest( boolean diiRequest ) { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; - - // Get the most recent info object from the thread local - // ClientRequestInfoImpl stack: - RequestInfoStack infoStack = - (RequestInfoStack)threadLocalClientRequestInfoStack.get(); - ClientRequestInfoImpl info = null; - - if (!infoStack.empty() ) { - info = (ClientRequestInfoImpl)infoStack.peek(); - } - - if (!diiRequest && (info != null) && info.isDIIInitiate() ) { - // In RequestImpl.doInvocation we already called - // initiateClientPIRequest( true ), so ignore this initiate. - info.setDIIInitiate( false ); - } else { - // If there is no info object or if we are not retrying a request, - // push a new ClientRequestInfoImpl on the stack: - - // 6763340: don't push unless this is not a retry - if( (info == null) || !info.getRetryRequest().isRetry() ) { - info = new ClientRequestInfoImpl( orb ); - infoStack.push( info ); - printPush(); - // Note: the entry count is automatically initialized to 0. - } - - // Reset the retry request flag so that recursive calls will - // push a new info object, and bump up entry count so we know - // when to pop this info object: - info.setRetryRequest( RetryType.NONE ); - info.incrementEntryCount(); - - // KMC 6763340: I don't know why this wasn't set earlier, - // but we do not want a retry to pick up the previous - // reply status, so clear it here. Most likely a new - // info was pushed before, so that this was not a problem. - info.setReplyStatus( RequestInfoImpl.UNINITIALIZED ) ; - - // If this is a DII request, make sure we ignore the next initiate. - if( diiRequest ) { - info.setDIIInitiate( true ); - } - } - } - - public void cleanupClientPIRequest() { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; - - ClientRequestInfoImpl info = peekClientRequestInfoImplStack(); - RetryType rt = info.getRetryRequest() ; - - // fix for 6763340 - if (!rt.equals( RetryType.BEFORE_RESPONSE )) { - - // If the replyStatus has not yet been set, this is an indication - // that the ORB threw an exception before we had a chance to - // invoke the client interceptor ending points. - // - // _REVISIT_ We cannot handle any exceptions or ForwardRequests - // flagged by the ending points here because there is no way - // to gracefully handle this in any of the calling code. - // This is a rare corner case, so we will ignore this for now. - short replyStatus = info.getReplyStatus(); - if (replyStatus == info.UNINITIALIZED ) { - invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION, - wrapper.unknownRequestInvoke( - CompletionStatus.COMPLETED_MAYBE ) ) ; - } - } - - // Decrement entry count, and if it is zero, pop it from the stack. - info.decrementEntryCount(); - - // fix for 6763340, and probably other cases (non-recursive retry) - if (info.getEntryCount() == 0 && !info.getRetryRequest().isRetry()) { - // RequestInfoStack infoStack = - // threadLocalClientRequestInfoStack.get(); - RequestInfoStack infoStack = - (RequestInfoStack)threadLocalClientRequestInfoStack.get(); - infoStack.pop(); - printPop(); - } - } - - public void setClientPIInfo(CorbaMessageMediator messageMediator) - { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; - - peekClientRequestInfoImplStack().setInfo(messageMediator); - } - - public void setClientPIInfo( RequestImpl requestImpl ) { - if( !hasClientInterceptors ) return; - if( !isClientPIEnabledForThisThread() ) return; - - peekClientRequestInfoImplStack().setDIIRequest( requestImpl ); - } - - /* - ***************** - * Server PI hooks - *****************/ - - public void invokeServerPIStartingPoint() - { - if( !hasServerInterceptors ) return; - - ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - interceptorInvoker.invokeServerInterceptorStartingPoint( info ); - - // Handle SystemException or ForwardRequest: - serverPIHandleExceptions( info ); - } - - public void invokeServerPIIntermediatePoint() - { - if( !hasServerInterceptors ) return; - - ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - interceptorInvoker.invokeServerInterceptorIntermediatePoint( info ); - - // Clear servant from info object so that the user has control over - // its lifetime: - info.releaseServant(); - - // Handle SystemException or ForwardRequest: - serverPIHandleExceptions( info ); - } - - public void invokeServerPIEndingPoint( ReplyMessage replyMessage ) - { - if( !hasServerInterceptors ) return; - ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - - // REVISIT: This needs to be done "early" for the following workaround. - info.setReplyMessage( replyMessage ); - - // REVISIT: This was done inside of invokeServerInterceptorEndingPoint - // but needs to be here for now. See comment in that method for why. - info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING ); - - // It is possible we might have entered this method more than - // once (e.g. if an ending point threw a SystemException, then - // a new ServerResponseImpl is created). - if( !info.getAlreadyExecuted() ) { - int replyStatus = replyMessage.getReplyStatus(); - - // Translate ReplyMessage.replyStatus into PI replyStatus: - // Note: this is also an assertion to make sure a valid - // replyStatus is passed in (IndexOutOfBoundsException will be - // thrown otherwise) - short piReplyStatus = - REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus]; - - // Make forwarded IOR available to interceptors, if applicable: - if( ( piReplyStatus == LOCATION_FORWARD.value ) || - ( piReplyStatus == TRANSPORT_RETRY.value ) ) - { - info.setForwardRequest( replyMessage.getIOR() ); - } - - // REVISIT: Do early above for now. - // Make reply message available to interceptors: - //info.setReplyMessage( replyMessage ); - - // Remember exception so we can tell if an interceptor changed it. - Exception prevException = info.getException(); - - // _REVISIT_ We do not have access to the User Exception at - // this point, so treat it as an UNKNOWN for now. - // Note that if this is a DSI call, we do have the user exception. - if( !info.isDynamic() && - (piReplyStatus == USER_EXCEPTION.value) ) - { - info.setException( omgWrapper.unknownUserException( - CompletionStatus.COMPLETED_MAYBE ) ) ; - } - - // Invoke the ending interception points: - info.setReplyStatus( piReplyStatus ); - interceptorInvoker.invokeServerInterceptorEndingPoint( info ); - short newPIReplyStatus = info.getReplyStatus(); - Exception newException = info.getException(); - - // Check reply status. If an interceptor threw a SystemException - // and it is different than the one that we came in with, - // rethrow it so the proper response can be constructed: - if( ( newPIReplyStatus == SYSTEM_EXCEPTION.value ) && - ( newException != prevException ) ) - { - throw (SystemException)newException; - } - - // If we are to forward the location: - if( newPIReplyStatus == LOCATION_FORWARD.value ) { - if( piReplyStatus != LOCATION_FORWARD.value ) { - // Treat a ForwardRequest as a ForwardException. - IOR ior = info.getForwardRequestIOR(); - throw new ForwardException( orb, ior ) ; - } - else if( info.isForwardRequestRaisedInEnding() ) { - // Treat a ForwardRequest by changing the IOR. - replyMessage.setIOR( info.getForwardRequestIOR() ); - } - } - } - } - - public void setServerPIInfo( Exception exception ) { - if( !hasServerInterceptors ) return; - - ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setException( exception ); - } - - public void setServerPIInfo( NVList arguments ) - { - if( !hasServerInterceptors ) return; - - ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setDSIArguments( arguments ); - } - - public void setServerPIExceptionInfo( Any exception ) - { - if( !hasServerInterceptors ) return; - - ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setDSIException( exception ); - } - - public void setServerPIInfo( Any result ) - { - if( !hasServerInterceptors ) return; - - ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setDSIResult( result ); - } - - public void initializeServerPIInfo( CorbaMessageMediator request, - ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp ) - { - if( !hasServerInterceptors ) return; - - RequestInfoStack infoStack = - (RequestInfoStack)threadLocalServerRequestInfoStack.get(); - ServerRequestInfoImpl info = new ServerRequestInfoImpl( orb ); - infoStack.push( info ); - printPush(); - - // Notify request object that once response is constructed, make - // sure we execute ending points. - request.setExecutePIInResponseConstructor( true ); - - info.setInfo( request, oa, objectId, oktemp ); - } - - public void setServerPIInfo( java.lang.Object servant, - String targetMostDerivedInterface ) - { - if( !hasServerInterceptors ) return; - - ServerRequestInfoImpl info = peekServerRequestInfoImplStack(); - info.setInfo( servant, targetMostDerivedInterface ); - } - - public void cleanupServerPIRequest() { - if( !hasServerInterceptors ) return; - - RequestInfoStack infoStack = - (RequestInfoStack)threadLocalServerRequestInfoStack.get(); - infoStack.pop(); - printPop(); - } - - /* - ********************************************************************** - * The following methods are private utility methods. - ************************************************************************/ - - /** - * Handles exceptions for the starting and intermediate points for - * server request interceptors. This is common code that has been - * factored out into this utility method. - *

- * This method will NOT work for ending points. - */ - private void serverPIHandleExceptions( ServerRequestInfoImpl info ) - { - int endingPointCall = info.getEndingPointCall(); - if(endingPointCall == ServerRequestInfoImpl.CALL_SEND_EXCEPTION) { - // If a system exception was thrown, throw it to caller: - throw (SystemException)info.getException(); - } - else if( (endingPointCall == ServerRequestInfoImpl.CALL_SEND_OTHER) && - (info.getForwardRequestException() != null) ) - { - // If an interceptor throws a forward request, convert it - // into a ForwardException for easier handling: - IOR ior = info.getForwardRequestIOR(); - throw new ForwardException( orb, ior ); - } - } - - /** - * Utility method to convert a PI reply status short to a ReplyMessage - * constant. This is a reverse lookup on the table defined in - * REPLY_MESSAGE_TO_PI_REPLY_STATUS. The reverse lookup need not be - * performed as quickly since it is only executed in exception - * conditions. - */ - private int convertPIReplyStatusToReplyMessage( short replyStatus ) { - int result = 0; - for( int i = 0; i < REPLY_MESSAGE_TO_PI_REPLY_STATUS.length; i++ ) { - if( REPLY_MESSAGE_TO_PI_REPLY_STATUS[i] == replyStatus ) { - result = i; - break; - } - } - return result; - } - - /** - * Convenience method to get the ClientRequestInfoImpl object off the - * top of the ThreadLocal stack. Throws an INTERNAL exception if - * the Info stack is empty. - */ - private ClientRequestInfoImpl peekClientRequestInfoImplStack() { - RequestInfoStack infoStack = - (RequestInfoStack)threadLocalClientRequestInfoStack.get(); - ClientRequestInfoImpl info = null; - if( !infoStack.empty() ) { - info = (ClientRequestInfoImpl)infoStack.peek(); - } else { - throw wrapper.clientInfoStackNull() ; - } - - return info; - } - - /** - * Convenience method to get the ServerRequestInfoImpl object off the - * top of the ThreadLocal stack. Returns null if there are none. - */ - private ServerRequestInfoImpl peekServerRequestInfoImplStack() { - RequestInfoStack infoStack = - (RequestInfoStack)threadLocalServerRequestInfoStack.get(); - ServerRequestInfoImpl info = null; - - if( !infoStack.empty() ) { - info = (ServerRequestInfoImpl)infoStack.peek(); - } else { - throw wrapper.serverInfoStackNull() ; - } - - return info; - } - - /** - * Convenience method to determine whether Client PI is enabled - * for requests on this thread. - */ - private boolean isClientPIEnabledForThisThread() { - RequestInfoStack infoStack = - (RequestInfoStack)threadLocalClientRequestInfoStack.get(); - return (infoStack.disableCount == 0); - } - - /** - * Call pre_init on all ORB initializers - */ - private void preInitORBInitializers( ORBInitInfoImpl info ) { - - // Inform ORBInitInfo we are in pre_init stage - info.setStage( ORBInitInfoImpl.STAGE_PRE_INIT ); - - // Step through each initializer instantiation and call its - // pre_init. Ignore any exceptions. - for( int i = 0; i < orb.getORBData().getORBInitializers().length; - i++ ) { - ORBInitializer init = orb.getORBData().getORBInitializers()[i]; - if( init != null ) { - try { - init.pre_init( info ); - } - catch( Exception e ) { - // As per orbos/99-12-02, section 9.3.1.2, "If there are - // any exceptions, the ORB shall ignore them and proceed." - } - } - } - } - - /** - * Call post_init on all ORB initializers - */ - private void postInitORBInitializers( ORBInitInfoImpl info ) { - - // Inform ORBInitInfo we are in post_init stage - info.setStage( ORBInitInfoImpl.STAGE_POST_INIT ); - - // Step through each initializer instantiation and call its post_init. - // Ignore any exceptions. - for( int i = 0; i < orb.getORBData().getORBInitializers().length; - i++ ) { - ORBInitializer init = orb.getORBData().getORBInitializers()[i]; - if( init != null ) { - try { - init.post_init( info ); - } - catch( Exception e ) { - // As per orbos/99-12-02, section 9.3.1.2, "If there are - // any exceptions, the ORB shall ignore them and proceed." - } - } - } - } - - /** - * Creates the ORBInitInfo object to be passed to ORB intializers' - * pre_init and post_init methods - */ - private ORBInitInfoImpl createORBInitInfo() { - ORBInitInfoImpl result = null; - - // arguments comes from set_parameters. May be null. - - // _REVISIT_ The spec does not specify which ID this is to be. - // We currently get this from the corba.ORB, which reads it from - // the ORB_ID_PROPERTY property. - String orbId = orb.getORBData().getORBId() ; - - result = new ORBInitInfoImpl( orb, arguments, orbId, codecFactory ); - - return result; - } - - /** - * Called by ORBInitInfo when an interceptor needs to be registered. - * The type is one of: - *

- * - * @exception DuplicateName Thrown if an interceptor of the given - * name already exists for the given type. - */ - public void register_interceptor( Interceptor interceptor, int type ) - throws DuplicateName - { - // We will assume interceptor is not null, since it is called - // internally. - if( (type >= InterceptorList.NUM_INTERCEPTOR_TYPES) || (type < 0) ) { - throw wrapper.typeOutOfRange( new Integer( type ) ) ; - } - - String interceptorName = interceptor.name(); - - if( interceptorName == null ) { - throw wrapper.nameNull() ; - } - - // Register with interceptor list: - interceptorList.register_interceptor( interceptor, type ); - } - - public Current getPICurrent( ) { - return current; - } - - /** - * Called when an invalid null parameter was passed. Throws a - * BAD_PARAM with a minor code of 1 - */ - private void nullParam() - throws BAD_PARAM - { - throw orbutilWrapper.nullParam() ; - } - - /** This is the implementation of standard API defined in org.omg.CORBA.ORB - * class. This method finds the Policy Factory for the given Policy Type - * and instantiates the Policy object from the Factory. It will throw - * PolicyError exception, If the PolicyFactory for the given type is - * not registered. - * _REVISIT_, Once Policy Framework work is completed, Reorganize - * this method to com.sun.corba.se.spi.orb.ORB. - */ - public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) - throws org.omg.CORBA.PolicyError - { - if( val == null ) { - nullParam( ); - } - if( policyFactoryTable == null ) { - throw new org.omg.CORBA.PolicyError( - "There is no PolicyFactory Registered for type " + type, - BAD_POLICY.value ); - } - PolicyFactory factory = (PolicyFactory)policyFactoryTable.get( - new Integer(type) ); - if( factory == null ) { - throw new org.omg.CORBA.PolicyError( - " Could Not Find PolicyFactory for the Type " + type, - BAD_POLICY.value); - } - org.omg.CORBA.Policy policy = factory.create_policy( type, val ); - return policy; - } - - /** This method registers the Policy Factory in the policyFactoryTable, - * which is a HashMap. This method is made package private, because - * it is used internally by the Interceptors. - */ - public void registerPolicyFactory( int type, PolicyFactory factory ) { - if( policyFactoryTable == null ) { - policyFactoryTable = new HashMap(); - } - Integer key = new Integer( type ); - java.lang.Object val = policyFactoryTable.get( key ); - if( val == null ) { - policyFactoryTable.put( key, factory ); - } - else { - throw omgWrapper.policyFactoryRegFailed( new Integer( type ) ) ; - } - } - - public synchronized int allocateServerRequestId () - { - return serverRequestIdCounter++; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java 2018-01-30 20:17:19.000000000 -0500 +++ /dev/null 2018-01-30 20:17:19.000000000 -0500 @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.interceptors; - -import java.io.IOException; - -import org.omg.CORBA.Any; -import org.omg.CORBA.NVList; - -import org.omg.IOP.CodecFactory; - -import org.omg.CORBA.portable.RemarshalException; - -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ForwardRequest; -import org.omg.PortableInterceptor.Interceptor; -import org.omg.PortableInterceptor.PolicyFactory; -import org.omg.PortableInterceptor.Current; - -import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ; - -import com.sun.corba.se.pept.encoding.OutputObject; - -import com.sun.corba.se.spi.ior.ObjectKeyTemplate; - -import com.sun.corba.se.spi.oa.ObjectAdapter; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.protocol.PIHandler; -import com.sun.corba.se.spi.protocol.ForwardException; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.impl.corba.RequestImpl; - -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; - -/** - * This is No-Op implementation of PIHandler. It is used in ORBConfigurator - * to initialize a piHandler before the Persistent Server Activation. This - * PIHandler implementation will be replaced by the real PIHandler in - * ORB.postInit( ) call. - */ -public class PINoOpHandlerImpl implements PIHandler -{ - public PINoOpHandlerImpl( ) { - } - - public void close() { - } - - public void initialize() { - } - - public void destroyInterceptors() { - } - - public void objectAdapterCreated( ObjectAdapter oa ) - { - } - - public void adapterManagerStateChanged( int managerId, - short newState ) - { - } - - public void adapterStateChanged( ObjectReferenceTemplate[] - templates, short newState ) - { - } - - - public void disableInterceptorsThisThread() { - } - - public void enableInterceptorsThisThread() { - } - - public void invokeClientPIStartingPoint() - throws RemarshalException - { - } - - public Exception invokeClientPIEndingPoint( - int replyStatus, Exception exception ) - { - return null; - } - - public Exception makeCompletedClientRequest( - int replyStatus, Exception exception ) { - return null; - } - - public void initiateClientPIRequest( boolean diiRequest ) { - } - - public void cleanupClientPIRequest() { - } - - public void setClientPIInfo(CorbaMessageMediator messageMediator) - { - } - - public void setClientPIInfo( RequestImpl requestImpl ) - { - } - - final public void sendCancelRequestIfFinalFragmentNotSent() - { - } - - - public void invokeServerPIStartingPoint() - { - } - - public void invokeServerPIIntermediatePoint() - { - } - - public void invokeServerPIEndingPoint( ReplyMessage replyMessage ) - { - } - - public void setServerPIInfo( Exception exception ) { - } - - public void setServerPIInfo( NVList arguments ) - { - } - - public void setServerPIExceptionInfo( Any exception ) - { - } - - public void setServerPIInfo( Any result ) - { - } - - public void initializeServerPIInfo( CorbaMessageMediator request, - ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp ) - { - } - - public void setServerPIInfo( java.lang.Object servant, - String targetMostDerivedInterface ) - { - } - - public void cleanupServerPIRequest() { - } - - public void register_interceptor( Interceptor interceptor, int type ) - throws DuplicateName - { - } - - public Current getPICurrent( ) { - return null; - } - - public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) - throws org.omg.CORBA.PolicyError - { - return null; - } - - public void registerPolicyFactory( int type, PolicyFactory factory ) { - } - - public int allocateServerRequestId () - { - return 0; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java 2018-01-30 20:17:20.000000000 -0500 +++ /dev/null 2018-01-30 20:17:20.000000000 -0500 @@ -1,929 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.interceptors; - -import java.io.IOException ; - -import java.lang.reflect.Method ; -import java.lang.reflect.InvocationTargetException ; - -import java.util.HashMap ; - -import org.omg.PortableInterceptor.ForwardRequest; -import org.omg.PortableInterceptor.InvalidSlot; -import org.omg.PortableInterceptor.RequestInfo; -import org.omg.PortableInterceptor.LOCATION_FORWARD; -import org.omg.IOP.TaggedProfile; -import org.omg.IOP.TaggedComponent; -import org.omg.IOP.ServiceContextHelper; -import org.omg.Messaging.SYNC_WITH_TRANSPORT; -import org.omg.CORBA.ParameterMode; - -import org.omg.CORBA.Any; -import org.omg.CORBA.BAD_INV_ORDER; -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.Context; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.CTX_RESTRICT_SCOPE; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.LocalObject; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.NO_RESOURCES; -import org.omg.CORBA.NVList; -import org.omg.CORBA.Object; -import org.omg.CORBA.Policy; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.UNKNOWN; -import org.omg.CORBA.UserException; -import org.omg.CORBA.portable.ApplicationException; -import org.omg.CORBA.portable.Delegate; -import org.omg.CORBA.portable.InputStream; - -import org.omg.Dynamic.Parameter; - -import com.sun.corba.se.spi.legacy.connection.Connection; - -import com.sun.corba.se.spi.legacy.interceptor.RequestInfoExt; - -import com.sun.corba.se.spi.ior.IOR; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.servicecontext.UnknownServiceContext; - -import com.sun.corba.se.impl.encoding.CDRInputStream_1_0; -import com.sun.corba.se.impl.encoding.EncapsOutputStream; - -import com.sun.corba.se.impl.orbutil.ORBUtility; - -import com.sun.corba.se.impl.util.RepositoryId; - -import com.sun.corba.se.impl.logging.InterceptorsSystemException; -import com.sun.corba.se.impl.logging.OMGSystemException; - -import sun.corba.SharedSecrets; - -/** - * Implementation of the RequestInfo interface as specified in - * orbos/99-12-02 section 5.4.1. - */ -public abstract class RequestInfoImpl - extends LocalObject - implements RequestInfo, RequestInfoExt -{ - ////////////////////////////////////////////////////////////////////// - // - // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); - // - ////////////////////////////////////////////////////////////////////// - - // The ORB from which to get PICurrent and other info - protected ORB myORB; - protected InterceptorsSystemException wrapper ; - protected OMGSystemException stdWrapper ; - - // The number of interceptors actually invoked for this client request. - // See setFlowStackIndex for a detailed description. - protected int flowStackIndex = 0; - - // The type of starting point call to make to the interceptors - // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of - // appropriate constants. - protected int startingPointCall; - - // The type of intermediate point call to make to the interceptors - // See ServerRequestInfoImpl for a list of appropriate constants. - // This does not currently apply to client request interceptors but is - // here in case intermediate points are introduced in the future. - protected int intermediatePointCall; - - // The type of ending point call to make to the interceptors - // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of - // appropriate constants. - protected int endingPointCall; - - // The reply status to return in reply_status. This is initialized - // to UNINITIALIZED so that we can tell if this has been set or not. - protected short replyStatus = UNINITIALIZED; - - // Constant for an uninitizlied reply status. - protected static final short UNINITIALIZED = -1; - - // Which points we are currently executing (so we can implement the - // validity table). - protected int currentExecutionPoint; - protected static final int EXECUTION_POINT_STARTING = 0; - protected static final int EXECUTION_POINT_INTERMEDIATE = 1; - protected static final int EXECUTION_POINT_ENDING = 2; - - // Set to true if all interceptors have had all their points - // executed. - protected boolean alreadyExecuted; - - // Sources of request information - protected Connection connection; - protected ServiceContexts serviceContexts; - - // The ForwardRequest object if this request is being forwarded. - // Either the forwardRequest or the forwardRequestIOR field is set. - // When set, the other field is set to null initially. If the other - // field is queried, it is lazily calculated and cached. These - // two attributes are always kept in sync. - protected ForwardRequest forwardRequest; - protected IOR forwardRequestIOR; - - // PICurrent's SlotTable - protected SlotTable slotTable; - - // The exception to be returned by received_exception and - // received_exception_id - protected Exception exception; - - ////////////////////////////////////////////////////////////////////// - // - // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); - // - ////////////////////////////////////////////////////////////////////// - - /** - * Reset the info object so that it can be reused for a retry, - * for example. - */ - void reset() { - - // Please keep these in the same order as declared above. - - flowStackIndex = 0; - startingPointCall = 0; - intermediatePointCall = 0; - endingPointCall = 0; - // 6763340 - setReplyStatus( UNINITIALIZED ) ; - currentExecutionPoint = EXECUTION_POINT_STARTING; - alreadyExecuted = false; - connection = null; - serviceContexts = null; - forwardRequest = null; - forwardRequestIOR = null; - exception = null; - - // We don't need to reset the Slots because they are - // already in the clean state after recieve_ interceptor - // are called. - } - - /* - ********************************************************************** - * Access protection - **********************************************************************/ - - // Method IDs for all methods in RequestInfo. This allows for a - // convenient O(1) lookup for checkAccess(). - protected static final int MID_REQUEST_ID = 0; - protected static final int MID_OPERATION = 1; - protected static final int MID_ARGUMENTS = 2; - protected static final int MID_EXCEPTIONS = 3; - protected static final int MID_CONTEXTS = 4; - protected static final int MID_OPERATION_CONTEXT = 5; - protected static final int MID_RESULT = 6; - protected static final int MID_RESPONSE_EXPECTED = 7; - protected static final int MID_SYNC_SCOPE = 8; - protected static final int MID_REPLY_STATUS = 9; - protected static final int MID_FORWARD_REFERENCE = 10; - protected static final int MID_GET_SLOT = 11; - protected static final int MID_GET_REQUEST_SERVICE_CONTEXT = 12; - protected static final int MID_GET_REPLY_SERVICE_CONTEXT = 13; - // The last value from RequestInfo (be sure to update this): - protected static final int MID_RI_LAST = 13; - - /* - ********************************************************************** - * Public interfaces - **********************************************************************/ - - /** - * Creates a new RequestInfoImpl object. - */ - public RequestInfoImpl( ORB myORB ) { - super(); - - this.myORB = myORB; - wrapper = InterceptorsSystemException.get( myORB, - CORBALogDomains.RPC_PROTOCOL ) ; - stdWrapper = OMGSystemException.get( myORB, - CORBALogDomains.RPC_PROTOCOL ) ; - - // Capture the current TSC and make it the RSC of this request. - PICurrent current = (PICurrent)(myORB.getPIHandler().getPICurrent()); - slotTable = current.getSlotTable( ); - } - - /** - * Implementation for request_id() differs for client and server - * implementations. - * - * Uniquely identifies an active request/reply sequence. Once a - * request/reply sequence is concluded this ID may be reused. (this - * is NOT necessarily the same as the GIOP request_id). - */ - abstract public int request_id (); - - /** - * Implementation for operation() differs for client and server - * implementations. - * - * The name of the operation being invoked. - */ - abstract public String operation (); - - - /** - * This method returns the list of arguments for the operation that was - * invoked. It raises NO_RESOURCES exception if the operation is not invoked - * by using DII mechanism. - */ - abstract public Parameter[] arguments (); - - /** - * This method returns the list of exceptios that was raised when the - * operation was invoked. It raises NO_RESOURCES exception if the operation - * is not invoked by using DII mechanism. - */ - abstract public TypeCode[] exceptions (); - - /** - * This method returns the list of contexts for the DII operation. - * It raises NO_RESOURCES exception if the operation is not invoked by - * using DII mechanism. - */ - abstract public String[] contexts (); - - /** - * This method returns the list of operation_context for the DII operation. - * It raises NO_RESOURCES exception if the operation is not invoked by - * using DII mechanism. - */ - abstract public String[] operation_context (); - - /** - * This method returns the result from the invoked DII operation. - * It raises NO_RESOURCES exception if the operation is not invoked by - * using DII mechanism. - */ - abstract public Any result (); - - /** - * Implementation for response_expected() differs for client and server - * implementations. - * - * Indicates whether a response is expected. On the client, a reply is - * not returned when response_expected is false, so receive_reply cannot - * be called. receive_other is called unless an exception occurs, in - * which case receive_exception is called. On the client, within - * send_poll, this attribute is true. - */ - abstract public boolean response_expected (); - - /** - * Defined in the Messaging specification. Pertinent only when - * response_expected is false. If response_expected is true, the value - * of sync_scope is undefined. It defines how far the request shall - * progress before control is returned to the client. This attribute may - * have one of the follwing values: - * - */ - public short sync_scope (){ - checkAccess( MID_SYNC_SCOPE ); - return SYNC_WITH_TRANSPORT.value; // REVISIT - get from MessageMediator - } - - /** - * Describes the state of the result of the operation invocation. Its - * value can be one of the following: - * - */ - public short reply_status (){ - checkAccess( MID_REPLY_STATUS ); - return replyStatus; - } - - /** - * Implementation for forward_reference() differs for client and server - * implementations. - * - * If the reply_status attribute is LOCATION_FORWARD - * then this attribute will contain the object - * to which the request will be forwarded. It is indeterminate whether a - * forwarded request will actually occur. - */ - abstract public Object forward_reference (); - - - /** - * Returns the data from the given slot of the PortableInterceptor::Current - * that is in the scope of the request. - *

- * If the given slot has not been set, then an any containing a type code - * with a TCKind value of tk_null is returned. - *

- * If the ID does not define an allocated slot, InvalidSlot is raised. - */ - public Any get_slot (int id) - throws InvalidSlot - { - // access is currently valid for all states: - //checkAccess( MID_GET_SLOT ); - // Delegate the call to the slotTable which was set when RequestInfo was - // created. - return slotTable.get_slot( id ); - } - - /** - * Implementation for get_request_service_context() differs for client - * and server implementations. - * - * This operation returns a copy of the service context with the given ID - * that is associated with the request. If the request's service context - * does not contain an etry for that ID, BAD_PARAM with a minor code of - * TBD_BP is raised. - */ - abstract public org.omg.IOP.ServiceContext - get_request_service_context(int id); - - /** - * Implementation for get_reply_service_context() differs for client - * and server implementations. - * - * This operation returns a copy of the service context with the given ID - * that is associated with the reply. IF the request's service context - * does not contain an entry for that ID, BAD_PARAM with a minor code of - * TBD_BP is raised. - */ - abstract public org.omg.IOP.ServiceContext - get_reply_service_context (int id); - - - // NOTE: When adding a method, be sure to: - // 1. Add a MID_* constant for that method - // 2. Call checkAccess at the start of the method - // 3. Define entries in the validCall[][] table for interception points - // in both ClientRequestInfoImpl and ServerRequestInfoImpl. - - - - /* - ********************************************************************** - * Proprietary methods - **********************************************************************/ - - /** - * @return The connection on which the request is made. - * - * Note: we store the connection as an internal type but - * expose it here as an external type. - */ - public com.sun.corba.se.spi.legacy.connection.Connection connection() - { - return connection; - } - - /* - ********************************************************************** - * Private utility methods - **********************************************************************/ - - /** - * Inserts the UserException inside the given ApplicationException - * into the given Any. Throws an UNKNOWN with minor code - * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be - * found to insert it with. - */ - private void insertApplicationException( ApplicationException appException, - Any result ) - throws UNKNOWN - { - try { - // Extract the UserException from the ApplicationException. - // Look up class name from repository id: - RepositoryId repId = RepositoryId.cache.getId( - appException.getId() ); - String className = repId.getClassName(); - - // Find the read method on the helper class: - String helperClassName = className + "Helper"; - Class helperClass = - SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName ); - Class[] readParams = new Class[1]; - readParams[0] = org.omg.CORBA.portable.InputStream.class; - Method readMethod = helperClass.getMethod( "read", readParams ); - - // Invoke the read method, passing in the input stream to - // retrieve the user exception. Mark and reset the stream - // as to not disturb it. - InputStream ueInputStream = appException.getInputStream(); - ueInputStream.mark( 0 ); - UserException userException = null; - try { - java.lang.Object[] readArguments = new java.lang.Object[1]; - readArguments[0] = ueInputStream; - userException = (UserException)readMethod.invoke( - null, readArguments ); - } - finally { - try { - ueInputStream.reset(); - } - catch( IOException e ) { - throw wrapper.markAndResetFailed( e ) ; - } - } - - // Insert this UserException into the provided Any using the - // helper class. - insertUserException( userException, result ); - } catch( ClassNotFoundException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ; - } catch( NoSuchMethodException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ; - } catch( SecurityException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ; - } catch( IllegalAccessException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ; - } catch( IllegalArgumentException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ; - } catch( InvocationTargetException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ; - } - } - - /** - * Inserts the UserException into the given Any. - * Throws an UNKNOWN with minor code - * OMGSYstemException.UNKNOWN_USER_EXCEPTION if the Helper class could not be - * found to insert it with. - */ - private void insertUserException( UserException userException, Any result ) - throws UNKNOWN - { - try { - // Insert this UserException into the provided Any using the - // helper class. - if( userException != null ) { - Class exceptionClass = userException.getClass(); - String className = exceptionClass.getName(); - String helperClassName = className + "Helper"; - Class helperClass = - SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName ); - - // Find insert( Any, class ) method - Class[] insertMethodParams = new Class[2]; - insertMethodParams[0] = org.omg.CORBA.Any.class; - insertMethodParams[1] = exceptionClass; - Method insertMethod = helperClass.getMethod( - "insert", insertMethodParams ); - - // Call helper.insert( result, userException ): - java.lang.Object[] insertMethodArguments = - new java.lang.Object[2]; - insertMethodArguments[0] = result; - insertMethodArguments[1] = userException; - insertMethod.invoke( null, insertMethodArguments ); - } - } catch( ClassNotFoundException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ); - } catch( NoSuchMethodException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ); - } catch( SecurityException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ); - } catch( IllegalAccessException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ); - } catch( IllegalArgumentException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ); - } catch( InvocationTargetException e ) { - throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ); - } - } - - /* - ********************************************************************** - * Protected utility methods - **********************************************************************/ - - /** - * Internal utility method to convert an NVList into a PI Parameter[] - */ - protected Parameter[] nvListToParameterArray( NVList parNVList ) { - - // _REVISIT_ This utility method should probably be doing a deep - // copy so interceptor can't accidentally change the arguments. - - int count = parNVList.count(); - Parameter[] plist = new Parameter[count]; - try { - for( int i = 0; i < count; i++ ) { - Parameter p = new Parameter(); - plist[i] = p; - NamedValue nv = parNVList.item( i ); - plist[i].argument = nv.value(); - // ParameterMode spec can be found in 99-10-07.pdf - // Section:10.5.22 - // nv.flags spec can be found in 99-10-07.pdf - // Section 7.1.1 - // nv.flags has ARG_IN as 1, ARG_OUT as 2 and ARG_INOUT as 3 - // To convert this into enum PARAM_IN, PARAM_OUT and - // PARAM_INOUT the value is subtracted by 1. - plist[i].mode = ParameterMode.from_int( nv.flags() - 1 ); - } - } catch ( Exception e ) { - throw wrapper.exceptionInArguments( e ) ; - } - - return plist; - } - - /** - * Utility to wrap the given Exception in an Any object and return it. - * If the exception is a UserException which cannot be inserted into - * an any, then this returns an Any containing the system exception - * UNKNOWN. - */ - protected Any exceptionToAny( Exception exception ){ - Any result = myORB.create_any(); - - if( exception == null ) { - // Note: exception should never be null here since we will throw - // a BAD_INV_ORDER if this is not called from receive_exception. - throw wrapper.exceptionWasNull2() ; - } else if( exception instanceof SystemException ) { - ORBUtility.insertSystemException( - (SystemException)exception, result ); - } else if( exception instanceof ApplicationException ) { - // Use the Helper class for this exception to insert it into an - // Any. - try { - // Insert the user exception inside the application exception - // into the Any result: - ApplicationException appException = - (ApplicationException)exception; - insertApplicationException( appException, result ); - } catch( UNKNOWN e ) { - // As per ptc/00-08-06, 21.3.13.4. if we cannot find the - // appropriate class, then return an any containing UNKNOWN, - // with a minor code of 1. This is conveniently the same - // exception that is returned from the - // insertApplicationException utility method. - ORBUtility.insertSystemException( e, result ); - } - } else if( exception instanceof UserException ) { - try { - UserException userException = (UserException)exception; - insertUserException( userException, result ); - } catch( UNKNOWN e ) { - ORBUtility.insertSystemException( e, result ); - } - } - - - return result; - } - - /** - * Utility method to look up a service context with the given id and - * convert it to an IOP.ServiceContext. Uses the given HashMap as - * a cache. If not found in cache, the result is inserted in the cache. - */ - protected org.omg.IOP.ServiceContext - getServiceContext ( HashMap cachedServiceContexts, - ServiceContexts serviceContexts, int id ) - { - org.omg.IOP.ServiceContext result = null; - Integer integerId = new Integer( id ); - - // Search cache first: - result = (org.omg.IOP.ServiceContext) - cachedServiceContexts.get( integerId ); - - // null could normally mean that either we cached the value null - // or it's not in the cache. However, there is no way for us to - // cache the value null in the following code. - if( result == null ) { - // Not in cache. Find it and put in cache. - // Get the desired "core" service context. - com.sun.corba.se.spi.servicecontext.ServiceContext context = - serviceContexts.get( id ); - if (context == null) - throw stdWrapper.invalidServiceContextId() ; - - // Convert the "core" service context to an - // "IOP" ServiceContext by writing it to a - // CDROutputStream and reading it back. - EncapsOutputStream out = - sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB); - - context.write( out, GIOPVersion.V1_2 ); - InputStream inputStream = out.create_input_stream(); - result = ServiceContextHelper.read( inputStream ); - - cachedServiceContexts.put( integerId, result ); - } - - // Good citizen: For increased efficiency, we assume that interceptors - // will not modify the returned ServiceContext. Otherwise, we would - // have to make a deep copy. - - return result; - } - - - /** - * Utility method to add an IOP.ServiceContext to a core.ServiceContexts - * object. If replace is true, any service context with the given id - * is replaced. - *

- * Raises BAD_INV_ORDER if replace is false and a service context with - * the given id already exists. - *

- * Uses the given HashMap as a cache. If a service context is placed - * in the container, it goes in the HashMap as well. - */ - protected void addServiceContext( - HashMap cachedServiceContexts, - ServiceContexts serviceContexts, - org.omg.IOP.ServiceContext service_context, - boolean replace ) - { - int id = 0 ; - // Convert IOP.service_context to core.ServiceContext: - EncapsOutputStream outputStream = - sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB); - InputStream inputStream = null; - UnknownServiceContext coreServiceContext = null; - ServiceContextHelper.write( outputStream, service_context ); - inputStream = outputStream.create_input_stream(); - - // Constructor expects id to already have been read from stream. - coreServiceContext = new UnknownServiceContext( - inputStream.read_long(), - (org.omg.CORBA_2_3.portable.InputStream)inputStream ); - - id = coreServiceContext.getId(); - - if (serviceContexts.get(id) != null) - if (replace) - serviceContexts.delete( id ); - else - throw stdWrapper.serviceContextAddFailed( new Integer(id) ) ; - - serviceContexts.put( coreServiceContext ); - - // Place IOP.ServiceContext in cache as well: - cachedServiceContexts.put( new Integer( id ), service_context ); - } - - /** - * Sets the number of interceptors whose starting interception - * points were successfully invoked on this client call. As specified - * in orbos/99-12-02, section 5.2.1., not all interceptors will - * be invoked if a ForwardRequest exception or a system exception - * is raised. This keeps track of how many were successfully executed - * so we know not to execute the corresponding ending interception - * points for the interceptors whose starting interception points - * were not completed. This simulates the "Flow Stack Visual Model" - * presented in section 5.1.3.*/ - protected void setFlowStackIndex(int num ) { - this.flowStackIndex = num; - } - - /** - * Returns the number of interceptors whose starting interception - * points were actually invoked on this client request. See - * setFlowStackIndex for more details. - */ - protected int getFlowStackIndex() { - return this.flowStackIndex; - } - - /** - * Sets which ending interception point should be called - * for each interceptor in the virtual flow stack. - */ - protected void setEndingPointCall( int call ) { - this.endingPointCall = call; - } - - /** - * Retrieves the current ending point call type (see - * setEndingPointCall for more details). - */ - protected int getEndingPointCall() { - return this.endingPointCall; - } - - /** - * Sets which intermediate interception point should be called - * for each interceptor in the virtual flow stack. - */ - protected void setIntermediatePointCall( int call ) { - this.intermediatePointCall = call; - } - - /** - * Retrieves the current intermediate point call type (see - * setEndingPointCall for more details). - */ - protected int getIntermediatePointCall() { - return this.intermediatePointCall; - } - - /** - * Sets which starting interception point should be called - * for each interceptor in the virtual flow stack. - */ - protected void setStartingPointCall( int call ) { - this.startingPointCall = call; - } - - /** - * Retrieves the current starting point call type (see - * setStartingPointCall for more details). - */ - protected int getStartingPointCall() { - return this.startingPointCall; - } - - /** - * Returns true if all interceptors' starting and ending points - * have already executed to completion, or false if not yet. - */ - protected boolean getAlreadyExecuted() { - return this.alreadyExecuted; - } - - /** - * Sets whether all interceotrs' starting and ending points - * have already been executed to completion. - */ - protected void setAlreadyExecuted( boolean alreadyExecuted ) { - this.alreadyExecuted = alreadyExecuted; - } - - /** - * Sets the value to be returned by reply_status - */ - protected void setReplyStatus( short replyStatus ) { - this.replyStatus = replyStatus; - } - - /** - * Gets the current reply_status without doing an access check - * (available only to package and subclasses) - */ - protected short getReplyStatus() { - return this.replyStatus; - } - - /** - * Stores the given ForwardRequest object for later analysis. - * This version supplements setForwardRequest( IOR ); - */ - protected void setForwardRequest( ForwardRequest forwardRequest ) { - this.forwardRequest = forwardRequest; - this.forwardRequestIOR = null; - } - - /** - * Stores the given IOR for later forward request analysis. - * This version supplements setForwardRequest( ForwardRequest ); - */ - protected void setForwardRequest( IOR ior ) { - this.forwardRequestIOR = ior; - this.forwardRequest = null; - } - - /** - * Retrieves the ForwardRequest object as a ForwardRequest exception. - */ - protected ForwardRequest getForwardRequestException() { - if( this.forwardRequest == null ) { - if( this.forwardRequestIOR != null ) { - // Convert the internal IOR to a forward request exception - // by creating an object reference. - org.omg.CORBA.Object obj = iorToObject(this.forwardRequestIOR); - this.forwardRequest = new ForwardRequest( obj ); - } - } - - return this.forwardRequest; - } - - /** - * Retrieves the IOR of the ForwardRequest exception. - */ - protected IOR getForwardRequestIOR() { - if( this.forwardRequestIOR == null ) { - if( this.forwardRequest != null ) { - this.forwardRequestIOR = ORBUtility.getIOR( - this.forwardRequest.forward ) ; - } - } - - return this.forwardRequestIOR; - } - - /** - * Sets the exception to be returned by received_exception and - * received_exception_id. - */ - protected void setException( Exception exception ) { - this.exception = exception; - } - - /** - * Returns the exception to be returned by received_exception and - * received_exception_id. - */ - Exception getException() { - return this.exception; - } - - /** - * Sets the execution point that we are currently executing - * (starting points, intermediate points, or ending points). - * This allows us to enforce the validity table. - */ - protected void setCurrentExecutionPoint( int executionPoint ) { - this.currentExecutionPoint = executionPoint; - } - - /** - * Check whether the caller is allowed to access this method at - * this particular time. This is overridden in subclasses to implement - * the validity table specified in ptc/00-04-05, table 21-1 and 21-2. - * The currentExecutionPoint attribute is checked, and if access is - * forbidden at this time, BAD_INV_ORDER is raised with a minor code of - * TBD_BIO. - * - * @param methodID The ID of this method, one of the MID_* constants. - * This allows us to easily look up the method access in a table. - * Note that method ids may overlap between subclasses. - */ - protected abstract void checkAccess( int methodID ) - throws BAD_INV_ORDER; - - /** - * The server side does an explicit set rather than taking the - * current PICurrent table as is done in the general RequestInfoImpl - * constructor. - */ - void setSlotTable(SlotTable slotTable) - { - this.slotTable = slotTable; - } - - protected org.omg.CORBA.Object iorToObject( IOR ior ) - { - return ORBUtility.makeObjectReference( ior ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java 2018-01-30 20:17:20.000000000 -0500 +++ /dev/null 2018-01-30 20:17:20.000000000 -0500 @@ -1,907 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.interceptors; - -import org.omg.CORBA.Any; -import org.omg.CORBA.BAD_INV_ORDER; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.LocalObject; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.NO_RESOURCES; -import org.omg.CORBA.NVList; -import org.omg.CORBA.Object; -import org.omg.CORBA.Policy; -import org.omg.CORBA.TypeCode; - -import org.omg.PortableServer.Servant; - -import org.omg.IOP.TaggedProfile; -import org.omg.IOP.ServiceContext; - -import org.omg.Dynamic.Parameter; - -import org.omg.PortableInterceptor.InvalidSlot; -import org.omg.PortableInterceptor.ServerRequestInfo; -import org.omg.PortableInterceptor.LOCATION_FORWARD; -import org.omg.PortableInterceptor.SUCCESSFUL; -import org.omg.PortableInterceptor.SYSTEM_EXCEPTION; -import org.omg.PortableInterceptor.TRANSPORT_RETRY; -import org.omg.PortableInterceptor.USER_EXCEPTION; - -import com.sun.corba.se.spi.oa.ObjectAdapter; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter; - -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; - -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.ior.ObjectKeyTemplate; -import com.sun.corba.se.spi.ior.ObjectAdapterId ; - -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import java.util.*; - -/** - * Implementation of the ServerRequestInfo interface as specified in - * orbos/99-12-02 section 5.4.3. - */ -public final class ServerRequestInfoImpl - extends RequestInfoImpl - implements ServerRequestInfo -{ - // The available constants for startingPointCall - static final int CALL_RECEIVE_REQUEST_SERVICE_CONTEXT = 0; - - // The available constants for intermediatePointCall. The default (0) - // is receive_request, but can be set to none on demand. - static final int CALL_RECEIVE_REQUEST = 0; - static final int CALL_INTERMEDIATE_NONE = 1; - - // The available constants for endingPointCall - static final int CALL_SEND_REPLY = 0; - static final int CALL_SEND_EXCEPTION = 1; - static final int CALL_SEND_OTHER = 2; - - ////////////////////////////////////////////////////////////////////// - // - // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); - // - ////////////////////////////////////////////////////////////////////// - - // Set to true if the server ending point raised ForwardRequest at some - // point in the ending point. - private boolean forwardRequestRaisedInEnding; - - // Sources of server request information: - private CorbaMessageMediator request; - private java.lang.Object servant; - private byte[] objectId; - private ObjectKeyTemplate oktemp ; - - // Information cached from calls to oktemp - private byte[] adapterId; - private String[] adapterName; - - private ArrayList addReplyServiceContextQueue; - private ReplyMessage replyMessage; - private String targetMostDerivedInterface; - private NVList dsiArguments; - private Any dsiResult; - private Any dsiException; - private boolean isDynamic; - private ObjectAdapter objectAdapter; - private int serverRequestId; - - // Cached information: - private Parameter[] cachedArguments; - private Any cachedSendingException; - // key = Integer, value = IOP.ServiceContext. - private HashMap cachedRequestServiceContexts; - // key = Integer, value = IOP.ServiceContext. - private HashMap cachedReplyServiceContexts; - - ////////////////////////////////////////////////////////////////////// - // - // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET(); - // - ////////////////////////////////////////////////////////////////////// - - - /** - * Reset the info object so that it can be reused for a retry, - * for example. - */ - void reset() { - super.reset(); - - // Please keep these in the same order as declared above. - - forwardRequestRaisedInEnding = false; - - request = null; - servant = null; - objectId = null; - oktemp = null; - - adapterId = null; - adapterName = null; - - addReplyServiceContextQueue = null; - replyMessage = null; - targetMostDerivedInterface = null; - dsiArguments = null; - dsiResult = null; - dsiException = null; - isDynamic = false; - objectAdapter = null; - serverRequestId = myORB.getPIHandler().allocateServerRequestId(); - - // reset cached attributes: - cachedArguments = null; - cachedSendingException = null; - cachedRequestServiceContexts = null; - cachedReplyServiceContexts = null; - - startingPointCall = CALL_RECEIVE_REQUEST_SERVICE_CONTEXT; - intermediatePointCall = CALL_RECEIVE_REQUEST; - endingPointCall = CALL_SEND_REPLY; - } - - /* - ********************************************************************** - * Access protection - **********************************************************************/ - - // Method IDs for all methods in ServerRequestInfo. This allows for a - // convenient O(1) lookup for checkAccess(). - protected static final int MID_SENDING_EXCEPTION = MID_RI_LAST + 1; - protected static final int MID_OBJECT_ID = MID_RI_LAST + 2; - protected static final int MID_ADAPTER_ID = MID_RI_LAST + 3; - protected static final int MID_TARGET_MOST_DERIVED_INTERFACE - = MID_RI_LAST + 4; - protected static final int MID_GET_SERVER_POLICY = MID_RI_LAST + 5; - protected static final int MID_SET_SLOT = MID_RI_LAST + 6; - protected static final int MID_TARGET_IS_A = MID_RI_LAST + 7; - protected static final int MID_ADD_REPLY_SERVICE_CONTEXT - = MID_RI_LAST + 8; - protected static final int MID_SERVER_ID = MID_RI_LAST + 9; - protected static final int MID_ORB_ID = MID_RI_LAST + 10; - protected static final int MID_ADAPTER_NAME = MID_RI_LAST + 11; - - // ServerRequestInfo validity table (see ptc/00-08-06 table 21-2). - // Note: These must be in the same order as specified in contants. - private static final boolean validCall[][] = { - // LEGEND: - // r_rsc = receive_request_service_contexts - // r_req = receive_request - // s_rep = send_reply - // s_exc = send_exception - // s_oth = send_other - // - // A true value indicates call is valid at specified point. - // A false value indicates the call is invalid. - // - // NOTE: If the order or number of columns change, update - // checkAccess() accordingly. - // - // { r_rsc, r_req, s_rep, s_exc, s_oth } - // RequestInfo methods: - /*request_id*/ { true , true , true , true , true }, - /*operation*/ { true , true , true , true , true }, - /*arguments*/ { false, true , true , false, false }, - /*exceptions*/ { false, true , true , true , true }, - /*contexts*/ { false, true , true , true , true }, - /*operation_context*/ { false, true , true , false, false }, - /*result*/ { false, false, true , false, false }, - /*response_expected*/ { true , true , true , true , true }, - /*sync_scope*/ { true , true , true , true , true }, - /*reply_status*/ { false, false, true , true , true }, - /*forward_reference*/ { false, false, false, false, true }, - /*get_slot*/ { true , true , true , true , true }, - /*get_request_service_context*/ { true , true , true , true , true }, - /*get_reply_service_context*/ { false, false, true , true , true }, - // - // ServerRequestInfo methods:: - /*sending_exception*/ { false, false, false, true , false }, - /*object_id*/ { false, true , true , true , true }, - /*adapter_id*/ { false, true , true , true , true }, - /*target_most_derived_inte...*/ { false, true , false, false, false }, - /*get_server_policy*/ { true , true , true , true , true }, - /*set_slot*/ { true , true , true , true , true }, - /*target_is_a*/ { false, true , false, false, false }, - /*add_reply_service_context*/ { true , true , true , true , true }, - /*orb_id*/ { false, true , true , true , true }, - /*server_id*/ { false, true , true , true , true }, - /*adapter_name*/ { false, true , true , true , true } - }; - - /* - ********************************************************************** - * Public interfaces - **********************************************************************/ - - /** - * Creates a new ServerRequestInfo implementation. - * The constructor is package scope since no other package need create - * an instance of this class. - */ - ServerRequestInfoImpl( ORB myORB ) { - super( myORB ); - startingPointCall = CALL_RECEIVE_REQUEST_SERVICE_CONTEXT; - intermediatePointCall = CALL_RECEIVE_REQUEST; - endingPointCall = CALL_SEND_REPLY; - serverRequestId = myORB.getPIHandler().allocateServerRequestId(); - } - - /** - * Any containing the exception to be returned to the client. - */ - public Any sending_exception () { - checkAccess( MID_SENDING_EXCEPTION ); - - if( cachedSendingException == null ) { - Any result = null ; - - if( dsiException != null ) { - result = dsiException; - } else if( exception != null ) { - result = exceptionToAny( exception ); - } else { - // sending_exception should not be callable if both dsiException - // and exception are null. - throw wrapper.exceptionUnavailable() ; - } - - cachedSendingException = result; - } - - return cachedSendingException; - } - - /** - * The opaque object_id describing the target of the operation invocation. - */ - public byte[] object_id () { - checkAccess( MID_OBJECT_ID ); - - if( objectId == null ) { - // For some reason, we never set object id. This could be - // because a servant locator caused a location forward or - // raised an exception. As per ptc/00-08-06, section 21.3.14, - // we throw NO_RESOURCES - throw stdWrapper.piOperationNotSupported6() ; - } - - // Good citizen: In the interest of efficiency, we will assume - // interceptors will not change the resulting byte[] array. - // Otherwise, we would need to make a clone of this array. - - return objectId; - } - - private void checkForNullTemplate() - { - if (oktemp == null) { - // For some reason, we never set the ObjectKeyTemplate - // because a servant locator caused a location forward or - // raised an exception. As per ptc/00-08-06, section 21.3.14, - // we throw NO_RESOURCES - throw stdWrapper.piOperationNotSupported7() ; - } - } - - public String server_id() - { - checkAccess( MID_SERVER_ID ) ; - checkForNullTemplate() ; - - // Good citizen: In the interest of efficiency, we will assume - // interceptors will not change the resulting byte[] array. - // Otherwise, we would need to make a clone of this array. - - return Integer.toString( oktemp.getServerId() ) ; - } - - public String orb_id() - { - checkAccess( MID_ORB_ID ) ; - - return myORB.getORBData().getORBId() ; - } - - synchronized public String[] adapter_name() - { - checkAccess( MID_ADAPTER_NAME ) ; - - if (adapterName == null) { - checkForNullTemplate() ; - - ObjectAdapterId oaid = oktemp.getObjectAdapterId() ; - adapterName = oaid.getAdapterName() ; - } - - return adapterName ; - } - - /** - * The opaque identifier for the object adapter. - */ - synchronized public byte[] adapter_id () - { - checkAccess( MID_ADAPTER_ID ); - - if( adapterId == null ) { - checkForNullTemplate() ; - adapterId = oktemp.getAdapterId() ; - } - - return adapterId; - } - - /** - * The RepositoryID for the most derived interface of the servant. - */ - public String target_most_derived_interface () { - checkAccess( MID_TARGET_MOST_DERIVED_INTERFACE ); - return targetMostDerivedInterface; - } - - /** - * Returns the policy in effect for this operation for the given policy - * type. - */ - public Policy get_server_policy (int type) { - // access is currently valid for all states: - //checkAccess( MID_GET_SERVER_POLICY ); - - Policy result = null; - - if( objectAdapter != null ) { - result = objectAdapter.getEffectivePolicy( type ); - } - - // _REVISIT_ RTF Issue: get_server_policy spec not in sync with - // get_effective_policy spec. - - return result; - } - - /** - * Allows an Interceptor to set a slot in the Current that is in the scope - * of the request. If data already exists in that slot, it will be - * overwritten. If the ID does not define an allocated slot, InvalidSlot - * is raised. - */ - public void set_slot (int id, Any data) throws InvalidSlot { - // access is currently valid for all states: - //checkAccess( MID_SET_SLOT ); - - slotTable.set_slot( id, data ); - } - - /** - * Returns true if the servant is the given RepositoryId, false if it is - * not. - */ - public boolean target_is_a (String id) { - checkAccess( MID_TARGET_IS_A ); - - boolean result = false ; - if( servant instanceof Servant ) { - result = ((Servant)servant)._is_a( id ); - } else if (StubAdapter.isStub( servant )) { - result = ((org.omg.CORBA.Object)servant)._is_a( id ); - } else { - throw wrapper.servantInvalid() ; - } - - return result; - } - - /** - * Allows Interceptors to add service contexts to the request. - */ - public void add_reply_service_context ( ServiceContext service_context, - boolean replace ) - { - // access is currently valid for all states: - //checkAccess( MID_ADD_REPLY_SERVICE_CONTEXT ); - - if( currentExecutionPoint == EXECUTION_POINT_ENDING ) { - ServiceContexts scs = replyMessage.getServiceContexts(); - - // May be null. If this is null, create a new one in its place. - if( scs == null ) { - scs = new ServiceContexts( myORB ); - replyMessage.setServiceContexts( scs ); - } - - if( cachedReplyServiceContexts == null ) { - cachedReplyServiceContexts = new HashMap(); - } - - // This is during and ending point, so we now have enough - // information to add the reply service context. - addServiceContext( cachedReplyServiceContexts, scs, - service_context, replace ); - } - - // We enqueue all adds for the following reasons: - // - // If we are not in the ending point then we do not yet have a - // pointer to the ServiceContexts object so we cannot access the - // service contexts until we get to the ending point. - // So we enqueue this add reply service context request. - // It is added when we do have a handle on the service contexts object. - // - // If we are in the ending point and we just add directly to the - // SC container but then an interceptor raises a SystemException - // then that add will be lost since a new container is created - // for the SystemException response. - // - // Therefore we always enqueue and never dequeue (per request) so - // that all adds will be completed. - - AddReplyServiceContextCommand addReply = - new AddReplyServiceContextCommand(); - addReply.service_context = service_context; - addReply.replace = replace; - - if( addReplyServiceContextQueue == null ) { - addReplyServiceContextQueue = new ArrayList(); - } - - // REVISIT: this does not add to the cache. - enqueue( addReply ); - } - - // NOTE: When adding a method, be sure to: - // 1. Add a MID_* constant for that method - // 2. Call checkAccess at the start of the method - // 3. Define entries in the validCall[][] table for interception points. - - /* - ********************************************************************** - * Public RequestInfo interfaces - * - * These are implemented here because they have differing - * implementations depending on whether this is a client or a server - * request info object. - **********************************************************************/ - - /** - * See ServerRequestInfo for javadocs. - */ - public int request_id (){ - // access is currently valid for all states: - //checkAccess( MID_REQUEST_ID ); - /* - * NOTE: The request id in server interceptors is NOT the - * same as the GIOP request id. The ORB may be servicing several - * connections, each with possibly overlapping sets of request ids. - * Therefore we create a request id specific to interceptors. - */ - return serverRequestId; - } - - /** - * See ServerRequestInfo for javadocs. - */ - public String operation (){ - // access is currently valid for all states: - //checkAccess( MID_OPERATION ); - return request.getOperationName(); - } - - /** - * See ServerRequestInfo for javadocs. - */ - public Parameter[] arguments (){ - checkAccess( MID_ARGUMENTS ); - - if( cachedArguments == null ) { - if( !isDynamic ) { - throw stdWrapper.piOperationNotSupported1() ; - } - - if( dsiArguments == null ) { - throw stdWrapper.piOperationNotSupported8() ; - } - - // If it is a DSI request then get the arguments from the DSI req - // and convert that into parameters. - cachedArguments = nvListToParameterArray( dsiArguments ); - } - - // Good citizen: In the interest of efficiency, we assume - // interceptors will be "good citizens" in that they will not - // modify the contents of the Parameter[] array. We also assume - // they will not change the values of the containing Anys. - - return cachedArguments; - } - - /** - * See ServerRequestInfo for javadocs. - */ - public TypeCode[] exceptions (){ - checkAccess( MID_EXCEPTIONS ); - - // _REVISIT_ PI RTF Issue: No exception list on server side. - - throw stdWrapper.piOperationNotSupported2() ; - } - - /** - * See ServerRequestInfo for javadocs. - */ - public String[] contexts (){ - checkAccess( MID_CONTEXTS ); - - // We do not support this because our ORB does not send contexts. - - throw stdWrapper.piOperationNotSupported3() ; - } - - /** - * See ServerRequestInfo for javadocs. - */ - public String[] operation_context (){ - checkAccess( MID_OPERATION_CONTEXT ); - - // We do not support this because our ORB does not send - // operation_context. - - throw stdWrapper.piOperationNotSupported4() ; - } - - /** - * See ServerRequestInfo for javadocs. - */ - public Any result (){ - checkAccess( MID_RESULT ); - - if( !isDynamic ) { - throw stdWrapper.piOperationNotSupported5() ; - } - - if( dsiResult == null ) { - throw wrapper.piDsiResultIsNull() ; - } - - // Good citizen: In the interest of efficiency, we assume that - // interceptors will not modify the contents of the result Any. - // Otherwise, we would need to create a deep copy of the Any. - - return dsiResult; - } - - /** - * See ServerRequestInfo for javadocs. - */ - public boolean response_expected (){ - // access is currently valid for all states: - //checkAccess( MID_RESPONSE_EXPECTED ); - return !request.isOneWay(); - } - - /** - * See ServerRequestInfo for javadocs. - */ - public Object forward_reference (){ - checkAccess( MID_FORWARD_REFERENCE ); - // Check to make sure we are in LOCATION_FORWARD - // state as per ptc/00-08-06, table 21-2 - // footnote 2. - if( replyStatus != LOCATION_FORWARD.value ) { - throw stdWrapper.invalidPiCall1() ; - } - - return getForwardRequestException().forward; - } - - /** - * See ServerRequestInfo for javadocs. - */ - public org.omg.IOP.ServiceContext get_request_service_context( int id ) { - checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT ); - - if( cachedRequestServiceContexts == null ) { - cachedRequestServiceContexts = new HashMap(); - } - - return getServiceContext( cachedRequestServiceContexts, - request.getRequestServiceContexts(), id ); - } - - /** - * See ServerRequestInfo for javadocs. - */ - public org.omg.IOP.ServiceContext get_reply_service_context( int id ) { - checkAccess( MID_GET_REPLY_SERVICE_CONTEXT ); - - if( cachedReplyServiceContexts == null ) { - cachedReplyServiceContexts = new HashMap(); - } - - return getServiceContext( cachedReplyServiceContexts, - replyMessage.getServiceContexts(), id ); - } - - /* - ********************************************************************** - * Private-scope classes and methods - **********************************************************************/ - - // A command encapsulating a request to add a reply service context. - // These commands are enqueued until we have a handle on the actual - // reply service context, at which point they are executed. - private class AddReplyServiceContextCommand { - ServiceContext service_context; - boolean replace; - } - - // Adds the given add reply service context command to the queue of - // such commands. If a command is detected to have the same id as - // the service context in this command, and replace is false, - // BAD_INV_ORDER is thrown. If replace is true, the original command - // in the queue is replaced by this command. - private void enqueue( AddReplyServiceContextCommand addReply ) { - int size = addReplyServiceContextQueue.size(); - boolean found = false; - - for( int i = 0; i < size; i++ ) { - AddReplyServiceContextCommand cmd = - (AddReplyServiceContextCommand) - addReplyServiceContextQueue.get( i ); - - if( cmd.service_context.context_id == - addReply.service_context.context_id ) - { - found = true; - if( addReply.replace ) { - addReplyServiceContextQueue.set( i, addReply ); - } else { - throw stdWrapper.serviceContextAddFailed( - new Integer( cmd.service_context.context_id ) ) ; - } - break; - } - } - - if( !found ) { - addReplyServiceContextQueue.add( addReply ); - } - } - - /* - ********************************************************************** - * Package and protected-scope methods - **********************************************************************/ - - /** - * Overridden from RequestInfoImpl. This version calls the super - * and then, if we are changing to ending points, executes all - * enqueued AddReplyServiceContextCommands. - */ - protected void setCurrentExecutionPoint( int executionPoint ) { - super.setCurrentExecutionPoint( executionPoint ); - - // If we are transitioning to ending point, we will now have a pointer - // to the reply service contexts, so we can execute all queued - // add reply service context requests. - if( (executionPoint == EXECUTION_POINT_ENDING) && - (addReplyServiceContextQueue != null) ) - { - int size = addReplyServiceContextQueue.size(); - for( int i = 0; i < size; i++ ) { - AddReplyServiceContextCommand addReply = - (AddReplyServiceContextCommand) - addReplyServiceContextQueue.get( i ); - try { - add_reply_service_context( addReply.service_context, - addReply.replace ); - } - catch( BAD_INV_ORDER e ) { - // _REVISIT_ The only way this can happen is if during - // rrsc or rr, the interceptor tried to add with - // replace=false to a service context that is present in - // the reply message. At that time there was no way for - // us to check for this, so the best we can do is ignore - // the original request. - } - } - - // We specifically do not empty the SC queue so that if - // the interceptor raises an exception the queued service contexts - // will be put in the exception response. - } - } - - /** - * Stores the various sources of information used for this info object. - */ - protected void setInfo( CorbaMessageMediator request, ObjectAdapter oa, - byte[] objectId, ObjectKeyTemplate oktemp ) - { - this.request = request; - this.objectId = objectId; - this.oktemp = oktemp; - this.objectAdapter = oa ; - this.connection = (com.sun.corba.se.spi.legacy.connection.Connection) - request.getConnection(); - } - - /** - * Stores the various sources of information used for this info object. - */ - protected void setDSIArguments( NVList arguments ) { - this.dsiArguments = arguments; - } - - /** - * Stores the various sources of information used for this info object. - */ - protected void setDSIException( Any exception ) { - this.dsiException = exception; - - // Clear cached exception value: - cachedSendingException = null; - } - - /** - * Stores the various sources of information used for this info object. - */ - protected void setDSIResult( Any result ) { - this.dsiResult = result; - } - - /** - * Sets the exception to be returned by received_exception and - * received_exception_id. - */ - protected void setException( Exception exception ) { - super.setException( exception ); - - // Make sure DSIException is null because this is the more recent one. - this.dsiException = null; - - // Clear cached exception value: - cachedSendingException = null; - } - - /** - * Stores the various sources of information used for this info object. - */ - protected void setInfo( java.lang.Object servant, - String targetMostDerivedInterface ) - { - this.servant = servant; - this.targetMostDerivedInterface = targetMostDerivedInterface; - this.isDynamic = - (servant instanceof - org.omg.PortableServer.DynamicImplementation) || - (servant instanceof org.omg.CORBA.DynamicImplementation); - } - - /** - * Set reply message - */ - void setReplyMessage( ReplyMessage replyMessage ) { - this.replyMessage = replyMessage; - } - - /** - * Overridden from RequestInfoImpl. Calls the super class, then - * sets the ending point call depending on the reply status. - */ - protected void setReplyStatus( short replyStatus ) { - super.setReplyStatus( replyStatus ); - switch( replyStatus ) { - case SUCCESSFUL.value: - endingPointCall = CALL_SEND_REPLY; - break; - case SYSTEM_EXCEPTION.value: - case USER_EXCEPTION.value: - endingPointCall = CALL_SEND_EXCEPTION; - break; - case LOCATION_FORWARD.value: - case TRANSPORT_RETRY.value: - endingPointCall = CALL_SEND_OTHER; - break; - } - } - - /** - * Release the servant object so the user has control over its lifetime. - * Called after receive_request is finished executing. - */ - void releaseServant() { - this.servant = null; - } - - /** - * Sets the forwardRequestRaisedInEnding flag to true, indicating that - * a server ending point has raised location forward at some point. - */ - void setForwardRequestRaisedInEnding() { - this.forwardRequestRaisedInEnding = true; - } - - /** - * Returns true if ForwardRequest was raised by a server ending point - * or false otherwise. - */ - boolean isForwardRequestRaisedInEnding() { - return this.forwardRequestRaisedInEnding; - } - - /** - * Returns true if this is a dynamic invocation, or false if not - */ - boolean isDynamic() { - return this.isDynamic; - } - - /** - * See description for RequestInfoImpl.checkAccess - */ - protected void checkAccess( int methodID ) - { - // Make sure currentPoint matches the appropriate index in the - // validCall table: - int validCallIndex = 0; - switch( currentExecutionPoint ) { - case EXECUTION_POINT_STARTING: - validCallIndex = 0; - break; - case EXECUTION_POINT_INTERMEDIATE: - validCallIndex = 1; - break; - case EXECUTION_POINT_ENDING: - switch( endingPointCall ) { - case CALL_SEND_REPLY: - validCallIndex = 2; - break; - case CALL_SEND_EXCEPTION: - validCallIndex = 3; - break; - case CALL_SEND_OTHER: - validCallIndex = 4; - break; - } - break; - } - - // Check the validCall table: - if( !validCall[methodID][validCallIndex] ) { - throw stdWrapper.invalidPiCall2() ; - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTable.java 2018-01-30 20:17:21.000000000 -0500 +++ /dev/null 2018-01-30 20:17:21.000000000 -0500 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.interceptors; - -import com.sun.corba.se.impl.corba.AnyImpl; -import com.sun.corba.se.spi.orb.ORB; -import org.omg.PortableInterceptor.Current; -import org.omg.PortableInterceptor.InvalidSlot; -import org.omg.CORBA.Any; - -/** - * SlotTable is used internally by PICurrent to store the slot information. - */ -public class SlotTable { - // The vector where all the slot data for the current thread is stored - private Any[] theSlotData; - - // Required for instantiating Any object. - private ORB orb; - - // The flag to check whether there are any updates in the current SlotTable. - // The slots will be reset to null, only if this flag is set. - private boolean dirtyFlag; - - /** - * The constructor instantiates an Array of Any[] of size given by slotSize - * parameter. - */ - SlotTable( ORB orb, int slotSize ) { - dirtyFlag = false; - this.orb = orb; - theSlotData = new Any[slotSize]; - } - - /** - * This method sets the slot data at the given slot id (index). - */ - public void set_slot( int id, Any data ) throws InvalidSlot - { - // First check whether the slot is allocated - // If not, raise the invalid slot exception - if( id >= theSlotData.length ) { - throw new InvalidSlot(); - } - dirtyFlag = true; - theSlotData[id] = data; - } - - /** - * This method get the slot data for the given slot id (index). - */ - public Any get_slot( int id ) throws InvalidSlot - { - // First check whether the slot is allocated - // If not, raise the invalid slot exception - if( id >= theSlotData.length ) { - throw new InvalidSlot(); - } - if( theSlotData[id] == null ) { - theSlotData [id] = new AnyImpl(orb); - } - return theSlotData[ id ]; - } - - - /** - * This method resets all the slot data to null if dirtyFlag is set. - */ - void resetSlots( ) { - if( dirtyFlag == true ) { - for( int i = 0; i < theSlotData.length; i++ ) { - theSlotData[i] = null; - } - } - } - - /** - * This method returns the size of the allocated slots. - */ - int getSize( ) { - return theSlotData.length; - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTableStack.java 2018-01-30 20:17:22.000000000 -0500 +++ /dev/null 2018-01-30 20:17:22.000000000 -0500 @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.interceptors; - -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.INTERNAL; -import org.omg.PortableInterceptor.Current; -import org.omg.PortableInterceptor.InvalidSlot; - -import com.sun.corba.se.impl.corba.AnyImpl; - -import com.sun.corba.se.impl.logging.InterceptorsSystemException; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.spi.orb.ORB; - -/** - * SlotTableStack is the container of SlotTable instances for each thread - */ -public class SlotTableStack -{ - // SlotTablePool is the container for reusable SlotTables' - private class SlotTablePool { - - // Contains a list of reusable SlotTable - private SlotTable[] pool; - - // High water mark for the pool - // If the pool size reaches this limit then putSlotTable will - // not put SlotTable to the pool. - private final int HIGH_WATER_MARK = 5; - - // currentIndex points to the last SlotTable in the list - private int currentIndex; - - SlotTablePool( ) { - pool = new SlotTable[HIGH_WATER_MARK]; - currentIndex = 0; - } - - /** - * Puts SlotTable to the re-usable pool. - */ - void putSlotTable( SlotTable table ) { - // If there are enough SlotTables in the pool, then don't add - // this table to the pool. - if( currentIndex >= HIGH_WATER_MARK ) { - // Let the garbage collector collect it. - return; - } - pool[currentIndex] = table; - currentIndex++; - } - - /** - * Gets SlotTable from the re-usable pool. - */ - SlotTable getSlotTable( ) { - // If there are no entries in the pool then return null - if( currentIndex == 0 ) { - return null; - } - // Works like a stack, Gets the last one added first - currentIndex--; - return pool[currentIndex]; - } - } - - // Contains all the active SlotTables for each thread. - // The List is made to behave like a stack. - private java.util.List tableContainer; - - // Keeps track of number of PICurrents in the stack. - private int currentIndex; - - // For Every Thread there will be a pool of re-usable SlotTables' - // stored in SlotTablePool - private SlotTablePool tablePool; - - // The ORB associated with this slot table stack - private ORB orb; - - private InterceptorsSystemException wrapper ; - - /** - * Constructs the stack and and SlotTablePool - */ - SlotTableStack( ORB orb, SlotTable table ) { - this.orb = orb; - wrapper = InterceptorsSystemException.get( orb, CORBALogDomains.RPC_PROTOCOL ) ; - - currentIndex = 0; - tableContainer = new java.util.ArrayList( ); - tablePool = new SlotTablePool( ); - // SlotTableStack will be created with one SlotTable on the stack. - // This table is used as the reference to query for number of - // allocated slots to create other slottables. - tableContainer.add( currentIndex, table ); - currentIndex++; - } - - - /** - * pushSlotTable pushes a fresh Slot Table on to the stack by doing the - * following, - * 1: Checks to see if there is any SlotTable in SlotTablePool - * If present then use that instance to push into the SlotTableStack - * - * 2: If there is no SlotTable in the pool, then creates a new one and - * pushes that into the SlotTableStack - */ - void pushSlotTable( ) { - SlotTable table = tablePool.getSlotTable( ); - if( table == null ) { - // get an existing PICurrent to get the slotSize - SlotTable tableTemp = peekSlotTable(); - table = new SlotTable( orb, tableTemp.getSize( )); - } - // NOTE: Very important not to always "add" - otherwise a memory leak. - if (currentIndex == tableContainer.size()) { - // Add will cause the table to grow. - tableContainer.add( currentIndex, table ); - } else if (currentIndex > tableContainer.size()) { - throw wrapper.slotTableInvariant( new Integer( currentIndex ), - new Integer( tableContainer.size() ) ) ; - } else { - // Set will override unused slots. - tableContainer.set( currentIndex, table ); - } - currentIndex++; - } - - /** - * popSlotTable does the following - * 1: pops the top SlotTable in the SlotTableStack - * - * 2: resets the slots in the SlotTable which resets the slotvalues to - * null if there are any previous sets. - * - * 3: puts the reset SlotTable into the SlotTablePool to reuse - */ - void popSlotTable( ) { - if( currentIndex <= 1 ) { - // Do not pop the SlotTable, If there is only one. - // This should not happen, But an extra check for safety. - throw wrapper.cantPopOnlyPicurrent() ; - } - currentIndex--; - SlotTable table = (SlotTable)tableContainer.get( currentIndex ); - tableContainer.set( currentIndex, null ); // Do not leak memory. - table.resetSlots( ); - tablePool.putSlotTable( table ); - } - - /** - * peekSlotTable gets the top SlotTable from the SlotTableStack without - * popping. - */ - SlotTable peekSlotTable( ) { - return (SlotTable) tableContainer.get( currentIndex - 1); - } - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java 2018-01-30 20:17:23.000000000 -0500 +++ /dev/null 2018-01-30 20:17:23.000000000 -0500 @@ -1,184 +0,0 @@ -/* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -import org.omg.CORBA.ORB; -import java.util.Properties; -import javax.rmi.CORBA.Util; -import javax.rmi.CORBA.ValueHandler; -import java.util.Hashtable; -import java.util.Stack; - -import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription; -import com.sun.org.omg.SendingContext._CodeBaseImplBase; -import com.sun.org.omg.SendingContext.CodeBase; -import com.sun.org.omg.SendingContext.CodeBaseHelper; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.ORB; - -import com.sun.corba.se.impl.logging.OMGSystemException; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -/** - * This class acts as the remote interface to receivers wishing to retrieve - * the information of a remote Class. - */ -public class FVDCodeBaseImpl extends _CodeBaseImplBase -{ - // Contains rep. ids as keys to FullValueDescriptions - private static Hashtable fvds = new Hashtable(); - - // Private ORBSingleton used when we need an ORB while not - // having a delegate set. - private transient ORB orb = null; - - private transient OMGSystemException wrapper = OMGSystemException.get( - CORBALogDomains.RPC_ENCODING ) ; - - // backward compatability so that appropriate rep-id calculations - // can take place - // this needs to be transient to prevent serialization during - // marshalling/unmarshalling - private transient ValueHandlerImpl vhandler = null; - - void setValueHandler(ValueHandler vh) - { - vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh; - } - - // Operation to obtain the IR from the sending context - public com.sun.org.omg.CORBA.Repository get_ir (){ - return null; - } - - // Operations to obtain a URL to the implementation code - public String implementation (String x){ - try{ - // default to using the current ORB version in case the - // vhandler is not set - if (vhandler == null) { - vhandler = ValueHandlerImpl.getInstance(false); - } - - // Util.getCodebase may return null which would - // cause a BAD_PARAM exception. - String result = Util.getCodebase(vhandler.getClassFromType(x)); - if (result == null) - return ""; - else - return result; - } catch(ClassNotFoundException cnfe){ - throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE, - cnfe ) ; - } - } - - public String[] implementations (String[] x){ - String result[] = new String[x.length]; - - for (int i = 0; i < x.length; i++) - result[i] = implementation(x[i]); - - return result; - } - - // the same information - public FullValueDescription meta (String x){ - try{ - FullValueDescription result = (FullValueDescription)fvds.get(x); - - if (result == null) { - // default to using the current ORB version in case the - // vhandler is not set - if (vhandler == null) { - vhandler = ValueHandlerImpl.getInstance(false); - } - - try{ - result = ValueUtility.translate(_orb(), - ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler); - } catch(Throwable t){ - if (orb == null) - orb = ORB.init(); //d11638 - result = ValueUtility.translate(orb, - ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler); - } - - if (result != null){ - fvds.put(x, result); - } else { - throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE); - } - } - - return result; - } catch(Throwable t){ - throw wrapper.incompatibleValueImpl(CompletionStatus.COMPLETED_MAYBE,t); - } - } - - public FullValueDescription[] metas (String[] x){ - FullValueDescription descriptions[] = new FullValueDescription[x.length]; - - for (int i = 0; i < x.length; i++) - descriptions[i] = meta(x[i]); - - return descriptions; - } - - // information - public String[] bases (String x){ - try { - // default to using the current ORB version in case the - // vhandler is not set - if (vhandler == null) { - vhandler = ValueHandlerImpl.getInstance(false); - } - - Stack repIds = new Stack(); - Class parent = ObjectStreamClass.lookup(vhandler.getClassFromType(x)).forClass().getSuperclass(); - - while (!parent.equals(java.lang.Object.class)) { - repIds.push(vhandler.createForAnyType(parent)); - parent = parent.getSuperclass(); - } - - String result[] = new String[repIds.size()]; - for (int i = result.length - 1; i >= 0; i++) - result[i] = (String)repIds.pop(); - - return result; - } catch (Throwable t) { - throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE, t ); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java 2018-01-30 20:17:24.000000000 -0500 +++ /dev/null 2018-01-30 20:17:24.000000000 -0500 @@ -1,2810 +0,0 @@ -/* - * Copyright (c) 1998, 2015, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -import java.io.IOException; -import java.io.StreamCorruptedException; -import java.io.ObjectInputValidation; -import java.io.NotActiveException; -import java.io.InvalidObjectException; -import java.io.InvalidClassException; -import java.io.OptionalDataException; -import java.io.Externalizable; -import java.io.EOFException; -import java.lang.reflect.*; -import java.util.Vector; -import java.util.Enumeration; - -import sun.corba.Bridge ; - -import java.security.AccessController ; -import java.security.PrivilegedAction ; - -import com.sun.corba.se.impl.util.Utility; - -import org.omg.CORBA.portable.ValueInputStream; - -import org.omg.CORBA.ValueMember; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.TCKind; -import org.omg.CORBA.ORB; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.portable.IndirectionException; -import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.TypeCode; - -import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription; -import com.sun.org.omg.SendingContext.CodeBase; - -import javax.rmi.CORBA.Util; -import javax.rmi.CORBA.ValueHandler; - -import java.security.*; -import java.util.*; - -import com.sun.corba.se.impl.logging.OMGSystemException ; -import com.sun.corba.se.impl.logging.UtilSystemException ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -/** - * IIOPInputStream is used by the ValueHandlerImpl to handle Java serialization - * input semantics. - * - * @author Stephen Lewallen - * @since JDK1.1.6 - */ - -public class IIOPInputStream - extends com.sun.corba.se.impl.io.InputStreamHook -{ - private static Bridge bridge = - (Bridge)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return Bridge.get() ; - } - } - ) ; - - private static OMGSystemException omgWrapper = OMGSystemException.get( - CORBALogDomains.RPC_ENCODING ) ; - private static UtilSystemException utilWrapper = UtilSystemException.get( - CORBALogDomains.RPC_ENCODING ) ; - - // Necessary to pass the appropriate fields into the - // defaultReadObjectDelegate method (which takes no - // parameters since it's called from - // java.io.ObjectInpuStream defaultReadObject() - // which we can't change). - // - // This is only used in the case where the fields had - // to be obtained remotely because of a serializable - // version difference. Set in inputObjectUsingFVD. - // Part of serialization evolution fixes for Ladybird, - // bug 4365188. - private ValueMember defaultReadObjectFVDMembers[] = null; - - private org.omg.CORBA_2_3.portable.InputStream orbStream; - - private CodeBase cbSender; - - private ValueHandlerImpl vhandler; //d4365188 - - private Object currentObject = null; - - private ObjectStreamClass currentClassDesc = null; - - private Class currentClass = null; - - private int recursionDepth = 0; - - private int simpleReadDepth = 0; - - // The ActiveRecursionManager replaces the old RecursionManager which - // used to record how many recursions were made, and resolve them after - // an object was completely deserialized. - // - // That created problems (as in bug 4414154) because when custom - // unmarshaling in readObject, there can be recursive references - // to one of the objects currently being unmarshaled, and the - // passive recursion system failed. - ActiveRecursionManager activeRecursionMgr = new ActiveRecursionManager(); - - private IOException abortIOException = null; - - /* Remember the first exception that stopped this stream. */ - private ClassNotFoundException abortClassNotFoundException = null; - - /* Vector of validation callback objects - * The vector is created as needed. The vector is maintained in - * order of highest (first) priority to lowest - */ - private Vector callbacks; - - // Serialization machinery fields - /* Arrays used to keep track of classes and ObjectStreamClasses - * as they are being merged; used in inputObject. - * spClass is the stack pointer for both. */ - ObjectStreamClass[] classdesc; - Class[] classes; - int spClass; - - private static final String kEmptyStr = ""; - - // TCKind TypeCodes used in FVD inputClassFields - //public static final TypeCode kRemoteTypeCode = new TypeCodeImpl(TCKind._tk_objref); - //public static final TypeCode kValueTypeCode = new TypeCodeImpl(TCKind._tk_value); - // removed TypeCodeImpl dependency - public static final TypeCode kRemoteTypeCode = ORB.init().get_primitive_tc(TCKind.tk_objref); - public static final TypeCode kValueTypeCode = ORB.init().get_primitive_tc(TCKind.tk_value); - - // TESTING CODE - useFVDOnly should be made final before FCS in order to - // optimize out the check. - private static final boolean useFVDOnly = false; - - private byte streamFormatVersion; - - // Return the stream format version currently being used - // to deserialize an object - protected byte getStreamFormatVersion() { - return streamFormatVersion; - } - - // At the beginning of data sent by a writeObject or - // writeExternal method there is a byte telling the - // reader the stream format version. - private void readFormatVersion() throws IOException { - - streamFormatVersion = orbStream.read_octet(); - - if (streamFormatVersion < 1 || - streamFormatVersion > vhandler.getMaximumStreamFormatVersion()) { - SystemException sysex = omgWrapper.unsupportedFormatVersion( - CompletionStatus.COMPLETED_MAYBE); - // XXX I18N? Logging for IOException? - IOException result = new IOException("Unsupported format version: " - + streamFormatVersion); - result.initCause( sysex ) ; - throw result ; - } - - if (streamFormatVersion == 2) { - if (!(orbStream instanceof ValueInputStream)) { - SystemException sysex = omgWrapper.notAValueinputstream( - CompletionStatus.COMPLETED_MAYBE); - // XXX I18N? Logging for IOException? - IOException result = new IOException("Not a ValueInputStream"); - result.initCause( sysex ) ; - throw result; - } - } - } - - public static void setTestFVDFlag(boolean val){ - // useFVDOnly = val; - } - - /** - * Dummy constructor; passes upper stream a dummy stream; - **/ - public IIOPInputStream() - throws java.io.IOException { - super(); - resetStream(); - } - - final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) { - orbStream = os; - } - - final org.omg.CORBA_2_3.portable.InputStream getOrbStream() { - return orbStream; - } - - //added setSender and getSender - public final void setSender(CodeBase cb) { - cbSender = cb; - } - - public final CodeBase getSender() { - return cbSender; - } - - // 4365188 this is added to enable backward compatability w/ wrong - // rep-ids - public final void setValueHandler(ValueHandler vh) { - vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh; - } - - public final ValueHandler getValueHandler() { - return (javax.rmi.CORBA.ValueHandler) vhandler; - } - - final void increaseRecursionDepth(){ - recursionDepth++; - } - - final int decreaseRecursionDepth(){ - return --recursionDepth; - } - - /** - * Override the actions of the final method "readObject()" - * in ObjectInputStream. - * @since JDK1.1.6 - * - * Read an object from the ObjectInputStream. - * The class of the object, the signature of the class, and the values - * of the non-transient and non-static fields of the class and all - * of its supertypes are read. Default deserializing for a class can be - * overriden using the writeObject and readObject methods. - * Objects referenced by this object are read transitively so - * that a complete equivalent graph of objects is reconstructed by readObject.

- * - * The root object is completly restored when all of its fields - * and the objects it references are completely restored. At this - * point the object validation callbacks are executed in order - * based on their registered priorities. The callbacks are - * registered by objects (in the readObject special methods) - * as they are individually restored. - * - * Exceptions are thrown for problems with the InputStream and for classes - * that should not be deserialized. All exceptions are fatal to the - * InputStream and leave it in an indeterminate state; it is up to the caller - * to ignore or recover the stream state. - * @exception java.lang.ClassNotFoundException Class of a serialized object - * cannot be found. - * @exception InvalidClassException Something is wrong with a class used by - * serialization. - * @exception StreamCorruptedException Control information in the - * stream is inconsistent. - * @exception OptionalDataException Primitive data was found in the - * stream instead of objects. - * @exception IOException Any of the usual Input/Output related exceptions. - * @since JDK1.1 - */ - public final synchronized Object readObjectDelegate() throws IOException - { - try { - - readObjectState.readData(this); - - return orbStream.read_abstract_interface(); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, true); - throw marshalException; - } catch(IndirectionException cdrie) - { - // The CDR stream had never seen the given offset before, - // so check the recursion manager (it will throw an - // IOException if it doesn't have a reference, either). - return activeRecursionMgr.getObject(cdrie.offset); - } - } - - final synchronized Object simpleReadObject(Class clz, - String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender, - int offset) - /* throws OptionalDataException, ClassNotFoundException, IOException */ - { - /* Save the current state and get ready to read an object. */ - Object prevObject = currentObject; - ObjectStreamClass prevClassDesc = currentClassDesc; - Class prevClass = currentClass; - byte oldStreamFormatVersion = streamFormatVersion; - - simpleReadDepth++; // Entering - Object obj = null; - - /* - * Check for reset, handle it before reading an object. - */ - try { - // d4365188: backward compatability - if (vhandler.useFullValueDescription(clz, repositoryID)) { - obj = inputObjectUsingFVD(clz, repositoryID, sender, offset); - } else { - obj = inputObject(clz, repositoryID, sender, offset); - } - - obj = currentClassDesc.readResolve(obj); - } - catch(ClassNotFoundException cnfe) - { - bridge.throwException( cnfe ) ; - return null; - } - catch(IOException ioe) - { - // System.out.println("CLZ = " + clz + "; " + ioe.toString()); - bridge.throwException(ioe) ; - return null; - } - finally { - simpleReadDepth --; - currentObject = prevObject; - currentClassDesc = prevClassDesc; - currentClass = prevClass; - streamFormatVersion = oldStreamFormatVersion; - } - - - /* Check for thrown exceptions and re-throw them, clearing them if - * this is the last recursive call . - */ - IOException exIOE = abortIOException; - if (simpleReadDepth == 0) - abortIOException = null; - if (exIOE != null){ - bridge.throwException( exIOE ) ; - return null; - } - - - ClassNotFoundException exCNF = abortClassNotFoundException; - if (simpleReadDepth == 0) - abortClassNotFoundException = null; - if (exCNF != null) { - bridge.throwException( exCNF ) ; - return null; - } - - return obj; - } - - public final synchronized void simpleSkipObject(String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender) - /* throws OptionalDataException, ClassNotFoundException, IOException */ - { - - /* Save the current state and get ready to read an object. */ - Object prevObject = currentObject; - ObjectStreamClass prevClassDesc = currentClassDesc; - Class prevClass = currentClass; - byte oldStreamFormatVersion = streamFormatVersion; - - simpleReadDepth++; // Entering - Object obj = null; - - /* - * Check for reset, handle it before reading an object. - */ - try { - skipObjectUsingFVD(repositoryID, sender); - } - catch(ClassNotFoundException cnfe) - { - bridge.throwException( cnfe ) ; - return; - } - catch(IOException ioe) - { - bridge.throwException( ioe ) ; - return; - } - finally { - simpleReadDepth --; - streamFormatVersion = oldStreamFormatVersion; - currentObject = prevObject; - currentClassDesc = prevClassDesc; - currentClass = prevClass; - } - - - /* Check for thrown exceptions and re-throw them, clearing them if - * this is the last recursive call . - */ - IOException exIOE = abortIOException; - if (simpleReadDepth == 0) - abortIOException = null; - if (exIOE != null){ - bridge.throwException( exIOE ) ; - return; - } - - - ClassNotFoundException exCNF = abortClassNotFoundException; - if (simpleReadDepth == 0) - abortClassNotFoundException = null; - if (exCNF != null) { - bridge.throwException( exCNF ) ; - return; - } - - return; - } - ///////////////// - - /** - * This method is called by trusted subclasses of ObjectOutputStream - * that constructed ObjectOutputStream using the - * protected no-arg constructor. The subclass is expected to provide - * an override method with the modifier "final". - * - * @return the Object read from the stream. - * - * @see #ObjectInputStream() - * @see #readObject - * @since JDK 1.2 - */ - protected final Object readObjectOverride() - throws OptionalDataException, ClassNotFoundException, IOException - { - return readObjectDelegate(); - } - - /** - * Override the actions of the final method "defaultReadObject()" - * in ObjectInputStream. - * @since JDK1.1.6 - * - * Read the non-static and non-transient fields of the current class - * from this stream. This may only be called from the readObject method - * of the class being deserialized. It will throw the NotActiveException - * if it is called otherwise. - * - * @exception java.lang.ClassNotFoundException if the class of a serialized - * object could not be found. - * @exception IOException if an I/O error occurs. - * @exception NotActiveException if the stream is not currently reading - * objects. - * @since JDK1.1 - */ - final synchronized void defaultReadObjectDelegate() - /* throws IOException, ClassNotFoundException, NotActiveException */ - { - try { - if (currentObject == null || currentClassDesc == null) - // XXX I18N, logging needed. - throw new NotActiveException("defaultReadObjectDelegate"); - - if (!currentClassDesc.forClass().isAssignableFrom( - currentObject.getClass())) { - throw new IOException("Object Type mismatch"); - } - - // The array will be null unless fields were retrieved - // remotely because of a serializable version difference. - // Bug fix for 4365188. See the definition of - // defaultReadObjectFVDMembers for more information. - if (defaultReadObjectFVDMembers != null && - defaultReadObjectFVDMembers.length > 0) { - - // WARNING: Be very careful! What if some of - // these fields actually have to do this, too? - // This works because the defaultReadObjectFVDMembers - // reference is passed to inputClassFields, but - // there is no guarantee that - // defaultReadObjectFVDMembers will point to the - // same array after calling inputClassFields. - - // Use the remote fields to unmarshal. - inputClassFields(currentObject, - currentClass, - currentClassDesc, - defaultReadObjectFVDMembers, - cbSender); - - } else { - - // Use the local fields to unmarshal. - ObjectStreamField[] fields = - currentClassDesc.getFieldsNoCopy(); - if (fields.length > 0) { - inputClassFields(currentObject, currentClass, fields, cbSender); - } - } - } - catch(NotActiveException nae) - { - bridge.throwException( nae ) ; - } - catch(IOException ioe) - { - bridge.throwException( ioe ) ; - } - catch(ClassNotFoundException cnfe) - { - bridge.throwException( cnfe ) ; - } - - } - - /** - * Override the actions of the final method "enableResolveObject()" - * in ObjectInputStream. - * @since JDK1.1.6 - * - * Enable the stream to allow objects read from the stream to be replaced. - * If the stream is a trusted class it is allowed to enable replacment. - * Trusted classes are those classes with a classLoader equals null.

- * - * When enabled the resolveObject method is called for every object - * being deserialized. - * - * @exception SecurityException The classloader of this stream object is non-null. - * @since JDK1.1 - */ - public final boolean enableResolveObjectDelegate(boolean enable) - /* throws SecurityException */ - { - return false; - } - - // The following three methods allow the implementing orbStream - // to provide mark/reset behavior as defined in java.io.InputStream. - - public final void mark(int readAheadLimit) { - orbStream.mark(readAheadLimit); - } - - public final boolean markSupported() { - return orbStream.markSupported(); - } - - public final void reset() throws IOException { - try { - orbStream.reset(); - } catch (Error e) { - IOException err = new IOException(e.getMessage()); - err.initCause(e) ; - throw err ; - } - } - - public final int available() throws IOException{ - return 0; // unreliable - } - - public final void close() throws IOException{ - // no op - } - - public final int read() throws IOException{ - try{ - readObjectState.readData(this); - - return (orbStream.read_octet() << 0) & 0x000000FF; - } catch (MARSHAL marshalException) { - if (marshalException.minor - == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) { - setState(IN_READ_OBJECT_NO_MORE_OPT_DATA); - return -1; - } - - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e) ; - throw exc ; - } - } - - public final int read(byte data[], int offset, int length) throws IOException{ - try{ - readObjectState.readData(this); - - orbStream.read_octet_array(data, offset, length); - return length; - } catch (MARSHAL marshalException) { - if (marshalException.minor - == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) { - setState(IN_READ_OBJECT_NO_MORE_OPT_DATA); - return -1; - } - - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e) ; - throw exc ; - } - - } - - public final boolean readBoolean() throws IOException{ - try{ - readObjectState.readData(this); - - return orbStream.read_boolean(); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - public final byte readByte() throws IOException{ - try{ - readObjectState.readData(this); - - return orbStream.read_octet(); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - public final char readChar() throws IOException{ - try{ - readObjectState.readData(this); - - return orbStream.read_wchar(); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - public final double readDouble() throws IOException{ - try{ - readObjectState.readData(this); - - return orbStream.read_double(); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - public final float readFloat() throws IOException{ - try{ - readObjectState.readData(this); - - return orbStream.read_float(); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - public final void readFully(byte data[]) throws IOException{ -// d11623 : implement readFully, required for serializing some core classes - - readFully(data, 0, data.length); - } - - public final void readFully(byte data[], int offset, int size) throws IOException{ -// d11623 : implement readFully, required for serializing some core classes - try{ - readObjectState.readData(this); - - orbStream.read_octet_array(data, offset, size); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - public final int readInt() throws IOException{ - try{ - readObjectState.readData(this); - - return orbStream.read_long(); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - public final String readLine() throws IOException{ - // XXX I18N, logging needed. - throw new IOException("Method readLine not supported"); - } - - public final long readLong() throws IOException{ - try{ - readObjectState.readData(this); - - return orbStream.read_longlong(); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - public final short readShort() throws IOException{ - try{ - readObjectState.readData(this); - - return orbStream.read_short(); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - protected final void readStreamHeader() throws IOException, StreamCorruptedException{ - // no op - } - - public final int readUnsignedByte() throws IOException{ - try{ - readObjectState.readData(this); - - return (orbStream.read_octet() << 0) & 0x000000FF; - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - public final int readUnsignedShort() throws IOException{ - try{ - readObjectState.readData(this); - - return (orbStream.read_ushort() << 0) & 0x0000FFFF; - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - /** - * Helper method for correcting the Kestrel bug 4367783 (dealing - * with larger than 8-bit chars). The old behavior is preserved - * in orbutil.IIOPInputStream_1_3 in order to interoperate with - * our legacy ORBs. - */ - protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream) - { - return stream.read_wstring(); - } - - public final String readUTF() throws IOException{ - try{ - readObjectState.readData(this); - - return internalReadUTF(orbStream); - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e); - throw exc ; - } - } - - // If the ORB stream detects an incompatibility between what's - // on the wire and what our Serializable's readObject wants, - // it throws a MARSHAL exception with a specific minor code. - // This is rethrown to the readObject as an OptionalDataException. - // So far in RMI-IIOP, this process isn't specific enough to - // tell the readObject how much data is available, so we always - // set the OptionalDataException's EOF marker to true. - private void handleOptionalDataMarshalException(MARSHAL marshalException, - boolean objectRead) - throws IOException { - - // Java Object Serialization spec 3.4: "If the readObject method - // of the class attempts to read more data than is present in the - // optional part of the stream for this class, the stream will - // return -1 for bytewise reads, throw an EOFException for - // primitive data reads, or throw an OptionalDataException - // with the eof field set to true for object reads." - if (marshalException.minor - == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) { - - IOException result; - - if (!objectRead) - result = new EOFException("No more optional data"); - else - result = bridge.newOptionalDataExceptionForSerialization(true); - - result.initCause(marshalException); - - setState(IN_READ_OBJECT_NO_MORE_OPT_DATA); - - throw result; - } - } - - public final synchronized void registerValidation(ObjectInputValidation obj, - int prio) - throws NotActiveException, InvalidObjectException{ - // XXX I18N, logging needed. - throw new Error("Method registerValidation not supported"); - } - - protected final Class resolveClass(ObjectStreamClass v) - throws IOException, ClassNotFoundException{ - // XXX I18N, logging needed. - throw new IOException("Method resolveClass not supported"); - } - - protected final Object resolveObject(Object obj) throws IOException{ - // XXX I18N, logging needed. - throw new IOException("Method resolveObject not supported"); - } - - public final int skipBytes(int len) throws IOException{ - try{ - readObjectState.readData(this); - - byte buf[] = new byte[len]; - orbStream.read_octet_array(buf, 0, len); - return len; - } catch (MARSHAL marshalException) { - handleOptionalDataMarshalException(marshalException, false); - - throw marshalException; - } catch(Error e) { - IOException exc = new IOException(e.getMessage()); - exc.initCause(e) ; - throw exc ; - } - } - - private synchronized Object inputObject(Class clz, - String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender, - int offset) - throws IOException, ClassNotFoundException - { - - /* - * Get the descriptor and then class of the incoming object. - */ - - currentClassDesc = ObjectStreamClass.lookup(clz); - currentClass = currentClassDesc.forClass(); - //currentClassDesc.setClass(currentClass); - if (currentClass == null) - // XXX I18N, logging needed. - throw new ClassNotFoundException(currentClassDesc.getName()); - - try { - /* If Externalizable, - * Create an instance and tell it to read its data. - * else, - * Handle it as a serializable class. - */ - if (Enum.class.isAssignableFrom( clz )) { - int ordinal = orbStream.read_long() ; - String value = (String)orbStream.read_value( String.class ) ; - return Enum.valueOf( clz, value ) ; - } else if (currentClassDesc.isExternalizable()) { - try { - currentObject = (currentClass == null) ? - null : currentClassDesc.newInstance(); - if (currentObject != null) { - - // Store this object and its beginning position - // since there might be indirections to it while - // it's been unmarshalled. - activeRecursionMgr.addObject(offset, currentObject); - - // Read format version - readFormatVersion(); - - Externalizable ext = (Externalizable)currentObject; - ext.readExternal(this); - } - } catch (InvocationTargetException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InvocationTargetException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } catch (UnsupportedOperationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "UnsupportedOperationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } catch (InstantiationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InstantiationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } - } // end : if (currentClassDesc.isExternalizable()) - else { - /* Count number of classes and descriptors we might have - * to work on. - */ - - ObjectStreamClass currdesc = currentClassDesc; - Class currclass = currentClass; - - int spBase = spClass; // current top of stack - - if (currentClass.getName().equals("java.lang.String")) { - return this.readUTF(); - } - /* The object's classes should be processed from supertype to subtype - * Push all the clases of the current object onto a stack. - * Note that only the serializable classes are represented - * in the descriptor list. - * - * Handle versioning where one or more supertypes of - * have been inserted or removed. The stack will - * contain pairs of descriptors and the corresponding - * class. If the object has a class that did not occur in - * the original the descriptor will be null. If the - * original object had a descriptor for a class not - * present in the local hierarchy of the object the class will be - * null. - * - */ - - /* - * This is your basic diff pattern, made simpler - * because reordering is not allowed. - */ - // sun.4296963 ibm.11861 - // d11861 we should stop when we find the highest serializable class - // We need this so that when we allocate the new object below, we - // can call the constructor of the non-serializable superclass. - // Note that in the JRMP variant of this code the - // ObjectStreamClass.lookup() method handles this, but we've put - // this fix here rather than change lookup because the new behaviour - // is needed in other cases. - - for (currdesc = currentClassDesc, currclass = currentClass; - currdesc != null && currdesc.isSerializable(); /*sun.4296963 ibm.11861*/ - currdesc = currdesc.getSuperclass()) { - - /* - * Search the classes to see if the class of this - * descriptor appears further up the hierarchy. Until - * it's found assume its an inserted class. If it's - * not found, its the descriptor's class that has been - * removed. - */ - Class cc = currdesc.forClass(); - Class cl; - for (cl = currclass; cl != null; cl = cl.getSuperclass()) { - if (cc == cl) { - // found a superclass that matches this descriptor - break; - } else { - /* Ignore a class that doesn't match. No - * action is needed since it is already - * initialized. - */ - } - } // end : for (cl = currclass; cl != null; cl = cl.getSuperclass()) - /* Test if there is room for this new entry. - * If not, double the size of the arrays and copy the contents. - */ - spClass++; - if (spClass >= classes.length) { - int newlen = classes.length * 2; - Class[] newclasses = new Class[newlen]; - ObjectStreamClass[] newclassdesc = new ObjectStreamClass[newlen]; - - System.arraycopy(classes, 0, - newclasses, 0, - classes.length); - System.arraycopy(classdesc, 0, - newclassdesc, 0, - classes.length); - - classes = newclasses; - classdesc = newclassdesc; - } - - if (cl == null) { - /* Class not found corresponding to this descriptor. - * Pop off all the extra classes pushed. - * Push the descriptor and a null class. - */ - classdesc[spClass] = currdesc; - classes[spClass] = null; - } else { - /* Current class descriptor matches current class. - * Some classes may have been inserted. - * Record the match and advance the class, continue - * with the next descriptor. - */ - classdesc[spClass] = currdesc; - classes[spClass] = cl; - currclass = cl.getSuperclass(); - } - } // end : for (currdesc = currentClassDesc, currclass = currentClass; - - /* Allocate a new object. The object is only constructed - * above the highest serializable class and is set to - * default values for all more specialized classes. - */ - try { - currentObject = (currentClass == null) ? - null : currentClassDesc.newInstance() ; - - // Store this object and its beginning position - // since there might be indirections to it while - // it's been unmarshalled. - activeRecursionMgr.addObject(offset, currentObject); - } catch (InvocationTargetException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InvocationTargetException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } catch (UnsupportedOperationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "UnsupportedOperationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } catch (InstantiationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InstantiationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } - - /* - * For all the pushed descriptors and classes. - * if the class has its own writeObject and readObject methods - * call the readObject method - * else - * invoke the defaultReadObject method - */ - try { - for (spClass = spClass; spClass > spBase; spClass--) { - /* - * Set current descriptor and corresponding class - */ - currentClassDesc = classdesc[spClass]; - currentClass = classes[spClass]; - if (classes[spClass] != null) { - /* Read the data from the stream described by the - * descriptor and store into the matching class. - */ - - ReadObjectState oldState = readObjectState; - setState(DEFAULT_STATE); - - try { - - // Changed since invokeObjectReader no longer does this. - if (currentClassDesc.hasWriteObject()) { - - // Read format version - readFormatVersion(); - - // Read defaultWriteObject indicator - boolean calledDefaultWriteObject = readBoolean(); - - readObjectState.beginUnmarshalCustomValue(this, - calledDefaultWriteObject, - currentClassDesc.hasReadObject()); - } else { - if (currentClassDesc.hasReadObject()) - setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED); - } - - if (!invokeObjectReader(currentClassDesc, currentObject, currentClass) || - readObjectState == IN_READ_OBJECT_DEFAULTS_SENT) { - - // Error case of no readObject and didn't call - // defaultWriteObject handled in default state - - ObjectStreamField[] fields = - currentClassDesc.getFieldsNoCopy(); - if (fields.length > 0) { - inputClassFields(currentObject, currentClass, fields, sender); - } - } - - if (currentClassDesc.hasWriteObject()) - readObjectState.endUnmarshalCustomValue(this); - - } finally { - setState(oldState); - } - - } else { - - // _REVISIT_ : Can we ever get here? - /* No local class for this descriptor, - * Skip over the data for this class. - * like defaultReadObject with a null currentObject. - * The code will read the values but discard them. - */ - ObjectStreamField[] fields = - currentClassDesc.getFieldsNoCopy(); - if (fields.length > 0) { - inputClassFields(null, currentClass, fields, sender); - } - - } - - } - } finally { - // Make sure we exit at the same stack level as when we started. - spClass = spBase; - } - } - } finally { - // We've completed deserializing this object. Any - // future indirections will be handled correctly at the - // CDR level. The ActiveRecursionManager only deals with - // objects currently being deserialized. - activeRecursionMgr.removeObject(offset); - } - - return currentObject; - } - - // This retrieves a vector of FVD's for the hierarchy of serializable classes stemming from - // repositoryID. It is assumed that the sender will not provide base_value id's for non-serializable - // classes! - private Vector getOrderedDescriptions(String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender) { - Vector descs = new Vector(); - - if (sender == null) { - return descs; - } - - FullValueDescription aFVD = sender.meta(repositoryID); - while (aFVD != null) { - descs.insertElementAt(aFVD, 0); - if ((aFVD.base_value != null) && !kEmptyStr.equals(aFVD.base_value)) { - aFVD = sender.meta(aFVD.base_value); - } - else return descs; - } - - return descs; - } - - /** - * This input method uses FullValueDescriptions retrieved from the sender's runtime to - * read in the data. This method is capable of throwing out data not applicable to client's fields. - * This method handles instances where the reader has a class not sent by the sender, the sender sent - * a class not present on the reader, and/or the reader's class does not match the sender's class. - * - * NOTE : If the local description indicates custom marshaling and the remote type's FVD also - * indicates custom marsahling than the local type is used to read the data off the wire. However, - * if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is - * a form of custom marshaling. - * - */ - private synchronized Object inputObjectUsingFVD(Class clz, - String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender, - int offset) - throws IOException, ClassNotFoundException - { - int spBase = spClass; // current top of stack - try{ - - /* - * Get the descriptor and then class of the incoming object. - */ - - ObjectStreamClass currdesc = currentClassDesc = ObjectStreamClass.lookup(clz); - Class currclass = currentClass = clz; - - /* If Externalizable, - * Create an instance and tell it to read its data. - * else, - * Handle it as a serializable class. - */ - if (currentClassDesc.isExternalizable()) { - try { - currentObject = (currentClass == null) ? - null : currentClassDesc.newInstance(); - if (currentObject != null) { - // Store this object and its beginning position - // since there might be indirections to it while - // it's been unmarshalled. - activeRecursionMgr.addObject(offset, currentObject); - - // Read format version - readFormatVersion(); - - Externalizable ext = (Externalizable)currentObject; - ext.readExternal(this); - } - } catch (InvocationTargetException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InvocationTargetException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } catch (UnsupportedOperationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "UnsupportedOperationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } catch (InstantiationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InstantiationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } - } else { - /* - * This is your basic diff pattern, made simpler - * because reordering is not allowed. - */ - for (currdesc = currentClassDesc, currclass = currentClass; - currdesc != null && currdesc.isSerializable(); /*sun.4296963 ibm.11861*/ - - currdesc = currdesc.getSuperclass()) { - - /* - * Search the classes to see if the class of this - * descriptor appears further up the hierarchy. Until - * it's found assume its an inserted class. If it's - * not found, its the descriptor's class that has been - * removed. - */ - Class cc = currdesc.forClass(); - Class cl; - for (cl = currclass; cl != null; cl = cl.getSuperclass()) { - if (cc == cl) { - // found a superclass that matches this descriptor - break; - } else { - /* Ignore a class that doesn't match. No - * action is needed since it is already - * initialized. - */ - } - } // end : for (cl = currclass; cl != null; cl = cl.getSuperclass()) - /* Test if there is room for this new entry. - * If not, double the size of the arrays and copy the contents. - */ - spClass++; - if (spClass >= classes.length) { - int newlen = classes.length * 2; - Class[] newclasses = new Class[newlen]; - ObjectStreamClass[] newclassdesc = new ObjectStreamClass[newlen]; - - System.arraycopy(classes, 0, - newclasses, 0, - classes.length); - System.arraycopy(classdesc, 0, - newclassdesc, 0, - classes.length); - - classes = newclasses; - classdesc = newclassdesc; - } - - if (cl == null) { - /* Class not found corresponding to this descriptor. - * Pop off all the extra classes pushed. - * Push the descriptor and a null class. - */ - classdesc[spClass] = currdesc; - classes[spClass] = null; - } else { - /* Current class descriptor matches current class. - * Some classes may have been inserted. - * Record the match and advance the class, continue - * with the next descriptor. - */ - classdesc[spClass] = currdesc; - classes[spClass] = cl; - currclass = cl.getSuperclass(); - } - } // end : for (currdesc = currentClassDesc, currclass = currentClass; - - /* Allocate a new object. - */ - try { - currentObject = (currentClass == null) ? - null : currentClassDesc.newInstance(); - - // Store this object and its beginning position - // since there might be indirections to it while - // it's been unmarshalled. - activeRecursionMgr.addObject(offset, currentObject); - } catch (InvocationTargetException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InvocationTargetException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } catch (UnsupportedOperationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "UnsupportedOperationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } catch (InstantiationException e) { - InvalidClassException exc = new InvalidClassException( - currentClass.getName(), - "InstantiationException accessing no-arg constructor"); - exc.initCause( e ) ; - throw exc ; - } - - Enumeration fvdsList = getOrderedDescriptions(repositoryID, sender).elements(); - - while((fvdsList.hasMoreElements()) && (spClass > spBase)) { - FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement(); - // d4365188: backward compatability - String repIDForFVD = vhandler.getClassName(fvd.id); - String repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass)); - - while ((spClass > spBase) && - (!repIDForFVD.equals(repIDForClass))) { - int pos = findNextClass(repIDForFVD, classes, spClass, spBase); - if (pos != -1) { - spClass = pos; - currclass = currentClass = classes[spClass]; - repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass)); - } - else { // Read and throw away one level of the fvdslist - - // This seems to mean that the sender had a superclass that - // we don't have - - if (fvd.is_custom) { - - readFormatVersion(); - boolean calledDefaultWriteObject = readBoolean(); - - if (calledDefaultWriteObject) - inputClassFields(null, null, null, fvd.members, sender); - - if (getStreamFormatVersion() == 2) { - - ((ValueInputStream)getOrbStream()).start_value(); - ((ValueInputStream)getOrbStream()).end_value(); - } - - // WARNING: If stream format version is 1 and there's - // optional data, we'll get some form of exception down - // the line or data corruption. - - } else { - - inputClassFields(null, currentClass, null, fvd.members, sender); - } - - if (fvdsList.hasMoreElements()){ - fvd = (FullValueDescription)fvdsList.nextElement(); - repIDForFVD = vhandler.getClassName(fvd.id); - } - else return currentObject; - } - } - - currdesc = currentClassDesc = ObjectStreamClass.lookup(currentClass); - - if (!repIDForClass.equals("java.lang.Object")) { - - // If the sender used custom marshaling, then it should have put - // the two bytes on the wire indicating stream format version - // and whether or not the writeObject method called - // defaultWriteObject/writeFields. - - ReadObjectState oldState = readObjectState; - setState(DEFAULT_STATE); - - try { - - if (fvd.is_custom) { - - // Read format version - readFormatVersion(); - - // Read defaultWriteObject indicator - boolean calledDefaultWriteObject = readBoolean(); - - readObjectState.beginUnmarshalCustomValue(this, - calledDefaultWriteObject, - currentClassDesc.hasReadObject()); - } - - boolean usedReadObject = false; - - // Always use readObject if it exists, and fall back to default - // unmarshaling if it doesn't. - try { - - if (!fvd.is_custom && currentClassDesc.hasReadObject()) - setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED); - - // See the definition of defaultReadObjectFVDMembers - // for more information. This concerns making sure - // we use the remote FVD's members in defaultReadObject. - defaultReadObjectFVDMembers = fvd.members; - usedReadObject = invokeObjectReader(currentClassDesc, - currentObject, - currentClass); - - } finally { - defaultReadObjectFVDMembers = null; - } - - // Note that the !usedReadObject !calledDefaultWriteObject - // case is handled by the beginUnmarshalCustomValue method - // of the default state - if (!usedReadObject || readObjectState == IN_READ_OBJECT_DEFAULTS_SENT) - inputClassFields(currentObject, currentClass, currdesc, fvd.members, sender); - - if (fvd.is_custom) - readObjectState.endUnmarshalCustomValue(this); - - } finally { - setState(oldState); - } - - currclass = currentClass = classes[--spClass]; - - } else { - - // The remaining hierarchy of the local class does not match the sender's FVD. - // So, use remaining FVDs to read data off wire. If any remaining FVDs indicate - // custom marshaling, throw MARSHAL error. - inputClassFields(null, currentClass, null, fvd.members, sender); - - while (fvdsList.hasMoreElements()){ - fvd = (FullValueDescription)fvdsList.nextElement(); - - if (fvd.is_custom) - skipCustomUsingFVD(fvd.members, sender); - else - inputClassFields(null, currentClass, null, fvd.members, sender); - } - - } - - } // end : while(fvdsList.hasMoreElements()) - while (fvdsList.hasMoreElements()){ - - FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement(); - if (fvd.is_custom) - skipCustomUsingFVD(fvd.members, sender); - else - throwAwayData(fvd.members, sender); - } - } - - return currentObject; - } - finally { - // Make sure we exit at the same stack level as when we started. - spClass = spBase; - - // We've completed deserializing this object. Any - // future indirections will be handled correctly at the - // CDR level. The ActiveRecursionManager only deals with - // objects currently being deserialized. - activeRecursionMgr.removeObject(offset); - } - - } - - /** - * This input method uses FullValueDescriptions retrieved from the sender's runtime to - * read in the data. This method is capable of throwing out data not applicable to client's fields. - * - * NOTE : If the local description indicates custom marshaling and the remote type's FVD also - * indicates custom marsahling than the local type is used to read the data off the wire. However, - * if either says custom while the other does not, a MARSHAL error is thrown. Externalizable is - * a form of custom marshaling. - * - */ - private Object skipObjectUsingFVD(String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender) - throws IOException, ClassNotFoundException - { - - Enumeration fvdsList = getOrderedDescriptions(repositoryID, sender).elements(); - - while(fvdsList.hasMoreElements()) { - FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement(); - String repIDForFVD = vhandler.getClassName(fvd.id); - - if (!repIDForFVD.equals("java.lang.Object")) { - if (fvd.is_custom) { - - readFormatVersion(); - - boolean calledDefaultWriteObject = readBoolean(); - - if (calledDefaultWriteObject) - inputClassFields(null, null, null, fvd.members, sender); - - if (getStreamFormatVersion() == 2) { - - ((ValueInputStream)getOrbStream()).start_value(); - ((ValueInputStream)getOrbStream()).end_value(); - } - - // WARNING: If stream format version is 1 and there's - // optional data, we'll get some form of exception down - // the line. - - } else { - // Use default marshaling - inputClassFields(null, null, null, fvd.members, sender); - } - } - - } // end : while(fvdsList.hasMoreElements()) - return null; - - } - - /////////////////// - - private int findNextClass(String classname, Class classes[], int _spClass, int _spBase){ - - for (int i = _spClass; i > _spBase; i--){ - if (classname.equals(classes[i].getName())) { - return i; - } - } - - return -1; - } - - /* - * Invoke the readObject method if present. Assumes that in the case of custom - * marshaling, the format version and defaultWriteObject indicator were already - * removed. - */ - private boolean invokeObjectReader(ObjectStreamClass osc, Object obj, Class aclass) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException - { - try { - return osc.invokeReadObject( obj, this ) ; - } catch (InvocationTargetException e) { - Throwable t = e.getTargetException(); - if (t instanceof ClassNotFoundException) - throw (ClassNotFoundException)t; - else if (t instanceof IOException) - throw (IOException)t; - else if (t instanceof RuntimeException) - throw (RuntimeException) t; - else if (t instanceof Error) - throw (Error) t; - else - // XXX I18N, logging needed. - throw new Error("internal error"); - } - } - - /* - * Reset the stream to be just like it was after the constructor. - */ - private void resetStream() throws IOException { - - if (classes == null) - classes = new Class[20]; - else { - for (int i = 0; i < classes.length; i++) - classes[i] = null; - } - if (classdesc == null) - classdesc = new ObjectStreamClass[20]; - else { - for (int i = 0; i < classdesc.length; i++) - classdesc[i] = null; - } - spClass = 0; - - if (callbacks != null) - callbacks.setSize(0); // discard any pending callbacks - } - - /** - * Factored out of inputClassFields This reads a primitive value and sets it - * in the field of o described by the ObjectStreamField field. - * - * Note that reflection cannot be used here, because reflection cannot be used - * to set final fields. - */ - private void inputPrimitiveField(Object o, Class cl, ObjectStreamField field) - throws InvalidClassException, IOException { - - try { - switch (field.getTypeCode()) { - case 'B': - byte byteValue = orbStream.read_octet(); - if (field.getField() != null) { - bridge.putByte( o, field.getFieldID(), byteValue ) ; - //reflective code: field.getField().setByte( o, byteValue ) ; - } - break; - case 'Z': - boolean booleanValue = orbStream.read_boolean(); - if (field.getField() != null) { - bridge.putBoolean( o, field.getFieldID(), booleanValue ) ; - //reflective code: field.getField().setBoolean( o, booleanValue ) ; - } - break; - case 'C': - char charValue = orbStream.read_wchar(); - if (field.getField() != null) { - bridge.putChar( o, field.getFieldID(), charValue ) ; - //reflective code: field.getField().setChar( o, charValue ) ; - } - break; - case 'S': - short shortValue = orbStream.read_short(); - if (field.getField() != null) { - bridge.putShort( o, field.getFieldID(), shortValue ) ; - //reflective code: field.getField().setShort( o, shortValue ) ; - } - break; - case 'I': - int intValue = orbStream.read_long(); - if (field.getField() != null) { - bridge.putInt( o, field.getFieldID(), intValue ) ; - //reflective code: field.getField().setInt( o, intValue ) ; - } - break; - case 'J': - long longValue = orbStream.read_longlong(); - if (field.getField() != null) { - bridge.putLong( o, field.getFieldID(), longValue ) ; - //reflective code: field.getField().setLong( o, longValue ) ; - } - break; - case 'F' : - float floatValue = orbStream.read_float(); - if (field.getField() != null) { - bridge.putFloat( o, field.getFieldID(), floatValue ) ; - //reflective code: field.getField().setFloat( o, floatValue ) ; - } - break; - case 'D' : - double doubleValue = orbStream.read_double(); - if (field.getField() != null) { - bridge.putDouble( o, field.getFieldID(), doubleValue ) ; - //reflective code: field.getField().setDouble( o, doubleValue ) ; - } - break; - default: - // XXX I18N, logging needed. - throw new InvalidClassException(cl.getName()); - } - } catch (IllegalArgumentException e) { - /* This case should never happen. If the field types - are not the same, InvalidClassException is raised when - matching the local class to the serialized ObjectStreamClass. */ - ClassCastException cce = new ClassCastException("Assigning instance of class " + - field.getType().getName() + - " to field " + - currentClassDesc.getName() + '#' + - field.getField().getName()); - cce.initCause( e ) ; - throw cce ; - } - } - - private Object inputObjectField(org.omg.CORBA.ValueMember field, - com.sun.org.omg.SendingContext.CodeBase sender) - throws IndirectionException, ClassNotFoundException, IOException, - StreamCorruptedException { - - Object objectValue = null; - Class type = null; - String id = field.id; - - try { - type = vhandler.getClassFromType(id); - } catch(ClassNotFoundException cnfe) { - // Make sure type = null - type = null; - } - - String signature = null; - if (type != null) - signature = ValueUtility.getSignature(field); - - if (signature != null && (signature.equals("Ljava/lang/Object;") || - signature.equals("Ljava/io/Serializable;") || - signature.equals("Ljava/io/Externalizable;"))) { - objectValue = javax.rmi.CORBA.Util.readAny(orbStream); - } else { - // Decide what method call to make based on the type. If - // it is a type for which we need to load a stub, convert - // the type to the correct stub type. - // - // NOTE : Since FullValueDescription does not allow us - // to ask whether something is an interface we do not - // have the ability to optimize this check. - - int callType = ValueHandlerImpl.kValueType; - - if (!vhandler.isSequence(id)) { - - if (field.type.kind().value() == kRemoteTypeCode.kind().value()) { - - // RMI Object reference... - callType = ValueHandlerImpl.kRemoteType; - - } else { - - // REVISIT. If we don't have the local class, - // we should probably verify that it's an RMI type, - // query the remote FVD, and use is_abstract. - // Our FVD seems to get NullPointerExceptions for any - // non-RMI types. - - // This uses the local class in the same way as - // inputObjectField(ObjectStreamField) does. REVISIT - // inputObjectField(ObjectStreamField)'s loadStubClass - // logic. Assumption is that the given type cannot - // evolve to become a CORBA abstract interface or - // a RMI abstract interface. - - if (type != null && type.isInterface() && - (vhandler.isAbstractBase(type) || - ObjectStreamClassCorbaExt.isAbstractInterface(type))) { - - callType = ValueHandlerImpl.kAbstractType; - } - } - } - - // Now that we have used the FVD of the field to determine the proper course - // of action, it is ok to use the type (Class) from this point forward since - // the rep. id for this read will also follow on the wire. - - switch (callType) { - case ValueHandlerImpl.kRemoteType: - if (type != null) - objectValue = Utility.readObjectAndNarrow(orbStream, type); - else - objectValue = orbStream.read_Object(); - break; - case ValueHandlerImpl.kAbstractType: - if (type != null) - objectValue = Utility.readAbstractAndNarrow(orbStream, type); - else - objectValue = orbStream.read_abstract_interface(); - break; - case ValueHandlerImpl.kValueType: - if (type != null) - objectValue = orbStream.read_value(type); - else - objectValue = orbStream.read_value(); - break; - default: - // XXX I18N, logging needed. - throw new StreamCorruptedException("Unknown callType: " + callType); - } - } - - return objectValue; - } - - /** - * Factored out of inputClassFields and reused in - * inputCurrentClassFieldsForReadFields. - * - * Reads the field (which of an Object type as opposed to a primitive) - * described by ObjectStreamField field and returns it. - */ - private Object inputObjectField(ObjectStreamField field) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IndirectionException, IOException { - - if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) { - return javax.rmi.CORBA.Util.readAny(orbStream); - } - - Object objectValue = null; - - // fields have an API to provide the actual class - // corresponding to the data type - // Class type = osc.forClass(); - Class fieldType = field.getType(); - Class actualType = fieldType; // This may change if stub loaded. - - // Decide what method call to make based on the fieldType. If - // it is a type for which we need to load a stub, convert - // the type to the correct stub type. - - int callType = ValueHandlerImpl.kValueType; - boolean narrow = false; - - if (fieldType.isInterface()) { - boolean loadStubClass = false; - - if (java.rmi.Remote.class.isAssignableFrom(fieldType)) { - - // RMI Object reference... - callType = ValueHandlerImpl.kRemoteType; - - } else if (org.omg.CORBA.Object.class.isAssignableFrom(fieldType)){ - - // IDL Object reference... - callType = ValueHandlerImpl.kRemoteType; - loadStubClass = true; - - } else if (vhandler.isAbstractBase(fieldType)) { - // IDL Abstract Object reference... - - callType = ValueHandlerImpl.kAbstractType; - loadStubClass = true; - } else if (ObjectStreamClassCorbaExt.isAbstractInterface(fieldType)) { - // RMI Abstract Object reference... - - callType = ValueHandlerImpl.kAbstractType; - } - - if (loadStubClass) { - try { - String codebase = Util.getCodebase(fieldType); - String repID = vhandler.createForAnyType(fieldType); - Class stubType = - Utility.loadStubClass(repID, codebase, fieldType); - actualType = stubType; - } catch (ClassNotFoundException e) { - narrow = true; - } - } else { - narrow = true; - } - } - - switch (callType) { - case ValueHandlerImpl.kRemoteType: - if (!narrow) - objectValue = (Object)orbStream.read_Object(actualType); - else - objectValue = Utility.readObjectAndNarrow(orbStream, actualType); - break; - case ValueHandlerImpl.kAbstractType: - if (!narrow) - objectValue = (Object)orbStream.read_abstract_interface(actualType); - else - objectValue = Utility.readAbstractAndNarrow(orbStream, actualType); - break; - case ValueHandlerImpl.kValueType: - objectValue = (Object)orbStream.read_value(actualType); - break; - default: - // XXX I18N, logging needed. - throw new StreamCorruptedException("Unknown callType: " + callType); - } - - return objectValue; - } - - private final boolean mustUseRemoteValueMembers() { - return defaultReadObjectFVDMembers != null; - } - - void readFields(java.util.Map fieldToValueMap) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException { - - if (mustUseRemoteValueMembers()) { - inputRemoteMembersForReadFields(fieldToValueMap); - } else - inputCurrentClassFieldsForReadFields(fieldToValueMap); - } - - private final void inputRemoteMembersForReadFields(java.util.Map fieldToValueMap) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException { - - // Must have this local variable since defaultReadObjectFVDMembers - // may get mangled by recursion. - ValueMember fields[] = defaultReadObjectFVDMembers; - - try { - - for (int i = 0; i < fields.length; i++) { - - switch (fields[i].type.kind().value()) { - - case TCKind._tk_octet: - byte byteValue = orbStream.read_octet(); - fieldToValueMap.put(fields[i].name, new Byte(byteValue)); - break; - case TCKind._tk_boolean: - boolean booleanValue = orbStream.read_boolean(); - fieldToValueMap.put(fields[i].name, new Boolean(booleanValue)); - break; - case TCKind._tk_char: - // Backwards compatibility. Older Sun ORBs sent - // _tk_char even though they read and wrote wchars - // correctly. - // - // Fall through to the _tk_wchar case. - case TCKind._tk_wchar: - char charValue = orbStream.read_wchar(); - fieldToValueMap.put(fields[i].name, new Character(charValue)); - break; - case TCKind._tk_short: - short shortValue = orbStream.read_short(); - fieldToValueMap.put(fields[i].name, new Short(shortValue)); - break; - case TCKind._tk_long: - int intValue = orbStream.read_long(); - fieldToValueMap.put(fields[i].name, new Integer(intValue)); - break; - case TCKind._tk_longlong: - long longValue = orbStream.read_longlong(); - fieldToValueMap.put(fields[i].name, new Long(longValue)); - break; - case TCKind._tk_float: - float floatValue = orbStream.read_float(); - fieldToValueMap.put(fields[i].name, new Float(floatValue)); - break; - case TCKind._tk_double: - double doubleValue = orbStream.read_double(); - fieldToValueMap.put(fields[i].name, new Double(doubleValue)); - break; - case TCKind._tk_value: - case TCKind._tk_objref: - case TCKind._tk_value_box: - Object objectValue = null; - try { - objectValue = inputObjectField(fields[i], - cbSender); - - } catch (IndirectionException cdrie) { - // The CDR stream had never seen the given offset before, - // so check the recursion manager (it will throw an - // IOException if it doesn't have a reference, either). - objectValue = activeRecursionMgr.getObject(cdrie.offset); - } - - fieldToValueMap.put(fields[i].name, objectValue); - break; - default: - // XXX I18N, logging needed. - throw new StreamCorruptedException("Unknown kind: " - + fields[i].type.kind().value()); - } - } - } catch (Throwable t) { - StreamCorruptedException result = new StreamCorruptedException(t.getMessage()); - result.initCause(t); - throw result; - } - } - - /** - * Called from InputStreamHook. - * - * Reads the fields of the current class (could be the ones - * queried from the remote FVD) and puts them in - * the given Map, name to value. Wraps primitives in the - * corresponding java.lang Objects. - */ - private final void inputCurrentClassFieldsForReadFields(java.util.Map fieldToValueMap) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException { - - ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy(); - - int primFields = fields.length - currentClassDesc.objFields; - - // Handle the primitives first - for (int i = 0; i < primFields; ++i) { - - switch (fields[i].getTypeCode()) { - case 'B': - byte byteValue = orbStream.read_octet(); - fieldToValueMap.put(fields[i].getName(), - new Byte(byteValue)); - break; - case 'Z': - boolean booleanValue = orbStream.read_boolean(); - fieldToValueMap.put(fields[i].getName(), - new Boolean(booleanValue)); - break; - case 'C': - char charValue = orbStream.read_wchar(); - fieldToValueMap.put(fields[i].getName(), - new Character(charValue)); - break; - case 'S': - short shortValue = orbStream.read_short(); - fieldToValueMap.put(fields[i].getName(), - new Short(shortValue)); - break; - case 'I': - int intValue = orbStream.read_long(); - fieldToValueMap.put(fields[i].getName(), - new Integer(intValue)); - break; - case 'J': - long longValue = orbStream.read_longlong(); - fieldToValueMap.put(fields[i].getName(), - new Long(longValue)); - break; - case 'F' : - float floatValue = orbStream.read_float(); - fieldToValueMap.put(fields[i].getName(), - new Float(floatValue)); - break; - case 'D' : - double doubleValue = orbStream.read_double(); - fieldToValueMap.put(fields[i].getName(), - new Double(doubleValue)); - break; - default: - // XXX I18N, logging needed. - throw new InvalidClassException(currentClassDesc.getName()); - } - } - - /* Read and set object fields from the input stream. */ - if (currentClassDesc.objFields > 0) { - for (int i = primFields; i < fields.length; i++) { - Object objectValue = null; - try { - objectValue = inputObjectField(fields[i]); - } catch(IndirectionException cdrie) { - // The CDR stream had never seen the given offset before, - // so check the recursion manager (it will throw an - // IOException if it doesn't have a reference, either). - objectValue = activeRecursionMgr.getObject(cdrie.offset); - } - - fieldToValueMap.put(fields[i].getName(), objectValue); - } - } - } - - /* - * Read the fields of the specified class from the input stream and set - * the values of the fields in the specified object. If the specified - * object is null, just consume the fields without setting any values. If - * any ObjectStreamField does not have a reflected Field, don't try to set - * that field in the object. - * - * REVISIT -- This code doesn't do what the comment says to when - * getField() is null! - */ - private void inputClassFields(Object o, Class cl, - ObjectStreamField[] fields, - com.sun.org.omg.SendingContext.CodeBase sender) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException - { - - int primFields = fields.length - currentClassDesc.objFields; - - // this will leave primitives in the inputstream - // should really consume and discard where necessary - if (o != null) { - for (int i = 0; i < primFields; ++i) { - inputPrimitiveField(o, cl, fields[i]); - } - } - - /* Read and set object fields from the input stream. */ - if (currentClassDesc.objFields > 0) { - for (int i = primFields; i < fields.length; i++) { - Object objectValue = null; - - try { - objectValue = inputObjectField(fields[i]); - } catch(IndirectionException cdrie) { - // The CDR stream had never seen the given offset before, - // so check the recursion manager (it will throw an - // IOException if it doesn't have a reference, either). - objectValue = activeRecursionMgr.getObject(cdrie.offset); - } - - if ((o == null) || (fields[i].getField() == null)) { - continue; - } - - try { - Class fieldCl = fields[i].getClazz(); - if ((objectValue != null) - && (!fieldCl.isAssignableFrom( - objectValue.getClass()))) { - throw new IllegalArgumentException("Field mismatch"); - } - Field declaredClassField = null; - final String inputStreamFieldName = fields[i].getName(); - try { - declaredClassField = getDeclaredField( cl, inputStreamFieldName); - } catch (PrivilegedActionException paEx) { - throw new IllegalArgumentException( - (NoSuchFieldException) paEx.getException()); - } catch (SecurityException secEx) { - throw new IllegalArgumentException(secEx); - } catch (NullPointerException npEx) { - continue; - } catch (NoSuchFieldException e) { - continue; - } - - if (declaredClassField == null) { - continue; - } - - Class declaredFieldClass = declaredClassField.getType(); - - // check input field type is a declared field type - // input field is a subclass of the declared field - if (!declaredFieldClass.isAssignableFrom(fieldCl)) { - throw new IllegalArgumentException( - "Field Type mismatch"); - } - if (objectValue != null && !fieldCl.isInstance(objectValue)) { - throw new IllegalArgumentException(); - } - bridge.putObject( o, fields[i].getFieldID(), objectValue ) ; - // reflective code: fields[i].getField().set( o, objectValue ) ; - } catch (IllegalArgumentException iaEx) { - String objectValueClassName = "null"; - String currentClassDescClassName = "null"; - String fieldName = "null"; - if (objectValue != null) { - objectValueClassName = objectValue.getClass().getName(); - } - if (currentClassDesc != null) { - currentClassDescClassName = currentClassDesc.getName(); - } - if (fields[i] != null && fields[i].getField() != null) { - fieldName = fields[i].getField().getName(); - } - ClassCastException ccEx = new ClassCastException( - "Assigning instance of class " + objectValueClassName - + " to field " + currentClassDescClassName + '#' + fieldName); - ccEx.initCause( iaEx ) ; - throw ccEx ; - } - } // end : for loop - } - } - - /* - * Read the fields of the specified class from the input stream and set - * the values of the fields in the specified object. If the specified - * object is null, just consume the fields without setting any values. If - * any ObjectStreamField does not have a reflected Field, don't try to set - * that field in the object. - */ - private void inputClassFields(Object o, Class cl, - ObjectStreamClass osc, - ValueMember[] fields, - com.sun.org.omg.SendingContext.CodeBase sender) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException - { - try{ - for (int i = 0; i < fields.length; ++i) { - try { - switch (fields[i].type.kind().value()) { - case TCKind._tk_octet: - byte byteValue = orbStream.read_octet(); - if ((o != null) && osc.hasField(fields[i])) - setByteField(o, cl, fields[i].name, byteValue); - break; - case TCKind._tk_boolean: - boolean booleanValue = orbStream.read_boolean(); - if ((o != null) && osc.hasField(fields[i])) - setBooleanField(o, cl, fields[i].name, booleanValue); - break; - case TCKind._tk_char: - // Backwards compatibility. Older Sun ORBs sent - // _tk_char even though they read and wrote wchars - // correctly. - // - // Fall through to the _tk_wchar case. - case TCKind._tk_wchar: - char charValue = orbStream.read_wchar(); - if ((o != null) && osc.hasField(fields[i])) - setCharField(o, cl, fields[i].name, charValue); - break; - case TCKind._tk_short: - short shortValue = orbStream.read_short(); - if ((o != null) && osc.hasField(fields[i])) - setShortField(o, cl, fields[i].name, shortValue); - break; - case TCKind._tk_long: - int intValue = orbStream.read_long(); - if ((o != null) && osc.hasField(fields[i])) - setIntField(o, cl, fields[i].name, intValue); - break; - case TCKind._tk_longlong: - long longValue = orbStream.read_longlong(); - if ((o != null) && osc.hasField(fields[i])) - setLongField(o, cl, fields[i].name, longValue); - break; - case TCKind._tk_float: - float floatValue = orbStream.read_float(); - if ((o != null) && osc.hasField(fields[i])) - setFloatField(o, cl, fields[i].name, floatValue); - break; - case TCKind._tk_double: - double doubleValue = orbStream.read_double(); - if ((o != null) && osc.hasField(fields[i])) - setDoubleField(o, cl, fields[i].name, doubleValue); - break; - case TCKind._tk_value: - case TCKind._tk_objref: - case TCKind._tk_value_box: - Object objectValue = null; - try { - objectValue = inputObjectField(fields[i], sender); - } catch (IndirectionException cdrie) { - // The CDR stream had never seen the given offset before, - // so check the recursion manager (it will throw an - // IOException if it doesn't have a reference, either). - objectValue = activeRecursionMgr.getObject(cdrie.offset); - } - - if (o == null) - continue; - try { - if (osc.hasField(fields[i])){ - setObjectField(o, - cl, - fields[i].name, - objectValue); - } else { - // REVISIT. Convert to a log message. - // This is a normal case when fields have - // been added as part of evolution, but - // silently skipping can make it hard to - // debug if there's an error -// System.out.println("**** warning, not setting field: " -// + fields[i].name -// + " since not on class " -// + osc.getName()); - - } - } catch (IllegalArgumentException e) { - // XXX I18N, logging needed. - ClassCastException cce = new ClassCastException("Assigning instance of class " + - objectValue.getClass().getName() + " to field " + fields[i].name); - cce.initCause(e) ; - throw cce ; - } - break; - default: - // XXX I18N, logging needed. - throw new StreamCorruptedException("Unknown kind: " - + fields[i].type.kind().value()); - } - } catch (IllegalArgumentException e) { - /* This case should never happen. If the field types - are not the same, InvalidClassException is raised when - matching the local class to the serialized ObjectStreamClass. */ - // XXX I18N, logging needed. - ClassCastException cce = new ClassCastException("Assigning instance of class " + fields[i].id + - " to field " + currentClassDesc.getName() + '#' + fields[i].name); - cce.initCause( e ) ; - throw cce ; - } - } - } catch(Throwable t){ - // XXX I18N, logging needed. - StreamCorruptedException sce = new StreamCorruptedException(t.getMessage()); - sce.initCause(t) ; - throw sce ; - } - } - - private void skipCustomUsingFVD(ValueMember[] fields, - com.sun.org.omg.SendingContext.CodeBase sender) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException - { - readFormatVersion(); - boolean calledDefaultWriteObject = readBoolean(); - - if (calledDefaultWriteObject) - throwAwayData(fields, sender); - - if (getStreamFormatVersion() == 2) { - - ((ValueInputStream)getOrbStream()).start_value(); - ((ValueInputStream)getOrbStream()).end_value(); - } - } - - /* - * Read the fields of the specified class from the input stream throw data away. - * This must handle same switch logic as above. - */ - private void throwAwayData(ValueMember[] fields, - com.sun.org.omg.SendingContext.CodeBase sender) - throws InvalidClassException, StreamCorruptedException, - ClassNotFoundException, IOException { - - for (int i = 0; i < fields.length; ++i) { - - try { - - switch (fields[i].type.kind().value()) { - case TCKind._tk_octet: - orbStream.read_octet(); - break; - case TCKind._tk_boolean: - orbStream.read_boolean(); - break; - case TCKind._tk_char: - // Backwards compatibility. Older Sun ORBs sent - // _tk_char even though they read and wrote wchars - // correctly. - // - // Fall through to the _tk_wchar case. - case TCKind._tk_wchar: - orbStream.read_wchar(); - break; - case TCKind._tk_short: - orbStream.read_short(); - break; - case TCKind._tk_long: - orbStream.read_long(); - break; - case TCKind._tk_longlong: - orbStream.read_longlong(); - break; - case TCKind._tk_float: - orbStream.read_float(); - break; - case TCKind._tk_double: - orbStream.read_double(); - break; - case TCKind._tk_value: - case TCKind._tk_objref: - case TCKind._tk_value_box: - Class type = null; - String id = fields[i].id; - - try { - type = vhandler.getClassFromType(id); - } - catch(ClassNotFoundException cnfe){ - // Make sure type = null - type = null; - } - String signature = null; - if (type != null) - signature = ValueUtility.getSignature(fields[i]); - - // Read value - try { - if ((signature != null) && ( signature.equals("Ljava/lang/Object;") || - signature.equals("Ljava/io/Serializable;") || - signature.equals("Ljava/io/Externalizable;")) ) { - javax.rmi.CORBA.Util.readAny(orbStream); - } - else { - // Decide what method call to make based on the type. - // - // NOTE : Since FullValueDescription does not allow us - // to ask whether something is an interface we do not - // have the ability to optimize this check. - - int callType = ValueHandlerImpl.kValueType; - - if (!vhandler.isSequence(id)) { - FullValueDescription fieldFVD = sender.meta(fields[i].id); - if (kRemoteTypeCode == fields[i].type) { - - // RMI Object reference... - callType = ValueHandlerImpl.kRemoteType; - } else if (fieldFVD.is_abstract) { - // RMI Abstract Object reference... - - callType = ValueHandlerImpl.kAbstractType; - } - } - - // Now that we have used the FVD of the field to determine the proper course - // of action, it is ok to use the type (Class) from this point forward since - // the rep. id for this read will also follow on the wire. - - switch (callType) { - case ValueHandlerImpl.kRemoteType: - orbStream.read_Object(); - break; - case ValueHandlerImpl.kAbstractType: - orbStream.read_abstract_interface(); - break; - case ValueHandlerImpl.kValueType: - if (type != null) { - orbStream.read_value(type); - } else { - orbStream.read_value(); - } - break; - default: - // XXX I18N, logging needed. - throw new StreamCorruptedException("Unknown callType: " - + callType); - } - } - - } - catch(IndirectionException cdrie) { - // Since we are throwing this away, don't bother handling recursion. - continue; - } - - break; - default: - // XXX I18N, logging needed. - throw new StreamCorruptedException("Unknown kind: " - + fields[i].type.kind().value()); - - } - } catch (IllegalArgumentException e) { - /* This case should never happen. If the field types - are not the same, InvalidClassException is raised when - matching the local class to the serialized ObjectStreamClass. */ - // XXX I18N, logging needed. - ClassCastException cce = new ClassCastException("Assigning instance of class " + - fields[i].id + " to field " + currentClassDesc.getName() + - '#' + fields[i].name); - cce.initCause(e) ; - throw cce ; - } - } - } - - private static void setObjectField(Object o, Class c, String fieldName, Object v) { - try { - Field fld = getDeclaredField( c, fieldName ) ; - Class fieldCl = fld.getType(); - if(v != null && !fieldCl.isInstance(v)) { - throw new Exception(); - } - long key = bridge.objectFieldOffset( fld ) ; - bridge.putObject( o, key, v ) ; - } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetObjectField( e, fieldName, - o.toString(), - v.toString() ) ; - } else { - throw utilWrapper.errorSetObjectField( e, fieldName, - "null " + c.getName() + " object", - v.toString() ) ; - } - } - } - - private static void setBooleanField(Object o, Class c, String fieldName, boolean v) - { - try { - Field fld = getDeclaredField( c, fieldName ) ; - if ((fld != null) && (fld.getType() == Boolean.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putBoolean( o, key, v ) ; - } else { - throw new InvalidObjectException("Field Type mismatch"); - } - } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetBooleanField( e, fieldName, - o.toString(), - new Boolean(v) ) ; - } else { - throw utilWrapper.errorSetBooleanField( e, fieldName, - "null " + c.getName() + " object", - new Boolean(v) ) ; - } - } - } - - private static void setByteField(Object o, Class c, String fieldName, byte v) - { - try { - Field fld = getDeclaredField( c, fieldName ) ; - if ((fld != null) && (fld.getType() == Byte.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putByte( o, key, v ) ; - } else { - throw new InvalidObjectException("Field Type mismatch"); - } - } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetByteField( e, fieldName, - o.toString(), - new Byte(v) ) ; - } else { - throw utilWrapper.errorSetByteField( e, fieldName, - "null " + c.getName() + " object", - new Byte(v) ) ; - } - } - } - - private static void setCharField(Object o, Class c, String fieldName, char v) - { - try { - Field fld = getDeclaredField( c, fieldName ) ; - if ((fld != null) && (fld.getType() == Character.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putChar( o, key, v ) ; - } else { - throw new InvalidObjectException("Field Type mismatch"); - } - } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetCharField( e, fieldName, - o.toString(), - new Character(v) ) ; - } else { - throw utilWrapper.errorSetCharField( e, fieldName, - "null " + c.getName() + " object", - new Character(v) ) ; - } - } - } - - private static void setShortField(Object o, Class c, String fieldName, short v) - { - try { - Field fld = getDeclaredField( c, fieldName ) ; - if ((fld != null) && (fld.getType() == Short.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putShort( o, key, v ) ; - } else { - throw new InvalidObjectException("Field Type mismatch"); - } - } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetShortField( e, fieldName, - o.toString(), - new Short(v) ) ; - } else { - throw utilWrapper.errorSetShortField( e, fieldName, - "null " + c.getName() + " object", - new Short(v) ) ; - } - } - } - - private static void setIntField(Object o, Class c, String fieldName, int v) - { - try { - Field fld = getDeclaredField( c, fieldName ) ; - if ((fld != null) && (fld.getType() == Integer.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putInt( o, key, v ) ; - } else { - throw new InvalidObjectException("Field Type mismatch"); - } - } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetIntField( e, fieldName, - o.toString(), - new Integer(v) ) ; - } else { - throw utilWrapper.errorSetIntField( e, fieldName, - "null " + c.getName() + " object", - new Integer(v) ) ; - } - } - } - - private static void setLongField(Object o, Class c, String fieldName, long v) - { - try { - Field fld = getDeclaredField( c, fieldName ) ; - if ((fld != null) && (fld.getType() == Long.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putLong( o, key, v ) ; - } else { - throw new InvalidObjectException("Field Type mismatch"); - } - } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetLongField( e, fieldName, - o.toString(), - new Long(v) ) ; - } else { - throw utilWrapper.errorSetLongField( e, fieldName, - "null " + c.getName() + " object", - new Long(v) ) ; - } - } - } - - private static void setFloatField(Object o, Class c, String fieldName, float v) - { - try { - Field fld = getDeclaredField( c, fieldName ) ; - if ((fld != null) && (fld.getType() == Float.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putFloat( o, key, v ) ; - } else { - throw new InvalidObjectException("Field Type mismatch"); - } - } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetFloatField( e, fieldName, - o.toString(), - new Float(v) ) ; - } else { - throw utilWrapper.errorSetFloatField( e, fieldName, - "null " + c.getName() + " object", - new Float(v) ) ; - } - } - } - - private static void setDoubleField(Object o, Class c, String fieldName, double v) - { - try { - Field fld = getDeclaredField( c, fieldName ) ; - if ((fld != null) && (fld.getType() == Double.TYPE)) { - long key = bridge.objectFieldOffset( fld ) ; - bridge.putDouble( o, key, v ) ; - } else { - throw new InvalidObjectException("Field Type mismatch"); - } - } catch (Exception e) { - if (o != null) { - throw utilWrapper.errorSetDoubleField( e, fieldName, - o.toString(), - new Double(v) ) ; - } else { - throw utilWrapper.errorSetDoubleField( e, fieldName, - "null " + c.getName() + " object", - new Double(v) ) ; - } - } - } - - - private static Field getDeclaredField(final Class c, - final String fieldName) - throws PrivilegedActionException, NoSuchFieldException, SecurityException { - if (System.getSecurityManager() == null) { - return c.getDeclaredField(fieldName); - } else { - return AccessController - .doPrivileged(new PrivilegedExceptionAction() { - public Field run() throws NoSuchFieldException { - return c.getDeclaredField(fieldName); - } - }); - } - } - - /** - * This class maintains a map of stream position to - * an Object currently being deserialized. It is used - * to handle the cases where the are indirections to - * an object on the recursion stack. The CDR level - * handles indirections to objects previously seen - * (and completely deserialized) in the stream. - */ - static class ActiveRecursionManager - { - private Map offsetToObjectMap; - - public ActiveRecursionManager() { - // A hash map is unsynchronized and allows - // null values - offsetToObjectMap = new HashMap<>(); - } - - // Called right after allocating a new object. - // Offset is the starting position in the stream - // of the object. - public void addObject(int offset, Object value) { - offsetToObjectMap.put(new Integer(offset), value); - } - - // If the given starting position doesn't refer - // to the beginning of an object currently being - // deserialized, this throws an IOException. - // Otherwise, it returns a reference to the - // object. - public Object getObject(int offset) throws IOException { - Integer position = new Integer(offset); - - if (!offsetToObjectMap.containsKey(position)) - // XXX I18N, logging needed. - throw new IOException("Invalid indirection to offset " - + offset); - - return offsetToObjectMap.get(position); - } - - // Called when an object has been completely - // deserialized, so it should no longer be in - // this mapping. The CDR level can handle - // further indirections. - public void removeObject(int offset) { - offsetToObjectMap.remove(new Integer(offset)); - } - - // If the given offset doesn't map to an Object, - // then it isn't an indirection to an object - // currently being deserialized. - public boolean containsObject(int offset) { - return offsetToObjectMap.containsKey(new Integer(offset)); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java 2018-01-30 20:17:24.000000000 -0500 +++ /dev/null 2018-01-30 20:17:24.000000000 -0500 @@ -1,801 +0,0 @@ -/* - * Copyright (c) 1998, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -import org.omg.CORBA.portable.OutputStream; - -import java.security.AccessController ; -import java.security.PrivilegedAction ; - -import java.io.IOException; -import java.io.InvalidClassException; -import java.io.Externalizable; -import java.io.NotSerializableException; -import java.io.NotActiveException; - -import java.lang.reflect.InvocationTargetException; - -import javax.rmi.CORBA.Util; - -import sun.corba.Bridge ; - -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.util.RepositoryId; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.UtilSystemException ; - -/** - * IIOPOutputStream is ... - * - * @author Stephen Lewallen - * @since JDK1.1.6 - */ - -public class IIOPOutputStream - extends com.sun.corba.se.impl.io.OutputStreamHook -{ - private UtilSystemException wrapper = UtilSystemException.get( - CORBALogDomains.RPC_ENCODING ) ; - - private static Bridge bridge = - (Bridge)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return Bridge.get() ; - } - } - ) ; - - private org.omg.CORBA_2_3.portable.OutputStream orbStream; - - private Object currentObject = null; - - private ObjectStreamClass currentClassDesc = null; - - private int recursionDepth = 0; - - private int simpleWriteDepth = 0; - - private IOException abortIOException = null; - - private java.util.Stack classDescStack = new java.util.Stack(); - - // Used when calling an object's writeObject method - private Object[] writeObjectArgList = {this}; - - public IIOPOutputStream() - throws java.io.IOException - { - super(); - } - - // If using RMI-IIOP stream format version 2, this tells - // the ORB stream (which must be a ValueOutputStream) to - // begin a new valuetype to contain the optional data - // of the writeObject method. - protected void beginOptionalCustomData() { - - if (streamFormatVersion == 2) { - - org.omg.CORBA.portable.ValueOutputStream vout - = (org.omg.CORBA.portable.ValueOutputStream)orbStream; - - vout.start_value(currentClassDesc.getRMIIIOPOptionalDataRepId()); - } - } - - final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) { - orbStream = os; - } - - final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() { - return orbStream; - } - - final void increaseRecursionDepth(){ - recursionDepth++; - } - - final int decreaseRecursionDepth(){ - return --recursionDepth; - } - - /** - * Override the actions of the final method "writeObject()" - * in ObjectOutputStream. - * @since JDK1.1.6 - */ - public final void writeObjectOverride(Object obj) - throws IOException - { - writeObjectState.writeData(this); - - Util.writeAbstractObject((OutputStream)orbStream, obj); - } - - /** - * Override the actions of the final method "writeObject()" - * in ObjectOutputStream. - * @since JDK1.1.6 - */ - public final void simpleWriteObject(Object obj, byte formatVersion) - /* throws IOException */ - { - byte oldStreamFormatVersion = streamFormatVersion; - - streamFormatVersion = formatVersion; - - Object prevObject = currentObject; - ObjectStreamClass prevClassDesc = currentClassDesc; - simpleWriteDepth++; - - try { - // if (!checkSpecialClasses(obj) && !checkSubstitutableSpecialClasses(obj)) - outputObject(obj); - - } catch (IOException ee) { - if (abortIOException == null) - abortIOException = ee; - } finally { - /* Restore state of previous call incase this is a nested call */ - streamFormatVersion = oldStreamFormatVersion; - simpleWriteDepth--; - currentObject = prevObject; - currentClassDesc = prevClassDesc; - } - - /* If the recursion depth is 0, test for and clear the pending exception. - * If there is a pending exception throw it. - */ - IOException pending = abortIOException; - if (simpleWriteDepth == 0) - abortIOException = null; - if (pending != null) { - bridge.throwException( pending ) ; - } - } - - // Required by the superclass. - ObjectStreamField[] getFieldsNoCopy() { - return currentClassDesc.getFieldsNoCopy(); - } - - /** - * Override the actions of the final method "defaultWriteObject()" - * in ObjectOutputStream. - * @since JDK1.1.6 - */ - public final void defaultWriteObjectDelegate() - /* throws IOException */ - { - try { - if (currentObject == null || currentClassDesc == null) - // XXX I18N, Logging needed. - throw new NotActiveException("defaultWriteObjectDelegate"); - - ObjectStreamField[] fields = - currentClassDesc.getFieldsNoCopy(); - if (fields.length > 0) { - outputClassFields(currentObject, currentClassDesc.forClass(), - fields); - } - } catch(IOException ioe) { - bridge.throwException(ioe); - } - } - - /** - * Override the actions of the final method "enableReplaceObject()" - * in ObjectOutputStream. - * @since JDK1.1.6 - */ - public final boolean enableReplaceObjectDelegate(boolean enable) - /* throws SecurityException */ - { - return false; - - } - - - protected final void annotateClass(Class cl) throws IOException{ - // XXX I18N, Logging needed. - throw new IOException("Method annotateClass not supported"); - } - - public final void close() throws IOException{ - // no op - } - - protected final void drain() throws IOException{ - // no op - } - - public final void flush() throws IOException{ - try{ - orbStream.flush(); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - protected final Object replaceObject(Object obj) throws IOException{ - // XXX I18N, Logging needed. - throw new IOException("Method replaceObject not supported"); - } - - /** - * Reset will disregard the state of any objects already written - * to the stream. The state is reset to be the same as a new - * ObjectOutputStream. The current point in the stream is marked - * as reset so the corresponding ObjectInputStream will be reset - * at the same point. Objects previously written to the stream - * will not be refered to as already being in the stream. They - * will be written to the stream again. - * @since JDK1.1 - */ - public final void reset() throws IOException{ - try{ - //orbStream.reset(); - - if (currentObject != null || currentClassDesc != null) - // XXX I18N, Logging needed. - throw new IOException("Illegal call to reset"); - - abortIOException = null; - - if (classDescStack == null) - classDescStack = new java.util.Stack(); - else - classDescStack.setSize(0); - - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void write(byte b[]) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_octet_array(b, 0, b.length); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void write(byte b[], int off, int len) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_octet_array(b, off, len); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void write(int data) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_octet((byte)(data & 0xFF)); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeBoolean(boolean data) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_boolean(data); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeByte(int data) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_octet((byte)data); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeBytes(String data) throws IOException{ - try{ - writeObjectState.writeData(this); - - byte buf[] = data.getBytes(); - orbStream.write_octet_array(buf, 0, buf.length); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeChar(int data) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_wchar((char)data); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeChars(String data) throws IOException{ - try{ - writeObjectState.writeData(this); - - char buf[] = data.toCharArray(); - orbStream.write_wchar_array(buf, 0, buf.length); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeDouble(double data) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_double(data); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeFloat(float data) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_float(data); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeInt(int data) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_long(data); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeLong(long data) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_longlong(data); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - public final void writeShort(int data) throws IOException{ - try{ - writeObjectState.writeData(this); - - orbStream.write_short((short)data); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - protected final void writeStreamHeader() throws IOException{ - // no op - } - - /** - * Helper method for correcting the Kestrel bug 4367783 (dealing - * with larger than 8-bit chars). The old behavior is preserved - * in orbutil.IIOPInputStream_1_3 in order to interoperate with - * our legacy ORBs. - */ - protected void internalWriteUTF(org.omg.CORBA.portable.OutputStream stream, - String data) - { - stream.write_wstring(data); - } - - public final void writeUTF(String data) throws IOException{ - try{ - writeObjectState.writeData(this); - - internalWriteUTF(orbStream, data); - } catch(Error e) { - IOException ioexc = new IOException(e.getMessage()); - ioexc.initCause(e) ; - throw ioexc ; - } - } - - // INTERNAL UTILITY METHODS - /* - * Check for special cases of serializing objects. - * These objects are not subject to replacement. - */ - private boolean checkSpecialClasses(Object obj) throws IOException { - - /* - * If this is a class, don't allow substitution - */ - //if (obj instanceof Class) { - // throw new IOException("Serialization of Class not supported"); - //} - - if (obj instanceof ObjectStreamClass) { - // XXX I18N, Logging needed. - throw new IOException("Serialization of ObjectStreamClass not supported"); - } - - return false; - } - - /* - * Check for special cases of substitutable serializing objects. - * These classes are replaceable. - */ - private boolean checkSubstitutableSpecialClasses(Object obj) - throws IOException - { - if (obj instanceof String) { - orbStream.write_value((java.io.Serializable)obj); - return true; - } - - //if (obj.getClass().isArray()) { - // outputArray(obj); - // return true; - //} - - return false; - } - - /* - * Write out the object - */ - private void outputObject(final Object obj) throws IOException{ - - currentObject = obj; - Class currclass = obj.getClass(); - - /* Get the Class descriptor for this class, - * Throw a NotSerializableException if there is none. - */ - currentClassDesc = ObjectStreamClass.lookup(currclass); - if (currentClassDesc == null) { - // XXX I18N, Logging needed. - throw new NotSerializableException(currclass.getName()); - } - - /* If the object is externalizable, - * call writeExternal. - * else do Serializable processing. - */ - if (currentClassDesc.isExternalizable()) { - // Write format version - orbStream.write_octet(streamFormatVersion); - - Externalizable ext = (Externalizable)obj; - ext.writeExternal(this); - - } else { - - /* The object's classes should be processed from supertype to subtype - * Push all the clases of the current object onto a stack. - * Remember the stack pointer where this set of classes is being pushed. - */ - if (currentClassDesc.forClass().getName().equals("java.lang.String")) { - this.writeUTF((String)obj); - return; - } - int stackMark = classDescStack.size(); - try { - ObjectStreamClass next; - while ((next = currentClassDesc.getSuperclass()) != null) { - classDescStack.push(currentClassDesc); - currentClassDesc = next; - } - - /* - * For currentClassDesc and all the pushed class descriptors - * If the class is writing its own data - * set blockData = true; call the class writeObject method - * If not - * invoke either the defaultWriteObject method. - */ - do { - - WriteObjectState oldState = writeObjectState; - - try { - - setState(NOT_IN_WRITE_OBJECT); - - if (currentClassDesc.hasWriteObject()) { - invokeObjectWriter(currentClassDesc, obj ); - } else { - defaultWriteObjectDelegate(); - } - } finally { - setState(oldState); - } - - } while (classDescStack.size() > stackMark && - (currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null); - } finally { - classDescStack.setSize(stackMark); - } - } - } - - /* - * Invoke writer. - * _REVISIT_ invokeObjectWriter and invokeObjectReader behave inconsistently with each other since - * the reader returns a boolean...fix later - */ - private void invokeObjectWriter(ObjectStreamClass osc, Object obj) - throws IOException - { - Class c = osc.forClass() ; - - try { - - // Write format version - orbStream.write_octet(streamFormatVersion); - - writeObjectState.enterWriteObject(this); - - // writeObject(obj, c, this); - osc.invokeWriteObject( obj, this ) ; - - writeObjectState.exitWriteObject(this); - - } catch (InvocationTargetException e) { - Throwable t = e.getTargetException(); - if (t instanceof IOException) - throw (IOException)t; - else if (t instanceof RuntimeException) - throw (RuntimeException) t; - else if (t instanceof Error) - throw (Error) t; - else - // XXX I18N, Logging needed. - throw new Error("invokeObjectWriter internal error",e); - } - } - - void writeField(ObjectStreamField field, Object value) throws IOException { - switch (field.getTypeCode()) { - case 'B': - if (value == null) - orbStream.write_octet((byte)0); - else - orbStream.write_octet(((Byte)value).byteValue()); - break; - case 'C': - if (value == null) - orbStream.write_wchar((char)0); - else - orbStream.write_wchar(((Character)value).charValue()); - break; - case 'F': - if (value == null) - orbStream.write_float((float)0); - else - orbStream.write_float(((Float)value).floatValue()); - break; - case 'D': - if (value == null) - orbStream.write_double((double)0); - else - orbStream.write_double(((Double)value).doubleValue()); - break; - case 'I': - if (value == null) - orbStream.write_long((int)0); - else - orbStream.write_long(((Integer)value).intValue()); - break; - case 'J': - if (value == null) - orbStream.write_longlong((long)0); - else - orbStream.write_longlong(((Long)value).longValue()); - break; - case 'S': - if (value == null) - orbStream.write_short((short)0); - else - orbStream.write_short(((Short)value).shortValue()); - break; - case 'Z': - if (value == null) - orbStream.write_boolean(false); - else - orbStream.write_boolean(((Boolean)value).booleanValue()); - break; - case '[': - case 'L': - // What to do if it's null? - writeObjectField(field, value); - break; - default: - // XXX I18N, Logging needed. - throw new InvalidClassException(currentClassDesc.getName()); - } - } - - private void writeObjectField(ObjectStreamField field, - Object objectValue) throws IOException { - - if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) { - javax.rmi.CORBA.Util.writeAny(orbStream, objectValue); - } - else { - Class type = field.getType(); - int callType = ValueHandlerImpl.kValueType; - - if (type.isInterface()) { - String className = type.getName(); - - if (java.rmi.Remote.class.isAssignableFrom(type)) { - - // RMI Object reference... - - callType = ValueHandlerImpl.kRemoteType; - - - } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)){ - - // IDL Object reference... - callType = ValueHandlerImpl.kRemoteType; - - } else if (RepositoryId.isAbstractBase(type)) { - // IDL Abstract Object reference... - callType = ValueHandlerImpl.kAbstractType; - } else if (ObjectStreamClassCorbaExt.isAbstractInterface(type)) { - callType = ValueHandlerImpl.kAbstractType; - } - } - - switch (callType) { - case ValueHandlerImpl.kRemoteType: - Util.writeRemoteObject(orbStream, objectValue); - break; - case ValueHandlerImpl.kAbstractType: - Util.writeAbstractObject(orbStream, objectValue); - break; - case ValueHandlerImpl.kValueType: - try{ - orbStream.write_value((java.io.Serializable)objectValue, type); - } - catch(ClassCastException cce){ - if (objectValue instanceof java.io.Serializable) - throw cce; - else - Utility.throwNotSerializableForCorba(objectValue.getClass().getName()); - } - } - } - } - - /* Write the fields of the specified class by invoking the appropriate - * write* method on this class. - */ - private void outputClassFields(Object o, Class cl, - ObjectStreamField[] fields) - throws IOException { - - for (int i = 0; i < fields.length; i++) { - if (fields[i].getField() == null) - throw new InvalidClassException(cl.getName(), - "Nonexistent field " + fields[i].getName()); - switch (fields[i].getTypeCode()) { - case 'B': - byte byteValue = bridge.getByte(o, fields[i].getFieldID()) ; - orbStream.write_octet(byteValue); - break; - case 'C': - char charValue = bridge.getChar(o, fields[i].getFieldID()) ; - orbStream.write_wchar(charValue); - break; - case 'F': - float floatValue = bridge.getFloat(o, fields[i].getFieldID()) ; - orbStream.write_float(floatValue); - break; - case 'D' : - double doubleValue = bridge.getDouble(o, fields[i].getFieldID()) ; - orbStream.write_double(doubleValue); - break; - case 'I': - int intValue = bridge.getInt(o, fields[i].getFieldID()) ; - orbStream.write_long(intValue); - break; - case 'J': - long longValue = bridge.getLong(o, fields[i].getFieldID()) ; - orbStream.write_longlong(longValue); - break; - case 'S': - short shortValue = bridge.getShort(o, fields[i].getFieldID()) ; - orbStream.write_short(shortValue); - break; - case 'Z': - boolean booleanValue = bridge.getBoolean(o, fields[i].getFieldID()) ; - orbStream.write_boolean(booleanValue); - break; - case '[': - case 'L': - Object objectValue = bridge.getObject(o, fields[i].getFieldID()) ; - writeObjectField(fields[i], objectValue); - break; - default: - throw new InvalidClassException(cl.getName()); - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java 2018-01-30 20:17:25.000000000 -0500 +++ /dev/null 2018-01-30 20:17:25.000000000 -0500 @@ -1,469 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -import java.io.IOException; -import java.io.StreamCorruptedException; -import java.io.NotActiveException; -import java.io.InputStream; -import java.io.ObjectInputStream; -import java.util.*; -import java.lang.reflect.Array; -import java.lang.reflect.Constructor; - -import org.omg.CORBA.portable.ValueInputStream; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersion; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.impl.logging.UtilSystemException; -import com.sun.corba.se.impl.logging.OMGSystemException; - -public abstract class InputStreamHook extends ObjectInputStream -{ - // These should be visible in all the nested classes - static final OMGSystemException omgWrapper = - OMGSystemException.get( CORBALogDomains.RPC_ENCODING ) ; - - static final UtilSystemException utilWrapper = - UtilSystemException.get( CORBALogDomains.RPC_ENCODING ) ; - - private class HookGetFields extends ObjectInputStream.GetField { - private Map fields = null; - - HookGetFields(Map fields){ - this.fields = fields; - } - - /** - * Get the ObjectStreamClass that describes the fields in the stream. - * - * REVISIT! This doesn't work since we have our own ObjectStreamClass. - */ - public java.io.ObjectStreamClass getObjectStreamClass() { - return null; - } - - /** - * Return true if the named field is defaulted and has no value - * in this stream. - */ - public boolean defaulted(String name) - throws IOException, IllegalArgumentException { - return (!fields.containsKey(name)); - } - - /** - * Get the value of the named boolean field from the persistent field. - */ - public boolean get(String name, boolean defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Boolean)fields.get(name)).booleanValue(); - } - - /** - * Get the value of the named char field from the persistent fields. - */ - public char get(String name, char defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Character)fields.get(name)).charValue(); - - } - - /** - * Get the value of the named byte field from the persistent fields. - */ - public byte get(String name, byte defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Byte)fields.get(name)).byteValue(); - - } - - /** - * Get the value of the named short field from the persistent fields. - */ - public short get(String name, short defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Short)fields.get(name)).shortValue(); - - } - - /** - * Get the value of the named int field from the persistent fields. - */ - public int get(String name, int defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Integer)fields.get(name)).intValue(); - - } - - /** - * Get the value of the named long field from the persistent fields. - */ - public long get(String name, long defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Long)fields.get(name)).longValue(); - - } - - /** - * Get the value of the named float field from the persistent fields. - */ - public float get(String name, float defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Float)fields.get(name)).floatValue(); - - } - - /** - * Get the value of the named double field from the persistent field. - */ - public double get(String name, double defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Double)fields.get(name)).doubleValue(); - - } - - /** - * Get the value of the named Object field from the persistent field. - */ - public Object get(String name, Object defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return fields.get(name); - - } - - public String toString(){ - return fields.toString(); - } - } - - public InputStreamHook() - throws IOException { - super(); - } - - public void defaultReadObject() - throws IOException, ClassNotFoundException, NotActiveException - { - readObjectState.beginDefaultReadObject(this); - - defaultReadObjectDelegate(); - - readObjectState.endDefaultReadObject(this); - } - - abstract void defaultReadObjectDelegate(); - - abstract void readFields(java.util.Map fieldToValueMap) - throws java.io.InvalidClassException, java.io.StreamCorruptedException, - ClassNotFoundException, java.io.IOException; - - - // See java.io.ObjectInputStream.GetField - // Remember that this is equivalent to defaultReadObject - // in RMI-IIOP - public ObjectInputStream.GetField readFields() - throws IOException, ClassNotFoundException, NotActiveException { - - HashMap fieldValueMap = new HashMap(); - - // We were treating readFields same as defaultReadObject. It is - // incorrect if the state is readOptionalData. If this line - // is uncommented, it will throw a stream corrupted exception. - // _REVISIT_: The ideal fix would be to add a new state. In - // writeObject user may do one of the following - // 1. Call defaultWriteObject() - // 2. Put out optional fields - // 3. Call writeFields - // We have the state defined for (1) and (2) but not for (3), so - // we should ideally introduce a new state for 3 and have the - // beginDefaultReadObject do nothing. - //readObjectState.beginDefaultReadObject(this); - - readFields(fieldValueMap); - - readObjectState.endDefaultReadObject(this); - - return new HookGetFields(fieldValueMap); - } - - // The following is a State pattern implementation of what - // should be done when the sender's Serializable has a - // writeObject method. This was especially necessary for - // RMI-IIOP stream format version 2. Please see the - // state diagrams in the docs directory of the workspace. - // - // On the reader's side, the main factors are whether or not - // we have a readObject method and whether or not the - // sender wrote default data - - protected void setState(ReadObjectState newState) { - readObjectState = newState; - } - - protected abstract byte getStreamFormatVersion(); - abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream(); - - // Description of possible actions - protected static class ReadObjectState { - public void beginUnmarshalCustomValue(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) throws IOException {} - - public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException {} - public void beginDefaultReadObject(InputStreamHook stream) throws IOException {} - public void endDefaultReadObject(InputStreamHook stream) throws IOException {} - public void readData(InputStreamHook stream) throws IOException {} - } - - protected ReadObjectState readObjectState = DEFAULT_STATE; - - protected static final ReadObjectState DEFAULT_STATE = new DefaultState(); - protected static final ReadObjectState IN_READ_OBJECT_OPT_DATA - = new InReadObjectOptionalDataState(); - protected static final ReadObjectState IN_READ_OBJECT_NO_MORE_OPT_DATA - = new InReadObjectNoMoreOptionalDataState(); - protected static final ReadObjectState IN_READ_OBJECT_DEFAULTS_SENT - = new InReadObjectDefaultsSentState(); - protected static final ReadObjectState NO_READ_OBJECT_DEFAULTS_SENT - = new NoReadObjectDefaultsSentState(); - - protected static final ReadObjectState IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED - = new InReadObjectRemoteDidNotUseWriteObjectState(); - protected static final ReadObjectState IN_READ_OBJECT_PAST_DEFAULTS_REMOTE_NOT_CUSTOM - = new InReadObjectPastDefaultsRemoteDidNotUseWOState(); - - protected static class DefaultState extends ReadObjectState { - - public void beginUnmarshalCustomValue(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) - throws IOException { - - if (hasReadObject) { - if (calledDefaultWriteObject) - stream.setState(IN_READ_OBJECT_DEFAULTS_SENT); - else { - try { - if (stream.getStreamFormatVersion() == 2) - ((ValueInputStream)stream.getOrbStream()).start_value(); - } catch( Exception e ) { - // This will happen for Big Integer which uses - // writeFields in it's writeObject. We should be past - // start_value by now. - // NOTE: If we don't log any exception here we should - // be fine. If there is an error, it will be caught - // while reading the optional data. - - } - stream.setState(IN_READ_OBJECT_OPT_DATA); - } - } else { - if (calledDefaultWriteObject) - stream.setState(NO_READ_OBJECT_DEFAULTS_SENT); - else - // XXX I18N and logging needed. - throw new StreamCorruptedException("No default data sent"); - } - } - } - - // REVISIT. If a readObject exits here without reading - // default data, we won't skip it. This could be done automatically - // as in line 1492 in IIOPInputStream. - protected static class InReadObjectRemoteDidNotUseWriteObjectState extends ReadObjectState { - - public void beginUnmarshalCustomValue(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) - { - throw utilWrapper.badBeginUnmarshalCustomValue() ; - } - - public void endDefaultReadObject(InputStreamHook stream) { - stream.setState(IN_READ_OBJECT_PAST_DEFAULTS_REMOTE_NOT_CUSTOM); - } - - public void readData(InputStreamHook stream) { - stream.throwOptionalDataIncompatibleException(); - } - } - - protected static class InReadObjectPastDefaultsRemoteDidNotUseWOState extends ReadObjectState { - - public void beginUnmarshalCustomValue(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) - { - throw utilWrapper.badBeginUnmarshalCustomValue() ; - } - - public void beginDefaultReadObject(InputStreamHook stream) throws IOException - { - // XXX I18N and logging needed. - throw new StreamCorruptedException("Default data already read"); - } - - - public void readData(InputStreamHook stream) { - stream.throwOptionalDataIncompatibleException(); - } - } - - protected void throwOptionalDataIncompatibleException() - { - throw omgWrapper.rmiiiopOptionalDataIncompatible2() ; - } - - - protected static class InReadObjectDefaultsSentState extends ReadObjectState { - - public void beginUnmarshalCustomValue(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) { - // This should never happen. - throw utilWrapper.badBeginUnmarshalCustomValue() ; - } - - public void endUnmarshalCustomValue(InputStreamHook stream) { - - // In stream format version 2, we can skip over - // the optional data this way. In stream format version 1, - // we will probably wind up with an error if we're - // unmarshaling a superclass. - if (stream.getStreamFormatVersion() == 2) { - ((ValueInputStream)stream.getOrbStream()).start_value(); - ((ValueInputStream)stream.getOrbStream()).end_value(); - } - - stream.setState(DEFAULT_STATE); - } - - public void endDefaultReadObject(InputStreamHook stream) throws IOException { - - // Read the fake valuetype header in stream format version 2 - if (stream.getStreamFormatVersion() == 2) - ((ValueInputStream)stream.getOrbStream()).start_value(); - - stream.setState(IN_READ_OBJECT_OPT_DATA); - } - - public void readData(InputStreamHook stream) throws IOException { - org.omg.CORBA.ORB orb = stream.getOrbStream().orb(); - if ((orb == null) || - !(orb instanceof com.sun.corba.se.spi.orb.ORB)) { - throw new StreamCorruptedException( - "Default data must be read first"); - } - ORBVersion clientOrbVersion = - ((com.sun.corba.se.spi.orb.ORB)orb).getORBVersion(); - - // Fix Date interop bug. For older versions of the ORB don't do - // anything for readData(). Before this used to throw - // StreamCorruptedException for older versions of the ORB where - // calledDefaultWriteObject always returns true. - if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) || - (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) { - // XXX I18N and logging needed. - throw new StreamCorruptedException("Default data must be read first"); - } - } - } - - protected static class InReadObjectOptionalDataState extends ReadObjectState { - - public void beginUnmarshalCustomValue(InputStreamHook stream, - boolean calledDefaultWriteObject, - boolean hasReadObject) - { - // This should never happen. - throw utilWrapper.badBeginUnmarshalCustomValue() ; - } - - public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException - { - if (stream.getStreamFormatVersion() == 2) { - ((ValueInputStream)stream.getOrbStream()).end_value(); - } - stream.setState(DEFAULT_STATE); - } - - public void beginDefaultReadObject(InputStreamHook stream) throws IOException - { - // XXX I18N and logging needed. - throw new StreamCorruptedException("Default data not sent or already read/passed"); - } - - - } - - protected static class InReadObjectNoMoreOptionalDataState - extends InReadObjectOptionalDataState { - - public void readData(InputStreamHook stream) throws IOException { - stream.throwOptionalDataIncompatibleException(); - } - } - - protected static class NoReadObjectDefaultsSentState extends ReadObjectState { - public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException { - // Code should read default fields before calling this - - if (stream.getStreamFormatVersion() == 2) { - ((ValueInputStream)stream.getOrbStream()).start_value(); - ((ValueInputStream)stream.getOrbStream()).end_value(); - } - - stream.setState(DEFAULT_STATE); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java 2018-01-30 20:17:26.000000000 -0500 +++ /dev/null 2018-01-30 20:17:26.000000000 -0500 @@ -1,1795 +0,0 @@ -/* - * Copyright (c) 1998, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 2012 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.lang.invoke.MethodHandle; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.DigestOutputStream; -import java.security.AccessController; -import java.security.PermissionCollection; -import java.security.Permissions; -import java.security.PrivilegedAction; -import java.security.ProtectionDomain; - -import java.lang.reflect.Modifier; -import java.lang.reflect.Field; -import java.lang.reflect.Member; -import java.lang.reflect.Method; -import java.lang.reflect.Constructor; -import java.lang.reflect.Proxy; -import java.lang.reflect.InvocationTargetException; - -import java.io.IOException; -import java.io.DataOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.InvalidClassException; -import java.io.Externalizable; -import java.io.Serializable; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Set; - -import com.sun.corba.se.impl.util.RepositoryId; - -import org.omg.CORBA.ValueMember; - -import sun.corba.Bridge; - -/** - * An ObjectStreamClass describes a class that can be serialized to a stream - * or a class that was serialized to a stream. It contains the name - * and the serialVersionUID of the class. - *
- * The ObjectStreamClass for a specific class loaded in this Java VM can - * be found using the lookup method. - * - * @author Roger Riggs - * @since JDK1.1 - */ -public class ObjectStreamClass implements java.io.Serializable { - private static final boolean DEBUG_SVUID = false ; - - public static final long kDefaultUID = -1; - - /** true if represents enum type */ - private boolean isEnum; - - private static final Bridge bridge = - AccessController.doPrivileged( - new PrivilegedAction() { - public Bridge run() { - return Bridge.get() ; - } - } - ) ; - - /** Find the descriptor for a class that can be serialized. Null - * is returned if the specified class does not implement - * java.io.Serializable or java.io.Externalizable. - */ - static final ObjectStreamClass lookup(Class cl) - { - ObjectStreamClass desc = lookupInternal(cl); - if (desc.isSerializable() || desc.isExternalizable()) - return desc; - return null; - } - - /* - * Find the class descriptor for the specified class. - * Package access only so it can be called from ObjectIn/OutStream. - */ - static ObjectStreamClass lookupInternal(Class cl) - { - /* Synchronize on the hashtable so no two threads will do - * this at the same time. - */ - ObjectStreamClass desc = null; - synchronized (descriptorFor) { - /* Find the matching descriptor if it already known */ - desc = findDescriptorFor(cl); - if (desc == null) { - /* Check if it's serializable */ - boolean serializable = Serializable.class.isAssignableFrom(cl); - - /* If the class is only Serializable, - * lookup the descriptor for the superclass. - */ - ObjectStreamClass superdesc = null; - if (serializable) { - Class superclass = cl.getSuperclass(); - if (superclass != null) - superdesc = lookup(superclass); - } - - /* Check if its' externalizable. - * If it's Externalizable, clear the serializable flag. - * Only one or the other may be set in the protocol. - */ - boolean externalizable = false; - if (serializable) { - externalizable = - ((superdesc != null) && superdesc.isExternalizable()) || - Externalizable.class.isAssignableFrom(cl); - if (externalizable) { - serializable = false; - } - } - - /* Create a new version descriptor, - * it put itself in the known table. - */ - desc = new ObjectStreamClass(cl, superdesc, - serializable, externalizable); - } - // Must always call init. See bug 4488137. This code was - // incorrectly changed to return immediately on a non-null - // cache result. That allowed threads to gain access to - // unintialized instances. - // - // History: Note, the following init() call was originally within - // the synchronization block, as it currently is now. Later, the - // init() call was moved outside the synchronization block, and - // the init() method used a private member variable lock, to - // avoid performance problems. See bug 4165204. But that lead to - // a deadlock situation, see bug 5104239. Hence, the init() method - // has now been moved back into the synchronization block. The - // right approach to solving these problems would be to rewrite - // this class, based on the latest java.io.ObjectStreamClass. - desc.init(); - } - return desc; - } - - /** - * The name of the class described by this descriptor. - */ - public final String getName() { - return name; - } - - /** - * Return the serialVersionUID for this class. - * The serialVersionUID defines a set of classes all with the same name - * that have evolved from a common root class and agree to be serialized - * and deserialized using a common format. - */ - public static final long getSerialVersionUID( java.lang.Class clazz) { - ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz ); - if( theosc != null ) - { - return theosc.getSerialVersionUID( ); - } - return 0; - } - - /** - * Return the serialVersionUID for this class. - * The serialVersionUID defines a set of classes all with the same name - * that have evolved from a common root class and agree to be serialized - * and deserialized using a common format. - */ - public final long getSerialVersionUID() { - return suid; - } - - /** - * Return the serialVersionUID string for this class. - * The serialVersionUID defines a set of classes all with the same name - * that have evolved from a common root class and agree to be serialized - * and deserialized using a common format. - */ - public final String getSerialVersionUIDStr() { - if (suidStr == null) - suidStr = Long.toHexString(suid).toUpperCase(); - return suidStr; - } - - /** - * Return the actual (computed) serialVersionUID for this class. - */ - public static final long getActualSerialVersionUID( java.lang.Class clazz ) - { - ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz ); - if( theosc != null ) - { - return theosc.getActualSerialVersionUID( ); - } - return 0; - } - - /** - * Return the actual (computed) serialVersionUID for this class. - */ - public final long getActualSerialVersionUID() { - return actualSuid; - } - - /** - * Return the actual (computed) serialVersionUID for this class. - */ - public final String getActualSerialVersionUIDStr() { - if (actualSuidStr == null) - actualSuidStr = Long.toHexString(actualSuid).toUpperCase(); - return actualSuidStr; - } - - /** - * Return the class in the local VM that this version is mapped to. - * Null is returned if there is no corresponding local class. - */ - public final Class forClass() { - return ofClass; - } - - /** - * Return an array of the fields of this serializable class. - * @return an array containing an element for each persistent - * field of this class. Returns an array of length zero if - * there are no fields. - * @since JDK1.2 - */ - public ObjectStreamField[] getFields() { - // Return a copy so the caller can't change the fields. - if (fields.length > 0) { - ObjectStreamField[] dup = new ObjectStreamField[fields.length]; - System.arraycopy(fields, 0, dup, 0, fields.length); - return dup; - } else { - return fields; - } - } - - public boolean hasField(ValueMember field) - { - try { - for (int i = 0; i < fields.length; i++) { - if (fields[i].getName().equals(field.name)) { - if (fields[i].getSignature().equals( - ValueUtility.getSignature(field))) - return true; - } - } - } catch (Exception exc) { - // Ignore this; all we want to do is return false - // Note that ValueUtility.getSignature can throw checked exceptions. - } - - return false; - } - - /* Avoid unnecessary allocations. */ - final ObjectStreamField[] getFieldsNoCopy() { - return fields; - } - - /** - * Get the field of this class by name. - * @return The ObjectStreamField object of the named field or null if there - * is no such named field. - */ - public final ObjectStreamField getField(String name) { - /* Binary search of fields by name. - */ - for (int i = fields.length-1; i >= 0; i--) { - if (name.equals(fields[i].getName())) { - return fields[i]; - } - } - return null; - } - - public final boolean invokeWriteObject(Object obj, ObjectOutputStream ois) throws InvocationTargetException { - if (!hasWriteObject()) { - return false; - } - try { - writeObjectMethod.invoke(obj, ois); - } catch (Throwable t) { - throw new InvocationTargetException(t, "writeObject"); - } - return true; - } - - public final boolean invokeReadObject(Object obj, ObjectInputStream ois) throws InvocationTargetException { - if (hasReadObject()) { - try { - readObjectMethod.invoke(obj, ois); - return true; - } catch (Throwable t) { - throw new InvocationTargetException(t, "readObject"); - } - } else { - return false; - } - } - - public Serializable writeReplace(Serializable value) { - if (writeReplaceObjectMethod != null) { - try { - return (Serializable) writeReplaceObjectMethod.invoke(value); - } catch (Throwable t) { - throw new InternalError("unexpected error", t); - } - } - else return value; - } - - public Object readResolve(Object value) { - if (readResolveObjectMethod != null) { - try { - return readResolveObjectMethod.invoke(value); - } catch (Throwable t) { - throw new InternalError("unexpected error", t); - } - } - else return value; - } - - /** - * Return a string describing this ObjectStreamClass. - */ - public final String toString() { - StringBuffer sb = new StringBuffer(); - - sb.append(name); - sb.append(": static final long serialVersionUID = "); - sb.append(Long.toString(suid)); - sb.append("L;"); - return sb.toString(); - } - - /* - * Create a new ObjectStreamClass from a loaded class. - * Don't call this directly, call lookup instead. - */ - private ObjectStreamClass(java.lang.Class cl, ObjectStreamClass superdesc, - boolean serial, boolean extern) - { - ofClass = cl; /* created from this class */ - - if (Proxy.isProxyClass(cl)) { - forProxyClass = true; - } - - name = cl.getName(); - isEnum = Enum.class.isAssignableFrom(cl); - superclass = superdesc; - serializable = serial; - if (!forProxyClass) { - // proxy classes are never externalizable - externalizable = extern; - } - - /* - * Enter this class in the table of known descriptors. - * Otherwise, when the fields are read it may recurse - * trying to find the descriptor for itself. - */ - insertDescriptorFor(this); - - /* - * The remainder of initialization occurs in init(), which is called - * after the lock on the global class descriptor table has been - * released. - */ - } - - static final class PersistentFieldsValue - extends ClassValue { - PersistentFieldsValue() { } - - protected ObjectStreamField[] computeValue(Class type) { - try { - bridge.ensureClassInitialized(type); - Field pf = type.getDeclaredField("serialPersistentFields"); - int mods = pf.getModifiers(); - if (Modifier.isPrivate(mods) && Modifier.isStatic(mods) && - Modifier.isFinal(mods)) { - long offset = bridge.staticFieldOffset(pf); - java.io.ObjectStreamField[] fields = - (java.io.ObjectStreamField[])bridge.getObject(type, offset); - return translateFields(fields); - } - } catch (NoSuchFieldException | - IllegalArgumentException | ClassCastException e) { - } - return null; - } - - private static ObjectStreamField[] translateFields(java.io.ObjectStreamField[] fields) { - if (fields == null) { - return null; - } - ObjectStreamField[] translation = - new ObjectStreamField[fields.length]; - for (int i = 0; i < fields.length; i++) { - translation[i] = new ObjectStreamField(fields[i].getName(), - fields[i].getType()); - } - return translation; - } - } - - private static final PersistentFieldsValue persistentFieldsValue = - new PersistentFieldsValue(); - - /** - * Creates a PermissionDomain that grants no permission. - */ - private ProtectionDomain noPermissionsDomain() { - PermissionCollection perms = new Permissions(); - perms.setReadOnly(); - return new ProtectionDomain(null, perms); - } - - /** - * Aggregate the ProtectionDomains of all the classes that separate - * a concrete class {@code cl} from its ancestor's class declaring - * a constructor {@code cons}. - * - * If {@code cl} is defined by the boot loader, or the constructor - * {@code cons} is declared by {@code cl}, or if there is no security - * manager, then this method does nothing and {@code null} is returned. - * - * @param cons A constructor declared by {@code cl} or one of its - * ancestors. - * @param cl A concrete class, which is either the class declaring - * the constructor {@code cons}, or a serializable subclass - * of that class. - * @return An array of ProtectionDomain representing the set of - * ProtectionDomain that separate the concrete class {@code cl} - * from its ancestor's declaring {@code cons}, or {@code null}. - */ - private ProtectionDomain[] getProtectionDomains(Constructor cons, - Class cl) { - ProtectionDomain[] domains = null; - if (cons != null && cl.getClassLoader() != null - && System.getSecurityManager() != null) { - Class cls = cl; - Class fnscl = cons.getDeclaringClass(); - Set pds = null; - while (cls != fnscl) { - ProtectionDomain pd = cls.getProtectionDomain(); - if (pd != null) { - if (pds == null) pds = new HashSet<>(); - pds.add(pd); - } - cls = cls.getSuperclass(); - if (cls == null) { - // that's not supposed to happen - // make a ProtectionDomain with no permission. - // should we throw instead? - if (pds == null) pds = new HashSet<>(); - else pds.clear(); - pds.add(noPermissionsDomain()); - break; - } - } - if (pds != null) { - domains = pds.toArray(new ProtectionDomain[0]); - } - } - return domains; - } - - /* - * Initialize class descriptor. This method is only invoked on class - * descriptors created via calls to lookupInternal(). This method is kept - * separate from the ObjectStreamClass constructor so that lookupInternal - * does not have to hold onto a global class descriptor table lock while the - * class descriptor is being initialized (see bug 4165204). - */ - - - private void init() { - synchronized (lock) { - - // See description at definition of initialized. - if (initialized) - return; - - final Class cl = ofClass; - - if (!serializable || - externalizable || - forProxyClass || - name.equals("java.lang.String")){ - fields = NO_FIELDS; - } else if (serializable) { - /* Ask for permission to override field access checks. - */ - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - /* Fill in the list of persistent fields. - * If it is declared, use the declared serialPersistentFields. - * Otherwise, extract the fields from the class itself. - */ - fields = persistentFieldsValue.get(cl); - - if (fields == null) { - /* Get all of the declared fields for this Class. - * Create a temporary ObjectStreamField array to hold each - * non-static, non-transient field. Then copy the - * temporary array into an array of the correct - * size once the number of fields is known. - */ - Field[] actualfields = cl.getDeclaredFields(); - - int numFields = 0; - ObjectStreamField[] tempFields = - new ObjectStreamField[actualfields.length]; - for (int i = 0; i < actualfields.length; i++) { - Field fld = actualfields[i] ; - int modifiers = fld.getModifiers(); - if (!Modifier.isStatic(modifiers) && - !Modifier.isTransient(modifiers)) { - tempFields[numFields++] = new ObjectStreamField(fld); - } - } - - fields = new ObjectStreamField[numFields]; - System.arraycopy(tempFields, 0, fields, 0, numFields); - - } else { - // For each declared persistent field, look for an actual - // reflected Field. If there is one, make sure it's the correct - // type and cache it in the ObjectStreamClass for that field. - for (int j = fields.length-1; j >= 0; j--) { - try { - Field reflField = cl.getDeclaredField(fields[j].getName()); - if (fields[j].getType() == reflField.getType()) { - fields[j].setField(reflField); - } - } catch (NoSuchFieldException e) { - // Nothing to do - } - } - } - return null; - } - }); - - if (fields.length > 1) - Arrays.sort(fields); - - /* Set up field data for use while writing using the API api. */ - computeFieldInfo(); - } - - /* Get the serialVersionUID from the class. - * It uses the access override mechanism so make sure - * the field objects is only used here. - * - * NonSerializable classes have a serialVerisonUID of 0L. - */ - if (isNonSerializable() || isEnum) { - suid = 0L; - } else { - // Lookup special Serializable members using reflection. - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - if (forProxyClass) { - // proxy classes always have serialVersionUID of 0L - suid = 0L; - } else { - try { - final Field f = cl.getDeclaredField("serialVersionUID"); - int mods = f.getModifiers(); - // SerialBug 5: static final SUID should be read - if (Modifier.isStatic(mods) && Modifier.isFinal(mods) ) { - long offset = bridge.staticFieldOffset(f); - suid = bridge.getLong(cl, offset); - // SerialBug 2: should be computed after writeObject - // actualSuid = computeStructuralUID(cl); - } else { - suid = _computeSerialVersionUID(cl); - // SerialBug 2: should be computed after writeObject - // actualSuid = computeStructuralUID(cl); - } - } catch (NoSuchFieldException ex) { - suid = _computeSerialVersionUID(cl); - // SerialBug 2: should be computed after writeObject - // actualSuid = computeStructuralUID(cl); - } - } - - writeReplaceObjectMethod = bridge.writeReplaceForSerialization(cl); - - readResolveObjectMethod = bridge.readResolveForSerialization(cl); - - domains = new ProtectionDomain[] {noPermissionsDomain()}; - - if (externalizable) - cons = getExternalizableConstructor(cl) ; - else - cons = getSerializableConstructor(cl) ; - - domains = getProtectionDomains(cons, cl); - - if (serializable && !forProxyClass) { - writeObjectMethod = bridge.writeObjectForSerialization(cl) ; - readObjectMethod = bridge.readObjectForSerialization(cl); - } - return null; - } - }); - } - - // This call depends on a lot of information computed above! - actualSuid = ObjectStreamClass.computeStructuralUID(this, cl); - - // If we have a write object method, precompute the - // RMI-IIOP stream format version 2 optional data - // repository ID. - if (hasWriteObject()) - rmiiiopOptionalDataRepId = computeRMIIIOPOptionalDataRepId(); - - // This must be done last. - initialized = true; - } - } - - // Specific to RMI-IIOP - /** - * Java to IDL ptc-02-01-12 1.5.1 - * - * "The rep_id string passed to the start_value method must be - * 'RMI:org.omg.custom.class:hashcode:suid' where class is the - * fully-qualified name of the class whose writeObject method - * is being invoked and hashcode and suid are the class's hashcode - * and SUID." - */ - private String computeRMIIIOPOptionalDataRepId() { - - StringBuffer sbuf = new StringBuffer("RMI:org.omg.custom."); - sbuf.append(RepositoryId.convertToISOLatin1(this.getName())); - sbuf.append(':'); - sbuf.append(this.getActualSerialVersionUIDStr()); - sbuf.append(':'); - sbuf.append(this.getSerialVersionUIDStr()); - - return sbuf.toString(); - } - - /** - * This will return null if there is no writeObject method. - */ - public final String getRMIIIOPOptionalDataRepId() { - return rmiiiopOptionalDataRepId; - } - - /* - * Create an empty ObjectStreamClass for a class about to be read. - * This is separate from read so ObjectInputStream can assign the - * wire handle early, before any nested ObjectStreamClass might - * be read. - */ - ObjectStreamClass(String n, long s) { - name = n; - suid = s; - superclass = null; - } - - - /* - * Set the class this version descriptor matches. - * The base class name and serializable hash must match. - * Fill in the reflected Fields that will be used - * for reading. - */ - final void setClass(Class cl) throws InvalidClassException { - - if (cl == null) { - localClassDesc = null; - ofClass = null; - computeFieldInfo(); - return; - } - - localClassDesc = lookupInternal(cl); - if (localClassDesc == null) - // XXX I18N, logging needed - throw new InvalidClassException(cl.getName(), - "Local class not compatible"); - if (suid != localClassDesc.suid) { - - /* Check for exceptional cases that allow mismatched suid. */ - - /* Allow adding Serializable or Externalizable - * to a later release of the class. - */ - boolean addedSerialOrExtern = - isNonSerializable() || localClassDesc.isNonSerializable(); - - /* Disregard the serialVersionUID of an array - * when name and cl.Name differ. If resolveClass() returns - * an array with a different package name, - * the serialVersionUIDs will not match since the fully - * qualified array class is used in the - * computation of the array's serialVersionUID. There is - * no way to set a permanent serialVersionUID for an array type. - */ - - boolean arraySUID = (cl.isArray() && ! cl.getName().equals(name)); - - if (! arraySUID && ! addedSerialOrExtern ) { - // XXX I18N, logging needed - throw new InvalidClassException(cl.getName(), - "Local class not compatible:" + - " stream classdesc serialVersionUID=" + suid + - " local class serialVersionUID=" + localClassDesc.suid); - } - } - - /* compare the class names, stripping off package names. */ - if (! compareClassNames(name, cl.getName(), '.')) - // XXX I18N, logging needed - throw new InvalidClassException(cl.getName(), - "Incompatible local class name. " + - "Expected class name compatible with " + - name); - - /* - * Test that both implement either serializable or externalizable. - */ - - // The next check is more generic, since it covers the - // Proxy case, the JDK 1.3 serialization code has - // both checks - //if ((serializable && localClassDesc.externalizable) || - // (externalizable && localClassDesc.serializable)) - // throw new InvalidClassException(localCl.getName(), - // "Serializable is incompatible with Externalizable"); - - if ((serializable != localClassDesc.serializable) || - (externalizable != localClassDesc.externalizable) || - (!serializable && !externalizable)) - - // XXX I18N, logging needed - throw new InvalidClassException(cl.getName(), - "Serialization incompatible with Externalization"); - - /* Set up the reflected Fields in the class where the value of each - * field in this descriptor should be stored. - * Each field in this ObjectStreamClass (the source) is located (by - * name) in the ObjectStreamClass of the class(the destination). - * In the usual (non-versioned case) the field is in both - * descriptors and the types match, so the reflected Field is copied. - * If the type does not match, a InvalidClass exception is thrown. - * If the field is not present in the class, the reflected Field - * remains null so the field will be read but discarded. - * If extra fields are present in the class they are ignored. Their - * values will be set to the default value by the object allocator. - * Both the src and dest field list are sorted by type and name. - */ - - ObjectStreamField[] destfield = - (ObjectStreamField[])localClassDesc.fields; - ObjectStreamField[] srcfield = - (ObjectStreamField[])fields; - - int j = 0; - nextsrc: - for (int i = 0; i < srcfield.length; i++ ) { - /* Find this field in the dest*/ - for (int k = j; k < destfield.length; k++) { - if (srcfield[i].getName().equals(destfield[k].getName())) { - /* found match */ - if (srcfield[i].isPrimitive() && - !srcfield[i].typeEquals(destfield[k])) { - // XXX I18N, logging needed - throw new InvalidClassException(cl.getName(), - "The type of field " + - srcfield[i].getName() + - " of class " + name + - " is incompatible."); - } - - /* Skip over any fields in the dest that are not in the src */ - j = k; - - srcfield[i].setField(destfield[j].getField()); - // go on to the next source field - continue nextsrc; - } - } - } - - /* Set up field data for use while reading from the input stream. */ - computeFieldInfo(); - - /* Remember the class this represents */ - ofClass = cl; - - /* get the cache of these methods from the local class - * implementation. - */ - readObjectMethod = localClassDesc.readObjectMethod; - readResolveObjectMethod = localClassDesc.readResolveObjectMethod; - } - - /* Compare the base class names of streamName and localName. - * - * @return Return true iff the base class name compare. - * @param streamName Fully qualified class name. - * @param localName Fully qualified class name. - * @param pkgSeparator class names use either '.' or '/'. - * - * Only compare base class name to allow package renaming. - */ - static boolean compareClassNames(String streamName, - String localName, - char pkgSeparator) { - /* compare the class names, stripping off package names. */ - int streamNameIndex = streamName.lastIndexOf(pkgSeparator); - if (streamNameIndex < 0) - streamNameIndex = 0; - - int localNameIndex = localName.lastIndexOf(pkgSeparator); - if (localNameIndex < 0) - localNameIndex = 0; - - return streamName.regionMatches(false, streamNameIndex, - localName, localNameIndex, - streamName.length() - streamNameIndex); - } - - /* - * Compare the types of two class descriptors. - * They match if they have the same class name and suid - */ - final boolean typeEquals(ObjectStreamClass other) { - return (suid == other.suid) && - compareClassNames(name, other.name, '.'); - } - - /* - * Return the superclass descriptor of this descriptor. - */ - final void setSuperclass(ObjectStreamClass s) { - superclass = s; - } - - /* - * Return the superclass descriptor of this descriptor. - */ - final ObjectStreamClass getSuperclass() { - return superclass; - } - - /** - * Return whether the class has a readObject method - */ - final boolean hasReadObject() { - return readObjectMethod != null; - } - - /* - * Return whether the class has a writeObject method - */ - final boolean hasWriteObject() { - return writeObjectMethod != null ; - } - - /** - * Returns true if represented class is serializable or externalizable and - * defines a conformant writeReplace method. Otherwise, returns false. - */ - boolean hasWriteReplaceMethod() { - return (writeReplaceObjectMethod != null); - } - - /** - * Returns true if represented class is serializable or externalizable and - * defines a conformant readResolve method. Otherwise, returns false. - */ - boolean hasReadResolveMethod() { - return (readResolveObjectMethod != null); - } - - /** - * Returns when or not this class should be custom - * marshaled (use chunking). This should happen if - * it is Externalizable OR if it or - * any of its superclasses has a writeObject method, - */ - final boolean isCustomMarshaled() { - return (hasWriteObject() || isExternalizable()) - || (superclass != null && superclass.isCustomMarshaled()); - } - - /* - * Return true if all instances of 'this' Externalizable class - * are written in block-data mode from the stream that 'this' was read - * from.

- * - * In JDK 1.1, all Externalizable instances are not written - * in block-data mode. - * In JDK 1.2, all Externalizable instances, by default, are written - * in block-data mode and the Externalizable instance is terminated with - * tag TC_ENDBLOCKDATA. Change enabled the ability to skip Externalizable - * instances. - * - * IMPLEMENTATION NOTE: - * This should have been a mode maintained per stream; however, - * for compatibility reasons, it was only possible to record - * this change per class. All Externalizable classes within - * a given stream should either have this mode enabled or - * disabled. This is enforced by not allowing the PROTOCOL_VERSION - * of a stream to he changed after any objects have been written. - * - * @see ObjectOutputStream#useProtocolVersion - * @see ObjectStreamConstants#PROTOCOL_VERSION_1 - * @see ObjectStreamConstants#PROTOCOL_VERSION_2 - * - * @since JDK 1.2 - */ - boolean hasExternalizableBlockDataMode() { - return hasExternalizableBlockData; - } - - /** - * Creates a new instance of the represented class. If the class is - * externalizable, invokes its public no-arg constructor; otherwise, if the - * class is serializable, invokes the no-arg constructor of the first - * non-serializable superclass. Throws UnsupportedOperationException if - * this class descriptor is not associated with a class, if the associated - * class is non-serializable or if the appropriate no-arg constructor is - * inaccessible/unavailable. - */ - Object newInstance() - throws InstantiationException, InvocationTargetException, - UnsupportedOperationException - { - if (cons != null) { - try { - return bridge.newInstanceForSerialization(cons, domains); - } catch (IllegalAccessException ex) { - // should not occur, as access checks have been suppressed - InternalError ie = new InternalError(); - ie.initCause( ex ) ; - throw ie ; - } - } else { - throw new UnsupportedOperationException("no constructor for " + ofClass); - } - } - - /** - * Returns public no-arg constructor of given class, or null if none found. - * Access checks are disabled on the returned constructor (if any), since - * the defining class may still be non-public. - */ - private static Constructor getExternalizableConstructor(Class cl) { - return bridge.newConstructorForExternalization(cl); - } - - /** - * Returns subclass-accessible no-arg constructor of first non-serializable - * superclass, or null if none found. Access checks are disabled on the - * returned constructor (if any). - */ - private static Constructor getSerializableConstructor(Class cl) { - return bridge.newConstructorForSerialization(cl); - } - - /* - * Return the ObjectStreamClass of the local class this one is based on. - */ - final ObjectStreamClass localClassDescriptor() { - return localClassDesc; - } - - /* - * Get the Serializability of the class. - */ - boolean isSerializable() { - return serializable; - } - - /* - * Get the externalizability of the class. - */ - boolean isExternalizable() { - return externalizable; - } - - boolean isNonSerializable() { - return ! (externalizable || serializable); - } - - /* - * Calculate the size of the array needed to store primitive data and the - * number of object references to read when reading from the input - * stream. - */ - private void computeFieldInfo() { - primBytes = 0; - objFields = 0; - - for (int i = 0; i < fields.length; i++ ) { - switch (fields[i].getTypeCode()) { - case 'B': - case 'Z': - primBytes += 1; - break; - case 'C': - case 'S': - primBytes += 2; - break; - - case 'I': - case 'F': - primBytes += 4; - break; - case 'J': - case 'D' : - primBytes += 8; - break; - - case 'L': - case '[': - objFields += 1; - break; - } - } - } - - private static void msg( String str ) - { - System.out.println( str ) ; - } - - /* JDK 1.5 has introduced some new modifier bits (such as SYNTHETIC) - * that can affect the SVUID computation (see bug 4897937). These bits - * must be ignored, as otherwise interoperability with ORBs in earlier - * JDK versions can be compromised. I am adding these masks for this - * purpose as discussed in the CCC for this bug (see http://ccc.sfbay/4897937). - */ - - public static final int CLASS_MASK = Modifier.PUBLIC | Modifier.FINAL | - Modifier.INTERFACE | Modifier.ABSTRACT ; - public static final int FIELD_MASK = Modifier.PUBLIC | Modifier.PRIVATE | - Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL | - Modifier.TRANSIENT | Modifier.VOLATILE ; - public static final int METHOD_MASK = Modifier.PUBLIC | Modifier.PRIVATE | - Modifier.PROTECTED | Modifier.STATIC | Modifier.FINAL | - Modifier.SYNCHRONIZED | Modifier.NATIVE | Modifier.ABSTRACT | - Modifier.STRICT ; - - /* - * Compute a hash for the specified class. Incrementally add - * items to the hash accumulating in the digest stream. - * Fold the hash into a long. Use the SHA secure hash function. - */ - private static long _computeSerialVersionUID(Class cl) { - if (DEBUG_SVUID) - msg( "Computing SerialVersionUID for " + cl ) ; - ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); - - long h = 0; - try { - MessageDigest md = MessageDigest.getInstance("SHA"); - DigestOutputStream mdo = new DigestOutputStream(devnull, md); - DataOutputStream data = new DataOutputStream(mdo); - - if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + cl.getName() + "\" )" ) ; - data.writeUTF(cl.getName()); - - int classaccess = cl.getModifiers(); - classaccess &= (Modifier.PUBLIC | Modifier.FINAL | - Modifier.INTERFACE | Modifier.ABSTRACT); - - /* Workaround for javac bug that only set ABSTRACT for - * interfaces if the interface had some methods. - * The ABSTRACT bit reflects that the number of methods > 0. - * This is required so correct hashes can be computed - * for existing class files. - * Previously this hack was previously present in the VM. - */ - Method[] method = cl.getDeclaredMethods(); - if ((classaccess & Modifier.INTERFACE) != 0) { - classaccess &= (~Modifier.ABSTRACT); - if (method.length > 0) { - classaccess |= Modifier.ABSTRACT; - } - } - - // Mask out any post-1.4 attributes - classaccess &= CLASS_MASK ; - - if (DEBUG_SVUID) - msg( "\twriteInt( " + classaccess + " ) " ) ; - data.writeInt(classaccess); - - /* - * Get the list of interfaces supported, - * Accumulate their names their names in Lexical order - * and add them to the hash - */ - if (!cl.isArray()) { - /* In 1.2fcs, getInterfaces() was modified to return - * {java.lang.Cloneable, java.io.Serializable} when - * called on array classes. These values would upset - * the computation of the hash, so we explicitly omit - * them from its computation. - */ - - Class interfaces[] = cl.getInterfaces(); - Arrays.sort(interfaces, compareClassByName); - - for (int i = 0; i < interfaces.length; i++) { - if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + interfaces[i].getName() + "\" ) " ) ; - data.writeUTF(interfaces[i].getName()); - } - } - - /* Sort the field names to get a deterministic order */ - Field[] field = cl.getDeclaredFields(); - Arrays.sort(field, compareMemberByName); - - for (int i = 0; i < field.length; i++) { - Field f = field[i]; - - /* Include in the hash all fields except those that are - * private transient and private static. - */ - int m = f.getModifiers(); - if (Modifier.isPrivate(m) && - (Modifier.isTransient(m) || Modifier.isStatic(m))) - continue; - - if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + f.getName() + "\" ) " ) ; - data.writeUTF(f.getName()); - - // Mask out any post-1.4 bits - m &= FIELD_MASK ; - - if (DEBUG_SVUID) - msg( "\twriteInt( " + m + " ) " ) ; - data.writeInt(m); - - if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + getSignature(f.getType()) + "\" ) " ) ; - data.writeUTF(getSignature(f.getType())); - } - - if (hasStaticInitializer(cl)) { - if (DEBUG_SVUID) - msg( "\twriteUTF( \"\" ) " ) ; - data.writeUTF(""); - - if (DEBUG_SVUID) - msg( "\twriteInt( " + Modifier.STATIC + " )" ) ; - data.writeInt(Modifier.STATIC); // TBD: what modifiers does it have - - if (DEBUG_SVUID) - msg( "\twriteUTF( \"()V\" )" ) ; - data.writeUTF("()V"); - } - - /* - * Get the list of constructors including name and signature - * Sort lexically, add all except the private constructors - * to the hash with their access flags - */ - - MethodSignature[] constructors = - MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors()); - for (int i = 0; i < constructors.length; i++) { - MethodSignature c = constructors[i]; - String mname = ""; - String desc = c.signature; - desc = desc.replace('/', '.'); - if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + mname + "\" )" ) ; - data.writeUTF(mname); - - // mask out post-1.4 modifiers - int modifier = c.member.getModifiers() & METHOD_MASK ; - - if (DEBUG_SVUID) - msg( "\twriteInt( " + modifier + " ) " ) ; - data.writeInt( modifier ) ; - - if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + desc+ "\" )" ) ; - data.writeUTF(desc); - } - - /* Include in the hash all methods except those that are - * private transient and private static. - */ - MethodSignature[] methods = - MethodSignature.removePrivateAndSort(method); - for (int i = 0; i < methods.length; i++ ) { - MethodSignature m = methods[i]; - String desc = m.signature; - desc = desc.replace('/', '.'); - - if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + m.member.getName()+ "\" )" ) ; - data.writeUTF(m.member.getName()); - - // mask out post-1.4 modifiers - int modifier = m.member.getModifiers() & METHOD_MASK ; - - if (DEBUG_SVUID) - msg( "\twriteInt( " + modifier + " ) " ) ; - data.writeInt( modifier ) ; - - if (DEBUG_SVUID) - msg( "\twriteUTF( \"" + desc + "\" )" ) ; - data.writeUTF(desc); - } - - /* Compute the hash value for this class. - * Use only the first 64 bits of the hash. - */ - data.flush(); - byte hasharray[] = md.digest(); - for (int i = 0; i < Math.min(8, hasharray.length); i++) { - h += (long)(hasharray[i] & 255) << (i * 8); - } - } catch (IOException ignore) { - /* can't happen, but be deterministic anyway. */ - h = -1; - } catch (NoSuchAlgorithmException complain) { - SecurityException se = new SecurityException() ; - se.initCause( complain ) ; - throw se ; - } - - return h; - } - - private static long computeStructuralUID(com.sun.corba.se.impl.io.ObjectStreamClass osc, Class cl) { - ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); - - long h = 0; - try { - - if ((!java.io.Serializable.class.isAssignableFrom(cl)) || - (cl.isInterface())){ - return 0; - } - - if (java.io.Externalizable.class.isAssignableFrom(cl)) { - return 1; - } - - MessageDigest md = MessageDigest.getInstance("SHA"); - DigestOutputStream mdo = new DigestOutputStream(devnull, md); - DataOutputStream data = new DataOutputStream(mdo); - - // Get SUID of parent - Class parent = cl.getSuperclass(); - if ((parent != null)) - // SerialBug 1; acc. to spec the one for - // java.lang.object - // should be computed and put - // && (parent != java.lang.Object.class)) - { - //data.writeLong(computeSerialVersionUID(null,parent)); - data.writeLong(computeStructuralUID(lookup(parent), parent)); - } - - if (osc.hasWriteObject()) - data.writeInt(2); - else - data.writeInt(1); - - // CORBA formal 00-11-03 10.6.2: For each field of the - // class that is mapped to IDL, sorted lexicographically - // by Java field name, in increasing order... - ObjectStreamField[] field = osc.getFields(); - if (field.length > 1) { - Arrays.sort(field, compareObjStrFieldsByName); - } - - // ...Java field name in UTF encoding, field - // descriptor, as defined by the JVM spec... - for (int i = 0; i < field.length; i++) { - data.writeUTF(field[i].getName()); - data.writeUTF(field[i].getSignature()); - } - - /* Compute the hash value for this class. - * Use only the first 64 bits of the hash. - */ - data.flush(); - byte hasharray[] = md.digest(); - // int minimum = Math.min(8, hasharray.length); - // SerialBug 3: SHA computation is wrong; for loop reversed - //for (int i = minimum; i > 0; i--) - for (int i = 0; i < Math.min(8, hasharray.length); i++) { - h += (long)(hasharray[i] & 255) << (i * 8); - } - } catch (IOException ignore) { - /* can't happen, but be deterministic anyway. */ - h = -1; - } catch (NoSuchAlgorithmException complain) { - SecurityException se = new SecurityException(); - se.initCause( complain ) ; - throw se ; - } - return h; - } - - /** - * Compute the JVM signature for the class. - */ - static String getSignature(Class clazz) { - String type = null; - if (clazz.isArray()) { - Class cl = clazz; - int dimensions = 0; - while (cl.isArray()) { - dimensions++; - cl = cl.getComponentType(); - } - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < dimensions; i++) { - sb.append("["); - } - sb.append(getSignature(cl)); - type = sb.toString(); - } else if (clazz.isPrimitive()) { - if (clazz == Integer.TYPE) { - type = "I"; - } else if (clazz == Byte.TYPE) { - type = "B"; - } else if (clazz == Long.TYPE) { - type = "J"; - } else if (clazz == Float.TYPE) { - type = "F"; - } else if (clazz == Double.TYPE) { - type = "D"; - } else if (clazz == Short.TYPE) { - type = "S"; - } else if (clazz == Character.TYPE) { - type = "C"; - } else if (clazz == Boolean.TYPE) { - type = "Z"; - } else if (clazz == Void.TYPE) { - type = "V"; - } - } else { - type = "L" + clazz.getName().replace('.', '/') + ";"; - } - return type; - } - - /* - * Compute the JVM method descriptor for the method. - */ - static String getSignature(Method meth) { - StringBuffer sb = new StringBuffer(); - - sb.append("("); - - Class[] params = meth.getParameterTypes(); // avoid clone - for (int j = 0; j < params.length; j++) { - sb.append(getSignature(params[j])); - } - sb.append(")"); - sb.append(getSignature(meth.getReturnType())); - return sb.toString(); - } - - /* - * Compute the JVM constructor descriptor for the constructor. - */ - static String getSignature(Constructor cons) { - StringBuffer sb = new StringBuffer(); - - sb.append("("); - - Class[] params = cons.getParameterTypes(); // avoid clone - for (int j = 0; j < params.length; j++) { - sb.append(getSignature(params[j])); - } - sb.append(")V"); - return sb.toString(); - } - - /* - * Cache of Class -> ClassDescriptor Mappings. - */ - static private ObjectStreamClassEntry[] descriptorFor = new ObjectStreamClassEntry[61]; - - /* - * findDescriptorFor a Class. This looks in the cache for a - * mapping from Class -> ObjectStreamClass mappings. The hashCode - * of the Class is used for the lookup since the Class is the key. - * The entries are extended from java.lang.ref.SoftReference so the - * gc will be able to free them if needed. - */ - private static ObjectStreamClass findDescriptorFor(Class cl) { - - int hash = cl.hashCode(); - int index = (hash & 0x7FFFFFFF) % descriptorFor.length; - ObjectStreamClassEntry e; - ObjectStreamClassEntry prev; - - /* Free any initial entries whose refs have been cleared */ - while ((e = descriptorFor[index]) != null && e.get() == null) { - descriptorFor[index] = e.next; - } - - /* Traverse the chain looking for a descriptor with ofClass == cl. - * unlink entries that are unresolved. - */ - prev = e; - while (e != null ) { - ObjectStreamClass desc = (ObjectStreamClass)(e.get()); - if (desc == null) { - // This entry has been cleared, unlink it - prev.next = e.next; - } else { - if (desc.ofClass == cl) - return desc; - prev = e; - } - e = e.next; - } - return null; - } - - /* - * insertDescriptorFor a Class -> ObjectStreamClass mapping. - */ - private static void insertDescriptorFor(ObjectStreamClass desc) { - // Make sure not already present - if (findDescriptorFor(desc.ofClass) != null) { - return; - } - - int hash = desc.ofClass.hashCode(); - int index = (hash & 0x7FFFFFFF) % descriptorFor.length; - ObjectStreamClassEntry e = new ObjectStreamClassEntry(desc); - e.next = descriptorFor[index]; - descriptorFor[index] = e; - } - - private static Field[] getDeclaredFields(final Class clz) { - return (Field[]) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return clz.getDeclaredFields(); - } - }); - } - - - /* - * The name of this descriptor - */ - private String name; - - /* - * The descriptor of the supertype. - */ - private ObjectStreamClass superclass; - - /* - * Flags for Serializable and Externalizable. - */ - private boolean serializable; - private boolean externalizable; - - /* - * Array of persistent fields of this class, sorted by - * type and name. - */ - private ObjectStreamField[] fields; - - /* - * Class that is a descriptor for in this virtual machine. - */ - private Class ofClass; - - /* - * True if descriptor for a proxy class. - */ - boolean forProxyClass; - - - /* - * SerialVersionUID for this class. - */ - private long suid = kDefaultUID; - private String suidStr = null; - - /* - * Actual (computed) SerialVersionUID for this class. - */ - private long actualSuid = kDefaultUID; - private String actualSuidStr = null; - - /* - * The total number of bytes of primitive fields. - * The total number of object fields. - */ - int primBytes; - int objFields; - - /** - * Flag indicating whether or not this instance has - * successfully completed initialization. This is to - * try to fix bug 4373844. Working to move to - * reusing java.io.ObjectStreamClass for JDK 1.5. - */ - private boolean initialized = false; - - /* Internal lock object. */ - private Object lock = new Object(); - - /* In JDK 1.1, external data was not written in block mode. - * As of JDK 1.2, external data is written in block data mode. This - * flag enables JDK 1.2 to be able to read JDK 1.1 written external data. - * - * @since JDK 1.2 - */ - private boolean hasExternalizableBlockData; - private transient MethodHandle writeObjectMethod; - private transient MethodHandle readObjectMethod; - private transient MethodHandle writeReplaceObjectMethod; - private transient MethodHandle readResolveObjectMethod; - private transient Constructor cons; - private transient ProtectionDomain[] domains; - - /** - * Beginning in Java to IDL ptc/02-01-12, RMI-IIOP has a - * stream format version 2 which puts a fake valuetype around - * a Serializable's optional custom data. This valuetype has - * a special repository ID made from the Serializable's - * information which we are pre-computing and - * storing here. - */ - private String rmiiiopOptionalDataRepId = null; - - /* - * ObjectStreamClass that this one was built from. - */ - private ObjectStreamClass localClassDesc; - - /** - * Returns true if the given class defines a static initializer method, - * false otherwise. - */ - private static boolean hasStaticInitializer(Class cl) { - return bridge.hasStaticInitializerForSerialization(cl); - } - - - /** use serialVersionUID from JDK 1.1. for interoperability */ - private static final long serialVersionUID = -6120832682080437368L; - - /** - * Set serialPersistentFields of a Serializable class to this value to - * denote that the class has no Serializable fields. - */ - public static final ObjectStreamField[] NO_FIELDS = - new ObjectStreamField[0]; - - /* - * Entries held in the Cache of known ObjectStreamClass objects. - * Entries are chained together with the same hash value (modulo array size). - */ - private static class ObjectStreamClassEntry // extends java.lang.ref.SoftReference - { - ObjectStreamClassEntry(ObjectStreamClass c) { - //super(c); - this.c = c; - } - ObjectStreamClassEntry next; - - public Object get() - { - return c; - } - private ObjectStreamClass c; - } - - /* - * Comparator object for Classes and Interfaces - */ - private static Comparator compareClassByName = - new CompareClassByName(); - - private static class CompareClassByName implements Comparator { - public int compare(Object o1, Object o2) { - Class c1 = (Class)o1; - Class c2 = (Class)o2; - return (c1.getName()).compareTo(c2.getName()); - } - } - - /** - * Comparator for ObjectStreamFields by name - */ - private final static Comparator compareObjStrFieldsByName - = new CompareObjStrFieldsByName(); - - private static class CompareObjStrFieldsByName implements Comparator { - public int compare(Object o1, Object o2) { - ObjectStreamField osf1 = (ObjectStreamField)o1; - ObjectStreamField osf2 = (ObjectStreamField)o2; - - return osf1.getName().compareTo(osf2.getName()); - } - } - - /* - * Comparator object for Members, Fields, and Methods - */ - private static Comparator compareMemberByName = - new CompareMemberByName(); - - private static class CompareMemberByName implements Comparator { - public int compare(Object o1, Object o2) { - String s1 = ((Member)o1).getName(); - String s2 = ((Member)o2).getName(); - - if (o1 instanceof Method) { - s1 += getSignature((Method)o1); - s2 += getSignature((Method)o2); - } else if (o1 instanceof Constructor) { - s1 += getSignature((Constructor)o1); - s2 += getSignature((Constructor)o2); - } - return s1.compareTo(s2); - } - } - - /* It is expensive to recompute a method or constructor signature - many times, so compute it only once using this data structure. */ - private static class MethodSignature implements Comparator { - Member member; - String signature; // cached parameter signature - - /* Given an array of Method or Constructor members, - return a sorted array of the non-private members.*/ - /* A better implementation would be to implement the returned data - structure as an insertion sorted link list.*/ - static MethodSignature[] removePrivateAndSort(Member[] m) { - int numNonPrivate = 0; - for (int i = 0; i < m.length; i++) { - if (! Modifier.isPrivate(m[i].getModifiers())) { - numNonPrivate++; - } - } - MethodSignature[] cm = new MethodSignature[numNonPrivate]; - int cmi = 0; - for (int i = 0; i < m.length; i++) { - if (! Modifier.isPrivate(m[i].getModifiers())) { - cm[cmi] = new MethodSignature(m[i]); - cmi++; - } - } - if (cmi > 0) - Arrays.sort(cm, cm[0]); - return cm; - } - - /* Assumes that o1 and o2 are either both methods - or both constructors.*/ - public int compare(Object o1, Object o2) { - /* Arrays.sort calls compare when o1 and o2 are equal.*/ - if (o1 == o2) - return 0; - - MethodSignature c1 = (MethodSignature)o1; - MethodSignature c2 = (MethodSignature)o2; - - int result; - if (isConstructor()) { - result = c1.signature.compareTo(c2.signature); - } else { // is a Method. - result = c1.member.getName().compareTo(c2.member.getName()); - if (result == 0) - result = c1.signature.compareTo(c2.signature); - } - return result; - } - - final private boolean isConstructor() { - return member instanceof Constructor; - } - private MethodSignature(Member m) { - member = m; - if (isConstructor()) { - signature = ObjectStreamClass.getSignature((Constructor)m); - } else { - signature = ObjectStreamClass.getSignature((Method)m); - } - } - } - - /** - * Returns non-static, non-abstract method with given signature provided it - * is defined by or accessible (via inheritance) by the given class, or - * null if no match found. Access checks are disabled on the returned - * method (if any). - * - * Copied from the Merlin java.io.ObjectStreamClass. - */ - private static Method getInheritableMethod(Class cl, String name, - Class[] argTypes, - Class returnType) - { - Method meth = null; - Class defCl = cl; - while (defCl != null) { - try { - meth = defCl.getDeclaredMethod(name, argTypes); - break; - } catch (NoSuchMethodException ex) { - defCl = defCl.getSuperclass(); - } - } - - if ((meth == null) || (meth.getReturnType() != returnType)) { - return null; - } - int mods = meth.getModifiers(); - if ((mods & (Modifier.STATIC | Modifier.ABSTRACT)) != 0) { - return null; - } else if ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) { - return meth; - } else if ((mods & Modifier.PRIVATE) != 0) { - return (cl == defCl) ? meth : null; - } else { - return packageEquals(cl, defCl) ? meth : null; - } - } - - /** - * Returns true if classes are defined in the same package, false - * otherwise. - * - * Copied from the Merlin java.io.ObjectStreamClass. - */ - private static boolean packageEquals(Class cl1, Class cl2) { - Package pkg1 = cl1.getPackage(), pkg2 = cl2.getPackage(); - return ((pkg1 == pkg2) || ((pkg1 != null) && (pkg1.equals(pkg2)))); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java 2018-01-30 20:17:27.000000000 -0500 +++ /dev/null 2018-01-30 20:17:27.000000000 -0500 @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.io; - -import java.security.AccessController; -import java.security.PrivilegedExceptionAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedAction; - -import java.lang.reflect.Modifier; -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.lang.reflect.Member; -import java.lang.reflect.Method; - - -// This file contains some utility methods that -// originally were in the OSC in the RMI-IIOP -// code delivered by IBM. They don't make -// sense there, and hence have been put -// here so that they can be factored out in -// an attempt to eliminate redundant code from -// ObjectStreamClass. Eventually the goal is -// to move to java.io.ObjectStreamClass, and -// java.io.ObjectStreamField. - -// class is package private for security reasons - -class ObjectStreamClassCorbaExt { - - /** - * Return true, iff, - * - * 1. 'cl' is an interface, and - * 2. 'cl' and all its ancestors do not implement java.rmi.Remote, and - * 3. if 'cl' has no methods (including those of its ancestors), or, - * if all the methods (including those of its ancestors) throw an - * exception that is atleast java.rmi.RemoteException or one of - * java.rmi.RemoteException's super classes. - */ - static final boolean isAbstractInterface(Class cl) { - if (!cl.isInterface() || // #1 - java.rmi.Remote.class.isAssignableFrom(cl)) { // #2 - return false; - } - Method[] methods = cl.getMethods(); - for (int i = 0; i < methods.length; i++) { - Class exceptions[] = methods[i].getExceptionTypes(); - boolean exceptionMatch = false; - for (int j = 0; (j < exceptions.length) && !exceptionMatch; j++) { - if ((java.rmi.RemoteException.class == exceptions[j]) || - (java.lang.Throwable.class == exceptions[j]) || - (java.lang.Exception.class == exceptions[j]) || - (java.io.IOException.class == exceptions[j])) { - exceptionMatch = true; - } - } - if (!exceptionMatch) { - return false; - } - } - return true; - } - - /* - * Returns TRUE if type is 'any'. - */ - static final boolean isAny(String typeString) { - - int isAny = 0; - - if ( (typeString != null) && - (typeString.equals("Ljava/lang/Object;") || - typeString.equals("Ljava/io/Serializable;") || - typeString.equals("Ljava/io/Externalizable;")) ) - isAny = 1; - - return (isAny==1); - } - - private static final Method[] getDeclaredMethods(final Class clz) { - return (Method[]) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return clz.getDeclaredMethods(); - } - }); - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamField.java 2018-01-30 20:17:27.000000000 -0500 +++ /dev/null 2018-01-30 20:17:27.000000000 -0500 @@ -1,271 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -import java.lang.reflect.Field; -import java.lang.Comparable; -import java.util.Hashtable; - -import sun.corba.Bridge ; -import java.security.AccessController ; -import java.security.PrivilegedAction ; - -/** - * A description of a field in a serializable class. - * A array of these is used to declare the persistent fields of - * a class. - * - */ -public class ObjectStreamField implements Comparable -{ - private static final Bridge bridge = - (Bridge)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return Bridge.get() ; - } - } - ) ; - - /** - * Create a named field with the specified type. - */ - ObjectStreamField(String n, Class clazz) { - name = n; - this.clazz = clazz; - - // Compute the typecode for easy switching - if (clazz.isPrimitive()) { - if (clazz == Integer.TYPE) { - type = 'I'; - } else if (clazz == Byte.TYPE) { - type = 'B'; - } else if (clazz == Long.TYPE) { - type = 'J'; - } else if (clazz == Float.TYPE) { - type = 'F'; - } else if (clazz == Double.TYPE) { - type = 'D'; - } else if (clazz == Short.TYPE) { - type = 'S'; - } else if (clazz == Character.TYPE) { - type = 'C'; - } else if (clazz == Boolean.TYPE) { - type = 'Z'; - } - } else if (clazz.isArray()) { - type = '['; - typeString = ObjectStreamClass.getSignature(clazz); - } else { - type = 'L'; - typeString = ObjectStreamClass.getSignature(clazz); - } - - if (typeString != null) - signature = typeString; - else - signature = String.valueOf(type); - - } - - ObjectStreamField(Field field) { - this(field.getName(), field.getType()); - setField( field ) ; - } - - /** - * Create an ObjectStreamField containing a reflected Field. - */ - ObjectStreamField(String n, char t, Field f, String ts) - { - name = n; - type = t; - setField( f ) ; - typeString = ts; - - if (typeString != null) - signature = typeString; - else - signature = String.valueOf(type); - - } - - /** - * Get the name of this field. - */ - public String getName() { - return name; - } - - /** - * Get the type of the field. - */ - public Class getType() { - if (clazz != null) - return clazz; - switch (type) { - case 'B': clazz = Byte.TYPE; - break; - case 'C': clazz = Character.TYPE; - break; - case 'S': clazz = Short.TYPE; - break; - case 'I': clazz = Integer.TYPE; - break; - case 'J': clazz = Long.TYPE; - break; - case 'F': clazz = Float.TYPE; - break; - case 'D': clazz = Double.TYPE; - break; - case 'Z': clazz = Boolean.TYPE; - break; - case '[': - case 'L': - clazz = Object.class; - break; - } - - return clazz; - } - - public char getTypeCode() { - return type; - } - - public String getTypeString() { - return typeString; - } - - Field getField() { - return field; - } - - void setField(Field field) { - this.field = field; - this.fieldID = bridge.objectFieldOffset( field ) ; - } - - /* - * Default constructor creates an empty field. - * Usually used just to get to the sort functions. - */ - ObjectStreamField() { - } - - /** - * test if this field is a primitive or not. - */ - public boolean isPrimitive() { - return (type != '[' && type != 'L'); - } - - /** - * Compare this with another ObjectStreamField. - * return -1 if this is smaller, 0 if equal, 1 if greater - * types that are primitives are "smaller" than objects. - * if equal, the names are compared. - */ - public int compareTo(Object o) { - ObjectStreamField f2 = (ObjectStreamField)o; - boolean thisprim = (this.typeString == null); - boolean otherprim = (f2.typeString == null); - - if (thisprim != otherprim) { - return (thisprim ? -1 : 1); - } - return this.name.compareTo(f2.name); - } - - /** - * Compare the types of two class descriptors. - * The match if they have the same primitive types. - * or if they are both objects and the object types match. - */ - public boolean typeEquals(ObjectStreamField other) { - if (other == null || type != other.type) - return false; - - /* Return true if the primitive types matched */ - if (typeString == null && other.typeString == null) - return true; - - return ObjectStreamClass.compareClassNames(typeString, - other.typeString, - '/'); - } - - /* Returns the signature of the Field. - * - */ - public String getSignature() { - - return signature; - - } - - /** - * Return a string describing this field. - */ - public String toString() { - if (typeString != null) - return typeString + " " + name; - else - return type + " " + name; - } - - public Class getClazz() { - return clazz; - } - - /* Returns the Field ID - * - */ - public long getFieldID() { - return fieldID ; - } - - private String name; // the name of the field - private char type; // type first byte of the type signature - private Field field; // Reflected field - private String typeString; // iff object, typename - private Class clazz; // the type of this field, if has been resolved - - // the next 2 things are RMI-IIOP specific, it can be easily - // removed, if we can figure out all place where there are dependencies - // to this. Signature is esentially equal to typestring. Then - // essentially we can use the java.io.ObjectStreamField as such. - - private String signature; // the signature of the field - private long fieldID = Bridge.INVALID_FIELD_OFFSET ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/OptionalDataException.java 2018-01-30 20:17:28.000000000 -0500 +++ /dev/null 2018-01-30 20:17:28.000000000 -0500 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1998, 2002, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -/** - * Unexpected data appeared in an ObjectInputStream trying to read - * an Object. - * This exception occurs when the stream contains primitive data - * instead of the object expected by readObject. - * The eof flag in the exception is true to indicate that no more - * primitive data is available. - * The count field contains the number of bytes available to read. - * - * @author unascribed - * @since JDK1.1 - */ -public class OptionalDataException extends java.io.IOException { - /* - * Create an OptionalDataException with a length. - */ - OptionalDataException(int len) { - eof = false; - length = len; - } - - /* - * Create an OptionalDataException signifing no - * more primitive data is available. - */ - OptionalDataException(boolean end) { - length = 0; - eof = end; - } - - /** - * The number of bytes of primitive data available to be read - * in the current buffer. - */ - public int length; - - /** - * True if there is no more data in the buffered part of the stream. - */ - public boolean eof; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java 2018-01-30 20:17:29.000000000 -0500 +++ /dev/null 2018-01-30 20:17:29.000000000 -0500 @@ -1,318 +0,0 @@ -/* - * Copyright (c) 1999, 2015, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -import java.io.IOException; -import java.io.NotActiveException; -import java.io.OutputStream; -import java.io.ObjectOutputStream; -import java.io.ObjectOutput; -import java.util.Map; -import java.util.HashMap; - -import org.omg.CORBA.INTERNAL; - -public abstract class OutputStreamHook extends ObjectOutputStream -{ - private HookPutFields putFields = null; - - /** - * Since ObjectOutputStream.PutField methods specify no exceptions, - * we are not checking for null parameters on put methods. - */ - private class HookPutFields extends ObjectOutputStream.PutField - { - private Map fields = new HashMap<>(); - - /** - * Put the value of the named boolean field into the persistent field. - */ - public void put(String name, boolean value){ - fields.put(name, new Boolean(value)); - } - - /** - * Put the value of the named char field into the persistent fields. - */ - public void put(String name, char value){ - fields.put(name, new Character(value)); - } - - /** - * Put the value of the named byte field into the persistent fields. - */ - public void put(String name, byte value){ - fields.put(name, new Byte(value)); - } - - /** - * Put the value of the named short field into the persistent fields. - */ - public void put(String name, short value){ - fields.put(name, new Short(value)); - } - - /** - * Put the value of the named int field into the persistent fields. - */ - public void put(String name, int value){ - fields.put(name, new Integer(value)); - } - - /** - * Put the value of the named long field into the persistent fields. - */ - public void put(String name, long value){ - fields.put(name, new Long(value)); - } - - /** - * Put the value of the named float field into the persistent fields. - * - */ - public void put(String name, float value){ - fields.put(name, new Float(value)); - } - - /** - * Put the value of the named double field into the persistent field. - */ - public void put(String name, double value){ - fields.put(name, new Double(value)); - } - - /** - * Put the value of the named Object field into the persistent field. - */ - public void put(String name, Object value){ - fields.put(name, value); - } - - /** - * Write the data and fields to the specified ObjectOutput stream. - */ - public void write(ObjectOutput out) throws IOException { - OutputStreamHook hook = (OutputStreamHook)out; - - ObjectStreamField[] osfields = hook.getFieldsNoCopy(); - - // Write the fields to the stream in the order - // provided by the ObjectStreamClass. (They should - // be sorted appropriately already.) - for (int i = 0; i < osfields.length; i++) { - - Object value = fields.get(osfields[i].getName()); - - hook.writeField(osfields[i], value); - } - } - } - - abstract void writeField(ObjectStreamField field, Object value) throws IOException; - - public OutputStreamHook() - throws java.io.IOException { - super(); - } - - public void defaultWriteObject() throws IOException { - - writeObjectState.defaultWriteObject(this); - - defaultWriteObjectDelegate(); - } - - public abstract void defaultWriteObjectDelegate(); - - public ObjectOutputStream.PutField putFields() - throws IOException { - if (putFields == null) { - putFields = new HookPutFields(); - } - return putFields; - } - - // Stream format version, saved/restored during recursive calls - protected byte streamFormatVersion = 1; - - // Return the stream format version currently being used - // to serialize an object - public byte getStreamFormatVersion() { - return streamFormatVersion; - } - - abstract ObjectStreamField[] getFieldsNoCopy(); - - // User uses PutFields to simulate default data. - // See java.io.ObjectOutputStream.PutFields - public void writeFields() - throws IOException { - - writeObjectState.defaultWriteObject(this); - if (putFields != null) { - putFields.write(this); - } else { - throw new NotActiveException("no current PutField object"); - } - } - - abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream(); - - protected abstract void beginOptionalCustomData(); - - - // The following is a State pattern implementation of what - // should be done when a Serializable has a - // writeObject method. This was especially necessary for - // RMI-IIOP stream format version 2. Please see the - // state diagrams in the docs directory of the workspace. - - protected WriteObjectState writeObjectState = NOT_IN_WRITE_OBJECT; - - protected void setState(WriteObjectState newState) { - writeObjectState = newState; - } - - // Description of possible actions - protected static class WriteObjectState { - public void enterWriteObject(OutputStreamHook stream) throws IOException {} - public void exitWriteObject(OutputStreamHook stream) throws IOException {} - public void defaultWriteObject(OutputStreamHook stream) throws IOException {} - public void writeData(OutputStreamHook stream) throws IOException {} - } - - protected static class DefaultState extends WriteObjectState { - public void enterWriteObject(OutputStreamHook stream) throws IOException { - stream.setState(IN_WRITE_OBJECT); - } - } - - protected static final WriteObjectState NOT_IN_WRITE_OBJECT = new DefaultState(); - protected static final WriteObjectState IN_WRITE_OBJECT = new InWriteObjectState(); - protected static final WriteObjectState WROTE_DEFAULT_DATA = new WroteDefaultDataState(); - protected static final WriteObjectState WROTE_CUSTOM_DATA = new WroteCustomDataState(); - - protected static class InWriteObjectState extends WriteObjectState { - - public void enterWriteObject(OutputStreamHook stream) throws IOException { - // XXX I18N, logging needed. - throw new IOException("Internal state failure: Entered writeObject twice"); - } - - public void exitWriteObject(OutputStreamHook stream) throws IOException { - - // We didn't write any data, so write the - // called defaultWriteObject indicator as false - stream.getOrbStream().write_boolean(false); - - // If we're in stream format verison 2, we must - // put the "null" marker to say that there isn't - // any optional data - if (stream.getStreamFormatVersion() == 2) - stream.getOrbStream().write_long(0); - - stream.setState(NOT_IN_WRITE_OBJECT); - } - - public void defaultWriteObject(OutputStreamHook stream) throws IOException { - - // The writeObject method called defaultWriteObject - // or writeFields, so put the called defaultWriteObject - // indicator as true - stream.getOrbStream().write_boolean(true); - - stream.setState(WROTE_DEFAULT_DATA); - } - - public void writeData(OutputStreamHook stream) throws IOException { - - // The writeObject method first called a direct - // write operation. Write the called defaultWriteObject - // indicator as false, put the special stream format - // version 2 header (if stream format version 2, of course), - // and write the data - stream.getOrbStream().write_boolean(false); - stream.beginOptionalCustomData(); - stream.setState(WROTE_CUSTOM_DATA); - } - } - - protected static class WroteDefaultDataState extends InWriteObjectState { - - public void exitWriteObject(OutputStreamHook stream) throws IOException { - - // We only wrote default data, so if in stream format - // version 2, put the null indicator to say that there - // is no optional data - if (stream.getStreamFormatVersion() == 2) - stream.getOrbStream().write_long(0); - - stream.setState(NOT_IN_WRITE_OBJECT); - } - - public void defaultWriteObject(OutputStreamHook stream) throws IOException { - // XXX I18N, logging needed. - throw new IOException("Called defaultWriteObject/writeFields twice"); - } - - public void writeData(OutputStreamHook stream) throws IOException { - - // The writeObject method called a direct write operation. - // If in stream format version 2, put the fake valuetype - // header. - stream.beginOptionalCustomData(); - - stream.setState(WROTE_CUSTOM_DATA); - } - } - - protected static class WroteCustomDataState extends InWriteObjectState { - - public void exitWriteObject(OutputStreamHook stream) throws IOException { - // In stream format version 2, we must tell the ORB - // stream to close the fake custom valuetype. - if (stream.getStreamFormatVersion() == 2) - ((org.omg.CORBA.portable.ValueOutputStream)stream.getOrbStream()).end_value(); - - stream.setState(NOT_IN_WRITE_OBJECT); - } - - public void defaultWriteObject(OutputStreamHook stream) throws IOException { - // XXX I18N, logging needed. - throw new IOException("Cannot call defaultWriteObject/writeFields after writing custom data in RMI-IIOP"); - } - - // We don't have to do anything special here, just let - // the stream write the data. - public void writeData(OutputStreamHook stream) throws IOException {} - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/TypeMismatchException.java 2018-01-30 20:17:30.000000000 -0500 +++ /dev/null 2018-01-30 20:17:30.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -public class TypeMismatchException extends Error -{ - public TypeMismatchException() - { - super(); - } - - public TypeMismatchException(String mssg) - { - super(mssg); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java 2018-01-30 20:17:30.000000000 -0500 +++ /dev/null 2018-01-30 20:17:30.000000000 -0500 @@ -1,926 +0,0 @@ -/* - * Copyright (c) 1998, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -import javax.rmi.CORBA.Util; - -import java.util.Hashtable; -import java.io.IOException; - -import com.sun.corba.se.impl.util.RepositoryId; -import com.sun.corba.se.impl.util.Utility; - -import org.omg.CORBA.TCKind; - -import org.omg.CORBA.portable.IndirectionException; -import com.sun.org.omg.SendingContext.CodeBase; -import com.sun.org.omg.SendingContext.CodeBaseHelper; - -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.security.PrivilegedExceptionAction; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.impl.logging.OMGSystemException; -import com.sun.corba.se.impl.logging.UtilSystemException; - -public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat { - - // Property to override our maximum stream format version - public static final String FORMAT_VERSION_PROPERTY - = "com.sun.CORBA.MaxStreamFormatVersion"; - - private static final byte MAX_SUPPORTED_FORMAT_VERSION = (byte)2; - private static final byte STREAM_FORMAT_VERSION_1 = (byte)1; - - // The ValueHandler's maximum stream format version to advertise, - // set in a static initializer. - private static final byte MAX_STREAM_FORMAT_VERSION; - - static { - MAX_STREAM_FORMAT_VERSION = getMaxStreamFormatVersion(); - } - - // Looks for the FORMAT_VERSION_PROPERTY system property - // to allow the user to override our default stream format - // version. Note that this still only allows them to pick - // a supported version (1 through MAX_STREAM_FORMAT_VERSION). - private static byte getMaxStreamFormatVersion() { - - try { - - String propValue = (String) AccessController.doPrivileged( - new PrivilegedAction() { - public java.lang.Object run() { - return System.getProperty(ValueHandlerImpl.FORMAT_VERSION_PROPERTY); - } - }); - - // The property wasn't set - if (propValue == null) - return MAX_SUPPORTED_FORMAT_VERSION; - - byte result = Byte.parseByte(propValue); - - // REVISIT. Just set to MAX_SUPPORTED_FORMAT_VERSION - // or really let the system shutdown with this Error? - if (result < 1 || result > MAX_SUPPORTED_FORMAT_VERSION) - // XXX I18N, logging needed. - throw new ExceptionInInitializerError("Invalid stream format version: " - + result - + ". Valid range is 1 through " - + MAX_SUPPORTED_FORMAT_VERSION); - - return result; - - } catch (Exception ex) { - // REVISIT. Swallow this or really let - // the system shutdown with this Error? - - Error err = new ExceptionInInitializerError(ex); - err.initCause( ex ) ; - throw err ; - } - } - - public static final short kRemoteType = 0; - public static final short kAbstractType = 1; - public static final short kValueType = 2; - - private Hashtable inputStreamPairs = null; - private Hashtable outputStreamPairs = null; - private CodeBase codeBase = null; - private boolean useHashtables = true; - private boolean isInputStream = true; - private IIOPOutputStream outputStreamBridge = null; - private IIOPInputStream inputStreamBridge = null; - private OMGSystemException omgWrapper = OMGSystemException.get( - CORBALogDomains.RPC_ENCODING ) ; - private UtilSystemException utilWrapper = UtilSystemException.get( - CORBALogDomains.RPC_ENCODING ) ; - - // See javax.rmi.CORBA.ValueHandlerMultiFormat - public byte getMaximumStreamFormatVersion() { - return MAX_STREAM_FORMAT_VERSION; - } - - // See javax.rmi.CORBA.ValueHandlerMultiFormat - public void writeValue(org.omg.CORBA.portable.OutputStream out, - java.io.Serializable value, - byte streamFormatVersion) { - - if (streamFormatVersion == 2) { - if (!(out instanceof org.omg.CORBA.portable.ValueOutputStream)) { - throw omgWrapper.notAValueoutputstream() ; - } - } else if (streamFormatVersion != 1) { - throw omgWrapper.invalidStreamFormatVersion( - new Integer(streamFormatVersion) ) ; - } - - writeValueWithVersion(out, value, streamFormatVersion); - } - - private ValueHandlerImpl(){} - - private ValueHandlerImpl(boolean isInputStream) { - this(); - useHashtables = false; - this.isInputStream = isInputStream; - } - - static ValueHandlerImpl getInstance() { - return new ValueHandlerImpl(); - } - - static ValueHandlerImpl getInstance(boolean isInputStream) { - return new ValueHandlerImpl(isInputStream); - } - - /** - * Writes the value to the stream using java semantics. - * @param out The stream to write the value to - * @param value The value to be written to the stream - **/ - public void writeValue(org.omg.CORBA.portable.OutputStream out, - java.io.Serializable value) { - writeValueWithVersion(out, value, STREAM_FORMAT_VERSION_1); - } - - private void writeValueWithVersion(org.omg.CORBA.portable.OutputStream _out, - java.io.Serializable value, - byte streamFormatVersion) { - - org.omg.CORBA_2_3.portable.OutputStream out = - (org.omg.CORBA_2_3.portable.OutputStream) _out; - - if (!useHashtables) { - if (outputStreamBridge == null) { - outputStreamBridge = createOutputStream(); - outputStreamBridge.setOrbStream(out); - } - - try { - outputStreamBridge.increaseRecursionDepth(); - writeValueInternal(outputStreamBridge, out, value, streamFormatVersion); - } finally { - outputStreamBridge.decreaseRecursionDepth(); - } - - return; - } - - IIOPOutputStream jdkToOrbOutputStreamBridge = null; - - if (outputStreamPairs == null) - outputStreamPairs = new Hashtable(); - - jdkToOrbOutputStreamBridge = (IIOPOutputStream)outputStreamPairs.get(_out); - - if (jdkToOrbOutputStreamBridge == null) { - jdkToOrbOutputStreamBridge = createOutputStream(); - jdkToOrbOutputStreamBridge.setOrbStream(out); - outputStreamPairs.put(_out, jdkToOrbOutputStreamBridge); - } - - try { - - jdkToOrbOutputStreamBridge.increaseRecursionDepth(); - writeValueInternal(jdkToOrbOutputStreamBridge, out, value, streamFormatVersion); - } finally { - if (jdkToOrbOutputStreamBridge.decreaseRecursionDepth() == 0) { - outputStreamPairs.remove(_out); - } - } - } - - private void writeValueInternal(IIOPOutputStream bridge, - org.omg.CORBA_2_3.portable.OutputStream out, - java.io.Serializable value, - byte streamFormatVersion) - { - Class clazz = value.getClass(); - - if (clazz.isArray()) - write_Array(out, value, clazz.getComponentType()); - else - bridge.simpleWriteObject(value, streamFormatVersion); - } - - /** - * Reads a value from the stream using java semantics. - * @param in The stream to read the value from - * @param clazz The type of the value to be read in - * @param rt The sending context runtime - **/ - public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream in, - int offset, - java.lang.Class clazz, - String repositoryID, - org.omg.SendingContext.RunTime rt) - { - // Must use narrow rather than a direct cast to a com.sun - // class. Fix for bug 4379539. - CodeBase sender = CodeBaseHelper.narrow(rt); - - org.omg.CORBA_2_3.portable.InputStream inStream = - (org.omg.CORBA_2_3.portable.InputStream) in; - - if (!useHashtables) { - if (inputStreamBridge == null) { - inputStreamBridge = createInputStream(); - inputStreamBridge.setOrbStream(inStream); - inputStreamBridge.setSender(sender); //d11638 - // backward compatability 4365188 - inputStreamBridge.setValueHandler(this); - } - - java.io.Serializable result = null; - - try { - - inputStreamBridge.increaseRecursionDepth(); - result = (java.io.Serializable) readValueInternal(inputStreamBridge, inStream, offset, clazz, repositoryID, sender); - - } finally { - - if (inputStreamBridge.decreaseRecursionDepth() == 0) { - // Indirections are resolved immediately since - // the change to the active recursion manager, - // so this will never happen. - } - } - - return result; - } - - IIOPInputStream jdkToOrbInputStreamBridge = null; - if (inputStreamPairs == null) - inputStreamPairs = new Hashtable(); - - jdkToOrbInputStreamBridge = (IIOPInputStream)inputStreamPairs.get(in); - - if (jdkToOrbInputStreamBridge == null) { - - jdkToOrbInputStreamBridge = createInputStream(); - jdkToOrbInputStreamBridge.setOrbStream(inStream); - jdkToOrbInputStreamBridge.setSender(sender); //d11638 - // backward compatability 4365188 - jdkToOrbInputStreamBridge.setValueHandler(this); - inputStreamPairs.put(in, jdkToOrbInputStreamBridge); - } - - java.io.Serializable result = null; - - try { - - jdkToOrbInputStreamBridge.increaseRecursionDepth(); - result = (java.io.Serializable) readValueInternal(jdkToOrbInputStreamBridge, inStream, offset, clazz, repositoryID, sender); - - } finally { - - if (jdkToOrbInputStreamBridge.decreaseRecursionDepth() == 0) { - inputStreamPairs.remove(in); - } - } - - return result; - } - - private java.io.Serializable readValueInternal(IIOPInputStream bridge, - org.omg.CORBA_2_3.portable.InputStream in, - int offset, - java.lang.Class clazz, - String repositoryID, - com.sun.org.omg.SendingContext.CodeBase sender) - { - java.io.Serializable result = null; - - if (clazz == null) { - // clazz == null indicates an FVD situation for a nonexistant class - if (isArray(repositoryID)){ - read_Array(bridge, in, null, sender, offset); - } else { - bridge.simpleSkipObject(repositoryID, sender); - } - return result; - } - - if (clazz.isArray()) { - result = (java.io.Serializable)read_Array(bridge, in, clazz, sender, offset); - } else { - result = (java.io.Serializable)bridge.simpleReadObject(clazz, repositoryID, sender, offset); - } - - return result; - } - - /** - * Returns the repository ID for the given RMI value Class. - * @param clz The class to return a repository ID for. - * @return the repository ID of the Class. - **/ - public java.lang.String getRMIRepositoryID(java.lang.Class clz) { - return RepositoryId.createForJavaType(clz); - } - - /** - * Indicates whether the given Class performs custom or - * default marshaling. - * @param clz The class to test for custom marshaling. - * @return True if the class performs custom marshaling, false - * if it does not. - **/ - public boolean isCustomMarshaled(java.lang.Class clz) { - return ObjectStreamClass.lookup(clz).isCustomMarshaled(); - } - - /** - * Returns the CodeBase for this ValueHandler. This is used by - * the ORB runtime. The server sends the service context containing - * the IOR for this CodeBase on the first GIOP reply. The clients - * do the same on the first GIOP request. - * @return the SendingContext.CodeBase of this ValueHandler. - **/ - public org.omg.SendingContext.RunTime getRunTimeCodeBase() { - if (codeBase != null) - return codeBase; - else { - codeBase = new FVDCodeBaseImpl(); - - // backward compatability 4365188 - // set the valueHandler so that correct/incorrect RepositoryID - // calculations can be done based on the ORB version - FVDCodeBaseImpl fvdImpl = (FVDCodeBaseImpl) codeBase; - fvdImpl.setValueHandler(this); - return codeBase; - } - } - - - // methods supported for backward compatability so that the appropriate - // Rep-id calculations take place based on the ORB version - - /** - * Returns a boolean of whether or not RepositoryId indicates - * FullValueDescriptor. - * used for backward compatability - */ - - public boolean useFullValueDescription(Class clazz, String repositoryID) - throws IOException - { - return RepositoryId.useFullValueDescription(clazz, repositoryID); - } - - public String getClassName(String id) - { - RepositoryId repID = RepositoryId.cache.getId(id); - return repID.getClassName(); - } - - public Class getClassFromType(String id) - throws ClassNotFoundException - { - RepositoryId repId = RepositoryId.cache.getId(id); - return repId.getClassFromType(); - } - - public Class getAnyClassFromType(String id) - throws ClassNotFoundException - { - RepositoryId repId = RepositoryId.cache.getId(id); - return repId.getAnyClassFromType(); - } - - public String createForAnyType(Class cl) - { - return RepositoryId.createForAnyType(cl); - } - - public String getDefinedInId(String id) - { - RepositoryId repId = RepositoryId.cache.getId(id); - return repId.getDefinedInId(); - } - - public String getUnqualifiedName(String id) - { - RepositoryId repId = RepositoryId.cache.getId(id); - return repId.getUnqualifiedName(); - } - - public String getSerialVersionUID(String id) - { - RepositoryId repId = RepositoryId.cache.getId(id); - return repId.getSerialVersionUID(); - } - - - public boolean isAbstractBase(Class clazz) - { - return RepositoryId.isAbstractBase(clazz); - } - - public boolean isSequence(String id) - { - RepositoryId repId = RepositoryId.cache.getId(id); - return repId.isSequence(); - } - - /** - * If the value contains a writeReplace method then the result - * is returned. Otherwise, the value itself is returned. - * @return the true value to marshal on the wire. - **/ - public java.io.Serializable writeReplace(java.io.Serializable value) { - return ObjectStreamClass.lookup(value.getClass()).writeReplace(value); - } - - private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out, - char[] array, - int offset, - int length) - { - out.write_wchar_array(array, offset, length); - } - - private void write_Array(org.omg.CORBA_2_3.portable.OutputStream out, java.io.Serializable obj, Class type) { - - int i, length; - - if (type.isPrimitive()) { - if (type == Integer.TYPE) { - int[] array = (int[])((Object)obj); - length = array.length; - out.write_ulong(length); - out.write_long_array(array, 0, length); - } else if (type == Byte.TYPE) { - byte[] array = (byte[])((Object)obj); - length = array.length; - out.write_ulong(length); - out.write_octet_array(array, 0, length); - } else if (type == Long.TYPE) { - long[] array = (long[])((Object)obj); - length = array.length; - out.write_ulong(length); - out.write_longlong_array(array, 0, length); - } else if (type == Float.TYPE) { - float[] array = (float[])((Object)obj); - length = array.length; - out.write_ulong(length); - out.write_float_array(array, 0, length); - } else if (type == Double.TYPE) { - double[] array = (double[])((Object)obj); - length = array.length; - out.write_ulong(length); - out.write_double_array(array, 0, length); - } else if (type == Short.TYPE) { - short[] array = (short[])((Object)obj); - length = array.length; - out.write_ulong(length); - out.write_short_array(array, 0, length); - } else if (type == Character.TYPE) { - char[] array = (char[])((Object)obj); - length = array.length; - out.write_ulong(length); - writeCharArray(out, array, 0, length); - } else if (type == Boolean.TYPE) { - boolean[] array = (boolean[])((Object)obj); - length = array.length; - out.write_ulong(length); - out.write_boolean_array(array, 0, length); - } else { - // XXX I18N, logging needed. - throw new Error("Invalid primitive type : " + - obj.getClass().getName()); - } - } else if (type == java.lang.Object.class) { - Object[] array = (Object[])((Object)obj); - length = array.length; - out.write_ulong(length); - for (i = 0; i < length; i++) { - Util.writeAny(out, array[i]); - } - } else { - Object[] array = (Object[])((Object)obj); - length = array.length; - out.write_ulong(length); - int callType = kValueType; - - if (type.isInterface()) { - String className = type.getName(); - - if (java.rmi.Remote.class.isAssignableFrom(type)) { - // RMI Object reference... - callType = kRemoteType; - } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)){ - // IDL Object reference... - callType = kRemoteType; - } else if (RepositoryId.isAbstractBase(type)) { - // IDL Abstract Object reference... - callType = kAbstractType; - } else if (ObjectStreamClassCorbaExt.isAbstractInterface(type)) { - callType = kAbstractType; - } - } - - for (i = 0; i < length; i++) { - switch (callType) { - case kRemoteType: - Util.writeRemoteObject(out, array[i]); - break; - case kAbstractType: - Util.writeAbstractObject(out,array[i]); - break; - case kValueType: - try{ - out.write_value((java.io.Serializable)array[i]); - } catch(ClassCastException cce){ - if (array[i] instanceof java.io.Serializable) - throw cce; - else { - Utility.throwNotSerializableForCorba( - array[i].getClass().getName()); - } - } - break; - } - } - } - } - - private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in, - char[] array, - int offset, - int length) - { - in.read_wchar_array(array, offset, length); - } - - private java.lang.Object read_Array(IIOPInputStream bridge, - org.omg.CORBA_2_3.portable.InputStream in, - Class sequence, - com.sun.org.omg.SendingContext.CodeBase sender, - int offset) - { - try { - // Read length of coming array - int length = in.read_ulong(); - int i; - - if (sequence == null) { - for (i = 0; i < length; i++) - in.read_value(); - - return null; - } - - Class componentType = sequence.getComponentType(); - Class actualType = componentType; - - - if (componentType.isPrimitive()) { - if (componentType == Integer.TYPE) { - int[] array = new int[length]; - in.read_long_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); - } else if (componentType == Byte.TYPE) { - byte[] array = new byte[length]; - in.read_octet_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); - } else if (componentType == Long.TYPE) { - long[] array = new long[length]; - in.read_longlong_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); - } else if (componentType == Float.TYPE) { - float[] array = new float[length]; - in.read_float_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); - } else if (componentType == Double.TYPE) { - double[] array = new double[length]; - in.read_double_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); - } else if (componentType == Short.TYPE) { - short[] array = new short[length]; - in.read_short_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); - } else if (componentType == Character.TYPE) { - char[] array = new char[length]; - readCharArray(in, array, 0, length); - return ((java.io.Serializable)((Object)array)); - } else if (componentType == Boolean.TYPE) { - boolean[] array = new boolean[length]; - in.read_boolean_array(array, 0, length); - return ((java.io.Serializable)((Object)array)); - } else { - // XXX I18N, logging needed. - throw new Error("Invalid primitive componentType : " + sequence.getName()); - } - } else if (componentType == java.lang.Object.class) { - Object[] array = (Object[])java.lang.reflect.Array.newInstance( - componentType, length); - - // Store this object and its beginning position - // since there might be indirections to it while - // it's been unmarshalled. - bridge.activeRecursionMgr.addObject(offset, array); - - for (i = 0; i < length; i++) { - Object objectValue = null; - try { - objectValue = Util.readAny(in); - } catch(IndirectionException cdrie) { - try { - // The CDR stream had never seen the given offset - // before, so check the recursion manager (it will - // throw an IOException if it doesn't have a - // reference, either). - objectValue = bridge.activeRecursionMgr.getObject( - cdrie.offset); - } catch (IOException ie) { - // Translate to a MARSHAL exception since - // ValueHandlers aren't allowed to throw - // IOExceptions - throw utilWrapper.invalidIndirection( ie, - new Integer( cdrie.offset ) ) ; - } - } - - array[i] = objectValue; - } - return ((java.io.Serializable)((Object)array)); - } else { - Object[] array = (Object[])java.lang.reflect.Array.newInstance( - componentType, length); - // Store this object and its beginning position - // since there might be indirections to it while - // it's been unmarshalled. - bridge.activeRecursionMgr.addObject(offset, array); - - // Decide what method call to make based on the componentType. - // If it is a componentType for which we need to load a stub, - // convert the componentType to the correct stub type. - - int callType = kValueType; - boolean narrow = false; - - if (componentType.isInterface()) { - boolean loadStubClass = false; - // String className = componentType.getName(); - - if (java.rmi.Remote.class.isAssignableFrom(componentType)) { - - // RMI Object reference... - callType = kRemoteType; - - // for better performance, load the stub class once - // instead of for each element of the array - loadStubClass = true; - } else if (org.omg.CORBA.Object.class.isAssignableFrom(componentType)){ - // IDL Object reference... - callType = kRemoteType; - loadStubClass = true; - } else if (RepositoryId.isAbstractBase(componentType)) { - // IDL Abstract Object reference... - callType = kAbstractType; - loadStubClass = true; - } else if (ObjectStreamClassCorbaExt.isAbstractInterface(componentType)) { - - // RMI Abstract Object reference... - - // componentType = null; - callType = kAbstractType; - } - - if (loadStubClass) { - try { - String codebase = Util.getCodebase(componentType); - String repID = RepositoryId.createForAnyType(componentType); - Class stubType = - Utility.loadStubClass(repID, codebase, componentType); - actualType = stubType; - } catch (ClassNotFoundException e) { - narrow = true; - } - } else { - narrow = true; - } - } - - for (i = 0; i < length; i++) { - - try { - switch (callType) { - case kRemoteType: - if (!narrow) - array[i] = (Object)in.read_Object(actualType); - else { - array[i] = Utility.readObjectAndNarrow(in, actualType); - - } - break; - case kAbstractType: - if (!narrow) - array[i] = (Object)in.read_abstract_interface(actualType); - else { - array[i] = Utility.readAbstractAndNarrow(in, actualType); - } - break; - case kValueType: - array[i] = (Object)in.read_value(actualType); - break; - } - } catch(IndirectionException cdrie) { - // The CDR stream had never seen the given offset before, - // so check the recursion manager (it will throw an - // IOException if it doesn't have a reference, either). - try { - array[i] = bridge.activeRecursionMgr.getObject( - cdrie.offset); - } catch (IOException ioe) { - // Translate to a MARSHAL exception since - // ValueHandlers aren't allowed to throw - // IOExceptions - throw utilWrapper.invalidIndirection( ioe, - new Integer( cdrie.offset ) ) ; - } - } - - } - - return ((java.io.Serializable)((Object)array)); - } - } finally { - // We've completed deserializing this object. Any - // future indirections will be handled correctly at the - // CDR level. The ActiveRecursionManager only deals with - // objects currently being deserialized. - bridge.activeRecursionMgr.removeObject(offset); - } - } - - private boolean isArray(String repId){ - return RepositoryId.cache.getId(repId).isSequence(); - } - - private String getOutputStreamClassName() { - return "com.sun.corba.se.impl.io.IIOPOutputStream"; - } - - private IIOPOutputStream createOutputStream() { - final String name = getOutputStreamClassName(); - try { - IIOPOutputStream stream = createOutputStreamBuiltIn(name); - if (stream != null) { - return stream; - } - return createCustom(IIOPOutputStream.class, name); - } catch (Throwable t) { - // Throw exception under the carpet. - InternalError ie = new InternalError( - "Error loading " + name - ); - ie.initCause(t); - throw ie; - } - } - - /** - * Construct a built in implementation with priveleges. - * Returning null indicates a non-built is specified. - */ - private IIOPOutputStream createOutputStreamBuiltIn( - final String name - ) throws Throwable { - try { - return AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public IIOPOutputStream run() throws IOException { - return createOutputStreamBuiltInNoPriv(name); - } - } - ); - } catch (java.security.PrivilegedActionException exc) { - throw exc.getCause(); - } - } - - /** - * Returning null indicates a non-built is specified. - */ - private IIOPOutputStream createOutputStreamBuiltInNoPriv( - final String name - ) throws IOException { - return name.equals(IIOPOutputStream.class.getName()) ? - new IIOPOutputStream() : null; - } - - private String getInputStreamClassName() { - return "com.sun.corba.se.impl.io.IIOPInputStream"; - } - - private IIOPInputStream createInputStream() { - final String name = getInputStreamClassName(); - try { - IIOPInputStream stream = createInputStreamBuiltIn(name); - if (stream != null) { - return stream; - } - return createCustom(IIOPInputStream.class, name); - } catch (Throwable t) { - // Throw exception under the carpet. - InternalError ie = new InternalError( - "Error loading " + name - ); - ie.initCause(t); - throw ie; - } - } - - /** - * Construct a built in implementation with priveleges. - * Returning null indicates a non-built is specified. - */ - private IIOPInputStream createInputStreamBuiltIn( - final String name - ) throws Throwable { - try { - return AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public IIOPInputStream run() throws IOException { - return createInputStreamBuiltInNoPriv(name); - } - } - ); - } catch (java.security.PrivilegedActionException exc) { - throw exc.getCause(); - } - } - - /** - * Returning null indicates a non-built is specified. - */ - private IIOPInputStream createInputStreamBuiltInNoPriv( - final String name - ) throws IOException { - return name.equals(IIOPInputStream.class.getName()) ? - new IIOPInputStream() : null; - } - - /** - * Create a custom implementation without privileges. - */ - private T createCustom( - final Class type, final String className - ) throws Throwable { - // Note: We use the thread context or system ClassLoader here - // since we want to load classes outside of the - // core JDK when running J2EE Pure ORB and - // talking to Kestrel. - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (cl == null) - cl = ClassLoader.getSystemClassLoader(); - - Class clazz = cl.loadClass(className); - Class streamClass = clazz.asSubclass(type); - - // Since the ClassLoader should cache the class, this isn't - // as expensive as it looks. - return streamClass.newInstance(); - - } - - TCKind getJavaCharTCKind() { - return TCKind.tk_wchar; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueUtility.java 2018-01-30 20:17:31.000000000 -0500 +++ /dev/null 2018-01-30 20:17:31.000000000 -0500 @@ -1,483 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.io; - -import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription; -import com.sun.org.omg.CORBA.OperationDescription; -import com.sun.org.omg.CORBA.AttributeDescription; -import org.omg.CORBA.ValueMember; -import com.sun.org.omg.CORBA.Initializer; -import org.omg.CORBA.IDLType; -import com.sun.org.omg.CORBA._IDLTypeStub; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCodePackage.*; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.TCKind; -import java.lang.reflect.*; -import com.sun.corba.se.impl.util.RepositoryId; -import java.util.*; -import javax.rmi.CORBA.Util; -import javax.rmi.CORBA.ValueHandler; - -/** - * Holds utility methods for converting from ObjectStreamClass to - * FullValueDescription and generating typecodes from ObjectStreamClass. - **/ -public class ValueUtility { - - public static final short PRIVATE_MEMBER = 0; - public static final short PUBLIC_MEMBER = 1; - - private static final String primitiveConstants[] = { - null, // tk_null 0 - null, // tk_void 1 - "S", // tk_short 2 - "I", // tk_long 3 - "S", // tk_ushort 4 - "I", // tk_ulong 5 - "F", // tk_float 6 - "D", // tk_double 7 - "Z", // tk_boolean 8 - "C", // tk_char 9 - "B", // tk_octet 10 - null, // tk_any 11 - null, // tk_typecode 12 - null, // tk_principal 13 - null, // tk_objref 14 - null, // tk_struct 15 - null, // tk_union 16 - null, // tk_enum 17 - null, // tk_string 18 - null, // tk_sequence 19 - null, // tk_array 20 - null, // tk_alias 21 - null, // tk_except 22 - "J", // tk_longlong 23 - "J", // tk_ulonglong 24 - "D", // tk_longdouble 25 - "C", // tk_wchar 26 - null, // tk_wstring 27 - null, // tk_fixed 28 - null, // tk_value 29 - null, // tk_value_box 30 - null, // tk_native 31 - null, // tk_abstract_interface 32 - }; - - static { - sun.corba.SharedSecrets.setJavaCorbaAccess(new sun.corba.JavaCorbaAccess() { - public ValueHandlerImpl newValueHandlerImpl() { - return ValueHandlerImpl.getInstance(); - } - public Class loadClass(String className) throws ClassNotFoundException { - if (Thread.currentThread().getContextClassLoader() != null) { - return Thread.currentThread().getContextClassLoader(). - loadClass(className); - } else { - return ClassLoader.getSystemClassLoader().loadClass(className); - } - } - }); - } - - public static String getSignature(ValueMember member) - throws ClassNotFoundException { - - // REVISIT. Can the type be something that is - // non-primitive yet not a value_box, value, or objref? - // If so, should use ObjectStreamClass or throw - // exception. - - if (member.type.kind().value() == TCKind._tk_value_box || - member.type.kind().value() == TCKind._tk_value || - member.type.kind().value() == TCKind._tk_objref) { - Class c = RepositoryId.cache.getId(member.id).getClassFromType(); - return ObjectStreamClass.getSignature(c); - - } else { - - return primitiveConstants[member.type.kind().value()]; - } - - } - - public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh){ - - // Create FullValueDescription - FullValueDescription result = new FullValueDescription(); - Class className = osc.forClass(); - - ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh; - String repId = vhandler.createForAnyType(className); - - // Set FVD name - result.name = vhandler.getUnqualifiedName(repId); - if (result.name == null) - result.name = ""; - - // Set FVD id _REVISIT_ : Manglings - result.id = vhandler.getRMIRepositoryID(className); - if (result.id == null) - result.id = ""; - - // Set FVD is_abstract - result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className); - - // Set FVD is_custom - result.is_custom = osc.hasWriteObject() || osc.isExternalizable(); - - // Set FVD defined_in _REVISIT_ : Manglings - result.defined_in = vhandler.getDefinedInId(repId); - if (result.defined_in == null) - result.defined_in = ""; - - // Set FVD version - result.version = vhandler.getSerialVersionUID(repId); - if (result.version == null) - result.version = ""; - - // Skip FVD operations - N/A - result.operations = new OperationDescription[0]; - - // Skip FVD attributed - N/A - result.attributes = new AttributeDescription[0]; - - // Set FVD members - // Maps classes to repositoryIDs strings. This is used to detect recursive types. - IdentityKeyValueStack createdIDs = new IdentityKeyValueStack(); - // Stores all types created for resolving indirect types at the end. - result.members = translateMembers(orb, osc, vh, createdIDs); - - // Skip FVD initializers - N/A - result.initializers = new Initializer[0]; - - Class interfaces[] = osc.forClass().getInterfaces(); - int abstractCount = 0; - - // Skip FVD supported_interfaces - result.supported_interfaces = new String[interfaces.length]; - for (int interfaceIndex = 0; interfaceIndex < interfaces.length; - interfaceIndex++) { - result.supported_interfaces[interfaceIndex] = - vhandler.createForAnyType(interfaces[interfaceIndex]); - - if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) || - (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers()))) - abstractCount++; - } - - // Skip FVD abstract_base_values - N/A - result.abstract_base_values = new String[abstractCount]; - for (int interfaceIndex = 0; interfaceIndex < interfaces.length; - interfaceIndex++) { - if ((!(java.rmi.Remote.class.isAssignableFrom(interfaces[interfaceIndex]))) || - (!Modifier.isPublic(interfaces[interfaceIndex].getModifiers()))) - result.abstract_base_values[interfaceIndex] = - vhandler.createForAnyType(interfaces[interfaceIndex]); - - } - - result.is_truncatable = false; - - // Set FVD base_value - Class superClass = osc.forClass().getSuperclass(); - if (java.io.Serializable.class.isAssignableFrom(superClass)) - result.base_value = vhandler.getRMIRepositoryID(superClass); - else - result.base_value = ""; - - // Set FVD type - //result.type = createTypeCodeForClass(orb, osc.forClass()); - result.type = orb.get_primitive_tc(TCKind.tk_value); //11638 - - return result; - - } - - private static ValueMember[] translateMembers (ORB orb, - ObjectStreamClass osc, - ValueHandler vh, - IdentityKeyValueStack createdIDs) - { - ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh; - ObjectStreamField fields[] = osc.getFields(); - int fieldsLength = fields.length; - ValueMember[] members = new ValueMember[fieldsLength]; - // Note : fields come out of ObjectStreamClass in correct order for - // writing. So, we will create the same order in the members array. - for (int i = 0; i < fieldsLength; i++) { - String valRepId = vhandler.getRMIRepositoryID(fields[i].getClazz()); - members[i] = new ValueMember(); - members[i].name = fields[i].getName(); - members[i].id = valRepId; // _REVISIT_ : Manglings - members[i].defined_in = vhandler.getDefinedInId(valRepId);// _REVISIT_ : Manglings - members[i].version = "1.0"; - members[i].type_def = new _IDLTypeStub(); // _REVISIT_ : IDLType implementation missing - - if (fields[i].getField() == null) { - // When using serialPersistentFields, the class may - // no longer have an actual Field that corresponds - // to one of the items. The Java to IDL spec - // ptc-00-01-06 1.3.5.6 says that the IDL field - // should be private in this case. - members[i].access = PRIVATE_MEMBER; - } else { - int m = fields[i].getField().getModifiers(); - if (Modifier.isPublic(m)) - members[i].access = PUBLIC_MEMBER; - else - members[i].access = PRIVATE_MEMBER; - } - - switch (fields[i].getTypeCode()) { - case 'B': - members[i].type = orb.get_primitive_tc(TCKind.tk_octet); //11638 - break; - case 'C': - members[i].type - = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); // 11638 - break; - case 'F': - members[i].type = orb.get_primitive_tc(TCKind.tk_float); //11638 - break; - case 'D' : - members[i].type = orb.get_primitive_tc(TCKind.tk_double); //11638 - break; - case 'I': - members[i].type = orb.get_primitive_tc(TCKind.tk_long); //11638 - break; - case 'J': - members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); //11638 - break; - case 'S': - members[i].type = orb.get_primitive_tc(TCKind.tk_short); //11638 - break; - case 'Z': - members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); //11638 - break; - // case '[': - // members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); //11638 - // members[i].id = RepositoryId.createForAnyType(fields[i].getType()); - // break; - default: - members[i].type = createTypeCodeForClassInternal(orb, fields[i].getClazz(), vhandler, - createdIDs); - members[i].id = vhandler.createForAnyType(fields[i].getType()); - break; - } // end switch - - } // end for loop - - return members; - } - - private static boolean exists(String str, String strs[]){ - for (int i = 0; i < strs.length; i++) - if (str.equals(strs[i])) - return true; - - return false; - } - - public static boolean isAssignableFrom(String clzRepositoryId, FullValueDescription type, - com.sun.org.omg.SendingContext.CodeBase sender){ - - if (exists(clzRepositoryId, type.supported_interfaces)) - return true; - - if (clzRepositoryId.equals(type.id)) - return true; - - if ((type.base_value != null) && - (!type.base_value.equals(""))) { - FullValueDescription parent = sender.meta(type.base_value); - - return isAssignableFrom(clzRepositoryId, parent, sender); - } - - return false; - - } - - public static TypeCode createTypeCodeForClass (ORB orb, java.lang.Class c, ValueHandler vh) { - // Maps classes to repositoryIDs strings. This is used to detect recursive types. - IdentityKeyValueStack createdIDs = new IdentityKeyValueStack(); - // Stores all types created for resolving indirect types at the end. - TypeCode tc = createTypeCodeForClassInternal(orb, c, vh, createdIDs); - return tc; - } - - private static TypeCode createTypeCodeForClassInternal (ORB orb, - java.lang.Class c, - ValueHandler vh, - IdentityKeyValueStack createdIDs) - { - // This wrapper method is the protection against infinite recursion. - TypeCode tc = null; - String id = (String)createdIDs.get(c); - if (id != null) { - return orb.create_recursive_tc(id); - } else { - id = vh.getRMIRepositoryID(c); - if (id == null) id = ""; - // cache the rep id BEFORE creating a new typecode. - // so that recursive tc can look up the rep id. - createdIDs.push(c, id); - tc = createTypeCodeInternal(orb, c, vh, id, createdIDs); - createdIDs.pop(); - return tc; - } - } - - // Maintains a stack of key-value pairs. Compares elements using == operator. - private static class IdentityKeyValueStack { - private static class KeyValuePair { - Object key; - Object value; - KeyValuePair(Object key, Object value) { - this.key = key; - this.value = value; - } - boolean equals(KeyValuePair pair) { - return pair.key == this.key; - } - } - - Stack pairs = null; - - Object get(Object key) { - if (pairs == null) { - return null; - } - for (Iterator i = pairs.iterator(); i.hasNext();) { - KeyValuePair pair = (KeyValuePair)i.next(); - if (pair.key == key) { - return pair.value; - } - } - return null; - } - - void push(Object key, Object value) { - if (pairs == null) { - pairs = new Stack(); - } - pairs.push(new KeyValuePair(key, value)); - } - - void pop() { - pairs.pop(); - } - } - - private static TypeCode createTypeCodeInternal (ORB orb, - java.lang.Class c, - ValueHandler vh, - String id, - IdentityKeyValueStack createdIDs) - { - if ( c.isArray() ) { - // Arrays - may recurse for multi-dimensional arrays - Class componentClass = c.getComponentType(); - TypeCode embeddedType; - if ( componentClass.isPrimitive() ){ - embeddedType - = ValueUtility.getPrimitiveTypeCodeForClass(orb, - componentClass, - vh); - } else { - embeddedType = createTypeCodeForClassInternal(orb, componentClass, vh, - createdIDs); - } - TypeCode t = orb.create_sequence_tc (0, embeddedType); - return orb.create_value_box_tc (id, "Sequence", t); - } else if ( c == java.lang.String.class ) { - // Strings - TypeCode t = orb.create_string_tc (0); - return orb.create_value_box_tc (id, "StringValue", t); - } else if (java.rmi.Remote.class.isAssignableFrom(c)) { - return orb.get_primitive_tc(TCKind.tk_objref); - } else if (org.omg.CORBA.Object.class.isAssignableFrom(c)) { - return orb.get_primitive_tc(TCKind.tk_objref); - } - - // Anything else - - ObjectStreamClass osc = ObjectStreamClass.lookup(c); - - if (osc == null) { - return orb.create_value_box_tc (id, "Value", orb.get_primitive_tc (TCKind.tk_value)); - } - - // type modifier - // REVISIT truncatable and abstract? - short modifier = (osc.isCustomMarshaled() ? org.omg.CORBA.VM_CUSTOM.value : org.omg.CORBA.VM_NONE.value); - - // concrete base - TypeCode base = null; - Class superClass = c.getSuperclass(); - if (superClass != null && java.io.Serializable.class.isAssignableFrom(superClass)) { - base = createTypeCodeForClassInternal(orb, superClass, vh, createdIDs); - } - - // members - ValueMember[] members = translateMembers (orb, osc, vh, createdIDs); - - return orb.create_value_tc(id, c.getName(), modifier, base, members); - } - - public static TypeCode getPrimitiveTypeCodeForClass (ORB orb, - Class c, - ValueHandler vh) { - - if (c == Integer.TYPE) { - return orb.get_primitive_tc (TCKind.tk_long); - } else if (c == Byte.TYPE) { - return orb.get_primitive_tc (TCKind.tk_octet); - } else if (c == Long.TYPE) { - return orb.get_primitive_tc (TCKind.tk_longlong); - } else if (c == Float.TYPE) { - return orb.get_primitive_tc (TCKind.tk_float); - } else if (c == Double.TYPE) { - return orb.get_primitive_tc (TCKind.tk_double); - } else if (c == Short.TYPE) { - return orb.get_primitive_tc (TCKind.tk_short); - } else if (c == Character.TYPE) { - return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind()); - } else if (c == Boolean.TYPE) { - return orb.get_primitive_tc (TCKind.tk_boolean); - } else { - // _REVISIT_ Not sure if this is right. - return orb.get_primitive_tc (TCKind.tk_any); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java 2018-01-30 20:17:32.000000000 -0500 +++ /dev/null 2018-01-30 20:17:32.000000000 -0500 @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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.corba.se.impl.ior ; - - -public class ByteBuffer { - /** - * The array buffer into which the components of the ByteBuffer are - * stored. The capacity of the ByteBuffer is the length of this array buffer, - * and is at least large enough to contain all the ByteBuffer's elements.

- * - * Any array elements following the last element in the ByteBuffer are 0. - */ - protected byte elementData[]; - - /** - * The number of valid components in this {@code ByteBuffer} object. - * Components {@code elementData[0]} through - * {@code elementData[elementCount-1]} are the actual items. - * - * @serial - */ - protected int elementCount; - - /** - * The amount by which the capacity of the ByteBuffer is automatically - * incremented when its size becomes greater than its capacity. If - * the capacity increment is less than or equal to zero, the capacity - * of the ByteBuffer is doubled each time it needs to grow. - * - * @serial - */ - protected int capacityIncrement; - - /** - * Constructs an empty ByteBuffer with the specified initial capacity and - * capacity increment. - * - * @param initialCapacity the initial capacity of the ByteBuffer. - * @param capacityIncrement the amount by which the capacity is - * increased when the ByteBuffer overflows. - * @exception IllegalArgumentException if the specified initial capacity - * is negative - */ - public ByteBuffer(int initialCapacity, int capacityIncrement) { - super(); - if (initialCapacity < 0) - throw new IllegalArgumentException("Illegal Capacity: "+ - initialCapacity); - this.elementData = new byte[initialCapacity]; - this.capacityIncrement = capacityIncrement; - } - - /** - * Constructs an empty ByteBuffer with the specified initial capacity and - * with its capacity increment equal to zero. - * - * @param initialCapacity the initial capacity of the ByteBuffer. - * @exception IllegalArgumentException if the specified initial capacity - * is negative - */ - public ByteBuffer(int initialCapacity) { - this(initialCapacity, 0); - } - - /** - * Constructs an empty ByteBuffer so that its internal data array - * has size {@code 10} and its standard capacity increment is - * zero. - */ - public ByteBuffer() { - this(200); - } - - /** - * Trims the capacity of this ByteBuffer to be the ByteBuffer's current - * size. If the capacity of this cector is larger than its current - * size, then the capacity is changed to equal the size by replacing - * its internal data array, kept in the field {@code elementData}, - * with a smaller one. An application can use this operation to - * minimize the storage of a ByteBuffer. - */ - public void trimToSize() { - int oldCapacity = elementData.length; - if (elementCount < oldCapacity) { - byte oldData[] = elementData; - elementData = new byte[elementCount]; - System.arraycopy(oldData, 0, elementData, 0, elementCount); - } - } - - /** - * This implements the unsynchronized semantics of ensureCapacity. - * Synchronized methods in this class can internally call this - * method for ensuring capacity without incurring the cost of an - * extra synchronization. - * - * @see java.util.ByteBuffer#ensureCapacity(int) - */ - private void ensureCapacityHelper(int minCapacity) { - int oldCapacity = elementData.length; - if (minCapacity > oldCapacity) { - byte oldData[] = elementData; - int newCapacity = (capacityIncrement > 0) ? - (oldCapacity + capacityIncrement) : (oldCapacity * 2); - if (newCapacity < minCapacity) { - newCapacity = minCapacity; - } - elementData = new byte[newCapacity]; - System.arraycopy(oldData, 0, elementData, 0, elementCount); - } - } - - /** - * Returns the current capacity of this ByteBuffer. - * - * @return the current capacity (the length of its internal - * data arary, kept in the field {@code elementData} - * of this ByteBuffer. - */ - public int capacity() { - return elementData.length; - } - - /** - * Returns the number of components in this ByteBuffer. - * - * @return the number of components in this ByteBuffer. - */ - public int size() { - return elementCount; - } - - /** - * Tests if this ByteBuffer has no components. - * - * @return {@code true} if and only if this ByteBuffer has - * no components, that is, its size is zero; - * {@code false} otherwise. - */ - public boolean isEmpty() { - return elementCount == 0; - } - - public void append(byte value) - { - ensureCapacityHelper(elementCount + 1); - elementData[elementCount++] = value; - } - - public void append( int value ) - { - ensureCapacityHelper(elementCount + 4); - doAppend( value ) ; - } - - private void doAppend( int value ) - { - int current = value ; - for (int ctr=0; ctr<4; ctr++) { - elementData[elementCount+ctr] = (byte)(current & 255) ; - current = current >> 8 ; - } - elementCount += 4 ; - } - - public void append( String value ) - { - byte[] data = value.getBytes() ; - ensureCapacityHelper( elementCount + data.length + 4 ) ; - doAppend( data.length ) ; - System.arraycopy( data, 0, elementData, elementCount, data.length ) ; - elementCount += data.length ; - } - - /** - * Returns an array containing all of the elements in this ByteBuffer - * in the correct order. - * - * @since 1.2 - */ - public byte[] toArray() { - return elementData ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java 2018-01-30 20:17:32.000000000 -0500 +++ /dev/null 2018-01-30 20:17:32.000000000 -0500 @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.ior; - -import java.util.List; -import java.util.LinkedList; -import java.util.Iterator; - -import org.omg.IOP.TAG_INTERNET_IOP ; - -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA_2_3.portable.InputStream ; - -import com.sun.corba.se.spi.ior.TaggedComponent ; -import com.sun.corba.se.spi.ior.Identifiable ; -import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ; -import com.sun.corba.se.spi.ior.WriteContents ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.impl.ior.FreezableList ; - -import com.sun.corba.se.impl.encoding.CDROutputStream ; -import com.sun.corba.se.impl.encoding.EncapsOutputStream ; -import com.sun.corba.se.impl.encoding.EncapsInputStream ; - -import sun.corba.EncapsInputStreamFactory; - -/** - * This static utility class contains various utility methods for reading and - * writing CDR encapsulations. - * - * @author Ken Cavanaugh - */ -public class EncapsulationUtility -{ - private EncapsulationUtility() - { - } - - /** Read the count from is, then read count Identifiables from - * is using the factory. Add each constructed Identifiable to container. - */ - public static void readIdentifiableSequence( List container, - IdentifiableFactoryFinder finder, InputStream istr) - { - int count = istr.read_long() ; - for (int ctr = 0; ctr iorTypeNames; - private static final Set builtinIorTypeNames; - private ORB theOrb; - - static { - builtinIorTypeNames = initBuiltinIorTypeNames(); - } - - public IORTypeCheckRegistryImpl( String filterProperties, ORB orb) { - theOrb = orb; - iorTypeNames = parseIorClassNameList(filterProperties); - } - - /* - * - * A note on the validation flow: - * 1. against the filter class name list - * 2. against the builtin class name list - */ - - @Override - public boolean isValidIORType(String iorClassName) { - dprintTransport(".isValidIORType : iorClassName == " + iorClassName); - return validateIorTypeByName(iorClassName); - } - - - private boolean validateIorTypeByName(String iorClassName) { - dprintTransport(".validateIorTypeByName : iorClassName == " + iorClassName); - boolean isValidType; - - isValidType = checkIorTypeNames(iorClassName); - - if (!isValidType) { - isValidType = checkBuiltinClassNames(iorClassName); - } - - dprintTransport(".validateIorTypeByName : isValidType == " + isValidType); - return isValidType; - } - - - /* - * check if the class name corresponding to an IOR Type name - * is in the ior class name list as generated from the filter property. - * So if the IOR type is recorded in the registry then allow the creation of the - * stub factory and let it resolve and load the class. That is if current - * type check deliberation permits. - * IOR Type names are configured by the filter property - */ - - private boolean checkIorTypeNames( - String theIorClassName) { - return (iorTypeNames != null) && (iorTypeNames.contains(theIorClassName)); - } - - /* - * Check the IOR interface class name against the set of - * class names that correspond to the builtin JDK IDL stub classes. - */ - - private boolean checkBuiltinClassNames( - String theIorClassName) { - return builtinIorTypeNames.contains(theIorClassName); - } - - - private Set parseIorClassNameList(String filterProperty) { - Set _iorTypeNames = null; - if (filterProperty != null) { - String[] tempIorClassNames = filterProperty.split(";"); - _iorTypeNames = Set.of(tempIorClassNames); - if (theOrb.orbInitDebugFlag) { - dprintConfiguredIorTypeNames(); - } - } - return _iorTypeNames; - } - - - private static Set initBuiltinIorTypeNames() { - Set> builtInCorbaStubTypes = initBuiltInCorbaStubTypes(); - String [] tempBuiltinIorTypeNames = new String[builtInCorbaStubTypes.size()]; - int i = 0; - for (Class _stubClass: builtInCorbaStubTypes) { - tempBuiltinIorTypeNames[i++] = _stubClass.getName(); - } - return Set.of(tempBuiltinIorTypeNames); - } - - private static Set> initBuiltInCorbaStubTypes() { - Class tempBuiltinCorbaStubTypes[] = { - com.sun.corba.se.spi.activation.Activator.class, - com.sun.corba.se.spi.activation._ActivatorStub.class, - com.sun.corba.se.spi.activation._InitialNameServiceStub.class, - com.sun.corba.se.spi.activation._LocatorStub.class, - com.sun.corba.se.spi.activation._RepositoryStub.class, - com.sun.corba.se.spi.activation._ServerManagerStub.class, - com.sun.corba.se.spi.activation._ServerStub.class, - org.omg.CosNaming.BindingIterator.class, - org.omg.CosNaming._BindingIteratorStub.class, - org.omg.CosNaming.NamingContextExt.class, - org.omg.CosNaming._NamingContextExtStub.class, - org.omg.CosNaming.NamingContext.class, - org.omg.CosNaming._NamingContextStub.class, - org.omg.DynamicAny.DynAnyFactory.class, - org.omg.DynamicAny._DynAnyFactoryStub.class, - org.omg.DynamicAny.DynAny.class, - org.omg.DynamicAny._DynAnyStub.class, - org.omg.DynamicAny.DynArray.class, - org.omg.DynamicAny._DynArrayStub.class, - org.omg.DynamicAny.DynEnum.class, - org.omg.DynamicAny._DynEnumStub.class, - org.omg.DynamicAny.DynFixed.class, - org.omg.DynamicAny._DynFixedStub.class, - org.omg.DynamicAny.DynSequence.class, - org.omg.DynamicAny._DynSequenceStub.class, - org.omg.DynamicAny.DynStruct.class, - org.omg.DynamicAny._DynStructStub.class, - org.omg.DynamicAny.DynUnion.class, - org.omg.DynamicAny._DynUnionStub.class, - org.omg.DynamicAny._DynValueStub.class, - org.omg.DynamicAny.DynValue.class, - org.omg.PortableServer.ServantActivator.class, - org.omg.PortableServer._ServantActivatorStub.class, - org.omg.PortableServer.ServantLocator.class, - org.omg.PortableServer._ServantLocatorStub.class }; - return Set.>of(tempBuiltinCorbaStubTypes); - } - - private void dprintConfiguredIorTypeNames() { - if (iorTypeNames != null) { - for (String iorTypeName : iorTypeNames) { - ORBUtility.dprint(this, ".dprintConfiguredIorTypeNames: " + iorTypeName); - } - } - } - - private void dprintTransport(String msg) { - if (theOrb.transportDebugFlag) { - ORBUtility.dprint(this, msg); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java 2018-01-30 20:17:38.000000000 -0500 +++ /dev/null 2018-01-30 20:17:38.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.ior ; - -import org.omg.CORBA_2_3.portable.InputStream ; - -import java.util.Map ; -import java.util.HashMap ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.ior.Identifiable ; -import com.sun.corba.se.spi.ior.IdentifiableFactory ; -import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.IORSystemException ; - -public abstract class IdentifiableFactoryFinderBase implements - IdentifiableFactoryFinder -{ - private ORB orb ; - private Map map ; - protected IORSystemException wrapper ; - - protected IdentifiableFactoryFinderBase( ORB orb ) - { - map = new HashMap() ; - this.orb = orb ; - wrapper = IORSystemException.get( orb, - CORBALogDomains.OA_IOR ) ; - } - - protected IdentifiableFactory getFactory(int id) - { - Integer ident = new Integer( id ) ; - IdentifiableFactory factory = (IdentifiableFactory)(map.get( - ident ) ) ; - return factory ; - } - - public abstract Identifiable handleMissingFactory( int id, InputStream is ) ; - - public Identifiable create(int id, InputStream is) - { - IdentifiableFactory factory = getFactory( id ) ; - - if (factory != null) - return factory.create( is ) ; - else - return handleMissingFactory( id, is ) ; - } - - public void registerFactory(IdentifiableFactory factory) - { - Integer ident = new Integer( factory.getId() ) ; - map.put( ident, factory ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java 2018-01-30 20:17:39.000000000 -0500 +++ /dev/null 2018-01-30 20:17:39.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import org.omg.CORBA.OctetSeqHolder ; - -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectKeyFactory ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORBVersionFactory ; - -import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ; - -/** - * @author Ken Cavanaugh - */ -public final class JIDLObjectKeyTemplate extends NewObjectKeyTemplateBase -{ - /** This constructor reads the template ONLY from the stream. - */ - public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is ) - { - super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID ); - - setORBVersion( is ) ; - } - - /** This constructor reads a complete ObjectKey (template and Id) - * from the stream. - */ - public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is, - OctetSeqHolder osh ) - { - super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID ); - - osh.value = readObjectKey( is ) ; - - setORBVersion( is ) ; - } - - public JIDLObjectKeyTemplate( ORB orb, int scid, int serverid ) - { - super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, - JIDL_ORB_ID, JIDL_OAID ) ; - - setORBVersion( ORBVersionFactory.getORBVersion() ) ; - } - - protected void writeTemplate( OutputStream os ) - { - os.write_long( getMagic() ) ; - os.write_long( getSubcontractId() ) ; - os.write_long( getServerId() ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java 2018-01-30 20:17:40.000000000 -0500 +++ /dev/null 2018-01-30 20:17:40.000000000 -0500 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior; - -import java.io.IOException ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectAdapterId ; -import com.sun.corba.se.spi.ior.ObjectKeyFactory ; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORBVersionFactory ; - -import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ; - -public abstract class NewObjectKeyTemplateBase extends ObjectKeyTemplateBase -{ - public NewObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid, - String orbid, ObjectAdapterId oaid ) - { - super( orb, magic, scid, serverid, orbid, oaid ) ; - // subclass must set the version, since we don't have the object key here. - - if (magic != ObjectKeyFactoryImpl.JAVAMAGIC_NEWER) - throw wrapper.badMagic( new Integer( magic ) ) ; - } - - public void write(ObjectId objectId, OutputStream os) - { - super.write( objectId, os ) ; - getORBVersion().write( os ) ; - } - - public void write(OutputStream os) - { - super.write( os ) ; - getORBVersion().write( os ) ; - } - - protected void setORBVersion( InputStream is ) - { - ORBVersion version = ORBVersionFactory.create( is ) ; - setORBVersion( version ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java 2018-01-30 20:17:40.000000000 -0500 +++ /dev/null 2018-01-30 20:17:40.000000000 -0500 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior ; - -import java.util.Iterator ; -import java.util.Arrays ; - -public class ObjectAdapterIdArray extends ObjectAdapterIdBase { - private final String[] objectAdapterId ; - - public ObjectAdapterIdArray( String[] objectAdapterId ) - { - this.objectAdapterId = objectAdapterId ; - } - - /** Special constructor used for OA IDs of length 2. - */ - public ObjectAdapterIdArray( String name1, String name2 ) - { - objectAdapterId = new String[2] ; - objectAdapterId[0] = name1 ; - objectAdapterId[1] = name2 ; - } - - public int getNumLevels() - { - return objectAdapterId.length ; - } - - public Iterator iterator() - { - return Arrays.asList( objectAdapterId ).iterator() ; - } - - public String[] getAdapterName() - { - return (String[])(objectAdapterId.clone()) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java 2018-01-30 20:17:41.000000000 -0500 +++ /dev/null 2018-01-30 20:17:41.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior ; - -import java.util.Iterator ; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.ObjectAdapterId ; - -abstract class ObjectAdapterIdBase implements ObjectAdapterId { - public boolean equals( Object other ) - { - if (!(other instanceof ObjectAdapterId)) - return false ; - - ObjectAdapterId theOther = (ObjectAdapterId)other ; - - Iterator iter1 = iterator() ; - Iterator iter2 = theOther.iterator() ; - - while (iter1.hasNext() && iter2.hasNext()) { - String str1 = (String)(iter1.next()) ; - String str2 = (String)(iter2.next()) ; - - if (!str1.equals( str2 )) - return false ; - } - - return iter1.hasNext() == iter2.hasNext() ; - } - - public int hashCode() - { - int result = 17 ; - Iterator iter = iterator() ; - while (iter.hasNext()) { - String str = (String)(iter.next()) ; - result = 37*result + str.hashCode() ; - } - return result ; - } - - public String toString() - { - StringBuffer buff = new StringBuffer() ; - buff.append( "ObjectAdapterID[" ) ; - Iterator iter = iterator() ; - boolean first = true ; - while (iter.hasNext()) { - String str = (String)(iter.next()) ; - - if (first) - first = false ; - else - buff.append( "/" ) ; - - buff.append( str ) ; - } - - buff.append( "]" ) ; - - return buff.toString() ; - } - - public void write( OutputStream os ) - { - os.write_long( getNumLevels() ) ; - Iterator iter = iterator() ; - while (iter.hasNext()) { - String str = (String)(iter.next()) ; - os.write_string( str ) ; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java 2018-01-30 20:17:42.000000000 -0500 +++ /dev/null 2018-01-30 20:17:42.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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.corba.se.impl.ior ; - -import java.util.Iterator ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -/** ObjectAdapterIdNumber is used to represent pre-JDK 1.4 POA adapter - * IDs. The POA ID was simply represented as a single integer, which was - * mapped to the actual POA instance. Here, we just represent these - * internally as arrays of the form {@code { "OldRootPOA", "" }}, - * and provide an extra method to get the number back. - */ -public class ObjectAdapterIdNumber extends ObjectAdapterIdArray { - private int poaid ; - - public ObjectAdapterIdNumber( int poaid ) - { - super( "OldRootPOA", Integer.toString( poaid ) ) ; - this.poaid = poaid ; - } - - public int getOldPOAId() - { - return poaid ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java 2018-01-30 20:17:42.000000000 -0500 +++ /dev/null 2018-01-30 20:17:42.000000000 -0500 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior; - -import java.util.Arrays ; -import com.sun.corba.se.spi.ior.ObjectId ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -public final class ObjectIdImpl implements ObjectId -{ - private byte[] id; - - public boolean equals( Object obj ) - { - if (!(obj instanceof ObjectIdImpl)) - return false ; - - ObjectIdImpl other = (ObjectIdImpl)obj ; - - return Arrays.equals( this.id, other.id ) ; - } - - public int hashCode() - { - int result = 17 ; - for (int ctr=0; ctr= ORBConstants.FIRST_POA_SCID) && - (scid <= ORBConstants.MAX_POA_SCID)) { - if (magic >= JAVAMAGIC_NEWER) - oktemp = new POAObjectKeyTemplate( orb, magic, scid, is, osh ) ; - else - oktemp = new OldPOAObjectKeyTemplate( orb, magic, scid, is, osh ) ; - } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) { - if (magic >= JAVAMAGIC_NEWER) - oktemp = new JIDLObjectKeyTemplate( orb, magic, scid, is, osh ) ; - else - oktemp = new OldJIDLObjectKeyTemplate( orb, magic, scid, is, osh ); - } - - return oktemp ; - } - } ; - - /** This handler reads only the oktemp. - */ - private Handler oktempOnly = new Handler() { - public ObjectKeyTemplate handle( int magic, int scid, - InputStream is, OctetSeqHolder osh ) { - ObjectKeyTemplate oktemp = null ; - - if ((scid >= ORBConstants.FIRST_POA_SCID) && - (scid <= ORBConstants.MAX_POA_SCID)) { - if (magic >= JAVAMAGIC_NEWER) - oktemp = new POAObjectKeyTemplate( orb, magic, scid, is ) ; - else - oktemp = new OldPOAObjectKeyTemplate( orb, magic, scid, is ) ; - } else if ((scid >= 0) && (scid < ORBConstants.FIRST_POA_SCID)) { - if (magic >= JAVAMAGIC_NEWER) - oktemp = new JIDLObjectKeyTemplate( orb, magic, scid, is ) ; - else - oktemp = new OldJIDLObjectKeyTemplate( orb, magic, scid, is ) ; - } - - return oktemp ; - } - } ; - - /** Returns true iff magic is in the range of valid magic numbers - * for our ORB. - */ - private boolean validMagic( int magic ) - { - return (magic >= MAGIC_BASE) && (magic <= MAX_MAGIC) ; - } - - /** Creates an ObjectKeyTemplate from the InputStream. Most of the - * decoding is done inside the handler. - */ - private ObjectKeyTemplate create( InputStream is, Handler handler, - OctetSeqHolder osh ) - { - ObjectKeyTemplate oktemp = null ; - - try { - is.mark(0) ; - int magic = is.read_long() ; - - if (validMagic( magic )) { - int scid = is.read_long() ; - oktemp = handler.handle( magic, scid, is, osh ) ; - } - } catch (MARSHAL mexc) { - // XXX log this error - // ignore this: error handled below because oktemp == null - } - - if (oktemp == null) - // If we did not successfully construct a oktemp, reset the - // stream so that WireObjectKeyTemplate can correctly construct the - // object key. - try { - is.reset() ; - } catch (IOException exc) { - // XXX log this error - // ignore this - } - - return oktemp ; - } - - public ObjectKey create( byte[] key ) - { - OctetSeqHolder osh = new OctetSeqHolder() ; - EncapsInputStream is = EncapsInputStreamFactory.newEncapsInputStream( orb, key, key.length ); - - ObjectKeyTemplate oktemp = create( is, fullKey, osh ) ; - if (oktemp == null) - oktemp = new WireObjectKeyTemplate( is, osh ) ; - - ObjectId oid = new ObjectIdImpl( osh.value ) ; - return new ObjectKeyImpl( oktemp, oid ) ; - } - - public ObjectKeyTemplate createTemplate( InputStream is ) - { - ObjectKeyTemplate oktemp = create( is, oktempOnly, null ) ; - if (oktemp == null) - oktemp = new WireObjectKeyTemplate( orb ) ; - - return oktemp ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java 2018-01-30 20:17:44.000000000 -0500 +++ /dev/null 2018-01-30 20:17:44.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.ior; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectKey ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; - -import com.sun.corba.se.impl.encoding.EncapsOutputStream ; - -public class ObjectKeyImpl implements ObjectKey -{ - private ObjectKeyTemplate oktemp; - private ObjectId id; - - public boolean equals( Object obj ) - { - if (obj == null) - return false ; - - if (!(obj instanceof ObjectKeyImpl)) - return false ; - - ObjectKeyImpl other = (ObjectKeyImpl)obj ; - - return oktemp.equals( other.oktemp ) && - id.equals( other.id ) ; - } - - public int hashCode() - { - return oktemp.hashCode() ^ id.hashCode() ; - } - - public ObjectKeyTemplate getTemplate() - { - return oktemp ; - } - - public ObjectId getId() - { - return id ; - } - - public ObjectKeyImpl( ObjectKeyTemplate oktemp, ObjectId id ) - { - this.oktemp = oktemp ; - this.id = id ; - } - - public void write( OutputStream os ) - { - oktemp.write( id, os ) ; - } - - public byte[] getBytes( org.omg.CORBA.ORB orb ) - { - EncapsOutputStream os = - sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb); - write( os ) ; - return os.toByteArray() ; - } - - public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb ) - { - return oktemp.getServerRequestDispatcher( orb, id ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java 2018-01-30 20:17:44.000000000 -0500 +++ /dev/null 2018-01-30 20:17:44.000000000 -0500 @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior; - -import java.util.Iterator ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; - -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectAdapterId ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - - -import com.sun.corba.se.impl.encoding.EncapsOutputStream ; - -import com.sun.corba.se.impl.logging.IORSystemException ; - - -public abstract class ObjectKeyTemplateBase implements ObjectKeyTemplate -{ - // Fixed constants for Java IDL object key template forms - public static final String JIDL_ORB_ID = "" ; - private static final String[] JIDL_OAID_STRINGS = { "TransientObjectAdapter" } ; - public static final ObjectAdapterId JIDL_OAID = new ObjectAdapterIdArray( JIDL_OAID_STRINGS ) ; - - private ORB orb ; - protected IORSystemException wrapper ; - private ORBVersion version ; - private int magic ; - private int scid ; - private int serverid ; - private String orbid ; - private ObjectAdapterId oaid ; - - private byte[] adapterId ; - - public byte[] getAdapterId() - { - return (byte[])(adapterId.clone()) ; - } - - private byte[] computeAdapterId() - { - // write out serverid, orbid, oaid - ByteBuffer buff = new ByteBuffer() ; - - buff.append( getServerId() ) ; - buff.append( orbid ) ; - - buff.append( oaid.getNumLevels() ) ; - Iterator iter = oaid.iterator() ; - while (iter.hasNext()) { - String comp = (String)(iter.next()) ; - buff.append( comp ) ; - } - - buff.trimToSize() ; - - return buff.toArray() ; - } - - public ObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid, - String orbid, ObjectAdapterId oaid ) - { - this.orb = orb ; - this.wrapper = IORSystemException.get( orb, - CORBALogDomains.OA_IOR ) ; - this.magic = magic ; - this.scid = scid ; - this.serverid = serverid ; - this.orbid = orbid ; - this.oaid = oaid ; - - adapterId = computeAdapterId() ; - } - - public boolean equals( Object obj ) - { - if (!(obj instanceof ObjectKeyTemplateBase)) - return false ; - - ObjectKeyTemplateBase other = (ObjectKeyTemplateBase)obj ; - - return (magic == other.magic) && (scid == other.scid) && - (serverid == other.serverid) && (version.equals( other.version ) && - orbid.equals( other.orbid ) && oaid.equals( other.oaid )) ; - } - - public int hashCode() - { - int result = 17 ; - result = 37*result + magic ; - result = 37*result + scid ; - result = 37*result + serverid ; - result = 37*result + version.hashCode() ; - result = 37*result + orbid.hashCode() ; - result = 37*result + oaid.hashCode() ; - return result ; - } - - public int getSubcontractId() - { - return scid ; - } - - public int getServerId() - { - return serverid ; - } - - public String getORBId() - { - return orbid ; - } - - public ObjectAdapterId getObjectAdapterId() - { - return oaid ; - } - - public void write(ObjectId objectId, OutputStream os) - { - writeTemplate( os ) ; - objectId.write( os ) ; - } - - public void write( OutputStream os ) - { - writeTemplate( os ) ; - } - - abstract protected void writeTemplate( OutputStream os ) ; - - protected int getMagic() - { - return magic ; - } - - // All subclasses should set the version in their constructors. - // Public so it can be used in a white-box test. - public void setORBVersion( ORBVersion version ) - { - this.version = version ; - } - - public ORBVersion getORBVersion() - { - return version ; - } - - protected byte[] readObjectKey( InputStream is ) - { - int len = is.read_long() ; - byte[] result = new byte[len] ; - is.read_octet_array( result, 0, len ) ; - return result ; - } - - public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id ) - { - return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( scid ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java 2018-01-30 20:17:45.000000000 -0500 +++ /dev/null 2018-01-30 20:17:45.000000000 -0500 @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.ior ; - -import java.util.Iterator ; - -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; -import org.omg.CORBA.portable.StreamableValue ; - -import org.omg.CORBA.TypeCode ; - -import org.omg.PortableInterceptor.ObjectReferenceFactory ; -import org.omg.PortableInterceptor.ObjectReferenceFactoryHelper ; - -import com.sun.corba.se.spi.oa.ObjectAdapter ; - -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.se.spi.ior.ObjectAdapterId ; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactory; -import com.sun.corba.se.spi.ior.IORTemplateList; -import com.sun.corba.se.spi.ior.IORFactories; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** This is an implementation of the ObjectReferenceFactory abstract value -* type defined by the portable interceptors IDL. -* Note that this is a direct Java implementation -* of the abstract value type: there is no stateful value type defined in IDL, -* since defining the state in IDL is awkward and inefficient. The best way -* to define the state is to use internal data structures that can be written -* to and read from CORBA streams. -*/ -public class ObjectReferenceFactoryImpl extends ObjectReferenceProducerBase - implements ObjectReferenceFactory, StreamableValue -{ - transient private IORTemplateList iorTemplates ; - - public ObjectReferenceFactoryImpl( InputStream is ) - { - super( (ORB)(is.orb()) ) ; - _read( is ) ; - } - - public ObjectReferenceFactoryImpl( ORB orb, IORTemplateList iortemps ) - { - super( orb ) ; - iorTemplates = iortemps ; - } - - public boolean equals( Object obj ) - { - if (!(obj instanceof ObjectReferenceFactoryImpl)) - return false ; - - ObjectReferenceFactoryImpl other = (ObjectReferenceFactoryImpl)obj ; - - return (iorTemplates != null) && - iorTemplates.equals( other.iorTemplates ) ; - } - - public int hashCode() - { - return iorTemplates.hashCode() ; - } - - // Note that this repository ID must reflect the implementation - // of the abstract valuetype (that is, this class), not the - // repository ID of the org.omg.PortableInterceptor.ObjectReferenceFactory - // class. This allows for multiple independent implementations - // of the abstract valuetype, should that become necessary. - public static final String repositoryId = - "IDL:com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl:1.0" ; - - public String[] _truncatable_ids() - { - return new String[] { repositoryId } ; - } - - public TypeCode _type() - { - return ObjectReferenceFactoryHelper.type() ; - } - - /** Read the data into a (presumably) empty ObjectReferenceFactoryImpl. - * This sets the orb to the ORB of the InputStream. - */ - public void _read( InputStream is ) - { - org.omg.CORBA_2_3.portable.InputStream istr = - (org.omg.CORBA_2_3.portable.InputStream)is ; - - iorTemplates = IORFactories.makeIORTemplateList( istr ) ; - } - - /** Write the state to the OutputStream. - */ - public void _write( OutputStream os ) - { - org.omg.CORBA_2_3.portable.OutputStream ostr = - (org.omg.CORBA_2_3.portable.OutputStream)os ; - - iorTemplates.write( ostr ) ; - } - - public IORFactory getIORFactory() - { - return iorTemplates ; - } - - public IORTemplateList getIORTemplateList() - { - return iorTemplates ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java 2018-01-30 20:17:46.000000000 -0500 +++ /dev/null 2018-01-30 20:17:46.000000000 -0500 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.ior ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.ior.IORFactory ; -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.IORFactories ; -import com.sun.corba.se.spi.ior.IORTemplateList ; -import com.sun.corba.se.spi.ior.ObjectId ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -import com.sun.corba.se.impl.logging.IORSystemException ; - -public abstract class ObjectReferenceProducerBase { - transient protected ORB orb ; - - public abstract IORFactory getIORFactory() ; - - public abstract IORTemplateList getIORTemplateList() ; - - public ObjectReferenceProducerBase( ORB orb ) - { - this.orb = orb ; - } - - public org.omg.CORBA.Object make_object (String repositoryId, - byte[] objectId) - { - ObjectId oid = IORFactories.makeObjectId( objectId ) ; - IOR ior = getIORFactory().makeIOR( orb, repositoryId, oid ) ; - - return ORBUtility.makeObjectReference( ior ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java 2018-01-30 20:17:46.000000000 -0500 +++ /dev/null 2018-01-30 20:17:46.000000000 -0500 @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior ; - -import java.util.Iterator ; - -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; -import org.omg.CORBA.portable.StreamableValue ; - -import org.omg.CORBA.TypeCode ; - -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper ; - -import com.sun.corba.se.spi.oa.ObjectAdapter ; - -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.se.spi.ior.ObjectAdapterId ; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactory; -import com.sun.corba.se.spi.ior.IORTemplate; -import com.sun.corba.se.spi.ior.IORTemplateList; -import com.sun.corba.se.spi.ior.IORFactories; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** This is an implementation of the ObjectReferenceTemplate abstract value -* type defined by the portable interceptors IDL. -* Note that this is a direct Java implementation -* of the abstract value type: there is no stateful value type defined in IDL, -* since defining the state in IDL is awkward and inefficient. The best way -* to define the state is to use internal data structures that can be written -* to and read from CORBA streams. -*/ -public class ObjectReferenceTemplateImpl extends ObjectReferenceProducerBase - implements ObjectReferenceTemplate, StreamableValue -{ - transient private IORTemplate iorTemplate ; - - public ObjectReferenceTemplateImpl( InputStream is ) - { - super( (ORB)(is.orb()) ) ; - _read( is ) ; - } - - public ObjectReferenceTemplateImpl( ORB orb, IORTemplate iortemp ) - { - super( orb ) ; - iorTemplate = iortemp ; - } - - public boolean equals( Object obj ) - { - if (!(obj instanceof ObjectReferenceTemplateImpl)) - return false ; - - ObjectReferenceTemplateImpl other = (ObjectReferenceTemplateImpl)obj ; - - return (iorTemplate != null) && - iorTemplate.equals( other.iorTemplate ) ; - } - - public int hashCode() - { - return iorTemplate.hashCode() ; - } - - // Note that this repository ID must reflect the implementation - // of the abstract valuetype (that is, this class), not the - // repository ID of the org.omg.PortableInterceptor.ObjectReferenceTemplate - // class. This allows for multiple independent implementations - // of the abstract valuetype, should that become necessary. - public static final String repositoryId = - "IDL:com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl:1.0" ; - - public String[] _truncatable_ids() - { - return new String[] { repositoryId } ; - } - - public TypeCode _type() - { - return ObjectReferenceTemplateHelper.type() ; - } - - /** Read the data into a (presumably) empty ORTImpl. This sets the - * orb to the ORB of the InputStream. - */ - public void _read( InputStream is ) - { - org.omg.CORBA_2_3.portable.InputStream istr = - (org.omg.CORBA_2_3.portable.InputStream)is ; - iorTemplate = IORFactories.makeIORTemplate( istr ) ; - orb = (ORB)(istr.orb()) ; - } - - /** Write the state to the OutputStream. - */ - public void _write( OutputStream os ) - { - org.omg.CORBA_2_3.portable.OutputStream ostr = - (org.omg.CORBA_2_3.portable.OutputStream)os ; - - iorTemplate.write( ostr ) ; - } - - public String server_id () - { - int val = iorTemplate.getObjectKeyTemplate().getServerId() ; - return Integer.toString( val ) ; - } - - public String orb_id () - { - return iorTemplate.getObjectKeyTemplate().getORBId() ; - } - - public String[] adapter_name() - { - ObjectAdapterId poaid = - iorTemplate.getObjectKeyTemplate().getObjectAdapterId() ; - - return poaid.getAdapterName() ; - } - - public IORFactory getIORFactory() - { - return iorTemplate ; - } - - public IORTemplateList getIORTemplateList() - { - IORTemplateList tl = IORFactories.makeIORTemplateList() ; - tl.add( iorTemplate ) ; - tl.makeImmutable() ; - return tl ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java 2018-01-30 20:17:47.000000000 -0500 +++ /dev/null 2018-01-30 20:17:47.000000000 -0500 @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior; - -import org.omg.CORBA.OctetSeqHolder ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectKeyFactory ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORBVersionFactory ; - -import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ; - -import com.sun.corba.se.impl.encoding.CDRInputStream ; - -/** - * Handles object keys created by JDK ORBs from before JDK 1.4.0. - */ -public final class OldJIDLObjectKeyTemplate extends OldObjectKeyTemplateBase -{ - /** - * JDK 1.3.1 FCS did not include a version byte at the end of - * its object keys. JDK 1.3.1_01 included the byte with the - * value 1. Anything below 1 is considered an invalid value. - */ - public static final byte NULL_PATCH_VERSION = 0; - - byte patchVersion = OldJIDLObjectKeyTemplate.NULL_PATCH_VERSION; - - public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid, - InputStream is, OctetSeqHolder osh ) - { - this( orb, magic, scid, is ); - - osh.value = readObjectKey( is ) ; - - /** - * Beginning with JDK 1.3.1_01, a byte was placed at the end of - * the object key with a value indicating the patch version. - * JDK 1.3.1_01 had the value 1. If other patches are necessary - * which involve ORB versioning changes, they should increment - * the patch version. - * - * Note that if we see a value greater than 1 in this code, we - * will treat it as if we're talking to the most recent ORB version. - * - * WARNING: This code is sensitive to changes in CDRInputStream - * getPosition. It assumes that the CDRInputStream is an - * encapsulation whose position can be compared to the object - * key array length. - */ - if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW && - osh.value.length > ((CDRInputStream)is).getPosition()) { - - patchVersion = is.read_octet(); - - if (patchVersion == ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL) - setORBVersion(ORBVersionFactory.getJDK1_3_1_01()); - else if (patchVersion > ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL) - setORBVersion(ORBVersionFactory.getORBVersion()); - else - throw wrapper.invalidJdk131PatchLevel( new Integer( patchVersion ) ) ; - } - } - - - public OldJIDLObjectKeyTemplate( ORB orb, int magic, int scid, int serverid) - { - super( orb, magic, scid, serverid, JIDL_ORB_ID, JIDL_OAID ) ; - } - - public OldJIDLObjectKeyTemplate(ORB orb, int magic, int scid, InputStream is) - { - this( orb, magic, scid, is.read_long() ) ; - } - - protected void writeTemplate( OutputStream os ) - { - os.write_long( getMagic() ) ; - os.write_long( getSubcontractId() ) ; - os.write_long( getServerId() ) ; - } - - public void write(ObjectId objectId, OutputStream os) - { - super.write(objectId, os); - - if (patchVersion != OldJIDLObjectKeyTemplate.NULL_PATCH_VERSION) - os.write_octet( patchVersion ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java 2018-01-30 20:17:48.000000000 -0500 +++ /dev/null 2018-01-30 20:17:48.000000000 -0500 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior; - -import com.sun.corba.se.spi.ior.ObjectAdapterId ; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORBVersionFactory ; - -import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ; - -/** - * @author Ken Cavanaugh - */ -public abstract class OldObjectKeyTemplateBase extends ObjectKeyTemplateBase -{ - public OldObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid, - String orbid, ObjectAdapterId oaid ) - { - super( orb, magic, scid, serverid, orbid, oaid ) ; - - // set version based on magic - if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_OLD) - setORBVersion( ORBVersionFactory.getOLD() ) ; - else if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW) - setORBVersion( ORBVersionFactory.getNEW() ) ; - else // any other magic should not be here - throw wrapper.badMagic( new Integer( magic ) ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java 2018-01-30 20:17:48.000000000 -0500 +++ /dev/null 2018-01-30 20:17:48.000000000 -0500 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior; - -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.OctetSeqHolder ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORBVersionFactory ; - -import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ; - -/** - * @author Ken Cavanaugh - */ -public final class OldPOAObjectKeyTemplate extends OldObjectKeyTemplateBase -{ - /** This constructor reads the template ONLY from the stream - */ - public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is ) - { - this( orb, magic, scid, is.read_long(), is.read_long(), is.read_long() ) ; - } - - /** This constructor reads a complete ObjectKey (template and Id) - * from the stream. - */ - public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is, - OctetSeqHolder osh ) - { - this( orb, magic, scid, is ) ; - osh.value = readObjectKey( is ) ; - } - - public OldPOAObjectKeyTemplate( ORB orb, int magic, int scid, int serverid, - int orbid, int poaid) - { - super( orb, magic, scid, serverid, - Integer.toString( orbid ), - new ObjectAdapterIdNumber( poaid ) ) ; - } - - public void writeTemplate(OutputStream os) - { - os.write_long( getMagic() ) ; - os.write_long( getSubcontractId() ) ; - os.write_long( getServerId() ) ; - - int orbid = Integer.parseInt( getORBId() ) ; - os.write_long( orbid ) ; - - ObjectAdapterIdNumber oaid = (ObjectAdapterIdNumber)(getObjectAdapterId()) ; - int poaid = oaid.getOldPOAId() ; - os.write_long( poaid ) ; - } - - public ORBVersion getORBVersion() - { - if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_OLD) - return ORBVersionFactory.getOLD() ; - else if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_NEW) - return ORBVersionFactory.getNEW() ; - else - throw new INTERNAL() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java 2018-01-30 20:17:49.000000000 -0500 +++ /dev/null 2018-01-30 20:17:49.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior; - -import java.util.Iterator ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import org.omg.CORBA.OctetSeqHolder ; - -import com.sun.corba.se.spi.activation.POANameHelper ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORBVersionFactory ; - -import com.sun.corba.se.spi.ior.ObjectAdapterId ; - -import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ; - -public final class POAObjectKeyTemplate extends NewObjectKeyTemplateBase -{ - /** This constructor reads the template ONLY from the stream. - */ - public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is ) - { - super( orb, magic, scid, is.read_long(), is.read_string(), - new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ; - - setORBVersion( is ) ; - } - - /** This constructor reads a complete ObjectKey (template and Id) - * from the stream. - */ - public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is, - OctetSeqHolder osh ) - { - super( orb, magic, scid, is.read_long(), is.read_string(), - new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ; - - osh.value = readObjectKey( is ) ; - - setORBVersion( is ) ; - } - - public POAObjectKeyTemplate( ORB orb, int scid, int serverid, String orbid, - ObjectAdapterId objectAdapterId) - { - super( orb, ObjectKeyFactoryImpl.JAVAMAGIC_NEWER, scid, serverid, orbid, - objectAdapterId ) ; - - setORBVersion( ORBVersionFactory.getORBVersion() ) ; - } - - public void writeTemplate(OutputStream os) - { - os.write_long( getMagic() ) ; - os.write_long( getSubcontractId() ) ; - os.write_long( getServerId() ) ; - os.write_string( getORBId() ) ; - getObjectAdapterId().write( os ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java 2018-01-30 20:17:50.000000000 -0500 +++ /dev/null 2018-01-30 20:17:50.000000000 -0500 @@ -1,267 +0,0 @@ -/* - * Copyright (c) 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.ior; - -import java.io.ObjectInputStream ; -import java.io.ObjectOutputStream ; -import java.io.IOException ; -import java.io.StringWriter ; - -import org.omg.CORBA.ORB ; - -import org.omg.CORBA.portable.Delegate ; -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; - -// Be very careful: com.sun.corba imports must not depend on -// PEORB internal classes in ways that prevent portability to -// other vendor's ORBs. -import com.sun.corba.se.spi.presentation.rmi.StubAdapter ; -import com.sun.corba.se.impl.orbutil.HexOutputStream ; - -/** - * This class implements a very simply IOR representation - * which must be completely ORBImpl free so that this class - * can be used in the implementation of a portable StubDelegateImpl. - */ -public class StubIORImpl -{ - // cached hash code - private int hashCode; - - // IOR components - private byte[] typeData; - private int[] profileTags; - private byte[][] profileData; - - public StubIORImpl() - { - hashCode = 0 ; - typeData = null ; - profileTags = null ; - profileData = null ; - } - - public String getRepositoryId() - { - if (typeData == null) - return null ; - - return new String( typeData ) ; - } - - public StubIORImpl( org.omg.CORBA.Object obj ) - { - // write the IOR to an OutputStream and get an InputStream - OutputStream ostr = StubAdapter.getORB( obj ).create_output_stream(); - ostr.write_Object(obj); - InputStream istr = ostr.create_input_stream(); - - // read the IOR components back from the stream - int typeLength = istr.read_long(); - typeData = new byte[typeLength]; - istr.read_octet_array(typeData, 0, typeLength); - int numProfiles = istr.read_long(); - profileTags = new int[numProfiles]; - profileData = new byte[numProfiles][]; - for (int i = 0; i < numProfiles; i++) { - profileTags[i] = istr.read_long(); - profileData[i] = new byte[istr.read_long()]; - istr.read_octet_array(profileData[i], 0, profileData[i].length); - } - } - - public Delegate getDelegate( ORB orb ) - { - // write the IOR components to an org.omg.CORBA.portable.OutputStream - OutputStream ostr = orb.create_output_stream(); - ostr.write_long(typeData.length); - ostr.write_octet_array(typeData, 0, typeData.length); - ostr.write_long(profileTags.length); - for (int i = 0; i < profileTags.length; i++) { - ostr.write_long(profileTags[i]); - ostr.write_long(profileData[i].length); - ostr.write_octet_array(profileData[i], 0, profileData[i].length); - } - - InputStream istr = ostr.create_input_stream() ; - - // read the IOR back from the stream - org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object(); - return StubAdapter.getDelegate( obj ) ; - } - - public void doRead( java.io.ObjectInputStream stream ) - throws IOException, ClassNotFoundException - { - // read the IOR from the ObjectInputStream - int typeLength = stream.readInt(); - typeData = new byte[typeLength]; - stream.readFully(typeData); - int numProfiles = stream.readInt(); - profileTags = new int[numProfiles]; - profileData = new byte[numProfiles][]; - for (int i = 0; i < numProfiles; i++) { - profileTags[i] = stream.readInt(); - profileData[i] = new byte[stream.readInt()]; - stream.readFully(profileData[i]); - } - } - - public void doWrite( ObjectOutputStream stream ) - throws IOException - { - // write the IOR to the ObjectOutputStream - stream.writeInt(typeData.length); - stream.write(typeData); - stream.writeInt(profileTags.length); - for (int i = 0; i < profileTags.length; i++) { - stream.writeInt(profileTags[i]); - stream.writeInt(profileData[i].length); - stream.write(profileData[i]); - } - } - - /** - * Returns a hash code value for the object which is the same for all stubs - * that represent the same remote object. - * @return the hash code value. - */ - public synchronized int hashCode() - { - if (hashCode == 0) { - - // compute the hash code - for (int i = 0; i < typeData.length; i++) { - hashCode = hashCode * 37 + typeData[i]; - } - - for (int i = 0; i < profileTags.length; i++) { - hashCode = hashCode * 37 + profileTags[i]; - for (int j = 0; j < profileData[i].length; j++) { - hashCode = hashCode * 37 + profileData[i][j]; - } - } - } - - return hashCode; - } - - private boolean equalArrays( int[] data1, int[] data2 ) - { - if (data1.length != data2.length) - return false ; - - for (int ctr=0; ctr,[]data, ...]"} - * @return a string representation of this stub. - */ - public String toString() - { - StringBuffer result = new StringBuffer() ; - result.append( "SimpleIORImpl[" ) ; - String repositoryId = new String( typeData ) ; - result.append( repositoryId ) ; - for (int ctr=0; ctr32K - CodeSetsComponent - - none additional - JavaCodebaseComponent - - none additional - ORBTypeComponent - - none additional - PoliciesComponent - - none additional - -IdentifiableContainerBase (DONE) - - Test iteratorById on Identifiables (DONE) - - Iterator on id not present is empty (hasNext() == false) - - Iterator on id present returns all ids in sequence -IdEncapsulationContainerBase (DONE) - - Test read sequence of TaggedComponents - - Test writing sequence of TaggedComponents -GenericIdEncapsulation (DONE) - - Test by using for tagged profile and tagged component - - write out and read back test -IIOPAddress (DONE) - - Constructed object returns correct values - - equals: - - false for non-IIOPAddress value - - true iff ports and hosts match -IIOPProfile (DONE) - - construct from id, template; check that correct values are returned - - write out and read back - - no components for 1.0 - - components for >1.0 - - getObjectKey returns value constructed correctly - - isEquivalent iff ids equal and templates equivalent -IIOPProfileTemplate (DONE) - - Constructed object contains correct values - - isEquivalent iff address and template are equal - - cannot have new components added after makeImmutable call -IOR (DONE) - - Constructed object contains correct values - - IOR() has null typeid and no profiles (DONE) - - IOR( String ) has given typeid and no profiles (DONE) - - IOR( String, IIOPProfileTemplate, ObjectId ) has given typeid and - one IIOPProfile corresponding to template and objectid - - IOR( String, IORTemplate, ObjectId ) has profiles corresponding to - IORTemplate and ObjectIds. (DONE) - - IORTemplate( String, IORTemplate, ObjectIds ) has profiles - corresponding to IORTemplate and ObjectIds (DONE) - - IOR( IORTemplate, ObjectIds ) usual test (DONE) - - write out/read back test (DONE) - - Construct IOR with 2 IIOPProfiles, each with several components, - and 2 GenericIdEncapsulation profiles, write out, read back, - check for equals directly and by calling equals - - cannot have new profiles added after makeImmutable call (DONE) - - contained IIOPProfiles cannot have added components after - makeImmutable call. (DONE) -IORTemplate (DONE) - - Constructed object contains correct value -JIDLObjectKeyTemplate (DONE) - - test that IDs match expected values when created from - byte[] in ObjectKeyFactory.create - - Constructed object contains correct values - - write out and read back test - - getId correctly extract id from key -FreezableList (DONE) - - ASSUME that it acts like a linked list: don't test entire interface - - all modification operations throw UnsupportedOperationException - after makeImmutable call - - all iterators (whether created before or after makeImmutable call) - throw U.O.E. after makeImmutable -ObjectId (DONE) - - constructed object returns same id - - test cases in equals -ObjectKey (DONE) - - constructed object returns same id, template - - write/read test - - getBytes returns correct value (test by using factory and - comparing) -ObjectKeyFactory (DONE) - - test create with hand created keys - - key length < 4 - - key length >= 4 - - magic is JAVAMAGIC - - scid is POA scid - - scid is JIDL scid - - other scid - - magic is not JAVAMAGIC - - test with error cases on length -POAObjectKeyTemplate (DONE) - - test that IDs match expected values when created from - byte[] in ObjectKeyFactory.create - - test that IDs match when created with explicit values - - write out and read back test - - getId correctly extracts id from key -TaggedComponentFactories (DONE) - - only tested inditectly by reading and writing IIOPProfileTemplate - that contains all components -TaggedComponentFactoryFinder (DONE) - - registered factory can be looked up - - lookup of unregistered factory returns null - - reads tagged component from stream as correct type if registered - - reads tagged component from stream as generic if not registered -TaggedProfileFactoryFinder (DONE) - - reads IIOP profile as IIOPProfile - - reads others as Generic -WireObjectTemplate (DONE) - - getId returns entire key as id - - serverId is -1 - - write out and read back test - -Interfaces (no tests): - IdEncapsulation - IdEncapsulationFactory - IdEncapsulationFactoryFinder - Identifiable - ObjectKeyTemplateo - ObjectKeyTemplate - TaggedComponent - TaggedProfile - TaggedProfileTemplate - Writeable - -Trivial classes: - ObjectIds --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java 2018-01-30 20:17:53.000000000 -0500 +++ /dev/null 2018-01-30 20:17:53.000000000 -0500 @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior; - -import org.omg.CORBA.OctetSeqHolder ; - -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA_2_3.portable.InputStream ; - -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; - -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectAdapterId ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORBVersionFactory ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -import com.sun.corba.se.impl.encoding.CDRInputStream ; - -import com.sun.corba.se.impl.logging.IORSystemException ; - -/** - * @author Ken Cavanaugh - */ -public class WireObjectKeyTemplate implements ObjectKeyTemplate -{ - private ORB orb ; - private IORSystemException wrapper ; - - public boolean equals( Object obj ) - { - if (obj == null) - return false ; - - return obj instanceof WireObjectKeyTemplate ; - } - - public int hashCode() - { - return 53 ; // All WireObjectKeyTemplates are the same, so they should - // have the same hashCode. - } - - private byte[] getId( InputStream is ) - { - CDRInputStream cis = (CDRInputStream)is ; - int len = cis.getBufferLength() ; - byte[] result = new byte[ len ] ; - cis.read_octet_array( result, 0, len ) ; - return result ; - } - - public WireObjectKeyTemplate( ORB orb ) - { - initORB( orb ) ; - } - - public WireObjectKeyTemplate( InputStream is, OctetSeqHolder osh ) - { - osh.value = getId( is ) ; - initORB( (ORB)(is.orb())) ; - } - - private void initORB( ORB orb ) - { - this.orb = orb ; - wrapper = IORSystemException.get( orb, - CORBALogDomains.OA_IOR ) ; - } - - public void write( ObjectId id, OutputStream os ) - { - byte[] key = id.getId() ; - os.write_octet_array( key, 0, key.length ) ; - } - - public void write( OutputStream os ) - { - // Does nothing - } - - public int getSubcontractId() - { - return ORBConstants.DEFAULT_SCID ; - } - - /** While it might make sense to throw an exception here, this causes - * problems since we need to check whether unusual object references - * are local or not. It seems that the easiest way to handle this is - * to return an invalid server id. - */ - public int getServerId() - { - return -1 ; - } - - public String getORBId() - { - throw wrapper.orbIdNotAvailable() ; - } - - public ObjectAdapterId getObjectAdapterId() - { - throw wrapper.objectAdapterIdNotAvailable() ; - } - - /** Adapter ID is not available, since our - * ORB did not implement the object carrying this key. - */ - public byte[] getAdapterId() - { - throw wrapper.adapterIdNotAvailable() ; - } - - public ORBVersion getORBVersion() - { - return ORBVersionFactory.getFOREIGN() ; - } - - public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id ) - { - byte[] bid = id.getId() ; - String str = new String( bid ) ; - return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( str ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java 2018-01-30 20:17:54.000000000 -0500 +++ /dev/null 2018-01-30 20:17:54.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.ior.iiop; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.TaggedComponentBase ; - -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent ; - -import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ; - -/** - * @author Ken Cavanaugh - */ -public class AlternateIIOPAddressComponentImpl extends TaggedComponentBase - implements AlternateIIOPAddressComponent -{ - private IIOPAddress addr ; - - public boolean equals( Object obj ) - { - if (!(obj instanceof AlternateIIOPAddressComponentImpl)) - return false ; - - AlternateIIOPAddressComponentImpl other = - (AlternateIIOPAddressComponentImpl)obj ; - - return addr.equals( other.addr ) ; - } - - public int hashCode() - { - return addr.hashCode() ; - } - - public String toString() - { - return "AlternateIIOPAddressComponentImpl[addr=" + addr + "]" ; - } - - public AlternateIIOPAddressComponentImpl( IIOPAddress addr ) - { - this.addr = addr ; - } - - public IIOPAddress getAddress() - { - return addr ; - } - - public void writeContents(OutputStream os) - { - addr.write( os ) ; - } - - public int getId() - { - return TAG_ALTERNATE_IIOP_ADDRESS.value ; // 3 in CORBA 2.3.1 13.6.3 - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java 2018-01-30 20:17:54.000000000 -0500 +++ /dev/null 2018-01-30 20:17:54.000000000 -0500 @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.ior.iiop; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.TaggedComponentBase ; - -import com.sun.corba.se.spi.ior.iiop.CodeSetsComponent ; - -import org.omg.IOP.TAG_CODE_SETS ; - -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ; -import com.sun.corba.se.impl.encoding.MarshalOutputStream ; -import com.sun.corba.se.impl.encoding.MarshalInputStream ; - -public class CodeSetsComponentImpl extends TaggedComponentBase - implements CodeSetsComponent -{ - CodeSetComponentInfo csci ; - - public boolean equals( Object obj ) - { - if (!(obj instanceof CodeSetsComponentImpl)) - return false ; - - CodeSetsComponentImpl other = (CodeSetsComponentImpl)obj ; - - return csci.equals( other.csci ) ; - } - - public int hashCode() - { - return csci.hashCode() ; - } - - public String toString() - { - return "CodeSetsComponentImpl[csci=" + csci + "]" ; - } - - public CodeSetsComponentImpl() - { - // Uses our default code sets (see CodeSetComponentInfo) - csci = new CodeSetComponentInfo() ; - } - - public CodeSetsComponentImpl( InputStream is ) - { - csci = new CodeSetComponentInfo() ; - csci.read( (MarshalInputStream)is ) ; - } - - public CodeSetsComponentImpl(com.sun.corba.se.spi.orb.ORB orb) - { - if (orb == null) - csci = new CodeSetComponentInfo(); - else - csci = orb.getORBData().getCodeSetComponentInfo(); - } - - public CodeSetComponentInfo getCodeSetComponentInfo() - { - return csci ; - } - - public void writeContents(OutputStream os) - { - csci.write( (MarshalOutputStream)os ) ; - } - - public int getId() - { - return TAG_CODE_SETS.value ; // 1 in CORBA 2.3.1 13.6.3 - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java 2018-01-30 20:17:55.000000000 -0500 +++ /dev/null 2018-01-30 20:17:55.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior.iiop ; - -import org.omg.CORBA.BAD_PARAM ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; - -abstract class IIOPAddressBase implements IIOPAddress -{ - // Ports are marshalled as shorts on the wire. The IDL - // type is unsigned short, which lacks a convenient representation - // in Java in the 32768-65536 range. So, we treat ports as - // ints throught this code, except that marshalling requires a - // scaling conversion. intToShort and shortToInt are provided - // for this purpose. - protected short intToShort( int value ) - { - if (value > 32767) - return (short)(value - 65536) ; - return (short)value ; - } - - protected int shortToInt( short value ) - { - if (value < 0) - return value + 65536 ; - return value ; - } - - public void write( OutputStream os ) - { - os.write_string( getHost() ) ; - int port = getPort() ; - os.write_short( intToShort( port ) ) ; - } - - public boolean equals( Object obj ) - { - if (!(obj instanceof IIOPAddress)) - return false ; - - IIOPAddress other = (IIOPAddress)obj ; - - return getHost().equals(other.getHost()) && - (getPort() == other.getPort()) ; - } - - public int hashCode() - { - return getHost().hashCode() ^ getPort() ; - } - - public String toString() - { - return "IIOPAddress[" + getHost() + "," + getPort() + "]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java 2018-01-30 20:17:56.000000000 -0500 +++ /dev/null 2018-01-30 20:17:56.000000000 -0500 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior.iiop; - -import org.omg.CORBA.BAD_PARAM ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.orbutil.closure.Closure ; - -public final class IIOPAddressClosureImpl extends IIOPAddressBase -{ - private Closure host; - private Closure port; - - public IIOPAddressClosureImpl( Closure host, Closure port ) - { - this.host = host ; - this.port = port ; - } - - public String getHost() - { - return (String)(host.evaluate()) ; - } - - public int getPort() - { - Integer value = (Integer)(port.evaluate()) ; - return value.intValue() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java 2018-01-30 20:17:56.000000000 -0500 +++ /dev/null 2018-01-30 20:17:56.000000000 -0500 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.ior.iiop; - -import org.omg.CORBA.BAD_PARAM ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.IORSystemException ; - -public final class IIOPAddressImpl extends IIOPAddressBase -{ - private ORB orb ; - private IORSystemException wrapper ; - private String host; - private int port; - - public IIOPAddressImpl( ORB orb, String host, int port ) - { - this.orb = orb ; - wrapper = IORSystemException.get( orb, - CORBALogDomains.OA_IOR ) ; - - if ((port < 0) || (port > 65535)) - throw wrapper.badIiopAddressPort( new Integer(port)) ; - - this.host = host ; - this.port = port ; - } - - public IIOPAddressImpl( InputStream is ) - { - host = is.read_string() ; - short thePort = is.read_short() ; - port = shortToInt( thePort ) ; - } - - public String getHost() - { - return host ; - } - - public int getPort() - { - return port ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java 2018-01-30 20:17:57.000000000 -0500 +++ /dev/null 2018-01-30 20:17:57.000000000 -0500 @@ -1,348 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.ior.iiop; - -import java.util.List ; -import java.util.Iterator ; - -import org.omg.CORBA.SystemException ; - -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA_2_3.portable.InputStream ; - -import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ; -import org.omg.IOP.TAG_INTERNET_IOP; -import org.omg.IOP.TAG_JAVA_CODEBASE; - -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ; - -import com.sun.corba.se.spi.oa.ObjectAdapter ; -import com.sun.corba.se.spi.oa.ObjectAdapterFactory ; - -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectAdapterId ; -import com.sun.corba.se.spi.ior.TaggedProfile ; -import com.sun.corba.se.spi.ior.TaggedProfileTemplate ; -import com.sun.corba.se.spi.ior.ObjectKey ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.se.spi.ior.TaggedComponent ; -import com.sun.corba.se.spi.ior.IdentifiableBase ; -import com.sun.corba.se.spi.ior.IORFactories ; -import com.sun.corba.se.spi.ior.ObjectKeyFactory ; - -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.ior.iiop.IIOPFactories ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.se.spi.ior.iiop.JavaCodebaseComponent ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.ior.EncapsulationUtility ; - -import com.sun.corba.se.impl.encoding.EncapsInputStream ; -import com.sun.corba.se.impl.encoding.EncapsOutputStream ; - -import sun.corba.EncapsInputStreamFactory; - -import com.sun.corba.se.impl.util.JDKBridge; - -import com.sun.corba.se.impl.logging.IORSystemException; - -public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile -{ - private ORB orb ; - private IORSystemException wrapper ; - private ObjectId oid; - private IIOPProfileTemplate proftemp; - private ObjectKeyTemplate oktemp ; - - // Cached lookups - protected String codebase = null ; - protected boolean cachedCodebase = false; - - private boolean checkedIsLocal = false ; - private boolean cachedIsLocal = false ; - - // initialize-on-demand holder - private static class LocalCodeBaseSingletonHolder { - public static JavaCodebaseComponent comp ; - - static { - String localCodebase = JDKBridge.getLocalCodebase() ; - if (localCodebase == null) - comp = null ; - else - comp = IIOPFactories.makeJavaCodebaseComponent( - localCodebase ) ; - } - } - - private GIOPVersion giopVersion = null; - - public boolean equals( Object obj ) - { - if (!(obj instanceof IIOPProfileImpl)) - return false ; - - IIOPProfileImpl other = (IIOPProfileImpl)obj ; - - return oid.equals( other.oid ) && proftemp.equals( other.proftemp ) && - oktemp.equals( other.oktemp ) ; - } - - public int hashCode() - { - return oid.hashCode() ^ proftemp.hashCode() ^ oktemp.hashCode() ; - } - - public ObjectId getObjectId() - { - return oid ; - } - - public TaggedProfileTemplate getTaggedProfileTemplate() - { - return proftemp ; - } - - public ObjectKeyTemplate getObjectKeyTemplate() - { - return oktemp ; - } - - private IIOPProfileImpl( ORB orb ) - { - this.orb = orb ; - wrapper = IORSystemException.get( orb, - CORBALogDomains.OA_IOR ) ; - } - - public IIOPProfileImpl( ORB orb, ObjectKeyTemplate oktemp, ObjectId oid, - IIOPProfileTemplate proftemp ) - { - this( orb ) ; - this.oktemp = oktemp ; - this.oid = oid ; - this.proftemp = proftemp ; - } - - public IIOPProfileImpl( InputStream is ) - { - this( (ORB)(is.orb()) ) ; - init( is ) ; - } - - public IIOPProfileImpl( ORB orb, org.omg.IOP.TaggedProfile profile) - { - this( orb ) ; - - if (profile == null || profile.tag != TAG_INTERNET_IOP.value || - profile.profile_data == null) { - throw wrapper.invalidTaggedProfile() ; - } - - EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data, - profile.profile_data.length); - istr.consumeEndian(); - init( istr ) ; - } - - private void init( InputStream istr ) - { - // First, read all of the IIOP IOR data - GIOPVersion version = new GIOPVersion() ; - version.read( istr ) ; - IIOPAddress primary = new IIOPAddressImpl( istr ) ; - byte[] key = EncapsulationUtility.readOctets( istr ) ; - - ObjectKey okey = orb.getObjectKeyFactory().create( key ) ; - oktemp = okey.getTemplate() ; - oid = okey.getId() ; - - proftemp = IIOPFactories.makeIIOPProfileTemplate( orb, - version, primary ) ; - - // Handle any tagged components (if applicable) - if (version.getMinor() > 0) - EncapsulationUtility.readIdentifiableSequence( proftemp, - orb.getTaggedComponentFactoryFinder(), istr ) ; - - // If there is no codebase in this IOR and there IS a - // java.rmi.server.codebase property set, we need to - // update the IOR with the local codebase. Note that - // there is only one instance of the local codebase, but it - // can be safely shared in multiple IORs since it is immutable. - if (uncachedGetCodeBase() == null) { - JavaCodebaseComponent jcc = LocalCodeBaseSingletonHolder.comp ; - - if (jcc != null) { - if (version.getMinor() > 0) - proftemp.add( jcc ) ; - - codebase = jcc.getURLs() ; - } - - // Whether codebase is null or not, we have it, - // and so getCodebase ned never call uncachedGetCodebase. - cachedCodebase = true; - } - } - - public void writeContents(OutputStream os) - { - proftemp.write( oktemp, oid, os ) ; - } - - public int getId() - { - return proftemp.getId() ; - } - - public boolean isEquivalent( TaggedProfile prof ) - { - if (!(prof instanceof IIOPProfile)) - return false ; - - IIOPProfile other = (IIOPProfile)prof ; - - return oid.equals( other.getObjectId() ) && - proftemp.isEquivalent( other.getTaggedProfileTemplate() ) && - oktemp.equals( other.getObjectKeyTemplate() ) ; - } - - public ObjectKey getObjectKey() - { - ObjectKey result = IORFactories.makeObjectKey( oktemp, oid ) ; - return result ; - } - - public org.omg.IOP.TaggedProfile getIOPProfile() - { - EncapsOutputStream os = - sun.corba.OutputStreamFactory.newEncapsOutputStream(orb); - os.write_long( getId() ) ; - write( os ) ; - InputStream is = (InputStream)(os.create_input_stream()) ; - return org.omg.IOP.TaggedProfileHelper.read( is ) ; - } - - private String uncachedGetCodeBase() { - Iterator iter = proftemp.iteratorById( TAG_JAVA_CODEBASE.value ) ; - - if (iter.hasNext()) { - JavaCodebaseComponent jcbc = (JavaCodebaseComponent)(iter.next()) ; - return jcbc.getURLs() ; - } - - return null ; - } - - public synchronized String getCodebase() { - if (!cachedCodebase) { - cachedCodebase = true ; - codebase = uncachedGetCodeBase() ; - } - - return codebase ; - } - - /** - * @return the ORBVersion associated with the object key in the IOR. - */ - public ORBVersion getORBVersion() { - return oktemp.getORBVersion(); - } - - public synchronized boolean isLocal() - { - if (!checkedIsLocal) { - checkedIsLocal = true ; - String host = proftemp.getPrimaryAddress().getHost() ; - - cachedIsLocal = orb.isLocalHost(host) && - orb.isLocalServerId(oktemp.getSubcontractId(), - oktemp.getServerId()) && - orb.getLegacyServerSocketManager() - .legacyIsLocalServerPort( - proftemp.getPrimaryAddress().getPort()); - } - - return cachedIsLocal ; - } - - /** Return the servant for this IOR, if it is local AND if the OA that - * implements this objref supports direct access to servants outside of an - * invocation. - * XXX revisit: do we want this at all? If we do, it might move to the - * ObjectKeyTemplate instead. - */ - public java.lang.Object getServant() - { - if (!isLocal()) - return null ; - - RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ; - ObjectAdapterFactory oaf = scr.getObjectAdapterFactory( - oktemp.getSubcontractId() ) ; - - ObjectAdapterId oaid = oktemp.getObjectAdapterId() ; - ObjectAdapter oa = null ; - - try { - oa = oaf.find( oaid ) ; - } catch (SystemException exc) { - // Could not find the OA, so just return null. - // This usually happens when POAs are being deleted, - // and the POA always return null for getLocalServant anyway. - wrapper.getLocalServantFailure( exc, oaid.toString() ) ; - return null ; - } - - byte[] boid = oid.getId() ; - java.lang.Object servant = oa.getLocalServant( boid ) ; - return servant ; - } - - /** - * Return GIOPVersion for this IOR. - * Requests created against this IOR will be of the - * return Version. - */ - public synchronized GIOPVersion getGIOPVersion() - { - return proftemp.getGIOPVersion() ; - } - - public void makeImmutable() - { - proftemp.makeImmutable() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java 2018-01-30 20:17:58.000000000 -0500 +++ /dev/null 2018-01-30 20:17:58.000000000 -0500 @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.ior.iiop; - -import java.util.Iterator ; - -import org.omg.IOP.TAG_INTERNET_IOP ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.TaggedComponent ; -import com.sun.corba.se.spi.ior.TaggedProfile ; -import com.sun.corba.se.spi.ior.TaggedProfileTemplate ; -import com.sun.corba.se.spi.ior.TaggedProfileTemplateBase ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.IdentifiableContainerBase ; -import com.sun.corba.se.spi.ior.IdentifiableBase ; - -import com.sun.corba.se.impl.ior.EncapsulationUtility ; - -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.iiop.IIOPFactories ; - -import com.sun.corba.se.impl.encoding.EncapsOutputStream ; - -import com.sun.corba.se.impl.encoding.CDROutputStream ; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.se.spi.orb.ORB ; - -/** - * If getMinorVersion==0, this does not contain any tagged components - */ -public class IIOPProfileTemplateImpl extends TaggedProfileTemplateBase - implements IIOPProfileTemplate -{ - private ORB orb ; - private GIOPVersion giopVersion ; - private IIOPAddress primary ; - - public boolean equals( Object obj ) - { - if (!(obj instanceof IIOPProfileTemplateImpl)) - return false ; - - IIOPProfileTemplateImpl other = (IIOPProfileTemplateImpl)obj ; - - return super.equals( obj ) && giopVersion.equals( other.giopVersion ) && - primary.equals( other.primary ) ; - } - - public int hashCode() - { - return super.hashCode() ^ giopVersion.hashCode() ^ primary.hashCode() ; - } - - public TaggedProfile create( ObjectKeyTemplate oktemp, ObjectId id ) - { - return IIOPFactories.makeIIOPProfile( orb, oktemp, id, this ) ; - } - - public GIOPVersion getGIOPVersion() - { - return giopVersion ; - } - - public IIOPAddress getPrimaryAddress() - { - return primary ; - } - - public IIOPProfileTemplateImpl( ORB orb, GIOPVersion version, IIOPAddress primary ) - { - this.orb = orb ; - this.giopVersion = version ; - this.primary = primary ; - if (giopVersion.getMinor() == 0) - // Adding tagged components is not allowed for IIOP 1.0, - // so this template is complete and should be made immutable. - makeImmutable() ; - } - - public IIOPProfileTemplateImpl( InputStream istr ) - { - byte major = istr.read_octet() ; - byte minor = istr.read_octet() ; - giopVersion = GIOPVersion.getInstance( major, minor ) ; - primary = new IIOPAddressImpl( istr ) ; - orb = (ORB)(istr.orb()) ; - // Handle any tagged components (if applicable) - if (minor > 0) - EncapsulationUtility.readIdentifiableSequence( - this, orb.getTaggedComponentFactoryFinder(), istr ) ; - - makeImmutable() ; - } - - public void write( ObjectKeyTemplate okeyTemplate, ObjectId id, OutputStream os) - { - giopVersion.write( os ) ; - primary.write( os ) ; - - // Note that this is NOT an encapsulation: do not marshal - // the endianness flag. However, the length is required. - // Note that this cannot be accomplished with a codec! - - // Use the byte order of the given stream - OutputStream encapsulatedOS = - sun.corba.OutputStreamFactory.newEncapsOutputStream( - (ORB)os.orb(), ((CDROutputStream)os).isLittleEndian() ) ; - - okeyTemplate.write( id, encapsulatedOS ) ; - EncapsulationUtility.writeOutputStream( encapsulatedOS, os ) ; - - if (giopVersion.getMinor() > 0) - EncapsulationUtility.writeIdentifiableSequence( this, os ) ; - } - - /** Write out this IIOPProfileTemplateImpl only. - */ - public void writeContents( OutputStream os) - { - giopVersion.write( os ) ; - primary.write( os ) ; - - if (giopVersion.getMinor() > 0) - EncapsulationUtility.writeIdentifiableSequence( this, os ) ; - } - - public int getId() - { - return TAG_INTERNET_IOP.value ; - } - - public boolean isEquivalent( TaggedProfileTemplate temp ) - { - if (!(temp instanceof IIOPProfileTemplateImpl)) - return false ; - - IIOPProfileTemplateImpl tempimp = (IIOPProfileTemplateImpl)temp ; - - return primary.equals( tempimp.primary ) ; - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java 2018-01-30 20:17:58.000000000 -0500 +++ /dev/null 2018-01-30 20:17:58.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.ior.iiop; - -import org.omg.IOP.TAG_JAVA_CODEBASE ; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.TaggedComponentBase ; - -import com.sun.corba.se.spi.ior.iiop.JavaCodebaseComponent ; - -public class JavaCodebaseComponentImpl extends TaggedComponentBase - implements JavaCodebaseComponent -{ - private String URLs ; - - public boolean equals( Object obj ) - { - if (obj == null) - return false ; - - if (!(obj instanceof JavaCodebaseComponentImpl)) - return false ; - - JavaCodebaseComponentImpl other = (JavaCodebaseComponentImpl)obj ; - - return URLs.equals( other.getURLs() ) ; - } - - public int hashCode() - { - return URLs.hashCode() ; - } - - public String toString() - { - return "JavaCodebaseComponentImpl[URLs=" + URLs + "]" ; - } - - public String getURLs() - { - return URLs ; - } - - public JavaCodebaseComponentImpl( String URLs ) - { - this.URLs = URLs ; - } - - public void writeContents(OutputStream os) - { - os.write_string( URLs ) ; - } - - public int getId() - { - return TAG_JAVA_CODEBASE.value ; // 25 in CORBA 2.3.1 13.6.3 - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java 2018-01-30 20:17:59.000000000 -0500 +++ /dev/null 2018-01-30 20:17:59.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.ior.iiop; - -import org.omg.CORBA_2_3.portable.OutputStream; - -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.TaggedComponentBase; - -/** - * Tagged component that contains a value that indicates the Java - * serialization version supported by the ORB. - * - * ORB Java serialization uses IIOP as the transport protocol, but uses - * Java serialization mechanism and its accompanying encodings, instead - * of IIOP CDR serialization mechanism. Java serialization is generally - * observed to be faster than CDR. - */ -public class JavaSerializationComponent extends TaggedComponentBase { - - private byte version; - - private static JavaSerializationComponent singleton; - - public static JavaSerializationComponent singleton() { - if (singleton == null) { - synchronized (JavaSerializationComponent.class) { - singleton = - new JavaSerializationComponent(Message.JAVA_ENC_VERSION); - } - } - return singleton; - } - - public JavaSerializationComponent(byte version) { - this.version = version; - } - - public byte javaSerializationVersion() { - return this.version; - } - - public void writeContents(OutputStream os) { - os.write_octet(version); - } - - public int getId() { - return ORBConstants.TAG_JAVA_SERIALIZATION_ID; - } - - public boolean equals(Object obj) { - if (!(obj instanceof JavaSerializationComponent)) { - return false; - } - JavaSerializationComponent other = (JavaSerializationComponent) obj; - return this.version == other.version; - } - - public int hashCode() { - return this.version; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java 2018-01-30 20:18:00.000000000 -0500 +++ /dev/null 2018-01-30 20:18:00.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.impl.ior.iiop; - -import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT; - -import org.omg.CORBA_2_3.portable.OutputStream; - -import javax.rmi.CORBA.Util; -import javax.rmi.CORBA.ValueHandler; -import javax.rmi.CORBA.ValueHandlerMultiFormat; - -import com.sun.corba.se.impl.orbutil.ORBUtility; - -import com.sun.corba.se.spi.ior.TaggedComponentBase; - -import com.sun.corba.se.spi.ior.iiop.MaxStreamFormatVersionComponent; - -// Java to IDL ptc 02-01-12 1.4.11 -// TAG_RMI_CUSTOM_MAX_STREAM_FORMAT -public class MaxStreamFormatVersionComponentImpl extends TaggedComponentBase - implements MaxStreamFormatVersionComponent -{ - private byte version; - - public static final MaxStreamFormatVersionComponentImpl singleton - = new MaxStreamFormatVersionComponentImpl(); - - public boolean equals(Object obj) - { - if (!(obj instanceof MaxStreamFormatVersionComponentImpl)) - return false ; - - MaxStreamFormatVersionComponentImpl other = - (MaxStreamFormatVersionComponentImpl)obj ; - - return version == other.version ; - } - - public int hashCode() - { - return version ; - } - - public String toString() - { - return "MaxStreamFormatVersionComponentImpl[version=" + version + "]" ; - } - - public MaxStreamFormatVersionComponentImpl() - { - version = ORBUtility.getMaxStreamFormatVersion(); - } - - public MaxStreamFormatVersionComponentImpl(byte streamFormatVersion) { - version = streamFormatVersion; - } - - public byte getMaxStreamFormatVersion() - { - return version; - } - - public void writeContents(OutputStream os) - { - os.write_octet(version); - } - - public int getId() - { - return TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java 2018-01-30 20:18:00.000000000 -0500 +++ /dev/null 2018-01-30 20:18:00.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.ior.iiop; - -import org.omg.IOP.TAG_ORB_TYPE ; - -import com.sun.corba.se.spi.ior.TaggedComponentBase ; - -import com.sun.corba.se.spi.ior.iiop.ORBTypeComponent ; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -/** - * @author Ken Cavanaugh - */ -public class ORBTypeComponentImpl extends TaggedComponentBase - implements ORBTypeComponent -{ - private int ORBType; - - public boolean equals( Object obj ) - { - if (!(obj instanceof ORBTypeComponentImpl)) - return false ; - - ORBTypeComponentImpl other = (ORBTypeComponentImpl)obj ; - - return ORBType == other.ORBType ; - } - - public int hashCode() - { - return ORBType ; - } - - public String toString() - { - return "ORBTypeComponentImpl[ORBType=" + ORBType + "]" ; - } - - public ORBTypeComponentImpl(int ORBType) - { - this.ORBType = ORBType ; - } - - public int getId() - { - return TAG_ORB_TYPE.value ; // 0 in CORBA 2.3.1 13.6.3 - } - - public int getORBType() - { - return ORBType ; - } - - public void writeContents(OutputStream os) - { - os.write_ulong( ORBType ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java 2018-01-30 20:18:01.000000000 -0500 +++ /dev/null 2018-01-30 20:18:01.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.ior.iiop; - -import org.omg.CORBA_2_3.portable.OutputStream; - -import com.sun.corba.se.spi.ior.TaggedComponentBase; -import com.sun.corba.se.spi.ior.iiop.RequestPartitioningComponent; -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.orbutil.ORBConstants; - - -public class RequestPartitioningComponentImpl extends TaggedComponentBase - implements RequestPartitioningComponent -{ - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.get( CORBALogDomains.OA_IOR ) ; - - private int partitionToUse; - - public boolean equals(Object obj) - { - if (!(obj instanceof RequestPartitioningComponentImpl)) - return false ; - - RequestPartitioningComponentImpl other = - (RequestPartitioningComponentImpl)obj ; - - return partitionToUse == other.partitionToUse ; - } - - public int hashCode() - { - return partitionToUse; - } - - public String toString() - { - return "RequestPartitioningComponentImpl[partitionToUse=" + partitionToUse + "]" ; - } - - public RequestPartitioningComponentImpl() - { - partitionToUse = 0; - } - - public RequestPartitioningComponentImpl(int thePartitionToUse) { - if (thePartitionToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID || - thePartitionToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) { - throw wrapper.invalidRequestPartitioningComponentValue( - new Integer(thePartitionToUse), - new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID), - new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID)); - } - partitionToUse = thePartitionToUse; - } - - public int getRequestPartitioningId() - { - return partitionToUse; - } - - public void writeContents(OutputStream os) - { - os.write_ulong(partitionToUse); - } - - public int getId() - { - return ORBConstants.TAG_REQUEST_PARTITIONING_ID; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/ior/notes 2018-01-30 20:18:02.000000000 -0500 +++ /dev/null 2018-01-30 20:18:02.000000000 -0500 @@ -1,317 +0,0 @@ -Notes on IOR implementation - -1. Writeable is an interface that can write itself to an OutputStream. - -2. IdEncapsulation is a particular kind of Writeable that has an Id and - an Encapsulation (a sequence of bytes) representing some other structure - in a CDR encapsulation. - -3. ContainerBase is a base class for containers of IdEncapsulations. - -4. An IOR is a ContainerBase. - -5. A TaggedComponent is not a ContainerBase. - -6. Some (not all) Profiles are ContainerBases. - -7. IIOPAddress contains (host, port) - IIOPServerLocation contains: - - A primary IIOPAddress - - 0 or more secondary IIOPAddresses (these get placed in - TAG_ALTERNATE_IIOP_ADDRESS components) - -8. IIOPProfileTemplate: - - major, minor version - - 0 or more TaggedComponents - - ObjectKeyTemplate - -9. ObjectKeyTemplate: - - contains only wire data, not internal structures - - write( object id, output stream ): write the object key out - to the output stream with the given object id - -10. Significant problem: must of the dispatch path code is written in terms of - IORs when it should be based on profiles. Only a single profile is used in - a request, and that is what should be passed around. This needs fixing soon - to accommodate the eventual implementation of CORBA FT, and also to work - properly with the new IOR. - -11. Another question: since profile contains key which contains scid, what if - we have multiple profiles with different scids? - One answer: create a cluster subcontract that invokes the individual - profiles for FT. This may not mesh well with the FT spec. - -12. Uses of IORs in the ORB: - -Activation/ServerManagerImpl.java - - Construct IOR for bad ID handler location forward -corba/ClientDelegate.java - - marshal, getIOR, unmarshal are all questionable and make - poor use of IOR. - - gets forwarded IOR from response - - IORs handled in some service contexts - - createRequest needs to parse IOR - - gets the (one) IIOP profile that we care about - - gets the object key -corba/InitialNamingClient.java - - constructs IOR from address info, object key - - current implementation should use AlternateIIOPAddress components - - constructs IOR with key "INIT" for old bootstrap -corba/ORB.java - - stringify and destringify IOR -corba/ServerDelegate.java - - access IOR from sending context service context - - destroyObjref directly access transient key from a known offset. - - creation sets up key inline with known offsets -core/IOR.java - - IOR sometimes stores a servant - - IOR contains the following - - Object servant - - Endpoint ep - - String codebase - - boolean cachedCodebase - - TaggedComponent localCodeBaseTC - - InternetIOPTag - - The two constructors that take full args also - construct tagged components - - will need alternate address components for INS -core/SendingContextServiceContext.java - - reads IOR from input stream -iiop/CDRInputStream.java - - needs type id, code base from IOR -iiop/IIOPOutputStream.java - - needs to access objkey as a sequence of bytes to realing requests. -POA/GenericPOAClientSC.java - - needs to pull POA ID out of object key - - needs to created a new IOR that has an updated scid -POA/GenericPOAServerSC.java - - creates IORs -TransactionalPOA/TransactionalServerSC.java - - inline access to known offset in object key to - determine whether transactional - -Guide to the files: - -Basic Interfaces: - Identifiable.java (Object has an Id) - Writeable.java (Object can write to OutputStream) - IdEncapsulation.java (Writeable, Identifiable interface) - IdEncapsulationFactory.java (Factory interface for IdEncapsulation) - IdEncapsulationFactoryFinder.java (Finder interface for IdEncapsulationFactoryFinder) - - IIOPAddress.java (class containing host and port for IIOP) - -Basic support for IdEncapsulations (shared for components and profiles): - GenericIdEncapsulation.java (Has id, octet sequence: used for generic - TaggedComponent and TaggedProfile objects) - FreezableList.java (Delegated implementation of List that can be made - immutable after construction) - IdentifiableContainerBase.java (extends FreezableList: container of Identifiable: - supports iteratorById.) - IdEncapsulationContainerBase.java (extends IdenitifableContainerBase: - container of IdEncapsulation: supports read/write IdEncapsulationSequence) - -Object Keys: - ObjectKeyFactory.java - ObjectKeyTemplate.java (interface for the following:) - JIDLObjectKeyTemplate.java (object key used in *Delegate) - POAObjectKeyTemplate.java (object key used in GenericPOA*SC) - WireObjectKeyTemplate.java (used for non-Sun ORB IORs) - ObjectId.java (a simple wrapper for byte[]) - ObjectKey.java (contains ObjectId and ObjectKeyTemplate) - -Components: - TaggedComponentFactories.java (contains method for registering factories) - TaggedComponentFactoryFinder.java (contains registered factories) - TaggedComponent.java (interface of all tagged components) - AlternateIIOPAddressComponent.java - CodeSetsComponent.java - JavaCodebaseComponent.java - ORBTypeComponent.java - PoliciesComponent.java - -Profiles: - IIOPProfile.java (IIOPProfileTemplate and ObjectId) - IIOPProfileTemplate.java (contains version, address, ObjectKeyTemplate, - list of TaggedComponent) - TaggedProfile.java (interface for all TaggedProfiles) - TaggedProfileFactoryFinder.java - TaggedProfileTemplate.java - -IOR: - IOR.java - IORTemplate.java (List of IIOPProfileTemplate - ObjectIds.java (List of ObjectId: needed for an IOR constructor) - -Notes from integration code review: - -General: - - Look at making IOR API public, or - move everything into com.sun.corba.se.impl.ior - (don't hold up putback for this) - Making public: - - Writeable needs getBytes() as well as write() - methods. - - codec can be used with an Any to convert between - IDL data type and sequence of bytes. - - write() needs to use getBytes, then write id, length, - octets to output stream. - - getBytes() method needs to get typecode from IDL - then create Any. - - IdEncapsulations need to have constructor that takes - byte[] (encapsulation of value). - Why not? - - Unencapsulated object keys can't be made portable - - Lots of dependencies on ORB code in ObjectKey support - Conclusion: - - move to internal (DONE) - - JAVA_MAGIC should move to ObjectKeyTemplates (DONE) - - check for intToBytes/bytesToInt related to object key - corba/ServerDelegate (DONE) - POA/GenericPOAServerSC (DONE) - POA/SubcontractResponseHandler (DONE) - TransactionalPOA/TransactionalClientSC.java (DONE) - TransactionalPOA/TransactionalServerSC.java (DONE) - -./com/sun/corba/se/impl/cosnaming/BootstrapServer.java - - remove sc_init_key_* (DONE) - -./com/sun/corba/se/impl/poa/POAImpl.java - - remove line 130: comment on other endpoints, e.g. SSL (DONE) - - add revisit comment on line 133: use multiple server port API (DONE) - -./com/sun/corba/se/impl/corba/ORB.java - - object_to_string: add comment that connect only takes place in - non-POA cases. (DONE) - -./com/sun/corba/se/impl/corba/ServerDelegate.java - - chase down the object key offsets (DONE) - (search for bytesToInt and intToBytes) - -./com/sun/corba/se/impl/core/SubcontractRegistry.java - - getServerSubcontract: add b-e l-e comment and history on INIT, TINI (DONE) - - getServerSubcontract: reference to constants (May not do this?) - - getServerSubcontract: return null at end IS reachable, in the - case where we have essentially a name in the key that isn't - one of the ones we support. Throw an exception? (DONE) - - add minor code for INTERNAL (and string) (DONE) - - remove setId calls in callers to getClientSubcontract (DONE) - - throw INTERNAL exception for temp.size() != 1 case (DONE) - Think about INST corbaloc problems (multi-profile IORs) - both return nulls should throw exceptions (DONE) - -./com/sun/corba/se/impl/core/IOR.java - - Add some comments to getIORfromString about 4/2 constants (DONE) - - fix name: should be getIORFromString (DONE) - - IOR( InputStream ) has a problem with cachedCodeBase: - is should not call getCodeBase: must refactor to - an internal implementation method. (DONE) - - isEquivalent and isLocal should assert failure - if multiple profiles (through exception in getProfile) (DONE) - (add comments about multi case) - -./com/sun/corba/se/impl/iiop/CDRInputStream_1_0.java - - read_Object: add assert in case servant is not Tie or objref (DONE) - -./com/sun/corba/se/internal/TransactionalPOA/TransactionalPOAImpl.java - - add comment about transactionalIortemplate: goes away after - we get to OTS 1.2 transactional policy. (DONE) - - change transactionalClone( ObjectKeyTemplate ) so that - we get an error (INTERNAL) if NOT POAObjectKeyTemplate (DONE) - - line 138: get string constant from - org.omg.CosTransactions.TransactionalObject (DONE) - - remove Delegate d decl. (DONE) - -We need to assign minor codes for all exceptions! - -We need to clean up the minor code base usage! (DONE) - -Add equals/toString to: - Do not try to develop a reflective universal equals: too slow! - Do we really want equals on lists? - If we do, define collectionEqual on FreezableList - -CodeSetsComponent: toString -FreezableList: basic toString, equals methods -IIOPProfile: toString -IIOPProfileTemplate: toString -IOR: toString -IORTemplate.java: toString, equals (inherit?) -IdEncapsulationContainerBase.java: make abstract, but provide base toString/equals -IdentifiableContainerBase.java: make abstract (no other changes) - (ContainerBase classes need some explanation) -ObjectIds.java needs toString, equals (use FreezableList?) -ObjectKey: toString -ObjectKeyFactory.java: singleton: don't add toString or equals -PoliciesComponent.java: should finish this sometime (after we figure out - exactly what to do with it) -TaggedComponentBase.java: should be abstract -TaggedComponentFactories.java: a singelton -TaggedComponentFactoryFinder.java: a singleton -TaggedProfileFactoryFinder.java: a singleton -JIDLObjectKeyTemplate: toString -POAObjectKeyTemplate: toString -WireObjectKeyTemplate: toString uninteresting: no data, equals not useful - -use util/Utility.objectToString to implement toString methods. - -Other changes: - - IIOPAddress.toString should include class name (DONE) - - New tests needed: - IIOPProfile.getIOPComponents - IIOPProfile.getIOPProfile - GenericTaggedProfile.getIOPComponents - GenericTaggedProfile.getIOPProfile - GenericTaggedComponent.getIOPComponent - ObjectKeyTemplate.getAdapterId - - Plus, do a read/write test for IOP stuff: - construct profile - convert to IOP.TaggedProfile - write to stream - get input stream - construct profile - check for equal - - do some tests on IOR.toString() just to see what gets printed. - - Add getAdapterId to *ObjectKeyTemplate.java (DONE) - Add some tests for this: - - WireObjectKeyTemplate throws an exception - - Identically constructed ObjectKeyTemplates produce identical Adapter Ids. - - Different OKTs produce different adapter IDs. - -New tests for versioning support: - -ORBVersionFactory: - - for create array methods (DONE) - - returns expected values for version encodings - - throws INTERNAL for negative version - - test one case for create stream method (DONE) - - getORBVersion returns correct version (DONE) -ORBVersionImpl: - - check equals on some ORBVersions (DONE) - - check that each ORBVersion returns correct orbtype (DONE) -JIDLObjectKeyTemplate: - - non-key constructor gives NEWER version (DONE) -POAObjectKeyTemplate: - - non-key constructor gives NEWER version (DONE) -OldJIDLObjectKeyTemplate: (DONE) - - non-key constructor with OLD, NEW MAGIC and check version - - other values throw exception -OldPOAObjectKeyTemplate: (DONE) - - non-key constructor with OLD, NEW MAGIC and check version (DONE) - - other values throw exception (DONE) -WireObjectKeyTemplate (DONE) - - version is FOREIGN -ObjectKeyFactory (DONE) - create the following keys and check results: - JIDL OLD OldJIDL with correct magic, version - JIDL NEW OldJIDL - JIDL NEWER JIDL - POA OLD OldPOA - POA NEW OldPOA - POA NEWER POA --- old/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java 2018-01-30 20:18:02.000000000 -0500 +++ /dev/null 2018-01-30 20:18:02.000000000 -0500 @@ -1,214 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.javax.rmi.CORBA; - -import java.io.IOException; - -import java.rmi.RemoteException; - -import javax.rmi.CORBA.Tie; - -import org.omg.CORBA.ORB; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.BAD_OPERATION; -import org.omg.CORBA.BAD_INV_ORDER; - -import org.omg.CORBA.portable.Delegate; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.portable.InputStream; - -import com.sun.corba.se.spi.presentation.rmi.StubAdapter; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.util.Utility; - -import com.sun.corba.se.impl.ior.StubIORImpl ; -import com.sun.corba.se.impl.presentation.rmi.StubConnectImpl ; - -import com.sun.corba.se.impl.logging.UtilSystemException ; - -/** - * Base class from which all static RMI-IIOP stubs must inherit. - */ -public class StubDelegateImpl implements javax.rmi.CORBA.StubDelegate -{ - static UtilSystemException wrapper = UtilSystemException.get( - CORBALogDomains.RMIIIOP ) ; - - private StubIORImpl ior ; - - public StubIORImpl getIOR() - { - return ior ; - } - - public StubDelegateImpl() - { - ior = null ; - } - - /** - * Sets the IOR components if not already set. - */ - private void init (javax.rmi.CORBA.Stub self) - { - // If the Stub is not connected to an ORB, BAD_OPERATION exception - // will be raised by the code below. - if (ior == null) - ior = new StubIORImpl( self ) ; - } - - /** - * Returns a hash code value for the object which is the same for all stubs - * that represent the same remote object. - * @return the hash code value. - */ - public int hashCode(javax.rmi.CORBA.Stub self) - { - init(self); - return ior.hashCode() ; - } - - /** - * Compares two stubs for equality. Returns true when used to compare stubs - * that represent the same remote object, and false otherwise. - * @param obj the reference object with which to compare. - * @return true if this object is the same as the obj - * argument; false otherwise. - */ - public boolean equals(javax.rmi.CORBA.Stub self, java.lang.Object obj) - { - if (self == obj) { - return true; - } - - if (!(obj instanceof javax.rmi.CORBA.Stub)) { - return false; - } - - // no need to call init() because of calls to hashCode() below - - javax.rmi.CORBA.Stub other = (javax.rmi.CORBA.Stub) obj; - if (other.hashCode() != self.hashCode()) { - return false; - } - - // hashCodes being the same does not mean equality. The stubs still - // could be pointing to different IORs. So, do a literal comparison. - // Apparently the ONLY way to do this (other than using private - // reflection) toString, because it is not possible to directly - // access the StubDelegateImpl from the Stub. - return self.toString().equals( other.toString() ) ; - } - - public boolean equals( Object obj ) - { - if (this == obj) - return true ; - - if (!(obj instanceof StubDelegateImpl)) - return false ; - - StubDelegateImpl other = (StubDelegateImpl)obj ; - - if (ior == null) - return ior == other.ior ; - else - return ior.equals( other.ior ) ; - } - - public int hashCode() { - if (ior == null) { - return 0; - } else { - return ior.hashCode(); - } - } - - /** - * Returns a string representation of this stub. Returns the same string - * for all stubs that represent the same remote object. - * @return a string representation of this stub. - */ - public String toString(javax.rmi.CORBA.Stub self) - { - if (ior == null) - return null ; - else - return ior.toString() ; - } - - /** - * Connects this stub to an ORB. Required after the stub is deserialized - * but not after it is demarshalled by an ORB stream. If an unconnected - * stub is passed to an ORB stream for marshalling, it is implicitly - * connected to that ORB. Application code should not call this method - * directly, but should call the portable wrapper method - * {@link javax.rmi.PortableRemoteObject#connect}. - * @param orb the ORB to connect to. - * @exception RemoteException if the stub is already connected to a different - * ORB, or if the stub does not represent an exported remote or local object. - */ - public void connect(javax.rmi.CORBA.Stub self, ORB orb) - throws RemoteException - { - ior = StubConnectImpl.connect( ior, self, self, orb ) ; - } - - /** - * Serialization method to restore the IOR state. - */ - public void readObject(javax.rmi.CORBA.Stub self, - java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException - { - if (ior == null) - ior = new StubIORImpl() ; - - ior.doRead( stream ) ; - } - - /** - * Serialization method to save the IOR state. - * @serialData The length of the IOR type ID (int), followed by the IOR type ID - * (byte array encoded using ISO8859-1), followed by the number of IOR profiles - * (int), followed by the IOR profiles. Each IOR profile is written as a - * profile tag (int), followed by the length of the profile data (int), followed - * by the profile data (byte array). - */ - public void writeObject(javax.rmi.CORBA.Stub self, - java.io.ObjectOutputStream stream) throws IOException - { - init(self); - ior.doWrite( stream ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java 2018-01-30 20:18:03.000000000 -0500 +++ /dev/null 2018-01-30 20:18:03.000000000 -0500 @@ -1,778 +0,0 @@ -/* - * Copyright (c) 1999, 2015, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.javax.rmi.CORBA; // Util (sed marker, don't remove!) - -import java.rmi.RemoteException; -import java.rmi.UnexpectedException; -import java.rmi.MarshalException; - -import java.rmi.server.RMIClassLoader; - -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.Properties; -import java.util.Map; -import java.util.WeakHashMap; - -import java.io.Serializable; -import java.io.NotSerializableException; - -import java.lang.reflect.Constructor; - -import javax.rmi.CORBA.ValueHandler; -import javax.rmi.CORBA.Tie; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -import java.rmi.MarshalException; -import java.rmi.NoSuchObjectException; -import java.rmi.AccessException; -import java.rmi.Remote; -import java.rmi.ServerError; -import java.rmi.ServerException; -import java.rmi.ServerRuntimeException; - -import javax.transaction.TransactionRequiredException; -import javax.transaction.TransactionRolledbackException; -import javax.transaction.InvalidTransactionException; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.Any; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.INV_OBJREF; -import org.omg.CORBA.NO_PERMISSION; -import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.OBJECT_NOT_EXIST; -import org.omg.CORBA.TRANSACTION_REQUIRED; -import org.omg.CORBA.TRANSACTION_ROLLEDBACK; -import org.omg.CORBA.INVALID_TRANSACTION; -import org.omg.CORBA.BAD_OPERATION; -import org.omg.CORBA.ACTIVITY_REQUIRED; -import org.omg.CORBA.ACTIVITY_COMPLETED; -import org.omg.CORBA.INVALID_ACTIVITY; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.TCKind; -import org.omg.CORBA.portable.UnknownException; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -// This class must be able to function with non-Sun ORBs. -// This means that any of the following com.sun.corba classes -// must only occur in contexts that also handle the non-Sun case. - -import com.sun.corba.se.pept.transport.ContactInfoList ; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.protocol.CorbaClientDelegate; -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; -import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ; -import com.sun.corba.se.spi.copyobject.CopierManager ; -import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ; -import com.sun.corba.se.spi.copyobject.ObjectCopier ; -import com.sun.corba.se.impl.io.ValueHandlerImpl; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.logging.OMGSystemException; -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.util.IdentityHashtable; -import com.sun.corba.se.impl.util.JDKBridge; -import com.sun.corba.se.impl.logging.UtilSystemException; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import sun.corba.SharedSecrets; - - -/** - * Provides utility methods that can be used by stubs and ties to - * perform common operations. - */ -public class Util implements javax.rmi.CORBA.UtilDelegate -{ - // Runs as long as there are exportedServants - private static KeepAlive keepAlive = null; - - // Maps targets to ties. - private static IdentityHashtable exportedServants = new IdentityHashtable(); - - private static final ValueHandlerImpl valueHandlerSingleton = - SharedSecrets.getJavaCorbaAccess().newValueHandlerImpl(); - - private UtilSystemException utilWrapper = UtilSystemException.get( - CORBALogDomains.RPC_ENCODING); - - private static Util instance = null; - - public Util() { - setInstance(this); - } - - private static void setInstance( Util util ) { - assert instance == null : "Instance already defined"; - instance = util; - } - - public static Util getInstance() { - return instance; - } - - public static boolean isInstanceDefined() { - return instance != null; - } - - // Used by TOAFactory.shutdown to unexport all targets for this - // particular ORB. This happens during ORB shutdown. - public void unregisterTargetsForORB(org.omg.CORBA.ORB orb) - { - for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); ) - { - java.lang.Object key = e.nextElement(); - Remote target = (Remote)(key instanceof Tie ? ((Tie)key).getTarget() : key); - - // Bug 4476347: BAD_OPERATION is thrown if the ties delegate isn't set. - // We can ignore this because it means the tie is not connected to an ORB. - try { - if (orb == getTie(target).orb()) { - try { - unexportObject(target); - } catch( java.rmi.NoSuchObjectException ex ) { - // We neglect this exception if at all if it is - // raised. It is not harmful. - } - } - } catch (BAD_OPERATION bad) { - /* Ignore */ - } - } - } - - /** - * Maps a SystemException to a RemoteException. - * @param ex the SystemException to map. - * @return the mapped exception. - */ - public RemoteException mapSystemException(SystemException ex) - { - if (ex instanceof UnknownException) { - Throwable orig = ((UnknownException)ex).originalEx; - if (orig instanceof Error) { - return new ServerError("Error occurred in server thread",(Error)orig); - } else if (orig instanceof RemoteException) { - return new ServerException("RemoteException occurred in server thread", - (Exception)orig); - } else if (orig instanceof RuntimeException) { - throw (RuntimeException) orig; - } - } - - // Build the message string... - String name = ex.getClass().getName(); - String corbaName = name.substring(name.lastIndexOf('.')+1); - String status; - switch (ex.completed.value()) { - case CompletionStatus._COMPLETED_YES: - status = "Yes"; - break; - case CompletionStatus._COMPLETED_NO: - status = "No"; - break; - case CompletionStatus._COMPLETED_MAYBE: - default: - status = "Maybe"; - break; - } - - String message = "CORBA " + corbaName + " " + ex.minor + " " + status; - - // Now map to the correct RemoteException type... - if (ex instanceof COMM_FAILURE) { - return new MarshalException(message, ex); - } else if (ex instanceof INV_OBJREF) { - RemoteException newEx = new NoSuchObjectException(message); - newEx.detail = ex; - return newEx; - } else if (ex instanceof NO_PERMISSION) { - return new AccessException(message, ex); - } else if (ex instanceof MARSHAL) { - return new MarshalException(message, ex); - } else if (ex instanceof OBJECT_NOT_EXIST) { - RemoteException newEx = new NoSuchObjectException(message); - newEx.detail = ex; - return newEx; - } else if (ex instanceof TRANSACTION_REQUIRED) { - RemoteException newEx = new TransactionRequiredException(message); - newEx.detail = ex; - return newEx; - } else if (ex instanceof TRANSACTION_ROLLEDBACK) { - RemoteException newEx = new TransactionRolledbackException(message); - newEx.detail = ex; - return newEx; - } else if (ex instanceof INVALID_TRANSACTION) { - RemoteException newEx = new InvalidTransactionException(message); - newEx.detail = ex; - return newEx; - } else if (ex instanceof BAD_PARAM) { - Exception inner = ex; - - // Pre-Merlin Sun ORBs used the incorrect minor code for - // this case. See Java to IDL ptc-00-01-08 1.4.8. - if (ex.minor == ORBConstants.LEGACY_SUN_NOT_SERIALIZABLE || - ex.minor == OMGSystemException.NOT_SERIALIZABLE) { - - if (ex.getMessage() != null) - inner = new NotSerializableException(ex.getMessage()); - else - inner = new NotSerializableException(); - - inner.initCause( ex ) ; - } - - return new MarshalException(message,inner); - } else if (ex instanceof ACTIVITY_REQUIRED) { - try { - Class cl = SharedSecrets.getJavaCorbaAccess().loadClass( - "javax.activity.ActivityRequiredException"); - Class[] params = new Class[2]; - params[0] = java.lang.String.class; - params[1] = java.lang.Throwable.class; - Constructor cr = cl.getConstructor(params); - Object[] args = new Object[2]; - args[0] = message; - args[1] = ex; - return (RemoteException) cr.newInstance(args); - } catch (Throwable e) { - utilWrapper.classNotFound( - e, "javax.activity.ActivityRequiredException"); - } - } else if (ex instanceof ACTIVITY_COMPLETED) { - try { - Class cl = SharedSecrets.getJavaCorbaAccess().loadClass( - "javax.activity.ActivityCompletedException"); - Class[] params = new Class[2]; - params[0] = java.lang.String.class; - params[1] = java.lang.Throwable.class; - Constructor cr = cl.getConstructor(params); - Object[] args = new Object[2]; - args[0] = message; - args[1] = ex; - return (RemoteException) cr.newInstance(args); - } catch (Throwable e) { - utilWrapper.classNotFound( - e, "javax.activity.ActivityCompletedException"); - } - } else if (ex instanceof INVALID_ACTIVITY) { - try { - Class cl = SharedSecrets.getJavaCorbaAccess().loadClass( - "javax.activity.InvalidActivityException"); - Class[] params = new Class[2]; - params[0] = java.lang.String.class; - params[1] = java.lang.Throwable.class; - Constructor cr = cl.getConstructor(params); - Object[] args = new Object[2]; - args[0] = message; - args[1] = ex; - return (RemoteException) cr.newInstance(args); - } catch (Throwable e) { - utilWrapper.classNotFound( - e, "javax.activity.InvalidActivityException"); - } - } - - // Just map to a generic RemoteException... - return new RemoteException(message, ex); - } - - /** - * Writes any java.lang.Object as a CORBA any. - * @param out the stream in which to write the any. - * @param obj the object to write as an any. - */ - public void writeAny( org.omg.CORBA.portable.OutputStream out, - java.lang.Object obj) - { - org.omg.CORBA.ORB orb = out.orb(); - - // Create Any - Any any = orb.create_any(); - - // Make sure we have a connected object... - java.lang.Object newObj = Utility.autoConnect(obj,orb,false); - - if (newObj instanceof org.omg.CORBA.Object) { - any.insert_Object((org.omg.CORBA.Object)newObj); - } else { - if (newObj == null) { - // Handle the null case, including backwards - // compatibility issues - any.insert_Value(null, createTypeCodeForNull(orb)); - } else { - if (newObj instanceof Serializable) { - // If they're our Any and ORB implementations, - // we may want to do type code related versioning. - TypeCode tc = createTypeCode((Serializable)newObj, any, orb); - if (tc == null) - any.insert_Value((Serializable)newObj); - else - any.insert_Value((Serializable)newObj, tc); - } else if (newObj instanceof Remote) { - ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName()); - } else { - ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName()); - } - } - } - - out.write_any(any); - } - - /** - * When using our own ORB and Any implementations, we need to get - * the ORB version and create the type code appropriately. This is - * to overcome a bug in which the JDK 1.3.x ORBs used a tk_char - * rather than a tk_wchar to describe a Java char field. - * - * This only works in RMI-IIOP with Util.writeAny since we actually - * know what ORB and stream we're writing with when we insert - * the value. - * - * Returns null if it wasn't possible to create the TypeCode (means - * it wasn't our ORB or Any implementation). - * - * This does not handle null objs. - */ - private TypeCode createTypeCode(Serializable obj, - org.omg.CORBA.Any any, - org.omg.CORBA.ORB orb) { - - if (any instanceof com.sun.corba.se.impl.corba.AnyImpl && - orb instanceof ORB) { - - com.sun.corba.se.impl.corba.AnyImpl anyImpl - = (com.sun.corba.se.impl.corba.AnyImpl)any; - - ORB ourORB = (ORB)orb; - - return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB); - - } else - return null; - } - - - /** - * This is used to create the TypeCode for a null reference. - * It also handles backwards compatibility with JDK 1.3.x. - * - * This method will not return null. - */ - private TypeCode createTypeCodeForNull(org.omg.CORBA.ORB orb) - { - if (orb instanceof ORB) { - - ORB ourORB = (ORB)orb; - - // Preserve backwards compatibility with Kestrel and Ladybird - // by not fully implementing interop issue resolution 3857, - // and returning a null TypeCode with a tk_value TCKind. - // If we're not talking to Kestrel or Ladybird, fall through - // to the abstract interface case (also used for foreign ORBs). - if (!ORBVersionFactory.getFOREIGN().equals(ourORB.getORBVersion()) && - ORBVersionFactory.getNEWER().compareTo(ourORB.getORBVersion()) > 0) { - - return orb.get_primitive_tc(TCKind.tk_value); - } - } - - // Use tk_abstract_interface as detailed in the resolution - - // REVISIT: Define this in IDL and get the ID in generated code - String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0"; - - return orb.create_abstract_interface_tc(abstractBaseID, ""); - } - - /** - * Reads a java.lang.Object as a CORBA any. - * @param in the stream from which to read the any. - * @return the object read from the stream. - */ - public Object readAny(InputStream in) - { - Any any = in.read_any(); - if ( any.type().kind().value() == TCKind._tk_objref ) - return any.extract_Object (); - else - return any.extract_Value(); - } - - /** - * Writes a java.lang.Object as a CORBA Object. If {@code obj} is - * an exported RMI-IIOP server object, the tie is found - * and wired to {@code obj}, then written to {@code out.write_Object(org.omg.CORBA.Object)}. - * If {@code obj} is a CORBA Object, it is written to - * {@code out.write_Object(org.omg.CORBA.Object)}. - * @param out the stream in which to write the object. - * @param obj the object to write. - */ - public void writeRemoteObject(OutputStream out, java.lang.Object obj) - { - // Make sure we have a connected object, then - // write it out... - - Object newObj = Utility.autoConnect(obj,out.orb(),false); - out.write_Object((org.omg.CORBA.Object)newObj); - } - - /** - * Writes a java.lang.Object as either a value or a CORBA Object. - * If {@code obj} is a value object or a stub object, it is written to - * {@code out.write_abstract_interface(java.lang.Object)}. If {@code obj} is an exported - * RMI-IIOP server object, the tie is found and wired to {@code obj}, - * then written to {@code out.write_abstract_interface(java.lang.Object)}. - * @param out the stream in which to write the object. - * @param obj the object to write. - */ - public void writeAbstractObject( OutputStream out, java.lang.Object obj ) - { - // Make sure we have a connected object, then - // write it out... - - Object newObj = Utility.autoConnect(obj,out.orb(),false); - ((org.omg.CORBA_2_3.portable.OutputStream)out).write_abstract_interface(newObj); - } - - /** - * Registers a target for a tie. Adds the tie to an internal table and calls - * {@link Tie#setTarget} on the tie object. - * @param tie the tie to register. - * @param target the target for the tie. - */ - public void registerTarget(javax.rmi.CORBA.Tie tie, java.rmi.Remote target) - { - synchronized (exportedServants) { - // Do we already have this target registered? - if (lookupTie(target) == null) { - // No, so register it and set the target... - exportedServants.put(target,tie); - tie.setTarget(target); - - // Do we need to instantiate our keep-alive thread? - if (keepAlive == null) { - // Yes. Instantiate our keep-alive thread and start - // it up... - keepAlive = (KeepAlive)AccessController.doPrivileged(new PrivilegedAction() { - public java.lang.Object run() { - return new KeepAlive(); - } - }); - keepAlive.start(); - } - } - } - } - - /** - * Removes the associated tie from an internal table and calls {@link Tie#deactivate} - * to deactivate the object. - * @param target the object to unexport. - */ - public void unexportObject(java.rmi.Remote target) - throws java.rmi.NoSuchObjectException - { - synchronized (exportedServants) { - Tie cachedTie = lookupTie(target); - if (cachedTie != null) { - exportedServants.remove(target); - Utility.purgeStubForTie(cachedTie); - Utility.purgeTieAndServant(cachedTie); - try { - cleanUpTie(cachedTie); - } catch (BAD_OPERATION e) { - // ignore - } catch (org.omg.CORBA.OBJ_ADAPTER e) { - // This can happen when the target was never associated with a POA. - // We can safely ignore this case. - } - - // Is it time to shut down our keep alive thread? - if (exportedServants.isEmpty()) { - keepAlive.quit(); - keepAlive = null; - } - } else { - throw new java.rmi.NoSuchObjectException("Tie not found" ); - } - } - } - - protected void cleanUpTie(Tie cachedTie) - throws java.rmi.NoSuchObjectException - { - cachedTie.setTarget(null); - cachedTie.deactivate(); - } - - /** - * Returns the tie (if any) for a given target object. - * @return the tie or null if no tie is registered for the given target. - */ - public Tie getTie (Remote target) - { - synchronized (exportedServants) { - return lookupTie(target); - } - } - - /** - * An unsynchronized version of getTie() for internal use. - */ - private static Tie lookupTie (Remote target) - { - Tie result = (Tie)exportedServants.get(target); - if (result == null && target instanceof Tie) { - if (exportedServants.contains(target)) { - result = (Tie)target; - } - } - return result; - } - - /** - * Returns a singleton instance of a class that implements the - * {@link ValueHandler} interface. - * @return a class which implements the ValueHandler interface. - */ - public ValueHandler createValueHandler() - { - return valueHandlerSingleton; - } - - /** - * Returns the codebase, if any, for the given class. - * @param clz the class to get a codebase for. - * @return a space-separated list of URLs, or null. - */ - public String getCodebase(java.lang.Class clz) { - return RMIClassLoader.getClassAnnotation(clz); - } - - /** - * Returns a class instance for the specified class. - * @param className the name of the class. - * @param remoteCodebase a space-separated list of URLs at which - * the class might be found. May be null. - * @param loader a class whose ClassLoader may be used to - * load the class if all other methods fail. - * @return the {@code Class} object representing the loaded class. - * @exception ClassNotFoundException if class cannot be loaded. - */ - public Class loadClass( String className, String remoteCodebase, - ClassLoader loader) throws ClassNotFoundException - { - return JDKBridge.loadClass(className,remoteCodebase,loader); - } - - /** - * The {@code isLocal} method has the same semantics as the - * ObjectImpl._is_local method, except that it can throw a RemoteException. - * (no it doesn't but the spec says it should.) - * - * The {@code _is_local()} method is provided so that stubs may determine - * if a particular object is implemented by a local servant and hence local - * invocation APIs may be used. - * - * @param stub the stub to test. - * - * @return The {@code _is_local()} method returns true if - * the servant incarnating the object is located in the same process as - * the stub and they both share the same ORB instance. The {@code _is_local()} - * method returns false otherwise. The default behavior of {@code _is_local()} is - * to return false. - * - * @throws RemoteException The Java to IDL specification does to - * specify the conditions that cause a RemoteException to be thrown. - */ - public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException - { - boolean result = false ; - - try { - org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ; - if (delegate instanceof CorbaClientDelegate) { - // For the Sun ORB - CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ; - ContactInfoList cil = cdel.getContactInfoList() ; - if (cil instanceof CorbaContactInfoList) { - CorbaContactInfoList ccil = (CorbaContactInfoList)cil ; - LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher() ; - result = lcs.useLocalInvocation( null ) ; - } - } else { - // For a non-Sun ORB - result = delegate.is_local( stub ) ; - } - } catch (SystemException e) { - throw javax.rmi.CORBA.Util.mapSystemException(e); - } - - return result ; - } - - /** - * Wraps an exception thrown by an implementation - * method. It returns the corresponding client-side exception. - * @param orig the exception to wrap. - * @return the wrapped exception. - */ - public RemoteException wrapException(Throwable orig) - { - if (orig instanceof SystemException) { - return mapSystemException((SystemException)orig); - } - - if (orig instanceof Error) { - return new ServerError("Error occurred in server thread",(Error)orig); - } else if (orig instanceof RemoteException) { - return new ServerException("RemoteException occurred in server thread", - (Exception)orig); - } else if (orig instanceof RuntimeException) { - throw (RuntimeException) orig; - } - - if (orig instanceof Exception) - return new UnexpectedException( orig.toString(), (Exception)orig ); - else - return new UnexpectedException( orig.toString()); - } - - /** - * Copies or connects an array of objects. Used by local stubs - * to copy any number of actual parameters, preserving sharing - * across parameters as necessary to support RMI semantics. - * @param obj the objects to copy or connect. - * @param orb the ORB. - * @return the copied or connected objects. - * @exception RemoteException if any object could not be copied or connected. - */ - public Object[] copyObjects (Object[] obj, org.omg.CORBA.ORB orb) - throws RemoteException - { - if (obj == null) - // Bug fix for 5018613: JCK test expects copyObjects to throw - // NPE when obj==null. This is actually not in the spec, since - // obj is not really an RMI-IDL data type, but we follow our - // test here, and force this error to be thrown. - throw new NullPointerException() ; - - Class compType = obj.getClass().getComponentType() ; - if (Remote.class.isAssignableFrom( compType ) && !compType.isInterface()) { - // obj is an array of remote impl types. This - // causes problems with stream copier, so we copy - // it over to an array of Remotes instead. - Remote[] result = new Remote[obj.length] ; - System.arraycopy( (Object)obj, 0, (Object)result, 0, obj.length ) ; - return (Object[])copyObject( result, orb ) ; - } else - return (Object[])copyObject( obj, orb ) ; - } - - /** - * Copies or connects an object. Used by local stubs to copy - * an actual parameter, result object, or exception. - * @param obj the object to copy. - * @param orb the ORB. - * @return the copy or connected object. - * @exception RemoteException if the object could not be copied or connected. - */ - public Object copyObject (Object obj, org.omg.CORBA.ORB orb) - throws RemoteException - { - if (orb instanceof ORB) { - ORB lorb = (ORB)orb ; - - try { - try { - // This gets the copier for the current invocation, which was - // previously set by preinvoke. - return lorb.peekInvocationInfo().getCopierFactory().make().copy( obj ) ; - } catch (java.util.EmptyStackException exc) { - // copyObject was invoked outside of an invocation, probably by - // a test. Get the default copier from the ORB. - // XXX should we just make the default copier available directly - // and avoid constructing one on each call? - CopierManager cm = lorb.getCopierManager() ; - ObjectCopier copier = cm.getDefaultObjectCopierFactory().make() ; - return copier.copy( obj ) ; - } - } catch (ReflectiveCopyException exc) { - RemoteException rexc = new RemoteException() ; - rexc.initCause( exc ) ; - throw rexc ; - } - } else { - org.omg.CORBA_2_3.portable.OutputStream out = - (org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream(); - out.write_value((Serializable)obj); - org.omg.CORBA_2_3.portable.InputStream in = - (org.omg.CORBA_2_3.portable.InputStream)out.create_input_stream(); - return in.read_value(); - } - } -} - -class KeepAlive extends Thread -{ - boolean quit = false; - - public KeepAlive () - { - super(null, null, "Servant-KeepAlive-Thread", 0, false); - setDaemon(false); - } - - public synchronized void run () - { - while (!quit) { - try { - wait(); - } catch (InterruptedException e) {} - } - } - - public synchronized void quit () - { - quit = true; - notifyAll(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java 2018-01-30 20:18:03.000000000 -0500 +++ /dev/null 2018-01-30 20:18:04.000000000 -0500 @@ -1,362 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.javax.rmi; - -import java.lang.reflect.Method ; - -import javax.rmi.CORBA.Tie; -import javax.rmi.CORBA.Util; - -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; -import java.rmi.Remote; - -import java.util.Properties; - -import org.omg.CORBA.ORB; -import org.omg.CORBA.portable.Delegate; -import org.omg.CORBA.SystemException; - -import java.rmi.server.UnicastRemoteObject; -import java.rmi.server.RemoteStub; -import java.rmi.server.ExportException; - -import java.net.URL; - -import com.sun.corba.se.impl.util.JDKBridge; -import com.sun.corba.se.impl.util.Utility; -import com.sun.corba.se.impl.util.RepositoryId; - -import com.sun.corba.se.spi.presentation.rmi.StubAdapter; - -import java.security.AccessController; -import com.sun.corba.se.impl.orbutil.GetPropertyAction; - -/** - * Server implementation objects may either inherit from - * javax.rmi.PortableRemoteObject or they may implement a remote interface - * and then use the exportObject method to register themselves as a server object. - * The toStub method takes a server implementation and returns a stub that - * can be used to access that server object. - * The connect method makes a Remote object ready for remote communication. - * The unexportObject method is used to deregister a server object, allowing it to become - * available for garbage collection. - * The narrow method takes an object reference or abstract interface type and - * attempts to narrow it to conform to - * the given interface. If the operation is successful the result will be an - * object of the specified type, otherwise an exception will be thrown. - */ -public class PortableRemoteObject - implements javax.rmi.CORBA.PortableRemoteObjectDelegate { - - /** - * Makes a server object ready to receive remote calls. Note - * that subclasses of PortableRemoteObject do not need to call this - * method, as it is called by the constructor. - * @param obj the server object to export. - * @exception RemoteException if export fails. - */ - public void exportObject(Remote obj) - throws RemoteException { - - if (obj == null) { - throw new NullPointerException("invalid argument"); - } - - // Has this object already been exported to IIOP? - - if (Util.getTie(obj) != null) { - - // Yes, so this is an error... - - throw new ExportException (obj.getClass().getName() + " already exported"); - } - - // Can we load a Tie? - - Tie theTie = Utility.loadTie(obj); - - if (theTie != null) { - - // Yes, so export it to IIOP... - - Util.registerTarget(theTie,obj); - - } else { - - // No, so export to JRMP. If this is called twice for the - // same object, it will throw an ExportException... - - UnicastRemoteObject.exportObject(obj); - } - } - - /** - * Returns a stub for the given server object. - * @param obj the server object for which a stub is required. Must either be a subclass - * of PortableRemoteObject or have been previously the target of a call to - * {@link #exportObject}. - * @return the most derived stub for the object. - * @exception NoSuchObjectException if a stub cannot be located for the given server object. - */ - public Remote toStub (Remote obj) - throws NoSuchObjectException - { - Remote result = null; - if (obj == null) { - throw new NullPointerException("invalid argument"); - } - - // If the class is already an IIOP stub then return it. - if (StubAdapter.isStub( obj )) { - return obj; - } - - // If the class is already a JRMP stub then return it. - if (obj instanceof java.rmi.server.RemoteStub) { - return obj; - } - - // Has it been exported to IIOP? - Tie theTie = Util.getTie(obj); - - if (theTie != null) { - result = Utility.loadStub(theTie,null,null,true); - } else { - if (Utility.loadTie(obj) == null) { - result = java.rmi.server.RemoteObject.toStub(obj); - } - } - - if (result == null) { - throw new NoSuchObjectException("object not exported"); - } - - return result; - } - - /** - * Deregisters a server object from the runtime, allowing the object to become - * available for garbage collection. - * @param obj the object to unexport. - * @exception NoSuchObjectException if the remote object is not - * currently exported. - */ - public void unexportObject(Remote obj) - throws NoSuchObjectException { - - if (obj == null) { - throw new NullPointerException("invalid argument"); - } - - if (StubAdapter.isStub(obj) || - obj instanceof java.rmi.server.RemoteStub) { - throw new NoSuchObjectException( - "Can only unexport a server object."); - } - - Tie theTie = Util.getTie(obj); - if (theTie != null) { - Util.unexportObject(obj); - } else { - if (Utility.loadTie(obj) == null) { - UnicastRemoteObject.unexportObject(obj,true); - } else { - throw new NoSuchObjectException("Object not exported."); - } - } - } - - /** - * Checks to ensure that an object of a remote or abstract interface type - * can be cast to a desired type. - * @param narrowFrom the object to check. - * @param narrowTo the desired type. - * @return an object which can be cast to the desired type. - * @throws ClassCastException if narrowFrom cannot be cast to narrowTo. - */ - public java.lang.Object narrow ( java.lang.Object narrowFrom, - java.lang.Class narrowTo) throws ClassCastException - { - java.lang.Object result = null; - - if (narrowFrom == null) - return null; - - if (narrowTo == null) - throw new NullPointerException("invalid argument"); - - try { - if (narrowTo.isAssignableFrom(narrowFrom.getClass())) - return narrowFrom; - - // Is narrowTo an interface that might be - // implemented by a servant running on iiop? - if (narrowTo.isInterface() && - narrowTo != java.io.Serializable.class && - narrowTo != java.io.Externalizable.class) { - - org.omg.CORBA.Object narrowObj - = (org.omg.CORBA.Object) narrowFrom; - - // Create an id from the narrowTo type... - String id = RepositoryId.createForAnyType(narrowTo); - - if (narrowObj._is_a(id)) { - return Utility.loadStub(narrowObj,narrowTo); - } else { - throw new ClassCastException( "Object is not of remote type " + - narrowTo.getName() ) ; - } - } else { - throw new ClassCastException( "Class " + narrowTo.getName() + - " is not a valid remote interface" ) ; - } - } catch(Exception error) { - ClassCastException cce = new ClassCastException() ; - cce.initCause( error ) ; - throw cce ; - } - } - - /** - * Makes a Remote object ready for remote communication. This normally - * happens implicitly when the object is sent or received as an argument - * on a remote method call, but in some circumstances it is useful to - * perform this action by making an explicit call. See the - * {@link Stub#connect} method for more information. - * @param target the object to connect. - * @param source a previously connected object. - * @throws RemoteException if source is not connected - * or if target is already connected to a different ORB than - * source. - */ - public void connect (Remote target, Remote source) - throws RemoteException - { - if (target == null || source == null) { - throw new NullPointerException("invalid argument"); - } - - ORB orb = null; - try { - if (StubAdapter.isStub( source )) { - orb = StubAdapter.getORB( source ) ; - } else { - // Is this a servant that was exported to iiop? - Tie tie = Util.getTie(source); - if (tie == null) { - /* loadTie always succeeds for dynamic RMI-IIOP - // No, can we get a tie for it? If not, - // assume that source is a JRMP object... - if (Utility.loadTie(source) != null) { - // Yes, so it is an iiop object which - // has not been exported... - throw new RemoteException( - "'source' object not exported"); - } - */ - } else { - orb = tie.orb(); - } - } - } catch (SystemException e) { - throw new RemoteException("'source' object not connected", e ); - } - - boolean targetIsIIOP = false ; - Tie targetTie = null; - if (StubAdapter.isStub(target)) { - targetIsIIOP = true; - } else { - targetTie = Util.getTie(target); - if (targetTie != null) { - targetIsIIOP = true; - } else { - /* loadTie always succeeds for dynamic RMI-IIOP - if (Utility.loadTie(target) != null) { - throw new RemoteException("'target' servant not exported"); - } - */ - } - } - - if (!targetIsIIOP) { - // Yes. Do we have an ORB from the source object? - // If not, we're done - there is nothing to do to - // connect a JRMP object. If so, it is an error because - // the caller mixed JRMP and IIOP... - if (orb != null) { - throw new RemoteException( - "'source' object exported to IIOP, 'target' is JRMP"); - } - } else { - // The target object is IIOP. Make sure we have a - // valid ORB from the source object... - if (orb == null) { - throw new RemoteException( - "'source' object is JRMP, 'target' is IIOP"); - } - - // And, finally, connect it up... - try { - if (targetTie != null) { - // Is the tie already connected? - try { - ORB existingOrb = targetTie.orb(); - - // Yes. Is it the same orb? - if (existingOrb == orb) { - - // Yes, so nothing to do... - return; - } else { - // No, so this is an error... - throw new RemoteException( - "'target' object was already connected"); - } - } catch (SystemException e) {} - - // No, so do it... - targetTie.orb(orb); - } else { - StubAdapter.connect( target, orb ) ; - } - } catch (SystemException e) { - - // The stub or tie was already connected... - throw new RemoteException( - "'target' object was already connected", e ); - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java 2018-01-30 20:18:04.000000000 -0500 +++ /dev/null 2018-01-30 20:18:04.000000000 -0500 @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.legacy.connection; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.net.UnknownHostException; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; - -import org.omg.CORBA.ORB; -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException; -import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.transport.SocketInfo; - -import com.sun.corba.se.impl.legacy.connection.EndPointInfoImpl; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -public class DefaultSocketFactory - implements - ORBSocketFactory -{ - private com.sun.corba.se.spi.orb.ORB orb; - private static ORBUtilSystemException wrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_TRANSPORT ) ; - - public DefaultSocketFactory() - { - } - - public void setORB(com.sun.corba.se.spi.orb.ORB orb) - { - this.orb = orb; - } - - public ServerSocket createServerSocket(String type, int port) - throws - IOException - { - if (! type.equals(ORBSocketFactory.IIOP_CLEAR_TEXT)) { - throw wrapper.defaultCreateServerSocketGivenNonIiopClearText( type ) ; - } - - ServerSocket serverSocket; - - if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) { - ServerSocketChannel serverSocketChannel = - ServerSocketChannel.open(); - serverSocket = serverSocketChannel.socket(); - } else { - serverSocket = new ServerSocket(); - } - serverSocket.bind(new InetSocketAddress(port)); - return serverSocket; - } - - public SocketInfo getEndPointInfo(ORB orb, - IOR ior, - SocketInfo socketInfo) - { - IIOPProfileTemplate temp = - (IIOPProfileTemplate)ior.getProfile().getTaggedProfileTemplate() ; - IIOPAddress primary = temp.getPrimaryAddress() ; - - return new EndPointInfoImpl(ORBSocketFactory.IIOP_CLEAR_TEXT, - primary.getPort(), - primary.getHost().toLowerCase()); - } - - public Socket createSocket(SocketInfo socketInfo) - throws - IOException, - GetEndPointInfoAgainException - { - Socket socket; - - if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) { - InetSocketAddress address = - new InetSocketAddress(socketInfo.getHost(), - socketInfo.getPort()); - SocketChannel socketChannel = SocketChannel.open(address); - socket = socketChannel.socket(); - } else { - socket = new Socket(socketInfo.getHost(), - socketInfo.getPort()); - } - - // REVISIT - this is done in SocketOrChannelConnectionImpl - try { - socket.setTcpNoDelay(true); - } catch (Exception e) { - ; - } - return socket; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java 2018-01-30 20:18:05.000000000 -0500 +++ /dev/null 2018-01-30 20:18:05.000000000 -0500 @@ -1,117 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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.corba.se.impl.legacy.connection; - -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo; -import com.sun.corba.se.spi.transport.SocketInfo; - -public class EndPointInfoImpl - implements - SocketInfo, - LegacyServerSocketEndPointInfo -{ - - protected String type; - protected String hostname; - protected int port; - protected int locatorPort; - protected String name; - - public EndPointInfoImpl(String type, int port, String hostname) { - this.type = type; - this.port = port; - this.hostname = hostname; - this.locatorPort = -1; - this.name = LegacyServerSocketEndPointInfo.NO_NAME; - } - - public String getType() { - return type; - } - - public String getHost() { - return hostname; - } - - public String getHostName() { - return hostname; - } - - public int getPort() { - return port; - } - - public int getLocatorPort () - { - return locatorPort; - } - - public void setLocatorPort (int port) - { - locatorPort = port; - } - - public String getName() - { - return name; - } - - public int hashCode() { - return type.hashCode() ^ hostname.hashCode() ^ port; - } - - public boolean equals(Object obj) { - if (!(obj instanceof EndPointInfoImpl)) { - return false; - } - EndPointInfoImpl other = (EndPointInfoImpl)obj; - if (type == null) { - if (other.type != null) { - return false; - } - } else if (!type.equals(other.type)) { - return false; - } - if (port != other.port) { - return false; - } - if (!hostname.equals(other.hostname)) { - return false; - } - return true; - } - - public String toString () - { - return - type + " " + - name + " " + - hostname + " " + - port; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java 2018-01-30 20:18:05.000000000 -0500 +++ /dev/null 2018-01-30 20:18:06.000000000 -0500 @@ -1,186 +0,0 @@ -/* - * Copyright (c) 1998, 2003, 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.corba.se.impl.legacy.connection; - -import java.net.ServerSocket; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -import org.omg.CORBA.INITIALIZE; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.ByteBufferPool; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.Selector; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate; -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaTransportManager; -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo; -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager; -import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.encoding.EncapsOutputStream; -import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl; -import com.sun.corba.se.impl.legacy.connection.USLPort; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -public class LegacyServerSocketManagerImpl - implements - LegacyServerSocketManager -{ - protected ORB orb; - private ORBUtilSystemException wrapper ; - - public LegacyServerSocketManagerImpl(ORB orb) - { - this.orb = orb; - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_TRANSPORT ) ; - } - - //////////////////////////////////////////////////// - // - // LegacyServerSocketManager - // - - // Only used in ServerManagerImpl. - public int legacyGetTransientServerPort(String type) - { - return legacyGetServerPort(type, false); - } - - // Only used by POAPolicyMediatorBase. - public synchronized int legacyGetPersistentServerPort(String socketType) - { - if (orb.getORBData().getServerIsORBActivated()) { - // this server is activated by orbd - return legacyGetServerPort(socketType, true); - } else if (orb.getORBData().getPersistentPortInitialized()) { - // this is a user-activated server - return orb.getORBData().getPersistentServerPort(); - } else { - throw wrapper.persistentServerportNotSet( - CompletionStatus.COMPLETED_MAYBE); - } - } - - // Only used by PI IORInfoImpl. - public synchronized int legacyGetTransientOrPersistentServerPort( - String socketType) - { - return legacyGetServerPort(socketType, - orb.getORBData() - .getServerIsORBActivated()); - } - - // Used in RepositoryImpl, ServerManagerImpl, POAImpl, - // POAPolicyMediatorBase, TOAImpl. - // To get either default or bootnaming endpoint. - public synchronized LegacyServerSocketEndPointInfo legacyGetEndpoint( - String name) - { - Iterator iterator = getAcceptorIterator(); - while (iterator.hasNext()) { - LegacyServerSocketEndPointInfo endPoint = cast(iterator.next()); - if (endPoint != null && name.equals(endPoint.getName())) { - return endPoint; - } - } - throw new INTERNAL("No acceptor for: " + name); - } - - // Check to see if the given port is equal to any of the ORB Server Ports. - // XXX Does this need to change for the multi-homed case? - // Used in IIOPProfileImpl, ORBImpl. - public boolean legacyIsLocalServerPort(int port) - { - Iterator iterator = getAcceptorIterator(); - while (iterator.hasNext()) { - LegacyServerSocketEndPointInfo endPoint = cast(iterator.next()); - if (endPoint != null && endPoint.getPort() == port) { - return true; - } - } - return false; - } - - //////////////////////////////////////////////////// - // - // Implementation. - // - - private int legacyGetServerPort (String socketType, boolean isPersistent) - { - Iterator endpoints = getAcceptorIterator(); - while (endpoints.hasNext()) { - LegacyServerSocketEndPointInfo ep = cast(endpoints.next()); - if (ep != null && ep.getType().equals(socketType)) { - if (isPersistent) { - return ep.getLocatorPort(); - } else { - return ep.getPort(); - } - } - } - return -1; - } - - private Iterator getAcceptorIterator() - { - Collection acceptors = - orb.getCorbaTransportManager().getAcceptors(null, null); - if (acceptors != null) { - return acceptors.iterator(); - } - - throw wrapper.getServerPortCalledBeforeEndpointsInitialized() ; - } - - private LegacyServerSocketEndPointInfo cast(Object o) - { - if (o instanceof LegacyServerSocketEndPointInfo) { - return (LegacyServerSocketEndPointInfo) o; - } - return null; - } - - protected void dprint(String msg) - { - ORBUtility.dprint("LegacyServerSocketManagerImpl", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java 2018-01-30 20:18:06.000000000 -0500 +++ /dev/null 2018-01-30 20:18:06.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.legacy.connection; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.ServerSocket; - -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.INTERNAL; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl; -import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl; - -/** - * @author Harold Carr - */ -public class SocketFactoryAcceptorImpl - extends - SocketOrChannelAcceptorImpl -{ - public SocketFactoryAcceptorImpl(ORB orb, int port, - String name, String type) - { - super(orb, port, name, type); - } - - //////////////////////////////////////////////////// - // - // pept Acceptor - // - - public boolean initialize() - { - if (initialized) { - return false; - } - if (orb.transportDebugFlag) { - dprint("initialize: " + this); - } - try { - serverSocket = orb.getORBData() - .getLegacySocketFactory().createServerSocket(type, port); - internalInitialize(); - } catch (Throwable t) { - throw wrapper.createListenerFailed( t, Integer.toString(port) ) ; - } - initialized = true; - return true; - } - - //////////////////////////////////////////////////// - // - // Implementation. - // - - protected String toStringName() - { - return "SocketFactoryAcceptorImpl"; - } - - protected void dprint(String msg) - { - ORBUtility.dprint(toStringName(), msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java 2018-01-30 20:18:07.000000000 -0500 +++ /dev/null 2018-01-30 20:18:07.000000000 -0500 @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.legacy.connection; - -import java.net.Socket; -import java.nio.channels.SocketChannel; -import java.util.Collections; - -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.ContactInfo; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.transport.CorbaContactInfo; -import com.sun.corba.se.spi.transport.SocketInfo; - -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl; -import com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl; - -/** - * @author Harold Carr - */ -public class SocketFactoryConnectionImpl - extends - SocketOrChannelConnectionImpl -{ - // Socket-factory client constructor. - public SocketFactoryConnectionImpl(ORB orb, - CorbaContactInfo contactInfo, - boolean useSelectThreadToWait, - boolean useWorkerThread) - { - super(orb, useSelectThreadToWait, useWorkerThread); - - // REVISIT - probably need a contact info for both - // client and server for removing connections from cache? - this.contactInfo = contactInfo; - - boolean isBlocking = !useSelectThreadToWait; - SocketInfo socketInfo = - // REVISIT - case - needs interface method - ((SocketFactoryContactInfoImpl)contactInfo).socketInfo; - try { - socket = - orb.getORBData().getLegacySocketFactory().createSocket(socketInfo); - socketChannel = socket.getChannel(); - if (socketChannel != null) { - socketChannel.configureBlocking(isBlocking); - } else { - // IMPORTANT: non-channel-backed sockets must use - // dedicated reader threads. - setUseSelectThreadToWait(false); - } - if (orb.transportDebugFlag) { - dprint(".initialize: connection created: " + socket); - } - } catch (GetEndPointInfoAgainException ex) { - throw wrapper.connectFailure( - ex, socketInfo.getType(), socketInfo.getHost(), - Integer.toString(socketInfo.getPort())) ; - } catch (Exception ex) { - throw wrapper.connectFailure( - ex, socketInfo.getType(), socketInfo.getHost(), - Integer.toString(socketInfo.getPort())) ; - } - state = OPENING; - } - - public String toString() - { - synchronized ( stateEvent ){ - return - "SocketFactoryConnectionImpl[" + " " - + (socketChannel == null ? - socket.toString() : socketChannel.toString()) + " " - + getStateString( state ) + " " - + shouldUseSelectThreadToWait() + " " - + shouldUseWorkerThreadForEvent() - + "]" ; - } - } - - // Note: public to override parent. - public void dprint(String msg) - { - ORBUtility.dprint("SocketFactoryConnectionImpl", msg); - } - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java 2018-01-30 20:18:07.000000000 -0500 +++ /dev/null 2018-01-30 20:18:07.000000000 -0500 @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.legacy.connection; - -import com.sun.corba.se.pept.transport.Connection; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.transport.CorbaContactInfoList; -import com.sun.corba.se.spi.transport.SocketInfo; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl; - - -/** - * @author Harold Carr - */ -public class SocketFactoryContactInfoImpl - extends - SocketOrChannelContactInfoImpl -{ - protected ORBUtilSystemException wrapper; - protected SocketInfo socketInfo; - - // XREVISIT - // See SocketOrChannelAcceptorImpl.createMessageMediator - // See SocketFactoryContactInfoImpl.constructor() - // See SocketOrChannelContactInfoImpl.constructor() - public SocketFactoryContactInfoImpl() - { - } - - public SocketFactoryContactInfoImpl( - ORB orb, - CorbaContactInfoList contactInfoList, - IOR effectiveTargetIOR, - short addressingDisposition, - SocketInfo cookie) - { - super(orb, contactInfoList); - this.effectiveTargetIOR = effectiveTargetIOR; - this.addressingDisposition = addressingDisposition; - - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_TRANSPORT ) ; - - socketInfo = - orb.getORBData().getLegacySocketFactory() - .getEndPointInfo(orb, effectiveTargetIOR, cookie); - - socketType = socketInfo.getType(); - hostname = socketInfo.getHost(); - port = socketInfo.getPort(); - } - - //////////////////////////////////////////////////// - // - // pept.transport.ContactInfo - // - - public Connection createConnection() - { - Connection connection = - new SocketFactoryConnectionImpl( - orb, this, - orb.getORBData().connectionSocketUseSelectThreadToWait(), - orb.getORBData().connectionSocketUseWorkerThreadForEvent()); - return connection; - } - - //////////////////////////////////////////////////// - // - // java.lang.Object - // - - public String toString() - { - return - "SocketFactoryContactInfoImpl[" - + socketType + " " - + hostname + " " - + port - + "]"; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java 2018-01-30 20:18:08.000000000 -0500 +++ /dev/null 2018-01-30 20:18:08.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.legacy.connection; - -import java.util.Iterator; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.impl.transport.CorbaContactInfoListImpl; -import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl; - -/** - * @author Harold Carr - */ -public class SocketFactoryContactInfoListImpl - extends - CorbaContactInfoListImpl -{ - // XREVISIT - is this used? - public SocketFactoryContactInfoListImpl(ORB orb) - { - super(orb); - } - - public SocketFactoryContactInfoListImpl(ORB orb, IOR targetIOR) - { - super(orb, targetIOR); - } - - //////////////////////////////////////////////////// - // - // pept.transport.ContactInfoList - // - - public Iterator iterator() - { - return new SocketFactoryContactInfoListIteratorImpl(orb, this); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java 2018-01-30 20:18:09.000000000 -0500 +++ /dev/null 2018-01-30 20:18:09.000000000 -0500 @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.legacy.connection; - -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.pept.transport.ContactInfo; - -import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaContactInfo; -import com.sun.corba.se.spi.transport.CorbaContactInfoList; -import com.sun.corba.se.spi.transport.SocketInfo; - -import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl; -import com.sun.corba.se.impl.transport.SharedCDRContactInfoImpl; - -public class SocketFactoryContactInfoListIteratorImpl - extends CorbaContactInfoListIteratorImpl -{ - private SocketInfo socketInfoCookie; - - public SocketFactoryContactInfoListIteratorImpl( - ORB orb, - CorbaContactInfoList corbaContactInfoList) - { - super(orb, corbaContactInfoList, null, null); - } - - //////////////////////////////////////////////////// - // - // java.util.Iterator - // - - public boolean hasNext() - { - return true; - } - - public Object next() - { - if (contactInfoList.getEffectiveTargetIOR().getProfile().isLocal()){ - return new SharedCDRContactInfoImpl( - orb, contactInfoList, - contactInfoList.getEffectiveTargetIOR(), - orb.getORBData().getGIOPAddressDisposition()); - } else { - // REVISIT: - // on comm_failure maybe need to give IOR instead of located. - return new SocketFactoryContactInfoImpl( - orb, contactInfoList, - contactInfoList.getEffectiveTargetIOR(), - orb.getORBData().getGIOPAddressDisposition(), - socketInfoCookie); - } - } - - //////////////////////////////////////////////////// - // - // pept.ContactInfoListIterator - // - - public boolean reportException(ContactInfo contactInfo, - RuntimeException ex) - { - this.failureContactInfo = (CorbaContactInfo)contactInfo; - this.failureException = ex; - if (ex instanceof org.omg.CORBA.COMM_FAILURE) { - - if (ex.getCause() instanceof GetEndPointInfoAgainException) { - socketInfoCookie = - ((GetEndPointInfoAgainException) ex.getCause()) - .getEndPointInfo(); - return true; - } - - SystemException se = (SystemException) ex; - if (se.completed == CompletionStatus.COMPLETED_NO) { - if (contactInfoList.getEffectiveTargetIOR() != - contactInfoList.getTargetIOR()) - { - // retry from root ior - contactInfoList.setEffectiveTargetIOR( - contactInfoList.getTargetIOR()); - return true; - } - } - } - return false; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/USLPort.java 2018-01-30 20:18:09.000000000 -0500 +++ /dev/null 2018-01-30 20:18:09.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.legacy.connection; - -public class USLPort -{ - private String type; - private int port; - - public USLPort (String type, int port) - { - this.type = type; - this.port = port; - } - - public String getType () { return type; } - public int getPort () { return port; } - public String toString () { return type + ":" + port; } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java 2018-01-30 20:18:10.000000000 -0500 +++ /dev/null 2018-01-30 20:18:10.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.monitoring; - -import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfoFactory; -import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo; - -public class MonitoredAttributeInfoFactoryImpl - implements MonitoredAttributeInfoFactory -{ - public MonitoredAttributeInfo createMonitoredAttributeInfo( - String description, Class type, boolean isWritable, - boolean isStatistic ) - { - return new MonitoredAttributeInfoImpl( description, type, - isWritable, isStatistic ); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java 2018-01-30 20:18:11.000000000 -0500 +++ /dev/null 2018-01-30 20:18:11.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.monitoring; - -import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo; - -public class MonitoredAttributeInfoImpl implements MonitoredAttributeInfo { - private final String description; - private final Class type; - private final boolean writableFlag, statisticFlag; - - MonitoredAttributeInfoImpl( String description, Class type, - boolean isWritable, boolean isStatistic ) - { - this.description = description; - this.type = type; - this.writableFlag = isWritable; - this.statisticFlag = isStatistic; - } - - public String getDescription( ) { - return this.description; - } - - public Class type( ) { - return this.type; - } - - public boolean isWritable( ) { - return this.writableFlag; - } - - public boolean isStatistic( ) { - return this.statisticFlag; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java 2018-01-30 20:18:11.000000000 -0500 +++ /dev/null 2018-01-30 20:18:11.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.monitoring; - -import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory; -import com.sun.corba.se.spi.monitoring.MonitoredObject; - -public class MonitoredObjectFactoryImpl implements MonitoredObjectFactory { - - public MonitoredObject createMonitoredObject( String name, - String description ) - { - return new MonitoredObjectImpl( name, description ); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java 2018-01-30 20:18:12.000000000 -0500 +++ /dev/null 2018-01-30 20:18:12.000000000 -0500 @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.monitoring; - -import java.util.Map; -import java.util.HashMap; -import java.util.Collection; -import java.util.Iterator; - -import com.sun.corba.se.spi.monitoring.MonitoredObject; -import com.sun.corba.se.spi.monitoring.MonitoredAttribute; - -public class MonitoredObjectImpl implements MonitoredObject { - private final String name; - private final String description; - - // List of all child Monitored Objects - private Map children = new HashMap(); - - // All the Attributes of this Monitored Object instance - private Map monitoredAttributes = new HashMap(); - - private MonitoredObject parent = null; - - - // Constructor - MonitoredObjectImpl( String name, String description ) { - this.name = name; - this.description = description; - } - - public MonitoredObject getChild( String name ) { - synchronized( this ) { - return (MonitoredObject) children.get( name ); - } - } - - public Collection getChildren( ) { - synchronized( this ) { - return children.values(); - } - } - - public void addChild( MonitoredObject m ) { - if (m != null){ - synchronized( this ) { - children.put( m.getName(), m); - m.setParent( this ); - } - } - } - - public void removeChild( String name ) { - if (name != null){ - synchronized( this ) { - children.remove( name ); - } - } - } - - public synchronized MonitoredObject getParent( ) { - return parent; - } - - public synchronized void setParent( MonitoredObject p ) { - parent = p; - } - - public MonitoredAttribute getAttribute( String name ) { - synchronized( this ) { - return (MonitoredAttribute) monitoredAttributes.get( name ); - } - } - - public Collection getAttributes( ) { - synchronized( this ) { - return monitoredAttributes.values(); - } - } - - public void addAttribute( MonitoredAttribute value ) { - if (value != null) { - synchronized( this ) { - monitoredAttributes.put( value.getName(), value ); - } - } - } - - public void removeAttribute( String name ) { - if (name != null) { - synchronized( this ) { - monitoredAttributes.remove( name ); - } - } - } - - /** - * calls clearState() on all the registered children MonitoredObjects and - * MonitoredAttributes. - */ - public void clearState( ) { - synchronized( this ) { - Iterator i = monitoredAttributes.values().iterator(); - // First call clearState on all the local attributes - while( i.hasNext( ) ) { - ((MonitoredAttribute)i.next()).clearState(); - } - i = children.values().iterator(); - // next call clearState on all the children MonitoredObjects - while( i.hasNext() ) { - ((MonitoredObject)i.next()).clearState(); - } - } - } - - public String getName( ) { - return name; - } - - public String getDescription( ) { - return description; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java 2018-01-30 20:18:13.000000000 -0500 +++ /dev/null 2018-01-30 20:18:13.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.monitoring; - -import java.util.HashMap; -import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory; -import com.sun.corba.se.spi.monitoring.MonitoringManager; - -public class MonitoringManagerFactoryImpl implements MonitoringManagerFactory { - - private HashMap monitoringManagerTable = new HashMap(); - - public synchronized MonitoringManager createMonitoringManager( - String nameOfTheRoot, String description) - { - MonitoringManagerImpl m = null; - m = (MonitoringManagerImpl)monitoringManagerTable.get(nameOfTheRoot); - if (m == null) { - m = new MonitoringManagerImpl(nameOfTheRoot, description); - monitoringManagerTable.put(nameOfTheRoot, m); - } - return m; - } - - public synchronized void remove(String nameOfTheRoot) { - monitoringManagerTable.remove(nameOfTheRoot); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java 2018-01-30 20:18:13.000000000 -0500 +++ /dev/null 2018-01-30 20:18:13.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.monitoring; - -import com.sun.corba.se.spi.monitoring.MonitoringManager; -import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory; -import com.sun.corba.se.spi.monitoring.MonitoredObject; -import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory; -import com.sun.corba.se.spi.monitoring.MonitoringFactories; - -public class MonitoringManagerImpl implements MonitoringManager { - private final MonitoredObject rootMonitoredObject; - - MonitoringManagerImpl(String nameOfTheRoot, String description) { - MonitoredObjectFactory f = - MonitoringFactories.getMonitoredObjectFactory(); - rootMonitoredObject = - f.createMonitoredObject(nameOfTheRoot, description); - } - - public void clearState() { - rootMonitoredObject.clearState(); - } - - public MonitoredObject getRootMonitoredObject() { - return rootMonitoredObject; - } - - public void close() { - MonitoringManagerFactory f = - MonitoringFactories.getMonitoringManagerFactory(); - f.remove(rootMonitoredObject.getName()); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java 2018-01-30 20:18:14.000000000 -0500 +++ /dev/null 2018-01-30 20:18:14.000000000 -0500 @@ -1,185 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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.corba.se.impl.naming.cosnaming; - -// Import general CORBA classes -import org.omg.CORBA.ORB; -import org.omg.CORBA.Object; - -// Import org.omg.CosNaming classes -import org.omg.CosNaming.Binding; -import org.omg.CosNaming.BindingType; -import org.omg.CosNaming.BindingHolder; -import org.omg.CosNaming.BindingListHolder; -import org.omg.CosNaming.BindingIteratorHolder; -import org.omg.CosNaming.BindingIteratorPOA; -import org.omg.CORBA.BAD_PARAM; - -/** - * Class BindingIteratorImpl implements the org.omg.CosNaming::BindingIterator - * interface, but does not implement the method to retrieve the next - * binding in the NamingContext for which it was created. This is left - * to a subclass, which is why this class is abstract; BindingIteratorImpl - * provides an implementation of the interface operations on top of two - * subclass methods, allowing multiple implementations of iterators that - * differ in storage and access to the contents of a NamingContext - * implementation. - *

- * The operation next_one() is implemented by the subclass, whereas - * next_n() is implemented on top of the next_one() implementation. - * Destroy must also be implemented by the subclass. - *

- * A subclass must implement NextOne() and Destroy(); these - * methods are invoked from synchronized methods and need therefore - * not be synchronized themselves. - */ -public abstract class BindingIteratorImpl extends BindingIteratorPOA -{ - protected ORB orb ; - - /** - * Create a binding iterator servant. - * runs the super constructor. - * @param orb an ORB object. - * @exception java.lang.Exception a Java exception. - */ - public BindingIteratorImpl(ORB orb) - throws java.lang.Exception - { - super(); - this.orb = orb ; - } - - /** - * Return the next binding. It also returns true or false, indicating - * whether there were more bindings. - * @param b The Binding as an out parameter. - * @return true if there were more bindings. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see NextOne - */ - public synchronized boolean next_one(org.omg.CosNaming.BindingHolder b) - { - // NextOne actually returns the next one - return NextOne(b); - } - - /** - * Return the next n bindings. It also returns true or false, indicating - * whether there were more bindings. - * @param how_many The number of requested bindings in the BindingList. - * @param blh The BindingList as an out parameter. - * @return true if there were more bindings. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see NextOne - */ - public synchronized boolean next_n(int how_many, - org.omg.CosNaming.BindingListHolder blh) - { - if( how_many == 0 ) { - throw new BAD_PARAM( " 'how_many' parameter is set to 0 which is" + - " invalid" ); - } - return list( how_many, blh ); - } - - /** - * lists next n bindings. It returns true or false, indicating - * whether there were more bindings. This method has the package private - * scope, It will be called from NamingContext.list() operation or - * this.next_n(). - * @param how_many The number of requested bindings in the BindingList. - * @param blh The BindingList as an out parameter. - * @return true if there were more bindings. - */ - public boolean list( int how_many, org.omg.CosNaming.BindingListHolder blh) - { - // Take the smallest of what's left and what's being asked for - int numberToGet = Math.min(RemainingElements(),how_many); - - // Create a resulting BindingList - Binding[] bl = new Binding[numberToGet]; - BindingHolder bh = new BindingHolder(); - int i = 0; - // Keep iterating as long as there are entries - while (i < numberToGet && this.NextOne(bh) == true) { - bl[i] = bh.value; - i++; - } - // Found any at all? - if (i == 0) { - // No - blh.value = new Binding[0]; - return false; - } - - // Set into holder - blh.value = bl; - - return true; - } - - - - - /** - * Destroy this BindingIterator object. The object corresponding to this - * object reference is destroyed. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see Destroy - */ - public synchronized void destroy() - { - // Destroy actually destroys - this.Destroy(); - } - - /** - * Abstract method for returning the next binding in the NamingContext - * for which this BindingIterator was created. - * @param b The Binding as an out parameter. - * @return true if there were more bindings. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - protected abstract boolean NextOne(org.omg.CosNaming.BindingHolder b); - - /** - * Abstract method for destroying this BindingIterator. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - protected abstract void Destroy(); - - /** - * Abstract method for returning the remaining number of elements. - * @return the remaining number of elements in the iterator. - */ - protected abstract int RemainingElements(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java 2018-01-30 20:18:15.000000000 -0500 +++ /dev/null 2018-01-30 20:18:15.000000000 -0500 @@ -1,413 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.naming.cosnaming; - -import org.omg.CosNaming.NamingContextExtPackage.*; -import java.io.StringWriter; - -// Import general CORBA classes -import org.omg.CORBA.SystemException; -import org.omg.CORBA.Object; - -// Import org.omg.CosNaming types -import org.omg.CosNaming.NameComponent; -import org.omg.CosNaming.NamingContext; - - -/** - * Class InteroperableNamingImpl implements the methods defined - * for NamingContextExt which is part of Interoperable Naming - * Service specifications. This class is added for doing more - * of Parsing and Building of Stringified names according to INS - * Spec. - */ -public class InterOperableNamingImpl -{ - /** - * Method which stringifies the Name Components given as the input - * parameter. - * - * @param n Array of Name Components (Simple or Compound Names) - * @return string which is the stringified reference. - */ - public String convertToString( org.omg.CosNaming.NameComponent[] - theNameComponents ) - { - String theConvertedString = - convertNameComponentToString( theNameComponents[0] ); - String temp; - for( int i = 1; i < theNameComponents.length; i++ ) { - temp = convertNameComponentToString( theNameComponents[i] ); - if( temp != null ) { - theConvertedString = - theConvertedString + "/" + convertNameComponentToString( - theNameComponents[i] ); - } - } - return theConvertedString; - } - - /** This method converts a single Namecomponent to String, By adding Escapes - * If neccessary. - */ - private String convertNameComponentToString( - org.omg.CosNaming.NameComponent theNameComponent ) - { - if( ( ( theNameComponent.id == null ) - ||( theNameComponent.id.length() == 0 ) ) - &&( ( theNameComponent.kind == null ) - ||( theNameComponent.kind.length() == 0 ) ) ) - { - return "."; - } - else if( ( theNameComponent.id == null ) - ||( theNameComponent.id.length() == 0 ) ) - { - String kind = addEscape( theNameComponent.kind ); - return "." + kind; - } - else if( ( theNameComponent.kind == null ) - ||( theNameComponent.kind.length() == 0 ) ) - { - String id = addEscape( theNameComponent.id ); - return id; - } - else { - String id = addEscape( theNameComponent.id ); - String kind = addEscape( theNameComponent.kind ); - return (id + "." + kind); - } - } - - - /** This method adds escape '\' for the Namecomponent if neccessary - */ - private String addEscape( String value ) - { - StringBuffer theNewValue; - if( (value != null) && ( (value.indexOf('.') != -1 ) || - (value.indexOf('/') != -1))) - { - char c; - theNewValue = new StringBuffer( ); - for( int i = 0; i < value.length( ); i++ ) { - c = value.charAt( i ); - if( ( c != '.' ) && (c != '/' ) ) - { - theNewValue.append( c ); - } - else { - // Adding escape for the "." - theNewValue.append( '\\' ); - theNewValue.append( c ); - } - } - } - else { - return value; - } - return new String( theNewValue ); - } - - /** - * Method which converts the Stringified name into Array of Name Components. - * - * @param string which is the stringified name. - * @return Array of Name Components (Simple or Compound Names) - */ - public org.omg.CosNaming.NameComponent[] convertToNameComponent( - String theStringifiedName ) - throws org.omg.CosNaming.NamingContextPackage.InvalidName - { - String[] theStringifiedNameComponents = - breakStringToNameComponents( theStringifiedName ); - if( ( theStringifiedNameComponents == null ) - || (theStringifiedNameComponents.length == 0 ) ) - { - return null; - } - NameComponent[] theNameComponents = - new NameComponent[theStringifiedNameComponents.length]; - for( int i = 0; i < theStringifiedNameComponents.length; i++ ) { - theNameComponents[i] = createNameComponentFromString( - theStringifiedNameComponents[i] ); - } - return theNameComponents; - } - - /** Step1 in converting Stringified name into array of Name Component - * is breaking the String into multiple name components - */ - private String[] breakStringToNameComponents( String theStringifiedName ) { - int[] theIndices = new int[100]; - int theIndicesIndex = 0; - - for(int index = 0; index <= theStringifiedName.length(); ) { - theIndices[theIndicesIndex] = theStringifiedName.indexOf( '/', - index ); - if( theIndices[theIndicesIndex] == -1 ) { - // This is the end of all the occurence of '/' and hence come - // out of the loop - index = theStringifiedName.length()+1; - } - else { - // If the '/' is found, first check whether it is - // preceded by escape '\' - // If not then set theIndices and increment theIndicesIndex - // and also set the index else just ignore the '/' - if( (theIndices[theIndicesIndex] > 0 ) - && (theStringifiedName.charAt( - theIndices[theIndicesIndex]-1) == '\\') ) - { - index = theIndices[theIndicesIndex] + 1; - theIndices[theIndicesIndex] = -1; - } - else { - index = theIndices[theIndicesIndex] + 1; - theIndicesIndex++; - } - } - } - if( theIndicesIndex == 0 ) { - String[] tempString = new String[1]; - tempString[0] = theStringifiedName; - return tempString; - } - if( theIndicesIndex != 0 ) { - theIndicesIndex++; - } - return StringComponentsFromIndices( theIndices, theIndicesIndex, - theStringifiedName ); - } - - /** This method breaks one big String into multiple substrings based - * on the array of index passed in. - */ - private String[] StringComponentsFromIndices( int[] theIndices, - int indicesCount, String theStringifiedName ) - { - String[] theStringComponents = new String[indicesCount]; - int firstIndex = 0; - int lastIndex = theIndices[0]; - for( int i = 0; i < indicesCount; i++ ) { - theStringComponents[i] = theStringifiedName.substring( firstIndex, - lastIndex ); - if( ( theIndices[i] < theStringifiedName.length() - 1 ) - &&( theIndices[i] != -1 ) ) - { - firstIndex = theIndices[i]+1; - } - else { - firstIndex = 0; - i = indicesCount; - } - if( (i+1 < theIndices.length) - && (theIndices[i+1] < (theStringifiedName.length() - 1)) - && (theIndices[i+1] != -1) ) - { - lastIndex = theIndices[i+1]; - } - else { - i = indicesCount; - } - // This is done for the last component - if( firstIndex != 0 && i == indicesCount ) { - theStringComponents[indicesCount-1] = - theStringifiedName.substring( firstIndex ); - } - } - return theStringComponents; - } - - /** Step 2: After Breaking the Stringified name into set of NameComponent - * Strings, The next step is to create Namecomponents from the substring - * by removing the escapes if there are any. - */ - private NameComponent createNameComponentFromString( - String theStringifiedNameComponent ) - throws org.omg.CosNaming.NamingContextPackage.InvalidName - - { - String id = null; - String kind = null; - if( ( theStringifiedNameComponent == null ) - || ( theStringifiedNameComponent.length( ) == 0) - || ( theStringifiedNameComponent.endsWith(".") ) ) - { - // If any of the above is true, then we create an invalid Name - // Component to indicate that it is an invalid name. - throw new org.omg.CosNaming.NamingContextPackage.InvalidName( ); - } - - int index = theStringifiedNameComponent.indexOf( '.', 0 ); - // The format could be XYZ (Without kind) - if( index == -1 ) { - id = theStringifiedNameComponent; - } - // The format is .XYZ (Without ID) - else if( index == 0 ) { - // This check is for the Namecomponent which is just "." meaning Id - // and Kinds are null - if( theStringifiedNameComponent.length( ) != 1 ) { - kind = theStringifiedNameComponent.substring(1); - } - } - else - { - if( theStringifiedNameComponent.charAt(index-1) != '\\' ) { - id = theStringifiedNameComponent.substring( 0, index); - kind = theStringifiedNameComponent.substring( index + 1 ); - } - else { - boolean kindfound = false; - while( (index < theStringifiedNameComponent.length() ) - &&( kindfound != true ) ) - { - index = theStringifiedNameComponent.indexOf( '.',index + 1); - if( index > 0 ) { - if( theStringifiedNameComponent.charAt( - index - 1 ) != '\\' ) - { - kindfound = true; - } - } - else - { - // No more '.', which means there is no Kind - index = theStringifiedNameComponent.length(); - } - } - if( kindfound == true ) { - id = theStringifiedNameComponent.substring( 0, index); - kind = theStringifiedNameComponent.substring(index + 1 ); - } - else { - id = theStringifiedNameComponent; - } - } - } - id = cleanEscapeCharacter( id ); - kind = cleanEscapeCharacter( kind ); - if( id == null ) { - id = ""; - } - if( kind == null ) { - kind = ""; - } - return new NameComponent( id, kind ); - } - - - /** This method cleans the escapes in the Stringified name and returns the - * correct String - */ - private String cleanEscapeCharacter( String theString ) - { - if( ( theString == null ) || (theString.length() == 0 ) ) { - return theString; - } - int index = theString.indexOf( '\\' ); - if( index == 0 ) { - return theString; - } - else { - StringBuffer src = new StringBuffer( theString ); - StringBuffer dest = new StringBuffer( ); - char c; - for( int i = 0; i < theString.length( ); i++ ) { - c = src.charAt( i ); - if( c != '\\' ) { - dest.append( c ); - } else { - if( i+1 < theString.length() ) { - char d = src.charAt( i + 1 ); - // If there is a AlphaNumeric character after a \ - // then include slash, as it is not intended as an - // escape character. - if( Character.isLetterOrDigit(d) ) { - dest.append( c ); - } - } - } - } - return new String(dest); - } - } - - /** - * Method which converts the Stringified name and Host Name Address into - * a URL based Name - * - * @param address which is ip based host name - * @param name which is the stringified name. - * @return url based Name. - */ - public String createURLBasedAddress( String address, String name ) - throws InvalidAddress - { - String theurl = null; - if( ( address == null ) - ||( address.length() == 0 ) ) { - throw new InvalidAddress(); - } - else { - theurl = "corbaname:" + address + "#" + encode( name ); - } - return theurl; - } - - /** Encodes the string according to RFC 2396 IETF spec required by INS. - */ - private String encode( String stringToEncode ) { - StringWriter theStringAfterEscape = new StringWriter(); - int byteCount = 0; - for( int i = 0; i < stringToEncode.length(); i++ ) - { - char c = stringToEncode.charAt( i ) ; - if( Character.isLetterOrDigit( c ) ) { - theStringAfterEscape.write( c ); - } - // Do no Escape for characters in this list - // RFC 2396 - else if((c == ';') || (c == '/') || (c == '?') - || (c == ':') || (c == '@') || (c == '&') || (c == '=') - || (c == '+') || (c == '$') || (c == ';') || (c == '-') - || (c == '_') || (c == '.') || (c == '!') || (c == '~') - || (c == '*') || (c == ' ') || (c == '(') || (c == ')') ) - { - theStringAfterEscape.write( c ); - } - else { - // Add escape - theStringAfterEscape.write( '%' ); - String hexString = Integer.toHexString( (int) c ); - theStringAfterEscape.write( hexString ); - } - } - return theStringAfterEscape.toString(); - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java 2018-01-30 20:18:15.000000000 -0500 +++ /dev/null 2018-01-30 20:18:15.000000000 -0500 @@ -1,101 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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.corba.se.impl.naming.cosnaming; - -import org.omg.CosNaming.NameComponent; - -/** - * Class InternalBindingKey implements the necessary wrapper code - * around the org.omg.CosNaming::NameComponent class to implement the proper - * equals() method and the hashCode() method for use in a hash table. - * It computes the hashCode once and stores it, and also precomputes - * the lengths of the id and kind strings for faster comparison. - */ -public class InternalBindingKey -{ - // A key contains a name - public NameComponent name; - private int idLen; - private int kindLen; - private int hashVal; - - // Default Constructor - public InternalBindingKey() {} - - // Normal constructor - public InternalBindingKey(NameComponent n) - { - idLen = 0; - kindLen = 0; - setup(n); - } - - // Setup the object - protected void setup(NameComponent n) { - this.name = n; - // Precompute lengths and values since they will not change - if( this.name.id != null ) { - idLen = this.name.id.length(); - } - if( this.name.kind != null ) { - kindLen = this.name.kind.length(); - } - hashVal = 0; - if (idLen > 0) - hashVal += this.name.id.hashCode(); - if (kindLen > 0) - hashVal += this.name.kind.hashCode(); - } - - // Compare the keys by comparing name's id and kind - public boolean equals(java.lang.Object o) { - if (o == null) - return false; - if (o instanceof InternalBindingKey) { - InternalBindingKey that = (InternalBindingKey)o; - // Both lengths must match - if (this.idLen != that.idLen || this.kindLen != that.kindLen) { - return false; - } - // If id is set is must be equal - if (this.idLen > 0 && this.name.id.equals(that.name.id) == false) { - return false; - } - // If kind is set it must be equal - if (this.kindLen > 0 && this.name.kind.equals(that.name.kind) == false) { - return false; - } - // Must be the same - return true; - } else { - return false; - } - } - // Return precomputed value - public int hashCode() { - return this.hashVal; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java 2018-01-30 20:18:16.000000000 -0500 +++ /dev/null 2018-01-30 20:18:16.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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.corba.se.impl.naming.cosnaming; - -import org.omg.CORBA.Object; -import org.omg.CosNaming.Binding; -import org.omg.CosNaming.NameComponent; - -/** - * Class InternalBindingKey acts as a container for two objects, namely - * a org.omg.CosNaming::Binding and an CORBA object reference, which are the two - * components associated with the binding. - */ -public class InternalBindingValue -{ - public Binding theBinding; - public String strObjectRef; - public org.omg.CORBA.Object theObjectRef; - - // Default constructor - public InternalBindingValue() {} - - // Normal constructor - public InternalBindingValue(Binding b, String o) { - theBinding = b; - strObjectRef = o; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java 2018-01-30 20:18:17.000000000 -0500 +++ /dev/null 2018-01-30 20:18:17.000000000 -0500 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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.corba.se.impl.naming.cosnaming; - -// Import general CORBA classes -import org.omg.CORBA.Object; - -// Import org.omg.CosNaming classes -import org.omg.CosNaming.BindingType; -import org.omg.CosNaming.BindingTypeHolder; -import org.omg.CosNaming.BindingListHolder; -import org.omg.CosNaming.BindingIteratorHolder; -import org.omg.CosNaming.NameComponent; -import org.omg.CosNaming.NamingContext; -import org.omg.PortableServer.POA; - -/** - * This interface defines a set of methods that must be implemented by the - * "data store" associated with a NamingContext implementation. - * It allows for different implementations of naming contexts that - * support the same API but differ in storage mechanism. - */ -public interface NamingContextDataStore { - /** - * Method which implements binding a name to an object as - * the specified binding type. - * @param n a NameComponent which is the name under which the object - * will be bound. - * @param obj the object reference to be bound. - * @param bt Type of binding (as object or as context). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - void Bind(NameComponent n, org.omg.CORBA.Object obj, BindingType bt) - throws org.omg.CORBA.SystemException; - - /** - * Method which implements resolving the specified name, - * returning the type of the binding and the bound object reference. - * If the id and kind of the NameComponent are both empty, the initial - * naming context (i.e., the local root) must be returned. - * @param n a NameComponent which is the name to be resolved. - * @param bth the BindingType as an out parameter. - * @return the object reference bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - org.omg.CORBA.Object Resolve(NameComponent n,BindingTypeHolder bth) - throws org.omg.CORBA.SystemException; - - /** - * Method which implements unbinding a name. - * @return the object reference bound to the name, or null if not found. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - org.omg.CORBA.Object Unbind(NameComponent n) - throws org.omg.CORBA.SystemException; - - /** - * Method which implements listing the contents of this - * NamingContext and return a binding list and a binding iterator. - * @param how_many The number of requested bindings in the BindingList. - * @param bl The BindingList as an out parameter. - * @param bi The BindingIterator as an out parameter. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - void List(int how_many, BindingListHolder bl, BindingIteratorHolder bi) - throws org.omg.CORBA.SystemException; - - /** - * Method which implements creating a new NamingContext. - * @return an object reference for a new NamingContext object implemented - * by this Name Server. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - NamingContext NewContext() - throws org.omg.CORBA.SystemException; - - /** - * Method which implements destroying this NamingContext. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - void Destroy() - throws org.omg.CORBA.SystemException; - - /** - * Method which returns whether this NamingContext is empty - * or not. - * @return true if this NamingContext contains no bindings. - */ - boolean IsEmpty(); - - POA getNSPOA( ); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java 2018-01-30 20:18:17.000000000 -0500 +++ /dev/null 2018-01-30 20:18:17.000000000 -0500 @@ -1,1025 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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.corba.se.impl.naming.cosnaming; - -// Imports for Logging -import java.util.logging.Logger; -import java.util.logging.Level; -import com.sun.corba.se.impl.orbutil.LogKeywords; - -// Import general CORBA classes -import org.omg.CORBA.Object; -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.PortableServer.POA; -import org.omg.PortableServer.Servant; - -// Import org.omg.CosNaming classes -import org.omg.CosNaming.BindingType; -import org.omg.CosNaming.BindingTypeHolder; -import org.omg.CosNaming.BindingListHolder; -import org.omg.CosNaming.BindingIteratorHolder; -import org.omg.CosNaming.NameComponent; -import org.omg.CosNaming.NamingContextHelper; -import org.omg.CosNaming.NamingContext; -import org.omg.CosNaming.NamingContextPackage.*; -import org.omg.CosNaming._NamingContextImplBase; -import org.omg.CosNaming.NamingContextExtHelper; -import org.omg.CosNaming.NamingContextExt; -import org.omg.CosNaming.NamingContextExtPOA; -import org.omg.CosNaming.NamingContextExtPackage.*; -import org.omg.CosNaming.NamingContextPackage.NotFound; - -import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore; - -import com.sun.corba.se.impl.naming.namingutil.INSURLHandler; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.impl.logging.NamingSystemException ; - -import com.sun.corba.se.spi.orb.ORB; - -/** - * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext - * interface, but does not implement the methods associated with - * maintaining the "table" of current bindings in a NamingContext. - * Instead, this implementation assumes that the derived implementation - * implements the NamingContextDataStore interface, which has the necessary - * methods. This allows multiple - * NamingContext implementations that differ in storage of the bindings, - * as well as implementations of interfaces derived from - * CosNaming::NamingContext that still reuses the implementation. - *

- * The operations bind(), rebind(), bind_context() and rebind_context() - * are all really implemented by doBind(). resolve() is really implemented - * by doResolve(), unbind() by doUnbind(). list(), new_context() and - * destroy() uses the NamingContextDataStore interface directly. All the - * doX() methods are public static. - * They synchronize on the NamingContextDataStore object. - *

- * An implementation a NamingContext must extend this class and implement - * the NamingContextDataStore interface with the operations: - * Bind(), Resolve(), - * Unbind(), List(), NewContext() and Destroy(). Calls - * to these methods are synchronized; these methods should - * therefore not be synchronized. - */ -public abstract class NamingContextImpl - extends NamingContextExtPOA - implements NamingContextDataStore -{ - - protected POA nsPOA; - private Logger readLogger, updateLogger, lifecycleLogger; - private NamingSystemException wrapper ; - private static NamingSystemException staticWrapper = - NamingSystemException.get( CORBALogDomains.NAMING_UPDATE ) ; - - // The grammer for Parsing and Building Interoperable Stringified Names - // are implemented in this class - private InterOperableNamingImpl insImpl; - /** - * Create a naming context servant. - * Runs the super constructor. - * @param orb an ORB object. - * @exception java.lang.Exception a Java exception. - */ - public NamingContextImpl(ORB orb, POA poa) throws java.lang.Exception { - super(); - this.orb = orb; - wrapper = NamingSystemException.get( orb, - CORBALogDomains.NAMING_UPDATE ) ; - - insImpl = new InterOperableNamingImpl( ); - this.nsPOA = poa; - readLogger = orb.getLogger( CORBALogDomains.NAMING_READ); - updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE); - lifecycleLogger = orb.getLogger( - CORBALogDomains.NAMING_LIFECYCLE); - } - - public POA getNSPOA( ) { - return nsPOA; - } - - /** - * Bind an object under a name in this NamingContext. If the name - * contains multiple (n) components, n-1 will be resolved in this - * NamingContext and the object bound in resulting NamingContext. - * An exception is thrown if a binding with the supplied name already - * exists. If the - * object to be bound is a NamingContext it will not participate in - * a recursive resolve. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param obj the object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could - * not proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object - * is already bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see doBind - */ - public void bind(NameComponent[] n, org.omg.CORBA.Object obj) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName, - org.omg.CosNaming.NamingContextPackage.AlreadyBound - { - if( obj == null ) - { - updateLogger.warning( LogKeywords.NAMING_BIND + - " unsuccessful because NULL Object cannot be Bound " ); - throw wrapper.objectIsNull() ; - } - // doBind implements all four flavors of binding - NamingContextDataStore impl = (NamingContextDataStore)this; - doBind(impl,n,obj,false,BindingType.nobject); - if( updateLogger.isLoggable( Level.FINE ) ) { - // isLoggable call to make sure that we save some precious - // processor cycles, if there is no need to log. - updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " + - NamingUtils.getDirectoryStructuredName( n ) ); - } - } - - - /** - * Bind a NamingContext under a name in this NamingContext. If the name - * contains multiple (n) components, n-1 will be resolved in this - * NamingContext and the object bound in resulting NamingContext. - * An exception is thrown if a binding with the supplied name already - * exists. The NamingContext will participate in recursive resolving. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param nc the NamingContext object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could - * not proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object - * is already bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see doBind - */ - public void bind_context(NameComponent[] n, NamingContext nc) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName, - org.omg.CosNaming.NamingContextPackage.AlreadyBound - { - if( nc == null ) { - updateLogger.warning( LogKeywords.NAMING_BIND_FAILURE + - " NULL Context cannot be Bound " ); - throw new BAD_PARAM( "Naming Context should not be null " ); - } - // doBind implements all four flavors of binding - NamingContextDataStore impl = (NamingContextDataStore)this; - doBind(impl,n,nc,false,BindingType.ncontext); - if( updateLogger.isLoggable( Level.FINE ) ) { - // isLoggable call to make sure that we save some precious - // processor cycles, if there is no need to log. - updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " + - NamingUtils.getDirectoryStructuredName( n ) ); - } - } - - /** - * Bind an object under a name in this NamingContext. If the name - * contains multiple (n) components, n-1 will be resolved in this - * NamingContext and the object bound in resulting NamingContext. - * If a binding under the supplied name already exists it will be - * unbound first. If the - * object to be bound is a NamingContext it will not participate in - * a recursive resolve. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param obj the object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see doBind - */ - public void rebind(NameComponent[] n, org.omg.CORBA.Object obj) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - if( obj == null ) - { - updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE + - " NULL Object cannot be Bound " ); - throw wrapper.objectIsNull() ; - } - try { - // doBind implements all four flavors of binding - NamingContextDataStore impl = (NamingContextDataStore)this; - doBind(impl,n,obj,true,BindingType.nobject); - } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) { - updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE + - NamingUtils.getDirectoryStructuredName( n ) + - " is already bound to a Naming Context" ); - // This should not happen - throw wrapper.namingCtxRebindAlreadyBound( ex ) ; - } - if( updateLogger.isLoggable( Level.FINE ) ) { - // isLoggable call to make sure that we save some precious - // processor cycles, if there is no need to log. - updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " + - NamingUtils.getDirectoryStructuredName( n ) ); - } - } - - /** - * Bind a NamingContext under a name in this NamingContext. If the name - * contains multiple (n) components, the first n-1 components will be - * resolved in this NamingContext and the object bound in resulting - * NamingContext. If a binding under the supplied name already exists it - * will be unbound first. The NamingContext will participate in recursive - * resolving. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param nc the object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see doBind - */ - public void rebind_context(NameComponent[] n, NamingContext nc) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - if( nc == null ) - { - updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE + - " NULL Context cannot be Bound " ); - throw wrapper.objectIsNull() ; - } - try { - // doBind implements all four flavors of binding - NamingContextDataStore impl = (NamingContextDataStore)this; - doBind(impl,n,nc,true,BindingType.ncontext); - } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) { - // This should not happen - updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE + - NamingUtils.getDirectoryStructuredName( n ) + - " is already bound to a CORBA Object" ); - throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ; - } - if( updateLogger.isLoggable( Level.FINE ) ) { - // isLoggable call to make sure that we save some precious - // processor cycles, if there is no need to log. - updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " + - NamingUtils.getDirectoryStructuredName( n ) ); - } - } - - /** - * Resolve a name in this NamingContext and return the object reference - * bound to the name. If the name contains multiple (n) components, - * the first component will be resolved in this NamingContext and the - * remaining components resolved in the resulting NamingContext, provided - * that the NamingContext bound to the first component of the name was - * bound with bind_context(). - * @param n a sequence of NameComponents which is the name to be resolved. - * @return the object reference bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see doResolve - */ - public org.omg.CORBA.Object resolve(NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - // doResolve actually resolves - NamingContextDataStore impl = (NamingContextDataStore)this; - org.omg.CORBA.Object obj = doResolve(impl,n); - if( obj != null ) { - if( readLogger.isLoggable( Level.FINE ) ) { - readLogger.fine( LogKeywords.NAMING_RESOLVE_SUCCESS + - " Name: " + NamingUtils.getDirectoryStructuredName( n ) ); - } - } else { - readLogger.warning( LogKeywords.NAMING_RESOLVE_FAILURE + - " Name: " + NamingUtils.getDirectoryStructuredName( n ) ); - } - return obj; - } - - - /** - * Remove a binding from this NamingContext. If the name contains - * multiple (n) components, the first n-1 components will be resolved - * from this NamingContext and the final component unbound in - * the resulting NamingContext. - * @param n a sequence of NameComponents which is the name to be unbound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see doUnbind - */ - public void unbind(NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - // doUnbind actually unbinds - NamingContextDataStore impl = (NamingContextDataStore)this; - doUnbind(impl,n); - if( updateLogger.isLoggable( Level.FINE ) ) { - // isLoggable call to make sure that we save some precious - // processor cycles, if there is no need to log. - updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS + - " Name: " + NamingUtils.getDirectoryStructuredName( n ) ); - } - } - - /** - * List the contents of this NamingContest. A sequence of bindings - * is returned (a BindingList) containing up to the number of requested - * bindings, and a BindingIterator object reference is returned for - * iterating over the remaining bindings. - * @param how_many The number of requested bindings in the BindingList. - * @param bl The BindingList as an out parameter. - * @param bi The BindingIterator as an out parameter. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see BindingListHolder - * @see BindingIteratorImpl - */ - public void list(int how_many, BindingListHolder bl, - BindingIteratorHolder bi) - { - // List actually generates the list - NamingContextDataStore impl = (NamingContextDataStore)this; - synchronized (impl) { - impl.List(how_many,bl,bi); - } - if( readLogger.isLoggable( Level.FINE ) && (bl.value != null )) { - // isLoggable call to make sure that we save some precious - // processor cycles, if there is no need to log. - readLogger.fine ( LogKeywords.NAMING_LIST_SUCCESS + - "list(" + how_many + ") -> bindings[" + bl.value.length + - "] + iterator: " + bi.value); - } - } - - /** - * Create a NamingContext object and return its object reference. - * @return an object reference for a new NamingContext object implemented - * by this Name Server. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - public synchronized NamingContext new_context() - { - // Create actually creates a new naming context - lifecycleLogger.fine( "Creating New Naming Context " ); - NamingContextDataStore impl = (NamingContextDataStore)this; - synchronized (impl) { - NamingContext nctx = impl.NewContext(); - if( nctx != null ) { - lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS ); - } else { - // If naming context is null, then that must be a serious - // error. - lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE ); - } - return nctx; - } - } - - /** - * Create a new NamingContext, bind it in this Naming Context and return - * its object reference. This is equivalent to using new_context() followed - * by bind_context() with the supplied name and the object reference for - * the newly created NamingContext. - * @param n a sequence of NameComponents which is the name to be unbound. - * @return an object reference for a new NamingContext object implemented - * by this Name Server, bound to the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object - * is already bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see new_context - * @see bind_context - */ - public NamingContext bind_new_context(NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.AlreadyBound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - NamingContext nc = null; - NamingContext rnc = null; - try { - if (debug) - dprint("bind_new_context " + nameToString(n)); - // The obvious solution: - nc = this.new_context(); - this.bind_context(n,nc); - rnc = nc; - nc = null; - } finally { - try { - if(nc != null) - nc.destroy(); - } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) { - } - } - if( updateLogger.isLoggable( Level.FINE ) ) { - // isLoggable call to make sure that we save some precious - // processor cycles, if there is no need to log. - updateLogger.fine ( LogKeywords.NAMING_BIND + - "New Context Bound To " + - NamingUtils.getDirectoryStructuredName( n ) ); - } - return rnc; - } - - /** - * Destroy this NamingContext object. If this NamingContext contains - * no bindings, the NamingContext is deleted. - * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This - * NamingContext is not empty (i.e., contains bindings). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - public void destroy() - throws org.omg.CosNaming.NamingContextPackage.NotEmpty - { - lifecycleLogger.fine( "Destroying Naming Context " ); - NamingContextDataStore impl = (NamingContextDataStore)this; - synchronized (impl) { - if (impl.IsEmpty() == true) { - // The context is empty so it can be destroyed - impl.Destroy(); - lifecycleLogger.fine ( LogKeywords.LIFECYCLE_DESTROY_SUCCESS ); - } - else { - // This context is not empty! - // Not a fatal error, warning should do. - lifecycleLogger.warning( LogKeywords.LIFECYCLE_DESTROY_FAILURE + - " NamingContext children are not destroyed still.." ); - throw new NotEmpty(); - } - } - } - - /** - * Implements all four flavors of binding. It uses Resolve() to - * check if a binding already exists (for bind and bind_context), and - * unbind() to ensure that a binding does not already exist. - * If the length of the name is 1, then Bind() is called with - * the name and the object to bind. Otherwise, the first component - * of the name is resolved in this NamingContext and the appropriate - * form of bind passed to the resulting NamingContext. - * This method is static for maximal reuse - even for extended naming - * context implementations where the recursive semantics still apply. - * @param impl an implementation of NamingContextDataStore - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param obj the object reference to be bound. - * @param rebind Replace an existing binding or not. - * @param bt Type of binding (as object or as context). - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not * proceed - * in resolving the first component of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The - * supplied name is invalid (i.e., has length less than 1). - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object - * is already bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - * @see resolve - * @see unbind - * @see bind - * @see bind_context - * @see rebind - * @see rebind_context - */ - public static void doBind(NamingContextDataStore impl, - NameComponent[] n, - org.omg.CORBA.Object obj, - boolean rebind, - org.omg.CosNaming.BindingType bt) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName, - org.omg.CosNaming.NamingContextPackage.AlreadyBound - { - // Valid name? - if (n.length < 1) - throw new InvalidName(); - - // At bottom level? - if (n.length == 1) { - // The identifier must be set - if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) { - throw new InvalidName(); - } - - // Ensure synchronization of backend - synchronized (impl) { - // Yes: bind object in this context under the name - BindingTypeHolder bth = new BindingTypeHolder(); - if (rebind) { - org.omg.CORBA.Object objRef = impl.Resolve( n[0], bth ); - if( objRef != null ) { - // Refer Naming Service Doc:00-11-01 section 2.2.3.4 - // If there is an object already bound with the name - // and the binding type is not ncontext a NotFound - // Exception with a reason of not a context has to be - // raised. - // Fix for bug Id: 4384628 - if ( bth.value.value() == BindingType.nobject.value() ){ - if ( bt.value() == BindingType.ncontext.value() ) { - throw new NotFound( - NotFoundReason.not_context, n); - } - } else { - // Previously a Context was bound and now trying to - // bind Object. It is invalid. - if ( bt.value() == BindingType.nobject.value() ) { - throw new NotFound( - NotFoundReason.not_object, n); - } - } - impl.Unbind(n[0]); - } - - } else { - if (impl.Resolve(n[0],bth) != null) - // "Resistence is futile." [Borg pickup line] - throw new AlreadyBound(); - } - - // Now there are no other bindings under this name - impl.Bind(n[0],obj,bt); - } - } else { - // No: bind in a different context - NamingContext context = resolveFirstAsContext(impl,n); - - // Compute tail - NameComponent[] tail = new NameComponent[n.length - 1]; - System.arraycopy(n,1,tail,0,n.length-1); - - // How should we propagate the bind - switch (bt.value()) { - case BindingType._nobject: - { - // Bind as object - if (rebind) - context.rebind(tail,obj); - else - context.bind(tail,obj); - } - break; - case BindingType._ncontext: - { - // Narrow to a naming context using Java casts. It must - // work. - NamingContext objContext = (NamingContext)obj; - // Bind as context - if (rebind) - context.rebind_context(tail,objContext); - else - context.bind_context(tail,objContext); - } - break; - default: - // This should not happen - throw staticWrapper.namingCtxBadBindingtype() ; - } - } - } - - /** - * Implements resolving names in this NamingContext. The first component - * of the supplied name is resolved in this NamingContext by calling - * Resolve(). If there are no more components in the name, the - * resulting object reference is returned. Otherwise, the resulting object - * reference must have been bound as a context and be narrowable to - * a NamingContext. If this is the case, the remaining - * components of the name is resolved in the resulting NamingContext. - * This method is static for maximal reuse - even for extended naming - * context implementations where the recursive semantics still apply. - * @param impl an implementation of NamingContextDataStore - * @param n a sequence of NameComponents which is the name to be resolved. - * @return the object reference bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with - * multiple components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not - * proceed - * in resolving the first component of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied - * name is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system - * exceptions. - * @see resolve - */ - public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl, - NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - org.omg.CORBA.Object obj = null; - BindingTypeHolder bth = new BindingTypeHolder(); - - - // Length must be greater than 0 - if (n.length < 1) - throw new InvalidName(); - - // The identifier must be set - if (n.length == 1) { - synchronized (impl) { - // Resolve first level in this context - obj = impl.Resolve(n[0],bth); - } - if (obj == null) { - // Object was not found - throw new NotFound(NotFoundReason.missing_node,n); - } - return obj; - } else { - // n.length > 1 - if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0) ) { - throw new InvalidName(); - } - - NamingContext context = resolveFirstAsContext(impl,n); - - // Compute restOfName = name[1..length] - NameComponent[] tail = new NameComponent[n.length -1]; - System.arraycopy(n,1,tail,0,n.length-1); - - // Resolve rest of name in context - try { - // First try to resolve using the local call, this should work - // most of the time unless there are federated naming contexts. - Servant servant = impl.getNSPOA().reference_to_servant( - context ); - return doResolve(((NamingContextDataStore)servant), tail) ; - } catch( Exception e ) { - return context.resolve(tail); - } - } - } - - /** - * Implements unbinding bound names in this NamingContext. If the - * name contains only one component, the name is unbound in this - * NamingContext using Unbind(). Otherwise, the first component - * of the name is resolved in this NamingContext and - * unbind passed to the resulting NamingContext. - * This method is static for maximal reuse - even for extended naming - * context implementations where the recursive semantics still apply. - * @param impl an implementation of NamingContextDataStore - * @param n a sequence of NameComponents which is the name to be unbound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see resolve - */ - public static void doUnbind(NamingContextDataStore impl, - NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - // Name valid? - if (n.length < 1) - throw new InvalidName(); - - // Unbind here? - if (n.length == 1) { - // The identifier must be set - if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) { - throw new InvalidName(); - } - - org.omg.CORBA.Object objRef = null; - synchronized (impl) { - // Yes: unbind in this context - objRef = impl.Unbind(n[0]); - } - - if (objRef == null) - // It was not bound - throw new NotFound(NotFoundReason.missing_node,n); - // Done - return; - } else { - // No: unbind in a different context - - // Resolve first - must be resolveable - NamingContext context = resolveFirstAsContext(impl,n); - - // Compute tail - NameComponent[] tail = new NameComponent[n.length - 1]; - System.arraycopy(n,1,tail,0,n.length-1); - - // Propagate unbind to this context - context.unbind(tail); - } - } - - /** - * Implements resolving a NameComponent in this context and - * narrowing it to CosNaming::NamingContext. It will throw appropriate - * exceptions if not found or not narrowable. - * @param impl an implementation of NamingContextDataStore - * @param n a NameComponents which is the name to be found. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound The - * first component could not be resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the first component of the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see resolve - */ - protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl, - NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound { - org.omg.CORBA.Object topRef = null; - BindingTypeHolder bth = new BindingTypeHolder(); - NamingContext context = null; - - synchronized (impl) { - // Resolve first - must be resolveable - topRef = impl.Resolve(n[0],bth); - if (topRef == null) { - // It was not bound - throw new NotFound(NotFoundReason.missing_node,n); - } - } - - // Was it bound as a context? - if (bth.value != BindingType.ncontext) { - // It was not a context - throw new NotFound(NotFoundReason.not_context,n); - } - - // Narrow to a naming context - try { - context = NamingContextHelper.narrow(topRef); - } catch (org.omg.CORBA.BAD_PARAM ex) { - // It was not a context - throw new NotFound(NotFoundReason.not_context,n); - } - - // Hmm. must be ok - return context; - } - - - /** - * This operation creates a stringified name from the array of Name - * components. - * @param n Name of the object - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - */ - public String to_string(org.omg.CosNaming.NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.InvalidName - { - // Name valid? - if ( (n == null ) || (n.length == 0) ) - { - throw new InvalidName(); - } - NamingContextDataStore impl = (NamingContextDataStore)this; - - String theStringifiedName = insImpl.convertToString( n ); - - if( theStringifiedName == null ) - { - throw new InvalidName(); - } - - return theStringifiedName; - } - - - /** - * This operation converts a Stringified Name into an equivalent array - * of Name Components. - * @param sn Stringified Name of the object - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - */ - public org.omg.CosNaming.NameComponent[] to_name(String sn) - throws org.omg.CosNaming.NamingContextPackage.InvalidName - { - // Name valid? - if ( (sn == null ) || (sn.length() == 0) ) - { - throw new InvalidName(); - } - NamingContextDataStore impl = (NamingContextDataStore)this; - org.omg.CosNaming.NameComponent[] theNameComponents = - insImpl.convertToNameComponent( sn ); - if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) ) - { - throw new InvalidName(); - } - for( int i = 0; i < theNameComponents.length; i++ ) { - // If there is a name component whose id and kind null or - // zero length string, then an invalid name exception needs to be - // raised. - if ( ( ( theNameComponents[i].id == null ) - ||( theNameComponents[i].id.length() == 0 ) ) - &&( ( theNameComponents[i].kind == null ) - ||( theNameComponents[i].kind.length() == 0 ) ) ) { - throw new InvalidName(); - } - } - return theNameComponents; - } - - /** - * This operation creates a URL based "iiopname://" format name - * from the Stringified Name of the object. - * @param addr internet based address of the host machine where - * Name Service is running - * @param sn Stringified Name of the object - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress - * Indicates the internet based address of the host machine is - * incorrect - */ - - public String to_url(String addr, String sn) - throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - // Name valid? - if ( (sn == null ) || (sn.length() == 0) ) - { - throw new InvalidName(); - } - if( addr == null ) - { - throw new - org.omg.CosNaming.NamingContextExtPackage.InvalidAddress(); - } - NamingContextDataStore impl = (NamingContextDataStore)this; - String urlBasedAddress = null; - urlBasedAddress = insImpl.createURLBasedAddress( addr, sn ); - // Extra check to see that corba name url created is valid as per - // INS spec grammer. - try { - INSURLHandler.getINSURLHandler( ).parseURL( urlBasedAddress ); - } catch( BAD_PARAM e ) { - throw new - org.omg.CosNaming.NamingContextExtPackage.InvalidAddress(); - } - return urlBasedAddress; - } - - /** - * This operation resolves the Stringified name into the object - * reference. - * @param sn Stringified Name of the object - * @exception org.omg.CosNaming.NamingContextPackage.NotFound - * Indicates there is no object reference for the given name. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed - * Indicates that the given compound name is incorrect - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound - * Indicates the name is already bound. - * - */ - public org.omg.CORBA.Object resolve_str(String sn) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - org.omg.CORBA.Object theObject = null; - // Name valid? - if ( (sn == null ) || (sn.length() == 0) ) - { - throw new InvalidName(); - } - NamingContextDataStore impl = (NamingContextDataStore)this; - org.omg.CosNaming.NameComponent[] theNameComponents = - insImpl.convertToNameComponent( sn ); - - if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) ) - { - throw new InvalidName(); - } - theObject = resolve( theNameComponents ); - return theObject; - } - - - transient protected ORB orb; - - public static String nameToString(NameComponent[] name) - { - StringBuffer s = new StringBuffer("{"); - if (name != null || name.length > 0) { - for (int i=0;i0) - s.append(","); - s.append("["). - append(name[i].id). - append(","). - append(name[i].kind). - append("]"); - } - } - s.append("}"); - return s.toString(); - } - - // Debugging aids. - public static final boolean debug = false; - - private static void dprint(String msg) { - NamingUtils.dprint("NamingContextImpl(" + - Thread.currentThread().getName() + " at " + - System.currentTimeMillis() + - " ems): " + msg); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java 2018-01-30 20:18:18.000000000 -0500 +++ /dev/null 2018-01-30 20:18:18.000000000 -0500 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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.corba.se.impl.naming.cosnaming; - -import java.io.*; -import org.omg.CosNaming.NameComponent; - - -public class NamingUtils { - // Do not instantiate this class - private NamingUtils() {}; - - /** - * Debug flag which must be true for debug streams to be created and - * dprint output to be generated. - */ - public static boolean debug = false; - - /** - * Prints the message to the debug stream if debugging is enabled. - * @param msg the debug message to print. - */ - public static void dprint(String msg) { - if (debug && debugStream != null) - debugStream.println(msg); - } - - /** - * Prints the message to the error stream (System.err is default). - * @param msg the error message to print. - */ - public static void errprint(String msg) { - if (errStream != null) - errStream.println(msg); - else - System.err.println(msg); - } - - /** - * Prints the stacktrace of the supplied exception to the error stream. - * @param e any Java exception. - */ - public static void printException(java.lang.Exception e) { - if (errStream != null) - e.printStackTrace(errStream); - else - e.printStackTrace(); - } - - /** - * Create a debug print stream to the supplied log file. - * @param logFile the file to which debug output will go. - * @exception IOException thrown if the file cannot be opened for output. - */ - public static void makeDebugStream(File logFile) - throws java.io.IOException { - // Create an outputstream for debugging - java.io.OutputStream logOStream = - new java.io.FileOutputStream(logFile); - java.io.DataOutputStream logDStream = - new java.io.DataOutputStream(logOStream); - debugStream = new java.io.PrintStream(logDStream); - - // Emit first message - debugStream.println("Debug Stream Enabled."); - } - - /** - * Create a error print stream to the supplied file. - * @param errFile the file to which error messages will go. - * @exception IOException thrown if the file cannot be opened for output. - */ - public static void makeErrStream(File errFile) - throws java.io.IOException { - if (debug) { - // Create an outputstream for errors - java.io.OutputStream errOStream = - new java.io.FileOutputStream(errFile); - java.io.DataOutputStream errDStream = - new java.io.DataOutputStream(errOStream); - errStream = new java.io.PrintStream(errDStream); - dprint("Error stream setup completed."); - } - } - - - /** - * A utility method that takes Array of NameComponent and converts - * into a directory structured name in the format of /id1.kind1/id2.kind2.. - * This is used mainly for Logging. - */ - static String getDirectoryStructuredName( NameComponent[] name ) { - StringBuffer directoryStructuredName = new StringBuffer("/"); - for( int i = 0; i < name.length; i++ ) { - directoryStructuredName.append( name[i].id + "." + name[i].kind ); - } - return directoryStructuredName.toString( ); - } - - /** - * The debug printstream. - */ - public static java.io.PrintStream debugStream; - - /** - * The error printstream. - */ - public static java.io.PrintStream errStream; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java 2018-01-30 20:18:19.000000000 -0500 +++ /dev/null 2018-01-30 20:18:19.000000000 -0500 @@ -1,133 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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.corba.se.impl.naming.cosnaming; - -// Import general CORBA classes -import org.omg.CORBA.SystemException; -import org.omg.CORBA.ORB; -import org.omg.PortableServer.POA; - -// Get org.omg.CosNaming Types -import org.omg.CosNaming.Binding; -import org.omg.CosNaming.BindingType; -import org.omg.CosNaming.BindingTypeHolder; -import org.omg.CosNaming.NameComponent; - -// Get base implementation -import com.sun.corba.se.impl.naming.cosnaming.NamingContextImpl; -import com.sun.corba.se.impl.naming.cosnaming.InternalBindingValue; - -// Get a hash table -import java.util.Hashtable; -import java.util.Enumeration; - -/** - * Class TransientBindingIterator implements the abstract methods - * defined by BindingIteratorImpl, to use with the TransientNamingContext - * implementation of the NamingContextImpl. The TransientBindingIterator - * implementation receives a hash table of InternalBindingValues, and uses - * an Enumeration to iterate over the contents of the hash table. - * @see BindingIteratorImpl - * @see TransientNamingContext - */ -public class TransientBindingIterator extends BindingIteratorImpl -{ - // There is only one POA used for both TransientNamingContext and - // TransientBindingIteraor servants. - private POA nsPOA; - /** - * Constructs a new TransientBindingIterator object. - * @param orb a org.omg.CORBA.ORB object. - * @param aTable A hashtable containing InternalBindingValues which is - * the content of the TransientNamingContext. - * @exception Exception a Java exception thrown of the base class cannot - * initialize. - */ - public TransientBindingIterator(ORB orb, Hashtable aTable, - POA thePOA ) - throws java.lang.Exception - { - super(orb); - theHashtable = aTable; - theEnumeration = this.theHashtable.elements(); - currentSize = this.theHashtable.size(); - this.nsPOA = thePOA; - } - - /** - * Returns the next binding in the NamingContext. Uses the enumeration - * object to determine if there are more bindings and if so, returns - * the next binding from the InternalBindingValue. - * @param b The Binding as an out parameter. - * @return true if there were more bindings. - */ - final public boolean NextOne(org.omg.CosNaming.BindingHolder b) - { - // If there are more elements get the next element - boolean hasMore = theEnumeration.hasMoreElements(); - if (hasMore) { - b.value = - ((InternalBindingValue)theEnumeration.nextElement()).theBinding; - currentSize--; - } else { - // Return empty but marshalable binding - b.value = new Binding(new NameComponent[0],BindingType.nobject); - } - return hasMore; - } - - /** - * Destroys this BindingIterator by disconnecting from the ORB - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - final public void Destroy() - { - // Remove the object from the Active Object Map. - try { - byte[] objectId = nsPOA.servant_to_id( this ); - if( objectId != null ) { - nsPOA.deactivate_object( objectId ); - } - } - catch( Exception e ) { - NamingUtils.errprint("BindingIterator.Destroy():caught exception:"); - NamingUtils.printException(e); - } - } - - /** - * Returns the remaining number of elements in the iterator. - * @return the remaining number of elements in the iterator. - */ - public final int RemainingElements() { - return currentSize; - } - - private int currentSize; - private Hashtable theHashtable; - private Enumeration theEnumeration; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java 2018-01-30 20:18:19.000000000 -0500 +++ /dev/null 2018-01-30 20:18:19.000000000 -0500 @@ -1,236 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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.corba.se.impl.naming.cosnaming; - -import java.util.Properties; -import java.net.InetAddress; - -import org.omg.CORBA.ORB; - -import org.omg.CosNaming.NamingContext; - -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.naming.cosnaming.TransientNameService; - -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.CorbaResourceUtil; -import com.sun.corba.se.impl.logging.NamingSystemException; - -/** - * Class TransientNameServer is a standalone application which - * implements a transient name service. It uses the TransientNameService - * class for the name service implementation, and the BootstrapServer - * for implementing bootstrapping, i.e., to get the initial NamingContext. - *

- * The BootstrapServer uses a Properties object specify the initial service - * object references supported; such as Properties object is created containing - * only a "NameService" entry together with the stringified object reference - * for the initial NamingContext. The BootstrapServer's listening port - * is set by first checking the supplied arguments to the name server - * (-ORBInitialPort), and if not set, defaults to the standard port number. - * The BootstrapServer is created supplying the Properties object, using no - * external File object for storage, and the derived initial port number. - * @see TransientNameService - * @see BootstrapServer - */ -public class TransientNameServer -{ - static private boolean debug = false ; - static NamingSystemException wrapper = NamingSystemException.get( - CORBALogDomains.NAMING ) ; - - static public void trace( String msg ) { - if (debug) - System.out.println( msg ) ; - } - - static public void initDebug( String[] args ) { - // If debug was compiled to be true for testing purposes, - // don't change it. - if (debug) - return ; - - for (int ctr=0; ctr 0 ) { - initialPort = java.lang.Integer.parseInt(ips); - // -Dorg.omg.CORBA.ORBInitialPort=0 is invalid - if( initialPort == 0 ) { - orbInitialPort0 = true; - throw wrapper.transientNameServerBadPort() ; - } - } - String hostName = - System.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ; - if( hostName != null ) { - invalidHostOption = true; - throw wrapper.transientNameServerBadHost() ; - } - } catch (java.lang.NumberFormatException e) { - // do nothing - } - - // Let arguments override - for (int i=0;i - * The TransientNameService creates the initial NamingContext object. - * @see NamingContextImpl - * @see BindingIteratorImpl - * @see TransientNamingContext - * @see TransientBindingIterator - */ -public class TransientNameService -{ - /** - * Constructs a new TransientNameService, and creates an initial - * NamingContext, whose object - * reference can be obtained by the initialNamingContext method. - * @param orb The ORB object - * @exception org.omg.CORBA.INITIALIZE Thrown if - * the TransientNameService cannot initialize. - */ - public TransientNameService(com.sun.corba.se.spi.orb.ORB orb ) - throws org.omg.CORBA.INITIALIZE - { - // Default constructor uses "NameService" as the key for the Root Naming - // Context. If default constructor is used then INS's object key for - // Transient Name Service is "NameService" - initialize( orb, "NameService" ); - } - - /** - * Constructs a new TransientNameService, and creates an initial - * NamingContext, whose object - * reference can be obtained by the initialNamingContext method. - * @param orb The ORB object - * @param serviceName Stringified key used for INS Service registry - * @exception org.omg.CORBA.INITIALIZE Thrown if - * the TransientNameService cannot initialize. - */ - public TransientNameService(com.sun.corba.se.spi.orb.ORB orb, - String serviceName ) throws org.omg.CORBA.INITIALIZE - { - // This constructor gives the flexibility of providing the Object Key - // for the Root Naming Context that is registered with INS. - initialize( orb, serviceName ); - } - - - /** - * This method initializes Transient Name Service by associating Root - * context with POA and registering the root context with INS Object Keymap. - */ - private void initialize( com.sun.corba.se.spi.orb.ORB orb, - String nameServiceName ) - throws org.omg.CORBA.INITIALIZE - { - NamingSystemException wrapper = NamingSystemException.get( orb, - CORBALogDomains.NAMING ) ; - - try { - POA rootPOA = (POA) orb.resolve_initial_references( - ORBConstants.ROOT_POA_NAME ); - rootPOA.the_POAManager().activate(); - - int i = 0; - Policy[] poaPolicy = new Policy[3]; - poaPolicy[i++] = rootPOA.create_lifespan_policy( - LifespanPolicyValue.TRANSIENT); - poaPolicy[i++] = rootPOA.create_id_assignment_policy( - IdAssignmentPolicyValue.SYSTEM_ID); - poaPolicy[i++] = rootPOA.create_servant_retention_policy( - ServantRetentionPolicyValue.RETAIN); - - POA nsPOA = rootPOA.create_POA( "TNameService", null, poaPolicy ); - nsPOA.the_POAManager().activate(); - - // Create an initial context - TransientNamingContext initialContext = - new TransientNamingContext(orb, null, nsPOA); - byte[] rootContextId = nsPOA.activate_object( initialContext ); - initialContext.localRoot = - nsPOA.id_to_reference( rootContextId ); - theInitialNamingContext = initialContext.localRoot; - orb.register_initial_reference( nameServiceName, - theInitialNamingContext ); - } catch (org.omg.CORBA.SystemException e) { - throw wrapper.transNsCannotCreateInitialNcSys( e ) ; - } catch (Exception e) { - throw wrapper.transNsCannotCreateInitialNc( e ) ; - } - } - - - /** - * Return the initial NamingContext. - * @return the object reference for the initial NamingContext. - */ - public org.omg.CORBA.Object initialNamingContext() - { - return theInitialNamingContext; - } - - - // The initial naming context for this name service - private org.omg.CORBA.Object theInitialNamingContext; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java 2018-01-30 20:18:20.000000000 -0500 +++ /dev/null 2018-01-30 20:18:21.000000000 -0500 @@ -1,357 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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.corba.se.impl.naming.cosnaming; - -// Import general CORBA classes -import org.omg.CORBA.SystemException; -import org.omg.CORBA.Object; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.ORB; -import org.omg.PortableServer.POA; - -// Import org.omg.CosNaming types -import org.omg.CosNaming.Binding; -import org.omg.CosNaming.BindingType; -import org.omg.CosNaming.BindingTypeHolder; -import org.omg.CosNaming.BindingListHolder; -import org.omg.CosNaming.BindingIteratorHolder; -import org.omg.CosNaming.NameComponent; -import org.omg.CosNaming.NamingContext; - -import java.util.logging.Logger; -import java.util.logging.Level; - -import java.util.Hashtable; -import com.sun.corba.se.impl.orbutil.LogKeywords; -import com.sun.corba.se.impl.logging.NamingSystemException; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -/** - * Class TransientNamingContext implements the methods defined - * by NamingContextDataStore, and extends the NamingContextImpl class to - * provide a servant implementation of CosNaming::NamingContext. - * The TransientNamingContext uses a hash table - * to store the mappings between bindings and object references and the - * hash table is not persistent; thereby the name "transient". - * This class should not be used directly; instead, the class - * TransientNameService should be instantiated. - *

- * The keys in the hash table are InternalBindingKey objects, containing - * a single NameComponent and implementing the proper functions, i.e., - * equals() and hashCode() in an efficient manner. The values in the hash - * table are InternalBindingValues and store a org.omg.CosNaming::Binding and - * the object reference associated with the binding. For iteration, - * TransientBindingIterator objects are created, which are passed a cloned - * copy of the hashtable. Since elements are inserted and deleted and - * never modified, this provides stable iterators at the cost of cloning - * the hash table. - *

- * To create and destroy object references, the TransientNamingContext - * uses the orb.connect() and orb.disconnect() methods. - * - * @see NamingContextImpl - * @see NamingContextDataStore - * @see TransientBindingIterator - * @see TransientNameService - */ -public class TransientNamingContext extends NamingContextImpl implements NamingContextDataStore -{ - private Logger readLogger, updateLogger, lifecycleLogger; - - // XXX: the wrapper calls are all preceded by logger updates. - // These can be combined, and then we simply use 3 NamingSystemException wrappers, - // for read, update, and lifecycl. - private NamingSystemException wrapper ; - - /** - * Constructs a new TransientNamingContext object. - * @param orb an orb object. - * @param initial the initial naming context. - * @exception Exception a Java exception thrown of the base class cannot - * initialize. - */ - public TransientNamingContext(com.sun.corba.se.spi.orb.ORB orb, - org.omg.CORBA.Object initial, - POA nsPOA ) - throws java.lang.Exception - { - super(orb, nsPOA ); - wrapper = NamingSystemException.get( orb, CORBALogDomains.NAMING ) ; - - this.localRoot = initial; - readLogger = orb.getLogger( CORBALogDomains.NAMING_READ); - updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE); - lifecycleLogger = orb.getLogger( - CORBALogDomains.NAMING_LIFECYCLE); - lifecycleLogger.fine( "Root TransientNamingContext LIFECYCLE.CREATED" ); - } - - /** - * Binds the object to the name component as the specified binding type. - * It creates a InternalBindingKey object and a InternalBindingValue - * object and inserts them in the hash table. - * @param n A single org.omg.CosNaming::NameComponent under which the - * object will be bound. - * @param obj An object reference to be bound under the supplied name. - * @param bt The type of the binding (i.e., as object or as context). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - public final void Bind(NameComponent n, org.omg.CORBA.Object obj, - BindingType bt) - throws org.omg.CORBA.SystemException - { - // Create a key and a value - InternalBindingKey key = new InternalBindingKey(n); - NameComponent[] name = new NameComponent[1]; - name[0] = n; - Binding b = new Binding(name,bt); - InternalBindingValue value = new InternalBindingValue(b,null); - value.theObjectRef = obj; - // insert it - InternalBindingValue oldValue = - (InternalBindingValue)this.theHashtable.put(key,value); - - if (oldValue != null) { - updateLogger.warning( LogKeywords.NAMING_BIND + "Name " + - getName( n ) + " Was Already Bound" ); - throw wrapper.transNcBindAlreadyBound() ; - } - if( updateLogger.isLoggable( Level.FINE ) ) { - updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + - "Name Component: " + n.id + "." + n.kind ); - } - } - - /** - * Resolves the supplied name to an object reference and returns - * the type of the resolved binding. It creates a InternalBindingKey - * and uses the key for looking up in the hash table. If nothing - * is found an exception is thrown, otherwise the object reference - * is returned and the binding type set. - * @param n a NameComponent which is the name to be resolved. - * @param bth the BindingType as an out parameter. - * @return the object reference bound under the supplied name, null if not - * found. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - public final org.omg.CORBA.Object Resolve(NameComponent n, - BindingTypeHolder bth) - throws org.omg.CORBA.SystemException - { - // Is the initial naming context requested? - if ( (n.id.length() == 0) - &&(n.kind.length() == 0 ) ) - { - bth.value = BindingType.ncontext; - return localRoot; - } - - // Create a key and lookup the value - InternalBindingKey key = new InternalBindingKey(n); - - InternalBindingValue value = - (InternalBindingValue) this.theHashtable.get(key); - if (value == null) return null; - if( readLogger.isLoggable( Level.FINE ) ) { - readLogger.fine( LogKeywords.NAMING_RESOLVE_SUCCESS - + "Namecomponent :" + getName( n ) ); - } - - // Copy out binding type and object reference - bth.value = value.theBinding.binding_type; - return value.theObjectRef; - } - - /** - * Deletes the binding with the supplied name. It creates a - * InternalBindingKey and uses it to remove the value associated - * with the key. If nothing is found an exception is thrown, otherwise - * the element is removed from the hash table. - * @param n a NameComponent which is the name to unbind - * @return the object reference bound to the name, or null if not found. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - public final org.omg.CORBA.Object Unbind(NameComponent n) - throws org.omg.CORBA.SystemException - { - // Create a key and remove it from the hashtable - InternalBindingKey key = new InternalBindingKey(n); - InternalBindingValue value = - (InternalBindingValue)this.theHashtable.remove(key); - - // Return what was found - if (value == null) { - if( updateLogger.isLoggable( Level.FINE ) ) { - updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE + - " There was no binding with the name " + getName( n ) + - " to Unbind " ); - } - return null; - } else { - if( updateLogger.isLoggable( Level.FINE ) ) { - updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS + - " NameComponent: " + getName( n ) ); - } - return value.theObjectRef; - } - } - - /** - * List the contents of this NamingContext. It creates a new - * TransientBindingIterator object and passes it a clone of the - * hash table and an orb object. It then uses the - * newly created object to return the required number of bindings. - * @param how_many The number of requested bindings in the BindingList. - * @param bl The BindingList as an out parameter. - * @param bi The BindingIterator as an out parameter. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - public final void List(int how_many, BindingListHolder bl, - BindingIteratorHolder bi) - throws org.omg.CORBA.SystemException - { - try { - // Create a new binding iterator servant with a copy of this - // hashtable. nsPOA is passed to the object so that it can - // de-activate itself from the Active Object Map when - // Binding Iterator.destroy is called. - TransientBindingIterator bindingIterator = - new TransientBindingIterator(this.orb, - (Hashtable)this.theHashtable.clone(), nsPOA); - // Have it set the binding list - bindingIterator.list(how_many,bl); - - byte[] objectId = nsPOA.activate_object( bindingIterator ); - org.omg.CORBA.Object obj = nsPOA.id_to_reference( objectId ); - - // Get the object reference for the binding iterator servant - org.omg.CosNaming.BindingIterator bindingRef = - org.omg.CosNaming.BindingIteratorHelper.narrow( obj ); - - bi.value = bindingRef; - } catch (org.omg.CORBA.SystemException e) { - readLogger.warning( LogKeywords.NAMING_LIST_FAILURE + e ); - throw e; - } catch (Exception e) { - // Convert to a CORBA system exception - readLogger.severe( LogKeywords.NAMING_LIST_FAILURE + e ); - throw wrapper.transNcListGotExc( e ) ; - } - } - - /** - * Create a new NamingContext. It creates a new TransientNamingContext - * object, passing it the orb object. - * @return an object reference for a new NamingContext object implemented - * by this Name Server. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - public final org.omg.CosNaming.NamingContext NewContext() - throws org.omg.CORBA.SystemException - { - try { - // Create a new servant - TransientNamingContext transContext = - new TransientNamingContext( - (com.sun.corba.se.spi.orb.ORB) orb,localRoot, nsPOA); - - byte[] objectId = nsPOA.activate_object( transContext ); - org.omg.CORBA.Object obj = nsPOA.id_to_reference( objectId ); - lifecycleLogger.fine( "TransientNamingContext " + - "LIFECYCLE.CREATE SUCCESSFUL" ); - return org.omg.CosNaming.NamingContextHelper.narrow( obj ); - - } catch (org.omg.CORBA.SystemException e) { - lifecycleLogger.log( - Level.WARNING, LogKeywords.LIFECYCLE_CREATE_FAILURE, e ); - throw e; - } catch (Exception e) { - lifecycleLogger.log( - Level.WARNING, LogKeywords.LIFECYCLE_CREATE_FAILURE, e ); - throw wrapper.transNcNewctxGotExc( e ) ; - } - } - - /** - * Destroys this NamingContext by disconnecting from the ORB. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions. - */ - public final void Destroy() - throws org.omg.CORBA.SystemException - { - // Destroy the object reference by disconnecting from the ORB - try { - byte[] objectId = nsPOA.servant_to_id( this ); - if( objectId != null ) { - nsPOA.deactivate_object( objectId ); - } - if( lifecycleLogger.isLoggable( Level.FINE ) ) { - lifecycleLogger.fine( - LogKeywords.LIFECYCLE_DESTROY_SUCCESS ); - } - } catch (org.omg.CORBA.SystemException e) { - lifecycleLogger.log( Level.WARNING, - LogKeywords.LIFECYCLE_DESTROY_FAILURE, e ); - throw e; - } catch (Exception e) { - lifecycleLogger.log( Level.WARNING, - LogKeywords.LIFECYCLE_DESTROY_FAILURE, e ); - throw wrapper.transNcDestroyGotExc( e ) ; - } - } - - /** - * A Utility Method For Logging.. - */ - private String getName( NameComponent n ) { - return n.id + "." + n.kind; - } - - /** - * Return whether this NamingContext contains any bindings. It forwards - * this request to the hash table. - * @return true if this NamingContext contains no bindings. - */ - public final boolean IsEmpty() - { - return this.theHashtable.isEmpty(); - } - - // A hashtable to store the bindings - private final Hashtable theHashtable = new Hashtable(); - - /** - * The local root naming context. - */ - public org.omg.CORBA.Object localRoot; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java 2018-01-30 20:18:21.000000000 -0500 +++ /dev/null 2018-01-30 20:18:21.000000000 -0500 @@ -1,288 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.naming.namingutil; - -import java.util.*; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.NamingSystemException ; - -/** - * The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's - * will be parsed and converted to this object. This object is capable of - * storing multiple Host profiles as defined in the CorbaLoc grammer. - * - * @author Hemanth - */ -public class CorbalocURL extends INSURLBase -{ - static NamingSystemException wrapper = NamingSystemException.get( - CORBALogDomains.NAMING_READ ) ; - - /** - * This constructor parses the URL and initializes all the variables. Once - * the URL Object is constructed it is immutable. URL parameter is a - * corbaloc: URL string with 'corbaloc:' prefix stripped. - */ - public CorbalocURL( String aURL ) { - String url = aURL; - - if( url != null ) { - try { - // First Clean the URL Escapes if there are any - url = Utility.cleanEscapes( url ); - } catch( Exception e ) { - // There is something wrong with the URL escapes used - // so throw an exception - badAddress( e ); - } - int endIndex = url.indexOf( '/' ); - if( endIndex == -1 ) { - // If there is no '/' then the endIndex is at the end of the URL - endIndex = url.length(); - } - // _REVISIT_: Add a testcase to check 'corbaloc:/' - if( endIndex == 0 ) { - // The url starts with a '/', it's an error - badAddress( null ); - } - // Anything between corbaloc: and / is the host,port information - // of the server where the Service Object is located - StringTokenizer endpoints = new StringTokenizer( - url.substring( 0, endIndex ), "," ); - // NOTE: - // There should be atleast one token, because there are checks - // to make sure that there is host information before the - // delimiter '/'. So no need to explicitly check for number of - // tokens != 0 - while( endpoints.hasMoreTokens( ) ) { - String endpointInfo = endpoints.nextToken(); - IIOPEndpointInfo iiopEndpointInfo = null; - if( endpointInfo.startsWith( "iiop:" ) ) { - iiopEndpointInfo = handleIIOPColon( endpointInfo ); - } else if( endpointInfo.startsWith( "rir:" ) ) { - handleRIRColon( endpointInfo ); - rirFlag = true; - } else if( endpointInfo.startsWith( ":" ) ) { - iiopEndpointInfo = handleColon( endpointInfo ); - } else { - // Right now we are not allowing any other protocol - // other than iiop:, rir: so raise exception indicating - // that the URL is malformed - badAddress( null ); - } - if ( rirFlag == false ) { - // Add the Host information if RIR flag is set, - // If RIR is set then it means use the internal Boot - // Strap protocol for Key String resolution - if( theEndpointInfo == null ) { - theEndpointInfo = new java.util.ArrayList( ); - } - theEndpointInfo.add( iiopEndpointInfo ); - } - } - // If there is something after corbaloc:endpointInfo/ - // then that is the keyString - if( url.length() > (endIndex + 1) ) { - theKeyString = url.substring( endIndex + 1 ); - } - } - } - - - /** - * A Utility method to throw BAD_PARAM exception to signal malformed - * INS URL. - */ - private void badAddress( java.lang.Throwable e ) - { - throw wrapper.insBadAddress( e ) ; - } - - /** - * If there is 'iiop:' token in the URL, this method will parses - * and validates that host and port information. - */ - private IIOPEndpointInfo handleIIOPColon( String iiopInfo ) - { - // Check the iiop syntax - iiopInfo = iiopInfo.substring( NamingConstants.IIOP_LENGTH ); - return handleColon( iiopInfo ); - } - - - /** - * This is to handle the case of host information with no 'iiop:' prefix. - * instead if ':' is specified then iiop is assumed. - */ - private IIOPEndpointInfo handleColon( String iiopInfo ) { - // String after ":" - iiopInfo = iiopInfo.substring( 1 ); - String hostandport = iiopInfo; - // The format can be 1.2@: - StringTokenizer tokenizer = new StringTokenizer( iiopInfo, "@" ); - IIOPEndpointInfo iiopEndpointInfo = new IIOPEndpointInfo( ); - int tokenCount = tokenizer.countTokens( ); - // There can be 1 or 2 tokens with '@' as the delimiter - // - if there is only 1 token then there is no GIOP version - // information. A Default GIOP version of 1.2 is used. - // - if there are 2 tokens then there is GIOP version is specified - // - if there are no tokens or more than 2 tokens, then that's an - // error - if( ( tokenCount == 0 ) - ||( tokenCount > 2 )) - { - badAddress( null ); - } - if( tokenCount == 2 ) { - // There is VersionInformation after iiop: - String version = tokenizer.nextToken( ); - int dot = version.indexOf('.'); - // There is a version without ., which means - // Malformed list - if (dot == -1) { - badAddress( null ); - } - try { - iiopEndpointInfo.setVersion( - Integer.parseInt( version.substring( 0, dot )), - Integer.parseInt( version.substring(dot+1)) ); - hostandport = tokenizer.nextToken( ); - } catch( Throwable e ) { - badAddress( e ); - } - } - try { - // A Hack to differentiate IPV6 address - // from IPV4 address, Current Resolution - // is to use [ ] to differentiate ipv6 host - int squareBracketBeginIndex = hostandport.indexOf ( '[' ); - if( squareBracketBeginIndex != -1 ) { - // ipv6Host should be enclosed in - // [ ], if not it will result in a - // BAD_PARAM exception - String ipv6Port = getIPV6Port( hostandport ); - if( ipv6Port != null ) { - iiopEndpointInfo.setPort( Integer.parseInt( ipv6Port )); - } - iiopEndpointInfo.setHost( getIPV6Host( hostandport )); - return iiopEndpointInfo; - } - tokenizer = new StringTokenizer( hostandport, ":" ); - // There are three possible cases here - // 1. Host and Port is explicitly specified by using ":" as a - // a separator - // 2. Only Host is specified without the port - // 3. HostAndPort info is null - if( tokenizer.countTokens( ) == 2 ) { - // Case 1: There is Host and Port Info - iiopEndpointInfo.setHost( tokenizer.nextToken( ) ); - iiopEndpointInfo.setPort( Integer.parseInt( - tokenizer.nextToken( ))); - } else { - if( ( hostandport != null ) - &&( hostandport.length() != 0 ) ) - { - // Case 2: Only Host is specified. iiopEndpointInfo is - // initialized to use the default INS port, if no port is - // specified - iiopEndpointInfo.setHost( hostandport ); - } - // Case 3: If no Host and Port info is provided then we use the - // the default LocalHost and INSPort. iiopEndpointInfo is - // already initialized with this info. - } - } catch( Throwable e ) { - // Any kind of Exception is bad here. - // Possible causes: A Number Format exception because port info is - // malformed - badAddress( e ); - } - Utility.validateGIOPVersion( iiopEndpointInfo ); - return iiopEndpointInfo; - } - - /** - * Validate 'rir:' case. - */ - private void handleRIRColon( String rirInfo ) - { - if( rirInfo.length() != NamingConstants.RIRCOLON_LENGTH ) { - badAddress( null ); - } - } - - /** - * Returns an IPV6 Port that is after []:. There is no validation - * done here, if it is an incorrect port then the request through - * this URL results in a COMM_FAILURE, otherwise malformed list will - * result in BAD_PARAM exception thrown in checkcorbalocGrammer. - */ - private String getIPV6Port( String endpointInfo ) - { - int squareBracketEndIndex = endpointInfo.indexOf ( ']' ); - // If there is port information, then it has to be after ] bracket - // indexOf returns the count from the index of zero as the base, so - // equality check requires squareBracketEndIndex + 1. - if( (squareBracketEndIndex + 1) != (endpointInfo.length( )) ) { - if( endpointInfo.charAt( squareBracketEndIndex + 1 ) != ':' ) { - throw new RuntimeException( - "Host and Port is not separated by ':'" ); - } - // PortInformation should be after ']:' delimiter - // If there is an exception then it will be caught in - // checkcorbaGrammer method and rethrown as BAD_PARAM - return endpointInfo.substring( squareBracketEndIndex + 2 ); - } - return null; - } - - - /** - * Returns an IPV6 Host that is inside [ ] tokens. There is no validation - * done here, if it is an incorrect IPV6 address then the request through - * this URL results in a COMM_FAILURE, otherwise malformed list will - * result in BAD_PARAM exception thrown in checkcorbalocGrammer. - */ - private String getIPV6Host( String endpointInfo ) { - // ipv6Host should be enclosed in - // [ ], if not it will result in a - // BAD_PARAM exception - int squareBracketEndIndex = endpointInfo.indexOf ( ']' ); - // get the host between [ ] - String ipv6Host = endpointInfo.substring( 1, squareBracketEndIndex ); - return ipv6Host; - } - - /** - * Will be true only in CorbanameURL class. - */ - public boolean isCorbanameURL( ) { - return false; - } - - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java 2018-01-30 20:18:22.000000000 -0500 +++ /dev/null 2018-01-30 20:18:22.000000000 -0500 @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.naming.namingutil; - -import com.sun.corba.se.impl.logging.NamingSystemException; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -/** - * The corbaname: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's - * will be stored in this object. This object is capable of storing CorbaLoc - * profiles as defined in the CorbaName grammer. - * - * @author Hemanth - */ -public class CorbanameURL extends INSURLBase -{ - private static NamingSystemException wrapper = - NamingSystemException.get( CORBALogDomains.NAMING ) ; - - /** - * This constructor takes a corbaname: url with 'corbaname:' prefix stripped - * and initializes all the variables accordingly. If there are any parsing - * errors then BAD_PARAM exception is raised. - */ - public CorbanameURL( String aURL ) { - String url = aURL; - - // First Clean the URL Escapes if there are any - try { - url = Utility.cleanEscapes( url ); - } catch( Exception e ) { - badAddress( e ); - } - - int delimiterIndex = url.indexOf( '#' ); - String corbalocString = null; - if( delimiterIndex != -1 ) { - // Append corbaloc: for Grammar check, Get the string between - // corbaname: and # which forms the corbaloc string - corbalocString = "corbaloc:" + - url.substring( 0, delimiterIndex ) + "/"; - } else { - // Build a corbaloc string to check the grammar. - // 10 is the length of corbaname: - corbalocString = "corbaloc:" + url.substring( 0, url.length() ); - // If the string doesnot end with a / then add one to end the - // URL correctly - if( corbalocString.endsWith( "/" ) != true ) { - corbalocString = corbalocString + "/"; - } - } - try { - // Check the corbaloc grammar and set the returned corbaloc - // object to the CorbaName Object - INSURL insURL = - INSURLHandler.getINSURLHandler().parseURL( corbalocString ); - copyINSURL( insURL ); - // String after '#' is the Stringified name used to resolve - // the Object reference from the rootnaming context. If - // the String is null then the Root Naming context is passed - // back - if((delimiterIndex > -1) && - (delimiterIndex < (aURL.length() - 1))) - { - int start = delimiterIndex + 1 ; - String result = url.substring(start) ; - theStringifiedName = result ; - } - } catch( Exception e ) { - badAddress( e ); - } - } - - /** - * A Utility method to throw BAD_PARAM exception. - */ - private void badAddress( java.lang.Throwable e ) - throws org.omg.CORBA.BAD_PARAM - { - throw wrapper.insBadAddress( e ) ; - } - - /** - * A Utility method to copy all the variables from CorbalocURL object to - * this instance. - */ - private void copyINSURL( INSURL url ) { - rirFlag = url.getRIRFlag( ); - theEndpointInfo = (java.util.ArrayList) url.getEndpointInfo( ); - theKeyString = url.getKeyString( ); - theStringifiedName = url.getStringifiedName( ); - } - - public boolean isCorbanameURL( ) { - return true; - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java 2018-01-30 20:18:22.000000000 -0500 +++ /dev/null 2018-01-30 20:18:22.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.impl.naming.namingutil; - -import com.sun.corba.se.impl.orbutil.ORBConstants; - -/** - * EndpointInfo is used internally by CorbaLoc object to store the - * host information used in creating the Service Object reference - * from the -ORBInitDef and -ORBDefaultInitDef definitions. - * - * @author Hemanth - */ -public class IIOPEndpointInfo -{ - // Version information - private int major, minor; - - // Host Name and Port Number - private String host; - private int port; - - IIOPEndpointInfo( ) { - // Default IIOP Version - major = ORBConstants.DEFAULT_INS_GIOP_MAJOR_VERSION; - minor = ORBConstants.DEFAULT_INS_GIOP_MINOR_VERSION; - // Default host is localhost - host = ORBConstants.DEFAULT_INS_HOST; - // Default INS Port - port = ORBConstants.DEFAULT_INS_PORT; - } - - public void setHost( String theHost ) { - host = theHost; - } - - public String getHost( ) { - return host; - } - - public void setPort( int thePort ) { - port = thePort; - } - - public int getPort( ) { - return port; - } - - public void setVersion( int theMajor, int theMinor ) { - major = theMajor; - minor = theMinor; - } - - public int getMajor( ) { - return major; - } - - public int getMinor( ) { - return minor; - } - - /** Internal Debug Method. - */ - public void dump( ) { - System.out.println( " Major -> " + major + " Minor -> " + minor ); - System.out.println( "host -> " + host ); - System.out.println( "port -> " + port ); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURL.java 2018-01-30 20:18:23.000000000 -0500 +++ /dev/null 2018-01-30 20:18:23.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.naming.namingutil; - -/** - * INS URL is a generic interface for two different types of URL's specified - * in INS spec. - * - * @author Hemanth - */ -public interface INSURL { - public boolean getRIRFlag( ); - - // There can be one or more Endpoint's in the URL, so the return value is - // a List - public java.util.List getEndpointInfo( ); - - public String getKeyString( ); - - public String getStringifiedName( ); - - // This method will return true only in CorbanameURL, It is provided because - // corbaname: URL needs special handling. - public boolean isCorbanameURL( ); - - // A debug method, which is not required for normal operation - public void dPrint( ); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLBase.java 2018-01-30 20:18:24.000000000 -0500 +++ /dev/null 2018-01-30 20:18:24.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.naming.namingutil; - -/** The corbaloc: URL definitions from the -ORBInitDef and -ORBDefaultInitDef's - * will be stored in this object. This object is capable of storing multiple - * Host profiles as defined in the CorbaLoc grammer. - * - * @author Hemanth - */ -public abstract class INSURLBase implements INSURL { - - // If rirFlag is set to true that means internal - // boot strapping technique will be used. If set to - // false then the EndpointInfo will be used to create the - // Service Object reference. - protected boolean rirFlag = false ; - protected java.util.ArrayList theEndpointInfo = null ; - protected String theKeyString = "NameService" ; - protected String theStringifiedName = null ; - - public boolean getRIRFlag( ) { - return rirFlag; - } - - public java.util.List getEndpointInfo( ) { - return theEndpointInfo; - } - - public String getKeyString( ) { - return theKeyString; - } - - public String getStringifiedName( ) { - return theStringifiedName; - } - - public abstract boolean isCorbanameURL( ); - - public void dPrint( ) { - System.out.println( "URL Dump..." ); - System.out.println( "Key String = " + getKeyString( ) ); - System.out.println( "RIR Flag = " + getRIRFlag( ) ); - System.out.println( "isCorbanameURL = " + isCorbanameURL() ); - for( int i = 0; i < theEndpointInfo.size( ); i++ ) { - ((IIOPEndpointInfo) theEndpointInfo.get( i )).dump( ); - } - if( isCorbanameURL( ) ) { - System.out.println( "Stringified Name = " + getStringifiedName() ); - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java 2018-01-30 20:18:24.000000000 -0500 +++ /dev/null 2018-01-30 20:18:24.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.naming.namingutil; - -import org.omg.CORBA.CompletionStatus; -import java.util.StringTokenizer; - -/** - * This class is the entry point to parse different types of INS URL's. - * - * @author Hemanth - */ - -public class INSURLHandler { - - private static INSURLHandler insURLHandler = null; - - // Length of corbaloc: - private static final int CORBALOC_PREFIX_LENGTH = 9; - - // Length of corbaname: - private static final int CORBANAME_PREFIX_LENGTH = 10; - - private INSURLHandler( ) { - } - - public synchronized static INSURLHandler getINSURLHandler( ) { - if( insURLHandler == null ) { - insURLHandler = new INSURLHandler( ); - } - return insURLHandler; - } - - public INSURL parseURL( String aUrl ) { - String url = aUrl; - if ( url.startsWith( "corbaloc:" ) == true ) { - return new CorbalocURL( url.substring( CORBALOC_PREFIX_LENGTH ) ); - } else if ( url.startsWith ( "corbaname:" ) == true ) { - return new CorbanameURL( url.substring( CORBANAME_PREFIX_LENGTH ) ); - } - return null; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/NamingConstants.java 2018-01-30 20:18:25.000000000 -0500 +++ /dev/null 2018-01-30 20:18:25.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.impl.naming.namingutil; - -/** - * Constants specific to INS parsing and validation. - */ -public class NamingConstants { - - // iiop length - public static final int IIOP_LENGTH = 4; - - // rir: length - public static final int RIRCOLON_LENGTH = 4; - - public static final int MAJORNUMBER_SUPPORTED = 1; - - public static final int MINORNUMBERMAX = 2; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/Utility.java 2018-01-30 20:18:26.000000000 -0500 +++ /dev/null 2018-01-30 20:18:26.000000000 -0500 @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.naming.namingutil; - -import java.io.StringWriter; - -import org.omg.CORBA.DATA_CONVERSION; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.impl.logging.NamingSystemException; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -/** - * Utility methods for Naming. - * - * @author Hemanth - */ -class Utility { - private static NamingSystemException wrapper = - NamingSystemException.get( CORBALogDomains.NAMING ) ; - - /** - * cleanEscapes removes URL escapes as per IETF 2386 RFP. - */ - static String cleanEscapes( String stringToDecode ) { - StringWriter theStringWithoutEscape = new StringWriter(); - for( int i = 0; i < stringToDecode.length(); i++ ) { - char c = stringToDecode.charAt( i ) ; - if( c != '%' ) { - theStringWithoutEscape.write( c ); - } else { - // Get the two hexadecimal digits and convert that into int - i++; - int Hex1 = hexOf( stringToDecode.charAt(i) ); - i++; - int Hex2 = hexOf( stringToDecode.charAt(i) ); - int value = (Hex1 * 16) + Hex2; - // Convert the integer to ASCII - theStringWithoutEscape.write( (char) value ); - } - } - return theStringWithoutEscape.toString(); - } - - /** - * Converts an Ascii Character into Hexadecimal digit - * NOTE: THIS METHOD IS DUPLICATED TO DELIVER NAMING AS A SEPARATE - * COMPONENT TO RI. - **/ - static int hexOf( char x ) - { - int val; - - val = x - '0'; - if (val >=0 && val <= 9) - return val; - - val = (x - 'a') + 10; - if (val >= 10 && val <= 15) - return val; - - val = (x - 'A') + 10; - if (val >= 10 && val <= 15) - return val; - - throw new DATA_CONVERSION( ); - } - - /** - * If GIOP Version is not correct, This method throws a BAD_PARAM - * Exception. - **/ - static void validateGIOPVersion( IIOPEndpointInfo endpointInfo ) { - if ((endpointInfo.getMajor() > NamingConstants.MAJORNUMBER_SUPPORTED) || - (endpointInfo.getMinor() > NamingConstants.MINORNUMBERMAX ) ) - { - throw wrapper.insBadAddress() ; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java 2018-01-30 20:18:26.000000000 -0500 +++ /dev/null 2018-01-30 20:18:26.000000000 -0500 @@ -1,135 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.naming.pcosnaming; - -import java.io.Serializable; -import org.omg.CosNaming.NameComponent; - - -/** - * Class InternalBindingKey implements the necessary wrapper code - * around the org.omg.CosNaming::NameComponent class to implement the proper - * equals() method and the hashCode() method for use in a hash table. - * It computes the hashCode once and stores it, and also precomputes - * the lengths of the id and kind strings for faster comparison. - */ -public class InternalBindingKey - implements Serializable -{ - - // computed by serialver tool - private static final long serialVersionUID = -5410796631793704055L; - - public String id; - public String kind; - - // Default Constructor - public InternalBindingKey() {} - - // Normal constructor - public InternalBindingKey(NameComponent n) - { - setup(n); - } - - // Setup the object - protected void setup(NameComponent n) { - this.id = n.id; - this.kind = n.kind; - } - - // Compare the keys by comparing name's id and kind - public boolean equals(java.lang.Object o) { - if (o == null) - return false; - if (o instanceof InternalBindingKey) { - InternalBindingKey that = (InternalBindingKey)o; - if( this.id != null && that.id != null ) - { - if (this.id.length() != that.id.length() ) - { - return false; - } - // If id is set is must be equal - if (this.id.length() > 0 && this.id.equals(that.id) == false) - { - return false; - } - } - else - { - // If One is Null and the other is not then it's a mismatch - // So, return false - if( ( this.id == null && that.id != null ) - || ( this.id !=null && that.id == null ) ) - { - return false; - } - } - if( this.kind != null && that.kind != null ) - { - if (this.kind.length() != that.kind.length() ) - { - return false; - } - // If kind is set it must be equal - if (this.kind.length() > 0 && this.kind.equals(that.kind) == false) - { - return false; - } - } - else - { - // If One is Null and the other is not then it's a mismatch - // So, return false - if( ( this.kind == null && that.kind != null ) - || ( this.kind !=null && that.kind == null ) ) - { - return false; - } - } - // We have checked all the possibilities, so return true - return true; - } else { - return false; - } - } - - - // Return precomputed value - public int hashCode() { - int hashVal = 0; - if (this.id.length() > 0) - { - hashVal += this.id.hashCode(); - } - if (this.kind.length() > 0) - { - hashVal += this.kind.hashCode(); - } - return hashVal; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java 2018-01-30 20:18:27.000000000 -0500 +++ /dev/null 2018-01-30 20:18:27.000000000 -0500 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.naming.pcosnaming; - -import org.omg.CORBA.Object; -import org.omg.CosNaming.BindingType; -import java.io.Serializable; - -/** - * Class InternalBindingKey acts as a container for two objects, namely - * a org.omg.CosNaming::Binding and an CORBA object reference, which are the two - * components associated with the binding. - */ -public class InternalBindingValue - implements Serializable -{ - public BindingType theBindingType; - // The value stores both Stringified Object Reference and - // Non-Stringified Object Reference. This is done to avoid - // calling orb.string_to_object( ) everytime. Instead it - // will be set once and then the result will be used everytime. - public String strObjectRef; - transient private org.omg.CORBA.Object theObjectRef; - - // Default constructor - public InternalBindingValue() { - } - - // Normal constructor - public InternalBindingValue(BindingType b, String o) { - // Objectreference or Context - theBindingType = b; - strObjectRef = o; - } - - public org.omg.CORBA.Object getObjectRef( ) - { - return theObjectRef; - } - - public void setObjectRef( org.omg.CORBA.Object ObjectRef ) - { - theObjectRef = ObjectRef; - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameServer.java 2018-01-30 20:18:28.000000000 -0500 +++ /dev/null 2018-01-30 20:18:28.000000000 -0500 @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.naming.pcosnaming; - -import java.io.File; -import java.util.Properties; - -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.CorbaResourceUtil; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.activation.InitialNameService; -import com.sun.corba.se.spi.activation.InitialNameServiceHelper; -import org.omg.CosNaming.NamingContext; -/** - * Class NameServer is a standalone application which - * implements a persistent and a transient name service. - * It uses the PersistentNameService and TransientNameService - * classes for the name service implementation. - * - * @author Hemanth Puttaswamy - * @since JDK1.2 - */ - -public class NameServer -{ - private ORB orb; - - private File dbDir; // name server database directory - - private final static String dbName = "names.db"; - - public static void main(String args[]) - { - NameServer ns = new NameServer(args); - ns.run(); - } - - protected NameServer(String args[]) - { - // create the ORB Object - java.util.Properties props = System.getProperties(); - props.put( ORBConstants.SERVER_ID_PROPERTY, "1000" ) ; - props.put("org.omg.CORBA.ORBClass", - "com.sun.corba.se.impl.orb.ORBImpl"); - orb = (ORB) org.omg.CORBA.ORB.init(args,props); - - // set up the database directory - String dbDirName = props.getProperty( ORBConstants.DB_DIR_PROPERTY ) + - props.getProperty("file.separator") + dbName + - props.getProperty("file.separator"); - - dbDir = new File(dbDirName); - if (!dbDir.exists()) dbDir.mkdir(); - } - - protected void run() - { - try { - - // create the persistent name service - NameService ns = new NameService(orb, dbDir); - - // add root naming context to initial naming - NamingContext rootContext = ns.initialNamingContext(); - InitialNameService ins = InitialNameServiceHelper.narrow( - orb.resolve_initial_references( - ORBConstants.INITIAL_NAME_SERVICE_NAME )); - ins.bind( "NameService", rootContext, true); - System.out.println(CorbaResourceUtil.getText("pnameserv.success")); - - // wait for invocations - orb.run(); - - } catch (Exception ex) { - - ex.printStackTrace(System.err); - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameService.java 2018-01-30 20:18:28.000000000 -0500 +++ /dev/null 2018-01-30 20:18:28.000000000 -0500 @@ -1,234 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.naming.pcosnaming; - -import java.io.File; -import java.util.Properties; - -import org.omg.CORBA.Policy; -import org.omg.PortableServer.POA; -import org.omg.PortableServer.LifespanPolicyValue; -import org.omg.PortableServer.RequestProcessingPolicyValue; -import org.omg.PortableServer.IdAssignmentPolicyValue; -import org.omg.PortableServer.ServantRetentionPolicyValue; -import org.omg.CosNaming.NamingContext; -import org.omg.CosNaming.NamingContextHelper; -import org.omg.PortableServer.*; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -/** - * @author Hemanth Puttaswamy - * @since JDK1.2 - */ - -public class NameService -{ - private NamingContext rootContext = null; - private POA nsPOA = null; - private ServantManagerImpl contextMgr; - private ORB theorb; - - /** - * Create NameService which starts the Root Naming Context in Persistent CosNaming - * @param orb an ORB object. - * @param logDir a File - * @exception java.lang.Exception a Java exception. - */ - public NameService(ORB orb, File logDir) - throws Exception - { - theorb = orb; - - // Moved this to the creation of the ORB that is passed into this - // constructor. - // - // This is required for creating Persistent Servants under this ORB - // Right now the Persistent NameService and ORBD are launched together - // Find out a better way of doing this, Since ORBD is an important - // process which should not be killed because of some external process - // orb.setPersistentServerId( (int) 1000 ); - - // get and activate the root naming POA - POA rootPOA = (POA)orb.resolve_initial_references( - ORBConstants.ROOT_POA_NAME ) ; - rootPOA.the_POAManager().activate(); - - // create a new POA for persistent Naming Contexts - // With Non-Retain policy, So that every time Servant Manager - // will be contacted when the reference is made for the context - // The id assignment is made by the NameServer, The Naming Context - // id's will be in the format NC - int i=0; - Policy[] poaPolicy = new Policy[4]; - poaPolicy[i++] = rootPOA.create_lifespan_policy( - LifespanPolicyValue.PERSISTENT); - poaPolicy[i++] = rootPOA.create_request_processing_policy( - RequestProcessingPolicyValue.USE_SERVANT_MANAGER); - poaPolicy[i++] = rootPOA.create_id_assignment_policy( - IdAssignmentPolicyValue.USER_ID); - poaPolicy[i++] = rootPOA.create_servant_retention_policy( - ServantRetentionPolicyValue.NON_RETAIN); - - - nsPOA = rootPOA.create_POA("NameService", null, poaPolicy); - nsPOA.the_POAManager().activate( ); - - // create and set the servant manager - contextMgr = new - ServantManagerImpl(orb, logDir, this ); - - // The RootObject key will be NC0 - String rootKey = contextMgr.getRootObjectKey( ); - // initialize the root Naming Context - NamingContextImpl nc = - new NamingContextImpl( orb, rootKey, this, contextMgr ); - nc = contextMgr.addContext( rootKey, nc ); - nc.setServantManagerImpl( contextMgr ); - nc.setORB( orb ); - nc.setRootNameService( this ); - - nsPOA.set_servant_manager(contextMgr); - rootContext = NamingContextHelper.narrow( - nsPOA.create_reference_with_id( rootKey.getBytes( ), - NamingContextHelper.id( ) ) ); - } - - /** - * This method returns the Root Naming Context - */ - public NamingContext initialNamingContext() - { - return rootContext; - } - - /** - * This method returns nsPOA which is the only POA that we use for - * Persistent Naming Contexts. - */ - POA getNSPOA( ) { - return nsPOA; - } - - - /** - * This method creates a NewContext, This will internally invoked from - * NamingContextImpl. It is not a public API. NewContext is in this class - * because a Persiten reference has to be created with Persistent NameService - * POA. - */ - public NamingContext NewContext( ) throws org.omg.CORBA.SystemException - { - try - { - // Get the new Naming Context Key from - // the ServantManager - String newKey = - contextMgr.getNewObjectKey( ); - // Create the new Naming context and create the Persistent - // reference - NamingContextImpl theContext = - new NamingContextImpl( theorb, newKey, - this, contextMgr ); - NamingContextImpl tempContext = contextMgr.addContext( newKey, - theContext ); - if( tempContext != null ) - { - theContext = tempContext; - } - // If the context is read from the File, The following three entries - // will be null. So a fresh setup may be required. - theContext.setServantManagerImpl( contextMgr ); - theContext.setORB( theorb ); - theContext.setRootNameService( this ); - NamingContext theNewContext = - NamingContextHelper.narrow( - nsPOA.create_reference_with_id( newKey.getBytes( ), - NamingContextHelper.id( )) ); - return theNewContext; - } - catch( org.omg.CORBA.SystemException e ) - { - throw e; - } - catch( java.lang.Exception e ) - { - //throw e; - } - return null; - } - - /** - * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method - * @param Object Key as String - * @return a CORBA.Object reference. - */ - org.omg.CORBA.Object getObjectReferenceFromKey( String key ) - { - org.omg.CORBA.Object theObject = null; - try - { - theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) ); - } - catch (Exception e ) - { - theObject = null; - } - return theObject; - } - - /** - * getObjectKey gets the Object Key from the reference using POA.reference_to_id method - * @param reference an CORBA.Object. - * @return Object Key as String - */ - String getObjectKey( org.omg.CORBA.Object reference ) - { - byte theId[]; - try - { - theId = nsPOA.reference_to_id( reference ); - } - catch( org.omg.PortableServer.POAPackage.WrongAdapter e ) - { - return null; - } - catch( org.omg.PortableServer.POAPackage.WrongPolicy e ) - { - return null; - } - catch( Exception e ) - { - return null; - } - String theKey = new String( theId ); - return theKey; - } - - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java 2018-01-30 20:18:29.000000000 -0500 +++ /dev/null 2018-01-30 20:18:29.000000000 -0500 @@ -1,1302 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.naming.pcosnaming; - - -import org.omg.CORBA.Object; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.Policy; -import org.omg.PortableServer.POA; -import org.omg.PortableServer.LifespanPolicyValue; -import org.omg.PortableServer.RequestProcessingPolicyValue; -import org.omg.PortableServer.IdAssignmentPolicyValue; -import org.omg.PortableServer.ServantRetentionPolicyValue; - -import org.omg.CosNaming.*; -import org.omg.CosNaming.NamingContextPackage.*; -import org.omg.CosNaming.NamingContextExtPackage.*; - -import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore; -import com.sun.corba.se.impl.naming.cosnaming.NamingUtils; - -import com.sun.corba.se.impl.naming.namingutil.INSURLHandler; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.logging.NamingSystemException; - -import java.io.Serializable; -import java.util.Hashtable; - -/** - * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext and - * NamingContextExt interface. - *

- * The operations bind(), rebind(), bind_context() and rebind_context() - * are all really implemented by doBind(). resolve() is really implemented - * by doResolve(), unbind() by doUnbind(). list(), new_context() and - * destroy() uses the NamingContextDataStore interface directly. All the - * doX() methods are public static. - * They synchronize on the NamingContextDataStore object. - *

- * None of the methods here are Synchronized because These methods will be - * invoked from Super class's doBind( ), doResolve( ) which are already - * Synchronized. - */ - - -public class NamingContextImpl - extends NamingContextExtPOA - implements NamingContextDataStore, Serializable -{ - - // The ORB is required to do string_to_object() operations - // All the references are stored in the files in the form of IOR strings - private transient ORB orb; - - // The ObjectKey will be in the format NC which uniquely identifies - // The NamingContext internaly - private final String objKey; - - // Hash table contains all the entries in the NamingContexts. The - // CORBA.Object references will be stored in the form of IOR strings - // and the Child Naming Contexts will have it's key as the entry in the - // table. This table is written into File everytime an update is made - // on this context. - private final Hashtable theHashtable = new Hashtable( ); - - // The NameServiceHandle is required to get the ObjectId from the - // NamingContext's references. These references are created using - // POA in the NameService. - private transient NameService theNameServiceHandle; - - // ServantManager is the single point of contact to Read, Write and - // Update the NamingContextFile - private transient ServantManagerImpl theServantManagerImplHandle; - - // All the INS (Interoperable Naming Service) methods are defined in this class - // All the calls to INS will be delegated to this class. - private transient com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl insImpl; - - private transient NamingSystemException readWrapper ; - - private transient NamingSystemException updateWrapper ; - - private static POA biPOA = null; - - /** - * Create a naming context servant. - * Runs the super constructor. - * @param orb an ORB object. - * @param objKey as String - * @param theNameService as NameService - * @param theServantManagerImpl as ServantManagerImpl - * @exception java.lang.Exception a Java exception. - */ - - public NamingContextImpl(ORB orb, String objKey, - NameService theNameService, ServantManagerImpl theServantManagerImpl ) - throws Exception - { - super(); - - this.orb = orb; - readWrapper = NamingSystemException.get( orb, - CORBALogDomains.NAMING_READ ) ; - updateWrapper = NamingSystemException.get( orb, - CORBALogDomains.NAMING_UPDATE ) ; - - debug = true ; // orb.namingDebugFlag ; - this.objKey = objKey; - theNameServiceHandle = theNameService; - theServantManagerImplHandle = theServantManagerImpl; - insImpl = - new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl(); - } - - com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl getINSImpl( ) - { - if( insImpl == null ) - { - // insImpl will be null if the NamingContext graph is rebuilt from - // the persistence store. - insImpl = - new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl(); - } - return insImpl; - } - - - public void setRootNameService( NameService theNameService ) { - theNameServiceHandle = theNameService; - } - - public void setORB( ORB theOrb ) { - orb = theOrb; - } - - public void setServantManagerImpl( - ServantManagerImpl theServantManagerImpl ) - { - theServantManagerImplHandle = theServantManagerImpl; - } - - public POA getNSPOA( ) { - return theNameServiceHandle.getNSPOA( ); - } - - - - - /** - * Bind an object under a name in this NamingContext. If the name - * contains multiple (n) components, n-1 will be resolved in this - * NamingContext and the object bound in resulting NamingContext. - * An exception is thrown if a binding with the supplied name already - * exists. If the - * object to be bound is a NamingContext it will not participate in - * a recursive resolve. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param obj the object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound The supplied name - * is already bound. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see doBind - */ - public void bind(NameComponent[] n, org.omg.CORBA.Object obj) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName, - org.omg.CosNaming.NamingContextPackage.AlreadyBound - { - if( obj == null ) { - throw updateWrapper.objectIsNull() ; - } - - if (debug) - dprint("bind " + nameToString(n) + " to " + obj); - // doBind implements all four flavors of binding - NamingContextDataStore impl = (NamingContextDataStore)this; - doBind(impl,n,obj,false,BindingType.nobject); - } - - /** - * Bind a NamingContext under a name in this NamingContext. If the name - * contains multiple (n) components, n-1 will be resolved in this - * NamingContext and the object bound in resulting NamingContext. - * An exception is thrown if a binding with the supplied name already - * exists. The NamingContext will participate in recursive resolving. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param nc the NamingContect object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is - * already bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see doBind - */ - public void bind_context(NameComponent[] n, NamingContext nc) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName, - org.omg.CosNaming.NamingContextPackage.AlreadyBound - { - if( nc == null ) { - throw updateWrapper.objectIsNull() ; - } - // doBind implements all four flavors of binding - NamingContextDataStore impl = (NamingContextDataStore)this; - doBind(impl,n,nc,false,BindingType.ncontext); - } - - /** - * Bind an object under a name in this NamingContext. If the name - * contains multiple (n) components, n-1 will be resolved in this - * NamingContext and the object bound in resulting NamingContext. - * If a binding under the supplied name already exists it will be - * unbound first. If the - * object to be bound is a NamingContext it will not participate in - * a recursive resolve. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param obj the object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see doBind - */ - public void rebind(NameComponent[] n, org.omg.CORBA.Object obj) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - if( obj == null ) - { - throw updateWrapper.objectIsNull() ; - } - try { - if (debug) - dprint("rebind " + nameToString(n) + " to " + obj); - // doBind implements all four flavors of binding - NamingContextDataStore impl = (NamingContextDataStore)this; - doBind(impl,n,obj,true,BindingType.nobject); - } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) { - // This should not happen - throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ; - } - } - - /** - * Bind a NamingContext under a name in this NamingContext. If the name - * contains multiple (n) components, the first n-1 components will be - * resolved in this - * NamingContext and the object bound in resulting NamingContext. - * If a binding under the supplied name already exists it will be - * unbound first. The NamingContext will participate in recursive resolving. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param nc the object reference to be bound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see doBind - */ - public void rebind_context(NameComponent[] n, NamingContext nc) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - try { - if (debug) - dprint("rebind_context " + nameToString(n) + " to " + nc); - // doBind implements all four flavors of binding - NamingContextDataStore impl = (NamingContextDataStore)this; - doBind(impl,n,nc,true,BindingType.ncontext); - } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) { - // This should not happen - throw updateWrapper.namingCtxRebindAlreadyBound( ex ) ; - } - } - - /** - * Resolve a name in this NamingContext and return the object reference - * bound to the name. If the name contains multiple (n) components, - * the first component will be resolved in this NamingContext and the - * remaining components resolved in the resulting NamingContext, provided - * that the NamingContext bound to the first component of the name was - * bound with bind_context(). - * @param n a sequence of NameComponents which is the name to be resolved. - * @return the object reference bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see doResolve - */ - public org.omg.CORBA.Object resolve(NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - if (debug) - dprint("resolve " + nameToString(n)); - // doResolve actually resolves - NamingContextDataStore impl = (NamingContextDataStore)this; - return doResolve(impl,n); - } - - /** - * Remove a binding from this NamingContext. If the name contains - * multiple (n) components, the first n-1 components will be resolved - * from this NamingContext and the final component unbound in - * the resulting NamingContext. - * @param n a sequence of NameComponents which is the name to be unbound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see doUnbind - */ - public void unbind(NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - if (debug) - dprint("unbind " + nameToString(n)); - // doUnbind actually unbinds - NamingContextDataStore impl = (NamingContextDataStore)this; - doUnbind(impl,n); - } - - /** - * List the contents of this NamingContest. A sequence of bindings - * is returned (a BindingList) containing up to the number of requested - * bindings, and a BindingIterator object reference is returned for - * iterating over the remaining bindings. - * @param how_many The number of requested bindings in the BindingList. - * @param bl The BindingList as an out parameter. - * @param bi The BindingIterator as an out parameter. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see BindingListHolder - * @see BindingIteratorImpl - */ - public void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi) - { - if (debug) - dprint("list(" + how_many + ")"); - // List actually generates the list - NamingContextDataStore impl = (NamingContextDataStore)this; - synchronized (impl) { - impl.List(how_many,bl,bi); - } - if (debug && bl.value != null) - dprint("list(" + how_many + ") -> bindings[" + bl.value.length + - "] + iterator: " + bi.value); - } - - - /** - * Create a NamingContext object and return its object reference. - * @return an object reference for a new NamingContext object implemented - * by this Name Server. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - public synchronized NamingContext new_context() - { - // Create actually creates a new naming context - if (debug) - dprint("new_context()"); - NamingContextDataStore impl = (NamingContextDataStore)this; - synchronized (impl) { - return impl.NewContext(); - } - } - - - /** - * Create a new NamingContext, bind it in this Naming Context and return - * its object reference. This is equivalent to using new_context() followed - * by bind_context() with the supplied name and the object reference for - * the newly created NamingContext. - * @param n a sequence of NameComponents which is the name to be unbound. - * @return an object reference for a new NamingContext object implemented - * by this Name Server, bound to the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is - * already bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see new_context - * @see bind_context - */ - public NamingContext bind_new_context(NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.AlreadyBound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - NamingContext nc = null; - NamingContext rnc = null; - try { - if (debug) - dprint("bind_new_context " + nameToString(n)); - // The obvious solution: - nc = this.new_context(); - this.bind_context(n,nc); - rnc = nc; - nc = null; - } finally { - try { - if(nc != null) - nc.destroy(); - } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) { - } - } - return rnc; - } - - /** - * Destroy this NamingContext object. If this NamingContext contains - * no bindings, the NamingContext is deleted. - * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty This NamingContext - * is not empty (i.e., contains bindings). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - public void destroy() - throws org.omg.CosNaming.NamingContextPackage.NotEmpty - { - if (debug) - dprint("destroy "); - NamingContextDataStore impl = (NamingContextDataStore)this; - synchronized (impl) { - if (impl.IsEmpty() == true) - // The context is empty so it can be destroyed - impl.Destroy(); - else - // This context is not empty! - throw new org.omg.CosNaming.NamingContextPackage.NotEmpty(); - } - } - - /** - * Implements all four flavors of binding. It uses Resolve() to - * check if a binding already exists (for bind and bind_context), and - * unbind() to ensure that a binding does not already exist. - * If the length of the name is 1, then Bind() is called with - * the name and the object to bind. Otherwise, the first component - * of the name is resolved in this NamingContext and the appropriate - * form of bind passed to the resulting NamingContext. - * This method is static for maximal reuse - even for extended naming - * context implementations where the recursive semantics still apply. - * @param impl an implementation of NamingContextDataStore - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param obj the object reference to be bound. - * @param rebind Replace an existing binding or not. - * @param bt Type of binding (as object or as context). - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the first component of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is - * already bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see resolve - * @see unbind - * @see bind - * @see bind_context - * @see rebind - * @see rebind_context - */ - private void doBind(NamingContextDataStore impl, - NameComponent[] n, - org.omg.CORBA.Object obj, - boolean rebind, - org.omg.CosNaming.BindingType bt) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName, - org.omg.CosNaming.NamingContextPackage.AlreadyBound - { - // Valid name? - if (n.length < 1) - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - - // At bottom level? - if (n.length == 1) { - // The identifier must be set - if( (n[0].id.length() == 0) && (n[0].kind.length() == 0) ) - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - - // Ensure synchronization of backend - synchronized (impl) { - // Yes: bind object in this context under the name - BindingTypeHolder bth = new BindingTypeHolder(); - if (rebind) { - org.omg.CORBA.Object objRef = impl.Resolve( n[0], bth ); - if( objRef != null ) { - // Refer Naming Service Doc:00-11-01 section 2.2.3.4 - // If there is an object already bound with the name - // and the binding type is not ncontext a NotFound - // Exception with a reason of not a context has to be - // raised. - // Fix for bug Id: 4384628 - if ( bth.value.value() == BindingType.nobject.value() ) { - if ( bt.value() == BindingType.ncontext.value() ) { - throw new NotFound(NotFoundReason.not_context, n); - } - } else { - // Previously a Context was bound and now trying to - // bind Object. It is invalid. - if ( bt.value() == BindingType.nobject.value() ) { - throw new NotFound(NotFoundReason.not_object, n); - } - } - impl.Unbind(n[0]); - } - } else { - if (impl.Resolve(n[0],bth) != null) - throw new org.omg.CosNaming.NamingContextPackage.AlreadyBound(); - } - - // Now there are no other bindings under this name - impl.Bind(n[0],obj,bt); - } - } else { - // No: bind in a different context - NamingContext context = resolveFirstAsContext(impl,n); - - // Compute tail - NameComponent[] tail = new NameComponent[n.length - 1]; - System.arraycopy(n,1,tail,0,n.length-1); - - // How should we propagate the bind - switch (bt.value()) { - case BindingType._nobject: - { - // Bind as object - if (rebind) - context.rebind(tail,obj); - else - context.bind(tail,obj); - } - break; - case BindingType._ncontext: - { - // Narrow to a naming context using Java casts. It must work. - NamingContext objContext = (NamingContext)obj; - // Bind as context - if (rebind) - context.rebind_context(tail,objContext); - else - context.bind_context(tail,objContext); - } - break; - default: - // This should not happen - throw updateWrapper.namingCtxBadBindingtype() ; - } - } - } - - - /** - * Implements resolving names in this NamingContext. The first component - * of the supplied name is resolved in this NamingContext by calling - * Resolve(). If there are no more components in the name, the - * resulting object reference is returned. Otherwise, the resulting object - * reference must have been bound as a context and be narrowable to - * a NamingContext. If this is the case, the remaining - * components of the name is resolved in the resulting NamingContext. - * This method is static for maximal reuse - even for extended naming - * context implementations where the recursive semantics still apply. - * @param impl an implementation of NamingContextDataStore - * @param n a sequence of NameComponents which is the name to be resolved. - * @return the object reference bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the first component of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see resolve - */ - public static org.omg.CORBA.Object doResolve(NamingContextDataStore impl, - NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - org.omg.CORBA.Object obj = null; - BindingTypeHolder bth = new BindingTypeHolder(); - - // Length must be greater than 0 - if (n.length < 1) - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - - // The identifier must be set - if (n.length == 1) { - synchronized (impl) { - // Resolve first level in this context - obj = impl.Resolve(n[0],bth); - } - if (obj == null) { - // Object was not found - throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n); - } - return obj; - } else { - // n.length > 1 - if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) ) - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - - NamingContext context = resolveFirstAsContext(impl,n); - - // Compute restOfName = name[1..length] - NameComponent[] tail = new NameComponent[n.length -1]; - System.arraycopy(n,1,tail,0,n.length-1); - - // Resolve rest of name in context - return context.resolve(tail); - } - } - - /** - * Implements unbinding bound names in this NamingContext. If the - * name contains only one component, the name is unbound in this - * NamingContext using Unbind(). Otherwise, the first component - * of the name is resolved in this NamingContext and - * unbind passed to the resulting NamingContext. - * This method is static for maximal reuse - even for extended naming - * context implementations where the recursive semantics still apply. - * @param impl an implementation of NamingContextDataStore - * @param n a sequence of NameComponents which is the name to be unbound. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with multiple - * components was supplied, but the first component could not be - * resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the n-1 components of the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see resolve - */ - public static void doUnbind(NamingContextDataStore impl, - NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - // Name valid? - if (n.length < 1) - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - - // Unbind here? - if (n.length == 1) { - // The identifier must be set - if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - - org.omg.CORBA.Object objRef = null; - synchronized (impl) { - // Yes: unbind in this context - objRef = impl.Unbind(n[0]); - } - - if (objRef == null) - // It was not bound - throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n); - // Done - return; - } else { - // No: unbind in a different context - - // Resolve first - must be resolveable - NamingContext context = resolveFirstAsContext(impl,n); - - // Compute tail - NameComponent[] tail = new NameComponent[n.length - 1]; - System.arraycopy(n,1,tail,0,n.length-1); - - // Propagate unbind to this context - context.unbind(tail); - } - } - - /** - * Implements resolving a NameComponent in this context and - * narrowing it to CosNaming::NamingContext. It will throw appropriate - * exceptions if not found or not narrowable. - * @param impl an implementation of NamingContextDataStore - * @param n a NameComponents which is the name to be found. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound The - * first component could not be resolved. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the first component of the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see resolve - */ - protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl, - NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.NotFound { - org.omg.CORBA.Object topRef = null; - BindingTypeHolder bth = new BindingTypeHolder(); - NamingContext context = null; - - synchronized (impl) { - // Resolve first - must be resolveable - topRef = impl.Resolve(n[0],bth); - if (topRef == null) { - // It was not bound - throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n); - } - } - - // Was it bound as a context? - if (bth.value != BindingType.ncontext) { - // It was not a context - throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n); - } - - // Narrow to a naming context - try { - context = NamingContextHelper.narrow(topRef); - } catch (org.omg.CORBA.BAD_PARAM ex) { - // It was not a context - throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n); - } - - // Hmm. must be ok - return context; - } - - public static String nameToString(NameComponent[] name) - { - StringBuffer s = new StringBuffer("{"); - if (name != null || name.length > 0) { - for (int i=0;i0) - s.append(","); - s.append("["). - append(name[i].id). - append(","). - append(name[i].kind). - append("]"); - } - } - s.append("}"); - return s.toString(); - } - - // Debugging aids. - private static boolean debug ; - - private static void dprint(String msg) { - NamingUtils.dprint("NamingContextImpl(" + - Thread.currentThread().getName() + " at " + - System.currentTimeMillis() + - " ems): " + msg); - } - - - /** - * Implements all flavors of binding( bind and bindcontext) - * This method will be called from the superclass's doBind( ) method - * which takes care of all the conditions before calling this method. - * i.e., It checks whether the Name is already Bounded, Then in the - * case of rebind it calls Unbind first. - * This method does one level binding only, To have n-level binding - * with compound names, doBind( ) calls this method recursively. - * @param n a sequence of NameComponents which is the name under which - * the object will be bound. - * @param obj the object reference to be bound. - * @param bt Type of binding (as object or as context). - * @exception org.omg.CosNaming.NamingContextPackage.NotFound raised - * if the NameComoponent list is invalid - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed - * Could not proceed in resolving the Name from the given NameComponent - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object - * is already bound under the supplied name. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA - * system exceptions - * @see Resolve - * @see Unbind - */ - public void Bind(NameComponent n, org.omg.CORBA.Object obj, BindingType bt) - { - if( obj == null ) { - // Raise a Valid Exception and Return - return; - } - - InternalBindingKey key = new InternalBindingKey(n); - InternalBindingValue value; - - try { - if( bt.value() == BindingType._nobject ) { - // If the BindingType is an ObjectRef then Stringify this ref and - // Store it in InternalBindingValue instance. This is required - // because the Object References has to be stored in file - value = new InternalBindingValue(bt, orb.object_to_string(obj) ); - value.setObjectRef( obj ); - } else { - // If the BindingType is a NamingContext then get it's object key - // from the NameService and store it in the Internal Binding Value instance - String theNCKey = theNameServiceHandle.getObjectKey( obj ); - value = new InternalBindingValue( bt, theNCKey ); - value.setObjectRef( obj ); - } - - InternalBindingValue oldValue = - (InternalBindingValue)this.theHashtable.put(key,value); - - if( oldValue != null) { - // There was an entry with this name in the Hashtable and hence throw CTX_ALREADY_BOUND - // exception - throw updateWrapper.namingCtxRebindAlreadyBound() ; - } else { - try { - // Everything went smooth so update the NamingContext file with the - // latest Hashtable image - theServantManagerImplHandle.updateContext( objKey, this ); - } catch( Exception e ) { - // Something went wrong while updating the context - // so speak the error - throw updateWrapper.bindUpdateContextFailed( e ) ; - } - } - } catch( Exception e ) { - // Something went wrong while Binding the Object Reference - // Speak the error again. - throw updateWrapper.bindFailure( e ) ; - } - } - - /** - * This method resolves the NamingContext or Object Reference for one level - * The doResolve( ) method calls Resolve( ) recursively to resolve n level - * Names. - * @param n a sequence of NameComponents which is the name to be resolved. - * @param bth Type of binding (as object or as context). - * @return the object reference bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound Neither a NamingContext - * or a Corba Object reference not found under this Name - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see Bind - */ - public Object Resolve(NameComponent n, BindingTypeHolder bth) - throws SystemException - { - if( ( n.id.length() == 0 ) &&( n.kind.length() == 0 ) ) { - // If the NameComponent list has no entry then it means the current - // context was requested - bth.value = BindingType.ncontext; - return theNameServiceHandle.getObjectReferenceFromKey( - this.objKey ); - } - - InternalBindingKey key = new InternalBindingKey(n); - InternalBindingValue value = - (InternalBindingValue) this.theHashtable.get(key); - - if( value == null ) { - // No entry was found for the given name and hence return NULL - // NamingContextDataStore throws appropriate exception if - // required. - return null; - } - - Object theObjectFromStringifiedReference = null; - bth.value = value.theBindingType; - - try { - // Check whether the entry found in the Hashtable starts with NC - // Which means it's a name context. So get the NamingContext reference - // from ServantManager, which would either return from the cache or - // read it from the File. - if( value.strObjectRef.startsWith( "NC" ) ) { - bth.value = BindingType.ncontext; - return theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef ); - } else { - // Else, It is a Object Reference. Check whether Object Reference - // can be obtained directly, If not then convert the stringified - // reference to object and return. - theObjectFromStringifiedReference = value.getObjectRef( ); - - if (theObjectFromStringifiedReference == null ) { - try { - theObjectFromStringifiedReference = - orb.string_to_object( value.strObjectRef ); - value.setObjectRef( theObjectFromStringifiedReference ); - } catch( Exception e ) { - throw readWrapper.resolveConversionFailure( - CompletionStatus.COMPLETED_MAYBE, e ); - } - } - } - } catch ( Exception e ) { - throw readWrapper.resolveFailure( - CompletionStatus.COMPLETED_MAYBE, e ); - } - - return theObjectFromStringifiedReference; - } - - /** - * This method Unbinds the NamingContext or Object Reference for one level - * The doUnbind( ) method from superclass calls Unbind() to recursively - * Unbind using compound Names. - * @param n a sequence of NameComponents which is the name to be resolved. - * @return the object reference bound under the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.NotFound Neither a NamingContext - * or a Corba Object reference not found under this Name - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed - * in resolving the the supplied name. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The supplied name - * is invalid (i.e., has length less than 1). - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - * @see Bind - */ - - public Object Unbind(NameComponent n) throws SystemException - { - try { - InternalBindingKey key = new InternalBindingKey(n); - InternalBindingValue value = null; - - try { - value = (InternalBindingValue) this.theHashtable.remove(key); - } catch( Exception e ) { - // Ignore the exception in Hashtable.remove - } - - theServantManagerImplHandle.updateContext( objKey, this ); - - if( value == null ) { - return null; - } - - if( value.strObjectRef.startsWith( "NC" ) ) { - theServantManagerImplHandle.readInContext( value.strObjectRef ); - Object theObjectFromStringfiedReference = - theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef ); - return theObjectFromStringfiedReference; - } else { - Object theObjectFromStringifiedReference = value.getObjectRef( ); - - if( theObjectFromStringifiedReference == null ) { - theObjectFromStringifiedReference = - orb.string_to_object( value.strObjectRef ); - } - - return theObjectFromStringifiedReference; - } - } catch( Exception e ) { - throw updateWrapper.unbindFailure( CompletionStatus.COMPLETED_MAYBE, e ); - } - } - - /** - * List the contents of this NamingContext. It creates a new - * PersistentBindingIterator object and passes it a clone of the - * hash table and an orb object. It then uses the - * newly created object to return the required number of bindings. - * @param how_many The number of requested bindings in the BindingList. - * @param bl The BindingList as an out parameter. - * @param bi The BindingIterator as an out parameter. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - - public void List(int how_many, BindingListHolder bl, - BindingIteratorHolder bi) throws SystemException - { - if( biPOA == null ) { - createbiPOA( ); - } - try { - PersistentBindingIterator bindingIterator = - new PersistentBindingIterator(this.orb, - (Hashtable)this.theHashtable.clone(), biPOA); - // Have it set the binding list - bindingIterator.list(how_many,bl); - - byte[] objectId = biPOA.activate_object( bindingIterator ); - org.omg.CORBA.Object obj = biPOA.id_to_reference( objectId ); - - // Get the object reference for the binding iterator servant - org.omg.CosNaming.BindingIterator bindingRef = - org.omg.CosNaming.BindingIteratorHelper.narrow( obj ); - - bi.value = bindingRef; - } catch (org.omg.CORBA.SystemException e) { - throw e; - } catch( Exception e ) { - throw readWrapper.transNcListGotExc( e ) ; - } - } - - private synchronized void createbiPOA( ) { - if( biPOA != null ) { - return; - } - try { - POA rootPOA = (POA) orb.resolve_initial_references( - ORBConstants.ROOT_POA_NAME ); - rootPOA.the_POAManager().activate( ); - - int i = 0; - Policy[] poaPolicy = new Policy[3]; - poaPolicy[i++] = rootPOA.create_lifespan_policy( - LifespanPolicyValue.TRANSIENT); - poaPolicy[i++] = rootPOA.create_id_assignment_policy( - IdAssignmentPolicyValue.SYSTEM_ID); - poaPolicy[i++] = rootPOA.create_servant_retention_policy( - ServantRetentionPolicyValue.RETAIN); - biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy ); - biPOA.the_POAManager().activate( ); - } catch( Exception e ) { - throw readWrapper.namingCtxBindingIteratorCreate( e ) ; - } - } - - - /** - * Create a NamingContext object and return its object reference. - * @return an object reference for a new NamingContext object implemented - * by this Name Server. - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - public NamingContext NewContext() throws SystemException - { - try { - return theNameServiceHandle.NewContext( ); - } catch( org.omg.CORBA.SystemException e ) { - throw e; - } catch( Exception e ) { - throw updateWrapper.transNcNewctxGotExc( e ) ; - } - } - - - /** - * Destroys the NamingContext. - */ - public void Destroy() throws SystemException - { - // XXX note that orb.disconnect is illegal here, since the - // POA is used. However, there may be some associated state - // that needs to be cleaned up in ServerManagerImpl which we will - // look into further at another time. - /* - // XXX This needs to be replaced by cleaning up the - // file that backs up the naming context. No explicit - // action is necessary at the POA level, since this is - // created with the non-retain policy. - /* - try { orb.disconnect( - theNameServiceHandle.getObjectReferenceFromKey( this.objKey ) ); - } catch( org.omg.CORBA.SystemException e ) { - throw e; - } catch( Exception e ) { - throw updateWrapper.transNcDestroyGotEx( e ) ; - } - */ - } - - /** - * This operation creates a stringified name from the array of Name - * components. - * @param n Name of the object - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - */ - public String to_string(org.omg.CosNaming.NameComponent[] n) - throws org.omg.CosNaming.NamingContextPackage.InvalidName - { - // Name valid? - if ( (n == null ) || (n.length == 0) ) - { - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - } - - String theStringifiedName = getINSImpl().convertToString( n ); - - if( theStringifiedName == null ) - { - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - } - - return theStringifiedName; - } - - /** - * This operation converts a Stringified Name into an equivalent array - * of Name Components. - * @param sn Stringified Name of the object - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - */ - public org.omg.CosNaming.NameComponent[] to_name(String sn) - throws org.omg.CosNaming.NamingContextPackage.InvalidName - { - // Name valid? - if ( (sn == null ) || (sn.length() == 0) ) - { - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - } - org.omg.CosNaming.NameComponent[] theNameComponents = - getINSImpl().convertToNameComponent( sn ); - if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) ) - { - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - } - for( int i = 0; i < theNameComponents.length; i++ ) { - // If there is a name component whose id and kind null or - // zero length string, then an invalid name exception needs to be - // raised. - if ( ( ( theNameComponents[i].id == null ) - ||( theNameComponents[i].id.length() == 0 ) ) - &&( ( theNameComponents[i].kind == null ) - ||( theNameComponents[i].kind.length() == 0 ) ) ) { - throw new InvalidName(); - } - } - return theNameComponents; - } - - /** - * This operation creates a URL based "iiopname://" format name - * from the Stringified Name of the object. - * @param addr internet based address of the host machine where - * Name Service is running - * @param sn Stringified Name of the object - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress - * Indicates the internet based address of the host machine is - * incorrect - */ - - public String to_url(String addr, String sn) - throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - // Name valid? - if ( (sn == null ) || (sn.length() == 0) ) - { - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - } - if( addr == null ) - { - throw new org.omg.CosNaming.NamingContextExtPackage.InvalidAddress(); - } - String urlBasedAddress = null; - try { - urlBasedAddress = getINSImpl().createURLBasedAddress( addr, sn ); - } catch (Exception e ) { - urlBasedAddress = null; - } - // Extra check to see that corba name url created is valid as per - // INS spec grammer. - try { - INSURLHandler.getINSURLHandler().parseURL( urlBasedAddress ); - } catch( BAD_PARAM e ) { - throw new - org.omg.CosNaming.NamingContextExtPackage.InvalidAddress(); - } - return urlBasedAddress; - } - - /** - * This operation resolves the Stringified name into the object - * reference. - * @param sn Stringified Name of the object - * @exception org.omg.CosNaming.NamingContextPackage.NotFound - * Indicates there is no object reference for the given name. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed - * Indicates that the given compound name is incorrect - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - */ - public org.omg.CORBA.Object resolve_str(String sn) - throws org.omg.CosNaming.NamingContextPackage.NotFound, - org.omg.CosNaming.NamingContextPackage.CannotProceed, - org.omg.CosNaming.NamingContextPackage.InvalidName - { - org.omg.CORBA.Object theObject = null; - // Name valid? - if ( (sn == null ) || (sn.length() == 0) ) - { - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - } - org.omg.CosNaming.NameComponent[] theNameComponents = - getINSImpl().convertToNameComponent( sn ); - if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) ) - { - throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); - } - theObject = resolve( theNameComponents ); - return theObject; - } - - /** - * This is a Debugging Method - */ - public boolean IsEmpty() - { - return this.theHashtable.isEmpty(); - } - - /** - * This is a Debugging Method - */ - public void printSize( ) - { - System.out.println( "Hashtable Size = " + theHashtable.size( ) ); - java.util.Enumeration e = theHashtable.keys( ); - for( ; e.hasMoreElements(); ) - { - InternalBindingValue thevalue = - (InternalBindingValue) this.theHashtable.get(e.nextElement()); - if( thevalue != null ) - { - System.out.println( "value = " + thevalue.strObjectRef); - } - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java 2018-01-30 20:18:30.000000000 -0500 +++ /dev/null 2018-01-30 20:18:30.000000000 -0500 @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.naming.pcosnaming; - -// Import general CORBA classes -import org.omg.CORBA.SystemException; -import org.omg.CORBA.ORB; -import org.omg.CORBA.INTERNAL; - -// Get org.omg.CosNaming Types -import org.omg.CosNaming.Binding; -import org.omg.CosNaming.BindingType; -import org.omg.CosNaming.BindingTypeHolder; -import org.omg.CosNaming.NameComponent; -import org.omg.PortableServer.POA; - -// Get base implementation -import com.sun.corba.se.impl.naming.pcosnaming.NamingContextImpl; -import com.sun.corba.se.impl.naming.pcosnaming.InternalBindingValue; - -import com.sun.corba.se.impl.naming.cosnaming.BindingIteratorImpl; - -// Get a hash table -import java.util.Hashtable; -import java.util.Enumeration; - -/** - * Class TransientBindingIterator implements the abstract methods - * defined by BindingIteratorImpl, to use with the TransientNamingContext - * implementation of the NamingContextImpl. The TransientBindingIterator - * implementation receives a hash table of InternalBindingValues, and uses - * an Enumeration to iterate over the contents of the hash table. - * @see BindingIteratorImpl - * @see TransientNamingContext - */ -public class PersistentBindingIterator extends BindingIteratorImpl -{ - private POA biPOA; - /** - * Constructs a new PersistentBindingIterator object. - * @param orb a org.omg.CORBA.ORB object. - * @param aTable A hashtable containing InternalBindingValues which is - * the content of the PersistentNamingContext. - * @exception Exception a Java exception thrown of the base class cannot - * initialize. - */ - public PersistentBindingIterator(org.omg.CORBA.ORB orb, Hashtable aTable, - POA thePOA ) throws java.lang.Exception - { - super(orb); - this.orb = orb; - theHashtable = aTable; - theEnumeration = this.theHashtable.keys(); - currentSize = this.theHashtable.size(); - biPOA = thePOA; - } - - /** - * Returns the next binding in the NamingContext. Uses the enumeration - * object to determine if there are more bindings and if so, returns - * the next binding from the InternalBindingValue. - * @param b The Binding as an out parameter. - * @return true if there were more bindings. - */ - final public boolean NextOne(org.omg.CosNaming.BindingHolder b) - { - // If there are more elements get the next element - boolean hasMore = theEnumeration.hasMoreElements(); - if (hasMore) { - InternalBindingKey theBindingKey = - ((InternalBindingKey)theEnumeration.nextElement()); - InternalBindingValue theElement = - (InternalBindingValue)theHashtable.get( theBindingKey ); - NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind ); - NameComponent[] nlist = new NameComponent[1]; - nlist[0] = n; - BindingType theType = theElement.theBindingType; - - b.value = - new Binding( nlist, theType ); - } else { - // Return empty but marshalable binding - b.value = new Binding(new NameComponent[0],BindingType.nobject); - } - return hasMore; - } - - /** - * Destroys this BindingIterator by disconnecting from the ORB - * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions. - */ - final public void Destroy() - { - // Remove the object from the Active Object Map. - try { - byte[] objectId = biPOA.servant_to_id( this ); - if( objectId != null ) { - biPOA.deactivate_object( objectId ); - } - } - catch( Exception e ) { - throw new INTERNAL( "Exception in BindingIterator.Destroy " + e ); - } - } - - /** - * Returns the remaining number of elements in the iterator. - * @return the remaining number of elements in the iterator. - */ - public final int RemainingElements() { - return currentSize; - } - - private int currentSize; - private Hashtable theHashtable; - private Enumeration theEnumeration; - private org.omg.CORBA.ORB orb; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java 2018-01-30 20:18:30.000000000 -0500 +++ /dev/null 2018-01-30 20:18:30.000000000 -0500 @@ -1,261 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.naming.pcosnaming; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.Hashtable; - -import org.omg.CORBA.Policy; -import org.omg.CORBA.LocalObject; - -import org.omg.PortableServer.POA; -import org.omg.PortableServer.Servant; -import org.omg.PortableServer.ForwardRequest; -import org.omg.PortableServer.ServantLocator; -import org.omg.PortableServer.LifespanPolicyValue; -import org.omg.PortableServer.RequestProcessingPolicyValue; -import org.omg.PortableServer.IdAssignmentPolicyValue; -import org.omg.PortableServer.ServantRetentionPolicyValue; -import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; - -import com.sun.corba.se.spi.orb.ORB; - -/** - * @author Rohit Garg - * @since JDK1.2 - */ - -public class ServantManagerImpl extends org.omg.CORBA.LocalObject implements ServantLocator -{ - - // computed using serialver tool - - private static final long serialVersionUID = 4028710359865748280L; - private ORB orb; - - private NameService theNameService; - - private File logDir; - - private Hashtable contexts; - - private CounterDB counterDb; - - private int counter; - - private final static String objKeyPrefix = "NC"; - - ServantManagerImpl(ORB orb, File logDir, NameService aNameService) - { - this.logDir = logDir; - this.orb = orb; - // initialize the counter database - counterDb = new CounterDB(logDir); - contexts = new Hashtable(); - theNameService = aNameService; - } - - - public Servant preinvoke(byte[] oid, POA adapter, String operation, - CookieHolder cookie) throws ForwardRequest - { - - String objKey = new String(oid); - - Servant servant = (Servant) contexts.get(objKey); - - if (servant == null) - { - servant = readInContext(objKey); - } - - return servant; - } - - public void postinvoke(byte[] oid, POA adapter, String operation, - java.lang.Object cookie, Servant servant) - { - // nada - } - - public NamingContextImpl readInContext(String objKey) - { - NamingContextImpl context = (NamingContextImpl) contexts.get(objKey); - if( context != null ) - { - // Returning Context from Cache - return context; - } - - File contextFile = new File(logDir, objKey); - if (contextFile.exists()) { - try { - FileInputStream fis = new FileInputStream(contextFile); - ObjectInputStream ois = new ObjectInputStream(fis); - context = (NamingContextImpl) ois.readObject(); - context.setORB( orb ); - context.setServantManagerImpl( this ); - context.setRootNameService( theNameService ); - ois.close(); - } catch (Exception ex) { - } - } - - if (context != null) - { - contexts.put(objKey, context); - } - return context; - } - - public NamingContextImpl addContext(String objKey, - NamingContextImpl context) - { - File contextFile = new File(logDir, objKey); - - if (contextFile.exists()) - { - context = readInContext(objKey); - } - else { - try { - FileOutputStream fos = new FileOutputStream(contextFile); - ObjectOutputStream oos = new ObjectOutputStream(fos); - oos.writeObject(context); - oos.close(); - } catch (Exception ex) { - } - } - try - { - contexts.remove( objKey ); - } - catch( Exception e) - { - } - contexts.put(objKey, context); - - return context; - } - - public void updateContext( String objKey, - NamingContextImpl context ) - { - File contextFile = new File(logDir, objKey); - if (contextFile.exists()) - { - contextFile.delete( ); - contextFile = new File(logDir, objKey); - } - - try { - FileOutputStream fos = new FileOutputStream(contextFile); - ObjectOutputStream oos = new ObjectOutputStream(fos); - oos.writeObject(context); - oos.close(); - } catch (Exception ex) { - ex.printStackTrace( ); - } - } - - public static String getRootObjectKey() - { - return objKeyPrefix + CounterDB.rootCounter; - } - - public String getNewObjectKey() - { - return objKeyPrefix + counterDb.getNextCounter(); - } - - - -} - -class CounterDB implements Serializable -{ - - CounterDB (File logDir) - { - counterFileName = "counter"; - counterFile = new File(logDir, counterFileName); - if (!counterFile.exists()) { - counter = new Integer(rootCounter); - writeCounter(); - } else { - readCounter(); - } - } - - private void readCounter() - { - try { - FileInputStream fis = new FileInputStream(counterFile); - ObjectInputStream ois = new ObjectInputStream(fis); - counter = (Integer) ois.readObject(); - ois.close(); - } catch (Exception ex) { - } - } - - private void writeCounter() - { - try { - counterFile.delete(); - FileOutputStream fos = new FileOutputStream(counterFile); - ObjectOutputStream oos = new ObjectOutputStream(fos); - oos.writeObject(counter); - oos.flush(); - oos.close(); - - } catch (Exception ex) { - } - } - - public synchronized int getNextCounter() - { - int counterVal = counter.intValue(); - counter = new Integer(++counterVal); - writeCounter(); - - return counterVal; - } - - - - private Integer counter; - - private static String counterFileName = "counter"; - - private transient File counterFile; - - public final static int rootCounter = 0; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/NullServantImpl.java 2018-01-30 20:18:31.000000000 -0500 +++ /dev/null 2018-01-30 20:18:31.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.oa ; - -import org.omg.CORBA.SystemException ; - -import com.sun.corba.se.spi.oa.NullServant ; - -public class NullServantImpl implements NullServant -{ - private SystemException sysex ; - - public NullServantImpl( SystemException ex ) - { - this.sysex = ex ; - } - - public SystemException getException() - { - return sysex ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java 2018-01-30 20:18:32.000000000 -0500 +++ /dev/null 2018-01-30 20:18:32.000000000 -0500 @@ -1,247 +0,0 @@ -/* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.oa.poa ; - -import org.omg.CORBA.INTERNAL ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.orbutil.fsm.Action ; -import com.sun.corba.se.spi.orbutil.fsm.ActionBase ; -import com.sun.corba.se.spi.orbutil.fsm.Guard ; -import com.sun.corba.se.spi.orbutil.fsm.GuardBase ; -import com.sun.corba.se.spi.orbutil.fsm.State ; -import com.sun.corba.se.spi.orbutil.fsm.StateImpl ; -import com.sun.corba.se.spi.orbutil.fsm.Input ; -import com.sun.corba.se.spi.orbutil.fsm.InputImpl ; -import com.sun.corba.se.spi.orbutil.fsm.FSM ; -import com.sun.corba.se.spi.orbutil.fsm.FSMImpl ; -import com.sun.corba.se.spi.orbutil.fsm.StateEngine ; -import com.sun.corba.se.spi.orbutil.fsm.StateEngineFactory ; - -import com.sun.corba.se.impl.orbutil.concurrent.Mutex ; -import com.sun.corba.se.impl.orbutil.concurrent.CondVar ; - -import org.omg.CORBA.SystemException ; - -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; - -/** AOMEntry represents a Servant or potential Servant in the ActiveObjectMap. -* It may be in several states to allow for long incarnate or etherealize operations. -* The methods on this class mostly represent input symbols to the state machine -* that controls the lifecycle of the entry. A library is used to build the state -* machine rather than the more usual state pattern so that the state machine -* transitions are explicitly visible. -*/ -public class AOMEntry extends FSMImpl { - private final Thread[] etherealizer ; // The actual etherealize operation - // for this entry. It is - // represented as a Thread because - // the POA.deactivate_object never - // waits for the completion. - private final int[] counter ; // single element holder for counter - // accessed in actions - private final CondVar wait ; // accessed in actions - - final POAImpl poa ; - - public static final State INVALID = new StateImpl( "Invalid" ) ; - public static final State INCARN = new StateImpl( "Incarnating" ) { - public void postAction( FSM fsm ) { - AOMEntry entry = (AOMEntry)fsm ; - entry.wait.broadcast() ; - } - }; - public static final State VALID = new StateImpl( "Valid" ) ; - public static final State ETHP = new StateImpl( "EtherealizePending" ) ; - public static final State ETH = new StateImpl( "Etherealizing" ) { - public void preAction( FSM fsm ) { - AOMEntry entry = (AOMEntry)fsm ; - Thread etherealizer = entry.etherealizer[0] ; - if (etherealizer != null) - etherealizer.start() ; - } - - public void postAction( FSM fsm ) { - AOMEntry entry = (AOMEntry)fsm ; - entry.wait.broadcast() ; - } - }; - public static final State DESTROYED = new StateImpl( "Destroyed" ) ; - - static final Input START_ETH = new InputImpl( "startEtherealize" ) ; - static final Input ETH_DONE = new InputImpl( "etherealizeDone" ) ; - static final Input INC_DONE = new InputImpl( "incarnateDone" ) ; - static final Input INC_FAIL = new InputImpl( "incarnateFailure" ) ; - static final Input ACTIVATE = new InputImpl( "activateObject" ) ; - static final Input ENTER = new InputImpl( "enter" ) ; - static final Input EXIT = new InputImpl( "exit" ) ; - - private static Action incrementAction = new ActionBase( "increment" ) { - public void doIt( FSM fsm, Input in ) { - AOMEntry entry = (AOMEntry)fsm ; - entry.counter[0]++ ; - } - } ; - - private static Action decrementAction = new ActionBase( "decrement" ) { - public void doIt( FSM fsm, Input in ) { - AOMEntry entry = (AOMEntry)fsm ; - if (entry.counter[0] > 0) - entry.counter[0]-- ; - else - throw entry.poa.lifecycleWrapper().aomEntryDecZero() ; - } - } ; - - private static Action throwIllegalStateExceptionAction = new ActionBase( - "throwIllegalStateException" ) { - public void doIt( FSM fsm, Input in ) { - throw new IllegalStateException( - "No transitions allowed from the DESTROYED state" ) ; - } - } ; - - private static Action oaaAction = new ActionBase( "throwObjectAlreadyActive" ) { - public void doIt( FSM fsm, Input in ) { - throw new RuntimeException( new ObjectAlreadyActive() ) ; - } - } ; - - private static Guard waitGuard = new GuardBase( "wait" ) { - public Guard.Result evaluate( FSM fsm, Input in ) { - AOMEntry entry = (AOMEntry)fsm ; - try { - entry.wait.await() ; - } catch (InterruptedException exc) { - // XXX Log this - // NO-OP - } - - return Guard.Result.DEFERED ; - } - } ; - - - private static class CounterGuard extends GuardBase { - private int value ; - - public CounterGuard( int value ) - { - super( "counter>" + value ) ; - this.value = value ; - } - - public Guard.Result evaluate( FSM fsm, Input in ) - { - AOMEntry entry = (AOMEntry)fsm ; - return Guard.Result.convert( entry.counter[0] > value ) ; - } - } ; - - private static GuardBase greaterZeroGuard = new CounterGuard( 0 ) ; - private static Guard zeroGuard = new Guard.Complement( greaterZeroGuard ) ; - private static GuardBase greaterOneGuard = new CounterGuard( 1 ) ; - private static Guard oneGuard = new Guard.Complement( greaterOneGuard ) ; - - private static StateEngine engine ; - - static { - engine = StateEngineFactory.create() ; - - // State, Input, Guard, Action, new State - - engine.add( INVALID, ENTER, incrementAction, INCARN ) ; - engine.add( INVALID, ACTIVATE, null, VALID ) ; - engine.setDefault( INVALID ) ; - - engine.add( INCARN, ENTER, waitGuard, null, INCARN ) ; - engine.add( INCARN, EXIT, null, INCARN ) ; - engine.add( INCARN, START_ETH, waitGuard, null, INCARN ) ; - engine.add( INCARN, INC_DONE, null, VALID ) ; - engine.add( INCARN, INC_FAIL, decrementAction, INVALID ) ; - engine.add( INCARN, ACTIVATE, oaaAction, INCARN ) ; - - engine.add( VALID, ENTER, incrementAction, VALID ) ; - engine.add( VALID, EXIT, decrementAction, VALID ) ; - engine.add( VALID, START_ETH, greaterZeroGuard, null, ETHP ) ; - engine.add( VALID, START_ETH, zeroGuard, null, ETH ) ; - engine.add( VALID, ACTIVATE, oaaAction, VALID ) ; - - engine.add( ETHP, ENTER, waitGuard, null, ETHP ) ; - engine.add( ETHP, START_ETH, null, ETHP ) ; - engine.add( ETHP, EXIT, greaterOneGuard, decrementAction, ETHP ) ; - engine.add( ETHP, EXIT, oneGuard, decrementAction, ETH ) ; - engine.add( ETHP, ACTIVATE, oaaAction, ETHP ) ; - - engine.add( ETH, START_ETH, null, ETH ) ; - engine.add( ETH, ETH_DONE, null, DESTROYED ) ; - engine.add( ETH, ACTIVATE, oaaAction, ETH ) ; - engine.add( ETH, ENTER, waitGuard, null, ETH ) ; - - engine.setDefault( DESTROYED, throwIllegalStateExceptionAction, DESTROYED ) ; - - engine.done() ; - } - - public AOMEntry( POAImpl poa ) - { - super( engine, INVALID, ((ORB)poa.getORB()).poaFSMDebugFlag ) ; - this.poa = poa ; - etherealizer = new Thread[1] ; - etherealizer[0] = null ; - counter = new int[1] ; - counter[0] = 0 ; - wait = new CondVar( poa.poaMutex, - ((ORB)poa.getORB()).poaConcurrencyDebugFlag ) ; - } - - // Methods that drive the FSM: the real interface to this class - // Most just call the doIt method, but startEtherealize needs - // the etherealizer. - public void startEtherealize( Thread etherealizer ) - { - this.etherealizer[0] = etherealizer ; - doIt( START_ETH ) ; - } - - public void etherealizeComplete() { doIt( ETH_DONE ) ; } - public void incarnateComplete() { doIt( INC_DONE ) ; } - public void incarnateFailure() { doIt( INC_FAIL ) ; } - public void activateObject() throws ObjectAlreadyActive { - try { - doIt( ACTIVATE ) ; - } catch (RuntimeException exc) { - Throwable thr = exc.getCause() ; - if (thr instanceof ObjectAlreadyActive) - throw (ObjectAlreadyActive)thr ; - else - throw exc ; - } - } - public void enter() { doIt( ENTER ) ; } - public void exit() { doIt( EXIT ) ; } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java 2018-01-30 20:18:32.000000000 -0500 +++ /dev/null 2018-01-30 20:18:32.000000000 -0500 @@ -1,265 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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.corba.se.impl.oa.poa; - -import java.util.Set ; -import java.util.HashSet ; -import java.util.Map ; -import java.util.HashMap ; -import java.util.Iterator ; -import java.util.Vector ; - -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.CORBA.INTERNAL ; - -/** The ActiveObjectMap maintains associations between servants and - * their keys. There are two variants, to support whether or not - * multiple IDs per servant are allowed. This class suppots bidirectional - * traversal of the key-servant association. Access to an instance of this - * class is serialized by the POA mutex. - */ -public abstract class ActiveObjectMap -{ - public static class Key { - public byte[] id; - - Key(byte[] id) { - this.id = id; - } - - public String toString() { - StringBuffer buffer = new StringBuffer(); - for(int i = 0; i < id.length; i++) { - buffer.append(Integer.toString((int) id[i], 16)); - if (i != id.length-1) - buffer.append(":"); - } - return buffer.toString(); - } - - public boolean equals(java.lang.Object key) { - if (!(key instanceof Key)) - return false; - Key k = (Key) key; - if (k.id.length != this.id.length) - return false; - for(int i = 0; i < this.id.length; i++) - if (this.id[i] != k.id[i]) - return false; - return true; - } - - // Use the same hash function as for String - public int hashCode() { - int h = 0; - for (int i = 0; i < id.length; i++) - h = 31*h + id[i]; - return h; - } - } - - protected POAImpl poa ; - - protected ActiveObjectMap( POAImpl poa ) - { - this.poa = poa ; - } - - public static ActiveObjectMap create( POAImpl poa, boolean multipleIDsAllowed ) - { - if (multipleIDsAllowed) - return new MultipleObjectMap( poa ) ; - else - return new SingleObjectMap(poa ) ; - } - - private Map keyToEntry = new HashMap() ; // Map< Key, AOMEntry > - private Map entryToServant = new HashMap() ; // Map< AOMEntry, Servant > - private Map servantToEntry = new HashMap() ; // Map< Servant, AOMEntry > - - public final boolean contains(Servant value) - { - return servantToEntry.containsKey( value ) ; - } - - public final boolean containsKey(Key key) - { - return keyToEntry.containsKey(key); - } - - /** get Returbs the entry assigned to the key, or creates a new - * entry in state INVALID if none is present. - */ - public final AOMEntry get(Key key) - { - AOMEntry result = (AOMEntry)keyToEntry.get(key); - if (result == null) { - result = new AOMEntry( poa ) ; - putEntry( key, result ) ; - } - - return result ; - } - - public final Servant getServant( AOMEntry entry ) - { - return (Servant)entryToServant.get( entry ) ; - } - - public abstract Key getKey(AOMEntry value) throws WrongPolicy ; - - public Key getKey(Servant value) throws WrongPolicy - { - AOMEntry entry = (AOMEntry)servantToEntry.get( value ) ; - return getKey( entry ) ; - } - - protected void putEntry( Key key, AOMEntry value ) - { - keyToEntry.put( key, value ) ; - } - - public final void putServant( Servant servant, AOMEntry value ) - { - entryToServant.put( value, servant ) ; - servantToEntry.put( servant, value ) ; - } - - protected abstract void removeEntry( AOMEntry entry, Key key ) ; - - public final void remove( Key key ) - { - AOMEntry entry = (AOMEntry)keyToEntry.remove( key ) ; - Servant servant = (Servant)entryToServant.remove( entry ) ; - if (servant != null) - servantToEntry.remove( servant ) ; - - removeEntry( entry, key ) ; - } - - public abstract boolean hasMultipleIDs(AOMEntry value) ; - - protected void clear() - { - keyToEntry.clear(); - } - - public final Set keySet() - { - return keyToEntry.keySet() ; - } -} - -class SingleObjectMap extends ActiveObjectMap -{ - private Map entryToKey = new HashMap() ; // Map< AOMEntry, Key > - - public SingleObjectMap( POAImpl poa ) - { - super( poa ) ; - } - - public Key getKey(AOMEntry value) throws WrongPolicy - { - return (Key)entryToKey.get( value ) ; - } - - protected void putEntry(Key key, AOMEntry value) - { - super.putEntry( key, value); - - entryToKey.put( value, key ) ; - } - - public boolean hasMultipleIDs(AOMEntry value) - { - return false; - } - - // This case does not need the key. - protected void removeEntry(AOMEntry entry, Key key) - { - entryToKey.remove( entry ) ; - } - - public void clear() - { - super.clear() ; - entryToKey.clear() ; - } -} - -class MultipleObjectMap extends ActiveObjectMap -{ - private Map entryToKeys = new HashMap() ; // Map< AOMEntry, Set< Key > > - - public MultipleObjectMap( POAImpl poa ) - { - super( poa ) ; - } - - public Key getKey(AOMEntry value) throws WrongPolicy - { - throw new WrongPolicy() ; - } - - protected void putEntry(Key key, AOMEntry value) - { - super.putEntry( key, value); - - Set set = (Set)entryToKeys.get( value ) ; - if (set == null) { - set = new HashSet() ; - entryToKeys.put( value, set ) ; - } - set.add( key ) ; - } - - public boolean hasMultipleIDs(AOMEntry value) - { - Set set = (Set)entryToKeys.get( value ) ; - if (set == null) - return false ; - return set.size() > 1 ; - } - - protected void removeEntry(AOMEntry entry, Key key) - { - Set keys = (Set)entryToKeys.get( entry ) ; - if (keys != null) { - keys.remove( key ) ; - if (keys.isEmpty()) - entryToKeys.remove( entry ) ; - } - } - - public void clear() - { - super.clear() ; - entryToKeys.clear() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java 2018-01-30 20:18:33.000000000 -0500 +++ /dev/null 2018-01-30 20:18:33.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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.corba.se.impl.oa.poa; - -import com.sun.corba.se.spi.ior.ObjectKey; - -/** - * The bad server id handler is used to locate persistent objects. - * The Locator object registers the BadServerIdHandler with the ORB - * and when requests for persistent objects for servers (other than - * itself) comes, it throws a ForwardException with the IOR pointing - * to the active server. - */ -public interface BadServerIdHandler -{ - void handle(ObjectKey objectKey) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/DelegateImpl.java 2018-01-30 20:18:34.000000000 -0500 +++ /dev/null 2018-01-30 20:18:34.000000000 -0500 @@ -1,147 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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.corba.se.impl.oa.poa; - -import java.util.EmptyStackException; - -import org.omg.PortableServer.*; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.POASystemException ; - -public class DelegateImpl implements org.omg.PortableServer.portable.Delegate -{ - private ORB orb ; - private POASystemException wrapper ; - private POAFactory factory; - - public DelegateImpl(ORB orb, POAFactory factory){ - this.orb = orb ; - this.wrapper = POASystemException.get( orb, - CORBALogDomains.OA ) ; - this.factory = factory; - } - - public org.omg.CORBA.ORB orb(Servant self) - { - return orb; - } - - public org.omg.CORBA.Object this_object(Servant self) - { - byte[] oid; - POA poa; - try { - oid = orb.peekInvocationInfo().id(); - poa = (POA)orb.peekInvocationInfo().oa(); - String repId = self._all_interfaces(poa,oid)[0] ; - return poa.create_reference_with_id(oid, repId); - } catch (EmptyStackException notInInvocationE) { - //Not within an invocation context - POAImpl defaultPOA = null; - try { - defaultPOA = (POAImpl)self._default_POA(); - } catch (ClassCastException exception){ - throw wrapper.defaultPoaNotPoaimpl( exception ) ; - } - - try { - if (defaultPOA.getPolicies().isImplicitlyActivated() || - (defaultPOA.getPolicies().isUniqueIds() && - defaultPOA.getPolicies().retainServants())) { - return defaultPOA.servant_to_reference(self); - } else { - throw wrapper.wrongPoliciesForThisObject() ; - } - } catch ( org.omg.PortableServer.POAPackage.ServantNotActive e) { - throw wrapper.thisObjectServantNotActive( e ) ; - } catch ( org.omg.PortableServer.POAPackage.WrongPolicy e) { - throw wrapper.thisObjectWrongPolicy( e ) ; - } - } catch (ClassCastException e) { - throw wrapper.defaultPoaNotPoaimpl( e ) ; - } - } - - public POA poa(Servant self) - { - try { - return (POA)orb.peekInvocationInfo().oa(); - } catch (EmptyStackException exception){ - POA returnValue = factory.lookupPOA(self); - if (returnValue != null) { - return returnValue; - } - - throw wrapper.noContext( exception ) ; - } - } - - public byte[] object_id(Servant self) - { - try{ - return orb.peekInvocationInfo().id(); - } catch (EmptyStackException exception){ - throw wrapper.noContext(exception) ; - } - } - - public POA default_POA(Servant self) - { - return factory.getRootPOA(); - } - - public boolean is_a(Servant self, String repId) - { - String[] repositoryIds = self._all_interfaces(poa(self),object_id(self)); - for ( int i=0; icreate_POA - * Section 3.3.8.2 - */ - public POA create_POA(String name, POAManager - theManager, Policy[] policies) throws AdapterAlreadyExists, - InvalidPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling create_POA(name=" + name + - " theManager=" + theManager + " policies=" + policies + - ") on poa " + this ) ; - } - - // We cannot create children of a POA that is (being) destroyed. - // This has been added to the CORBA 3.0 spec. - if (state > STATE_RUN) - throw omgLifecycleWrapper().createPoaDestroy() ; - - POAImpl poa = (POAImpl)(children.get(name)) ; - - if (poa == null) { - poa = new POAImpl( name, this, getORB(), STATE_START ) ; - } - - try { - poa.lock() ; - - if (debug) { - ORBUtility.dprint( this, - "Calling create_POA: new poa is " + poa ) ; - } - - if ((poa.state != STATE_START) && (poa.state != STATE_INIT)) - throw new AdapterAlreadyExists(); - - POAManagerImpl newManager = (POAManagerImpl)theManager ; - if (newManager == null) - newManager = new POAManagerImpl( manager.getFactory(), - manager.getPIHandler() ); - - int defaultCopierId = - getORB().getCopierManager().getDefaultId() ; - Policies POAPolicies = - new Policies( policies, defaultCopierId ) ; - - poa.initialize( newManager, POAPolicies ) ; - - return poa; - } finally { - poa.unlock() ; - } - } finally { - unlock() ; - } - } - - /** - * find_POA - * Section 3.3.8.3 - */ - public POA find_POA(String name, boolean activate) - throws AdapterNonExistent - { - POAImpl found = null ; - AdapterActivator act = null ; - - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling find_POA(name=" + name + - " activate=" + activate + ") on poa " + this ) ; - } - - found = (POAImpl) children.get(name); - - if (found != null) { - if (debug) { - ORBUtility.dprint( this, - "Calling find_POA: found poa " + found ) ; - } - - try { - found.lock() ; - - // Do not hold the parent POA lock while - // waiting for child to complete initialization. - unlock() ; - - // Make sure that the child has completed its initialization, - // if it was created by an AdapterActivator, otherwise throw - // a standard TRANSIENT exception with minor code 4 (see - // CORBA 3.0 11.3.9.3, in reference to unknown_adapter) - if (!found.waitUntilRunning()) - throw omgLifecycleWrapper().poaDestroyed() ; - - // Note that found may be in state DESTROYING or DESTROYED at - // this point. That's OK, since destruction could start at - // any time. - } finally { - found.unlock() ; - } - } else { - try { - if (debug) { - ORBUtility.dprint( this, - "Calling find_POA: no poa found" ) ; - } - - if (activate && (activator != null)) { - // Create a child, but don't initialize it. The newly - // created POA will be in state STATE_START, which will - // cause other calls to find_POA that are creating the same - // POA to block on the waitUntilRunning call above. - // Initialization must be completed by a call to create_POA - // inside the unknown_adapter upcall. Note that - // this.poaMutex must be held here so that this.children - // can be safely updated. The state is set to STATE_INIT - // so that initialize can make the correct state transition - // when create_POA is called inside the AdapterActivator. - // This avoids activating the new POA too soon - // by transitioning to STATE_RUN after unknown_adapter - // returns. - found = new POAImpl( name, this, getORB(), STATE_INIT ) ; - - if (debug) { - ORBUtility.dprint( this, - "Calling find_POA: created poa " + found ) ; - } - - act = activator ; - } else { - throw new AdapterNonExistent(); - } - } finally { - unlock() ; - } - } - - // assert (found != null) - // assert not holding this.poaMutex OR found.poaMutex - - // We must not hold either this.poaMutex or found.poaMutex here while - // waiting for intialization of found to complete to prevent possible - // deadlocks. - - if (act != null) { - boolean status = false ; - boolean adapterResult = false ; - - if (debug) { - ORBUtility.dprint( this, - "Calling find_POA: calling AdapterActivator" ) ; - } - - try { - // Prevent more than one thread at a time from executing in act - // in case act is shared between multiple POAs. - synchronized (act) { - status = act.unknown_adapter(this, name); - } - } catch (SystemException exc) { - throw omgLifecycleWrapper().adapterActivatorException( exc, - name, poaId.toString() ) ; - } catch (Throwable thr) { - // ignore most non-system exceptions, but log them for - // diagnostic purposes. - lifecycleWrapper().unexpectedException( thr, this.toString() ) ; - - if (thr instanceof ThreadDeath) - throw (ThreadDeath)thr ; - } finally { - // At this point, we have completed adapter activation. - // Whether this was successful or not, we must call - // destroyIfNotInitDone so that calls to enter() and create_POA() - // that are waiting can execute again. Failing to do this - // will cause the system to hang in complex tests. - adapterResult = found.destroyIfNotInitDone() ; - } - - if (status) { - if (!adapterResult) - throw omgLifecycleWrapper().adapterActivatorException( name, - poaId.toString() ) ; - } else { - if (debug) { - ORBUtility.dprint( this, - "Calling find_POA: AdapterActivator returned false" ) ; - } - - // OMG Issue 3740 is resolved to throw AdapterNonExistent if - // unknown_adapter() returns false. - throw new AdapterNonExistent(); - } - } - - return found; - } - - /** - * destroy - * Section 3.3.8.4 - */ - public void destroy(boolean etherealize, boolean wait_for_completion) - { - // This is to avoid deadlock - if (wait_for_completion && getORB().isDuringDispatch()) { - throw lifecycleWrapper().destroyDeadlock() ; - } - - DestroyThread destroyer = new DestroyThread( etherealize, debug ); - destroyer.doIt( this, wait_for_completion ) ; - } - - /** - * create_thread_policy - * Section 3.3.8.5 - */ - public ThreadPolicy create_thread_policy( - ThreadPolicyValue value) - { - return new ThreadPolicyImpl(value); - } - - /** - * create_lifespan_policy - * Section 3.3.8.5 - */ - public LifespanPolicy create_lifespan_policy( - LifespanPolicyValue value) - { - return new LifespanPolicyImpl(value); - } - - /** - * create_id_uniqueness_policy - * Section 3.3.8.5 - */ - public IdUniquenessPolicy create_id_uniqueness_policy( - IdUniquenessPolicyValue value) - { - return new IdUniquenessPolicyImpl(value); - } - - /** - * create_id_assignment_policy - * Section 3.3.8.5 - */ - public IdAssignmentPolicy create_id_assignment_policy( - IdAssignmentPolicyValue value) - { - return new IdAssignmentPolicyImpl(value); - } - - /** - * create_implicit_activation_policy - * Section 3.3.8.5 - */ - public ImplicitActivationPolicy create_implicit_activation_policy( - ImplicitActivationPolicyValue value) - { - return new ImplicitActivationPolicyImpl(value); - } - - /** - * create_servant_retention_policy - * Section 3.3.8.5 - */ - public ServantRetentionPolicy create_servant_retention_policy( - ServantRetentionPolicyValue value) - { - return new ServantRetentionPolicyImpl(value); - } - - /** - * create_request_processing_policy - * Section 3.3.8.5 - */ - public RequestProcessingPolicy create_request_processing_policy( - RequestProcessingPolicyValue value) - { - return new RequestProcessingPolicyImpl(value); - } - - /** - * the_name - * Section 3.3.8.6 - */ - public String the_name() - { - try { - lock() ; - - return name; - } finally { - unlock() ; - } - } - - /** - * the_parent - * Section 3.3.8.7 - */ - public POA the_parent() - { - try { - lock() ; - - return parent; - } finally { - unlock() ; - } - } - - /** - * the_children - */ - public org.omg.PortableServer.POA[] the_children() - { - try { - lock() ; - - Collection coll = children.values() ; - int size = coll.size() ; - POA[] result = new POA[ size ] ; - int index = 0 ; - Iterator iter = coll.iterator() ; - while (iter.hasNext()) { - POA poa = (POA)(iter.next()) ; - result[ index++ ] = poa ; - } - - return result ; - } finally { - unlock() ; - } - } - - /** - * the_POAManager - * Section 3.3.8.8 - */ - public POAManager the_POAManager() - { - try { - lock() ; - - return manager; - } finally { - unlock() ; - } - } - - /** - * the_activator - * Section 3.3.8.9 - */ - public AdapterActivator the_activator() - { - try { - lock() ; - - return activator; - } finally { - unlock() ; - } - } - - /** - * the_activator - * Section 3.3.8.9 - */ - public void the_activator(AdapterActivator activator) - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling the_activator on poa " + - this + " activator=" + activator ) ; - } - - this.activator = activator; - } finally { - unlock() ; - } - } - - /** - * get_servant_manager - * Section 3.3.8.10 - */ - public ServantManager get_servant_manager() throws WrongPolicy - { - try { - lock() ; - - return mediator.getServantManager() ; - } finally { - unlock() ; - } - } - - /** - * set_servant_manager - * Section 3.3.8.10 - */ - public void set_servant_manager(ServantManager servantManager) - throws WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling set_servant_manager on poa " + - this + " servantManager=" + servantManager ) ; - } - - mediator.setServantManager( servantManager ) ; - } finally { - unlock() ; - } - } - - /** - * get_servant - * Section 3.3.8.12 - */ - public Servant get_servant() throws NoServant, WrongPolicy - { - try { - lock() ; - - return mediator.getDefaultServant() ; - } finally { - unlock() ; - } - } - - /** - * set_servant - * Section 3.3.8.13 - */ - public void set_servant(Servant defaultServant) - throws WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling set_servant on poa " + - this + " defaultServant=" + defaultServant ) ; - } - - mediator.setDefaultServant( defaultServant ) ; - } finally { - unlock() ; - } - } - - /** - * activate_object - * Section 3.3.8.14 - */ - public byte[] activate_object(Servant servant) - throws ServantAlreadyActive, WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, - "Calling activate_object on poa " + this + - " (servant=" + servant + ")" ) ; - } - - // Allocate a new system-generated object-id. - // This will throw WrongPolicy if not SYSTEM_ID - // policy. - byte[] id = mediator.newSystemId(); - - try { - mediator.activateObject( id, servant ) ; - } catch (ObjectAlreadyActive oaa) { - // This exception can not occur in this case, - // since id is always brand new. - // - } - - return id ; - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting activate_object on poa " + this ) ; - } - - unlock() ; - } - } - - /** - * activate_object_with_id - * Section 3.3.8.15 - */ - public void activate_object_with_id(byte[] id, - Servant servant) - throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, - "Calling activate_object_with_id on poa " + this + - " (servant=" + servant + " id=" + id + ")" ) ; - } - - // Clone the id to avoid possible errors due to aliasing - // (e.g. the client passes the id in and then changes it later). - byte[] idClone = (byte[])(id.clone()) ; - - mediator.activateObject( idClone, servant ) ; - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting activate_object_with_id on poa " + this ) ; - } - - unlock() ; - } - } - - /** - * deactivate_object - * 3.3.8.16 - */ - public void deactivate_object(byte[] id) - throws ObjectNotActive, WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, - "Calling deactivate_object on poa " + this + - " (id=" + id + ")" ) ; - } - - mediator.deactivateObject( id ) ; - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting deactivate_object on poa " + this ) ; - } - - unlock() ; - } - } - - /** - * create_reference - * 3.3.8.17 - */ - public org.omg.CORBA.Object create_reference(String repId) - throws WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling create_reference(repId=" + - repId + ") on poa " + this ) ; - } - - return makeObject( repId, mediator.newSystemId()) ; - } finally { - unlock() ; - } - } - - /** - * create_reference_with_id - * 3.3.8.18 - */ - public org.omg.CORBA.Object - create_reference_with_id(byte[] oid, String repId) - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, - "Calling create_reference_with_id(oid=" + - oid + " repId=" + repId + ") on poa " + this ) ; - } - - // Clone the id to avoid possible errors due to aliasing - // (e.g. the client passes the id in and then changes it later). - byte[] idClone = (byte[])(oid.clone()) ; - - return makeObject( repId, idClone ) ; - } finally { - unlock() ; - } - } - - /** - * servant_to_id - * 3.3.8.19 - */ - public byte[] servant_to_id(Servant servant) - throws ServantNotActive, WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling servant_to_id(servant=" + - servant + ") on poa " + this ) ; - } - - return mediator.servantToId( servant ) ; - } finally { - unlock() ; - } - } - - /** - * servant_to_reference - * 3.3.8.20 - */ - public org.omg.CORBA.Object servant_to_reference(Servant servant) - throws ServantNotActive, WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, - "Calling servant_to_reference(servant=" + - servant + ") on poa " + this ) ; - } - - byte[] oid = mediator.servantToId(servant); - String repId = servant._all_interfaces( this, oid )[0] ; - return create_reference_with_id(oid, repId); - } finally { - unlock() ; - } - } - - /** - * reference_to_servant - * 3.3.8.21 - */ - public Servant reference_to_servant(org.omg.CORBA.Object reference) - throws ObjectNotActive, WrongPolicy, WrongAdapter - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, - "Calling reference_to_servant(reference=" + - reference + ") on poa " + this ) ; - } - - if ( state >= STATE_DESTROYING ) { - throw lifecycleWrapper().adapterDestroyed() ; - } - - // reference_to_id should throw WrongAdapter - // if the objref was not created by this POA - byte [] id = internalReferenceToId(reference); - - return mediator.idToServant( id ) ; - } finally { - unlock() ; - } - } - - /** - * reference_to_id - * 3.3.8.22 - */ - public byte[] reference_to_id(org.omg.CORBA.Object reference) - throws WrongAdapter, WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling reference_to_id(reference=" + - reference + ") on poa " + this ) ; - } - - if( state >= STATE_DESTROYING ) { - throw lifecycleWrapper().adapterDestroyed() ; - } - - return internalReferenceToId( reference ) ; - } finally { - unlock() ; - } - } - - /** - * id_to_servant - * 3.3.8.23 - */ - public Servant id_to_servant(byte[] id) - throws ObjectNotActive, WrongPolicy - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling id_to_servant(id=" + - id + ") on poa " + this ) ; - } - - if( state >= STATE_DESTROYING ) { - throw lifecycleWrapper().adapterDestroyed() ; - } - return mediator.idToServant( id ) ; - } finally { - unlock() ; - } - } - - /** - * id_to_reference - * 3.3.8.24 - */ - public org.omg.CORBA.Object id_to_reference(byte[] id) - throws ObjectNotActive, WrongPolicy - - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling id_to_reference(id=" + - id + ") on poa " + this ) ; - } - - if( state >= STATE_DESTROYING ) { - throw lifecycleWrapper().adapterDestroyed() ; - } - - Servant s = mediator.idToServant( id ) ; - String repId = s._all_interfaces( this, id )[0] ; - return makeObject(repId, id ); - } finally { - unlock() ; - } - } - - /** - * id - * 11.3.8.26 in ptc/00-08-06 - */ - public byte[] id() - { - try { - lock() ; - - return getAdapterId() ; - } finally { - unlock() ; - } - } - - //*************************************************************** - //Implementation of ObjectAdapter interface - //*************************************************************** - - public Policy getEffectivePolicy( int type ) - { - return mediator.getPolicies().get_effective_policy( type ) ; - } - - public int getManagerId() - { - return manager.getManagerId() ; - } - - public short getState() - { - return manager.getORTState() ; - } - - public String[] getInterfaces( java.lang.Object servant, byte[] objectId ) - { - Servant serv = (Servant)servant ; - return serv._all_interfaces( this, objectId ) ; - } - - protected ObjectCopierFactory getObjectCopierFactory() - { - int copierId = mediator.getPolicies().getCopierId() ; - CopierManager cm = getORB().getCopierManager() ; - return cm.getObjectCopierFactory( copierId ) ; - } - - public void enter() throws OADestroyed - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling enter on poa " + this ) ; - } - - // Avoid deadlock if this is the thread that is processing the - // POA.destroy because this is the only thread that can notify - // waiters on beingDestroyedCV. This can happen if an - // etherealize upcall invokes a method on a colocated object - // served by this POA. - while ((state == STATE_DESTROYING) && - (isDestroying.get() == Boolean.FALSE)) { - try { - beingDestroyedCV.await(); - } catch (InterruptedException ex) { - // NO-OP - } - } - - if (!waitUntilRunning()) - throw new OADestroyed() ; - - invocationCount++; - } finally { - if (debug) { - ORBUtility.dprint( this, "Exiting enter on poa " + this ) ; - } - - unlock() ; - } - - manager.enter(); - } - - public void exit() - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, "Calling exit on poa " + this ) ; - } - - invocationCount--; - - if ((invocationCount == 0) && (state == STATE_DESTROYING)) { - invokeCV.broadcast(); - } - } finally { - if (debug) { - ORBUtility.dprint( this, "Exiting exit on poa " + this ) ; - } - - unlock() ; - } - - manager.exit(); - } - - public void getInvocationServant( OAInvocationInfo info ) - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, - "Calling getInvocationServant on poa " + this ) ; - } - - java.lang.Object servant = null ; - - try { - servant = mediator.getInvocationServant( info.id(), - info.getOperation() ); - } catch (ForwardRequest freq) { - throw new ForwardException( getORB(), freq.forward_reference ) ; - } - - info.setServant( servant ) ; - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting getInvocationServant on poa " + this ) ; - } - - unlock() ; - } - } - - public org.omg.CORBA.Object getLocalServant( byte[] objectId ) - { - return null ; - } - - /** Called from the subcontract to let this POA cleanup after an - * invocation. Note: If getServant was called, then returnServant - * MUST be called, even in the case of exceptions. This may be - * called multiple times for a single request. - */ - public void returnServant() - { - try { - lock() ; - - if (debug) { - ORBUtility.dprint( this, - "Calling returnServant on poa " + this ) ; - } - - mediator.returnServant(); - } catch (Throwable thr) { - if (debug) { - ORBUtility.dprint( this, - "Exception " + thr + " in returnServant on poa " + this ) ; - } - - if (thr instanceof Error) - throw (Error)thr ; - else if (thr instanceof RuntimeException) - throw (RuntimeException)thr ; - - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting returnServant on poa " + this ) ; - } - - unlock() ; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java 2018-01-30 20:18:39.000000000 -0500 +++ /dev/null 2018-01-30 20:18:39.000000000 -0500 @@ -1,547 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.corba.se.impl.oa.poa; - -import java.util.Iterator; -import java.util.Collections; -import java.util.Set; -import java.util.HashSet; - -import org.omg.CORBA.LocalObject; -import org.omg.CORBA.CompletionStatus ; - -import org.omg.PortableServer.POAManager; -import org.omg.PortableServer.POAManagerPackage.State; -import org.omg.PortableServer.POA; - -import org.omg.PortableInterceptor.DISCARDING ; -import org.omg.PortableInterceptor.ACTIVE ; -import org.omg.PortableInterceptor.HOLDING ; -import org.omg.PortableInterceptor.INACTIVE ; -import org.omg.PortableInterceptor.NON_EXISTENT ; - -import com.sun.corba.se.spi.protocol.PIHandler ; - -import com.sun.corba.se.impl.logging.POASystemException ; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -/** POAManagerImpl is the implementation of the POAManager interface. - * Its public methods are activate(), hold_requests(), discard_requests() - * and deactivate(). - */ - -public class POAManagerImpl extends org.omg.CORBA.LocalObject implements - POAManager -{ - private final POAFactory factory ; // factory which contains global state - // for all POAManagers - private PIHandler pihandler ; // for adapterManagerStateChanged - private State state; // current state of this POAManager - private Set poas = new HashSet(4) ; // all poas controlled by this POAManager - private int nInvocations=0; // Number of invocations in progress - private int nWaiters=0; // Number of threads waiting for - // invocations to complete - private int myId = 0 ; // This POAManager's ID - private boolean debug ; - private boolean explicitStateChange ; // initially false, set true as soon as - // one of activate, hold_request, - // discard_request, or deactivate is called. - - private String stateToString( State state ) - { - switch (state.value()) { - case State._HOLDING : return "State[HOLDING]" ; - case State._ACTIVE : return "State[ACTIVE]" ; - case State._DISCARDING : return "State[DISCARDING]" ; - case State._INACTIVE : return "State[INACTIVE]" ; - } - - return "State[UNKNOWN]" ; - } - - public String toString() - { - return "POAManagerImpl[myId=" + myId + - " state=" + stateToString(state) + - " nInvocations=" + nInvocations + - " nWaiters=" + nWaiters + "]" ; - } - - POAFactory getFactory() - { - return factory ; - } - - PIHandler getPIHandler() - { - return pihandler ; - } - - private void countedWait() - { - try { - if (debug) { - ORBUtility.dprint( this, "Calling countedWait on POAManager " + - this + " nWaiters=" + nWaiters ) ; - } - - nWaiters++ ; - wait(); - } catch ( java.lang.InterruptedException ex ) { - // NOP - } finally { - nWaiters-- ; - - if (debug) { - ORBUtility.dprint( this, "Exiting countedWait on POAManager " + - this + " nWaiters=" + nWaiters ) ; - } - } - } - - private void notifyWaiters() - { - if (debug) { - ORBUtility.dprint( this, "Calling notifyWaiters on POAManager " + - this + " nWaiters=" + nWaiters ) ; - } - - if (nWaiters >0) - notifyAll() ; - } - - public int getManagerId() - { - return myId ; - } - - POAManagerImpl( POAFactory factory, PIHandler pihandler ) - { - this.factory = factory ; - factory.addPoaManager(this); - this.pihandler = pihandler ; - myId = factory.newPOAManagerId() ; - state = State.HOLDING; - debug = factory.getORB().poaDebugFlag ; - explicitStateChange = false ; - - if (debug) { - ORBUtility.dprint( this, "Creating POAManagerImpl " + this ) ; - } - } - - synchronized void addPOA(POA poa) - { - // XXX This is probably not the correct error - if (state.value() == State._INACTIVE) { - POASystemException wrapper = factory.getWrapper(); - throw wrapper.addPoaInactive( CompletionStatus.COMPLETED_NO ) ; - } - - poas.add(poa); - } - - synchronized void removePOA(POA poa) - { - poas.remove(poa); - if ( poas.isEmpty() ) { - factory.removePoaManager(this); - } - } - - public short getORTState() - { - switch (state.value()) { - case State._HOLDING : return HOLDING.value ; - case State._ACTIVE : return ACTIVE.value ; - case State._INACTIVE : return INACTIVE.value ; - case State._DISCARDING : return DISCARDING.value ; - default : return NON_EXISTENT.value ; - } - } - -/**************************************************************************** - * The following four public methods are used to change the POAManager's state. - * - * A note on the design of synchronization code: - * There are 4 places where a thread would need to wait for a condition: - * - in hold_requests, discard_requests, deactivate, enter - * There are 5 places where a thread notifies a condition: - * - in activate, hold_requests, discard_requests, deactivate, exit - * - * Since each notify needs to awaken waiters in several of the 4 places, - * and since wait() in Java has the nice property of releasing the lock - * on its monitor before sleeping, it seemed simplest to have just one - * monitor object: "this". Thus all notifies will awaken all waiters. - * On waking up, each waiter verifies that the condition it was waiting - * for is satisfied, otherwise it goes back into a wait(). - * - ****************************************************************************/ - - /** - * activate - * Spec: pages 3-14 thru 3-18 - */ - public synchronized void activate() - throws org.omg.PortableServer.POAManagerPackage.AdapterInactive - { - explicitStateChange = true ; - - if (debug) { - ORBUtility.dprint( this, - "Calling activate on POAManager " + this ) ; - } - - try { - if ( state.value() == State._INACTIVE ) - throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive(); - - // set the state to ACTIVE - state = State.ACTIVE; - - pihandler.adapterManagerStateChanged( myId, getORTState() ) ; - - // Notify any invocations that were waiting because the previous - // state was HOLDING, as well as notify any threads that were waiting - // inside hold_requests() or discard_requests(). - notifyWaiters(); - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting activate on POAManager " + this ) ; - } - } - } - - /** - * hold_requests - * Spec: pages 3-14 thru 3-18 - */ - public synchronized void hold_requests(boolean wait_for_completion) - throws org.omg.PortableServer.POAManagerPackage.AdapterInactive - { - explicitStateChange = true ; - - if (debug) { - ORBUtility.dprint( this, - "Calling hold_requests on POAManager " + this ) ; - } - - try { - if ( state.value() == State._INACTIVE ) - throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive(); - // set the state to HOLDING - state = State.HOLDING; - - pihandler.adapterManagerStateChanged( myId, getORTState() ) ; - - // Notify any threads that were waiting in the wait() inside - // discard_requests. This will cause discard_requests to return - // (which is in conformance with the spec). - notifyWaiters(); - - if ( wait_for_completion ) { - while ( state.value() == State._HOLDING && nInvocations > 0 ) { - countedWait() ; - } - } - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting hold_requests on POAManager " + this ) ; - } - } - } - - /** - * discard_requests - * Spec: pages 3-14 thru 3-18 - */ - public synchronized void discard_requests(boolean wait_for_completion) - throws org.omg.PortableServer.POAManagerPackage.AdapterInactive - { - explicitStateChange = true ; - - if (debug) { - ORBUtility.dprint( this, - "Calling hold_requests on POAManager " + this ) ; - } - - try { - if ( state.value() == State._INACTIVE ) - throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive(); - - // set the state to DISCARDING - state = State.DISCARDING; - - pihandler.adapterManagerStateChanged( myId, getORTState() ) ; - - // Notify any invocations that were waiting because the previous - // state was HOLDING. Those invocations will henceforth be rejected with - // a TRANSIENT exception. Also notify any threads that were waiting - // inside hold_requests(). - notifyWaiters(); - - if ( wait_for_completion ) { - while ( state.value() == State._DISCARDING && nInvocations > 0 ) { - countedWait() ; - } - } - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting hold_requests on POAManager " + this ) ; - } - } - } - - /** - * deactivate - * Spec: pages 3-14 thru 3-18 - * Note: INACTIVE is a permanent state. - */ - - public void deactivate(boolean etherealize_objects, boolean wait_for_completion) - throws org.omg.PortableServer.POAManagerPackage.AdapterInactive - { - explicitStateChange = true ; - - try { - synchronized( this ) { - if (debug) { - ORBUtility.dprint( this, - "Calling deactivate on POAManager " + this ) ; - } - - if ( state.value() == State._INACTIVE ) - throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive(); - - state = State.INACTIVE; - - pihandler.adapterManagerStateChanged( myId, getORTState() ) ; - - // Notify any invocations that were waiting because the previous - // state was HOLDING. Those invocations will then be rejected with - // an OBJ_ADAPTER exception. Also notify any threads that were waiting - // inside hold_requests() or discard_requests(). - notifyWaiters(); - } - - POAManagerDeactivator deactivator = new POAManagerDeactivator( this, - etherealize_objects, debug ) ; - - if (wait_for_completion) - deactivator.run() ; - else { - Thread thr = new Thread(null, deactivator, "POA-Deactivator-Thread", 0, false) ; - thr.start() ; - } - } finally { - synchronized(this) { - if (debug) { - ORBUtility.dprint( this, - "Exiting deactivate on POAManager " + this ) ; - } - } - } - } - - private class POAManagerDeactivator implements Runnable - { - private boolean etherealize_objects ; - private POAManagerImpl pmi ; - private boolean debug ; - - POAManagerDeactivator( POAManagerImpl pmi, boolean etherealize_objects, - boolean debug ) - { - this.etherealize_objects = etherealize_objects ; - this.pmi = pmi ; - this.debug = debug ; - } - - public void run() - { - try { - synchronized (pmi) { - if (debug) { - ORBUtility.dprint( this, - "Calling run with etherealize_objects=" + - etherealize_objects + " pmi=" + pmi ) ; - } - - while ( pmi.nInvocations > 0 ) { - countedWait() ; - } - } - - if (etherealize_objects) { - Iterator iterator = null ; - - // Make sure that poas cannot change while we copy it! - synchronized (pmi) { - if (debug) { - ORBUtility.dprint( this, - "run: Preparing to etherealize with pmi=" + - pmi ) ; - } - - iterator = (new HashSet(pmi.poas)).iterator(); - } - - while (iterator.hasNext()) { - // Each RETAIN+USE_SERVANT_MGR poa - // must call etherealize for all its objects - ((POAImpl)iterator.next()).etherealizeAll(); - } - - synchronized (pmi) { - if (debug) { - ORBUtility.dprint( this, - "run: removing POAManager and clearing poas " + - "with pmi=" + pmi ) ; - } - - factory.removePoaManager(pmi); - poas.clear(); - } - } - } finally { - if (debug) { - synchronized (pmi) { - ORBUtility.dprint( this, "Exiting run" ) ; - } - } - } - } - } - - /** - * Added according to the spec CORBA V2.3; this returns the - * state of the POAManager - */ - - public org.omg.PortableServer.POAManagerPackage.State get_state () { - return state; - } - -/**************************************************************************** - * The following methods are used on the invocation path. - ****************************************************************************/ - - // called from POA.find_POA before calling - // AdapterActivator.unknown_adapter. - synchronized void checkIfActive() - { - try { - if (debug) { - ORBUtility.dprint( this, - "Calling checkIfActive for POAManagerImpl " + this ) ; - } - - checkState(); - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting checkIfActive for POAManagerImpl " + this ) ; - } - } - } - - private void checkState() - { - while ( state.value() != State._ACTIVE ) { - switch ( state.value() ) { - case State._HOLDING: - while ( state.value() == State._HOLDING ) { - countedWait() ; - } - break; - - case State._DISCARDING: - throw factory.getWrapper().poaDiscarding() ; - - case State._INACTIVE: - throw factory.getWrapper().poaInactive() ; - } - } - } - - synchronized void enter() - { - try { - if (debug) { - ORBUtility.dprint( this, - "Calling enter for POAManagerImpl " + this ) ; - } - - checkState(); - nInvocations++; - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting enter for POAManagerImpl " + this ) ; - } - } - } - - synchronized void exit() - { - try { - if (debug) { - ORBUtility.dprint( this, - "Calling exit for POAManagerImpl " + this ) ; - } - - nInvocations--; - - if ( nInvocations == 0 ) { - // This notifies any threads that were in the - // wait_for_completion loop in hold/discard/deactivate(). - notifyWaiters(); - } - } finally { - if (debug) { - ORBUtility.dprint( this, - "Exiting exit for POAManagerImpl " + this ) ; - } - } - } - - /** Activate the POAManager if no explicit state change has ever been - * previously invoked. - */ - public synchronized void implicitActivation() - { - if (!explicitStateChange) - try { - activate() ; - } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ai) { - // ignore the exception. - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java 2018-01-30 20:18:40.000000000 -0500 +++ /dev/null 2018-01-30 20:18:40.000000000 -0500 @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.impl.oa.poa ; - -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; - -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.NoServant ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; - -/** POAPolicyMediator defines an interface to which the POA delegates all - * policy specific operations. This permits code paths for different - * policies to be optimized by creating the correct code at POA creation - * time. Also note that as much as possible, this interface does not - * do any concurrency control, except as noted. The POA is responsible - * for concurrency control. - */ -public interface POAPolicyMediator { - /** Return the policies object that was used to create this - * POAPolicyMediator. - */ - Policies getPolicies() ; - - /** Return the subcontract ID to use in the IIOP profile in IORs - * created by this POAPolicyMediator's POA. This is initialized - * according to the policies and the POA used to construct this - * POAPolicyMediator in the POAPolicyMediatorFactory. - */ - int getScid() ; - - /** Return the server ID to use in the IIOP profile in IORs - * created by this POAPolicyMediator's POA. This is initialized - * according to the policies and the POA used to construct this - * POAPolicyMediator in the POAPolicyMediatorFactory. - */ - int getServerId() ; - - /** Get the servant to use for an invocation with the - * given id and operation. - * @param id the object ID for which we are requesting a servant - * @param operation the name of the operation to be performed on - * the servant - * @return the resulting Servant. - */ - java.lang.Object getInvocationServant( byte[] id, - String operation ) throws ForwardRequest ; - - /** Release a servant that was obtained from getInvocationServant. - */ - void returnServant() ; - - /** Etherealize all servants associated with this POAPolicyMediator. - * Does nothing if the retention policy is non-retain. - */ - void etherealizeAll() ; - - /** Delete everything in the active object map. - */ - void clearAOM() ; - - /** Return the servant manager. Will throw WrongPolicy - * if the request processing policy is not USE_SERVANT_MANAGER. - */ - ServantManager getServantManager() throws WrongPolicy ; - - /** Set the servant manager. Will throw WrongPolicy - * if the request processing policy is not USE_SERVANT_MANAGER. - */ - void setServantManager( ServantManager servantManager ) throws WrongPolicy ; - - /** Return the default servant. Will throw WrongPolicy - * if the request processing policy is not USE_DEFAULT_SERVANT. - */ - Servant getDefaultServant() throws NoServant, WrongPolicy ; - - /** Set the default servant. Will throw WrongPolicy - * if the request processing policy is not USE_DEFAULT_SERVANT. - */ - void setDefaultServant( Servant servant ) throws WrongPolicy ; - - void activateObject( byte[] id, Servant servant ) - throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy ; - - /** Deactivate the object that is associated with the given id. - * Returns the servant for id. - */ - Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy ; - - /** Allocate a new, unique system ID. Requires the ID assignment policy - * to be SYSTEM. - */ - byte[] newSystemId() throws WrongPolicy ; - - byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy ; - - Servant idToServant( byte[] id ) throws ObjectNotActive, WrongPolicy ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java 2018-01-30 20:18:40.000000000 -0500 +++ /dev/null 2018-01-30 20:18:40.000000000 -0500 @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.oa.poa ; - -import java.util.Collection; -import java.util.Enumeration ; - -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; - -import com.sun.corba.se.spi.extension.ServantCachingPolicy ; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor; - -import com.sun.corba.se.impl.orbutil.ORBConstants ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; -import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ; - - -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA. - */ -public abstract class POAPolicyMediatorBase implements POAPolicyMediator { - protected POAImpl poa ; - protected ORB orb ; - - private int sysIdCounter ; - private Policies policies ; - private DelegateImpl delegateImpl ; - - private int serverid ; - private int scid ; - - protected boolean isImplicit ; - protected boolean isUnique ; - protected boolean isSystemId ; - - public final Policies getPolicies() - { - return policies ; - } - - public final int getScid() - { - return scid ; - } - - public final int getServerId() - { - return serverid ; - } - - POAPolicyMediatorBase( Policies policies, POAImpl poa ) - { - if (policies.isSingleThreaded()) - throw poa.invocationWrapper().singleThreadNotSupported() ; - - POAManagerImpl poam = (POAManagerImpl)(poa.the_POAManager()) ; - POAFactory poaf = poam.getFactory() ; - delegateImpl = (DelegateImpl)(poaf.getDelegateImpl()) ; - this.policies = policies ; - this.poa = poa ; - orb = (ORB)poa.getORB() ; - - switch (policies.servantCachingLevel()) { - case ServantCachingPolicy.NO_SERVANT_CACHING : - scid = ORBConstants.TRANSIENT_SCID ; - break ; - case ServantCachingPolicy.FULL_SEMANTICS : - scid = ORBConstants.SC_TRANSIENT_SCID ; - break ; - case ServantCachingPolicy.INFO_ONLY_SEMANTICS : - scid = ORBConstants.IISC_TRANSIENT_SCID ; - break ; - case ServantCachingPolicy.MINIMAL_SEMANTICS : - scid = ORBConstants.MINSC_TRANSIENT_SCID ; - break ; - } - - if ( policies.isTransient() ) { - serverid = orb.getTransientServerId(); - } else { - serverid = orb.getORBData().getPersistentServerId(); - scid = ORBConstants.makePersistent( scid ) ; - } - - isImplicit = policies.isImplicitlyActivated() ; - isUnique = policies.isUniqueIds() ; - isSystemId = policies.isSystemAssignedIds() ; - - sysIdCounter = 0 ; - } - - public final java.lang.Object getInvocationServant( byte[] id, - String operation ) throws ForwardRequest - { - java.lang.Object result = internalGetServant( id, operation ) ; - - return result ; - } - - // Create a delegate and stick it in the servant. - // This delegate is needed during dispatch for the ObjectImpl._orb() - // method to work. - protected final void setDelegate(Servant servant, byte[] id) - { - //This new servant delegate no longer needs the id for - // its initialization. - servant._set_delegate(delegateImpl); - } - - public synchronized byte[] newSystemId() throws WrongPolicy - { - if (!isSystemId) - throw new WrongPolicy() ; - - byte[] array = new byte[8]; - ORBUtility.intToBytes(++sysIdCounter, array, 0); - ORBUtility.intToBytes( poa.getPOAId(), array, 4); - return array; - } - - protected abstract java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java 2018-01-30 20:18:41.000000000 -0500 +++ /dev/null 2018-01-30 20:18:41.000000000 -0500 @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.oa.poa ; - -import org.omg.PortableServer.Servant ; - -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; - -import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -import com.sun.corba.se.impl.javax.rmi.CORBA.Util ; - -import com.sun.corba.se.impl.oa.NullServantImpl ; - -public abstract class POAPolicyMediatorBase_R extends POAPolicyMediatorBase { - protected ActiveObjectMap activeObjectMap ; - - POAPolicyMediatorBase_R( Policies policies, POAImpl poa ) - { - super( policies, poa ) ; - - // assert policies.retainServants() && policies.useActiveObjectMapOnly() - if (!policies.retainServants()) - throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; - - activeObjectMap = ActiveObjectMap.create(poa, !isUnique); - } - - public void returnServant() - { - // NO-OP - } - - public void clearAOM() - { - activeObjectMap.clear() ; - activeObjectMap = null ; - } - - protected Servant internalKeyToServant( ActiveObjectMap.Key key ) - { - AOMEntry entry = activeObjectMap.get(key); - if (entry == null) - return null ; - - return activeObjectMap.getServant( entry ) ; - } - - protected Servant internalIdToServant( byte[] id ) - { - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - return internalKeyToServant( key ) ; - } - - protected void activateServant( ActiveObjectMap.Key key, AOMEntry entry, Servant servant ) - { - setDelegate(servant, key.id ); - - if (orb.shutdownDebugFlag) { - System.out.println("Activating object " + servant + - " with POA " + poa); - } - - activeObjectMap.putServant( servant, entry ) ; - - if (Util.isInstanceDefined()) { - POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ; - POAFactory factory = pm.getFactory() ; - factory.registerPOAForServant(poa, servant); - } - } - - public final void activateObject(byte[] id, Servant servant) - throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive - { - if (isUnique && activeObjectMap.contains(servant)) - throw new ServantAlreadyActive(); - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - - AOMEntry entry = activeObjectMap.get( key ) ; - - // Check for an ObjectAlreadyActive error - entry.activateObject() ; - activateServant( key, entry, servant ) ; - } - - public Servant deactivateObject( byte[] id ) - throws ObjectNotActive, WrongPolicy - { - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - return deactivateObject( key ) ; - } - - protected void deactivateHelper( ActiveObjectMap.Key key, AOMEntry entry, - Servant s ) throws ObjectNotActive, WrongPolicy - { - // Default does nothing, but the USE_SERVANT_MANAGER case - // must handle etherealization - - activeObjectMap.remove(key); - - if (Util.isInstanceDefined()) { - POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ; - POAFactory factory = pm.getFactory() ; - factory.unregisterPOAForServant(poa, s); - } - } - - public Servant deactivateObject( ActiveObjectMap.Key key ) - throws ObjectNotActive, WrongPolicy - { - if (orb.poaDebugFlag) { - ORBUtility.dprint( this, - "Calling deactivateObject for key " + key ) ; - } - - try { - AOMEntry entry = activeObjectMap.get(key); - if (entry == null) - throw new ObjectNotActive(); - - Servant s = activeObjectMap.getServant( entry ) ; - if (s == null) - throw new ObjectNotActive(); - - if (orb.poaDebugFlag) { - System.out.println("Deactivating object " + s + " with POA " + poa); - } - - deactivateHelper( key, entry, s ) ; - - return s ; - } finally { - if (orb.poaDebugFlag) { - ORBUtility.dprint( this, - "Exiting deactivateObject" ) ; - } - } - } - - public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy - { - // XXX needs to handle call from an invocation on this POA - - if (!isUnique && !isImplicit) - throw new WrongPolicy(); - - if (isUnique) { - ActiveObjectMap.Key key = activeObjectMap.getKey(servant); - if (key != null) - return key.id ; - } - - // assert !isUnique || (servant not in activateObjectMap) - - if (isImplicit) - try { - byte[] id = newSystemId() ; - activateObject( id, servant ) ; - return id ; - } catch (ObjectAlreadyActive oaa) { - // This can't occur here, since id is always brand new. - throw poa.invocationWrapper().servantToIdOaa( oaa ) ; - } catch (ServantAlreadyActive s) { - throw poa.invocationWrapper().servantToIdSaa( s ) ; - } catch (WrongPolicy w) { - throw poa.invocationWrapper().servantToIdWp( w ) ; - } - - throw new ServantNotActive(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java 2018-01-30 20:18:42.000000000 -0500 +++ /dev/null 2018-01-30 20:18:42.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.impl.oa.poa ; - -abstract class POAPolicyMediatorFactory { - // create an appropriate policy mediator based on the policies. - // Note that the policies object has already been validated before - // this call, so it can only contain valid combinations of POA policies. - static POAPolicyMediator create( Policies policies, POAImpl poa ) - { - if (policies.retainServants()) { - if (policies.useActiveMapOnly()) - return new POAPolicyMediatorImpl_R_AOM( policies, poa ) ; - else if (policies.useDefaultServant()) - return new POAPolicyMediatorImpl_R_UDS( policies, poa ) ; - else if (policies.useServantManager()) - return new POAPolicyMediatorImpl_R_USM( policies, poa ) ; - else - throw poa.invocationWrapper().pmfCreateRetain() ; - } else { - if (policies.useDefaultServant()) - return new POAPolicyMediatorImpl_NR_UDS( policies, poa ) ; - else if (policies.useServantManager()) - return new POAPolicyMediatorImpl_NR_USM( policies, poa ) ; - else - throw poa.invocationWrapper().pmfCreateNonRetain() ; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java 2018-01-30 20:18:42.000000000 -0500 +++ /dev/null 2018-01-30 20:18:42.000000000 -0500 @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.oa.poa ; - -import java.util.Enumeration ; - -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.NoServant ; - -import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -/** Implementation of POAPolicyMediator that provides policy specific - * operations on the POA. - */ -public class POAPolicyMediatorImpl_NR_UDS extends POAPolicyMediatorBase { - private Servant defaultServant ; - - POAPolicyMediatorImpl_NR_UDS( Policies policies, POAImpl poa ) - { - super( policies, poa ) ; - - // assert !policies.retainServants() && policies.useDefaultServant() - if (policies.retainServants()) - throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; - - if (!policies.useDefaultServant()) - throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; - - defaultServant = null ; - } - - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest - { - if (defaultServant == null) - throw poa.invocationWrapper().poaNoDefaultServant() ; - - return defaultServant; - } - - public void returnServant() - { - // NO-OP - } - - public void etherealizeAll() - { - // NO-OP - } - - public void clearAOM() - { - // NO-OP - } - - public ServantManager getServantManager() throws WrongPolicy - { - throw new WrongPolicy(); - } - - public void setServantManager( ServantManager servantManager ) throws WrongPolicy - { - throw new WrongPolicy(); - } - - public Servant getDefaultServant() throws NoServant, WrongPolicy - { - if (defaultServant == null) - throw new NoServant(); - return defaultServant; - } - - public void setDefaultServant( Servant servant ) throws WrongPolicy - { - this.defaultServant = servant; - setDelegate(defaultServant, "DefaultServant".getBytes()); - } - - public final void activateObject(byte[] id, Servant servant) - throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive - { - throw new WrongPolicy(); - } - - public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy - { - throw new WrongPolicy(); - } - - public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy - { - throw new WrongPolicy(); - } - - public Servant idToServant( byte[] id ) - throws WrongPolicy, ObjectNotActive - { - if (defaultServant != null) - return defaultServant; - - throw new ObjectNotActive() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java 2018-01-30 20:18:43.000000000 -0500 +++ /dev/null 2018-01-30 20:18:43.000000000 -0500 @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.oa.poa ; - -import java.util.Enumeration ; - -import org.omg.PortableServer.POA ; -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ServantLocator ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.NoServant ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ; - -import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -import com.sun.corba.se.spi.oa.OAInvocationInfo ; -import com.sun.corba.se.impl.oa.NullServantImpl ; - -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA. - */ -public class POAPolicyMediatorImpl_NR_USM extends POAPolicyMediatorBase { - private ServantLocator locator ; - - POAPolicyMediatorImpl_NR_USM( Policies policies, POAImpl poa ) - { - super( policies, poa ) ; - - // assert !policies.retainServants() && policies.useServantManager() - if (policies.retainServants()) - throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; - - if (!policies.useServantManager()) - throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; - - locator = null ; - } - - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest - { - if (locator == null) - throw poa.invocationWrapper().poaNoServantManager() ; - - CookieHolder cookieHolder = orb.peekInvocationInfo().getCookieHolder() ; - - // Try - finally is J2EE requirement. - java.lang.Object servant; - try{ - poa.unlock() ; - - servant = locator.preinvoke(id, poa, operation, cookieHolder); - if (servant == null) - servant = new NullServantImpl( poa.omgInvocationWrapper().nullServantReturned() ) ; - else - setDelegate( (Servant)servant, id); - } finally { - poa.lock() ; - } - - return servant; - } - - public void returnServant() - { - OAInvocationInfo info = orb.peekInvocationInfo(); - if (locator == null) - return; - - try { - poa.unlock() ; - locator.postinvoke(info.id(), (POA)(info.oa()), - info.getOperation(), info.getCookieHolder().value, - (Servant)(info.getServantContainer()) ); - } finally { - poa.lock() ; - } - } - - public void etherealizeAll() - { - // NO-OP - } - - public void clearAOM() - { - // NO-OP - } - - public ServantManager getServantManager() throws WrongPolicy - { - return locator ; - } - - public void setServantManager( ServantManager servantManager ) throws WrongPolicy - { - if (locator != null) - throw poa.invocationWrapper().servantManagerAlreadySet() ; - - if (servantManager instanceof ServantLocator) - locator = (ServantLocator)servantManager; - else - throw poa.invocationWrapper().servantManagerBadType() ; - } - - public Servant getDefaultServant() throws NoServant, WrongPolicy - { - throw new WrongPolicy(); - } - - public void setDefaultServant( Servant servant ) throws WrongPolicy - { - throw new WrongPolicy(); - } - - public final void activateObject(byte[] id, Servant servant) - throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive - { - throw new WrongPolicy(); - } - - public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy - { - throw new WrongPolicy(); - } - - public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy - { - throw new WrongPolicy(); - } - - public Servant idToServant( byte[] id ) - throws WrongPolicy, ObjectNotActive - { - throw new WrongPolicy(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java 2018-01-30 20:18:44.000000000 -0500 +++ /dev/null 2018-01-30 20:18:44.000000000 -0500 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.oa.poa ; - -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.NoServant ; - -import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -import com.sun.corba.se.impl.oa.NullServantImpl ; - -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA in the case: - *

- */ -public class POAPolicyMediatorImpl_R_AOM extends POAPolicyMediatorBase_R { - POAPolicyMediatorImpl_R_AOM( Policies policies, POAImpl poa ) - { - // assert policies.retainServants() - super( policies, poa ) ; - - // policies.useActiveObjectMapOnly() - if (!policies.useActiveMapOnly()) - throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; - } - - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest - { - java.lang.Object servant = internalIdToServant( id ) ; - if (servant == null) - servant = new NullServantImpl( - poa.invocationWrapper().nullServant() ) ; - return servant ; - } - - public void etherealizeAll() - { - // NO-OP - } - - public ServantManager getServantManager() throws WrongPolicy - { - throw new WrongPolicy(); - } - - public void setServantManager( ServantManager servantManager ) - throws WrongPolicy - { - throw new WrongPolicy(); - } - - public Servant getDefaultServant() throws NoServant, WrongPolicy - { - throw new WrongPolicy(); - } - - public void setDefaultServant( Servant servant ) throws WrongPolicy - { - throw new WrongPolicy(); - } - - public Servant idToServant( byte[] id ) - throws WrongPolicy, ObjectNotActive - { - Servant s = internalIdToServant( id ) ; - - if (s == null) - throw new ObjectNotActive() ; - else - return s; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java 2018-01-30 20:18:44.000000000 -0500 +++ /dev/null 2018-01-30 20:18:44.000000000 -0500 @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.oa.poa ; - -import java.util.Enumeration ; - -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.NoServant ; - -import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA. - */ -public class POAPolicyMediatorImpl_R_UDS extends POAPolicyMediatorBase_R { - private Servant defaultServant ; - - POAPolicyMediatorImpl_R_UDS( Policies policies, POAImpl poa ) - { - // assert policies.retainServants() - super( policies, poa ) ; - defaultServant = null ; - - // policies.useDefaultServant() - if (!policies.useDefaultServant()) - throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; - } - - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest - { - Servant servant = internalIdToServant( id ) ; - if (servant == null) - servant = defaultServant ; - - if (servant == null) - throw poa.invocationWrapper().poaNoDefaultServant() ; - - return servant ; - } - - public void etherealizeAll() - { - // NO-OP - } - - public ServantManager getServantManager() throws WrongPolicy - { - throw new WrongPolicy(); - } - - public void setServantManager( ServantManager servantManager ) throws WrongPolicy - { - throw new WrongPolicy(); - } - - public Servant getDefaultServant() throws NoServant, WrongPolicy - { - if (defaultServant == null) - throw new NoServant(); - else - return defaultServant; - } - - public void setDefaultServant( Servant servant ) throws WrongPolicy - { - defaultServant = servant; - setDelegate(defaultServant, "DefaultServant".getBytes()); - } - - public Servant idToServant( byte[] id ) - throws WrongPolicy, ObjectNotActive - { - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - Servant s = internalKeyToServant(key); - - if (s == null) - if (defaultServant != null) - s = defaultServant; - - if (s == null) - throw new ObjectNotActive() ; - - return s; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java 2018-01-30 20:18:45.000000000 -0500 +++ /dev/null 2018-01-30 20:18:45.000000000 -0500 @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2002, 2015, 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.corba.se.impl.oa.poa ; - -import java.util.Set ; -import org.omg.CORBA.SystemException ; - -import org.omg.PortableServer.ServantActivator ; -import org.omg.PortableServer.Servant ; -import org.omg.PortableServer.ServantManager ; -import org.omg.PortableServer.ForwardRequest ; -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ObjectNotActive ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ; -import org.omg.PortableServer.POAPackage.ServantAlreadyActive ; -import org.omg.PortableServer.POAPackage.NoServant ; - -import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -import com.sun.corba.se.impl.oa.NullServantImpl ; - -import com.sun.corba.se.impl.javax.rmi.CORBA.Util ; - -import com.sun.corba.se.spi.oa.OAInvocationInfo ; -import com.sun.corba.se.spi.oa.NullServant ; - -/** Implementation of POARequesHandler that provides policy specific - * operations on the POA. - */ -public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R { - protected ServantActivator activator ; - - POAPolicyMediatorImpl_R_USM( Policies policies, POAImpl poa ) - { - // assert policies.retainServants() - super( policies, poa ) ; - activator = null ; - - if (!policies.useServantManager()) - throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ; - } - - /* This handles a rather subtle bug (4939892). The problem is that - * enter will wait on the entry if it is being etherealized. When the - * deferred state transition completes, the entry is no longer in the - * AOM, and so we need to get a new entry, otherwise activator.incarnate - * will be called twice, once for the old entry, and again when a new - * entry is created. This fix also required extending the FSM StateEngine - * to allow actions to throw exceptions, and adding a new state in the - * AOMEntry FSM to detect this condition. - */ - private AOMEntry enterEntry( ActiveObjectMap.Key key ) - { - AOMEntry result = null ; - boolean failed ; - do { - failed = false ; - result = activeObjectMap.get(key) ; - - try { - result.enter() ; - } catch (Exception exc) { - failed = true ; - } - } while (failed) ; - - return result ; - } - - protected java.lang.Object internalGetServant( byte[] id, - String operation ) throws ForwardRequest - { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "Calling POAPolicyMediatorImpl_R_USM.internalGetServant " + - "for poa " + poa + " operation=" + operation ) ; - } - - try { - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - AOMEntry entry = enterEntry(key) ; - java.lang.Object servant = activeObjectMap.getServant( entry ) ; - if (servant != null) { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "internalGetServant: servant already activated" ) ; - } - - return servant ; - } - - if (activator == null) { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "internalGetServant: no servant activator in POA" ) ; - } - - entry.incarnateFailure() ; - throw poa.invocationWrapper().poaNoServantManager() ; - } - - // Drop the POA lock during the incarnate call and - // re-acquire it afterwards. The entry state machine - // prevents more than one thread from executing the - // incarnate method at a time within the same POA. - try { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "internalGetServant: upcall to incarnate" ) ; - } - - poa.unlock() ; - - servant = activator.incarnate(id, poa); - - if (servant == null) - servant = new NullServantImpl( - poa.omgInvocationWrapper().nullServantReturned() ) ; - } catch (ForwardRequest freq) { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "internalGetServant: incarnate threw ForwardRequest" ) ; - } - - throw freq ; - } catch (SystemException exc) { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "internalGetServant: incarnate threw SystemException " + exc ) ; - } - - throw exc ; - } catch (Throwable exc) { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "internalGetServant: incarnate threw Throwable " + exc ) ; - } - - throw poa.invocationWrapper().poaServantActivatorLookupFailed( - exc ) ; - } finally { - poa.lock() ; - - // servant == null means incarnate threw an exception, - // while servant instanceof NullServant means incarnate returned a - // null servant. Either case is an incarnate failure to the - // entry state machine. - if ((servant == null) || (servant instanceof NullServant)) { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "internalGetServant: incarnate failed" ) ; - } - - // XXX Does the AOM leak in this case? Yes, - // but the problem is hard to fix. There may be - // a number of threads waiting for the state to change - // from INCARN to something else, which is VALID or - // INVALID, depending on the incarnate result. - // The activeObjectMap.get() call above creates an - // ActiveObjectMap.Entry if one does not already exist, - // and stores it in the keyToEntry map in the AOM. - entry.incarnateFailure() ; - } else { - // here check for unique_id policy, and if the servant - // is already registered for a different ID, then throw - // OBJ_ADAPTER exception, else activate it. Section 11.3.5.1 - // 99-10-07.pdf - if (isUnique) { - // check if the servant already is associated with some id - if (activeObjectMap.contains((Servant)servant)) { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "internalGetServant: servant already assigned to ID" ) ; - } - - entry.incarnateFailure() ; - throw poa.invocationWrapper().poaServantNotUnique() ; - } - } - - if (poa.getDebug()) { - ORBUtility.dprint( this, - "internalGetServant: incarnate complete" ) ; - } - - entry.incarnateComplete() ; - activateServant(key, entry, (Servant)servant); - } - } - - return servant ; - } finally { - if (poa.getDebug()) { - ORBUtility.dprint( this, - "Exiting POAPolicyMediatorImpl_R_USM.internalGetServant " + - "for poa " + poa ) ; - } - } - } - - public void returnServant() - { - OAInvocationInfo info = orb.peekInvocationInfo(); - byte[] id = info.id() ; - ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ; - AOMEntry entry = activeObjectMap.get( key ) ; - entry.exit() ; - } - - public void etherealizeAll() - { - if (activator != null) { - Set keySet = activeObjectMap.keySet() ; - - // Copy the elements in the set to an array to avoid - // changes in the set due to concurrent modification - ActiveObjectMap.Key[] keys = - (ActiveObjectMap.Key[])keySet.toArray( - new ActiveObjectMap.Key[ keySet.size() ] ) ; - - for (int ctr=0; ctr= 0) { - setPolicyValue( key.intValue(), POAPolicyValue ) ; - - // if the value of this POA policy was previously set to a - // different value than the current value given in - // POAPolicyValue, record an error. - if ((prev != null) && - (getPOAPolicyValue( prev ) != POAPolicyValue)) - errorSet.set( i ) ; - } - } - - // Check for bad policy combinations - - // NON_RETAIN requires USE_DEFAULT_SERVANT or USE_SERVANT_MANAGER - if (!retainServants() && useActiveMapOnly() ) { - addToErrorSet( policies, SERVANT_RETENTION_POLICY_ID.value, - errorSet ) ; - addToErrorSet( policies, REQUEST_PROCESSING_POLICY_ID.value, - errorSet ) ; - } - - // IMPLICIT_ACTIVATION requires SYSTEM_ID and RETAIN - if (isImplicitlyActivated()) { - if (!retainServants()) { - addToErrorSet( policies, IMPLICIT_ACTIVATION_POLICY_ID.value, - errorSet ) ; - addToErrorSet( policies, SERVANT_RETENTION_POLICY_ID.value, - errorSet ) ; - } - - if (!isSystemAssignedIds()) { - addToErrorSet( policies, IMPLICIT_ACTIVATION_POLICY_ID.value, - errorSet ) ; - addToErrorSet( policies, ID_ASSIGNMENT_POLICY_ID.value, - errorSet ) ; - } - } - - checkForPolicyError( errorSet ) ; - } - - public Policy get_effective_policy( int type ) - { - Integer key = new Integer( type ) ; - Policy result = (Policy)(policyMap.get(key)) ; - return result ; - } - - /* Thread Policies */ - public final boolean isOrbControlledThreads() { - return getPolicyValue( THREAD_POLICY_ID.value ) == - ThreadPolicyValue._ORB_CTRL_MODEL; - } - public final boolean isSingleThreaded() { - return getPolicyValue( THREAD_POLICY_ID.value ) == - ThreadPolicyValue._SINGLE_THREAD_MODEL; - } - - /* Lifespan */ - public final boolean isTransient() { - return getPolicyValue( LIFESPAN_POLICY_ID.value ) == - LifespanPolicyValue._TRANSIENT; - } - public final boolean isPersistent() { - return getPolicyValue( LIFESPAN_POLICY_ID.value ) == - LifespanPolicyValue._PERSISTENT; - } - - /* ID Uniqueness */ - public final boolean isUniqueIds() { - return getPolicyValue( ID_UNIQUENESS_POLICY_ID.value ) == - IdUniquenessPolicyValue._UNIQUE_ID; - } - public final boolean isMultipleIds() { - return getPolicyValue( ID_UNIQUENESS_POLICY_ID.value ) == - IdUniquenessPolicyValue._MULTIPLE_ID; - } - - /* ID Assignment */ - public final boolean isUserAssignedIds() { - return getPolicyValue( ID_ASSIGNMENT_POLICY_ID.value ) == - IdAssignmentPolicyValue._USER_ID; - } - public final boolean isSystemAssignedIds() { - return getPolicyValue( ID_ASSIGNMENT_POLICY_ID.value ) == - IdAssignmentPolicyValue._SYSTEM_ID; - } - - /* Servant Rentention */ - public final boolean retainServants() { - return getPolicyValue( SERVANT_RETENTION_POLICY_ID.value ) == - ServantRetentionPolicyValue._RETAIN; - } - - /* Request Processing */ - public final boolean useActiveMapOnly() { - return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) == - RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY; - } - public final boolean useDefaultServant() { - return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) == - RequestProcessingPolicyValue._USE_DEFAULT_SERVANT; - } - public final boolean useServantManager() { - return getPolicyValue( REQUEST_PROCESSING_POLICY_ID.value ) == - RequestProcessingPolicyValue._USE_SERVANT_MANAGER; - } - - /* Implicit Activation */ - public final boolean isImplicitlyActivated() { - return getPolicyValue( IMPLICIT_ACTIVATION_POLICY_ID.value ) == - ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION; - } - - /* proprietary servant caching policy */ - public final int servantCachingLevel() - { - Integer key = new Integer( ORBConstants.SERVANT_CACHING_POLICY ) ; - ServantCachingPolicy policy = (ServantCachingPolicy)policyMap.get( key ) ; - if (policy == null) - return ServantCachingPolicy.NO_SERVANT_CACHING ; - else - return policy.getType() ; - } - - public final boolean forceZeroPort() - { - Integer key = new Integer( ORBConstants.ZERO_PORT_POLICY ) ; - ZeroPortPolicy policy = (ZeroPortPolicy)policyMap.get( key ) ; - if (policy == null) - return false ; - else - return policy.forceZeroPort() ; - } - - public final int getCopierId() - { - Integer key = new Integer( ORBConstants.COPY_OBJECT_POLICY ) ; - CopyObjectPolicy policy = (CopyObjectPolicy)policyMap.get( key ) ; - if (policy != null) - return policy.getValue() ; - else - return defaultObjectCopierFactoryId ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java 2018-01-30 20:18:46.000000000 -0500 +++ /dev/null 2018-01-30 20:18:46.000000000 -0500 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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.corba.se.impl.oa.poa; - -import org.omg.CORBA.*; -import org.omg.PortableServer.*; - -public class RequestProcessingPolicyImpl - extends org.omg.CORBA.LocalObject implements RequestProcessingPolicy { - - public RequestProcessingPolicyImpl(RequestProcessingPolicyValue - value) { - this.value = value; - } - - public RequestProcessingPolicyValue value() { - return value; - } - - public int policy_type() - { - return REQUEST_PROCESSING_POLICY_ID.value ; - } - - public Policy copy() { - return new RequestProcessingPolicyImpl(value); - } - - public void destroy() { - value = null; - } - - private RequestProcessingPolicyValue value; - - public String toString() - { - String type = null ; - switch (value.value()) { - case RequestProcessingPolicyValue._USE_ACTIVE_OBJECT_MAP_ONLY : - type = "USE_ACTIVE_OBJECT_MAP_ONLY" ; - break ; - case RequestProcessingPolicyValue._USE_DEFAULT_SERVANT : - type = "USE_DEFAULT_SERVANT" ; - break ; - case RequestProcessingPolicyValue._USE_SERVANT_MANAGER : - type = "USE_SERVANT_MANAGER" ; - break ; - } - - return "RequestProcessingPolicy[" + type + "]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java 2018-01-30 20:18:47.000000000 -0500 +++ /dev/null 2018-01-30 20:18:47.000000000 -0500 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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.corba.se.impl.oa.poa; - -import org.omg.CORBA.*; -import org.omg.PortableServer.*; - -final class ServantRetentionPolicyImpl - extends org.omg.CORBA.LocalObject implements ServantRetentionPolicy { - - public ServantRetentionPolicyImpl(ServantRetentionPolicyValue value) { - this.value = value; - } - - public ServantRetentionPolicyValue value() { - return value; - } - - public int policy_type() - { - return SERVANT_RETENTION_POLICY_ID.value ; - } - - public Policy copy() { - return new ServantRetentionPolicyImpl(value); - } - - public void destroy() { - value = null; - } - - private ServantRetentionPolicyValue value; - - public String toString() - { - return "ServantRetentionPolicy[" + - ((value.value() == ServantRetentionPolicyValue._RETAIN) ? - "RETAIN" : "NON_RETAIN" + "]") ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java 2018-01-30 20:18:47.000000000 -0500 +++ /dev/null 2018-01-30 20:18:47.000000000 -0500 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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.corba.se.impl.oa.poa; - -import org.omg.CORBA.*; -import org.omg.PortableServer.*; - -final class ThreadPolicyImpl - extends org.omg.CORBA.LocalObject implements ThreadPolicy { - - public ThreadPolicyImpl(ThreadPolicyValue value) { - this.value = value; - } - - public ThreadPolicyValue value() { - return value; - } - - public int policy_type() - { - return THREAD_POLICY_ID.value ; - } - - public Policy copy() { - return new ThreadPolicyImpl(value); - } - - public void destroy() { - value = null; - } - - private ThreadPolicyValue value; - - public String toString() - { - return "ThreadPolicy[" + - ((value.value() == ThreadPolicyValue._SINGLE_THREAD_MODEL) ? - "SINGLE_THREAD_MODEL" : "ORB_CTRL_MODEL" + "]") ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt 2018-01-30 20:18:48.000000000 -0500 +++ /dev/null 2018-01-30 20:18:48.000000000 -0500 @@ -1,61 +0,0 @@ -package @PKGNAME@ ; - -import org.omg.CORBA.OMGVMCID ; -import org.omg.CORBA.CompletionStatus ; - -import org.omg.CORBA.@SYSEX@ ; - -public abstract class StandardException { - // @SYSEX@ BAD_CONTEXT - - public void IdlContextNotFound( CompletionStatus completed ) - { - throw new BAD_CONTEXT( "IDL context not found", - OMGVMCID.value + 1, completed ) ; - } - - public void IdlContextNotFound( ) - { - IdlContextNotFound( CompletionStatus.COMPLETED_NO ) ; - } - -Data structures: list[ ... ] vector[ ... ] ( record ) - -list[ ( string{exception name} list[ ( string{code name} int{value} string{description} ] ) ] - -Processing: - - - open file (fname) - fr = new FileReader( fname ) - br = new BufferedReader( fr ) - br.readLine() returns null at EOF - - want a BufferedReader - - while not eol read line - if (line start with spaces) - add to current index - else - new exception - - create StandardException class - - foreach ( excname vec ) in data - add import statement for execname to output - - foreach ( codename value descr ) in vec - generate full method - generate short method - - -(define (read-file fname) - (begin - (let port (open-input-port fname)) - (let obj (read port)) - obj - ) -) - - - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt 2018-01-30 20:18:49.000000000 -0500 +++ /dev/null 2018-01-30 20:18:49.000000000 -0500 @@ -1,160 +0,0 @@ -( -(BAD_CONTEXT - (IDL_CONTEXT_NOT_FOUND 1 "IDL context not found") - (NO_MATCHING_IDL_CONTEXT 2 "No matching IDL context property") -) -(BAD_INV_ORDER - (DEP_PREVENT_DESTRUCTION 1 "Dependency exists in IFR preventing destruction of this object") - (DESTROY_INDESTRUCTIBLE 2 "Attempt to destroy indestructible objects in IFR") - (OPERATION_DEADLOCK 3 "Operation would deadlock") - (ORB_SHUTDOWN 4 "ORB has shutdown") - (BAD_INVOKE 5 "Attempt to invoke send or invoke operation of the same Request object more than once ") - (BAD_SET_SERVANT_MANAGER 6 "Attempt to set a servent manager after one has already been set") - (BAD_ARGUMENTS_CALL 7 "ServerRequest::arguments called more than once or after a call to ServerRequest::set_exception") - (BAD_CTX_CALL 8 "ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception") - (BAD_RESULT_CALL 9 "ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception") - (BAD_SEND 10 "Attempt to send a DII request after it was sent previously") - (BAD_POLL_BEFORE 11 "Attempt to poll a DII request or to retrieve its result before the request was sent") - (BAD_POLL_AFTER 12 "Attempt to poll a DII request or to retrieve its result after the result was retrieved previously") - (BAD_POLL_SYNC 13 "Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request") - (BAD_PI_CALL 14 "Invalid portable interceptor call") - (BAD_PI_ADD_SERVICE_CONTEXT 15 "Service context add failed in portable interceptor because a service context with the given id already exists") - (DUPLICATE_POLICY_FACTORY 16 "Registration of PolicyFactory failed because a factory already exists for the given PolicyType") - (CREATE_POA_DESTROY 17 "POA cannot create POAs while undergoing destruction") - (PRIORITY_REASSIGN 18 "Attempt to reassign priority") - (XA_START_OUTSIZE 19 "An OTS/XA integration xa_start() call returned XAER_OUTSIDE") - (XA_START_PROTO 20 "An OTS/XA integration xa_ call returned XAER_PROTO") -) -(BAD_OPERATION - (BAD_SERVANT_MANAGER_TYPE 1 "ServantManager returned wrong servant type") - (OPERATION_UNKNOWN_TO_TARGET 2 "Operation or attribute not known to target object ") -) -(BAD_PARAM - (VALUE_FACTORY_REG_ERROR 1 "Failure to register, unregister or lookup value factory") - (RID_ALREADY_DEFINED 2 "RID already defined in IFR") - (NAME_USED_IFR 3 "Name already used in the context in IFR ") - (TARGET_NOT_CONTAINER 4 "Target is not a valid container") - (NAME_CLASH 5 "Name clash in inherited context") - (BAD_ABSTRACT_INTERFACE_TYPE 6 "Incorrect type for abstract interface") - (SO_BAD_SCHEME_NAME 7 "string_to_object conversion failed due to bad scheme name") - (SO_BAD_ADDRESS 8 "string_to_object conversion failed due to bad address") - (SO_BAD_SCHEMA_SPECIFIC 9 "string_to_object conversion failed due to bad bad schema specific part") - (SO_NON_SPECIFIC 10 "string_to_object conversion failed due to non specific reason") - (IR_DERIVE_ABS_INT_BASE 11 "Attempt to derive abstract interface from non-abstract base interface in the Interface Repository") - (IR_VALUE_SUPPORT 12 "Attempt to let a ValueDef support more than one non-abstract interface in the Interface Repository") - (INCOMPLETE_TYPECODE 13 "Attempt to use an incomplete TypeCode as a parameter") - (INVALID_OBJECT_ID 14 "Invalid object id passed to POA::create_reference_by_id ") - (TYPECODE_BAD_NAME 15 "Bad name argument in TypeCode operation") - (TYPECODE_BAD_REPID 16 "Bad RepositoryId argument in TypeCode operation") - (TYPECODE_INV_MEMBER 17 "Invalid member name in TypeCode operation ") - (TC_UNION_DUP_LABEL 18 "Duplicate label value in create_union_tc ") - (TC_UNION_INCOMPATIBLE 19 "Incompatible TypeCode of label and discriminator in create_union_tc ") - (TC_UNION_BAD_DISC 20 "Supplied discriminator type illegitimate in create_union_tc ") - (SET_EXCEPTION_BAD_ANY 21 "Any passed to ServerRequest::set_exception does not contain an exception ") - (SET_EXCEPTION_UNLISTED 22 "Unlisted user exception passed to ServerRequest::set_exception ") - (NO_WCHAR_CODE_SET 23 "wchar transmission code set not in service context") - (ILLEGAL_SERVICE_CONTEXT 24 "Service context is not in OMG-defined range") - (ENUM_OUT_OF_RANGE 25 "Enum value out of range") - (PI_BAD_SERVICE_CONTEXT 26 "Invalid service context Id in portable interceptor") - (REG_INITIAL_NULL 27 "Attempt to call register_initial_reference with a null Object") - (PI_INV_COMPONENT_ID 28 "Invalid component Id in portable interceptor") - (PI_INV_PROFILE_ID 29 "Invalid profile Id in portable interceptor") - (POLICY_TYPE_DUPLICATE 30 "Two or more Policy objects with the same PolicyType value supplied to Object::set_policy_overrides or PolicyManager::set_policy_overrides") - (BAD_ONEWAY_DEFINITION 31 "Attempt to define a oneway operation with non-void result, out or inout parameters or user exceptions") - (DII_FOR_IMPLICIT_OPERATION 32 "DII asked to create request for an implicit operation") - (XA_CALL_INVAL 33 "An OTS/XA integration xa_ call returned XAER_INVAL") - (UNION_BAD_DISCRIMINATOR 34 "Union branch modifier method called with bad case label discriminator") - (CTX_ILLEGAL_PROPERTY_NAME 35 "Illegal IDL context property name") - (CTX_ILLEGAL_SEARCH_STRING 36 "Illegal IDL property search string") - (CTX_ILLEGAL_NAME 37 "Illegal IDL context name") - (CTX_NON_EMPTY 38 "Non-empty IDL context") - (RMI_STREAM_FORMAT 39 "Unsupported RMI/IDL custom value type stream format") - (OUTPUT_STREAM_NOT_VALUE 40 "ORB output stream does not support ValueOutputStream interface") - (INPUT_STREAM_NOT_VALUE 41 "ORB input stream does not support ValueInputStream interface") -) -(BAD_TYPECODE - (MARSHALL_INCOMPLETE_TYPECODE 1 "Attempt to marshal incomplete TypeCode") - (BAD_MEMBER_TYPECODE 2 "Member type code illegitimate in TypeCode operation") - (ILLEGAL_PARAMETER 3 "Illegal parameter type") -) -(DATA_CONVERSION - (CHAR_NOT_MAP_TCS 1 "Character does not map to negotiated transmission code set") - (PRIORITY_MAP_FAILRE 2 "Failure of PriorityMapping object") -) -(IMP_LIMIT - (NO_USABLE_PROFILE 1 "Unable to use any profile in IOR") -) -(INITIALIZE - (PRIORITY_RANGE_RESTRICT 1 "Priority range too restricted for ORB") -) -(INV_OBJREF - (NO_WCHAR_CODE_SET 1 "wchar Code Set support not specified") - (CODESET_COMPONENT_REQUIRED 2 "Codeset component required for type using wchar or wstring data") -) -(INV_POLICY - (IOR_POLICY_RECONCILE_ERROR 1 "Unable to reconcile IOR specified policy with effective policy override") - (INVALID_POLICY_TYPE 2 "Invalid PolicyType") - (NO_POLICY_FACTORY 3 "No PolicyFactory has been registered for the given PolicyType") -) -(INTERNAL - (XA_RMERR 1 "An OTS/XA integration xa_ call returned XAER_RMERR") - (XA_RMFAIL 2 "An OTS/XA integration xa_ call returned XAER_RMFAIL") -) -(INTF_REPOS - (NO_IR 1 "Interface Repository not available") - (NO_INTERFACE_IN_IR 2 "No entry for requested interface in Interface Repository") -) -(MARSHAL - (NO_VALUE_FACTORY 1 "Unable to locate value factory") - (SET_RESULT_BEFORE_CTX 2 "ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause ") - (BAD_NVLIST 3 "NVList passed to ServerRequest::arguments does not describe all parameters passed by client") - (MARSHAL_LOCAL_OBJECT 4 "Attempt to marshal Local object") - (WCHAR_BAD_GIOP_VERSION_SENT 5 "wchar or wstring data erroneosly sent by client over GIOP 1.0 connection ") - (WCHAR_BAD_GIOP_VERSION_RETURNED 6 "wchar or wstring data erroneously returned by server over GIOP 1.0 connection ") - (RMI_STREAM_FORMAT_2 7 "Unsupported RMI/IDL custom value type stream "format -) -(NO_IMPLEMENT - (NO_LOCAL_VALUE_IMPLEMENTATION 1 "Missing local value implementation") - (INCOMPAT_VALUE_IMPLEMENTATION 2 "Incompatible value implementation version") - (NO_USABLE_PROFILE_2 3 "Unable to use any profile in IOR") - (DII_LOCAL_OBJECT 4 "Attempt to use DII on Local object") - (BIO_RESET 5 "Biomolecular Sequence Analysis iterator cannot be reset") - (BIO_NOT_AVAILABLE 6 "Biomolecular Sequence Analysis metadata is not available as XML") - (BIO_GENOMIC_NO_ITERATOR 7 "Genomic Maps iterator cannot be reset") -) -(NO_RESOURCES - (PI_OPERATION_NOT_SUPPORTED 1 "Portable Interceptor operation not supported in this binding") - (NO_CONNECTION_PRIORITY 2 "No connection for request's priority") -) -(TRANSACTION_ROLLEDBACK - (XA_RB 1 "An OTS/XA integration xa_ call returned XAER_RB") - (XA_NOTA 2 "An OTS/XA integration xa_ call returned XAER_NOTA") - (XA_END_TRUE_ROLLBACK_DEFERRED 3 "OTS/XA integration end() was called with success set to TRUE while transaction rollback was deferred") -) -(TRANSIENT - (POA_REQUEST_DISCARD 1 "Request discarded because of resource exhaustion in POA or because POA is in DISCARDING state") - (NO_USABLE_PROFILE_3 2 "No usable profile in IOR") - (REQUEST_CANCELLED 3 "Request cancelled") - (POA_DESTROYED 4 "POA destroyed") -) -(OBJECT_NOT_EXIST - "(UNREGISTERED_VALUE_AS_OBJREF 1 Attempt to pass an unactivated (unregistered) value as an object reference") - (NO_OBJECT_ADAPTOR 2 "Failed to create or locate Object Adaptor") - (BIO_NOT_AVAILABLE 3 "Biomolecular Sequence Analysis Service is no longer available") - (OBJECT_ADAPTER_INACTIVE 4 "Object Adapter Inactive") -) -(OBJ_ADAPTER - (UNKNOWN_ADAPTER_SYS_EXCEPTION 1 "System exception in POA::unknown_adapter") - (BAD_SERVANT_TYPE 2 "Incorrect servant type returned by servant manager ") - (NO_DEFAULT_SERVANT 3 "No default servant available [POA policy"]) - (NO_SERVANT_MANAGER 4 "No servant manager available [POA Policy"]) - (BAD_POLICY_INCARNATE 5 "Violation of POA policy by ServantActivator::incarnate") - (PI_EXC_COMP_ESTABLISHED 6 "Exception in PortableInterceptor::IORInterceptor.components_established") - (NULL_SERVANT_RETURNED 7 "Null servant returned by servant manager") -) -(UNKNOWN - (UNLISTED_EXCEPTION_RECEIVED 1 "Unlisted user exception received by client ") - (UNSUPPORTED_SYSTEM_EXCEPTION 2 "Non-standard System Exception not supported") - (PI_UNKNOWN_USER_EXCEPTION 3 "An unknown user exception received by a portable interceptor") -) -) --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOA.java 2018-01-30 20:18:49.000000000 -0500 +++ /dev/null 2018-01-30 20:18:49.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.impl.oa.toa ; - -import com.sun.corba.se.spi.oa.ObjectAdapter ; - -/** The Transient Object Adapter is used for standard RMI-IIOP and Java-IDL - * (legacy JDK 1.2) object implementations. Its protocol for managing objects is very - * simple: just connect and disconnect. There is only a single TOA instance per ORB, - * and its lifetime is the same as the ORB. The TOA instance is always ready to receive - * messages except when the ORB is shutting down. - */ -public interface TOA extends ObjectAdapter { - /** Connect the given servant to the ORB by allocating a transient object key - * and creating an IOR and object reference using the current factory. - */ - void connect( org.omg.CORBA.Object servant ) ; - - /** Disconnect the object from this ORB. - */ - void disconnect( org.omg.CORBA.Object obj ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java 2018-01-30 20:18:50.000000000 -0500 +++ /dev/null 2018-01-30 20:18:50.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.oa.toa ; - -import java.util.Map ; -import java.util.HashMap ; - -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.CompletionStatus ; - -import com.sun.corba.se.spi.oa.ObjectAdapterFactory ; -import com.sun.corba.se.spi.oa.ObjectAdapter ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.ior.ObjectAdapterId ; - -import com.sun.corba.se.impl.oa.toa.TOAImpl ; -import com.sun.corba.se.impl.oa.toa.TransientObjectManager ; - -import com.sun.corba.se.impl.javax.rmi.CORBA.Util ; - -import com.sun.corba.se.impl.ior.ObjectKeyTemplateBase ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public class TOAFactory implements ObjectAdapterFactory -{ - private ORB orb ; - private ORBUtilSystemException wrapper ; - - private TOAImpl toa ; - private Map codebaseToTOA ; - private TransientObjectManager tom ; - - public ObjectAdapter find ( ObjectAdapterId oaid ) - { - if (oaid.equals( ObjectKeyTemplateBase.JIDL_OAID ) ) - // Return the dispatch-only TOA, which can dispatch - // request for objects created by any TOA. - return getTOA() ; - else - throw wrapper.badToaOaid() ; - } - - public void init( ORB orb ) - { - this.orb = orb ; - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.OA_LIFECYCLE ) ; - tom = new TransientObjectManager( orb ) ; - codebaseToTOA = new HashMap() ; - } - - public void shutdown( boolean waitForCompletion ) - { - if (Util.isInstanceDefined()) { - Util.getInstance().unregisterTargetsForORB(orb); - } - } - - public synchronized TOA getTOA( String codebase ) - { - TOA toa = (TOA)(codebaseToTOA.get( codebase )) ; - if (toa == null) { - toa = new TOAImpl( orb, tom, codebase ) ; - - codebaseToTOA.put( codebase, toa ) ; - } - - return toa ; - } - - public synchronized TOA getTOA() - { - if (toa == null) - // The dispatch-only TOA is not used for creating - // objrefs, so its codebase can be null (and must - // be, since we do not have a servant at this point) - toa = new TOAImpl( orb, tom, null ) ; - - return toa ; - } - - public ORB getORB() - { - return orb ; - } -} ; --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAImpl.java 2018-01-30 20:18:51.000000000 -0500 +++ /dev/null 2018-01-30 20:18:51.000000000 -0500 @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2001, 2004, 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.corba.se.impl.oa.toa ; - -import org.omg.CORBA.Policy ; -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ObjectReferenceFactory ; -import org.omg.PortableInterceptor.ACTIVE; -import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ; - -import com.sun.corba.se.pept.protocol.ClientDelegate ; - -import com.sun.corba.se.spi.copyobject.CopierManager ; -import com.sun.corba.se.spi.copyobject.ObjectCopier ; -import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.iiop.IIOPFactories ; -import com.sun.corba.se.spi.oa.OAInvocationInfo ; -import com.sun.corba.se.spi.oa.OADestroyed ; -import com.sun.corba.se.spi.oa.ObjectAdapterBase ; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter ; -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; - -import com.sun.corba.se.impl.ior.JIDLObjectKeyTemplate ; -import com.sun.corba.se.impl.oa.NullServantImpl; -import com.sun.corba.se.impl.oa.poa.Policies; -import com.sun.corba.se.impl.oa.toa.TransientObjectManager ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; -import com.sun.corba.se.impl.protocol.JIDLLocalCRDImpl ; - -/** The Transient Object Adapter (TOA) represents the OA for purely transient -* objects. It is used for standard RMI-IIOP as well as backwards compatible -* server support (i.e. the ORB.connect() method) -* Its characteristics include: -* -* Other requirements: -* -*/ -public class TOAImpl extends ObjectAdapterBase implements TOA -{ - private TransientObjectManager servants ; - - public TOAImpl( ORB orb, TransientObjectManager tom, String codebase ) - { - super( orb ) ; - servants = tom ; - - // Make the object key template - int serverid = ((ORB)getORB()).getTransientServerId(); - int scid = ORBConstants.TOA_SCID ; - - ObjectKeyTemplate oktemp = new JIDLObjectKeyTemplate( orb, scid, serverid ) ; - - // REVISIT - POA specific - Policies policies = Policies.defaultPolicies; - - // REVISIT - absorb codebase into a policy - initializeTemplate( oktemp, true, - policies, - codebase, - null, // manager id - oktemp.getObjectAdapterId() - ) ; - } - - // Methods required for dispatching requests - - public ObjectCopierFactory getObjectCopierFactory() - { - CopierManager cm = getORB().getCopierManager() ; - return cm.getDefaultObjectCopierFactory() ; - } - - public org.omg.CORBA.Object getLocalServant( byte[] objectId ) - { - return (org.omg.CORBA.Object)(servants.lookupServant( objectId ) ) ; - } - - /** Get the servant for the request given by the parameters. - * This will update thread Current, so that subsequent calls to - * returnServant and removeCurrent from the same thread are for the - * same request. - * @param info is the request containing the rest of the request - */ - public void getInvocationServant( OAInvocationInfo info ) - { - java.lang.Object servant = servants.lookupServant( info.id() ) ; - if (servant == null) - // This is expected to result in an RMI-IIOP NoSuchObjectException. - // See bug 4973160. - servant = new NullServantImpl( lifecycleWrapper().nullServant() ) ; - info.setServant( servant ) ; - } - - public void returnServant() - { - // NO-OP - } - - /** Return the most derived interface for the given servant and objectId. - */ - public String[] getInterfaces( Object servant, byte[] objectId ) - { - return StubAdapter.getTypeIds( servant ) ; - } - - // XXX For now, this does nothing. - // This will need fixing once we support ORB and thread level policies, - // but for now, there is no way to associate policies with the TOA, so - // getEffectivePolicy must always return null. - public Policy getEffectivePolicy( int type ) - { - return null ; - } - - public int getManagerId() - { - return -1 ; - } - - public short getState() - { - return ACTIVE.value ; - } - - public void enter() throws OADestroyed - { - } - - public void exit() - { - } - - // Methods unique to the TOA - - public void connect( org.omg.CORBA.Object objref) - { - // Store the objref and get a userkey allocated by the transient - // object manager. - byte[] key = servants.storeServant(objref, null); - - // Find out the repository ID for this objref. - String id = StubAdapter.getTypeIds( objref )[0] ; - - // Create the new objref - ObjectReferenceFactory orf = getCurrentFactory() ; - org.omg.CORBA.Object obj = orf.make_object( id, key ) ; - - // Copy the delegate from the new objref to the argument - // XXX handle the case of an attempt to connect a local object. - - org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate( - obj ) ; - CorbaContactInfoList ccil = (CorbaContactInfoList) - ((ClientDelegate)delegate).getContactInfoList() ; - LocalClientRequestDispatcher lcs = - ccil.getLocalClientRequestDispatcher() ; - - if (lcs instanceof JIDLLocalCRDImpl) { - JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl)lcs ; - jlcs.setServant( objref ) ; - } else { - throw new RuntimeException( - "TOAImpl.connect can not be called on " + lcs ) ; - } - - StubAdapter.setDelegate( objref, delegate ) ; - } - - public void disconnect( org.omg.CORBA.Object objref ) - { - // Get the delegate, then ior, then transientKey, then delete servant - org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate( - objref ) ; - CorbaContactInfoList ccil = (CorbaContactInfoList) - ((ClientDelegate)del).getContactInfoList() ; - LocalClientRequestDispatcher lcs = - ccil.getLocalClientRequestDispatcher() ; - - if (lcs instanceof JIDLLocalCRDImpl) { - JIDLLocalCRDImpl jlcs = (JIDLLocalCRDImpl)lcs ; - byte[] oid = jlcs.getObjectId() ; - servants.deleteServant(oid); - jlcs.unexport() ; - } else { - throw new RuntimeException( - "TOAImpl.disconnect can not be called on " + lcs ) ; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TransientObjectManager.java 2018-01-30 20:18:51.000000000 -0500 +++ /dev/null 2018-01-30 20:18:51.000000000 -0500 @@ -1,205 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.oa.toa; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; -import com.sun.corba.se.spi.orb.ORB ; - -public final class TransientObjectManager { - private ORB orb ; - private int maxSize = 128; - private Element[] elementArray; - private Element freeList; - - void dprint( String msg ) { - ORBUtility.dprint( this, msg ) ; - } - - public TransientObjectManager( ORB orb ) - { - this.orb = orb ; - - elementArray = new Element[maxSize]; - elementArray[maxSize-1] = new Element(maxSize-1,null); - for ( int i=maxSize-2; i>=0; i-- ) - elementArray[i] = new Element(i,elementArray[i+1]); - freeList = elementArray[0]; - } - - public synchronized byte[] storeServant(java.lang.Object servant, java.lang.Object servantData) - { - if ( freeList == null ) - doubleSize(); - - Element elem = freeList; - freeList = (Element)freeList.servant; - - byte[] result = elem.getKey(servant, servantData); - if (orb.transientObjectManagerDebugFlag) - dprint( "storeServant returns key for element " + elem ) ; - return result ; - } - - public synchronized java.lang.Object lookupServant(byte transientKey[]) - { - int index = ORBUtility.bytesToInt(transientKey,0); - int counter = ORBUtility.bytesToInt(transientKey,4); - - if (orb.transientObjectManagerDebugFlag) - dprint( "lookupServant called with index=" + index + ", counter=" + counter ) ; - - if (elementArray[index].counter == counter && - elementArray[index].valid ) { - if (orb.transientObjectManagerDebugFlag) - dprint( "\tcounter is valid" ) ; - return elementArray[index].servant; - } - - // servant not found - if (orb.transientObjectManagerDebugFlag) - dprint( "\tcounter is invalid" ) ; - return null; - } - - public synchronized java.lang.Object lookupServantData(byte transientKey[]) - { - int index = ORBUtility.bytesToInt(transientKey,0); - int counter = ORBUtility.bytesToInt(transientKey,4); - - if (orb.transientObjectManagerDebugFlag) - dprint( "lookupServantData called with index=" + index + ", counter=" + counter ) ; - - if (elementArray[index].counter == counter && - elementArray[index].valid ) { - if (orb.transientObjectManagerDebugFlag) - dprint( "\tcounter is valid" ) ; - return elementArray[index].servantData; - } - - // servant not found - if (orb.transientObjectManagerDebugFlag) - dprint( "\tcounter is invalid" ) ; - return null; - } - - public synchronized void deleteServant(byte transientKey[]) - { - int index = ORBUtility.bytesToInt(transientKey,0); - if (orb.transientObjectManagerDebugFlag) - dprint( "deleting servant at index=" + index ) ; - - elementArray[index].delete(freeList); - freeList = elementArray[index]; - } - - public synchronized byte[] getKey(java.lang.Object servant) - { - for ( int i=0; i=oldSize; i-- ) - elementArray[i] = new Element(i,elementArray[i+1]); - freeList = elementArray[oldSize]; - } -} - - -final class Element { - java.lang.Object servant=null; // also stores "next pointer" in free list - java.lang.Object servantData=null; - int index=-1; - int counter=0; - boolean valid=false; // valid=true if this Element contains - // a valid servant - - Element(int i, java.lang.Object next) - { - servant = next; - index = i; - } - - byte[] getKey(java.lang.Object servant, java.lang.Object servantData) - { - this.servant = servant; - this.servantData = servantData; - this.valid = true; - - return toBytes(); - } - - byte[] toBytes() - { - // Convert the index+counter into an 8-byte (big-endian) key. - - byte key[] = new byte[8]; - ORBUtility.intToBytes(index, key, 0); - ORBUtility.intToBytes(counter, key, 4); - - return key; - } - - void delete(Element freeList) - { - if ( !valid ) // prevent double deletion - return; - counter++; - servantData = null; - valid = false; - - // add this to freeList - servant = freeList; - } - - public String toString() - { - return "Element[" + index + ", " + counter + "]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/AppletDataCollector.java 2018-01-30 20:18:52.000000000 -0500 +++ /dev/null 2018-01-30 20:18:52.000000000 -0500 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orb ; - -import java.applet.Applet ; -import java.util.Properties ; - -public class AppletDataCollector extends DataCollectorBase { - private Applet applet ; - - AppletDataCollector( Applet app, Properties props, String localHostName, - String configurationHostName ) - { - super( props, localHostName, configurationHostName ) ; - this.applet = app ; - } - - public boolean isApplet() - { - return true ; - } - - protected void collect( ) - { - checkPropertyDefaults() ; - - findPropertiesFromFile() ; - - // We do not use system properties for applets in order to - // avoid security exceptions. - - findPropertiesFromProperties() ; - findPropertiesFromApplet( applet ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorBase.java 2018-01-30 20:18:53.000000000 -0500 +++ /dev/null 2018-01-30 20:18:53.000000000 -0500 @@ -1,473 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.impl.orb ; - -import com.sun.corba.se.impl.orbutil.GetPropertyAction ; - -import java.security.PrivilegedAction ; -import java.security.AccessController ; - -import java.applet.Applet ; - -import java.util.Properties ; -import java.util.Vector ; -import java.util.Set ; -import java.util.HashSet ; -import java.util.Enumeration ; -import java.util.Iterator ; -import java.util.StringTokenizer ; - -import java.net.URL ; - -import java.security.AccessController ; - -import java.io.File ; -import java.io.FileInputStream ; - -import com.sun.corba.se.spi.orb.DataCollector ; -import com.sun.corba.se.spi.orb.PropertyParser ; - -import com.sun.corba.se.impl.orbutil.ORBConstants ; -import com.sun.corba.se.impl.orbutil.ORBUtility; - -public abstract class DataCollectorBase implements DataCollector { - private PropertyParser parser ; - private Set propertyNames ; - private Set propertyPrefixes ; - private Set URLPropertyNames ; - protected String localHostName ; - protected String configurationHostName ; - private boolean setParserCalled ; - private Properties originalProps ; - private Properties resultProps ; - - public DataCollectorBase( Properties props, String localHostName, - String configurationHostName ) - { - // XXX This is fully initialized here. So do we ever want to - // generalize this (or perhaps this is the wrong place for this?) - URLPropertyNames = new HashSet() ; - URLPropertyNames.add( ORBConstants.INITIAL_SERVICES_PROPERTY ) ; - - propertyNames = new HashSet() ; - - // Make sure that we are ready to handle -ORBInitRef. This is special - // due to the need to handle multiple -ORBInitRef args as prefix - // parsing. - propertyNames.add( ORBConstants.ORB_INIT_REF_PROPERTY ) ; - - propertyPrefixes = new HashSet() ; - - this.originalProps = props ; - this.localHostName = localHostName ; - this.configurationHostName = configurationHostName ; - setParserCalled = false ; - resultProps = new Properties() ; - } - -////////////////////////////////////////////////////////// -// Public interface defined in DataCollector -////////////////////////////////////////////////////////// - - public boolean initialHostIsLocal() - { - checkSetParserCalled() ; - return localHostName.equals( resultProps.getProperty( - ORBConstants.INITIAL_HOST_PROPERTY ) ) ; - } - - public void setParser( PropertyParser parser ) - { - Iterator iter = parser.iterator() ; - while (iter.hasNext()) { - ParserAction pa = (ParserAction)(iter.next()) ; - if (pa.isPrefix()) - propertyPrefixes.add( pa.getPropertyName() ) ; - else - propertyNames.add( pa.getPropertyName() ) ; - } - - collect() ; - setParserCalled = true ; - } - - public Properties getProperties() - { - checkSetParserCalled() ; - return resultProps ; - } - -////////////////////////////////////////////////////////// -// public interface from DataCollector that must be defined -// in subclasses -////////////////////////////////////////////////////////// - - public abstract boolean isApplet() ; - -////////////////////////////////////////////////////////// -// Implementation methods needed in subclasses -////////////////////////////////////////////////////////// - - protected abstract void collect() ; - -////////////////////////////////////////////////////////// -// methods for use by subclasses -////////////////////////////////////////////////////////// - - protected void checkPropertyDefaults() - { - String host = - resultProps.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ; - - if ((host == null) || (host.equals(""))) - setProperty( ORBConstants.INITIAL_HOST_PROPERTY, - configurationHostName ); - - String serverHost = - resultProps.getProperty( ORBConstants.SERVER_HOST_PROPERTY ) ; - - if (serverHost == null || - serverHost.equals("") || - serverHost.equals("0.0.0.0") || - serverHost.equals("::") || - serverHost.toLowerCase().equals("::ffff:0.0.0.0")) - { - setProperty(ORBConstants.SERVER_HOST_PROPERTY, - localHostName); - setProperty(ORBConstants.LISTEN_ON_ALL_INTERFACES, - ORBConstants.LISTEN_ON_ALL_INTERFACES); - } - } - - protected void findPropertiesFromArgs( String[] params ) - { - if (params == null) - return; - - // All command-line args are of the form "-ORBkey value". - // The key is mapped to .ORBkey. - - String name ; - String value ; - - for ( int i=0; i= - StringTokenizer st = new StringTokenizer( value, "=" ) ; - if (st.countTokens() != 2) - throw new IllegalArgumentException() ; - - String refName = st.nextToken() ; - String refValue = st.nextToken() ; - - resultProps.setProperty( name + "." + refName, refValue ) ; - } else { - resultProps.setProperty( name, value ) ; - } - } - - private void checkSetParserCalled() - { - if (!setParserCalled) - throw new IllegalStateException( "setParser not called." ) ; - } - - // For each prefix in prefixes, For each name in propertyNames, - // if (prefix is a prefix of name) get value from getProperties and - // setProperty (name, value). - private void findPropertiesByPrefix( Set prefixes, - Iterator propertyNames, PropertyCallback getProperty ) - { - while (propertyNames.hasNext()) { - String name = (String)(propertyNames.next()) ; - Iterator iter = prefixes.iterator() ; - while (iter.hasNext()) { - String prefix = (String)(iter.next()) ; - if (name.startsWith( prefix )) { - String value = getProperty.get( name ) ; - - // Note: do a put even if value is null since just - // the presence of the property may be significant. - setProperty( name, value ) ; - } - } - } - } - - // For each prefix in names, get the corresponding property - // value from the callback, and store the name/value pair in - // the result. - private void findPropertiesByName( Iterator names, - PropertyCallback getProperty ) - { - while (names.hasNext()) { - String name = (String)(names.next()) ; - String value = getProperty.get( name ) ; - if (value != null) - setProperty( name, value ) ; - } - } - - private static String getSystemProperty(final String name) - { - return (String)AccessController.doPrivileged( - new GetPropertyAction(name)); - } - - // Map command-line arguments to ORB properties. - // - private String findMatchingPropertyName( Set names, - String suffix ) - { - Iterator iter = names.iterator() ; - while (iter.hasNext()) { - String name = (String)(iter.next()) ; - if (name.endsWith( suffix )) - return name ; - } - - return null ; - } - - private static Iterator makeIterator( final Enumeration enumeration ) - { - return new Iterator() { - public boolean hasNext() { return enumeration.hasMoreElements() ; } - public Object next() { return enumeration.nextElement() ; } - public void remove() { throw new UnsupportedOperationException() ; } - } ; - } - - private static Iterator getSystemPropertyNames() - { - // This will not throw a SecurityException because this - // class was loaded from rt.jar using the bootstrap classloader. - Enumeration enumeration = (Enumeration) - AccessController.doPrivileged( - new PrivilegedAction() { - public java.lang.Object run() { - return System.getProperties().propertyNames(); - } - } - ); - - return makeIterator( enumeration ) ; - } - - private void getPropertiesFromFile( Properties props, String fileName ) - { - try { - File file = new File( fileName ) ; - if (!file.exists()) - return ; - - FileInputStream in = new FileInputStream( file ) ; - - try { - props.load( in ) ; - } finally { - in.close() ; - } - } catch (Exception exc) { - // if (ORBInitDebug) - // dprint( "ORB properties file " + fileName + " not found: " + - // exc) ; - } - } - - private Properties getFileProperties() - { - Properties defaults = new Properties() ; - - String javaHome = getSystemProperty( "java.home" ) ; - String fileName = javaHome + File.separator + "lib" + File.separator + - "orb.properties" ; - - getPropertiesFromFile( defaults, fileName ) ; - - Properties results = new Properties( defaults ) ; - - String userHome = getSystemProperty( "user.home" ) ; - fileName = userHome + File.separator + "orb.properties" ; - - getPropertiesFromFile( results, fileName ) ; - return results ; - } - - private boolean hasCORBAPrefix( String prefix ) - { - return prefix.startsWith( ORBConstants.ORG_OMG_PREFIX ) || - prefix.startsWith( ORBConstants.SUN_PREFIX ) || - prefix.startsWith( ORBConstants.SUN_LC_PREFIX ) || - prefix.startsWith( ORBConstants.SUN_LC_VERSION_PREFIX ) ; - } - - // Return only those element of prefixes for which hasCORBAPrefix - // is true. - private Set getCORBAPrefixes( final Set prefixes ) - { - Set result = new HashSet() ; - Iterator iter = prefixes.iterator() ; - while (iter.hasNext()) { - String element = (String)(iter.next()) ; - if (hasCORBAPrefix( element )) - result.add( element ) ; - } - - return result ; - } -} - -// Used to collect properties from various sources. -abstract class PropertyCallback -{ - abstract public String get(String name); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorFactory.java 2018-01-30 20:18:53.000000000 -0500 +++ /dev/null 2018-01-30 20:18:53.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.impl.orb ; - -import java.applet.Applet ; -import java.util.Properties ; -import java.net.URL ; - -import com.sun.corba.se.spi.orb.DataCollector ; - -public abstract class DataCollectorFactory { - private DataCollectorFactory() {} - - public static DataCollector create( Applet app, Properties props, - String localHostName ) - { - String appletHost = localHostName ; - - if (app != null) { - URL appletCodeBase = app.getCodeBase() ; - - if (appletCodeBase != null) - appletHost = appletCodeBase.getHost() ; - } - - return new AppletDataCollector( app, props, localHostName, - appletHost ) ; - } - - public static DataCollector create( String[] args, Properties props, - String localHostName ) - { - return new NormalDataCollector( args, props, localHostName, - localHostName ) ; - } - - public static DataCollector create( Properties props, - String localHostName ) - { - return new PropertyOnlyDataCollector( props, localHostName, - localHostName ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalDataCollector.java 2018-01-30 20:18:54.000000000 -0500 +++ /dev/null 2018-01-30 20:18:54.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orb ; - -import java.net.InetAddress ; - -import java.util.Properties ; - -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.CompletionStatus ; - -public class NormalDataCollector extends DataCollectorBase { - private String[] args ; - - public NormalDataCollector( String[] args, Properties props, - String localHostName, String configurationHostName ) - { - super( props, localHostName, configurationHostName ) ; - this.args = args ; - } - - public boolean isApplet() - { - return false ; - } - - protected void collect() - { - checkPropertyDefaults() ; - - findPropertiesFromFile() ; - findPropertiesFromSystem() ; - findPropertiesFromProperties() ; - findPropertiesFromArgs( args ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserAction.java 2018-01-30 20:18:55.000000000 -0500 +++ /dev/null 2018-01-30 20:18:55.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orb ; - -import java.util.Properties ; - -import com.sun.corba.se.spi.orb.Operation ; - -public class NormalParserAction extends ParserActionBase { - public NormalParserAction( String propertyName, - Operation operation, String fieldName ) - { - super( propertyName, false, operation, fieldName ) ; - } - - /** Create a String[] of all suffixes of property names that - * match the propertyName prefix, pass this to op, and return the - * result. - */ - public Object apply( Properties props ) - { - Object value = props.getProperty( getPropertyName() ) ; - if (value != null) - return getOperation().operate( value ) ; - else - return null ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserData.java 2018-01-30 20:18:55.000000000 -0500 +++ /dev/null 2018-01-30 20:18:55.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orb ; - -import java.util.Properties ; - -import com.sun.corba.se.spi.orb.Operation ; -import com.sun.corba.se.spi.orb.PropertyParser ; - -public class NormalParserData extends ParserDataBase { - private String testData ; - - public NormalParserData( String propertyName, - Operation operation, String fieldName, Object defaultValue, - Object testValue, String testData ) - { - super( propertyName, operation, fieldName, defaultValue, testValue ) ; - this.testData = testData ; - } - public void addToParser( PropertyParser parser ) - { - parser.add( getPropertyName(), getOperation(), getFieldName() ) ; - } - - public void addToProperties( Properties props ) - { - props.setProperty( getPropertyName(), testData ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java 2018-01-30 20:18:56.000000000 -0500 +++ /dev/null 2018-01-30 20:18:56.000000000 -0500 @@ -1,628 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.impl.orb ; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.InetAddress ; -import java.security.PrivilegedAction ; -import java.security.PrivilegedExceptionAction ; -import java.security.AccessController ; -import java.util.Collection ; -import java.util.Iterator ; - -import org.omg.CORBA.CompletionStatus ; -import org.omg.CORBA.portable.ValueFactory ; - -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ; -import com.sun.corba.se.pept.transport.Acceptor; - -import com.sun.corba.se.spi.activation.Locator ; -import com.sun.corba.se.spi.activation.Activator ; -import com.sun.corba.se.spi.activation.LocatorHelper ; -import com.sun.corba.se.spi.activation.ActivatorHelper ; -import com.sun.corba.se.spi.activation.EndPointInfo ; - -import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ; -import com.sun.corba.se.spi.copyobject.CopyobjectDefaults ; -import com.sun.corba.se.spi.copyobject.CopierManager ; - -import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories ; - -import com.sun.corba.se.spi.ior.iiop.IIOPFactories ; - -import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.spi.oa.OADefault ; -import com.sun.corba.se.spi.oa.ObjectAdapter ; -import com.sun.corba.se.spi.oa.ObjectAdapterFactory ; - -import com.sun.corba.se.spi.orb.Operation ; -import com.sun.corba.se.spi.orb.OperationFactory ; -import com.sun.corba.se.spi.orb.ORBData ; -import com.sun.corba.se.spi.orb.DataCollector ; -import com.sun.corba.se.spi.orb.ORBConfigurator ; -import com.sun.corba.se.spi.orb.ParserImplBase ; -import com.sun.corba.se.spi.orb.PropertyParser ; -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.orbutil.closure.Closure ; -import com.sun.corba.se.spi.orbutil.closure.ClosureFactory ; - -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; -import com.sun.corba.se.spi.protocol.RequestDispatcherDefault ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ; - -import com.sun.corba.se.spi.resolver.LocalResolver ; -import com.sun.corba.se.spi.resolver.Resolver ; -import com.sun.corba.se.spi.resolver.ResolverDefault ; - -import com.sun.corba.se.spi.transport.CorbaContactInfoList; -import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory; -import com.sun.corba.se.spi.transport.SocketInfo; -import com.sun.corba.se.spi.transport.TransportDefault ; - -import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ; - -import com.sun.corba.se.spi.servicecontext.ServiceContext ; -import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ; -import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext ; -import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext ; -import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext ; -import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext ; -import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl; - -// XXX This should go away once we get rid of the port exchange for ORBD -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo; -import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl; -import com.sun.corba.se.impl.legacy.connection.SocketFactoryContactInfoListImpl; -import com.sun.corba.se.impl.legacy.connection.USLPort; - -// XXX These should move to SPI -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -// XXX This needs an SPI -import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl ; - -public class ORBConfiguratorImpl implements ORBConfigurator { - private ORBUtilSystemException wrapper ; - - public static class ConfigParser extends ParserImplBase { - public Class[] userConfigurators = null ; - - public PropertyParser makeParser() - { - PropertyParser parser = new PropertyParser() ; - Operation action = OperationFactory.compose( - OperationFactory.suffixAction(), - OperationFactory.classAction() - ) ; - parser.addPrefix( ORBConstants.SUN_PREFIX + "ORBUserConfigurators", - action, "userConfigurators", Class.class ) ; - return parser ; - } - } - - public void configure( DataCollector collector, ORB orb ) - { - ORB theOrb = orb ; - wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.ORB_LIFECYCLE ) ; - - initObjectCopiers( theOrb ) ; - initIORFinders( theOrb ) ; - - theOrb.setClientDelegateFactory( - // REVISIT: this should be ProtocolDefault. - TransportDefault.makeClientDelegateFactory( theOrb )) ; - - initializeTransport(theOrb) ; - - initializeNaming( theOrb ) ; - initServiceContextRegistry( theOrb ) ; - initRequestDispatcherRegistry( theOrb ) ; - registerInitialReferences( theOrb ) ; - - persistentServerInitialization( theOrb ) ; - - runUserConfigurators( collector, theOrb ) ; - } - - private void runUserConfigurators( DataCollector collector, ORB orb ) - { - // Run any pluggable configurators. This is a lot like - // ORBInitializers, only it uses the internal ORB and has - // access to all data for parsing. - ConfigParser parser = new ConfigParser() ; - parser.init( collector ) ; - if (parser.userConfigurators != null) { - for (int ctr=0; ctr() { - public String run() { - String props = System - .getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME); - if (props == null) { - props = Security - .getProperty(IORTYPECHECKREGISTRY_FILTER_PROPNAME); - } - return props; - } - }); - if (filterProps != null) { - try { - iorTypeCheckRegistry = new IORTypeCheckRegistryImpl(filterProps, this); - } catch (Exception ex) { - throw wrapper.bootstrapException(ex); - } - - if (this.orbInitDebugFlag) { - dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl created for properties == " - + filterProps); - } - } else { - if (this.orbInitDebugFlag) { - dprint(".initIORTypeCheckRegistry, IORTypeCheckRegistryImpl NOT created for properties == "); - } - } - } - - protected void setDebugFlags( String[] args ) - { - for (int ctr=0; ctr"Y", and an - * object, YY, then a subsequent call to - * ORB.resolve_initial_references( "Y" ) will - * return object YY. - * - * @param id The ID by which the initial reference will be known. - * @param obj The initial reference itself. - * @throws InvalidName if this operation is called with an empty string id - * or this operation is called with an id that is already registered, - * including the default names defined by OMG. - * @throws BAD_PARAM if the obj parameter is null. - */ - public void register_initial_reference( - String id, org.omg.CORBA.Object obj ) throws InvalidName - { - CorbaServerRequestDispatcher insnd ; - - synchronized (this) { - checkShutdownState(); - } - - if ((id == null) || (id.length() == 0)) - throw new InvalidName() ; - - synchronized (this) { - checkShutdownState(); - } - - synchronized (resolverLock) { - insnd = insNamingDelegate ; - - java.lang.Object obj2 = localResolver.resolve( id ) ; - if (obj2 != null) - throw new InvalidName(id + " already registered") ; - - localResolver.register( id, ClosureFactory.makeConstant( obj )) ; - } - - synchronized (this) { - if (StubAdapter.isStub(obj)) - // Make all remote object references available for INS. - requestDispatcherRegistry.registerServerRequestDispatcher( - insnd, id ) ; - } - } - -/**************************************************************************** - * The following methods (introduced in POA / CORBA2.1) deal with - * shutdown / single threading. - ****************************************************************************/ - - public void run() - { - synchronized (this) { - checkShutdownState(); - } - - synchronized (runObj) { - try { - runObj.wait(); - } catch ( InterruptedException ex ) {} - } - } - - public void shutdown(boolean wait_for_completion) { - boolean wait = false; - - synchronized (this) { - checkShutdownState(); - - // This is to avoid deadlock: don't allow a thread that is - // processing a request to call shutdown( true ), because - // the shutdown would block waiting for the request to complete, - // while the request would block waiting for shutdown to complete. - if (wait_for_completion && - isProcessingInvocation.get() == Boolean.TRUE) { - throw omgWrapper.shutdownWaitForCompletionDeadlock(); - } - - if (status == STATUS_SHUTTING_DOWN) { - if (wait_for_completion) { - wait = true; - } else { - return; - } - } - - status = STATUS_SHUTTING_DOWN; - } - - // Avoid more than one thread performing shutdown at a time. - synchronized (shutdownObj) { - // At this point, the ORB status is certainly STATUS_SHUTTING_DOWN. - // If wait is true, another thread already called shutdown( true ), - // and so we wait for completion - if (wait) { - while (true) { - synchronized (this) { - if (status == STATUS_SHUTDOWN) - break; - } - - try { - shutdownObj.wait(); - } catch (InterruptedException exc) { - // NOP: just loop and wait until state is changed - } - } - } else { - // perform the actual shutdown - shutdownServants(wait_for_completion); - - if (wait_for_completion) { - synchronized ( waitForCompletionObj ) { - while (numInvocations > 0) { - try { - waitForCompletionObj.wait(); - } catch (InterruptedException ex) {} - } - } - } - - synchronized (runObj) { - runObj.notifyAll(); - } - - status = STATUS_SHUTDOWN; - - shutdownObj.notifyAll(); - } - } - } - - // Cause all ObjectAdapaterFactories to clean up all of their internal state, which - // may include activated objects that have associated state and callbacks that must - // complete in order to shutdown. This will cause new request to be rejected. - protected void shutdownServants(boolean wait_for_completion) { - Set oaset; - synchronized (this) { - oaset = new HashSet<>(requestDispatcherRegistry.getObjectAdapterFactories()); - } - - for (ObjectAdapterFactory oaf : oaset) - oaf.shutdown(wait_for_completion); - } - - // Note that the caller must hold the ORBImpl lock. - public void checkShutdownState() - { - if (status == STATUS_DESTROYED) { - throw wrapper.orbDestroyed() ; - } - - if (status == STATUS_SHUTDOWN) { - throw omgWrapper.badOperationAfterShutdown() ; - } - } - - public boolean isDuringDispatch() - { - synchronized (this) { - checkShutdownState(); - } - Boolean value = (Boolean)(isProcessingInvocation.get()) ; - return value.booleanValue() ; - } - - public void startingDispatch() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (invocationObj) { - isProcessingInvocation.set(Boolean.TRUE); - numInvocations++; - } - } - - public void finishedDispatch() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (invocationObj) { - numInvocations--; - isProcessingInvocation.set(false); - if (numInvocations == 0) { - synchronized (waitForCompletionObj) { - waitForCompletionObj.notifyAll(); - } - } else if (numInvocations < 0) { - throw wrapper.numInvocationsAlreadyZero( - CompletionStatus.COMPLETED_YES); - } - } - } - - /** - * formal/99-10-07 p 159: "If destroy is called on an ORB that has - * not been shut down, it will start the shutdown process and block until - * the ORB has shut down before it destroys the ORB." - */ - public void destroy() - { - boolean shutdownFirst = false; - - synchronized (this) { - shutdownFirst = (status == STATUS_OPERATING); - } - - if (shutdownFirst) { - shutdown(true); - } - - synchronized (this) { - if (status < STATUS_DESTROYED) { - getCorbaTransportManager().close(); - getPIHandler().destroyInterceptors(); - status = STATUS_DESTROYED; - } - } - synchronized (threadPoolManagerAccessLock) { - if (orbOwnsThreadPoolManager) { - try { - threadpoolMgr.close(); - threadpoolMgr = null; - } catch (IOException exc) { - wrapper.ioExceptionOnClose(exc); - } - } - } - - try { - monitoringManager.close(); - monitoringManager = null; - } catch (IOException exc) { - wrapper.ioExceptionOnClose(exc); - } - - CachedCodeBase.cleanCache(this); - try { - pihandler.close(); - } catch (IOException exc) { - wrapper.ioExceptionOnClose(exc); - } - - super.destroy(); - - badServerIdHandlerAccessLock = null; - clientDelegateFactoryAccessorLock = null; - corbaContactInfoListFactoryAccessLock = null; - - objectKeyFactoryAccessLock = null; - legacyServerSocketManagerAccessLock = null; - threadPoolManagerAccessLock = null; - transportManager = null; - legacyServerSocketManager = null; - OAInvocationInfoStack = null; - clientInvocationInfoStack = null; - codeBaseIOR = null; - dynamicRequests = null; - svResponseReceived = null; - runObj = null; - shutdownObj = null; - waitForCompletionObj = null; - invocationObj = null; - isProcessingInvocation = null; - typeCodeForClassMap = null; - valueFactoryCache = null; - orbVersionThreadLocal = null; - requestDispatcherRegistry = null; - copierManager = null; - toaFactory = null; - poaFactory = null; - pihandler = null; - configData = null; - badServerIdHandler = null; - clientDelegateFactory = null; - corbaContactInfoListFactory = null; - resolver = null; - localResolver = null; - insNamingDelegate = null; - urlOperation = null; - taggedComponentFactoryFinder = null; - taggedProfileFactoryFinder = null; - taggedProfileTemplateFactoryFinder = null; - objectKeyFactory = null; - } - - /** - * Registers a value factory for a particular repository ID. - * - * @param repositoryID the repository ID. - * @param factory the factory. - * @return the previously registered factory for the given repository ID, - * or null if no such factory was previously registered. - * @exception org.omg.CORBA.BAD_PARAM if the registration fails. - **/ - public synchronized ValueFactory register_value_factory(String repositoryID, - ValueFactory factory) - { - checkShutdownState(); - - if ((repositoryID == null) || (factory == null)) - throw omgWrapper.unableRegisterValueFactory() ; - - return (ValueFactory)valueFactoryCache.put(repositoryID, factory); - } - - /** - * Unregisters a value factory for a particular repository ID. - * - * @param repositoryID the repository ID. - **/ - public synchronized void unregister_value_factory(String repositoryID) - { - checkShutdownState(); - - if (valueFactoryCache.remove(repositoryID) == null) - throw wrapper.nullParam() ; - } - - /** - * Finds and returns a value factory for the given repository ID. - * The value factory returned was previously registered by a call to - * {@link #register_value_factory} or is the default factory. - * - * @param repositoryID the repository ID. - * @return the value factory. - * @exception org.omg.CORBA.BAD_PARAM if unable to locate a factory. - **/ - public synchronized ValueFactory lookup_value_factory(String repositoryID) - { - checkShutdownState(); - - ValueFactory factory = - (ValueFactory)valueFactoryCache.get(repositoryID); - - if (factory == null) { - try { - factory = Utility.getFactory(null, null, null, repositoryID); - } catch(org.omg.CORBA.MARSHAL ex) { - throw wrapper.unableFindValueFactory( ex ) ; - } - } - - return factory ; - } - - public OAInvocationInfo peekInvocationInfo() - { - synchronized (this) { - checkShutdownState(); - } - StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ; - return (OAInvocationInfo)(stack.peek()) ; - } - - public void pushInvocationInfo( OAInvocationInfo info ) - { - synchronized (this) { - checkShutdownState(); - } - StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ; - stack.push( info ) ; - } - - public OAInvocationInfo popInvocationInfo() - { - synchronized (this) { - checkShutdownState(); - } - StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ; - return (OAInvocationInfo)(stack.pop()) ; - } - - /** - * The bad server id handler is used by the Locator to - * send back the location of a persistant server to the client. - */ - - private Object badServerIdHandlerAccessLock = new Object(); - - public void initBadServerIdHandler() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (badServerIdHandlerAccessLock) { - Class cls = configData.getBadServerIdHandler() ; - if (cls != null) { - try { - Class[] params = new Class[] { org.omg.CORBA.ORB.class }; - java.lang.Object[] args = new java.lang.Object[]{this}; - Constructor cons = cls.getConstructor(params); - badServerIdHandler = - (BadServerIdHandler) cons.newInstance(args); - } catch (Exception e) { - throw wrapper.errorInitBadserveridhandler( e ) ; - } - } - } - } - - public void setBadServerIdHandler( BadServerIdHandler handler ) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (badServerIdHandlerAccessLock) { - badServerIdHandler = handler; - } - } - - public void handleBadServerId( ObjectKey okey ) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (badServerIdHandlerAccessLock) { - if (badServerIdHandler == null) - throw wrapper.badServerId() ; - else - badServerIdHandler.handle( okey ) ; - } - } - - public synchronized org.omg.CORBA.Policy create_policy( int type, - org.omg.CORBA.Any val ) throws org.omg.CORBA.PolicyError - { - checkShutdownState() ; - - return pihandler.create_policy( type, val ) ; - } - - /** This is the implementation of the public API used to connect - * a servant-skeleton to the ORB. - */ - public synchronized void connect(org.omg.CORBA.Object servant) - { - checkShutdownState(); - if (getTOAFactory() == null) - throw wrapper.noToa() ; - - try { - String codebase = javax.rmi.CORBA.Util.getCodebase( servant.getClass() ) ; - getTOAFactory().getTOA( codebase ).connect( servant ) ; - } catch ( Exception ex ) { - throw wrapper.orbConnectError( ex ) ; - } - } - - public synchronized void disconnect(org.omg.CORBA.Object obj) - { - checkShutdownState(); - if (getTOAFactory() == null) - throw wrapper.noToa() ; - - try { - getTOAFactory().getTOA().disconnect( obj ) ; - } catch ( Exception ex ) { - throw wrapper.orbConnectError( ex ) ; - } - } - - public int getTransientServerId() - { - synchronized (this) { - checkShutdownState(); - } - if( configData.getORBServerIdPropertySpecified( ) ) { - // ORBServerId is specified then use that value - return configData.getPersistentServerId( ); - } - return transientServerId; - } - - public RequestDispatcherRegistry getRequestDispatcherRegistry() - { - synchronized (this) { - checkShutdownState(); - } - return requestDispatcherRegistry; - } - - public ServiceContextRegistry getServiceContextRegistry() - { - synchronized (this) { - checkShutdownState(); - } - return serviceContextRegistry ; - } - - // XXX All of the isLocalXXX checking needs to be revisited. - // First of all, all three of these methods are called from - // only one place in impl.ior.IORImpl. Second, we have problems - // both with multi-homed hosts and with multi-profile IORs. - // A possible strategy: like the LocalClientRequestDispatcher, we need - // to determine this more abstractly at the ContactInfo level. - // This level should probably just get the CorbaContactInfoList from - // the IOR, then iterator over ContactInfo. If any ContactInfo is - // local, the IOR is local, and we can pick one to create the - // LocalClientRequestDispatcher as well. Bottom line: this code needs to move. - - // XXX What about multi-homed host? - public boolean isLocalHost( String hostName ) - { - synchronized (this) { - checkShutdownState(); - } - return hostName.equals( configData.getORBServerHost() ) || - hostName.equals( getLocalHostName() ) ; - } - - public boolean isLocalServerId( int subcontractId, int serverId ) - { - synchronized (this) { - checkShutdownState(); - } - if ((subcontractId < ORBConstants.FIRST_POA_SCID) || - (subcontractId > ORBConstants.MAX_POA_SCID)) - return serverId == getTransientServerId( ) ; - - // XXX isTransient info should be stored in subcontract registry - if (ORBConstants.isTransient( subcontractId )) - return (serverId == getTransientServerId()) ; - else if (configData.getPersistentServerIdInitialized()) - return (serverId == configData.getPersistentServerId()) ; - else - return false ; - } - - /************************************************************************* - * The following public methods are for ORB shutdown. - *************************************************************************/ - - private String getHostName(String host) - throws java.net.UnknownHostException - { - return InetAddress.getByName( host ).getHostAddress(); - } - - /* keeping a copy of the getLocalHostName so that it can only be called - * internally and the unauthorized clients cannot have access to the - * localHost information, originally, the above code was calling - * getLocalHostName from Connection.java. If the hostname is cached in - * Connection.java, then - * it is a security hole, since any unauthorized client has access to - * the host information. With this change it is used internally so the - * security problem is resolved. Also in Connection.java, the - * getLocalHost() implementation has changed to always call the - * InetAddress.getLocalHost().getHostAddress() - * The above mentioned method has been removed from the connection class - */ - - private static String localHostString = null; - - private synchronized String getLocalHostName() - { - if (localHostString == null) { - try { - localHostString = InetAddress.getLocalHost().getHostAddress(); - } catch (Exception ex) { - throw wrapper.getLocalHostFailed( ex ) ; - } - } - return localHostString ; - } - - /****************************************************************************** - * The following public methods are for ORB shutdown. - * - ******************************************************************************/ - - /** This method always returns false because the ORB never needs the - * main thread to do work. - */ - public synchronized boolean work_pending() - { - checkShutdownState(); - throw wrapper.genericNoImpl() ; - } - - /** This method does nothing. It is not required by the spec to do anything! - */ - public synchronized void perform_work() - { - checkShutdownState(); - throw wrapper.genericNoImpl() ; - } - - public synchronized void set_delegate(java.lang.Object servant){ - checkShutdownState(); - - POAFactory poaFactory = getPOAFactory() ; - if (poaFactory != null) - ((org.omg.PortableServer.Servant)servant) - ._set_delegate( poaFactory.getDelegateImpl() ) ; - else - throw wrapper.noPoa() ; - } - - //////////////////////////////////////////////////// - // - // pept.broker.Broker - // - - public ClientInvocationInfo createOrIncrementInvocationInfo() - { - synchronized (this) { - checkShutdownState(); - } - StackImpl invocationInfoStack = - (StackImpl) clientInvocationInfoStack.get(); - ClientInvocationInfo clientInvocationInfo = null; - if (!invocationInfoStack.empty()) { - clientInvocationInfo = - (ClientInvocationInfo) invocationInfoStack.peek(); - } - if ((clientInvocationInfo == null) || - (!clientInvocationInfo.isRetryInvocation())) - { - // This is a new call - not a retry. - clientInvocationInfo = new CorbaInvocationInfo(this); - startingDispatch(); - invocationInfoStack.push(clientInvocationInfo); - } - // Reset retry so recursive calls will get a new info object. - clientInvocationInfo.setIsRetryInvocation(false); - clientInvocationInfo.incrementEntryCount(); - return clientInvocationInfo; - } - - public void releaseOrDecrementInvocationInfo() - { - synchronized (this) { - checkShutdownState(); - } - int entryCount = -1; - ClientInvocationInfo clientInvocationInfo = null; - StackImpl invocationInfoStack = - (StackImpl)clientInvocationInfoStack.get(); - if (!invocationInfoStack.empty()) { - clientInvocationInfo = - (ClientInvocationInfo)invocationInfoStack.peek(); - } else { - throw wrapper.invocationInfoStackEmpty() ; - } - clientInvocationInfo.decrementEntryCount(); - entryCount = clientInvocationInfo.getEntryCount(); - if (clientInvocationInfo.getEntryCount() == 0) { - // 6763340: don't pop if this is a retry! - if (!clientInvocationInfo.isRetryInvocation()) { - invocationInfoStack.pop(); - } - finishedDispatch(); - } - } - - public ClientInvocationInfo getInvocationInfo() - { - synchronized (this) { - checkShutdownState(); - } - StackImpl invocationInfoStack = - (StackImpl) clientInvocationInfoStack.get(); - return (ClientInvocationInfo) invocationInfoStack.peek(); - } - - //////////////////////////////////////////////////// - // - // - // - - private Object clientDelegateFactoryAccessorLock = new Object(); - - public void setClientDelegateFactory( ClientDelegateFactory factory ) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (clientDelegateFactoryAccessorLock) { - clientDelegateFactory = factory ; - } - } - - public ClientDelegateFactory getClientDelegateFactory() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (clientDelegateFactoryAccessorLock) { - return clientDelegateFactory ; - } - } - - private Object corbaContactInfoListFactoryAccessLock = new Object(); - - public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory ) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (corbaContactInfoListFactoryAccessLock) { - corbaContactInfoListFactory = factory ; - } - } - - public synchronized CorbaContactInfoListFactory getCorbaContactInfoListFactory() - { - checkShutdownState(); - return corbaContactInfoListFactory ; - } - - /** Set the resolver used in this ORB. This resolver will be used for list_initial_services - * and resolve_initial_references. - */ - public void setResolver( Resolver resolver ) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (resolverLock) { - this.resolver = resolver ; - } - } - - /** Get the resolver used in this ORB. This resolver will be used for list_initial_services - * and resolve_initial_references. - */ - public Resolver getResolver() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (resolverLock) { - return resolver ; - } - } - - /** Set the LocalResolver used in this ORB. This LocalResolver is used for - * register_initial_reference only. - */ - public void setLocalResolver( LocalResolver resolver ) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (resolverLock) { - this.localResolver = resolver ; - } - } - - /** Get the LocalResolver used in this ORB. This LocalResolver is used for - * register_initial_reference only. - */ - public LocalResolver getLocalResolver() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (resolverLock) { - return localResolver ; - } - } - - /** Set the operation used in string_to_object calls. The Operation must expect a - * String and return an org.omg.CORBA.Object. - */ - public void setURLOperation( Operation stringToObject ) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (urlOperationLock) { - urlOperation = stringToObject ; - } - } - - /** Get the operation used in string_to_object calls. The Operation must expect a - * String and return an org.omg.CORBA.Object. - */ - public Operation getURLOperation() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (urlOperationLock) { - return urlOperation ; - } - } - - public void setINSDelegate( CorbaServerRequestDispatcher sdel ) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (resolverLock) { - insNamingDelegate = sdel ; - } - } - - public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() - { - synchronized (this) { - checkShutdownState(); - } - return taggedComponentFactoryFinder ; - } - - public IdentifiableFactoryFinder getTaggedProfileFactoryFinder() - { - synchronized (this) { - checkShutdownState(); - } - return taggedProfileFactoryFinder ; - } - - public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() - { - synchronized (this) { - checkShutdownState(); - } - return taggedProfileTemplateFactoryFinder ; - } - - private Object objectKeyFactoryAccessLock = new Object(); - - public ObjectKeyFactory getObjectKeyFactory() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (objectKeyFactoryAccessLock) { - return objectKeyFactory ; - } - } - - public void setObjectKeyFactory( ObjectKeyFactory factory ) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (objectKeyFactoryAccessLock) { - objectKeyFactory = factory ; - } - } - - private Object transportManagerAccessorLock = new Object(); - - public TransportManager getTransportManager() - { - synchronized (transportManagerAccessorLock) { - if (transportManager == null) { - transportManager = new CorbaTransportManagerImpl(this); - } - return transportManager; - } - } - - public CorbaTransportManager getCorbaTransportManager() - { - return (CorbaTransportManager) getTransportManager(); - } - - private Object legacyServerSocketManagerAccessLock = new Object(); - - public LegacyServerSocketManager getLegacyServerSocketManager() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (legacyServerSocketManagerAccessLock) { - if (legacyServerSocketManager == null) { - legacyServerSocketManager = new LegacyServerSocketManagerImpl(this); - } - return legacyServerSocketManager; - } - } - - private Object threadPoolManagerAccessLock = new Object(); - - public void setThreadPoolManager(ThreadPoolManager mgr) - { - synchronized (this) { - checkShutdownState(); - } - synchronized (threadPoolManagerAccessLock) { - threadpoolMgr = mgr; - } - } - - public ThreadPoolManager getThreadPoolManager() - { - synchronized (this) { - checkShutdownState(); - } - synchronized (threadPoolManagerAccessLock) { - if (threadpoolMgr == null) { - threadpoolMgr = new ThreadPoolManagerImpl(); - orbOwnsThreadPoolManager = true; - } - return threadpoolMgr; - } - } - - public CopierManager getCopierManager() - { - synchronized (this) { - checkShutdownState(); - } - return copierManager ; - } - - @Override - public void validateIORClass(String iorClassName) { - if (iorTypeCheckRegistry != null) { - if (!iorTypeCheckRegistry.isValidIORType(iorClassName)) { - throw ORBUtilSystemException.get( this, - CORBALogDomains.OA_IOR ).badStringifiedIor(); - } - } - } - -} // Class ORBImpl - -//////////////////////////////////////////////////////////////////////// -/// Helper class for a Synchronization Variable -//////////////////////////////////////////////////////////////////////// - -class SynchVariable -{ - // Synchronization Variable - public boolean _flag; - - // Constructor - SynchVariable() - { - _flag = false; - } - - // set Flag to true - public void set() - { - _flag = true; - } - - // get value - public boolean value() - { - return _flag; - } - - // reset Flag to true - public void reset() - { - _flag = false; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java 2018-01-30 20:18:58.000000000 -0500 +++ /dev/null 2018-01-30 20:18:58.000000000 -0500 @@ -1,780 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.orb; - -import java.util.Collection; -import java.util.Properties; -import java.util.Hashtable; - -import java.applet.Applet; - -import java.net.URL; - -import java.io.IOException ; - -import java.util.logging.Logger ; - -import org.omg.CORBA.Context; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.Environment; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.ORBPackage.InvalidName; -import org.omg.CORBA.NVList; -import org.omg.CORBA.TCKind; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.Object; -import org.omg.CORBA.Request; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Any; -import org.omg.CORBA.StructMember; -import org.omg.CORBA.UnionMember; -import org.omg.CORBA.ValueMember; -import org.omg.CORBA.Policy; -import org.omg.CORBA.PolicyError; - -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.portable.RemarshalException; - -import com.sun.corba.se.pept.protocol.ClientInvocationInfo ; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.ConnectionCache; -import com.sun.corba.se.pept.transport.Selector ; -import com.sun.corba.se.pept.transport.TransportManager; - -import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory; -import com.sun.corba.se.spi.orb.ORBData; -import com.sun.corba.se.spi.orb.Operation; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersion; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.oa.OAInvocationInfo; -import com.sun.corba.se.spi.oa.ObjectAdapter; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.protocol.ClientDelegateFactory; -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher; -import com.sun.corba.se.spi.protocol.PIHandler; -import com.sun.corba.se.spi.resolver.Resolver; -import com.sun.corba.se.spi.resolver.LocalResolver; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder; -import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder; -import com.sun.corba.se.spi.ior.ObjectKey; -import com.sun.corba.se.spi.ior.ObjectKeyFactory; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.pept.transport.ByteBufferPool ; -import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ; -import com.sun.corba.se.spi.transport.CorbaTransportManager; -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager; -import com.sun.corba.se.spi.orbutil.closure.Closure; -import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager; -import com.sun.corba.se.spi.logging.LogWrapperFactory; -import com.sun.corba.se.spi.logging.LogWrapperBase; -import com.sun.corba.se.spi.copyobject.CopierManager; -import com.sun.corba.se.spi.presentation.rmi.PresentationManager; -import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults; - -import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; - -import com.sun.corba.se.impl.corba.TypeCodeFactory; -import com.sun.corba.se.impl.corba.TypeCodeImpl; -import com.sun.corba.se.impl.corba.NVListImpl; -import com.sun.corba.se.impl.corba.NamedValueImpl; -import com.sun.corba.se.impl.corba.ExceptionListImpl; -import com.sun.corba.se.impl.corba.ContextListImpl; -import com.sun.corba.se.impl.corba.EnvironmentImpl; -import com.sun.corba.se.impl.corba.AnyImpl; -import com.sun.corba.se.impl.encoding.BufferManagerFactory; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; -import com.sun.corba.se.impl.encoding.MarshalInputStream; -import com.sun.corba.se.impl.encoding.EncapsOutputStream; -import com.sun.corba.se.impl.encoding.MarshalOutputStream; -import com.sun.corba.se.impl.oa.poa.BadServerIdHandler; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo; - -/* - * The restricted singleton ORB implementation. - * - * For now, this class must implement just enough functionality to be - * used as a factory for immutable TypeCode instances. - * - * See ORBImpl.java for the real ORB implementation. - */ -public class ORBSingleton extends ORB -{ - // This is used to support read_Object. - private ORB fullORB; - private static PresentationManager.StubFactoryFactory staticStubFactoryFactory = - PresentationDefaults.getStaticStubFactoryFactory() ; - - public void set_parameters( Properties props ) { - } - - protected void set_parameters(Applet app, Properties props) { - } - - protected void set_parameters (String params[], Properties props) { - } - - public OutputStream create_output_stream() { - return sun.corba.OutputStreamFactory.newEncapsOutputStream(this); - } - - public TypeCode create_struct_tc(String id, - String name, - StructMember[] members) - { - return new TypeCodeImpl(this, TCKind._tk_struct, id, name, members); - } - - public TypeCode create_union_tc(String id, - String name, - TypeCode discriminator_type, - UnionMember[] members) - { - return new TypeCodeImpl(this, - TCKind._tk_union, - id, - name, - discriminator_type, - members); - } - - public TypeCode create_enum_tc(String id, - String name, - String[] members) - { - return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members); - } - - public TypeCode create_alias_tc(String id, - String name, - TypeCode original_type) - { - return new TypeCodeImpl(this, TCKind._tk_alias, id, name, original_type); - } - - public TypeCode create_exception_tc(String id, - String name, - StructMember[] members) - { - return new TypeCodeImpl(this, TCKind._tk_except, id, name, members); - } - - public TypeCode create_interface_tc(String id, - String name) - { - return new TypeCodeImpl(this, TCKind._tk_objref, id, name); - } - - public TypeCode create_string_tc(int bound) { - return new TypeCodeImpl(this, TCKind._tk_string, bound); - } - - public TypeCode create_wstring_tc(int bound) { - return new TypeCodeImpl(this, TCKind._tk_wstring, bound); - } - - public TypeCode create_sequence_tc(int bound, - TypeCode element_type) - { - return new TypeCodeImpl(this, TCKind._tk_sequence, bound, element_type); - } - - public TypeCode create_recursive_sequence_tc(int bound, - int offset) - { - return new TypeCodeImpl(this, TCKind._tk_sequence, bound, offset); - } - - public TypeCode create_array_tc(int length, - TypeCode element_type) - { - return new TypeCodeImpl(this, TCKind._tk_array, length, element_type); - } - - public org.omg.CORBA.TypeCode create_native_tc(String id, - String name) - { - return new TypeCodeImpl(this, TCKind._tk_native, id, name); - } - - public org.omg.CORBA.TypeCode create_abstract_interface_tc( - String id, - String name) - { - return new TypeCodeImpl(this, TCKind._tk_abstract_interface, id, name); - } - - public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale) - { - return new TypeCodeImpl(this, TCKind._tk_fixed, digits, scale); - } - - // orbos 98-01-18: Objects By Value -- begin - - public org.omg.CORBA.TypeCode create_value_tc(String id, - String name, - short type_modifier, - TypeCode concrete_base, - ValueMember[] members) - { - return new TypeCodeImpl(this, TCKind._tk_value, id, name, - type_modifier, concrete_base, members); - } - - public org.omg.CORBA.TypeCode create_recursive_tc(String id) { - return new TypeCodeImpl(this, id); - } - - public org.omg.CORBA.TypeCode create_value_box_tc(String id, - String name, - TypeCode boxed_type) - { - return new TypeCodeImpl(this, TCKind._tk_value_box, id, name, boxed_type); - } - - public TypeCode get_primitive_tc( TCKind tckind ) - { - return get_primitive_tc( tckind.value() ) ; - } - - public Any create_any() { - return new AnyImpl(this); - } - - // TypeCodeFactory interface methods. - // Keeping track of type codes by repository id. - /* - * Not strictly needed for TypeCode factory duty but these seem - * harmless enough. - */ - - public NVList create_list(int count) { - return new NVListImpl(this, count); - } - - public org.omg.CORBA.NVList - create_operation_list(org.omg.CORBA.Object oper) { - throw wrapper.genericNoImpl() ; - } - - public org.omg.CORBA.NamedValue - create_named_value(String s, Any any, int flags) { - return new NamedValueImpl(this, s, any, flags); - } - - public org.omg.CORBA.ExceptionList create_exception_list() { - return new ExceptionListImpl(); - } - - public org.omg.CORBA.ContextList create_context_list() { - return new ContextListImpl(this); - } - - public org.omg.CORBA.Context get_default_context() - { - throw wrapper.genericNoImpl() ; - } - - public org.omg.CORBA.Environment create_environment() - { - return new EnvironmentImpl(); - } - - public org.omg.CORBA.Current get_current() - { - throw wrapper.genericNoImpl() ; - } - - /* - * Things that aren't allowed. - */ - - public String[] list_initial_services () - { - throw wrapper.genericNoImpl() ; - } - - public org.omg.CORBA.Object resolve_initial_references(String identifier) - throws InvalidName - { - throw wrapper.genericNoImpl() ; - } - - public void register_initial_reference( - String id, org.omg.CORBA.Object obj ) throws InvalidName - { - throw wrapper.genericNoImpl() ; - } - - public void send_multiple_requests_oneway(Request[] req) { - throw new SecurityException("ORBSingleton: access denied"); - } - - public void send_multiple_requests_deferred(Request[] req) { - throw new SecurityException("ORBSingleton: access denied"); - } - - public boolean poll_next_response() { - throw new SecurityException("ORBSingleton: access denied"); - } - - public org.omg.CORBA.Request get_next_response() { - throw new SecurityException("ORBSingleton: access denied"); - } - - public String object_to_string(org.omg.CORBA.Object obj) { - throw new SecurityException("ORBSingleton: access denied"); - } - - public org.omg.CORBA.Object string_to_object(String s) { - throw new SecurityException("ORBSingleton: access denied"); - } - - public java.rmi.Remote string_to_remote(String s) - throws java.rmi.RemoteException - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public void connect(org.omg.CORBA.Object servant) { - throw new SecurityException("ORBSingleton: access denied"); - } - - public void disconnect(org.omg.CORBA.Object obj) { - throw new SecurityException("ORBSingleton: access denied"); - } - - public void run() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public void shutdown(boolean wait_for_completion) - { - throw new SecurityException("ORBSingleton: access denied"); - } - - protected void shutdownServants(boolean wait_for_completion) { - throw new SecurityException("ORBSingleton: access denied"); - } - - protected void destroyConnections() { - throw new SecurityException("ORBSingleton: access denied"); - } - - public void destroy() { - throw new SecurityException("ORBSingleton: access denied"); - } - - public boolean work_pending() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public void perform_work() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public org.omg.CORBA.portable.ValueFactory register_value_factory(String repositoryID, - org.omg.CORBA.portable.ValueFactory factory) - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public void unregister_value_factory(String repositoryID) - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public org.omg.CORBA.portable.ValueFactory lookup_value_factory(String repositoryID) - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public TransportManager getTransportManager() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public CorbaTransportManager getCorbaTransportManager() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public LegacyServerSocketManager getLegacyServerSocketManager() - { - throw new SecurityException("ORBSingleton: access denied"); - } - -/************************************************************************* - These are methods from com.sun.corba.se.impl.se.core.ORB - ************************************************************************/ - - private synchronized ORB getFullORB() - { - if (fullORB == null) { - Properties props = new Properties() ; - fullORB = new ORBImpl() ; - fullORB.set_parameters( props ) ; - } - - return fullORB ; - } - - public RequestDispatcherRegistry getRequestDispatcherRegistry() - { - // To enable read_Object. - - return getFullORB().getRequestDispatcherRegistry(); - } - - /** - * Return the service context registry - */ - public ServiceContextRegistry getServiceContextRegistry() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - /** - * Get the transient server ID - */ - public int getTransientServerId() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - /** - * Return the bootstrap naming port specified in the ORBInitialPort param. - */ - public int getORBInitialPort() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - /** - * Return the bootstrap naming host specified in the ORBInitialHost param. - */ - public String getORBInitialHost() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public String getORBServerHost() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public int getORBServerPort() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public CodeSetComponentInfo getCodeSetComponentInfo() - { - return new CodeSetComponentInfo(); - } - - public boolean isLocalHost( String host ) - { - // To enable read_Object. - return false; - } - - public boolean isLocalServerId( int subcontractId, int serverId ) - { - // To enable read_Object. - return false; - } - - /* - * Things from corba.ORB. - */ - - public ORBVersion getORBVersion() - { - // Always use our latest ORB version (latest fixes, etc) - return ORBVersionFactory.getORBVersion(); - } - - public void setORBVersion(ORBVersion verObj) - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public String getAppletHost() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public URL getAppletCodeBase() - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public int getHighWaterMark(){ - throw new SecurityException("ORBSingleton: access denied"); - } - - public int getLowWaterMark(){ - throw new SecurityException("ORBSingleton: access denied"); - } - - public int getNumberToReclaim(){ - throw new SecurityException("ORBSingleton: access denied"); - } - - public int getGIOPFragmentSize() { - return ORBConstants.GIOP_DEFAULT_BUFFER_SIZE; - } - - public int getGIOPBuffMgrStrategy(GIOPVersion gv) { - return BufferManagerFactory.GROW; - } - - public IOR getFVDCodeBaseIOR(){ - throw new SecurityException("ORBSingleton: access denied"); - } - - public Policy create_policy( int type, Any val ) throws PolicyError - { - throw new NO_IMPLEMENT(); - } - - public LegacyServerSocketEndPointInfo getServerEndpoint() - { - return null ; - } - - public void setPersistentServerId( int id ) - { - } - - public TypeCodeImpl getTypeCodeForClass( Class c ) - { - return null ; - } - - public void setTypeCodeForClass( Class c, TypeCodeImpl tcimpl ) - { - } - - public boolean alwaysSendCodeSetServiceContext() - { - return true ; - } - - public boolean isDuringDispatch() - { - return false ; - } - - public void notifyORB() { } - - public PIHandler getPIHandler() - { - return null ; - } - - public void checkShutdownState() - { - } - - public void startingDispatch() - { - } - - public void finishedDispatch() - { - } - - public void registerInitialReference( String id, Closure closure ) - { - } - - public ORBData getORBData() - { - return getFullORB().getORBData() ; - } - - public void setClientDelegateFactory( ClientDelegateFactory factory ) - { - } - - public ClientDelegateFactory getClientDelegateFactory() - { - return getFullORB().getClientDelegateFactory() ; - } - - public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory ) - { - } - - public CorbaContactInfoListFactory getCorbaContactInfoListFactory() - { - return getFullORB().getCorbaContactInfoListFactory() ; - } - - public Operation getURLOperation() - { - return null ; - } - - public void setINSDelegate( CorbaServerRequestDispatcher sdel ) - { - } - - public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() - { - return getFullORB().getTaggedComponentFactoryFinder() ; - } - - public IdentifiableFactoryFinder getTaggedProfileFactoryFinder() - { - return getFullORB().getTaggedProfileFactoryFinder() ; - } - - public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() - { - return getFullORB().getTaggedProfileTemplateFactoryFinder() ; - } - - public ObjectKeyFactory getObjectKeyFactory() - { - return getFullORB().getObjectKeyFactory() ; - } - - public void setObjectKeyFactory( ObjectKeyFactory factory ) - { - throw new SecurityException("ORBSingleton: access denied"); - } - - public void handleBadServerId( ObjectKey okey ) - { - } - - public OAInvocationInfo peekInvocationInfo() - { - return null ; - } - - public void pushInvocationInfo( OAInvocationInfo info ) - { - } - - public OAInvocationInfo popInvocationInfo() - { - return null ; - } - - public ClientInvocationInfo createOrIncrementInvocationInfo() - { - return null ; - } - - public void releaseOrDecrementInvocationInfo() - { - } - - public ClientInvocationInfo getInvocationInfo() - { - return null ; - } - - public ConnectionCache getConnectionCache(ContactInfo contactInfo) - { - return null; - } - - public void setResolver( Resolver resolver ) - { - } - - public Resolver getResolver() - { - return null ; - } - - public void setLocalResolver( LocalResolver resolver ) - { - } - - public LocalResolver getLocalResolver() - { - return null ; - } - - public void setURLOperation( Operation stringToObject ) - { - } - - // NOTE: REMOVE THIS METHOD ONCE WE HAVE A ORT BASED ORBD - public void setBadServerIdHandler( BadServerIdHandler handler ) - { - } - - // NOTE: REMOVE THIS METHOD ONCE WE HAVE A ORT BASED ORBD - public void initBadServerIdHandler() - { - } - - public Selector getSelector(int x) - { - return null; - } - - public void setThreadPoolManager(ThreadPoolManager mgr) { - } - - public ThreadPoolManager getThreadPoolManager() { - return null; - } - - public CopierManager getCopierManager() { - return null ; - } - - @Override - public void validateIORClass(String iorClassName) { - getFullORB().validateIORClass(iorClassName); - - } - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBVersionImpl.java 2018-01-30 20:18:59.000000000 -0500 +++ /dev/null 2018-01-30 20:18:59.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.orb ; - -import org.omg.CORBA.portable.OutputStream ; - -import com.sun.corba.se.spi.orb.ORBVersion ; - -public class ORBVersionImpl implements ORBVersion { - private byte orbType ; - - public ORBVersionImpl( byte orbType ) - { - this.orbType = orbType ; - } - - public static final ORBVersion FOREIGN = new ORBVersionImpl( - ORBVersion.FOREIGN ) ; - - public static final ORBVersion OLD = new ORBVersionImpl( - ORBVersion.OLD ) ; - - public static final ORBVersion NEW = new ORBVersionImpl( - ORBVersion.NEW ) ; - - public static final ORBVersion JDK1_3_1_01 = new ORBVersionImpl( - ORBVersion.JDK1_3_1_01 ) ; - - public static final ORBVersion NEWER = new ORBVersionImpl( - ORBVersion.NEWER ) ; - - public static final ORBVersion PEORB = new ORBVersionImpl( - ORBVersion.PEORB ) ; - - public byte getORBType() - { - return orbType ; - } - - public void write( OutputStream os ) - { - os.write_octet( (byte)orbType ) ; - } - - public String toString() - { - return "ORBVersionImpl[" + Byte.toString( orbType ) + "]" ; - } - - public boolean equals( Object obj ) - { - if (!(obj instanceof ORBVersion)) - return false ; - - ORBVersion version = (ORBVersion)obj ; - return version.getORBType() == orbType ; - } - - public int hashCode() - { - return orbType ; - } - - public boolean lessThan(ORBVersion version) { - return orbType < version.getORBType(); - } - - public int compareTo(Object obj) { - // The Comparable interface says that this - // method throws a ClassCastException if the - // given object's type prevents it from being - // compared. - return getORBType() - ((ORBVersion)obj).getORBType(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserAction.java 2018-01-30 20:18:59.000000000 -0500 +++ /dev/null 2018-01-30 20:18:59.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orb ; - -import java.util.Properties ; - -public interface ParserAction { - /** Return the property name or prefix for which this action - * is applied. - */ - String getPropertyName() ; - - /** Return whether this action is for an exact match or a prefix - * match (true). - */ - boolean isPrefix() ; - - /** Return the field name in an object that is set with the result - */ - String getFieldName() ; - - /** Apply this action to props and return the result. - */ - Object apply( Properties props ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionBase.java 2018-01-30 20:19:00.000000000 -0500 +++ /dev/null 2018-01-30 20:19:00.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orb ; - -import java.util.Properties ; - -import com.sun.corba.se.spi.orb.Operation ; - -public abstract class ParserActionBase implements ParserAction { - private String propertyName ; - private boolean prefix ; - private Operation operation ; - private String fieldName ; - - public int hashCode() - { - return propertyName.hashCode() ^ operation.hashCode() ^ - fieldName.hashCode() ^ (prefix ? 0 : 1) ; - } - - public boolean equals( Object obj ) - { - if (obj == this) - return true ; - - if (!(obj instanceof ParserActionBase)) - return false ; - - ParserActionBase other = (ParserActionBase)obj ; - - return propertyName.equals( other.propertyName ) && - prefix == other.prefix && - operation.equals( other.operation ) && - fieldName.equals( other.fieldName ) ; - } - - public ParserActionBase( String propertyName, boolean prefix, - Operation operation, String fieldName ) - { - this.propertyName = propertyName ; - this.prefix = prefix ; - this.operation = operation ; - this.fieldName = fieldName ; - } - - public String getPropertyName() - { - return propertyName ; - } - - public boolean isPrefix() - { - return prefix ; - } - - public String getFieldName() - { - return fieldName ; - } - - public abstract Object apply( Properties props ) ; - - protected Operation getOperation() - { - return operation ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionFactory.java 2018-01-30 20:19:01.000000000 -0500 +++ /dev/null 2018-01-30 20:19:01.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orb ; - -import com.sun.corba.se.spi.orb.Operation ; - -public class ParserActionFactory{ - private ParserActionFactory() {} - - public static ParserAction makeNormalAction( String propertyName, - Operation operation, String fieldName ) - { - return new NormalParserAction( propertyName, operation, fieldName ) ; - } - - public static ParserAction makePrefixAction( String propertyName, - Operation operation, String fieldName, Class componentType ) - { - return new PrefixParserAction( propertyName, operation, fieldName, componentType ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserDataBase.java 2018-01-30 20:19:01.000000000 -0500 +++ /dev/null 2018-01-30 20:19:01.000000000 -0500 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orb ; - -import com.sun.corba.se.spi.orb.ParserData ; -import com.sun.corba.se.spi.orb.Operation ; - -public abstract class ParserDataBase implements ParserData { - private String propertyName ; - private Operation operation ; - private String fieldName ; - private Object defaultValue ; - private Object testValue ; - - protected ParserDataBase( String propertyName, - Operation operation, String fieldName, Object defaultValue, - Object testValue ) - { - this.propertyName = propertyName ; - this.operation = operation ; - this.fieldName = fieldName ; - this.defaultValue = defaultValue ; - this.testValue = testValue ; - } - - public String getPropertyName() { return propertyName ; } - public Operation getOperation() { return operation ; } - public String getFieldName() { return fieldName ; } - public Object getDefaultValue() { return defaultValue ; } - public Object getTestValue() { return testValue ; } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserTable.java 2018-01-30 20:19:02.000000000 -0500 +++ /dev/null 2018-01-30 20:19:02.000000000 -0500 @@ -1,1110 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orb ; - -import java.net.URL ; -import java.net.InetSocketAddress; -import java.net.Socket ; -import java.net.ServerSocket ; - -import java.io.IOException ; - -import java.util.HashMap ; -import java.util.List; -import java.util.Map ; - -import java.security.AccessController ; -import java.security.PrivilegedExceptionAction ; -import java.security.PrivilegedActionException ; - -import org.omg.PortableInterceptor.ORBInitializer ; -import org.omg.PortableInterceptor.ORBInitInfo ; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.ContactInfoList; -import com.sun.corba.se.pept.transport.EventHandler; -import com.sun.corba.se.pept.transport.InboundConnectionCache; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.ObjectKey ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.Operation ; -import com.sun.corba.se.spi.orb.OperationFactory ; -import com.sun.corba.se.spi.orb.ParserData ; -import com.sun.corba.se.spi.orb.ParserDataFactory ; -import com.sun.corba.se.spi.orb.StringPair ; -import com.sun.corba.se.spi.transport.CorbaContactInfoList; -import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory; -import com.sun.corba.se.spi.transport.CorbaTransportManager; -import com.sun.corba.se.spi.transport.IORToSocketInfo; -import com.sun.corba.se.spi.transport.ReadTimeouts; -import com.sun.corba.se.spi.transport.SocketInfo; -import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo; -import com.sun.corba.se.spi.transport.TransportDefault; - -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry ; -import com.sun.corba.se.impl.legacy.connection.USLPort ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; -import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr ; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr ; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr ; -import com.sun.corba.se.impl.transport.DefaultIORToSocketInfoImpl; -import com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl; - -import sun.corba.SharedSecrets; - -/** Initialize the parser data for the standard ORB parser. This is used both - * to implement ORBDataParserImpl and to provide the basic testing framework - * for ORBDataParserImpl. - */ -public class ParserTable { - private static String MY_CLASS_NAME = ParserTable.class.getName() ; - - private static ParserTable myInstance = new ParserTable() ; - - private ORBUtilSystemException wrapper ; - - public static ParserTable get() - { - return myInstance ; - } - - private ParserData[] parserData ; - - public ParserData[] getParserData() - { - ParserData[] parserArray = new ParserData[parserData.length]; - System.arraycopy(parserData, 0, parserArray, 0, parserData.length); - return parserArray; - } - - private ParserTable() { - wrapper = ORBUtilSystemException.get( CORBALogDomains.ORB_LIFECYCLE ) ; - - String codeSetTestString = - OSFCodeSetRegistry.ISO_8859_1_VALUE + "," + - OSFCodeSetRegistry.UTF_16_VALUE + "," + - OSFCodeSetRegistry.ISO_646_VALUE ; - - String[] debugTestData = { "subcontract", "poa", "transport" } ; - - USLPort[] USLPorts = { new USLPort( "FOO", 2701 ), new USLPort( "BAR", 3333 ) } ; - - ReadTimeouts readTimeouts = - TransportDefault.makeReadTimeoutsFactory().create( - ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR); - - ORBInitializer[] TestORBInitializers = - { null, - new TestORBInitializer1(), - new TestORBInitializer2() } ; - StringPair[] TestORBInitData = { - new StringPair( "foo.bar.blech.NonExistent", "dummy" ), - new StringPair( MY_CLASS_NAME + "$TestORBInitializer1", "dummy" ), - new StringPair( MY_CLASS_NAME + "$TestORBInitializer2", "dummy" ) } ; - - Acceptor[] TestAcceptors = - { new TestAcceptor2(), - new TestAcceptor1(), - null } ; - // REVISIT: The test data gets put into a Properties object where - // order is not guaranteed. Thus the above array is in reverse. - StringPair[] TestAcceptorData = { - new StringPair( "foo.bar.blech.NonExistent", "dummy" ), - new StringPair( MY_CLASS_NAME + "$TestAcceptor1", "dummy" ), - new StringPair( MY_CLASS_NAME + "$TestAcceptor2", "dummy" ) } ; - - StringPair[] TestORBInitRefData = - { new StringPair( "Foo", "ior:930492049394" ), - new StringPair( "Bar", "ior:3453465785633576" ) } ; - - URL testServicesURL = null ; - String testServicesString = "corbaloc::camelot/NameService" ; - - try { - testServicesURL = new URL( testServicesString ) ; - } catch (Exception exc) { - } - - // propertyName, - // operation, - // fieldName, defaultValue, - // testValue, testData (string or Pair[]) - ParserData[] pd = { - ParserDataFactory.make( ORBConstants.DEBUG_PROPERTY, - OperationFactory.listAction( ",", OperationFactory.stringAction()), - "debugFlags", new String[0], - debugTestData, "subcontract,poa,transport" ), - ParserDataFactory.make( ORBConstants.INITIAL_HOST_PROPERTY, - OperationFactory.stringAction(), - "ORBInitialHost", "", - "Foo", "Foo" ), - ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY, - OperationFactory.integerAction(), - "ORBInitialPort", new Integer( ORBConstants.DEFAULT_INITIAL_PORT ), - new Integer( 27314 ), "27314" ), - // Where did this come from? - //ParserDataFactory.make( ORBConstants.INITIAL_PORT_PROPERTY, - //OperationFactory.booleanAction(), - //"ORBInitialPortInitialized", Boolean.FALSE, - //Boolean.TRUE, "27314" ), - ParserDataFactory.make( ORBConstants.SERVER_HOST_PROPERTY, - OperationFactory.stringAction(), - "ORBServerHost", "", - "camelot", "camelot" ), - ParserDataFactory.make( ORBConstants.SERVER_PORT_PROPERTY, - OperationFactory.integerAction(), - "ORBServerPort", new Integer( 0 ), - new Integer( 38143 ), "38143" ), - // NOTE: We are putting SERVER_HOST_NAME configuration info into - // DataCollectorBase to avoid a security hole. However, that forces - // us to also set LISTEN_ON_ALL_INTERFACES at the same time. - // This all needs to be cleaned up for two reasons: to get configuration - // out of DataCollectorBase and to correctly support multihoming. - ParserDataFactory.make( ORBConstants.LISTEN_ON_ALL_INTERFACES, - OperationFactory.stringAction(), - "listenOnAllInterfaces", ORBConstants.LISTEN_ON_ALL_INTERFACES, - "foo", "foo" ), - ParserDataFactory.make( ORBConstants.ORB_ID_PROPERTY, - OperationFactory.stringAction(), - "orbId", "", - "foo", "foo" ), - ParserDataFactory.make( ORBConstants.OLD_ORB_ID_PROPERTY, - OperationFactory.stringAction(), - "orbId", "", - "foo", "foo" ), - ParserDataFactory.make( ORBConstants.ORB_SERVER_ID_PROPERTY, - OperationFactory.integerAction(), - "persistentServerId", new Integer(-1), - new Integer( 1234), "1234" ), - ParserDataFactory.make( - ORBConstants.ORB_SERVER_ID_PROPERTY, - OperationFactory.setFlagAction(), - "persistentServerIdInitialized", Boolean.FALSE, - Boolean.TRUE, "1234" ), - ParserDataFactory.make( - ORBConstants.ORB_SERVER_ID_PROPERTY, - OperationFactory.setFlagAction(), - "orbServerIdPropertySpecified", Boolean.FALSE, - Boolean.TRUE, "1234" ), - // REVISIT after switch - // ParserDataFactory.make( ORBConstants.INITIAL_SERVICES_PROPERTY, - // OperationFactory.URLAction(), - // "servicesURL", null, - // testServicesURL, testServicesString ), - // ParserDataFactory.make( ORBConstants.DEFAULT_INIT_REF_PROPERTY, - // OperationFactory.stringAction(), - // "defaultInitRef", null, - // "Fooref", "Fooref" ), - ParserDataFactory.make( ORBConstants.HIGH_WATER_MARK_PROPERTY, - OperationFactory.integerAction(), - "highWaterMark", new Integer( 240 ), - new Integer( 3745 ), "3745" ), - ParserDataFactory.make( ORBConstants.LOW_WATER_MARK_PROPERTY, - OperationFactory.integerAction(), - "lowWaterMark", new Integer( 100 ), - new Integer( 12 ), "12" ), - ParserDataFactory.make( ORBConstants.NUMBER_TO_RECLAIM_PROPERTY, - OperationFactory.integerAction(), - "numberToReclaim", new Integer( 5 ), - new Integer( 231 ), "231" ), - ParserDataFactory.make( ORBConstants.GIOP_VERSION, - makeGVOperation(), - "giopVersion", GIOPVersion.DEFAULT_VERSION, - new GIOPVersion( 2, 3 ), "2.3" ), - ParserDataFactory.make( ORBConstants.GIOP_FRAGMENT_SIZE, - makeFSOperation(), "giopFragmentSize", - new Integer( ORBConstants.GIOP_DEFAULT_FRAGMENT_SIZE ), - new Integer( 65536 ), "65536" ), - ParserDataFactory.make( ORBConstants.GIOP_BUFFER_SIZE, - OperationFactory.integerAction(), - "giopBufferSize", new Integer( ORBConstants.GIOP_DEFAULT_BUFFER_SIZE ), - new Integer( 234000 ), "234000" ), - ParserDataFactory.make( ORBConstants.GIOP_11_BUFFMGR, - makeBMGROperation(), - "giop11BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_11_BUFFMGR ), - new Integer( 1 ), "CLCT" ), - ParserDataFactory.make( ORBConstants.GIOP_12_BUFFMGR, - makeBMGROperation(), - "giop12BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_12_BUFFMGR ), - new Integer( 0 ), "GROW" ), - - // Note that the same property is used to set two different - // fields here. This requires that both entries use the same test - // data, or the test will fail. - ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING, - OperationFactory.compose( OperationFactory.integerRangeAction( 0, 3 ), - OperationFactory.convertIntegerToShort() ), - "giopTargetAddressPreference", - new Short( ORBConstants.ADDR_DISP_HANDLE_ALL ), - new Short( (short)2 ), "2" ), - ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING, - makeADOperation(), - "giopAddressDisposition", new Short( KeyAddr.value ), - new Short( (short)2 ), "2" ), - ParserDataFactory.make( ORBConstants.ALWAYS_SEND_CODESET_CTX_PROPERTY, - OperationFactory.booleanAction(), - "alwaysSendCodeSetCtx", Boolean.TRUE, - Boolean.FALSE, "false"), - ParserDataFactory.make( ORBConstants.USE_BOMS, - OperationFactory.booleanAction(), - "useByteOrderMarkers", - Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS ), - Boolean.FALSE, "false" ), - ParserDataFactory.make( ORBConstants.USE_BOMS_IN_ENCAPS, - OperationFactory.booleanAction(), - "useByteOrderMarkersInEncaps", - Boolean.valueOf( ORBConstants.DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS ), - Boolean.FALSE, "false" ), - ParserDataFactory.make( ORBConstants.CHAR_CODESETS, - makeCSOperation(), - "charData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getCharComponent(), - CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ), - ParserDataFactory.make( ORBConstants.WCHAR_CODESETS, - makeCSOperation(), - "wcharData", CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.getWCharComponent(), - CodeSetComponentInfo.createFromString( codeSetTestString ), codeSetTestString ), - ParserDataFactory.make( ORBConstants.ALLOW_LOCAL_OPTIMIZATION, - OperationFactory.booleanAction(), - "allowLocalOptimization", Boolean.FALSE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.LEGACY_SOCKET_FACTORY_CLASS_PROPERTY, - makeLegacySocketFactoryOperation(), - // No default - must be set by user if they are using - // legacy socket factory. - "legacySocketFactory", null, - new TestLegacyORBSocketFactory(), - MY_CLASS_NAME + "$TestLegacyORBSocketFactory" ), - ParserDataFactory.make( ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY, - makeSocketFactoryOperation(), - "socketFactory", new DefaultSocketFactoryImpl(), - new TestORBSocketFactory(), - MY_CLASS_NAME + "$TestORBSocketFactory" ), - ParserDataFactory.make( ORBConstants.LISTEN_SOCKET_PROPERTY, - makeUSLOperation() , - "userSpecifiedListenPorts", new USLPort[0], - USLPorts, "FOO:2701,BAR:3333" ), - ParserDataFactory.make( ORBConstants.IOR_TO_SOCKET_INFO_CLASS_PROPERTY, - makeIORToSocketInfoOperation(), - "iorToSocketInfo", new DefaultIORToSocketInfoImpl(), - new TestIORToSocketInfo(), - MY_CLASS_NAME + "$TestIORToSocketInfo" ), - ParserDataFactory.make( ORBConstants.IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY, - makeIIOPPrimaryToContactInfoOperation(), - "iiopPrimaryToContactInfo", null, - new TestIIOPPrimaryToContactInfo(), - MY_CLASS_NAME + "$TestIIOPPrimaryToContactInfo" ), - ParserDataFactory.make( ORBConstants.CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY, - makeContactInfoListFactoryOperation(), - "corbaContactInfoListFactory", null, - new TestContactInfoListFactory(), - MY_CLASS_NAME + "$TestContactInfoListFactory" ), - ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, - OperationFactory.integerAction(), - "persistentServerPort", new Integer( 0 ), - new Integer( 2743 ), "2743" ), - ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY, - OperationFactory.setFlagAction(), - "persistentPortInitialized", Boolean.FALSE, - Boolean.TRUE, "2743" ), - ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY, - OperationFactory.integerAction(), - "persistentServerId", new Integer( 0 ), - new Integer( 294 ), "294" ), - ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY, - OperationFactory.setFlagAction(), - "persistentServerIdInitialized", Boolean.FALSE, - Boolean.TRUE, "294" ), - ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY, - OperationFactory.setFlagAction(), - "orbServerIdPropertySpecified", Boolean.FALSE, - Boolean.TRUE, "294" ), - ParserDataFactory.make( ORBConstants.ACTIVATED_PROPERTY, - OperationFactory.booleanAction(), - "serverIsORBActivated", Boolean.FALSE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY, - OperationFactory.classAction(), - "badServerIdHandlerClass", null, - TestBadServerIdHandler.class, MY_CLASS_NAME + "$TestBadServerIdHandler" ), - ParserDataFactory.make( ORBConstants.PI_ORB_INITIALIZER_CLASS_PREFIX, - makeROIOperation(), - "orbInitializers", new ORBInitializer[0], - TestORBInitializers, TestORBInitData, ORBInitializer.class ), - ParserDataFactory.make( ORBConstants.ACCEPTOR_CLASS_PREFIX_PROPERTY, - makeAcceptorInstantiationOperation(), - "acceptors", new Acceptor[0], - TestAcceptors, TestAcceptorData, Acceptor.class ), - - // - // Socket/Channel control - // - - // Acceptor: - // useNIOSelector == true - // useSelectThreadToWait = true - // useWorkerThreadForEvent = false - // else - // useSelectThreadToWait = false - // useWorkerThreadForEvent = true - - // Connection: - // useNIOSelector == true - // useSelectThreadToWait = true - // useWorkerThreadForEvent = true - // else - // useSelectThreadToWait = false - // useWorkerThreadForEvent = true - - ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_TYPE_PROPERTY, - OperationFactory.stringAction(), - "acceptorSocketType", ORBConstants.SOCKETCHANNEL, - "foo", "foo" ), - - ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY, - OperationFactory.booleanAction(), - "acceptorSocketUseSelectThreadToWait", Boolean.TRUE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY, - OperationFactory.booleanAction(), - "acceptorSocketUseWorkerThreadForEvent", Boolean.TRUE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_TYPE_PROPERTY, - OperationFactory.stringAction(), - "connectionSocketType", ORBConstants.SOCKETCHANNEL, - "foo", "foo" ), - ParserDataFactory.make( ORBConstants.USE_NIO_SELECT_TO_WAIT_PROPERTY, - OperationFactory.booleanAction(), - "connectionSocketUseSelectThreadToWait", Boolean.TRUE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY, - OperationFactory.booleanAction(), - "connectionSocketUseWorkerThreadForEvent", Boolean.TRUE, - Boolean.TRUE, "true" ), - ParserDataFactory.make( ORBConstants.DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY, - OperationFactory.booleanAction(), - "disableDirectByteBufferUse", Boolean.FALSE, - Boolean.TRUE, "true" ), - ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_READ_TIMEOUTS_PROPERTY, - makeTTCPRTOperation(), - "readTimeouts", TransportDefault.makeReadTimeoutsFactory().create( - ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT, - ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR), - readTimeouts, "100:3000:300:20" ), - ParserDataFactory.make( - ORBConstants.ENABLE_JAVA_SERIALIZATION_PROPERTY, - OperationFactory.booleanAction(), - "enableJavaSerialization", Boolean.FALSE, - Boolean.FALSE, "false"), - ParserDataFactory.make( - ORBConstants.USE_REP_ID, - OperationFactory.booleanAction(), - "useRepId", Boolean.TRUE, - Boolean.TRUE, "true"), - ParserDataFactory.make( ORBConstants.ORB_INIT_REF_PROPERTY, - OperationFactory.identityAction(), - "orbInitialReferences", new StringPair[0], - TestORBInitRefData, TestORBInitRefData, StringPair.class ) - } ; - - parserData = pd ; - } - - public final class TestBadServerIdHandler implements BadServerIdHandler - { - public boolean equals( Object other ) - { - return other instanceof TestBadServerIdHandler ; - } - - public int hashCode() { - return 1; - } - - public void handle( ObjectKey objectKey ) - { - } - } - - private Operation makeTTCPRTOperation() - { - Operation[] fourIop = { OperationFactory.integerAction(), - OperationFactory.integerAction(), - OperationFactory.integerAction(), - OperationFactory.integerAction() } ; - - Operation op2 = OperationFactory.sequenceAction( ":", fourIop ) ; - - Operation rtOp = new Operation() { - public Object operate(Object value) - { - Object[] values = (Object[])value ; - Integer initialTime = (Integer)(values[0]) ; - Integer maxGIOPHdrTime = (Integer)(values[1]) ; - Integer maxGIOPBodyTime = (Integer)(values[2]) ; - Integer backoffPercent = (Integer)(values[3]) ; - return TransportDefault.makeReadTimeoutsFactory().create( - initialTime.intValue(), - maxGIOPHdrTime.intValue(), - maxGIOPBodyTime.intValue(), - backoffPercent.intValue()); - } - } ; - - Operation ttcprtOp = OperationFactory.compose(op2, rtOp); - return ttcprtOp; - } - - private Operation makeUSLOperation() - { - Operation[] siop = { OperationFactory.stringAction(), - OperationFactory.integerAction() } ; - Operation op2 = OperationFactory.sequenceAction( ":", siop ) ; - - Operation uslop = new Operation() { - public Object operate( Object value ) - { - Object[] values = (Object[])value ; - String type = (String)(values[0]) ; - Integer port = (Integer)(values[1]) ; - return new USLPort( type, port.intValue() ) ; - } - } ; - - Operation op3 = OperationFactory.compose( op2, uslop ) ; - Operation listenop = OperationFactory.listAction( ",", op3 ) ; - return listenop ; - } - - public static final class TestLegacyORBSocketFactory - implements com.sun.corba.se.spi.legacy.connection.ORBSocketFactory - { - public boolean equals( Object other ) - { - return other instanceof TestLegacyORBSocketFactory ; - } - - public int hashCode() { - return 1; - } - - public ServerSocket createServerSocket( String type, int port ) - { - return null ; - } - - public SocketInfo getEndPointInfo( org.omg.CORBA.ORB orb, - IOR ior, SocketInfo socketInfo ) - { - return null ; - } - - public Socket createSocket( SocketInfo socketInfo ) - { - return null ; - } - } - - public static final class TestORBSocketFactory - implements com.sun.corba.se.spi.transport.ORBSocketFactory - { - public boolean equals( Object other ) - { - return other instanceof TestORBSocketFactory ; - } - - public int hashCode() { - return 1; - } - - public void setORB(ORB orb) - { - } - - public ServerSocket createServerSocket( String type, InetSocketAddress a ) - { - return null ; - } - - public Socket createSocket( String type, InetSocketAddress a ) - { - return null ; - } - - public void setAcceptedSocketOptions(Acceptor acceptor, - ServerSocket serverSocket, - Socket socket) - { - } - } - - public static final class TestIORToSocketInfo - implements IORToSocketInfo - { - public boolean equals( Object other ) - { - return other instanceof TestIORToSocketInfo; - } - - public int hashCode() { - return 1; - } - - public List getSocketInfo(IOR ior) - { - return null; - } - } - - public static final class TestIIOPPrimaryToContactInfo - implements IIOPPrimaryToContactInfo - { - public void reset(ContactInfo primary) - { - } - - public boolean hasNext(ContactInfo primary, - ContactInfo previous, - List contactInfos) - { - return true; - } - - public ContactInfo next(ContactInfo primary, - ContactInfo previous, - List contactInfos) - { - return null; - } - } - - public static final class TestContactInfoListFactory - implements CorbaContactInfoListFactory - { - public boolean equals( Object other ) - { - return other instanceof TestContactInfoListFactory; - } - - public int hashCode() { - return 1; - } - - public void setORB(ORB orb) { } - - public CorbaContactInfoList create( IOR ior ) { return null; } - } - - private Operation makeMapOperation( final Map map ) - { - return new Operation() { - public Object operate( Object value ) - { - return map.get( value ) ; - } - } ; - } - - private Operation makeBMGROperation() - { - Map map = new HashMap() ; - map.put( "GROW", new Integer(0) ) ; - map.put( "CLCT", new Integer(1) ) ; - map.put( "STRM", new Integer(2) ) ; - return makeMapOperation( map ) ; - } - - private Operation makeLegacySocketFactoryOperation() - { - Operation sfop = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; - - try { - Class legacySocketFactoryClass = - SharedSecrets.getJavaCorbaAccess().loadClass(param); - // For security reasons avoid creating an instance if - // this socket factory class is not one that would fail - // the class cast anyway. - if (com.sun.corba.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) { - return legacySocketFactoryClass.newInstance(); - } else { - throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ; - } - } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or - // ClassCastException - throw wrapper.badCustomSocketFactory( ex, param ) ; - } - } - } ; - - return sfop ; - } - - private Operation makeSocketFactoryOperation() - { - Operation sfop = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; - - try { - Class socketFactoryClass = - SharedSecrets.getJavaCorbaAccess().loadClass(param); - // For security reasons avoid creating an instance if - // this socket factory class is not one that would fail - // the class cast anyway. - if (com.sun.corba.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) { - return socketFactoryClass.newInstance(); - } else { - throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ; - } - } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or - // ClassCastException - throw wrapper.badCustomSocketFactory( ex, param ) ; - } - } - } ; - - return sfop ; - } - - private Operation makeIORToSocketInfoOperation() - { - Operation op = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; - - try { - Class iorToSocketInfoClass = - SharedSecrets.getJavaCorbaAccess().loadClass(param); - // For security reasons avoid creating an instance if - // this socket factory class is not one that would fail - // the class cast anyway. - if (IORToSocketInfo.class.isAssignableFrom(iorToSocketInfoClass)) { - return iorToSocketInfoClass.newInstance(); - } else { - throw wrapper.illegalIorToSocketInfoType( iorToSocketInfoClass.toString() ) ; - } - } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or - // ClassCastException - throw wrapper.badCustomIorToSocketInfo( ex, param ) ; - } - } - } ; - - return op ; - } - - private Operation makeIIOPPrimaryToContactInfoOperation() - { - Operation op = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; - - try { - Class iiopPrimaryToContactInfoClass = - SharedSecrets.getJavaCorbaAccess().loadClass(param); - // For security reasons avoid creating an instance if - // this socket factory class is not one that would fail - // the class cast anyway. - if (IIOPPrimaryToContactInfo.class.isAssignableFrom(iiopPrimaryToContactInfoClass)) { - return iiopPrimaryToContactInfoClass.newInstance(); - } else { - throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ; - } - } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or - // ClassCastException - throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ; - } - } - } ; - - return op ; - } - - private Operation makeContactInfoListFactoryOperation() - { - Operation op = new Operation() { - public Object operate( Object value ) - { - String param = (String)value ; - - try { - Class contactInfoListFactoryClass = - SharedSecrets.getJavaCorbaAccess().loadClass(param); - // For security reasons avoid creating an instance if - // this socket factory class is not one that would fail - // the class cast anyway. - if (CorbaContactInfoListFactory.class.isAssignableFrom( - contactInfoListFactoryClass)) { - return contactInfoListFactoryClass.newInstance(); - } else { - throw wrapper.illegalContactInfoListFactoryType( - contactInfoListFactoryClass.toString() ) ; - } - } catch (Exception ex) { - // ClassNotFoundException, IllegalAccessException, - // InstantiationException, SecurityException or - // ClassCastException - throw wrapper.badContactInfoListFactory( ex, param ) ; - } - } - } ; - - return op ; - } - - private Operation makeCSOperation() - { - Operation csop = new Operation() { - public Object operate( Object value ) - { - String val = (String)value ; - return CodeSetComponentInfo.createFromString( val ) ; - } - } ; - - return csop ; - } - - private Operation makeADOperation() - { - Operation admap = new Operation() { - private Integer[] map = { - new Integer( KeyAddr.value ), - new Integer( ProfileAddr.value ), - new Integer( ReferenceAddr.value ), - new Integer( KeyAddr.value ) } ; - - public Object operate( Object value ) - { - int val = ((Integer)value).intValue() ; - return map[val] ; - } - } ; - - Operation rangeop = OperationFactory.integerRangeAction( 0, 3 ) ; - Operation op1 = OperationFactory.compose( rangeop, admap ) ; - Operation result = OperationFactory.compose( op1, OperationFactory.convertIntegerToShort() ) ; - return result ; - } - - private Operation makeFSOperation() { - Operation fschecker = new Operation() { - public Object operate( Object value ) - { - int giopFragmentSize = ((Integer)value).intValue() ; - if (giopFragmentSize < ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE){ - throw wrapper.fragmentSizeMinimum( new Integer( giopFragmentSize ), - new Integer( ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE ) ) ; - } - - if (giopFragmentSize % ORBConstants.GIOP_FRAGMENT_DIVISOR != 0) - throw wrapper.fragmentSizeDiv( new Integer( giopFragmentSize ), - new Integer( ORBConstants.GIOP_FRAGMENT_DIVISOR ) ) ; - - return value ; - } - } ; - - Operation result = OperationFactory.compose( OperationFactory.integerAction(), - fschecker ) ; - return result ; - } - - private Operation makeGVOperation() { - Operation gvHelper = OperationFactory.listAction( ".", - OperationFactory.integerAction() ) ; - Operation gvMain = new Operation() { - public Object operate( Object value ) - { - Object[] nums = (Object[])value ; - int major = ((Integer)(nums[0])).intValue() ; - int minor = ((Integer)(nums[1])).intValue() ; - - return new GIOPVersion( major, minor ) ; - } - } ; - - Operation result = OperationFactory.compose( gvHelper, gvMain ); - return result ; - } - - public static final class TestORBInitializer1 extends org.omg.CORBA.LocalObject - implements ORBInitializer - { - public boolean equals( Object other ) - { - return other instanceof TestORBInitializer1 ; - } - - public int hashCode() { - return 1; - } - - public void pre_init( ORBInitInfo info ) - { - } - - public void post_init( ORBInitInfo info ) - { - } - } - - public static final class TestORBInitializer2 extends org.omg.CORBA.LocalObject - implements ORBInitializer - { - public boolean equals( Object other ) - { - return other instanceof TestORBInitializer2 ; - } - - public int hashCode() { - return 1; - } - - public void pre_init( ORBInitInfo info ) - { - } - - public void post_init( ORBInitInfo info ) - { - } - } - - private Operation makeROIOperation() { - Operation clsop = OperationFactory.classAction() ; - Operation indexOp = OperationFactory.suffixAction() ; - Operation op1 = OperationFactory.compose( indexOp, clsop ) ; - Operation mop = OperationFactory.maskErrorAction( op1 ) ; - - Operation mkinst = new Operation() { - public Object operate( Object value ) - { - final Class initClass = (Class)value ; - if (initClass == null) - return null ; - - // For security reasons avoid creating an instance - // if this class is one that would fail the class cast - // to ORBInitializer anyway. - if( org.omg.PortableInterceptor.ORBInitializer.class.isAssignableFrom( - initClass ) ) { - // Now that we have a class object, instantiate one and - // remember it: - ORBInitializer initializer = null ; - - try { - initializer = (ORBInitializer)AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Object run() - throws InstantiationException, IllegalAccessException - { - return initClass.newInstance() ; - } - } - ) ; - } catch (PrivilegedActionException exc) { - // Unwrap the exception, as we don't care exc here - throw wrapper.orbInitializerFailure( exc.getException(), - initClass.getName() ) ; - } catch (Exception exc) { - throw wrapper.orbInitializerFailure( exc, initClass.getName() ) ; - } - - return initializer ; - } else { - throw wrapper.orbInitializerType( initClass.getName() ) ; - } - } - } ; - - Operation result = OperationFactory.compose( mop, mkinst ) ; - - return result ; - } - - public static final class TestAcceptor1 - implements Acceptor - { - public boolean equals( Object other ) - { - return other instanceof TestAcceptor1 ; - } - - public int hashCode() { return 1; } - public boolean initialize() { return true; } - public boolean initialized() { return true; } - public String getConnectionCacheType() { return "FOO"; } - public void setConnectionCache(InboundConnectionCache connectionCache){} - public InboundConnectionCache getConnectionCache() { return null; } - public boolean shouldRegisterAcceptEvent() { return true; } - public void setUseSelectThreadForConnections(boolean x) { } - public boolean shouldUseSelectThreadForConnections() { return true; } - public void setUseWorkerThreadForConnections(boolean x) { } - public boolean shouldUseWorkerThreadForConnections() { return true; } - public void accept() { } - public void close() { } - public EventHandler getEventHandler() { return null; } - public MessageMediator createMessageMediator( - Broker xbroker, Connection xconnection) { return null; } - public MessageMediator finishCreatingMessageMediator( - Broker xbroker, Connection xconnection, - MessageMediator messageMediator) { return null; } - public InputObject createInputObject( - Broker broker, MessageMediator messageMediator) { return null; } - public OutputObject createOutputObject( - Broker broker, MessageMediator messageMediator) { return null; } - } - - public static final class TestAcceptor2 - implements Acceptor - { - public boolean equals( Object other ) - { - return other instanceof TestAcceptor2 ; - } - public int hashCode() { return 1; } - public boolean initialize() { return true; } - public boolean initialized() { return true; } - public String getConnectionCacheType() { return "FOO"; } - public void setConnectionCache(InboundConnectionCache connectionCache){} - public InboundConnectionCache getConnectionCache() { return null; } - public boolean shouldRegisterAcceptEvent() { return true; } - public void setUseSelectThreadForConnections(boolean x) { } - public boolean shouldUseSelectThreadForConnections() { return true; } - public void setUseWorkerThreadForConnections(boolean x) { } - public boolean shouldUseWorkerThreadForConnections() { return true; } - public void accept() { } - public void close() { } - public EventHandler getEventHandler() { return null; } - public MessageMediator createMessageMediator( - Broker xbroker, Connection xconnection) { return null; } - public MessageMediator finishCreatingMessageMediator( - Broker xbroker, Connection xconnection, - MessageMediator messageMediator) { return null; } - public InputObject createInputObject( - Broker broker, MessageMediator messageMediator) { return null; } - public OutputObject createOutputObject( - Broker broker, MessageMediator messageMediator) { return null; } - } - - // REVISIT - this is a cut and paste modification of makeROIOperation. - private Operation makeAcceptorInstantiationOperation() { - Operation clsop = OperationFactory.classAction() ; - Operation indexOp = OperationFactory.suffixAction() ; - Operation op1 = OperationFactory.compose( indexOp, clsop ) ; - Operation mop = OperationFactory.maskErrorAction( op1 ) ; - - Operation mkinst = new Operation() { - public Object operate( Object value ) - { - final Class initClass = (Class)value ; - if (initClass == null) - return null ; - - // For security reasons avoid creating an instance - // if this class is one that would fail the class cast - // to ORBInitializer anyway. - if( Acceptor.class.isAssignableFrom( initClass ) ) { - // Now that we have a class object, instantiate one and - // remember it: - Acceptor acceptor = null ; - - try { - acceptor = (Acceptor)AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public Object run() - throws InstantiationException, IllegalAccessException - { - return initClass.newInstance() ; - } - } - ) ; - } catch (PrivilegedActionException exc) { - // Unwrap the exception, as we don't care exc here - throw wrapper.acceptorInstantiationFailure( exc.getException(), - initClass.getName() ) ; - } catch (Exception exc) { - throw wrapper.acceptorInstantiationFailure( exc, initClass.getName() ) ; - } - - return acceptor ; - } else { - throw wrapper.acceptorInstantiationTypeFailure( initClass.getName() ) ; - } - } - } ; - - Operation result = OperationFactory.compose( mop, mkinst ) ; - - return result ; - } - - private Operation makeInitRefOperation() { - return new Operation() { - public Object operate( Object value ) - { - // Object is String[] of length 2. - String[] values = (String[])value ; - if (values.length != 2) - throw wrapper.orbInitialreferenceSyntax() ; - - return values[0] + "=" + values[1] ; - } - } ; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserAction.java 2018-01-30 20:19:03.000000000 -0500 +++ /dev/null 2018-01-30 20:19:03.000000000 -0500 @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.orb ; - -import org.omg.CORBA.INITIALIZE ; - -import java.util.Properties ; -import java.util.List ; -import java.util.LinkedList ; -import java.util.Iterator ; - -import java.lang.reflect.Array ; - -import com.sun.corba.se.spi.orb.Operation ; -import com.sun.corba.se.spi.orb.StringPair ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.orbutil.ObjectUtility ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public class PrefixParserAction extends ParserActionBase { - private Class componentType ; - private ORBUtilSystemException wrapper ; - - public PrefixParserAction( String propertyName, - Operation operation, String fieldName, Class componentType ) - { - super( propertyName, true, operation, fieldName ) ; - this.componentType = componentType ; - this.wrapper = ORBUtilSystemException.get( - CORBALogDomains.ORB_LIFECYCLE ) ; - } - - /** For each String s that matches the prefix given by getPropertyName(), - * apply getOperation() to { suffix( s ), value } - * and add the result to an Object[] - * which forms the result of apply. Returns null if there are no - * matches. - */ - public Object apply( Properties props ) - { - String prefix = getPropertyName() ; - int prefixLength = prefix.length() ; - if (prefix.charAt( prefixLength - 1 ) != '.') { - prefix += '.' ; - prefixLength++ ; - } - - List matches = new LinkedList() ; - - // Find all keys in props that start with propertyName - Iterator iter = props.keySet().iterator() ; - while (iter.hasNext()) { - String key = (String)(iter.next()) ; - if (key.startsWith( prefix )) { - String suffix = key.substring( prefixLength ) ; - String value = props.getProperty( key ) ; - StringPair data = new StringPair( suffix, value ) ; - Object result = getOperation().operate( data ) ; - matches.add( result ) ; - } - } - - int size = matches.size() ; - if (size > 0) { - // Convert the list into an array of the proper type. - // An Object[] as a result does NOT work. Also report - // any errors carefully, as errors here or in parsers that - // use this Operation often show up at ORB.init(). - Object result = null ; - try { - result = Array.newInstance( componentType, size ) ; - } catch (Throwable thr) { - throw wrapper.couldNotCreateArray( thr, - getPropertyName(), componentType, - new Integer( size ) ) ; - } - - Iterator iter2 = matches.iterator() ; - int ctr = 0 ; - while (iter2.hasNext()) { - Object obj = iter2.next() ; - - try { - Array.set( result, ctr, obj ) ; - } catch (Throwable thr) { - throw wrapper.couldNotSetArray( thr, - getPropertyName(), new Integer(ctr), - componentType, new Integer(size), - obj.toString() ) ; - } - ctr++ ; - } - - return result ; - } else - return null ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserData.java 2018-01-30 20:19:03.000000000 -0500 +++ /dev/null 2018-01-30 20:19:03.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.orb ; - -import java.util.Properties ; - -import com.sun.corba.se.spi.orb.StringPair ; -import com.sun.corba.se.spi.orb.Operation ; -import com.sun.corba.se.spi.orb.PropertyParser ; - -public class PrefixParserData extends ParserDataBase { - - private StringPair[] testData ; - private Class componentType ; - - public PrefixParserData( String propertyName, - Operation operation, String fieldName, Object defaultValue, - Object testValue, StringPair[] testData, Class componentType ) - { - super( propertyName, operation, fieldName, defaultValue, testValue ) ; - this.testData = testData ; - this.componentType = componentType ; - } - - public void addToParser( PropertyParser parser ) - { - parser.addPrefix( getPropertyName(), getOperation(), getFieldName(), - componentType ) ; - } - - public void addToProperties( Properties props ) - { - for (int ctr=0; ctr - class combine - init : X - add( X, Y ) : X - op1( String ) : X - op2( String ) : Y - - reduce( sep, op1, op2, comb ) ( String ) : X - - operate(data) - if (sep in data) // either first from left orfirst from right - split data into prefix, rest - return comb.add( op2.operate( rest ), op1.operate( prefix ) ) - else - return comb.add( comb.init(), op1.operate( data ) ) - - example - - op = reduce( ":", op1, null, comb ) - op.setop2( op ) - - op.operate( "A:B:C" ) = - comb.add( op.operate( "B:C" ), op1.operate( "A" ) ) = - comb.add( comb.add( op.operate("C"), op1.operate("B") ), op1.operate( "A" ) = - comb.add( comb.add( comb.add( comb.init(), op1.operate("C") ), op1.operate("B") ), - op1.operate("A") ) - - -Splitter interface - -interface Splitter { - List split( String str ) -} - -variations: - - separated list SL - - first sep rest FSR - - fail if not present one arg - - default value two args - - rest sep last RSL - - fail if not present one arg - - default value two args - -Have we just pushed the real problem off a level? - -How do we combine: - op1 = FSR("@",v12) - op2 = LSR(":",9090) - - str = 1.2@myhost:2345 - - op1(str) = ( "1.2" "myhost:2345" ) - - define splice( int index, Operator op ) on a list of strings, with op( String ) : (String) - to replace the indexth element of a list of strings with the list returned - from op( element ). - - compose( op1, splice( 1, op2 )) is the correct parser. - - -A grammar for parsers? - -parser : simple_parser - | parser ":" simple_parser ; - -simple_parser : ident - | ident "(" param_list ")" ; - -param_list : param - | param_list "," param ; - -param : constant - | parser ; - -constant is a Java constant -ident x is interpreted as either a public static method on OperationFactory -named xAction which takes as arguments the types of the param list, or as -the fully qualified class name of a class that implements Operation and has -a constructor which takes as arguments the types of the param list. - -From parser table: - -debugFlags string -ORBInitialHost string -ORBInitialPort integer -ORBServerHost string -ORBServerPort integer -orbId string -highWaterMark integer -lowWaterMark integer -etc. - -giopVersion construct(GIOPVersion.class):map(integer):list('.') -giopFragmentSize mod(ORBConstants.GIOP_FRAGMENT_DIVISOR):min(ORBConstants.GIOP_FRAGMENT_SIZE):integer - -Lisp notation: - parse((mod ORBConstants.GIOP_FRAGMENT_DIVISOR) (min ...) (integer)) - -giop11BuffMgr makeMap(map) where map is constructed in java with - map.get("GROW") = Integer(0) - map.get("CLCT") = Integer(1) - map.get("STRM") = Integer(2) - -giopTargetAddressPreference intToShort:integerRange(0,3) -giopAddressDisposition another map variant - -charData construct(CodeSetComponentInfo.class):string - - -What about corbaloc:? - -v12 = GIOPVersion.v12 ; - -giopVersion = construct( GIOPVersion.class ):mapSequence( [integer,integer] ):FSR(".") - -iiopAddress = mapSequence( [giopVersion,identity,integer] ): - splice( 1, LSR( ":" 9090 )): - FSR( "@", v12 ) - -addressHandler = choice( - "iiop:", iiopAddress - ":", iiopAddress -) - -addressList = map(addressHandler):SL(",") - -choice( - "corbaloc:", mapSequence( [addressList,string] ):RSL("/", "NameService"), - "corbaname:", ... -) --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CacheTable.java 2018-01-30 20:19:05.000000000 -0500 +++ /dev/null 2018-01-30 20:19:05.000000000 -0500 @@ -1,163 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.impl.orbutil; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -public class CacheTable { - class Entry { - java.lang.Object key; - int val; - Entry next; // this chains the collision list of table "map" - Entry rnext; // this chains the collision list of table "rmap" - public Entry(java.lang.Object k, int v) { - key = k; - val = v; - next = null; - rnext = null; - } - } - private boolean noReverseMap; - // size must be power of 2 - static final int INITIAL_SIZE = 16; - static final int MAX_SIZE = 1 << 30; - int size; - int entryCount; - private Entry [] map; - private Entry [] rmap; - - private ORB orb; - private ORBUtilSystemException wrapper; - - private CacheTable() {} - public CacheTable(ORB orb, boolean u) { - //System.out.println("using new cache table"); - this.orb = orb; - wrapper = ORBUtilSystemException.get(orb, - CORBALogDomains.RPC_ENCODING); - noReverseMap = u; - size = INITIAL_SIZE; - entryCount = 0; - initTables(); - } - private void initTables() { - map = new Entry[size]; - rmap = noReverseMap ? null : new Entry[size]; - } - private void grow() { - if (size == MAX_SIZE) - return; - Entry [] oldMap = map; - int oldSize = size; - size <<= 1; - initTables(); - // now rehash the entries into the new table - for (int i = 0; i < oldSize; i++) { - for (Entry e = oldMap[i]; e != null; e = e.next) - put_table(e.key, e.val); - } - } - private int moduloTableSize(int h) { - // these are the "supplemental hash function" copied from - // java.util.HashMap, supposed to be "critical" - h += ~(h << 9); - h ^= (h >>> 14); - h += (h << 4); - h ^= (h >>> 10); - return h & (size - 1); - } - private int hash(java.lang.Object key) { - return moduloTableSize(System.identityHashCode(key)); - } - private int hash(int val) { - return moduloTableSize(val); - } - public final void put(java.lang.Object key, int val) { - if (put_table(key, val)) { - entryCount++; - if (entryCount > size * 3 / 4) - grow(); - } - } - private boolean put_table(java.lang.Object key, int val) { - int index = hash(key); - for (Entry e = map[index]; e != null; e = e.next) { - if (e.key == key) { - if (e.val != val) { - throw wrapper.duplicateIndirectionOffset(); - } - // if we get here we are trying to put in the same key/val pair - // this is a no-op, so we just return - return false; - } - } - // this means the key is not present in our table - // then it shouldnt be present in our reverse table either - Entry newEntry = new Entry(key, val); - newEntry.next = map[index]; - map[index] = newEntry; - if (!noReverseMap) { - int rindex = hash(val); - newEntry.rnext = rmap[rindex]; - rmap[rindex] = newEntry; - } - return true; - } - public final boolean containsKey(java.lang.Object key) { - return (getVal(key) != -1); - } - public final int getVal(java.lang.Object key) { - int index = hash(key); - for (Entry e = map[index]; e != null; e = e.next) { - if (e.key == key) - return e.val; - } - return -1; - } - public final boolean containsVal(int val) { - return (getKey(val) != null); - } - public final boolean containsOrderedVal(int val) { - return containsVal(val); - } - public final java.lang.Object getKey(int val) { - int index = hash(val); - for (Entry e = rmap[index]; e != null; e = e.rnext) { - if (e.val == val) - return e.key; - } - return null; - } - public void done() { - map = null; - rmap = null; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java 2018-01-30 20:19:06.000000000 -0500 +++ /dev/null 2018-01-30 20:19:06.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.orbutil; - -import java.util.ResourceBundle; -import java.util.MissingResourceException; - -public class CorbaResourceUtil { - public static String getString(String key) { - if (!resourcesInitialized) { - initResources(); - } - - try { - return resources.getString(key); - } catch (MissingResourceException ignore) { - } - return null; - } - - public static String getText(String key) { - String message = getString(key); - if (message == null) { - message = "no text found: \"" + key + "\""; - } - return message; - } - - public static String getText(String key, int num) { - return getText(key, Integer.toString(num), null, null); - } - - public static String getText(String key, String arg0) { - return getText(key, arg0, null, null); - } - - public static String getText(String key, String arg0, String arg1) { - return getText(key, arg0, arg1, null); - } - - public static String getText(String key, - String arg0, String arg1, String arg2) - { - String format = getString(key); - if (format == null) { - format = "no text found: key = \"" + key + "\", " + - "arguments = \"{0}\", \"{1}\", \"{2}\""; - } - - String[] args = new String[3]; - args[0] = (arg0 != null ? arg0.toString() : "null"); - args[1] = (arg1 != null ? arg1.toString() : "null"); - args[2] = (arg2 != null ? arg2.toString() : "null"); - - return java.text.MessageFormat.format(format, (Object[]) args); - } - - private static boolean resourcesInitialized = false; - private static ResourceBundle resources; - - private static void initResources() { - try { - resources = - ResourceBundle.getBundle("com.sun.corba.se.impl.orbutil.resources.sunorb"); - resourcesInitialized = true; - } catch (MissingResourceException e) { - throw new Error("fatal: missing resource bundle: " + - e.getClassName()); - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java 2018-01-30 20:19:06.000000000 -0500 +++ /dev/null 2018-01-30 20:19:06.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.orbutil ; - -import java.util.ArrayList ; - -/** Utility for managing mappings from densely allocated integer - * keys to arbitrary objects. This should only be used for - * keys in the range 0..max such that "most" of the key space is actually - * used. - */ -public class DenseIntMapImpl -{ - private ArrayList list = new ArrayList() ; - - private void checkKey( int key ) - { - if (key < 0) - throw new IllegalArgumentException( "Key must be >= 0." ) ; - } - - /** - * If {@code key >= 0}, return the value bound to key, or null if none. - * Throws IllegalArgumentException if {@code key < 0}. - */ - public Object get( int key ) - { - checkKey( key ) ; - - Object result = null ; - if (key < list.size()) - result = list.get( key ) ; - - return result ; - } - - /** - * If {@code key >= 0}, bind value to the key. - * Throws IllegalArgumentException if {@code key < 0}. - */ - public void set( int key, Object value ) - { - checkKey( key ) ; - extend( key ) ; - list.set( key, value ) ; - } - - private void extend( int index ) - { - if (index >= list.size()) { - list.ensureCapacity( index + 1 ) ; - int max = list.size() ; - while (max++ <= index) - list.add( null ) ; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/GetPropertyAction.java 2018-01-30 20:19:07.000000000 -0500 +++ /dev/null 2018-01-30 20:19:07.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.orbutil ; - -/** - * A convenience class for retrieving the string value of a system - * property as a privileged action. This class is directly copied - * from sun.security.action.GetPropertyAction in order to avoid - * depending on the sun.security.action package. - * - *

An instance of this class can be used as the argument of - * AccessController.doPrivileged. - * - *

The following code retrieves the value of the system - * property named "prop" as a privileged action: - * - *

- * String s = (String) java.security.AccessController.doPrivileged(
- *                         new GetPropertyAction("prop"));
- * 
- * - * @author Roland Schemers - * @author Ken Cavanaugh - * @see java.security.PrivilegedAction - * @see java.security.AccessController - */ - -public class GetPropertyAction implements java.security.PrivilegedAction { - private String theProp; - private String defaultVal; - - /** - * Constructor that takes the name of the system property whose - * string value needs to be determined. - * - * @param theProp the name of the system property. - */ - public GetPropertyAction(String theProp) { - this.theProp = theProp; - } - - /** - * Constructor that takes the name of the system property and the default - * value of that property. - * - * @param theProp the name of the system property. - * @param defaultVal the default value. - */ - public GetPropertyAction(String theProp, String defaultVal) { - this.theProp = theProp; - this.defaultVal = defaultVal; - } - - /** - * Determines the string value of the system property whose - * name was specified in the constructor. - * - * @return the string value of the system property, - * or the default value if there is no property with that key. - */ - public Object run() { - String value = System.getProperty(theProp); - return (value == null) ? defaultVal : value; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/HexOutputStream.java 2018-01-30 20:19:08.000000000 -0500 +++ /dev/null 2018-01-30 20:19:08.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1996, 2002, 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.corba.se.impl.orbutil; - -import java.io.StringWriter; -import java.io.OutputStream; -import java.io.IOException; - -/** - * Writes each input byte as a 2 byte hexidecimal output pair making it - * possible to turn arbitrary binary data into an ASCII format. - * The high 4 bits of the byte is translated into the first byte. - * - * @author Jeff Nisewanger - */ -public class HexOutputStream extends OutputStream -{ - static private final char hex[] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' - }; - - private StringWriter writer; - - /** - * Creates a new HexOutputStream. - * @param w The underlying StringWriter. - */ - public - HexOutputStream(StringWriter w) { - writer = w; - } - - - /** - * Writes a byte. Will block until the byte is actually - * written. - * param b The byte to write out. - * @exception java.io.IOException I/O error occurred. - */ - public synchronized void write(int b) throws IOException { - writer.write(hex[((b >> 4) & 0xF)]); - writer.write(hex[((b >> 0) & 0xF)]); - } - - public synchronized void write(byte[] b) throws IOException { - write(b, 0, b.length); - } - - public synchronized void write(byte[] b, int off, int len) - throws IOException - { - for(int i=0; i < len; i++) { - write(b[off + i]); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java 2018-01-30 20:19:08.000000000 -0500 +++ /dev/null 2018-01-30 20:19:09.000000000 -0500 @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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.corba.se.impl.orbutil; - -import java.io.*; -import java.util.Hashtable; - -class LegacyHookGetFields extends ObjectInputStream.GetField { - private Hashtable fields = null; - - LegacyHookGetFields(Hashtable fields){ - this.fields = fields; - } - - /** - * Get the ObjectStreamClass that describes the fields in the stream. - */ - public java.io.ObjectStreamClass getObjectStreamClass() { - return null; - } - - /** - * Return true if the named field is defaulted and has no value - * in this stream. - */ - public boolean defaulted(String name) - throws IOException, IllegalArgumentException { - return (!fields.containsKey(name)); - } - - /** - * Get the value of the named boolean field from the persistent field. - */ - public boolean get(String name, boolean defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Boolean)fields.get(name)).booleanValue(); - } - - /** - * Get the value of the named char field from the persistent fields. - */ - public char get(String name, char defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Character)fields.get(name)).charValue(); - - } - - /** - * Get the value of the named byte field from the persistent fields. - */ - public byte get(String name, byte defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Byte)fields.get(name)).byteValue(); - - } - - /** - * Get the value of the named short field from the persistent fields. - */ - public short get(String name, short defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Short)fields.get(name)).shortValue(); - - } - - /** - * Get the value of the named int field from the persistent fields. - */ - public int get(String name, int defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Integer)fields.get(name)).intValue(); - - } - - /** - * Get the value of the named long field from the persistent fields. - */ - public long get(String name, long defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Long)fields.get(name)).longValue(); - - } - - /** - * Get the value of the named float field from the persistent fields. - */ - public float get(String name, float defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Float)fields.get(name)).floatValue(); - - } - - /** - * Get the value of the named double field from the persistent field. - */ - public double get(String name, double defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return ((Double)fields.get(name)).doubleValue(); - - } - - /** - * Get the value of the named Object field from the persistent field. - */ - public Object get(String name, Object defvalue) - throws IOException, IllegalArgumentException { - if (defaulted(name)) - return defvalue; - else return fields.get(name); - - } - - public String toString(){ - return fields.toString(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java 2018-01-30 20:19:09.000000000 -0500 +++ /dev/null 2018-01-30 20:19:09.000000000 -0500 @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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.corba.se.impl.orbutil; - -import java.io.*; -import java.util.Hashtable; - -/** - * Since ObjectOutputStream.PutField methods specify no exceptions, - * we are not checking for null parameters on put methods. - */ -class LegacyHookPutFields extends ObjectOutputStream.PutField -{ - private Hashtable fields = new Hashtable(); - - /** - * Put the value of the named boolean field into the persistent field. - */ - public void put(String name, boolean value){ - fields.put(name, new Boolean(value)); - } - - /** - * Put the value of the named char field into the persistent fields. - */ - public void put(String name, char value){ - fields.put(name, new Character(value)); - } - - /** - * Put the value of the named byte field into the persistent fields. - */ - public void put(String name, byte value){ - fields.put(name, new Byte(value)); - } - - /** - * Put the value of the named short field into the persistent fields. - */ - public void put(String name, short value){ - fields.put(name, new Short(value)); - } - - /** - * Put the value of the named int field into the persistent fields. - */ - public void put(String name, int value){ - fields.put(name, new Integer(value)); - } - - /** - * Put the value of the named long field into the persistent fields. - */ - public void put(String name, long value){ - fields.put(name, new Long(value)); - } - - /** - * Put the value of the named float field into the persistent fields. - * - */ - public void put(String name, float value){ - fields.put(name, new Float(value)); - } - - /** - * Put the value of the named double field into the persistent field. - */ - public void put(String name, double value){ - fields.put(name, new Double(value)); - } - - /** - * Put the value of the named Object field into the persistent field. - */ - public void put(String name, Object value){ - fields.put(name, value); - } - - /** - * Write the data and fields to the specified ObjectOutput stream. - */ - public void write(ObjectOutput out) throws IOException { - out.writeObject(fields); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LogKeywords.java 2018-01-30 20:19:10.000000000 -0500 +++ /dev/null 2018-01-30 20:19:10.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.orbutil; -/** - * All the Keywords that will be used in Logging Messages for CORBA need to - * be defined here. The LogKeywords will be useful for searching log messages - * based on the standard keywords, it is also useful to work with LogAnalyzing - * tools. - * We will try to standardize these keywords in JSR 117 Logging - */ -public class LogKeywords { - - /** - ** Keywords for Lifecycle Loggers. - ** _REVISIT_ After it is clearly defined in JSR 117 - **/ - public final static String LIFECYCLE_CREATE = "<>"; - public final static String LIFECYCLE_INITIALIZE = "<>"; - public final static String LIFECYCLE_SHUTDOWN = "<>"; - public final static String LIFECYCLE_DESTROY = "<>"; - - - public final static String LIFECYCLE_CREATE_SUCCESS = - LIFECYCLE_CREATE + "<>"; - public final static String LIFECYCLE_CREATE_FAILURE = - LIFECYCLE_CREATE + "<>"; - public final static String LIFECYCLE_INITIALIZE_SUCCESS = - LIFECYCLE_INITIALIZE + "<>"; - public final static String LIFECYCLE_INITIALIZE_FAILURE = - LIFECYCLE_INITIALIZE + "<>"; - public final static String LIFECYCLE_SHUTDOWN_SUCCESS = - LIFECYCLE_SHUTDOWN + "<>"; - public final static String LIFECYCLE_SHUTDOWN_FAILURE = - LIFECYCLE_SHUTDOWN + "<>"; - public final static String LIFECYCLE_DESTROY_SUCCESS = - LIFECYCLE_DESTROY + "<>"; - public final static String LIFECYCLE_DESTROY_FAILURE = - LIFECYCLE_DESTROY + "<>"; - - /** - ** Keywords for Naming Read Loggers. - **/ - public final static String NAMING_RESOLVE = "<>"; - public final static String NAMING_LIST = "<>"; - - public final static String NAMING_RESOLVE_SUCCESS = - NAMING_RESOLVE + "<>"; - public final static String NAMING_RESOLVE_FAILURE = - NAMING_RESOLVE + "<>"; - public final static String NAMING_LIST_SUCCESS = - NAMING_LIST + "<>"; - public final static String NAMING_LIST_FAILURE = - NAMING_LIST + "<>"; - - /** - ** Keywords for Naming Update Loggers. - **/ - public final static String NAMING_BIND = "<>"; - public final static String NAMING_UNBIND = "<>"; - public final static String NAMING_REBIND = "<>"; - - public final static String NAMING_BIND_SUCCESS = - NAMING_BIND + "<>"; - public final static String NAMING_BIND_FAILURE = - NAMING_BIND + "<>"; - public final static String NAMING_UNBIND_SUCCESS = - NAMING_UNBIND + "<>"; - public final static String NAMING_UNBIND_FAILURE = - NAMING_UNBIND + "<>"; - public final static String NAMING_REBIND_SUCCESS = - NAMING_REBIND + "<>"; - public final static String NAMING_REBIND_FAILURE = - NAMING_REBIND + "<>"; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBConstants.java 2018-01-30 20:19:11.000000000 -0500 +++ /dev/null 2018-01-30 20:19:11.000000000 -0500 @@ -1,471 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.orbutil; - -import com.sun.corba.se.impl.util.SUNVMCID ; - -public class ORBConstants { - private ORBConstants() {} - - public static final String STRINGIFY_PREFIX = "IOR:" ; - - /* TAGS - tag-request@omg.org - FAQ on tags and tag allocation: http://doc.omg.org/ptc/99-02-01. - http://doc.omg.org/standard-tags - http://doc.omg.org/vendor-tags - - Last update: 19th August 2003 (ptc/03-08-14) - - // Legacy - 1 profile tag 0x4f4e4300 ("ONC\x00") - 1 profile tag 0x4e454f00 ("NEO\x00") - 1 profile tag 0x434f4f4c ("COOL") - 16 service tags 0x4e454f00 - 0x4e454f0f ("NEO\x00" - "NEO\x0f") - - // Current - 16 VMCID 0x5355xxxx ("SU\x00\x00" - "SU\xff\xff") - 16 profile tags 0x53554e00 - 0x53554e0f ("SUN\x00" - "SUN\x0f") - 16 ORB Type IDs 0x53554e00 - 0x53554e0f ("SUN\x00" - "SUN\x0f") - 64 service tags 0x53554e00 - 0x53554e3f ("SUN\x00" - "SUN\x3f") - 64 component tags 0x53554e00 - 0x53554e3f ("SUN\x00" - "SUN\x3f") - */ - - // All NEO service contexts must be in the range - // NEO_FIRST_SERVICE_CONTEXT to - // NEO_FIRST_SERVICE_CONTEXT + NUM_NEO_SERVICE_CONTEXTS - 1 - public static final int NEO_FIRST_SERVICE_CONTEXT = 0x4e454f00 ; - public static final int NUM_NEO_SERVICE_CONTEXTS = 15 ; - public static final int TAG_ORB_VERSION = NEO_FIRST_SERVICE_CONTEXT ; - - public static final int SUN_TAGGED_COMPONENT_ID_BASE = 0x53554e00; - public static final int SUN_SERVICE_CONTEXT_ID_BASE = 0x53554e00; - - // - // Tagged Components Ids - // - - // Used by AS 7 for IIOP failover. - public static final int TAG_CONTAINER_ID = - SUN_TAGGED_COMPONENT_ID_BASE + 0; - // Used by AS 8.1 for Request Partioning - public static final int TAG_REQUEST_PARTITIONING_ID = - SUN_TAGGED_COMPONENT_ID_BASE + 1; - // TaggedComponentId for Java serialization tagged component. - public static final int TAG_JAVA_SERIALIZATION_ID = - SUN_TAGGED_COMPONENT_ID_BASE + 2; - - // - // Service Context Ids - // - - // Used by AS 7 for IIOP failover. - public static final int CONTAINER_ID_SERVICE_CONTEXT = - SUN_SERVICE_CONTEXT_ID_BASE + 0; - - // All Sun policies are allocated using the SUNVMCID, which is also - // used for minor codes. This allows 12 bits of offset, so - // the largest legal Sun policy is SUNVMCID.value + 4095. - public static final int SERVANT_CACHING_POLICY = SUNVMCID.value + 0 ; - public static final int ZERO_PORT_POLICY = SUNVMCID.value + 1 ; - public static final int COPY_OBJECT_POLICY = SUNVMCID.value + 2 ; - public static final int REQUEST_PARTITIONING_POLICY = SUNVMCID.value + 3 ; - - // These are the subcontract IDs for various qualities of - // service/implementation. - // Persistent SCIDs have the second bit as 1. - // SCIDs less than FIRST_POA_SCID are JavaIDL SCIDs. - public static final int TOA_SCID = 2 ; - - public static final int DEFAULT_SCID = TOA_SCID ; - - public static final int FIRST_POA_SCID = 32; - public static final int MAX_POA_SCID = 63; - public static final int TRANSIENT_SCID = FIRST_POA_SCID ; - public static final int PERSISTENT_SCID = makePersistent( TRANSIENT_SCID ) ; - public static final int SC_TRANSIENT_SCID = FIRST_POA_SCID + 4 ; - public static final int SC_PERSISTENT_SCID = makePersistent( SC_TRANSIENT_SCID ) ; - public static final int IISC_TRANSIENT_SCID = FIRST_POA_SCID + 8 ; - public static final int IISC_PERSISTENT_SCID = makePersistent( IISC_TRANSIENT_SCID ) ; - public static final int MINSC_TRANSIENT_SCID = FIRST_POA_SCID + 12 ; - public static final int MINSC_PERSISTENT_SCID = makePersistent( MINSC_TRANSIENT_SCID ) ; - - public static boolean isTransient( int scid ) - { - return (scid & 2) == 0 ; - } - - public static int makePersistent( int scid ) - { - return scid | 2 ; - } - - // Constants for ORB properties ************************************************************** - - // All ORB properties must follow the following rules: - // 1. Property names must start with either - // ORG_OMG_CORBA_PREFIX or SUN_PREFIX. - // 2. Property names must have unique suffixes after the last ".". - // 3. Property names must have "ORB" as the first 3 letters - // in their suffix. - // 4. proprietary property names should have a subsystem - // where appropriate after the prefix. - - // org.omg.CORBA properties must be defined by OMG standards - // The well known org.omg.CORBA.ORBClass and - // org.omg.CORBA.ORBSingletonClass are not included here - // since they occur in org.omg.CORBA.ORB. - - public static final String ORG_OMG_PREFIX = "org.omg." ; - public static final String ORG_OMG_CORBA_PREFIX = "org.omg.CORBA." ; - - public static final String INITIAL_HOST_PROPERTY = - ORG_OMG_CORBA_PREFIX + "ORBInitialHost" ; - public static final String INITIAL_PORT_PROPERTY = - ORG_OMG_CORBA_PREFIX + "ORBInitialPort" ; - public static final String INITIAL_SERVICES_PROPERTY = - ORG_OMG_CORBA_PREFIX + "ORBInitialServices" ; - public static final String DEFAULT_INIT_REF_PROPERTY = - ORG_OMG_CORBA_PREFIX + "ORBDefaultInitRef" ; - public static final String ORB_INIT_REF_PROPERTY = - ORG_OMG_CORBA_PREFIX + "ORBInitRef" ; - - // All of our proprietary properties must start with com.sun.CORBA - public static final String SUN_PREFIX = "com.sun.CORBA." ; - - // general properties - public static final String ALLOW_LOCAL_OPTIMIZATION = SUN_PREFIX + "ORBAllowLocalOptimization" ; - public static final String SERVER_PORT_PROPERTY = SUN_PREFIX + "ORBServerPort" ; - public static final String SERVER_HOST_PROPERTY = SUN_PREFIX + "ORBServerHost" ; - public static final String ORB_ID_PROPERTY = ORG_OMG_CORBA_PREFIX + "ORBId" ; - // This property is provided for backward compatibility reasons - public static final String OLD_ORB_ID_PROPERTY = SUN_PREFIX + "ORBid" ; - public static final String ORB_SERVER_ID_PROPERTY = ORG_OMG_CORBA_PREFIX + "ORBServerId" ; - public static final String DEBUG_PROPERTY = SUN_PREFIX + "ORBDebug" ; - // Property for setting use of repository Ids during serialization. - public static final String USE_REP_ID = SUN_PREFIX + "ORBUseRepId"; - - // NOTE: This is an internal property. It should never be set by - // a user. That is the reason it has spaces in its name - to make it - // harder to use. - public static final String LISTEN_ON_ALL_INTERFACES = SUN_PREFIX + "INTERNAL USE ONLY: listen on all interfaces"; - - // giop related properties - default settings in decimal form - public static final String GIOP_VERSION = SUN_PREFIX + "giop.ORBGIOPVersion" ; - public static final String GIOP_FRAGMENT_SIZE = SUN_PREFIX + "giop.ORBFragmentSize" ; - public static final String GIOP_BUFFER_SIZE = SUN_PREFIX + "giop.ORBBufferSize" ; - public static final String GIOP_11_BUFFMGR = SUN_PREFIX + "giop.ORBGIOP11BuffMgr"; - public static final String GIOP_12_BUFFMGR = SUN_PREFIX + "giop.ORBGIOP12BuffMgr"; - public static final String GIOP_TARGET_ADDRESSING = SUN_PREFIX + "giop.ORBTargetAddressing"; - public static final int GIOP_DEFAULT_FRAGMENT_SIZE = 1024; - public static final int GIOP_DEFAULT_BUFFER_SIZE = 1024; - public static final int DEFAULT_GIOP_11_BUFFMGR = 0; //Growing - public static final int DEFAULT_GIOP_12_BUFFMGR = 2; //Streaming - public static final short ADDR_DISP_OBJKEY = 0; // object key used for target addressing - public static final short ADDR_DISP_PROFILE = 1; // iop profile used for target addressing - public static final short ADDR_DISP_IOR = 2; // ior used for target addressing - public static final short ADDR_DISP_HANDLE_ALL = 3; // accept all target addressing dispositions (default) - - // CORBA formal 00-11-03 sections 15.4.2.2, 15.4.3.2, 15.4.6.2 - // state that the GIOP 1.2 RequestMessage, ReplyMessage, and - // LocateReply message bodies must begin on 8 byte boundaries. - public static final int GIOP_12_MSG_BODY_ALIGNMENT = 8; - - // The GIOP 1.2 fragments must be divisible by 8. We generalize this - // to GIOP 1.1 fragments, as well. - public static final int GIOP_FRAGMENT_DIVISOR = 8; - public static final int GIOP_FRAGMENT_MINIMUM_SIZE = 32; - - // connection management properties - public static final String HIGH_WATER_MARK_PROPERTY = - SUN_PREFIX + "connection.ORBHighWaterMark" ; - public static final String LOW_WATER_MARK_PROPERTY = - SUN_PREFIX + "connection.ORBLowWaterMark" ; - public static final String NUMBER_TO_RECLAIM_PROPERTY = - SUN_PREFIX + "connection.ORBNumberToReclaim" ; - - public static final String ACCEPTOR_CLASS_PREFIX_PROPERTY = - SUN_PREFIX + "transport.ORBAcceptor"; - - public static final String CONTACT_INFO_LIST_FACTORY_CLASS_PROPERTY = - SUN_PREFIX + "transport.ORBContactInfoList"; - - // Legacy: - public static final String LEGACY_SOCKET_FACTORY_CLASS_PROPERTY = - SUN_PREFIX + "legacy.connection.ORBSocketFactoryClass" ; - - - public static final String SOCKET_FACTORY_CLASS_PROPERTY = - SUN_PREFIX + "transport.ORBSocketFactoryClass" ; - public static final String LISTEN_SOCKET_PROPERTY = - SUN_PREFIX + "transport.ORBListenSocket"; - public static final String IOR_TO_SOCKET_INFO_CLASS_PROPERTY = - SUN_PREFIX + "transport.ORBIORToSocketInfoClass"; - public static final String IIOP_PRIMARY_TO_CONTACT_INFO_CLASS_PROPERTY = - SUN_PREFIX + "transport.ORBIIOPPrimaryToContactInfoClass"; - - // Request partitioning maximum and minimum thread pool id constants. - public static final int REQUEST_PARTITIONING_MIN_THREAD_POOL_ID = 0; - public static final int REQUEST_PARTITIONING_MAX_THREAD_POOL_ID = 63; - - // transport read tcp timeout property, colon separated property - // with syntax - public static final String TRANSPORT_TCP_READ_TIMEOUTS_PROPERTY = - SUN_PREFIX + "transport.ORBTCPReadTimeouts"; - - // initial time to wait in milliseconds if a transport - // tcp read returns 0 bytes - public static final int TRANSPORT_TCP_INITIAL_TIME_TO_WAIT = 100; - - // max time to spend in cumulative waits in milliseconds - // if a transport tcp read returns 0 bytes - public static final int TRANSPORT_TCP_MAX_TIME_TO_WAIT = 3000; - - // max time to spend in cumulative waits in milliseconds - // if a transport tcp read of GIOP header returns 0 bytes - public static final int TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT = 300; - - // A backoff percentage used to compute the next amount of time to - // wait on a subsequent transport tcp read of 0 bytes - public static final int TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR = 20; - - public static final String USE_NIO_SELECT_TO_WAIT_PROPERTY = - SUN_PREFIX + "transport.ORBUseNIOSelectToWait"; - - // "Socket" | "SocketChannel" - // Note: Connections accepted by SocketChannel will be SocketChannel. - public static final String ACCEPTOR_SOCKET_TYPE_PROPERTY = - SUN_PREFIX + "transport.ORBAcceptorSocketType"; - - // Applicable if using SocketChannel and using select thread. - public static final String ACCEPTOR_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY = - SUN_PREFIX + "transport.ORBAcceptorSocketUseWorkerThreadForEvent"; - - // Applicable on client-side. "Socket" | "SocketChannel" - public static final String CONNECTION_SOCKET_TYPE_PROPERTY = - SUN_PREFIX + "transport.ORBConnectionSocketType"; - - // Applicable if using SocketChannel and using select thread - public static final String CONNECTION_SOCKET_USE_WORKER_THREAD_FOR_EVENT_PROPERTY = - SUN_PREFIX + "transport.ORBConnectionSocketUseWorkerThreadForEvent"; - - // Used to disable the use of direct byte buffers. This enables much easier - // debugging, because the contents of a direct byte buffer cannot be - // viewed in most (all?) debuggers. - public static final String DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY = - SUN_PREFIX + "transport.ORBDisableDirectByteBufferUse" ; - - public static final String SOCKET = "Socket"; - public static final String SOCKETCHANNEL = "SocketChannel"; - - // POA related policies - public static final String PERSISTENT_SERVER_PORT_PROPERTY = SUN_PREFIX + "POA.ORBPersistentServerPort" ; - public static final String SERVER_ID_PROPERTY = SUN_PREFIX + "POA.ORBServerId" ; - public static final String BAD_SERVER_ID_HANDLER_CLASS_PROPERTY - = SUN_PREFIX + "POA.ORBBadServerIdHandlerClass" ; - public static final String ACTIVATED_PROPERTY = SUN_PREFIX + "POA.ORBActivated" ; - public static final String SERVER_NAME_PROPERTY = SUN_PREFIX + "POA.ORBServerName" ; - - // Server Properties; e.g. when properties passed to ORB activated - // servers - - public static final String SERVER_DEF_VERIFY_PROPERTY = SUN_PREFIX + "activation.ORBServerVerify" ; - - // This one is an exception, but it may be externally visible - public static final String SUN_LC_PREFIX = "com.sun.corba." ; - - // Necessary for package renaming to work correctly - public static final String SUN_LC_VERSION_PREFIX = "com.sun.corba.se."; - - public static final String JTS_CLASS_PROPERTY = SUN_LC_VERSION_PREFIX + "CosTransactions.ORBJTSClass" ; - - // Property for enabling ORB's use of Java serialization. - public static final String ENABLE_JAVA_SERIALIZATION_PROPERTY = - SUN_PREFIX + "encoding.ORBEnableJavaSerialization"; - - // Constants for ORB prefixes ************************************************************** - - public static final String PI_ORB_INITIALIZER_CLASS_PREFIX = - "org.omg.PortableInterceptor.ORBInitializerClass."; - - public static final String USE_DYNAMIC_STUB_PROPERTY = SUN_PREFIX + "ORBUseDynamicStub" ; - - public static final String DYNAMIC_STUB_FACTORY_FACTORY_CLASS = - SUN_PREFIX + "ORBDynamicStubFactoryFactoryClass" ; - - // Constants for NameService properties ************************************ - - public static final int DEFAULT_INITIAL_PORT = 900; - - public static final String DEFAULT_INS_HOST = "localhost"; - - public static final int DEFAULT_INS_PORT = 2089; - - public static final int DEFAULT_INS_GIOP_MAJOR_VERSION = 1; - - // http://www.omg.org/cgi-bin/doc?ptc/00-08-07 [ Section 13.6.7.3 ] - // defines the default GIOP minor version to be 0. - public static final int DEFAULT_INS_GIOP_MINOR_VERSION = 0; - - - // Constants for INS properties ******************************************** - - // GIOP Version number for validation of INS URL format addresses - public static final int MAJORNUMBER_SUPPORTED = 1; - public static final int MINORNUMBERMAX = 2; - - // Subcontract's differentiation using the TRANSIENT and PERSISTENT - // Name Service Property. - public static final int TRANSIENT = 1; - public static final int PERSISTENT = 2; - - // Constants for ORBD properties **************************************************************** - - // These properties are never passed on ORB init: they are only passed to ORBD. - - public static final String DB_DIR_PROPERTY = SUN_PREFIX + "activation.DbDir" ; - public static final String DB_PROPERTY = SUN_PREFIX + "activation.db" ; - public static final String ORBD_PORT_PROPERTY = SUN_PREFIX + "activation.Port" ; - public static final String SERVER_POLLING_TIME = SUN_PREFIX + "activation.ServerPollingTime"; - public static final String SERVER_STARTUP_DELAY = SUN_PREFIX + "activation.ServerStartupDelay"; - - public static final int DEFAULT_ACTIVATION_PORT = 1049 ; - - // If RI is starting the NameService then they would indicate that by - // passing the RI flag. That would start a Persistent Port to listen to - // INS request. - public static final int RI_NAMESERVICE_PORT = 1050; - - public static final int DEFAULT_SERVER_POLLING_TIME = 1000; - - public static final int DEFAULT_SERVER_STARTUP_DELAY = 1000; - - - //***************** Constants for Logging **************** - - public static final String LOG_LEVEL_PROPERTY = SUN_PREFIX + "ORBLogLevel"; - - public static final String LOG_RESOURCE_FILE = - "com.sun.corba.se.impl.logging.LogStrings"; - - // Constants for initial references ************************************************************* - - public static final String TRANSIENT_NAME_SERVICE_NAME = "TNameService" ; - public static final String PERSISTENT_NAME_SERVICE_NAME = "NameService" ; - - // A large Number to make sure that other ServerIds doesn't collide - // with NameServer Persistent Server Id - public static final String NAME_SERVICE_SERVER_ID = "1000000" ; - - public static final String ROOT_POA_NAME = "RootPOA" ; - public static final String POA_CURRENT_NAME = "POACurrent" ; - public static final String SERVER_ACTIVATOR_NAME = "ServerActivator" ; - public static final String SERVER_LOCATOR_NAME = "ServerLocator" ; - public static final String SERVER_REPOSITORY_NAME = "ServerRepository" ; - public static final String INITIAL_NAME_SERVICE_NAME= "InitialNameService" ; - public static final String TRANSACTION_CURRENT_NAME = "TransactionCurrent" ; - public static final String DYN_ANY_FACTORY_NAME = "DynAnyFactory" ; - - // New for Portable Interceptors - public static final String PI_CURRENT_NAME = "PICurrent" ; - public static final String CODEC_FACTORY_NAME = "CodecFactory" ; - - // Constants for ORBD DB *********************************************************************** - - public static final String DEFAULT_DB_DIR = "orb.db" ; - public static final String DEFAULT_DB_NAME = "db" ; - public static final String INITIAL_ORB_DB = "initial.db" ; - public static final String SERVER_LOG_DIR = "logs" ; - public static final String ORBID_DIR_BASE = "orbids" ; - public static final String ORBID_DB_FILE_NAME = "orbids.db" ; - - // Constants for ThreadPool ******************************************************************** - - // Default value for when inactive threads in the pool can stop running (ms) - public static final int DEFAULT_INACTIVITY_TIMEOUT = 120000; - // Default name of the threadpool - public static final String THREADPOOL_DEFAULT_NAME = "default-threadpool"; - // Default name of the workqueue - public static final String WORKQUEUE_DEFAULT_NAME = "default-workqueue"; - - // Constants for minor code bases ************************************************************** - // This is the value that pre-Merlin Sun ORBs incorrectly used. We preserve this - // here for backwards compatibility, but note that the current ORB must never - // create a BAD_PARAM system exception with this minor code. - public static final int LEGACY_SUN_NOT_SERIALIZABLE = SUNVMCID.value + 1 ; - - // Code Set related ******************************************************* - - // If we don't always send the code set context, there's a possibility - // of failure when fragments of a smaller request are interleved with - // those of a first request with other large service contexts. - // - public static final boolean DEFAULT_ALWAYS_SEND_CODESET_CTX = true; - public static final String ALWAYS_SEND_CODESET_CTX_PROPERTY - = SUN_PREFIX + "codeset.AlwaysSendCodeSetCtx"; - - // Use byte order markers in streams when applicable? This won't apply to - // GIOP 1.1 due to limitations in the CDR encoding. - public static final boolean DEFAULT_USE_BYTE_ORDER_MARKERS = true; - public static final String USE_BOMS = SUN_PREFIX + "codeset.UseByteOrderMarkers"; - - // Use byte order markers in encapsulations when applicable? - public static final boolean DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS = false; - public static final String USE_BOMS_IN_ENCAPS = SUN_PREFIX + "codeset.UseByteOrderMarkersInEncaps"; - - // The CHAR_CODESETS and WCHAR_CODESETS allow the user to override the default - // connection code sets. The value should be a comma separated list of OSF - // registry numbers. The first number in the list will be the native code - // set. - // - // Number can be specified as hex if preceded by 0x, otherwise they are - // interpreted as decimal. - // - // Code sets that we accept currently (see core/OSFCodeSetRegistry): - // - // char/string: - // - // ISO8859-1 (Latin-1) 0x00010001 - // ISO646 (ASCII) 0x00010020 - // UTF-8 0x05010001 - // - // wchar/string: - // - // UTF-16 0x00010109 - // UCS-2 0x00010100 - // UTF-8 0x05010001 - // - // Note: The ORB will let you assign any of the above values to - // either of the following properties, but the above assignments - // are the only ones that won't get you into trouble. - public static final String CHAR_CODESETS = SUN_PREFIX + "codeset.charsets"; - public static final String WCHAR_CODESETS = SUN_PREFIX + "codeset.wcharsets"; - - // Constants to make stream format version code easier to read - public static final byte STREAM_FORMAT_VERSION_1 = (byte)1; - public static final byte STREAM_FORMAT_VERSION_2 = (byte)2; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java 2018-01-30 20:19:11.000000000 -0500 +++ /dev/null 2018-01-30 20:19:11.000000000 -0500 @@ -1,846 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.orbutil; - -import java.lang.Character; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.rmi.NoSuchObjectException; -import java.security.AccessController; -import java.security.PermissionCollection; -import java.security.Policy; -import java.security.PrivilegedAction; -import java.security.ProtectionDomain; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Enumeration; -import java.util.StringTokenizer; -import java.util.NoSuchElementException; - -import javax.rmi.CORBA.ValueHandler; -import javax.rmi.CORBA.ValueHandlerMultiFormat; -import javax.rmi.CORBA.Util; - -import org.omg.CORBA.StructMember ; -import org.omg.CORBA.TypeCode ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.TCKind ; -import org.omg.CORBA.SystemException ; -import org.omg.CORBA.CompletionStatus ; -import org.omg.CORBA.DATA_CONVERSION ; -import org.omg.CORBA.BAD_PARAM ; -import org.omg.CORBA.BAD_OPERATION ; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.TypeCodePackage.BadKind ; -import org.omg.CORBA.portable.OutputStream ; -import org.omg.CORBA.portable.InputStream ; - -import com.sun.corba.se.pept.transport.ContactInfoList ; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter ; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORBVersionFactory ; -import com.sun.corba.se.spi.protocol.CorbaClientDelegate ; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate; - -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.corba.CORBAObjectImpl ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.logging.OMGSystemException ; -import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent; - -import sun.corba.SharedSecrets; - -/** - * Handy class full of static functions that don't belong in util.Utility for pure ORB reasons. - */ -public final class ORBUtility { - private ORBUtility() {} - - private static ORBUtilSystemException wrapper = ORBUtilSystemException.get( - CORBALogDomains.UTIL ) ; - private static OMGSystemException omgWrapper = OMGSystemException.get( - CORBALogDomains.UTIL ) ; - - private static StructMember[] members = null; - - private static StructMember[] systemExceptionMembers (ORB orb) { - if (members == null) { - members = new StructMember[3]; - members[0] = new StructMember("id", orb.create_string_tc(0), null); - members[1] = new StructMember("minor", orb.get_primitive_tc(TCKind.tk_long), null); - members[2] = new StructMember("completed", orb.get_primitive_tc(TCKind.tk_long), null); - } - return members; - } - - private static TypeCode getSystemExceptionTypeCode(ORB orb, String repID, String name) { - synchronized (TypeCode.class) { - return orb.create_exception_tc(repID, name, systemExceptionMembers(orb)); - } - } - - private static boolean isSystemExceptionTypeCode(TypeCode type, ORB orb) { - StructMember[] systemExceptionMembers = systemExceptionMembers(orb); - try { - return (type.kind().value() == TCKind._tk_except && - type.member_count() == 3 && - type.member_type(0).equal(systemExceptionMembers[0].type) && - type.member_type(1).equal(systemExceptionMembers[1].type) && - type.member_type(2).equal(systemExceptionMembers[2].type)); - } catch (BadKind ex) { - return false; - } catch (org.omg.CORBA.TypeCodePackage.Bounds ex) { - return false; - } - } - - /** - * Static method for writing a CORBA standard exception to an Any. - * @param any The Any to write the SystemException into. - */ - public static void insertSystemException(SystemException ex, Any any) { - OutputStream out = any.create_output_stream(); - ORB orb = (ORB)(out.orb()); - String name = ex.getClass().getName(); - String repID = ORBUtility.repositoryIdOf(name); - out.write_string(repID); - out.write_long(ex.minor); - out.write_long(ex.completed.value()); - any.read_value(out.create_input_stream(), - getSystemExceptionTypeCode(orb, repID, name)); - } - - public static SystemException extractSystemException(Any any) { - InputStream in = any.create_input_stream(); - ORB orb = (ORB)(in.orb()); - if ( ! isSystemExceptionTypeCode(any.type(), orb)) { - throw wrapper.unknownDsiSysex(CompletionStatus.COMPLETED_MAYBE); - } - return ORBUtility.readSystemException(in); - } - - /** - * Return default ValueHandler - */ - public static ValueHandler createValueHandler() { - ValueHandler vh; - try { - vh = AccessController.doPrivileged(new PrivilegedExceptionAction() { - public ValueHandler run() throws Exception { - return Util.createValueHandler(); - } - }); - } catch (PrivilegedActionException e) { - throw new InternalError(e.getCause()); - } - return vh; - } - - /** - * Returns true if it was accurately determined that the remote ORB is - * a foreign (non-JavaSoft) ORB. Note: If passed the ORBSingleton, this - * will return false. - */ - public static boolean isForeignORB(ORB orb) - { - if (orb == null) - return false; - - try { - return orb.getORBVersion().equals(ORBVersionFactory.getFOREIGN()); - } catch (SecurityException se) { - return false; - } - } - - /** Unmarshal a byte array to an integer. - Assume the bytes are in BIGENDIAN order. - i.e. array[offset] is the most-significant-byte - and array[offset+3] is the least-significant-byte. - @param array The array of bytes. - @param offset The offset from which to start unmarshalling. - */ - public static int bytesToInt(byte[] array, int offset) - { - int b1, b2, b3, b4; - - b1 = (array[offset++] << 24) & 0xFF000000; - b2 = (array[offset++] << 16) & 0x00FF0000; - b3 = (array[offset++] << 8) & 0x0000FF00; - b4 = (array[offset++] << 0) & 0x000000FF; - - return (b1 | b2 | b3 | b4); - } - - /** Marshal an integer to a byte array. - The bytes are in BIGENDIAN order. - i.e. array[offset] is the most-significant-byte - and array[offset+3] is the least-significant-byte. - @param array The array of bytes. - @param offset The offset from which to start marshalling. - */ - public static void intToBytes(int value, byte[] array, int offset) - { - array[offset++] = (byte)((value >>> 24) & 0xFF); - array[offset++] = (byte)((value >>> 16) & 0xFF); - array[offset++] = (byte)((value >>> 8) & 0xFF); - array[offset++] = (byte)((value >>> 0) & 0xFF); - } - - /** Converts an Ascii Character into Hexadecimal digit - */ - public static int hexOf( char x ) - { - int val; - - val = x - '0'; - if (val >=0 && val <= 9) - return val; - - val = (x - 'a') + 10; - if (val >= 10 && val <= 15) - return val; - - val = (x - 'A') + 10; - if (val >= 10 && val <= 15) - return val; - - throw wrapper.badHexDigit() ; - } - - // method moved from util.Utility - - /** - * Static method for writing a CORBA standard exception to a stream. - * @param strm The OutputStream to use for marshaling. - */ - public static void writeSystemException(SystemException ex, OutputStream strm) - { - String s; - - s = repositoryIdOf(ex.getClass().getName()); - strm.write_string(s); - strm.write_long(ex.minor); - strm.write_long(ex.completed.value()); - } - - /** - * Static method for reading a CORBA standard exception from a stream. - * @param strm The InputStream to use for unmarshaling. - */ - public static SystemException readSystemException(InputStream strm) - { - try { - String name = classNameOf(strm.read_string()); - SystemException ex = (SystemException)SharedSecrets. - getJavaCorbaAccess().loadClass(name).newInstance(); - ex.minor = strm.read_long(); - ex.completed = CompletionStatus.from_int(strm.read_long()); - return ex; - } catch ( Exception ex ) { - throw wrapper.unknownSysex( CompletionStatus.COMPLETED_MAYBE, ex ); - } - } - - /** - * Get the class name corresponding to a particular repository Id. - * This is used by the system to unmarshal (instantiate) the - * appropriate exception class for an marshaled as the value of - * its repository Id. - * @param repositoryId The repository Id for which we want a class name. - */ - public static String classNameOf(String repositoryId) - { - String className=null; - - className = (String) exceptionClassNames.get(repositoryId); - if (className == null) - className = "org.omg.CORBA.UNKNOWN"; - - return className; - } - - /** - * Return true if this repositoryId is a SystemException. - * @param repositoryId The repository Id to check. - */ - public static boolean isSystemException(String repositoryId) - { - String className=null; - - className = (String) exceptionClassNames.get(repositoryId); - if (className == null) - return false; - else - return true; - } - - /** - * @return the Java serialization encoding version. - */ - public static byte getEncodingVersion(ORB orb, IOR ior) { - - // Is Java serialization enabled? - // Check the JavaSerializationComponent (tagged component) - // in the IIOPProfile. If present, the peer ORB's GIOP is capable - // of using Java serialization instead of CDR serialization. - // In such a case, use Java serialization, iff the java serialization - // versions match. - - if (orb.getORBData().isJavaSerializationEnabled()) { - IIOPProfile prof = ior.getProfile(); - IIOPProfileTemplate profTemp = - (IIOPProfileTemplate) prof.getTaggedProfileTemplate(); - java.util.Iterator iter = profTemp.iteratorById( - ORBConstants.TAG_JAVA_SERIALIZATION_ID); - if (iter.hasNext()) { - JavaSerializationComponent jc = - (JavaSerializationComponent) iter.next(); - byte jcVersion = jc.javaSerializationVersion(); - if (jcVersion >= Message.JAVA_ENC_VERSION) { - return Message.JAVA_ENC_VERSION; - } else if (jcVersion > Message.CDR_ENC_VERSION) { - return jc.javaSerializationVersion(); - } else { - // throw error? - // Since encodingVersion is <= 0 (CDR_ENC_VERSION). - } - } - } - return Message.CDR_ENC_VERSION; // default - } - - /** - * Get the repository id corresponding to a particular class. - * This is used by the system to write the - * appropriate repository id for a system exception. - * @param name The class name of the system exception. - */ - public static String repositoryIdOf(String name) - { - String id; - - id = (String) exceptionRepositoryIds.get(name); - if (id == null) - id = "IDL:omg.org/CORBA/UNKNOWN:1.0"; - - return id; - } - - private static final Hashtable exceptionClassNames = new Hashtable(); - private static final Hashtable exceptionRepositoryIds = new Hashtable(); - - static { - - // - // construct repositoryId -> className hashtable - // - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_CONTEXT:1.0", - "org.omg.CORBA.BAD_CONTEXT"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_INV_ORDER:1.0", - "org.omg.CORBA.BAD_INV_ORDER"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_OPERATION:1.0", - "org.omg.CORBA.BAD_OPERATION"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_PARAM:1.0", - "org.omg.CORBA.BAD_PARAM"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_TYPECODE:1.0", - "org.omg.CORBA.BAD_TYPECODE"); - exceptionClassNames.put("IDL:omg.org/CORBA/COMM_FAILURE:1.0", - "org.omg.CORBA.COMM_FAILURE"); - exceptionClassNames.put("IDL:omg.org/CORBA/DATA_CONVERSION:1.0", - "org.omg.CORBA.DATA_CONVERSION"); - exceptionClassNames.put("IDL:omg.org/CORBA/IMP_LIMIT:1.0", - "org.omg.CORBA.IMP_LIMIT"); - exceptionClassNames.put("IDL:omg.org/CORBA/INTF_REPOS:1.0", - "org.omg.CORBA.INTF_REPOS"); - exceptionClassNames.put("IDL:omg.org/CORBA/INTERNAL:1.0", - "org.omg.CORBA.INTERNAL"); - exceptionClassNames.put("IDL:omg.org/CORBA/INV_FLAG:1.0", - "org.omg.CORBA.INV_FLAG"); - exceptionClassNames.put("IDL:omg.org/CORBA/INV_IDENT:1.0", - "org.omg.CORBA.INV_IDENT"); - exceptionClassNames.put("IDL:omg.org/CORBA/INV_OBJREF:1.0", - "org.omg.CORBA.INV_OBJREF"); - exceptionClassNames.put("IDL:omg.org/CORBA/MARSHAL:1.0", - "org.omg.CORBA.MARSHAL"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_MEMORY:1.0", - "org.omg.CORBA.NO_MEMORY"); - exceptionClassNames.put("IDL:omg.org/CORBA/FREE_MEM:1.0", - "org.omg.CORBA.FREE_MEM"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_IMPLEMENT:1.0", - "org.omg.CORBA.NO_IMPLEMENT"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_PERMISSION:1.0", - "org.omg.CORBA.NO_PERMISSION"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_RESOURCES:1.0", - "org.omg.CORBA.NO_RESOURCES"); - exceptionClassNames.put("IDL:omg.org/CORBA/NO_RESPONSE:1.0", - "org.omg.CORBA.NO_RESPONSE"); - exceptionClassNames.put("IDL:omg.org/CORBA/OBJ_ADAPTER:1.0", - "org.omg.CORBA.OBJ_ADAPTER"); - exceptionClassNames.put("IDL:omg.org/CORBA/INITIALIZE:1.0", - "org.omg.CORBA.INITIALIZE"); - exceptionClassNames.put("IDL:omg.org/CORBA/PERSIST_STORE:1.0", - "org.omg.CORBA.PERSIST_STORE"); - exceptionClassNames.put("IDL:omg.org/CORBA/TRANSIENT:1.0", - "org.omg.CORBA.TRANSIENT"); - exceptionClassNames.put("IDL:omg.org/CORBA/UNKNOWN:1.0", - "org.omg.CORBA.UNKNOWN"); - exceptionClassNames.put("IDL:omg.org/CORBA/OBJECT_NOT_EXIST:1.0", - "org.omg.CORBA.OBJECT_NOT_EXIST"); - - // SystemExceptions from OMG Transactions Service Spec - exceptionClassNames.put("IDL:omg.org/CORBA/INVALID_TRANSACTION:1.0", - "org.omg.CORBA.INVALID_TRANSACTION"); - exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_REQUIRED:1.0", - "org.omg.CORBA.TRANSACTION_REQUIRED"); - exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_ROLLEDBACK:1.0", - "org.omg.CORBA.TRANSACTION_ROLLEDBACK"); - - // from portability RTF 98-07-01.txt - exceptionClassNames.put("IDL:omg.org/CORBA/INV_POLICY:1.0", - "org.omg.CORBA.INV_POLICY"); - - // from orbrev/00-09-01 (CORBA 2.4 Draft Specification) - exceptionClassNames. - put("IDL:omg.org/CORBA/TRANSACTION_UNAVAILABLE:1.0", - "org.omg.CORBA.TRANSACTION_UNAVAILABLE"); - exceptionClassNames.put("IDL:omg.org/CORBA/TRANSACTION_MODE:1.0", - "org.omg.CORBA.TRANSACTION_MODE"); - - // Exception types introduced between CORBA 2.4 and 3.0 - exceptionClassNames.put("IDL:omg.org/CORBA/CODESET_INCOMPATIBLE:1.0", - "org.omg.CORBA.CODESET_INCOMPATIBLE"); - exceptionClassNames.put("IDL:omg.org/CORBA/REBIND:1.0", - "org.omg.CORBA.REBIND"); - exceptionClassNames.put("IDL:omg.org/CORBA/TIMEOUT:1.0", - "org.omg.CORBA.TIMEOUT"); - exceptionClassNames.put("IDL:omg.org/CORBA/BAD_QOS:1.0", - "org.omg.CORBA.BAD_QOS"); - - // Exception types introduced in CORBA 3.0 - exceptionClassNames.put("IDL:omg.org/CORBA/INVALID_ACTIVITY:1.0", - "org.omg.CORBA.INVALID_ACTIVITY"); - exceptionClassNames.put("IDL:omg.org/CORBA/ACTIVITY_COMPLETED:1.0", - "org.omg.CORBA.ACTIVITY_COMPLETED"); - exceptionClassNames.put("IDL:omg.org/CORBA/ACTIVITY_REQUIRED:1.0", - "org.omg.CORBA.ACTIVITY_REQUIRED"); - - // - // construct className -> repositoryId hashtable - // - Enumeration keys = exceptionClassNames.keys(); - java.lang.Object s; - String rId; - String cName; - - try{ - while (keys.hasMoreElements()) { - s = keys.nextElement(); - rId = (String) s; - cName = (String) exceptionClassNames.get(rId); - exceptionRepositoryIds.put (cName, rId); - } - } catch (NoSuchElementException e) { } - } - - /** Parse a version string such as "1.1.6" or "jdk1.2fcs" into - a version array of integers {1, 1, 6} or {1, 2}. - A string of "n." or "n..m" is equivalent to "n.0" or "n.0.m" respectively. - */ - public static int[] parseVersion(String version) { - if (version == null) - return new int[0]; - char[] s = version.toCharArray(); - //find the maximum span of the string "n.n.n..." where n is an integer - int start = 0; - for (; start < s.length && (s[start] < '0' || s[start] > '9'); ++start) - if (start == s.length) //no digit found - return new int[0]; - int end = start + 1; - int size = 1; - for (; end < s.length; ++end) - if (s[end] == '.') - ++size; - else if (s[end] < '0' || s[end] > '9') - break; - int[] val = new int[size]; - for (int i = 0; i < size; ++i) { - int dot = version.indexOf('.', start); - if (dot == -1 || dot > end) - dot = end; - if (start >= dot) //cases like "n." or "n..m" - val[i] = 0; //convert equivalent to "n.0" or "n.0.m" - else - val[i] = Integer.parseInt(version.substring(start, dot)); - start = dot + 1; - } - return val; - } - - /** Compare two version arrays. - Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2. - */ - public static int compareVersion(int[] v1, int[] v2) { - if (v1 == null) - v1 = new int[0]; - if (v2 == null) - v2 = new int[0]; - for (int i = 0; i < v1.length; ++i) { - if (i >= v2.length || v1[i] > v2[i]) //v1 is longer or greater than v2 - return 1; - if (v1[i] < v2[i]) - return -1; - } - return v1.length == v2.length ? 0 : -1; - } - - /** Compare two version strings. - Return 1, 0 or -1 if v1 is greater than, equal to, or less than v2. - */ - public static synchronized int compareVersion(String v1, String v2) { - return compareVersion(parseVersion(v1), parseVersion(v2)); - } - - private static String compressClassName( String name ) - { - // Note that this must end in . in order to be renamed correctly. - String prefix = "com.sun.corba.se." ; - if (name.startsWith( prefix ) ) { - return "(ORB)." + name.substring( prefix.length() ) ; - } else - return name ; - } - - // Return a compressed representation of the thread name. This is particularly - // useful on the server side, where there are many SelectReaderThreads, and - // we need a short unambiguous name for such threads. - public static String getThreadName( Thread thr ) - { - if (thr == null) - return "null" ; - - // This depends on the formatting in SelectReaderThread and CorbaConnectionImpl. - // Pattern for SelectReaderThreads: - // SelectReaderThread CorbaConnectionImpl[ ] - // Any other pattern in the Thread's name is just returned. - String name = thr.getName() ; - StringTokenizer st = new StringTokenizer( name ) ; - int numTokens = st.countTokens() ; - if (numTokens != 5) - return name ; - - String[] tokens = new String[numTokens] ; - for (int ctr=0; ctr= 0 ? - "(" + ste.getFileName() + ":" + ste.getLineNumber() + ")" : - (ste.getFileName() != null ? "("+ste.getFileName()+")" : "(Unknown Source)"))); - } - - private static void printStackTrace( StackTraceElement[] trace ) - { - System.out.println( " Stack Trace:" ) ; - // print the stack trace, ommitting the zeroth element, which is - // always this method. - for ( int ctr = 1; ctr < trace.length; ctr++ ) { - System.out.print( " >" ) ; - System.out.println( formatStackTraceElement( trace[ctr] ) ) ; - } - } - - // - // Implements all dprint calls in this package. - // - public static synchronized void dprint(java.lang.Object obj, String msg) { - System.out.println( - compressClassName( obj.getClass().getName() ) + "(" + - getThreadName( Thread.currentThread() ) + "): " + msg); - } - - public static synchronized void dprint(String className, String msg) { - System.out.println( - compressClassName( className ) + "(" + - getThreadName( Thread.currentThread() ) + "): " + msg); - } - - public synchronized void dprint(String msg) { - ORBUtility.dprint(this, msg); - } - - public static synchronized void dprintTrace(Object obj, String msg) { - ORBUtility.dprint(obj, msg); - - Throwable thr = new Throwable() ; - printStackTrace( thr.getStackTrace() ) ; - } - - public static synchronized void dprint(java.lang.Object caller, - String msg, Throwable t) - { - System.out.println( - compressClassName( caller.getClass().getName() ) + - '(' + Thread.currentThread() + "): " + msg); - - if (t != null) - printStackTrace( t.getStackTrace() ) ; - } - - public static String[] concatenateStringArrays( String[] arr1, String[] arr2 ) - { - String[] result = new String[ - arr1.length + arr2.length ] ; - - for (int ctr = 0; ctr() { - public ValueHandler run() throws Exception { - return Util.createValueHandler(); - } - }); - } catch (PrivilegedActionException e) { - throw new InternalError(e.getCause()); - } - - if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat)) - return ORBConstants.STREAM_FORMAT_VERSION_1; - else - return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion(); - } - - public static CorbaClientDelegate makeClientDelegate( IOR ior ) - { - ORB orb = ior.getORB() ; - CorbaContactInfoList ccil = orb.getCorbaContactInfoListFactory().create( ior ) ; - CorbaClientDelegate del = orb.getClientDelegateFactory().create(ccil); - return del ; - } - - /** This method is used to create untyped object references. - */ - public static org.omg.CORBA.Object makeObjectReference( IOR ior ) - { - CorbaClientDelegate del = makeClientDelegate( ior ) ; - org.omg.CORBA.Object objectImpl = new CORBAObjectImpl() ; - StubAdapter.setDelegate( objectImpl, del ) ; - return objectImpl ; - } - - /** This method obtains an IOR from a CORBA object reference. - * It will return null if obj is a local object, a null object, - * or an object implemented by a different ORB. It will - * throw BAD_OPERATION if obj is an unconnected RMI-IIOP object. - * @return IOR the IOR that represents this objref. This will - * never be null. - * @exception BAD_OPERATION (from oi._get_delegate) if obj is a - * normal objref, but does not have a delegate set. - * @exception BAD_PARAM if obj is a local object, or else was - * created by a foreign ORB. - */ - public static IOR getIOR( org.omg.CORBA.Object obj ) - { - if (obj == null) - throw wrapper.nullObjectReference() ; - - IOR ior = null ; - if (StubAdapter.isStub(obj)) { - org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate( - obj ) ; - - if (del instanceof CorbaClientDelegate) { - CorbaClientDelegate cdel = (CorbaClientDelegate)del ; - ContactInfoList cil = cdel.getContactInfoList() ; - - if (cil instanceof CorbaContactInfoList) { - CorbaContactInfoList ccil = (CorbaContactInfoList)cil ; - ior = ccil.getTargetIOR() ; - if (ior == null) - throw wrapper.nullIor() ; - - return ior ; - } else { - // This is our code, but the ContactInfoList is not a - // CorbaContactInfoList. This should not happen, because - // we are in the CORBA application of the DCSA framework. - // This is a coding error, and thus an INTERNAL exception - // should be thrown. - // XXX needs minor code - throw new INTERNAL() ; - } - } - - // obj is implemented by a foreign ORB, because the Delegate is not a - // ClientDelegate. - // XXX this case could be handled by marshalling and - // unmarshalling. However, object_to_string cannot be used - // here, as it is implemented with getIOR. Note that this - // will require access to an ORB, so that we can create streams - // as needed. The ORB is available simply as io._orb(). - throw wrapper.objrefFromForeignOrb() ; - } else - throw wrapper.localObjectNotAllowed() ; - } - - /** Obtains an IOR for the object reference obj, first connecting it to - * the ORB if necessary. - * @return IOR the IOR that represents this objref. This will - * never be null. - * @exception BAD_OPERATION if the object could not be connected, - * if a connection attempt was needed. - * @exception BAD_PARAM if obj is a local object, or else was - * created by a foreign ORB. - */ - public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj ) - { - IOR result ; - try { - result = getIOR( obj ) ; - } catch (BAD_OPERATION bop) { - if (StubAdapter.isStub(obj)) { - try { - StubAdapter.connect( obj, orb ) ; - } catch (java.rmi.RemoteException exc) { - throw wrapper.connectingServant( exc ) ; - } - } else { - orb.connect( obj ) ; - } - - result = getIOR( obj ) ; - } - - return result ; - } - - public static String operationNameAndRequestId(CorbaMessageMediator m) - { - return "op/" + m.getOperationName() + " id/" + m.getRequestId(); - } - - public static boolean isPrintable(char c) - { - if (Character.isJavaIdentifierStart(c)) { - // Letters and $ _ - return true; - } - if (Character.isDigit(c)) { - return true; - } - switch (Character.getType(c)) { - case Character.MODIFIER_SYMBOL : return true; // ` ^ - case Character.DASH_PUNCTUATION : return true; // - - case Character.MATH_SYMBOL : return true; // = ~ + | < > - case Character.OTHER_PUNCTUATION : return true; // !@#%&*;':",./? - case Character.START_PUNCTUATION : return true; // ( [ { - case Character.END_PUNCTUATION : return true; // ) ] } - } - return false; - } - - public static String getClassSecurityInfo(final Class cl) - { - // Returns a String which looks similar to: - // PermissionCollection java.security.Permissions@1053693 ... - // (java.io.FilePermission <> ....) - // (java.io.FilePermission /export0/sunwappserv/lib/- ...) - // ... other permissions ... - // Domain ProtectionDomain (file:/export0/sunwappserv/lib-) - // java.security.Permissions@141fedb ( - // (java.io.FilePermission <> ...) - // (java.io.FilePermission /var/tmp//- ...) - - String result = - (String)AccessController.doPrivileged(new PrivilegedAction() { - public java.lang.Object run() { - StringBuffer sb = new StringBuffer(500); - ProtectionDomain pd = cl.getProtectionDomain(); - Policy policy = Policy.getPolicy(); - PermissionCollection pc = policy.getPermissions(pd); - sb.append("\nPermissionCollection "); - sb.append(pc.toString()); - // Don't need to add 'Protection Domain' string, it's - // in ProtectionDomain.toString() already. - sb.append(pd.toString()); - return sb.toString(); - } - }); - return result; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java 2018-01-30 20:19:12.000000000 -0500 +++ /dev/null 2018-01-30 20:19:12.000000000 -0500 @@ -1,558 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.orbutil; - -// for computing the structural UID -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.DigestOutputStream; -import java.security.AccessController; -import java.security.PrivilegedExceptionAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedAction; -import java.io.DataOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; - -import java.util.Arrays; -import java.util.Comparator; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.lang.reflect.Array; -import java.lang.reflect.Member; -import java.lang.reflect.Method; -import java.lang.reflect.Constructor; - - -import com.sun.corba.se.impl.io.ObjectStreamClass; - -public final class ObjectStreamClassUtil_1_3 { - - // maintained here for backward compatability with JDK 1.3, where - // writeObject method was not being checked at all, so there is - // no need to lookup the ObjectStreamClass - - public static long computeSerialVersionUID(final Class cl) { - - long csuid = ObjectStreamClass.getSerialVersionUID(cl); - if (csuid == 0) - return csuid; // for non-serializable/proxy classes - - csuid = (ObjectStreamClassUtil_1_3.getSerialVersion(csuid, cl).longValue()); - return csuid; - } - - - // to maintain same suid as the JDK 1.3, we pick - // up suid only for classes with private,static,final - // declarations, and compute it for all others - - private static Long getSerialVersion(final long csuid, final Class cl) - { - return (Long) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - long suid; - try { - final Field f = cl.getDeclaredField("serialVersionUID"); - int mods = f.getModifiers(); - if (Modifier.isStatic(mods) && - Modifier.isFinal(mods) && Modifier.isPrivate(mods)) { - suid = csuid; - } else { - suid = _computeSerialVersionUID(cl); - } - } catch (NoSuchFieldException ex) { - suid = _computeSerialVersionUID(cl); - //} catch (IllegalAccessException ex) { - // suid = _computeSerialVersionUID(cl); - } - return new Long(suid); - } - }); - } - - public static long computeStructuralUID(boolean hasWriteObject, Class cl) { - ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); - - long h = 0; - try { - - if ((!java.io.Serializable.class.isAssignableFrom(cl)) || - (cl.isInterface())){ - return 0; - } - - if (java.io.Externalizable.class.isAssignableFrom(cl)) { - return 1; - } - - MessageDigest md = MessageDigest.getInstance("SHA"); - DigestOutputStream mdo = new DigestOutputStream(devnull, md); - DataOutputStream data = new DataOutputStream(mdo); - - //In the old case, for the caller class, the write Method wasn't considered - // for rep-id calculations correctly, but for parent classes it was taken - // into account. That is the reason there is the klude of getting the write - // Object method in there - - // Get SUID of parent - Class parent = cl.getSuperclass(); - if ((parent != null) && (parent != java.lang.Object.class)) { - boolean hasWriteObjectFlag = false; - Class [] args = {java.io.ObjectOutputStream.class}; - Method hasWriteObjectMethod = ObjectStreamClassUtil_1_3.getDeclaredMethod(parent, "writeObject", args, - Modifier.PRIVATE, Modifier.STATIC); - if (hasWriteObjectMethod != null) - hasWriteObjectFlag = true; - data.writeLong(ObjectStreamClassUtil_1_3.computeStructuralUID(hasWriteObjectFlag, parent)); - } - - if (hasWriteObject) - data.writeInt(2); - else - data.writeInt(1); - - /* Sort the field names to get a deterministic order */ - Field[] field = ObjectStreamClassUtil_1_3.getDeclaredFields(cl); - Arrays.sort(field, compareMemberByName); - - for (int i = 0; i < field.length; i++) { - Field f = field[i]; - - /* Include in the hash all fields except those that are - * transient or static. - */ - int m = f.getModifiers(); - if (Modifier.isTransient(m) || Modifier.isStatic(m)) - continue; - - data.writeUTF(f.getName()); - data.writeUTF(getSignature(f.getType())); - } - - /* Compute the hash value for this class. - * Use only the first 64 bits of the hash. - */ - data.flush(); - byte hasharray[] = md.digest(); - int minimum = Math.min(8, hasharray.length); - for (int i = minimum; i > 0; i--) { - h += (long)(hasharray[i] & 255) << (i * 8); - } - } catch (IOException ignore) { - /* can't happen, but be deterministic anyway. */ - h = -1; - } catch (NoSuchAlgorithmException complain) { - throw new SecurityException(complain.getMessage()); - } - return h; - } - - /* - * Compute a hash for the specified class. Incrementally add - * items to the hash accumulating in the digest stream. - * Fold the hash into a long. Use the SHA secure hash function. - */ - private static long _computeSerialVersionUID(Class cl) { - ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); - - long h = 0; - try { - MessageDigest md = MessageDigest.getInstance("SHA"); - DigestOutputStream mdo = new DigestOutputStream(devnull, md); - DataOutputStream data = new DataOutputStream(mdo); - - - data.writeUTF(cl.getName()); - - int classaccess = cl.getModifiers(); - classaccess &= (Modifier.PUBLIC | Modifier.FINAL | - Modifier.INTERFACE | Modifier.ABSTRACT); - - /* Workaround for javac bug that only set ABSTRACT for - * interfaces if the interface had some methods. - * The ABSTRACT bit reflects that the number of methods > 0. - * This is required so correct hashes can be computed - * for existing class files. - * Previously this hack was previously present in the VM. - */ - Method[] method = cl.getDeclaredMethods(); - if ((classaccess & Modifier.INTERFACE) != 0) { - classaccess &= (~Modifier.ABSTRACT); - if (method.length > 0) { - classaccess |= Modifier.ABSTRACT; - } - } - - data.writeInt(classaccess); - - /* - * Get the list of interfaces supported, - * Accumulate their names their names in Lexical order - * and add them to the hash - */ - if (!cl.isArray()) { - /* In 1.2fcs, getInterfaces() was modified to return - * {java.lang.Cloneable, java.io.Serializable} when - * called on array classes. These values would upset - * the computation of the hash, so we explicitly omit - * them from its computation. - */ - - Class interfaces[] = cl.getInterfaces(); - Arrays.sort(interfaces, compareClassByName); - - for (int i = 0; i < interfaces.length; i++) { - data.writeUTF(interfaces[i].getName()); - } - } - - /* Sort the field names to get a deterministic order */ - Field[] field = cl.getDeclaredFields(); - Arrays.sort(field, compareMemberByName); - - for (int i = 0; i < field.length; i++) { - Field f = field[i]; - - /* Include in the hash all fields except those that are - * private transient and private static. - */ - int m = f.getModifiers(); - if (Modifier.isPrivate(m) && - (Modifier.isTransient(m) || Modifier.isStatic(m))) - continue; - - data.writeUTF(f.getName()); - data.writeInt(m); - data.writeUTF(getSignature(f.getType())); - } - - // need to find the java replacement for hasStaticInitializer - if (hasStaticInitializer(cl)) { - data.writeUTF(""); - data.writeInt(Modifier.STATIC); // TBD: what modifiers does it have - data.writeUTF("()V"); - } - - /* - * Get the list of constructors including name and signature - * Sort lexically, add all except the private constructors - * to the hash with their access flags - */ - - MethodSignature[] constructors = - MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors()); - for (int i = 0; i < constructors.length; i++) { - MethodSignature c = constructors[i]; - String mname = ""; - String desc = c.signature; - desc = desc.replace('/', '.'); - data.writeUTF(mname); - data.writeInt(c.member.getModifiers()); - data.writeUTF(desc); - } - - /* Include in the hash all methods except those that are - * private transient and private static. - */ - MethodSignature[] methods = - MethodSignature.removePrivateAndSort(method); - for (int i = 0; i < methods.length; i++ ) { - MethodSignature m = methods[i]; - String desc = m.signature; - desc = desc.replace('/', '.'); - data.writeUTF(m.member.getName()); - data.writeInt(m.member.getModifiers()); - data.writeUTF(desc); - } - - /* Compute the hash value for this class. - * Use only the first 64 bits of the hash. - */ - data.flush(); - byte hasharray[] = md.digest(); - for (int i = 0; i < Math.min(8, hasharray.length); i++) { - h += (long)(hasharray[i] & 255) << (i * 8); - } - } catch (IOException ignore) { - /* can't happen, but be deterministic anyway. */ - h = -1; - } catch (NoSuchAlgorithmException complain) { - throw new SecurityException(complain.getMessage()); - } - return h; - } - - /* - * Comparator object for Classes and Interfaces - */ - private static Comparator compareClassByName = - new CompareClassByName(); - - private static class CompareClassByName implements Comparator { - public int compare(Object o1, Object o2) { - Class c1 = (Class)o1; - Class c2 = (Class)o2; - return (c1.getName()).compareTo(c2.getName()); - } - } - - /* - * Comparator object for Members, Fields, and Methods - */ - private static Comparator compareMemberByName = - new CompareMemberByName(); - - private static class CompareMemberByName implements Comparator { - public int compare(Object o1, Object o2) { - String s1 = ((Member)o1).getName(); - String s2 = ((Member)o2).getName(); - - if (o1 instanceof Method) { - s1 += getSignature((Method)o1); - s2 += getSignature((Method)o2); - } else if (o1 instanceof Constructor) { - s1 += getSignature((Constructor)o1); - s2 += getSignature((Constructor)o2); - } - return s1.compareTo(s2); - } - } - - /** - * Compute the JVM signature for the class. - */ - private static String getSignature(Class clazz) { - String type = null; - if (clazz.isArray()) { - Class cl = clazz; - int dimensions = 0; - while (cl.isArray()) { - dimensions++; - cl = cl.getComponentType(); - } - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < dimensions; i++) { - sb.append("["); - } - sb.append(getSignature(cl)); - type = sb.toString(); - } else if (clazz.isPrimitive()) { - if (clazz == Integer.TYPE) { - type = "I"; - } else if (clazz == Byte.TYPE) { - type = "B"; - } else if (clazz == Long.TYPE) { - type = "J"; - } else if (clazz == Float.TYPE) { - type = "F"; - } else if (clazz == Double.TYPE) { - type = "D"; - } else if (clazz == Short.TYPE) { - type = "S"; - } else if (clazz == Character.TYPE) { - type = "C"; - } else if (clazz == Boolean.TYPE) { - type = "Z"; - } else if (clazz == Void.TYPE) { - type = "V"; - } - } else { - type = "L" + clazz.getName().replace('.', '/') + ";"; - } - return type; - } - - /* - * Compute the JVM method descriptor for the method. - */ - private static String getSignature(Method meth) { - StringBuffer sb = new StringBuffer(); - - sb.append("("); - - Class[] params = meth.getParameterTypes(); // avoid clone - for (int j = 0; j < params.length; j++) { - sb.append(getSignature(params[j])); - } - sb.append(")"); - sb.append(getSignature(meth.getReturnType())); - return sb.toString(); - } - - /* - * Compute the JVM constructor descriptor for the constructor. - */ - private static String getSignature(Constructor cons) { - StringBuffer sb = new StringBuffer(); - - sb.append("("); - - Class[] params = cons.getParameterTypes(); // avoid clone - for (int j = 0; j < params.length; j++) { - sb.append(getSignature(params[j])); - } - sb.append(")V"); - return sb.toString(); - } - - private static Field[] getDeclaredFields(final Class clz) { - return (Field[]) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return clz.getDeclaredFields(); - } - }); - } - - private static class MethodSignature implements Comparator { - Member member; - String signature; // cached parameter signature - - /* Given an array of Method or Constructor members, - return a sorted array of the non-private members.*/ - /* A better implementation would be to implement the returned data - structure as an insertion sorted link list.*/ - static MethodSignature[] removePrivateAndSort(Member[] m) { - int numNonPrivate = 0; - for (int i = 0; i < m.length; i++) { - if (! Modifier.isPrivate(m[i].getModifiers())) { - numNonPrivate++; - } - } - MethodSignature[] cm = new MethodSignature[numNonPrivate]; - int cmi = 0; - for (int i = 0; i < m.length; i++) { - if (! Modifier.isPrivate(m[i].getModifiers())) { - cm[cmi] = new MethodSignature(m[i]); - cmi++; - } - } - if (cmi > 0) - Arrays.sort(cm, cm[0]); - return cm; - } - - /* Assumes that o1 and o2 are either both methods - or both constructors.*/ - public int compare(Object o1, Object o2) { - /* Arrays.sort calls compare when o1 and o2 are equal.*/ - if (o1 == o2) - return 0; - - MethodSignature c1 = (MethodSignature)o1; - MethodSignature c2 = (MethodSignature)o2; - - int result; - if (isConstructor()) { - result = c1.signature.compareTo(c2.signature); - } else { // is a Method. - result = c1.member.getName().compareTo(c2.member.getName()); - if (result == 0) - result = c1.signature.compareTo(c2.signature); - } - return result; - } - - final private boolean isConstructor() { - return member instanceof Constructor; - } - private MethodSignature(Member m) { - member = m; - if (isConstructor()) { - signature = ObjectStreamClassUtil_1_3.getSignature((Constructor)m); - } else { - signature = ObjectStreamClassUtil_1_3.getSignature((Method)m); - } - } - } - - /* Find out if the class has a static class initializer */ - // use java.io.ObjectStream's hasStaticInitializer method - // private static native boolean hasStaticInitializer(Class cl); - - private static Method hasStaticInitializerMethod = null; - /** - * Returns true if the given class defines a static initializer method, - * false otherwise. - */ - private static boolean hasStaticInitializer(Class cl) { - if (hasStaticInitializerMethod == null) { - Class classWithThisMethod = null; - - try { - if (classWithThisMethod == null) - classWithThisMethod = java.io.ObjectStreamClass.class; - - hasStaticInitializerMethod = - classWithThisMethod.getDeclaredMethod("hasStaticInitializer", - new Class[] { Class.class }); - } catch (NoSuchMethodException ex) { - } - - if (hasStaticInitializerMethod == null) { - throw new InternalError("Can't find hasStaticInitializer method on " - + classWithThisMethod.getName()); - } - hasStaticInitializerMethod.setAccessible(true); - } - try { - Boolean retval = (Boolean) - hasStaticInitializerMethod.invoke(null, new Object[] { cl }); - return retval.booleanValue(); - } catch (Exception ex) { - throw new InternalError("Error invoking hasStaticInitializer: " - + ex); - } - } - - private static Method getDeclaredMethod(final Class cl, final String methodName, final Class[] args, - final int requiredModifierMask, - final int disallowedModifierMask) { - return (Method) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - Method method = null; - try { - method = - cl.getDeclaredMethod(methodName, args); - int mods = method.getModifiers(); - if ((mods & disallowedModifierMask) != 0 || - (mods & requiredModifierMask) != requiredModifierMask) { - method = null; - } - //if (!Modifier.isPrivate(mods) || - // Modifier.isStatic(mods)) { - // method = null; - //} - } catch (NoSuchMethodException e) { - // Since it is alright if methodName does not exist, - // no need to do anything special here. - } - return method; - } - }); - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java 2018-01-30 20:19:12.000000000 -0500 +++ /dev/null 2018-01-30 20:19:13.000000000 -0500 @@ -1,1262 +0,0 @@ -/* - * Copyright (c) 2001, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.orbutil; - -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.DigestOutputStream; -import java.security.AccessController; -import java.security.PrivilegedExceptionAction; -import java.security.PrivilegedActionException; -import java.security.PrivilegedAction; - -import java.lang.reflect.Modifier; -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.lang.reflect.Member; -import java.lang.reflect.Method; -import java.lang.reflect.Constructor; -import java.lang.reflect.Proxy; -import java.lang.reflect.InvocationTargetException; - -import java.io.IOException; -import java.io.DataOutputStream; -import java.io.ByteArrayOutputStream; -import java.io.InvalidClassException; -import java.io.Serializable; -import java.io.Externalizable; - -import java.util.Arrays; -import java.util.Comparator; -import java.util.Hashtable; - -import org.omg.CORBA.ValueMember; - -import com.sun.corba.se.impl.io.ValueUtility; -import com.sun.corba.se.impl.io.ObjectStreamClass; - -/** - * This is duplicated here to preserve the JDK 1.3.1FCS behavior - * of calculating the OMG hash code incorrectly when serialPersistentFields - * is used, but some of the fields no longer exist in the class itself. - * - * We have to duplicate it since we aren't allowed to modify the - * com.sun.corba.se.impl.io version further, and can't make it - * public outside of its package for security reasons. - */ -/** - * A ObjectStreamClass_1_3_1 describes a class that can be serialized to a stream - * or a class that was serialized to a stream. It contains the name - * and the serialVersionUID of the class. - *
- * The ObjectStreamClass_1_3_1 for a specific class loaded in this Java VM can - * be found using the lookup method. - * - * @author Roger Riggs - * @since JDK1.1 - */ -public class ObjectStreamClass_1_3_1 implements java.io.Serializable { - - public static final long kDefaultUID = -1; - - private static Object noArgsList[] = {}; - private static Class noTypesList[] = {}; - - private static Hashtable translatedFields; - - /** Find the descriptor for a class that can be serialized. Null - * is returned if the specified class does not implement - * java.io.Serializable or java.io.Externalizable. - */ - static final ObjectStreamClass_1_3_1 lookup(Class cl) - { - ObjectStreamClass_1_3_1 desc = lookupInternal(cl); - if (desc.isSerializable() || desc.isExternalizable()) - return desc; - return null; - } - - /* - * Find the class descriptor for the specified class. - * Package access only so it can be called from ObjectIn/OutStream. - */ - static ObjectStreamClass_1_3_1 lookupInternal(Class cl) - { - /* Synchronize on the hashtable so no two threads will do - * this at the same time. - */ - ObjectStreamClass_1_3_1 desc = null; - synchronized (descriptorFor) { - /* Find the matching descriptor if it already known */ - desc = findDescriptorFor(cl); - if (desc != null) { - return desc; - } - - /* Check if it's serializable */ - boolean serializable = Serializable.class.isAssignableFrom(cl); - /* If the class is only Serializable, - * lookup the descriptor for the superclass. - */ - ObjectStreamClass_1_3_1 superdesc = null; - if (serializable) { - Class superclass = cl.getSuperclass(); - if (superclass != null) - superdesc = lookup(superclass); - } - - /* Check if its' externalizable. - * If it's Externalizable, clear the serializable flag. - * Only one or the other may be set in the protocol. - */ - boolean externalizable = false; - if (serializable) { - externalizable = - ((superdesc != null) && superdesc.isExternalizable()) || - Externalizable.class.isAssignableFrom(cl); - if (externalizable) { - serializable = false; - } - } - - /* Create a new version descriptor, - * it put itself in the known table. - */ - desc = new ObjectStreamClass_1_3_1(cl, superdesc, - serializable, externalizable); - } - desc.init(); - return desc; - } - - /** - * The name of the class described by this descriptor. - */ - public final String getName() { - return name; - } - - /** - * Return the serialVersionUID for this class. - * The serialVersionUID defines a set of classes all with the same name - * that have evolved from a common root class and agree to be serialized - * and deserialized using a common format. - */ - public static final long getSerialVersionUID( java.lang.Class clazz) { - ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz ); - if( theosc != null ) - { - return theosc.getSerialVersionUID( ); - } - return 0; - } - - /** - * Return the serialVersionUID for this class. - * The serialVersionUID defines a set of classes all with the same name - * that have evolved from a common root class and agree to be serialized - * and deserialized using a common format. - */ - public final long getSerialVersionUID() { - return suid; - } - - /** - * Return the serialVersionUID string for this class. - * The serialVersionUID defines a set of classes all with the same name - * that have evolved from a common root class and agree to be serialized - * and deserialized using a common format. - */ - public final String getSerialVersionUIDStr() { - if (suidStr == null) - suidStr = Long.toHexString(suid).toUpperCase(); - return suidStr; - } - - /** - * Return the actual (computed) serialVersionUID for this class. - */ - public static final long getActualSerialVersionUID( java.lang.Class clazz ) - { - ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz ); - if( theosc != null ) - { - return theosc.getActualSerialVersionUID( ); - } - return 0; - } - - /** - * Return the actual (computed) serialVersionUID for this class. - */ - public final long getActualSerialVersionUID() { - return actualSuid; - } - - /** - * Return the actual (computed) serialVersionUID for this class. - */ - public final String getActualSerialVersionUIDStr() { - if (actualSuidStr == null) - actualSuidStr = Long.toHexString(actualSuid).toUpperCase(); - return actualSuidStr; - } - - /** - * Return the class in the local VM that this version is mapped to. - * Null is returned if there is no corresponding local class. - */ - public final Class forClass() { - return ofClass; - } - - /** - * Return an array of the fields of this serializable class. - * @return an array containing an element for each persistent - * field of this class. Returns an array of length zero if - * there are no fields. - * @since JDK1.2 - */ - public ObjectStreamField[] getFields() { - // Return a copy so the caller can't change the fields. - if (fields.length > 0) { - ObjectStreamField[] dup = new ObjectStreamField[fields.length]; - System.arraycopy(fields, 0, dup, 0, fields.length); - return dup; - } else { - return fields; - } - } - - public boolean hasField(ValueMember field){ - - for (int i = 0; i < fields.length; i++){ - try{ - if (fields[i].getName().equals(field.name)) { - - if (fields[i].getSignature().equals(ValueUtility.getSignature(field))) - return true; - } - } - catch(Throwable t){} - } - return false; - } - - /* Avoid unnecessary allocations. */ - final ObjectStreamField[] getFieldsNoCopy() { - return fields; - } - - /** - * Get the field of this class by name. - * @return The ObjectStreamField object of the named field or null if there - * is no such named field. - */ - public final ObjectStreamField getField(String name) { - /* Binary search of fields by name. - */ - for (int i = fields.length-1; i >= 0; i--) { - if (name.equals(fields[i].getName())) { - return fields[i]; - } - } - return null; - } - - public Serializable writeReplace(Serializable value) { - if (writeReplaceObjectMethod != null) { - try { - return (Serializable) writeReplaceObjectMethod.invoke(value,noArgsList); - } - catch(Throwable t) { - throw new RuntimeException(t.getMessage()); - } - } - else return value; - } - - public Object readResolve(Object value) { - if (readResolveObjectMethod != null) { - try { - return readResolveObjectMethod.invoke(value,noArgsList); - } - catch(Throwable t) { - throw new RuntimeException(t.getMessage()); - } - } - else return value; - } - - /** - * Return a string describing this ObjectStreamClass_1_3_1. - */ - public final String toString() { - StringBuffer sb = new StringBuffer(); - - sb.append(name); - sb.append(": static final long serialVersionUID = "); - sb.append(Long.toString(suid)); - sb.append("L;"); - return sb.toString(); - } - - /* - * Create a new ObjectStreamClass_1_3_1 from a loaded class. - * Don't call this directly, call lookup instead. - */ - private ObjectStreamClass_1_3_1(java.lang.Class cl, ObjectStreamClass_1_3_1 superdesc, - boolean serial, boolean extern) - { - ofClass = cl; /* created from this class */ - - if (Proxy.isProxyClass(cl)) { - forProxyClass = true; - } - - name = cl.getName(); - superclass = superdesc; - serializable = serial; - if (!forProxyClass) { - // proxy classes are never externalizable - externalizable = extern; - } - - /* - * Enter this class in the table of known descriptors. - * Otherwise, when the fields are read it may recurse - * trying to find the descriptor for itself. - */ - insertDescriptorFor(this); - - /* - * The remainder of initialization occurs in init(), which is called - * after the lock on the global class descriptor table has been - * released. - */ - } - - /* - * Initialize class descriptor. This method is only invoked on class - * descriptors created via calls to lookupInternal(). This method is kept - * separate from the ObjectStreamClass_1_3_1 constructor so that lookupInternal - * does not have to hold onto a global class descriptor table lock while the - * class descriptor is being initialized (see bug 4165204). - */ - - - private void init() { - synchronized (lock) { - - final Class cl = ofClass; - - if (fields != null) // already initialized - return; - - - if (!serializable || - externalizable || - forProxyClass || - name.equals("java.lang.String")) { - fields = NO_FIELDS; - } else if (serializable) { - - /* Ask for permission to override field access checks. - */ - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - /* Fill in the list of persistent fields. - * If it is declared, use the declared serialPersistentFields. - * Otherwise, extract the fields from the class itself. - */ - try { - Field pf = cl.getDeclaredField("serialPersistentFields"); - // serial bug 7; the serialPersistentFields were not - // being read and stored as Accessible bit was not set - pf.setAccessible(true); - // serial bug 7; need to find if the field is of type - // java.io.ObjectStreamField - java.io.ObjectStreamField[] f = - (java.io.ObjectStreamField[])pf.get(cl); - int mods = pf.getModifiers(); - if ((Modifier.isPrivate(mods)) && - (Modifier.isStatic(mods)) && - (Modifier.isFinal(mods))) - { - fields = (ObjectStreamField[])translateFields((Object[])pf.get(cl)); - } - } catch (NoSuchFieldException e) { - fields = null; - } catch (IllegalAccessException e) { - fields = null; - } catch (IllegalArgumentException e) { - fields = null; - } catch (ClassCastException e) { - /* Thrown if a field serialPersistentField exists - * but it is not of type ObjectStreamField. - */ - fields = null; - } - - - if (fields == null) { - /* Get all of the declared fields for this - * Class. setAccessible on all fields so they - * can be accessed later. Create a temporary - * ObjectStreamField array to hold each - * non-static, non-transient field. Then copy the - * temporary array into an array of the correct - * size once the number of fields is known. - */ - Field[] actualfields = cl.getDeclaredFields(); - - int numFields = 0; - ObjectStreamField[] tempFields = - new ObjectStreamField[actualfields.length]; - for (int i = 0; i < actualfields.length; i++) { - int modifiers = actualfields[i].getModifiers(); - if (!Modifier.isStatic(modifiers) && - !Modifier.isTransient(modifiers)) { - tempFields[numFields++] = - new ObjectStreamField(actualfields[i]); - } - } - fields = new ObjectStreamField[numFields]; - System.arraycopy(tempFields, 0, fields, 0, numFields); - - } else { - // For each declared persistent field, look for an actual - // reflected Field. If there is one, make sure it's the correct - // type and cache it in the ObjectStreamClass_1_3_1 for that field. - for (int j = fields.length-1; j >= 0; j--) { - try { - Field reflField = cl.getDeclaredField(fields[j].getName()); - if (fields[j].getType() == reflField.getType()) { - // reflField.setAccessible(true); - fields[j].setField(reflField); - } - } catch (NoSuchFieldException e) { - // Nothing to do - } - } - } - return null; - } - }); - - if (fields.length > 1) - Arrays.sort(fields); - - /* Set up field data for use while writing using the API api. */ - computeFieldInfo(); - } - - /* Get the serialVersionUID from the class. - * It uses the access override mechanism so make sure - * the field objects is only used here. - * - * NonSerializable classes have a serialVerisonUID of 0L. - */ - if (isNonSerializable()) { - suid = 0L; - } else { - // Lookup special Serializable members using reflection. - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - if (forProxyClass) { - // proxy classes always have serialVersionUID of 0L - suid = 0L; - } else { - try { - final Field f = cl.getDeclaredField("serialVersionUID"); - int mods = f.getModifiers(); - // SerialBug 5: static final SUID should be read - if (Modifier.isStatic(mods) && - Modifier.isFinal(mods) ) { - f.setAccessible(true); - suid = f.getLong(cl); - // get rid of native code - // suid = getSerialVersionUIDField(cl); - // SerialBug 2: should be computed after writeObject - // actualSuid = computeStructuralUID(cl); - } else { - suid = ObjectStreamClass.getSerialVersionUID(cl); - // SerialBug 2: should be computed after writeObject - // actualSuid = computeStructuralUID(cl); - } - } catch (NoSuchFieldException ex) { - suid = ObjectStreamClass.getSerialVersionUID(cl); - // SerialBug 2: should be computed after writeObject - // actualSuid = computeStructuralUID(cl); - } catch (IllegalAccessException ex) { - suid = ObjectStreamClass.getSerialVersionUID(cl); - } - } - - - try { - writeReplaceObjectMethod = cl.getDeclaredMethod("writeReplace", noTypesList); - if (Modifier.isStatic(writeReplaceObjectMethod.getModifiers())) { - writeReplaceObjectMethod = null; - } else { - writeReplaceObjectMethod.setAccessible(true); - } - - } catch (NoSuchMethodException e2) { - - } - - try { - readResolveObjectMethod = cl.getDeclaredMethod("readResolve", noTypesList); - if (Modifier.isStatic(readResolveObjectMethod.getModifiers())) { - readResolveObjectMethod = null; - } else { - readResolveObjectMethod.setAccessible(true); - } - - } catch (NoSuchMethodException e2) { - - } - - /* Cache lookup of writeObject and readObject for - * Serializable classes. (Do not lookup for - * Externalizable) - */ - - if (serializable && !forProxyClass) { - - /* Look for the writeObject method - * Set the accessible flag on it here. ObjectOutputStream - * will call it as necessary. - */ - try { - Class[] args = {java.io.ObjectOutputStream.class}; - writeObjectMethod = cl.getDeclaredMethod("writeObject", args); - hasWriteObjectMethod = true; - int mods = writeObjectMethod.getModifiers(); - - // Method must be private and non-static - if (!Modifier.isPrivate(mods) || - Modifier.isStatic(mods)) { - writeObjectMethod = null; - hasWriteObjectMethod = false; - } - - } catch (NoSuchMethodException e) { - } - - /* Look for the readObject method - * set the access override and save the reference for - * ObjectInputStream so it can all the method directly. - */ - try { - Class[] args = {java.io.ObjectInputStream.class}; - readObjectMethod = cl.getDeclaredMethod("readObject", args); - int mods = readObjectMethod.getModifiers(); - - // Method must be private and non-static - if (!Modifier.isPrivate(mods) || - Modifier.isStatic(mods)) { - readObjectMethod = null; - } - } catch (NoSuchMethodException e) { - } - // Compute the structural UID. This must be done after the - // calculation for writeObject. Fixed 4/20/2000, eea1 - // SerialBug 2: to have correct value in RepId - } - return null; - } - }); - } - - actualSuid = computeStructuralUID(this, cl); - } - - } - - /* - * Create an empty ObjectStreamClass_1_3_1 for a class about to be read. - * This is separate from read so ObjectInputStream can assign the - * wire handle early, before any nested ObjectStreamClass_1_3_1 might - * be read. - */ - ObjectStreamClass_1_3_1(String n, long s) { - name = n; - suid = s; - superclass = null; - } - - private static Object[] translateFields(Object objs[]) - throws NoSuchFieldException { - try{ - java.io.ObjectStreamField fields[] = (java.io.ObjectStreamField[])objs; - Object translation[] = null; - - if (translatedFields == null) - translatedFields = new Hashtable(); - - translation = (Object[])translatedFields.get(fields); - - if (translation != null) - return translation; - else { - Class osfClass = com.sun.corba.se.impl.orbutil.ObjectStreamField.class; - - translation = (Object[])java.lang.reflect.Array.newInstance(osfClass, objs.length); - Object arg[] = new Object[2]; - Class types[] = {String.class, Class.class}; - Constructor constructor = osfClass.getDeclaredConstructor(types); - for (int i = fields.length -1; i >= 0; i--){ - arg[0] = fields[i].getName(); - arg[1] = fields[i].getType(); - - translation[i] = constructor.newInstance(arg); - } - translatedFields.put(fields, translation); - - } - - return (Object[])translation; - } - catch(Throwable t){ - throw new NoSuchFieldException(); - } - } - - /* Compare the base class names of streamName and localName. - * - * @return Return true iff the base class name compare. - * @param streamName Fully qualified class name. - * @param localName Fully qualified class name. - * @param pkgSeparator class names use either '.' or '/'. - * - * Only compare base class name to allow package renaming. - */ - static boolean compareClassNames(String streamName, - String localName, - char pkgSeparator) { - /* compare the class names, stripping off package names. */ - int streamNameIndex = streamName.lastIndexOf(pkgSeparator); - if (streamNameIndex < 0) - streamNameIndex = 0; - - int localNameIndex = localName.lastIndexOf(pkgSeparator); - if (localNameIndex < 0) - localNameIndex = 0; - - return streamName.regionMatches(false, streamNameIndex, - localName, localNameIndex, - streamName.length() - streamNameIndex); - } - - /* - * Compare the types of two class descriptors. - * They match if they have the same class name and suid - */ - final boolean typeEquals(ObjectStreamClass_1_3_1 other) { - return (suid == other.suid) && - compareClassNames(name, other.name, '.'); - } - - /* - * Return the superclass descriptor of this descriptor. - */ - final void setSuperclass(ObjectStreamClass_1_3_1 s) { - superclass = s; - } - - /* - * Return the superclass descriptor of this descriptor. - */ - final ObjectStreamClass_1_3_1 getSuperclass() { - return superclass; - } - - /* - * Return whether the class has a writeObject method - */ - final boolean hasWriteObject() { - return hasWriteObjectMethod; - } - - final boolean isCustomMarshaled() { - return (hasWriteObject() || isExternalizable()); - } - - /* - * Return true if all instances of 'this' Externalizable class - * are written in block-data mode from the stream that 'this' was read - * from.

- * - * In JDK 1.1, all Externalizable instances are not written - * in block-data mode. - * In JDK 1.2, all Externalizable instances, by default, are written - * in block-data mode and the Externalizable instance is terminated with - * tag TC_ENDBLOCKDATA. Change enabled the ability to skip Externalizable - * instances. - * - * IMPLEMENTATION NOTE: - * This should have been a mode maintained per stream; however, - * for compatibility reasons, it was only possible to record - * this change per class. All Externalizable classes within - * a given stream should either have this mode enabled or - * disabled. This is enforced by not allowing the PROTOCOL_VERSION - * of a stream to he changed after any objects have been written. - * - * @see ObjectOutputStream#useProtocolVersion - * @see ObjectStreamConstants#PROTOCOL_VERSION_1 - * @see ObjectStreamConstants#PROTOCOL_VERSION_2 - * - * @since JDK 1.2 - */ - boolean hasExternalizableBlockDataMode() { - return hasExternalizableBlockData; - } - - /* - * Return the ObjectStreamClass_1_3_1 of the local class this one is based on. - */ - final ObjectStreamClass_1_3_1 localClassDescriptor() { - return localClassDesc; - } - - /* - * Get the Serializability of the class. - */ - boolean isSerializable() { - return serializable; - } - - /* - * Get the externalizability of the class. - */ - boolean isExternalizable() { - return externalizable; - } - - boolean isNonSerializable() { - return ! (externalizable || serializable); - } - - /* - * Calculate the size of the array needed to store primitive data and the - * number of object references to read when reading from the input - * stream. - */ - private void computeFieldInfo() { - primBytes = 0; - objFields = 0; - - for (int i = 0; i < fields.length; i++ ) { - switch (fields[i].getTypeCode()) { - case 'B': - case 'Z': - primBytes += 1; - break; - case 'C': - case 'S': - primBytes += 2; - break; - - case 'I': - case 'F': - primBytes += 4; - break; - case 'J': - case 'D' : - primBytes += 8; - break; - - case 'L': - case '[': - objFields += 1; - break; - } - } - } - - private static long computeStructuralUID(ObjectStreamClass_1_3_1 osc, Class cl) { - ByteArrayOutputStream devnull = new ByteArrayOutputStream(512); - - long h = 0; - try { - - if ((!java.io.Serializable.class.isAssignableFrom(cl)) || - (cl.isInterface())){ - return 0; - } - - if (java.io.Externalizable.class.isAssignableFrom(cl)) { - return 1; - } - - MessageDigest md = MessageDigest.getInstance("SHA"); - DigestOutputStream mdo = new DigestOutputStream(devnull, md); - DataOutputStream data = new DataOutputStream(mdo); - - // Get SUID of parent - Class parent = cl.getSuperclass(); - if ((parent != null)) - // SerialBug 1; acc. to spec the one for - // java.lang.object - // should be computed and put - // && (parent != java.lang.Object.class)) - { - //data.writeLong(computeSerialVersionUID(null,parent)); - data.writeLong(computeStructuralUID(lookup(parent), parent)); - } - - if (osc.hasWriteObject()) - data.writeInt(2); - else - data.writeInt(1); - - /* Sort the field names to get a deterministic order */ - // Field[] field = ObjectStreamClass_1_3_1.getDeclaredFields(cl); - - ObjectStreamField[] fields = osc.getFields(); - - // Must make sure that the Field array we allocate - // below is exactly the right size. Bug fix for - // 4397133. - int numNonNullFields = 0; - for (int i = 0; i < fields.length; i++) - if (fields[i].getField() != null) - numNonNullFields++; - - Field [] field = new java.lang.reflect.Field[numNonNullFields]; - for (int i = 0, fieldNum = 0; i < fields.length; i++) { - if (fields[i].getField() != null) { - field[fieldNum++] = fields[i].getField(); - } - } - - if (field.length > 1) - Arrays.sort(field, compareMemberByName); - - for (int i = 0; i < field.length; i++) { - Field f = field[i]; - - /* Include in the hash all fields except those that are - * transient - */ - int m = f.getModifiers(); - //Serial 6 - //if (Modifier.isTransient(m) || Modifier.isStatic(m)) - // spec reference 00-01-06.pdf, 1.3.5.6, states non-static - // non-transient, public fields are mapped to Java IDL. - // - // Here's the quote from the first paragraph: - // Java non-static non-transient public fields are mapped to - // OMG IDL public data members, and other Java fields are - // not mapped. - - // if (Modifier.isTransient(m) || Modifier.isStatic(m)) - // continue; - - data.writeUTF(f.getName()); - data.writeUTF(getSignature(f.getType())); - } - - /* Compute the hash value for this class. - * Use only the first 64 bits of the hash. - */ - data.flush(); - byte hasharray[] = md.digest(); - // int minimum = Math.min(8, hasharray.length); - // SerialBug 3: SHA computation is wrong; for loop reversed - //for (int i = minimum; i > 0; i--) - for (int i = 0; i < Math.min(8, hasharray.length); i++) { - h += (long)(hasharray[i] & 255) << (i * 8); - } - } catch (IOException ignore) { - /* can't happen, but be deterministic anyway. */ - h = -1; - } catch (NoSuchAlgorithmException complain) { - throw new SecurityException(complain.getMessage()); - } - return h; - } - - /** - * Compute the JVM signature for the class. - */ - static String getSignature(Class clazz) { - String type = null; - if (clazz.isArray()) { - Class cl = clazz; - int dimensions = 0; - while (cl.isArray()) { - dimensions++; - cl = cl.getComponentType(); - } - StringBuffer sb = new StringBuffer(); - for (int i = 0; i < dimensions; i++) { - sb.append("["); - } - sb.append(getSignature(cl)); - type = sb.toString(); - } else if (clazz.isPrimitive()) { - if (clazz == Integer.TYPE) { - type = "I"; - } else if (clazz == Byte.TYPE) { - type = "B"; - } else if (clazz == Long.TYPE) { - type = "J"; - } else if (clazz == Float.TYPE) { - type = "F"; - } else if (clazz == Double.TYPE) { - type = "D"; - } else if (clazz == Short.TYPE) { - type = "S"; - } else if (clazz == Character.TYPE) { - type = "C"; - } else if (clazz == Boolean.TYPE) { - type = "Z"; - } else if (clazz == Void.TYPE) { - type = "V"; - } - } else { - type = "L" + clazz.getName().replace('.', '/') + ";"; - } - return type; - } - - /* - * Compute the JVM method descriptor for the method. - */ - static String getSignature(Method meth) { - StringBuffer sb = new StringBuffer(); - - sb.append("("); - - Class[] params = meth.getParameterTypes(); // avoid clone - for (int j = 0; j < params.length; j++) { - sb.append(getSignature(params[j])); - } - sb.append(")"); - sb.append(getSignature(meth.getReturnType())); - return sb.toString(); - } - - /* - * Compute the JVM constructor descriptor for the constructor. - */ - static String getSignature(Constructor cons) { - StringBuffer sb = new StringBuffer(); - - sb.append("("); - - Class[] params = cons.getParameterTypes(); // avoid clone - for (int j = 0; j < params.length; j++) { - sb.append(getSignature(params[j])); - } - sb.append(")V"); - return sb.toString(); - } - - /* - * Cache of Class -> ClassDescriptor Mappings. - */ - static private ObjectStreamClassEntry[] descriptorFor = new ObjectStreamClassEntry[61]; - - /* - * findDescriptorFor a Class. This looks in the cache for a - * mapping from Class -> ObjectStreamClass mappings. The hashCode - * of the Class is used for the lookup since the Class is the key. - * The entries are extended from java.lang.ref.SoftReference so the - * gc will be able to free them if needed. - */ - private static ObjectStreamClass_1_3_1 findDescriptorFor(Class cl) { - - int hash = cl.hashCode(); - int index = (hash & 0x7FFFFFFF) % descriptorFor.length; - ObjectStreamClassEntry e; - ObjectStreamClassEntry prev; - - /* Free any initial entries whose refs have been cleared */ - while ((e = descriptorFor[index]) != null && e.get() == null) { - descriptorFor[index] = e.next; - } - - /* Traverse the chain looking for a descriptor with ofClass == cl. - * unlink entries that are unresolved. - */ - prev = e; - while (e != null ) { - ObjectStreamClass_1_3_1 desc = (ObjectStreamClass_1_3_1)(e.get()); - if (desc == null) { - // This entry has been cleared, unlink it - prev.next = e.next; - } else { - if (desc.ofClass == cl) - return desc; - prev = e; - } - e = e.next; - } - return null; - } - - /* - * insertDescriptorFor a Class -> ObjectStreamClass_1_3_1 mapping. - */ - private static void insertDescriptorFor(ObjectStreamClass_1_3_1 desc) { - // Make sure not already present - if (findDescriptorFor(desc.ofClass) != null) { - return; - } - - int hash = desc.ofClass.hashCode(); - int index = (hash & 0x7FFFFFFF) % descriptorFor.length; - ObjectStreamClassEntry e = new ObjectStreamClassEntry(desc); - e.next = descriptorFor[index]; - descriptorFor[index] = e; - } - - private static Field[] getDeclaredFields(final Class clz) { - return (Field[]) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return clz.getDeclaredFields(); - } - }); - } - - - /* - * The name of this descriptor - */ - private String name; - - /* - * The descriptor of the supertype. - */ - private ObjectStreamClass_1_3_1 superclass; - - /* - * Flags for Serializable and Externalizable. - */ - private boolean serializable; - private boolean externalizable; - - /* - * Array of persistent fields of this class, sorted by - * type and name. - */ - private ObjectStreamField[] fields; - - /* - * Class that is a descriptor for in this virtual machine. - */ - private Class ofClass; - - /* - * True if descriptor for a proxy class. - */ - boolean forProxyClass; - - - /* - * SerialVersionUID for this class. - */ - private long suid = kDefaultUID; - private String suidStr = null; - - /* - * Actual (computed) SerialVersionUID for this class. - */ - private long actualSuid = kDefaultUID; - private String actualSuidStr = null; - - /* - * The total number of bytes of primitive fields. - * The total number of object fields. - */ - int primBytes; - int objFields; - - /* Internal lock object. */ - private Object lock = new Object(); - - /* True if this class has/had a writeObject method */ - private boolean hasWriteObjectMethod; - - /* In JDK 1.1, external data was not written in block mode. - * As of JDK 1.2, external data is written in block data mode. This - * flag enables JDK 1.2 to be able to read JDK 1.1 written external data. - * - * @since JDK 1.2 - */ - private boolean hasExternalizableBlockData; - Method writeObjectMethod; - Method readObjectMethod; - private transient Method writeReplaceObjectMethod; - private transient Method readResolveObjectMethod; - - /* - * ObjectStreamClass_1_3_1 that this one was built from. - */ - private ObjectStreamClass_1_3_1 localClassDesc; - - /* Get the private static final field for serial version UID */ - // private static native long getSerialVersionUIDField(Class cl); - - /** use serialVersionUID from JDK 1.1. for interoperability */ - private static final long serialVersionUID = -6120832682080437368L; - - /** - * Set serialPersistentFields of a Serializable class to this value to - * denote that the class has no Serializable fields. - */ - public static final ObjectStreamField[] NO_FIELDS = - new ObjectStreamField[0]; - - /* - * Entries held in the Cache of known ObjectStreamClass_1_3_1 objects. - * Entries are chained together with the same hash value (modulo array size). - */ - private static class ObjectStreamClassEntry // extends java.lang.ref.SoftReference - { - ObjectStreamClassEntry(ObjectStreamClass_1_3_1 c) { - //super(c); - this.c = c; - } - ObjectStreamClassEntry next; - - public Object get() - { - return c; - } - private ObjectStreamClass_1_3_1 c; - } - - /* - * Comparator object for Classes and Interfaces - */ - private static Comparator compareClassByName = - new CompareClassByName(); - - private static class CompareClassByName implements Comparator { - public int compare(Object o1, Object o2) { - Class c1 = (Class)o1; - Class c2 = (Class)o2; - return (c1.getName()).compareTo(c2.getName()); - } - } - - /* - * Comparator object for Members, Fields, and Methods - */ - private static Comparator compareMemberByName = - new CompareMemberByName(); - - private static class CompareMemberByName implements Comparator { - public int compare(Object o1, Object o2) { - String s1 = ((Member)o1).getName(); - String s2 = ((Member)o2).getName(); - - if (o1 instanceof Method) { - s1 += getSignature((Method)o1); - s2 += getSignature((Method)o2); - } else if (o1 instanceof Constructor) { - s1 += getSignature((Constructor)o1); - s2 += getSignature((Constructor)o2); - } - return s1.compareTo(s2); - } - } - - /* It is expensive to recompute a method or constructor signature - many times, so compute it only once using this data structure. */ - private static class MethodSignature implements Comparator { - Member member; - String signature; // cached parameter signature - - /* Given an array of Method or Constructor members, - return a sorted array of the non-private members.*/ - /* A better implementation would be to implement the returned data - structure as an insertion sorted link list.*/ - static MethodSignature[] removePrivateAndSort(Member[] m) { - int numNonPrivate = 0; - for (int i = 0; i < m.length; i++) { - if (! Modifier.isPrivate(m[i].getModifiers())) { - numNonPrivate++; - } - } - MethodSignature[] cm = new MethodSignature[numNonPrivate]; - int cmi = 0; - for (int i = 0; i < m.length; i++) { - if (! Modifier.isPrivate(m[i].getModifiers())) { - cm[cmi] = new MethodSignature(m[i]); - cmi++; - } - } - if (cmi > 0) - Arrays.sort(cm, cm[0]); - return cm; - } - - /* Assumes that o1 and o2 are either both methods - or both constructors.*/ - public int compare(Object o1, Object o2) { - /* Arrays.sort calls compare when o1 and o2 are equal.*/ - if (o1 == o2) - return 0; - - MethodSignature c1 = (MethodSignature)o1; - MethodSignature c2 = (MethodSignature)o2; - - int result; - if (isConstructor()) { - result = c1.signature.compareTo(c2.signature); - } else { // is a Method. - result = c1.member.getName().compareTo(c2.member.getName()); - if (result == 0) - result = c1.signature.compareTo(c2.signature); - } - return result; - } - - final private boolean isConstructor() { - return member instanceof Constructor; - } - private MethodSignature(Member m) { - member = m; - if (isConstructor()) { - signature = ObjectStreamClass_1_3_1.getSignature((Constructor)m); - } else { - signature = ObjectStreamClass_1_3_1.getSignature((Method)m); - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamField.java 2018-01-30 20:19:13.000000000 -0500 +++ /dev/null 2018-01-30 20:19:13.000000000 -0500 @@ -1,270 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.orbutil; - -import java.lang.reflect.Field; -import java.lang.Comparable; -import java.util.Hashtable; - -/** - * This is duplicated here somewhat in haste since we can't - * expose this class outside of the com.sun.corba.se.impl.io - * package for security reasons. - */ -/** - * A description of a field in a serializable class. - * A array of these is used to declare the persistent fields of - * a class. - * - */ -class ObjectStreamField implements Comparable { - /** - * Create a named field with the specified type. - */ - ObjectStreamField(String n, Class clazz) { - name = n; - this.clazz = clazz; - - // Compute the typecode for easy switching - if (clazz.isPrimitive()) { - if (clazz == Integer.TYPE) { - type = 'I'; - } else if (clazz == Byte.TYPE) { - type = 'B'; - } else if (clazz == Long.TYPE) { - type = 'J'; - } else if (clazz == Float.TYPE) { - type = 'F'; - } else if (clazz == Double.TYPE) { - type = 'D'; - } else if (clazz == Short.TYPE) { - type = 'S'; - } else if (clazz == Character.TYPE) { - type = 'C'; - } else if (clazz == Boolean.TYPE) { - type = 'Z'; - } - } else if (clazz.isArray()) { - type = '['; - typeString = ObjectStreamClass_1_3_1.getSignature(clazz); - } else { - type = 'L'; - typeString = ObjectStreamClass_1_3_1.getSignature(clazz); - } - - if (typeString != null) - signature = typeString; - else - signature = String.valueOf(type); - - } - - ObjectStreamField(Field field) { - this(field.getName(), field.getType()); - this.field = field; - } - - /** - * Create an ObjectStreamField containing a reflected Field. - */ - ObjectStreamField(String n, char t, Field f, String ts) - { - name = n; - type = t; - field = f; - typeString = ts; - - if (typeString != null) - signature = typeString; - else - signature = String.valueOf(type); - - } - - /** - * Get the name of this field. - */ - public String getName() { - return name; - } - - /** - * Get the type of the field. - */ - public Class getType() { - if (clazz != null) - return clazz; - switch (type) { - case 'B': clazz = Byte.TYPE; - break; - case 'C': clazz = Character.TYPE; - break; - case 'S': clazz = Short.TYPE; - break; - case 'I': clazz = Integer.TYPE; - break; - case 'J': clazz = Long.TYPE; - break; - case 'F': clazz = Float.TYPE; - break; - case 'D': clazz = Double.TYPE; - break; - case 'Z': clazz = Boolean.TYPE; - break; - case '[': - case 'L': - clazz = Object.class; - break; - } - - return clazz; - } - - public char getTypeCode() { - return type; - } - - public String getTypeString() { - return typeString; - } - - Field getField() { - return field; - } - - void setField(Field field) { - this.field = field; - this.fieldID = -1; - } - - /* - * Default constructor creates an empty field. - * Usually used just to get to the sort functions. - */ - ObjectStreamField() { - } - - /** - * test if this field is a primitive or not. - */ - public boolean isPrimitive() { - return (type != '[' && type != 'L'); - } - - /** - * Compare this with another ObjectStreamField. - * return -1 if this is smaller, 0 if equal, 1 if greater - * types that are primitives are "smaller" than objects. - * if equal, the names are compared. - */ - public int compareTo(Object o) { - ObjectStreamField f2 = (ObjectStreamField)o; - boolean thisprim = (this.typeString == null); - boolean otherprim = (f2.typeString == null); - - if (thisprim != otherprim) { - return (thisprim ? -1 : 1); - } - return this.name.compareTo(f2.name); - } - - /** - * Compare the types of two class descriptors. - * The match if they have the same primitive types. - * or if they are both objects and the object types match. - */ - public boolean typeEquals(ObjectStreamField other) { - if (other == null || type != other.type) - return false; - - /* Return true if the primitive types matched */ - if (typeString == null && other.typeString == null) - return true; - - return ObjectStreamClass_1_3_1.compareClassNames(typeString, - other.typeString, - '/'); - } - - /* Returns the signature of the Field. - * - */ - public String getSignature() { - - return signature; - - } - - /** - * Return a string describing this field. - */ - public String toString() { - if (typeString != null) - return typeString + " " + name; - else - return type + " " + name; - } - - public Class getClazz() { - return clazz; - } - - /* Returns the Field ID - * NOT USED, since this class is used only in ObjectStreamClass_1_3_1, - * which is used only in RepositoryId_1_3_1. - public long getFieldID( Class cl ) { - if (fieldID == -1) { - if (typeString != null) - fieldID = getFieldIDNative( cl, getName(), typeString ); - else - fieldID = getFieldIDNative( cl, getName(), getSignature() ); - } - return fieldID; - } - */ - - private String name; // the name of the field - private char type; // type first byte of the type signature - private Field field; // Reflected field - private String typeString; // iff object, typename - private Class clazz; // the type of this field, if has been resolved - - // the next 3 things are RMI-IIOP specific, it can be easily - // removed, if we can figure out all place where there are dependencies - // to this. Signature is esentially equal to typestring. Then - // essentially we can use the java.io.ObjectStreamField as such. - - private String signature; // the signature of the field - private long fieldID = -1; - // private static native long getFieldIDNative(Class c, String fieldName, String fieldSig); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java 2018-01-30 20:19:14.000000000 -0500 +++ /dev/null 2018-01-30 20:19:14.000000000 -0500 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.orbutil; - -import java.security.PrivilegedAction; -import java.security.AccessController; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Map; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; -import java.util.Map.Entry; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Enumeration; -import java.util.Properties; -import java.util.IdentityHashMap; -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.math.BigInteger ; -import java.math.BigDecimal ; - -public final class ObjectUtility { - private ObjectUtility() {} - - - /** If arr1 and arr2 are both arrays of the same component type, - * return an array of that component type that consists of the - * elements of arr1 followed by the elements of arr2. - * Throws IllegalArgumentException otherwise. - */ - public static Object concatenateArrays( Object arr1, Object arr2 ) - { - Class comp1 = arr1.getClass().getComponentType() ; - Class comp2 = arr2.getClass().getComponentType() ; - int len1 = Array.getLength( arr1 ) ; - int len2 = Array.getLength( arr2 ) ; - - if ((comp1 == null) || (comp2 == null)) - throw new IllegalStateException( "Arguments must be arrays" ) ; - if (!comp1.equals( comp2 )) - throw new IllegalStateException( - "Arguments must be arrays with the same component type" ) ; - - Object result = Array.newInstance( comp1, len1 + len2 ) ; - - int index = 0 ; - - for (int ctr=0; ctr" ) ; - Class compClass = obj.getClass().getComponentType() ; - - if (compClass != null) { - result.append( "[" ) ; - if (compClass == boolean.class) { - boolean[] arr = (boolean[])obj ; - result.append( arr.length ) ; - result.append( "]" ) ; - } else if (compClass == byte.class) { - byte[] arr = (byte[])obj ; - result.append( arr.length ) ; - result.append( "]" ) ; - } else if (compClass == short.class) { - short[] arr = (short[])obj ; - result.append( arr.length ) ; - result.append( "]" ) ; - } else if (compClass == int.class) { - int[] arr = (int[])obj ; - result.append( arr.length ) ; - result.append( "]" ) ; - } else if (compClass == long.class) { - long[] arr = (long[])obj ; - result.append( arr.length ) ; - result.append( "]" ) ; - } else if (compClass == char.class) { - char[] arr = (char[])obj ; - result.append( arr.length ) ; - result.append( "]" ) ; - } else if (compClass == float.class) { - float[] arr = (float[])obj ; - result.append( arr.length ) ; - result.append( "]" ) ; - } else if (compClass == double.class) { - double[] arr = (double[])obj ; - result.append( arr.length ) ; - result.append( "]" ) ; - } else { // array of object - java.lang.Object[] arr = (java.lang.Object[])obj ; - result.append( arr.length ) ; - result.append( "]" ) ; - } - } - - result.append( "(" ) ; - } - - /** Expected patterns: - * startObject endObject( str ) - * header( elem )\n - * startObject ( startElement append* endElement ) * endObject - * header(\n - * append*\n * - * )\n - */ - private static class IndentingObjectWriter extends ObjectWriter { - private int level ; - private int increment ; - - public IndentingObjectWriter( int initialLevel, int increment ) - { - this.level = initialLevel ; - this.increment = increment ; - startLine() ; - } - - private void startLine() - { - char[] fill = new char[ level * increment ] ; - Arrays.fill( fill, ' ' ) ; - result.append( fill ) ; - } - - public void startObject( java.lang.Object obj ) - { - appendObjectHeader( obj ) ; - level++ ; - } - - public void startElement() - { - result.append( "\n" ) ; - startLine() ; - } - - public void endElement() - { - } - - public void endObject( String str ) - { - level-- ; - result.append( str ) ; - result.append( ")" ) ; - } - - public void endObject( ) - { - level-- ; - result.append( "\n" ) ; - startLine() ; - result.append( ")" ) ; - } - } - - private static class SimpleObjectWriter extends ObjectWriter { - public void startObject( java.lang.Object obj ) - { - appendObjectHeader( obj ) ; - result.append( " " ) ; - } - - public void startElement() - { - result.append( " " ) ; - } - - public void endObject( String str ) - { - result.append( str ) ; - result.append( ")" ) ; - } - - public void endElement() - { - } - - public void endObject() - { - result.append( ")" ) ; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java 2018-01-30 20:19:15.000000000 -0500 +++ /dev/null 2018-01-30 20:19:15.000000000 -0500 @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.orbutil; - -import org.omg.CORBA.ORB; -import java.io.Serializable; -import java.util.Hashtable; -import com.sun.corba.se.impl.io.TypeMismatchException; -import java.net.MalformedURLException; -import com.sun.corba.se.impl.util.RepositoryId; - -/** - * Delegates to the current RepositoryId implementation in - * com.sun.corba.se.impl.util. This is necessary to - * overcome the fact that many of RepositoryId's methods - * are static. - */ -public final class RepIdDelegator - implements RepositoryIdStrings, - RepositoryIdUtility, - RepositoryIdInterface -{ - // RepositoryIdFactory methods - - public String createForAnyType(Class type) { - return RepositoryId.createForAnyType(type); - } - - public String createForJavaType(Serializable ser) - throws TypeMismatchException - { - return RepositoryId.createForJavaType(ser); - } - - public String createForJavaType(Class clz) - throws TypeMismatchException - { - return RepositoryId.createForJavaType(clz); - } - - public String createSequenceRepID(java.lang.Object ser) { - return RepositoryId.createSequenceRepID(ser); - } - - public String createSequenceRepID(Class clazz) { - return RepositoryId.createSequenceRepID(clazz); - } - - public RepositoryIdInterface getFromString(String repIdString) { - return new RepIdDelegator(RepositoryId.cache.getId(repIdString)); - } - - // RepositoryIdUtility methods - - public boolean isChunkedEncoding(int valueTag) { - return RepositoryId.isChunkedEncoding(valueTag); - } - - public boolean isCodeBasePresent(int valueTag) { - return RepositoryId.isCodeBasePresent(valueTag); - } - - public String getClassDescValueRepId() { - return RepositoryId.kClassDescValueRepID; - } - - public String getWStringValueRepId() { - return RepositoryId.kWStringValueRepID; - } - - public int getTypeInfo(int valueTag) { - return RepositoryId.getTypeInfo(valueTag); - } - - public int getStandardRMIChunkedNoRepStrId() { - return RepositoryId.kPreComputed_StandardRMIChunked_NoRep; - } - - public int getCodeBaseRMIChunkedNoRepStrId() { - return RepositoryId.kPreComputed_CodeBaseRMIChunked_NoRep; - } - - public int getStandardRMIChunkedId() { - return RepositoryId.kPreComputed_StandardRMIChunked; - } - - public int getCodeBaseRMIChunkedId() { - return RepositoryId.kPreComputed_CodeBaseRMIChunked; - } - - public int getStandardRMIUnchunkedId() { - return RepositoryId.kPreComputed_StandardRMIUnchunked; - } - - public int getCodeBaseRMIUnchunkedId() { - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked; - } - - public int getStandardRMIUnchunkedNoRepStrId() { - return RepositoryId.kPreComputed_StandardRMIUnchunked_NoRep; - } - - public int getCodeBaseRMIUnchunkedNoRepStrId() { - return RepositoryId.kPreComputed_CodeBaseRMIUnchunked_NoRep; - } - - // RepositoryIdInterface methods - - public Class getClassFromType() throws ClassNotFoundException { - return delegate.getClassFromType(); - } - - public Class getClassFromType(String codebaseURL) - throws ClassNotFoundException, MalformedURLException - { - return delegate.getClassFromType(codebaseURL); - } - - public Class getClassFromType(Class expectedType, - String codebaseURL) - throws ClassNotFoundException, MalformedURLException - { - return delegate.getClassFromType(expectedType, codebaseURL); - } - - public String getClassName() { - return delegate.getClassName(); - } - - // Constructor used for factory/utility cases - public RepIdDelegator() { - this(null); - } - - // Constructor used by getIdFromString. All non-static - // RepositoryId methods will use the provided delegate. - private RepIdDelegator(RepositoryId _delegate) { - this.delegate = _delegate; - } - - private final RepositoryId delegate; - - public String toString() { - if (delegate != null) - return delegate.toString(); - else - return this.getClass().getName(); - } - - public boolean equals(Object obj) { - if (delegate != null) - return delegate.equals(obj); - else - return super.equals(obj); - } - - public int hashCode() { - if (delegate != null) { - return delegate.hashCode(); - } else { - return super.hashCode(); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java 2018-01-30 20:19:16.000000000 -0500 +++ /dev/null 2018-01-30 20:19:16.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.orbutil; - -import com.sun.corba.se.spi.orb.ORBVersion; -import com.sun.corba.se.spi.orb.ORB; - -public abstract class RepositoryIdFactory -{ - private static final RepIdDelegator currentDelegator - = new RepIdDelegator(); - - /** - * Returns the latest version RepositoryIdStrings instance - */ - public static RepositoryIdStrings getRepIdStringsFactory() - { - return currentDelegator; - } - - /** - * Returns the latest version RepositoryIdUtility instance - */ - public static RepositoryIdUtility getRepIdUtility() - { - return currentDelegator; - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java 2018-01-30 20:19:17.000000000 -0500 +++ /dev/null 2018-01-30 20:19:17.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2000, 2002, 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.corba.se.impl.orbutil; - -import org.omg.CORBA.ORB; -import java.io.Serializable; -import java.net.MalformedURLException; - -/** - * Methods on specific instances of RepositoryId. Hides - * versioning of our RepositoryId class. - */ -public interface RepositoryIdInterface -{ - Class getClassFromType() throws ClassNotFoundException; - - Class getClassFromType(String codebaseURL) - throws ClassNotFoundException, MalformedURLException; - - Class getClassFromType(Class expectedType, - String codebaseURL) - throws ClassNotFoundException, MalformedURLException; - - String getClassName(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java 2018-01-30 20:19:17.000000000 -0500 +++ /dev/null 2018-01-30 20:19:17.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2000, 2002, 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.corba.se.impl.orbutil; - -import java.io.Serializable; -import com.sun.corba.se.impl.io.TypeMismatchException; - -/** - * Factory methods for creating various repository ID strings - * and instances. - */ -public interface RepositoryIdStrings -{ - String createForAnyType(Class type); - - String createForJavaType(Serializable ser) - throws TypeMismatchException; - - String createForJavaType(Class clz) - throws TypeMismatchException; - - String createSequenceRepID(java.lang.Object ser); - - String createSequenceRepID(java.lang.Class clazz); - - RepositoryIdInterface getFromString(String repIdString); - - String getClassDescValueRepId(); - String getWStringValueRepId(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java 2018-01-30 20:19:18.000000000 -0500 +++ /dev/null 2018-01-30 20:19:18.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.orbutil; - -import org.omg.CORBA.ORB; -import com.sun.corba.se.impl.util.RepositoryId; - -/** - * Utility methods for working with repository IDs. - */ -public interface RepositoryIdUtility -{ - boolean isChunkedEncoding(int valueTag); - boolean isCodeBasePresent(int valueTag); - - // These are currently the same in both RepositoryId and - // RepositoryId_1_3, but provide the constants again here - // to eliminate awkardness when using this interface. - int NO_TYPE_INFO = RepositoryId.kNoTypeInfo; - int SINGLE_REP_TYPE_INFO = RepositoryId.kSingleRepTypeInfo; - int PARTIAL_LIST_TYPE_INFO = RepositoryId.kPartialListTypeInfo; - - // Determine how many (if any) repository IDs follow the value - // tag. - int getTypeInfo(int valueTag); - - // Accessors for precomputed value tags - int getStandardRMIChunkedNoRepStrId(); - int getCodeBaseRMIChunkedNoRepStrId(); - int getStandardRMIChunkedId(); - int getCodeBaseRMIChunkedId(); - int getStandardRMIUnchunkedId(); - int getCodeBaseRMIUnchunkedId(); - int getStandardRMIUnchunkedNoRepStrId(); - int getCodeBaseRMIUnchunkedNoRepStrId(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/StackImpl.java 2018-01-30 20:19:18.000000000 -0500 +++ /dev/null 2018-01-30 20:19:19.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.impl.orbutil ; - -import java.util.EmptyStackException ; - -// We implement a Stack here instead of using java.util.Stack because -// java.util.Stack is thread-safe, negatively impacting performance. -// We use an ArrayList instead since it is not thread-safe. -// RequestInfoStack is used quite frequently. -public class StackImpl { - // The stack for RequestInfo objects. - private Object[] data = new Object[3] ; - private int top = -1 ; - - // Tests if this stack is empty. - public final boolean empty() { - return top == -1; - } - - // Looks at the object at the top of this stack without removing it - // from the stack. - public final Object peek() { - if (empty()) - throw new EmptyStackException(); - - return data[ top ]; - } - - // Removes the object at the top of this stack and returns that - // object as the value of this function. - public final Object pop() { - Object obj = peek() ; - data[top] = null ; - top-- ; - return obj; - } - - private void ensure() - { - if (top == (data.length-1)) { - int newSize = 2*data.length ; - Object[] newData = new Object[ newSize ] ; - System.arraycopy( data, 0, newData, 0, data.length ) ; - data = newData ; - } - } - - // Pushes an item onto the top of the stack - public final Object push( Object item ) { - ensure() ; - top++ ; - data[top] = item; - return item; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Constant.java 2018-01-30 20:19:19.000000000 -0500 +++ /dev/null 2018-01-30 20:19:19.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.orbutil.closure ; - -import com.sun.corba.se.spi.orbutil.closure.Closure ; - -public class Constant implements Closure { - private Object value ; - - public Constant( Object value ) - { - this.value = value ; - } - - public Object evaluate() - { - return value ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Future.java 2018-01-30 20:19:20.000000000 -0500 +++ /dev/null 2018-01-30 20:19:20.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.orbutil.closure ; - -import com.sun.corba.se.spi.orbutil.closure.Closure ; - -public class Future implements Closure { - private boolean evaluated ; - private Closure closure ; - private Object value ; - - public Future( Closure value ) - { - this.evaluated = false ; - this.closure = (Closure)value ; - this.value = null ; - } - - public synchronized Object evaluate() - { - if (!evaluated) { - evaluated = true ; - value = closure.evaluate() ; - } - - return value ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/CondVar.java 2018-01-30 20:19:21.000000000 -0500 +++ /dev/null 2018-01-30 20:19:21.000000000 -0500 @@ -1,340 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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. - */ - -/* - File: ConditionVariable.java - - Originally written by Doug Lea and released into the public domain. - This may be used for any purposes whatsoever without acknowledgment. - Thanks for the assistance and support of Sun Microsystems Labs, - and everyone contributing, testing, and using this code. - - History: - Date Who What - 11Jun1998 dl Create public version - 08dec2001 kmc Added support for Reentrant Mutexes -*/ - -package com.sun.corba.se.impl.orbutil.concurrent; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -/** - * This class is designed for fans of POSIX pthreads programming. - * If you restrict yourself to Mutexes and CondVars, you can - * use most of your favorite constructions. Don't randomly mix them - * with synchronized methods or blocks though. - *

- * Method names and behavior are as close as is reasonable to - * those in POSIX. - *

- * Sample Usage. Here is a full version of a bounded buffer - * that implements the BoundedChannel interface, written in - * a style reminscent of that in POSIX programming books. - *

- * class CVBuffer implements BoundedChannel {
- *   private final Mutex mutex;
- *   private final CondVar notFull;
- *   private final CondVar notEmpty;
- *   private int count = 0;
- *   private int takePtr = 0;
- *   private int putPtr = 0;
- *   private final Object[] array;
- *
- *   public CVBuffer(int capacity) {
- *     array = new Object[capacity];
- *     mutex = new Mutex();
- *     notFull = new CondVar(mutex);
- *     notEmpty = new CondVar(mutex);
- *   }
- *
- *   public int capacity() { return array.length; }
- *
- *   public void put(Object x) throws InterruptedException {
- *     mutex.acquire();
- *     try {
- *       while (count == array.length) {
- *         notFull.await();
- *       }
- *       array[putPtr] = x;
- *       putPtr = (putPtr + 1) % array.length;
- *       ++count;
- *       notEmpty.signal();
- *     }
- *     finally {
- *       mutex.release();
- *     }
- *   }
- *
- *   public Object take() throws InterruptedException {
- *     Object x = null;
- *     mutex.acquire();
- *     try {
- *       while (count == 0) {
- *         notEmpty.await();
- *       }
- *       x = array[takePtr];
- *       array[takePtr] = null;
- *       takePtr = (takePtr + 1) % array.length;
- *       --count;
- *       notFull.signal();
- *     }
- *     finally {
- *       mutex.release();
- *     }
- *     return x;
- *   }
- *
- *   public boolean offer(Object x, long msecs) throws InterruptedException {
- *     mutex.acquire();
- *     try {
- *       if (count == array.length) {
- *         notFull.timedwait(msecs);
- *         if (count == array.length)
- *           return false;
- *       }
- *       array[putPtr] = x;
- *       putPtr = (putPtr + 1) % array.length;
- *       ++count;
- *       notEmpty.signal();
- *       return true;
- *     }
- *     finally {
- *       mutex.release();
- *     }
- *   }
- *
- *   public Object poll(long msecs) throws InterruptedException {
- *     Object x = null;
- *     mutex.acquire();
- *     try {
- *       if (count == 0) {
- *         notEmpty.timedwait(msecs);
- *         if (count == 0)
- *           return null;
- *       }
- *       x = array[takePtr];
- *       array[takePtr] = null;
- *       takePtr = (takePtr + 1) % array.length;
- *       --count;
- *       notFull.signal();
- *     }
- *     finally {
- *       mutex.release();
- *     }
- *     return x;
- *   }
- * }
- *
- * 
- * @see Mutex - * [ Introduction to this package. ] - **/ - -public class CondVar { - - protected boolean debug_ ; - - /** The mutex **/ - protected final Sync mutex_; - protected final ReentrantMutex remutex_; - - private int releaseMutex() - { - int count = 1 ; - - if (remutex_!=null) - count = remutex_.releaseAll() ; - else - mutex_.release() ; - - return count ; - } - - private void acquireMutex( int count ) throws InterruptedException - { - if (remutex_!=null) - remutex_.acquireAll( count ) ; - else - mutex_.acquire() ; - } - - /** - * Create a new CondVar that relies on the given mutual - * exclusion lock. - * @param mutex A mutual exclusion lock which must either be non-reentrant, - * or else be ReentrantMutex. - * Standard usage is to supply an instance of Mutex, - * but, for example, a Semaphore initialized to 1 also works. - * On the other hand, many other Sync implementations would not - * work here, so some care is required to supply a sensible - * synchronization object. - * In normal use, the mutex should be one that is used for all - * synchronization of the object using the CondVar. Generally, - * to prevent nested monitor lockouts, this - * object should not use any native Java synchronized blocks. - **/ - - public CondVar(Sync mutex, boolean debug) { - debug_ = debug ; - mutex_ = mutex; - if (mutex instanceof ReentrantMutex) - remutex_ = (ReentrantMutex)mutex; - else - remutex_ = null; - } - - public CondVar( Sync mutex ) { - this( mutex, false ) ; - } - - /** - * Wait for notification. This operation at least momentarily - * releases the mutex. The mutex is always held upon return, - * even if interrupted. - * @exception InterruptedException if the thread was interrupted - * before or during the wait. However, if the thread is interrupted - * after the wait but during mutex re-acquisition, the interruption - * is ignored, while still ensuring - * that the currentThread's interruption state stays true, so can - * be probed by callers. - **/ - public void await() throws InterruptedException { - int count = 0 ; - if (Thread.interrupted()) - throw new InterruptedException(); - - try { - if (debug_) - ORBUtility.dprintTrace( this, "await enter" ) ; - - synchronized(this) { - count = releaseMutex() ; - try { - wait(); - } catch (InterruptedException ex) { - notify(); - throw ex; - } - } - } finally { - // Must ignore interrupt on re-acquire - boolean interrupted = false; - for (;;) { - try { - acquireMutex( count ); - break; - } catch (InterruptedException ex) { - interrupted = true; - } - } - - if (interrupted) { - Thread.currentThread().interrupt(); - } - - if (debug_) - ORBUtility.dprintTrace( this, "await exit" ) ; - } - } - - /** - * Wait for at most msecs for notification. - * This operation at least momentarily - * releases the mutex. The mutex is always held upon return, - * even if interrupted. - * @param msecs The time to wait. A value less than or equal to zero - * causes a momentarily release - * and re-acquire of the mutex, and always returns false. - * @return false if at least msecs have elapsed - * upon resumption; else true. A - * false return does NOT necessarily imply that the thread was - * not notified. For example, it might have been notified - * after the time elapsed but just before resuming. - * @exception InterruptedException if the thread was interrupted - * before or during the wait. - **/ - - public boolean timedwait(long msecs) throws InterruptedException { - - if (Thread.interrupted()) - throw new InterruptedException(); - - boolean success = false; - int count = 0; - - try { - if (debug_) - ORBUtility.dprintTrace( this, "timedwait enter" ) ; - - synchronized(this) { - count = releaseMutex() ; - try { - if (msecs > 0) { - long start = System.currentTimeMillis(); - wait(msecs); - success = System.currentTimeMillis() - start <= msecs; - } - } catch (InterruptedException ex) { - notify(); - throw ex; - } - } - } finally { - // Must ignore interrupt on re-acquire - boolean interrupted = false; - for (;;) { - try { - acquireMutex( count ) ; - break; - } catch (InterruptedException ex) { - interrupted = true; - } - } - - if (interrupted) { - Thread.currentThread().interrupt(); - } - - if (debug_) - ORBUtility.dprintTrace( this, "timedwait exit" ) ; - } - return success; - } - - /** - * Notify a waiting thread. - * If one exists, a non-interrupted thread will return - * normally (i.e., not via InterruptedException) from await or timedwait. - **/ - public synchronized void signal() { - notify(); - } - - /** Notify all waiting threads **/ - public synchronized void broadcast() { - notifyAll(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/DebugMutex.java 2018-01-30 20:19:21.000000000 -0500 +++ /dev/null 2018-01-30 20:19:21.000000000 -0500 @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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. - */ - -/* - File: Mutex.java - - Originally written by Doug Lea and released into the public domain. - This may be used for any purposes whatsoever without acknowledgment. - Thanks for the assistance and support of Sun Microsystems Labs, - and everyone contributing, testing, and using this code. - - History: - Date Who What - 11Jun1998 dl Create public version -*/ - -package com.sun.corba.se.impl.orbutil.concurrent; - -/** - * A simple non-reentrant mutual exclusion lock. - * The lock is free upon construction. Each acquire gets the - * lock, and each release frees it. Releasing a lock that - * is already free has no effect. - *

- * This implementation makes no attempt to provide any fairness - * or ordering guarantees. If you need them, consider using one of - * the Semaphore implementations as a locking mechanism. - *

- * Sample usage
- *

- * Mutex can be useful in constructions that cannot be - * expressed using java synchronized blocks because the - * acquire/release pairs do not occur in the same method or - * code block. For example, you can use them for hand-over-hand - * locking across the nodes of a linked list. This allows - * extremely fine-grained locking, and so increases - * potential concurrency, at the cost of additional complexity and - * overhead that would normally make this worthwhile only in cases of - * extreme contention. - *

- * class Node {
- *   Object item;
- *   Node next;
- *   Mutex lock = new Mutex(); // each node keeps its own lock
- *
- *   Node(Object x, Node n) { item = x; next = n; }
- * }
- *
- * class List {
- *    protected Node head; // pointer to first node of list
- *
- *    // Use plain java synchronization to protect head field.
- *    //  (We could instead use a Mutex here too but there is no
- *    //  reason to do so.)
- *    protected synchronized Node getHead() { return head; }
- *
- *    boolean search(Object x) throws InterruptedException {
- *      Node p = getHead();
- *      if (p == null) return false;
- *
- *      //  (This could be made more compact, but for clarity of illustration,
- *      //  all of the cases that can arise are handled separately.)
- *
- *      p.lock.acquire();              // Prime loop by acquiring first lock.
- *                                     //    (If the acquire fails due to
- *                                     //    interrupt, the method will throw
- *                                     //    InterruptedException now,
- *                                     //    so there is no need for any
- *                                     //    further cleanup.)
- *      for (;;) {
- *        if (x.equals(p.item)) {
- *          p.lock.release();          // release current before return
- *          return true;
- *        }
- *        else {
- *          Node nextp = p.next;
- *          if (nextp == null) {
- *            p.lock.release();       // release final lock that was held
- *            return false;
- *          }
- *          else {
- *            try {
- *              nextp.lock.acquire(); // get next lock before releasing current
- *            }
- *            catch (InterruptedException ex) {
- *              p.lock.release();    // also release current if acquire fails
- *              throw ex;
- *            }
- *            p.lock.release();      // release old lock now that new one held
- *            p = nextp;
- *          }
- *        }
- *      }
- *    }
- *
- *    synchronized void add(Object x) { // simple prepend
- *      // The use of `synchronized'  here protects only head field.
- *      // The method does not need to wait out other traversers
- *      // who have already made it past head.
- *
- *      head = new Node(x, head);
- *    }
- *
- *    // ...  other similar traversal and update methods ...
- * }
- * 
- *

- *

This version adds some debugging capability: it will detect an attempt by a thread - * that holds the lock to acquire it for a second time, and also an attempt by a thread that - * does not hold the mutex to release it. - * @see Semaphore - *

[ Introduction to this package. ] -**/ - -import org.omg.CORBA.INTERNAL ; - -public class DebugMutex implements Sync { - - /** The lock status **/ - protected boolean inuse_ = false; - protected Thread holder_ = null; - - public void acquire() throws InterruptedException { - if (Thread.interrupted()) throw new InterruptedException(); - synchronized(this) { - Thread thr = Thread.currentThread(); - if (holder_ == thr) - throw new INTERNAL( - "Attempt to acquire Mutex by thread holding the Mutex" ) ; - - try { - while (inuse_) wait(); - inuse_ = true; - holder_ = Thread.currentThread(); - } - catch (InterruptedException ex) { - notify(); - throw ex; - } - } - } - - public synchronized void release() { - Thread thr = Thread.currentThread(); - if (thr != holder_) - throw new INTERNAL( - "Attempt to release Mutex by thread not holding the Mutex" ) ; - holder_ = null; - inuse_ = false; - notify(); - } - - - public boolean attempt(long msecs) throws InterruptedException { - if (Thread.interrupted()) throw new InterruptedException(); - synchronized(this) { - Thread thr = Thread.currentThread() ; - - if (!inuse_) { - inuse_ = true; - holder_ = thr; - return true; - } else if (msecs <= 0) - return false; - else { - long waitTime = msecs; - long start = System.currentTimeMillis(); - try { - for (;;) { - wait(waitTime); - if (!inuse_) { - inuse_ = true; - holder_ = thr; - return true; - } - else { - waitTime = msecs - (System.currentTimeMillis() - start); - if (waitTime <= 0) - return false; - } - } - } - catch (InterruptedException ex) { - notify(); - throw ex; - } - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Mutex.java 2018-01-30 20:19:22.000000000 -0500 +++ /dev/null 2018-01-30 20:19:22.000000000 -0500 @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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. - */ - -/* - File: Mutex.java - - Originally written by Doug Lea and released into the public domain. - This may be used for any purposes whatsoever without acknowledgment. - Thanks for the assistance and support of Sun Microsystems Labs, - and everyone contributing, testing, and using this code. - - History: - Date Who What - 11Jun1998 dl Create public version -*/ - -package com.sun.corba.se.impl.orbutil.concurrent; - -/** - * A simple non-reentrant mutual exclusion lock. - * The lock is free upon construction. Each acquire gets the - * lock, and each release frees it. Releasing a lock that - * is already free has no effect. - *

- * This implementation makes no attempt to provide any fairness - * or ordering guarantees. If you need them, consider using one of - * the Semaphore implementations as a locking mechanism. - *

- * Sample usage
- *

- * Mutex can be useful in constructions that cannot be - * expressed using java synchronized blocks because the - * acquire/release pairs do not occur in the same method or - * code block. For example, you can use them for hand-over-hand - * locking across the nodes of a linked list. This allows - * extremely fine-grained locking, and so increases - * potential concurrency, at the cost of additional complexity and - * overhead that would normally make this worthwhile only in cases of - * extreme contention. - *

- * class Node {
- *   Object item;
- *   Node next;
- *   Mutex lock = new Mutex(); // each node keeps its own lock
- *
- *   Node(Object x, Node n) { item = x; next = n; }
- * }
- *
- * class List {
- *    protected Node head; // pointer to first node of list
- *
- *    // Use plain java synchronization to protect head field.
- *    //  (We could instead use a Mutex here too but there is no
- *    //  reason to do so.)
- *    protected synchronized Node getHead() { return head; }
- *
- *    boolean search(Object x) throws InterruptedException {
- *      Node p = getHead();
- *      if (p == null) return false;
- *
- *      //  (This could be made more compact, but for clarity of illustration,
- *      //  all of the cases that can arise are handled separately.)
- *
- *      p.lock.acquire();              // Prime loop by acquiring first lock.
- *                                     //    (If the acquire fails due to
- *                                     //    interrupt, the method will throw
- *                                     //    InterruptedException now,
- *                                     //    so there is no need for any
- *                                     //    further cleanup.)
- *      for (;;) {
- *        if (x.equals(p.item)) {
- *          p.lock.release();          // release current before return
- *          return true;
- *        }
- *        else {
- *          Node nextp = p.next;
- *          if (nextp == null) {
- *            p.lock.release();       // release final lock that was held
- *            return false;
- *          }
- *          else {
- *            try {
- *              nextp.lock.acquire(); // get next lock before releasing current
- *            }
- *            catch (InterruptedException ex) {
- *              p.lock.release();    // also release current if acquire fails
- *              throw ex;
- *            }
- *            p.lock.release();      // release old lock now that new one held
- *            p = nextp;
- *          }
- *        }
- *      }
- *    }
- *
- *    synchronized void add(Object x) { // simple prepend
- *      // The use of `synchronized'  here protects only head field.
- *      // The method does not need to wait out other traversers
- *      // who have already made it past head.
- *
- *      head = new Node(x, head);
- *    }
- *
- *    // ...  other similar traversal and update methods ...
- * }
- * 
- * @see Semaphore - *

[ Introduction to this package. ] -**/ - -public class Mutex implements Sync { - - /** The lock status **/ - protected boolean inuse_ = false; - - public void acquire() throws InterruptedException { - if (Thread.interrupted()) throw new InterruptedException(); - synchronized(this) { - try { - while (inuse_) wait(); - inuse_ = true; - } - catch (InterruptedException ex) { - notify(); - throw ex; - } - } - } - - public synchronized void release() { - inuse_ = false; - notify(); - } - - - public boolean attempt(long msecs) throws InterruptedException { - if (Thread.interrupted()) throw new InterruptedException(); - synchronized(this) { - if (!inuse_) { - inuse_ = true; - return true; - } - else if (msecs <= 0) - return false; - else { - long waitTime = msecs; - long start = System.currentTimeMillis(); - try { - for (;;) { - wait(waitTime); - if (!inuse_) { - inuse_ = true; - return true; - } - else { - waitTime = msecs - (System.currentTimeMillis() - start); - if (waitTime <= 0) - return false; - } - } - } - catch (InterruptedException ex) { - notify(); - throw ex; - } - } - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/ReentrantMutex.java 2018-01-30 20:19:23.000000000 -0500 +++ /dev/null 2018-01-30 20:19:23.000000000 -0500 @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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. - */ - -/* - File: Mutex.java - - Originally written by Doug Lea and released into the public domain. - This may be used for any purposes whatsoever without acknowledgment. - Thanks for the assistance and support of Sun Microsystems Labs, - and everyone contributing, testing, and using this code. - - History: - Date Who What - 11Jun1998 dl Create public version -*/ - -package com.sun.corba.se.impl.orbutil.concurrent; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -/** - * A simple reentrant mutual exclusion lock. - * The lock is free upon construction. Each acquire gets the - * lock, and each release frees it. Releasing a lock that - * is already free has no effect. - *

- * This implementation makes no attempt to provide any fairness - * or ordering guarantees. If you need them, consider using one of - * the Semaphore implementations as a locking mechanism. - *

- * Sample usage
- *

- * Mutex can be useful in constructions that cannot be - * expressed using java synchronized blocks because the - * acquire/release pairs do not occur in the same method or - * code block. For example, you can use them for hand-over-hand - * locking across the nodes of a linked list. This allows - * extremely fine-grained locking, and so increases - * potential concurrency, at the cost of additional complexity and - * overhead that would normally make this worthwhile only in cases of - * extreme contention. - *

- * class Node {
- *   Object item;
- *   Node next;
- *   Mutex lock = new Mutex(); // each node keeps its own lock
- *
- *   Node(Object x, Node n) { item = x; next = n; }
- * }
- *
- * class List {
- *    protected Node head; // pointer to first node of list
- *
- *    // Use plain java synchronization to protect head field.
- *    //  (We could instead use a Mutex here too but there is no
- *    //  reason to do so.)
- *    protected synchronized Node getHead() { return head; }
- *
- *    boolean search(Object x) throws InterruptedException {
- *      Node p = getHead();
- *      if (p == null) return false;
- *
- *      //  (This could be made more compact, but for clarity of illustration,
- *      //  all of the cases that can arise are handled separately.)
- *
- *      p.lock.acquire();              // Prime loop by acquiring first lock.
- *                                     //    (If the acquire fails due to
- *                                     //    interrupt, the method will throw
- *                                     //    InterruptedException now,
- *                                     //    so there is no need for any
- *                                     //    further cleanup.)
- *      for (;;) {
- *        if (x.equals(p.item)) {
- *          p.lock.release();          // release current before return
- *          return true;
- *        }
- *        else {
- *          Node nextp = p.next;
- *          if (nextp == null) {
- *            p.lock.release();       // release final lock that was held
- *            return false;
- *          }
- *          else {
- *            try {
- *              nextp.lock.acquire(); // get next lock before releasing current
- *            }
- *            catch (InterruptedException ex) {
- *              p.lock.release();    // also release current if acquire fails
- *              throw ex;
- *            }
- *            p.lock.release();      // release old lock now that new one held
- *            p = nextp;
- *          }
- *        }
- *      }
- *    }
- *
- *    synchronized void add(Object x) { // simple prepend
- *      // The use of `synchronized'  here protects only head field.
- *      // The method does not need to wait out other traversers
- *      // who have already made it past head.
- *
- *      head = new Node(x, head);
- *    }
- *
- *    // ...  other similar traversal and update methods ...
- * }
- * 
- *

- *

This version adds some debugging capability: it will detect - * an attempt by a thread that does not hold the mutex to release it. - * This version is reentrant: the same thread may acquire a mutex multiple - * times, in which case it must release the mutex the same number of times - * as it was acquired before another thread can acquire the mutex. - * @see Semaphore - *

[ Introduction to this package. ] -**/ - -import org.omg.CORBA.INTERNAL ; - -public class ReentrantMutex implements Sync { - - /** The thread holding the lock **/ - protected Thread holder_ = null; - - /** number of times thread has acquired the lock **/ - protected int counter_ = 0 ; - - protected boolean debug = false ; - - public ReentrantMutex() - { - this( false ) ; - } - - public ReentrantMutex( boolean debug ) - { - this.debug = debug ; - } - - public void acquire() throws InterruptedException { - if (Thread.interrupted()) - throw new InterruptedException(); - - synchronized(this) { - try { - if (debug) - ORBUtility.dprintTrace( this, - "acquire enter: holder_=" + - ORBUtility.getThreadName(holder_) + - " counter_=" + counter_ ) ; - - Thread thr = Thread.currentThread(); - if (holder_ != thr) { - try { - while (counter_ > 0) - wait(); - - // This can't happen, but make sure anyway - if (counter_ != 0) - throw new INTERNAL( - "counter not 0 when first acquiring mutex" ) ; - - holder_ = thr; - } catch (InterruptedException ex) { - notify(); - throw ex; - } - } - - counter_ ++ ; - } finally { - if (debug) - ORBUtility.dprintTrace( this, "acquire exit: holder_=" + - ORBUtility.getThreadName(holder_) + " counter_=" + - counter_ ) ; - } - } - } - - void acquireAll( int count ) throws InterruptedException - { - if (Thread.interrupted()) - throw new InterruptedException(); - - synchronized(this) { - try { - if (debug) - ORBUtility.dprintTrace( this, - "acquireAll enter: count=" + count + " holder_=" + - ORBUtility.getThreadName(holder_) + " counter_=" + - counter_ ) ; - Thread thr = Thread.currentThread(); - if (holder_ == thr) { - throw new INTERNAL( - "Cannot acquireAll while holding the mutex" ) ; - } else { - try { - while (counter_ > 0) - wait(); - - // This can't happen, but make sure anyway - if (counter_ != 0) - throw new INTERNAL( - "counter not 0 when first acquiring mutex" ) ; - - holder_ = thr; - } catch (InterruptedException ex) { - notify(); - throw ex; - } - } - - counter_ = count ; - } finally { - if (debug) - ORBUtility.dprintTrace( this, "acquireAll exit: count=" + - count + " holder_=" + ORBUtility.getThreadName(holder_) + - " counter_=" + counter_ ) ; - } - } - } - - public synchronized void release() - { - try { - if (debug) - ORBUtility.dprintTrace( this, "release enter: " + - " holder_=" + ORBUtility.getThreadName(holder_) + - " counter_=" + counter_ ) ; - - Thread thr = Thread.currentThread(); - if (thr != holder_) - throw new INTERNAL( - "Attempt to release Mutex by thread not holding the Mutex" ) ; - else - counter_ -- ; - - if (counter_ == 0) { - holder_ = null; - notify(); - } - } finally { - if (debug) - ORBUtility.dprintTrace( this, "release exit: " + - " holder_=" + ORBUtility.getThreadName(holder_) + - " counter_=" + counter_ ) ; - } - } - - synchronized int releaseAll() - { - try { - if (debug) - ORBUtility.dprintTrace( this, "releaseAll enter: " + - " holder_=" + ORBUtility.getThreadName(holder_) + - " counter_=" + counter_ ) ; - - Thread thr = Thread.currentThread(); - if (thr != holder_) - throw new INTERNAL( - "Attempt to releaseAll Mutex by thread not holding the Mutex" ) ; - - int result = counter_ ; - counter_ = 0 ; - holder_ = null ; - notify() ; - return result ; - } finally { - if (debug) - ORBUtility.dprintTrace( this, "releaseAll exit: " + - " holder_=" + ORBUtility.getThreadName(holder_) + - " counter_=" + counter_ ) ; - } - } - - public boolean attempt(long msecs) throws InterruptedException { - if (Thread.interrupted()) - throw new InterruptedException(); - - synchronized(this) { - try { - if (debug) - ORBUtility.dprintTrace( this, "attempt enter: msecs=" + - msecs + " holder_=" + - ORBUtility.getThreadName(holder_) + - " counter_=" + counter_ ) ; - - Thread thr = Thread.currentThread() ; - - if (counter_==0) { - holder_ = thr; - counter_ = 1 ; - return true; - } else if (msecs <= 0) { - return false; - } else { - long waitTime = msecs; - long start = System.currentTimeMillis(); - try { - for (;;) { - wait(waitTime); - if (counter_==0) { - holder_ = thr; - counter_ = 1 ; - return true; - } else { - waitTime = msecs - - (System.currentTimeMillis() - start); - - if (waitTime <= 0) - return false; - } - } - } catch (InterruptedException ex) { - notify(); - throw ex; - } - } - } finally { - if (debug) - ORBUtility.dprintTrace( this, "attempt exit: " + - " holder_=" + ORBUtility.getThreadName(holder_) + - " counter_=" + counter_ ) ; - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Sync.java 2018-01-30 20:19:23.000000000 -0500 +++ /dev/null 2018-01-30 20:19:23.000000000 -0500 @@ -1,362 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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. - */ - -/* - File: Sync.java - - Originally written by Doug Lea and released into the public domain. - This may be used for any purposes whatsoever without acknowledgment. - Thanks for the assistance and support of Sun Microsystems Labs, - and everyone contributing, testing, and using this code. - - History: - Date Who What - 11Jun1998 dl Create public version - 5Aug1998 dl Added some convenient time constants -*/ - -package com.sun.corba.se.impl.orbutil.concurrent; - -/** - * Main interface for locks, gates, and conditions. - *

- * Sync objects isolate waiting and notification for particular - * logical states, resource availability, events, and the like that are - * shared across multiple threads. Use of Syncs sometimes - * (but by no means always) adds flexibility and efficiency - * compared to the use of plain java monitor methods - * and locking, and are sometimes (but by no means always) - * simpler to program with. - *

- * - * Most Syncs are intended to be used primarily (although - * not exclusively) in before/after constructions such as: - *

- * class X {
- *   Sync gate;
- *   // ...
- *
- *   public void m() {
- *     try {
- *       gate.acquire();  // block until condition holds
- *       try {
- *         // ... method body
- *       }
- *       finally {
- *         gate.release()
- *       }
- *     }
- *     catch (InterruptedException ex) {
- *       // ... evasive action
- *     }
- *   }
- *
- *   public void m2(Sync cond) { // use supplied condition
- *     try {
- *       if (cond.attempt(10)) {         // try the condition for 10 ms
- *         try {
- *           // ... method body
- *         }
- *         finally {
- *           cond.release()
- *         }
- *       }
- *     }
- *     catch (InterruptedException ex) {
- *       // ... evasive action
- *     }
- *   }
- * }
- * 
- * Syncs may be used in somewhat tedious but more flexible replacements - * for built-in Java synchronized blocks. For example: - *
- * class HandSynched {
- *   private double state_ = 0.0;
- *   private final Sync lock;  // use lock type supplied in constructor
- *   public HandSynched(Sync l) { lock = l; }
- *
- *   public void changeState(double d) {
- *     try {
- *       lock.acquire();
- *       try     { state_ = updateFunction(d); }
- *       finally { lock.release(); }
- *     }
- *     catch(InterruptedException ex) { }
- *   }
- *
- *   public double getState() {
- *     double d = 0.0;
- *     try {
- *       lock.acquire();
- *       try     { d = accessFunction(state_); }
- *       finally { lock.release(); }
- *     }
- *     catch(InterruptedException ex){}
- *     return d;
- *   }
- *   private double updateFunction(double d) { ... }
- *   private double accessFunction(double d) { ... }
- * }
- * 
- * If you have a lot of such methods, and they take a common - * form, you can standardize this using wrappers. Some of these - * wrappers are standardized in LockedExecutor, but you can make others. - * For example: - *
- * class HandSynchedV2 {
- *   private double state_ = 0.0;
- *   private final Sync lock;  // use lock type supplied in constructor
- *   public HandSynchedV2(Sync l) { lock = l; }
- *
- *   protected void runSafely(Runnable r) {
- *     try {
- *       lock.acquire();
- *       try { r.run(); }
- *       finally { lock.release(); }
- *     }
- *     catch (InterruptedException ex) { // propagate without throwing
- *       Thread.currentThread().interrupt();
- *     }
- *   }
- *
- *   public void changeState(double d) {
- *     runSafely(new Runnable() {
- *       public void run() { state_ = updateFunction(d); }
- *     });
- *   }
- *   // ...
- * }
- * 
- *

- * One reason to bother with such constructions is to use deadlock- - * avoiding back-offs when dealing with locks involving multiple objects. - * For example, here is a Cell class that uses attempt to back-off - * and retry if two Cells are trying to swap values with each other - * at the same time. - *

- * class Cell {
- *   long value;
- *   Sync lock = ... // some sync implementation class
- *   void swapValue(Cell other) {
- *     for (;;) {
- *       try {
- *         lock.acquire();
- *         try {
- *           if (other.lock.attempt(100)) {
- *             try {
- *               long t = value;
- *               value = other.value;
- *               other.value = t;
- *               return;
- *             }
- *             finally { other.lock.release(); }
- *           }
- *         }
- *         finally { lock.release(); }
- *       }
- *       catch (InterruptedException ex) { return; }
- *     }
- *   }
- * }
- * 
- *

- * Here is an even fancier version, that uses lock re-ordering - * upon conflict: - *

{@code
- * class Cell {
- *   long value;
- *   Sync lock = ...;
- *   private static boolean trySwap(Cell a, Cell b) {
- *     a.lock.acquire();
- *     try {
- *       if (!b.lock.attempt(0))
- *         return false;
- *       try {
- *         long t = a.value;
- *         a.value = b.value;
- *         b.value = t;
- *         return true;
- *       }
- *       finally { other.lock.release(); }
- *     }
- *     finally { lock.release(); }
- *     return false;
- *   }
- *
- *  void swapValue(Cell other) {
- *    try {
- *      while (!trySwap(this, other) &&
- *            !tryswap(other, this))
- *        Thread.sleep(1);
- *    }
- *    catch (InterruptedException ex) { return; }
- *  }
- * }
- * }
- *

- * Interruptions are in general handled as early as possible. - * Normally, InterruptionExceptions are thrown - * in acquire and attempt(msec) if interruption - * is detected upon entry to the method, as well as in any - * later context surrounding waits. - * However, interruption status is ignored in release(); - *

- * Timed versions of attempt report failure via return value. - * If so desired, you can transform such constructions to use exception - * throws via - *

- *   if (!c.attempt(timeval)) throw new TimeoutException(timeval);
- * 
- *

- * The TimoutSync wrapper class can be used to automate such usages. - *

- * All time values are expressed in milliseconds as longs, which have a maximum - * value of Long.MAX_VALUE, or almost 300,000 centuries. It is not - * known whether JVMs actually deal correctly with such extreme values. - * For convenience, some useful time values are defined as static constants. - *

- * All implementations of the three Sync methods guarantee to - * somehow employ Java synchronized methods or blocks, - * and so entail the memory operations described in JLS - * chapter 17 which ensure that variables are loaded and flushed - * within before/after constructions. - *

- * Syncs may also be used in spinlock constructions. Although - * it is normally best to just use acquire(), various forms - * of busy waits can be implemented. For a simple example - * (but one that would probably never be preferable to using acquire()): - *

{@code
- * class X {
- *   Sync lock = ...
- *   void spinUntilAcquired() throws InterruptedException {
- *     // Two phase.
- *     // First spin without pausing.
- *     int purespins = 10;
- *     for (int i = 0; i < purespins; ++i) {
- *       if (lock.attempt(0))
- *         return true;
- *     }
- *     // Second phase - use timed waits
- *     long waitTime = 1; // 1 millisecond
- *     for (;;) {
- *       if (lock.attempt(waitTime))
- *         return true;
- *       else
- *         waitTime = waitTime * 3 / 2 + 1; // increase 50%
- *     }
- *   }
- * }
- * }
- *

- * In addition pure synchronization control, Syncs - * may be useful in any context requiring before/after methods. - * For example, you can use an ObservableSync - * (perhaps as part of a LayeredSync) in order to obtain callbacks - * before and after each method invocation for a given class. - * - * [ Introduction to this package. ] - **/ - - -public interface Sync { - - /** - * Wait (possibly forever) until successful passage. - * Fail only upon interuption. Interruptions always result in - * `clean' failures. On failure, you can be sure that it has not - * been acquired, and that no - * corresponding release should be performed. Conversely, - * a normal return guarantees that the acquire was successful. - **/ - - public void acquire() throws InterruptedException; - - /** - * Wait at most msecs to pass; report whether passed. - *

- * The method has best-effort semantics: - * The msecs bound cannot - * be guaranteed to be a precise upper bound on wait time in Java. - * Implementations generally can only attempt to return as soon as possible - * after the specified bound. Also, timers in Java do not stop during garbage - * collection, so timeouts can occur just because a GC intervened. - * So, msecs arguments should be used in - * a coarse-grained manner. Further, - * implementations cannot always guarantee that this method - * will return at all without blocking indefinitely when used in - * unintended ways. For example, deadlocks may be encountered - * when called in an unintended context. - *

- * @param msecs the number of milleseconds to wait. - * An argument less than or equal to zero means not to wait at all. - * However, this may still require - * access to a synchronization lock, which can impose unbounded - * delay if there is a lot of contention among threads. - * @return true if acquired - **/ - - public boolean attempt(long msecs) throws InterruptedException; - - /** - * Potentially enable others to pass. - *

- * Because release does not raise exceptions, - * it can be used in `finally' clauses without requiring extra - * embedded try/catch blocks. But keep in mind that - * as with any java method, implementations may - * still throw unchecked exceptions such as Error or NullPointerException - * when faced with uncontinuable errors. However, these should normally - * only be caught by higher-level error handlers. - **/ - - public void release(); - - /** One second, in milliseconds; convenient as a time-out value **/ - public static final long ONE_SECOND = 1000; - - /** One minute, in milliseconds; convenient as a time-out value **/ - public static final long ONE_MINUTE = 60 * ONE_SECOND; - - /** One hour, in milliseconds; convenient as a time-out value **/ - public static final long ONE_HOUR = 60 * ONE_MINUTE; - - /** One day, in milliseconds; convenient as a time-out value **/ - public static final long ONE_DAY = 24 * ONE_HOUR; - - /** One week, in milliseconds; convenient as a time-out value **/ - public static final long ONE_WEEK = 7 * ONE_DAY; - - /** One year in milliseconds; convenient as a time-out value **/ - // Not that it matters, but there is some variation across - // standard sources about value at msec precision. - // The value used is the same as in java.util.GregorianCalendar - public static final long ONE_YEAR = (long)(365.2425 * ONE_DAY); - - /** One century in milliseconds; convenient as a time-out value **/ - public static final long ONE_CENTURY = 100 * ONE_YEAR; - - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/SyncUtil.java 2018-01-30 20:19:24.000000000 -0500 +++ /dev/null 2018-01-30 20:19:24.000000000 -0500 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2001, 2002, 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.corba.se.impl.orbutil.concurrent; - -import com.sun.corba.se.impl.orbutil.concurrent.Sync ; - -public class SyncUtil { - private SyncUtil() {} - - /** Method to acquire a Sync without ever throwing an - * InterruptedException. Useful when a mutex is being - * used in place of Java synchronization. - */ - public static void acquire( Sync sync ) - { - boolean held = false ; - while (!held) { - try { - sync.acquire() ; - held = true ; - } catch (InterruptedException exc) { - held = false ; - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/GuardedAction.java 2018-01-30 20:19:25.000000000 -0500 +++ /dev/null 2018-01-30 20:19:25.000000000 -0500 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.orbutil.fsm ; - -import com.sun.corba.se.spi.orbutil.fsm.Guard ; -import com.sun.corba.se.spi.orbutil.fsm.GuardBase ; -import com.sun.corba.se.spi.orbutil.fsm.Input ; -import com.sun.corba.se.spi.orbutil.fsm.Action ; -import com.sun.corba.se.spi.orbutil.fsm.State ; -import com.sun.corba.se.spi.orbutil.fsm.FSM ; - -public class GuardedAction { - private static Guard trueGuard = new GuardBase( "true" ) { - public Guard.Result evaluate( FSM fsm, Input in ) - { - return Guard.Result.ENABLED ; - } - } ; - - private Guard guard ; - private Action action ; - private State nextState ; - - public GuardedAction( Action action, State nextState ) - { - this.guard = trueGuard ; - this.action = action ; - this.nextState = nextState ; - } - - public GuardedAction( Guard guard, Action action, State nextState ) - { - this.guard = guard ; - this.action = action ; - this.nextState = nextState ; - } - - public String toString() - { - return "GuardedAction[action=" + action + " guard=" + guard + - " nextState=" + nextState + "]" ; - } - - public Action getAction() { return action ; } - public Guard getGuard() { return guard ; } - public State getNextState() { return nextState ; } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/NameBase.java 2018-01-30 20:19:25.000000000 -0500 +++ /dev/null 2018-01-30 20:19:25.000000000 -0500 @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.orbutil.fsm ; - -import com.sun.corba.se.spi.orbutil.fsm.Action ; -import com.sun.corba.se.spi.orbutil.fsm.State ; -import com.sun.corba.se.spi.orbutil.fsm.Guard ; -import com.sun.corba.se.spi.orbutil.fsm.Input ; - -import java.util.StringTokenizer ; - -public class NameBase { - private String name ; - private String toStringName ; - - // Return just the name of the class, not the full qualified name. - private String getClassName() - { - String fqn = this.getClass().getName() ; - StringTokenizer st = new StringTokenizer( fqn, "." ) ; - String token = st.nextToken() ; - while (st.hasMoreTokens()) - token = st.nextToken() ; - return token ; - } - - private String getPreferredClassName() - { - if (this instanceof Action) - return "Action" ; - if (this instanceof State) - return "State" ; - if (this instanceof Guard) - return "Guard" ; - if (this instanceof Input) - return "Input" ; - return getClassName() ; - } - - public NameBase( String name ) - { - this.name = name ; - toStringName = getPreferredClassName() + "[" + name + "]" ; - } - - public String getName() - { - return name ; - } - - public String toString() { - return toStringName ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/StateEngineImpl.java 2018-01-30 20:19:26.000000000 -0500 +++ /dev/null 2018-01-30 20:19:26.000000000 -0500 @@ -1,328 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.orbutil.fsm ; - -import java.util.HashMap ; -import java.util.HashSet ; -import java.util.Set ; -import java.util.Iterator ; - -import org.omg.CORBA.INTERNAL ; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -import com.sun.corba.se.spi.orbutil.fsm.Input ; -import com.sun.corba.se.spi.orbutil.fsm.Guard ; -import com.sun.corba.se.spi.orbutil.fsm.Action ; -import com.sun.corba.se.spi.orbutil.fsm.ActionBase ; -import com.sun.corba.se.spi.orbutil.fsm.State ; -import com.sun.corba.se.spi.orbutil.fsm.StateEngine ; -import com.sun.corba.se.spi.orbutil.fsm.StateImpl ; -import com.sun.corba.se.spi.orbutil.fsm.FSM ; -import com.sun.corba.se.spi.orbutil.fsm.FSMImpl ; - -import com.sun.corba.se.impl.orbutil.fsm.GuardedAction ; - -/** - * Encodes the state transition function for a finite state machine. - * - * @author Ken Cavanaugh - */ -public class StateEngineImpl implements StateEngine -{ - // An action that does nothing at all. - private static Action emptyAction = new ActionBase( "Empty" ) - { - public void doIt( FSM fsm, Input in ) - { - } - } ; - - private boolean initializing ; - private Action defaultAction ; - - public StateEngineImpl() - { - initializing = true ; - defaultAction = new ActionBase("Invalid Transition") - { - public void doIt( FSM fsm, Input in ) - { - throw new INTERNAL( - "Invalid transition attempted from " + - fsm.getState() + " under " + in ) ; - } - } ; - } - - public StateEngine add( State oldState, Input input, Guard guard, Action action, - State newState ) throws IllegalArgumentException, - IllegalStateException - { - mustBeInitializing() ; - - StateImpl oldStateImpl = (StateImpl)oldState ; - GuardedAction ga = new GuardedAction( guard, action, newState ) ; - oldStateImpl.addGuardedAction( input, ga ) ; - - return this ; - } - - public StateEngine add( State oldState, Input input, Action action, - State newState ) throws IllegalArgumentException, - IllegalStateException - { - mustBeInitializing() ; - - StateImpl oldStateImpl = (StateImpl)oldState ; - GuardedAction ta = new GuardedAction( action, newState ) ; - oldStateImpl.addGuardedAction( input, ta ) ; - - return this ; - } - - public StateEngine setDefault( State oldState, Action action, State newState ) - throws IllegalArgumentException, IllegalStateException - { - mustBeInitializing() ; - - StateImpl oldStateImpl = (StateImpl)oldState ; - oldStateImpl.setDefaultAction( action ) ; - oldStateImpl.setDefaultNextState( newState ) ; - - return this ; - } - - public StateEngine setDefault( State oldState, State newState ) - throws IllegalArgumentException, IllegalStateException - { - return setDefault( oldState, emptyAction, newState ) ; - } - - public StateEngine setDefault( State oldState ) - throws IllegalArgumentException, IllegalStateException - { - return setDefault( oldState, oldState ) ; - } - - public void done() throws IllegalStateException - { - mustBeInitializing() ; - - // optimize FSM here if desired. For example, - // we could choose different strategies for implementing - // the state transition function based on the distribution - // of values for states and input labels. - - initializing = false ; - } - - public void setDefaultAction( Action act ) throws IllegalStateException - { - mustBeInitializing() ; - defaultAction = act ; - } - - public void doIt( FSM fsm, Input in, boolean debug ) - { - // This method is present only for debugging. - // innerDoIt does the actual transition. - - if (debug) - ORBUtility.dprint( this, "doIt enter: currentState = " + - fsm.getState() + " in = " + in ) ; - - try { - innerDoIt( fsm, in, debug ) ; - } finally { - if (debug) - ORBUtility.dprint( this, "doIt exit" ) ; - } - } - - private StateImpl getDefaultNextState( StateImpl currentState ) - { - // Use the currentState defaults if - // set, otherwise use the state engine default. - StateImpl nextState = (StateImpl)currentState.getDefaultNextState() ; - if (nextState == null) - // The state engine default never changes the state - nextState = currentState ; - - return nextState ; - } - - private Action getDefaultAction( StateImpl currentState ) - { - Action action = currentState.getDefaultAction() ; - if (action == null) - action = defaultAction ; - - return action ; - } - - private void innerDoIt( FSM fsm, Input in, boolean debug ) - { - if (debug) { - ORBUtility.dprint( this, "Calling innerDoIt with input " + in ) ; - } - - // Locals needed for performing the state transition, once we determine - // the required transition. - StateImpl currentState = null ; - StateImpl nextState = null ; - Action action = null ; - - // Do until no guard has deferred. - boolean deferral = false ; - do { - deferral = false ; // clear this after each deferral! - currentState = (StateImpl)fsm.getState() ; - nextState = getDefaultNextState( currentState ) ; - action = getDefaultAction( currentState ) ; - - if (debug) { - ORBUtility.dprint( this, "currentState = " + currentState ) ; - ORBUtility.dprint( this, "in = " + in ) ; - ORBUtility.dprint( this, "default nextState = " + nextState ) ; - ORBUtility.dprint( this, "default action = " + action ) ; - } - - Set gas = currentState.getGuardedActions(in) ; - if (gas != null) { - Iterator iter = gas.iterator() ; - - // Search for a guard that is not DISABLED. - // All DISABLED means use defaults. - while (iter.hasNext()) { - GuardedAction ga = (GuardedAction)iter.next() ; - Guard.Result gr = ga.getGuard().evaluate( fsm, in ) ; - if (debug) - ORBUtility.dprint( this, - "doIt: evaluated " + ga + " with result " + gr ) ; - - if (gr == Guard.Result.ENABLED) { - // ga has the next state and action. - nextState = (StateImpl)ga.getNextState() ; - action = ga.getAction() ; - if (debug) { - ORBUtility.dprint( this, "nextState = " + nextState ) ; - ORBUtility.dprint( this, "action = " + action ) ; - } - break ; - } else if (gr == Guard.Result.DEFERED) { - deferral = true ; - break ; - } - } - } - } while (deferral) ; - - performStateTransition( fsm, in, nextState, action, debug ) ; - } - - private void performStateTransition( FSM fsm, Input in, - StateImpl nextState, Action action, boolean debug ) - { - StateImpl currentState = (StateImpl)fsm.getState() ; - - // Perform the state transition. Pre and post actions are only - // performed if the state changes (see UML hidden transitions). - - boolean different = !currentState.equals( nextState ) ; - - if (different) { - if (debug) - ORBUtility.dprint( this, - "doIt: executing postAction for state " + currentState ) ; - try { - currentState.postAction( fsm ) ; - } catch (Throwable thr) { - if (debug) - ORBUtility.dprint( this, - "doIt: postAction threw " + thr ) ; - - if (thr instanceof ThreadDeath) - throw (ThreadDeath)thr ; - } - } - - try { - // Note that action may be null in a transition, which simply - // means that no action is needed. Note that action.doIt may - // throw an exception, in which case the exception is - // propagated after making sure that the transition is properly - // completed. - if (action != null) - action.doIt( fsm, in ) ; - } finally { - if (different) { - if (debug) - ORBUtility.dprint( this, - "doIt: executing preAction for state " + nextState ) ; - - try { - nextState.preAction( fsm ) ; - } catch (Throwable thr) { - if (debug) - ORBUtility.dprint( this, - "doIt: preAction threw " + thr ) ; - - if (thr instanceof ThreadDeath) - throw (ThreadDeath)thr ; - } - - ((FSMImpl)fsm).internalSetState( nextState ) ; - } - - if (debug) - ORBUtility.dprint( this, "doIt: state is now " + nextState ) ; - } - } - - public FSM makeFSM( State startState ) throws IllegalStateException - { - mustNotBeInitializing() ; - - return new FSMImpl( this, startState ) ; - } - - private void mustBeInitializing() throws IllegalStateException - { - if (!initializing) - throw new IllegalStateException( - "Invalid method call after initialization completed" ) ; - } - - private void mustNotBeInitializing() throws IllegalStateException - { - if (initializing) - throw new IllegalStateException( - "Invalid method call before initialization completed" ) ; - } -} - -// end of StateEngineImpl.java --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Graph.java 2018-01-30 20:19:27.000000000 -0500 +++ /dev/null 2018-01-30 20:19:27.000000000 -0500 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.orbutil.graph ; - -import java.util.Set ; - -public interface Graph extends Set // Set -{ - NodeData getNodeData( Node node ) ; - - Set /* Set */ getRoots() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/GraphImpl.java 2018-01-30 20:19:27.000000000 -0500 +++ /dev/null 2018-01-30 20:19:27.000000000 -0500 @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.orbutil.graph ; - -import java.util.Collection ; -import java.util.AbstractSet ; -import java.util.Iterator ; -import java.util.Map ; -import java.util.HashMap ; -import java.util.Set ; -import java.util.HashSet ; - -public class GraphImpl extends AbstractSet implements Graph -{ - private Map /* Map */ nodeToData ; - - public GraphImpl() - { - nodeToData = new HashMap() ; - } - - public GraphImpl( Collection coll ) - { - this() ; - addAll( coll ) ; - } - -/***********************************************************************************/ -/************ AbstractSet implementation *******************************************/ -/***********************************************************************************/ - - // Required for AbstractSet - public boolean add( Object obj ) // obj must be a Node - { - if (!(obj instanceof Node)) - throw new IllegalArgumentException( "Graphs must contain only Node instances" ) ; - - Node node = (Node)obj ; - boolean found = nodeToData.keySet().contains( obj ) ; - - if (!found) { - NodeData nd = new NodeData() ; - nodeToData.put( node, nd ) ; - } - - return !found ; - } - - // Required for AbstractSet - public Iterator iterator() - { - return nodeToData.keySet().iterator() ; - } - - // Required for AbstractSet - public int size() - { - return nodeToData.keySet().size() ; - } - -/***********************************************************************************/ - - public NodeData getNodeData( Node node ) - { - return (NodeData)nodeToData.get( node ) ; - } - - private void clearNodeData() - { - // Clear every node - Iterator iter = nodeToData.entrySet().iterator() ; - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry)iter.next() ; - NodeData nd = (NodeData)(entry.getValue()) ; - nd.clear( ) ; - } - } - - interface NodeVisitor - { - void visit( Graph graph, Node node, NodeData nd ) ; - } - - // This visits every node in the graph exactly once. A - // visitor is allowed to modify the graph during the - // traversal. - void visitAll( NodeVisitor nv ) - { - boolean done = false ; - - // Repeat the traversal until every node has been visited. Since - // it takes one pass to determine whether or not each node has - // already been visited, this loop always runs at least once. - do { - done = true ; - - // Copy entries to array to avoid concurrent modification - // problem with iterator if the visitor is updating the graph. - Map.Entry[] entries = - (Map.Entry[])nodeToData.entrySet().toArray( new Map.Entry[0] ) ; - - // Visit each node in the graph that has not already been visited. - // If any node is visited in this pass, we must run at least one more - // pass. - for (int ctr=0; ctr - while (iter.hasNext()) { - Node child = (Node)iter.next() ; - - // Make sure the child is in the graph so it can be - // visited later if necessary. - graph.add( child ) ; - - // Mark the child as a non-root, since a child is never a root. - NodeData cnd = graph.getNodeData( child ) ; - cnd.notRoot() ; - } - } - } ) ; - } - - private Set collectRootSet() - { - final Set result = new HashSet() ; - - Iterator iter = nodeToData.entrySet().iterator() ; - while (iter.hasNext()) { - Map.Entry entry = (Map.Entry)iter.next() ; - Node node = (Node)entry.getKey() ; - NodeData nd = (NodeData)entry.getValue() ; - if (nd.isRoot()) - result.add( node ) ; - } - - return result ; - } - - public Set /* Set */ getRoots() - { - clearNodeData() ; - markNonRoots() ; - return collectRootSet() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Node.java 2018-01-30 20:19:28.000000000 -0500 +++ /dev/null 2018-01-30 20:19:28.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.orbutil.graph ; - -import java.util.Set ; - -/** Node in a graph. -*/ -public interface Node -{ - /** Get all the children of this node. - */ - Set /* Set */ getChildren() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/NodeData.java 2018-01-30 20:19:29.000000000 -0500 +++ /dev/null 2018-01-30 20:19:29.000000000 -0500 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.orbutil.graph ; - -/** Data about a node in a graph. - */ -public class NodeData -{ - private boolean visited ; - private boolean root ; - - public NodeData() - { - clear() ; - } - - public void clear() - { - this.visited = false ; - this.root = true ; - } - - /** Return whether this node has been visited in a traversal. - * Note that we only support a single traversal at a time. - */ - boolean isVisited() - { - return visited ; - } - - void visited() - { - visited = true ; - } - - /** Return whether this node is a root. - */ - boolean isRoot() - { - return root ; - } - - void notRoot() - { - root = false ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb.properties 2018-01-30 20:19:29.000000000 -0500 +++ /dev/null 2018-01-30 20:19:29.000000000 -0500 @@ -1,193 +0,0 @@ -# -# Copyright (c) 2000, 2005, 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. -# - -orbd.usage=Usage: {0} \ -\n\ -\nwhere includes:\ -\n -port Activation Port where the ORBD should be started, default 1049 (optional)\ -\n -defaultdb Directory for ORBD files, default "./orb.db" (optional)\ -\n -serverid Server Id for ORBD, default 1 (optional)\ -\n -ORBInitialPort Initial Port (required)\ -\n -ORBInitialHost Initial HostName (required)\ -\n\ - - -servertool.usage=Usage: {0} \ -\n\ -\nwhere includes:\ -\n -ORBInitialPort Initial Port (required)\ -\n -ORBInitialHost Initial HostName (required)\ -\n\ - -servertool.banner=\ -\n\ -\nWelcome to the Java IDL Server Tool \ -\nplease enter commands at the prompt \ -\n\ - -servertool.shorthelp=\ -\n\ -\n\tAvailable Commands: \ -\n\t------------------- \ -\n\ - -servertool.baddef=Bad server definition: {0} -servertool.nosuchserver=\tno such server found. -servertool.helddown=\tserver is held down. -servertool.nosuchorb=\tinvalid ORB. -servertool.serverup=\tserver is already up. -servertool.appname=\tapplicationName - {0} -servertool.name=\tname - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\tserver id - {0} -servertool.servernotrunning=\tserver is not running. -servertool.register=\ -\n\ -\n\tregister -server \ -\n\t -applicationName \ -\n\t -classpath \ -\n\t -args \ -\n\t -vmargs \ -\n\ - -servertool.register1=register an activatable server -servertool.register2=\tserver registered (serverid = {0}). -servertool.register3=\tserver registerd but held down (serverid = {0}). -servertool.register4=\tserver already registered (serverid = {0}). - -servertool.unregister=\ -\n\tunregister [ -serverid | -applicationName ] \ -\n\ - -servertool.unregister1=unregister a registered server -servertool.unregister2=\tserver unregistered. - -servertool.locate=\ -\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \ -\n\ - -servertool.locate1=locate ports of specific type for a registered server -servertool.locate2=\ -\n\ -\n\tHost Name {0} \ -\n\ -\n\t\tPort\t\tPort Type\t\tORB Id\ -\n\t\t----\t\t---------\t\t------\ -\n\ - -servertool.locateorb=\ -\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\ -\n\ - -servertool.locateorb1=locate ports for a specific orb of registered server -servertool.locateorb2=\ -\n\ -\n\tHost Name {0} \ -\n\ -\n\t\tPort\t\tPortType\t\tORB Id\ -\n\t\t----\t\t--------\t\t------\ -\n\ - -servertool.getserverid=\n\tgetserverid [ -applicationName ] \ -\n\ - -servertool.getserverid1=return the server id for an applicationName -servertool.getserverid2=\tServer ID for applicationName {0} is {1} - -servertool.list=\n\tlist\ -\n\ - -servertool.list1=list all registered servers -servertool.list2=\ -\n\tServer Id\tServer Class Name\t\tServer Application\ -\n\t---------\t-----------------\t\t------------------\ -\n\ - -servertool.listactive=\n\tlistactive -servertool.listactive1=list currently active servers -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=list applicationNames currently defined -servertool.listappnames2=Currently defined server applicationNames: - -servertool.shutdown=\ -\n\tshutdown [ -serverid | -applicationName ]\ -\n\ - -servertool.shutdown1=shutdown a registered server -servertool.shutdown2=\tserver sucessfully shutdown. -servertool.startserver=\ -\n\tstartup [ -serverid | -applicationName ]\ -\n\ - -servertool.startserver1=start a registered server -servertool.startserver2=\tserver sucessfully started up. - -servertool.quit=\n\tquit\n -servertool.quit1=quit this tool - -servertool.help=\thelp\ -\n\tOR\ -\n\thelp \ -\n\ - -servertool.help1=get help - -servertool.orbidmap=\tUsage: orblist [ -serverid | -applicationName ]\ -\n\ - -servertool.orbidmap1=list of orb names and their mapping -servertool.orbidmap2=\ -\n\tORB Id\t\tORB Name\ -\n\t------\t\t--------\ -\n\ - -pnameserv.success=Persistent NameServer Started Successfully - - -bootstrap.usage=Usage: {0} \ -\n\ -\nwhere includes:\ -\n -ORBInitialPort Initial Port (required)\ -\n -InitialServicesFile File containing list of initial services (required)\ -\n\ - -bootstrap.success=setting port to {0} and reading services from {1} -bootstrap.filenotreadable=the file {0} is not readable -bootstrap.filenotfound=the file {0} not found -bootstrap.exception=caught exception while saving Properties to file {0}: Exception {1} - -tnameserv.exception=caught an exception while starting the bootstrap service on port {0} -tnameserv.usage=try using a different port with commandline arguments -ORBInitialPort -tnameserv.invalidhostoption=ORBInitialHost is not a valid option for NameService -tnameserv.orbinitialport0=ORBInitialPort 0 is not valid option for NameService -tnameserv.hs1=Initial Naming Context:\n{0} -tnameserv.hs2=TransientNameServer: setting port for initial object references to: {0} -tnameserv.hs3=Ready. - -orbd.commfailure=\nFailed to start ORBD because ORBinitialPort is already in use -orbd.internalexception=\nFailed to start ORBD because of an Internal Exception. \nPossible Causes: \n1. Specified ORBInitialPort or ORBActivationPort is already in use \n2. No Write Permission to write orb.db - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties 2018-01-30 20:19:30.000000000 -0500 +++ /dev/null 2018-01-30 20:19:30.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 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. -# - -orbd.usage=Verwendung: {0} \n\nwobei folgende m\u00F6glich sind:\n -port Aktivierungsport, an dem der ORBD gestartet werden sollte, Standardwert 1049 (optional)\n -defaultdb Verzeichnis f\u00FCr ORBD-Dateien, Standardwert "./orb.db" (optional)\n -serverid Server-ID f\u00FCr ORBD, Standardwert 1 (optional)\n -ORBInitialPort Anfangsport (erforderlich)\n -ORBInitialHost Anf\u00E4nglicher HostName (erforderlich)\n - -servertool.usage=Verwendung: {0} \n\nwobei folgende m\u00F6glich sind:\n -ORBInitialPort Anfangsport (erforderlich)\n -ORBInitialHost Anf\u00E4nglicher HostName (erforderlich)\n -servertool.banner=\n\nWillkommen beim Java IDL-Servertool \nGeben Sie die entsprechenden Befehle im Prompt ein \n -servertool.shorthelp=\n\n\tVerf\u00FCgbare Befehle: \n\t------------------- \n -servertool.baddef=Ung\u00FCltige Serverdefinition: {0} -servertool.nosuchserver=\tServer wurde nicht gefunden. -servertool.helddown=\tServer ist au\u00DFer Betrieb. -servertool.nosuchorb=\tUng\u00FCltiger ORB. -servertool.serverup=\tServer ist bereits hochgefahren. -servertool.appname=\tapplicationName - {0} -servertool.name=\tName - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\tServer-ID - {0} -servertool.servernotrunning=\tServer wird nicht ausgef\u00FChrt. -servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n -servertool.register1=aktivierbaren Server registrieren -servertool.register2=\tServer registriert (serverid = {0}). -servertool.register3=\tServer registriert, aber au\u00DFer Betrieb (serverid = {0}). -servertool.register4=\tServer bereits registriert (serverid = {0}). - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n -servertool.unregister1=Registrierung eines registrierten Servers aufheben -servertool.unregister2=\tServerregistrierung aufgehoben. - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n -servertool.locate1=Ports eines speziellen Typs f\u00FCr einen registrierten Server finden -servertool.locate2=\n\n\tHostname {0} \n\n\t\tPort\t\tPorttyp\t\tORB-ID\n\t\t----\t\t-------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=Ports f\u00FCr einen speziellen ORB bei einem registrierten Server finden -servertool.locateorb2=\n\n\tHostname {0} \n\n\t\tPort\t\tPortType\t\tORB-ID\n\t\t----\t\t-------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ] \n -servertool.getserverid1=Server-ID f\u00FCr applicationName zur\u00FCckgeben -servertool.getserverid2=\tServer-ID f\u00FCr applicationName {0} ist {1} - -servertool.list=\n\tlist\n -servertool.list1=alle registrierten Server auflisten -servertool.list2=\n\tServer-ID\tServerklassenname\t\tServeranwendung\n\t---------\t-----------------\t\t------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=derzeit aktive Server auflisten -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=derzeit definierte applicationNames auflisten -servertool.listappnames2=Derzeit definierte Server-applicationNames: - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=registrierten Server herunterfahren -servertool.shutdown2=\tServer erfolgreich heruntergefahren. -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=registrierten Server starten -servertool.startserver2=\tServer erfolgreich hochgefahren. - -servertool.quit=\n\tquit\n -servertool.quit1=dieses Tool beenden - -servertool.help=\thelp\n\tOR\n\thelp \n -servertool.help1=Hilfe abrufen - -servertool.orbidmap=\\Verwendung: orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=Liste von ORB-Namen und ihren Zuordnungen -servertool.orbidmap2=\n\tORB-ID\t\tORB-Name\n\t------\t\t--------\n -pnameserv.success=Persistenter NameServer erfolgreich gestartet - - -bootstrap.usage=Verwendung: {0} \n\nwobei folgende m\u00F6glich sind:\n -ORBInitialPort Anf\u00E4nglicher Port (erforderlich)\n -InitialServicesFile Datei mit Liste von anf\u00E4nglichen Services (erforderlich)\n -bootstrap.success=Port wird auf {0} gesetzt, Services werden aus {1} gelesen -bootstrap.filenotreadable=Datei {0} kann nicht gelesen werden -bootstrap.filenotfound=Datei {0} wurde nicht gefunden -bootstrap.exception=Beim Speichern von Eigenschaften in Datei {0} wurde eine Ausnahme abgefangen: Ausnahme {1} - -tnameserv.exception=Beim Hochfahren des Bootstrap-Services auf Port {0} wurde eine Ausnahme abgefangen -tnameserv.usage=Verwenden Sie einen anderen Port mit den Befehlszeilenargumenten -ORBInitialPort -tnameserv.invalidhostoption=ORBInitialHost ist keine g\u00FCltige Option f\u00FCr NameService -tnameserv.orbinitialport0=ORBInitialPort 0 ist keine g\u00FCltige Option f\u00FCr NameService -tnameserv.hs1=Anf\u00E4nglicher Namenskontext:\n{0} -tnameserv.hs2=TransientNameServer: Port f\u00FCr anf\u00E4ngliche Objektreferenzen wird auf {0} gesetzt -tnameserv.hs3=Bereit. - -orbd.commfailure=\nStart von ORBD nicht erfolgreich, da ORBinitialPort bereits verwendet wird -orbd.internalexception=\nStart von ORBD aufgrund einer internen Ausnahme nicht erfolgreich. \nM\u00F6gliche Ursachen: \n1. Der angegebene ORBInitialPort oder ORBActivationPort wird bereits verwendet \n2. Keine Berechtigung zum Schreiben von orb.db - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties 2018-01-30 20:19:31.000000000 -0500 +++ /dev/null 2018-01-30 20:19:31.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 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. -# - -orbd.usage=Sintaxis: {0} \n\ndonde incluye:\n -port Puerto de activaci\u00F3n en el que se debe iniciar el ORBD, por defecto es el 1049 (opcional)\n -defaultdb Directorio para los archivos de ORBD, por defecto es "./orb.db" (opcional)\n -serverid Identificador de servidor para ORBD, por defecto es 1 (opcional)\n -ORBInitialPort Puerto inicial (necesario)\n -ORBInitialHost Nombre de host inicial (necesario)\n - -servertool.usage=Sintaxis: {0} \n\ndonde incluye:\n -ORBInitialPort Puerto inicial (necesario)\n -ORBInitialHost Nombre de host inicial (necesario)\n -servertool.banner=\n\nBienvenido a Java IDL Server Tool \nescriba los comandos en la petici\u00F3n de datos \n -servertool.shorthelp=\n\n\tComandos disponibles: \n\t------------------- \n -servertool.baddef=Definici\u00F3n de servidor incorrecta: {0} -servertool.nosuchserver=\tno se ha encontrado el servidor. -servertool.helddown=\tel servidor se mantiene desconectado. -servertool.nosuchorb=\tORB no v\u00E1lido. -servertool.serverup=\tel servidor ya est\u00E1 conectado. -servertool.appname=\tapplicationName - {0} -servertool.name=\tname - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\tserver id - {0} -servertool.servernotrunning=\tel servidor no se est\u00E1 ejecutando. -servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n -servertool.register1=registrar un servidor que se pueda activar -servertool.register2=\tservidor registrado (identificador de servidor = {0}). -servertool.register3=\tservidor registrado pero desconectado (identificador de servidor = {0}). -servertool.register4=\tservidor ya registrado (identificador de servidor = {0}). - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n -servertool.unregister1=anular el registro de un servidor registrado -servertool.unregister2=\tanulado el registro del servidor. - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n -servertool.locate1=localizar puertos de un tipo espec\u00EDfico para un servidor registrado -servertool.locate2=\n\n\tNombre de host {0} \n\n\t\tPuerto\t\tTipo de puerto\t\tIdentificador ORB\n\t\t----\t\t---------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=localizar puertos para un ORB espec\u00EDfico del servidor registrado -servertool.locateorb2=\n\n\tNombre de host {0} \n\n\t\tPuerto\t\tTipo de puerto\t\tIdentificador de ORB\n\t\t----\t\t--------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ] \n -servertool.getserverid1=devolver el identificador de servidor para un valor de applicationName -servertool.getserverid2=\tEl identificador de servidor para applicationName {0} es {1} - -servertool.list=\n\tlist\n -servertool.list1=enumerar todos los servidores registrados -servertool.list2=\n\tIdentificador de servidor\tNombre de clase del servidor\t\tAplicaci\u00F3n de servidor\n\t-------------------------\t----------------------------\t\t----------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=enumerar los servidores actualmente activos -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=enumerar los nombres de aplicaci\u00F3n actualmente definidos -servertool.listappnames2=Nombres de aplicaci\u00F3n de servidor actualmente definidos: - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=apagar un servidor registrado -servertool.shutdown2=\tservidor apagado correctamente. -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=iniciar un servidor registrado -servertool.startserver2=\tservidor iniciado correctamente. - -servertool.quit=\n\tquit\n -servertool.quit1=salir de esta herramienta - -servertool.help=\thelp\n\tO\n\thelp \n -servertool.help1=obtener ayuda - -servertool.orbidmap=\tSintaxis: orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=lista de nombres de ORB y su asignaci\u00F3n -servertool.orbidmap2=\n\tIdentificador de ORB\t\tNombre de ORB\n\t------\t\t--------\n -pnameserv.success=NameServer constante iniciado correctamente - - -bootstrap.usage=Sintaxis: {0} \n\ndonde incluye:\n -ORBInitialPort Puerto inicial (necesario)\n -InitialServicesFile Archivo que contiene una lista de los servicios iniciales (necesario)\n -bootstrap.success=definiendo puerto en {0} y leyendo servicios de {1} -bootstrap.filenotreadable=el archivo {0} no se puede leer -bootstrap.filenotfound=no se ha encontrado el archivo {0} -bootstrap.exception=se ha obtenido una excepci\u00F3n al guardar las propiedades en el archivo {0}: Excepci\u00F3n {1} - -tnameserv.exception=se ha obtenido una excepci\u00F3n al iniciar el servicio de inicializaci\u00F3n de datos en el puerto {0} -tnameserv.usage=intente utilizar un puerto distinto con argumentos de l\u00EDnea de comandos -ORBInitialPort -tnameserv.invalidhostoption=ORBInitialHost no es una opci\u00F3n v\u00E1lida para NameService -tnameserv.orbinitialport0=ORBInitialPort 0 no es una opci\u00F3n v\u00E1lida para NameService -tnameserv.hs1=Contexto de Nomenclatura Inicial:\n{0} -tnameserv.hs2=TransientNameServer: definiendo puerto para referencias a objeto iniciales en: {0} -tnameserv.hs3=Listo. - -orbd.commfailure=\nORBD no puede iniciarse porque ORBinitialPort ya est\u00E1 en uso -orbd.internalexception=\nORBD no puede iniciarse debido a una excepci\u00F3n interna. \nCausas posibles: \n1. El ORBInitialPort o el ORBActivationPort especificado ya est\u00E1 en uso \n2. No tiene permiso de escritura para orb.db - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties 2018-01-30 20:19:31.000000000 -0500 +++ /dev/null 2018-01-30 20:19:31.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 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. -# - -orbd.usage=Syntaxe : {0} \n\no\u00F9 comprend :\n -port Port d''activation o\u00F9 l''ORBD doit \u00EAtre d\u00E9marr\u00E9, 1049 par d\u00E9faut (facultatif)\n -defaultdb R\u00E9pertoire des fichiers ORBD, par d\u00E9faut "./orb.db" (facultatif)\n -serverid ID de serveur pour ORBD, 1 par d\u00E9faut (facultatif)\n -ORBInitialPort Port initial (obligatoire)\n -ORBInitialHost Nom d''h\u00F4te initial (obligatoire)\n - -servertool.usage=Syntaxe : {0} \n\no\u00F9 comprend :\n -ORBInitialPort Port initial (obligatoire)\n -ORBInitialHost Nom d''h\u00F4te initial (obligatoire)\n -servertool.banner=\n\nBienvenue dans l'outil Java IDL Server Tool \nSp\u00E9cifiez des commandes \u00E0 l'invite \n -servertool.shorthelp=\n\n\tCommandes disponibles : \n\t------------------- \n -servertool.baddef=D\u00E9finition de serveur incorrecte : {0} -servertool.nosuchserver=\tce serveur est introuvable. -servertool.helddown=\tserveur interrompu. -servertool.nosuchorb=\tORB non valide. -servertool.serverup=\tle serveur fonctionne d\u00E9j\u00E0. -servertool.appname=\tapplicationName - {0} -servertool.name=\tname - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\tID de serveur - {0} -servertool.servernotrunning=\tle serveur ne fonctionne pas. -servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n -servertool.register1=inscrire un serveur activable -servertool.register2=\tserveur inscrit (ID serveur = {0}). -servertool.register3=\tserveur inscrit mais interrompu (ID serveur = {0}). -servertool.register4=\tserveur d\u00E9j\u00E0 inscrit (ID serveur = {0}). - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n -servertool.unregister1=d\u00E9sinscrire un serveur inscrit -servertool.unregister2=\tserveur d\u00E9sinscrit. - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n -servertool.locate1=rep\u00E9rer des ports de type sp\u00E9cifique d'un serveur inscrit -servertool.locate2=\n\n\tNom d''h\u00F4te {0} \n\n\t\tPort\t\tType de port\t\tID ORB\n\t\t----\t\t---------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=rep\u00E9rer les ports d'un ORB sp\u00E9cifique de serveur inscrit -servertool.locateorb2=\n\n\tNom d''h\u00F4te {0} \n\n\t\tPort\t\tType de port\t\tID ORB\n\t\t----\t\t--------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ] \n -servertool.getserverid1=renvoyer l'ID serveur pour un nom d'application -servertool.getserverid2=\tL''ID serveur du nom d''application {0} est {1} - -servertool.list=\n\tlist\n -servertool.list1=lister tous les serveurs inscrits -servertool.list2=\n\tID serveur\tNom de classe serveur\t\tApplication serveur\n\t---------\t-----------------\t\t------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=lister les serveurs actifs -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=lister les noms d'application d\u00E9finis -servertool.listappnames2=Noms d'application du serveur d\u00E9finis : - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=arr\u00EAter un serveur inscrit -servertool.shutdown2=\tserveur arr\u00EAt\u00E9. -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=d\u00E9marrer un serveur inscrit -servertool.startserver2=\tserveur d\u00E9marr\u00E9. - -servertool.quit=\n\tquit\n -servertool.quit1=fermer cet outil - -servertool.help=\thelp\n\tOR\n\thelp \n -servertool.help1=afficher l'aide - -servertool.orbidmap=\tSyntaxe : orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=liste des noms ORB et de leur mappage -servertool.orbidmap2=\n\tID ORB\t\tNom ORB\n\t------\t\t--------\n -pnameserv.success=NameServer persistant d\u00E9marr\u00E9 - - -bootstrap.usage=Syntaxe : {0} \n\no\u00F9 comprend :\n -ORBInitialPort Port initial (obligatoire)\n -InitialServicesFile Fichier contenant la liste des services initiaux (obligatoire)\n -bootstrap.success=configuration du port sur {0} et lecture des services de {1} -bootstrap.filenotreadable=le fichier {0} n''est pas lisible -bootstrap.filenotfound=fichier {0} introuvable -bootstrap.exception=exception d\u00E9tect\u00E9e lors de l''enregistrement des propri\u00E9t\u00E9s dans le fichier {0}. Exception : {1} - -tnameserv.exception=exception d\u00E9tect\u00E9e lors du d\u00E9marrage du service bootstrap sur le port {0} -tnameserv.usage=essayez un autre port avec les arguments de ligne de commande -ORBInitialPort -tnameserv.invalidhostoption=ORBInitialHost n'est pas une option valide pour NameService -tnameserv.orbinitialport0=ORBInitialPort 0 n'est pas une option valide pour NameService -tnameserv.hs1=Contexte de d\u00E9nomination initial :\n{0} -tnameserv.hs2=TransientNameServer : configuration du port pour des r\u00E9f\u00E9rences d''objet initial sur {0} -tnameserv.hs3=Pr\u00EAt. - -orbd.commfailure=\nLe d\u00E9marrage d'ORBD a \u00E9chou\u00E9 car ORBinitialPort est d\u00E9j\u00E0 utilis\u00E9 -orbd.internalexception=\nLe d\u00E9marrage d'ORBD a \u00E9chou\u00E9 en raison d'une exception interne. \nCauses possibles\u00A0: \n1. L'\u00E9l\u00E9ment ORBInitialPort ou ORBActivationPort sp\u00E9cifi\u00E9 est d\u00E9j\u00E0 utilis\u00E9 \n2. Aucune autorisation en \u00E9criture permettant d'\u00E9crire orb.db - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties 2018-01-30 20:19:32.000000000 -0500 +++ /dev/null 2018-01-30 20:19:32.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 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. -# - -orbd.usage=Uso: {0} \n\ndove include:\n -port Porta di attivazione da cui avviare ORBD, valore predefinito 1049 (opzionale)\n -defaultdb Directory per i file ORBD, valore predefinito "./orb.db" (opzionale)\n -serverid ID server per ORBD, valore predefinito 1 (opzionale)\n -ORBInitialPort Porta iniziale (richiesta)\n -ORBInitialHost HostName iniziale (richiesto)\n - -servertool.usage=Uso: {0} \n\ndove include:\n -ORBInitialPort Porta iniziale (richiesta)\n -ORBInitialHost HostName iniziale (richiesto)\n -servertool.banner=\n\nBenvenuti in Java IDL Server Tool \nimmettere i comandi quando richiesto \n -servertool.shorthelp=\n\n\tComandi disponibili:\n\t-------------------- \n -servertool.baddef=Definizione server errata: {0} -servertool.nosuchserver=\timpossibile trovare il server indicato. -servertool.helddown=\til server \u00E8 mantenuto inattivo. -servertool.nosuchorb=\tORB non valido. -servertool.serverup=\til server \u00E8 gi\u00E0 attivo. -servertool.appname=\tapplicationName - {0} -servertool.name=\tnome - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targom - {0} -servertool.vmargs=\targomvm - {0} -servertool.serverid=\tID server - {0} -servertool.servernotrunning=\til server non \u00E8 in funzione. -servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n -servertool.register1=registra un server attivabile -servertool.register2=\tserver registrato (idserver = {0}). -servertool.register3=\tserver registrato ma mantenuto inattivo (idserver = {0}). -servertool.register4=\tserver gi\u00E0 registrato (idserver = {0}). - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n -servertool.unregister1=rimuovi un server registrato. -servertool.unregister2=\tserver rimosso dal registro. - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n -servertool.locate1=individua le porte di un tipo specifico per un server registrato -servertool.locate2=\n\n\tNome host {0} \n\n\t\tPorta\t\tTipo porta\t\tId ORB\n\t\t-----\t\t----------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=individua le porte per un orb specifico di un server registrato -servertool.locateorb2=\n\n\tNome host {0} \n\n\t\tPorta\t\tPortType\t\tId ORB\n\t\t-----\t\t---------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ] \n -servertool.getserverid1=restituisce l'id server per un applicationName -servertool.getserverid2=\tL''ID server per applicationName {0} \u00E8 {1} - -servertool.list=\n\tlista\n -servertool.list1=elenca tutti i server registrati -servertool.list2=\n\tID server\tNome classe server\t\tApplicazione server\n\t---------\t------------------\t\t-------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=elenca i server attivi al momento -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=elenca applicationNames definiti al momento -servertool.listappnames2=applicationNames del server definiti al momento: - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=arresta un server registrato -servertool.shutdown2=\tserver arrestato correttamente -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=avvia un server registrato -servertool.startserver2=\tserver avviato correttamente. - -servertool.quit=\n\tesci\n -servertool.quit1=esci dall'applicazione corrente - -servertool.help=\thelp\n\tOR\n\thelp \n -servertool.help1=Guida - -servertool.orbidmap=\tUso: orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=lista nomi orb e relativa mappatura -servertool.orbidmap2=\n\tId ORB\t\tNome ORB\n\t------\t\t--------\n -pnameserv.success=NameServer persistente avviato correttamente - - -bootstrap.usage=Uso: {0} \n\ndove include:\n -ORBInitialPort Porta iniziale (richiesta)\n -InitialServicesFile File contenente la lista dei servizi iniziali (richiesto)\n -bootstrap.success=impostazione porta su {0} e lettura servizi da {1} in corso -bootstrap.filenotreadable=il file {0} non \u00E8 leggibile -bootstrap.filenotfound=impossibile trovare il file {0} -bootstrap.exception=rilevata un''eccezione durante il salvataggio delle propriet\u00E0 nel file {0}: eccezione {1} - -tnameserv.exception=rilevata un''eccezione durante l''avvio del servizio di bootstrap sulla porta {0} -tnameserv.usage=utilizzare un'altra porta con gli argomenti di riga di comando -ORBInitialPort -tnameserv.invalidhostoption=ORBInitialHost non \u00E8 un'opzione valida per NameService -tnameserv.orbinitialport0=ORBInitialPort 0 non \u00E8 un'opzione valida per NameService -tnameserv.hs1=Contesto di denominazione iniziale:\n{0} -tnameserv.hs2=TransientNameServer: impostazione della porta per i riferimenti degli oggetti iniziali a: {0} -tnameserv.hs3=Pronto. - -orbd.commfailure=\nImpossibile avviare ORBD perch\u00E9 ORBinitialPort \u00E8 gi\u00E0 in uso -orbd.internalexception=\nImpossibile avviare ORBD a causa di un'eccezione interna. \neCause possibili: \n1. ORBInitialPort o ORBActivationPort specificato gi\u00E0 in uso \n2. Non esistono autorizzazioni per scrivere orb.db - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties 2018-01-30 20:19:33.000000000 -0500 +++ /dev/null 2018-01-30 20:19:33.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 2016, 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. -# - -orbd.usage=\u4F7F\u7528\u65B9\u6CD5: {0} \n\n\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n -port ORBD\u306E\u8D77\u52D5\u30DD\u30FC\u30C8\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F1049(\u30AA\u30D7\u30B7\u30E7\u30F3)\n -defaultdb ORBD\u30D5\u30A1\u30A4\u30EB\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F"./orb.db"(\u30AA\u30D7\u30B7\u30E7\u30F3)\n -serverid ORBD\u306E\u30B5\u30FC\u30D0\u30FCId\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F1(\u30AA\u30D7\u30B7\u30E7\u30F3)\n -ORBInitialPort \u521D\u671F\u30DD\u30FC\u30C8(\u5FC5\u9808)\n -ORBInitialHost \u521D\u671F\u30DB\u30B9\u30C8\u540D(\u5FC5\u9808)\n - -servertool.usage=\u4F7F\u7528\u65B9\u6CD5: {0} \n\n\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n -ORBInitialPort \u521D\u671F\u30DD\u30FC\u30C8(\u5FC5\u9808)\n -ORBInitialHost \u521D\u671F\u30DB\u30B9\u30C8\u540D(\u5FC5\u9808)\n -servertool.banner=\n\nJava IDL Server Tool\u3078\u3088\u3046\u3053\u305D\n\u30D7\u30ED\u30F3\u30D7\u30C8\u306B\u30B3\u30DE\u30F3\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\n -servertool.shorthelp=\n\n\t\u4F7F\u7528\u53EF\u80FD\u306A\u30B3\u30DE\u30F3\u30C9: \n\t------------------- \n -servertool.baddef=\u4E0D\u6B63\u306A\u30B5\u30FC\u30D0\u30FC\u5B9A\u7FA9: {0} -servertool.nosuchserver=\t\u6307\u5B9A\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 -servertool.helddown=\t\u30B5\u30FC\u30D0\u30FC\u306F\u505C\u6B62\u3057\u3066\u3044\u307E\u3059\u3002 -servertool.nosuchorb=\tORB\u304C\u7121\u52B9\u3067\u3059\u3002 -servertool.serverup=\t\u30B5\u30FC\u30D0\u30FC\u306F\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059\u3002 -servertool.appname=\tapplicationName - {0} -servertool.name=\tname - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\tserver id - {0} -servertool.servernotrunning=\t\u30B5\u30FC\u30D0\u30FC\u306F\u7A3C\u50CD\u3057\u3066\u3044\u307E\u305B\u3093\u3002 -servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n -servertool.register1=\u8D77\u52D5\u53EF\u80FD\u306A\u30B5\u30FC\u30D0\u30FC\u3092\u767B\u9332\u3057\u307E\u3059 -servertool.register2=\t\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC(serverid={0})\u3002 -servertool.register3=\t\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u304C\u8D77\u52D5\u3057\u3066\u3044\u306A\u3044\u30B5\u30FC\u30D0\u30FC(serverid={0})\u3002 -servertool.register4=\t\u767B\u9332\u6E08\u306E\u30B5\u30FC\u30D0\u30FC(serverid={0})\u3002 - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ]\n -servertool.unregister1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u306E\u767B\u9332\u3092\u89E3\u9664\u3057\u307E\u3059 -servertool.unregister2=\t\u30B5\u30FC\u30D0\u30FC\u306E\u767B\u9332\u304C\u89E3\u9664\u3055\u308C\u307E\u3057\u305F\u3002 - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ]\n -servertool.locate1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u306E\u7279\u5B9A\u30BF\u30A4\u30D7\u306E\u30DD\u30FC\u30C8\u3092\u691C\u51FA\u3057\u307E\u3059 -servertool.locate2=\n\n\t\u30DB\u30B9\u30C8\u540D{0}\n\n\t\t\u30DD\u30FC\u30C8\t\t\u30DD\u30FC\u30C8\u30FB\u30BF\u30A4\u30D7\t\tORB ID\n\t\t------\t\t------------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u306E\u7279\u5B9AORB\u306E\u30DD\u30FC\u30C8\u3092\u691C\u51FA\u3057\u307E\u3059 -servertool.locateorb2=\n\n\t\u30DB\u30B9\u30C8\u540D{0}\n\n\t\t\u30DD\u30FC\u30C8\t\t\u30DD\u30FC\u30C8\u30FB\u30BF\u30A4\u30D7\t\tORB ID\n\t\t------\t\t------------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ]\n -servertool.getserverid1=applicationName\u306E\u30B5\u30FC\u30D0\u30FCID\u3092\u8FD4\u3057\u307E\u3059 -servertool.getserverid2=\tapplicationName {0}\u306E\u30B5\u30FC\u30D0\u30FCID\u306F{1}\u3067\u3059 - -servertool.list=\n\tlist\n -servertool.list1=\u767B\u9332\u3055\u308C\u305F\u3059\u3079\u3066\u306E\u30B5\u30FC\u30D0\u30FC\u306E\u30EA\u30B9\u30C8\u3092\u8868\u793A\u3057\u307E\u3059 -servertool.list2=\n\t\u30B5\u30FC\u30D0\u30FCID\t\u30B5\u30FC\u30D0\u30FC\u306E\u30AF\u30E9\u30B9\u540D\t\t\u30B5\u30FC\u30D0\u30FC\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\n\t---------\t----------------\t\t----------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=\u73FE\u5728\u30A2\u30AF\u30C6\u30A3\u30D6\u306A\u30B5\u30FC\u30D0\u30FC\u306E\u30EA\u30B9\u30C8\u3092\u8868\u793A\u3057\u307E\u3059 -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=\u73FE\u5728\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u308BapplicationNames\u306E\u30EA\u30B9\u30C8\u3092\u8868\u793A\u3057\u307E\u3059 -servertool.listappnames2=\u73FE\u5728\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u308B\u30B5\u30FC\u30D0\u30FCapplicationNames: - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u3092\u505C\u6B62\u3057\u307E\u3059 -servertool.shutdown2=\t\u30B5\u30FC\u30D0\u30FC\u306E\u505C\u6B62\u306B\u6210\u529F\u3057\u307E\u3057\u305F\u3002 -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u3092\u8D77\u52D5\u3057\u307E\u3059 -servertool.startserver2=\t\u30B5\u30FC\u30D0\u30FC\u306E\u8D77\u52D5\u306B\u6210\u529F\u3057\u307E\u3057\u305F\u3002 - -servertool.quit=\n\tquit\n -servertool.quit1=\u3053\u306E\u30C4\u30FC\u30EB\u3092\u7D42\u4E86\u3057\u307E\u3059 - -servertool.help=\thelp\n\t\u307E\u305F\u306F\n\thelp \n -servertool.help1=\u30D8\u30EB\u30D7\u3092\u8868\u793A\u3057\u307E\u3059 - -servertool.orbidmap=\t\u4F7F\u7528\u65B9\u6CD5: orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=ORB\u540D\u304A\u3088\u3073\u305D\u306E\u30DE\u30C3\u30D4\u30F3\u30B0\u306E\u30EA\u30B9\u30C8 -servertool.orbidmap2=\n\tORB ID\t\tORB\u540D\n\t------\t\t--------\n -pnameserv.success=\u6301\u7D9ANameServer\u306E\u8D77\u52D5\u306B\u6210\u529F\u3057\u307E\u3057\u305F - - -bootstrap.usage=\u4F7F\u7528\u65B9\u6CD5: {0} \n\n\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n -ORBInitialPort \u521D\u671F\u30DD\u30FC\u30C8(\u5FC5\u9808)\n -InitialServicesFile \u521D\u671F\u30B5\u30FC\u30D3\u30B9\u30FB\u30EA\u30B9\u30C8\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB(\u5FC5\u9808)\n -bootstrap.success=\u30DD\u30FC\u30C8\u3092{0}\u306B\u8A2D\u5B9A\u3057\u3001{1}\u304B\u3089\u30B5\u30FC\u30D3\u30B9\u3092\u8AAD\u307F\u8FBC\u307F\u307E\u3059 -bootstrap.filenotreadable=\u30D5\u30A1\u30A4\u30EB{0}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093 -bootstrap.filenotfound=\u30D5\u30A1\u30A4\u30EB{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093 -bootstrap.exception=\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u30D5\u30A1\u30A4\u30EB{0}\u306B\u4FDD\u5B58\u4E2D\u306B\u4F8B\u5916\u3092\u6355\u6349\u3057\u307E\u3057\u305F: \u4F8B\u5916{1} - -tnameserv.exception=\u30DD\u30FC\u30C8{0}\u3067\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30B5\u30FC\u30D3\u30B9\u3092\u8D77\u52D5\u4E2D\u306B\u4F8B\u5916\u3092\u6355\u6349\u3057\u307E\u3057\u305F -tnameserv.usage=\u30B3\u30DE\u30F3\u30C9\u884C\u5F15\u6570-ORBInitialPort\u3092\u4F7F\u7528\u3057\u3066\u5225\u306E\u30DD\u30FC\u30C8\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044 -tnameserv.invalidhostoption=ORBInitialHost\u306FNameService\u306B\u6709\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u306F\u3042\u308A\u307E\u305B\u3093 -tnameserv.orbinitialport0=ORBInitialPort 0\u306FNameService\u306B\u6709\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u306F\u3042\u308A\u307E\u305B\u3093 -tnameserv.hs1=\u521D\u671F\u30CD\u30FC\u30DF\u30F3\u30B0\u30FB\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8:\n{0} -tnameserv.hs2=TransientNameServer: \u521D\u671F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u53C2\u7167\u306E\u30DD\u30FC\u30C8\u3092{0}\u306B\u8A2D\u5B9A\u3057\u307E\u3059 -tnameserv.hs3=\u6E96\u5099\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002 - -orbd.commfailure=\nORBinitialPort\u304C\u4F7F\u7528\u4E2D\u3067\u3042\u308B\u305F\u3081\u3001ORBD\u306E\u8D77\u52D5\u306B\u5931\u6557\u3057\u307E\u3057\u305F -orbd.internalexception=\n\u5185\u90E8\u4F8B\u5916\u306E\u305F\u3081\u306BORBD\u306E\u8D77\u52D5\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\n\u8003\u3048\u3089\u308C\u308B\u539F\u56E0: \n1. \u6307\u5B9A\u3055\u308C\u305FORBInitialPort\u307E\u305F\u306FORBActivationPort\u304C\u4F7F\u7528\u4E2D\n2. orb.db\u3078\u306E\u66F8\u8FBC\u307F\u6A29\u9650\u304C\u306A\u3044 - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties 2018-01-30 20:19:33.000000000 -0500 +++ /dev/null 2018-01-30 20:19:33.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 2016, 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. -# - -orbd.usage=\uC0AC\uC6A9\uBC95: {0} \n\n\uC5EC\uAE30\uC11C \uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n -port ORBD\uAC00 \uC2DC\uC791\uB418\uC5B4\uC57C \uD558\uB294 \uD65C\uC131 \uD3EC\uD2B8\uB85C, \uAE30\uBCF8\uAC12\uC740 1049\uC785\uB2C8\uB2E4(\uC120\uD0DD\uC0AC\uD56D).\n -defaultdb ORBD \uD30C\uC77C\uC758 \uB514\uB809\uD1A0\uB9AC\uB85C, \uAE30\uBCF8\uAC12\uC740 "./orb.db"\uC785\uB2C8\uB2E4(\uC120\uD0DD\uC0AC\uD56D).\n -serverid ORBD\uC758 \uC11C\uBC84 ID\uB85C, \uAE30\uBCF8\uAC12\uC740 1 \uC785\uB2C8\uB2E4(\uC120\uD0DD\uC0AC\uD56D).\n -ORBInitialPort \uCD08\uAE30 \uD3EC\uD2B8\uC785\uB2C8\uB2E4(\uD544\uC218).\n -ORBInitialHost \uCD08\uAE30 HostName\uC785\uB2C8\uB2E4(\uD544\uC218).\n - -servertool.usage=\uC0AC\uC6A9\uBC95: {0} \n\n\uC5EC\uAE30\uC11C \uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n -ORBInitialPort \uCD08\uAE30 \uD3EC\uD2B8\uC785\uB2C8\uB2E4(\uD544\uC218).\n -ORBInitialHost \uCD08\uAE30 HostName\uC785\uB2C8\uB2E4(\uD544\uC218).\n -servertool.banner=\n\nJava IDL \uC11C\uBC84 \uD234 \uC2DC\uC791 \n\uD504\uB86C\uD504\uD2B8\uC5D0 \uBA85\uB839\uC744 \uC785\uB825\uD558\uC2ED\uC2DC\uC624. \n -servertool.shorthelp=\n\n\t\uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uBA85\uB839: \n\t------------------- \n -servertool.baddef=\uC798\uBABB\uB41C \uC11C\uBC84 \uC815\uC758: {0} -servertool.nosuchserver=\t\uD574\uB2F9 \uC11C\uBC84\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. -servertool.helddown=\t\uC11C\uBC84\uC758 \uC791\uB3D9\uC774 \uC911\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4. -servertool.nosuchorb=\tORB\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4. -servertool.serverup=\t\uC11C\uBC84\uAC00 \uC774\uBBF8 \uC791\uB3D9 \uC911\uC785\uB2C8\uB2E4. -servertool.appname=\tapplicationName - {0} -servertool.name=\tname - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\tserver id - {0} -servertool.servernotrunning=\t\uC11C\uBC84\uAC00 \uC2E4\uD589 \uC911\uC774 \uC544\uB2D9\uB2C8\uB2E4. -servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n -servertool.register1=\uD65C\uC131 \uAC00\uB2A5 \uC11C\uBC84 \uB4F1\uB85D -servertool.register2=\t\uC11C\uBC84\uAC00 \uB4F1\uB85D\uB418\uC5C8\uC2B5\uB2C8\uB2E4(serverid = {0}). -servertool.register3=\t\uC11C\uBC84\uAC00 \uB4F1\uB85D\uB418\uC5C8\uC9C0\uB9CC \uC791\uB3D9\uC774 \uC911\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4(serverid = {0}). -servertool.register4=\t\uC11C\uBC84\uAC00 \uC774\uBBF8 \uB4F1\uB85D\uB418\uC5C8\uC2B5\uB2C8\uB2E4(serverid = {0}). - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n -servertool.unregister1=\uB4F1\uB85D\uB41C \uC11C\uBC84\uC758 \uB4F1\uB85D \uD574\uC81C -servertool.unregister2=\t\uC11C\uBC84\uC758 \uB4F1\uB85D\uC774 \uD574\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4. - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n -servertool.locate1=\uB4F1\uB85D\uB41C \uC11C\uBC84\uC5D0 \uB300\uD55C \uD2B9\uC815 \uC720\uD615\uC758 \uD3EC\uD2B8 \uCC3E\uAE30 -servertool.locate2=\n\n\t\uD638\uC2A4\uD2B8 \uC774\uB984 {0} \n\n\t\t\uD3EC\uD2B8\t\t\uD3EC\uD2B8 \uC720\uD615\t\tORB ID\n\t\t----\t\t---------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=\uB4F1\uB85D\uB41C \uC11C\uBC84\uC5D0 \uB300\uD55C \uD2B9\uC815 ORB\uC758 \uD3EC\uD2B8 \uCC3E\uAE30 -servertool.locateorb2=\n\n\t\uD638\uC2A4\uD2B8 \uC774\uB984 {0} \n\n\t\t\uD3EC\uD2B8\t\tPortType\t\tORB ID\n\t\t----\t\t--------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ] \n -servertool.getserverid1=applicationName\uC5D0 \uB300\uD55C \uC11C\uBC84 ID \uBC18\uD658 -servertool.getserverid2=\tapplicationName {0}\uC5D0 \uB300\uD55C \uC11C\uBC84 ID\uB294 {1}\uC785\uB2C8\uB2E4. - -servertool.list=\n\t\uBAA9\uB85D\n -servertool.list1=\uB4F1\uB85D\uB41C \uC11C\uBC84 \uBAA8\uB450 \uB098\uC5F4 -servertool.list2=\n\t\uC11C\uBC84 ID\t\uC11C\uBC84 \uD074\uB798\uC2A4 \uC774\uB984\t\t\uC11C\uBC84 \uC560\uD50C\uB9AC\uCF00\uC774\uC158\n\t---------\t-----------------\t\t------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=\uD604\uC7AC \uD65C\uC131 \uC11C\uBC84 \uB098\uC5F4 -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=\uD604\uC7AC \uC815\uC758\uB41C applicationNames \uB098\uC5F4 -servertool.listappnames2=\uD604\uC7AC \uC815\uC758\uB41C \uC11C\uBC84 applicationNames: - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=\uB4F1\uB85D\uB41C \uC11C\uBC84 \uC885\uB8CC -servertool.shutdown2=\t\uC11C\uBC84\uAC00 \uC131\uACF5\uC801\uC73C\uB85C \uC885\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=\uB4F1\uB85D\uB41C \uC11C\uBC84 \uC2DC\uC791 -servertool.startserver2=\t\uC11C\uBC84\uAC00 \uC131\uACF5\uC801\uC73C\uB85C \uC2DC\uC791\uB418\uC5C8\uC2B5\uB2C8\uB2E4. - -servertool.quit=\n\tquit\n -servertool.quit1=\uC774 \uD234 \uC885\uB8CC - -servertool.help=\thelp\n\tOR\n\thelp \n -servertool.help1=\uB3C4\uC6C0\uB9D0 \uD45C\uC2DC - -servertool.orbidmap=\t\uC0AC\uC6A9\uBC95: orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=ORB \uC774\uB984\uACFC \uD574\uB2F9 \uB9E4\uD551 \uB098\uC5F4 -servertool.orbidmap2=\n\tORB ID\t\tORB \uC774\uB984\n\t------\t\t--------\n -pnameserv.success=\uC9C0\uC18D NameServer\uAC00 \uC131\uACF5\uC801\uC73C\uB85C \uC2DC\uC791\uB428 - - -bootstrap.usage=\uC0AC\uC6A9\uBC95: {0} \n\n\uC5EC\uAE30\uC11C \uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n -ORBInitialPort \uCD08\uAE30 \uD3EC\uD2B8\uC785\uB2C8\uB2E4(\uD544\uC218).\n -InitialServicesFile \uCD08\uAE30 \uC11C\uBE44\uC2A4 \uBAA9\uB85D\uC774 \uB4E4\uC5B4 \uC788\uB294 \uD30C\uC77C\uC785\uB2C8\uB2E4(\uD544\uC218).\n -bootstrap.success=\uD3EC\uD2B8\uB97C {0}(\uC73C)\uB85C \uC124\uC815\uD558\uACE0 {1}\uC5D0\uC11C \uC11C\uBE44\uC2A4\uB97C \uC77D\uB294 \uC911 -bootstrap.filenotreadable={0} \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. -bootstrap.filenotfound={0} \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. -bootstrap.exception={0} \uD30C\uC77C\uC5D0 \uC18D\uC131\uC744 \uC800\uC7A5\uD558\uB294 \uC911 \uC608\uC678\uC0AC\uD56D \uBC1C\uC0DD: {1} \uC608\uC678\uC0AC\uD56D - -tnameserv.exception={0} \uD3EC\uD2B8\uC5D0\uC11C \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uC11C\uBE44\uC2A4\uB97C \uC2DC\uC791\uD558\uB294 \uC911 \uC608\uC678\uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. -tnameserv.usage=-ORBInitialPort \uBA85\uB839\uD589 \uC778\uC218\uB85C \uB2E4\uB978 \uD3EC\uD2B8 \uC0AC\uC6A9 \uC2DC\uB3C4 -tnameserv.invalidhostoption=ORBInitialHost\uB294 NameService\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC635\uC158\uC774 \uC544\uB2D9\uB2C8\uB2E4. -tnameserv.orbinitialport0=ORBInitialPort 0\uC740 NameService\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC635\uC158\uC774 \uC544\uB2D9\uB2C8\uB2E4. -tnameserv.hs1=\uCD08\uAE30 \uC774\uB984 \uC9C0\uC815 \uCEE8\uD14D\uC2A4\uD2B8:\n{0} -tnameserv.hs2=TransientNameServer: \uCD08\uAE30 \uAC1D\uCCB4 \uCC38\uC870\uB97C \uC704\uD55C \uD3EC\uD2B8\uB97C {0}(\uC73C)\uB85C \uC124\uC815\uD558\uB294 \uC911 -tnameserv.hs3=\uC900\uBE44\uB418\uC5C8\uC2B5\uB2C8\uB2E4. - -orbd.commfailure=\nORBinitialPort\uAC00 \uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC774\uC5B4\uC11C ORBD \uC2DC\uC791\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. -orbd.internalexception=\n\uB0B4\uBD80 \uC608\uC678\uC0AC\uD56D\uC73C\uB85C \uC778\uD574 ORBD \uC2DC\uC791\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \n\uAC00\uB2A5\uD55C \uC6D0\uC778: \n1. \uC9C0\uC815\uB41C ORBInitialPort \uB610\uB294 ORBActivationPort\uAC00 \uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC785\uB2C8\uB2E4.\n2. orb.db\uB97C \uC4F8 \uC218 \uC788\uB294 \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties 2018-01-30 20:19:34.000000000 -0500 +++ /dev/null 2018-01-30 20:19:34.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 2016, 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. -# - -orbd.usage=Uso: {0} \n\nem que inclui:\n -port porta de ativa\u00E7\u00E3o na qual o ORBD deve ser iniciado, padr\u00E3o 1049 (opcional)\n -defaultdb diret\u00F3rio dos arquivos ORBD, padr\u00E3o "./orb.db" (opcional)\n -serverid id do servidor para ORBD, padr\u00E3o 1 (opcional)\n -ORBInitialPort porta inicial (obrigat\u00F3rio)\n -ORBInitialHost nome de host inicial (obrigat\u00F3rio)\n - -servertool.usage=Uso: {0} \n\nem que inclui:\n -ORBInitialPort porta inicial (obrigat\u00F3rio)\n -ORBInitialHost nome de host inicial (obrigat\u00F3rio)\n -servertool.banner=\n\nBem-vindo \u00E0 Ferramenta de Servidor IDL Java \ninsira os comandos no prompt \n -servertool.shorthelp=\n\n\tComandos Dispon\u00EDveis: \n\t------------------- \n -servertool.baddef=Defini\u00E7\u00E3o do servidor inv\u00E1lida: {0} -servertool.nosuchserver=\tservidor n\u00E3o encontrado. -servertool.helddown=\to servidor est\u00E1 em espera. -servertool.nosuchorb=\tORB inv\u00E1lido. -servertool.serverup=\to servidor j\u00E1 est\u00E1 ativo. -servertool.appname=\tapplicationName - {0} -servertool.name=\tname - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\tserver id - {0} -servertool.servernotrunning=\to servidor n\u00E3o est\u00E1 em execu\u00E7\u00E3o. -servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n -servertool.register1=registra um servidor ativ\u00E1vel -servertool.register2=\tservidor registrado (serverid = {0}). -servertool.register3=\tservidor registrado, mas em espera (serverid = {0}). -servertool.register4=\tservidor j\u00E1 registrado (serverid = {0}). - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n -servertool.unregister1=cancela o registro de um servidor registrado -servertool.unregister2=\tservidor n\u00E3o registrado. - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n -servertool.locate1=localiza portas de tipo espec\u00EDfico para um servidor registrado -servertool.locate2=\n\n\tNome do Host {0} \n\n\t\tPorta\t\tTipo de Porta\t\tId do ORB\n\t\t----\t\t---------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=localiza portas para um orb espec\u00EDfico de servidor registrado -servertool.locateorb2=\n\n\tNome do Host {0} \n\n\t\tPorta\t\tTipo de Porta\t\tId do ORB\n\t\t----\t\t--------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ] \n -servertool.getserverid1=retorna o id do servidor de um applicationName -servertool.getserverid2=\tID do Servidor de applicationName {0} \u00E9 {1} - -servertool.list=\n\tlist\n -servertool.list1=lista todos os servidores registrados -servertool.list2=\n\tId do Servidor\tNome de Classe do Servidor\t\tAplicativo do Servidor\n\t---------\t-----------------\t\t------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=lista os servidores atualmente ativos -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=lista os applicationNames atualmente definidos -servertool.listappnames2=applicationNames do servidor definidos atualmente: - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=faz shutdown de um servidor registrado -servertool.shutdown2=\tshutdown do servidor bem-sucedido. -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=inicia um servidor registrado -servertool.startserver2=\tservidor iniciado com \u00EAxito. - -servertool.quit=\n\tquit\n -servertool.quit1=sai desta ferramenta - -servertool.help=\thelp\n\tOR\n\thelp \n -servertool.help1=obt\u00E9m ajuda - -servertool.orbidmap=\tUso: orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=lista de nomes de orb e seus mapeamentos -servertool.orbidmap2=\n\tId de ORB\t\tNome de ORB\n\t------\t\t--------\n -pnameserv.success=NameServer Persistente Iniciado com \u00CAxito - - -bootstrap.usage=Uso: {0} \n\nem que inclui:\n -ORBInitialPort porta inicial (obrigat\u00F3rio)\n -InitialServicesFile arquivo que cont\u00E9m a lista de servi\u00E7os iniciais (obrigat\u00F3rio)\n -bootstrap.success=definindo porta para {0} e lendo servi\u00E7os de {1} -bootstrap.filenotreadable=o arquivo {0} n\u00E3o \u00E9 leg\u00EDvel -bootstrap.filenotfound=arquivo {0} n\u00E3o encontrado -bootstrap.exception=exce\u00E7\u00E3o capturada ao salvar as propriedades no Arquivo {0}: exce\u00E7\u00E3o {1} - -tnameserv.exception=uma exce\u00E7\u00E3o capturada ao iniciar o servi\u00E7o de inicializa\u00E7\u00E3o na porta {0} -tnameserv.usage=tente usar outra porta com os argumentos de linha de comandos -ORBInitialPort -tnameserv.invalidhostoption=ORBInitialHost n\u00E3o \u00E9 uma op\u00E7\u00E3o v\u00E1lida para NameService -tnameserv.orbinitialport0=ORBInitialPort 0 n\u00E3o \u00E9 uma op\u00E7\u00E3o v\u00E1lida para NameService -tnameserv.hs1=Contexto de Nomea\u00E7\u00E3o Inicial:\n{0} -tnameserv.hs2=TransientNameServer: definindo porta para as refer\u00EAncias de objeto iniciais: {0} -tnameserv.hs3=Pronto. - -orbd.commfailure=\nFalha ao iniciar ORBD porque ORBinitialPort j\u00E1 est\u00E1 em uso -orbd.internalexception=\nFalha ao iniciar ORBD devido a uma exce\u00E7\u00E3o interna. \nPoss\u00EDveis causas: \n1. ORBInitialPort especificado ou ORBActivationPort j\u00E1 em uso \n2. Sem permiss\u00E3o de grava\u00E7\u00E3o para gravar orb.db - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties 2018-01-30 20:19:35.000000000 -0500 +++ /dev/null 2018-01-30 20:19:35.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 2016, 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. -# - -orbd.usage=Syntax: {0} \n\nd\u00E4r inkluderar:\n -port Aktiveringsport d\u00E4r ORBD ska startas, standard 1049 (valfritt)\n -defaultdb Katalog f\u00F6r ORBD-filer, standard "./orb.db" (valfritt)\n -serverid Server-id f\u00F6r ORBD, standard 1 (valfritt)\n -ORBInitialPort Ursprunglig port (obligatoriskt)\n -ORBInitialHost Ursprungligt v\u00E4rdnamn (obligatoriskt)\n - -servertool.usage=Syntax: {0} \n\nd\u00E4r inkluderar:\n -ORBInitialPort Ursprunglig port (obligatoriskt)\n -ORBInitialHost Ursprungligt v\u00E4rdnamn (obligatoriskt)\n -servertool.banner=\n\nV\u00E4lkommen till Java IDL Server Tool \nange kommandona vid kommandoraden \n -servertool.shorthelp=\n\n\tTillg\u00E4ngliga kommandon: \n\t------------------- \n -servertool.baddef=Felaktig serverdefinition: {0} -servertool.nosuchserver=\tn\u00E5gon s\u00E5dan server kan inte hittas. -servertool.helddown=\tservern h\u00E5lls avst\u00E4ngd. -servertool.nosuchorb=\togiltig ORB. -servertool.serverup=\tserver \u00E4r redan startad -servertool.appname=\tapplicationName - {0} -servertool.name=\tnamn - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\tserver id - {0} -servertool.servernotrunning=\tserver k\u00F6rs inte. -servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n -servertool.register1=registrera en aktiverbar server -servertool.register2=\tserver registrerad (serverid = {0}). -servertool.register3=\tserver registrerad men h\u00E5lls avst\u00E4ngd(serverid = {0}). -servertool.register4=\tserver har redan registrerats (serverid = {0}). - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n -servertool.unregister1=avregistrera en registrerad server -servertool.unregister2=\tserver avregistrerad. - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n -servertool.locate1=hitta portar av en viss typ f\u00F6r en registrerad server -servertool.locate2=\n\n\tV\u00E4rdnamn {0} \n\n\t\tPort\t\tPorttyp\t\tORB-id\n\t\t----\t\t---------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=hitta portar f\u00F6r en viss ORB f\u00F6r en registrerad server -servertool.locateorb2=\n\n\tV\u00E4rdnamn {0} \n\n\t\tPort\t\tPorttyp\t\tORB-id\n\t\t----\t\t--------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ] \n -servertool.getserverid1=returnerar server-id f\u00F6r ett applicationName -servertool.getserverid2=\tServer-id f\u00F6r applicationName {0} \u00E4r {1} - -servertool.list=\n\tlist_\n -servertool.list1=listar alla registrerade servrar -servertool.list2=\n\tServer-id\tServerklassnamn\t\tServerapplikation\n\t---------\t-----------------\t\t------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=listar alla f\u00F6r tillf\u00E4llet aktiva servrar -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=listar de applicationNames som f\u00F6r tillf\u00E4llet \u00E4r definierade -servertool.listappnames2=Definierade applikationsnamn f\u00F6r servern: - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=st\u00E4nger av en registrerad server -servertool.shutdown2=\tserver har st\u00E4ngts av. -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=startar en registrerad server -servertool.startserver2=\tserver har startats. - -servertool.quit=\n\tquit\n -servertool.quit1=avsluta det h\u00E4r verktyget - -servertool.help=\thelp\n\tELLER\n\thelp \n -servertool.help1=f\u00E5 hj\u00E4lp - -servertool.orbidmap=\tSyntax: orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=lista \u00F6ver ORB-namn och deras mappning -servertool.orbidmap2=\n\tORB-id\t\tORB-namn\n\t------\t\t--------\n -pnameserv.success=Den best\u00E4ndiga namnservern har startats - - -bootstrap.usage=Syntax: {0} \n\nd\u00E4r inkluderar:\n -ORBInitialPort Ursprunglig port (obligatoriskt)\n -InitialServicesFile En fil som inneh\u00E5ller en lista \u00F6ver ursprungliga tj\u00E4nster (obligatoriskt)\n -bootstrap.success=st\u00E4ller in porten till {0} och l\u00E4ser tj\u00E4nster fr\u00E5n {1} -bootstrap.filenotreadable=filen {0} kan inte l\u00E4sas -bootstrap.filenotfound=filen {0} hittas inte -bootstrap.exception=p\u00E5tr\u00E4ffade undantag medan egenskaper sparades i filen {0}: Undantag {1} - -tnameserv.exception=p\u00E5tr\u00E4ffade ett undantag n\u00E4r starttj\u00E4nsten startades vid porten {0} -tnameserv.usage=f\u00F6rs\u00F6k att anv\u00E4nda en annan port med kommandoradsargument -ORBInitialPort -tnameserv.invalidhostoption=ORBInitialHost \u00E4r inte ett giltigt alternativ f\u00F6r NameService -tnameserv.orbinitialport0=ORBInitialPort 0 \u00E4r inte ett giltigt alternativ f\u00F6r NameService -tnameserv.hs1=Ursprunglig namngivningskontext:\n{0} -tnameserv.hs2=TransientNameServer: st\u00E4ller in port f\u00F6r ursprungliga objektreferenser till: {0} -tnameserv.hs3=Klar. - -orbd.commfailure=\nKunde inte starta ORBD eftersom ORBinitialport redan anv\u00E4nds -orbd.internalexception=\nKunde inte starta ORBD p\u00E5 grund av internt undantag. \nM\u00F6jliga orsaker: \n1. Angivet ORBInitialPort eller ORBActivationPort anv\u00E4ndas redan \n2. Ingen beh\u00F6righet att skriva till orb.db - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties 2018-01-30 20:19:35.000000000 -0500 +++ /dev/null 2018-01-30 20:19:35.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 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. -# - -orbd.usage=\u7528\u6CD5: {0} <\u9009\u9879> \n\n\u5176\u4E2D, <\u9009\u9879> \u5305\u62EC: \n -port \u6FC0\u6D3B\u542F\u52A8 ORBD \u7684\u7AEF\u53E3, \u9ED8\u8BA4\u503C\u4E3A 1049 (\u53EF\u9009)\n -defaultdb ORBD \u6587\u4EF6\u7684\u76EE\u5F55, \u9ED8\u8BA4\u503C\u4E3A "./orb.db" (\u53EF\u9009)\n -serverid ORBD \u7684\u670D\u52A1\u5668 ID, \u9ED8\u8BA4\u503C\u4E3A 1 (\u53EF\u9009)\n -ORBInitialPort \u521D\u59CB\u7AEF\u53E3 (\u5FC5\u9700)\n -ORBInitialHost \u521D\u59CB HostName (\u5FC5\u9700)\n - -servertool.usage=\u7528\u6CD5: {0} <\u9009\u9879> \n\n\u5176\u4E2D, <\u9009\u9879> \u5305\u62EC: \n -ORBInitialPort \u521D\u59CB\u7AEF\u53E3 (\u5FC5\u9700)\n -ORBInitialHost \u521D\u59CB HostName (\u5FC5\u9700)\n -servertool.banner=\n\n\u6B22\u8FCE\u4F7F\u7528 Java IDL \u670D\u52A1\u5668\u5DE5\u5177 \n\u8BF7\u5728\u63D0\u793A\u5904\u8F93\u5165\u547D\u4EE4 \n -servertool.shorthelp=\n\n\t\u53EF\u7528\u547D\u4EE4: \n\t------------------- \n -servertool.baddef=\u9519\u8BEF\u7684\u670D\u52A1\u5668\u5B9A\u4E49: {0} -servertool.nosuchserver=\t\u627E\u4E0D\u5230\u8FD9\u79CD\u670D\u52A1\u5668\u3002 -servertool.helddown=\t\u670D\u52A1\u5668\u5DF2\u88AB\u5173\u95ED\u3002 -servertool.nosuchorb=\t\u65E0\u6548\u7684\u5BF9\u8C61\u8BF7\u6C42\u4EE3\u7406\u7A0B\u5E8F (ORB)\u3002 -servertool.serverup=\t\u670D\u52A1\u5668\u5DF2\u5728\u8FD0\u884C\u3002 -servertool.appname=\tapplicationName - {0} -servertool.name=\tname - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\t\u670D\u52A1\u5668 ID - {0} -servertool.servernotrunning=\t\u670D\u52A1\u5668\u6CA1\u6709\u8FD0\u884C\u3002 -servertool.register=\n\n\tregister -server<\u670D\u52A1\u5668\u7C7B\u540D\u79F0> \n\t -applicationName <\u5907\u7528\u670D\u52A1\u5668\u540D\u79F0> \n\t -classpath <\u670D\u52A1\u5668\u7684\u7C7B\u8DEF\u5F84> \n\t -args <\u670D\u52A1\u5668\u7684\u53C2\u6570> \n\t -vmargs <\u670D\u52A1\u5668 Java VM \u7684\u53C2\u6570>\n -servertool.register1=\u6CE8\u518C\u4E00\u4E2A\u53EF\u6FC0\u6D3B\u7684\u670D\u52A1\u5668 -servertool.register2=\t\u5DF2\u6CE8\u518C\u670D\u52A1\u5668 (serverid = {0})\u3002 -servertool.register3=\t\u5DF2\u6CE8\u518C\u670D\u52A1\u5668, \u4F46\u5DF2\u88AB\u5173\u95ED (serverid = {0})\u3002 -servertool.register4=\t\u670D\u52A1\u5668\u5DF2\u6CE8\u518C (serverid = {0})\u3002 - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n -servertool.unregister1=\u6CE8\u9500\u5DF2\u6CE8\u518C\u7684\u670D\u52A1\u5668 -servertool.unregister2=\t\u670D\u52A1\u5668\u5DF2\u6CE8\u9500\u3002 - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n -servertool.locate1=\u4E3A\u5DF2\u6CE8\u518C\u670D\u52A1\u5668\u5B9A\u4F4D\u7279\u5B9A\u7C7B\u578B\u7684\u7AEF\u53E3 -servertool.locate2=\n\n\t\u4E3B\u673A\u540D\u79F0 {0} \n\n\t\t\u7AEF\u53E3\t\t\u7AEF\u53E3\u7C7B\u578B\t\tORB \u6807\u8BC6\n\t\t----\t\t---------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=\u4E3A\u5DF2\u6CE8\u518C\u670D\u52A1\u5668\u7684\u7279\u5B9A\u5BF9\u8C61\u8BF7\u6C42\u4EE3\u7406\u7A0B\u5E8F\u5B9A\u4F4D\u7AEF\u53E3\u3002 -servertool.locateorb2=\n\n\t\u4E3B\u673A\u540D\u79F0 {0} \n\n\t\t\u7AEF\u53E3\t\t\u7AEF\u53E3\u7C7B\u578B\t\tORB \u6807\u8BC6\n\t\t----\t\t--------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ] \n -servertool.getserverid1=\u8FD4\u56DE applicationName \u7684\u670D\u52A1\u5668 ID -servertool.getserverid2=\tapplicationName {0} \u7684\u670D\u52A1\u5668 ID \u662F {1} - -servertool.list=\n\t\u5217\u8868\n -servertool.list1=\u5217\u51FA\u6240\u6709\u5DF2\u6CE8\u518C\u670D\u52A1\u5668 -servertool.list2=\n\t\u670D\u52A1\u5668 ID\t\u670D\u52A1\u5668\u7C7B\u540D\u79F0\t\t\u670D\u52A1\u5668\u5E94\u7528\u7A0B\u5E8F\n\t---------\t-----------------\t\t------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=\u5217\u51FA\u5F53\u524D\u6D3B\u52A8\u7684\u670D\u52A1\u5668 -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=\u5217\u51FA\u5F53\u524D\u5B9A\u4E49\u7684 applicationName -servertool.listappnames2=\u5F53\u524D\u5B9A\u4E49\u7684\u670D\u52A1\u5668 applicationName: - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=\u5173\u95ED\u4E00\u4E2A\u5DF2\u6CE8\u518C\u670D\u52A1\u5668 -servertool.shutdown2=\t\u670D\u52A1\u5668\u6210\u529F\u5173\u95ED\u3002 -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=\u542F\u52A8\u4E00\u4E2A\u5DF2\u6CE8\u518C\u670D\u52A1\u5668 -servertool.startserver2=\t\u670D\u52A1\u5668\u6210\u529F\u542F\u52A8\u3002 - -servertool.quit=\n\t\u9000\u51FA\n -servertool.quit1=\u9000\u51FA\u6B64\u5DE5\u5177 - -servertool.help=\thelp\n\t\u6216\n\thelp \n -servertool.help1=\u83B7\u53D6\u5E2E\u52A9 - -servertool.orbidmap=\t\u7528\u6CD5: orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=\u5BF9\u8C61\u8BF7\u6C42\u4EE3\u7406\u7A0B\u5E8F (orb) \u540D\u79F0\u53CA\u5176\u6620\u5C04\u5217\u8868 -servertool.orbidmap2=\n\tORB \u6807\u8BC6\t\tORB \u540D\u79F0\n\t------\t\t--------\n -pnameserv.success=\u6301\u4E45\u6027\u540D\u79F0\u670D\u52A1\u5668\u6210\u529F\u542F\u52A8 - - -bootstrap.usage=\u7528\u6CD5: {0} <\u9009\u9879> \n\n\u5176\u4E2D, <\u9009\u9879> \u5305\u62EC: \n -ORBInitialPort \u521D\u59CB\u7AEF\u53E3 (\u5FC5\u9700)\n -InitialServicesFile \u5305\u542B\u521D\u59CB\u670D\u52A1\u5217\u8868\u7684\u6587\u4EF6 (\u5FC5\u9700)\n -bootstrap.success=\u5C06\u7AEF\u53E3\u8BBE\u7F6E\u4E3A{0}\u5E76\u4ECE{1}\u8BFB\u53D6\u670D\u52A1 -bootstrap.filenotreadable=\u6587\u4EF6{0}\u4E0D\u53EF\u8BFB\u53D6 -bootstrap.filenotfound=\u6CA1\u6709\u627E\u5230\u6587\u4EF6{0} -bootstrap.exception=\u5C06\u5C5E\u6027\u4FDD\u5B58\u5230\u6587\u4EF6{0}\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF: \u5F02\u5E38\u9519\u8BEF{1} - -tnameserv.exception=\u542F\u52A8{0}\u7AEF\u53E3\u4E0A\u7684\u5F15\u5BFC\u7A0B\u5E8F\u670D\u52A1\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF -tnameserv.usage=\u5C1D\u8BD5\u5229\u7528\u547D\u4EE4\u884C\u53C2\u6570 -ORBInitialPort \u4F7F\u7528\u4E0D\u540C\u7684\u7AEF\u53E3 -tnameserv.invalidhostoption=ORBInitialHost \u4E0D\u662F NameService \u7684\u6709\u6548\u9009\u9879 -tnameserv.orbinitialport0=ORBInitialPort 0 \u4E0D\u662F NameService \u7684\u6709\u6548\u9009\u9879 -tnameserv.hs1=\u521D\u59CB\u7684\u547D\u540D\u4E0A\u4E0B\u6587: \n{0} -tnameserv.hs2=TransientNameServer: \u5C06\u521D\u59CB\u5BF9\u8C61\u5F15\u7528\u7AEF\u53E3\u8BBE\u7F6E\u4E3A: {0} -tnameserv.hs3=\u51C6\u5907\u5C31\u7EEA\u3002 - -orbd.commfailure=\n\u7531\u4E8E ORBinitialPort \u5DF2\u5728\u4F7F\u7528\u4E2D, \u65E0\u6CD5\u542F\u52A8 ORBD -orbd.internalexception=\n\u7531\u4E8E\u5185\u90E8\u5F02\u5E38\u9519\u8BEF, \u65E0\u6CD5\u542F\u52A8 ORBD\u3002\n\u53EF\u80FD\u539F\u56E0: \n1. \u6307\u5B9A\u7684 ORBInitialPort \u6216 ORBActivationPort \u5DF2\u5728\u4F7F\u7528\u4E2D \n2. \u6CA1\u6709\u5199\u5165 orb.db \u7684\u6743\u9650 - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties 2018-01-30 20:19:36.000000000 -0500 +++ /dev/null 2018-01-30 20:19:36.000000000 -0500 @@ -1,107 +0,0 @@ -# -# Copyright (c) 2000, 2016, 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. -# - -orbd.usage=\u7528\u6CD5: {0} \n\n\u5176\u4E2D \u5305\u62EC: \n -port ORBD \u61C9\u88AB\u555F\u52D5\u7684\u555F\u52D5\u9023\u63A5\u57E0\u6240\u5728\uFF0C\u9810\u8A2D\u70BA 1049 (\u53EF\u9078)\n -defaultdb ORBD \u6A94\u6848\u7684\u76EE\u9304\uFF0C\u9810\u8A2D "./orb.db" (\u53EF\u9078)\n -serverid ORBD \u4F3A\u670D\u5668 Id\uFF0C\u9810\u8A2D\u70BA 1 (\u53EF\u9078)\n -ORBInitialPort \u8D77\u59CB\u9023\u63A5\u57E0 (\u5FC5\u8981)\n -ORBInitialHost \u8D77\u59CB\u4E3B\u6A5F\u540D\u7A31 (\u5FC5\u8981)\n - -servertool.usage=\u7528\u6CD5: {0} \n\nwhere \u5305\u62EC:\n -ORBInitialPort \u8D77\u59CB\u9023\u63A5\u57E0 (\u5FC5\u8981)\n -ORBInitialHost \u8D77\u59CB\u4E3B\u6A5F\u540D\u7A31 (\u5FC5\u8981)\n -servertool.banner=\n\n\u6B61\u8FCE\u4F7F\u7528 Java IDL \u4F3A\u670D\u5668\u5DE5\u5177 \n\u8ACB\u5728\u63D0\u793A\u8655\u8F38\u5165\u547D\u4EE4 \n -servertool.shorthelp=\n\n\t\u53EF\u7528\u7684\u547D\u4EE4: \n\t------------------- \n -servertool.baddef=\u932F\u8AA4\u7684\u4F3A\u670D\u5668\u5B9A\u7FA9: {0} -servertool.nosuchserver=\t\u627E\u4E0D\u5230\u9019\u500B\u4F3A\u670D\u5668\u3002 -servertool.helddown=\t\u4F3A\u670D\u5668\u4E0D\u5728\u5DE5\u4F5C\u72C0\u614B\u3002 -servertool.nosuchorb=\t\u7121\u6548\u7684 ORB. -servertool.serverup=\t\u4F3A\u670D\u5668\u5DF2\u5728\u5DE5\u4F5C\u72C0\u614B\u3002 -servertool.appname=\tapplicationName - {0} -servertool.name=\tname - {0} -servertool.classpath=\tclasspath - {0} -servertool.args=\targs - {0} -servertool.vmargs=\tvmargs - {0} -servertool.serverid=\tserver id - {0} -servertool.servernotrunning=\t\u4F3A\u670D\u5668\u672A\u57F7\u884C\u3002 -servertool.register=\n\n\tregister -server \n\t -applicationName \n\t -classpath \n\t -args \n\t -vmargs \n -servertool.register1=\u8A3B\u518A\u4E00\u500B\u53EF\u555F\u52D5\u7684\u4F3A\u670D\u5668 -servertool.register2=\t\u5DF2\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668 (serverid = {0})\u3002 -servertool.register3=\t\u5DF2\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668\uFF0C\u4F46\u4E0D\u5728\u5DE5\u4F5C\u72C0\u614B (serverid = {0})\u3002 -servertool.register4=\t\u4F3A\u670D\u5668\u5DF2\u8A3B\u518A (serverid = {0})\u3002 - -servertool.unregister=\n\tunregister [ -serverid | -applicationName ] \n -servertool.unregister1=\u5C07\u5DF2\u8A3B\u518A\u7684\u4F3A\u670D\u5668\u53D6\u6D88\u8A3B\u518A -servertool.unregister2=\t\u4F3A\u670D\u5668\u5DF2\u53D6\u6D88\u8A3B\u518A\u3002 - -servertool.locate=\n\tlocate [ -serverid | -applicationName ] [ <-endpointType ] \n -servertool.locate1=\u91DD\u5C0D\u4E00\u500B\u5DF2\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668\u5C0B\u627E\u7279\u5B9A\u985E\u578B\u7684\u9023\u63A5\u57E0 -servertool.locate2=\n\n\t\u4E3B\u6A5F\u540D\u7A31 {0} \n\n\t\t\u9023\u63A5\u57E0\t\t\u9023\u63A5\u57E0\u985E\u578B\t\tORB Id\n\t\t----\t\t---------\t\t------\n -servertool.locateorb=\n\tlocateperorb [ -serverid | -applicationName ] [ -orbid ]\n -servertool.locateorb1=\u91DD\u5C0D\u5DF2\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668\u7684\u7279\u5B9A orb \u5C0B\u627E\u9023\u63A5\u57E0\u3002 -servertool.locateorb2=\n\n\t\u4E3B\u6A5F\u540D\u7A31 {0} \n\n\t\t\u9023\u63A5\u57E0\t\t\u9023\u63A5\u57E0\u985E\u578B\t\tORB Id\n\t\t----\t\t--------\t\t------\n -servertool.getserverid=\n\tgetserverid [ -applicationName ] \n -servertool.getserverid1=\u50B3\u56DE applicationName \u7684\u4F3A\u670D\u5668\u8B58\u5225\u78BC -servertool.getserverid2=\tapplicationName \u7684\u4F3A\u670D\u5668\u8B58\u5225\u78BC {0} \u70BA {1} - -servertool.list=\n\tlist\n -servertool.list1=\u5217\u51FA\u6240\u6709\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668 -servertool.list2=\n\t\u4F3A\u670D\u5668\u8B58\u5225\u78BC\t\u4F3A\u670D\u5668\u985E\u5225\u540D\u7A31\t\t\u4F3A\u670D\u5668\u61C9\u7528\u7A0B\u5F0F\n\t---------\t-----------------\t\t------------------\n -servertool.listactive=\n\tlistactive -servertool.listactive1=\u5217\u51FA\u76EE\u524D\u4F7F\u7528\u4E2D\u7684\u4F3A\u670D\u5668 -servertool.listappnames=\tlistappnames\n -servertool.listappnames1=\u5217\u51FA\u76EE\u524D\u5B9A\u7FA9\u7684 applicationNames -servertool.listappnames2=\u76EE\u524D\u5B9A\u7FA9\u7684\u4F3A\u670D\u5668 applicationNames: - -servertool.shutdown=\n\tshutdown [ -serverid | -applicationName ]\n -servertool.shutdown1=\u95DC\u9589\u4E00\u500B\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668 -servertool.shutdown2=\t\u4F3A\u670D\u5668\u95DC\u9589\u6210\u529F\u3002 -servertool.startserver=\n\tstartup [ -serverid | -applicationName ]\n -servertool.startserver1=\u555F\u52D5\u4E00\u500B\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668 -servertool.startserver2=\t\u4F3A\u670D\u5668\u555F\u52D5\u6210\u529F\u3002 - -servertool.quit=\n\tquit\n -servertool.quit1=\u96E2\u958B\u9019\u500B\u5DE5\u5177 - -servertool.help=\thelp\n\t\u6216\n\thelp \n -servertool.help1=\u53D6\u5F97\u8AAA\u660E - -servertool.orbidmap=\t\u7528\u6CD5: orblist [ -serverid | -applicationName ]\n -servertool.orbidmap1=orb \u540D\u7A31\u53CA\u5176\u5C0D\u6620\u6E05\u55AE -servertool.orbidmap2=\n\tORB Id\t\tORB \u540D\u7A31\n\t------\t\t--------\n -pnameserv.success=\u6C38\u4E45\u6027 NameServer \u555F\u52D5\u6210\u529F - - -bootstrap.usage=\u7528\u6CD5: {0} \n\n\u5176\u4E2D \u5305\u62EC: \n -ORBInitialPort \u8D77\u59CB\u9023\u63A5\u57E0 (\u5FC5\u8981)\n -InitialServicesFile \u542B\u6709\u8D77\u59CB\u670D\u52D9\u6E05\u55AE\u7684\u6A94\u6848 (\u5FC5\u8981)\n -bootstrap.success=\u8A2D\u5B9A\u9023\u63A5\u57E0\u81F3 {0} \u4E26\u5F9E {1} \u8B80\u53D6\u670D\u52D9 -bootstrap.filenotreadable=\u6A94\u6848 {0} \u7121\u6CD5\u8B80\u53D6 -bootstrap.filenotfound=\u627E\u4E0D\u5230\u6A94\u6848 {0} -bootstrap.exception=\u5C07\u5C6C\u6027\u5132\u5B58\u81F3\u6A94\u6848 {0} \u6642\u767C\u751F\u7570\u5E38\u72C0\u6CC1: \u7570\u5E38\u72C0\u6CC1 {1} - -tnameserv.exception=\u958B\u555F {0} \u9023\u63A5\u57E0\u4E0A\u7684\u555F\u52D5\u5B89\u88DD\u670D\u52D9\u6642\uFF0C\u767C\u751F\u7570\u5E38\u72C0\u6CC1 -tnameserv.usage=\u5617\u8A66\u4EE5\u547D\u4EE4\u884C\u5F15\u6578\u4F86\u4F7F\u7528\u4E0D\u540C\u9023\u63A5\u57E0 -ORBInitialPort -tnameserv.invalidhostoption=ORBInitialHost \u4E0D\u662F NameService \u7684\u6709\u6548\u9078\u9805 -tnameserv.orbinitialport0=ORBInitialPort 0 \u4E0D\u662F NameService \u7684\u6709\u6548\u9078\u9805 -tnameserv.hs1=\u8D77\u59CB\u547D\u540D\u76F8\u95DC\u8CC7\u8A0A\u74B0\u5883: \n{0} -tnameserv.hs2=TransientNameServer: \u91DD\u5C0D\u8D77\u59CB\u7269\u4EF6\u53C3\u7167\uFF0C\u8A2D\u5B9A\u9023\u63A5\u57E0\u81F3: {0} -tnameserv.hs3=\u5C31\u7DD2\u3002 - -orbd.commfailure=\n\u56E0\u70BA ORBinitialPort \u5728\u4F7F\u7528\u4E2D\uFF0C\u6240\u4EE5\u7121\u6CD5\u555F\u52D5 ORBD\u3002 -orbd.internalexception=\n\u56E0\u70BA\u5167\u90E8\u767C\u751F\u7570\u5E38\uFF0C\u6240\u4EE5\u7121\u6CD5\u555F\u52D5 ORBD\u3002\n\u53EF\u80FD\u7684\u539F\u56E0: \n1. \u6307\u5B9A\u7684 ORBInitialPort \u6216 ORBActivationPort \u5728\u4F7F\u7528\u4E2D\u3002\n2. \u6C92\u6709\u5BEB\u5165 orb.db \u7684\u6B0A\u9650\u3002 - --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolImpl.java 2018-01-30 20:19:36.000000000 -0500 +++ /dev/null 2018-01-30 20:19:37.000000000 -0500 @@ -1,547 +0,0 @@ -/* - * Copyright (c) 2003, 2015, 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.corba.se.impl.orbutil.threadpool; - -import java.io.IOException; -import java.io.Closeable; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -import java.util.List; -import java.util.ArrayList; - -import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicLong; - -import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException; -import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool; -import com.sun.corba.se.spi.orbutil.threadpool.Work; -import com.sun.corba.se.spi.orbutil.threadpool.WorkQueue; - -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.threadpool.WorkQueueImpl; - -import com.sun.corba.se.spi.monitoring.MonitoringConstants; -import com.sun.corba.se.spi.monitoring.MonitoredObject; -import com.sun.corba.se.spi.monitoring.MonitoringFactories; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -public class ThreadPoolImpl implements ThreadPool -{ - // serial counter useful for debugging - private static AtomicInteger threadCounter = new AtomicInteger(0); - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.get(CORBALogDomains.RPC_TRANSPORT); - - - // Any time currentThreadCount and/or availableWorkerThreads is updated - // or accessed this ThreadPool's WorkQueue must be locked. And, it is - // expected that this ThreadPool's WorkQueue is the only object that - // updates and accesses these values directly and indirectly though a - // call to a method in this ThreadPool. If any call to update or access - // those values must synchronized on this ThreadPool's WorkQueue. - private WorkQueue workQueue; - - // Stores the number of available worker threads - private int availableWorkerThreads = 0; - - // Stores the number of threads in the threadpool currently - private int currentThreadCount = 0; - - // Minimum number of worker threads created at instantiation of the threadpool - private int minWorkerThreads = 0; - - // Maximum number of worker threads in the threadpool - private int maxWorkerThreads = 0; - - // Inactivity timeout value for worker threads to exit and stop running - private long inactivityTimeout; - - // Indicates if the threadpool is bounded or unbounded - private boolean boundedThreadPool = false; - - // Running count of the work items processed - // Set the value to 1 so that divide by zero is avoided in - // averageWorkCompletionTime() - private AtomicLong processedCount = new AtomicLong(1); - - // Running aggregate of the time taken in millis to execute work items - // processed by the threads in the threadpool - private AtomicLong totalTimeTaken = new AtomicLong(0); - - // Name of the ThreadPool - private String name; - - // MonitoredObject for ThreadPool - private MonitoredObject threadpoolMonitoredObject; - - // ThreadGroup in which threads should be created - private ThreadGroup threadGroup; - - Object workersLock = new Object(); - List workers = new ArrayList<>(); - - /** - * This constructor is used to create an unbounded threadpool - */ - public ThreadPoolImpl(ThreadGroup tg, String threadpoolName) { - inactivityTimeout = ORBConstants.DEFAULT_INACTIVITY_TIMEOUT; - maxWorkerThreads = Integer.MAX_VALUE; - workQueue = new WorkQueueImpl(this); - threadGroup = tg; - name = threadpoolName; - initializeMonitoring(); - } - - /** - * This constructor is used to create an unbounded threadpool - * in the ThreadGroup of the current thread - */ - public ThreadPoolImpl(String threadpoolName) { - this( Thread.currentThread().getThreadGroup(), threadpoolName ) ; - } - - /** - * This constructor is used to create bounded threadpool - */ - public ThreadPoolImpl(int minSize, int maxSize, long timeout, - String threadpoolName) - { - minWorkerThreads = minSize; - maxWorkerThreads = maxSize; - inactivityTimeout = timeout; - boundedThreadPool = true; - workQueue = new WorkQueueImpl(this); - name = threadpoolName; - for (int i = 0; i < minWorkerThreads; i++) { - createWorkerThread(); - } - initializeMonitoring(); - } - - // Note that this method should not return until AFTER all threads have died. - public void close() throws IOException { - - // Copy to avoid concurrent modification problems. - List copy = null; - synchronized (workersLock) { - copy = new ArrayList<>(workers); - } - - for (WorkerThread wt : copy) { - wt.close(); - while (wt.getState() != Thread.State.TERMINATED) { - try { - wt.join(); - } catch (InterruptedException exc) { - wrapper.interruptedJoinCallWhileClosingThreadPool(exc, wt, this); - } - } - } - - threadGroup = null; - } - - - // Setup monitoring for this threadpool - private void initializeMonitoring() { - // Get root monitored object - MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory(). - createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null). - getRootMonitoredObject(); - - // Create the threadpool monitoring root - MonitoredObject threadPoolMonitoringObjectRoot = root.getChild( - MonitoringConstants.THREADPOOL_MONITORING_ROOT); - if (threadPoolMonitoringObjectRoot == null) { - threadPoolMonitoringObjectRoot = MonitoringFactories. - getMonitoredObjectFactory().createMonitoredObject( - MonitoringConstants.THREADPOOL_MONITORING_ROOT, - MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION); - root.addChild(threadPoolMonitoringObjectRoot); - } - threadpoolMonitoredObject = MonitoringFactories. - getMonitoredObjectFactory(). - createMonitoredObject(name, - MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION); - - threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject); - - LongMonitoredAttributeBase b1 = new - LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS, - MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) { - public Object getValue() { - return new Long(ThreadPoolImpl.this.currentNumberOfThreads()); - } - }; - threadpoolMonitoredObject.addAttribute(b1); - LongMonitoredAttributeBase b2 = new - LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS, - MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) { - public Object getValue() { - return new Long(ThreadPoolImpl.this.numberOfAvailableThreads()); - } - }; - threadpoolMonitoredObject.addAttribute(b2); - LongMonitoredAttributeBase b3 = new - LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS, - MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) { - public Object getValue() { - return new Long(ThreadPoolImpl.this.numberOfBusyThreads()); - } - }; - threadpoolMonitoredObject.addAttribute(b3); - LongMonitoredAttributeBase b4 = new - LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME, - MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) { - public Object getValue() { - return new Long(ThreadPoolImpl.this.averageWorkCompletionTime()); - } - }; - threadpoolMonitoredObject.addAttribute(b4); - LongMonitoredAttributeBase b5 = new - LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT, - MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) { - public Object getValue() { - return new Long(ThreadPoolImpl.this.currentProcessedCount()); - } - }; - threadpoolMonitoredObject.addAttribute(b5); - - // Add the monitored object for the WorkQueue - - threadpoolMonitoredObject.addChild( - ((WorkQueueImpl)workQueue).getMonitoredObject()); - } - - // Package private method to get the monitored object for this - // class - MonitoredObject getMonitoredObject() { - return threadpoolMonitoredObject; - } - - public WorkQueue getAnyWorkQueue() - { - return workQueue; - } - - public WorkQueue getWorkQueue(int queueId) - throws NoSuchWorkQueueException - { - if (queueId != 0) - throw new NoSuchWorkQueueException(); - return workQueue; - } - - /** - * To be called from the workqueue when work is added to the - * workQueue. This method would create new threads if required - * or notify waiting threads on the queue for available work - */ - void notifyForAvailableWork(WorkQueue aWorkQueue) { - synchronized (aWorkQueue) { - if (availableWorkerThreads < aWorkQueue.workItemsInQueue()) { - createWorkerThread(); - } else { - aWorkQueue.notify(); - } - } - } - - - private Thread createWorkerThreadHelper( String name ) { - // Thread creation needs to be in a doPrivileged block - // if there is a non-null security manager for two reasons: - // 1. The creation of a thread in a specific ThreadGroup - // is a privileged operation. Lack of a doPrivileged - // block here causes an AccessControlException - // (see bug 6268145). - // 2. We want to make sure that the permissions associated - // with this thread do NOT include the permissions of - // the current thread that is calling this method. - // This leads to problems in the app server where - // some threads in the ThreadPool randomly get - // bad permissions, leading to unpredictable - // permission errors (see bug 6021011). - // - // A Java thread contains a stack of call frames, - // one for each method called that has not yet returned. - // Each method comes from a particular class. The class - // was loaded by a ClassLoader which has an associated - // CodeSource, and this determines the Permissions - // for all methods in that class. The current - // Permissions for the thread are the intersection of - // all Permissions for the methods on the stack. - // This is part of the Security Context of the thread. - // - // When a thread creates a new thread, the new thread - // inherits the security context of the old thread. - // This is bad in a ThreadPool, because different - // creators of threads may have different security contexts. - // This leads to occasional unpredictable errors when - // a thread is re-used in a different security context. - // - // Avoiding this problem is simple: just do the thread - // creation in a doPrivileged block. This sets the - // inherited security context to that of the code source - // for the ORB code itself, which contains all permissions - // in either Java SE or Java EE. - WorkerThread thread = new WorkerThread(threadGroup, name); - synchronized (workersLock) { - workers.add(thread); - } - - // The thread must be set to a daemon thread so the - // VM can exit if the only threads left are PooledThreads - // or other daemons. We don't want to rely on the - // calling thread always being a daemon. - // Note that no exception is possible here since we - // are inside the doPrivileged block. - thread.setDaemon(true); - - wrapper.workerThreadCreated(thread, thread.getContextClassLoader()); - - thread.start(); - return null; - } - - - /** - * To be called from the workqueue to create worker threads when none - * available. - */ - void createWorkerThread() { - final String name = getName(); - synchronized (workQueue) { - try { - if (System.getSecurityManager() == null) { - createWorkerThreadHelper(name); - } else { - // If we get here, we need to create a thread. - AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return createWorkerThreadHelper(name); - } - } - ); - } - } catch (Throwable t) { - // Decrementing the count of current worker threads. - // But, it will be increased in the finally block. - decrementCurrentNumberOfThreads(); - wrapper.workerThreadCreationFailure(t); - } finally { - incrementCurrentNumberOfThreads(); - } - } - } - - public int minimumNumberOfThreads() { - return minWorkerThreads; - } - - public int maximumNumberOfThreads() { - return maxWorkerThreads; - } - - public long idleTimeoutForThreads() { - return inactivityTimeout; - } - - public int currentNumberOfThreads() { - synchronized (workQueue) { - return currentThreadCount; - } - } - - void decrementCurrentNumberOfThreads() { - synchronized (workQueue) { - currentThreadCount--; - } - } - - void incrementCurrentNumberOfThreads() { - synchronized (workQueue) { - currentThreadCount++; - } - } - - public int numberOfAvailableThreads() { - synchronized (workQueue) { - return availableWorkerThreads; - } - } - - public int numberOfBusyThreads() { - synchronized (workQueue) { - return (currentThreadCount - availableWorkerThreads); - } - } - - public long averageWorkCompletionTime() { - synchronized (workQueue) { - return (totalTimeTaken.get() / processedCount.get()); - } - } - - public long currentProcessedCount() { - synchronized (workQueue) { - return processedCount.get(); - } - } - - public String getName() { - return name; - } - - /** - * This method will return the number of WorkQueues serviced by the threadpool. - */ - public int numberOfWorkQueues() { - return 1; - } - - - private static synchronized int getUniqueThreadId() { - return ThreadPoolImpl.threadCounter.incrementAndGet(); - } - - /** - * This method will decrement the number of available threads - * in the threadpool which are waiting for work. Called from - * WorkQueueImpl.requestWork() - */ - void decrementNumberOfAvailableThreads() { - synchronized (workQueue) { - availableWorkerThreads--; - } - } - - /** - * This method will increment the number of available threads - * in the threadpool which are waiting for work. Called from - * WorkQueueImpl.requestWork() - */ - void incrementNumberOfAvailableThreads() { - synchronized (workQueue) { - availableWorkerThreads++; - } - } - - - private class WorkerThread extends Thread implements Closeable - { - private Work currentWork; - private int threadId = 0; // unique id for the thread - private volatile boolean closeCalled = false; - private String threadPoolName; - // name seen by Thread.getName() - private StringBuffer workerThreadName = new StringBuffer(); - - WorkerThread(ThreadGroup tg, String threadPoolName) { - super(tg, null, "Idle", 0, false); - this.threadId = ThreadPoolImpl.getUniqueThreadId(); - this.threadPoolName = threadPoolName; - setName(composeWorkerThreadName(threadPoolName, "Idle")); - } - - public synchronized void close() { - closeCalled = true; - interrupt(); - } - - private void resetClassLoader() { - - } - - private void performWork() { - long start = System.currentTimeMillis(); - try { - currentWork.doWork(); - } catch (Throwable t) { - wrapper.workerThreadDoWorkThrowable(this, t); - } - long elapsedTime = System.currentTimeMillis() - start; - totalTimeTaken.addAndGet(elapsedTime); - processedCount.incrementAndGet(); - } - - public void run() { - try { - while (!closeCalled) { - try { - currentWork = ((WorkQueueImpl)workQueue).requestWork( - inactivityTimeout); - if (currentWork == null) - continue; - } catch (InterruptedException exc) { - wrapper.workQueueThreadInterrupted( exc, getName(), - Boolean.valueOf(closeCalled)); - - continue ; - } catch (Throwable t) { - wrapper.workerThreadThrowableFromRequestWork(this, t, - workQueue.getName()); - - continue; - } - - performWork(); - - // set currentWork to null so that the work item can be - // garbage collected without waiting for the next work item. - currentWork = null; - - resetClassLoader(); - } - } catch (Throwable e) { - // This should not be possible - wrapper.workerThreadCaughtUnexpectedThrowable(this,e); - } finally { - synchronized (workersLock) { - workers.remove(this); - } - } - } - - private String composeWorkerThreadName(String poolName, String workerName) { - workerThreadName.setLength(0); - workerThreadName.append("p: ").append(poolName); - workerThreadName.append("; w: ").append(workerName); - return workerThreadName.toString(); - } - } // End of WorkerThread class - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolManagerImpl.java 2018-01-30 20:19:37.000000000 -0500 +++ /dev/null 2018-01-30 20:19:37.000000000 -0500 @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.orbutil.threadpool; - -import java.io.IOException; - -import java.security.PrivilegedAction; -import java.security.AccessController; - -import java.util.concurrent.atomic.AtomicInteger; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException; -import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool; -import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager; -import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolChooser; - -import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.spi.logging.CORBALogDomains; - - -public class ThreadPoolManagerImpl implements ThreadPoolManager -{ - private ThreadPool threadPool; - private ThreadGroup threadGroup; - - private static final ORBUtilSystemException wrapper = - ORBUtilSystemException.get(CORBALogDomains.RPC_TRANSPORT); - - public ThreadPoolManagerImpl() { - threadGroup = getThreadGroup(); - threadPool = new ThreadPoolImpl(threadGroup, - ORBConstants.THREADPOOL_DEFAULT_NAME); - } - - private static AtomicInteger tgCount = new AtomicInteger(); - - - private ThreadGroup getThreadGroup() { - ThreadGroup tg; - - // See bugs 4916766 and 4936203 - // We intend to create new threads in a reliable thread group. - // This avoids problems if the application/applet - // creates a thread group, makes JavaIDL calls which create a new - // connection and ReaderThread, and then destroys the thread - // group. If our ReaderThreads were to be part of such destroyed thread - // group then it might get killed and cause other invoking threads - // sharing the same connection to get a non-restartable - // CommunicationFailure. We'd like to avoid that. - // - // Our solution is to create all of our threads in the highest thread - // group that we have access to, given our own security clearance. - // - try { - // try to get a thread group that's as high in the threadgroup - // parent-child hierarchy, as we can get to. - // this will prevent an ORB thread created during applet-init from - // being killed when an applet dies. - tg = AccessController.doPrivileged( - new PrivilegedAction() { - public ThreadGroup run() { - ThreadGroup tg = Thread.currentThread().getThreadGroup(); - ThreadGroup ptg = tg; - try { - while (ptg != null) { - tg = ptg; - ptg = tg.getParent(); - } - } catch (SecurityException se) { - // Discontinue going higher on a security exception. - } - return new ThreadGroup(tg, "ORB ThreadGroup " + tgCount.getAndIncrement()); - } - } - ); - } catch (SecurityException e) { - // something wrong, we go back to the original code - tg = Thread.currentThread().getThreadGroup(); - } - - return tg; - } - - public void close() { - try { - threadPool.close(); - } catch (IOException exc) { - wrapper.threadPoolCloseError(); - } - - try { - boolean isDestroyed = threadGroup.isDestroyed(); - int numThreads = threadGroup.activeCount(); - int numGroups = threadGroup.activeGroupCount(); - - if (isDestroyed) { - wrapper.threadGroupIsDestroyed(threadGroup); - } else { - if (numThreads > 0) - wrapper.threadGroupHasActiveThreadsInClose(threadGroup, numThreads); - - if (numGroups > 0) - wrapper.threadGroupHasSubGroupsInClose(threadGroup, numGroups); - - threadGroup.destroy(); - } - } catch (IllegalThreadStateException exc) { - wrapper.threadGroupDestroyFailed(exc, threadGroup); - } - - threadGroup = null; - } - - /** - * This method will return an instance of the threadpool given a threadpoolId, - * that can be used by any component in the app. server. - * - * @throws NoSuchThreadPoolException thrown when invalid threadpoolId is passed - * as a parameter - */ - public ThreadPool getThreadPool(String threadpoolId) - throws NoSuchThreadPoolException { - - return threadPool; - } - - /** - * This method will return an instance of the threadpool given a numeric threadpoolId. - * This method will be used by the ORB to support the functionality of - * dedicated threadpool for EJB beans - * - * @throws NoSuchThreadPoolException thrown when invalidnumericIdForThreadpool is passed - * as a parameter - */ - public ThreadPool getThreadPool(int numericIdForThreadpool) - throws NoSuchThreadPoolException { - - return threadPool; - } - - /** - * This method is used to return the numeric id of the threadpool, given a String - * threadpoolId. This is used by the POA interceptors to add the numeric threadpool - * Id, as a tagged component in the IOR. This is used to provide the functionality of - * dedicated threadpool for EJB beans - */ - public int getThreadPoolNumericId(String threadpoolId) { - return 0; - } - - /** - * Return a String Id for a numericId of a threadpool managed by the threadpool - * manager - */ - public String getThreadPoolStringId(int numericIdForThreadpool) { - return ""; - } - - /** - * Returns the first instance of ThreadPool in the ThreadPoolManager - */ - public ThreadPool getDefaultThreadPool() { - return threadPool; - } - - /** - * Return an instance of ThreadPoolChooser based on the componentId that was - * passed as argument - */ - public ThreadPoolChooser getThreadPoolChooser(String componentId) { - //FIXME: This method is not used, but should be fixed once - //nio select starts working and we start using ThreadPoolChooser - return null; - } - /** - * Return an instance of ThreadPoolChooser based on the componentIndex that was - * passed as argument. This is added for improved performance so that the caller - * does not have to pay the cost of computing hashcode for the componentId - */ - public ThreadPoolChooser getThreadPoolChooser(int componentIndex) { - //FIXME: This method is not used, but should be fixed once - //nio select starts working and we start using ThreadPoolChooser - return null; - } - - /** - * Sets a ThreadPoolChooser for a particular componentId in the ThreadPoolManager. This - * would enable any component to add a ThreadPoolChooser for their specific use - */ - public void setThreadPoolChooser(String componentId, ThreadPoolChooser aThreadPoolChooser) { - //FIXME: This method is not used, but should be fixed once - //nio select starts working and we start using ThreadPoolChooser - } - - /** - * Gets the numeric index associated with the componentId specified for a - * ThreadPoolChooser. This method would help the component call the more - * efficient implementation i.e. getThreadPoolChooser(int componentIndex) - */ - public int getThreadPoolChooserNumericId(String componentId) { - //FIXME: This method is not used, but should be fixed once - //nio select starts working and we start using ThreadPoolChooser - return 0; - } - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/TimeoutException.java 2018-01-30 20:19:38.000000000 -0500 +++ /dev/null 2018-01-30 20:19:38.000000000 -0500 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.orbutil.threadpool; - -public class TimeoutException extends Exception -{ -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java 2018-01-30 20:19:39.000000000 -0500 +++ /dev/null 2018-01-30 20:19:39.000000000 -0500 @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.orbutil.threadpool; - -import java.util.LinkedList; - -import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool; -import com.sun.corba.se.spi.orbutil.threadpool.Work; -import com.sun.corba.se.spi.orbutil.threadpool.WorkQueue; - -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl; - -import com.sun.corba.se.spi.monitoring.MonitoringConstants; -import com.sun.corba.se.spi.monitoring.MonitoringFactories; -import com.sun.corba.se.spi.monitoring.MonitoredObject; -import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase; - -public class WorkQueueImpl implements WorkQueue -{ - private ThreadPool workerThreadPool; - private LinkedList theWorkQueue = new LinkedList(); - private long workItemsAdded = 0; - - // Initialized to 1 to avoid divide by zero in averageTimeInQueue() - private long workItemsDequeued = 1; - - private long totalTimeInQueue = 0; - - // Name of the work queue - private String name; - - // MonitoredObject for work queue - private MonitoredObject workqueueMonitoredObject; - - public WorkQueueImpl() { - name=ORBConstants.WORKQUEUE_DEFAULT_NAME; - initializeMonitoring(); - } - - public WorkQueueImpl(ThreadPool workerThreadPool) { - this(workerThreadPool, ORBConstants.WORKQUEUE_DEFAULT_NAME); - } - - public WorkQueueImpl(ThreadPool workerThreadPool, String name) { - this.workerThreadPool = workerThreadPool; - this.name = name; - initializeMonitoring(); - } - - // Setup monitoring for this workqueue - private void initializeMonitoring() { - workqueueMonitoredObject = MonitoringFactories. - getMonitoredObjectFactory(). - createMonitoredObject(name, - MonitoringConstants.WORKQUEUE_MONITORING_DESCRIPTION); - - LongMonitoredAttributeBase b1 = new - LongMonitoredAttributeBase(MonitoringConstants.WORKQUEUE_TOTAL_WORK_ITEMS_ADDED, - MonitoringConstants.WORKQUEUE_TOTAL_WORK_ITEMS_ADDED_DESCRIPTION) { - public Object getValue() { - return new Long(WorkQueueImpl.this.totalWorkItemsAdded()); - } - }; - workqueueMonitoredObject.addAttribute(b1); - LongMonitoredAttributeBase b2 = new - LongMonitoredAttributeBase(MonitoringConstants.WORKQUEUE_WORK_ITEMS_IN_QUEUE, - MonitoringConstants.WORKQUEUE_WORK_ITEMS_IN_QUEUE_DESCRIPTION) { - public Object getValue() { - return new Long(WorkQueueImpl.this.workItemsInQueue()); - } - }; - workqueueMonitoredObject.addAttribute(b2); - LongMonitoredAttributeBase b3 = new - LongMonitoredAttributeBase(MonitoringConstants.WORKQUEUE_AVERAGE_TIME_IN_QUEUE, - MonitoringConstants.WORKQUEUE_AVERAGE_TIME_IN_QUEUE_DESCRIPTION) { - public Object getValue() { - return new Long(WorkQueueImpl.this.averageTimeInQueue()); - } - }; - workqueueMonitoredObject.addAttribute(b3); - } - - - // Package private method to get the monitored object for this - // class - MonitoredObject getMonitoredObject() { - return workqueueMonitoredObject; - } - - public synchronized void addWork(Work work) { - workItemsAdded++; - work.setEnqueueTime(System.currentTimeMillis()); - theWorkQueue.addLast(work); - ((ThreadPoolImpl)workerThreadPool).notifyForAvailableWork(this); - } - - synchronized Work requestWork(long waitTime) throws TimeoutException, InterruptedException - { - Work workItem; - ((ThreadPoolImpl)workerThreadPool).incrementNumberOfAvailableThreads(); - - if (theWorkQueue.size() != 0) { - workItem = (Work)theWorkQueue.removeFirst(); - totalTimeInQueue += System.currentTimeMillis() - workItem.getEnqueueTime(); - workItemsDequeued++; - ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads(); - return workItem; - } - - try { - - long remainingWaitTime = waitTime; - long finishTime = System.currentTimeMillis() + waitTime; - - do { - - this.wait(remainingWaitTime); - - if (theWorkQueue.size() != 0) { - workItem = (Work)theWorkQueue.removeFirst(); - totalTimeInQueue += System.currentTimeMillis() - workItem.getEnqueueTime(); - workItemsDequeued++; - ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads(); - return workItem; - } - - remainingWaitTime = finishTime - System.currentTimeMillis(); - - } while (remainingWaitTime > 0); - - ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads(); - throw new TimeoutException(); - - } catch (InterruptedException ie) { - ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads(); - throw ie; - } - } - - public void setThreadPool(ThreadPool workerThreadPool) { - this.workerThreadPool = workerThreadPool; - } - - public ThreadPool getThreadPool() { - return workerThreadPool; - } - - /** - * Returns the total number of Work items added to the Queue. - * This method is unsynchronized and only gives a snapshot of the - * state when it is called - */ - public long totalWorkItemsAdded() { - return workItemsAdded; - } - - /** - * Returns the total number of Work items in the Queue to be processed - * This method is unsynchronized and only gives a snapshot of the - * state when it is called - */ - public int workItemsInQueue() { - return theWorkQueue.size(); - } - - public synchronized long averageTimeInQueue() { - return (totalTimeInQueue/workItemsDequeued); - } - - public String getName() { - return name; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicAccessPermission.java 2018-01-30 20:19:39.000000000 -0500 +++ /dev/null 2018-01-30 20:19:39.000000000 -0500 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2006, 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.corba.se.impl.presentation.rmi; - -import java.security.*; - -/** - * This class controls the use of dynamic proxies. - * A DynamicAccessPermission contains a name (also referred to as a "target name") but - * no actions list; you either have the named permission - * or you don't. - * - */ - -public final class DynamicAccessPermission extends BasicPermission { - //private static final long serialVersionUID = -8343910153355041693L; - - /** - * Creates a new DynamicAccessPermission with the specified name. - * @param name the name of the DynamicAccessPermission. - */ - public DynamicAccessPermission(String name) - { - super(name); - } - - /** - * Creates a new DynamicAccessPermission object with the specified name. - * The name is the symbolic name of the DynamicAccessPermission, and the - * actions String is currently unused and should be null. - * - * @param name the name of the DynamicAccessPermission. - * @param actions should be null. - */ - public DynamicAccessPermission(String name, String actions) - { - super(name, actions); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicMethodMarshallerImpl.java 2018-01-30 20:19:40.000000000 -0500 +++ /dev/null 2018-01-30 20:19:40.000000000 -0500 @@ -1,465 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.presentation.rmi ; - -import java.io.Serializable ; -import java.io.Externalizable ; - -import javax.rmi.PortableRemoteObject ; -import javax.rmi.CORBA.Util ; - -import org.omg.CORBA.portable.IDLEntity ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA.portable.ApplicationException ; - -import java.lang.reflect.Method ; - -import java.rmi.RemoteException ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.presentation.rmi.DynamicMethodMarshaller ; - -public class DynamicMethodMarshallerImpl implements DynamicMethodMarshaller -{ - Method method ; - ExceptionHandler ehandler ; - boolean hasArguments = true ; - boolean hasVoidResult = true ; - boolean needsArgumentCopy ; // true if copyObjects call needs for args - boolean needsResultCopy ; // true if copyObject call needs for result - ReaderWriter[] argRWs = null ; - ReaderWriter resultRW = null ; - - private static boolean isAnyClass( Class cls ) - { - return cls.equals( Object.class ) || cls.equals( Serializable.class ) || - cls.equals( Externalizable.class ) ; - } - - // Assume that cls is not Remote, !isAnyClass(cls), and - // !org.omg.CORBA.Object.class.isAssignableFrom( cls ). - // Then return whether cls is an RMI-IIOP abstract interface. - private static boolean isAbstractInterface( Class cls ) - { - // Either cls is an interface that extends IDLEntity, or else - // cls does not extend java.rmi.Remote and all of its methods - // throw RemoteException. - if (IDLEntity.class.isAssignableFrom( cls )) - return cls.isInterface() ; - else - return cls.isInterface() && allMethodsThrowRemoteException( cls ) ; - } - - private static boolean allMethodsThrowRemoteException( Class cls ) - { - Method[] methods = cls.getMethods() ; - - // Check that all methods (other than those declared in java.lang.Object) - // throw an exception that is a subclass of RemoteException. - for (int ctr=0; ctr 0 ; - if (hasArguments) { - argRWs = new ReaderWriter[ argTypes.length ] ; - for (int ctr=0; ctr 0) { - ExceptionRW duprw = rws[duplicateIndex] ; - String firstClassName = - erw.getExceptionClass().getName() ; - String secondClassName = - duprw.getExceptionClass().getName() ; - throw wrapper.duplicateExceptionRepositoryId( - firstClassName, secondClassName, repositoryId ) ; - } - - */ - - rws[index++] = erw ; - } - } - } - - private int findDeclaredException( Class cls ) - { - for (int ctr = 0; ctr < rws.length; ctr++) { - Class next = rws[ctr].getExceptionClass() ; - if (next.isAssignableFrom(cls)) - return ctr ; - } - - return -1 ; - } - - private int findDeclaredException( String repositoryId ) - { - for (int ctr=0; ctr= 0 ; - } - - public void writeException( OutputStream os, Exception ex ) - { - int index = findDeclaredException( ex.getClass() ) ; - if (index < 0) - throw wrapper.writeUndeclaredException( ex, - ex.getClass().getName() ) ; - - rws[index].write( os, ex ) ; - } - - public Exception readException( ApplicationException ae ) - { - // Note that the exception ID is present in both ae - // and in the input stream from ae. The exception - // reader must actually read the exception ID from - // the stream. - InputStream is = (InputStream)ae.getInputStream() ; - String excName = ae.getId() ; - int index = findDeclaredException( excName ) ; - if (index < 0) { - excName = is.read_string() ; - Exception res = new UnexpectedException( excName ) ; - res.initCause( ae ) ; - return res ; - } - - return rws[index].read( is ) ; - } - - // This is here just for the dynamicrmiiiop test - public ExceptionRW getRMIExceptionRW( Class cls ) - { - return new ExceptionRWRMIImpl( cls ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java 2018-01-30 20:19:42.000000000 -0500 +++ /dev/null 2018-01-30 20:19:42.000000000 -0500 @@ -1,908 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.presentation.rmi ; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -import java.lang.reflect.Method; - -import java.math.BigInteger; - -import java.util.Map; -import java.util.Set; -import java.util.HashSet; -import java.util.Iterator; -import java.util.HashMap; -import java.util.StringTokenizer; - -import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ; - -import com.sun.corba.se.impl.presentation.rmi.IDLType ; -import com.sun.corba.se.impl.presentation.rmi.IDLTypeException ; -import com.sun.corba.se.impl.presentation.rmi.IDLTypesUtil ; -import com.sun.corba.se.impl.orbutil.ObjectUtility ; - -/** - * Bidirectional translator between RMI-IIOP interface methods and - * and IDL Names. - */ -public class IDLNameTranslatorImpl implements IDLNameTranslator { - - // From CORBA Spec, Table 6 Keywords. - // Note that since all IDL identifiers are case - // insensitive, java identifier comparisons to these - // will be case insensitive also. - private static String[] IDL_KEYWORDS = { - - "abstract", "any", "attribute", "boolean", "case", "char", - "const", "context", "custom", "default", "double", "enum", - "exception", "factory", "FALSE", "fixed", "float", "in", "inout", - "interface", "long", "module", "native", "Object", "octet", - "oneway", "out", "private", "public", "raises", "readonly", "sequence", - "short", "string", "struct", "supports", "switch", "TRUE", "truncatable", - "typedef", "unsigned", "union", "ValueBase", "valuetype", "void", - "wchar", "wstring" - - }; - - private static char[] HEX_DIGITS = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'A', 'B', 'C', 'D', 'E', 'F' - }; - - private static final String UNDERSCORE = "_"; - - // used to mangle java inner class names - private static final String INNER_CLASS_SEPARATOR = - UNDERSCORE + UNDERSCORE; - - // used to form IDL array type names - private static final String[] BASE_IDL_ARRAY_MODULE_TYPE= - new String[] { "org", "omg", "boxedRMI" } ; - - private static final String BASE_IDL_ARRAY_ELEMENT_TYPE = "seq"; - - // used to mangling java identifiers that have a leading underscore - private static final String LEADING_UNDERSCORE_CHAR = "J"; - private static final String ID_CONTAINER_CLASH_CHAR = UNDERSCORE; - - // separator used between types in a mangled overloaded method name - private static final String OVERLOADED_TYPE_SEPARATOR = - UNDERSCORE + UNDERSCORE; - - // string appended to attribute if it clashes with a method name - private static final String ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS = - UNDERSCORE + UNDERSCORE; - - // strings prepended to the attribute names in order to form their - // IDL names. - private static final String GET_ATTRIBUTE_PREFIX = "_get_"; - private static final String SET_ATTRIBUTE_PREFIX = "_set_"; - private static final String IS_ATTRIBUTE_PREFIX = "_get_"; - - private static Set idlKeywords_; - - static { - - idlKeywords_ = new HashSet(); - for(int i = 0; i < IDL_KEYWORDS.length; i++) { - String next = (String) IDL_KEYWORDS[i]; - // Convert keyword to all caps to ease equality - // check. - String keywordAllCaps = next.toUpperCase(); - idlKeywords_.add(keywordAllCaps); - } - - } - - // - // Instance state - // - - // Remote interface for name translation. - private Class[] interf_; - - // Maps used to hold name translations. These do not need to be - // synchronized since the translation is never modified after - // initialization. - private Map methodToIDLNameMap_; - private Map IDLNameToMethodMap_; - private Method[] methods_; - - /** - * Return an IDLNameTranslator for the given interface. - * - * @throws IllegalStateException if given class is not a valid - * RMI/IIOP Remote Interface - */ - public static IDLNameTranslator get( Class interf ) - { - - return new IDLNameTranslatorImpl(new Class[] { interf } ); - - } - - /** - * Return an IDLNameTranslator for the given interfacex. - * - * @throws IllegalStateException if given classes are not valid - * RMI/IIOP Remote Interfaces - */ - public static IDLNameTranslator get( Class[] interfaces ) - { - - return new IDLNameTranslatorImpl(interfaces ); - - } - - public static String getExceptionId( Class cls ) - { - // Requirements for this method: - // 1. cls must be an exception but not a RemoteException. - // 2. If cls has an IDL keyword name, an underscore is prepended (1.3.2.2). - // 3. If cls jas a leading underscore, J is prepended (1.3.2.3). - // 4. If cls has an illegal IDL ident char, it is mapped to UXXXX where - // XXXX is the unicode value in hex of the char (1.3.2.4). - // 5. double underscore for inner class (1.3.2.5). - // 6. The ID is "IDL:" + name with / separators + ":1.0". - IDLType itype = classToIDLType( cls ) ; - return itype.getExceptionName() ; - } - - public Class[] getInterfaces() - { - return interf_; - } - - public Method[] getMethods() - { - return methods_ ; - } - - public Method getMethod( String idlName ) - { - return (Method) IDLNameToMethodMap_.get(idlName); - } - - public String getIDLName( Method method ) - { - return (String) methodToIDLNameMap_.get(method); - } - - /** - * Initialize an IDLNameTranslator for the given interface. - * - * @throws IllegalStateException if given class is not a valid - * RMI/IIOP Remote Interface - */ - private IDLNameTranslatorImpl(Class[] interfaces) - { - - SecurityManager s = System.getSecurityManager(); - if (s != null) { - s.checkPermission(new DynamicAccessPermission("access")); - } - try { - IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); - for (int ctr=0; ctr 0 ) { - int div = value / 16; - int mod = value % 16; - hexString.insert(0, HEX_DIGITS[mod]); - value = div; - } - - int numZerosToAdd = 4 - hexString.length(); - for(int i = 0; i < numZerosToAdd; i++) { - hexString.insert(0, "0"); - } - - hexString.insert(0, "U"); - return hexString.toString(); - } - - private static boolean isIDLIdentifier(String identifier) { - - boolean isIdentifier = true; - - for(int i = 0; i < identifier.length(); i++) { - char nextChar = identifier.charAt(i); - // 1st char must be alphbetic. - isIdentifier = (i == 0) ? - isIDLAlphabeticChar(nextChar) : - isIDLIdentifierChar(nextChar); - if( !isIdentifier ) { - break; - } - } - - return isIdentifier; - - } - - private static boolean isIDLIdentifierChar(char c) { - return (isIDLAlphabeticChar(c) || - isIDLDecimalDigit(c) || - isUnderscore(c)); - } - - /** - * True if character is one of 114 Alphabetic characters as - * specified in Table 2 of Chapter 3 in CORBA spec. - */ - private static boolean isIDLAlphabeticChar(char c) { - - // NOTE that we can't use the java.lang.Character - // isUpperCase, isLowerCase, etc. methods since they - // include many characters other than the Alphabetic list in - // the CORBA spec. Instead, we test for inclusion in the - // Unicode value ranges for the corresponding legal characters. - - boolean alphaChar = - ( - // A - Z - ((c >= 0x0041) && (c <= 0x005A)) - - || - - // a - z - ((c >= 0x0061) && (c <= 0x007A)) - - || - - // other letter uppercase, other letter lowercase, which is - // the entire upper half of C1 Controls except X and / - ((c >= 0x00C0) && (c <= 0x00FF) - && (c != 0x00D7) && (c != 0x00F7))); - - return alphaChar; - } - - /** - * True if character is one of 10 Decimal Digits - * specified in Table 3 of Chapter 3 in CORBA spec. - */ - private static boolean isIDLDecimalDigit(char c) { - return ( (c >= 0x0030) && (c <= 0x0039) ); - } - - private static boolean isUnderscore(char c) { - return ( c == 0x005F ); - } - - /** - * Mangle an overloaded method name as defined in Section 1.3.2.6 of - * Java2IDL spec. Current value of method name is passed in as argument. - * We can't start from original method name since the name might have - * been partially mangled as a result of the other rules. - */ - private static String mangleOverloadedMethod(String mangledName, Method m) { - - IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); - - // Start by appending the separator string - String newMangledName = mangledName + OVERLOADED_TYPE_SEPARATOR; - - Class[] parameterTypes = m.getParameterTypes(); - - for(int i = 0; i < parameterTypes.length; i++) { - Class nextParamType = parameterTypes[i]; - - if( i > 0 ) { - newMangledName = newMangledName + OVERLOADED_TYPE_SEPARATOR; - } - IDLType idlType = classToIDLType(nextParamType); - - String moduleName = idlType.getModuleName(); - String memberName = idlType.getMemberName(); - - String typeName = (moduleName.length() > 0) ? - moduleName + UNDERSCORE + memberName : memberName; - - if( !idlTypesUtil.isPrimitive(nextParamType) && - (idlTypesUtil.getSpecialCaseIDLTypeMapping(nextParamType) - == null) && - isIDLKeyword(typeName) ) { - typeName = mangleIDLKeywordClash(typeName); - } - - typeName = mangleUnicodeChars(typeName); - - newMangledName = newMangledName + typeName; - } - - return newMangledName; - } - - - private static IDLType classToIDLType(Class c) { - - IDLType idlType = null; - IDLTypesUtil idlTypesUtil = new IDLTypesUtil(); - - if( idlTypesUtil.isPrimitive(c) ) { - - idlType = idlTypesUtil.getPrimitiveIDLTypeMapping(c); - - } else if( c.isArray() ) { - - // Calculate array depth, as well as base element type. - Class componentType = c.getComponentType(); - int numArrayDimensions = 1; - while(componentType.isArray()) { - componentType = componentType.getComponentType(); - numArrayDimensions++; - } - IDLType componentIdlType = classToIDLType(componentType); - - String[] modules = BASE_IDL_ARRAY_MODULE_TYPE; - if( componentIdlType.hasModule() ) { - modules = (String[])ObjectUtility.concatenateArrays( modules, - componentIdlType.getModules() ) ; - } - - String memberName = BASE_IDL_ARRAY_ELEMENT_TYPE + - numArrayDimensions + UNDERSCORE + - componentIdlType.getMemberName(); - - idlType = new IDLType(c, modules, memberName); - - } else { - idlType = idlTypesUtil.getSpecialCaseIDLTypeMapping(c); - - if (idlType == null) { - // Section 1.3.2.5 of Java2IDL spec defines mangling rules for - // inner classes. - String memberName = getUnmappedContainerName(c); - - // replace inner class separator with double underscore - memberName = memberName.replaceAll("\\$", - INNER_CLASS_SEPARATOR); - - if( hasLeadingUnderscore(memberName) ) { - memberName = mangleLeadingUnderscore(memberName); - } - - // Get raw package name. If there is a package, it - // will still have the "." separators and none of the - // mangling rules will have been applied. - String packageName = getPackageName(c); - - if (packageName == null) { - idlType = new IDLType( c, memberName ) ; - } else { - // If this is a generated IDL Entity Type we need to - // prepend org_omg_boxedIDL per sections 1.3.5 and 1.3.9 - if (idlTypesUtil.isEntity(c)) { - packageName = "org.omg.boxedIDL." + packageName ; - } - - // Section 1.3.2.1 and 1.3.2.6 of Java2IDL spec defines - // rules for mapping java packages to IDL modules and for - // mangling module name portion of type name. NOTE that - // of the individual identifier mangling rules, - // only the leading underscore test is done here. - // The other two(IDL Keyword, Illegal Unicode chars) are - // done in mangleOverloadedMethodName. - StringTokenizer tokenizer = - new StringTokenizer(packageName, "."); - - String[] modules = new String[ tokenizer.countTokens() ] ; - int index = 0 ; - while (tokenizer.hasMoreElements()) { - String next = tokenizer.nextToken(); - String moreMangled = hasLeadingUnderscore( next ) ? - mangleLeadingUnderscore( next ) : next; - - modules[index++] = moreMangled ; - } - - idlType = new IDLType(c, modules, memberName); - } - } - } - - return idlType; - } - - /** - * Return Class' package name or null if there is no package. - */ - private static String getPackageName(Class c) { - Package thePackage = c.getPackage(); - String packageName = null; - - // Try to get package name by introspection. Some classloaders might - // not provide this information, so check for null. - if( thePackage != null ) { - packageName = thePackage.getName(); - } else { - // brute force method - String fullyQualifiedClassName = c.getName(); - int lastDot = fullyQualifiedClassName.indexOf('.'); - packageName = (lastDot == -1) ? null : - fullyQualifiedClassName.substring(0, lastDot); - } - return packageName; - } - - private static String getMappedContainerName(Class c) { - String unmappedName = getUnmappedContainerName(c); - - return mangleIdentifier(unmappedName); - } - - /** - * Return portion of class name excluding package name. - */ - private static String getUnmappedContainerName(Class c) { - - String memberName = null; - String packageName = getPackageName(c); - - String fullyQualifiedClassName = c.getName(); - - if( packageName != null ) { - int packageLength = packageName.length(); - memberName = fullyQualifiedClassName.substring(packageLength + 1); - } else { - memberName = fullyQualifiedClassName; - - } - - return memberName; - } - - /** - * Internal helper class for tracking information related to each - * interface method while we're building the name translation table. - */ - private static class IDLMethodInfo - { - public Method method; - public boolean isProperty; - - // If this is a property, originalName holds the original - // attribute name. Otherwise, it holds the original method name. - public String originalName; - - // If this is a property, mangledName holds the mangled attribute - // name. Otherwise, it holds the mangled method name. - public String mangledName; - - } - - public String toString() { - - StringBuffer contents = new StringBuffer(); - contents.append("IDLNameTranslator[" ); - for( int ctr=0; ctr0) - sbuff.append( separator ) ; - - if (fixIDLKeywords && IDLNameTranslatorImpl.isIDLKeyword(mod)) - mod = IDLNameTranslatorImpl.mangleIDLKeywordClash( mod ) ; - - sbuff.append( mod ) ; - } - - return sbuff.toString() ; - } - - public String getModuleName() { - // Note that this should probably be makeConcatenatedName( '/', true ) - // for spec compliance, - // but rmic does it this way, so we'll leave this. - // The effect is that an overloaded method like - // void foo( bar.typedef.Baz ) - // will get an IDL name of foo__bar_typedef_Baz instead of - // foo__bar__typedef_Baz (note the extra _ before typedef). - return makeConcatenatedName( '_', false ) ; - } - - public String getExceptionName() { - // Here we will check for IDL keyword collisions (see bug 5010332). - // This means that the repository ID for - // foo.exception.SomeException is - // "IDL:foo/_exception/SomeEx:1.0" (note the underscore in front - // of the exception module name). - String modName = makeConcatenatedName( '/', true ) ; - - String suffix = "Exception" ; - String excName = memberName_ ; - if (excName.endsWith( suffix )) { - int last = excName.length() - suffix.length() ; - excName = excName.substring( 0, last ) ; - } - - // See bug 4989312: we must always add the Ex. - excName += "Ex" ; - - if (modName.length() == 0) - return "IDL:" + excName + ":1.0" ; - else - return "IDL:" + modName + '/' + excName + ":1.0" ; - } - - public String getMemberName() { - return memberName_; - } - - /** - * True if this type doesn't have a containing module. This - * would be true of a java type defined in the default package - * or a primitive. - */ - public boolean hasModule() { - return (modules_.length > 0) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypeException.java 2018-01-30 20:19:44.000000000 -0500 +++ /dev/null 2018-01-30 20:19:44.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.presentation.rmi ; - -/** - * Checked exception containing information about an - * an IDL type validation. - */ -public class IDLTypeException extends Exception { - - public IDLTypeException() {} - - public IDLTypeException(String message) { - super(message); - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil.java 2018-01-30 20:19:44.000000000 -0500 +++ /dev/null 2018-01-30 20:19:45.000000000 -0500 @@ -1,598 +0,0 @@ -/* - * Copyright (c) 2003, 2006, 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.corba.se.impl.presentation.rmi ; - -import java.lang.reflect.Method; -import java.lang.reflect.Field; -import java.util.Set; -import java.util.HashSet; -import java.util.Iterator; - -/** - * Utility class for testing RMI/IDL Types as defined in - * Section 1.2 of The Java Language to IDL Mapping. Note that - * these are static checks only. Runtime checks, such as those - * described in Section 1.2.3, #3, are not covered. - */ -public final class IDLTypesUtil { - - private static final String GET_PROPERTY_PREFIX = "get"; - private static final String SET_PROPERTY_PREFIX = "set"; - private static final String IS_PROPERTY_PREFIX = "is"; - - public static final int VALID_TYPE = 0; - public static final int INVALID_TYPE = 1; - - /* rmic -iiop does not correctly implement the clause in 1.3.4.3 - * about is/get conflicts. The spec says that - * is is the property and get is left alone, - * but rmic does the opposite. We will follow rmic in this, - * but it's easy to change. - */ - public static final boolean FOLLOW_RMIC = true ; - - /** - * Validate a class to ensure it conforms to the rules for a - * Java RMI/IIOP interface. - * - * @throws IDLTypeException if not a valid RMI/IIOP interface. - */ - public void validateRemoteInterface(Class c) throws IDLTypeException - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - if( !c.isInterface() ) { - String msg = "Class " + c + " must be a java interface."; - throw new IDLTypeException(msg); - } - - if( !java.rmi.Remote.class.isAssignableFrom(c) ) { - String msg = "Class " + c + " must extend java.rmi.Remote, " + - "either directly or indirectly."; - throw new IDLTypeException(msg); - } - - // Get all methods, including super-interface methods. - Method[] methods = c.getMethods(); - - for(int i = 0; i < methods.length; i++) { - Method next = methods[i]; - validateExceptions(next); - } - - // Removed because of bug 4989053 - // validateDirectInterfaces(c); - validateConstants(c); - - return; - } - - public boolean isRemoteInterface(Class c) - { - boolean remoteInterface = true; - try { - validateRemoteInterface(c); - } catch(IDLTypeException ite) { - remoteInterface = false; - } - - return remoteInterface; - } - - /** - * Section 1.2.2 Primitive Types - */ - public boolean isPrimitive(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return c.isPrimitive(); - } - - /** - * Section 1.2.4 - */ - public boolean isValue(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return - (!c.isInterface() && - java.io.Serializable.class.isAssignableFrom(c) && - !java.rmi.Remote.class.isAssignableFrom(c)); - } - - /** - * Section 1.2.5 - */ - public boolean isArray(Class c) - { - boolean arrayType = false; - - if( c == null ) { - throw new IllegalArgumentException(); - } - - if( c.isArray() ) { - Class componentType = c.getComponentType(); - arrayType = - (isPrimitive(componentType) || isRemoteInterface(componentType) || - isEntity(componentType) || isException(componentType) || - isValue(componentType) || isObjectReference(componentType) ); - } - - return arrayType; - } - - /** - * Section 1.2.6 - */ - public boolean isException(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - // Must be a checked exception, not including RemoteException or - // its subclasses. - return isCheckedException(c) && !isRemoteException(c) && isValue(c); - } - - public boolean isRemoteException(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return java.rmi.RemoteException.class.isAssignableFrom(c) ; - } - - public boolean isCheckedException(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return Throwable.class.isAssignableFrom(c) && - !RuntimeException.class.isAssignableFrom(c) && - !Error.class.isAssignableFrom(c) ; - } - - /** - * Section 1.2.7 - */ - public boolean isObjectReference(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - return (c.isInterface() && - org.omg.CORBA.Object.class.isAssignableFrom(c)); - } - - /** - * Section 1.2.8 - */ - public boolean isEntity(Class c) - { - if( c == null ) { - throw new IllegalArgumentException(); - } - - Class superClass = c.getSuperclass(); - return (!c.isInterface() && - (superClass != null) && - (org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(c))); - } - - /** - * Return true if given method is legal property accessor as defined in - * Section 1.3.4.3 of Java2IDL spec. - */ - public boolean isPropertyAccessorMethod(Method m, Class c) { - - String methodName = m.getName(); - Class returnType = m.getReturnType(); - Class[] parameters = m.getParameterTypes(); - Class[] exceptionTypes = m.getExceptionTypes(); - String propertyType = null; - - if( methodName.startsWith(GET_PROPERTY_PREFIX) ) { - - if((parameters.length == 0) && (returnType != Void.TYPE) && - !readHasCorrespondingIsProperty(m, c)) { - propertyType = GET_PROPERTY_PREFIX; - } - - } else if( methodName.startsWith(SET_PROPERTY_PREFIX) ) { - - if((returnType == Void.TYPE) && (parameters.length == 1)) { - if (hasCorrespondingReadProperty(m, c, GET_PROPERTY_PREFIX) || - hasCorrespondingReadProperty(m, c, IS_PROPERTY_PREFIX)) { - propertyType = SET_PROPERTY_PREFIX; - } - } - - } else if( methodName.startsWith(IS_PROPERTY_PREFIX) ) { - if((parameters.length == 0) && (returnType == Boolean.TYPE) && - !isHasCorrespondingReadProperty(m, c)) { - propertyType = IS_PROPERTY_PREFIX; - } - } - - // Some final checks that apply to all properties. - if( propertyType != null ) { - if(!validPropertyExceptions(m) || - (methodName.length() <= propertyType.length())) { - propertyType = null; - } - } - - return (propertyType != null); - } - - private boolean hasCorrespondingReadProperty - (Method writeProperty, Class c, String readPropertyPrefix) - { - String writePropertyMethodName = writeProperty.getName(); - Class[] writePropertyParameters = writeProperty.getParameterTypes(); - boolean foundReadProperty = false; - - try { - // Look for a valid corresponding Read property - String readPropertyMethodName = - writePropertyMethodName.replaceFirst - (SET_PROPERTY_PREFIX, readPropertyPrefix); - Method readPropertyMethod = c.getMethod(readPropertyMethodName, - new Class[] {}); - foundReadProperty = - ( isPropertyAccessorMethod(readPropertyMethod, c) && - (readPropertyMethod.getReturnType() == - writePropertyParameters[0]) ); - } catch(Exception e) { - // ignore. this means we didn't find a corresponding get property. - } - - return foundReadProperty; - } - - private boolean readHasCorrespondingIsProperty(Method readProperty, - Class c) - { - if (FOLLOW_RMIC) - return false ; - - String readPropertyMethodName = readProperty.getName(); - boolean foundIsProperty = false; - - try { - // Look for a valid corresponding Is property - String isPropertyMethodName = - readPropertyMethodName.replaceFirst(GET_PROPERTY_PREFIX, - IS_PROPERTY_PREFIX); - Method isPropertyMethod = c.getMethod( isPropertyMethodName, - new Class[] {}); - foundIsProperty = isPropertyAccessorMethod(isPropertyMethod, - c) ; - } catch(Exception e) { - // ignore. this means we didn't find a corresponding Is property. - } - - return foundIsProperty; - } - - private boolean isHasCorrespondingReadProperty(Method readProperty, - Class c) - { - if (!FOLLOW_RMIC) - return false ; - - String readPropertyMethodName = readProperty.getName(); - boolean foundIsProperty = false; - - try { - // Look for a valid corresponding Read property - String isPropertyMethodName = - readPropertyMethodName.replaceFirst(IS_PROPERTY_PREFIX, - GET_PROPERTY_PREFIX); - Method isPropertyMethod = c.getMethod( isPropertyMethodName, - new Class[] {}); - foundIsProperty = isPropertyAccessorMethod(isPropertyMethod, - c) ; - } catch(Exception e) { - // ignore. this means we didn't find a corresponding read property. - } - - return foundIsProperty; - } - - public String getAttributeNameForProperty(String propertyName) { - String attributeName = null; - String prefix = null; - - if( propertyName.startsWith(GET_PROPERTY_PREFIX) ) { - prefix = GET_PROPERTY_PREFIX; - } else if( propertyName.startsWith(SET_PROPERTY_PREFIX) ) { - prefix = SET_PROPERTY_PREFIX; - } else if( propertyName.startsWith(IS_PROPERTY_PREFIX) ) { - prefix = IS_PROPERTY_PREFIX; - } - - if( (prefix != null) && (prefix.length() < propertyName.length()) ) { - String remainder = propertyName.substring(prefix.length()); - if( (remainder.length() >= 2) && - Character.isUpperCase(remainder.charAt(0)) && - Character.isUpperCase(remainder.charAt(1)) ) { - // don't set the first letter to lower-case if the - // first two are upper-case - attributeName = remainder; - } else { - attributeName = Character.toLowerCase(remainder.charAt(0)) + - remainder.substring(1); - } - } - - return attributeName; - } - - /** - * Return IDL Type name for primitive types as defined in - * Section 1.3.3 of Java2IDL spec or null if not a primitive type. - */ - public IDLType getPrimitiveIDLTypeMapping(Class c) { - - if( c == null ) { - throw new IllegalArgumentException(); - } - - if( c.isPrimitive() ) { - if( c == Void.TYPE ) { - return new IDLType( c, "void" ) ; - } else if( c == Boolean.TYPE ) { - return new IDLType( c, "boolean" ) ; - } else if( c == Character.TYPE ) { - return new IDLType( c, "wchar" ) ; - } else if( c == Byte.TYPE ) { - return new IDLType( c, "octet" ) ; - } else if( c == Short.TYPE ) { - return new IDLType( c, "short" ) ; - } else if( c == Integer.TYPE ) { - return new IDLType( c, "long" ) ; - } else if( c == Long.TYPE ) { - return new IDLType( c, "long_long" ) ; - } else if( c == Float.TYPE ) { - return new IDLType( c, "float" ) ; - } else if( c == Double.TYPE ) { - return new IDLType( c, "double" ) ; - } - } - - return null; - } - - /** - * Return IDL Type name for special case type mappings as defined in - * Table 1-1 of Java2IDL spec or null if given class is not a special - * type. - */ - public IDLType getSpecialCaseIDLTypeMapping(Class c) { - - if( c == null ) { - throw new IllegalArgumentException(); - } - - if( c == java.lang.Object.class ) { - return new IDLType( c, new String[] { "java", "lang" }, - "Object" ) ; - } else if( c == java.lang.String.class ) { - return new IDLType( c, new String[] { "CORBA" }, - "WStringValue" ) ; - } else if( c == java.lang.Class.class ) { - return new IDLType( c, new String[] { "javax", "rmi", "CORBA" }, - "ClassDesc" ) ; - } else if( c == java.io.Serializable.class ) { - return new IDLType( c, new String[] { "java", "io" }, - "Serializable" ) ; - } else if( c == java.io.Externalizable.class ) { - return new IDLType( c, new String[] { "java", "io" }, - "Externalizable" ) ; - } else if( c == java.rmi.Remote.class ) { - return new IDLType( c, new String[] { "java", "rmi" }, - "Remote" ) ; - } else if( c == org.omg.CORBA.Object.class ) { - return new IDLType( c, "Object" ) ; - } else { - return null; - } - } - - /** - * Implements 1.2.3 #2 and #4 - */ - private void validateExceptions(Method method) throws IDLTypeException { - - Class[] exceptions = method.getExceptionTypes(); - - boolean declaresRemoteExceptionOrSuperClass = false; - - // Section 1.2.3, #2 - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { - Class exception = exceptions[eIndex]; - if( isRemoteExceptionOrSuperClass(exception) ) { - declaresRemoteExceptionOrSuperClass = true; - break; - } - } - - if( !declaresRemoteExceptionOrSuperClass ) { - String msg = "Method '" + method + "' must throw at least one " + - "exception of type java.rmi.RemoteException or one of its " + - "super-classes"; - throw new IDLTypeException(msg); - } - - // Section 1.2.3, #4 - // See also bug 4972402 - // For all exceptions E in exceptions, - // (isCheckedException(E) => (isValue(E) || RemoteException.isAssignableFrom( E ) ) - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { - Class exception = exceptions[eIndex]; - - if (isCheckedException(exception) && !isValue(exception) && - !isRemoteException(exception)) - { - String msg = "Exception '" + exception + "' on method '" + - method + "' is not a allowed RMI/IIOP exception type"; - throw new IDLTypeException(msg); - } - } - - return; - } - - /** - * Returns true if the method's throw clause conforms to the exception - * restrictions for properties as defined in Section 1.3.4.3 of - * Java2IDL spec. This means that for all exceptions E declared on the - * method, E isChecked => RemoteException.isAssignableFrom( E ). - */ - private boolean validPropertyExceptions(Method method) - { - Class[] exceptions = method.getExceptionTypes(); - - for(int eIndex = 0; eIndex < exceptions.length; eIndex++) { - Class exception = exceptions[eIndex]; - - if (isCheckedException(exception) && !isRemoteException(exception)) - return false ; - } - - return true; - } - - /** - * Implements Section 1.2.3, #2. - */ - private boolean isRemoteExceptionOrSuperClass(Class c) { - return - ((c == java.rmi.RemoteException.class) || - (c == java.io.IOException.class) || - (c == java.lang.Exception.class) || - (c == java.lang.Throwable.class)); - } - - /** - * Implements Section 1.2.3, #5. - */ - private void validateDirectInterfaces(Class c) throws IDLTypeException { - - Class[] directInterfaces = c.getInterfaces(); - - if( directInterfaces.length < 2 ) { - return; - } - - Set allMethodNames = new HashSet(); - Set currentMethodNames = new HashSet(); - - for(int i = 0; i < directInterfaces.length; i++) { - Class next = directInterfaces[i]; - Method[] methods = next.getMethods(); - - // Comparison is based on method names only. First collect - // all methods from current interface, eliminating duplicate - // names. - currentMethodNames.clear(); - for(int m = 0; m < methods.length; m++) { - currentMethodNames.add(methods[m].getName()); - } - - // Now check each method against list of all unique method - // names processed so far. - for(Iterator iter=currentMethodNames.iterator(); iter.hasNext();) { - String methodName = (String) iter.next(); - if( allMethodNames.contains(methodName) ) { - String msg = "Class " + c + " inherits method " + - methodName + " from multiple direct interfaces."; - throw new IDLTypeException(msg); - } else { - allMethodNames.add(methodName); - } - } - } - - return; - } - - /** - * Implements 1.2.3 #6 - */ - private void validateConstants(final Class c) - throws IDLTypeException { - - Field[] fields = null; - - try { - fields = (Field[]) - java.security.AccessController.doPrivileged - (new java.security.PrivilegedExceptionAction() { - public java.lang.Object run() throws Exception { - return c.getFields(); - } - }); - } catch(java.security.PrivilegedActionException pae) { - IDLTypeException ite = new IDLTypeException(); - ite.initCause(pae); - throw ite; - } - - for(int i = 0; i < fields.length; i++) { - Field next = fields[i]; - Class fieldType = next.getType(); - if( (fieldType != java.lang.String.class) && - !isPrimitive(fieldType) ) { - String msg = "Constant field '" + next.getName() + - "' in class '" + next.getDeclaringClass().getName() + - "' has invalid type' " + next.getType() + "'. Constants" + - " in RMI/IIOP interfaces can only have primitive" + - " types and java.lang.String types."; - throw new IDLTypeException(msg); - } - } - - - return; - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java 2018-01-30 20:19:45.000000000 -0500 +++ /dev/null 2018-01-30 20:19:45.000000000 -0500 @@ -1,168 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.presentation.rmi ; - -import java.lang.reflect.InvocationHandler ; -import java.lang.reflect.Proxy ; -import java.lang.reflect.Method ; - -import org.omg.CORBA.portable.ObjectImpl ; - -import java.io.ObjectStreamException ; -import java.io.Serializable ; - -import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ; -import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.se.spi.presentation.rmi.DynamicStub ; - -import com.sun.corba.se.spi.orbutil.proxy.LinkedInvocationHandler ; -import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ; -import com.sun.corba.se.spi.orbutil.proxy.DelegateInvocationHandlerImpl ; -import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandler ; -import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandlerImpl ; -import java.security.AccessController; -import java.security.PrivilegedAction; - -public class InvocationHandlerFactoryImpl implements InvocationHandlerFactory -{ - private final PresentationManager.ClassData classData ; - private final PresentationManager pm ; - private Class[] proxyInterfaces ; - - public InvocationHandlerFactoryImpl( PresentationManager pm, - PresentationManager.ClassData classData ) - { - this.classData = classData ; - this.pm = pm ; - - Class[] remoteInterfaces = - classData.getIDLNameTranslator().getInterfaces() ; - proxyInterfaces = new Class[ remoteInterfaces.length + 1 ] ; - for (int ctr=0; ctr() { - @Override - public Void run() { - handler.addInvocationHandler( DynamicStub.class, - dynamicStubHandler ) ; - handler.addInvocationHandler( org.omg.CORBA.Object.class, - dynamicStubHandler ) ; - handler.addInvocationHandler( Object.class, - dynamicStubHandler ) ; - return null; - } - }); - - - // If the method passed to invoke is not from DynamicStub or its superclasses, - // it must be from an implemented interface, so we just handle - // all of these with the stubMethodHandler. This used to be - // done be adding explicit entries for stubMethodHandler for - // each remote interface, but that does not work correctly - // for abstract interfaces, since the graph analysis ignores - // abstract interfaces in order to compute the type ids - // correctly (see PresentationManagerImpl.NodeImpl.getChildren). - // Rather than produce more graph traversal code to handle this - // problem, we simply use a default. - // This also points to a possible optimization: just use explict - // checks for the three special classes, rather than a general - // table lookup that usually fails. - handler.setDefaultHandler( stubMethodHandler ) ; - - return handler ; - } - - public Class[] getProxyInterfaces() - { - return proxyInterfaces ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java 2018-01-30 20:19:46.000000000 -0500 +++ /dev/null 2018-01-30 20:19:46.000000000 -0500 @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.presentation.rmi ; - -import java.lang.reflect.Field ; - -import java.util.Hashtable; - -import javax.naming.*; -import javax.naming.spi.StateFactory; - -import java.security.AccessController ; -import java.security.PrivilegedAction ; - -import javax.rmi.PortableRemoteObject ; - -import com.sun.corba.se.spi.orb.ORB; - -import java.rmi.Remote; -import java.rmi.server.ExportException; - -// XXX This creates a dependendcy on the implementation -// of the CosNaming service provider. -import com.sun.jndi.cosnaming.CNCtx ; - -import com.sun.corba.se.spi.presentation.rmi.StubAdapter ; - -/** - * StateFactory that turns java.rmi.Remote objects to org.omg.CORBA.Object. - * This version works either with standard RMI-IIOP or Dynamic RMI-IIOP. - * Based on the original com.sun.jndi.cosnaming.RemoteToCorba and - * com.sun.jndi.toolkit.corba.CorbaUtils. - * - * @author Ken Cavanaugh - */ - -public class JNDIStateFactoryImpl implements StateFactory -{ - private static final Field orbField ; - - static { - orbField = (Field) AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - Field fld = null ; - try { - Class cls = CNCtx.class ; - fld = cls.getDeclaredField( "_orb" ) ; - fld.setAccessible( true ) ; - } catch (Exception exc) { - // XXX log exception at FINE - } - return fld ; - } - } - ) ; - } - - public JNDIStateFactoryImpl() - { - } - - /** - * Returns the CORBA object for a Remote object. - * If input is not a Remote object, or if Remote object uses JRMP, return null. - * If the RMI-IIOP library is not available, throw ConfigurationException. - * - * @param orig The object to turn into a CORBA object. If not Remote, - * or if is a JRMP stub or impl, return null. - * @param name Ignored - * @param ctx The non-null CNCtx whose ORB to use. - * @param env Ignored - * @return The CORBA object for {@code orig} or null. - * @exception ConfigurationException If the CORBA object cannot be obtained - * due to configuration problems - * @exception NamingException If some other problem prevented a CORBA - * object from being obtained from the Remote object. - */ - public Object getStateToBind(Object orig, Name name, Context ctx, - Hashtable env) throws NamingException - { - if (orig instanceof org.omg.CORBA.Object) - return orig ; - - if (!(orig instanceof Remote)) - // Not for this StateFactory - return null ; - - ORB orb = getORB( ctx ) ; - if (orb == null) - // Wrong kind of context, so just give up and let another StateFactory - // try to satisfy getStateToBind. - return null ; - - Remote stub = null; - - try { - stub = PortableRemoteObject.toStub( (Remote)orig ) ; - } catch (Exception exc) { - // XXX log at FINE level? - // Wrong sort of object: just return null to allow another StateFactory - // to handle this. This can happen easily because this StateFactory - // is specified for the application, not the service context provider. - return null ; - } - - if (StubAdapter.isStub( stub )) { - try { - StubAdapter.connect( stub, orb ) ; - } catch (Exception exc) { - if (!(exc instanceof java.rmi.RemoteException)) { - // XXX log at FINE level? - // Wrong sort of object: just return null to allow another StateFactory - // to handle this call. - return null ; - } - - // ignore RemoteException because stub might have already - // been connected - } - } - - return stub ; - } - - // This is necessary because the _orb field is package private in - // com.sun.jndi.cosnaming.CNCtx. This is not an ideal solution. - // The best solution for our ORB is to change the CosNaming provider - // to use the StubAdapter. But this has problems as well, because - // other vendors may use the CosNaming provider with a different ORB - // entirely. - private ORB getORB( Context ctx ) - { - ORB orb = null ; - - try { - orb = (ORB)orbField.get( ctx ) ; - } catch (Exception exc) { - // XXX log this exception at FINE level - // ignore the exception and return null. - // Note that the exception may be because ctx - // is not a CosNaming context. - } - - return orb ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/PresentationManagerImpl.java 2018-01-30 20:19:46.000000000 -0500 +++ /dev/null 2018-01-30 20:19:47.000000000 -0500 @@ -1,325 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.presentation.rmi ; - -import java.util.Map ; -import java.util.HashMap ; -import java.util.Set ; -import java.util.HashSet ; -import java.util.List ; -import java.util.ArrayList ; -import java.util.Iterator ; - -import java.lang.reflect.Method ; - -import java.rmi.Remote ; - -import javax.rmi.CORBA.Tie ; - -import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ; - -import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ; -import com.sun.corba.se.spi.presentation.rmi.DynamicMethodMarshaller ; -import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -import com.sun.corba.se.impl.presentation.rmi.IDLNameTranslatorImpl ; -import com.sun.corba.se.impl.presentation.rmi.StubFactoryProxyImpl ; - -import com.sun.corba.se.impl.orbutil.graph.Node ; -import com.sun.corba.se.impl.orbutil.graph.Graph ; -import com.sun.corba.se.impl.orbutil.graph.GraphImpl ; - -public final class PresentationManagerImpl implements PresentationManager -{ - private Map classToClassData ; - private Map methodToDMM ; - private PresentationManager.StubFactoryFactory staticStubFactoryFactory ; - private PresentationManager.StubFactoryFactory dynamicStubFactoryFactory ; - private ORBUtilSystemException wrapper = null ; - private boolean useDynamicStubs ; - - public PresentationManagerImpl( boolean useDynamicStubs ) - { - this.useDynamicStubs = useDynamicStubs ; - wrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_PRESENTATION ) ; - - // XXX these should probably be WeakHashMaps. - classToClassData = new HashMap() ; - methodToDMM = new HashMap() ; - } - -//////////////////////////////////////////////////////////////////////////////// -// PresentationManager interface -//////////////////////////////////////////////////////////////////////////////// - - public synchronized DynamicMethodMarshaller getDynamicMethodMarshaller( - Method method ) - { - if (method == null) - return null ; - - DynamicMethodMarshaller result = - (DynamicMethodMarshaller)methodToDMM.get( method ) ; - if (result == null) { - result = new DynamicMethodMarshallerImpl( method ) ; - methodToDMM.put( method, result ) ; - } - - return result ; - } - - public synchronized ClassData getClassData( Class cls ) - { - ClassData result = (ClassData)classToClassData.get( cls ) ; - if (result == null) { - result = new ClassDataImpl( cls ) ; - classToClassData.put( cls, result ) ; - } - - return result ; - } - - private class ClassDataImpl implements PresentationManager.ClassData - { - private Class cls ; - private IDLNameTranslator nameTranslator ; - private String[] typeIds ; - private PresentationManager.StubFactory sfactory ; - private InvocationHandlerFactory ihfactory ; - private Map dictionary ; - - public ClassDataImpl( Class cls ) - { - this.cls = cls ; - Graph gr = new GraphImpl() ; - NodeImpl root = new NodeImpl( cls ) ; - Set rootSet = getRootSet( cls, root, gr ) ; - - // At this point, rootSet contains those remote interfaces - // that are not related by inheritance, and gr contains - // all reachable remote interfaces. - - Class[] interfaces = getInterfaces( rootSet ) ; - nameTranslator = IDLNameTranslatorImpl.get( interfaces ) ; - typeIds = makeTypeIds( root, gr, rootSet ) ; - ihfactory = new InvocationHandlerFactoryImpl( - PresentationManagerImpl.this, this ) ; - dictionary = new HashMap() ; - } - - public Class getMyClass() - { - return cls ; - } - - public IDLNameTranslator getIDLNameTranslator() - { - return nameTranslator ; - } - - public String[] getTypeIds() - { - return typeIds ; - } - - public InvocationHandlerFactory getInvocationHandlerFactory() - { - return ihfactory ; - } - - public Map getDictionary() - { - return dictionary ; - } - } - - public PresentationManager.StubFactoryFactory getStubFactoryFactory( - boolean isDynamic ) - { - if (isDynamic) - return dynamicStubFactoryFactory ; - else - return staticStubFactoryFactory ; - } - - public void setStubFactoryFactory( boolean isDynamic, - PresentationManager.StubFactoryFactory sff ) - { - if (isDynamic) - dynamicStubFactoryFactory = sff ; - else - staticStubFactoryFactory = sff ; - } - - public Tie getTie() - { - return dynamicStubFactoryFactory.getTie( null ) ; - } - - public boolean useDynamicStubs() - { - return useDynamicStubs ; - } - -//////////////////////////////////////////////////////////////////////////////// -// Graph computations -//////////////////////////////////////////////////////////////////////////////// - - private Set getRootSet( Class target, NodeImpl root, Graph gr ) - { - Set rootSet = null ; - - if (target.isInterface()) { - gr.add( root ) ; - rootSet = gr.getRoots() ; // rootSet just contains root here - } else { - // Use this class and its superclasses (not Object) as initial roots - Class superclass = target ; - Set initialRootSet = new HashSet() ; - while ((superclass != null) && !superclass.equals( Object.class )) { - Node node = new NodeImpl( superclass ) ; - gr.add( node ) ; - initialRootSet.add( node ) ; - superclass = superclass.getSuperclass() ; - } - - // Expand all nodes into the graph - gr.getRoots() ; - - // remove the roots and find roots again - gr.removeAll( initialRootSet ) ; - rootSet = gr.getRoots() ; - } - - return rootSet ; - } - - private Class[] getInterfaces( Set roots ) - { - Class[] classes = new Class[ roots.size() ] ; - Iterator iter = roots.iterator() ; - int ctr = 0 ; - while (iter.hasNext()) { - NodeImpl node = (NodeImpl)iter.next() ; - classes[ctr++] = node.getInterface() ; - } - - return classes ; - } - - private String[] makeTypeIds( NodeImpl root, Graph gr, Set rootSet ) - { - Set nonRootSet = new HashSet( gr ) ; - nonRootSet.removeAll( rootSet ) ; - - // List for the typeids - List result = new ArrayList() ; - - if (rootSet.size() > 1) { - // If the rootSet has more than one element, we must - // put the type id of the implementation class first. - // Root represents the implementation class here. - result.add( root.getTypeId() ) ; - } - - addNodes( result, rootSet ) ; - addNodes( result, nonRootSet ) ; - - return (String[])result.toArray( new String[result.size()] ) ; - } - - private void addNodes( List resultList, Set nodeSet ) - { - Iterator iter = nodeSet.iterator() ; - while (iter.hasNext()) { - NodeImpl node = (NodeImpl)iter.next() ; - String typeId = node.getTypeId() ; - resultList.add( typeId ) ; - } - } - - private static class NodeImpl implements Node - { - private Class interf ; - - public Class getInterface() - { - return interf ; - } - - public NodeImpl( Class interf ) - { - this.interf = interf ; - } - - public String getTypeId() - { - return "RMI:" + interf.getName() + ":0000000000000000" ; - } - - public Set getChildren() - { - Set result = new HashSet() ; - Class[] interfaces = interf.getInterfaces() ; - for (int ctr=0; ctr() { - @Override - public StubFactoryProxyImpl run() { - return new StubFactoryProxyImpl(classData, classLoader); - } - }); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java 2018-01-30 20:19:52.000000000 -0500 +++ /dev/null 2018-01-30 20:19:52.000000000 -0500 @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.presentation.rmi; - -import javax.rmi.CORBA.Util; -import javax.rmi.CORBA.Tie ; - -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.presentation.rmi.PresentationManager; - -import com.sun.corba.se.impl.util.PackagePrefixChecker; -import com.sun.corba.se.impl.util.Utility; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public class StubFactoryFactoryStaticImpl extends - StubFactoryFactoryBase -{ - private ORBUtilSystemException wrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_PRESENTATION ) ; - - public PresentationManager.StubFactory createStubFactory( - String className, boolean isIDLStub, String remoteCodeBase, Class - expectedClass, ClassLoader classLoader) - { - String stubName = null ; - - if (isIDLStub) - stubName = Utility.idlStubName( className ) ; - else - stubName = Utility.stubNameForCompiler( className ) ; - - ClassLoader expectedTypeClassLoader = - (expectedClass == null ? classLoader : - expectedClass.getClassLoader()); - - // The old code was optimized to try to guess which way to load classes - // first. The real stub class name could either be className or - // "org.omg.stub." + className. We will compute this as follows: - // If stubName starts with a "forbidden" package, try the prefixed - // version first, otherwise try the non-prefixed version first. - // In any case, try both forms if necessary. - - String firstStubName = stubName ; - String secondStubName = stubName ; - - if (PackagePrefixChecker.hasOffendingPrefix(stubName)) - firstStubName = PackagePrefixChecker.packagePrefix() + stubName ; - else - secondStubName = PackagePrefixChecker.packagePrefix() + stubName ; - - Class clz = null; - - try { - clz = Util.loadClass( firstStubName, remoteCodeBase, - expectedTypeClassLoader ) ; - } catch (ClassNotFoundException e1) { - // log only at FINE level - wrapper.classNotFound1( CompletionStatus.COMPLETED_MAYBE, - e1, firstStubName ) ; - try { - clz = Util.loadClass( secondStubName, remoteCodeBase, - expectedTypeClassLoader ) ; - } catch (ClassNotFoundException e2) { - throw wrapper.classNotFound2( - CompletionStatus.COMPLETED_MAYBE, e2, secondStubName ) ; - } - } - - // XXX Is this step necessary, or should the Util.loadClass - // algorithm always produce a valid class if the setup is correct? - // Does the OMG standard algorithm need to be changed to include - // this step? - if ((clz == null) || - ((expectedClass != null) && !expectedClass.isAssignableFrom(clz))) { - try { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (cl == null) - cl = ClassLoader.getSystemClassLoader(); - - clz = cl.loadClass(className); - } catch (Exception exc) { - // XXX make this a system exception - IllegalStateException ise = new IllegalStateException( - "Could not load class " + stubName ) ; - ise.initCause( exc ) ; - throw ise ; - } - } - - return new StubFactoryStaticImpl( clz ) ; - } - - public Tie getTie( Class cls ) - { - Class tieClass = null ; - String className = Utility.tieName(cls.getName()); - - // XXX log exceptions at FINE level - try { - try { - //_REVISIT_ The spec does not specify a loadingContext parameter for - //the following call. Would it be useful to pass one? - tieClass = Utility.loadClassForClass(className, Util.getCodebase(cls), - null, cls, cls.getClassLoader()); - return (Tie) tieClass.newInstance(); - } catch (Exception err) { - tieClass = Utility.loadClassForClass( - PackagePrefixChecker.packagePrefix() + className, - Util.getCodebase(cls), null, cls, cls.getClassLoader()); - return (Tie) tieClass.newInstance(); - } - } catch (Exception err) { - return null; - } - - } - - public boolean createsDynamicStubs() - { - return false ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryProxyImpl.java 2018-01-30 20:19:52.000000000 -0500 +++ /dev/null 2018-01-30 20:19:52.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.presentation.rmi ; - -import java.lang.reflect.Proxy ; - -import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.se.spi.presentation.rmi.DynamicStub ; - -import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ; -import com.sun.corba.se.spi.orbutil.proxy.LinkedInvocationHandler ; - -public class StubFactoryProxyImpl extends StubFactoryDynamicBase -{ - public StubFactoryProxyImpl( PresentationManager.ClassData classData, - ClassLoader loader ) - { - super( classData, loader ) ; - } - - public org.omg.CORBA.Object makeStub() - { - // Construct the dynamic proxy that implements this stub - // using the composite handler - InvocationHandlerFactory factory = classData.getInvocationHandlerFactory() ; - LinkedInvocationHandler handler = - (LinkedInvocationHandler)factory.getInvocationHandler() ; - Class[] interfaces = factory.getProxyInterfaces() ; - DynamicStub stub = (DynamicStub)Proxy.newProxyInstance( loader, interfaces, - handler ) ; - handler.setProxy( (Proxy)stub ) ; - return stub ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryStaticImpl.java 2018-01-30 20:19:53.000000000 -0500 +++ /dev/null 2018-01-30 20:19:53.000000000 -0500 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.presentation.rmi; - -import java.lang.reflect.InvocationHandler ; - -import com.sun.corba.se.spi.presentation.rmi.PresentationManager; - -public class StubFactoryStaticImpl extends StubFactoryBase -{ - private Class stubClass ; - - public StubFactoryStaticImpl(Class cls) - { - super( null ) ; - this.stubClass = cls; - } - - public org.omg.CORBA.Object makeStub() - { - org.omg.CORBA.Object stub = null; - try { - stub = (org.omg.CORBA.Object) stubClass.newInstance(); - } catch (InstantiationException e) { - throw new RuntimeException(e); - } catch (IllegalAccessException e) { - throw new RuntimeException(e); - } - return stub ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubInvocationHandlerImpl.java 2018-01-30 20:19:54.000000000 -0500 +++ /dev/null 2018-01-30 20:19:54.000000000 -0500 @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2003, 2006, 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.corba.se.impl.presentation.rmi ; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -import java.lang.reflect.Method ; -import java.lang.reflect.InvocationHandler ; -import java.lang.reflect.Proxy ; -import java.lang.reflect.InvocationTargetException ; - -import java.io.ObjectInputStream ; -import java.io.ObjectOutputStream ; -import java.io.IOException ; - -import java.rmi.Remote ; - -import javax.rmi.CORBA.Util ; - -import org.omg.CORBA.portable.ObjectImpl ; -import org.omg.CORBA.portable.Delegate ; -import org.omg.CORBA.portable.ServantObject ; -import org.omg.CORBA.portable.ApplicationException ; -import org.omg.CORBA.portable.RemarshalException ; - -import org.omg.CORBA.SystemException ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.pept.transport.ContactInfoList ; - -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; - -import com.sun.corba.se.spi.protocol.CorbaClientDelegate ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; - -import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ; -import com.sun.corba.se.spi.presentation.rmi.DynamicMethodMarshaller ; -import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter ; - -import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ; -import com.sun.corba.se.spi.orbutil.proxy.LinkedInvocationHandler ; - -import com.sun.corba.se.impl.corba.CORBAObjectImpl ; - -public final class StubInvocationHandlerImpl implements LinkedInvocationHandler -{ - private transient PresentationManager.ClassData classData ; - private transient PresentationManager pm ; - private transient org.omg.CORBA.Object stub ; - private transient Proxy self ; - - public void setProxy( Proxy self ) - { - this.self = self ; - } - - public Proxy getProxy() - { - return self ; - } - - public StubInvocationHandlerImpl( PresentationManager pm, - PresentationManager.ClassData classData, org.omg.CORBA.Object stub ) - { - SecurityManager s = System.getSecurityManager(); - if (s != null) { - s.checkPermission(new DynamicAccessPermission("access")); - } - this.classData = classData ; - this.pm = pm ; - this.stub = stub ; - } - - private boolean isLocal() - { - boolean result = false ; - Delegate delegate = StubAdapter.getDelegate( stub ) ; - - if (delegate instanceof CorbaClientDelegate) { - CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ; - ContactInfoList cil = cdel.getContactInfoList() ; - if (cil instanceof CorbaContactInfoList) { - CorbaContactInfoList ccil = (CorbaContactInfoList)cil ; - LocalClientRequestDispatcher lcrd = - ccil.getLocalClientRequestDispatcher() ; - result = lcrd.useLocalInvocation( null ) ; - } - } - - return result ; - } - - /** Invoke the given method with the args and return the result. - * This may result in a remote invocation. - * @param proxy The proxy used for this class (null if not using java.lang.reflect.Proxy) - */ - public Object invoke( Object proxy, final Method method, - Object[] args ) throws Throwable - { - String giopMethodName = classData.getIDLNameTranslator(). - getIDLName( method ) ; - DynamicMethodMarshaller dmm = - pm.getDynamicMethodMarshaller( method ) ; - - Delegate delegate = null ; - try { - delegate = StubAdapter.getDelegate( stub ) ; - } catch (SystemException ex) { - throw Util.mapSystemException(ex) ; - } - - if (!isLocal()) { - try { - org.omg.CORBA_2_3.portable.InputStream in = null ; - try { - // create request - org.omg.CORBA_2_3.portable.OutputStream out = - (org.omg.CORBA_2_3.portable.OutputStream) - delegate.request( stub, giopMethodName, true); - - // marshal arguments - dmm.writeArguments( out, args ) ; - - // finish invocation - in = (org.omg.CORBA_2_3.portable.InputStream) - delegate.invoke( stub, out); - - // unmarshal result - return dmm.readResult( in ) ; - } catch (ApplicationException ex) { - throw dmm.readException( ex ) ; - } catch (RemarshalException ex) { - return invoke( proxy, method, args ) ; - } finally { - delegate.releaseReply( stub, in ); - } - } catch (SystemException ex) { - throw Util.mapSystemException(ex) ; - } - } else { - // local branch - ORB orb = (ORB)delegate.orb( stub ) ; - ServantObject so = delegate.servant_preinvoke( stub, giopMethodName, - method.getDeclaringClass() ); - if (so == null) { - return invoke( stub, method, args ) ; - } - try { - Object[] copies = dmm.copyArguments( args, orb ) ; - - if (!method.isAccessible()) { - // Make sure that we can invoke a method from a normally - // inaccessible package, as this reflective class must always - // be able to invoke a non-public method. - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - method.setAccessible( true ) ; - return null ; - } - } ) ; - } - - Object result = method.invoke( so.servant, copies ) ; - - return dmm.copyResult( result, orb ) ; - } catch (InvocationTargetException ex) { - Throwable mex = ex.getCause() ; - // mex should never be null, as null cannot be thrown - Throwable exCopy = (Throwable)Util.copyObject(mex,orb); - if (dmm.isDeclaredException( exCopy )) - throw exCopy ; - else - throw Util.wrapException(exCopy); - } catch (Throwable thr) { - if (thr instanceof ThreadDeath) - throw (ThreadDeath)thr ; - - // This is not a user thrown exception from the - // method call, so don't copy it. This is either - // an error or a reflective invoke exception. - throw Util.wrapException( thr ) ; - } finally { - delegate.servant_postinvoke( stub, so); - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/jndi.properties 2018-01-30 20:19:54.000000000 -0500 +++ /dev/null 2018-01-30 20:19:54.000000000 -0500 @@ -1,3 +0,0 @@ -# Required to add a javax.naming.spi.StateFactory for CosNaming that -# supports dynamic RMI-IIOP. -java.naming.factory.state=com.sun.corba.se.impl.presentation.rmi.JNDIStateFactoryImpl --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/AddressingDispositionException.java 2018-01-30 20:19:55.000000000 -0500 +++ /dev/null 2018-01-30 20:19:55.000000000 -0500 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.impl.protocol; - -import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr; - -/** - * This exception is thrown while reading GIOP 1.2 Request, LocateRequest - * to indicate that a TargetAddress disposition is unacceptable. - * If this exception is caught explicitly, this need to be rethrown. This - * is eventually handled within RequestPRocessor and an appropriate reply - * is sent back to the client. - * - * GIOP 1.2 allows three dispositions : KeyAddr (ObjectKey), ProfileAddr (ior - * profile), IORAddressingInfo (IOR). If the ORB does not support the - * disposition contained in the GIOP Request / LocateRequest 1.2 message, - * then it sends a Reply / LocateReply indicating the correct disposition, - * which the client ORB shall use to transparently retry the request - * with the correct disposition. - * - */ -public class AddressingDispositionException extends RuntimeException { - - private short expectedAddrDisp = KeyAddr.value; - - public AddressingDispositionException(short expectedAddrDisp) { - this.expectedAddrDisp = expectedAddrDisp; - } - - public short expectedAddrDisp() { - return this.expectedAddrDisp; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/BootstrapServerRequestDispatcher.java 2018-01-30 20:19:56.000000000 -0500 +++ /dev/null 2018-01-30 20:19:56.000000000 -0500 @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol ; - -import java.util.Iterator ; - -import org.omg.CORBA.SystemException ; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.ObjectKey ; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.impl.encoding.MarshalInputStream ; -import com.sun.corba.se.impl.encoding.MarshalOutputStream ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * Class BootstrapServerRequestDispatcher handles the requests coming to the - * BootstrapServer. It implements Server so that it can be registered - * as a subcontract. It is passed a BootstrapServiceProperties object - * which contains - * the supported ids and their values for the bootstrap service. This - * Properties object is only read from, never written to, and is shared - * among all threads. - *

- * The BootstrapServerRequestDispatcher responds primarily to GIOP requests, - * but LocateRequests are also handled for graceful interoperability. - * The BootstrapServerRequestDispatcher handles one request at a time. - */ -public class BootstrapServerRequestDispatcher - implements CorbaServerRequestDispatcher -{ - private ORB orb; - - ORBUtilSystemException wrapper ; - - private static final boolean debug = false; - - public BootstrapServerRequestDispatcher(ORB orb ) - { - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - /** - * Dispatch is called by the ORB and will serve get(key) and list() - * invocations on the initial object key. - */ - public void dispatch(MessageMediator messageMediator) - { - CorbaMessageMediator request = (CorbaMessageMediator) messageMediator; - CorbaMessageMediator response = null; - - try { - MarshalInputStream is = (MarshalInputStream) - request.getInputObject(); - String method = request.getOperationName(); - response = request.getProtocolHandler().createResponse(request, null); - MarshalOutputStream os = (MarshalOutputStream) - response.getOutputObject(); - - if (method.equals("get")) { - // Get the name of the requested service - String serviceKey = is.read_string(); - - // Look it up - org.omg.CORBA.Object serviceObject = - orb.getLocalResolver().resolve( serviceKey ) ; - - // Write reply value - os.write_Object(serviceObject); - } else if (method.equals("list")) { - java.util.Set keys = orb.getLocalResolver().list() ; - os.write_long( keys.size() ) ; - Iterator iter = keys.iterator() ; - while (iter.hasNext()) { - String obj = (String)iter.next() ; - os.write_string( obj ) ; - } - } else { - throw wrapper.illegalBootstrapOperation( method ) ; - } - - } catch (org.omg.CORBA.SystemException ex) { - // Marshal the exception thrown - response = request.getProtocolHandler().createSystemExceptionResponse( - request, ex, null); - } catch (java.lang.RuntimeException ex) { - // Unknown exception - SystemException sysex = wrapper.bootstrapRuntimeException( ex ) ; - response = request.getProtocolHandler().createSystemExceptionResponse( - request, sysex, null ) ; - } catch (java.lang.Exception ex) { - // Unknown exception - SystemException sysex = wrapper.bootstrapException( ex ) ; - response = request.getProtocolHandler().createSystemExceptionResponse( - request, sysex, null ) ; - } - - return; - } - - /** - * Locates the object mentioned in the locate requests, and returns - * object here iff the object is the initial object key. A SystemException - * thrown if the object key is not the initial object key. - */ - public IOR locate( ObjectKey objectKey) { - return null; - } - - /** - * Not implemented - */ - public int getId() { - throw wrapper.genericNoImpl() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientDelegateImpl.java 2018-01-30 20:19:56.000000000 -0500 +++ /dev/null 2018-01-30 20:19:56.000000000 -0500 @@ -1,443 +0,0 @@ -/* - * Copyright (c) 2001, 2004, 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.corba.se.impl.protocol; - -import java.util.Iterator; -import java.util.HashMap; - -import javax.rmi.CORBA.Tie; - -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.Context; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.NVList; -import org.omg.CORBA.Request; -import org.omg.CORBA.TypeCode; - -import org.omg.CORBA.portable.ApplicationException; -import org.omg.CORBA.portable.Delegate; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.portable.RemarshalException; -import org.omg.CORBA.portable.ServantObject; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.ClientInvocationInfo; -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.ContactInfoList; -import com.sun.corba.se.pept.transport.ContactInfoListIterator; - -import com.sun.corba.se.spi.presentation.rmi.StubAdapter; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.protocol.CorbaClientDelegate ; -import com.sun.corba.se.spi.transport.CorbaContactInfo; -import com.sun.corba.se.spi.transport.CorbaContactInfoList; -import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator; - -import com.sun.corba.se.impl.corba.RequestImpl; -import com.sun.corba.se.impl.protocol.CorbaInvocationInfo; -import com.sun.corba.se.impl.transport.CorbaContactInfoListImpl; -import com.sun.corba.se.impl.util.JDKBridge; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -// implements com.sun.corba.se.impl.core.ClientRequestDispatcher -// so RMI-IIOP Util.isLocal can call ClientRequestDispatcher.useLocalInvocation. - -/** - * @author Harold Carr - */ -public class CorbaClientDelegateImpl extends CorbaClientDelegate -{ - private ORB orb; - private ORBUtilSystemException wrapper ; - - private CorbaContactInfoList contactInfoList; - - public CorbaClientDelegateImpl(ORB orb, - CorbaContactInfoList contactInfoList) - { - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - this.contactInfoList = contactInfoList; - } - - // - // framework.subcontract.Delegate - // - - public Broker getBroker() - { - return orb; - } - - public ContactInfoList getContactInfoList() - { - return contactInfoList; - } - - // - // CORBA_2_3.portable.Delegate - // - - public OutputStream request(org.omg.CORBA.Object self, - String operation, - boolean responseExpected) - { - ClientInvocationInfo invocationInfo = - orb.createOrIncrementInvocationInfo(); - Iterator contactInfoListIterator = - invocationInfo.getContactInfoListIterator(); - if (contactInfoListIterator == null) { - contactInfoListIterator = contactInfoList.iterator(); - invocationInfo.setContactInfoListIterator(contactInfoListIterator); - } - if (! contactInfoListIterator.hasNext()) { - throw ((CorbaContactInfoListIterator)contactInfoListIterator) - .getFailureException(); - } - CorbaContactInfo contactInfo = (CorbaContactInfo) contactInfoListIterator.next(); - ClientRequestDispatcher subcontract = contactInfo.getClientRequestDispatcher(); - // Remember chosen subcontract for invoke and releaseReply. - // NOTE: This is necessary since a stream is not available in - // releaseReply if there is a client marshaling error or an - // error in _invoke. - invocationInfo.setClientRequestDispatcher(subcontract); - return (OutputStream) - subcontract.beginRequest(self, operation, - !responseExpected, contactInfo); - } - - public InputStream invoke(org.omg.CORBA.Object self, OutputStream output) - throws - ApplicationException, - RemarshalException - { - ClientRequestDispatcher subcontract = getClientRequestDispatcher(); - return (InputStream) - subcontract.marshalingComplete((Object)self, (OutputObject)output); - } - - public void releaseReply(org.omg.CORBA.Object self, InputStream input) - { - // NOTE: InputStream may be null (e.g., exception request from PI). - ClientRequestDispatcher subcontract = getClientRequestDispatcher(); - subcontract.endRequest(orb, self, (InputObject)input); - orb.releaseOrDecrementInvocationInfo(); - } - - private ClientRequestDispatcher getClientRequestDispatcher() - { - return (ClientRequestDispatcher) - ((CorbaInvocationInfo)orb.getInvocationInfo()) - .getClientRequestDispatcher(); - } - - public org.omg.CORBA.Object get_interface_def(org.omg.CORBA.Object obj) - { - InputStream is = null; - // instantiate the stub - org.omg.CORBA.Object stub = null ; - - try { - OutputStream os = request(null, "_interface", true); - is = (InputStream) invoke((org.omg.CORBA.Object)null, os); - - org.omg.CORBA.Object objimpl = - (org.omg.CORBA.Object) is.read_Object(); - - // check if returned object is of correct type - if ( !objimpl._is_a("IDL:omg.org/CORBA/InterfaceDef:1.0") ) - throw wrapper.wrongInterfaceDef(CompletionStatus.COMPLETED_MAYBE); - - try { - stub = (org.omg.CORBA.Object) - JDKBridge.loadClass("org.omg.CORBA._InterfaceDefStub"). - newInstance(); - } catch (Exception ex) { - throw wrapper.noInterfaceDefStub( ex ) ; - } - - org.omg.CORBA.portable.Delegate del = - StubAdapter.getDelegate( objimpl ) ; - StubAdapter.setDelegate( stub, del ) ; - } catch (ApplicationException e) { - // This cannot happen. - throw wrapper.applicationExceptionInSpecialMethod( e ) ; - } catch (RemarshalException e) { - return get_interface_def(obj); - } finally { - releaseReply((org.omg.CORBA.Object)null, (InputStream)is); - } - - return stub; - } - - public boolean is_a(org.omg.CORBA.Object obj, String dest) - { - // dest is the typeId of the interface to compare against. - // repositoryIds is the list of typeIds that the stub knows about. - - // First we look for an answer using local information. - - String [] repositoryIds = StubAdapter.getTypeIds( obj ) ; - String myid = contactInfoList.getTargetIOR().getTypeId(); - if ( dest.equals(myid) ) { - return true; - } - for ( int i=0; i maximum ) - return 0; - return h; - } - - public Request request(org.omg.CORBA.Object obj, String operation) - { - return new RequestImpl(orb, obj, null, operation, null, null, null, - null); - } - - public Request create_request(org.omg.CORBA.Object obj, - Context ctx, - String operation, - NVList arg_list, - NamedValue result) - { - return new RequestImpl(orb, obj, ctx, operation, arg_list, - result, null, null); - } - - public Request create_request(org.omg.CORBA.Object obj, - Context ctx, - String operation, - NVList arg_list, - NamedValue result, - ExceptionList exclist, - ContextList ctxlist) - { - return new RequestImpl(orb, obj, ctx, operation, arg_list, result, - exclist, ctxlist); - } - - public org.omg.CORBA.ORB orb(org.omg.CORBA.Object obj) - { - return this.orb; - } - - /** - * Returns true if this object is implemented by a local servant. - * - * REVISIT: locatedIOR should be replaced with a method call that - * returns the current IOR for this request (e.g. ContactInfoChooser). - * - * @param self The object reference which delegated to this delegate. - * @return true only if the servant incarnating this object is located in - * this ORB. - */ - public boolean is_local(org.omg.CORBA.Object self) - { - // XXX this need to check isNextCallValid - return contactInfoList.getEffectiveTargetIOR().getProfile(). - isLocal(); - } - - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType) - { - return - contactInfoList.getLocalClientRequestDispatcher() - .servant_preinvoke(self, operation, expectedType); - } - - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servant) - { - contactInfoList.getLocalClientRequestDispatcher() - .servant_postinvoke(self, servant); - } - - // XXX Should this be public? - /* Returns the codebase for object reference provided. - * @param self the object reference whose codebase needs to be returned. - * @return the codebase as a space delimited list of url strings or - * null if none. - */ - public String get_codebase(org.omg.CORBA.Object self) - { - if (contactInfoList.getTargetIOR() != null) { - return contactInfoList.getTargetIOR().getProfile().getCodebase(); - } - return null; - } - - public String toString(org.omg.CORBA.Object self) - { - return contactInfoList.getTargetIOR().stringify(); - } - - //////////////////////////////////////////////////// - // - // java.lang.Object - // - - public int hashCode() - { - return this.contactInfoList.hashCode(); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java 2018-01-30 20:19:57.000000000 -0500 +++ /dev/null 2018-01-30 20:19:57.000000000 -0500 @@ -1,1053 +0,0 @@ -/* - * Copyright (c) 2001, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.protocol; - -import java.io.IOException; -import java.util.Iterator; -import java.rmi.RemoteException; - -import javax.rmi.CORBA.Util; -import javax.rmi.CORBA.Tie; - -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.Request; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.NVList; -import org.omg.CORBA.Context; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.RemarshalException; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA.portable.Delegate; -import org.omg.CORBA.portable.ServantObject; -import org.omg.CORBA.portable.ApplicationException; -import org.omg.CORBA.portable.UnknownException; -import org.omg.IOP.ExceptionDetailMessage; -import org.omg.IOP.TAG_CODE_SETS; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.OutboundConnectionCache; -import com.sun.corba.se.pept.transport.ContactInfo; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate; -import com.sun.corba.se.spi.ior.iiop.CodeSetsComponent; -import com.sun.corba.se.spi.oa.OAInvocationInfo; -import com.sun.corba.se.spi.oa.ObjectAdapterFactory; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersion; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry; -import com.sun.corba.se.spi.transport.CorbaContactInfo ; -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; -import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator ; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext; -import com.sun.corba.se.spi.servicecontext.ServiceContext; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext; -import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext; -import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext; -import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext; -import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext; -import com.sun.corba.se.spi.servicecontext.UnknownServiceContext; - -import com.sun.corba.se.impl.encoding.CDRInputObject; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.EncapsInputStream; -import com.sun.corba.se.impl.encoding.MarshalOutputStream; -import com.sun.corba.se.impl.encoding.MarshalInputStream; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr; -import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl; -import com.sun.corba.se.impl.util.JDKBridge; - -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ConcurrentHashMap; -import sun.corba.EncapsInputStreamFactory; - -/** - * ClientDelegate is the RMI client-side subcontract or representation - * It implements RMI delegate as well as our internal ClientRequestDispatcher - * interface. - */ -public class CorbaClientRequestDispatcherImpl - implements - ClientRequestDispatcher -{ - private ConcurrentMap locks = - new ConcurrentHashMap(); - - public OutputObject beginRequest(Object self, String opName, - boolean isOneWay, ContactInfo contactInfo) - { - ORB orb = null; - try { - CorbaContactInfo corbaContactInfo = (CorbaContactInfo) contactInfo; - orb = (ORB)contactInfo.getBroker(); - - if (orb.subcontractDebugFlag) { - dprint(".beginRequest->: op/" + opName); - } - - // - // Portable Interceptor initialization. - // - - orb.getPIHandler().initiateClientPIRequest( false ); - - // - // Connection. - // - - CorbaConnection connection = null; - - // This locking is done so that multiple connections are not created - // for the same endpoint - // 7046238 - Synchronization on a single monitor for contactInfo parameters - // with identical hashCode(), so we lock on same monitor for equal parameters - // (which can refer to equal (in terms of equals()) but not the same objects) - - Object lock = locks.get(contactInfo); - - if (lock == null) { - Object newLock = new Object(); - lock = locks.putIfAbsent(contactInfo, newLock); - if (lock == null) { - lock = newLock; - } - } - - synchronized (lock) { - if (contactInfo.isConnectionBased()) { - if (contactInfo.shouldCacheConnection()) { - connection = (CorbaConnection) - orb.getTransportManager() - .getOutboundConnectionCache(contactInfo).get(contactInfo); - } - if (connection != null) { - if (orb.subcontractDebugFlag) { - dprint(".beginRequest: op/" + opName - + ": Using cached connection: " + connection); - } - } else { - try { - connection = (CorbaConnection) - contactInfo.createConnection(); - if (orb.subcontractDebugFlag) { - dprint(".beginRequest: op/" + opName - + ": Using created connection: " + connection); - } - } catch (RuntimeException e) { - if (orb.subcontractDebugFlag) { - dprint(".beginRequest: op/" + opName - + ": failed to create connection: " + e); - } - // REVISIT: this part similar to marshalingComplete below. - boolean retry = getContactInfoListIterator(orb) - .reportException(contactInfo, e); - // REVISIT: - // this part similar to Remarshal in this method below - if (retry) { - if(getContactInfoListIterator(orb).hasNext()) { - contactInfo = (ContactInfo) - getContactInfoListIterator(orb).next(); - unregisterWaiter(orb); - return beginRequest(self, opName, - isOneWay, contactInfo); - } else { - throw e; - } - } else { - throw e; - } - } - if (connection.shouldRegisterReadEvent()) { - // REVISIT: cast - orb.getTransportManager().getSelector(0) - .registerForEvent(connection.getEventHandler()); - connection.setState("ESTABLISHED"); - } - // Do not do connection reclaim here since the connections - // are marked in use by registerWaiter() call and since this - // call happens later do it after that. - if (contactInfo.shouldCacheConnection()) { - OutboundConnectionCache connectionCache = - orb.getTransportManager() - .getOutboundConnectionCache(contactInfo); - connectionCache.stampTime(connection); - connectionCache.put(contactInfo, connection); - // connectionCache.reclaim(); - } - } - } - } - - CorbaMessageMediator messageMediator = (CorbaMessageMediator) - contactInfo.createMessageMediator( - orb, contactInfo, connection, opName, isOneWay); - if (orb.subcontractDebugFlag) { - dprint(".beginRequest: " + opAndId(messageMediator) - + ": created message mediator: " + messageMediator); - } - - // NOTE: Thread data so we can get the mediator in release reply - // in order to remove the waiter in CorbaConnection. - // We cannot depend on obtaining information in releaseReply - // via its InputStream argument since, on certain errors - // (e.g., client marshaling errors), the stream may be null. - // Likewise for releaseReply "self". - // NOTE: This must be done before initializing the message since - // that may start sending fragments which may end up in "early" - // replies or client marshaling exceptions. - - orb.getInvocationInfo().setMessageMediator(messageMediator); - - if (connection != null && connection.getCodeSetContext() == null) { - performCodeSetNegotiation(messageMediator); - } - - addServiceContexts(messageMediator); - - OutputObject outputObject = - contactInfo.createOutputObject(messageMediator); - if (orb.subcontractDebugFlag) { - dprint(".beginRequest: " + opAndId(messageMediator) - + ": created output object: " + outputObject); - } - - - // NOTE: Not necessary for oneways, but useful for debugging. - // This must be done BEFORE message initialization since fragments - // may be sent at that time. - registerWaiter(messageMediator); - - // Do connection reclaim now - synchronized (lock) { - if (contactInfo.isConnectionBased()) { - if (contactInfo.shouldCacheConnection()) { - OutboundConnectionCache connectionCache = - orb.getTransportManager() - .getOutboundConnectionCache(contactInfo); - connectionCache.reclaim(); - } - } - } - - orb.getPIHandler().setClientPIInfo(messageMediator); - try { - // This MUST come before message is initialized so - // service contexts may be added by PI because - // initial fragments may be sent during message initialization. - orb.getPIHandler().invokeClientPIStartingPoint(); - } catch( RemarshalException e ) { - if (orb.subcontractDebugFlag) { - dprint(".beginRequest: " + opAndId(messageMediator) - + ": Remarshal"); - } - - // NOTE: We get here because an interceptor raised ForwardRequest - // and updated the IOR/Iterator. Since we have a fresh iterator - // hasNext should succeed. - - // REVISIT: We should feed ALL interceptor exceptions to - // iterator.reportException so it can determine if it wants - // to retry. Right now, SystemExceptions will flow to the - // client code. - - // REVISIT: - // This assumes that interceptors update - // ContactInfoList outside of subcontract. - // Want to move that update to here. - if (getContactInfoListIterator(orb).hasNext()) { - contactInfo = (ContactInfo)getContactInfoListIterator(orb).next(); - if (orb.subcontractDebugFlag) { - dprint( "RemarshalException: hasNext true\ncontact info " + contactInfo ); - } - - // Fix for 6763340: Complete the first attempt before starting another. - orb.getPIHandler().makeCompletedClientRequest( - ReplyMessage.LOCATION_FORWARD, null ) ; - unregisterWaiter(orb); - orb.getPIHandler().cleanupClientPIRequest() ; - - return beginRequest(self, opName, isOneWay, contactInfo); - } else { - if (orb.subcontractDebugFlag) { - dprint( "RemarshalException: hasNext false" ); - } - ORBUtilSystemException wrapper = - ORBUtilSystemException.get(orb, - CORBALogDomains.RPC_PROTOCOL); - throw wrapper.remarshalWithNowhereToGo(); - } - } - - messageMediator.initializeMessage(); - if (orb.subcontractDebugFlag) { - dprint(".beginRequest: " + opAndId(messageMediator) - + ": initialized message"); - } - - return outputObject; - - } finally { - if (orb.subcontractDebugFlag) { - dprint(".beginRequest<-: op/" + opName); - } - } - } - - public InputObject marshalingComplete(java.lang.Object self, - OutputObject outputObject) - throws - ApplicationException, - org.omg.CORBA.portable.RemarshalException - { - ORB orb = null; - CorbaMessageMediator messageMediator = null; - try { - messageMediator = (CorbaMessageMediator) - outputObject.getMessageMediator(); - - orb = (ORB) messageMediator.getBroker(); - - if (orb.subcontractDebugFlag) { - dprint(".marshalingComplete->: " + opAndId(messageMediator)); - } - - InputObject inputObject = - marshalingComplete1(orb, messageMediator); - - return processResponse(orb, messageMediator, inputObject); - - } finally { - if (orb.subcontractDebugFlag) { - dprint(".marshalingComplete<-: " + opAndId(messageMediator)); - } - } - } - - public InputObject marshalingComplete1( - ORB orb, CorbaMessageMediator messageMediator) - throws - ApplicationException, - org.omg.CORBA.portable.RemarshalException - { - try { - messageMediator.finishSendingRequest(); - - if (orb.subcontractDebugFlag) { - dprint(".marshalingComplete: " + opAndId(messageMediator) - + ": finished sending request"); - } - - return messageMediator.waitForResponse(); - - } catch (RuntimeException e) { - - if (orb.subcontractDebugFlag) { - dprint(".marshalingComplete: " + opAndId(messageMediator) - + ": exception: " + e.toString()); - } - - boolean retry = - getContactInfoListIterator(orb) - .reportException(messageMediator.getContactInfo(), e); - - //Bug 6382377: must not lose exception in PI - - // Must run interceptor end point before retrying. - Exception newException = - orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.SYSTEM_EXCEPTION, e); - - if (retry) { - if (newException == e) { - continueOrThrowSystemOrRemarshal(messageMediator, - new RemarshalException()); - } else { - continueOrThrowSystemOrRemarshal(messageMediator, - newException); - } - } else { - if (newException instanceof RuntimeException){ - throw (RuntimeException)newException; - } - else if (newException instanceof RemarshalException) - { - throw (RemarshalException)newException; - } - - // NOTE: Interceptor ending point will run in releaseReply. - throw e; - } - return null; // for compiler - } - } - - protected InputObject processResponse(ORB orb, - CorbaMessageMediator messageMediator, - InputObject inputObject) - throws - ApplicationException, - org.omg.CORBA.portable.RemarshalException - { - ORBUtilSystemException wrapper = - ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - - if (orb.subcontractDebugFlag) { - dprint(".processResponse: " + opAndId(messageMediator) - + ": response received"); - } - - // We know for sure now that we've sent a message. - // So OK to not send initial again. - if (messageMediator.getConnection() != null) { - ((CorbaConnection)messageMediator.getConnection()) - .setPostInitialContexts(); - } - - // NOTE: not necessary to set MessageMediator for PI. - // It already has it. - - // Process the response. - - Exception exception = null; - - if (messageMediator.isOneWay()) { - getContactInfoListIterator(orb) - .reportSuccess(messageMediator.getContactInfo()); - // Invoke Portable Interceptors with receive_other - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.NO_EXCEPTION, exception ); - continueOrThrowSystemOrRemarshal(messageMediator, exception); - return null; - } - - consumeServiceContexts(orb, messageMediator); - - // Now that we have the service contexts processed and the - // correct ORBVersion set, we must finish initializing the stream. - // REVISIT - need interface for this operation. - ((CDRInputObject)inputObject).performORBVersionSpecificInit(); - - if (messageMediator.isSystemExceptionReply()) { - - SystemException se = messageMediator.getSystemExceptionReply(); - - if (orb.subcontractDebugFlag) { - dprint(".processResponse: " + opAndId(messageMediator) - + ": received system exception: " + se); - } - - boolean doRemarshal = - getContactInfoListIterator(orb) - .reportException(messageMediator.getContactInfo(), se); - - if (doRemarshal) { - - // Invoke Portable Interceptors with receive_exception: - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.SYSTEM_EXCEPTION, se ); - - // If PI did not change the exception, throw a - // Remarshal. - if( se == exception ) { - // exception = null is to maintain symmetry with - // GenericPOAClientSC. - exception = null; - continueOrThrowSystemOrRemarshal(messageMediator, - new RemarshalException()); - throw wrapper.statementNotReachable1() ; - } else { - // Otherwise, throw the exception PI wants thrown. - continueOrThrowSystemOrRemarshal(messageMediator, - exception); - throw wrapper.statementNotReachable2() ; - } - } - - // No retry, so see if was unknown. - - ServiceContexts contexts = - messageMediator.getReplyServiceContexts(); - if (contexts != null) { - UEInfoServiceContext usc = - (UEInfoServiceContext) - contexts.get(UEInfoServiceContext.SERVICE_CONTEXT_ID); - - if (usc != null) { - Throwable unknown = usc.getUE() ; - UnknownException ue = new UnknownException(unknown); - - // Invoke Portable Interceptors with receive_exception: - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.SYSTEM_EXCEPTION, ue ); - - continueOrThrowSystemOrRemarshal(messageMediator, exception); - throw wrapper.statementNotReachable3() ; - } - } - - // It was not a comm failure nor unknown. - // This is the general case. - - // Invoke Portable Interceptors with receive_exception: - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.SYSTEM_EXCEPTION, se ); - - continueOrThrowSystemOrRemarshal(messageMediator, exception); - - // Note: We should never need to execute this line, but - // we should assert in case exception is null somehow. - throw wrapper.statementNotReachable4() ; - } else if (messageMediator.isUserExceptionReply()) { - - if (orb.subcontractDebugFlag) { - dprint(".processResponse: " + opAndId(messageMediator) - + ": received user exception"); - } - - getContactInfoListIterator(orb) - .reportSuccess(messageMediator.getContactInfo()); - - String exceptionRepoId = peekUserExceptionId(inputObject); - Exception newException = null; - - if (messageMediator.isDIIRequest()) { - exception = messageMediator.unmarshalDIIUserException( - exceptionRepoId, (InputStream)inputObject); - newException = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.USER_EXCEPTION, exception ); - messageMediator.setDIIException(newException); - - } else { - ApplicationException appException = - new ApplicationException( - exceptionRepoId, - (org.omg.CORBA.portable.InputStream)inputObject); - exception = appException; - newException = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.USER_EXCEPTION, appException ); - } - - if (newException != exception) { - continueOrThrowSystemOrRemarshal(messageMediator,newException); - } - - if (newException instanceof ApplicationException) { - throw (ApplicationException)newException; - } - // For DII: - // This return will be ignored - already unmarshaled above. - return inputObject; - - } else if (messageMediator.isLocationForwardReply()) { - - if (orb.subcontractDebugFlag) { - dprint(".processResponse: " + opAndId(messageMediator) - + ": received location forward"); - } - - // NOTE: Expects iterator to update target IOR - getContactInfoListIterator(orb).reportRedirect( - (CorbaContactInfo)messageMediator.getContactInfo(), - messageMediator.getForwardedIOR()); - - // Invoke Portable Interceptors with receive_other: - Exception newException = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.LOCATION_FORWARD, null ); - - if( !(newException instanceof RemarshalException) ) { - exception = newException; - } - - // If PI did not change exception, throw Remarshal, else - // throw the exception PI wants thrown. - // KMC: GenericPOAClientSC did not check exception != null - if( exception != null ) { - continueOrThrowSystemOrRemarshal(messageMediator, exception); - } - continueOrThrowSystemOrRemarshal(messageMediator, - new RemarshalException()); - throw wrapper.statementNotReachable5() ; - - } else if (messageMediator.isDifferentAddrDispositionRequestedReply()){ - - if (orb.subcontractDebugFlag) { - dprint(".processResponse: " + opAndId(messageMediator) - + ": received different addressing dispostion request"); - } - - // Set the desired target addressing disposition. - getContactInfoListIterator(orb).reportAddrDispositionRetry( - (CorbaContactInfo)messageMediator.getContactInfo(), - messageMediator.getAddrDispositionReply()); - - // Invoke Portable Interceptors with receive_other: - Exception newException = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.NEEDS_ADDRESSING_MODE, null); - - // For consistency with corresponding code in GenericPOAClientSC: - if( !(newException instanceof RemarshalException) ) { - exception = newException; - } - - // If PI did not change exception, throw Remarshal, else - // throw the exception PI wants thrown. - // KMC: GenericPOAClientSC did not include exception != null check - if( exception != null ) { - continueOrThrowSystemOrRemarshal(messageMediator, exception); - } - continueOrThrowSystemOrRemarshal(messageMediator, - new RemarshalException()); - throw wrapper.statementNotReachable6() ; - } else /* normal response */ { - - if (orb.subcontractDebugFlag) { - dprint(".processResponse: " + opAndId(messageMediator) - + ": received normal response"); - } - - getContactInfoListIterator(orb) - .reportSuccess(messageMediator.getContactInfo()); - - messageMediator.handleDIIReply((InputStream)inputObject); - - // Invoke Portable Interceptors with receive_reply: - exception = orb.getPIHandler().invokeClientPIEndingPoint( - ReplyMessage.NO_EXCEPTION, null ); - - // Remember: not thrown if exception is null. - continueOrThrowSystemOrRemarshal(messageMediator, exception); - - return inputObject; - } - } - - // Filters the given exception into a SystemException or a - // RemarshalException and throws it. Assumes the given exception is - // of one of these two types. This is a utility method for - // the above invoke code which must do this numerous times. - // If the exception is null, no exception is thrown. - // - // Note that this code is duplicated in GenericPOAClientSC.java - protected void continueOrThrowSystemOrRemarshal( - CorbaMessageMediator messageMediator, Exception exception) - throws - SystemException, RemarshalException - { - - ORB orb = (ORB) messageMediator.getBroker(); - - if( exception == null ) { - - // do nothing. - - } else if( exception instanceof RemarshalException ) { - - // REVISIT - unify with PI handling - orb.getInvocationInfo().setIsRetryInvocation(true); - - // NOTE - We must unregister the waiter NOW for this request - // since the retry will result in a new request id. Therefore - // the old request id would be lost and we would have a memory - // leak in the responseWaitingRoom. - unregisterWaiter(orb); - - if (orb.subcontractDebugFlag) { - dprint(".continueOrThrowSystemOrRemarshal: " - + opAndId(messageMediator) - + ": throwing Remarshal"); - } - - throw (RemarshalException)exception; - - } else { - - if (orb.subcontractDebugFlag) { - dprint(".continueOrThrowSystemOrRemarshal: " - + opAndId(messageMediator) - + ": throwing sex:" - + exception); - } - - throw (SystemException)exception; - } - } - - protected CorbaContactInfoListIterator getContactInfoListIterator(ORB orb) - { - return (CorbaContactInfoListIterator) - ((CorbaInvocationInfo)orb.getInvocationInfo()) - .getContactInfoListIterator(); - } - - protected void registerWaiter(CorbaMessageMediator messageMediator) - { - if (messageMediator.getConnection() != null) { - messageMediator.getConnection().registerWaiter(messageMediator); - } - } - - protected void unregisterWaiter(ORB orb) - { - MessageMediator messageMediator = - orb.getInvocationInfo().getMessageMediator(); - if (messageMediator!=null && messageMediator.getConnection() != null) { - // REVISIT: - // The messageMediator may be null if COMM_FAILURE before - // it is created. - messageMediator.getConnection().unregisterWaiter(messageMediator); - } - } - - protected void addServiceContexts(CorbaMessageMediator messageMediator) - { - ORB orb = (ORB)messageMediator.getBroker(); - CorbaConnection c = (CorbaConnection) messageMediator.getConnection(); - GIOPVersion giopVersion = messageMediator.getGIOPVersion(); - - ServiceContexts contexts = messageMediator.getRequestServiceContexts(); - - addCodeSetServiceContext(c, contexts, giopVersion); - - // Add the RMI-IIOP max stream format version - // service context to every request. Once we have GIOP 1.3, - // we could skip it since we now support version 2, but - // probably safer to always send it. - contexts.put(MaxStreamFormatVersionServiceContext.singleton); - - // ORBVersion servicecontext needs to be sent - ORBVersionServiceContext ovsc = new ORBVersionServiceContext( - ORBVersionFactory.getORBVersion() ) ; - contexts.put( ovsc ) ; - - // NOTE : We only want to send the runtime context the first time - if ((c != null) && !c.isPostInitialContexts()) { - // Do not do c.setPostInitialContexts() here. - // If a client interceptor send_request does a ForwardRequest - // which ends up using the same connection then the service - // context would not be sent. - SendingContextServiceContext scsc = - new SendingContextServiceContext( orb.getFVDCodeBaseIOR() ) ; //d11638 - contexts.put( scsc ) ; - } - } - - protected void consumeServiceContexts(ORB orb, - CorbaMessageMediator messageMediator) - { - ServiceContexts ctxts = messageMediator.getReplyServiceContexts(); - ServiceContext sc ; - ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - - if (ctxts == null) { - return; // no service context available, return gracefully. - } - - sc = ctxts.get( SendingContextServiceContext.SERVICE_CONTEXT_ID ) ; - - if (sc != null) { - SendingContextServiceContext scsc = - (SendingContextServiceContext)sc ; - IOR ior = scsc.getIOR() ; - - try { - // set the codebase returned by the server - if (messageMediator.getConnection() != null) { - ((CorbaConnection)messageMediator.getConnection()).setCodeBaseIOR(ior); - } - } catch (ThreadDeath td) { - throw td ; - } catch (Throwable t) { - throw wrapper.badStringifiedIor( t ) ; - } - } - - // see if the version subcontract is present, if yes, then set - // the ORBversion - sc = ctxts.get( ORBVersionServiceContext.SERVICE_CONTEXT_ID ) ; - - if (sc != null) { - ORBVersionServiceContext ovsc = - (ORBVersionServiceContext) sc; - - ORBVersion version = ovsc.getVersion(); - orb.setORBVersion( version ) ; - } - - getExceptionDetailMessage(messageMediator, wrapper); - } - - protected void getExceptionDetailMessage( - CorbaMessageMediator messageMediator, - ORBUtilSystemException wrapper) - { - ServiceContext sc = messageMediator.getReplyServiceContexts() - .get(ExceptionDetailMessage.value); - if (sc == null) - return ; - - if (! (sc instanceof UnknownServiceContext)) { - throw wrapper.badExceptionDetailMessageServiceContextType(); - } - byte[] data = ((UnknownServiceContext)sc).getData(); - EncapsInputStream in = - EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(), - data, data.length); - in.consumeEndian(); - - String msg = - "----------BEGIN server-side stack trace----------\n" - + in.read_wstring() + "\n" - + "----------END server-side stack trace----------"; - - messageMediator.setReplyExceptionDetailMessage(msg); - } - - public void endRequest(Broker broker, Object self, InputObject inputObject) - { - ORB orb = (ORB)broker ; - - try { - if (orb.subcontractDebugFlag) { - dprint(".endRequest->"); - } - - // Note: the inputObject may be null if an error occurs - // in request or before _invoke returns. - // Note: self may be null also (e.g., compiler generates null in stub). - - MessageMediator messageMediator = - orb.getInvocationInfo().getMessageMediator(); - if (messageMediator != null) - { - if (messageMediator.getConnection() != null) - { - ((CorbaMessageMediator)messageMediator) - .sendCancelRequestIfFinalFragmentNotSent(); - } - - // Release any outstanding NIO ByteBuffers to the ByteBufferPool - - InputObject inputObj = messageMediator.getInputObject(); - if (inputObj != null) { - inputObj.close(); - } - - OutputObject outputObj = messageMediator.getOutputObject(); - if (outputObj != null) { - outputObj.close(); - } - - } - - // XREVISIT NOTE - Assumes unregistering the waiter for - // location forwards has already happened somewhere else. - // The code below is only going to unregister the final successful - // request. - - // NOTE: In the case of a recursive stack of endRequests in a - // finally block (because of Remarshal) only the first call to - // unregisterWaiter will remove the waiter. The rest will be - // noops. - unregisterWaiter(orb); - - // Invoke Portable Interceptors cleanup. This is done to handle - // exceptions during stream marshaling. More generally, exceptions - // that occur in the ORB after send_request (which includes - // after returning from _request) before _invoke: - orb.getPIHandler().cleanupClientPIRequest(); - - // REVISIT: Early replies? - } catch (IOException ex) { - // See CDRInput/OutputObject.close() for more info. - // This won't result in a Corba error if an IOException happens. - if (orb.subcontractDebugFlag) - { - dprint(".endRequest: ignoring IOException - " + ex.toString()); - } - } finally { - if (orb.subcontractDebugFlag) { - dprint(".endRequest<-"); - } - } - } - - - protected void performCodeSetNegotiation(CorbaMessageMediator messageMediator) - { - CorbaConnection conn = - (CorbaConnection) messageMediator.getConnection(); - IOR ior = - ((CorbaContactInfo)messageMediator.getContactInfo()) - .getEffectiveTargetIOR(); - GIOPVersion giopVersion = messageMediator.getGIOPVersion(); - - // XXX This seems to be a broken double checked locking idiom: FIX IT! - - // conn.getCodeSetContext() is null when no other requests have - // been made on this connection to trigger code set negotation. - if (conn != null && - conn.getCodeSetContext() == null && - !giopVersion.equals(GIOPVersion.V1_0)) { - - synchronized(conn) { - // Double checking. Don't let any other - // threads use this connection until the - // code sets are straight. - if (conn.getCodeSetContext() != null) - return; - - // This only looks at the first code set component. If - // there can be multiple locations with multiple code sets, - // this requires more work. - IIOPProfileTemplate temp = - (IIOPProfileTemplate)ior.getProfile(). - getTaggedProfileTemplate(); - Iterator iter = temp.iteratorById(TAG_CODE_SETS.value); - if (!iter.hasNext()) { - // Didn't have a code set component. The default will - // be to use ISO8859-1 for char data and throw an - // exception if wchar data is used. - return; - } - - // Get the native and conversion code sets the - // server specified in its IOR - CodeSetComponentInfo serverCodeSets - = ((CodeSetsComponent)iter.next()).getCodeSetComponentInfo(); - - // Perform the negotiation between this ORB's code sets and - // the ones from the IOR - CodeSetComponentInfo.CodeSetContext result - = CodeSetConversion.impl().negotiate( - conn.getBroker().getORBData().getCodeSetComponentInfo(), - serverCodeSets); - - conn.setCodeSetContext(result); - } - } - } - - protected void addCodeSetServiceContext(CorbaConnection conn, - ServiceContexts ctxs, - GIOPVersion giopVersion) { - - // REVISIT. OMG issue 3318 concerning sending the code set - // service context more than once was deemed too much for the - // RTF. Here's our strategy for the moment: - // - // Send it on every request (necessary in cases of fragmentation - // with multithreaded clients or when the first thing on a - // connection is a LocateRequest). Provide an ORB property - // to disable multiple sends. - // - // Note that the connection is null in the local case and no - // service context is included. We use the ORB provided - // encapsulation streams. - // - // Also, there will be no negotiation or service context - // in GIOP 1.0. ISO8859-1 is used for char/string, and - // wchar/wstring are illegal. - // - if (giopVersion.equals(GIOPVersion.V1_0) || conn == null) - return; - - CodeSetComponentInfo.CodeSetContext codeSetCtx = null; - - if (conn.getBroker().getORBData().alwaysSendCodeSetServiceContext() || - !conn.isPostInitialContexts()) { - - // Get the negotiated code sets (if any) out of the connection - codeSetCtx = conn.getCodeSetContext(); - } - - // Either we shouldn't send the code set service context, or - // for some reason, the connection doesn't have its code sets. - // Perhaps the server didn't include them in the IOR. Uses - // ISO8859-1 for char and makes wchar/wstring illegal. - if (codeSetCtx == null) - return; - - CodeSetServiceContext cssc = new CodeSetServiceContext(codeSetCtx); - ctxs.put(cssc); - } - - protected String peekUserExceptionId(InputObject inputObject) - { - CDRInputObject cdrInputObject = (CDRInputObject) inputObject; - // REVISIT - need interface for mark/reset - cdrInputObject.mark(Integer.MAX_VALUE); - String result = cdrInputObject.read_string(); - cdrInputObject.reset(); - return result; - } - - protected void dprint(String msg) - { - ORBUtility.dprint("CorbaClientRequestDispatcherImpl", msg); - } - - protected String opAndId(CorbaMessageMediator mediator) - { - return ORBUtility.operationNameAndRequestId(mediator); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaInvocationInfo.java 2018-01-30 20:19:58.000000000 -0500 +++ /dev/null 2018-01-30 20:19:58.000000000 -0500 @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.impl.protocol; - -import java.util.Iterator; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.pept.protocol.ClientInvocationInfo; -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; - -/** - * @author Harold Carr - */ -public class CorbaInvocationInfo implements ClientInvocationInfo -{ - // REVISIT - these needs to be an interface-based impl. - - private boolean isRetryInvocation; - private int entryCount; - private ORB orb; - private Iterator contactInfoListIterator; - private ClientRequestDispatcher clientRequestDispatcher; - private MessageMediator messageMediator; - - private CorbaInvocationInfo() - { - } - - public CorbaInvocationInfo(ORB orb) - { - this.orb = orb; - isRetryInvocation = false; - entryCount = 0; - } - - public Iterator getContactInfoListIterator() - { - return contactInfoListIterator; - } - - public void setContactInfoListIterator(Iterator contactInfoListIterator) - { - this.contactInfoListIterator = contactInfoListIterator; - } - - public boolean isRetryInvocation() - { - return isRetryInvocation; - } - - public void setIsRetryInvocation(boolean isRetryInvocation) - { - this.isRetryInvocation = isRetryInvocation; - } - - public int getEntryCount() - { - return entryCount; - } - - public void incrementEntryCount() - { - entryCount++; - } - - public void decrementEntryCount() - { - entryCount--; - } - - public void setClientRequestDispatcher(ClientRequestDispatcher clientRequestDispatcher) - { - this.clientRequestDispatcher = clientRequestDispatcher; - } - - public ClientRequestDispatcher getClientRequestDispatcher() - { - return clientRequestDispatcher; - } - - public void setMessageMediator(MessageMediator messageMediator) - { - this.messageMediator = messageMediator; - } - - public MessageMediator getMessageMediator() - { - return messageMediator; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java 2018-01-30 20:19:58.000000000 -0500 +++ /dev/null 2018-01-30 20:19:58.000000000 -0500 @@ -1,2370 +0,0 @@ -/* - * Copyright (c) 2001, 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.corba.se.impl.protocol; - -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.PrintWriter; -import java.nio.ByteBuffer; -import java.nio.channels.SelectionKey; -import java.util.EmptyStackException; -import java.util.Iterator; - -import org.omg.CORBA.Any; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.Principal; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.UnknownUserException; -import org.omg.CORBA.UNKNOWN; -import org.omg.CORBA.portable.ResponseHandler; -import org.omg.CORBA.portable.UnknownException; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.IOP.ExceptionDetailMessage; -import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.protocol.ProtocolHandler; -import com.sun.corba.se.pept.transport.ByteBufferPool; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.EventHandler; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.ObjectKey; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile; -import com.sun.corba.se.spi.ior.iiop.MaxStreamFormatVersionComponent; -import com.sun.corba.se.spi.oa.OAInvocationInfo; -import com.sun.corba.se.spi.oa.ObjectAdapter; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.protocol.CorbaProtocolHandler; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher; -import com.sun.corba.se.spi.protocol.ForwardException; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.transport.CorbaContactInfo; -import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom; -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext; -import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext; -import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext; -import com.sun.corba.se.spi.servicecontext.UnknownServiceContext; - -import com.sun.corba.se.impl.corba.RequestImpl; -import com.sun.corba.se.impl.encoding.BufferManagerFactory; -import com.sun.corba.se.impl.encoding.BufferManagerReadStream; -import com.sun.corba.se.impl.encoding.CDRInputObject; -import com.sun.corba.se.impl.encoding.CDROutputObject; -import com.sun.corba.se.impl.encoding.EncapsOutputStream; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.logging.InterceptorsSystemException; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent; -import com.sun.corba.se.impl.protocol.AddressingDispositionException; -import com.sun.corba.se.impl.protocol.RequestCanceledException; -import com.sun.corba.se.impl.protocol.giopmsgheaders.AddressingDispositionHelper; -import com.sun.corba.se.impl.protocol.giopmsgheaders.CancelRequestMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage_1_1; -import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage_1_2; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage_1_0; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage_1_1; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage_1_2; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyOrReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage_1_0; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage_1_1; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage_1_2; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageHandler; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_0; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_1; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2; -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_0 ; -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_1 ; -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_2 ; - -// REVISIT: make sure no memory leaks in client/server request/reply maps. -// REVISIT: normalize requestHeader, replyHeader, messageHeader. - -/** - * @author Harold Carr - */ -public class CorbaMessageMediatorImpl - implements - CorbaMessageMediator, - CorbaProtocolHandler, - MessageHandler -{ - protected ORB orb; - protected ORBUtilSystemException wrapper ; - protected InterceptorsSystemException interceptorWrapper ; - protected CorbaContactInfo contactInfo; - protected CorbaConnection connection; - protected short addrDisposition; - protected CDROutputObject outputObject; - protected CDRInputObject inputObject; - protected Message messageHeader; - protected RequestMessage requestHeader; - protected LocateReplyOrReplyMessage replyHeader; - protected String replyExceptionDetailMessage; - protected IOR replyIOR; - protected Integer requestIdInteger; - protected Message dispatchHeader; - protected ByteBuffer dispatchByteBuffer; - protected byte streamFormatVersion; - protected boolean streamFormatVersionSet = false; - - protected org.omg.CORBA.Request diiRequest; - - protected boolean cancelRequestAlreadySent = false; - - protected ProtocolHandler protocolHandler; - protected boolean _executeReturnServantInResponseConstructor = false; - protected boolean _executeRemoveThreadInfoInResponseConstructor = false; - protected boolean _executePIInResponseConstructor = false; - - // - // Client-side constructor. - // - - public CorbaMessageMediatorImpl(ORB orb, - ContactInfo contactInfo, - Connection connection, - GIOPVersion giopVersion, - IOR ior, - int requestId, - short addrDisposition, - String operationName, - boolean isOneWay) - { - this( orb, connection ) ; - - this.contactInfo = (CorbaContactInfo) contactInfo; - this.addrDisposition = addrDisposition; - - streamFormatVersion = - getStreamFormatVersionForThisRequest( - ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(), - giopVersion); - streamFormatVersionSet = true; - - requestHeader = (RequestMessage) MessageBase.createRequest( - this.orb, - giopVersion, - ORBUtility.getEncodingVersion(orb, ior), - requestId, - !isOneWay, - ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(), - this.addrDisposition, - operationName, - new ServiceContexts(orb), - null); - } - - // - // Acceptor constructor. - // - - public CorbaMessageMediatorImpl(ORB orb, - Connection connection) - { - this.orb = orb; - this.connection = (CorbaConnection)connection; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - this.interceptorWrapper = InterceptorsSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - // - // Dispatcher constructor. - // - - // Note: in some cases (e.g., a reply message) this message - // mediator will only be used for dispatch. Then the original - // request side mediator will take over. - public CorbaMessageMediatorImpl(ORB orb, - CorbaConnection connection, - Message dispatchHeader, - ByteBuffer byteBuffer) - { - this( orb, connection ) ; - this.dispatchHeader = dispatchHeader; - this.dispatchByteBuffer = byteBuffer; - } - - //////////////////////////////////////////////////// - // - // MessageMediator - // - - public Broker getBroker() - { - return orb; - } - - public ContactInfo getContactInfo() - { - return contactInfo; - } - - public Connection getConnection() - { - return connection; - } - - public void initializeMessage() - { - getRequestHeader().write(outputObject); - } - - public void finishSendingRequest() - { - // REVISIT: probably move logic in outputObject to here. - outputObject.finishSendingMessage(); - } - - public InputObject waitForResponse() - { - if (getRequestHeader().isResponseExpected()) { - return connection.waitForResponse(this); - } - return null; - } - - public void setOutputObject(OutputObject outputObject) - { - this.outputObject = (CDROutputObject) outputObject; - } - - public OutputObject getOutputObject() - { - return outputObject; - } - - public void setInputObject(InputObject inputObject) - { - this.inputObject = (CDRInputObject) inputObject; - } - - public InputObject getInputObject() - { - return inputObject; - } - - //////////////////////////////////////////////////// - // - // CorbaMessageMediator - // - - public void setReplyHeader(LocateReplyOrReplyMessage header) - { - this.replyHeader = header; - this.replyIOR = header.getIOR(); // REVISIT - need separate field? - } - - public LocateReplyMessage getLocateReplyHeader() - { - return (LocateReplyMessage) replyHeader; - } - - public ReplyMessage getReplyHeader() - { - return (ReplyMessage) replyHeader; - } - - public void setReplyExceptionDetailMessage(String message) - { - replyExceptionDetailMessage = message; - } - - public RequestMessage getRequestHeader() - { - return requestHeader; - } - - public GIOPVersion getGIOPVersion() - { - if (messageHeader != null) { - return messageHeader.getGIOPVersion(); - } - return getRequestHeader().getGIOPVersion(); - } - - public byte getEncodingVersion() { - if (messageHeader != null) { - return messageHeader.getEncodingVersion(); - } - return getRequestHeader().getEncodingVersion(); - } - - public int getRequestId() - { - return getRequestHeader().getRequestId(); - } - - public Integer getRequestIdInteger() - { - if (requestIdInteger == null) { - requestIdInteger = new Integer(getRequestHeader().getRequestId()); - } - return requestIdInteger; - } - - public boolean isOneWay() - { - return ! getRequestHeader().isResponseExpected(); - } - - public short getAddrDisposition() - { - return addrDisposition; - } - - public String getOperationName() - { - return getRequestHeader().getOperation(); - } - - public ServiceContexts getRequestServiceContexts() - { - return getRequestHeader().getServiceContexts(); - } - - public ServiceContexts getReplyServiceContexts() - { - return getReplyHeader().getServiceContexts(); - } - - public void sendCancelRequestIfFinalFragmentNotSent() - { - if ((!sentFullMessage()) && sentFragment() && - (!cancelRequestAlreadySent)) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".sendCancelRequestIfFinalFragmentNotSent->: " - + opAndId(this)); - } - connection.sendCancelRequestWithLock(getGIOPVersion(), - getRequestId()); - // Case: first a location forward, then a marshaling - // exception (e.g., non-serializable object). Only - // send cancel once. - cancelRequestAlreadySent = true; - } catch (IOException e) { - if (orb.subcontractDebugFlag) { - dprint(".sendCancelRequestIfFinalFragmentNotSent: !ERROR : " + opAndId(this), - e); - } - - // REVISIT: we could attempt to send a final incomplete - // fragment in this case. - throw interceptorWrapper.ioexceptionDuringCancelRequest( - CompletionStatus.COMPLETED_MAYBE, e ); - } finally { - if (orb.subcontractDebugFlag) { - dprint(".sendCancelRequestIfFinalFragmentNotSent<-: " - + opAndId(this)); - } - } - } - } - - public boolean sentFullMessage() - { - return outputObject.getBufferManager().sentFullMessage(); - } - - public boolean sentFragment() - { - return outputObject.getBufferManager().sentFragment(); - } - - public void setDIIInfo(org.omg.CORBA.Request diiRequest) - { - this.diiRequest = diiRequest; - } - - public boolean isDIIRequest() - { - return diiRequest != null; - } - - public Exception unmarshalDIIUserException(String repoId, InputStream is) - { - if (! isDIIRequest()) { - return null; - } - - ExceptionList _exceptions = diiRequest.exceptions(); - - try { - // Find the typecode for the exception - for (int i=0; i<_exceptions.count() ; i++) { - TypeCode tc = _exceptions.item(i); - if ( tc.id().equals(repoId) ) { - // Since we dont have the actual user exception - // class, the spec says we have to create an - // UnknownUserException and put it in the - // environment. - Any eany = orb.create_any(); - eany.read_value(is, (TypeCode)tc); - - return new UnknownUserException(eany); - } - } - } catch (Exception b) { - throw wrapper.unexpectedDiiException(b); - } - - // must be a truly unknown exception - return wrapper.unknownCorbaExc( CompletionStatus.COMPLETED_MAYBE); - } - - public void setDIIException(Exception exception) - { - diiRequest.env().exception(exception); - } - - public void handleDIIReply(InputStream inputStream) - { - if (! isDIIRequest()) { - return; - } - ((RequestImpl)diiRequest).unmarshalReply(inputStream); - } - - public Message getDispatchHeader() - { - return dispatchHeader; - } - - public void setDispatchHeader(Message msg) - { - dispatchHeader = msg; - } - - public ByteBuffer getDispatchBuffer() - { - return dispatchByteBuffer; - } - - public void setDispatchBuffer(ByteBuffer byteBuffer) - { - dispatchByteBuffer = byteBuffer; - } - - public int getThreadPoolToUse() { - int poolToUse = 0; - Message msg = getDispatchHeader(); - // A null msg should never happen. But, we'll be - // defensive just in case. - if (msg != null) { - poolToUse = msg.getThreadPoolToUse(); - } - return poolToUse; - } - - public byte getStreamFormatVersion() - { - // REVISIT: ContactInfo/Acceptor output object factories - // just use this. Maybe need to distinguish: - // createOutputObjectForRequest - // createOutputObjectForReply - // then do getStreamFormatVersionForRequest/ForReply here. - if (streamFormatVersionSet) { - return streamFormatVersion; - } - return getStreamFormatVersionForReply(); - } - - /** - * If the RMI-IIOP maximum stream format version service context - * is present, it indicates the maximum stream format version we - * could use for the reply. If it isn't present, the default is - * 2 for GIOP 1.3 or greater, 1 for lower. - * - * This is only sent on requests. Clients can find out the - * server's maximum by looking for a tagged component in the IOR. - */ - public byte getStreamFormatVersionForReply() { - - // NOTE: The request service contexts may indicate the max. - ServiceContexts svc = getRequestServiceContexts(); - - MaxStreamFormatVersionServiceContext msfvsc - = (MaxStreamFormatVersionServiceContext)svc.get( - MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID); - - if (msfvsc != null) { - byte localMaxVersion = ORBUtility.getMaxStreamFormatVersion(); - byte remoteMaxVersion = msfvsc.getMaximumStreamFormatVersion(); - - return (byte)Math.min(localMaxVersion, remoteMaxVersion); - } else { - // Defaults to 1 for GIOP 1.2 or less, 2 for - // GIOP 1.3 or higher. - if (getGIOPVersion().lessThan(GIOPVersion.V1_3)) - return ORBConstants.STREAM_FORMAT_VERSION_1; - else - return ORBConstants.STREAM_FORMAT_VERSION_2; - } - } - - public boolean isSystemExceptionReply() - { - return replyHeader.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION; - } - - public boolean isUserExceptionReply() - { - return replyHeader.getReplyStatus() == ReplyMessage.USER_EXCEPTION; - } - - public boolean isLocationForwardReply() - { - return ( (replyHeader.getReplyStatus() == ReplyMessage.LOCATION_FORWARD) || - (replyHeader.getReplyStatus() == ReplyMessage.LOCATION_FORWARD_PERM) ); - //return replyHeader.getReplyStatus() == ReplyMessage.LOCATION_FORWARD; - } - - public boolean isDifferentAddrDispositionRequestedReply() - { - return replyHeader.getReplyStatus() == ReplyMessage.NEEDS_ADDRESSING_MODE; - } - - public short getAddrDispositionReply() - { - return replyHeader.getAddrDisposition(); - } - - public IOR getForwardedIOR() - { - return replyHeader.getIOR(); - } - - public SystemException getSystemExceptionReply() - { - return replyHeader.getSystemException(replyExceptionDetailMessage); - } - - //////////////////////////////////////////////////// - // - // Used by server side. - // - - public ObjectKey getObjectKey() - { - return getRequestHeader().getObjectKey(); - } - - public void setProtocolHandler(CorbaProtocolHandler protocolHandler) - { - throw wrapper.methodShouldNotBeCalled() ; - } - - public CorbaProtocolHandler getProtocolHandler() - { - // REVISIT: should look up in orb registry. - return this; - } - - //////////////////////////////////////////////////// - // - // ResponseHandler - // - - public org.omg.CORBA.portable.OutputStream createReply() - { - // Note: relies on side-effect of setting mediator output field. - // REVISIT - cast - need interface - getProtocolHandler().createResponse(this, (ServiceContexts) null); - return (OutputStream) getOutputObject(); - } - - public org.omg.CORBA.portable.OutputStream createExceptionReply() - { - // Note: relies on side-effect of setting mediator output field. - // REVISIT - cast - need interface - getProtocolHandler().createUserExceptionResponse(this, (ServiceContexts) null); - return (OutputStream) getOutputObject(); - } - - public boolean executeReturnServantInResponseConstructor() - { - return _executeReturnServantInResponseConstructor; - - } - - public void setExecuteReturnServantInResponseConstructor(boolean b) - { - _executeReturnServantInResponseConstructor = b; - } - - public boolean executeRemoveThreadInfoInResponseConstructor() - { - return _executeRemoveThreadInfoInResponseConstructor; - } - - public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b) - { - _executeRemoveThreadInfoInResponseConstructor = b; - } - - public boolean executePIInResponseConstructor() - { - return _executePIInResponseConstructor; - } - - public void setExecutePIInResponseConstructor( boolean b ) - { - _executePIInResponseConstructor = b; - } - - private byte getStreamFormatVersionForThisRequest(IOR ior, - GIOPVersion giopVersion) - { - - byte localMaxVersion - = ORBUtility.getMaxStreamFormatVersion(); - - IOR effectiveTargetIOR = - ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(); - IIOPProfileTemplate temp = - (IIOPProfileTemplate)effectiveTargetIOR.getProfile().getTaggedProfileTemplate(); - Iterator iter = temp.iteratorById(TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value); - if (!iter.hasNext()) { - // Didn't have the max stream format version tagged - // component. - if (giopVersion.lessThan(GIOPVersion.V1_3)) - return ORBConstants.STREAM_FORMAT_VERSION_1; - else - return ORBConstants.STREAM_FORMAT_VERSION_2; - } - - byte remoteMaxVersion - = ((MaxStreamFormatVersionComponent)iter.next()).getMaxStreamFormatVersion(); - - return (byte)Math.min(localMaxVersion, remoteMaxVersion); - } - - //////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////// - //////////////////////////////////////////////////////////////////////// - - // REVISIT - This could be a separate implementation object looked - // up in a registry. However it needs some state in the message - // mediator so combine for now. - - - protected boolean isThreadDone = false; - - //////////////////////////////////////////////////// - // - // pept.protocol.ProtocolHandler - // - - public boolean handleRequest(MessageMediator messageMediator) - { - try { - dispatchHeader.callback(this); - } catch (IOException e) { - // REVISIT - this should be handled internally. - ; - } - return isThreadDone; - } - - //////////////////////////////////////////////////// - // - // iiop.messages.MessageHandler - // - - private void setWorkThenPoolOrResumeSelect(Message header) - { - if (getConnection().getEventHandler().shouldUseSelectThreadToWait()) { - resumeSelect(header); - } else { - // Leader/Follower when using reader thread. - // When this thread is done working it will go back in pool. - - isThreadDone = true; - - // First unregister current registration. - orb.getTransportManager().getSelector(0) - .unregisterForEvent(getConnection().getEventHandler()); - // Have another thread become the reader. - orb.getTransportManager().getSelector(0) - .registerForEvent(getConnection().getEventHandler()); - } - } - - private void setWorkThenReadOrResumeSelect(Message header) - { - if (getConnection().getEventHandler().shouldUseSelectThreadToWait()) { - resumeSelect(header); - } else { - // When using reader thread then wen this thread is - // done working it will continue reading. - isThreadDone = false; - } - } - - private void resumeSelect(Message header) - { - // NOTE: VERY IMPORTANT: - // Only participate in select after getting to the point - // that proper serialization of fragments is ensured. - - if (transportDebug()) { - dprint(".resumeSelect:->"); - // REVISIT: not-OO: - String requestId = "?"; - if (header instanceof RequestMessage) { - requestId = - new Integer(((RequestMessage)header) - .getRequestId()).toString(); - } else if (header instanceof ReplyMessage) { - requestId = - new Integer(((ReplyMessage)header) - .getRequestId()).toString(); - } else if (header instanceof FragmentMessage_1_2) { - requestId = - new Integer(((FragmentMessage_1_2)header) - .getRequestId()).toString(); - } - dprint(".resumeSelect: id/" - + requestId - + " " + getConnection() - ); - - } - - // IMPORTANT: To avoid bug (4953599), we force the Thread that does the NIO select - // to also do the enable/disable of Ops using SelectionKey.interestOps(Ops of Interest). - // Otherwise, the SelectionKey.interestOps(Ops of Interest) may block indefinitely in - // this thread. - EventHandler eventHandler = getConnection().getEventHandler(); - orb.getTransportManager().getSelector(0).registerInterestOps(eventHandler); - - if (transportDebug()) { - dprint(".resumeSelect:<-"); - } - } - - private void setInputObject() - { - // REVISIT: refactor createInputObject (and createMessageMediator) - // into base PlugInFactory. Get via connection (either ContactInfo - // or Acceptor). - if (getConnection().getContactInfo() != null) { - inputObject = (CDRInputObject) - getConnection().getContactInfo() - .createInputObject(orb, this); - } else if (getConnection().getAcceptor() != null) { - inputObject = (CDRInputObject) - getConnection().getAcceptor() - .createInputObject(orb, this); - } else { - throw new RuntimeException("CorbaMessageMediatorImpl.setInputObject"); - } - inputObject.setMessageMediator(this); - setInputObject(inputObject); - } - - private void signalResponseReceived() - { - // This will end up using the MessageMediator associated with - // the original request instead of the current mediator (which - // need to be constructed to hold the dispatchBuffer and connection). - connection.getResponseWaitingRoom() - .responseReceived((InputObject)inputObject); - } - - // This handles message types for which we don't create classes. - public void handleInput(Message header) throws IOException - { - try { - messageHeader = header; - - if (transportDebug()) - dprint(".handleInput->: " - + MessageBase.typeToString(header.getType())); - - setWorkThenReadOrResumeSelect(header); - - switch(header.getType()) - { - case Message.GIOPCloseConnection: - if (transportDebug()) { - dprint(".handleInput: CloseConnection: purging"); - } - connection.purgeCalls(wrapper.connectionRebind(), true, false); - break; - case Message.GIOPMessageError: - if (transportDebug()) { - dprint(".handleInput: MessageError: purging"); - } - connection.purgeCalls(wrapper.recvMsgError(), true, false); - break; - default: - if (transportDebug()) { - dprint(".handleInput: ERROR: " - + MessageBase.typeToString(header.getType())); - } - throw wrapper.badGiopRequestType() ; - } - releaseByteBufferToPool(); - } finally { - if (transportDebug()) { - dprint(".handleInput<-: " - + MessageBase.typeToString(header.getType())); - } - } - } - - public void handleInput(RequestMessage_1_0 header) throws IOException - { - try { - if (transportDebug()) dprint(".REQUEST 1.0->: " + header); - try { - messageHeader = requestHeader = (RequestMessage) header; - setInputObject(); - } finally { - setWorkThenPoolOrResumeSelect(header); - } - getProtocolHandler().handleRequest(header, this); - } catch (Throwable t) { - if (transportDebug()) - dprint(".REQUEST 1.0: !!ERROR!!: " + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".REQUEST 1.0<-: " + header); - } - } - - public void handleInput(RequestMessage_1_1 header) throws IOException - { - try { - if (transportDebug()) dprint(".REQUEST 1.1->: " + header); - try { - messageHeader = requestHeader = (RequestMessage) header; - setInputObject(); - connection.serverRequest_1_1_Put(this); - } finally { - setWorkThenPoolOrResumeSelect(header); - } - getProtocolHandler().handleRequest(header, this); - } catch (Throwable t) { - if (transportDebug()) - dprint(".REQUEST 1.1: !!ERROR!!: " + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".REQUEST 1.1<-: " + header); - } - } - - // REVISIT: this is identical to 1_0 except for fragment part. - public void handleInput(RequestMessage_1_2 header) throws IOException - { - try { - try { - - messageHeader = requestHeader = (RequestMessage) header; - - header.unmarshalRequestID(dispatchByteBuffer); - setInputObject(); - - if (transportDebug()) dprint(".REQUEST 1.2->: id/" - + header.getRequestId() - + ": " - + header); - - // NOTE: in the old code this used to be done conditionally: - // if (header.moreFragmentsToFollow()). - // Now we always put it in. We take it out when - // the response is done. - // This must happen now so if a header is fragmented the stream - // may be found. - connection.serverRequestMapPut(header.getRequestId(), this); - } finally { - // Leader/Follower. - // Note: This *MUST* come after putting stream in above map - // since the header may be fragmented and you do not want to - // start reading again until the map above is set. - setWorkThenPoolOrResumeSelect(header); - } - //inputObject.unmarshalHeader(); // done in subcontract. - getProtocolHandler().handleRequest(header, this); - } catch (Throwable t) { - if (transportDebug()) dprint(".REQUEST 1.2: id/" - + header.getRequestId() - + ": !!ERROR!!: " - + header, - t); - // Mask the exception from thread.; - } finally { - connection.serverRequestMapRemove(header.getRequestId()); - - if (transportDebug()) dprint(".REQUEST 1.2<-: id/" - + header.getRequestId() - + ": " - + header); - } - } - - public void handleInput(ReplyMessage_1_0 header) throws IOException - { - try { - try { - if (transportDebug()) dprint(".REPLY 1.0->: " + header); - messageHeader = replyHeader = (ReplyMessage) header; - setInputObject(); - - // REVISIT: this should be done by waiting thread. - inputObject.unmarshalHeader(); - - signalResponseReceived(); - } finally{ - setWorkThenReadOrResumeSelect(header); - } - } catch (Throwable t) { - if (transportDebug())dprint(".REPLY 1.0: !!ERROR!!: " + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".REPLY 1.0<-: " + header); - } - } - - public void handleInput(ReplyMessage_1_1 header) throws IOException - { - try { - if (transportDebug()) dprint(".REPLY 1.1->: " + header); - messageHeader = replyHeader = (ReplyMessage) header; - setInputObject(); - - if (header.moreFragmentsToFollow()) { - - // More fragments are coming to complete this reply, so keep - // a reference to the InputStream so we can add the fragments - connection.clientReply_1_1_Put(this); - - // In 1.1, we can't assume that we have the request ID in the - // first fragment. Thus, another thread is used - // to be the reader while this thread unmarshals - // the extended header and wakes up the client thread. - setWorkThenPoolOrResumeSelect(header); - - // REVISIT - error handling. - // This must be done now. - inputObject.unmarshalHeader(); - - signalResponseReceived(); - - } else { - - // Not fragmented, therefore we know the request - // ID is here. Thus, we can unmarshal the extended header - // and wake up the client thread without using a third - // thread as above. - - // REVISIT - error handling during unmarshal. - // This must be done now to get the request id. - inputObject.unmarshalHeader(); - - signalResponseReceived(); - - setWorkThenReadOrResumeSelect(header); - } - } catch (Throwable t) { - if (transportDebug()) dprint(".REPLY 1.1: !!ERROR!!: " + header); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".REPLY 1.1<-: " + header); - } - } - - public void handleInput(ReplyMessage_1_2 header) throws IOException - { - try { - try { - messageHeader = replyHeader = (ReplyMessage) header; - - // We know that the request ID is in the first fragment - header.unmarshalRequestID(dispatchByteBuffer); - - if (transportDebug()) { - dprint(".REPLY 1.2->: id/" - + + header.getRequestId() - + ": more?: " + header.moreFragmentsToFollow() - + ": " + header); - } - - setInputObject(); - - signalResponseReceived(); - } finally { - setWorkThenReadOrResumeSelect(header); - } - } catch (Throwable t) { - if (transportDebug()) dprint(".REPLY 1.2: id/" - + header.getRequestId() - + ": !!ERROR!!: " - + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".REPLY 1.2<-: id/" - + header.getRequestId() - + ": " - + header); - } - } - - public void handleInput(LocateRequestMessage_1_0 header) throws IOException - { - try { - if (transportDebug()) - dprint(".LOCATE_REQUEST 1.0->: " + header); - try { - messageHeader = header; - setInputObject(); - } finally { - setWorkThenPoolOrResumeSelect(header); - } - getProtocolHandler().handleRequest(header, this); - } catch (Throwable t) { - if (transportDebug()) - dprint(".LOCATE_REQUEST 1.0: !!ERROR!!: " + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) - dprint(".LOCATE_REQUEST 1.0<-: " + header); - } - - } - - public void handleInput(LocateRequestMessage_1_1 header) throws IOException - { - try { - if (transportDebug()) - dprint(".LOCATE_REQUEST 1.1->: " + header); - try { - messageHeader = header; - setInputObject(); - } finally { - setWorkThenPoolOrResumeSelect(header); - } - getProtocolHandler().handleRequest(header, this); - } catch (Throwable t) { - if (transportDebug()) - dprint(".LOCATE_REQUEST 1.1: !!ERROR!!: " + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) - dprint(".LOCATE_REQUEST 1.1<-:" + header); - } - } - - public void handleInput(LocateRequestMessage_1_2 header) throws IOException - { - try { - try { - messageHeader = header; - - header.unmarshalRequestID(dispatchByteBuffer); - setInputObject(); - - if (transportDebug()) - dprint(".LOCATE_REQUEST 1.2->: id/" - + header.getRequestId() - + ": " - + header); - - if (header.moreFragmentsToFollow()) { - connection.serverRequestMapPut(header.getRequestId(),this); - } - } finally { - setWorkThenPoolOrResumeSelect(header); - } - getProtocolHandler().handleRequest(header, this); - } catch (Throwable t) { - if (transportDebug()) - dprint(".LOCATE_REQUEST 1.2: id/" - + header.getRequestId() - + ": !!ERROR!!: " - + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) - dprint(".LOCATE_REQUEST 1.2<-: id/" - + header.getRequestId() - + ": " - + header); - } - } - - public void handleInput(LocateReplyMessage_1_0 header) throws IOException - { - try { - if (transportDebug()) - dprint(".LOCATE_REPLY 1.0->:" + header); - try { - messageHeader = header; - setInputObject(); - inputObject.unmarshalHeader(); // REVISIT Put in subcontract. - signalResponseReceived(); - } finally { - setWorkThenReadOrResumeSelect(header); - } - } catch (Throwable t) { - if (transportDebug()) - dprint(".LOCATE_REPLY 1.0: !!ERROR!!: " + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) - dprint(".LOCATE_REPLY 1.0<-: " + header); - } - } - - public void handleInput(LocateReplyMessage_1_1 header) throws IOException - { - try { - if (transportDebug()) dprint(".LOCATE_REPLY 1.1->: " + header); - try { - messageHeader = header; - setInputObject(); - // Fragmented LocateReplies are not allowed in 1.1. - inputObject.unmarshalHeader(); - signalResponseReceived(); - } finally { - setWorkThenReadOrResumeSelect(header); - } - } catch (Throwable t) { - if (transportDebug()) - dprint(".LOCATE_REPLY 1.1: !!ERROR!!: " + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".LOCATE_REPLY 1.1<-: " + header); - } - } - - public void handleInput(LocateReplyMessage_1_2 header) throws IOException - { - try { - try { - messageHeader = header; - - // No need to put in client reply map - already there. - header.unmarshalRequestID(dispatchByteBuffer); - - setInputObject(); - - if (transportDebug()) dprint(".LOCATE_REPLY 1.2->: id/" - + header.getRequestId() - + ": " - + header); - - signalResponseReceived(); - } finally { - setWorkThenPoolOrResumeSelect(header); // REVISIT - } - } catch (Throwable t) { - if (transportDebug()) - dprint(".LOCATE_REPLY 1.2: id/" - + header.getRequestId() - + ": !!ERROR!!: " - + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".LOCATE_REPLY 1.2<-: id/" - + header.getRequestId() - + ": " - + header); - } - } - - public void handleInput(FragmentMessage_1_1 header) throws IOException - { - try { - if (transportDebug()) { - dprint(".FRAGMENT 1.1->: " - + "more?: " + header.moreFragmentsToFollow() - + ": " + header); - } - try { - messageHeader = header; - MessageMediator mediator = null; - CDRInputObject inputObject = null; - - if (connection.isServer()) { - mediator = connection.serverRequest_1_1_Get(); - } else { - mediator = connection.clientReply_1_1_Get(); - } - if (mediator != null) { - inputObject = (CDRInputObject) mediator.getInputObject(); - } - - // If no input stream available, then discard the fragment. - // This can happen: - // 1. if a fragment message is received prior to receiving - // the original request/reply message. Very unlikely. - // 2. if a fragment message is received after the - // reply has been sent (early replies) - // Note: In the case of early replies, the fragments received - // during the request processing (which are never unmarshaled), - // will eventually be discarded by the GC. - if (inputObject == null) { - if (transportDebug()) - dprint(".FRAGMENT 1.1: ++++DISCARDING++++: " + header); - // need to release dispatchByteBuffer to pool if - // we are discarding - releaseByteBufferToPool(); - return; - } - - inputObject.getBufferManager() - .processFragment(dispatchByteBuffer, header); - - if (! header.moreFragmentsToFollow()) { - if (connection.isServer()) { - connection.serverRequest_1_1_Remove(); - } else { - connection.clientReply_1_1_Remove(); - } - } - } finally { - // NOTE: This *must* come after queing the fragment - // when using the selector to ensure fragments stay in order. - setWorkThenReadOrResumeSelect(header); - } - } catch (Throwable t) { - if (transportDebug()) - dprint(".FRAGMENT 1.1: !!ERROR!!: " + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".FRAGMENT 1.1<-: " + header); - } - } - - public void handleInput(FragmentMessage_1_2 header) throws IOException - { - try { - try { - messageHeader = header; - - // Note: We know it's a 1.2 fragment, we have the data, but - // we need the IIOPInputStream instance to unmarshal the - // request ID... but we need the request ID to get the - // IIOPInputStream instance. So we peek at the raw bytes. - - header.unmarshalRequestID(dispatchByteBuffer); - - if (transportDebug()) { - dprint(".FRAGMENT 1.2->: id/" - + header.getRequestId() - + ": more?: " + header.moreFragmentsToFollow() - + ": " + header); - } - - MessageMediator mediator = null; - InputObject inputObject = null; - - if (connection.isServer()) { - mediator = - connection.serverRequestMapGet(header.getRequestId()); - } else { - mediator = - connection.clientRequestMapGet(header.getRequestId()); - } - if (mediator != null) { - inputObject = mediator.getInputObject(); - } - // See 1.1 comments. - if (inputObject == null) { - if (transportDebug()) { - dprint(".FRAGMENT 1.2: id/" - + header.getRequestId() - + ": ++++DISCARDING++++: " - + header); - } - // need to release dispatchByteBuffer to pool if - // we are discarding - releaseByteBufferToPool(); - return; - } - ((CDRInputObject)inputObject) - .getBufferManager().processFragment( - dispatchByteBuffer, header); - - // REVISIT: but if it is a server don't you have to remove the - // stream from the map? - if (! connection.isServer()) { - /* REVISIT - * No need to do anything. - * Should we mark that last was received? - if (! header.moreFragmentsToFollow()) { - // Last fragment. - } - */ - } - } finally { - // NOTE: This *must* come after queing the fragment - // when using the selector to ensure fragments stay in order. - setWorkThenReadOrResumeSelect(header); - } - } catch (Throwable t) { - if (transportDebug()) - dprint(".FRAGMENT 1.2: id/" - + header.getRequestId() - + ": !!ERROR!!: " - + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".FRAGMENT 1.2<-: id/" - + header.getRequestId() - + ": " - + header); - } - } - - public void handleInput(CancelRequestMessage header) throws IOException - { - try { - try { - messageHeader = header; - setInputObject(); - - // REVISIT: Move these two to subcontract. - inputObject.unmarshalHeader(); - - if (transportDebug()) dprint(".CANCEL->: id/" - + header.getRequestId() + ": " - + header.getGIOPVersion() + ": " - + header); - - processCancelRequest(header.getRequestId()); - releaseByteBufferToPool(); - } finally { - setWorkThenReadOrResumeSelect(header); - } - } catch (Throwable t) { - if (transportDebug()) dprint(".CANCEL: id/" - + header.getRequestId() - + ": !!ERROR!!: " - + header, t); - // Mask the exception from thread.; - } finally { - if (transportDebug()) dprint(".CANCEL<-: id/" - + header.getRequestId() + ": " - + header.getGIOPVersion() + ": " - + header); - } - } - - private void throwNotImplemented() - { - isThreadDone = false; - throwNotImplemented(""); - } - - private void throwNotImplemented(String msg) - { - throw new RuntimeException("CorbaMessageMediatorImpl: not implemented " + msg); - } - - private void dprint(String msg, Throwable t) - { - dprint(msg); - t.printStackTrace(System.out); - } - - private void dprint(String msg) - { - ORBUtility.dprint("CorbaMessageMediatorImpl", msg); - } - - protected String opAndId(CorbaMessageMediator mediator) - { - return ORBUtility.operationNameAndRequestId(mediator); - } - - private boolean transportDebug() - { - return orb.transportDebugFlag; - } - - // REVISIT: move this to subcontract (but both client and server need it). - private final void processCancelRequest(int cancelReqId) { - - // The GIOP version of CancelRequest does not matter, since - // CancelRequest_1_0 could be sent to cancel a request which - // has a different GIOP version. - - /* - * CancelRequest processing logic : - * - * - find the request with matching requestId - * - * - call cancelProcessing() in BufferManagerRead [BMR] - * - * - the hope is that worker thread would call BMR.underflow() - * to wait for more fragments to come in. When BMR.underflow() is - * called, if a CancelRequest had already arrived, - * the worker thread would throw ThreadDeath, - * else the thread would wait to be notified of the - * arrival of a new fragment or CancelRequest. Upon notification, - * the woken up thread would check to see if a CancelRequest had - * arrived and if so throw a ThreadDeath or it will continue to - * process the received fragment. - * - * - if all the fragments had been received prior to CancelRequest - * then the worker thread would never block in BMR.underflow(). - * So, setting the abort flag in BMR has no effect. The request - * processing will complete normally. - * - * - in the case where the server has received enough fragments to - * start processing the request and the server sends out - * an early reply. In such a case if the CancelRequest arrives - * after the reply has been sent, it has no effect. - */ - - if (!connection.isServer()) { - return; // we do not support bi-directional giop yet, ignore. - } - - // Try to get hold of the InputStream buffer. - // In the case of 1.0 requests there is no way to get hold of - // InputStream. Try out the 1.1 and 1.2 cases. - - // was the request 1.2 ? - MessageMediator mediator = connection.serverRequestMapGet(cancelReqId); - int requestId ; - if (mediator == null) { - // was the request 1.1 ? - mediator = connection.serverRequest_1_1_Get(); - if (mediator == null) { - // XXX log this! - // either the request was 1.0 - // or an early reply has already been sent - // or request processing is over - // or its a spurious CancelRequest - return; // do nothing. - } - - requestId = ((CorbaMessageMediator) mediator).getRequestId(); - - if (requestId != cancelReqId) { - // A spurious 1.1 CancelRequest has been received. - // XXX log this! - return; // do nothing - } - - if (requestId == 0) { // special case - // XXX log this - // this means that - // 1. the 1.1 requests' requestId has not been received - // i.e., a CancelRequest was received even before the - // 1.1 request was received. The spec disallows this. - // 2. or the 1.1 request has a requestId 0. - // - // It is a little tricky to distinguish these two. So, be - // conservative and do not cancel the request. Downside is that - // 1.1 requests with requestId of 0 will never be cancelled. - return; // do nothing - } - } else { - requestId = ((CorbaMessageMediator) mediator).getRequestId(); - } - - Message msg = ((CorbaMessageMediator)mediator).getRequestHeader(); - if (msg.getType() != Message.GIOPRequest) { - // Any mediator obtained here should only ever be for a GIOP - // request. - wrapper.badMessageTypeForCancel() ; - } - - // At this point we have a valid message mediator that contains - // a valid requestId. - - // at this point we have chosen a request to be cancelled. But we - // do not know if the target object's method has been invoked or not. - // Request input stream being available simply means that the request - // processing is not over yet. simply set the abort flag in the - // BMRS and hope that the worker thread would notice it (this can - // happen only if the request stream is being unmarshalled and the - // target's method has not been invoked yet). This guarantees - // that the requests which have been dispatched to the - // target's method will never be cancelled. - - BufferManagerReadStream bufferManager = (BufferManagerReadStream) - ((CDRInputObject)mediator.getInputObject()).getBufferManager(); - bufferManager.cancelProcessing(cancelReqId); - } - - //////////////////////////////////////////////////// - // - // spi.protocol.CorbaProtocolHandler - // - - public void handleRequest(RequestMessage msg, - CorbaMessageMediator messageMediator) - { - try { - beginRequest(messageMediator); - try { - handleRequestRequest(messageMediator); - if (messageMediator.isOneWay()) { - return; - } - } catch (Throwable t) { - if (messageMediator.isOneWay()) { - return; - } - handleThrowableDuringServerDispatch( - messageMediator, t, CompletionStatus.COMPLETED_MAYBE); - } - sendResponse(messageMediator); - } catch (Throwable t) { - dispatchError(messageMediator, "RequestMessage", t); - } finally { - endRequest(messageMediator); - } - } - - public void handleRequest(LocateRequestMessage msg, - CorbaMessageMediator messageMediator) - { - try { - beginRequest(messageMediator); - try { - handleLocateRequest(messageMediator); - } catch (Throwable t) { - handleThrowableDuringServerDispatch( - messageMediator, t, CompletionStatus.COMPLETED_MAYBE); - } - sendResponse(messageMediator); - } catch (Throwable t) { - dispatchError(messageMediator, "LocateRequestMessage", t); - } finally { - endRequest(messageMediator); - } - } - - private void beginRequest(CorbaMessageMediator messageMediator) - { - ORB orb = (ORB) messageMediator.getBroker(); - if (orb.subcontractDebugFlag) { - dprint(".handleRequest->:"); - } - connection.serverRequestProcessingBegins(); - } - - private void dispatchError(CorbaMessageMediator messageMediator, - String msg, Throwable t) - { - if (orb.subcontractDebugFlag) { - dprint(".handleRequest: " + opAndId(messageMediator) - + ": !!ERROR!!: " - + msg, - t); - } - // REVISIT - this makes hcks sendTwoObjects fail - // messageMediator.getConnection().close(); - } - - private void sendResponse(CorbaMessageMediator messageMediator) - { - if (orb.subcontractDebugFlag) { - dprint(".handleRequest: " + opAndId(messageMediator) - + ": sending response"); - } - // REVISIT - type and location - CDROutputObject outputObject = (CDROutputObject) - messageMediator.getOutputObject(); - if (outputObject != null) { - // REVISIT - can be null for TRANSIENT below. - outputObject.finishSendingMessage(); - } - } - - private void endRequest(CorbaMessageMediator messageMediator) - { - ORB orb = (ORB) messageMediator.getBroker(); - if (orb.subcontractDebugFlag) { - dprint(".handleRequest<-: " + opAndId(messageMediator)); - } - - // release NIO ByteBuffers to ByteBufferPool - - try { - OutputObject outputObj = messageMediator.getOutputObject(); - if (outputObj != null) { - outputObj.close(); - } - InputObject inputObj = messageMediator.getInputObject(); - if (inputObj != null) { - inputObj.close(); - } - } catch (IOException ex) { - // Given what close() does, this catch shouldn't ever happen. - // See CDRInput/OutputObject.close() for more info. - // It also won't result in a Corba error if an IOException happens. - if (orb.subcontractDebugFlag) { - dprint(".endRequest: IOException:" + ex.getMessage(), ex); - } - } finally { - ((CorbaConnection)messageMediator.getConnection()).serverRequestProcessingEnds(); - } - } - - protected void handleRequestRequest(CorbaMessageMediator messageMediator) - { - // Does nothing if already unmarshaled. - ((CDRInputObject)messageMediator.getInputObject()).unmarshalHeader(); - - ORB orb = (ORB)messageMediator.getBroker(); - synchronized (orb) { - orb.checkShutdownState(); - } - - ObjectKey okey = messageMediator.getObjectKey(); - if (orb.subcontractDebugFlag) { - ObjectKeyTemplate oktemp = okey.getTemplate() ; - dprint( ".handleRequest: " + opAndId(messageMediator) - + ": dispatching to scid: " + oktemp.getSubcontractId()); - } - - CorbaServerRequestDispatcher sc = okey.getServerRequestDispatcher(orb); - - if (orb.subcontractDebugFlag) { - dprint(".handleRequest: " + opAndId(messageMediator) - + ": dispatching to sc: " + sc); - } - - if (sc == null) { - throw wrapper.noServerScInDispatch() ; - } - - // NOTE: - // This is necessary so mediator can act as ResponseHandler - // and pass necessary info to response constructors located - // in the subcontract. - // REVISIT - same class right now. - //messageMediator.setProtocolHandler(this); - - try { - orb.startingDispatch(); - sc.dispatch(messageMediator); - } finally { - orb.finishedDispatch(); - } - } - - protected void handleLocateRequest(CorbaMessageMediator messageMediator) - { - ORB orb = (ORB)messageMediator.getBroker(); - LocateRequestMessage msg = (LocateRequestMessage) - messageMediator.getDispatchHeader(); - IOR ior = null; - LocateReplyMessage reply = null; - short addrDisp = -1; - - try { - ((CDRInputObject)messageMediator.getInputObject()).unmarshalHeader(); - CorbaServerRequestDispatcher sc = - msg.getObjectKey().getServerRequestDispatcher( orb ) ; - if (sc == null) { - return; - } - - ior = sc.locate(msg.getObjectKey()); - - if ( ior == null ) { - reply = MessageBase.createLocateReply( - orb, msg.getGIOPVersion(), - msg.getEncodingVersion(), - msg.getRequestId(), - LocateReplyMessage.OBJECT_HERE, null); - - } else { - reply = MessageBase.createLocateReply( - orb, msg.getGIOPVersion(), - msg.getEncodingVersion(), - msg.getRequestId(), - LocateReplyMessage.OBJECT_FORWARD, ior); - } - // REVISIT: Should we catch SystemExceptions? - - } catch (AddressingDispositionException ex) { - - // create a response containing the expected target - // addressing disposition. - - reply = MessageBase.createLocateReply( - orb, msg.getGIOPVersion(), - msg.getEncodingVersion(), - msg.getRequestId(), - LocateReplyMessage.LOC_NEEDS_ADDRESSING_MODE, null); - - addrDisp = ex.expectedAddrDisp(); - - } catch (RequestCanceledException ex) { - - return; // no need to send reply - - } catch ( Exception ex ) { - - // REVISIT If exception is not OBJECT_NOT_EXIST, it should - // have a different reply - - // This handles OBJECT_NOT_EXIST exceptions thrown in - // the subcontract or obj manager. Send back UNKNOWN_OBJECT. - - reply = MessageBase.createLocateReply( - orb, msg.getGIOPVersion(), - msg.getEncodingVersion(), - msg.getRequestId(), - LocateReplyMessage.UNKNOWN_OBJECT, null); - } - - CDROutputObject outputObject = - createAppropriateOutputObject(messageMediator, - msg, reply); - messageMediator.setOutputObject(outputObject); - outputObject.setMessageMediator(messageMediator); - - reply.write(outputObject); - // outputObject.setMessage(reply); // REVISIT - not necessary - if (ior != null) { - ior.write(outputObject); - } - if (addrDisp != -1) { - AddressingDispositionHelper.write(outputObject, addrDisp); - } - } - - private CDROutputObject createAppropriateOutputObject( - CorbaMessageMediator messageMediator, - Message msg, LocateReplyMessage reply) - { - CDROutputObject outputObject; - - if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) { - // locate msgs 1.0 & 1.1 :=> grow, - outputObject = sun.corba.OutputStreamFactory.newCDROutputObject( - (ORB) messageMediator.getBroker(), - this, - GIOPVersion.V1_0, - (CorbaConnection) messageMediator.getConnection(), - reply, - ORBConstants.STREAM_FORMAT_VERSION_1); - } else { - // 1.2 :=> stream - outputObject = sun.corba.OutputStreamFactory.newCDROutputObject( - (ORB) messageMediator.getBroker(), - messageMediator, - reply, - ORBConstants.STREAM_FORMAT_VERSION_1); - } - return outputObject; - } - - public void handleThrowableDuringServerDispatch( - CorbaMessageMediator messageMediator, - Throwable throwable, - CompletionStatus completionStatus) - { - if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) { - dprint(".handleThrowableDuringServerDispatch: " - + opAndId(messageMediator) + ": " - + throwable); - } - - // If we haven't unmarshaled the header, we probably don't - // have enough information to even send back a reply. - - // REVISIT - // Cannot do this check. When target addressing disposition does - // not match (during header unmarshaling) it throws an exception - // to be handled here. - /* - if (! ((CDRInputObject)messageMediator.getInputObject()) - .unmarshaledHeader()) { - return; - } - */ - handleThrowableDuringServerDispatch(messageMediator, - throwable, - completionStatus, - 1); - } - - - // REVISIT - catch and ignore RequestCanceledException. - - protected void handleThrowableDuringServerDispatch( - CorbaMessageMediator messageMediator, - Throwable throwable, - CompletionStatus completionStatus, - int iteration) - { - if (iteration > 10) { - if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) { - dprint(".handleThrowableDuringServerDispatch: " - + opAndId(messageMediator) - + ": cannot handle: " - + throwable); - } - - // REVISIT - should we close connection? - RuntimeException rte = - new RuntimeException("handleThrowableDuringServerDispatch: " + - "cannot create response."); - rte.initCause(throwable); - throw rte; - } - - try { - if (throwable instanceof ForwardException) { - ForwardException fex = (ForwardException)throwable ; - createLocationForward( messageMediator, fex.getIOR(), null ) ; - return; - } - - if (throwable instanceof AddressingDispositionException) { - handleAddressingDisposition( - messageMediator, - (AddressingDispositionException)throwable); - return; - } - - // Else. - - SystemException sex = - convertThrowableToSystemException(throwable, completionStatus); - - createSystemExceptionResponse(messageMediator, sex, null); - return; - - } catch (Throwable throwable2) { - - // User code (e.g., postinvoke, interceptors) may change - // the exception, so we end up back here. - // Report the changed exception. - - handleThrowableDuringServerDispatch(messageMediator, - throwable2, - completionStatus, - iteration + 1); - return; - } - } - - protected SystemException convertThrowableToSystemException( - Throwable throwable, - CompletionStatus completionStatus) - { - if (throwable instanceof SystemException) { - return (SystemException)throwable; - } - - if (throwable instanceof RequestCanceledException) { - // Reporting an exception response causes the - // poa current stack, the interceptor stacks, etc. - // to be balanced. It also notifies interceptors - // that the request was cancelled. - - return wrapper.requestCanceled( throwable ) ; - } - - // NOTE: We do not trap ThreadDeath above Throwable. - // There is no reason to stop the thread. It is - // just a worker thread. The ORB never throws - // ThreadDeath. Client code may (e.g., in ServantManagers, - // interceptors, or servants) but that should not - // effect the ORB threads. So it is just handled - // generically. - - // - // Last resort. - // If user code throws a non-SystemException report it generically. - // - - return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ; - } - - protected void handleAddressingDisposition( - CorbaMessageMediator messageMediator, - AddressingDispositionException ex) - { - - short addrDisp = -1; - - // from iiop.RequestProcessor. - - // Respond with expected target addressing disposition. - - switch (messageMediator.getRequestHeader().getType()) { - case Message.GIOPRequest : - ReplyMessage replyHeader = MessageBase.createReply( - (ORB)messageMediator.getBroker(), - messageMediator.getGIOPVersion(), - messageMediator.getEncodingVersion(), - messageMediator.getRequestId(), - ReplyMessage.NEEDS_ADDRESSING_MODE, - null, null); - // REVISIT: via acceptor factory. - CDROutputObject outputObject = - sun.corba.OutputStreamFactory.newCDROutputObject( - (ORB)messageMediator.getBroker(), - this, - messageMediator.getGIOPVersion(), - (CorbaConnection)messageMediator.getConnection(), - replyHeader, - ORBConstants.STREAM_FORMAT_VERSION_1); - messageMediator.setOutputObject(outputObject); - outputObject.setMessageMediator(messageMediator); - replyHeader.write(outputObject); - AddressingDispositionHelper.write(outputObject, - ex.expectedAddrDisp()); - return; - - case Message.GIOPLocateRequest : - LocateReplyMessage locateReplyHeader = MessageBase.createLocateReply( - (ORB)messageMediator.getBroker(), - messageMediator.getGIOPVersion(), - messageMediator.getEncodingVersion(), - messageMediator.getRequestId(), - LocateReplyMessage.LOC_NEEDS_ADDRESSING_MODE, - null); - - addrDisp = ex.expectedAddrDisp(); - - // REVISIT: via acceptor factory. - outputObject = - createAppropriateOutputObject(messageMediator, - messageMediator.getRequestHeader(), - locateReplyHeader); - messageMediator.setOutputObject(outputObject); - outputObject.setMessageMediator(messageMediator); - locateReplyHeader.write(outputObject); - IOR ior = null; - if (ior != null) { - ior.write(outputObject); - } - if (addrDisp != -1) { - AddressingDispositionHelper.write(outputObject, addrDisp); - } - return; - } - } - - public CorbaMessageMediator createResponse( - CorbaMessageMediator messageMediator, - ServiceContexts svc) - { - // REVISIT: ignore service contexts during framework transition. - // They are set in SubcontractResponseHandler to the wrong connection. - // Then they would be set again here and a duplicate contexts - // exception occurs. - return createResponseHelper( - messageMediator, - getServiceContextsForReply(messageMediator, null)); - } - - public CorbaMessageMediator createUserExceptionResponse( - CorbaMessageMediator messageMediator, ServiceContexts svc) - { - // REVISIT - same as above - return createResponseHelper( - messageMediator, - getServiceContextsForReply(messageMediator, null), - true); - } - - public CorbaMessageMediator createUnknownExceptionResponse( - CorbaMessageMediator messageMediator, UnknownException ex) - { - // NOTE: This service context container gets augmented in - // tail call. - ServiceContexts contexts = null; - SystemException sys = new UNKNOWN( 0, - CompletionStatus.COMPLETED_MAYBE); - contexts = new ServiceContexts( (ORB)messageMediator.getBroker() ); - UEInfoServiceContext uei = new UEInfoServiceContext(sys); - contexts.put( uei ) ; - return createSystemExceptionResponse(messageMediator, sys, contexts); - } - - public CorbaMessageMediator createSystemExceptionResponse( - CorbaMessageMediator messageMediator, - SystemException ex, - ServiceContexts svc) - { - if (messageMediator.getConnection() != null) { - // It is possible that fragments of response have already been - // sent. Then an error may occur (e.g. marshaling error like - // non serializable object). In that case it is too late - // to send the exception. We just return the existing fragmented - // stream here. This will cause an incomplete last fragment - // to be sent. Then the other side will get a marshaling error - // when attempting to unmarshal. - - // REVISIT: Impl - make interface method to do the following. - CorbaMessageMediatorImpl mediator = (CorbaMessageMediatorImpl) - ((CorbaConnection)messageMediator.getConnection()) - .serverRequestMapGet(messageMediator.getRequestId()); - - OutputObject existingOutputObject = null; - if (mediator != null) { - existingOutputObject = mediator.getOutputObject(); - } - - // REVISIT: need to think about messageMediator containing correct - // pointer to output object. - if (existingOutputObject != null && - mediator.sentFragment() && - ! mediator.sentFullMessage()) - { - return mediator; - } - } - - // Only do this if interceptors have been initialized on this request - // and have not completed their lifecycle (otherwise the info stack - // may be empty or have a different request's entry on top). - if (messageMediator.executePIInResponseConstructor()) { - // REVISIT: not necessary in framework now? - // Inform Portable Interceptors of the SystemException. This is - // required to be done here because the ending interception point - // is called in the when creating the response below - // but we do not currently write the SystemException into the - // response until after the ending point is called. - ((ORB)messageMediator.getBroker()).getPIHandler().setServerPIInfo( ex ); - } - - if (((ORB)messageMediator.getBroker()).subcontractDebugFlag && - ex != null) - { - dprint(".createSystemExceptionResponse: " - + opAndId(messageMediator), - ex); - } - - ServiceContexts serviceContexts = - getServiceContextsForReply(messageMediator, svc); - - // NOTE: We MUST add the service context before creating - // the response since service contexts are written to the - // stream when the response object is created. - - addExceptionDetailMessage(messageMediator, ex, serviceContexts); - - CorbaMessageMediator response = - createResponseHelper(messageMediator, serviceContexts, false); - - // NOTE: From here on, it is too late to add more service contexts. - // They have already been serialized to the stream (and maybe fragments - // sent). - - ORBUtility.writeSystemException( - ex, (OutputStream)response.getOutputObject()); - - return response; - } - - private void addExceptionDetailMessage(CorbaMessageMediator mediator, - SystemException ex, - ServiceContexts serviceContexts) - { - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - PrintWriter pw = new PrintWriter(baos); - ex.printStackTrace(pw); - pw.flush(); // NOTE: you must flush or baos will be empty. - EncapsOutputStream encapsOutputStream = - sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker()); - encapsOutputStream.putEndian(); - encapsOutputStream.write_wstring(baos.toString()); - UnknownServiceContext serviceContext = - new UnknownServiceContext(ExceptionDetailMessage.value, - encapsOutputStream.toByteArray()); - serviceContexts.put(serviceContext); - } - - public CorbaMessageMediator createLocationForward( - CorbaMessageMediator messageMediator, IOR ior, ServiceContexts svc) - { - ReplyMessage reply - = MessageBase.createReply( - (ORB)messageMediator.getBroker(), - messageMediator.getGIOPVersion(), - messageMediator.getEncodingVersion(), - messageMediator.getRequestId(), - ReplyMessage.LOCATION_FORWARD, - getServiceContextsForReply(messageMediator, svc), - ior); - - return createResponseHelper(messageMediator, reply, ior); - } - - protected CorbaMessageMediator createResponseHelper( - CorbaMessageMediator messageMediator, ServiceContexts svc) - { - ReplyMessage message = - MessageBase.createReply( - (ORB)messageMediator.getBroker(), - messageMediator.getGIOPVersion(), - messageMediator.getEncodingVersion(), - messageMediator.getRequestId(), - ReplyMessage.NO_EXCEPTION, - svc, - null); - return createResponseHelper(messageMediator, message, null); - } - - protected CorbaMessageMediator createResponseHelper( - CorbaMessageMediator messageMediator, ServiceContexts svc,boolean user) - { - ReplyMessage message = - MessageBase.createReply( - (ORB)messageMediator.getBroker(), - messageMediator.getGIOPVersion(), - messageMediator.getEncodingVersion(), - messageMediator.getRequestId(), - user ? ReplyMessage.USER_EXCEPTION : - ReplyMessage.SYSTEM_EXCEPTION, - svc, - null); - return createResponseHelper(messageMediator, message, null); - } - - // REVISIT - IOR arg is ignored. - protected CorbaMessageMediator createResponseHelper( - CorbaMessageMediator messageMediator, ReplyMessage reply, IOR ior) - { - // REVISIT - these should be invoked from subcontract. - runServantPostInvoke(messageMediator); - runInterceptors(messageMediator, reply); - runRemoveThreadInfo(messageMediator); - - if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) { - dprint(".createResponseHelper: " - + opAndId(messageMediator) + ": " - + reply); - } - - messageMediator.setReplyHeader(reply); - - OutputObject replyOutputObject; - // REVISIT = do not use null. - // - if (messageMediator.getConnection() == null) { - replyOutputObject = - sun.corba.OutputStreamFactory.newCDROutputObject(orb, - messageMediator, messageMediator.getReplyHeader(), - messageMediator.getStreamFormatVersion(), - BufferManagerFactory.GROW); - } else { - replyOutputObject = messageMediator.getConnection().getAcceptor() - .createOutputObject(messageMediator.getBroker(), messageMediator); - } - messageMediator.setOutputObject(replyOutputObject); - messageMediator.getOutputObject().setMessageMediator(messageMediator); - - reply.write((OutputStream) messageMediator.getOutputObject()); - if (reply.getIOR() != null) { - reply.getIOR().write((OutputStream) messageMediator.getOutputObject()); - } - // REVISIT - not necessary? - //messageMediator.this.replyIOR = reply.getIOR(); - - // NOTE: The mediator holds onto output object so return value - // not really necessary. - return messageMediator; - } - - protected void runServantPostInvoke(CorbaMessageMediator messageMediator) - { - // Run ServantLocator::postinvoke. This may cause a SystemException - // which will throw out of the constructor and return later - // to construct a reply for that exception. The internal logic - // of returnServant makes sure that postinvoke is only called once. - // REVISIT: instead of instanceof, put method on all orbs. - ORB orb = null; - // This flag is to deal with BootstrapServer use of reply streams, - // with ServerRequestDispatcher's use of reply streams, etc. - if (messageMediator.executeReturnServantInResponseConstructor()) { - // It is possible to get marshaling errors in the skeleton after - // postinvoke has completed. We must set this to false so that - // when the error exception reply is constructed we don't try - // to incorrectly access poa current (which will be the wrong - // one or an empty stack. - messageMediator.setExecuteReturnServantInResponseConstructor(false); - messageMediator.setExecuteRemoveThreadInfoInResponseConstructor(true); - - try { - orb = (ORB)messageMediator.getBroker(); - OAInvocationInfo info = orb.peekInvocationInfo() ; - ObjectAdapter oa = info.oa(); - try { - oa.returnServant() ; - } catch (Throwable thr) { - wrapper.unexpectedException( thr ) ; - - if (thr instanceof Error) - throw (Error)thr ; - else if (thr instanceof RuntimeException) - throw (RuntimeException)thr ; - } finally { - oa.exit(); - } - } catch (EmptyStackException ese) { - throw wrapper.emptyStackRunServantPostInvoke( ese ) ; - } - } - } - - protected void runInterceptors(CorbaMessageMediator messageMediator, - ReplyMessage reply) - { - if( messageMediator.executePIInResponseConstructor() ) { - // Invoke server request ending interception points (send_*): - // Note: this may end up with a SystemException or an internal - // Runtime ForwardRequest - ((ORB)messageMediator.getBroker()).getPIHandler(). - invokeServerPIEndingPoint( reply ); - - // Note this will be executed even if a ForwardRequest or - // SystemException is thrown by a Portable Interceptors ending - // point since we end up in this constructor again anyway. - ((ORB)messageMediator.getBroker()).getPIHandler(). - cleanupServerPIRequest(); - - // See createSystemExceptionResponse for why this is necesary. - messageMediator.setExecutePIInResponseConstructor(false); - } - } - - protected void runRemoveThreadInfo(CorbaMessageMediator messageMediator) - { - // Once you get here then the final reply is available (i.e., - // postinvoke and interceptors have completed. - if (messageMediator.executeRemoveThreadInfoInResponseConstructor()) { - messageMediator.setExecuteRemoveThreadInfoInResponseConstructor(false); - ((ORB)messageMediator.getBroker()).popInvocationInfo() ; - } - } - - protected ServiceContexts getServiceContextsForReply( - CorbaMessageMediator messageMediator, ServiceContexts contexts) - { - CorbaConnection c = (CorbaConnection) messageMediator.getConnection(); - - if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) { - dprint(".getServiceContextsForReply: " - + opAndId(messageMediator) - + ": " + c); - } - - if (contexts == null) { - contexts = new ServiceContexts(((ORB)messageMediator.getBroker())); - } - - // NOTE : We only want to send the runtime context the first time - - if (c != null && !c.isPostInitialContexts()) { - c.setPostInitialContexts(); - SendingContextServiceContext scsc = - new SendingContextServiceContext( - ((ORB)messageMediator.getBroker()).getFVDCodeBaseIOR()) ; - - if (contexts.get( scsc.getId() ) != null) - throw wrapper.duplicateSendingContextServiceContext() ; - - contexts.put( scsc ) ; - - if ( ((ORB)messageMediator.getBroker()).subcontractDebugFlag) - dprint(".getServiceContextsForReply: " - + opAndId(messageMediator) - + ": added SendingContextServiceContext" ) ; - } - - // send ORBVersion servicecontext as part of the Reply - - ORBVersionServiceContext ovsc - = new ORBVersionServiceContext(ORBVersionFactory.getORBVersion()); - - if (contexts.get( ovsc.getId() ) != null) - throw wrapper.duplicateOrbVersionServiceContext() ; - - contexts.put( ovsc ) ; - - if ( ((ORB)messageMediator.getBroker()).subcontractDebugFlag) - dprint(".getServiceContextsForReply: " - + opAndId(messageMediator) - + ": added ORB version service context"); - - return contexts; - } - - // REVISIT - this method should be migrated to orbutil.ORBUtility - // since all locations that release ByteBuffers use - // very similar logic and debug information. - private void releaseByteBufferToPool() { - if (dispatchByteBuffer != null) { - orb.getByteBufferPool().releaseByteBuffer(dispatchByteBuffer); - if (transportDebug()) { - int bbId = System.identityHashCode(dispatchByteBuffer); - StringBuffer sb = new StringBuffer(); - sb.append(".handleInput: releasing ByteBuffer (" + bbId + - ") to ByteBufferPool"); - dprint(sb.toString()); - } - } - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaServerRequestDispatcherImpl.java 2018-01-30 20:19:59.000000000 -0500 +++ /dev/null 2018-01-30 20:19:59.000000000 -0500 @@ -1,885 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - - -package com.sun.corba.se.impl.protocol; - -import org.omg.PortableServer.Servant ; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.UNKNOWN; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.Any; - -import org.omg.CORBA.portable.InvokeHandler; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.portable.UnknownException; -import org.omg.CORBA.portable.ResponseHandler; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersion; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.ObjectKey; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate; -import com.sun.corba.se.spi.ior.ObjectAdapterId; -import com.sun.corba.se.spi.oa.ObjectAdapterFactory; -import com.sun.corba.se.spi.oa.ObjectAdapter; -import com.sun.corba.se.spi.oa.OAInvocationInfo; -import com.sun.corba.se.spi.oa.OADestroyed; -import com.sun.corba.se.spi.oa.NullServant; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher; -import com.sun.corba.se.spi.protocol.ForwardException ; -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.impl.protocol.SpecialMethod ; -import com.sun.corba.se.spi.servicecontext.ServiceContext; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext; -import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext; -import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext; -import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext; - -import com.sun.corba.se.impl.corba.ServerRequestImpl ; -import com.sun.corba.se.impl.encoding.MarshalInputStream; -import com.sun.corba.se.impl.encoding.MarshalOutputStream; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.protocol.RequestCanceledException; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.logging.POASystemException; - -public class CorbaServerRequestDispatcherImpl - implements CorbaServerRequestDispatcher -{ - protected ORB orb; // my ORB instance - private ORBUtilSystemException wrapper ; - private POASystemException poaWrapper ; - - // Added from last version because it broke the build - RTW - // XXX remove me and rebuild: probably no longer needed - // public static final int UNKNOWN_EXCEPTION_INFO_ID = 9; - - public CorbaServerRequestDispatcherImpl(ORB orb) - { - this.orb = orb; - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - poaWrapper = POASystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - /** XXX/REVISIT: - * We do not want to look for a servant in the POA/ServantManager case, - * but we could in most other cases. The OA could have a method that - * returns true if the servant MAY exist, and false only if the servant - * definitely DOES NOT exist. - * - * XXX/REVISIT: - * We may wish to indicate OBJECT_HERE by some mechanism other than - * returning a null result. - * - * Called from ORB.locate when a LocateRequest arrives. - * Result is not always absolutely correct: may indicate OBJECT_HERE - * for non-existent objects, which is resolved on invocation. This - * "bug" is unavoidable, since in general the object may be destroyed - * between a locate and a request. Note that this only checks that - * the appropriate ObjectAdapter is available, not that the servant - * actually exists. - * Need to signal one of OBJECT_HERE, OBJECT_FORWARD, OBJECT_NOT_EXIST. - * @return Result is null if object is (possibly) implemented here, otherwise - * an IOR indicating objref to forward the request to. - * @exception OBJECT_NOT_EXIST is thrown if we know the object does not - * exist here, and we are not forwarding. - */ - public IOR locate(ObjectKey okey) - { - try { - if (orb.subcontractDebugFlag) - dprint(".locate->"); - - ObjectKeyTemplate oktemp = okey.getTemplate() ; - - try { - checkServerId(okey); - } catch (ForwardException fex) { - return fex.getIOR() ; - } - - // Called only for its side-effect of throwing appropriate exceptions - findObjectAdapter(oktemp); - - return null ; - } finally { - if (orb.subcontractDebugFlag) - dprint(".locate<-"); - } - } - - public void dispatch(MessageMediator messageMediator) - { - CorbaMessageMediator request = (CorbaMessageMediator) messageMediator; - try { - if (orb.subcontractDebugFlag) { - dprint(".dispatch->: " + opAndId(request)); - } - - // to set the codebase information, if any transmitted; and also - // appropriate ORB Version. - consumeServiceContexts(request); - - // Now that we have the service contexts processed and the - // correct ORBVersion set, we must finish initializing the - // stream. - ((MarshalInputStream)request.getInputObject()) - .performORBVersionSpecificInit(); - - ObjectKey okey = request.getObjectKey(); - - // Check that this server is the right server - try { - checkServerId(okey); - } catch (ForwardException fex) { - if (orb.subcontractDebugFlag) { - dprint(".dispatch: " + opAndId(request) - + ": bad server id"); - } - - request.getProtocolHandler() - .createLocationForward(request, fex.getIOR(), null); - return; - } - - String operation = request.getOperationName(); - ObjectAdapter objectAdapter = null ; - - try { - byte[] objectId = okey.getId().getId() ; - ObjectKeyTemplate oktemp = okey.getTemplate() ; - objectAdapter = findObjectAdapter(oktemp); - - java.lang.Object servant = getServantWithPI(request, objectAdapter, - objectId, oktemp, operation); - - dispatchToServant(servant, request, objectId, objectAdapter); - } catch (ForwardException ex) { - if (orb.subcontractDebugFlag) { - dprint(".dispatch: " + opAndId(request) - + ": ForwardException caught"); - } - - // Thrown by Portable Interceptors from InterceptorInvoker, - // through Response constructor. - request.getProtocolHandler() - .createLocationForward(request, ex.getIOR(), null); - } catch (OADestroyed ex) { - if (orb.subcontractDebugFlag) { - dprint(".dispatch: " + opAndId(request) - + ": OADestroyed exception caught"); - } - - // DO NOT CALL THIS HERE: - // releaseServant(objectAdapter); - // The problem is that OADestroyed is only thrown by oa.enter, in - // which case oa.exit should NOT be called, and neither should - // the invocationInfo stack be popped. - - // Destroyed POAs can be recreated by normal adapter activation. - // So just restart the dispatch. - dispatch(request); - } catch (RequestCanceledException ex) { - if (orb.subcontractDebugFlag) { - dprint(".dispatch: " + opAndId(request) - + ": RequestCanceledException caught"); - } - - // IDLJ generated non-tie based skeletons do not catch the - // RequestCanceledException. Rethrow the exception, which will - // cause the worker thread to unwind the dispatch and wait for - // other requests. - throw ex; - } catch (UnknownException ex) { - if (orb.subcontractDebugFlag) { - dprint(".dispatch: " + opAndId(request) - + ": UnknownException caught " + ex); - } - - // RMIC generated tie skeletons convert all Throwable exception - // types (including RequestCanceledException, ThreadDeath) - // thrown during reading fragments into UnknownException. - // If RequestCanceledException was indeed raised, - // then rethrow it, which will eventually cause the worker - // thread to unstack the dispatch and wait for other requests. - if (ex.originalEx instanceof RequestCanceledException) { - throw (RequestCanceledException) ex.originalEx; - } - - ServiceContexts contexts = new ServiceContexts(orb); - UEInfoServiceContext usc = new UEInfoServiceContext( - ex.originalEx); - - contexts.put( usc ) ; - - SystemException sysex = wrapper.unknownExceptionInDispatch( - CompletionStatus.COMPLETED_MAYBE, ex ) ; - request.getProtocolHandler() - .createSystemExceptionResponse(request, sysex, - contexts); - } catch (Throwable ex) { - if (orb.subcontractDebugFlag) { - dprint(".dispatch: " + opAndId(request) - + ": other exception " + ex); - } - request.getProtocolHandler() - .handleThrowableDuringServerDispatch( - request, ex, CompletionStatus.COMPLETED_MAYBE); - } - return; - } finally { - if (orb.subcontractDebugFlag) { - dprint(".dispatch<-: " + opAndId(request)); - } - } - } - - private void releaseServant(ObjectAdapter objectAdapter) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".releaseServant->"); - } - - if (objectAdapter == null) { - if (orb.subcontractDebugFlag) { - dprint(".releaseServant: null object adapter"); - } - return ; - } - - try { - objectAdapter.returnServant(); - } finally { - objectAdapter.exit(); - orb.popInvocationInfo() ; - } - } finally { - if (orb.subcontractDebugFlag) { - dprint(".releaseServant<-"); - } - } - } - - // Note that objectAdapter.enter() must be called before getServant. - private java.lang.Object getServant(ObjectAdapter objectAdapter, byte[] objectId, - String operation) - throws OADestroyed - { - try { - if (orb.subcontractDebugFlag) { - dprint(".getServant->"); - } - - OAInvocationInfo info = objectAdapter.makeInvocationInfo(objectId); - info.setOperation(operation); - orb.pushInvocationInfo(info); - objectAdapter.getInvocationServant(info); - return info.getServantContainer() ; - } finally { - if (orb.subcontractDebugFlag) { - dprint(".getServant<-"); - } - } - } - - protected java.lang.Object getServantWithPI(CorbaMessageMediator request, - ObjectAdapter objectAdapter, - byte[] objectId, ObjectKeyTemplate oktemp, String operation) - throws OADestroyed - { - try { - if (orb.subcontractDebugFlag) { - dprint(".getServantWithPI->"); - } - - // Prepare Portable Interceptors for a new server request - // and invoke receive_request_service_contexts. The starting - // point may throw a SystemException or ForwardException. - orb.getPIHandler().initializeServerPIInfo(request, objectAdapter, - objectId, oktemp); - orb.getPIHandler().invokeServerPIStartingPoint(); - - objectAdapter.enter() ; - - // This must be set just after the enter so that exceptions thrown by - // enter do not cause - // the exception reply to pop the thread stack and do an extra oa.exit. - if (request != null) - request.setExecuteReturnServantInResponseConstructor(true); - - java.lang.Object servant = getServant(objectAdapter, objectId, - operation); - - // Note: we do not know the MDI on a null servant. - // We only end up in that situation if _non_existent called, - // so that the following handleNullServant call does not throw an - // exception. - String mdi = "unknown" ; - - if (servant instanceof NullServant) - handleNullServant(operation, (NullServant)servant); - else - mdi = objectAdapter.getInterfaces(servant, objectId)[0] ; - - orb.getPIHandler().setServerPIInfo(servant, mdi); - - if (((servant != null) && - !(servant instanceof org.omg.CORBA.DynamicImplementation) && - !(servant instanceof org.omg.PortableServer.DynamicImplementation)) || - (SpecialMethod.getSpecialMethod(operation) != null)) { - orb.getPIHandler().invokeServerPIIntermediatePoint(); - } - - return servant ; - } finally { - if (orb.subcontractDebugFlag) { - dprint(".getServantWithPI<-"); - } - } - } - - protected void checkServerId(ObjectKey okey) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".checkServerId->"); - } - - ObjectKeyTemplate oktemp = okey.getTemplate() ; - int sId = oktemp.getServerId() ; - int scid = oktemp.getSubcontractId() ; - - if (!orb.isLocalServerId(scid, sId)) { - if (orb.subcontractDebugFlag) { - dprint(".checkServerId: bad server id"); - } - - orb.handleBadServerId(okey); - } - } finally { - if (orb.subcontractDebugFlag) { - dprint(".checkServerId<-"); - } - } - } - - private ObjectAdapter findObjectAdapter(ObjectKeyTemplate oktemp) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".findObjectAdapter->"); - } - - RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ; - int scid = oktemp.getSubcontractId() ; - ObjectAdapterFactory oaf = scr.getObjectAdapterFactory(scid); - if (oaf == null) { - if (orb.subcontractDebugFlag) { - dprint(".findObjectAdapter: failed to find ObjectAdapterFactory"); - } - - throw wrapper.noObjectAdapterFactory() ; - } - - ObjectAdapterId oaid = oktemp.getObjectAdapterId() ; - ObjectAdapter oa = oaf.find(oaid); - - if (oa == null) { - if (orb.subcontractDebugFlag) { - dprint(".findObjectAdapter: failed to find ObjectAdaptor"); - } - - throw wrapper.badAdapterId() ; - } - - return oa ; - } finally { - if (orb.subcontractDebugFlag) { - dprint(".findObjectAdapter<-"); - } - } - } - - /** Always throws OBJECT_NOT_EXIST if operation is not a special method. - * If operation is _non_existent or _not_existent, this will just - * return without performing any action, so that _non_existent can return - * false. Always throws OBJECT_NOT_EXIST for any other special method. - * Update for issue 4385. - */ - protected void handleNullServant(String operation, NullServant nserv ) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".handleNullServant->: " + operation); - } - - SpecialMethod specialMethod = - SpecialMethod.getSpecialMethod(operation); - - if ((specialMethod == null) || - !specialMethod.isNonExistentMethod()) { - if (orb.subcontractDebugFlag) { - dprint(".handleNullServant: " + operation - + ": throwing OBJECT_NOT_EXIST"); - } - - throw nserv.getException() ; - } - } finally { - if (orb.subcontractDebugFlag) { - dprint(".handleNullServant<-: " + operation); - } - } - } - - protected void consumeServiceContexts(CorbaMessageMediator request) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".consumeServiceContexts->: " - + opAndId(request)); - } - - ServiceContexts ctxts = request.getRequestServiceContexts(); - ServiceContext sc ; - - GIOPVersion giopVersion = request.getGIOPVersion(); - - // we cannot depend on this since for our local case, we do not send - // in this service context. Can we rely on just the CodeSetServiceContext? - // boolean rtSC = false; // Runtime ServiceContext - - boolean hasCodeSetContext = processCodeSetContext(request, ctxts); - - if (orb.subcontractDebugFlag) { - dprint(".consumeServiceContexts: " + opAndId(request) - + ": GIOP version: " + giopVersion); - dprint(".consumeServiceContexts: " + opAndId(request) - + ": as code set context? " + hasCodeSetContext); - } - - sc = ctxts.get( - SendingContextServiceContext.SERVICE_CONTEXT_ID ) ; - - if (sc != null) { - SendingContextServiceContext scsc = - (SendingContextServiceContext)sc ; - IOR ior = scsc.getIOR() ; - - try { - ((CorbaConnection)request.getConnection()) - .setCodeBaseIOR(ior); - } catch (ThreadDeath td) { - throw td ; - } catch (Throwable t) { - throw wrapper.badStringifiedIor( t ) ; - } - } - - // the RTSC is sent only once during session establishment. We - // need to find out if the CodeBaseRef is already set. If yes, - // then also the rtSC flag needs to be set to true - // this is not possible for the LocalCase since there is no - // IIOPConnection for the LocalCase - - // used for a case where we have JDK 1.3 supporting 1.0 protocol, - // but sending 2 service contexts, that is not normal as per - // GIOP rules, based on above information, we figure out that we - // are talking to the legacy ORB and set the ORB Version Accordingly. - - // this special case tell us that it is legacy SUN orb - // and not a foreign one - // rtSC is not available for localcase due to which this generic - // path would fail if relying on rtSC - //if (giopVersion.equals(GIOPVersion.V1_0) && hasCodeSetContext && rtSC) - boolean isForeignORB = false; - - if (giopVersion.equals(GIOPVersion.V1_0) && hasCodeSetContext) { - if (orb.subcontractDebugFlag) { - dprint(".consumeServiceCOntexts: " + opAndId(request) - + ": Determined to be an old Sun ORB"); - } - - orb.setORBVersion(ORBVersionFactory.getOLD()) ; - // System.out.println("setting legacy ORB version"); - } else { - // If it didn't include our ORB version service context (below), - // then it must be a foreign ORB. - isForeignORB = true; - } - - // try to get the ORBVersion sent as part of the ServiceContext - // if any - sc = ctxts.get( ORBVersionServiceContext.SERVICE_CONTEXT_ID ) ; - if (sc != null) { - ORBVersionServiceContext ovsc = - (ORBVersionServiceContext) sc; - - ORBVersion version = ovsc.getVersion(); - orb.setORBVersion(version); - - isForeignORB = false; - } - - if (isForeignORB) { - if (orb.subcontractDebugFlag) { - dprint(".consumeServiceContexts: " + opAndId(request) - + ": Determined to be a foreign ORB"); - } - - orb.setORBVersion(ORBVersionFactory.getFOREIGN()); - } - } finally { - if (orb.subcontractDebugFlag) { - dprint(".consumeServiceContexts<-: " + opAndId(request)); - } - } - } - - protected CorbaMessageMediator dispatchToServant( - java.lang.Object servant, - CorbaMessageMediator req, - byte[] objectId, ObjectAdapter objectAdapter) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".dispatchToServant->: " + opAndId(req)); - } - - CorbaMessageMediator response = null ; - - String operation = req.getOperationName() ; - - SpecialMethod method = SpecialMethod.getSpecialMethod(operation) ; - if (method != null) { - if (orb.subcontractDebugFlag) { - dprint(".dispatchToServant: " + opAndId(req) - + ": Handling special method"); - } - - response = method.invoke(servant, req, objectId, objectAdapter); - return response ; - } - - // Invoke on the servant using the portable DSI skeleton - if (servant instanceof org.omg.CORBA.DynamicImplementation) { - if (orb.subcontractDebugFlag) { - dprint(".dispatchToServant: " + opAndId(req) - + ": Handling old style DSI type servant"); - } - - org.omg.CORBA.DynamicImplementation dynimpl = - (org.omg.CORBA.DynamicImplementation)servant; - ServerRequestImpl sreq = new ServerRequestImpl(req, orb); - - // Note: When/if dynimpl.invoke calls arguments() or - // set_exception() then intermediate points are run. - dynimpl.invoke(sreq); - - response = handleDynamicResult(sreq, req); - } else if (servant instanceof org.omg.PortableServer.DynamicImplementation) { - if (orb.subcontractDebugFlag) { - dprint(".dispatchToServant: " + opAndId(req) - + ": Handling POA DSI type servant"); - } - - org.omg.PortableServer.DynamicImplementation dynimpl = - (org.omg.PortableServer.DynamicImplementation)servant; - ServerRequestImpl sreq = new ServerRequestImpl(req, orb); - - // Note: When/if dynimpl.invoke calls arguments() or - // set_exception() then intermediate points are run. - dynimpl.invoke(sreq); - - response = handleDynamicResult(sreq, req); - } else { - if (orb.subcontractDebugFlag) { - dprint(".dispatchToServant: " + opAndId(req) - + ": Handling invoke handler type servant"); - } - - InvokeHandler invhandle = (InvokeHandler)servant ; - - OutputStream stream = - (OutputStream)invhandle._invoke( - operation, - (org.omg.CORBA.portable.InputStream)req.getInputObject(), - req); - response = (CorbaMessageMediator) - ((OutputObject)stream).getMessageMediator(); - } - - return response ; - } finally { - if (orb.subcontractDebugFlag) { - dprint(".dispatchToServant<-: " + opAndId(req)); - } - } - } - - protected CorbaMessageMediator handleDynamicResult( - ServerRequestImpl sreq, - CorbaMessageMediator req) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".handleDynamicResult->: " + opAndId(req)); - } - - CorbaMessageMediator response = null ; - - // Check if ServerRequestImpl.result() has been called - Any excany = sreq.checkResultCalled(); - - if (excany == null) { // normal return - if (orb.subcontractDebugFlag) { - dprint(".handleDynamicResult: " + opAndId(req) - + ": handling normal result"); - } - - // Marshal out/inout/return parameters into the ReplyMessage - response = sendingReply(req); - OutputStream os = (OutputStream) response.getOutputObject(); - sreq.marshalReplyParams(os); - } else { - if (orb.subcontractDebugFlag) { - dprint(".handleDynamicResult: " + opAndId(req) - + ": handling error"); - } - - response = sendingReply(req, excany); - } - - return response ; - } finally { - if (orb.subcontractDebugFlag) { - dprint(".handleDynamicResult<-: " + opAndId(req)); - } - } - } - - protected CorbaMessageMediator sendingReply(CorbaMessageMediator req) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".sendingReply->: " + opAndId(req)); - } - - ServiceContexts scs = new ServiceContexts(orb); - return req.getProtocolHandler().createResponse(req, scs); - } finally { - if (orb.subcontractDebugFlag) { - dprint(".sendingReply<-: " + opAndId(req)); - } - } - } - - /** Must always be called, just after the servant's method returns. - * Creates the ReplyMessage header and puts in the transaction context - * if necessary. - */ - protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".sendingReply/Any->: " + opAndId(req)); - } - - ServiceContexts scs = new ServiceContexts(orb); - - // Check if the servant set a SystemException or - // UserException - CorbaMessageMediator resp; - String repId=null; - try { - repId = excany.type().id(); - } catch (org.omg.CORBA.TypeCodePackage.BadKind e) { - throw wrapper.problemWithExceptionTypecode( e ) ; - } - - if (ORBUtility.isSystemException(repId)) { - if (orb.subcontractDebugFlag) { - dprint(".sendingReply/Any: " + opAndId(req) - + ": handling system exception"); - } - - // Get the exception object from the Any - InputStream in = excany.create_input_stream(); - SystemException ex = ORBUtility.readSystemException(in); - // Marshal the exception back - resp = req.getProtocolHandler() - .createSystemExceptionResponse(req, ex, scs); - } else { - if (orb.subcontractDebugFlag) { - dprint(".sendingReply/Any: " + opAndId(req) - + ": handling user exception"); - } - - resp = req.getProtocolHandler() - .createUserExceptionResponse(req, scs); - OutputStream os = (OutputStream)resp.getOutputObject(); - excany.write_value(os); - } - - return resp; - } finally { - if (orb.subcontractDebugFlag) { - dprint(".sendingReply/Any<-: " + opAndId(req)); - } - } - } - - /** - * Handles setting the connection's code sets if required. - * Returns true if the CodeSetContext was in the request, false - * otherwise. - */ - protected boolean processCodeSetContext( - CorbaMessageMediator request, ServiceContexts contexts) - { - try { - if (orb.subcontractDebugFlag) { - dprint(".processCodeSetContext->: " + opAndId(request)); - } - - ServiceContext sc = contexts.get( - CodeSetServiceContext.SERVICE_CONTEXT_ID); - if (sc != null) { - // Somehow a code set service context showed up in the local case. - if (request.getConnection() == null) { - return true; - } - - // If it's GIOP 1.0, it shouldn't have this context at all. Our legacy - // ORBs sent it and we need to know if it's here to make ORB versioning - // decisions, but we don't use the contents. - if (request.getGIOPVersion().equals(GIOPVersion.V1_0)) { - return true; - } - - CodeSetServiceContext cssc = (CodeSetServiceContext)sc ; - CodeSetComponentInfo.CodeSetContext csctx = cssc.getCodeSetContext(); - - // Note on threading: - // - // getCodeSetContext and setCodeSetContext are synchronized - // on the Connection. At worst, this will result in - // multiple threads entering this block and calling - // setCodeSetContext but not actually changing the - // values on the Connection. - // - // Alternative would be to lock the connection for the - // whole block, but it's fine either way. - - // The connection's codeSetContext is null until we've received a - // request with a code set context with the negotiated code sets. - if (((CorbaConnection)request.getConnection()) - .getCodeSetContext() == null) - { - - // Use these code sets on this connection - if (orb.subcontractDebugFlag) { - dprint(".processCodeSetContext: " + opAndId(request) - + ": Setting code sets to: " + csctx); - } - - ((CorbaConnection)request.getConnection()) - .setCodeSetContext(csctx); - - // We had to read the method name using ISO 8859-1 - // (which is the default in the CDRInputStream for - // char data), but now we may have a new char - // code set. If it isn't ISO8859-1, we must tell - // the CDR stream to null any converter references - // it has created so that it will reacquire - // the code sets again using the new info. - // - // This should probably compare with the stream's - // char code set rather than assuming it's ISO8859-1. - // (However, the operation name is almost certainly - // ISO8859-1 or ASCII.) - if (csctx.getCharCodeSet() != - OSFCodeSetRegistry.ISO_8859_1.getNumber()) { - ((MarshalInputStream)request.getInputObject()) - .resetCodeSetConverters(); - } - } - } - - // If no code set information is ever sent from the client, - // the server will use ISO8859-1 for char and throw an - // exception for any wchar transmissions. - // - // In the local case, we use ORB provided streams for - // marshaling and unmarshaling. Currently, they use - // ISO8859-1 for char/string and UTF16 for wchar/wstring. - return sc != null ; - } finally { - if (orb.subcontractDebugFlag) { - dprint(".processCodeSetContext<-: " + opAndId(request)); - } - } - } - - protected void dprint(String msg) - { - ORBUtility.dprint("CorbaServerRequestDispatcherImpl", msg); - } - - protected String opAndId(CorbaMessageMediator mediator) - { - return ORBUtility.operationNameAndRequestId(mediator); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/FullServantCacheLocalCRDImpl.java 2018-01-30 20:20:00.000000000 -0500 +++ /dev/null 2018-01-30 20:20:00.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol; - -import org.omg.CORBA.portable.ServantObject ; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.oa.OAInvocationInfo ; -import com.sun.corba.se.spi.oa.OADestroyed ; - -import com.sun.corba.se.spi.ior.IOR; - -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.logging.POASystemException ; - -public class FullServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase -{ - public FullServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior ) - { - super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ) ; - } - - public ServantObject servant_preinvoke( org.omg.CORBA.Object self, - String operation, Class expectedType ) - { - OAInvocationInfo cachedInfo = getCachedInfo() ; - if (!checkForCompatibleServant( cachedInfo, expectedType )) - return null ; - - // Note that info is shared across multiple threads - // using the same subcontract, each of which may - // have its own operation. Therefore we need to clone it. - OAInvocationInfo info = new OAInvocationInfo( cachedInfo, operation ) ; - orb.pushInvocationInfo( info ) ; - - try { - info.oa().enter() ; - } catch (OADestroyed pdes) { - throw wrapper.preinvokePoaDestroyed( pdes ) ; - } - - return info ; - } - - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servantobj) - { - OAInvocationInfo cachedInfo = getCachedInfo() ; - cachedInfo.oa().exit() ; - orb.popInvocationInfo() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/INSServerRequestDispatcher.java 2018-01-30 20:20:00.000000000 -0500 +++ /dev/null 2018-01-30 20:20:00.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.protocol; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.ObjectKey; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -/** - * INSServerRequestDispatcher handles all INS related discovery request. The INS Service - * can be registered using ORB.register_initial_reference(). - * This Singleton subcontract just - * finds the target IOR and does location forward. - * XXX PI points are not invoked in either dispatch() or locate() method this - * should be fixed in Tiger. - */ -public class INSServerRequestDispatcher - implements CorbaServerRequestDispatcher -{ - - private ORB orb = null; - private ORBUtilSystemException wrapper ; - - public INSServerRequestDispatcher( ORB orb ) { - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - // Need to signal one of OBJECT_HERE, OBJECT_FORWARD, OBJECT_NOT_EXIST. - public IOR locate(ObjectKey okey) { - // send a locate forward with the right IOR. If the insKey is not - // registered then it will throw OBJECT_NOT_EXIST Exception - String insKey = new String( okey.getBytes(orb) ); - return getINSReference( insKey ); - } - - public void dispatch(MessageMediator mediator) - { - CorbaMessageMediator request = (CorbaMessageMediator) mediator; - // send a locate forward with the right IOR. If the insKey is not - // registered then it will throw OBJECT_NOT_EXIST Exception - String insKey = new String( request.getObjectKey().getBytes(orb) ); - request.getProtocolHandler() - .createLocationForward(request, getINSReference( insKey ), null); - return; - } - - /** - * getINSReference if it is registered in INSObjectKeyMap. - */ - private IOR getINSReference( String insKey ) { - IOR entry = ORBUtility.getIOR( orb.getLocalResolver().resolve( insKey ) ) ; - if( entry != null ) { - // If entry is not null then the locate is with an INS Object key, - // so send a location forward with the right IOR. - return entry; - } - - throw wrapper.servantNotFound() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java 2018-01-30 20:20:01.000000000 -0500 +++ /dev/null 2018-01-30 20:20:01.000000000 -0500 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol; - -import org.omg.CORBA.portable.ServantObject ; - -import com.sun.corba.se.spi.oa.OAInvocationInfo ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; - -import com.sun.corba.se.spi.ior.IOR; - -public class InfoOnlyServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase -{ - public InfoOnlyServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior ) - { - super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ) ; - } - - public ServantObject servant_preinvoke( org.omg.CORBA.Object self, - String operation, Class expectedType ) - { - OAInvocationInfo cachedInfo = getCachedInfo() ; - if (!checkForCompatibleServant( cachedInfo, expectedType )) - return null ; - - // Note that info is shared across multiple threads - // using the same subcontract, each of which may - // have its own operation. Therefore we need to copy it. - OAInvocationInfo info = new OAInvocationInfo(cachedInfo, operation) ; - orb.pushInvocationInfo( info ) ; - - return info ; - } - - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servantobj) - { - orb.popInvocationInfo() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/JIDLLocalCRDImpl.java 2018-01-30 20:20:02.000000000 -0500 +++ /dev/null 2018-01-30 20:20:02.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol; - -import javax.rmi.CORBA.Tie; - -import org.omg.CORBA.portable.ServantObject; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; - -import com.sun.corba.se.spi.ior.IOR ; - -import com.sun.corba.se.impl.protocol.LocalClientRequestDispatcherBase ; - -import com.sun.corba.se.pept.broker.Broker; - -public class JIDLLocalCRDImpl extends LocalClientRequestDispatcherBase -{ - public JIDLLocalCRDImpl( ORB orb, int scid, IOR ior ) - { - super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ) ; - } - - protected ServantObject servant; - - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType) - { - if (!checkForCompatibleServant( servant, expectedType )) - return null ; - - return servant; - } - - public void servant_postinvoke( org.omg.CORBA.Object self, - ServantObject servant ) - { - // NO-OP - } - - // REVISIT - This is called from TOAImpl. - public void setServant( java.lang.Object servant ) - { - if (servant != null && servant instanceof Tie) { - this.servant = new ServantObject(); - this.servant.servant = ((Tie)servant).getTarget(); - } else { - this.servant = null; - } - } - - public void unexport() { - // DO NOT set the IOR to null. (Un)exporting is only concerns - // the servant not the IOR. If the ior is set to null then - // null pointer exceptions happen during an colocated invocation. - // It is better to let the invocation proceed and get OBJECT_NOT_EXIST - // from the server side. - //ior = null; - servant = null; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java 2018-01-30 20:20:02.000000000 -0500 +++ /dev/null 2018-01-30 20:20:02.000000000 -0500 @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.protocol; - -import org.omg.CORBA.portable.ServantObject; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher; -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.oa.ObjectAdapterFactory; - -import com.sun.corba.se.spi.ior.ObjectAdapterId; -import com.sun.corba.se.spi.ior.TaggedProfile; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate; -import com.sun.corba.se.spi.ior.ObjectId; - -public abstract class LocalClientRequestDispatcherBase implements LocalClientRequestDispatcher -{ - protected ORB orb; - int scid; - - // Cached information needed for local dispatch - protected boolean servantIsLocal ; - protected ObjectAdapterFactory oaf ; - protected ObjectAdapterId oaid ; - protected byte[] objectId ; - - // If isNextIsLocalValid.get() == Boolean.TRUE, - // the next call to isLocal should be valid - private static final ThreadLocal isNextCallValid = new ThreadLocal() { - protected synchronized Object initialValue() { - return Boolean.TRUE; - } - }; - - protected LocalClientRequestDispatcherBase(ORB orb, int scid, IOR ior) - { - this.orb = orb ; - - TaggedProfile prof = ior.getProfile() ; - servantIsLocal = orb.getORBData().isLocalOptimizationAllowed() && - prof.isLocal(); - - ObjectKeyTemplate oktemp = prof.getObjectKeyTemplate() ; - this.scid = oktemp.getSubcontractId() ; - RequestDispatcherRegistry sreg = orb.getRequestDispatcherRegistry() ; - oaf = sreg.getObjectAdapterFactory( scid ) ; - oaid = oktemp.getObjectAdapterId() ; - ObjectId oid = prof.getObjectId() ; - objectId = oid.getId() ; - } - - public byte[] getObjectId() - { - return objectId ; - } - - public boolean is_local(org.omg.CORBA.Object self) - { - return false; - } - - /* - * Possible paths through - * useLocalInvocation/servant_preinvoke/servant_postinvoke: - * - * A: call useLocalInvocation - * If useLocalInvocation returns false, servant_preinvoke is not called. - * If useLocalInvocation returns true, - * call servant_preinvoke - * If servant_preinvoke returns null, - * goto A - * else - * (local invocation proceeds normally) - * servant_postinvoke is called - * - */ - public boolean useLocalInvocation( org.omg.CORBA.Object self ) - { - if (isNextCallValid.get() == Boolean.TRUE) - return servantIsLocal ; - else - isNextCallValid.set( Boolean.TRUE ) ; - - return false ; - } - - /** Check that the servant in info (which must not be null) is - * an instance of the expectedType. If not, set the thread local flag - * and return false. - */ - protected boolean checkForCompatibleServant( ServantObject so, - Class expectedType ) - { - if (so == null) - return false ; - - // Normally, this test will never fail. However, if the servant - // and the stub were loaded in different class loaders, this test - // will fail. - if (!expectedType.isInstance( so.servant )) { - isNextCallValid.set( Boolean.FALSE ) ; - - // When servant_preinvoke returns null, the stub will - // recursively re-invoke itself. Thus, the next call made from - // the stub is another useLocalInvocation call. - return false ; - } - - return true ; - } - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/MinimalServantCacheLocalCRDImpl.java 2018-01-30 20:20:03.000000000 -0500 +++ /dev/null 2018-01-30 20:20:03.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol ; - -import org.omg.CORBA.portable.ServantObject ; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; - -import com.sun.corba.se.spi.ior.IOR ; - -import com.sun.corba.se.spi.oa.OAInvocationInfo ; - -import com.sun.corba.se.spi.orb.ORB ; - -public class MinimalServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase -{ - public MinimalServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior ) - { - super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ) ; - } - - public ServantObject servant_preinvoke( org.omg.CORBA.Object self, - String operation, Class expectedType ) - { - OAInvocationInfo cachedInfo = getCachedInfo() ; - if (checkForCompatibleServant( cachedInfo, expectedType )) - return cachedInfo ; - else - return null ; - } - - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servantobj) - { - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/NotLocalLocalCRDImpl.java 2018-01-30 20:20:04.000000000 -0500 +++ /dev/null 2018-01-30 20:20:04.000000000 -0500 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol; - -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.portable.ServantObject; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; - -/** - * @author Harold Carr - */ - -public class NotLocalLocalCRDImpl implements LocalClientRequestDispatcher -{ - public boolean useLocalInvocation(org.omg.CORBA.Object self) - { - return false; - } - - public boolean is_local(org.omg.CORBA.Object self) - { - return false; - } - - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType) - { - // REVISIT: Rewrite rmic.HelloTest and rmic.LocalStubTest - // (which directly call servant_preinvoke) - // then revert to exception again. - return null; - //throw new INTERNAL(); - } - - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servant) - { - //throw new INTERNAL(); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/POALocalCRDImpl.java 2018-01-30 20:20:04.000000000 -0500 +++ /dev/null 2018-01-30 20:20:04.000000000 -0500 @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.OBJ_ADAPTER ; -import org.omg.CORBA.UNKNOWN ; -import org.omg.CORBA.CompletionStatus ; - -import org.omg.CORBA.portable.ServantObject; - -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory; -import com.sun.corba.se.spi.protocol.ForwardException ; - -import com.sun.corba.se.spi.oa.ObjectAdapter; -import com.sun.corba.se.spi.oa.OAInvocationInfo ; -import com.sun.corba.se.spi.oa.OADestroyed; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.ior.IOR ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.POASystemException ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -public class POALocalCRDImpl extends LocalClientRequestDispatcherBase -{ - private ORBUtilSystemException wrapper ; - private POASystemException poaWrapper ; - - public POALocalCRDImpl( ORB orb, int scid, IOR ior) - { - super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ); - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - poaWrapper = POASystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - private OAInvocationInfo servantEnter( ObjectAdapter oa ) throws OADestroyed - { - oa.enter() ; - - OAInvocationInfo info = oa.makeInvocationInfo( objectId ) ; - orb.pushInvocationInfo( info ) ; - - return info ; - } - - private void servantExit( ObjectAdapter oa ) - { - try { - oa.returnServant(); - } finally { - oa.exit() ; - orb.popInvocationInfo() ; - } - } - - // Look up the servant for this request and return it in a - // ServantObject. Note that servant_postinvoke is always called - // by the stub UNLESS this method returns null. However, in all - // cases we must be sure that ObjectAdapter.getServant and - // ObjectAdapter.returnServant calls are paired, as required for - // Portable Interceptors and Servant Locators in the POA. - // Thus, this method must call returnServant if it returns null. - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType) - { - ObjectAdapter oa = oaf.find( oaid ) ; - OAInvocationInfo info = null ; - - try { - info = servantEnter( oa ) ; - info.setOperation( operation ) ; - } catch ( OADestroyed ex ) { - // Destroyed POAs can be recreated by normal adapter activation. - // So just reinvoke this method. - return servant_preinvoke(self, operation, expectedType); - } - - try { - try { - oa.getInvocationServant( info ); - if (!checkForCompatibleServant( info, expectedType )) - return null ; - } catch (Throwable thr) { - // Cleanup after this call, then throw to allow - // outer try to handle the exception appropriately. - servantExit( oa ) ; - throw thr ; - } - } catch ( ForwardException ex ) { - /* REVISIT - ClientRequestDispatcher csub = (ClientRequestDispatcher) - StubAdapter.getDelegate( ex.forward_reference ) ; - IOR ior = csub.getIOR() ; - setLocatedIOR( ior ) ; - */ - RuntimeException runexc = new RuntimeException("deal with this."); - runexc.initCause( ex ) ; - throw runexc ; - } catch ( ThreadDeath ex ) { - // ThreadDeath on the server side should not cause a client - // side thread death in the local case. We want to preserve - // this behavior for location transparency, so that a ThreadDeath - // has the same affect in either the local or remote case. - // The non-colocated case is handled in iiop.ORB.process, which - // throws the same exception. - throw wrapper.runtimeexception( ex ) ; - } catch ( Throwable t ) { - if (t instanceof SystemException) - throw (SystemException)t ; - - throw poaWrapper.localServantLookup( t ) ; - } - - if (!checkForCompatibleServant( info, expectedType )) { - servantExit( oa ) ; - return null ; - } - - return info; - } - - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servantobj) - { - ObjectAdapter oa = orb.peekInvocationInfo().oa() ; - servantExit( oa ) ; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestCanceledException.java 2018-01-30 20:20:05.000000000 -0500 +++ /dev/null 2018-01-30 20:20:05.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol; - -/** - * If this exception is caught explicitly, this need to be rethrown. - */ -public class RequestCanceledException extends RuntimeException { - - private int requestId = 0; - - public RequestCanceledException(int requestId) { - this.requestId = requestId; - } - - public int getRequestId() { - return this.requestId; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestDispatcherRegistryImpl.java 2018-01-30 20:20:06.000000000 -0500 +++ /dev/null 2018-01-30 20:20:06.000000000 -0500 @@ -1,183 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol; - -import java.util.Set; -import java.util.HashSet; -import java.util.Map; -import java.util.HashMap; -import java.util.Collections; - -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ; - -import com.sun.corba.se.spi.oa.ObjectAdapterFactory ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.impl.orbutil.ORBConstants ; -import com.sun.corba.se.impl.orbutil.DenseIntMapImpl ; - -/** - * This is a registry of all subcontract ID dependent objects. This includes: - * LocalClientRequestDispatcherFactory, ClientRequestDispatcher, ServerSubcontract, and - * ObjectAdapterFactory. - */ -public class RequestDispatcherRegistryImpl implements RequestDispatcherRegistry { - private ORB orb; - - protected int defaultId; // The default subcontract ID to use if - // there is no more specific ID available. - // This happens when invoking a foreign IOR. - private DenseIntMapImpl SDRegistry ; // ServerRequestDispatcher registry - private DenseIntMapImpl CSRegistry ; // ClientRequestDispatcher registry - private DenseIntMapImpl OAFRegistry ; // ObjectAdapterFactory registry - private DenseIntMapImpl LCSFRegistry ; // LocalClientRequestDispatcherFactory registry - private Set objectAdapterFactories ; // Set of all ObjectAdapterFactory instances - private Set objectAdapterFactoriesView ; // Read-only view of oaf instances - private Map stringToServerSubcontract ; // Map from obect key string to - // ServerSubcontract - // for special bootstrap IORs - - public RequestDispatcherRegistryImpl(ORB orb, int defaultId ) - { - this.orb = orb; - this.defaultId = defaultId; - SDRegistry = new DenseIntMapImpl() ; - CSRegistry = new DenseIntMapImpl() ; - OAFRegistry = new DenseIntMapImpl() ; - LCSFRegistry = new DenseIntMapImpl() ; - objectAdapterFactories = new HashSet() ; - objectAdapterFactoriesView = Collections.unmodifiableSet( objectAdapterFactories ) ; - stringToServerSubcontract = new HashMap() ; - } - - public synchronized void registerClientRequestDispatcher( - ClientRequestDispatcher csc, int scid) - { - CSRegistry.set( scid, csc ) ; - } - - public synchronized void registerLocalClientRequestDispatcherFactory( - LocalClientRequestDispatcherFactory csc, int scid) - { - LCSFRegistry.set( scid, csc ) ; - } - - public synchronized void registerServerRequestDispatcher( - CorbaServerRequestDispatcher ssc, int scid) - { - SDRegistry.set( scid, ssc ) ; - } - - public synchronized void registerServerRequestDispatcher( - CorbaServerRequestDispatcher scc, String name ) - { - stringToServerSubcontract.put( name, scc ) ; - } - - public synchronized void registerObjectAdapterFactory( - ObjectAdapterFactory oaf, int scid) - { - objectAdapterFactories.add( oaf ) ; - OAFRegistry.set( scid, oaf ) ; - } - - // ************************************************** - // Methods to find the subcontract side subcontract - // ************************************************** - - // Note that both forms of getServerRequestDispatcher need to return - // the default server delegate if no other match is found. - // This is essential to proper handling of errors for - // malformed requests. In particular, a bad MAGIC will - // result in a lookup in the named key table (stringToServerSubcontract), - // which must return a valid ServerRequestDispatcher. A bad subcontract ID - // will similarly need to return the default ServerRequestDispatcher. - - public CorbaServerRequestDispatcher getServerRequestDispatcher(int scid) - { - CorbaServerRequestDispatcher sdel = - (CorbaServerRequestDispatcher)(SDRegistry.get(scid)) ; - if ( sdel == null ) - sdel = (CorbaServerRequestDispatcher)(SDRegistry.get(defaultId)) ; - - return sdel; - } - - public CorbaServerRequestDispatcher getServerRequestDispatcher( String name ) - { - CorbaServerRequestDispatcher sdel = - (CorbaServerRequestDispatcher)stringToServerSubcontract.get( name ) ; - - if ( sdel == null ) - sdel = (CorbaServerRequestDispatcher)(SDRegistry.get(defaultId)) ; - - return sdel; - } - - public LocalClientRequestDispatcherFactory getLocalClientRequestDispatcherFactory( - int scid ) - { - LocalClientRequestDispatcherFactory factory = - (LocalClientRequestDispatcherFactory)(LCSFRegistry.get(scid)) ; - if (factory == null) { - factory = (LocalClientRequestDispatcherFactory)(LCSFRegistry.get(defaultId)) ; - } - - return factory ; - } - - public ClientRequestDispatcher getClientRequestDispatcher( int scid ) - { - ClientRequestDispatcher subcontract = - (ClientRequestDispatcher)(CSRegistry.get(scid)) ; - if (subcontract == null) { - subcontract = (ClientRequestDispatcher)(CSRegistry.get(defaultId)) ; - } - - return subcontract ; - } - - public ObjectAdapterFactory getObjectAdapterFactory( int scid ) - { - ObjectAdapterFactory oaf = - (ObjectAdapterFactory)(OAFRegistry.get(scid)) ; - if ( oaf == null ) - oaf = (ObjectAdapterFactory)(OAFRegistry.get(defaultId)) ; - - return oaf; - } - - public Set getObjectAdapterFactories() - { - return objectAdapterFactoriesView ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/ServantCacheLocalCRDBase.java 2018-01-30 20:20:06.000000000 -0500 +++ /dev/null 2018-01-30 20:20:06.000000000 -0500 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol; - -import org.omg.CORBA.BAD_OPERATION ; -import org.omg.CORBA.INTERNAL ; -import org.omg.CORBA.SystemException ; -import org.omg.CORBA.CompletionStatus ; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher; -import com.sun.corba.se.spi.protocol.ForwardException; - -// XXX This should be in the SPI -import com.sun.corba.se.impl.protocol.LocalClientRequestDispatcherBase; - -import com.sun.corba.se.spi.oa.OAInvocationInfo; -import com.sun.corba.se.spi.oa.ObjectAdapter; -import com.sun.corba.se.spi.oa.OADestroyed; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.ior.IOR ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.POASystemException; - -public abstract class ServantCacheLocalCRDBase extends LocalClientRequestDispatcherBase -{ - - private OAInvocationInfo cachedInfo ; - protected POASystemException wrapper ; - - protected ServantCacheLocalCRDBase( ORB orb, int scid, IOR ior ) - { - super( orb, scid, ior ) ; - wrapper = POASystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - protected synchronized OAInvocationInfo getCachedInfo() - { - if (!servantIsLocal) - throw wrapper.servantMustBeLocal() ; - - if (cachedInfo == null) { - ObjectAdapter oa = oaf.find( oaid ) ; - cachedInfo = oa.makeInvocationInfo( objectId ) ; - - // InvocationInfo must be pushed before calling getInvocationServant - orb.pushInvocationInfo( cachedInfo ) ; - - try { - oa.enter( ); - oa.getInvocationServant( cachedInfo ) ; - } catch (ForwardException freq) { - throw wrapper.illegalForwardRequest( freq ) ; - } catch( OADestroyed oades ) { - // This is an error since no user of this implementation - // should ever throw this exception - throw wrapper.adapterDestroyed( oades ) ; - } finally { - oa.returnServant( ); - oa.exit( ); - orb.popInvocationInfo() ; - } - } - - return cachedInfo ; - } -} - -// End of File --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java 2018-01-30 20:20:07.000000000 -0500 +++ /dev/null 2018-01-30 20:20:07.000000000 -0500 @@ -1,237 +0,0 @@ -/* - * Copyright (c) 2003, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.protocol; - -import java.io.IOException; -import java.util.Iterator; -import java.rmi.RemoteException; -import java.nio.ByteBuffer; -import java.security.AccessController; -import java.security.PrivilegedAction; -import javax.rmi.CORBA.Util; -import javax.rmi.CORBA.Tie; - -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.WrongTransaction; -import org.omg.CORBA.Request; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.NVList; -import org.omg.CORBA.Context; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.DATA_CONVERSION; -import org.omg.CORBA.UNKNOWN; -import org.omg.CORBA.portable.RemarshalException; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; -import org.omg.CORBA.portable.Delegate; -import org.omg.CORBA.portable.ServantObject; -import org.omg.CORBA.portable.ApplicationException; -import org.omg.CORBA.portable.UnknownException; -import org.omg.IOP.TAG_CODE_SETS; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ConnectionCache; -import com.sun.corba.se.pept.transport.ContactInfo; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate; -import com.sun.corba.se.spi.ior.iiop.CodeSetsComponent; -import com.sun.corba.se.spi.oa.OAInvocationInfo; -import com.sun.corba.se.spi.oa.ObjectAdapterFactory; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersion; -import com.sun.corba.se.spi.orb.ORBVersionFactory; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry; -import com.sun.corba.se.spi.transport.CorbaContactInfo ; -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; -import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator ; -import com.sun.corba.se.spi.transport.CorbaConnection; - -import com.sun.corba.se.spi.servicecontext.ServiceContext; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext; -import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext; -import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext; -import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext; -import com.sun.corba.se.impl.encoding.ByteBufferWithInfo; -import com.sun.corba.se.impl.encoding.CDRInputObject; -import com.sun.corba.se.impl.encoding.CDROutputObject; -import com.sun.corba.se.impl.encoding.CDROutputStream; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; -import com.sun.corba.se.impl.encoding.CodeSetConversion; -import com.sun.corba.se.impl.encoding.MarshalOutputStream; -import com.sun.corba.se.impl.encoding.MarshalInputStream; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr; -import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.util.JDKBridge; - -/** - * ClientDelegate is the RMI client-side subcontract or representation - * It implements RMI delegate as well as our internal ClientRequestDispatcher - * interface. - */ -public class SharedCDRClientRequestDispatcherImpl - extends - CorbaClientRequestDispatcherImpl -{ - // REVISIT: - // Rather than have separate CDR subcontract, - // use same CorbaClientRequestDispatcherImpl but have - // different MessageMediator finishSendingRequest and waitForResponse - // handle what is done below. - // Benefit: then in ContactInfo no need to do a direct new - // of subcontract - does not complicate subcontract registry. - - public InputObject marshalingComplete(java.lang.Object self, - OutputObject outputObject) - throws - ApplicationException, - org.omg.CORBA.portable.RemarshalException - { - ORB orb = null; - CorbaMessageMediator messageMediator = null; - try { - messageMediator = (CorbaMessageMediator) - outputObject.getMessageMediator(); - - orb = (ORB) messageMediator.getBroker(); - - if (orb.subcontractDebugFlag) { - dprint(".marshalingComplete->: " + opAndId(messageMediator)); - } - - CDROutputObject cdrOutputObject = (CDROutputObject) outputObject; - - // - // Create server-side input object. - // - - ByteBufferWithInfo bbwi = cdrOutputObject.getByteBufferWithInfo(); - cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize()); - final ORB inOrb = orb; - final ByteBuffer inBuffer = bbwi.byteBuffer; - final Message inMsg = cdrOutputObject.getMessageHeader(); - CDRInputObject cdrInputObject = AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public CDRInputObject run() { - return new CDRInputObject(inOrb, null, inBuffer, - inMsg); - } - }); - messageMediator.setInputObject(cdrInputObject); - cdrInputObject.setMessageMediator(messageMediator); - - // - // Dispatch - // - - // REVISIT: Impl cast. - ((CorbaMessageMediatorImpl)messageMediator).handleRequestRequest( - messageMediator); - - // InputStream must be closed on the InputObject so that its - // ByteBuffer can be released to the ByteBufferPool. We must do - // this before we re-assign the cdrInputObject reference below. - try { cdrInputObject.close(); } - catch (IOException ex) { - // No need to do anything since we're done with the input stream - // and cdrInputObject will be re-assigned a new client-side input - // object, (i.e. won't result in a corba error). - - if (orb.transportDebugFlag) { - dprint(".marshalingComplete: ignoring IOException - " + ex.toString()); - } - } - - // - // Create client-side input object - // - - cdrOutputObject = (CDROutputObject) messageMediator.getOutputObject(); - bbwi = cdrOutputObject.getByteBufferWithInfo(); - cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize()); - final ORB inOrb2 = orb; - final ByteBuffer inBuffer2 = bbwi.byteBuffer; - final Message inMsg2 = cdrOutputObject.getMessageHeader(); - cdrInputObject = AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public CDRInputObject run() { - return new CDRInputObject(inOrb2, null, inBuffer2, - inMsg2); - } - }); - messageMediator.setInputObject(cdrInputObject); - cdrInputObject.setMessageMediator(messageMediator); - - cdrInputObject.unmarshalHeader(); - - InputObject inputObject = cdrInputObject; - - return processResponse(orb, messageMediator, inputObject); - - } finally { - if (orb.subcontractDebugFlag) { - dprint(".marshalingComplete<-: " + opAndId(messageMediator)); - } - } - } - - protected void dprint(String msg) - { - ORBUtility.dprint("SharedCDRClientRequestDispatcherImpl", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SpecialMethod.java 2018-01-30 20:20:07.000000000 -0500 +++ /dev/null 2018-01-30 20:20:07.000000000 -0500 @@ -1,168 +0,0 @@ -/* - * Copyright (c) 1998, 2003, 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.corba.se.impl.protocol ; - -import javax.rmi.CORBA.Tie; - -import org.omg.CORBA.SystemException ; -import org.omg.CORBA.NO_IMPLEMENT ; -import org.omg.CORBA.OBJECT_NOT_EXIST ; -import org.omg.CORBA.CompletionStatus ; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -import com.sun.corba.se.spi.oa.ObjectAdapter; -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.spi.logging.CORBALogDomains; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -import com.sun.corba.se.spi.oa.NullServant ; - -public abstract class SpecialMethod { - public abstract boolean isNonExistentMethod() ; - public abstract String getName(); - public abstract CorbaMessageMediator invoke(java.lang.Object servant, - CorbaMessageMediator request, - byte[] objectId, - ObjectAdapter objectAdapter); - - public static final SpecialMethod getSpecialMethod(String operation) { - for(int i = 0; i < methods.length; i++) - if (methods[i].getName().equals(operation)) - return methods[i]; - return null; - } - - static SpecialMethod[] methods = { - new IsA(), - new GetInterface(), - new NonExistent(), - new NotExistent() - }; -} - -class NonExistent extends SpecialMethod { - public boolean isNonExistentMethod() - { - return true ; - } - - public String getName() { // _non_existent - return "_non_existent"; - } - - public CorbaMessageMediator invoke(java.lang.Object servant, - CorbaMessageMediator request, - byte[] objectId, - ObjectAdapter objectAdapter) - { - boolean result = (servant == null) || (servant instanceof NullServant) ; - CorbaMessageMediator response = - request.getProtocolHandler().createResponse(request, null); - ((OutputStream)response.getOutputObject()).write_boolean(result); - return response; - } -} - -class NotExistent extends NonExistent { - public String getName() { // _not_existent - return "_not_existent"; - } -} - -class IsA extends SpecialMethod { // _is_a - public boolean isNonExistentMethod() - { - return false ; - } - - public String getName() { - return "_is_a"; - } - public CorbaMessageMediator invoke(java.lang.Object servant, - CorbaMessageMediator request, - byte[] objectId, - ObjectAdapter objectAdapter) - { - if ((servant == null) || (servant instanceof NullServant)) { - ORB orb = (ORB)request.getBroker() ; - ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.OA_INVOCATION ) ; - - return request.getProtocolHandler().createSystemExceptionResponse( - request, wrapper.badSkeleton(), null); - } - - String[] ids = objectAdapter.getInterfaces( servant, objectId ); - String clientId = - ((InputStream)request.getInputObject()).read_string(); - boolean answer = false; - for(int i = 0; i < ids.length; i++) - if (ids[i].equals(clientId)) { - answer = true; - break; - } - - CorbaMessageMediator response = - request.getProtocolHandler().createResponse(request, null); - ((OutputStream)response.getOutputObject()).write_boolean(answer); - return response; - } -} - -class GetInterface extends SpecialMethod { // _get_interface - public boolean isNonExistentMethod() - { - return false ; - } - - public String getName() { - return "_interface"; - } - public CorbaMessageMediator invoke(java.lang.Object servant, - CorbaMessageMediator request, - byte[] objectId, - ObjectAdapter objectAdapter) - { - ORB orb = (ORB)request.getBroker() ; - ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.OA_INVOCATION ) ; - - if ((servant == null) || (servant instanceof NullServant)) { - return request.getProtocolHandler().createSystemExceptionResponse( - request, wrapper.badSkeleton(), null); - } else { - return request.getProtocolHandler().createSystemExceptionResponse( - request, wrapper.getinterfaceNotImplemented(), null); - } - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java 2018-01-30 20:20:08.000000000 -0500 +++ /dev/null 2018-01-30 20:20:08.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - - -/** -* com/sun/corba/se/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ - -abstract public class AddressingDispositionHelper -{ - private static String _id = "IDL:messages/AddressingDisposition:1.0"; - - public static void insert (org.omg.CORBA.Any a, short that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static short extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.corba.se.impl.protocol.giopmsgheaders.AddressingDispositionHelper.id (), "AddressingDisposition", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static short read (org.omg.CORBA.portable.InputStream istream) - { - short value = (short)0; - value = istream.read_short (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, short value) - { - ostream.write_short (value); - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage.java 2018-01-30 20:20:09.000000000 -0500 +++ /dev/null 2018-01-30 20:20:09.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -/** - * This interface captures the CancelRequestMessage contract. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public interface CancelRequestMessage extends Message { - int CANCEL_REQ_MSG_SIZE = 4; - int getRequestId(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java 2018-01-30 20:20:09.000000000 -0500 +++ /dev/null 2018-01-30 20:20:09.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -/** - * This implements the GIOP 1.0 CancelRequest header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class CancelRequestMessage_1_0 extends Message_1_0 - implements CancelRequestMessage { - - // Instance variables - - private int request_id = (int) 0; - - // Constructors - - CancelRequestMessage_1_0() {} - - CancelRequestMessage_1_0(int _request_id) { - super(Message.GIOPBigMagic, false, Message.GIOPCancelRequest, - CANCEL_REQ_MSG_SIZE); - request_id = _request_id; - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class CancelRequestMessage_1_0 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java 2018-01-30 20:20:10.000000000 -0500 +++ /dev/null 2018-01-30 20:20:10.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -/** - * This implements the GIOP 1.1 CancelRequest header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class CancelRequestMessage_1_1 extends Message_1_1 - implements CancelRequestMessage { - - // Instance variables - - private int request_id = (int) 0; - - // Constructors - - CancelRequestMessage_1_1() {} - - CancelRequestMessage_1_1(int _request_id) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPCancelRequest, CANCEL_REQ_MSG_SIZE); - request_id = _request_id; - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class CancelRequestMessage_1_1 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java 2018-01-30 20:20:11.000000000 -0500 +++ /dev/null 2018-01-30 20:20:11.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -/** - * This implements the GIOP 1.2 CancelRequest header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class CancelRequestMessage_1_2 extends Message_1_1 - implements CancelRequestMessage { - - // Instance variables - - private int request_id = (int) 0; - - // Constructors - - CancelRequestMessage_1_2() {} - - CancelRequestMessage_1_2(int _request_id) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPCancelRequest, CANCEL_REQ_MSG_SIZE); - request_id = _request_id; - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class CancelRequestMessage_1_2 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage.java 2018-01-30 20:20:11.000000000 -0500 +++ /dev/null 2018-01-30 20:20:11.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -/** - * This interface captures the FragmentMessage contract. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public interface FragmentMessage extends Message { - int getRequestId(); - int getHeaderLength(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java 2018-01-30 20:20:12.000000000 -0500 +++ /dev/null 2018-01-30 20:20:12.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.protocol.giopmsgheaders; - -/** - * This implements the GIOP 1.1 Fragment header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class FragmentMessage_1_1 extends Message_1_1 - implements FragmentMessage { - - // Constructors - - FragmentMessage_1_1() {} - - FragmentMessage_1_1(Message_1_1 msg11) { - this.magic = msg11.magic; - this.GIOP_version = msg11.GIOP_version; - this.flags = msg11.flags; - this.message_type = GIOPFragment; - this.message_size = 0; - } - - // Accessor methods - - public int getRequestId() { - return -1; // 1.1 has no fragment header and so no request_id - } - - public int getHeaderLength() { - return GIOPMessageHeaderLength; - } - - // IO methods - - /* This will never be called, since we do not currently read the - * request_id from an CDRInputStream. Instead we use the - * readGIOP_1_1_requestId to read the requestId from a byte buffer. - */ - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - } - - /* 1.1 has no request_id; so nothing to write */ - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class FragmentMessage_1_1 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java 2018-01-30 20:20:13.000000000 -0500 +++ /dev/null 2018-01-30 20:20:13.000000000 -0500 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.protocol.giopmsgheaders; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -/** - * This implements the GIOP 1.2 Fragment header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class FragmentMessage_1_2 extends Message_1_2 - implements FragmentMessage { - - // Constructors - - FragmentMessage_1_2() {} - - // This is currently never called. - FragmentMessage_1_2(int _request_id) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPFragment, 0); - this.message_type = GIOPFragment; - request_id = _request_id; - } - - FragmentMessage_1_2(Message_1_1 msg12) { - this.magic = msg12.magic; - this.GIOP_version = msg12.GIOP_version; - this.flags = msg12.flags; - this.message_type = GIOPFragment; - this.message_size = 0; - - switch (msg12.message_type) { - case GIOPRequest : - this.request_id = ((RequestMessage) msg12).getRequestId(); - break; - case GIOPReply : - this.request_id = ((ReplyMessage) msg12).getRequestId(); - break; - case GIOPLocateRequest : - this.request_id = ((LocateRequestMessage) msg12).getRequestId(); - break; - case GIOPLocateReply : - this.request_id = ((LocateReplyMessage) msg12).getRequestId(); - break; - case GIOPFragment : - this.request_id = ((FragmentMessage) msg12).getRequestId(); - break; - } - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - public int getHeaderLength() { - return GIOPMessageHeaderLength + 4; - } - - // IO methods - - /* This will never be called, since we do not currently read the - * request_id from an CDRInputStream. Instead we use the - * readGIOP_1_2_requestId to read the requestId from a byte buffer. - */ - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class FragmentMessage_1_2 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfo.java 2018-01-30 20:20:13.000000000 -0500 +++ /dev/null 2018-01-30 20:20:13.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - - -/** -* com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfo.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ - -public final class IORAddressingInfo implements org.omg.CORBA.portable.IDLEntity -{ - public int selected_profile_index = (int)0; - public org.omg.IOP.IOR ior = null; - - public IORAddressingInfo () - { - } // ctor - - public IORAddressingInfo (int _selected_profile_index, org.omg.IOP.IOR _ior) - { - selected_profile_index = _selected_profile_index; - ior = _ior; - } // ctor - -} // class IORAddressingInfo --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java 2018-01-30 20:20:14.000000000 -0500 +++ /dev/null 2018-01-30 20:20:14.000000000 -0500 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - - -/** -* com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ - -abstract public class IORAddressingInfoHelper -{ - private static String _id = "IDL:messages/IORAddressingInfo:1.0"; - - public static void insert (org.omg.CORBA.Any a, com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [2]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong); - _members0[0] = new org.omg.CORBA.StructMember ( - "selected_profile_index", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.IOP.IORHelper.type (); - _members0[1] = new org.omg.CORBA.StructMember ( - "ior", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.id (), "IORAddressingInfo", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo value = new com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo (); - value.selected_profile_index = istream.read_ulong (); - value.ior = org.omg.IOP.IORHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo value) - { - ostream.write_ulong (value.selected_profile_index); - org.omg.IOP.IORHelper.write (ostream, value.ior); - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/KeyAddr.java 2018-01-30 20:20:15.000000000 -0500 +++ /dev/null 2018-01-30 20:20:15.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - - -/** -* com/sun/corba/se/impl/protocol/giopmsgheaders/KeyAddr.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ - -public interface KeyAddr -{ - public static final short value = (short)(0); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage.java 2018-01-30 20:20:15.000000000 -0500 +++ /dev/null 2018-01-30 20:20:15.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.SystemException; -import com.sun.corba.se.spi.ior.IOR; - -/** - * This interface captures the LocateReplyMessage contract. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public interface LocateReplyMessage extends Message, LocateReplyOrReplyMessage { - - int UNKNOWN_OBJECT = 0; - int OBJECT_HERE = 1; - int OBJECT_FORWARD = 2; - int OBJECT_FORWARD_PERM = 3; // 1.2 - int LOC_SYSTEM_EXCEPTION = 4; // 1.2 - int LOC_NEEDS_ADDRESSING_MODE = 5; // 1.2 -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java 2018-01-30 20:20:16.000000000 -0500 +++ /dev/null 2018-01-30 20:20:16.000000000 -0500 @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.impl.encoding.CDRInputStream; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * This implements the GIOP 1.0 LocateReply header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class LocateReplyMessage_1_0 extends Message_1_0 - implements LocateReplyMessage { - - // Instance variables - - private ORB orb = null; - private int request_id = (int) 0; - private int locate_status = (int) 0; - private IOR ior = null; - - // Constructors - - LocateReplyMessage_1_0(ORB orb) { - this.orb = orb; - } - - LocateReplyMessage_1_0(ORB orb, int _request_id, - int _locate_status, IOR _ior) { - super(Message.GIOPBigMagic, false, Message.GIOPLocateReply, 0); - this.orb = orb; - request_id = _request_id; - locate_status = _locate_status; - ior = _ior; - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - public int getReplyStatus() { - return this.locate_status; - } - - public short getAddrDisposition() { - return KeyAddr.value; - } - - public SystemException getSystemException(String message) { - return null; // 1.0 LocateReply body does not contain SystemException - } - - public IOR getIOR() { - return this.ior; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - this.locate_status = istream.read_long(); - isValidReplyStatus(this.locate_status); // raises exception on error - - // The code below reads the reply body if status is OBJECT_FORWARD - if (this.locate_status == OBJECT_FORWARD) { - CDRInputStream cdr = (CDRInputStream) istream; - this.ior = IORFactories.makeIOR( cdr ) ; - } - } - - // Note, this writes only the header information. - // IOR may be written afterwards into the reply mesg body. - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - ostream.write_long(this.locate_status); - } - - // Static methods - - public static void isValidReplyStatus(int replyStatus) { - switch (replyStatus) { - case UNKNOWN_OBJECT : - case OBJECT_HERE : - case OBJECT_FORWARD : - break; - default : - ORBUtilSystemException localWrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_PROTOCOL ) ; - throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE); - } - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class LocateReplyMessage_1_0 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java 2018-01-30 20:20:17.000000000 -0500 +++ /dev/null 2018-01-30 20:20:17.000000000 -0500 @@ -1,140 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.encoding.CDRInputStream; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * This implements the GIOP 1.1 LocateReply header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class LocateReplyMessage_1_1 extends Message_1_1 - implements LocateReplyMessage { - - // Instance variables - - private ORB orb = null; - private int request_id = (int) 0; - private int reply_status = (int) 0; - private IOR ior = null; - - // Constructors - - LocateReplyMessage_1_1(ORB orb) { - this.orb = orb; - } - - LocateReplyMessage_1_1(ORB orb, int _request_id, - int _reply_status, IOR _ior) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPLocateReply, 0); - this.orb = orb; - request_id = _request_id; - reply_status = _reply_status; - ior = _ior; - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - public int getReplyStatus() { - return this.reply_status; - } - - public short getAddrDisposition() { - return KeyAddr.value; - } - - public SystemException getSystemException(String message) { - return null; // 1.0 LocateReply body does not contain SystemException - } - - public IOR getIOR() { - return this.ior; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - this.reply_status = istream.read_long(); - isValidReplyStatus(this.reply_status); // raises exception on error - - // The code below reads the reply body if status is OBJECT_FORWARD - if (this.reply_status == OBJECT_FORWARD) { - CDRInputStream cdr = (CDRInputStream) istream; - this.ior = IORFactories.makeIOR( cdr ) ; - } - } - - // Note, this writes only the header information. SystemException or - // IOR may be written afterwards into the reply mesg body. - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - ostream.write_long(this.reply_status); - } - - // Static methods - - public static void isValidReplyStatus(int replyStatus) { - switch (replyStatus) { - case UNKNOWN_OBJECT : - case OBJECT_HERE : - case OBJECT_FORWARD : - break; - default : - ORBUtilSystemException localWrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_PROTOCOL ) ; - throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE); - } - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class LocateReplyMessage_1_1 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java 2018-01-30 20:20:17.000000000 -0500 +++ /dev/null 2018-01-30 20:20:17.000000000 -0500 @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream; - -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * This implements the GIOP 1.2 LocateReply header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class LocateReplyMessage_1_2 extends Message_1_2 - implements LocateReplyMessage { - - // Instance variables - - private ORB orb = null; - private ORBUtilSystemException wrapper = null ; - private int reply_status = (int) 0; - private IOR ior = null; - private String exClassName = null; - private int minorCode = (int) 0; - private CompletionStatus completionStatus = null; - private short addrDisposition = KeyAddr.value; // default; - - // Constructors - - LocateReplyMessage_1_2(ORB orb) { - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - LocateReplyMessage_1_2(ORB orb, int _request_id, - int _reply_status, IOR _ior) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPLocateReply, 0); - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - request_id = _request_id; - reply_status = _reply_status; - ior = _ior; - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - public int getReplyStatus() { - return this.reply_status; - } - - public short getAddrDisposition() { - return this.addrDisposition; - } - - public SystemException getSystemException(String message) { - return MessageBase.getSystemException( - exClassName, minorCode, completionStatus, message, wrapper); - } - - public IOR getIOR() { - return this.ior; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - this.reply_status = istream.read_long(); - isValidReplyStatus(this.reply_status); // raises exception on error - - // GIOP 1.2 LocateReply message bodies are not aligned on - // 8 byte boundaries. - - // The code below reads the reply body in some cases - // LOC_SYSTEM_EXCEPTION & OBJECT_FORWARD & OBJECT_FORWARD_PERM & - // LOC_NEEDS_ADDRESSING_MODE - if (this.reply_status == LOC_SYSTEM_EXCEPTION) { - - String reposId = istream.read_string(); - this.exClassName = ORBUtility.classNameOf(reposId); - this.minorCode = istream.read_long(); - int status = istream.read_long(); - - switch (status) { - case CompletionStatus._COMPLETED_YES: - this.completionStatus = CompletionStatus.COMPLETED_YES; - break; - case CompletionStatus._COMPLETED_NO: - this.completionStatus = CompletionStatus.COMPLETED_NO; - break; - case CompletionStatus._COMPLETED_MAYBE: - this.completionStatus = CompletionStatus.COMPLETED_MAYBE; - break; - default: - throw wrapper.badCompletionStatusInLocateReply( - CompletionStatus.COMPLETED_MAYBE, new Integer(status) ); - } - } else if ( (this.reply_status == OBJECT_FORWARD) || - (this.reply_status == OBJECT_FORWARD_PERM) ){ - CDRInputStream cdr = (CDRInputStream) istream; - this.ior = IORFactories.makeIOR( cdr ) ; - } else if (this.reply_status == LOC_NEEDS_ADDRESSING_MODE) { - // read GIOP::AddressingDisposition from body and resend the - // original request using the requested addressing mode. The - // resending is transparent to the caller. - this.addrDisposition = AddressingDispositionHelper.read(istream); - } - } - - // Note, this writes only the header information. SystemException or - // IOR or GIOP::AddressingDisposition may be written afterwards into the - // reply mesg body. - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - ostream.write_long(this.reply_status); - - - // GIOP 1.2 LocateReply message bodies are not aligned on - // 8 byte boundaries. - } - - // Static methods - - public static void isValidReplyStatus(int replyStatus) { - switch (replyStatus) { - case UNKNOWN_OBJECT : - case OBJECT_HERE : - case OBJECT_FORWARD : - case OBJECT_FORWARD_PERM : - case LOC_SYSTEM_EXCEPTION : - case LOC_NEEDS_ADDRESSING_MODE : - break; - default : - ORBUtilSystemException localWrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_PROTOCOL ) ; - throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE); - } - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class LocateReplyMessage_1_2 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java 2018-01-30 20:20:18.000000000 -0500 +++ /dev/null 2018-01-30 20:20:18.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.SystemException; -import com.sun.corba.se.spi.ior.IOR; - -public interface LocateReplyOrReplyMessage extends Message { - - int getRequestId(); - int getReplyStatus(); - SystemException getSystemException(String message); - IOR getIOR(); - short getAddrDisposition(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage.java 2018-01-30 20:20:19.000000000 -0500 +++ /dev/null 2018-01-30 20:20:19.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import com.sun.corba.se.spi.ior.ObjectKey; - -/** - * This interface captures the LocateRequestMessage contract. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public interface LocateRequestMessage extends Message { - int getRequestId(); - ObjectKey getObjectKey(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java 2018-01-30 20:20:19.000000000 -0500 +++ /dev/null 2018-01-30 20:20:19.000000000 -0500 @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.ior.ObjectKey; - -/** - * This implements the GIOP 1.0 LocateRequest header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class LocateRequestMessage_1_0 extends Message_1_0 - implements LocateRequestMessage { - - // Instance variables - - private ORB orb = null; - private int request_id = (int) 0; - private byte[] object_key = null; - private ObjectKey objectKey = null; - - // Constructor - - LocateRequestMessage_1_0(ORB orb) { - this.orb = orb; - } - - LocateRequestMessage_1_0(ORB orb, int _request_id, byte[] _object_key) { - super(Message.GIOPBigMagic, false, Message.GIOPLocateRequest, 0); - this.orb = orb; - request_id = _request_id; - object_key = _object_key; - } - - // Accessor methods (LocateRequestMessage interface) - - public int getRequestId() { - return this.request_id; - } - - public ObjectKey getObjectKey() { - if (this.objectKey == null) { - // this will raise a MARSHAL exception upon errors. - this.objectKey = MessageBase.extractObjectKey(object_key, orb); - } - - return this.objectKey; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream);; - this.request_id = istream.read_ulong(); - int _len0 = istream.read_long(); - this.object_key = new byte[_len0]; - istream.read_octet_array (this.object_key, 0, _len0); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - nullCheck(this.object_key); - ostream.write_long(this.object_key.length); - ostream.write_octet_array(this.object_key, 0, this.object_key.length); - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class LocateRequestMessage_1_0 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java 2018-01-30 20:20:20.000000000 -0500 +++ /dev/null 2018-01-30 20:20:20.000000000 -0500 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.ior.ObjectKey; - -/** - * This implements the GIOP 1.1 LocateRequest header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class LocateRequestMessage_1_1 extends Message_1_1 - implements LocateRequestMessage { - - // Instance variables - - private ORB orb = null; - private int request_id = (int) 0; - private byte[] object_key = null; - private ObjectKey objectKey = null; - - // Constructors - - LocateRequestMessage_1_1(ORB orb) { - this.orb = orb; - } - - LocateRequestMessage_1_1(ORB orb, int _request_id, byte[] _object_key) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPLocateRequest, 0); - this.orb = orb; - request_id = _request_id; - object_key = _object_key; - } - - // Accessor methods (LocateRequestMessage interface) - - public int getRequestId() { - return this.request_id; - } - - public ObjectKey getObjectKey() { - if (this.objectKey == null) { - // this will raise a MARSHAL exception upon errors. - this.objectKey = MessageBase.extractObjectKey(object_key, orb); - } - - return this.objectKey; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - int _len1 = istream.read_long(); - this.object_key = new byte[_len1]; - istream.read_octet_array(this.object_key, 0, _len1); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - nullCheck(this.object_key); - ostream.write_long(this.object_key.length); - ostream.write_octet_array(this.object_key, 0, this.object_key.length); - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class LocateRequestMessage_1_1 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java 2018-01-30 20:20:21.000000000 -0500 +++ /dev/null 2018-01-30 20:20:21.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import com.sun.corba.se.spi.ior.ObjectKey; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; - -/** - * This implements the GIOP 1.2 LocateRequest header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class LocateRequestMessage_1_2 extends Message_1_2 - implements LocateRequestMessage { - - // Instance variables - - private ORB orb = null; - private ObjectKey objectKey = null; - private TargetAddress target = null; - - // Constructors - - LocateRequestMessage_1_2(ORB orb) { - this.orb = orb; - } - - LocateRequestMessage_1_2(ORB orb, int _request_id, TargetAddress _target) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPLocateRequest, 0); - this.orb = orb; - request_id = _request_id; - target = _target; - } - - // Accessor methods (LocateRequestMessage interface) - - public int getRequestId() { - return this.request_id; - } - - public ObjectKey getObjectKey() { - if (this.objectKey == null) { - // this will raise a MARSHAL exception upon errors. - this.objectKey = MessageBase.extractObjectKey(target, orb); - } - - return this.objectKey; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - this.target = TargetAddressHelper.read(istream); - getObjectKey(); // this does AddressingDisposition check - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong (this.request_id); - nullCheck(this.target); - TargetAddressHelper.write(ostream, this.target); - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class LocateRequestMessage_1_2 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message.java 2018-01-30 20:20:21.000000000 -0500 +++ /dev/null 2018-01-30 20:20:21.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.protocol.giopmsgheaders; - -import java.io.IOException; -import java.nio.ByteBuffer; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -/** - * This is the base interface for different message type interfaces. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public interface Message { - - // Generic constants - - int defaultBufferSize = 1024; - int GIOPBigEndian = 0; - int GIOPLittleEndian = 1; - int GIOPBigMagic = 0x47494F50; - int GIOPLittleMagic = 0x504F4947; - int GIOPMessageHeaderLength = 12; - - // Other useful constants - - byte LITTLE_ENDIAN_BIT = 0x01; - byte MORE_FRAGMENTS_BIT = 0x02; - byte FLAG_NO_FRAG_BIG_ENDIAN = 0x00; - static final byte TRAILING_TWO_BIT_BYTE_MASK = 0x3; - static final byte THREAD_POOL_TO_USE_MASK = 0x3F; - - // Encoding related constants - - byte CDR_ENC_VERSION = 0x00; - byte JAVA_ENC_VERSION = 0x01; - - // Message types - - byte GIOPRequest = 0; - byte GIOPReply = 1; - byte GIOPCancelRequest = 2; - byte GIOPLocateRequest = 3; - byte GIOPLocateReply = 4; - byte GIOPCloseConnection = 5; - byte GIOPMessageError = 6; - byte GIOPFragment = 7; // 1.1 & 1.2: - - // Accessor methods - - GIOPVersion getGIOPVersion(); - byte getEncodingVersion(); - boolean isLittleEndian(); - boolean moreFragmentsToFollow(); - int getType(); - int getSize(); - ByteBuffer getByteBuffer(); - int getThreadPoolToUse(); - - // Mutator methods - - void read(org.omg.CORBA.portable.InputStream istream); - void write(org.omg.CORBA.portable.OutputStream ostream); - - void setSize(ByteBuffer byteBuffer, int size); - - FragmentMessage createFragmentMessage(); - - void callback(MessageHandler handler) throws IOException; - - void setByteBuffer(ByteBuffer byteBuffer); - void setEncodingVersion(byte version); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java 2018-01-30 20:20:22.000000000 -0500 +++ /dev/null 2018-01-30 20:20:22.000000000 -0500 @@ -1,967 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.protocol.giopmsgheaders; - -import java.io.IOException; -import java.lang.Class; -import java.lang.reflect.Constructor; -import java.nio.ByteBuffer; -import java.util.Iterator; - -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.Principal; -import org.omg.CORBA.SystemException; -import org.omg.IOP.TaggedProfile; - -import com.sun.corba.se.pept.transport.ByteBufferPool; - -import com.sun.corba.se.spi.ior.ObjectKey; -import com.sun.corba.se.spi.ior.ObjectId; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.ObjectKeyFactory; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile; -import com.sun.corba.se.spi.ior.iiop.IIOPFactories; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.ior.iiop.RequestPartitioningComponent; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.transport.ReadTimeouts; - -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.impl.encoding.ByteBufferWithInfo; -import com.sun.corba.se.impl.encoding.CDRInputStream_1_0; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.protocol.AddressingDispositionException; - -import sun.corba.SharedSecrets; - -/** - * This class acts as the base class for the various GIOP message types. This - * also serves as a factory to create various message types. We currently - * support GIOP 1.0, 1.1 and 1.2 message types. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public abstract class MessageBase implements Message{ - - // This is only used when the giopDebug flag is - // turned on. - public byte[] giopHeader; - private ByteBuffer byteBuffer; - private int threadPoolToUse; - - // (encodingVersion == 0x00) implies CDR encoding, - // (encodingVersion > 0x00) implies Java serialization version. - byte encodingVersion = (byte) Message.CDR_ENC_VERSION; - - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.get( CORBALogDomains.RPC_PROTOCOL ) ; - - // Static methods - - public static String typeToString(int type) - { - return typeToString((byte)type); - } - - public static String typeToString(byte type) - { - String result = type + "/"; - switch (type) { - case GIOPRequest : result += "GIOPRequest"; break; - case GIOPReply : result += "GIOPReply"; break; - case GIOPCancelRequest : result += "GIOPCancelRequest"; break; - case GIOPLocateRequest : result += "GIOPLocateRequest"; break; - case GIOPLocateReply : result += "GIOPLocateReply"; break; - case GIOPCloseConnection : result += "GIOPCloseConnection"; break; - case GIOPMessageError : result += "GIOPMessageError"; break; - case GIOPFragment : result += "GIOPFragment"; break; - default : result += "Unknown"; break; - } - return result; - } - - public static MessageBase readGIOPMessage(ORB orb, CorbaConnection connection) - { - MessageBase msg = readGIOPHeader(orb, connection); - msg = (MessageBase)readGIOPBody(orb, connection, (Message)msg); - return msg; - } - - public static MessageBase readGIOPHeader(ORB orb, CorbaConnection connection) - { - MessageBase msg = null; - ReadTimeouts readTimeouts = - orb.getORBData().getTransportTCPReadTimeouts(); - - ByteBuffer buf = null; - - try { - buf = connection.read(GIOPMessageHeaderLength, - 0, GIOPMessageHeaderLength, - readTimeouts.get_max_giop_header_time_to_wait()); - } catch (IOException e) { - throw wrapper.ioexceptionWhenReadingConnection(e); - } - - if (orb.giopDebugFlag) { - // Since this is executed in debug mode only the overhead of - // using a View Buffer is not an issue. We'll also use a - // read-only View Buffer so we don't disturb the state of - // byteBuffer. - dprint(".readGIOPHeader: " + typeToString(buf.get(7))); - dprint(".readGIOPHeader: GIOP header is: "); - ByteBuffer viewBuffer = buf.asReadOnlyBuffer(); - viewBuffer.position(0).limit(GIOPMessageHeaderLength); - ByteBufferWithInfo bbwi = new ByteBufferWithInfo(orb,viewBuffer); - bbwi.buflen = GIOPMessageHeaderLength; - CDRInputStream_1_0.printBuffer(bbwi); - } - - // Sanity checks - - /* - * check for magic corruption - * check for version incompatibility - * check if fragmentation is allowed based on mesg type. - . 1.0 fragmentation disallowed; FragmentMessage is non-existent. - . 1.1 only {Request, Reply} msgs maybe fragmented. - . 1.2 only {Request, Reply, LocateRequest, LocateReply} msgs - maybe fragmented. - */ - - int b1, b2, b3, b4; - - b1 = (buf.get(0) << 24) & 0xFF000000; - b2 = (buf.get(1) << 16) & 0x00FF0000; - b3 = (buf.get(2) << 8) & 0x0000FF00; - b4 = (buf.get(3) << 0) & 0x000000FF; - int magic = (b1 | b2 | b3 | b4); - - if (magic != GIOPBigMagic) { - // If Magic is incorrect, it is an error. - // ACTION : send MessageError and close the connection. - throw wrapper.giopMagicError( CompletionStatus.COMPLETED_MAYBE); - } - - // Extract the encoding version from the request GIOP Version, - // if it contains an encoding, and set GIOP version appropriately. - // For Java serialization, we use GIOP Version 1.2 message format. - byte requestEncodingVersion = Message.CDR_ENC_VERSION; - if ((buf.get(4) == 0x0D) && - (buf.get(5) <= Message.JAVA_ENC_VERSION) && - (buf.get(5) > Message.CDR_ENC_VERSION) && - orb.getORBData().isJavaSerializationEnabled()) { - // Entering this block means the request is using Java encoding, - // and the encoding version is <= this ORB's Java encoding version. - requestEncodingVersion = buf.get(5); - buf.put(4, (byte) 0x01); - buf.put(5, (byte) 0x02); - } - - GIOPVersion orbVersion = orb.getORBData().getGIOPVersion(); - - if (orb.giopDebugFlag) { - dprint(".readGIOPHeader: Message GIOP version: " - + buf.get(4) + '.' + buf.get(5)); - dprint(".readGIOPHeader: ORB Max GIOP Version: " - + orbVersion); - } - - if ( (buf.get(4) > orbVersion.getMajor()) || - ( (buf.get(4) == orbVersion.getMajor()) && (buf.get(5) > orbVersion.getMinor()) ) - ) { - // For requests, sending ORB should use the version info - // published in the IOR or may choose to use a <= version - // for requests. If the version is greater than published version, - // it is an error. - - // For replies, the ORB should always receive a version it supports - // or less, but never greater (except for MessageError) - - // ACTION : Send back a MessageError() with the the highest version - // the server ORB supports, and close the connection. - if ( buf.get(7) != GIOPMessageError ) { - throw wrapper.giopVersionError( CompletionStatus.COMPLETED_MAYBE); - } - } - - AreFragmentsAllowed(buf.get(4), buf.get(5), buf.get(6), buf.get(7)); - - // create appropriate messages types - - switch (buf.get(7)) { - - case GIOPRequest: - if (orb.giopDebugFlag) { - dprint(".readGIOPHeader: creating RequestMessage"); - } - //msg = new RequestMessage(orb.giopDebugFlag); - if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0 - msg = new RequestMessage_1_0(orb); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1 - msg = new RequestMessage_1_1(orb); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2 - msg = new RequestMessage_1_2(orb); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - break; - - case GIOPLocateRequest: - if (orb.giopDebugFlag) { - dprint(".readGIOPHeader: creating LocateRequestMessage"); - } - //msg = new LocateRequestMessage(orb.giopDebugFlag); - if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0 - msg = new LocateRequestMessage_1_0(orb); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1 - msg = new LocateRequestMessage_1_1(orb); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2 - msg = new LocateRequestMessage_1_2(orb); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - break; - - case GIOPCancelRequest: - if (orb.giopDebugFlag) { - dprint(".readGIOPHeader: creating CancelRequestMessage"); - } - //msg = new CancelRequestMessage(orb.giopDebugFlag); - if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0 - msg = new CancelRequestMessage_1_0(); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1 - msg = new CancelRequestMessage_1_1(); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2 - msg = new CancelRequestMessage_1_2(); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - break; - - case GIOPReply: - if (orb.giopDebugFlag) { - dprint(".readGIOPHeader: creating ReplyMessage"); - } - //msg = new ReplyMessage(orb.giopDebugFlag); - if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0 - msg = new ReplyMessage_1_0(orb); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1 - msg = new ReplyMessage_1_1(orb); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2 - msg = new ReplyMessage_1_2(orb); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - break; - - case GIOPLocateReply: - if (orb.giopDebugFlag) { - dprint(".readGIOPHeader: creating LocateReplyMessage"); - } - //msg = new LocateReplyMessage(orb.giopDebugFlag); - if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0 - msg = new LocateReplyMessage_1_0(orb); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1 - msg = new LocateReplyMessage_1_1(orb); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2 - msg = new LocateReplyMessage_1_2(orb); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - break; - - case GIOPCloseConnection: - case GIOPMessageError: - if (orb.giopDebugFlag) { - dprint(".readGIOPHeader: creating Message for CloseConnection or MessageError"); - } - // REVISIT a MessageError may contain the highest version server - // can support. In such a case, a new request may be made with the - // correct version or the connection be simply closed. Note the - // connection may have been closed by the server. - //msg = new Message(orb.giopDebugFlag); - if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0 - msg = new Message_1_0(); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1 - msg = new Message_1_1(); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2 - msg = new Message_1_1(); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - break; - - case GIOPFragment: - if (orb.giopDebugFlag) { - dprint(".readGIOPHeader: creating FragmentMessage"); - } - //msg = new FragmentMessage(orb.giopDebugFlag); - if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0 - // not possible (error checking done already) - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1 - msg = new FragmentMessage_1_1(); - } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2 - msg = new FragmentMessage_1_2(); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - break; - - default: - if (orb.giopDebugFlag) - dprint(".readGIOPHeader: UNKNOWN MESSAGE TYPE: " - + buf.get(7)); - // unknown message type ? - // ACTION : send MessageError and close the connection - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - - // - // Initialize the generic GIOP header instance variables. - // - - if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0 - Message_1_0 msg10 = (Message_1_0) msg; - msg10.magic = magic; - msg10.GIOP_version = new GIOPVersion(buf.get(4), buf.get(5)); - msg10.byte_order = (buf.get(6) == LITTLE_ENDIAN_BIT); - // 'request partitioning' not supported on GIOP version 1.0 - // so just use the default thread pool, 0. - msg.threadPoolToUse = 0; - msg10.message_type = buf.get(7); - msg10.message_size = readSize(buf.get(8), buf.get(9), buf.get(10), buf.get(11), - msg10.isLittleEndian()) + - GIOPMessageHeaderLength; - } else { // 1.1 & 1.2 - Message_1_1 msg11 = (Message_1_1) msg; - msg11.magic = magic; - msg11.GIOP_version = new GIOPVersion(buf.get(4), buf.get(5)); - msg11.flags = (byte)(buf.get(6) & TRAILING_TWO_BIT_BYTE_MASK); - // IMPORTANT: For 'request partitioning', the thread pool to use - // information is stored in the leading 6 bits of byte 6. - // - // IMPORTANT: Request partitioning is a PROPRIETARY EXTENSION !!! - // - // NOTE: Bitwise operators will promote a byte to an int before - // performing a bitwise operation and bytes, ints, longs, etc - // are signed types in Java. Thus, the need for the - // THREAD_POOL_TO_USE_MASK operation. - msg.threadPoolToUse = (buf.get(6) >>> 2) & THREAD_POOL_TO_USE_MASK; - msg11.message_type = buf.get(7); - msg11.message_size = - readSize(buf.get(8), buf.get(9), buf.get(10), buf.get(11), - msg11.isLittleEndian()) + GIOPMessageHeaderLength; - } - - - if (orb.giopDebugFlag) { - // Since this is executed in debug mode only the overhead of - // using a View Buffer is not an issue. We'll also use a - // read-only View Buffer so we don't disturb the state of - // byteBuffer. - dprint(".readGIOPHeader: header construction complete."); - - // For debugging purposes, save the 12 bytes of the header - ByteBuffer viewBuf = buf.asReadOnlyBuffer(); - byte[] msgBuf = new byte[GIOPMessageHeaderLength]; - viewBuf.position(0).limit(GIOPMessageHeaderLength); - viewBuf.get(msgBuf,0,msgBuf.length); - // REVISIT: is giopHeader still used? - ((MessageBase)msg).giopHeader = msgBuf; - } - - msg.setByteBuffer(buf); - msg.setEncodingVersion(requestEncodingVersion); - - return msg; - } - - public static Message readGIOPBody(ORB orb, - CorbaConnection connection, - Message msg) - { - ReadTimeouts readTimeouts = - orb.getORBData().getTransportTCPReadTimeouts(); - ByteBuffer buf = msg.getByteBuffer(); - - buf.position(MessageBase.GIOPMessageHeaderLength); - int msgSizeMinusHeader = - msg.getSize() - MessageBase.GIOPMessageHeaderLength; - try { - buf = connection.read(buf, - GIOPMessageHeaderLength, msgSizeMinusHeader, - readTimeouts.get_max_time_to_wait()); - } catch (IOException e) { - throw wrapper.ioexceptionWhenReadingConnection(e); - } - - msg.setByteBuffer(buf); - - if (orb.giopDebugFlag) { - dprint(".readGIOPBody: received message:"); - ByteBuffer viewBuffer = buf.asReadOnlyBuffer(); - viewBuffer.position(0).limit(msg.getSize()); - ByteBufferWithInfo bbwi = new ByteBufferWithInfo(orb, viewBuffer); - CDRInputStream_1_0.printBuffer(bbwi); - } - - return msg; - } - - private static RequestMessage createRequest( - ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, - boolean response_expected, byte[] object_key, String operation, - ServiceContexts service_contexts, Principal requesting_principal) { - - if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new RequestMessage_1_0(orb, service_contexts, request_id, - response_expected, object_key, - operation, requesting_principal); - } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new RequestMessage_1_1(orb, service_contexts, request_id, - response_expected, new byte[] { 0x00, 0x00, 0x00 }, - object_key, operation, requesting_principal); - } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - // Note: Currently we use response_expected flag to decide if the - // call is oneway or not. Ideally, it is possible to expect a - // response on a oneway call too, but we do not support it now. - byte response_flags = 0x03; - if (response_expected) { - response_flags = 0x03; - } else { - response_flags = 0x00; - } - /* - // REVISIT The following is the correct way to do it. This gives - // more flexibility. - if ((DII::INV_NO_RESPONSE == false) && response_expected) { - response_flags = 0x03; // regular two-way - } else if ((DII::INV_NO_RESPONSE == false) && !response_expected) { - // this condition is not possible - } else if ((DII::INV_NO_RESPONSE == true) && response_expected) { - // oneway, but we need response for LocationForwards or - // SystemExceptions. - response_flags = 0x01; - } else if ((DII::INV_NO_RESPONSE == true) && !response_expected) { - // oneway, no response required - response_flags = 0x00; - } - */ - TargetAddress target = new TargetAddress(); - target.object_key(object_key); - RequestMessage msg = - new RequestMessage_1_2(orb, request_id, response_flags, - new byte[] { 0x00, 0x00, 0x00 }, - target, operation, service_contexts); - msg.setEncodingVersion(encodingVersion); - return msg; - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - } - - public static RequestMessage createRequest( - ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, - boolean response_expected, IOR ior, - short addrDisp, String operation, - ServiceContexts service_contexts, Principal requesting_principal) { - - RequestMessage requestMessage = null; - IIOPProfile profile = ior.getProfile(); - - if (addrDisp == KeyAddr.value) { - // object key will be used for target addressing - profile = ior.getProfile(); - ObjectKey objKey = profile.getObjectKey(); - byte[] object_key = objKey.getBytes(orb); - requestMessage = - createRequest(orb, gv, encodingVersion, request_id, - response_expected, object_key, - operation, service_contexts, - requesting_principal); - } else { - - if (!(gv.equals(GIOPVersion.V1_2))) { - // only object_key based target addressing is allowed for - // GIOP 1.0 & 1.1 - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - - // Note: Currently we use response_expected flag to decide if the - // call is oneway or not. Ideally, it is possible to expect a - // response on a oneway call too, but we do not support it now. - byte response_flags = 0x03; - if (response_expected) { - response_flags = 0x03; - } else { - response_flags = 0x00; - } - - TargetAddress target = new TargetAddress(); - if (addrDisp == ProfileAddr.value) { // iop profile will be used - profile = ior.getProfile(); - target.profile(profile.getIOPProfile()); - } else if (addrDisp == ReferenceAddr.value) { // ior will be used - IORAddressingInfo iorInfo = - new IORAddressingInfo( 0, // profile index - ior.getIOPIOR()); - target.ior(iorInfo); - } else { - // invalid target addressing disposition value - throw wrapper.illegalTargetAddressDisposition( - CompletionStatus.COMPLETED_NO); - } - - requestMessage = - new RequestMessage_1_2(orb, request_id, response_flags, - new byte[] { 0x00, 0x00, 0x00 }, target, - operation, service_contexts); - requestMessage.setEncodingVersion(encodingVersion); - } - - if (gv.supportsIORIIOPProfileComponents()) { - // add request partitioning thread pool to use info - int poolToUse = 0; // default pool - IIOPProfileTemplate temp = - (IIOPProfileTemplate)profile.getTaggedProfileTemplate(); - Iterator iter = - temp.iteratorById(ORBConstants.TAG_REQUEST_PARTITIONING_ID); - if (iter.hasNext()) { - poolToUse = - ((RequestPartitioningComponent)iter.next()).getRequestPartitioningId(); - } - - if (poolToUse < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID || - poolToUse > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) { - throw wrapper.invalidRequestPartitioningId(new Integer(poolToUse), - new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID), - new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID)); - } - requestMessage.setThreadPoolToUse(poolToUse); - } - - return requestMessage; - } - - public static ReplyMessage createReply( - ORB orb, GIOPVersion gv, byte encodingVersion, int request_id, - int reply_status, ServiceContexts service_contexts, IOR ior) { - - if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new ReplyMessage_1_0(orb, service_contexts, request_id, - reply_status, ior); - } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new ReplyMessage_1_1(orb, service_contexts, request_id, - reply_status, ior); - } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - ReplyMessage msg = - new ReplyMessage_1_2(orb, request_id, reply_status, - service_contexts, ior); - msg.setEncodingVersion(encodingVersion); - return msg; - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - } - - public static LocateRequestMessage createLocateRequest( - ORB orb, GIOPVersion gv, byte encodingVersion, - int request_id, byte[] object_key) { - - if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new LocateRequestMessage_1_0(orb, request_id, object_key); - } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new LocateRequestMessage_1_1(orb, request_id, object_key); - } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - TargetAddress target = new TargetAddress(); - target.object_key(object_key); - LocateRequestMessage msg = - new LocateRequestMessage_1_2(orb, request_id, target); - msg.setEncodingVersion(encodingVersion); - return msg; - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - } - - public static LocateReplyMessage createLocateReply( - ORB orb, GIOPVersion gv, byte encodingVersion, - int request_id, int locate_status, IOR ior) { - - if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new LocateReplyMessage_1_0(orb, request_id, - locate_status, ior); - } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new LocateReplyMessage_1_1(orb, request_id, - locate_status, ior); - } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - LocateReplyMessage msg = - new LocateReplyMessage_1_2(orb, request_id, - locate_status, ior); - msg.setEncodingVersion(encodingVersion); - return msg; - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - } - - public static CancelRequestMessage createCancelRequest( - GIOPVersion gv, int request_id) { - - if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new CancelRequestMessage_1_0(request_id); - } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new CancelRequestMessage_1_1(request_id); - } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - return new CancelRequestMessage_1_2(request_id); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - } - - public static Message createCloseConnection(GIOPVersion gv) { - if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new Message_1_0(Message.GIOPBigMagic, false, - Message.GIOPCloseConnection, 0); - } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1, - FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPCloseConnection, 0); - } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2, - FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPCloseConnection, 0); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - } - - public static Message createMessageError(GIOPVersion gv) { - if (gv.equals(GIOPVersion.V1_0)) { // 1.0 - return new Message_1_0(Message.GIOPBigMagic, false, - Message.GIOPMessageError, 0); - } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1 - return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_1, - FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPMessageError, 0); - } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2 - return new Message_1_1(Message.GIOPBigMagic, GIOPVersion.V1_2, - FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPMessageError, 0); - } else { - throw wrapper.giopVersionError( - CompletionStatus.COMPLETED_MAYBE); - } - } - - public static FragmentMessage createFragmentMessage(GIOPVersion gv) { - // This method is not currently used. - // New fragment messages are always created from existing messages. - // Creating a FragmentMessage from InputStream is done in - // createFromStream(..) - return null; - } - - public static int getRequestId(Message msg) { - switch (msg.getType()) { - case GIOPRequest : - return ((RequestMessage) msg).getRequestId(); - case GIOPReply : - return ((ReplyMessage) msg).getRequestId(); - case GIOPLocateRequest : - return ((LocateRequestMessage) msg).getRequestId(); - case GIOPLocateReply : - return ((LocateReplyMessage) msg).getRequestId(); - case GIOPCancelRequest : - return ((CancelRequestMessage) msg).getRequestId(); - case GIOPFragment : - return ((FragmentMessage) msg).getRequestId(); - } - - throw wrapper.illegalGiopMsgType( - CompletionStatus.COMPLETED_MAYBE); - } - - /** - * Set a flag in the given buffer (fragment bit, byte order bit, etc) - */ - public static void setFlag(ByteBuffer byteBuffer, int flag) { - byte b = byteBuffer.get(6); - b |= flag; - byteBuffer.put(6,b); - } - - /** - * Clears a flag in the given buffer - */ - public static void clearFlag(byte[] buf, int flag) { - buf[6] &= (0xFF ^ flag); - } - - private static void AreFragmentsAllowed(byte major, byte minor, byte flag, - byte msgType) { - - if ( (major == 0x01) && (minor == 0x00) ) { // 1.0 - if (msgType == GIOPFragment) { - throw wrapper.fragmentationDisallowed( - CompletionStatus.COMPLETED_MAYBE); - } - } - - if ( (flag & MORE_FRAGMENTS_BIT) == MORE_FRAGMENTS_BIT ) { - switch (msgType) { - case GIOPCancelRequest : - case GIOPCloseConnection : - case GIOPMessageError : - throw wrapper.fragmentationDisallowed( - CompletionStatus.COMPLETED_MAYBE); - case GIOPLocateRequest : - case GIOPLocateReply : - if ( (major == 0x01) && (minor == 0x01) ) { // 1.1 - throw wrapper.fragmentationDisallowed( - CompletionStatus.COMPLETED_MAYBE); - } - break; - } - } - } - - /** - * Construct an ObjectKey from a byte[]. - * - * @return ObjectKey the object key. - */ - static ObjectKey extractObjectKey(byte[] objKey, ORB orb) { - - try { - if (objKey != null) { - ObjectKey objectKey = - orb.getObjectKeyFactory().create(objKey); - if (objectKey != null) { - return objectKey; - } - } - } catch (Exception e) { - // XXX log this exception - } - - // This exception is thrown if any exceptions are raised while - // extracting the object key or if the object key is empty. - throw wrapper.invalidObjectKey(); - } - - /** - * Extract the object key from TargetAddress. - * - * @return ObjectKey the object key. - */ - static ObjectKey extractObjectKey(TargetAddress target, ORB orb) { - - short orbTargetAddrPref = orb.getORBData().getGIOPTargetAddressPreference(); - short reqAddrDisp = target.discriminator(); - - switch (orbTargetAddrPref) { - case ORBConstants.ADDR_DISP_OBJKEY : - if (reqAddrDisp != KeyAddr.value) { - throw new AddressingDispositionException(KeyAddr.value); - } - break; - case ORBConstants.ADDR_DISP_PROFILE : - if (reqAddrDisp != ProfileAddr.value) { - throw new AddressingDispositionException(ProfileAddr.value); - } - break; - case ORBConstants.ADDR_DISP_IOR : - if (reqAddrDisp != ReferenceAddr.value) { - throw new AddressingDispositionException(ReferenceAddr.value); - } - break; - case ORBConstants.ADDR_DISP_HANDLE_ALL : - break; - default : - throw wrapper.orbTargetAddrPreferenceInExtractObjectkeyInvalid() ; - } - - try { - switch (reqAddrDisp) { - case KeyAddr.value : - byte[] objKey = target.object_key(); - if (objKey != null) { // AddressingDisposition::KeyAddr - ObjectKey objectKey = - orb.getObjectKeyFactory().create(objKey); - if (objectKey != null) { - return objectKey; - } - } - break; - case ProfileAddr.value : - IIOPProfile iiopProfile = null; - TaggedProfile profile = target.profile(); - if (profile != null) { // AddressingDisposition::ProfileAddr - iiopProfile = IIOPFactories.makeIIOPProfile(orb, profile); - ObjectKey objectKey = iiopProfile.getObjectKey(); - if (objectKey != null) { - return objectKey; - } - } - break; - case ReferenceAddr.value : - IORAddressingInfo iorInfo = target.ior(); - if (iorInfo != null) { // AddressingDisposition::IORAddr - profile = iorInfo.ior.profiles[iorInfo.selected_profile_index]; - iiopProfile = IIOPFactories.makeIIOPProfile(orb, profile); - ObjectKey objectKey = iiopProfile.getObjectKey(); - if (objectKey != null) { - return objectKey; - } - } - break; - default : // this cannot happen - // There is no need for a explicit exception, since the - // TargetAddressHelper.read() would have raised a BAD_OPERATION - // exception by now. - break; - } - } catch (Exception e) {} - - // This exception is thrown if any exceptions are raised while - // extracting the object key from the TargetAddress or if all the - // the valid TargetAddress::AddressingDispositions are empty. - throw wrapper.invalidObjectKey() ; - } - - private static int readSize(byte b1, byte b2, byte b3, byte b4, - boolean littleEndian) { - - int a1, a2, a3, a4; - - if (!littleEndian) { - a1 = (b1 << 24) & 0xFF000000; - a2 = (b2 << 16) & 0x00FF0000; - a3 = (b3 << 8) & 0x0000FF00; - a4 = (b4 << 0) & 0x000000FF; - } else { - a1 = (b4 << 24) & 0xFF000000; - a2 = (b3 << 16) & 0x00FF0000; - a3 = (b2 << 8) & 0x0000FF00; - a4 = (b1 << 0) & 0x000000FF; - } - - return (a1 | a2 | a3 | a4); - } - - static void nullCheck(Object obj) { - if (obj == null) { - throw wrapper.nullNotAllowed() ; - } - } - - static SystemException getSystemException( - String exClassName, int minorCode, CompletionStatus completionStatus, - String message, ORBUtilSystemException wrapper) - { - SystemException sysEx = null; - - try { - Class clazz = - SharedSecrets.getJavaCorbaAccess().loadClass(exClassName); - if (message == null) { - sysEx = (SystemException) clazz.newInstance(); - } else { - Class[] types = { String.class }; - Constructor constructor = clazz.getConstructor(types); - Object[] args = { message }; - sysEx = (SystemException)constructor.newInstance(args); - } - } catch (Exception someEx) { - throw wrapper.badSystemExceptionInReply( - CompletionStatus.COMPLETED_MAYBE, someEx ); - } - - sysEx.minor = minorCode; - sysEx.completed = completionStatus; - - return sysEx; - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } - - public ByteBuffer getByteBuffer() - { - return byteBuffer; - } - - public void setByteBuffer(ByteBuffer byteBuffer) - { - this.byteBuffer = byteBuffer; - } - - public int getThreadPoolToUse() - { - return threadPoolToUse; - } - - public byte getEncodingVersion() { - return this.encodingVersion; - } - - public void setEncodingVersion(byte version) { - this.encodingVersion = version; - } - - private static void dprint(String msg) - { - ORBUtility.dprint("MessageBase", msg); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageHandler.java 2018-01-30 20:20:23.000000000 -0500 +++ /dev/null 2018-01-30 20:20:23.000000000 -0500 @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import java.io.IOException; - -/** - * Interface which allows an implementation to use - * double dispatch when processing the various - * concrete message types found in this package. - */ -public interface MessageHandler -{ - // - // REVISIT - These should not throw IOException. - // Should be handled internally. - - /** - * Used for message types for which we don't have concrete classes, yet, - * such as CloseConnection and MessageError, as well as unknown types. - */ - void handleInput(Message header) throws IOException; - - // Request - void handleInput(RequestMessage_1_0 header) throws IOException; - void handleInput(RequestMessage_1_1 header) throws IOException; - void handleInput(RequestMessage_1_2 header) throws IOException; - - // Reply - void handleInput(ReplyMessage_1_0 header) throws IOException; - void handleInput(ReplyMessage_1_1 header) throws IOException; - void handleInput(ReplyMessage_1_2 header) throws IOException; - - // LocateRequest - void handleInput(LocateRequestMessage_1_0 header) throws IOException; - void handleInput(LocateRequestMessage_1_1 header) throws IOException; - void handleInput(LocateRequestMessage_1_2 header) throws IOException; - - // LocateReply - void handleInput(LocateReplyMessage_1_0 header) throws IOException; - void handleInput(LocateReplyMessage_1_1 header) throws IOException; - void handleInput(LocateReplyMessage_1_2 header) throws IOException; - - // Fragment - void handleInput(FragmentMessage_1_1 header) throws IOException; - void handleInput(FragmentMessage_1_2 header) throws IOException; - - // CancelRequest - void handleInput(CancelRequestMessage header) throws IOException; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_0.java 2018-01-30 20:20:23.000000000 -0500 +++ /dev/null 2018-01-30 20:20:23.000000000 -0500 @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import java.nio.ByteBuffer; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/* - * This implements the GIOP 1.0 Message header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public class Message_1_0 - extends com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase { - - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.get( CORBALogDomains.RPC_PROTOCOL ) ; - - // Instance variables - int magic = (int) 0; - GIOPVersion GIOP_version = null; - boolean byte_order = false; - byte message_type = (byte) 0; - int message_size = (int) 0; - - // Constructor - - Message_1_0() { - } - - Message_1_0(int _magic, boolean _byte_order, byte _message_type, - int _message_size) { - magic = _magic; - GIOP_version = GIOPVersion.V1_0; - byte_order = _byte_order; - message_type = _message_type; - message_size = _message_size; - } - - // Accessor methods - - public GIOPVersion getGIOPVersion() { - return this.GIOP_version; - } - - public int getType() { - return this.message_type; - } - - public int getSize() { - return this.message_size; - } - - public boolean isLittleEndian() { - return this.byte_order; - } - - public boolean moreFragmentsToFollow() { - return false; - } - - // Mutator methods - - public void setSize(ByteBuffer byteBuffer, int size) { - this.message_size = size; - - // - // Patch the size field in the header. - // - int patch = size - GIOPMessageHeaderLength; - if (!isLittleEndian()) { - byteBuffer.put(8, (byte)((patch >>> 24) & 0xFF)); - byteBuffer.put(9, (byte)((patch >>> 16) & 0xFF)); - byteBuffer.put(10, (byte)((patch >>> 8) & 0xFF)); - byteBuffer.put(11, (byte)((patch >>> 0) & 0xFF)); - } else { - byteBuffer.put(8, (byte)((patch >>> 0) & 0xFF)); - byteBuffer.put(9, (byte)((patch >>> 8) & 0xFF)); - byteBuffer.put(10, (byte)((patch >>> 16) & 0xFF)); - byteBuffer.put(11, (byte)((patch >>> 24) & 0xFF)); - } - } - - public FragmentMessage createFragmentMessage() { - throw wrapper.fragmentationDisallowed( - CompletionStatus.COMPLETED_MAYBE); - } - - // IO methods - - // This should do nothing even if it is called. The Message Header already - // is read off java.io.InputStream (not a CDRInputStream) by IIOPConnection - // in order to choose the correct CDR Version, msg_type, and msg_size. - // So, we would never need to read the Message Header off a CDRInputStream. - public void read(org.omg.CORBA.portable.InputStream istream) { - /* - this.magic = istream.read_long(); - this.GIOP_version = (new GIOPVersion()).read(istream); - this.byte_order = istream.read_boolean(); - this.message_type = istream.read_octet(); - this.message_size = istream.read_ulong(); - */ - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - ostream.write_long(this.magic); - nullCheck(this.GIOP_version); - this.GIOP_version.write(ostream); - ostream.write_boolean(this.byte_order); - ostream.write_octet(this.message_type); - ostream.write_ulong(this.message_size); - } - -} // class Message_1_0 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_1.java 2018-01-30 20:20:24.000000000 -0500 +++ /dev/null 2018-01-30 20:20:24.000000000 -0500 @@ -1,196 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.protocol.giopmsgheaders; - -import java.nio.ByteBuffer; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/* - * This implements the GIOP 1.1 & 1.2 Message header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public class Message_1_1 - extends com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase { - - // Constants - final static int UPPER_THREE_BYTES_OF_INT_MASK = 0xFF; - - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.get( CORBALogDomains.RPC_PROTOCOL ) ; - - // Instance variables - int magic = (int) 0; - GIOPVersion GIOP_version = null; - byte flags = (byte) 0; - byte message_type = (byte) 0; - int message_size = (int) 0; - - // Constructor - - Message_1_1() { - } - - Message_1_1(int _magic, GIOPVersion _GIOP_version, byte _flags, - byte _message_type, int _message_size) { - magic = _magic; - GIOP_version = _GIOP_version; - flags = _flags; - message_type = _message_type; - message_size = _message_size; - } - - // Accessor methods - - public GIOPVersion getGIOPVersion() { - return this.GIOP_version; - } - - public int getType() { - return this.message_type; - } - - public int getSize() { - return this.message_size; - } - - public boolean isLittleEndian() { - return ((this.flags & LITTLE_ENDIAN_BIT) == LITTLE_ENDIAN_BIT); - } - - public boolean moreFragmentsToFollow() { - return ( (this.flags & MORE_FRAGMENTS_BIT) == MORE_FRAGMENTS_BIT ); - } - - // Mutator methods - - // NOTE: This is a SUN PROPRIETARY EXTENSION - // Add the poolToUse to the upper 6 bits of byte 6 of the GIOP header. - // this.flags represents byte 6 here. - public void setThreadPoolToUse(int poolToUse) { - // IMPORTANT: Bitwise operations will promote - // byte types to int before performing - // bitwise operations. And, Java - // types are signed. - int tmpFlags = poolToUse << 2; - tmpFlags &= UPPER_THREE_BYTES_OF_INT_MASK; - tmpFlags |= flags; - flags = (byte)tmpFlags; - } - - public void setSize(ByteBuffer byteBuffer, int size) { - - this.message_size = size; - - // - // Patch the size field in the header. - // - - int patch = size - GIOPMessageHeaderLength; - if (!isLittleEndian()) { - byteBuffer.put(8, (byte)((patch >>> 24) & 0xFF)); - byteBuffer.put(9, (byte)((patch >>> 16) & 0xFF)); - byteBuffer.put(10, (byte)((patch >>> 8) & 0xFF)); - byteBuffer.put(11, (byte)((patch >>> 0) & 0xFF)); - } else { - byteBuffer.put(8, (byte)((patch >>> 0) & 0xFF)); - byteBuffer.put(9, (byte)((patch >>> 8) & 0xFF)); - byteBuffer.put(10, (byte)((patch >>> 16) & 0xFF)); - byteBuffer.put(11, (byte)((patch >>> 24) & 0xFF)); - } - } - - /** - * Allows us to create a fragment message from any message type. - */ - public FragmentMessage createFragmentMessage() { - - // check for message type validity - - switch (this.message_type) { - case GIOPCancelRequest : - case GIOPCloseConnection : - case GIOPMessageError : - throw wrapper.fragmentationDisallowed( - CompletionStatus.COMPLETED_MAYBE); - case GIOPLocateRequest : - case GIOPLocateReply : - if (this.GIOP_version.equals(GIOPVersion.V1_1)) { - throw wrapper.fragmentationDisallowed( - CompletionStatus.COMPLETED_MAYBE); - } - break; - } - - /* - // A fragmented mesg can be created only if the current mesg' fragment - // bit is set. Otherwise, raise error - // too stringent check - if ( (this.flags & MORE_FRAGMENTS_BIT) != MORE_FRAGMENTS_BIT ) { - throw wrapper.fragmentationDisallowed( CompletionStatus.COMPLETED_MAYBE); - } - */ - if (this.GIOP_version.equals(GIOPVersion.V1_1)) { - return new FragmentMessage_1_1(this); - } else if (this.GIOP_version.equals(GIOPVersion.V1_2)) { - return new FragmentMessage_1_2(this); - } - - throw wrapper.giopVersionError( CompletionStatus.COMPLETED_MAYBE); - } - - // IO methods - - // This should do nothing even if it is called. The Message Header is read - // off a java.io.InputStream (not a CDRInputStream) by IIOPConnection - // in order to choose the correct CDR Version , msg_type, and msg_size. - // So, we would never need to read the Message Header off a CDRInputStream. - public void read(org.omg.CORBA.portable.InputStream istream) { - /* - this.magic = istream.read_long(); - this.GIOP_version = (new GIOPVersion()).read(istream); - this.flags = istream.read_octet(); - this.message_type = istream.read_octet(); - this.message_size = istream.read_ulong(); - */ - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - ostream.write_long(this.magic); - nullCheck(this.GIOP_version); - this.GIOP_version.write(ostream); - ostream.write_octet(this.flags); - ostream.write_octet(this.message_type); - ostream.write_ulong(this.message_size); - } -} // class Message_1_1 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_2.java 2018-01-30 20:20:25.000000000 -0500 +++ /dev/null 2018-01-30 20:20:25.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.protocol.giopmsgheaders; - -import java.nio.ByteBuffer; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -public class Message_1_2 extends Message_1_1 -{ - protected int request_id = (int) 0; - - Message_1_2() {} - - Message_1_2(int _magic, GIOPVersion _GIOP_version, byte _flags, - byte _message_type, int _message_size) { - - super(_magic, - _GIOP_version, - _flags, - _message_type, - _message_size); - } - - /** - * The byteBuffer is presumed to have contents of the message already - * read in. It must have 12 bytes of space at the beginning for the GIOP header, - * but the header doesn't have to be copied in. - */ - public void unmarshalRequestID(ByteBuffer byteBuffer) { - int b1, b2, b3, b4; - - if (!isLittleEndian()) { - b1 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 24) & 0xFF000000; - b2 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 16) & 0x00FF0000; - b3 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 8) & 0x0000FF00; - b4 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 0) & 0x000000FF; - } else { - b1 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 24) & 0xFF000000; - b2 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 16) & 0x00FF0000; - b3 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 8) & 0x0000FF00; - b4 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 0) & 0x000000FF; - } - - this.request_id = (b1 | b2 | b3 | b4); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - if (this.encodingVersion == Message.CDR_ENC_VERSION) { - super.write(ostream); - return; - } - GIOPVersion gv = this.GIOP_version; // save - this.GIOP_version = GIOPVersion.getInstance((byte)13, - this.encodingVersion); - super.write(ostream); - this.GIOP_version = gv; // restore - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ProfileAddr.java 2018-01-30 20:20:25.000000000 -0500 +++ /dev/null 2018-01-30 20:20:25.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - - -/** -* com/sun/corba/se/impl/protocol/giopmsgheaders/ProfileAddr.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ - -public interface ProfileAddr -{ - public static final short value = (short)(1); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReferenceAddr.java 2018-01-30 20:20:26.000000000 -0500 +++ /dev/null 2018-01-30 20:20:26.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - - -/** -* com/sun/corba/se/impl/protocol/giopmsgheaders/ReferenceAddr.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ - -public interface ReferenceAddr -{ - public static final short value = (short)(2); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage.java 2018-01-30 20:20:27.000000000 -0500 +++ /dev/null 2018-01-30 20:20:27.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import org.omg.CORBA.SystemException; -import com.sun.corba.se.spi.ior.IOR; - -/** - * This interface captures the ReplyMessage contract. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public interface ReplyMessage extends Message, LocateReplyOrReplyMessage { - - // Note: If the value, order, or number of these constants change, - // please update the REPLY_MESSAGE_TO_PI_REPLY_STATUS table in PIHandlerImpl. - int NO_EXCEPTION = 0; - int USER_EXCEPTION = 1; - int SYSTEM_EXCEPTION = 2; - int LOCATION_FORWARD = 3; - int LOCATION_FORWARD_PERM = 4; // 1.2 - int NEEDS_ADDRESSING_MODE = 5; // 1.2 - - ServiceContexts getServiceContexts(); - void setServiceContexts( ServiceContexts sc ); - void setIOR( IOR newIOR ); -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java 2018-01-30 20:20:27.000000000 -0500 +++ /dev/null 2018-01-30 20:20:27.000000000 -0500 @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.impl.encoding.CDRInputStream; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * This implements the GIOP 1.0 Reply header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class ReplyMessage_1_0 extends Message_1_0 - implements ReplyMessage { - - // Instance variables - - private ORB orb = null; - private ORBUtilSystemException wrapper = null ; - private ServiceContexts service_contexts = null; - private int request_id = (int) 0; - private int reply_status = (int) 0; - private IOR ior = null; - private String exClassName = null; - private int minorCode = (int) 0; - private CompletionStatus completionStatus = null; - - // Constructors - - ReplyMessage_1_0(ORB orb) { - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - ReplyMessage_1_0(ORB orb, ServiceContexts _service_contexts, - int _request_id, int _reply_status, IOR _ior) { - super(Message.GIOPBigMagic, false, Message.GIOPReply, 0); - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - service_contexts = _service_contexts; - request_id = _request_id; - reply_status = _reply_status; - ior = _ior; - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - public int getReplyStatus() { - return this.reply_status; - } - - public short getAddrDisposition() { - return KeyAddr.value; - } - - public ServiceContexts getServiceContexts() { - return this.service_contexts; - } - - public void setServiceContexts( ServiceContexts sc ) { - this.service_contexts = sc; - } - - public SystemException getSystemException(String message) { - return MessageBase.getSystemException( - exClassName, minorCode, completionStatus, message, wrapper); - } - - public IOR getIOR() { - return this.ior; - } - - public void setIOR( IOR ior ) { - this.ior = ior; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.service_contexts - = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); - this.request_id = istream.read_ulong(); - this.reply_status = istream.read_long(); - isValidReplyStatus(this.reply_status); // raises exception on error - - // The code below reads the reply body in some cases - // SYSTEM_EXCEPTION & LOCATION_FORWARD - if (this.reply_status == SYSTEM_EXCEPTION) { - - String reposId = istream.read_string(); - this.exClassName = ORBUtility.classNameOf(reposId); - this.minorCode = istream.read_long(); - int status = istream.read_long(); - - switch (status) { - case CompletionStatus._COMPLETED_YES: - this.completionStatus = CompletionStatus.COMPLETED_YES; - break; - case CompletionStatus._COMPLETED_NO: - this.completionStatus = CompletionStatus.COMPLETED_NO; - break; - case CompletionStatus._COMPLETED_MAYBE: - this.completionStatus = CompletionStatus.COMPLETED_MAYBE; - break; - default: - throw wrapper.badCompletionStatusInReply( - CompletionStatus.COMPLETED_MAYBE, new Integer(status) ); - } - - } else if (this.reply_status == USER_EXCEPTION) { - // do nothing. The client stub will read the exception from body. - } else if (this.reply_status == LOCATION_FORWARD) { - CDRInputStream cdr = (CDRInputStream) istream; - this.ior = IORFactories.makeIOR( cdr ) ; - } - } - - // Note, this writes only the header information. SystemException or - // IOR may be written afterwards into the reply mesg body. - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - if (this.service_contexts != null) { - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_0); - } else { - ServiceContexts.writeNullServiceContext( - (org.omg.CORBA_2_3.portable.OutputStream) ostream); - } - ostream.write_ulong(this.request_id); - ostream.write_long(this.reply_status); - } - - // Static methods - - public static void isValidReplyStatus(int replyStatus) { - switch (replyStatus) { - case NO_EXCEPTION : - case USER_EXCEPTION : - case SYSTEM_EXCEPTION : - case LOCATION_FORWARD : - break; - default : - ORBUtilSystemException localWrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_PROTOCOL ) ; - throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE); - } - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java 2018-01-30 20:20:28.000000000 -0500 +++ /dev/null 2018-01-30 20:20:28.000000000 -0500 @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.impl.encoding.CDRInputStream; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * This implements the GIOP 1.1 Reply header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class ReplyMessage_1_1 extends Message_1_1 - implements ReplyMessage { - - // Instance variables - - private ORB orb = null; - private ORBUtilSystemException wrapper = null ; - private ServiceContexts service_contexts = null; - private int request_id = (int) 0; - private int reply_status = (int) 0; - private IOR ior = null; - private String exClassName = null; - private int minorCode = (int) 0; - private CompletionStatus completionStatus = null; - - // Constructors - - ReplyMessage_1_1(ORB orb) { - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - ReplyMessage_1_1(ORB orb, ServiceContexts _service_contexts, - int _request_id, int _reply_status, IOR _ior) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPReply, 0); - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - service_contexts = _service_contexts; - request_id = _request_id; - reply_status = _reply_status; - ior = _ior; - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - public int getReplyStatus() { - return this.reply_status; - } - - public short getAddrDisposition() { - return KeyAddr.value; - } - - public ServiceContexts getServiceContexts() { - return this.service_contexts; - } - - public void setServiceContexts( ServiceContexts sc ) { - this.service_contexts = sc; - } - - public SystemException getSystemException(String message) { - return MessageBase.getSystemException( - exClassName, minorCode, completionStatus, message, wrapper); - } - - public IOR getIOR() { - return this.ior; - } - - public void setIOR( IOR ior ) { - this.ior = ior; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.service_contexts - = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); - this.request_id = istream.read_ulong(); - this.reply_status = istream.read_long(); - isValidReplyStatus(this.reply_status); // raises exception on error - - // The code below reads the reply body in some cases - // SYSTEM_EXCEPTION & LOCATION_FORWARD - if (this.reply_status == SYSTEM_EXCEPTION) { - - String reposId = istream.read_string(); - this.exClassName = ORBUtility.classNameOf(reposId); - this.minorCode = istream.read_long(); - int status = istream.read_long(); - - switch (status) { - case CompletionStatus._COMPLETED_YES: - this.completionStatus = CompletionStatus.COMPLETED_YES; - break; - case CompletionStatus._COMPLETED_NO: - this.completionStatus = CompletionStatus.COMPLETED_NO; - break; - case CompletionStatus._COMPLETED_MAYBE: - this.completionStatus = CompletionStatus.COMPLETED_MAYBE; - break; - default: - throw wrapper.badCompletionStatusInReply( - CompletionStatus.COMPLETED_MAYBE, new Integer(status) ); - } - } else if (this.reply_status == USER_EXCEPTION) { - // do nothing. The client stub will read the exception from body. - } else if (this.reply_status == LOCATION_FORWARD) { - CDRInputStream cdr = (CDRInputStream) istream; - this.ior = IORFactories.makeIOR(cdr) ; - } - } - - // Note, this writes only the header information. SystemException or - // IOR may be written afterwards into the reply mesg body. - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - if (this.service_contexts != null) { - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_1); - } else { - ServiceContexts.writeNullServiceContext( - (org.omg.CORBA_2_3.portable.OutputStream) ostream); - } - ostream.write_ulong(this.request_id); - ostream.write_long(this.reply_status); - } - - // Static methods - - public static void isValidReplyStatus(int replyStatus) { - switch (replyStatus) { - case NO_EXCEPTION : - case USER_EXCEPTION : - case SYSTEM_EXCEPTION : - case LOCATION_FORWARD : - break; - default : - ORBUtilSystemException localWrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_PROTOCOL ) ; - throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE); - } - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java 2018-01-30 20:20:28.000000000 -0500 +++ /dev/null 2018-01-30 20:20:29.000000000 -0500 @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORFactories ; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream; -import com.sun.corba.se.impl.encoding.CDRInputStream_1_2; -import com.sun.corba.se.impl.encoding.CDROutputStream_1_2; - -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * This implements the GIOP 1.2 Reply header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class ReplyMessage_1_2 extends Message_1_2 - implements ReplyMessage { - - // Instance variables - - private ORB orb = null; - private ORBUtilSystemException wrapper = null ; - private int reply_status = (int) 0; - private ServiceContexts service_contexts = null; - private IOR ior = null; - private String exClassName = null; - private int minorCode = (int) 0; - private CompletionStatus completionStatus = null; - private short addrDisposition = KeyAddr.value; // default; - - // Constructors - - ReplyMessage_1_2(ORB orb) { - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - ReplyMessage_1_2(ORB orb, int _request_id, int _reply_status, - ServiceContexts _service_contexts, IOR _ior) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPReply, 0); - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - request_id = _request_id; - reply_status = _reply_status; - service_contexts = _service_contexts; - ior = _ior; - } - - // Accessor methods - - public int getRequestId() { - return this.request_id; - } - - public int getReplyStatus() { - return this.reply_status; - } - - public short getAddrDisposition() { - return this.addrDisposition; - } - - public ServiceContexts getServiceContexts() { - return this.service_contexts; - } - - public void setServiceContexts( ServiceContexts sc ) { - this.service_contexts = sc; - } - - public SystemException getSystemException(String message) { - return MessageBase.getSystemException( - exClassName, minorCode, completionStatus, message, wrapper); - } - - public IOR getIOR() { - return this.ior; - } - - public void setIOR( IOR ior ) { - this.ior = ior; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - this.reply_status = istream.read_long(); - isValidReplyStatus(this.reply_status); // raises exception on error - this.service_contexts - = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); - - // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be - // aligned on an 8 octet boundary. - // Ensures that the first read operation called from the stub code, - // during body deconstruction, would skip the header padding, that was - // inserted to ensure that the body was aligned on an 8-octet boundary. - ((CDRInputStream)istream).setHeaderPadding(true); - - // The code below reads the reply body in some cases - // SYSTEM_EXCEPTION & LOCATION_FORWARD & LOCATION_FORWARD_PERM & - // NEEDS_ADDRESSING_MODE - if (this.reply_status == SYSTEM_EXCEPTION) { - - String reposId = istream.read_string(); - this.exClassName = ORBUtility.classNameOf(reposId); - this.minorCode = istream.read_long(); - int status = istream.read_long(); - - switch (status) { - case CompletionStatus._COMPLETED_YES: - this.completionStatus = CompletionStatus.COMPLETED_YES; - break; - case CompletionStatus._COMPLETED_NO: - this.completionStatus = CompletionStatus.COMPLETED_NO; - break; - case CompletionStatus._COMPLETED_MAYBE: - this.completionStatus = CompletionStatus.COMPLETED_MAYBE; - break; - default: - throw wrapper.badCompletionStatusInReply( - CompletionStatus.COMPLETED_MAYBE, new Integer(status) ); - } - - } else if (this.reply_status == USER_EXCEPTION) { - // do nothing. The client stub will read the exception from body. - } else if ( (this.reply_status == LOCATION_FORWARD) || - (this.reply_status == LOCATION_FORWARD_PERM) ){ - CDRInputStream cdr = (CDRInputStream) istream; - this.ior = IORFactories.makeIOR( cdr ) ; - } else if (this.reply_status == NEEDS_ADDRESSING_MODE) { - // read GIOP::AddressingDisposition from body and resend the - // original request using the requested addressing mode. The - // resending is transparent to the client program. - this.addrDisposition = AddressingDispositionHelper.read(istream); - } - } - - // Note, this writes only the header information. SystemException or - // IOR or GIOP::AddressingDisposition may be written afterwards into the - // reply mesg body. - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - ostream.write_long(this.reply_status); - if (this.service_contexts != null) { - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_2); - } else { - ServiceContexts.writeNullServiceContext( - (org.omg.CORBA_2_3.portable.OutputStream) ostream); - } - - // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be - // aligned on an 8 octet boundary. - // Ensures that the first write operation called from the stub code, - // during body construction, would insert a header padding, such that - // the body is aligned on an 8-octet boundary. - ((CDROutputStream)ostream).setHeaderPadding(true); - - } - - // Static methods - - public static void isValidReplyStatus(int replyStatus) { - switch (replyStatus) { - case NO_EXCEPTION : - case USER_EXCEPTION : - case SYSTEM_EXCEPTION : - case LOCATION_FORWARD : - case LOCATION_FORWARD_PERM : - case NEEDS_ADDRESSING_MODE : - break; - default : - ORBUtilSystemException localWrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_PROTOCOL ) ; - throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE); - } - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class ReplyMessage_1_2 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage.java 2018-01-30 20:20:29.000000000 -0500 +++ /dev/null 2018-01-30 20:20:29.000000000 -0500 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.Principal; -import com.sun.corba.se.spi.ior.ObjectKey; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; - -/** - * This interface captures the RequestMessage contract. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public interface RequestMessage extends Message { - - byte RESPONSE_EXPECTED_BIT = 0x01; - - ServiceContexts getServiceContexts(); - int getRequestId(); - boolean isResponseExpected(); - byte[] getReserved(); - ObjectKey getObjectKey(); - String getOperation(); - Principal getPrincipal(); - - // NOTE: This is a SUN PROPRIETARY EXTENSION - void setThreadPoolToUse(int poolToUse); - - -} // interface RequestMessage --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_0.java 2018-01-30 20:20:30.000000000 -0500 +++ /dev/null 2018-01-30 20:20:30.000000000 -0500 @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.Principal; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.ObjectKey; - -/** - * This implements the GIOP 1.0 Request header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class RequestMessage_1_0 extends Message_1_0 - implements RequestMessage { - - // Instance variables - - private ORB orb = null; - private ServiceContexts service_contexts = null; - private int request_id = (int) 0; - private boolean response_expected = false; - private byte[] object_key = null; - private String operation = null; - private Principal requesting_principal = null; - private ObjectKey objectKey = null; - - // Constructor - - RequestMessage_1_0(ORB orb) { - this.orb = orb; - } - - RequestMessage_1_0(ORB orb, ServiceContexts _service_contexts, - int _request_id, boolean _response_expected, byte[] _object_key, - String _operation, Principal _requesting_principal) { - super(Message.GIOPBigMagic, false, Message.GIOPRequest, 0); - this.orb = orb; - service_contexts = _service_contexts; - request_id = _request_id; - response_expected = _response_expected; - object_key = _object_key; - operation = _operation; - requesting_principal = _requesting_principal; - } - - // Accessor methods (RequestMessage interface) - - public ServiceContexts getServiceContexts() { - return this.service_contexts; - } - - public int getRequestId() { - return this.request_id; - } - - public boolean isResponseExpected() { - return this.response_expected; - } - - public byte[] getReserved() { - // REVISIT Should we throw an exception or return null ? - return null; - } - - public ObjectKey getObjectKey() { - if (this.objectKey == null) { - // this will raise a MARSHAL exception upon errors. - this.objectKey = MessageBase.extractObjectKey(object_key, orb); - } - - return this.objectKey; - } - - public String getOperation() { - return this.operation; - } - - public Principal getPrincipal() { - return this.requesting_principal; - } - - - // Mutators - - public void setThreadPoolToUse(int poolToUse) { - // No-op, must be GIOP Version 1.1 or greater - // to support this SUN PROPRIETARY EXTENSION. - } - - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.service_contexts - = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); - this.request_id = istream.read_ulong(); - this.response_expected = istream.read_boolean(); - int _len0 = istream.read_long(); - this.object_key = new byte[_len0]; - istream.read_octet_array(this.object_key, 0, _len0); - this.operation = istream.read_string(); - this.requesting_principal = istream.read_Principal(); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - if (this.service_contexts != null) { - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_0); - } else { - ServiceContexts.writeNullServiceContext( - (org.omg.CORBA_2_3.portable.OutputStream) ostream); - } - ostream.write_ulong(this.request_id); - ostream.write_boolean(this.response_expected); - nullCheck(this.object_key); - ostream.write_long(this.object_key.length); - ostream.write_octet_array(this.object_key, 0, this.object_key.length); - ostream.write_string(this.operation); - if (this.requesting_principal != null) { - ostream.write_Principal(this.requesting_principal); - } else { - ostream.write_long(0); - } - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class RequestMessage_1_0 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_1.java 2018-01-30 20:20:30.000000000 -0500 +++ /dev/null 2018-01-30 20:20:30.000000000 -0500 @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.Principal; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.ObjectKey; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * This implements the GIOP 1.1 Request header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class RequestMessage_1_1 extends Message_1_1 - implements RequestMessage { - - // Instance variables - - private ORB orb = null; - private ORBUtilSystemException wrapper = null ; - private ServiceContexts service_contexts = null; - private int request_id = (int) 0; - private boolean response_expected = false; - private byte[] reserved = null; // Added in GIOP 1.1 - private byte[] object_key = null; - private String operation = null; - private Principal requesting_principal = null; - private ObjectKey objectKey = null; - - // Constructors - - RequestMessage_1_1(ORB orb) { - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - RequestMessage_1_1(ORB orb, ServiceContexts _service_contexts, - int _request_id, boolean _response_expected, byte[] _reserved, - byte[] _object_key, String _operation, - Principal _requesting_principal) { - super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPRequest, 0); - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - service_contexts = _service_contexts; - request_id = _request_id; - response_expected = _response_expected; - reserved = _reserved; - object_key = _object_key; - operation = _operation; - requesting_principal = _requesting_principal; - } - - // Accessor methods (RequestMessage interface) - - public ServiceContexts getServiceContexts() { - return this.service_contexts; - } - - public int getRequestId() { - return this.request_id; - } - - public boolean isResponseExpected() { - return this.response_expected; - } - - public byte[] getReserved() { - return this.reserved; - } - - public ObjectKey getObjectKey() { - if (this.objectKey == null) { - // this will raise a MARSHAL exception upon errors. - this.objectKey = MessageBase.extractObjectKey(object_key, orb); - } - - return this.objectKey; - } - - public String getOperation() { - return this.operation; - } - - public Principal getPrincipal() { - return this.requesting_principal; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.service_contexts - = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); - this.request_id = istream.read_ulong(); - this.response_expected = istream.read_boolean(); - this.reserved = new byte[3]; - for (int _o0 = 0;_o0 < (3); ++_o0) { - this.reserved[_o0] = istream.read_octet(); - } - int _len1 = istream.read_long(); - this.object_key = new byte[_len1]; - istream.read_octet_array(this.object_key, 0, _len1); - this.operation = istream.read_string(); - this.requesting_principal = istream.read_Principal(); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - if (this.service_contexts != null) { - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_1); - } else { - ServiceContexts.writeNullServiceContext( - (org.omg.CORBA_2_3.portable.OutputStream) ostream); - } - ostream.write_ulong(this.request_id); - ostream.write_boolean(this.response_expected); - nullCheck(this.reserved); - if (this.reserved.length != (3)) { - throw wrapper.badReservedLength( - org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - } - for (int _i0 = 0;_i0 < (3); ++_i0) { - ostream.write_octet(this.reserved[_i0]); - } - nullCheck(this.object_key); - ostream.write_long(this.object_key.length); - ostream.write_octet_array(this.object_key, 0, this.object_key.length); - ostream.write_string(this.operation); - if (this.requesting_principal != null) { - ostream.write_Principal(this.requesting_principal); - } else { - ostream.write_long(0); - } - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class RequestMessage_1_1 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_2.java 2018-01-30 20:20:31.000000000 -0500 +++ /dev/null 2018-01-30 20:20:31.000000000 -0500 @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.impl.protocol.giopmsgheaders; - -import org.omg.CORBA.Principal; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.ObjectKey; -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.CDROutputStream; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.encoding.CDRInputStream_1_2; -import com.sun.corba.se.impl.encoding.CDROutputStream_1_2; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -/** - * This implements the GIOP 1.2 Request header. - * - * @author Ram Jeyaraman 05/14/2000 - */ - -public final class RequestMessage_1_2 extends Message_1_2 - implements RequestMessage { - - // Instance variables - - private ORB orb = null; - private ORBUtilSystemException wrapper = null ; - private byte response_flags = (byte) 0; - private byte reserved[] = null; - private TargetAddress target = null; - private String operation = null; - private ServiceContexts service_contexts = null; - private ObjectKey objectKey = null; - - // Constructors - - RequestMessage_1_2(ORB orb) { - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - } - - RequestMessage_1_2(ORB orb, int _request_id, byte _response_flags, - byte[] _reserved, TargetAddress _target, - String _operation, ServiceContexts _service_contexts) { - super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN, - Message.GIOPRequest, 0); - this.orb = orb; - this.wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - request_id = _request_id; - response_flags = _response_flags; - reserved = _reserved; - target = _target; - operation = _operation; - service_contexts = _service_contexts; - } - - // Accessor methods (RequestMessage interface) - - public int getRequestId() { - return this.request_id; - } - - public boolean isResponseExpected() { - /* - case 1: LSBit[1] == 1 - not a oneway call (DII flag INV_NO_RESPONSE is false) // Ox03 - LSBit[0] must be 1. - case 2: LSBit[1] == 0 - if (LSB[0] == 0) // Ox00 - oneway call - else if (LSB[0] == 1) // 0x01 - oneway call; but server may provide - a location forward response or system exception response. - */ - - if ( (this.response_flags & RESPONSE_EXPECTED_BIT) == RESPONSE_EXPECTED_BIT ) { - return true; - } - - return false; - } - - public byte[] getReserved() { - return this.reserved; - } - - public ObjectKey getObjectKey() { - if (this.objectKey == null) { - // this will raise a MARSHAL exception upon errors. - this.objectKey = MessageBase.extractObjectKey(target, orb); - } - - return this.objectKey; - } - - public String getOperation() { - return this.operation; - } - - public Principal getPrincipal() { - // REVISIT Should we throw an exception or return null ? - return null; - } - - public ServiceContexts getServiceContexts() { - return this.service_contexts; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - super.read(istream); - this.request_id = istream.read_ulong(); - this.response_flags = istream.read_octet(); - this.reserved = new byte[3]; - for (int _o0 = 0;_o0 < (3); ++_o0) { - this.reserved[_o0] = istream.read_octet(); - } - this.target = TargetAddressHelper.read(istream); - getObjectKey(); // this does AddressingDisposition check - this.operation = istream.read_string(); - this.service_contexts - = new ServiceContexts((org.omg.CORBA_2_3.portable.InputStream) istream); - - // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be - // aligned on an 8 octet boundary. - // Ensures that the first read operation called from the stub code, - // during body deconstruction, would skip the header padding, that was - // inserted to ensure that the body was aligned on an 8-octet boundary. - ((CDRInputStream)istream).setHeaderPadding(true); - - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - super.write(ostream); - ostream.write_ulong(this.request_id); - ostream.write_octet(this.response_flags); - nullCheck(this.reserved); - if (this.reserved.length != (3)) { - throw wrapper.badReservedLength( - org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - } - for (int _i0 = 0;_i0 < (3); ++_i0) { - ostream.write_octet(this.reserved[_i0]); - } - nullCheck(this.target); - TargetAddressHelper.write(ostream, this.target); - ostream.write_string(this.operation); - if (this.service_contexts != null) { - service_contexts.write( - (org.omg.CORBA_2_3.portable.OutputStream) ostream, - GIOPVersion.V1_2); - } else { - ServiceContexts.writeNullServiceContext( - (org.omg.CORBA_2_3.portable.OutputStream) ostream); - } - - // CORBA formal 00-11-0 15.4.2.2 GIOP 1.2 body must be - // aligned on an 8 octet boundary. - // Ensures that the first write operation called from the stub code, - // during body construction, would insert a header padding, such that - // the body is aligned on an 8-octet boundary. - ((CDROutputStream)ostream).setHeaderPadding(true); - } - - public void callback(MessageHandler handler) - throws java.io.IOException - { - handler.handleInput(this); - } -} // class RequestMessage_1_2 --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddress.java 2018-01-30 20:20:32.000000000 -0500 +++ /dev/null 2018-01-30 20:20:32.000000000 -0500 @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - - -/** -* com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddress.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ - -public final class TargetAddress implements org.omg.CORBA.portable.IDLEntity -{ - private byte[] ___object_key; - private org.omg.IOP.TaggedProfile ___profile; - private com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo ___ior; - private short __discriminator; - private boolean __uninitialized = true; - - public TargetAddress () - { - } - - public short discriminator () - { - if (__uninitialized) - throw new org.omg.CORBA.BAD_OPERATION (); - return __discriminator; - } - - public byte[] object_key () - { - if (__uninitialized) - throw new org.omg.CORBA.BAD_OPERATION (); - verifyobject_key (__discriminator); - return ___object_key; - } - - public void object_key (byte[] value) - { - __discriminator = com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr.value; - ___object_key = value; - __uninitialized = false; - } - - private void verifyobject_key (short discriminator) - { - if (discriminator != com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr.value) - throw new org.omg.CORBA.BAD_OPERATION (); - } - - public org.omg.IOP.TaggedProfile profile () - { - if (__uninitialized) - throw new org.omg.CORBA.BAD_OPERATION (); - verifyprofile (__discriminator); - return ___profile; - } - - public void profile (org.omg.IOP.TaggedProfile value) - { - __discriminator = com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr.value; - ___profile = value; - __uninitialized = false; - } - - private void verifyprofile (short discriminator) - { - if (discriminator != com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr.value) - throw new org.omg.CORBA.BAD_OPERATION (); - } - - public com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo ior () - { - if (__uninitialized) - throw new org.omg.CORBA.BAD_OPERATION (); - verifyior (__discriminator); - return ___ior; - } - - public void ior (com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo value) - { - __discriminator = com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value; - ___ior = value; - __uninitialized = false; - } - - private void verifyior (short discriminator) - { - if (discriminator != com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value) - throw new org.omg.CORBA.BAD_OPERATION (); - } - - public void _default () - { - __discriminator = -32768; - __uninitialized = false; - } - -} // class TargetAddress --- old/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddressHelper.java 2018-01-30 20:20:32.000000000 -0500 +++ /dev/null 2018-01-30 20:20:32.000000000 -0500 @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.impl.protocol.giopmsgheaders; - - -/** -* com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddressHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl -* Sunday, June 4, 2000 5:18:54 PM PDT -*/ - -abstract public class TargetAddressHelper -{ - private static String _id = "IDL:messages/TargetAddress:1.0"; - - public static void insert (org.omg.CORBA.Any a, com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - org.omg.CORBA.TypeCode _disTypeCode0; - _disTypeCode0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - _disTypeCode0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.corba.se.impl.protocol.giopmsgheaders.AddressingDispositionHelper.id (), "AddressingDisposition", _disTypeCode0); - org.omg.CORBA.UnionMember[] _members0 = new org.omg.CORBA.UnionMember [3]; - org.omg.CORBA.TypeCode _tcOf_members0; - org.omg.CORBA.Any _anyOf_members0; - - // Branch for object_key - _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any (); - _anyOf_members0.insert_short ((short)com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr.value); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_octet); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _members0[0] = new org.omg.CORBA.UnionMember ( - "object_key", - _anyOf_members0, - _tcOf_members0, - null); - - // Branch for profile - _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any (); - _anyOf_members0.insert_short ((short)com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr.value); - _tcOf_members0 = org.omg.IOP.TaggedProfileHelper.type (); - _members0[1] = new org.omg.CORBA.UnionMember ( - "profile", - _anyOf_members0, - _tcOf_members0, - null); - - // Branch for ior - _anyOf_members0 = org.omg.CORBA.ORB.init ().create_any (); - _anyOf_members0.insert_short ((short)com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value); - _tcOf_members0 = com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.type (); - _members0[2] = new org.omg.CORBA.UnionMember ( - "ior", - _anyOf_members0, - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_union_tc (com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddressHelper.id (), "TargetAddress", _disTypeCode0, _members0); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress value = new com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress (); - short _dis0 = (short)0; - _dis0 = istream.read_short (); - switch (_dis0) - { - case com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr.value: - byte _object_key[] = null; - int _len1 = istream.read_long (); - _object_key = new byte[_len1]; - istream.read_octet_array (_object_key, 0, _len1); - value.object_key (_object_key); - break; - case com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr.value: - org.omg.IOP.TaggedProfile _profile = null; - _profile = org.omg.IOP.TaggedProfileHelper.read (istream); - value.profile (_profile); - break; - case com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value: - com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo _ior = null; - _ior = com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.read (istream); - value.ior (_ior); - break; - default: - throw new org.omg.CORBA.BAD_OPERATION (); - } - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress value) - { - ostream.write_short (value.discriminator ()); - switch (value.discriminator ()) - { - case com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr.value: - ostream.write_long (value.object_key ().length); - ostream.write_octet_array (value.object_key (), 0, value.object_key ().length); - break; - case com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr.value: - org.omg.IOP.TaggedProfileHelper.write (ostream, value.profile ()); - break; - case com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value: - com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.write (ostream, value.ior ()); - break; - default: - throw new org.omg.CORBA.BAD_OPERATION (); - } - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/BootstrapResolverImpl.java 2018-01-30 20:20:33.000000000 -0500 +++ /dev/null 2018-01-30 20:20:33.000000000 -0500 @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.impl.resolver ; - -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.portable.OutputStream ; -import org.omg.CORBA.portable.ApplicationException ; -import org.omg.CORBA.portable.RemarshalException ; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.IORFactories ; -import com.sun.corba.se.spi.ior.IORTemplate ; -import com.sun.corba.se.spi.ior.ObjectKey ; -import com.sun.corba.se.spi.ior.ObjectKeyFactory ; -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.ior.iiop.IIOPFactories ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.resolver.Resolver ; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -public class BootstrapResolverImpl implements Resolver { - private org.omg.CORBA.portable.Delegate bootstrapDelegate ; - private ORBUtilSystemException wrapper ; - - public BootstrapResolverImpl(ORB orb, String host, int port) { - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.ORB_RESOLVER ) ; - - // Create a new IOR with the magic of INIT - byte[] initialKey = "INIT".getBytes() ; - ObjectKey okey = orb.getObjectKeyFactory().create(initialKey) ; - - IIOPAddress addr = IIOPFactories.makeIIOPAddress( orb, host, port ) ; - IIOPProfileTemplate ptemp = IIOPFactories.makeIIOPProfileTemplate( - orb, GIOPVersion.V1_0, addr); - - IORTemplate iortemp = IORFactories.makeIORTemplate( okey.getTemplate() ) ; - iortemp.add( ptemp ) ; - - IOR initialIOR = iortemp.makeIOR( (com.sun.corba.se.spi.orb.ORB)orb, - "", okey.getId() ) ; - - bootstrapDelegate = ORBUtility.makeClientDelegate( initialIOR ) ; - } - - /** - * For the BootStrap operation we do not expect to have more than one - * parameter. We do not want to extend BootStrap protocol any further, - * as INS handles most of what BootStrap can handle in a portable way. - * - * @return InputStream which contains the response from the - * BootStrapOperation. - */ - private InputStream invoke( String operationName, String parameter ) - { - boolean remarshal = true; - - // Invoke. - - InputStream inStream = null; - - // If there is a location forward then you will need - // to invoke again on the updated information. - // Just calling this same routine with the same host/port - // does not take the location forward info into account. - - while (remarshal) { - org.omg.CORBA.Object objref = null ; - remarshal = false; - - OutputStream os = (OutputStream) bootstrapDelegate.request( objref, - operationName, true); - - if ( parameter != null ) { - os.write_string( parameter ); - } - - try { - // The only reason a null objref is passed is to get the version of - // invoke used by streams. Otherwise the PortableInterceptor - // call stack will become unbalanced since the version of - // invoke which only takes the stream does not call - // PortableInterceptor ending points. - // Note that the first parameter is ignored inside invoke. - - inStream = bootstrapDelegate.invoke( objref, os); - } catch (ApplicationException e) { - throw wrapper.bootstrapApplicationException( e ) ; - } catch (RemarshalException e) { - // XXX log this - remarshal = true; - } - } - - return inStream; - } - - public org.omg.CORBA.Object resolve( String identifier ) - { - InputStream inStream = null ; - org.omg.CORBA.Object result = null ; - - try { - inStream = invoke( "get", identifier ) ; - - result = inStream.read_Object(); - - // NOTE: do note trap and ignore errors. - // Let them flow out. - } finally { - bootstrapDelegate.releaseReply( null, inStream ) ; - } - - return result ; - } - - public java.util.Set list() - { - InputStream inStream = null ; - java.util.Set result = new java.util.HashSet() ; - - try { - inStream = invoke( "list", null ) ; - - int count = inStream.read_long(); - for (int i=0; i < count; i++) - result.add( inStream.read_string() ) ; - - // NOTE: do note trap and ignore errors. - // Let them flow out. - } finally { - bootstrapDelegate.releaseReply( null, inStream ) ; - } - - return result ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/CompositeResolverImpl.java 2018-01-30 20:20:34.000000000 -0500 +++ /dev/null 2018-01-30 20:20:34.000000000 -0500 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.resolver ; - -import java.util.Set ; -import java.util.HashSet ; - -import com.sun.corba.se.spi.resolver.Resolver ; - -public class CompositeResolverImpl implements Resolver { - private Resolver first ; - private Resolver second ; - - public CompositeResolverImpl( Resolver first, Resolver second ) - { - this.first = first ; - this.second = second ; - } - - public org.omg.CORBA.Object resolve( String name ) - { - org.omg.CORBA.Object result = first.resolve( name ) ; - if (result == null) - result = second.resolve( name ) ; - return result ; - } - - public java.util.Set list() - { - Set result = new HashSet() ; - result.addAll( first.list() ) ; - result.addAll( second.list() ) ; - return result ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/FileResolverImpl.java 2018-01-30 20:20:34.000000000 -0500 +++ /dev/null 2018-01-30 20:20:34.000000000 -0500 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.resolver ; - -import org.omg.CORBA.ORBPackage.InvalidName; - -import com.sun.corba.se.spi.resolver.Resolver ; - -import java.util.Enumeration; -import java.util.Properties; -import java.util.Set; -import java.util.HashSet; - -import java.io.File; -import java.io.FileInputStream; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.impl.orbutil.CorbaResourceUtil ; - -public class FileResolverImpl implements Resolver -{ - private ORB orb ; - private File file ; - private Properties savedProps ; - private long fileModified = 0 ; - - public FileResolverImpl( ORB orb, File file ) - { - this.orb = orb ; - this.file = file ; - savedProps = new Properties() ; - } - - public org.omg.CORBA.Object resolve( String name ) - { - check() ; - String stringifiedObject = savedProps.getProperty( name ) ; - if (stringifiedObject == null) { - return null; - } - return orb.string_to_object( stringifiedObject ) ; - } - - public java.util.Set list() - { - check() ; - - Set result = new HashSet() ; - - // Obtain all the keys from the property object - Enumeration theKeys = savedProps.propertyNames(); - while (theKeys.hasMoreElements()) { - result.add( theKeys.nextElement() ) ; - } - - return result ; - } - - /** - * Checks the lastModified() timestamp of the file and optionally - * re-reads the Properties object from the file if newer. - */ - private void check() - { - if (file == null) - return; - - long lastMod = file.lastModified(); - if (lastMod > fileModified) { - try { - FileInputStream fileIS = new FileInputStream(file); - savedProps.clear(); - savedProps.load(fileIS); - fileIS.close(); - fileModified = lastMod; - } catch (java.io.FileNotFoundException e) { - System.err.println( CorbaResourceUtil.getText( - "bootstrap.filenotfound", file.getAbsolutePath())); - } catch (java.io.IOException e) { - System.err.println( CorbaResourceUtil.getText( - "bootstrap.exception", - file.getAbsolutePath(), e.toString())); - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java 2018-01-30 20:20:35.000000000 -0500 +++ /dev/null 2018-01-30 20:20:35.000000000 -0500 @@ -1,329 +0,0 @@ -/* - * Copyright (c) 1998, 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.corba.se.impl.resolver; - -import java.util.List ; -import java.util.Map ; -import java.util.Comparator ; -import java.util.Iterator ; -import java.util.HashMap ; -import java.util.ArrayList ; -import java.util.Collections ; - -import org.omg.CosNaming.NamingContextExt ; -import org.omg.CosNaming.NamingContextExtHelper ; - -import sun.corba.EncapsInputStreamFactory; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.IORTemplate; -import com.sun.corba.se.spi.ior.ObjectKey; -import com.sun.corba.se.spi.ior.IORFactories; -import com.sun.corba.se.spi.ior.ObjectKeyFactory ; -import com.sun.corba.se.spi.ior.iiop.IIOPAddress; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.ior.iiop.IIOPFactories ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.spi.orb.Operation; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.resolver.Resolver; - -import com.sun.corba.se.impl.encoding.EncapsInputStream; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.logging.OMGSystemException; -import com.sun.corba.se.impl.naming.namingutil.INSURLHandler; -import com.sun.corba.se.impl.naming.namingutil.IIOPEndpointInfo; -import com.sun.corba.se.impl.naming.namingutil.INSURL; -import com.sun.corba.se.impl.naming.namingutil.CorbalocURL; -import com.sun.corba.se.impl.naming.namingutil.CorbanameURL; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; - -/** - * This class provides an Operation that converts from CORBA INS URL strings into - * CORBA object references. It will eventually become extensible, but for now it - * simply encapsulates the existing implementation. Once the full extensibility - * is in place, we want this operation to convert string to INSURL, which has mainly - * a public resolver method that returns an object reference. - * - * @author Hemanth - * @author Ken - */ -public class INSURLOperationImpl implements Operation -{ - ORB orb; - ORBUtilSystemException wrapper ; - OMGSystemException omgWrapper ; - Resolver bootstrapResolver ; - - // Root Naming Context for default resolution of names. - private NamingContextExt rootNamingContextExt; - private Object rootContextCacheLock = new Object() ; - - // The URLHandler to parse INS URL's - private INSURLHandler insURLHandler = INSURLHandler.getINSURLHandler() ; - - public INSURLOperationImpl( ORB orb, Resolver bootstrapResolver ) - { - this.orb = orb ; - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.ORB_RESOLVER ) ; - omgWrapper = OMGSystemException.get( orb, - CORBALogDomains.ORB_RESOLVER ) ; - this.bootstrapResolver = bootstrapResolver ; - } - - private static final int NIBBLES_PER_BYTE = 2 ; - private static final int UN_SHIFT = 4 ; // "UPPER NIBBLE" shift factor for << - - /** This static method takes a Stringified IOR and converts it into IOR object. - * It is the caller's responsibility to only pass strings that start with "IOR:". - */ - private org.omg.CORBA.Object getIORFromString( String str ) - { - // Length must be even for str to be valid - if ( (str.length() & 1) == 1 ) - throw wrapper.badStringifiedIorLen() ; - - byte[] buf = new byte[(str.length() - ORBConstants.STRINGIFY_PREFIX.length()) / NIBBLES_PER_BYTE]; - for (int i=ORBConstants.STRINGIFY_PREFIX.length(), j=0; i < str.length(); i +=NIBBLES_PER_BYTE, j++) { - buf[j] = (byte)((ORBUtility.hexOf(str.charAt(i)) << UN_SHIFT) & 0xF0); - buf[j] |= (byte)(ORBUtility.hexOf(str.charAt(i+1)) & 0x0F); - } - EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length, - orb.getORBData().getGIOPVersion()); - s.consumeEndian(); - return s.read_Object() ; - } - - public Object operate( Object arg ) - { - if (arg instanceof String) { - String str = (String)arg ; - - if (str.startsWith( ORBConstants.STRINGIFY_PREFIX )) - // XXX handle this as just another URL scheme - return getIORFromString( str ) ; - else { - INSURL insURL = insURLHandler.parseURL( str ) ; - if (insURL == null) - throw omgWrapper.soBadSchemeName() ; - return resolveINSURL( insURL ) ; - } - } - - throw wrapper.stringExpected() ; - } - - private org.omg.CORBA.Object resolveINSURL( INSURL theURLObject ) { - // XXX resolve should be a method on INSURL - if( theURLObject.isCorbanameURL() ) { - return resolveCorbaname( (CorbanameURL)theURLObject ); - } else { - return resolveCorbaloc( (CorbalocURL)theURLObject ); - } - } - - /** - * resolves a corbaloc: url that is encapsulated in a CorbalocURL object. - * - * @return the CORBA.Object if resolution is successful - */ - private org.omg.CORBA.Object resolveCorbaloc( - CorbalocURL theCorbaLocObject ) - { - org.omg.CORBA.Object result = null; - // If RIR flag is true use the Bootstrap protocol - if( theCorbaLocObject.getRIRFlag( ) ) { - result = bootstrapResolver.resolve(theCorbaLocObject.getKeyString()); - } else { - result = getIORUsingCorbaloc( theCorbaLocObject ); - } - - return result; - } - - /** - * resolves a corbaname: url that is encapsulated in a CorbanameURL object. - * - * @return the CORBA.Object if resolution is successful - */ - private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) { - org.omg.CORBA.Object result = null; - - try { - NamingContextExt theNamingContext = null; - - if( theCorbaName.getRIRFlag( ) ) { - // Case 1 of corbaname: rir# - theNamingContext = getDefaultRootNamingContext( ); - } else { - // Case 2 of corbaname: ::hostname# - org.omg.CORBA.Object corbalocResult = - getIORUsingCorbaloc( theCorbaName ); - if( corbalocResult == null ) { - return null; - } - - theNamingContext = - NamingContextExtHelper.narrow( corbalocResult ); - } - - String StringifiedName = theCorbaName.getStringifiedName( ); - - if( StringifiedName == null ) { - // This means return the Root Naming context - return theNamingContext; - } else { - return theNamingContext.resolve_str( StringifiedName ); - } - } catch( Exception e ) { - clearRootNamingContextCache( ); - return null; - } - } - - /** - * This is an internal method to get the IOR from the CorbalocURL object. - * - * @return the CORBA.Object if resolution is successful - */ - private org.omg.CORBA.Object getIORUsingCorbaloc( INSURL corbalocObject ) - { - Map profileMap = new HashMap(); - List profileList1_0 = new ArrayList(); - - // corbalocObject cannot be null, because it's validated during - // parsing. So no null check is required. - java.util.List theEndpointInfo = corbalocObject.getEndpointInfo(); - String theKeyString = corbalocObject.getKeyString(); - // If there is no KeyString then it's invalid - if( theKeyString == null ) { - return null; - } - - ObjectKey key = orb.getObjectKeyFactory().create( - theKeyString.getBytes() ); - IORTemplate iortemp = IORFactories.makeIORTemplate( key.getTemplate() ); - java.util.Iterator iterator = theEndpointInfo.iterator( ); - while( iterator.hasNext( ) ) { - IIOPEndpointInfo element = - (IIOPEndpointInfo) iterator.next( ); - IIOPAddress addr = IIOPFactories.makeIIOPAddress( orb, element.getHost(), - element.getPort() ); - GIOPVersion giopVersion = GIOPVersion.getInstance( (byte)element.getMajor(), - (byte)element.getMinor()); - IIOPProfileTemplate profileTemplate = null; - if (giopVersion.equals(GIOPVersion.V1_0)) { - profileTemplate = IIOPFactories.makeIIOPProfileTemplate( - orb, giopVersion, addr); - profileList1_0.add(profileTemplate); - } else { - if (profileMap.get(giopVersion) == null) { - profileTemplate = IIOPFactories.makeIIOPProfileTemplate( - orb, giopVersion, addr); - profileMap.put(giopVersion, profileTemplate); - } else { - profileTemplate = (IIOPProfileTemplate)profileMap.get(giopVersion); - AlternateIIOPAddressComponent iiopAddressComponent = - IIOPFactories.makeAlternateIIOPAddressComponent(addr); - profileTemplate.add(iiopAddressComponent); - } - } - } - - GIOPVersion giopVersion = orb.getORBData().getGIOPVersion(); - IIOPProfileTemplate pTemplate = (IIOPProfileTemplate)profileMap.get(giopVersion); - if (pTemplate != null) { - iortemp.add(pTemplate); // Add profile for GIOP version used by this ORB - profileMap.remove(giopVersion); // Now remove this value from the map - } - - // Create a comparator that can sort in decending order (1.2, 1.1, ...) - Comparator comp = new Comparator() { - public int compare(Object o1, Object o2) { - GIOPVersion gv1 = (GIOPVersion)o1; - GIOPVersion gv2 = (GIOPVersion)o2; - return (gv1.lessThan(gv2) ? 1 : (gv1.equals(gv2) ? 0 : -1)); - }; - }; - - // Now sort using the above comparator - List list = new ArrayList(profileMap.keySet()); - Collections.sort(list, comp); - - // Add the profiles in the sorted order - Iterator iter = list.iterator(); - while (iter.hasNext()) { - IIOPProfileTemplate pt = (IIOPProfileTemplate)profileMap.get(iter.next()); - iortemp.add(pt); - } - - // Finally add the 1.0 profiles - iortemp.addAll(profileList1_0); - - IOR ior = iortemp.makeIOR( orb, "", key.getId() ) ; - return ORBUtility.makeObjectReference( ior ) ; - } - - /** - * This is required for corbaname: resolution. Currently we - * are not caching RootNamingContext as the reference to rootNamingContext - * may not be Persistent in all the implementations. - * _REVISIT_ to clear the rootNamingContext in case of COMM_FAILURE. - * - * @return the org.omg.COSNaming.NamingContextExt if resolution is - * successful - * - */ - private NamingContextExt getDefaultRootNamingContext( ) { - synchronized( rootContextCacheLock ) { - if( rootNamingContextExt == null ) { - try { - rootNamingContextExt = - NamingContextExtHelper.narrow( - orb.getLocalResolver().resolve( "NameService" ) ); - } catch( Exception e ) { - rootNamingContextExt = null; - } - } - } - return rootNamingContextExt; - } - - /** - * A utility method to clear the RootNamingContext, if there is an - * exception in resolving CosNaming:Name from the RootNamingContext, - */ - private void clearRootNamingContextCache( ) { - synchronized( rootContextCacheLock ) { - rootNamingContextExt = null; - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/LocalResolverImpl.java 2018-01-30 20:20:36.000000000 -0500 +++ /dev/null 2018-01-30 20:20:36.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.resolver ; - -import com.sun.corba.se.spi.resolver.LocalResolver ; -import com.sun.corba.se.spi.orbutil.closure.Closure ; - -public class LocalResolverImpl implements LocalResolver { - java.util.Map nameToClosure = new java.util.HashMap() ; - - public synchronized org.omg.CORBA.Object resolve( String name ) - { - Closure cl = (Closure)nameToClosure.get( name ) ; - if (cl == null) - return null ; - - return (org.omg.CORBA.Object)(cl.evaluate()) ; - } - - public synchronized java.util.Set list() - { - return nameToClosure.keySet() ; - } - - public synchronized void register( String name, Closure closure ) - { - nameToClosure.put( name, closure ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBDefaultInitRefResolverImpl.java 2018-01-30 20:20:37.000000000 -0500 +++ /dev/null 2018-01-30 20:20:37.000000000 -0500 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.impl.resolver ; - -import com.sun.corba.se.spi.resolver.Resolver ; - -import com.sun.corba.se.spi.orb.Operation ; - -public class ORBDefaultInitRefResolverImpl implements Resolver { - Operation urlHandler ; - String orbDefaultInitRef ; - - public ORBDefaultInitRefResolverImpl( Operation urlHandler, String orbDefaultInitRef ) - { - this.urlHandler = urlHandler ; - - // XXX Validate the URL? - this.orbDefaultInitRef = orbDefaultInitRef ; - } - - public org.omg.CORBA.Object resolve( String ident ) - { - // If the ORBDefaultInitRef is not defined simply return null - if( orbDefaultInitRef == null ) { - return null; - } - - String urlString; - // If the ORBDefaultInitDef is defined as corbaloc: then create the - // corbaloc String in the format - // / - // and resolve it using resolveCorbaloc method - if( orbDefaultInitRef.startsWith( "corbaloc:" ) ) { - urlString = orbDefaultInitRef + "/" + ident; - } else { - urlString = orbDefaultInitRef + "#" + ident; - } - - return (org.omg.CORBA.Object)urlHandler.operate( urlString ) ; - } - - public java.util.Set list() - { - return new java.util.HashSet() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBInitRefResolverImpl.java 2018-01-30 20:20:37.000000000 -0500 +++ /dev/null 2018-01-30 20:20:37.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.impl.resolver ; - -import com.sun.corba.se.spi.resolver.Resolver ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.orb.Operation ; -import com.sun.corba.se.spi.orb.StringPair ; - -public class ORBInitRefResolverImpl implements Resolver { - Operation urlHandler ; - java.util.Map orbInitRefTable ; - - public ORBInitRefResolverImpl( Operation urlHandler, StringPair[] initRefs ) - { - this.urlHandler = urlHandler ; - orbInitRefTable = new java.util.HashMap() ; - - for( int i = 0; i < initRefs.length ; i++ ) { - StringPair sp = initRefs[i] ; - orbInitRefTable.put( sp.getFirst(), sp.getSecond() ) ; - } - } - - public org.omg.CORBA.Object resolve( String ident ) - { - String url = (String)orbInitRefTable.get( ident ) ; - if (url == null) - return null ; - - org.omg.CORBA.Object result = - (org.omg.CORBA.Object)urlHandler.operate( url ) ; - return result ; - } - - public java.util.Set list() - { - return orbInitRefTable.keySet() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/SplitLocalResolverImpl.java 2018-01-30 20:20:38.000000000 -0500 +++ /dev/null 2018-01-30 20:20:38.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.resolver ; - -import com.sun.corba.se.spi.orbutil.closure.Closure ; - -import com.sun.corba.se.spi.resolver.Resolver ; -import com.sun.corba.se.spi.resolver.LocalResolver ; - -public class SplitLocalResolverImpl implements LocalResolver -{ - private Resolver resolver ; - private LocalResolver localResolver ; - - public SplitLocalResolverImpl( Resolver resolver, - LocalResolver localResolver ) - { - this.resolver = resolver ; - this.localResolver = localResolver ; - } - - public void register( String name, Closure closure ) - { - localResolver.register( name, closure ) ; - } - - public org.omg.CORBA.Object resolve( String name ) - { - return resolver.resolve( name ) ; - } - - public java.util.Set list() - { - return resolver.list() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ByteBufferPoolImpl.java 2018-01-30 20:20:39.000000000 -0500 +++ /dev/null 2018-01-30 20:20:39.000000000 -0500 @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.transport; - -import java.nio.ByteBuffer; -import java.util.ArrayList; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.pept.transport.ByteBufferPool; - -/** - * @author Charlie Hunt - */ - -public class ByteBufferPoolImpl implements ByteBufferPool -{ - private ORB itsOrb; - private int itsByteBufferSize; - private ArrayList itsPool; - private int itsObjectCounter = 0; - private boolean debug; - - // Construct a ByteBufferPool for a pool of NIO ByteBuffers - // of ORB fragment size. - public ByteBufferPoolImpl(ORB theORB) - { - itsByteBufferSize = theORB.getORBData().getGIOPFragmentSize(); - itsPool = new ArrayList(); - itsOrb = theORB; - debug = theORB.transportDebugFlag; - } - - /* - * Locations where ByteBuffers are gotten from the pool: - * 1. ContactInfoBase.createMessageMediator() - * 2. ByteBufferWithInfo.growBuffer() - * 3. ByteBufferWithInfo(ORB, BufferManagerWrite) - constructor - */ - - // If the requested ByteBuffer size is less than or equal to - // the ORB fragment size, and we have not disabled use of - // direct byte buffers (normally for debugging purposes) - // then get a DirectByteBuffer from the - // pool if there is one, if there is not one in the pool, - // then allocate a a DirectByteBuffer of ORB fragment size. - // - // If the request ByteBuffer size is greater than the ORB fragment - // size, allocate a new non-direct ByteBuffer. - public ByteBuffer getByteBuffer(int theAskSize) - { - ByteBuffer abb = null; - - if ((theAskSize <= itsByteBufferSize) && - !itsOrb.getORBData().disableDirectByteBufferUse()) - { - // check if there's one in the pool, if not allocate one. - int poolSize; - synchronized (itsPool) - { - poolSize = itsPool.size(); - if (poolSize > 0) - { - abb = (ByteBuffer)itsPool.remove(poolSize - 1); - - // clear ByteBuffer before returning it - abb.clear(); - } - } - - // NOTE: Moved the 'else' part of the above if statement - // outside the synchronized block since it is likely - // less expensive to check poolSize than to allocate a - // DirectByteBuffer in the synchronized block. - if (poolSize <= 0) - { - abb = ByteBuffer.allocateDirect(itsByteBufferSize); - } - - // increment the number of ByteBuffers gotten from pool - // IMPORTANT: Since this counter is used only for information - // purposes, it does not use synchronized access. - itsObjectCounter++; - } - else - { - // Requested ByteBuffer size larger than the pool manages. - // Just allocate a non-direct ByteBuffer - abb = ByteBuffer.allocate(theAskSize); - } - - return abb; - } - - - /* - * Locations where ByteBuffers are released to the pool: - * 1. ByteBufferWithInfo.growBuffer() - * 2. BufferManagerWriteCollect.sendMessage() - * 3. CDROutputStream_1_0.close() - * 4. CDRInputStream_1_0.close() - * 5. BufferManagerReadStream.underflow() - * 6. BufferManagerWrite.close() - * 7. BufferManagerRead.close() - * 8. CorbaMessageMediatorImpl.releaseByteBufferToPool() - */ - - // If the ByteBuffer is a DirectByteBuffer, add it to the pool. - // Otherwise, set its reference to null since it's not kept in - // the pool and caller is saying he/she is done with it. - // NOTE: The size of the ByteBuffer is not checked with the - // this pool's ByteBuffer size since only DirectByteBuffers - // ever allocated. Hence, only DirectByteBuffer are checked - // here. An additional check could be added here for that though. - public void releaseByteBuffer(ByteBuffer thebb) - { - if (thebb.isDirect()) - { - synchronized (itsPool) - { - // use with debug to determine if byteBuffer is already - // in the pool. - boolean refInPool = false; - int bbAddr = 0; - - if (debug) - { - // Check to make sure we don't have 'thebb' reference - // already in the pool before adding it. - - for (int i = 0; i < itsPool.size() && refInPool == false; i++) - { - ByteBuffer tmpbb = (ByteBuffer)itsPool.get(i); - if (thebb == tmpbb) - { - refInPool = true; - bbAddr = System.identityHashCode(thebb); - } - } - - } - - // NOTE: The else part of this if will only get called - // if debug = true and refInPool = true, see logic above. - if (refInPool == false || debug == false) - { - // add ByteBuffer back to the pool - itsPool.add(thebb); - } - else // otherwise, log a stack trace with duplicate message - { - String threadName = Thread.currentThread().getName(); - Throwable t = - new Throwable(threadName + - ": Duplicate ByteBuffer reference (" + - bbAddr + ")"); - t.printStackTrace(System.out); - } - } - - // decrement the count of ByteBuffers released - // IMPORTANT: Since this counter is used only for information - // purposes, it does not use synchronized access. - itsObjectCounter--; - } - else - { - // ByteBuffer not pooled nor needed - thebb = null; - } - } - - - // Get a count of the outstanding allocated DirectByteBuffers. - // (Those allocated and have not been returned to the pool). - // IMPORTANT: Since this counter is used only for information - // purposes, it does not use synchronized access. - public int activeCount() - { - return itsObjectCounter; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java 2018-01-30 20:20:39.000000000 -0500 +++ /dev/null 2018-01-30 20:20:39.000000000 -0500 @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.transport; - -import java.util.Collection; -import java.util.Iterator; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ConnectionCache; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.transport.CorbaConnectionCache; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.orbutil.ORBUtility; - -/** - * @author Harold Carr - */ -public abstract class CorbaConnectionCacheBase - implements - ConnectionCache, - CorbaConnectionCache -{ - protected ORB orb; - protected long timestamp = 0; - protected String cacheType; - protected String monitoringName; - protected ORBUtilSystemException wrapper; - - protected CorbaConnectionCacheBase(ORB orb, String cacheType, - String monitoringName) - { - this.orb = orb; - this.cacheType = cacheType; - this.monitoringName = monitoringName; - wrapper =ORBUtilSystemException.get(orb,CORBALogDomains.RPC_TRANSPORT); - registerWithMonitoring(); - dprintCreation(); - } - - //////////////////////////////////////////////////// - // - // pept.transport.ConnectionCache - // - - public String getCacheType() - { - return cacheType; - } - - public synchronized void stampTime(Connection c) - { - // _REVISIT_ Need to worry about wrap around some day - c.setTimeStamp(timestamp++); - } - - public long numberOfConnections() - { - synchronized (backingStore()) { - return values().size(); - } - } - - public void close() { - synchronized (backingStore()) { - for (Object obj : values()) { - ((CorbaConnection)obj).closeConnectionResources() ; - } - } - } - - public long numberOfIdleConnections() - { - long count = 0; - synchronized (backingStore()) { - Iterator connections = values().iterator(); - while (connections.hasNext()) { - if (! ((Connection)connections.next()).isBusy()) { - count++; - } - } - } - return count; - } - - public long numberOfBusyConnections() - { - long count = 0; - synchronized (backingStore()) { - Iterator connections = values().iterator(); - while (connections.hasNext()) { - if (((Connection)connections.next()).isBusy()) { - count++; - } - } - } - return count; - } - - /** - * Discarding least recently used Connections that are not busy - * - * This method must be synchronized since one WorkerThread could - * be reclaming connections inside the synchronized backingStore - * block and a second WorkerThread (or a SelectorThread) could have - * already executed the if (numberOfConnections {@literal <=} .... ). As a - * result the second thread would also attempt to reclaim connections. - * - * If connection reclamation becomes a performance issue, the connection - * reclamation could make its own task and consequently executed in - * a separate thread. - * Currently, the accept {@literal &} reclaim are done in the same thread, WorkerThread - * by default. It could be changed such that the SelectorThread would do - * it for SocketChannels and WorkerThreads for Sockets by updating the - * ParserTable. - */ - synchronized public boolean reclaim() - { - try { - long numberOfConnections = numberOfConnections(); - - if (orb.transportDebugFlag) { - dprint(".reclaim->: " + numberOfConnections - + " (" - + orb.getORBData().getHighWaterMark() - + "/" - + orb.getORBData().getLowWaterMark() - + "/" - + orb.getORBData().getNumberToReclaim() - + ")"); - } - - if (numberOfConnections <= orb.getORBData().getHighWaterMark() || - numberOfConnections < orb.getORBData().getLowWaterMark()) { - return false; - } - - Object backingStore = backingStore(); - synchronized (backingStore) { - - // REVISIT - A less expensive alternative connection reclaiming - // algorithm could be investigated. - - for (int i=0; i < orb.getORBData().getNumberToReclaim(); i++) { - Connection toClose = null; - long lru = java.lang.Long.MAX_VALUE; - Iterator iterator = values().iterator(); - - // Find least recently used and not busy connection in cache - while ( iterator.hasNext() ) { - Connection c = (Connection) iterator.next(); - if ( !c.isBusy() && c.getTimeStamp() < lru ) { - toClose = c; - lru = c.getTimeStamp(); - } - } - - if ( toClose == null ) { - return false; - } - - try { - if (orb.transportDebugFlag) { - dprint(".reclaim: closing: " + toClose); - } - toClose.close(); - } catch (Exception ex) { - // REVISIT - log - } - } - - if (orb.transportDebugFlag) { - dprint(".reclaim: connections reclaimed (" - + (numberOfConnections - numberOfConnections()) + ")"); - } - } - - // XXX is necessary to do a GC to reclaim - // closed network connections ?? - // java.lang.System.gc(); - - return true; - } finally { - if (orb.transportDebugFlag) { - dprint(".reclaim<-: " + numberOfConnections()); - } - } - } - - //////////////////////////////////////////////////// - // - // spi.transport.ConnectionCache - // - - public String getMonitoringName() - { - return monitoringName; - } - - //////////////////////////////////////////////////// - // - // Implementation - // - - // This is public so folb.Server test can access it. - public abstract Collection values(); - - protected abstract Object backingStore(); - - protected abstract void registerWithMonitoring(); - - protected void dprintCreation() - { - if (orb.transportDebugFlag) { - dprint(".constructor: cacheType: " + getCacheType() - + " monitoringName: " + getMonitoringName()); - } - } - - protected void dprintStatistics() - { - if (orb.transportDebugFlag) { - dprint(".stats: " - + numberOfConnections() + "/total " - + numberOfBusyConnections() + "/busy " - + numberOfIdleConnections() + "/idle" - + " (" - + orb.getORBData().getHighWaterMark() + "/" - + orb.getORBData().getLowWaterMark() + "/" - + orb.getORBData().getNumberToReclaim() - + ")"); - } - } - - protected void dprint(String msg) - { - ORBUtility.dprint("CorbaConnectionCacheBase", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java 2018-01-30 20:20:40.000000000 -0500 +++ /dev/null 2018-01-30 20:20:40.000000000 -0500 @@ -1,292 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.transport; - -import java.io.InputStream; -import java.io.IOException; -import java.nio.ByteBuffer; - -import org.omg.CORBA.INTERNAL; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.ByteBufferPool; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.ContactInfoList; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.EventHandler; -import com.sun.corba.se.pept.transport.OutboundConnectionCache; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.transport.CorbaContactInfoList; -import com.sun.corba.se.spi.transport.CorbaContactInfo; - -import com.sun.corba.se.impl.encoding.ByteBufferWithInfo; -import com.sun.corba.se.impl.encoding.CDRInputObject; -import com.sun.corba.se.impl.encoding.CDRInputStream_1_0; -import com.sun.corba.se.impl.encoding.CDROutputObject; -import com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl; -import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; -import com.sun.corba.se.impl.orbutil.ORBUtility; - -/** - * @author Harold Carr - */ -public abstract class CorbaContactInfoBase - implements - CorbaContactInfo -{ - protected ORB orb; - protected CorbaContactInfoList contactInfoList; - // NOTE: This may be different from same named one in CorbaContactInfoList. - protected IOR effectiveTargetIOR; - protected short addressingDisposition; - protected OutboundConnectionCache connectionCache; - - //////////////////////////////////////////////////// - // - // pept.transport.ContactInfo - // - - public Broker getBroker() - { - return orb; - } - - public ContactInfoList getContactInfoList() - { - return contactInfoList; - } - - public ClientRequestDispatcher getClientRequestDispatcher() - { - int scid = - getEffectiveProfile().getObjectKeyTemplate().getSubcontractId() ; - RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ; - return scr.getClientRequestDispatcher( scid ) ; - } - - // Note: not all derived classes will use a connection cache. - // These are convenience methods that may not be used. - public void setConnectionCache(OutboundConnectionCache connectionCache) - { - this.connectionCache = connectionCache; - } - - public OutboundConnectionCache getConnectionCache() - { - return connectionCache; - } - - // Called when client making an invocation. - public MessageMediator createMessageMediator(Broker broker, - ContactInfo contactInfo, - Connection connection, - String methodName, - boolean isOneWay) - { - // REVISIT: Would like version, ior, requestid, etc., decisions - // to be in client subcontract. Cannot pass these to this - // factory method because it breaks generic abstraction. - // Maybe set methods on mediator called from subcontract - // after creation? - CorbaMessageMediator messageMediator = - new CorbaMessageMediatorImpl( - (ORB) broker, - contactInfo, - connection, - GIOPVersion.chooseRequestVersion( (ORB)broker, - effectiveTargetIOR), - effectiveTargetIOR, - ((CorbaConnection)connection).getNextRequestId(), - getAddressingDisposition(), - methodName, - isOneWay); - - return messageMediator; - } - - // Called when connection handling a read event. - public MessageMediator createMessageMediator(Broker broker,Connection conn) - { - ORB orb = (ORB) broker; - CorbaConnection connection = (CorbaConnection) conn; - - if (orb.transportDebugFlag) { - if (connection.shouldReadGiopHeaderOnly()) { - dprint( - ".createMessageMediator: waiting for message header on connection: " - + connection); - } else { - dprint( - ".createMessageMediator: waiting for message on connection: " - + connection); - } - } - - Message msg = null; - - if (connection.shouldReadGiopHeaderOnly()) { - // read giop header only - msg = MessageBase.readGIOPHeader(orb, connection); - } else { - // read entire giop message - msg = MessageBase.readGIOPMessage(orb, connection); - } - - ByteBuffer byteBuffer = msg.getByteBuffer(); - msg.setByteBuffer(null); - CorbaMessageMediator messageMediator = - new CorbaMessageMediatorImpl(orb, connection, msg, byteBuffer); - - return messageMediator; - } - - // Called when connection reading message body - public MessageMediator finishCreatingMessageMediator(Broker broker, - Connection conn, MessageMediator messageMediator) - { - ORB orb = (ORB) broker; - CorbaConnection connection = (CorbaConnection) conn; - CorbaMessageMediator corbaMessageMediator = - (CorbaMessageMediator)messageMediator; - - if (orb.transportDebugFlag) { - dprint( - ".finishCreatingMessageMediator: waiting for message body on connection: " - + connection); - } - - Message msg = corbaMessageMediator.getDispatchHeader(); - msg.setByteBuffer(corbaMessageMediator.getDispatchBuffer()); - - // read giop body only - msg = MessageBase.readGIOPBody(orb, connection, msg); - - ByteBuffer byteBuffer = msg.getByteBuffer(); - msg.setByteBuffer(null); - corbaMessageMediator.setDispatchHeader(msg); - corbaMessageMediator.setDispatchBuffer(byteBuffer); - - return corbaMessageMediator; - } - - public OutputObject createOutputObject(MessageMediator messageMediator) - { - CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator) - messageMediator; - - OutputObject outputObject = - sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator, - corbaMessageMediator.getRequestHeader(), - corbaMessageMediator.getStreamFormatVersion()); - - messageMediator.setOutputObject(outputObject); - return outputObject; - } - - public InputObject createInputObject(Broker broker, - MessageMediator messageMediator) - { - // REVISIT: Duplicate of acceptor code. - CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator) - messageMediator; - return new CDRInputObject((ORB)broker, - (CorbaConnection)messageMediator.getConnection(), - corbaMessageMediator.getDispatchBuffer(), - corbaMessageMediator.getDispatchHeader()); - } - - //////////////////////////////////////////////////// - // - // spi.transport.CorbaContactInfo - // - - public short getAddressingDisposition() - { - return addressingDisposition; - } - - public void setAddressingDisposition(short addressingDisposition) - { - this.addressingDisposition = addressingDisposition; - } - - // REVISIT - remove this. - public IOR getTargetIOR() - { - return contactInfoList.getTargetIOR(); - } - - public IOR getEffectiveTargetIOR() - { - return effectiveTargetIOR ; - } - - public IIOPProfile getEffectiveProfile() - { - return effectiveTargetIOR.getProfile(); - } - - //////////////////////////////////////////////////// - // - // java.lang.Object - // - - public String toString() - { - return - "CorbaContactInfoBase[" - + "]"; - } - - - //////////////////////////////////////////////////// - // - // Implementation - // - - protected void dprint(String msg) - { - ORBUtility.dprint("CorbaContactInfoBase", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListImpl.java 2018-01-30 20:20:41.000000000 -0500 +++ /dev/null 2018-01-30 20:20:41.000000000 -0500 @@ -1,240 +0,0 @@ -/* - * Copyright (c) 2002, 2006, 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.corba.se.impl.transport; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import com.sun.corba.se.pept.transport.ContactInfo; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.oa.ObjectAdapterFactory; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory; -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; -import com.sun.corba.se.spi.transport.SocketInfo; - -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.protocol.NotLocalLocalCRDImpl; - -/** - * @author Harold Carr - */ -public class CorbaContactInfoListImpl - implements - CorbaContactInfoList -{ - protected ORB orb; - protected LocalClientRequestDispatcher LocalClientRequestDispatcher; - protected IOR targetIOR; - protected IOR effectiveTargetIOR; - protected List effectiveTargetIORContactInfoList; - protected ContactInfo primaryContactInfo; - - // XREVISIT - is this used? - public CorbaContactInfoListImpl(ORB orb) - { - this.orb = orb; - } - - public CorbaContactInfoListImpl(ORB orb, IOR targetIOR) - { - this(orb); - setTargetIOR(targetIOR); - } - - //////////////////////////////////////////////////// - // - // pept.transport.ContactInfoList - // - - public synchronized Iterator iterator() - { - createContactInfoList(); - return new CorbaContactInfoListIteratorImpl( - orb, this, primaryContactInfo, - effectiveTargetIORContactInfoList); - } - - //////////////////////////////////////////////////// - // - // spi.transport.CorbaContactInfoList - // - - public synchronized void setTargetIOR(IOR targetIOR) - { - this.targetIOR = targetIOR; - setEffectiveTargetIOR(targetIOR); - } - - public synchronized IOR getTargetIOR() - { - return targetIOR; - } - - public synchronized void setEffectiveTargetIOR(IOR effectiveTargetIOR) - { - this.effectiveTargetIOR = effectiveTargetIOR; - effectiveTargetIORContactInfoList = null; - if (primaryContactInfo != null && - orb.getORBData().getIIOPPrimaryToContactInfo() != null) - { - orb.getORBData().getIIOPPrimaryToContactInfo() - .reset(primaryContactInfo); - } - primaryContactInfo = null; - setLocalSubcontract(); - } - - public synchronized IOR getEffectiveTargetIOR() - { - return effectiveTargetIOR; - } - - public synchronized LocalClientRequestDispatcher getLocalClientRequestDispatcher() - { - return LocalClientRequestDispatcher; - } - - //////////////////////////////////////////////////// - // - // org.omg.CORBA.portable.Delegate - // - - // REVISIT - hashCode(org.omg.CORBA.Object self) - - //////////////////////////////////////////////////// - // - // java.lang.Object - // - - public synchronized int hashCode() - { - return targetIOR.hashCode(); - } - - //////////////////////////////////////////////////// - // - // Implementation - // - - protected void createContactInfoList() - { - if (effectiveTargetIORContactInfoList != null) { - return; - } - - effectiveTargetIORContactInfoList = new ArrayList(); - - IIOPProfile iiopProfile = effectiveTargetIOR.getProfile(); - String hostname = - ((IIOPProfileTemplate)iiopProfile.getTaggedProfileTemplate()) - .getPrimaryAddress().getHost().toLowerCase(); - int port = - ((IIOPProfileTemplate)iiopProfile.getTaggedProfileTemplate()) - .getPrimaryAddress().getPort(); - // For use by "sticky manager" if one is registered. - primaryContactInfo = - createContactInfo(SocketInfo.IIOP_CLEAR_TEXT, hostname, port); - - if (iiopProfile.isLocal()) { - // NOTE: IMPORTANT: - // Only do local. The APP Server interceptors check - // effectiveTarget.isLocal - which is determined via - // the IOR - so if we added other addresses then - // transactions and interceptors would not execute. - ContactInfo contactInfo = new SharedCDRContactInfoImpl( - orb, this, effectiveTargetIOR, - orb.getORBData().getGIOPAddressDisposition()); - effectiveTargetIORContactInfoList.add(contactInfo); - } else { - addRemoteContactInfos(effectiveTargetIOR, - effectiveTargetIORContactInfoList); - } - } - - protected void addRemoteContactInfos( - IOR effectiveTargetIOR, - List effectiveTargetIORContactInfoList) - { - ContactInfo contactInfo; - List socketInfos = orb.getORBData() - .getIORToSocketInfo().getSocketInfo(effectiveTargetIOR); - Iterator iterator = socketInfos.iterator(); - while (iterator.hasNext()) { - SocketInfo socketInfo = (SocketInfo) iterator.next(); - String type = socketInfo.getType(); - String host = socketInfo.getHost().toLowerCase(); - int port = socketInfo.getPort(); - contactInfo = createContactInfo(type, host, port); - effectiveTargetIORContactInfoList.add(contactInfo); - } - } - - protected ContactInfo createContactInfo(String type, - String hostname, int port) - { - return new SocketOrChannelContactInfoImpl( - orb, this, - // XREVISIT - See Base Line 62 - effectiveTargetIOR, - orb.getORBData().getGIOPAddressDisposition(), - type, hostname, port); - } - - /** - * setLocalSubcontract sets cached information that is set whenever - * the effectiveTargetIOR changes. - * - * Note: this must be maintained accurately whether or not the ORB - * allows local optimization, because ServantManagers in the POA - * ALWAYS use local optimization ONLY (they do not have a remote case). - */ - protected void setLocalSubcontract() - { - if (!effectiveTargetIOR.getProfile().isLocal()) { - LocalClientRequestDispatcher = new NotLocalLocalCRDImpl(); - return; - } - - // XXX Note that this always uses the first IIOP profile to get the - // scid. What about multi-profile IORs? This should perhaps be - // tied to the current ContactInfo in some way, together with an - // implementation of ClientDelegate that generally prefers co-located - // ContactInfo. This may in fact mean that we should do this at - // the ContactInfo level, rather than the IOR/profile level. - int scid = effectiveTargetIOR.getProfile().getObjectKeyTemplate(). - getSubcontractId() ; - LocalClientRequestDispatcherFactory lcsf = orb.getRequestDispatcherRegistry().getLocalClientRequestDispatcherFactory( scid ) ; - LocalClientRequestDispatcher = lcsf.create( scid, effectiveTargetIOR ) ; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListIteratorImpl.java 2018-01-30 20:20:42.000000000 -0500 +++ /dev/null 2018-01-30 20:20:42.000000000 -0500 @@ -1,259 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.impl.transport; - -import java.util.Iterator; -import java.util.List; - -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.pept.transport.ContactInfo ; -import com.sun.corba.se.pept.transport.ContactInfoList ; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.transport.CorbaContactInfo; -import com.sun.corba.se.spi.transport.CorbaContactInfoList; -import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator; -import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.protocol.CorbaInvocationInfo; - -// REVISIT: create a unit test for this class. - -public class CorbaContactInfoListIteratorImpl - implements - CorbaContactInfoListIterator -{ - protected ORB orb; - protected CorbaContactInfoList contactInfoList; - protected CorbaContactInfo successContactInfo; - protected CorbaContactInfo failureContactInfo; - protected RuntimeException failureException; - - // ITERATOR state - protected Iterator effectiveTargetIORIterator; - protected CorbaContactInfo previousContactInfo; - protected boolean isAddrDispositionRetry; - protected IIOPPrimaryToContactInfo primaryToContactInfo; - protected ContactInfo primaryContactInfo; - protected List listOfContactInfos; - // End ITERATOR state - - public CorbaContactInfoListIteratorImpl( - ORB orb, - CorbaContactInfoList corbaContactInfoList, - ContactInfo primaryContactInfo, - List listOfContactInfos) - { - this.orb = orb; - this.contactInfoList = corbaContactInfoList; - this.primaryContactInfo = primaryContactInfo; - if (listOfContactInfos != null) { - // listOfContactInfos is null when used by the legacy - // socket factory. In that case this iterator is NOT used. - this.effectiveTargetIORIterator = listOfContactInfos.iterator(); - } - // List is immutable so no need to synchronize access. - this.listOfContactInfos = listOfContactInfos; - - this.previousContactInfo = null; - this.isAddrDispositionRetry = false; - - this.successContactInfo = null; - this.failureContactInfo = null; - this.failureException = null; - - primaryToContactInfo = orb.getORBData().getIIOPPrimaryToContactInfo(); - } - - //////////////////////////////////////////////////// - // - // java.util.Iterator - // - - public boolean hasNext() - { - // REVISIT: Implement as internal closure iterator which would - // wraps sticky or default. Then hasNext and next just call - // the closure. - - if (isAddrDispositionRetry) { - return true; - } - - boolean result; - - if (primaryToContactInfo != null) { - result = primaryToContactInfo.hasNext(primaryContactInfo, - previousContactInfo, - listOfContactInfos); - } else { - result = effectiveTargetIORIterator.hasNext(); - } - - return result; - } - - public Object next() - { - if (isAddrDispositionRetry) { - isAddrDispositionRetry = false; - return previousContactInfo; - } - - // We hold onto the last in case we get an addressing - // disposition retry. Then we use it again. - - // We also hold onto it for the sticky manager. - - if (primaryToContactInfo != null) { - previousContactInfo = (CorbaContactInfo) - primaryToContactInfo.next(primaryContactInfo, - previousContactInfo, - listOfContactInfos); - } else { - previousContactInfo = (CorbaContactInfo) - effectiveTargetIORIterator.next(); - } - - return previousContactInfo; - } - - public void remove() - { - throw new UnsupportedOperationException(); - } - - //////////////////////////////////////////////////// - // - // com.sun.corba.se.pept.transport.ContactInfoListIterator - // - - public ContactInfoList getContactInfoList() - { - return contactInfoList; - } - - public void reportSuccess(ContactInfo contactInfo) - { - this.successContactInfo = (CorbaContactInfo)contactInfo; - } - - public boolean reportException(ContactInfo contactInfo, - RuntimeException ex) - { - this.failureContactInfo = (CorbaContactInfo)contactInfo; - this.failureException = ex; - if (ex instanceof COMM_FAILURE) { - SystemException se = (SystemException) ex; - if (se.completed == CompletionStatus.COMPLETED_NO) { - if (hasNext()) { - return true; - } - if (contactInfoList.getEffectiveTargetIOR() != - contactInfoList.getTargetIOR()) - { - // retry from root ior - updateEffectiveTargetIOR(contactInfoList.getTargetIOR()); - return true; - } - } - } - return false; - } - - public RuntimeException getFailureException() - { - if (failureException == null) { - return - ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_TRANSPORT ) - .invalidContactInfoListIteratorFailureException(); - } else { - return failureException; - } - } - - //////////////////////////////////////////////////// - // - // spi.CorbaContactInfoListIterator - // - - public void reportAddrDispositionRetry(CorbaContactInfo contactInfo, - short disposition) - { - previousContactInfo.setAddressingDisposition(disposition); - isAddrDispositionRetry = true; - } - - public void reportRedirect(CorbaContactInfo contactInfo, - IOR forwardedIOR) - { - updateEffectiveTargetIOR(forwardedIOR); - } - - //////////////////////////////////////////////////// - // - // Implementation. - // - - // - // REVISIT: - // - // The normal operation for a standard iterator is to throw - // ConcurrentModificationException whenever the underlying collection - // changes. This is implemented by keeping a modification counter (the - // timestamp may fail because the granularity is too coarse). - // Essentially what you need to do is whenever the iterator fails this - // way, go back to ContactInfoList and get a new iterator. - // - // Need to update CorbaClientRequestDispatchImpl to catch and use - // that exception. - // - - public void updateEffectiveTargetIOR(IOR newIOR) - { - contactInfoList.setEffectiveTargetIOR(newIOR); - // If we report the exception in _request (i.e., beginRequest - // we cannot throw RemarshalException to the stub because _request - // does not declare that exception. - // To keep the two-level dispatching (first level chooses ContactInfo, - // second level is specific to that ContactInfo/EPT) we need to - // ensure that the request dispatchers get their iterator from the - // InvocationStack (i.e., ThreadLocal). That way if the list iterator - // needs a complete update it happens right here. - ((CorbaInvocationInfo)orb.getInvocationInfo()) - .setContactInfoListIterator(contactInfoList.iterator()); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaInboundConnectionCacheImpl.java 2018-01-30 20:20:42.000000000 -0500 +++ /dev/null 2018-01-30 20:20:42.000000000 -0500 @@ -1,222 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.transport; - -import java.util.ArrayList; -import java.util.Collection; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.InboundConnectionCache; - -import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase; -import com.sun.corba.se.spi.monitoring.MonitoringConstants; -import com.sun.corba.se.spi.monitoring.MonitoringFactories; -import com.sun.corba.se.spi.monitoring.MonitoredObject; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaConnectionCache; -import com.sun.corba.se.spi.transport.CorbaAcceptor; - -import com.sun.corba.se.impl.orbutil.ORBUtility; - -/** - * @author Harold Carr - */ -public class CorbaInboundConnectionCacheImpl - extends - CorbaConnectionCacheBase - implements - InboundConnectionCache -{ - protected Collection connectionCache; - - private Acceptor acceptor; - - public CorbaInboundConnectionCacheImpl(ORB orb, Acceptor acceptor) - { - super(orb, acceptor.getConnectionCacheType(), - ((CorbaAcceptor)acceptor).getMonitoringName()); - this.connectionCache = new ArrayList(); - this.acceptor = acceptor; - if (orb.transportDebugFlag) { - dprint(": " + acceptor ); - } - } - - //////////////////////////////////////////////////// - // - // pept.transport.InboundConnectionCache - // - - public void close () { - - super.close(); - if (orb.transportDebugFlag) { - dprint(".close: " + acceptor ); - } - this.acceptor.close(); - - } - - public Connection get(Acceptor acceptor) - { - throw wrapper.methodShouldNotBeCalled(); - } - - public Acceptor getAcceptor () { - return acceptor; - } - - public void put(Acceptor acceptor, Connection connection) - { - if (orb.transportDebugFlag) { - dprint(".put: " + acceptor + " " + connection); - } - synchronized (backingStore()) { - connectionCache.add(connection); - connection.setConnectionCache(this); - dprintStatistics(); - } - } - - public void remove(Connection connection) - { - if (orb.transportDebugFlag) { - dprint(".remove: " + connection); - } - synchronized (backingStore()) { - connectionCache.remove(connection); - dprintStatistics(); - } - } - - //////////////////////////////////////////////////// - // - // Implementation - // - - public Collection values() - { - return connectionCache; - } - - protected Object backingStore() - { - return connectionCache; - } - - protected void registerWithMonitoring() - { - // ORB - MonitoredObject orbMO = - orb.getMonitoringManager().getRootMonitoredObject(); - - // REVISIT - add ORBUtil mkdir -p like operation for this. - - // CONNECTION - MonitoredObject connectionMO = - orbMO.getChild(MonitoringConstants.CONNECTION_MONITORING_ROOT); - if (connectionMO == null) { - connectionMO = - MonitoringFactories.getMonitoredObjectFactory() - .createMonitoredObject( - MonitoringConstants.CONNECTION_MONITORING_ROOT, - MonitoringConstants.CONNECTION_MONITORING_ROOT_DESCRIPTION); - orbMO.addChild(connectionMO); - } - - // INBOUND CONNECTION - MonitoredObject inboundConnectionMO = - connectionMO.getChild( - MonitoringConstants.INBOUND_CONNECTION_MONITORING_ROOT); - if (inboundConnectionMO == null) { - inboundConnectionMO = - MonitoringFactories.getMonitoredObjectFactory() - .createMonitoredObject( - MonitoringConstants.INBOUND_CONNECTION_MONITORING_ROOT, - MonitoringConstants.INBOUND_CONNECTION_MONITORING_ROOT_DESCRIPTION); - connectionMO.addChild(inboundConnectionMO); - } - - // NODE FOR THIS CACHE - MonitoredObject thisMO = - inboundConnectionMO.getChild(getMonitoringName()); - if (thisMO == null) { - thisMO = - MonitoringFactories.getMonitoredObjectFactory() - .createMonitoredObject( - getMonitoringName(), - MonitoringConstants.CONNECTION_MONITORING_DESCRIPTION); - inboundConnectionMO.addChild(thisMO); - } - - LongMonitoredAttributeBase attribute; - - // ATTRIBUTE - attribute = new - LongMonitoredAttributeBase( - MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS, - MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS_DESCRIPTION) - { - public Object getValue() { - return new Long(CorbaInboundConnectionCacheImpl.this.numberOfConnections()); - } - }; - thisMO.addAttribute(attribute); - - // ATTRIBUTE - attribute = new - LongMonitoredAttributeBase( - MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS, - MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS_DESCRIPTION) - { - public Object getValue() { - return new Long(CorbaInboundConnectionCacheImpl.this.numberOfIdleConnections()); - } - }; - thisMO.addAttribute(attribute); - - // ATTRIBUTE - attribute = new - LongMonitoredAttributeBase( - MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS, - MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS_DESCRIPTION) - { - public Object getValue() { - return new Long(CorbaInboundConnectionCacheImpl.this.numberOfBusyConnections()); - } - }; - thisMO.addAttribute(attribute); - } - - protected void dprint(String msg) - { - ORBUtility.dprint("CorbaInboundConnectionCacheImpl", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaOutboundConnectionCacheImpl.java 2018-01-30 20:20:43.000000000 -0500 +++ /dev/null 2018-01-30 20:20:43.000000000 -0500 @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.impl.transport; - -import java.util.Collection; -import java.util.Hashtable; -import java.util.Iterator; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.OutboundConnectionCache; - -import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase; -import com.sun.corba.se.spi.monitoring.MonitoringConstants; -import com.sun.corba.se.spi.monitoring.MonitoringFactories; -import com.sun.corba.se.spi.monitoring.MonitoredObject; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaConnectionCache; -import com.sun.corba.se.spi.transport.CorbaContactInfo; - -import com.sun.corba.se.impl.orbutil.ORBUtility; - -/** - * @author Harold Carr - */ -public class CorbaOutboundConnectionCacheImpl - extends - CorbaConnectionCacheBase - implements - OutboundConnectionCache -{ - protected Hashtable connectionCache; - - public CorbaOutboundConnectionCacheImpl(ORB orb, ContactInfo contactInfo) - { - super(orb, contactInfo.getConnectionCacheType(), - ((CorbaContactInfo)contactInfo).getMonitoringName()); - this.connectionCache = new Hashtable(); - } - - //////////////////////////////////////////////////// - // - // pept.transport.OutboundConnectionCache - // - - public Connection get(ContactInfo contactInfo) - { - if (orb.transportDebugFlag) { - dprint(".get: " + contactInfo + " " + contactInfo.hashCode()); - } - synchronized (backingStore()) { - dprintStatistics(); - return (Connection) connectionCache.get(contactInfo); - } - } - - public void put(ContactInfo contactInfo, Connection connection) - { - if (orb.transportDebugFlag) { - dprint(".put: " + contactInfo + " " + contactInfo.hashCode() + " " - + connection); - } - synchronized (backingStore()) { - connectionCache.put(contactInfo, connection); - connection.setConnectionCache(this); - dprintStatistics(); - } - } - - public void remove(ContactInfo contactInfo) - { - if (orb.transportDebugFlag) { - dprint(".remove: " + contactInfo + " " + contactInfo.hashCode()); - } - synchronized (backingStore()) { - if (contactInfo != null) { - connectionCache.remove(contactInfo); - } - dprintStatistics(); - } - } - - //////////////////////////////////////////////////// - // - // Implementation - // - - public Collection values() - { - return connectionCache.values(); - } - - protected Object backingStore() - { - return connectionCache; - } - - protected void registerWithMonitoring() - { - // ORB - MonitoredObject orbMO = - orb.getMonitoringManager().getRootMonitoredObject(); - - // CONNECTION - MonitoredObject connectionMO = - orbMO.getChild(MonitoringConstants.CONNECTION_MONITORING_ROOT); - if (connectionMO == null) { - connectionMO = - MonitoringFactories.getMonitoredObjectFactory() - .createMonitoredObject( - MonitoringConstants.CONNECTION_MONITORING_ROOT, - MonitoringConstants.CONNECTION_MONITORING_ROOT_DESCRIPTION); - orbMO.addChild(connectionMO); - } - - // OUTBOUND CONNECTION - MonitoredObject outboundConnectionMO = - connectionMO.getChild( - MonitoringConstants.OUTBOUND_CONNECTION_MONITORING_ROOT); - if (outboundConnectionMO == null) { - outboundConnectionMO = - MonitoringFactories.getMonitoredObjectFactory() - .createMonitoredObject( - MonitoringConstants.OUTBOUND_CONNECTION_MONITORING_ROOT, - MonitoringConstants.OUTBOUND_CONNECTION_MONITORING_ROOT_DESCRIPTION); - connectionMO.addChild(outboundConnectionMO); - } - - // NODE FOR THIS CACHE - MonitoredObject thisMO = - outboundConnectionMO.getChild(getMonitoringName()); - if (thisMO == null) { - thisMO = - MonitoringFactories.getMonitoredObjectFactory() - .createMonitoredObject( - getMonitoringName(), - MonitoringConstants.CONNECTION_MONITORING_DESCRIPTION); - outboundConnectionMO.addChild(thisMO); - } - - LongMonitoredAttributeBase attribute; - - // ATTRIBUTE - attribute = new - LongMonitoredAttributeBase( - MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS, - MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS_DESCRIPTION) - { - public Object getValue() { - return new Long(CorbaOutboundConnectionCacheImpl.this.numberOfConnections()); - } - }; - thisMO.addAttribute(attribute); - - // ATTRIBUTE - attribute = new - LongMonitoredAttributeBase( - MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS, - MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS_DESCRIPTION) - { - public Object getValue() { - return new Long(CorbaOutboundConnectionCacheImpl.this.numberOfIdleConnections()); - } - }; - thisMO.addAttribute(attribute); - - // ATTRIBUTE - attribute = new - LongMonitoredAttributeBase( - MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS, - MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS_DESCRIPTION) - { - public Object getValue() { - return new Long(CorbaOutboundConnectionCacheImpl.this.numberOfBusyConnections()); - } - }; - thisMO.addAttribute(attribute); - } - - protected void dprint(String msg) - { - ORBUtility.dprint("CorbaOutboundConnectionCacheImpl", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java 2018-01-30 20:20:44.000000000 -0500 +++ /dev/null 2018-01-30 20:20:44.000000000 -0500 @@ -1,337 +0,0 @@ -/* - * Copyright (c) 2001, 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.corba.se.impl.transport; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.SystemException; - -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom; - -import com.sun.corba.se.impl.encoding.BufferManagerReadStream; -import com.sun.corba.se.impl.encoding.CDRInputObject; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyOrReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; - -/** - * @author Harold Carr - */ -public class CorbaResponseWaitingRoomImpl - implements - CorbaResponseWaitingRoom -{ - final static class OutCallDesc - { - java.lang.Object done = new java.lang.Object(); - Thread thread; - MessageMediator messageMediator; - SystemException exception; - InputObject inputObject; - } - - private ORB orb; - private ORBUtilSystemException wrapper ; - - private CorbaConnection connection; - // Maps requestId to an OutCallDesc. - final private Map out_calls; - - public CorbaResponseWaitingRoomImpl(ORB orb, CorbaConnection connection) - { - this.orb = orb; - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_TRANSPORT ) ; - this.connection = connection; - out_calls = - Collections.synchronizedMap(new HashMap()); - } - - //////////////////////////////////////////////////// - // - // pept.transport.ResponseWaitingRoom - // - - public void registerWaiter(MessageMediator mediator) - { - CorbaMessageMediator messageMediator = (CorbaMessageMediator) mediator; - - if (orb.transportDebugFlag) { - dprint(".registerWaiter: " + opAndId(messageMediator)); - } - - Integer requestId = messageMediator.getRequestIdInteger(); - - OutCallDesc call = new OutCallDesc(); - call.thread = Thread.currentThread(); - call.messageMediator = messageMediator; - out_calls.put(requestId, call); - } - - public void unregisterWaiter(MessageMediator mediator) - { - CorbaMessageMediator messageMediator = (CorbaMessageMediator) mediator; - - if (orb.transportDebugFlag) { - dprint(".unregisterWaiter: " + opAndId(messageMediator)); - } - - Integer requestId = messageMediator.getRequestIdInteger(); - - out_calls.remove(requestId); - } - - public InputObject waitForResponse(MessageMediator mediator) - { - CorbaMessageMediator messageMediator = (CorbaMessageMediator) mediator; - - try { - - InputObject returnStream = null; - - if (orb.transportDebugFlag) { - dprint(".waitForResponse->: " + opAndId(messageMediator)); - } - - Integer requestId = messageMediator.getRequestIdInteger(); - - if (messageMediator.isOneWay()) { - // The waiter is removed in releaseReply in the same - // way as a normal request. - - if (orb.transportDebugFlag) { - dprint(".waitForResponse: one way - not waiting: " - + opAndId(messageMediator)); - } - - return null; - } - - OutCallDesc call = out_calls.get(requestId); - if (call == null) { - throw wrapper.nullOutCall(CompletionStatus.COMPLETED_MAYBE); - } - - synchronized(call.done) { - - while (call.inputObject == null && call.exception == null) { - // Wait for the reply from the server. - // The ReaderThread reads in the reply IIOP message - // and signals us. - try { - if (orb.transportDebugFlag) { - dprint(".waitForResponse: waiting: " - + opAndId(messageMediator)); - } - call.done.wait(); - } catch (InterruptedException ie) {}; - } - - if (call.exception != null) { - if (orb.transportDebugFlag) { - dprint(".waitForResponse: exception: " - + opAndId(messageMediator)); - } - throw call.exception; - } - - returnStream = call.inputObject; - } - - // REVISIT -- exceptions from unmarshaling code will - // go up through this client thread! - - if (returnStream != null) { - // On fragmented streams the header MUST be unmarshaled here - // (in the client thread) in case it blocks. - // If the header was already unmarshaled, this won't - // do anything - // REVISIT: cast - need interface method. - ((CDRInputObject)returnStream).unmarshalHeader(); - } - - return returnStream; - - } finally { - if (orb.transportDebugFlag) { - dprint(".waitForResponse<-: " + opAndId(messageMediator)); - } - } - } - - public void responseReceived(InputObject is) - { - CDRInputObject inputObject = (CDRInputObject) is; - LocateReplyOrReplyMessage header = (LocateReplyOrReplyMessage) - inputObject.getMessageHeader(); - Integer requestId = new Integer(header.getRequestId()); - OutCallDesc call = out_calls.get(requestId); - - if (orb.transportDebugFlag) { - dprint(".responseReceived: id/" - + requestId + ": " - + header); - } - - // This is an interesting case. It could mean that someone sent us a - // reply message, but we don't know what request it was for. That - // would probably call for an error. However, there's another case - // that's normal and we should think about -- - // - // If the unmarshaling thread does all of its work inbetween the time - // the ReaderThread gives it the last fragment and gets to the - // out_calls.get line, then it will also be null, so just return; - if (call == null) { - if (orb.transportDebugFlag) { - dprint(".responseReceived: id/" - + requestId - + ": no waiter: " - + header); - } - return; - } - - // Set the reply InputObject and signal the client thread - // that the reply has been received. - // The thread signalled will remove outcall descriptor if appropriate. - // Otherwise, it'll be removed when last fragment for it has been put on - // BufferManagerRead's queue. - synchronized (call.done) { - CorbaMessageMediator messageMediator = (CorbaMessageMediator) - call.messageMediator; - - if (orb.transportDebugFlag) { - dprint(".responseReceived: " - + opAndId(messageMediator) - + ": notifying waiters"); - } - - messageMediator.setReplyHeader(header); - messageMediator.setInputObject(is); - inputObject.setMessageMediator(messageMediator); - call.inputObject = is; - call.done.notify(); - } - } - - public int numberRegistered() - { - return out_calls.size(); - } - - ////////////////////////////////////////////////// - // - // CorbaResponseWaitingRoom - // - - public void signalExceptionToAllWaiters(SystemException systemException) - { - - if (orb.transportDebugFlag) { - dprint(".signalExceptionToAllWaiters: " + systemException); - } - - synchronized (out_calls) { - if (orb.transportDebugFlag) { - dprint(".signalExceptionToAllWaiters: out_calls size :" + - out_calls.size()); - } - - for (OutCallDesc call : out_calls.values()) { - if (orb.transportDebugFlag) { - dprint(".signalExceptionToAllWaiters: signaling " + - call); - } - synchronized(call.done) { - try { - // anything waiting for BufferManagerRead's fragment queue - // needs to be cancelled - CorbaMessageMediator corbaMsgMediator = - (CorbaMessageMediator)call.messageMediator; - CDRInputObject inputObject = - (CDRInputObject)corbaMsgMediator.getInputObject(); - // IMPORTANT: If inputObject is null, then no need to tell - // BufferManagerRead to cancel request processing. - if (inputObject != null) { - BufferManagerReadStream bufferManager = - (BufferManagerReadStream)inputObject.getBufferManager(); - int requestId = corbaMsgMediator.getRequestId(); - bufferManager.cancelProcessing(requestId); - } - } catch (Exception e) { - } finally { - // attempt to wake up waiting threads in all cases - call.inputObject = null; - call.exception = systemException; - call.done.notifyAll(); - } - } - } - } - } - - public MessageMediator getMessageMediator(int requestId) - { - Integer id = new Integer(requestId); - OutCallDesc call = out_calls.get(id); - if (call == null) { - // This can happen when getting early reply fragments for a - // request which has completed (e.g., client marshaling error). - return null; - } - return call.messageMediator; - } - - //////////////////////////////////////////////////// - // - // Implementation. - // - - protected void dprint(String msg) - { - ORBUtility.dprint("CorbaResponseWaitingRoomImpl", msg); - } - - protected String opAndId(CorbaMessageMediator mediator) - { - return ORBUtility.operationNameAndRequestId(mediator); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java 2018-01-30 20:20:45.000000000 -0500 +++ /dev/null 2018-01-30 20:20:45.000000000 -0500 @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.impl.transport; - -import java.net.ServerSocket; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import org.omg.CORBA.INITIALIZE; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; - -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.ConnectionCache; -import com.sun.corba.se.pept.transport.ByteBufferPool; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.InboundConnectionCache; -import com.sun.corba.se.pept.transport.OutboundConnectionCache; -import com.sun.corba.se.pept.transport.Selector; - -import com.sun.corba.se.spi.ior.IORTemplate; -import com.sun.corba.se.spi.ior.ObjectAdapterId; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaAcceptor; -import com.sun.corba.se.spi.transport.CorbaTransportManager; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ConnectionCache; - -// REVISIT - impl/poa specific: -import com.sun.corba.se.impl.oa.poa.Policies; -import com.sun.corba.se.impl.orbutil.ORBUtility; - -/** - * @author Harold Carr - */ -public class CorbaTransportManagerImpl - implements - CorbaTransportManager -{ - protected ORB orb; - protected List acceptors; - protected Map outboundConnectionCaches; - protected Map inboundConnectionCaches; - protected Selector selector; - - public CorbaTransportManagerImpl(ORB orb) - { - this.orb = orb; - acceptors = new ArrayList(); - outboundConnectionCaches = new HashMap(); - inboundConnectionCaches = new HashMap(); - selector = new SelectorImpl(orb); - } - - //////////////////////////////////////////////////// - // - // pept TransportManager - // - - public ByteBufferPool getByteBufferPool(int id) - { - throw new RuntimeException(); - } - - public OutboundConnectionCache getOutboundConnectionCache( - ContactInfo contactInfo) - { - synchronized (contactInfo) { - if (contactInfo.getConnectionCache() == null) { - OutboundConnectionCache connectionCache = null; - synchronized (outboundConnectionCaches) { - connectionCache = (OutboundConnectionCache) - outboundConnectionCaches.get( - contactInfo.getConnectionCacheType()); - if (connectionCache == null) { - // REVISIT: Would like to be able to configure - // the connection cache type used. - connectionCache = - new CorbaOutboundConnectionCacheImpl(orb, - contactInfo); - outboundConnectionCaches.put( - contactInfo.getConnectionCacheType(), - connectionCache); - } - } - contactInfo.setConnectionCache(connectionCache); - } - return contactInfo.getConnectionCache(); - } - } - - public Collection getOutboundConnectionCaches() - { - return outboundConnectionCaches.values(); - } - - public InboundConnectionCache getInboundConnectionCache( - Acceptor acceptor) - { - synchronized (acceptor) { - if (acceptor.getConnectionCache() == null) { - InboundConnectionCache connectionCache = null; - synchronized (inboundConnectionCaches) { - connectionCache = (InboundConnectionCache) - inboundConnectionCaches.get( - acceptor.getConnectionCacheType()); - if (connectionCache == null) { - // REVISIT: Would like to be able to configure - // the connection cache type used. - connectionCache = - new CorbaInboundConnectionCacheImpl(orb, - acceptor); - inboundConnectionCaches.put( - acceptor.getConnectionCacheType(), - connectionCache); - } - } - acceptor.setConnectionCache(connectionCache); - } - return acceptor.getConnectionCache(); - } - } - - public Collection getInboundConnectionCaches() - { - return inboundConnectionCaches.values(); - } - - public Selector getSelector(int id) - { - return selector; - } - - public synchronized void registerAcceptor(Acceptor acceptor) - { - if (orb.transportDebugFlag) { - dprint(".registerAcceptor->: " + acceptor); - } - acceptors.add(acceptor); - if (orb.transportDebugFlag) { - dprint(".registerAcceptor<-: " + acceptor); - } - } - - public Collection getAcceptors() - { - return getAcceptors(null, null); - } - - public synchronized void unregisterAcceptor(Acceptor acceptor) - { - acceptors.remove(acceptor); - } - - public void close() - { - try { - if (orb.transportDebugFlag) { - dprint(".close->"); - } - for (Object cc : outboundConnectionCaches.values()) { - ((ConnectionCache)cc).close() ; - } - for (Object icc : inboundConnectionCaches.values()) { - ((ConnectionCache)icc).close() ; - unregisterAcceptor(((InboundConnectionCache)icc).getAcceptor()); - } - getSelector(0).close(); - } finally { - if (orb.transportDebugFlag) { - dprint(".close<-"); - } - } - } - - //////////////////////////////////////////////////// - // - // CorbaTransportManager - // - - public Collection getAcceptors(String objectAdapterManagerId, - ObjectAdapterId objectAdapterId) - { - // REVISIT - need to filter based on arguments. - - // REVISIT - initialization will be moved to OA. - // Lazy initialization of acceptors. - Iterator iterator = acceptors.iterator(); - while (iterator.hasNext()) { - Acceptor acceptor = (Acceptor) iterator.next(); - if (acceptor.initialize()) { - if (acceptor.shouldRegisterAcceptEvent()) { - orb.getTransportManager().getSelector(0) - .registerForEvent(acceptor.getEventHandler()); - } - } - } - return acceptors; - } - - // REVISIT - POA specific policies - public void addToIORTemplate(IORTemplate iorTemplate, - Policies policies, - String codebase, - String objectAdapterManagerId, - ObjectAdapterId objectAdapterId) - { - Iterator iterator = - getAcceptors(objectAdapterManagerId, objectAdapterId).iterator(); - while (iterator.hasNext()) { - CorbaAcceptor acceptor = (CorbaAcceptor) iterator.next(); - acceptor.addToIORTemplate(iorTemplate, policies, codebase); - } - } - - - //////////////////////////////////////////////////// - // - // implemenation - // - - protected void dprint(String msg) - { - ORBUtility.dprint("CorbaTransportManagerImpl", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultIORToSocketInfoImpl.java 2018-01-30 20:20:45.000000000 -0500 +++ /dev/null 2018-01-30 20:20:45.000000000 -0500 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.transport; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent; -import com.sun.corba.se.spi.transport.IORToSocketInfo; -import com.sun.corba.se.spi.transport.SocketInfo; - -public class DefaultIORToSocketInfoImpl - implements IORToSocketInfo -{ - public List getSocketInfo(IOR ior) - { - SocketInfo socketInfo; - List result = new ArrayList(); - - IIOPProfileTemplate iiopProfileTemplate = (IIOPProfileTemplate) - ior.getProfile().getTaggedProfileTemplate() ; - IIOPAddress primary = iiopProfileTemplate.getPrimaryAddress() ; - String hostname = primary.getHost().toLowerCase(); - int port = primary.getPort(); - // NOTE: we could check for 0 (i.e., CSIv2) but, for a - // non-CSIv2-configured client ORB talking to a CSIv2 configured - // server ORB you might end up with an empty contact info list - // which would then report a failure which would not be as - // instructive as leaving a ContactInfo with a 0 port in the list. - socketInfo = createSocketInfo(hostname, port); - result.add(socketInfo); - - Iterator iterator = iiopProfileTemplate.iteratorById( - TAG_ALTERNATE_IIOP_ADDRESS.value); - - while (iterator.hasNext()) { - AlternateIIOPAddressComponent alternate = - (AlternateIIOPAddressComponent) iterator.next(); - hostname = alternate.getAddress().getHost().toLowerCase(); - port = alternate.getAddress().getPort(); - socketInfo= createSocketInfo(hostname, port); - result.add(socketInfo); - } - return result; - } - - private SocketInfo createSocketInfo(final String hostname, final int port) - { - return new SocketInfo() { - public String getType() { return SocketInfo.IIOP_CLEAR_TEXT; } - public String getHost() { return hostname; } - public int getPort() { return port; }}; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java 2018-01-30 20:20:46.000000000 -0500 +++ /dev/null 2018-01-30 20:20:46.000000000 -0500 @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.transport; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.SocketException; -import java.net.ServerSocket; -import java.nio.channels.SocketChannel; -import java.nio.channels.ServerSocketChannel; -import java.security.PrivilegedAction; - -import com.sun.corba.se.pept.transport.Acceptor; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.ORBSocketFactory; - -import com.sun.corba.se.impl.orbutil.ORBConstants; - -public class DefaultSocketFactoryImpl - implements ORBSocketFactory -{ - private ORB orb; - private static final boolean keepAlive; - - static { - keepAlive = java.security.AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Boolean run () { - String value = - System.getProperty("com.sun.CORBA.transport.enableTcpKeepAlive"); - if (value != null) - return new Boolean(!"false".equalsIgnoreCase(value)); - - return Boolean.FALSE; - } - }); - } - - public void setORB(ORB orb) - { - this.orb = orb; - } - - public ServerSocket createServerSocket(String type, - InetSocketAddress inetSocketAddress) - throws IOException - { - ServerSocketChannel serverSocketChannel = null; - ServerSocket serverSocket = null; - - if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) { - serverSocketChannel = ServerSocketChannel.open(); - serverSocket = serverSocketChannel.socket(); - } else { - serverSocket = new ServerSocket(); - } - serverSocket.bind(inetSocketAddress); - return serverSocket; - } - - public Socket createSocket(String type, - InetSocketAddress inetSocketAddress) - throws IOException - { - SocketChannel socketChannel = null; - Socket socket = null; - - if (orb.getORBData().connectionSocketType().equals(ORBConstants.SOCKETCHANNEL)) { - socketChannel = SocketChannel.open(inetSocketAddress); - socket = socketChannel.socket(); - } else { - socket = new Socket(inetSocketAddress.getHostName(), - inetSocketAddress.getPort()); - } - - // Disable Nagle's algorithm (i.e., always send immediately). - socket.setTcpNoDelay(true); - - if (keepAlive) - socket.setKeepAlive(true); - - return socket; - } - - public void setAcceptedSocketOptions(Acceptor acceptor, - ServerSocket serverSocket, - Socket socket) - throws SocketException - { - // Disable Nagle's algorithm (i.e., always send immediately). - socket.setTcpNoDelay(true); - if (keepAlive) - socket.setKeepAlive(true); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/EventHandlerBase.java 2018-01-30 20:20:47.000000000 -0500 +++ /dev/null 2018-01-30 20:20:47.000000000 -0500 @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.transport; - -import java.nio.channels.SelectionKey; - -import org.omg.CORBA.INTERNAL; - -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.EventHandler; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException; -import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException; -import com.sun.corba.se.spi.orbutil.threadpool.Work; - -import com.sun.corba.se.impl.orbutil.ORBUtility; - -public abstract class EventHandlerBase - implements - EventHandler -{ - protected ORB orb; - protected Work work; - protected boolean useWorkerThreadForEvent; - protected boolean useSelectThreadToWait; - protected SelectionKey selectionKey; - - //////////////////////////////////////////////////// - // - // EventHandler methods - // - - public void setUseSelectThreadToWait(boolean x) - { - useSelectThreadToWait = x; - } - - public boolean shouldUseSelectThreadToWait() - { - return useSelectThreadToWait; - } - - public void setSelectionKey(SelectionKey selectionKey) - { - this.selectionKey = selectionKey; - } - - public SelectionKey getSelectionKey() - { - return selectionKey; - } - - /* - * NOTE: - * This is not thread-safe by design. - * Only one thread should call it - a reader/listener/select thread. - * Not stateless: interest ops, registration. - */ - public void handleEvent() - { - if (orb.transportDebugFlag) { - dprint(".handleEvent->: " + this); - } - getSelectionKey().interestOps(getSelectionKey().interestOps() & - (~ getInterestOps())); - if (shouldUseWorkerThreadForEvent()) { - Throwable throwable = null; - try { - if (orb.transportDebugFlag) { - dprint(".handleEvent: addWork to pool: " + 0); - } - orb.getThreadPoolManager().getThreadPool(0) - .getWorkQueue(0).addWork(getWork()); - } catch (NoSuchThreadPoolException e) { - throwable = e; - } catch (NoSuchWorkQueueException e) { - throwable = e; - } - // REVISIT: need to close connection. - if (throwable != null) { - if (orb.transportDebugFlag) { - dprint(".handleEvent: " + throwable); - } - INTERNAL i = new INTERNAL("NoSuchThreadPoolException"); - i.initCause(throwable); - throw i; - } - } else { - if (orb.transportDebugFlag) { - dprint(".handleEvent: doWork"); - } - getWork().doWork(); - } - if (orb.transportDebugFlag) { - dprint(".handleEvent<-: " + this); - } - } - - public boolean shouldUseWorkerThreadForEvent() - { - return useWorkerThreadForEvent; - } - - public void setUseWorkerThreadForEvent(boolean x) - { - useWorkerThreadForEvent = x; - } - - public void setWork(Work work) - { - this.work = work; - } - - public Work getWork() - { - return work; - } - - private void dprint(String msg) - { - ORBUtility.dprint("EventHandlerBase", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ListenerThreadImpl.java 2018-01-30 20:20:48.000000000 -0500 +++ /dev/null 2018-01-30 20:20:48.000000000 -0500 @@ -1,147 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.transport; - -import java.io.IOException; - -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.ListenerThread; -import com.sun.corba.se.pept.transport.Selector; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orbutil.threadpool.Work; - -import com.sun.corba.se.impl.orbutil.ORBUtility; - - -public class ListenerThreadImpl - implements - ListenerThread, - Work -{ - private ORB orb; - private Acceptor acceptor; - private Selector selector; - private boolean keepRunning; - private long enqueueTime; - - public ListenerThreadImpl(ORB orb, Acceptor acceptor, Selector selector) - { - this.orb = orb; - this.acceptor = acceptor; - this.selector = selector; - keepRunning = true; - } - - //////////////////////////////////////////////////// - // - // ListenerThread methods. - // - - public Acceptor getAcceptor() - { - return acceptor; - } - - public void close() - { - if (orb.transportDebugFlag) { - dprint(".close: " + acceptor); - } - - keepRunning = false; - } - - //////////////////////////////////////////////////// - // - // Work methods. - // - - // REVISIT - this needs alot more from previous ListenerThread - - public void doWork() - { - try { - if (orb.transportDebugFlag) { - dprint(".doWork: Start ListenerThread: " + acceptor); - } - while (keepRunning) { - try { - if (orb.transportDebugFlag) { - dprint(".doWork: BEFORE ACCEPT CYCLE: " + acceptor); - } - - acceptor.accept(); - - if (orb.transportDebugFlag) { - dprint(".doWork: AFTER ACCEPT CYCLE: " + acceptor); - } - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".doWork: Exception in accept: " + acceptor,t); - } - orb.getTransportManager().getSelector(0) - .unregisterForEvent(getAcceptor().getEventHandler()); - getAcceptor().close(); - } - } - } finally { - if (orb.transportDebugFlag) { - dprint(".doWork: Terminated ListenerThread: " + acceptor); - } - } - } - - public void setEnqueueTime(long timeInMillis) - { - enqueueTime = timeInMillis; - } - - public long getEnqueueTime() - { - return enqueueTime; - } - - public String getName() { return "ListenerThread"; } - - //////////////////////////////////////////////////// - // - // Implementation. - // - - private void dprint(String msg) - { - ORBUtility.dprint("ListenerThreadImpl", msg); - } - - private void dprint(String msg, Throwable t) - { - dprint(msg); - t.printStackTrace(System.out); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReadTCPTimeoutsImpl.java 2018-01-30 20:20:49.000000000 -0500 +++ /dev/null 2018-01-30 20:20:49.000000000 -0500 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.impl.transport; - -import com.sun.corba.se.spi.transport.ReadTimeouts; - -/** - * @author Charlie Hunt - */ -public class ReadTCPTimeoutsImpl implements ReadTimeouts -{ - private int initial_time_to_wait; - private int max_time_to_wait; - private int max_giop_header_time_to_wait; - private double backoff_factor; - - // constructor - public ReadTCPTimeoutsImpl(int initial_time, - int max_time, - int max_giop_header_time, - int backoff_percent) { - this.initial_time_to_wait = initial_time; - this.max_time_to_wait = max_time; - this.max_giop_header_time_to_wait = max_giop_header_time; - this.backoff_factor = 1 + (double)(backoff_percent)/100; - } - - public int get_initial_time_to_wait() { return initial_time_to_wait; } - public int get_max_time_to_wait() { return max_time_to_wait; } - public double get_backoff_factor() { return backoff_factor; } - public int get_max_giop_header_time_to_wait() { - return max_giop_header_time_to_wait; } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReaderThreadImpl.java 2018-01-30 20:20:50.000000000 -0500 +++ /dev/null 2018-01-30 20:20:50.000000000 -0500 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.transport; - -import java.io.IOException; - -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ReaderThread; -import com.sun.corba.se.pept.transport.Selector; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orbutil.threadpool.Work; - -import com.sun.corba.se.impl.orbutil.ORBUtility; - -public class ReaderThreadImpl - implements - ReaderThread, - Work -{ - private ORB orb; - private Connection connection; - private Selector selector; - private boolean keepRunning; - private long enqueueTime; - - public ReaderThreadImpl(ORB orb, - Connection connection, Selector selector) - { - this.orb = orb; - this.connection = connection; - this.selector = selector; - keepRunning = true; - } - - //////////////////////////////////////////////////// - // - // ReaderThread methods. - // - - public Connection getConnection() - { - return connection; - } - - public void close() - { - if (orb.transportDebugFlag) { - dprint(".close: " + connection); - } - - keepRunning = false; - } - - //////////////////////////////////////////////////// - // - // Work methods. - // - - // REVISIT - this needs alot more from previous ReaderThread. - public void doWork() - { - try { - if (orb.transportDebugFlag) { - dprint(".doWork: Start ReaderThread: " + connection); - } - while (keepRunning) { - try { - - if (orb.transportDebugFlag) { - dprint(".doWork: Start ReaderThread cycle: " - + connection); - } - - if (connection.read()) { - // REVISIT - put in pool; - return; - } - - if (orb.transportDebugFlag) { - dprint(".doWork: End ReaderThread cycle: " - + connection); - } - - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".doWork: exception in read: " + connection,t); - } - orb.getTransportManager().getSelector(0) - .unregisterForEvent(getConnection().getEventHandler()); - getConnection().close(); - } - } - } finally { - if (orb.transportDebugFlag) { - dprint(".doWork: Terminated ReaderThread: " + connection); - } - } - } - - public void setEnqueueTime(long timeInMillis) - { - enqueueTime = timeInMillis; - } - - public long getEnqueueTime() - { - return enqueueTime; - } - - public String getName() { return "ReaderThread"; } - - //////////////////////////////////////////////////// - // - // Implementation. - // - - private void dprint(String msg) - { - ORBUtility.dprint("ReaderThreadImpl", msg); - } - - protected void dprint(String msg, Throwable t) - { - dprint(msg); - t.printStackTrace(System.out); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java 2018-01-30 20:20:50.000000000 -0500 +++ /dev/null 2018-01-30 20:20:51.000000000 -0500 @@ -1,615 +0,0 @@ -/* - * Copyright (c) 2003, 2015, 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.corba.se.impl.transport; - -import java.io.IOException; -import java.net.ServerSocket; -import java.nio.channels.ClosedChannelException; -import java.nio.channels.SelectableChannel; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SelectionKey; -import java.nio.channels.Selector; -import java.nio.channels.ClosedSelectorException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import java.util.Iterator; -import java.util.List; - - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.EventHandler; -import com.sun.corba.se.pept.transport.ListenerThread; -import com.sun.corba.se.pept.transport.ReaderThread; - -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orbutil.threadpool.Work; -import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException; -import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.orbutil.ORBUtility; - -/** - * @author Harold Carr - */ -class SelectorImpl - extends - Thread - implements - com.sun.corba.se.pept.transport.Selector -{ - private ORB orb; - private Selector selector; - private long timeout; - private List deferredRegistrations; - private List interestOpsList; - private HashMap listenerThreads; - private Map readerThreads; - private boolean selectorStarted; - private volatile boolean closed; - private ORBUtilSystemException wrapper; - - - public SelectorImpl(ORB orb) - { - super(null, null, "ORB-Selector-Thread", 0, false); - this.orb = orb; - selector = null; - selectorStarted = false; - timeout = 60000; - deferredRegistrations = new ArrayList(); - interestOpsList = new ArrayList(); - listenerThreads = new HashMap(); - readerThreads = java.util.Collections.synchronizedMap(new HashMap()); - closed = false; - wrapper = ORBUtilSystemException.get(orb,CORBALogDomains.RPC_TRANSPORT); - } - - public void setTimeout(long timeout) - { - this.timeout = timeout; - } - - public long getTimeout() - { - return timeout; - } - - public void registerInterestOps(EventHandler eventHandler) - { - if (orb.transportDebugFlag) { - dprint(".registerInterestOps:-> " + eventHandler); - } - - SelectionKey selectionKey = eventHandler.getSelectionKey(); - if (selectionKey.isValid()) { - int ehOps = eventHandler.getInterestOps(); - SelectionKeyAndOp keyAndOp = new SelectionKeyAndOp(selectionKey, ehOps); - synchronized(interestOpsList) { - interestOpsList.add(keyAndOp); - } - // tell Selector Thread there's an update to a SelectorKey's Ops - try { - if (selector != null) { - // wakeup Selector thread to process close request - selector.wakeup(); - } - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".registerInterestOps: selector.wakeup: ", t); - } - } - } - else { - wrapper.selectionKeyInvalid(eventHandler.toString()); - if (orb.transportDebugFlag) { - dprint(".registerInterestOps: EventHandler SelectionKey not valid " + eventHandler); - } - } - - if (orb.transportDebugFlag) { - dprint(".registerInterestOps:<- "); - } - } - - public void registerForEvent(EventHandler eventHandler) - { - if (orb.transportDebugFlag) { - dprint(".registerForEvent: " + eventHandler); - } - - if (isClosed()) { - if (orb.transportDebugFlag) { - dprint(".registerForEvent: closed: " + eventHandler); - } - return; - } - - if (eventHandler.shouldUseSelectThreadToWait()) { - synchronized (deferredRegistrations) { - deferredRegistrations.add(eventHandler); - } - if (! selectorStarted) { - startSelector(); - } - selector.wakeup(); - return; - } - - switch (eventHandler.getInterestOps()) { - case SelectionKey.OP_ACCEPT : - createListenerThread(eventHandler); - break; - case SelectionKey.OP_READ : - createReaderThread(eventHandler); - break; - default: - if (orb.transportDebugFlag) { - dprint(".registerForEvent: default: " + eventHandler); - } - throw new RuntimeException( - "SelectorImpl.registerForEvent: unknown interest ops"); - } - } - - public void unregisterForEvent(EventHandler eventHandler) - { - if (orb.transportDebugFlag) { - dprint(".unregisterForEvent: " + eventHandler); - } - - if (isClosed()) { - if (orb.transportDebugFlag) { - dprint(".unregisterForEvent: closed: " + eventHandler); - } - return; - } - - if (eventHandler.shouldUseSelectThreadToWait()) { - SelectionKey selectionKey ; - synchronized(deferredRegistrations) { - selectionKey = eventHandler.getSelectionKey(); - } - if (selectionKey != null) { - selectionKey.cancel(); - } - if (selector != null) { - selector.wakeup(); - } - return; - } - - switch (eventHandler.getInterestOps()) { - case SelectionKey.OP_ACCEPT : - destroyListenerThread(eventHandler); - break; - case SelectionKey.OP_READ : - destroyReaderThread(eventHandler); - break; - default: - if (orb.transportDebugFlag) { - dprint(".unregisterForEvent: default: " + eventHandler); - } - throw new RuntimeException( - "SelectorImpl.uregisterForEvent: unknown interest ops"); - } - } - - public void close() - { - if (orb.transportDebugFlag) { - dprint(".close"); - } - - if (isClosed()) { - if (orb.transportDebugFlag) { - dprint(".close: already closed"); - } - return; - } - - setClosed(true); - - Iterator i; - - // Kill listeners. - - i = listenerThreads.values().iterator(); - while (i.hasNext()) { - ListenerThread listenerThread = (ListenerThread) i.next(); - listenerThread.close(); - } - - // Kill readers. - - i = readerThreads.values().iterator(); - while (i.hasNext()) { - ReaderThread readerThread = (ReaderThread) i.next(); - readerThread.close(); - } - - clearDeferredRegistrations(); - - // Selector - - try { - if (selector != null) { - // wakeup Selector thread to process close request - selector.wakeup(); - } - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".close: selector.wakeup: ", t); - } - } - } - - /////////////////////////////////////////////////// - // - // Thread methods. - // - - public void run() - { - while (!closed) { - try { - int n = 0; - if (timeout == 0 && orb.transportDebugFlag) { - dprint(".run: Beginning of selection cycle"); - } - handleDeferredRegistrations(); - enableInterestOps(); - try { - n = selector.select(timeout); - } catch (IOException e) { - if (orb.transportDebugFlag) { - dprint(".run: selector.select: ", e); - } - } catch (ClosedSelectorException csEx) { - if (orb.transportDebugFlag) { - dprint(".run: selector.select: ", csEx); - } - break; - } - if (closed) { - break; - } - /* - if (timeout == 0 && orb.transportDebugFlag) { - dprint(".run: selector.select() returned: " + n); - } - if (n == 0) { - continue; - } - */ - Iterator iterator = selector.selectedKeys().iterator(); - if (orb.transportDebugFlag) { - if (iterator.hasNext()) { - dprint(".run: n = " + n); - } - } - while (iterator.hasNext()) { - SelectionKey selectionKey = (SelectionKey) iterator.next(); - iterator.remove(); - EventHandler eventHandler = (EventHandler) - selectionKey.attachment(); - try { - eventHandler.handleEvent(); - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".run: eventHandler.handleEvent", t); - } - } - } - if (timeout == 0 && orb.transportDebugFlag) { - dprint(".run: End of selection cycle"); - } - } catch (Throwable t) { - // IMPORTANT: ignore all errors so the select thread keeps running. - // Otherwise a guaranteed hang. - if (orb.transportDebugFlag) { - dprint(".run: ignoring", t); - } - } - } - try { - if (selector != null) { - if (orb.transportDebugFlag) { - dprint(".run: selector.close "); - } - selector.close(); - } - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".run: selector.close: ", t); - } - } - } - - ///////////////////////////////////////////////////// - // - // Implementation. - // - - private void clearDeferredRegistrations() { - synchronized (deferredRegistrations) { - int deferredListSize = deferredRegistrations.size(); - if (orb.transportDebugFlag) { - dprint(".clearDeferredRegistrations:deferred list size == " + deferredListSize); - } - for (int i = 0; i < deferredListSize; i++) { - EventHandler eventHandler = - (EventHandler)deferredRegistrations.get(i); - if (orb.transportDebugFlag) { - dprint(".clearDeferredRegistrations: " + eventHandler); - } - SelectableChannel channel = eventHandler.getChannel(); - SelectionKey selectionKey = null; - - try { - if (orb.transportDebugFlag) { - dprint(".clearDeferredRegistrations:close channel == " - + channel); - dprint(".clearDeferredRegistrations:close channel class == " - + channel.getClass().getName()); - } - channel.close(); - selectionKey = eventHandler.getSelectionKey(); - if (selectionKey != null) { - selectionKey.cancel(); - selectionKey.attach(null); - } - } catch (IOException ioEx) { - if (orb.transportDebugFlag) { - dprint(".clearDeferredRegistrations: ", ioEx); - } - } - } - deferredRegistrations.clear(); - } - } - - private synchronized boolean isClosed () - { - return closed; - } - - private synchronized void setClosed(boolean closed) - { - this.closed = closed; - } - - private void startSelector() - { - try { - selector = Selector.open(); - } catch (IOException e) { - if (orb.transportDebugFlag) { - dprint(".startSelector: Selector.open: IOException: ", e); - } - // REVISIT - better handling/reporting - RuntimeException rte = - new RuntimeException(".startSelector: Selector.open exception"); - rte.initCause(e); - throw rte; - } - setDaemon(true); - start(); - selectorStarted = true; - if (orb.transportDebugFlag) { - dprint(".startSelector: selector.start completed."); - } - } - - private void handleDeferredRegistrations() - { - synchronized (deferredRegistrations) { - int deferredListSize = deferredRegistrations.size(); - for (int i = 0; i < deferredListSize; i++) { - EventHandler eventHandler = - (EventHandler)deferredRegistrations.get(i); - if (orb.transportDebugFlag) { - dprint(".handleDeferredRegistrations: " + eventHandler); - } - SelectableChannel channel = eventHandler.getChannel(); - SelectionKey selectionKey = null; - try { - selectionKey = - channel.register(selector, - eventHandler.getInterestOps(), - (Object)eventHandler); - } catch (ClosedChannelException e) { - if (orb.transportDebugFlag) { - dprint(".handleDeferredRegistrations: ", e); - } - } - eventHandler.setSelectionKey(selectionKey); - } - deferredRegistrations.clear(); - } - } - - private void enableInterestOps() - { - synchronized (interestOpsList) { - int listSize = interestOpsList.size(); - if (listSize > 0) { - if (orb.transportDebugFlag) { - dprint(".enableInterestOps:->"); - } - SelectionKey selectionKey = null; - SelectionKeyAndOp keyAndOp = null; - int keyOp, selectionKeyOps = 0; - for (int i = 0; i < listSize; i++) { - keyAndOp = (SelectionKeyAndOp)interestOpsList.get(i); - selectionKey = keyAndOp.selectionKey; - - // Need to check if the SelectionKey is valid because a - // connection's SelectionKey could be put on the list to - // have its OP enabled and before it's enabled be reclaimed. - // Otherwise, the enabling of the OP will throw an exception - // here and exit this method an potentially not enable all - // registered ops. - // - // So, we ignore SelectionKeys that are invalid. They will get - // cleaned up on the next Selector.select() call. - - if (selectionKey.isValid()) { - if (orb.transportDebugFlag) { - dprint(".enableInterestOps: " + keyAndOp); - } - keyOp = keyAndOp.keyOp; - selectionKeyOps = selectionKey.interestOps(); - selectionKey.interestOps(selectionKeyOps | keyOp); - } - } - interestOpsList.clear(); - if (orb.transportDebugFlag) { - dprint(".enableInterestOps:<-"); - } - } - } - } - - private void createListenerThread(EventHandler eventHandler) - { - if (orb.transportDebugFlag) { - dprint(".createListenerThread: " + eventHandler); - } - Acceptor acceptor = eventHandler.getAcceptor(); - ListenerThread listenerThread = - new ListenerThreadImpl(orb, acceptor, this); - listenerThreads.put(eventHandler, listenerThread); - Throwable throwable = null; - try { - orb.getThreadPoolManager().getThreadPool(0) - .getWorkQueue(0).addWork((Work)listenerThread); - } catch (NoSuchThreadPoolException e) { - throwable = e; - } catch (NoSuchWorkQueueException e) { - throwable = e; - } - if (throwable != null) { - RuntimeException rte = new RuntimeException(throwable.toString()); - rte.initCause(throwable); - throw rte; - } - } - - private void destroyListenerThread(EventHandler eventHandler) - { - if (orb.transportDebugFlag) { - dprint(".destroyListenerThread: " + eventHandler); - } - ListenerThread listenerThread = (ListenerThread) - listenerThreads.get(eventHandler); - if (listenerThread == null) { - if (orb.transportDebugFlag) { - dprint(".destroyListenerThread: cannot find ListenerThread - ignoring."); - } - return; - } - listenerThreads.remove(eventHandler); - listenerThread.close(); - } - - private void createReaderThread(EventHandler eventHandler) - { - if (orb.transportDebugFlag) { - dprint(".createReaderThread: " + eventHandler); - } - Connection connection = eventHandler.getConnection(); - ReaderThread readerThread = - new ReaderThreadImpl(orb, connection, this); - readerThreads.put(eventHandler, readerThread); - Throwable throwable = null; - try { - orb.getThreadPoolManager().getThreadPool(0) - .getWorkQueue(0).addWork((Work)readerThread); - } catch (NoSuchThreadPoolException e) { - throwable = e; - } catch (NoSuchWorkQueueException e) { - throwable = e; - } - if (throwable != null) { - RuntimeException rte = new RuntimeException(throwable.toString()); - rte.initCause(throwable); - throw rte; - } - } - - private void destroyReaderThread(EventHandler eventHandler) - { - if (orb.transportDebugFlag) { - dprint(".destroyReaderThread: " + eventHandler); - } - ReaderThread readerThread = (ReaderThread) - readerThreads.get(eventHandler); - if (readerThread == null) { - if (orb.transportDebugFlag) { - dprint(".destroyReaderThread: cannot find ReaderThread - ignoring."); - } - return; - } - readerThreads.remove(eventHandler); - readerThread.close(); - } - - private void dprint(String msg) - { - ORBUtility.dprint("SelectorImpl", msg); - } - - protected void dprint(String msg, Throwable t) - { - dprint(msg); - t.printStackTrace(System.out); - } - - // Private class to contain a SelectionKey and a SelectionKey op. - // Used only by SelectorImpl to register and enable SelectionKey - // Op. - // REVISIT - Could do away with this class and use the EventHanlder - // directly. - private class SelectionKeyAndOp - { - // A SelectionKey.[OP_READ|OP_WRITE|OP_ACCEPT|OP_CONNECT] - public int keyOp; - public SelectionKey selectionKey; - - // constructor - public SelectionKeyAndOp(SelectionKey selectionKey, int keyOp) { - this.selectionKey = selectionKey; - this.keyOp = keyOp; - } - } - -// End of file. -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java 2018-01-30 20:20:51.000000000 -0500 +++ /dev/null 2018-01-30 20:20:51.000000000 -0500 @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.impl.transport; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ContactInfo; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.transport.CorbaContactInfoList; - -import com.sun.corba.se.impl.encoding.BufferManagerFactory; -import com.sun.corba.se.impl.encoding.CDROutputObject; -import com.sun.corba.se.impl.encoding.CDROutputStream; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl; -import com.sun.corba.se.impl.protocol.SharedCDRClientRequestDispatcherImpl; - -public class SharedCDRContactInfoImpl - extends - CorbaContactInfoBase -{ - // This is only necessary for the pi.clientrequestinfo test. - // It tests that request ids are different. - // Rather than rewrite the test, just fake it. - private static int requestId = 0; - - protected ORBUtilSystemException wrapper; - - public SharedCDRContactInfoImpl( - ORB orb, - CorbaContactInfoList contactInfoList, - IOR effectiveTargetIOR, - short addressingDisposition) - { - this.orb = orb; - this.contactInfoList = contactInfoList; - this.effectiveTargetIOR = effectiveTargetIOR; - this.addressingDisposition = addressingDisposition; - } - - //////////////////////////////////////////////////// - // - // pept.transport.ContactInfo - // - - public ClientRequestDispatcher getClientRequestDispatcher() - { - // REVISIT - use registry - return new SharedCDRClientRequestDispatcherImpl(); - } - - public boolean isConnectionBased() - { - return false; - } - - public boolean shouldCacheConnection() - { - return false; - } - - public String getConnectionCacheType() - { - throw getWrapper().methodShouldNotBeCalled(); - } - - public Connection createConnection() - { - throw getWrapper().methodShouldNotBeCalled(); - } - - // Called when client making an invocation. - public MessageMediator createMessageMediator(Broker broker, - ContactInfo contactInfo, - Connection connection, - String methodName, - boolean isOneWay) - { - if (connection != null) { - /// XXX LOGGING - throw new RuntimeException("connection is not null"); - } - - CorbaMessageMediator messageMediator = - new CorbaMessageMediatorImpl( - (ORB) broker, - contactInfo, - null, // Connection; - GIOPVersion.chooseRequestVersion( (ORB)broker, - effectiveTargetIOR), - effectiveTargetIOR, - requestId++, // Fake RequestId - getAddressingDisposition(), - methodName, - isOneWay); - - return messageMediator; - } - - public OutputObject createOutputObject(MessageMediator messageMediator) - { - CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator) - messageMediator; - // NOTE: GROW. - OutputObject outputObject = - sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator, - corbaMessageMediator.getRequestHeader(), - corbaMessageMediator.getStreamFormatVersion(), - BufferManagerFactory.GROW); - messageMediator.setOutputObject(outputObject); - return outputObject; - } - - //////////////////////////////////////////////////// - // - // spi.transport.CorbaContactInfo - // - - public String getMonitoringName() - { - throw getWrapper().methodShouldNotBeCalled(); - } - - //////////////////////////////////////////////////// - // - // java.lang.Object - // - - //////////////////////////////////////////////////// - // - // java.lang.Object - // - - public String toString() - { - return - "SharedCDRContactInfoImpl[" - + "]"; - } - - ////////////////////////////////////////////////// - // - // Implementation - // - - protected ORBUtilSystemException getWrapper() - { - if (wrapper == null) { - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_TRANSPORT ) ; - } - return wrapper; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java 2018-01-30 20:20:52.000000000 -0500 +++ /dev/null 2018-01-30 20:20:52.000000000 -0500 @@ -1,664 +0,0 @@ -/* - * Copyright (c) 2001, 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.corba.se.impl.transport; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.ServerSocket; -import java.net.Socket; -import java.nio.channels.SelectableChannel; -import java.nio.channels.SelectionKey; -import java.nio.channels.ServerSocketChannel; -import java.nio.channels.SocketChannel; -import java.util.Iterator; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.EventHandler; -import com.sun.corba.se.pept.transport.InboundConnectionCache; -import com.sun.corba.se.pept.transport.Selector; - -import com.sun.corba.se.spi.extension.RequestPartitioningPolicy; -import com.sun.corba.se.spi.ior.IORTemplate; -import com.sun.corba.se.spi.ior.TaggedProfileTemplate; -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.iiop.IIOPFactories; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orbutil.threadpool.Work; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.transport.CorbaAcceptor; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.transport.SocketInfo; -import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor; - -import com.sun.corba.se.impl.encoding.CDRInputObject; -import com.sun.corba.se.impl.encoding.CDROutputObject; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.oa.poa.Policies; // REVISIT impl/poa specific -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; - -// BEGIN Legacy support. -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo; -// END Legacy support. - -/** - * @author Harold Carr - */ -public class SocketOrChannelAcceptorImpl - extends - EventHandlerBase - implements - CorbaAcceptor, - SocketOrChannelAcceptor, - Work, - // BEGIN Legacy - SocketInfo, - LegacyServerSocketEndPointInfo - // END Legacy -{ - protected ServerSocketChannel serverSocketChannel; - protected ServerSocket serverSocket; - protected int port; - protected long enqueueTime; - protected boolean initialized; - protected ORBUtilSystemException wrapper ; - protected InboundConnectionCache connectionCache; - - // BEGIN Legacy - protected String type = ""; - protected String name = ""; - protected String hostname; - protected int locatorPort; - // END Legacy - - public SocketOrChannelAcceptorImpl(ORB orb) - { - this.orb = orb; - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_TRANSPORT ) ; - - setWork(this); - initialized = false; - - // BEGIN Legacy support. - this.hostname = orb.getORBData().getORBServerHost(); - this.name = LegacyServerSocketEndPointInfo.NO_NAME; - this.locatorPort = -1; - // END Legacy support. - } - - public SocketOrChannelAcceptorImpl(ORB orb, int port) - { - this(orb); - this.port = port; - } - - // BEGIN Legacy support. - public SocketOrChannelAcceptorImpl(ORB orb, int port, - String name, String type) - { - this(orb, port); - this.name = name; - this.type = type; - } - // END Legacy support. - - //////////////////////////////////////////////////// - // - // pept.transport.Acceptor - // - - public boolean initialize() - { - if (initialized) { - return false; - } - if (orb.transportDebugFlag) { - dprint(".initialize: " + this); - } - InetSocketAddress inetSocketAddress = null; - try { - if (orb.getORBData().getListenOnAllInterfaces().equals(ORBConstants.LISTEN_ON_ALL_INTERFACES)) { - inetSocketAddress = new InetSocketAddress(port); - } else { - String host = orb.getORBData().getORBServerHost(); - inetSocketAddress = new InetSocketAddress(host, port); - } - serverSocket = orb.getORBData().getSocketFactory() - .createServerSocket(type, inetSocketAddress); - internalInitialize(); - } catch (Throwable t) { - throw wrapper.createListenerFailed( t, Integer.toString(port) ) ; - } - initialized = true; - return true; - } - - protected void internalInitialize() - throws Exception - { - // Determine the listening port (for the IOR). - // This is important when using emphemeral ports (i.e., - // when the port value to the constructor is 0). - - port = serverSocket.getLocalPort(); - - // Register with transport (also sets up monitoring). - - orb.getCorbaTransportManager().getInboundConnectionCache(this); - - // Finish configuation. - - serverSocketChannel = serverSocket.getChannel(); - - if (serverSocketChannel != null) { - setUseSelectThreadToWait( - orb.getORBData().acceptorSocketUseSelectThreadToWait()); - serverSocketChannel.configureBlocking( - ! orb.getORBData().acceptorSocketUseSelectThreadToWait()); - } else { - // Configure to use listener and reader threads. - setUseSelectThreadToWait(false); - } - setUseWorkerThreadForEvent( - orb.getORBData().acceptorSocketUseWorkerThreadForEvent()); - - } - - public boolean initialized() - { - return initialized; - } - - public String getConnectionCacheType() - { - return this.getClass().toString(); - } - - public void setConnectionCache(InboundConnectionCache connectionCache) - { - this.connectionCache = connectionCache; - } - - public InboundConnectionCache getConnectionCache() - { - return connectionCache; - } - - public boolean shouldRegisterAcceptEvent() - { - return true; - } - - public void accept() - { - try { - SocketChannel socketChannel = null; - Socket socket = null; - if (serverSocketChannel == null) { - socket = serverSocket.accept(); - } else { - socketChannel = serverSocketChannel.accept(); - socket = socketChannel.socket(); - } - orb.getORBData().getSocketFactory() - .setAcceptedSocketOptions(this, serverSocket, socket); - if (orb.transportDebugFlag) { - dprint(".accept: " + - (serverSocketChannel == null - ? serverSocket.toString() - : serverSocketChannel.toString())); - } - - CorbaConnection connection = - new SocketOrChannelConnectionImpl(orb, this, socket); - if (orb.transportDebugFlag) { - dprint(".accept: new: " + connection); - } - - // NOTE: The connection MUST be put in the cache BEFORE being - // registered with the selector. Otherwise if the bytes - // are read on the connection it will attempt a time stamp - // but the cache will be null, resulting in NPE. - - // A connection needs to be timestamped before putting to the cache. - // Otherwise the newly created connection (with 0 timestamp) could be - // incorrectly reclaimed by concurrent reclaim() call OR if there - // will be no events on this connection then it could be reclaimed - // by upcoming reclaim() call. - getConnectionCache().stampTime(connection); - getConnectionCache().put(this, connection); - - if (connection.shouldRegisterServerReadEvent()) { - Selector selector = orb.getTransportManager().getSelector(0); - if (selector != null) { - if (orb.transportDebugFlag) { - dprint(".accept: registerForEvent: " + connection); - } - selector.registerForEvent(connection.getEventHandler()); - } - } - - getConnectionCache().reclaim(); - - } catch (IOException e) { - if (orb.transportDebugFlag) { - dprint(".accept:", e); - } - Selector selector = orb.getTransportManager().getSelector(0); - if (selector != null) { - selector.unregisterForEvent(this); - // REVISIT - need to close - recreate - then register new one. - selector.registerForEvent(this); - // NOTE: if register cycling we do not want to shut down ORB - // since local beans will still work. Instead one will see - // a growing log file to alert admin of problem. - } - } - } - - public void close () - { - try { - if (orb.transportDebugFlag) { - dprint(".close->:"); - } - Selector selector = orb.getTransportManager().getSelector(0); - if (selector != null) { - selector.unregisterForEvent(this); - } - if (serverSocketChannel != null) { - serverSocketChannel.close(); - } - if (serverSocket != null) { - serverSocket.close(); - } - } catch (IOException e) { - if (orb.transportDebugFlag) { - dprint(".close:", e); - } - } finally { - if (orb.transportDebugFlag) { - dprint(".close<-:"); - } - } - } - - public EventHandler getEventHandler() - { - return this; - } - - //////////////////////////////////////////////////// - // - // CorbaAcceptor - // - - public String getObjectAdapterId() - { - return null; - } - - public String getObjectAdapterManagerId() - { - return null; - } - - public void addToIORTemplate(IORTemplate iorTemplate, - Policies policies, - String codebase) - { - Iterator iterator = iorTemplate.iteratorById( - org.omg.IOP.TAG_INTERNET_IOP.value); - - String hostname = orb.getORBData().getORBServerHost(); - - if (iterator.hasNext()) { - // REVISIT - how does this play with legacy ORBD port exchange? - IIOPAddress iiopAddress = - IIOPFactories.makeIIOPAddress(orb, hostname, port); - AlternateIIOPAddressComponent iiopAddressComponent = - IIOPFactories.makeAlternateIIOPAddressComponent(iiopAddress); - - while (iterator.hasNext()) { - TaggedProfileTemplate taggedProfileTemplate = - (TaggedProfileTemplate) iterator.next(); - taggedProfileTemplate.add(iiopAddressComponent); - } - } else { - GIOPVersion version = orb.getORBData().getGIOPVersion(); - int templatePort; - if (policies.forceZeroPort()) { - templatePort = 0; - } else if (policies.isTransient()) { - templatePort = port; - } else { - templatePort = orb.getLegacyServerSocketManager() - .legacyGetPersistentServerPort(SocketInfo.IIOP_CLEAR_TEXT); - } - IIOPAddress addr = - IIOPFactories.makeIIOPAddress(orb, hostname, templatePort); - IIOPProfileTemplate iiopProfile = - IIOPFactories.makeIIOPProfileTemplate(orb, version, addr); - if (version.supportsIORIIOPProfileComponents()) { - iiopProfile.add(IIOPFactories.makeCodeSetsComponent(orb)); - iiopProfile.add(IIOPFactories.makeMaxStreamFormatVersionComponent()); - RequestPartitioningPolicy rpPolicy = (RequestPartitioningPolicy) - policies.get_effective_policy( - ORBConstants.REQUEST_PARTITIONING_POLICY); - if (rpPolicy != null) { - iiopProfile.add( - IIOPFactories.makeRequestPartitioningComponent( - rpPolicy.getValue())); - } - if (codebase != null && codebase != "") { - iiopProfile.add(IIOPFactories. makeJavaCodebaseComponent(codebase)); - } - if (orb.getORBData().isJavaSerializationEnabled()) { - iiopProfile.add( - IIOPFactories.makeJavaSerializationComponent()); - } - } - iorTemplate.add(iiopProfile); - } - } - - public String getMonitoringName() - { - return "AcceptedConnections"; - } - - //////////////////////////////////////////////////// - // - // EventHandler methods - // - - public SelectableChannel getChannel() - { - return serverSocketChannel; - } - - public int getInterestOps() - { - return SelectionKey.OP_ACCEPT; - } - - public Acceptor getAcceptor() - { - return this; - } - - public Connection getConnection() - { - throw new RuntimeException("Should not happen."); - } - - //////////////////////////////////////////////////// - // - // Work methods. - // - - /* CONFLICT: with legacy below. - public String getName() - { - return this.toString(); - } - */ - - public void doWork() - { - try { - if (orb.transportDebugFlag) { - dprint(".doWork->: " + this); - } - if (selectionKey.isAcceptable()) { - accept(); - } else { - if (orb.transportDebugFlag) { - dprint(".doWork: ! selectionKey.isAcceptable: " + this); - } - } - } catch (SecurityException se) { - if (orb.transportDebugFlag) { - dprint(".doWork: ignoring SecurityException: " - + se - + " " + this); - } - String permissionStr = ORBUtility.getClassSecurityInfo(getClass()); - wrapper.securityExceptionInAccept(se, permissionStr); - } catch (Exception ex) { - if (orb.transportDebugFlag) { - dprint(".doWork: ignoring Exception: " - + ex - + " " + this); - } - wrapper.exceptionInAccept(ex); - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".doWork: ignoring Throwable: " - + t - + " " + this); - } - } finally { - - // IMPORTANT: To avoid bug (4953599), we force the - // Thread that does the NIO select to also do the - // enable/disable of Ops using SelectionKey.interestOps(). - // Otherwise, the SelectionKey.interestOps() may block - // indefinitely. - // NOTE: If "acceptorSocketUseWorkerThreadForEvent" is - // set to to false in ParserTable.java, then this method, - // doWork(), will get executed by the same thread - // (SelectorThread) that does the NIO select. - // If "acceptorSocketUseWorkerThreadForEvent" is set - // to true, a WorkerThread will execute this method, - // doWork(). Hence, the registering of the enabling of - // the SelectionKey's interestOps is done here instead - // of calling SelectionKey.interestOps(). - - Selector selector = orb.getTransportManager().getSelector(0); - if (selector != null) { - selector.registerInterestOps(this); - } - - if (orb.transportDebugFlag) { - dprint(".doWork<-:" + this); - } - } - } - - public void setEnqueueTime(long timeInMillis) - { - enqueueTime = timeInMillis; - } - - public long getEnqueueTime() - { - return enqueueTime; - } - - - // - // Factory methods. - // - - // REVISIT: refactor into common base or delegate. - public MessageMediator createMessageMediator(Broker broker, - Connection connection) - { - // REVISIT - no factoring so cheat to avoid code dup right now. - // REVISIT **** COUPLING !!!! - ContactInfo contactInfo = new SocketOrChannelContactInfoImpl(); - return contactInfo.createMessageMediator(broker, connection); - } - - // REVISIT: refactor into common base or delegate. - public MessageMediator finishCreatingMessageMediator(Broker broker, - Connection connection, - MessageMediator messageMediator) - { - // REVISIT - no factoring so cheat to avoid code dup right now. - // REVISIT **** COUPLING !!!! - ContactInfo contactInfo = new SocketOrChannelContactInfoImpl(); - return contactInfo.finishCreatingMessageMediator(broker, - connection, messageMediator); - } - - public InputObject createInputObject(Broker broker, - MessageMediator messageMediator) - { - CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator) - messageMediator; - return new CDRInputObject((ORB)broker, - (CorbaConnection)messageMediator.getConnection(), - corbaMessageMediator.getDispatchBuffer(), - corbaMessageMediator.getDispatchHeader()); - } - - public OutputObject createOutputObject(Broker broker, - MessageMediator messageMediator) - { - CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator) - messageMediator; - return sun.corba.OutputStreamFactory.newCDROutputObject((ORB) broker, - corbaMessageMediator, corbaMessageMediator.getReplyHeader(), - corbaMessageMediator.getStreamFormatVersion()); - } - - //////////////////////////////////////////////////// - // - // SocketOrChannelAcceptor - // - - public ServerSocket getServerSocket() - { - return serverSocket; - } - - //////////////////////////////////////////////////// - // - // Implementation. - // - - public String toString() - { - String sock; - if (serverSocketChannel == null) { - if (serverSocket == null) { - sock = "(not initialized)"; - } else { - sock = serverSocket.toString(); - } - } else { - sock = serverSocketChannel.toString(); - } - - return - toStringName() + - "[" - + sock + " " - + type + " " - + shouldUseSelectThreadToWait() + " " - + shouldUseWorkerThreadForEvent() - + "]" ; - } - - protected String toStringName() - { - return "SocketOrChannelAcceptorImpl"; - } - - protected void dprint(String msg) - { - ORBUtility.dprint(toStringName(), msg); - } - - protected void dprint(String msg, Throwable t) - { - dprint(msg); - t.printStackTrace(System.out); - } - - // BEGIN Legacy support - //////////////////////////////////////////////////// - // - // LegacyServerSocketEndPointInfo and EndPointInfo - // - - public String getType() - { - return type; - } - - public String getHostName() - { - return hostname; - } - - public String getHost() - { - return hostname; - } - - public int getPort() - { - return port; - } - - public int getLocatorPort() - { - return locatorPort; - } - - public void setLocatorPort (int port) - { - locatorPort = port; - } - - public String getName() - { - // Kluge alert: - // Work and Legacy both define getName. - // Try to make this behave best for most cases. - String result = - name.equals(LegacyServerSocketEndPointInfo.NO_NAME) ? - this.toString() : name; - return result; - } - // END Legacy support -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java 2018-01-30 20:20:53.000000000 -0500 +++ /dev/null 2018-01-30 20:20:53.000000000 -0500 @@ -1,1687 +0,0 @@ -/* - * Copyright (c) 2001, 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.corba.se.impl.transport; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.nio.ByteBuffer; -import java.nio.channels.SelectableChannel; -import java.nio.channels.SelectionKey; -import java.nio.channels.SocketChannel; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Collections; -import java.util.Hashtable; -import java.util.HashMap; -import java.util.Map; - -import org.omg.CORBA.COMM_FAILURE; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.DATA_CONVERSION; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.MARSHAL; -import org.omg.CORBA.OBJECT_NOT_EXIST; -import org.omg.CORBA.SystemException; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ConnectionCache; -import com.sun.corba.se.pept.transport.ContactInfo; -import com.sun.corba.se.pept.transport.EventHandler; -import com.sun.corba.se.pept.transport.InboundConnectionCache; -import com.sun.corba.se.pept.transport.OutboundConnectionCache; -import com.sun.corba.se.pept.transport.ResponseWaitingRoom; -import com.sun.corba.se.pept.transport.Selector; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.logging.CORBALogDomains; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException; -import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException; -import com.sun.corba.se.spi.orbutil.threadpool.Work; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; -import com.sun.corba.se.spi.transport.CorbaContactInfo; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom; -import com.sun.corba.se.spi.transport.ReadTimeouts; - -import com.sun.corba.se.impl.encoding.CachedCodeBase; -import com.sun.corba.se.impl.encoding.CDRInputStream_1_0; -import com.sun.corba.se.impl.encoding.CDROutputObject; -import com.sun.corba.se.impl.encoding.CDROutputStream_1_0; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; -import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; -import com.sun.corba.se.impl.transport.CorbaResponseWaitingRoomImpl; - -/** - * @author Harold Carr - */ -public class SocketOrChannelConnectionImpl - extends - EventHandlerBase - implements - CorbaConnection, - Work -{ - public static boolean dprintWriteLocks = false; - - // - // New transport. - // - - protected long enqueueTime; - - protected SocketChannel socketChannel; - public SocketChannel getSocketChannel() - { - return socketChannel; - } - - // REVISIT: - // protected for test: genericRPCMSGFramework.IIOPConnection constructor. - protected CorbaContactInfo contactInfo; - protected Acceptor acceptor; - protected ConnectionCache connectionCache; - - // - // From iiop.Connection.java - // - - protected Socket socket; // The socket used for this connection. - protected long timeStamp = 0; - protected boolean isServer = false; - - // Start at some value other than zero since this is a magic - // value in some protocols. - protected int requestId = 5; - protected CorbaResponseWaitingRoom responseWaitingRoom; - protected int state; - protected java.lang.Object stateEvent = new java.lang.Object(); - protected java.lang.Object writeEvent = new java.lang.Object(); - protected boolean writeLocked; - protected int serverRequestCount = 0; - - // Server request map: used on the server side of Connection - // Maps request ID to IIOPInputStream. - Map serverRequestMap = null; - - // This is a flag associated per connection telling us if the - // initial set of sending contexts were sent to the receiver - // already... - protected boolean postInitialContexts = false; - - // Remote reference to CodeBase server (supplies - // FullValueDescription, among other things) - protected IOR codeBaseServerIOR; - - // CodeBase cache for this connection. This will cache remote operations, - // handle connecting, and ensure we don't do any remote operations until - // necessary. - protected CachedCodeBase cachedCodeBase = new CachedCodeBase(this); - - protected ORBUtilSystemException wrapper ; - - // transport read timeout values - protected ReadTimeouts readTimeouts; - - protected boolean shouldReadGiopHeaderOnly; - - // A message mediator used when shouldReadGiopHeaderOnly is - // true to maintain request message state across execution in a - // SelectorThread and WorkerThread. - protected CorbaMessageMediator partialMessageMediator = null; - - // Used in genericRPCMSGFramework test. - protected SocketOrChannelConnectionImpl(ORB orb) - { - this.orb = orb; - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_TRANSPORT ) ; - - setWork(this); - responseWaitingRoom = new CorbaResponseWaitingRoomImpl(orb, this); - setReadTimeouts(orb.getORBData().getTransportTCPReadTimeouts()); - } - - // Both client and servers. - protected SocketOrChannelConnectionImpl(ORB orb, - boolean useSelectThreadToWait, - boolean useWorkerThread) - { - this(orb) ; - setUseSelectThreadToWait(useSelectThreadToWait); - setUseWorkerThreadForEvent(useWorkerThread); - } - - // Client constructor. - public SocketOrChannelConnectionImpl(ORB orb, - CorbaContactInfo contactInfo, - boolean useSelectThreadToWait, - boolean useWorkerThread, - String socketType, - String hostname, - int port) - { - this(orb, useSelectThreadToWait, useWorkerThread); - - this.contactInfo = contactInfo; - - try { - socket = orb.getORBData().getSocketFactory() - .createSocket(socketType, - new InetSocketAddress(hostname, port)); - socketChannel = socket.getChannel(); - - if (socketChannel != null) { - boolean isBlocking = !useSelectThreadToWait; - socketChannel.configureBlocking(isBlocking); - } else { - // IMPORTANT: non-channel-backed sockets must use - // dedicated reader threads. - setUseSelectThreadToWait(false); - } - if (orb.transportDebugFlag) { - dprint(".initialize: connection created: " + socket); - } - } catch (Throwable t) { - throw wrapper.connectFailure(t, socketType, hostname, - Integer.toString(port)); - } - state = OPENING; - } - - // Client-side convenience. - public SocketOrChannelConnectionImpl(ORB orb, - CorbaContactInfo contactInfo, - String socketType, - String hostname, - int port) - { - this(orb, contactInfo, - orb.getORBData().connectionSocketUseSelectThreadToWait(), - orb.getORBData().connectionSocketUseWorkerThreadForEvent(), - socketType, hostname, port); - } - - // Server-side constructor. - public SocketOrChannelConnectionImpl(ORB orb, - Acceptor acceptor, - Socket socket, - boolean useSelectThreadToWait, - boolean useWorkerThread) - { - this(orb, useSelectThreadToWait, useWorkerThread); - - this.socket = socket; - socketChannel = socket.getChannel(); - if (socketChannel != null) { - // REVISIT - try { - boolean isBlocking = !useSelectThreadToWait; - socketChannel.configureBlocking(isBlocking); - } catch (IOException e) { - RuntimeException rte = new RuntimeException(); - rte.initCause(e); - throw rte; - } - } - this.acceptor = acceptor; - - serverRequestMap = Collections.synchronizedMap(new HashMap()); - isServer = true; - - state = ESTABLISHED; - } - - // Server-side convenience - public SocketOrChannelConnectionImpl(ORB orb, - Acceptor acceptor, - Socket socket) - { - this(orb, acceptor, socket, - (socket.getChannel() == null - ? false - : orb.getORBData().connectionSocketUseSelectThreadToWait()), - (socket.getChannel() == null - ? false - : orb.getORBData().connectionSocketUseWorkerThreadForEvent())); - } - - //////////////////////////////////////////////////// - // - // framework.transport.Connection - // - - public boolean shouldRegisterReadEvent() - { - return true; - } - - public boolean shouldRegisterServerReadEvent() - { - return true; - } - - public boolean read() - { - try { - if (orb.transportDebugFlag) { - dprint(".read->: " + this); - } - CorbaMessageMediator messageMediator = readBits(); - if (messageMediator != null) { - // Null can happen when client closes stream - // causing purgecalls. - return dispatch(messageMediator); - } - return true; - } finally { - if (orb.transportDebugFlag) { - dprint(".read<-: " + this); - } - } - } - - protected CorbaMessageMediator readBits() - { - try { - - if (orb.transportDebugFlag) { - dprint(".readBits->: " + this); - } - - MessageMediator messageMediator; - // REVISIT - use common factory base class. - if (contactInfo != null) { - messageMediator = - contactInfo.createMessageMediator(orb, this); - } else if (acceptor != null) { - messageMediator = acceptor.createMessageMediator(orb, this); - } else { - throw - new RuntimeException("SocketOrChannelConnectionImpl.readBits"); - } - return (CorbaMessageMediator) messageMediator; - - } catch (ThreadDeath td) { - if (orb.transportDebugFlag) { - dprint(".readBits: " + this + ": ThreadDeath: " + td, td); - } - try { - purgeCalls(wrapper.connectionAbort(td), false, false); - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".readBits: " + this + ": purgeCalls: Throwable: " + t, t); - } - } - throw td; - } catch (Throwable ex) { - if (orb.transportDebugFlag) { - dprint(".readBits: " + this + ": Throwable: " + ex, ex); - } - - try { - if (ex instanceof INTERNAL) { - sendMessageError(GIOPVersion.DEFAULT_VERSION); - } - } catch (IOException e) { - if (orb.transportDebugFlag) { - dprint(".readBits: " + this + - ": sendMessageError: IOException: " + e, e); - } - } - // REVISIT - make sure reader thread is killed. - Selector selector = orb.getTransportManager().getSelector(0); - if (selector != null) { - selector.unregisterForEvent(this); - } - // Notify anyone waiting. - purgeCalls(wrapper.connectionAbort(ex), true, false); - // REVISIT - //keepRunning = false; - // REVISIT - if this is called after purgeCalls then - // the state of the socket is ABORT so the writeLock - // in close throws an exception. It is ignored but - // causes IBM (screen scraping) tests to fail. - //close(); - } finally { - if (orb.transportDebugFlag) { - dprint(".readBits<-: " + this); - } - } - return null; - } - - protected CorbaMessageMediator finishReadingBits(MessageMediator messageMediator) - { - try { - - if (orb.transportDebugFlag) { - dprint(".finishReadingBits->: " + this); - } - - // REVISIT - use common factory base class. - if (contactInfo != null) { - messageMediator = - contactInfo.finishCreatingMessageMediator(orb, this, messageMediator); - } else if (acceptor != null) { - messageMediator = - acceptor.finishCreatingMessageMediator(orb, this, messageMediator); - } else { - throw - new RuntimeException("SocketOrChannelConnectionImpl.finishReadingBits"); - } - return (CorbaMessageMediator) messageMediator; - - } catch (ThreadDeath td) { - if (orb.transportDebugFlag) { - dprint(".finishReadingBits: " + this + ": ThreadDeath: " + td, td); - } - try { - purgeCalls(wrapper.connectionAbort(td), false, false); - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".finishReadingBits: " + this + ": purgeCalls: Throwable: " + t, t); - } - } - throw td; - } catch (Throwable ex) { - if (orb.transportDebugFlag) { - dprint(".finishReadingBits: " + this + ": Throwable: " + ex, ex); - } - - try { - if (ex instanceof INTERNAL) { - sendMessageError(GIOPVersion.DEFAULT_VERSION); - } - } catch (IOException e) { - if (orb.transportDebugFlag) { - dprint(".finishReadingBits: " + this + - ": sendMessageError: IOException: " + e, e); - } - } - // REVISIT - make sure reader thread is killed. - orb.getTransportManager().getSelector(0).unregisterForEvent(this); - // Notify anyone waiting. - purgeCalls(wrapper.connectionAbort(ex), true, false); - // REVISIT - //keepRunning = false; - // REVISIT - if this is called after purgeCalls then - // the state of the socket is ABORT so the writeLock - // in close throws an exception. It is ignored but - // causes IBM (screen scraping) tests to fail. - //close(); - } finally { - if (orb.transportDebugFlag) { - dprint(".finishReadingBits<-: " + this); - } - } - return null; - } - - protected boolean dispatch(CorbaMessageMediator messageMediator) - { - try { - if (orb.transportDebugFlag) { - dprint(".dispatch->: " + this); - } - - // - // NOTE: - // - // This call is the transition from the tranport block - // to the protocol block. - // - - boolean result = - messageMediator.getProtocolHandler() - .handleRequest(messageMediator); - - return result; - - } catch (ThreadDeath td) { - if (orb.transportDebugFlag) { - dprint(".dispatch: ThreadDeath", td ); - } - try { - purgeCalls(wrapper.connectionAbort(td), false, false); - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".dispatch: purgeCalls: Throwable", t); - } - } - throw td; - } catch (Throwable ex) { - if (orb.transportDebugFlag) { - dprint(".dispatch: Throwable", ex ) ; - } - - try { - if (ex instanceof INTERNAL) { - sendMessageError(GIOPVersion.DEFAULT_VERSION); - } - } catch (IOException e) { - if (orb.transportDebugFlag) { - dprint(".dispatch: sendMessageError: IOException", e); - } - } - purgeCalls(wrapper.connectionAbort(ex), false, false); - // REVISIT - //keepRunning = false; - } finally { - if (orb.transportDebugFlag) { - dprint(".dispatch<-: " + this); - } - } - - return true; - } - - public boolean shouldUseDirectByteBuffers() - { - return getSocketChannel() != null; - } - - public ByteBuffer read(int size, int offset, int length, long max_wait_time) - throws IOException - { - if (shouldUseDirectByteBuffers()) { - - ByteBuffer byteBuffer = - orb.getByteBufferPool().getByteBuffer(size); - - if (orb.transportDebugFlag) { - // print address of ByteBuffer gotten from pool - int bbAddress = System.identityHashCode(byteBuffer); - StringBuffer sb = new StringBuffer(80); - sb.append(".read: got ByteBuffer id ("); - sb.append(bbAddress).append(") from ByteBufferPool."); - String msgStr = sb.toString(); - dprint(msgStr); - } - - byteBuffer.position(offset); - byteBuffer.limit(size); - - readFully(byteBuffer, length, max_wait_time); - - return byteBuffer; - } - - byte[] buf = new byte[size]; - readFully(getSocket().getInputStream(), buf, - offset, length, max_wait_time); - ByteBuffer byteBuffer = ByteBuffer.wrap(buf); - byteBuffer.limit(size); - return byteBuffer; - } - - public ByteBuffer read(ByteBuffer byteBuffer, int offset, - int length, long max_wait_time) - throws IOException - { - int size = offset + length; - if (shouldUseDirectByteBuffers()) { - - if (! byteBuffer.isDirect()) { - throw wrapper.unexpectedNonDirectByteBufferWithChannelSocket(); - } - if (size > byteBuffer.capacity()) { - if (orb.transportDebugFlag) { - // print address of ByteBuffer being released - int bbAddress = System.identityHashCode(byteBuffer); - StringBuffer bbsb = new StringBuffer(80); - bbsb.append(".read: releasing ByteBuffer id (") - .append(bbAddress).append(") to ByteBufferPool."); - String bbmsg = bbsb.toString(); - dprint(bbmsg); - } - orb.getByteBufferPool().releaseByteBuffer(byteBuffer); - byteBuffer = orb.getByteBufferPool().getByteBuffer(size); - } - byteBuffer.position(offset); - byteBuffer.limit(size); - readFully(byteBuffer, length, max_wait_time); - byteBuffer.position(0); - byteBuffer.limit(size); - return byteBuffer; - } - if (byteBuffer.isDirect()) { - throw wrapper.unexpectedDirectByteBufferWithNonChannelSocket(); - } - byte[] buf = new byte[size]; - readFully(getSocket().getInputStream(), buf, - offset, length, max_wait_time); - return ByteBuffer.wrap(buf); - } - - public void readFully(ByteBuffer byteBuffer, int size, long max_wait_time) - throws IOException - { - int n = 0; - int bytecount = 0; - long time_to_wait = readTimeouts.get_initial_time_to_wait(); - long total_time_in_wait = 0; - - // The reading of data incorporates a strategy to detect a - // rogue client. The strategy is implemented as follows. As - // long as data is being read, at least 1 byte or more, we - // assume we have a well behaved client. If no data is read, - // then we sleep for a time to wait, re-calculate a new time to - // wait which is lengthier than the previous time spent waiting. - // Then, if the total time spent waiting does not exceed a - // maximum time we are willing to wait, we attempt another - // read. If the maximum amount of time we are willing to - // spend waiting for more data is exceeded, we throw an - // IOException. - - // NOTE: Reading of GIOP headers are treated with a smaller - // maximum time to wait threshold. Based on extensive - // performance testing, all GIOP headers are being - // read in 1 read access. - - do { - bytecount = getSocketChannel().read(byteBuffer); - - if (bytecount < 0) { - throw new IOException("End-of-stream"); - } - else if (bytecount == 0) { - try { - Thread.sleep(time_to_wait); - total_time_in_wait += time_to_wait; - time_to_wait = - (long)(time_to_wait*readTimeouts.get_backoff_factor()); - } - catch (InterruptedException ie) { - // ignore exception - if (orb.transportDebugFlag) { - dprint("readFully(): unexpected exception " - + ie.toString()); - } - } - } - else { - n += bytecount; - } - } - while (n < size && total_time_in_wait < max_wait_time); - - if (n < size && total_time_in_wait >= max_wait_time) - { - // failed to read entire message - throw wrapper.transportReadTimeoutExceeded(new Integer(size), - new Integer(n), new Long(max_wait_time), - new Long(total_time_in_wait)); - } - - getConnectionCache().stampTime(this); - } - - // To support non-channel connections. - public void readFully(java.io.InputStream is, byte[] buf, - int offset, int size, long max_wait_time) - throws IOException - { - int n = 0; - int bytecount = 0; - long time_to_wait = readTimeouts.get_initial_time_to_wait(); - long total_time_in_wait = 0; - - // The reading of data incorporates a strategy to detect a - // rogue client. The strategy is implemented as follows. As - // long as data is being read, at least 1 byte or more, we - // assume we have a well behaved client. If no data is read, - // then we sleep for a time to wait, re-calculate a new time to - // wait which is lengthier than the previous time spent waiting. - // Then, if the total time spent waiting does not exceed a - // maximum time we are willing to wait, we attempt another - // read. If the maximum amount of time we are willing to - // spend waiting for more data is exceeded, we throw an - // IOException. - - // NOTE: Reading of GIOP headers are treated with a smaller - // maximum time to wait threshold. Based on extensive - // performance testing, all GIOP headers are being - // read in 1 read access. - - do { - bytecount = is.read(buf, offset + n, size - n); - if (bytecount < 0) { - throw new IOException("End-of-stream"); - } - else if (bytecount == 0) { - try { - Thread.sleep(time_to_wait); - total_time_in_wait += time_to_wait; - time_to_wait = - (long)(time_to_wait*readTimeouts.get_backoff_factor()); - } - catch (InterruptedException ie) { - // ignore exception - if (orb.transportDebugFlag) { - dprint("readFully(): unexpected exception " - + ie.toString()); - } - } - } - else { - n += bytecount; - } - } - while (n < size && total_time_in_wait < max_wait_time); - - if (n < size && total_time_in_wait >= max_wait_time) - { - // failed to read entire message - throw wrapper.transportReadTimeoutExceeded(new Integer(size), - new Integer(n), new Long(max_wait_time), - new Long(total_time_in_wait)); - } - - getConnectionCache().stampTime(this); - } - - public void write(ByteBuffer byteBuffer) - throws IOException - { - if (shouldUseDirectByteBuffers()) { - /* NOTE: cannot perform this test. If one ask for a - ByteBuffer from the pool which is bigger than the size - of ByteBuffers managed by the pool, then the pool will - return a HeapByteBuffer. - if (byteBuffer.hasArray()) { - throw wrapper.unexpectedNonDirectByteBufferWithChannelSocket(); - } - */ - // IMPORTANT: For non-blocking SocketChannels, there's no guarantee - // all bytes are written on first write attempt. - do { - getSocketChannel().write(byteBuffer); - } - while (byteBuffer.hasRemaining()); - - } else { - if (! byteBuffer.hasArray()) { - throw wrapper.unexpectedDirectByteBufferWithNonChannelSocket(); - } - byte[] tmpBuf = byteBuffer.array(); - getSocket().getOutputStream().write(tmpBuf, 0, byteBuffer.limit()); - getSocket().getOutputStream().flush(); - } - - // TimeStamp connection to indicate it has been used - // Note granularity of connection usage is assumed for - // now to be that of a IIOP packet. - getConnectionCache().stampTime(this); - } - - /** - * Note:it is possible for this to be called more than once - */ - public synchronized void close() - { - try { - if (orb.transportDebugFlag) { - dprint(".close->: " + this); - } - writeLock(); - - // REVISIT It will be good to have a read lock on the reader thread - // before we proceed further, to avoid the reader thread (server side) - // from processing requests. This avoids the risk that a new request - // will be accepted by ReaderThread while the ListenerThread is - // attempting to close this connection. - - if (isBusy()) { // we are busy! - writeUnlock(); - if (orb.transportDebugFlag) { - dprint(".close: isBusy so no close: " + this); - } - return; - } - - try { - try { - sendCloseConnection(GIOPVersion.V1_0); - } catch (Throwable t) { - wrapper.exceptionWhenSendingCloseConnection(t); - } - - synchronized ( stateEvent ){ - state = CLOSE_SENT; - stateEvent.notifyAll(); - } - - // stop the reader without causing it to do purgeCalls - //Exception ex = new Exception(); - //reader.stop(ex); // REVISIT - - // NOTE: !!!!!! - // This does writeUnlock(). - purgeCalls(wrapper.connectionRebind(), false, true); - - } catch (Exception ex) { - if (orb.transportDebugFlag) { - dprint(".close: exception: " + this, ex); - } - } - try { - Selector selector = orb.getTransportManager().getSelector(0); - if (selector != null) { - selector.unregisterForEvent(this); - } - if (socketChannel != null) { - socketChannel.close(); - } - socket.close(); - } catch (IOException e) { - if (orb.transportDebugFlag) { - dprint(".close: " + this, e); - } - } - closeConnectionResources(); - } finally { - if (orb.transportDebugFlag) { - dprint(".close<-: " + this); - } - } - } - - public void closeConnectionResources() { - if (orb.transportDebugFlag) { - dprint(".closeConnectionResources->: " + this); - } - Selector selector = orb.getTransportManager().getSelector(0); - if (selector != null) { - selector.unregisterForEvent(this); - } - try { - if (socketChannel != null) - socketChannel.close() ; - if (socket != null && !socket.isClosed()) - socket.close() ; - } catch (IOException e) { - if (orb.transportDebugFlag) { - dprint( ".closeConnectionResources: " + this, e ) ; - } - } - if (orb.transportDebugFlag) { - dprint(".closeConnectionResources<-: " + this); - } - } - - - public Acceptor getAcceptor() - { - return acceptor; - } - - public ContactInfo getContactInfo() - { - return contactInfo; - } - - public EventHandler getEventHandler() - { - return this; - } - - public OutputObject createOutputObject(MessageMediator messageMediator) - { - // REVISIT - remove this method from Connection and all it subclasses. - throw new RuntimeException("*****SocketOrChannelConnectionImpl.createOutputObject - should not be called."); - } - - // This is used by the GIOPOutputObject in order to - // throw the correct error when handling code sets. - // Can we determine if we are on the server side by - // other means? XREVISIT - public boolean isServer() - { - return isServer; - } - - public boolean isBusy() - { - if (serverRequestCount > 0 || - getResponseWaitingRoom().numberRegistered() > 0) - { - return true; - } else { - return false; - } - } - - public long getTimeStamp() - { - return timeStamp; - } - - public void setTimeStamp(long time) - { - timeStamp = time; - } - - public void setState(String stateString) - { - synchronized (stateEvent) { - if (stateString.equals("ESTABLISHED")) { - state = ESTABLISHED; - stateEvent.notifyAll(); - } else { - // REVISIT: ASSERT - } - } - } - - /** - * Sets the writeLock for this connection. - * If the writeLock is already set by someone else, block till the - * writeLock is released and can set by us. - * IMPORTANT: this connection's lock must be acquired before - * setting the writeLock and must be unlocked after setting the writeLock. - */ - public void writeLock() - { - try { - if (dprintWriteLocks && orb.transportDebugFlag) { - dprint(".writeLock->: " + this); - } - // Keep looping till we can set the writeLock. - while ( true ) { - int localState = state; - switch ( localState ) { - - case OPENING: - synchronized (stateEvent) { - if (state != OPENING) { - // somebody has changed 'state' so be careful - break; - } - try { - stateEvent.wait(); - } catch (InterruptedException ie) { - if (orb.transportDebugFlag) { - dprint(".writeLock: OPENING InterruptedException: " + this); - } - } - } - // Loop back - break; - - case ESTABLISHED: - synchronized (writeEvent) { - if (!writeLocked) { - writeLocked = true; - return; - } - - try { - // do not stay here too long if state != ESTABLISHED - // Bug 4752117 - while (state == ESTABLISHED && writeLocked) { - writeEvent.wait(100); - } - } catch (InterruptedException ie) { - if (orb.transportDebugFlag) { - dprint(".writeLock: ESTABLISHED InterruptedException: " + this); - } - } - } - // Loop back - break; - - // - // XXX - // Need to distinguish between client and server roles - // here probably. - // - case ABORT: - synchronized ( stateEvent ){ - if (state != ABORT) { - break; - } - throw wrapper.writeErrorSend() ; - } - - case CLOSE_RECVD: - // the connection has been closed or closing - // ==> throw rebind exception - synchronized ( stateEvent ){ - if (state != CLOSE_RECVD) { - break; - } - throw wrapper.connectionCloseRebind() ; - } - - default: - if (orb.transportDebugFlag) { - dprint(".writeLock: default: " + this); - } - // REVISIT - throw new RuntimeException(".writeLock: bad state"); - } - } - } finally { - if (dprintWriteLocks && orb.transportDebugFlag) { - dprint(".writeLock<-: " + this); - } - } - } - - public void writeUnlock() - { - try { - if (dprintWriteLocks && orb.transportDebugFlag) { - dprint(".writeUnlock->: " + this); - } - synchronized (writeEvent) { - writeLocked = false; - writeEvent.notify(); // wake up one guy waiting to write - } - } finally { - if (dprintWriteLocks && orb.transportDebugFlag) { - dprint(".writeUnlock<-: " + this); - } - } - } - - // Assumes the caller handles writeLock and writeUnlock - public void sendWithoutLock(OutputObject outputObject) - { - // Don't we need to check for CloseConnection - // here? REVISIT - - // XREVISIT - Shouldn't the MessageMediator - // be the one to handle writing the data here? - - try { - - // Write the fragment/message - - CDROutputObject cdrOutputObject = (CDROutputObject) outputObject; - cdrOutputObject.writeTo(this); - // REVISIT - no flush? - //socket.getOutputStream().flush(); - - } catch (IOException e1) { - - /* - * ADDED(Ram J) 10/13/2000 In the event of an IOException, try - * sending a CancelRequest for regular requests / locate requests - */ - - // Since IIOPOutputStream's msgheader is set only once, and not - // altered during sending multiple fragments, the original - // msgheader will always have the requestId. - // REVISIT This could be optimized to send a CancelRequest only - // if any fragments had been sent already. - - /* REVISIT: MOVE TO SUBCONTRACT - Message msg = os.getMessage(); - if (msg.getType() == Message.GIOPRequest || - msg.getType() == Message.GIOPLocateRequest) { - GIOPVersion requestVersion = msg.getGIOPVersion(); - int requestId = MessageBase.getRequestId(msg); - try { - sendCancelRequest(requestVersion, requestId); - } catch (IOException e2) { - // most likely an abortive connection closure. - // ignore, since nothing more can be done. - if (orb.transportDebugFlag) { - - } - } - */ - - // REVISIT When a send failure happens, purgeCalls() need to be - // called to ensure that the connection is properly removed from - // further usage (ie., cancelling pending requests with COMM_FAILURE - // with an appropriate minor_code CompletionStatus.MAY_BE). - - // Relying on the IIOPOutputStream (as noted below) is not - // sufficient as it handles COMM_FAILURE only for the final - // fragment (during invoke processing). Note that COMM_FAILURE could - // happen while sending the initial fragments. - // Also the IIOPOutputStream does not properly close the connection. - // It simply removes the connection from the table. An orderly - // closure is needed (ie., cancel pending requests on the connection - // COMM_FAILURE as well. - - // IIOPOutputStream will cleanup the connection info when it - // sees this exception. - SystemException exc = wrapper.writeErrorSend(e1); - purgeCalls(exc, false, true); - throw exc; - } - } - - public void registerWaiter(MessageMediator messageMediator) - { - responseWaitingRoom.registerWaiter(messageMediator); - } - - public void unregisterWaiter(MessageMediator messageMediator) - { - responseWaitingRoom.unregisterWaiter(messageMediator); - } - - public InputObject waitForResponse(MessageMediator messageMediator) - { - return responseWaitingRoom.waitForResponse(messageMediator); - } - - public void setConnectionCache(ConnectionCache connectionCache) - { - this.connectionCache = connectionCache; - } - - public ConnectionCache getConnectionCache() - { - return connectionCache; - } - - //////////////////////////////////////////////////// - // - // EventHandler methods - // - - public void setUseSelectThreadToWait(boolean x) - { - useSelectThreadToWait = x; - // REVISIT - Reading of a GIOP header only is information - // that should be passed into the constructor - // from the SocketOrChannelConnection factory. - setReadGiopHeaderOnly(shouldUseSelectThreadToWait()); - } - - public void handleEvent() - { - if (orb.transportDebugFlag) { - dprint(".handleEvent->: " + this); - } - getSelectionKey().interestOps(getSelectionKey().interestOps() & - (~ getInterestOps())); - - if (shouldUseWorkerThreadForEvent()) { - Throwable throwable = null; - try { - int poolToUse = 0; - if (shouldReadGiopHeaderOnly()) { - partialMessageMediator = readBits(); - poolToUse = - partialMessageMediator.getThreadPoolToUse(); - } - - if (orb.transportDebugFlag) { - dprint(".handleEvent: addWork to pool: " + poolToUse); - } - orb.getThreadPoolManager().getThreadPool(poolToUse) - .getWorkQueue(0).addWork(getWork()); - } catch (NoSuchThreadPoolException e) { - throwable = e; - } catch (NoSuchWorkQueueException e) { - throwable = e; - } - // REVISIT: need to close connection. - if (throwable != null) { - if (orb.transportDebugFlag) { - dprint(".handleEvent: " + throwable); - } - INTERNAL i = new INTERNAL("NoSuchThreadPoolException"); - i.initCause(throwable); - throw i; - } - } else { - if (orb.transportDebugFlag) { - dprint(".handleEvent: doWork"); - } - getWork().doWork(); - } - if (orb.transportDebugFlag) { - dprint(".handleEvent<-: " + this); - } - } - - public SelectableChannel getChannel() - { - return socketChannel; - } - - public int getInterestOps() - { - return SelectionKey.OP_READ; - } - - // public Acceptor getAcceptor() - already defined above. - - public Connection getConnection() - { - return this; - } - - //////////////////////////////////////////////////// - // - // Work methods. - // - - public String getName() - { - return this.toString(); - } - - public void doWork() - { - try { - if (orb.transportDebugFlag) { - dprint(".doWork->: " + this); - } - - // IMPORTANT: Sanity checks on SelectionKeys such as - // SelectorKey.isValid() should not be done - // here. - // - - if (!shouldReadGiopHeaderOnly()) { - read(); - } - else { - // get the partialMessageMediator - // created by SelectorThread - CorbaMessageMediator messageMediator = - this.getPartialMessageMediator(); - - // read remaining info needed in a MessageMediator - messageMediator = finishReadingBits(messageMediator); - - if (messageMediator != null) { - // Null can happen when client closes stream - // causing purgecalls. - dispatch(messageMediator); - } - } - } catch (Throwable t) { - if (orb.transportDebugFlag) { - dprint(".doWork: ignoring Throwable: " - + t - + " " + this); - } - } finally { - if (orb.transportDebugFlag) { - dprint(".doWork<-: " + this); - } - } - } - - public void setEnqueueTime(long timeInMillis) - { - enqueueTime = timeInMillis; - } - - public long getEnqueueTime() - { - return enqueueTime; - } - - //////////////////////////////////////////////////// - // - // spi.transport.CorbaConnection. - // - - // IMPORTANT: Reader Threads must NOT read Giop header only. - public boolean shouldReadGiopHeaderOnly() { - return shouldReadGiopHeaderOnly; - } - - protected void setReadGiopHeaderOnly(boolean shouldReadHeaderOnly) { - shouldReadGiopHeaderOnly = shouldReadHeaderOnly; - } - - public ResponseWaitingRoom getResponseWaitingRoom() - { - return responseWaitingRoom; - } - - // REVISIT - inteface defines isServer but already defined in - // higher interface. - - public void serverRequestMapPut(int requestId, - CorbaMessageMediator messageMediator) - { - serverRequestMap.put(new Integer(requestId), messageMediator); - } - - public CorbaMessageMediator serverRequestMapGet(int requestId) - { - return (CorbaMessageMediator) - serverRequestMap.get(new Integer(requestId)); - } - - public void serverRequestMapRemove(int requestId) - { - serverRequestMap.remove(new Integer(requestId)); - } - - - // REVISIT: this is also defined in: - // com.sun.corba.se.spi.legacy.connection.Connection - public java.net.Socket getSocket() - { - return socket; - } - - /** It is possible for a Close Connection to have been - ** sent here, but we will not check for this. A "lazy" - ** Exception will be thrown in the Worker thread after the - ** incoming request has been processed even though the connection - ** is closed before the request is processed. This is o.k because - ** it is a boundary condition. To prevent it we would have to add - ** more locks which would reduce performance in the normal case. - **/ - public synchronized void serverRequestProcessingBegins() - { - serverRequestCount++; - } - - public synchronized void serverRequestProcessingEnds() - { - serverRequestCount--; - } - - // - // - // - - public synchronized int getNextRequestId() - { - return requestId++; - } - - // Negotiated code sets for char and wchar data - protected CodeSetComponentInfo.CodeSetContext codeSetContext = null; - - public ORB getBroker() - { - return orb; - } - - public CodeSetComponentInfo.CodeSetContext getCodeSetContext() { - // Needs to be synchronized for the following case when the client - // doesn't send the code set context twice, and we have two threads - // in ServerRequestDispatcher processCodeSetContext. - // - // Thread A checks to see if there is a context, there is none, so - // it calls setCodeSetContext, getting the synch lock. - // Thread B checks to see if there is a context. If we didn't synch, - // it might decide to outlaw wchar/wstring. - if (codeSetContext == null) { - synchronized(this) { - return codeSetContext; - } - } - - return codeSetContext; - } - - public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) { - // Double check whether or not we need to do this - if (codeSetContext == null) { - - if (OSFCodeSetRegistry.lookupEntry(csc.getCharCodeSet()) == null || - OSFCodeSetRegistry.lookupEntry(csc.getWCharCodeSet()) == null) { - // If the client says it's negotiated a code set that - // isn't a fallback and we never said we support, then - // it has a bug. - throw wrapper.badCodesetsFromClient() ; - } - - codeSetContext = csc; - } - } - - // - // from iiop.IIOPConnection.java - // - - // Map request ID to an InputObject. - // This is so the client thread can start unmarshaling - // the reply and remove it from the out_calls map while the - // ReaderThread can still obtain the input stream to give - // new fragments. Only the ReaderThread touches the clientReplyMap, - // so it doesn't incur synchronization overhead. - - public MessageMediator clientRequestMapGet(int requestId) - { - return responseWaitingRoom.getMessageMediator(requestId); - } - - protected MessageMediator clientReply_1_1; - - public void clientReply_1_1_Put(MessageMediator x) - { - clientReply_1_1 = x; - } - - public MessageMediator clientReply_1_1_Get() - { - return clientReply_1_1; - } - - public void clientReply_1_1_Remove() - { - clientReply_1_1 = null; - } - - protected MessageMediator serverRequest_1_1; - - public void serverRequest_1_1_Put(MessageMediator x) - { - serverRequest_1_1 = x; - } - - public MessageMediator serverRequest_1_1_Get() - { - return serverRequest_1_1; - } - - public void serverRequest_1_1_Remove() - { - serverRequest_1_1 = null; - } - - protected String getStateString( int state ) - { - synchronized ( stateEvent ){ - switch (state) { - case OPENING : return "OPENING" ; - case ESTABLISHED : return "ESTABLISHED" ; - case CLOSE_SENT : return "CLOSE_SENT" ; - case CLOSE_RECVD : return "CLOSE_RECVD" ; - case ABORT : return "ABORT" ; - default : return "???" ; - } - } - } - - public synchronized boolean isPostInitialContexts() { - return postInitialContexts; - } - - // Can never be unset... - public synchronized void setPostInitialContexts(){ - postInitialContexts = true; - } - - /** - * Wake up the outstanding requests on the connection, and hand them - * COMM_FAILURE exception with a given minor code. - * - * Also, delete connection from connection table and - * stop the reader thread. - - * Note that this should only ever be called by the Reader thread for - * this connection. - * - * @param minor_code The minor code for the COMM_FAILURE major code. - * @param die Kill the reader thread (this thread) before exiting. - */ - public void purgeCalls(SystemException systemException, - boolean die, boolean lockHeld) - { - int minor_code = systemException.minor; - - try{ - if (orb.transportDebugFlag) { - dprint(".purgeCalls->: " - + minor_code + "/" + die + "/" + lockHeld - + " " + this); - } - - // If this invocation is a result of ThreadDeath caused - // by a previous execution of this routine, just exit. - - synchronized ( stateEvent ){ - if ((state == ABORT) || (state == CLOSE_RECVD)) { - if (orb.transportDebugFlag) { - dprint(".purgeCalls: exiting since state is: " - + getStateString(state) - + " " + this); - } - return; - } - } - - // Grab the writeLock (freeze the calls) - try { - if (!lockHeld) { - writeLock(); - } - } catch (SystemException ex) { - if (orb.transportDebugFlag) - dprint(".purgeCalls: SystemException" + ex - + "; continuing " + this); - } - - // Mark the state of the connection - // and determine the request status - org.omg.CORBA.CompletionStatus completion_status; - synchronized ( stateEvent ){ - if (minor_code == ORBUtilSystemException.CONNECTION_REBIND) { - state = CLOSE_RECVD; - systemException.completed = CompletionStatus.COMPLETED_NO; - } else { - state = ABORT; - systemException.completed = CompletionStatus.COMPLETED_MAYBE; - } - stateEvent.notifyAll(); - } - - try { - socket.getInputStream().close(); - socket.getOutputStream().close(); - socket.close(); - } catch (Exception ex) { - if (orb.transportDebugFlag) { - dprint(".purgeCalls: Exception closing socket: " + ex - + " " + this); - } - } - - // Signal all threads with outstanding requests on this - // connection and give them the SystemException; - - responseWaitingRoom.signalExceptionToAllWaiters(systemException); - } finally { - if (contactInfo != null) { - ((OutboundConnectionCache)getConnectionCache()).remove(contactInfo); - } else if (acceptor != null) { - ((InboundConnectionCache)getConnectionCache()).remove(this); - } - - // - // REVISIT: Stop the reader thread - // - - // Signal all the waiters of the writeLock. - // There are 4 types of writeLock waiters: - // 1. Send waiters: - // 2. SendReply waiters: - // 3. cleanUp waiters: - // 4. purge_call waiters: - // - - writeUnlock(); - - if (orb.transportDebugFlag) { - dprint(".purgeCalls<-: " - + minor_code + "/" + die + "/" + lockHeld - + " " + this); - } - } - } - - /************************************************************************* - * The following methods are for dealing with Connection cleaning for - * better scalability of servers in high network load conditions. - **************************************************************************/ - - public void sendCloseConnection(GIOPVersion giopVersion) - throws IOException - { - Message msg = MessageBase.createCloseConnection(giopVersion); - sendHelper(giopVersion, msg); - } - - public void sendMessageError(GIOPVersion giopVersion) - throws IOException - { - Message msg = MessageBase.createMessageError(giopVersion); - sendHelper(giopVersion, msg); - } - - /** - * Send a CancelRequest message. This does not lock the connection, so the - * caller needs to ensure this method is called appropriately. - * @exception IOException - could be due to abortive connection closure. - */ - public void sendCancelRequest(GIOPVersion giopVersion, int requestId) - throws IOException - { - - Message msg = MessageBase.createCancelRequest(giopVersion, requestId); - sendHelper(giopVersion, msg); - } - - protected void sendHelper(GIOPVersion giopVersion, Message msg) - throws IOException - { - // REVISIT: See comments in CDROutputObject constructor. - CDROutputObject outputObject = - sun.corba.OutputStreamFactory.newCDROutputObject((ORB)orb, null, giopVersion, - this, msg, ORBConstants.STREAM_FORMAT_VERSION_1); - msg.write(outputObject); - - outputObject.writeTo(this); - } - - public void sendCancelRequestWithLock(GIOPVersion giopVersion, - int requestId) - throws IOException - { - writeLock(); - try { - sendCancelRequest(giopVersion, requestId); - } finally { - writeUnlock(); - } - } - - // Begin Code Base methods --------------------------------------- - // - // Set this connection's code base IOR. The IOR comes from the - // SendingContext. This is an optional service context, but all - // JavaSoft ORBs send it. - // - // The set and get methods don't need to be synchronized since the - // first possible get would occur during reading a valuetype, and - // that would be after the set. - - // Sets this connection's code base IOR. This is done after - // getting the IOR out of the SendingContext service context. - // Our ORBs always send this, but it's optional in CORBA. - - public final void setCodeBaseIOR(IOR ior) { - codeBaseServerIOR = ior; - } - - public final IOR getCodeBaseIOR() { - return codeBaseServerIOR; - } - - // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase - // won't connect to the remote codebase unless it's necessary. - public final CodeBase getCodeBase() { - return cachedCodeBase; - } - - // End Code Base methods ----------------------------------------- - - // set transport read thresholds - protected void setReadTimeouts(ReadTimeouts readTimeouts) { - this.readTimeouts = readTimeouts; - } - - protected void setPartialMessageMediator(CorbaMessageMediator messageMediator) { - partialMessageMediator = messageMediator; - } - - protected CorbaMessageMediator getPartialMessageMediator() { - return partialMessageMediator; - } - - public String toString() - { - synchronized ( stateEvent ){ - return - "SocketOrChannelConnectionImpl[" + " " - + (socketChannel == null ? - socket.toString() : socketChannel.toString()) + " " - + getStateString( state ) + " " - + shouldUseSelectThreadToWait() + " " - + shouldUseWorkerThreadForEvent() + " " - + shouldReadGiopHeaderOnly() - + "]" ; - } - } - - // Must be public - used in encoding. - public void dprint(String msg) - { - ORBUtility.dprint("SocketOrChannelConnectionImpl", msg); - } - - protected void dprint(String msg, Throwable t) - { - dprint(msg); - t.printStackTrace(System.out); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelContactInfoImpl.java 2018-01-30 20:20:53.000000000 -0500 +++ /dev/null 2018-01-30 20:20:54.000000000 -0500 @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.impl.transport; - -import com.sun.corba.se.pept.transport.Connection; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaContactInfoList; -import com.sun.corba.se.spi.transport.CorbaTransportManager; -import com.sun.corba.se.spi.transport.SocketInfo; - -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.transport.CorbaContactInfoBase; - -/** - * @author Harold Carr - */ -public class SocketOrChannelContactInfoImpl - extends CorbaContactInfoBase - implements SocketInfo -{ - protected boolean isHashCodeCached = false; - protected int cachedHashCode; - - protected String socketType; - protected String hostname; - protected int port; - - // XREVISIT - // See SocketOrChannelAcceptorImpl.createMessageMediator - // See SocketFactoryContactInfoImpl.constructor() - // See SocketOrChannelContactInfoImpl.constructor() - protected SocketOrChannelContactInfoImpl() - { - } - - protected SocketOrChannelContactInfoImpl( - ORB orb, - CorbaContactInfoList contactInfoList) - { - this.orb = orb; - this.contactInfoList = contactInfoList; - } - - public SocketOrChannelContactInfoImpl( - ORB orb, - CorbaContactInfoList contactInfoList, - String socketType, - String hostname, - int port) - { - this(orb, contactInfoList); - this.socketType = socketType; - this.hostname = hostname; - this.port = port; - } - - // XREVISIT - public SocketOrChannelContactInfoImpl( - ORB orb, - CorbaContactInfoList contactInfoList, - IOR effectiveTargetIOR, - short addressingDisposition, - String socketType, - String hostname, - int port) - { - this(orb, contactInfoList, socketType, hostname, port); - this.effectiveTargetIOR = effectiveTargetIOR; - this.addressingDisposition = addressingDisposition; - } - - //////////////////////////////////////////////////// - // - // pept.transport.ContactInfo - // - - public boolean isConnectionBased() - { - return true; - } - - public boolean shouldCacheConnection() - { - return true; - } - - public String getConnectionCacheType() - { - return CorbaTransportManager.SOCKET_OR_CHANNEL_CONNECTION_CACHE; - } - - public Connection createConnection() - { - Connection connection = - new SocketOrChannelConnectionImpl(orb, this, - socketType, hostname, port); - return connection; - } - - //////////////////////////////////////////////////// - // - // spi.transport.CorbaContactInfo - // - - public String getMonitoringName() - { - return "SocketConnections"; - } - - //////////////////////////////////////////////////// - // - // pept.transport.ContactInfo - // - - public String getType() - { - return socketType; - } - - public String getHost() - { - return hostname; - } - - public int getPort() - { - return port; - } - - //////////////////////////////////////////////////// - // - // java.lang.Object - // - - public int hashCode() - { - if (! isHashCodeCached) { - cachedHashCode = socketType.hashCode() ^ hostname.hashCode() ^ port; - isHashCodeCached = true; - } - return cachedHashCode; - } - - public boolean equals(Object obj) - { - if (obj == null) { - return false; - } else if (!(obj instanceof SocketOrChannelContactInfoImpl)) { - return false; - } - - SocketOrChannelContactInfoImpl other = - (SocketOrChannelContactInfoImpl) obj; - - if (port != other.port) { - return false; - } - if (!hostname.equals(other.hostname)) { - return false; - } - if (socketType == null) { - if (other.socketType != null) { - return false; - } - } else if (!socketType.equals(other.socketType)) { - return false; - } - return true; - } - - public String toString() - { - return - "SocketOrChannelContactInfoImpl[" - + socketType + " " - + hostname + " " - + port - + "]"; - } - - //////////////////////////////////////////////////// - // - // Implementation - // - - protected void dprint(String msg) - { - ORBUtility.dprint("SocketOrChannelContactInfoImpl", msg); - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtable.java 2018-01-30 20:20:54.000000000 -0500 +++ /dev/null 2018-01-30 20:20:54.000000000 -0500 @@ -1,373 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; - -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.NoSuchElementException; - -/** - * IdentityHashtable is a modified copy of the 1.1.6 Hashtable class which - * does not rely on the hashCode() and equals() methods of the key or value; - * instead, it uses the System.identityHashcode() method and pointer comparison. - * In addition, all synchronization has been removed. - */ -public final class IdentityHashtable extends Dictionary { - /** - * The hash table data. - */ - private transient IdentityHashtableEntry table[]; - - /** - * The total number of entries in the hash table. - */ - private transient int count; - - /** - * Rehashes the table when count exceeds this threshold. - */ - private int threshold; - - /** - * The load factor for the hashtable. - */ - private float loadFactor; - - /** - * Constructs a new, empty hashtable with the specified initial - * capacity and the specified load factor. - * - * @param initialCapacity the initial capacity of the hashtable. - * @param loadFactor a number between 0.0 and 1.0. - * @exception IllegalArgumentException if the initial capacity is less - * than or equal to zero, or if the load factor is less than - * or equal to zero. - * @since JDK1.0 - */ - public IdentityHashtable(int initialCapacity, float loadFactor) { - if ((initialCapacity <= 0) || (loadFactor <= 0.0)) { - throw new IllegalArgumentException(); - } - this.loadFactor = loadFactor; - table = new IdentityHashtableEntry[initialCapacity]; - threshold = (int)(initialCapacity * loadFactor); - } - - /** - * Constructs a new, empty hashtable with the specified initial capacity - * and default load factor. - * - * @param initialCapacity the initial capacity of the hashtable. - * @since JDK1.0 - */ - public IdentityHashtable(int initialCapacity) { - this(initialCapacity, 0.75f); - } - - /** - * Constructs a new, empty hashtable with a default capacity and load - * factor. - * - * @since JDK1.0 - */ - public IdentityHashtable() { - this(101, 0.75f); - } - - /** - * Returns the number of keys in this hashtable. - * - * @return the number of keys in this hashtable. - * @since JDK1.0 - */ - public int size() { - return count; - } - - /** - * Tests if this hashtable maps no keys to values. - * - * @return true if this hashtable maps no keys to values; - * false otherwise. - * @since JDK1.0 - */ - public boolean isEmpty() { - return count == 0; - } - - /** - * Returns an enumeration of the keys in this hashtable. - * - * @return an enumeration of the keys in this hashtable. - * @see java.util.Enumeration - * @see java.util.Hashtable#elements() - * @since JDK1.0 - */ - public Enumeration keys() { - return new IdentityHashtableEnumerator(table, true); - } - - /** - * Returns an enumeration of the values in this hashtable. - * Use the Enumeration methods on the returned object to fetch the elements - * sequentially. - * - * @return an enumeration of the values in this hashtable. - * @see java.util.Enumeration - * @see java.util.Hashtable#keys() - * @since JDK1.0 - */ - public Enumeration elements() { - return new IdentityHashtableEnumerator(table, false); - } - - /** - * Tests if some key maps into the specified value in this hashtable. - * This operation is more expensive than the containsKey - * method. - * - * @param value a value to search for. - * @return true if some key maps to the - * value argument in this hashtable; - * false otherwise. - * @exception NullPointerException if the value is null. - * @see java.util.Hashtable#containsKey(java.lang.Object) - * @since JDK1.0 - */ - public boolean contains(Object value) { - if (value == null) { - throw new NullPointerException(); - } - - IdentityHashtableEntry tab[] = table; - for (int i = tab.length ; i-- > 0 ;) { - for (IdentityHashtableEntry e = tab[i] ; e != null ; e = e.next) { - if (e.value == value) { - return true; - } - } - } - return false; - } - - /** - * Tests if the specified object is a key in this hashtable. - * - * @param key possible key. - * @return true if the specified object is a key in this - * hashtable; false otherwise. - * @see java.util.Hashtable#contains(java.lang.Object) - * @since JDK1.0 - */ - public boolean containsKey(Object key) { - IdentityHashtableEntry tab[] = table; - int hash = System.identityHashCode(key); - int index = (hash & 0x7FFFFFFF) % tab.length; - for (IdentityHashtableEntry e = tab[index] ; e != null ; e = e.next) { - if ((e.hash == hash) && e.key == key) { - return true; - } - } - return false; - } - - /** - * Returns the value to which the specified key is mapped in this hashtable. - * - * @param key a key in the hashtable. - * @return the value to which the key is mapped in this hashtable; - * null if the key is not mapped to any value in - * this hashtable. - * @see java.util.Hashtable#put(java.lang.Object, java.lang.Object) - * @since JDK1.0 - */ - public Object get(Object key) { - IdentityHashtableEntry tab[] = table; - int hash = System.identityHashCode(key); - int index = (hash & 0x7FFFFFFF) % tab.length; - for (IdentityHashtableEntry e = tab[index] ; e != null ; e = e.next) { - if ((e.hash == hash) && e.key == key) { - return e.value; - } - } - return null; - } - - /** - * Rehashes the contents of the hashtable into a hashtable with a - * larger capacity. This method is called automatically when the - * number of keys in the hashtable exceeds this hashtable's capacity - * and load factor. - * - * @since JDK1.0 - */ - protected void rehash() { - int oldCapacity = table.length; - IdentityHashtableEntry oldTable[] = table; - - int newCapacity = oldCapacity * 2 + 1; - IdentityHashtableEntry newTable[] = new IdentityHashtableEntry[newCapacity]; - - threshold = (int)(newCapacity * loadFactor); - table = newTable; - - //System.out.println("rehash old=" + oldCapacity + ", new=" + newCapacity + ", thresh=" + threshold + ", count=" + count); - - for (int i = oldCapacity ; i-- > 0 ;) { - for (IdentityHashtableEntry old = oldTable[i] ; old != null ; ) { - IdentityHashtableEntry e = old; - old = old.next; - - int index = (e.hash & 0x7FFFFFFF) % newCapacity; - e.next = newTable[index]; - newTable[index] = e; - } - } - } - - /** - * Maps the specified key to the specified - * value in this hashtable. Neither the key nor the - * value can be null. - *

- * The value can be retrieved by calling the get method - * with a key that is equal to the original key. - * - * @param key the hashtable key. - * @param value the value. - * @return the previous value of the specified key in this hashtable, - * or null if it did not have one. - * @exception NullPointerException if the key or value is - * null. - * @see java.util.Hashtable#get(java.lang.Object) - * @since JDK1.0 - */ - public Object put(Object key, Object value) { - // Make sure the value is not null - if (value == null) { - throw new NullPointerException(); - } - - // Makes sure the key is not already in the hashtable. - IdentityHashtableEntry tab[] = table; - int hash = System.identityHashCode(key); - int index = (hash & 0x7FFFFFFF) % tab.length; - for (IdentityHashtableEntry e = tab[index] ; e != null ; e = e.next) { - if ((e.hash == hash) && e.key == key) { - Object old = e.value; - e.value = value; - return old; - } - } - - if (count >= threshold) { - // Rehash the table if the threshold is exceeded - rehash(); - return put(key, value); - } - - // Creates the new entry. - IdentityHashtableEntry e = new IdentityHashtableEntry(); - e.hash = hash; - e.key = key; - e.value = value; - e.next = tab[index]; - tab[index] = e; - count++; - return null; - } - - /** - * Removes the key (and its corresponding value) from this - * hashtable. This method does nothing if the key is not in the hashtable. - * - * @param key the key that needs to be removed. - * @return the value to which the key had been mapped in this hashtable, - * or null if the key did not have a mapping. - * @since JDK1.0 - */ - public Object remove(Object key) { - IdentityHashtableEntry tab[] = table; - int hash = System.identityHashCode(key); - int index = (hash & 0x7FFFFFFF) % tab.length; - for (IdentityHashtableEntry e = tab[index], prev = null ; e != null ; prev = e, e = e.next) { - if ((e.hash == hash) && e.key == key) { - if (prev != null) { - prev.next = e.next; - } else { - tab[index] = e.next; - } - count--; - return e.value; - } - } - return null; - } - - /** - * Clears this hashtable so that it contains no keys. - * - * @since JDK1.0 - */ - public void clear() { - IdentityHashtableEntry tab[] = table; - for (int index = tab.length; --index >= 0; ) - tab[index] = null; - count = 0; - } - - /** - * Returns a rather long string representation of this hashtable. - * - * @return a string representation of this hashtable. - * @since JDK1.0 - */ - public String toString() { - int max = size() - 1; - StringBuffer buf = new StringBuffer(); - Enumeration k = keys(); - Enumeration e = elements(); - buf.append("{"); - - for (int i = 0; i <= max; i++) { - String s1 = k.nextElement().toString(); - String s2 = e.nextElement().toString(); - buf.append(s1 + "=" + s2); - if (i < max) { - buf.append(", "); - } - } - buf.append("}"); - return buf.toString(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEntry.java 2018-01-30 20:20:55.000000000 -0500 +++ /dev/null 2018-01-30 20:20:55.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; - -/** - * IdentityHashtable collision list. - */ -class IdentityHashtableEntry { - int hash; - Object key; - Object value; - IdentityHashtableEntry next; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEnumerator.java 2018-01-30 20:20:56.000000000 -0500 +++ /dev/null 2018-01-30 20:20:56.000000000 -0500 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2003, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; - -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.NoSuchElementException; - -/** - * A hashtable enumerator class. This class should remain opaque - * to the client. It will use the Enumeration interface. - */ -class IdentityHashtableEnumerator implements Enumeration { - boolean keys; - int index; - IdentityHashtableEntry table[]; - IdentityHashtableEntry entry; - - IdentityHashtableEnumerator(IdentityHashtableEntry table[], boolean keys) { - this.table = table; - this.keys = keys; - this.index = table.length; - } - - public boolean hasMoreElements() { - if (entry != null) { - return true; - } - while (index-- > 0) { - if ((entry = table[index]) != null) { - return true; - } - } - return false; -} - -public Object nextElement() { - if (entry == null) { - while ((index-- > 0) && ((entry = table[index]) == null)); - } - if (entry != null) { - IdentityHashtableEntry e = entry; - entry = e.next; - return keys ? e.key : e.value; - } - throw new NoSuchElementException("IdentityHashtableEnumerator"); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKBridge.java 2018-01-30 20:20:56.000000000 -0500 +++ /dev/null 2018-01-30 20:20:56.000000000 -0500 @@ -1,197 +0,0 @@ -/* - * Copyright (c) 1995, 2004, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; - -import java.rmi.Remote; -import java.rmi.NoSuchObjectException; -import java.rmi.server.RMIClassLoader; -import java.rmi.server.UnicastRemoteObject; -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.CompletionStatus; -import java.util.Properties; -import java.io.File; -import java.io.FileInputStream; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.net.MalformedURLException; -import com.sun.corba.se.impl.orbutil.GetPropertyAction; - -/** - * Utility methods for doing various method calls which are used - * by multiple classes - */ -public class JDKBridge { - - /** - * Get local codebase System property (java.rmi.server.codebase). - * May be null or a space separated array of URLS. - */ - public static String getLocalCodebase () { - return localCodebase; - } - - /** - * Return true if the system property "java.rmi.server.useCodebaseOnly" - * is set, false otherwise. - */ - public static boolean useCodebaseOnly () { - return useCodebaseOnly; - } - - /** - * Returns a class instance for the specified class. - * @param className the name of the class - * @param remoteCodebase a space-separated array of urls at which - * the class might be found. May be null. - * @param loader a ClassLoader who may be used to - * load the class if all other methods fail. - * @return the Class object representing the loaded class. - * @exception throws ClassNotFoundException if class cannot be loaded. - */ - public static Class loadClass (String className, - String remoteCodebase, - ClassLoader loader) - throws ClassNotFoundException { - - if (loader == null) { - return loadClassM(className,remoteCodebase,useCodebaseOnly); - } else { - try { - return loadClassM(className,remoteCodebase,useCodebaseOnly); - } catch (ClassNotFoundException e) { - return loader.loadClass(className); - } - } - } - - /** - * Returns a class instance for the specified class. - * @param className the name of the class - * @param remoteCodebase a space-separated array of urls at which - * the class might be found. May be null. - * @return the Class object representing the loaded class. - * @exception throws ClassNotFoundException if class cannot be loaded. - */ - public static Class loadClass (String className, - String remoteCodebase) - throws ClassNotFoundException { - return loadClass(className,remoteCodebase,null); - } - - /** - * Returns a class instance for the specified class. - * @param className the name of the class - * @return the Class object representing the loaded class. - * @exception throws ClassNotFoundException if class cannot be loaded. - */ - public static Class loadClass (String className) - throws ClassNotFoundException { - return loadClass(className,null,null); - } - - private static final String LOCAL_CODEBASE_KEY = "java.rmi.server.codebase"; - private static final String USE_CODEBASE_ONLY_KEY = "java.rmi.server.useCodebaseOnly"; - private static String localCodebase = null; - private static boolean useCodebaseOnly; - - static { - setCodebaseProperties(); - } - - public static final void main (String[] args) { - System.out.println("1.2 VM"); - - /* - // If on 1.2, use a policy with all permissions. - System.setSecurityManager (new javax.rmi.download.SecurityManager()); - String targetClass = "[[Lrmic.Typedef;"; - System.out.println("localCodebase = "+localCodebase); - System.out.println("Trying to load "+targetClass); - try { - Class clz = loadClass(targetClass,null,localCodebase); - System.out.println("Loaded: "+clz); - } catch (ClassNotFoundException e) { - System.out.println("Caught "+e); - } - */ - } - - /** - * Set the codebase and useCodebaseOnly properties. This is public - * only for test code. - */ - public static synchronized void setCodebaseProperties () { - String prop = (String)AccessController.doPrivileged( - new GetPropertyAction(LOCAL_CODEBASE_KEY) - ); - if (prop != null && prop.trim().length() > 0) { - localCodebase = prop; - } - - prop = (String)AccessController.doPrivileged( - new GetPropertyAction(USE_CODEBASE_ONLY_KEY) - ); - if (prop != null && prop.trim().length() > 0) { - useCodebaseOnly = Boolean.valueOf(prop).booleanValue(); - } - } - - /** - * Set the default code base. This method is here only - * for test code. - */ - public static synchronized void setLocalCodebase(String codebase) { - localCodebase = codebase; - } - - private static Class loadClassM (String className, - String remoteCodebase, - boolean useCodebaseOnly) - throws ClassNotFoundException { - - try { - return JDKClassLoader.loadClass(null,className); - } catch (ClassNotFoundException e) {} - try { - if (!useCodebaseOnly && remoteCodebase != null) { - return RMIClassLoader.loadClass(remoteCodebase, - className); - } else { - return RMIClassLoader.loadClass(className); - } - } catch (MalformedURLException e) { - className = className + ": " + e.toString(); - } - - throw new ClassNotFoundException(className); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKClassLoader.java 2018-01-30 20:20:57.000000000 -0500 +++ /dev/null 2018-01-30 20:20:57.000000000 -0500 @@ -1,192 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; - -import sun.corba.Bridge ; - -import java.util.Map ; -import java.util.WeakHashMap ; -import java.util.Collections ; - -import java.security.AccessController ; -import java.security.PrivilegedAction ; - -/** - * Utility method for crawling call stack to load class - */ -class JDKClassLoader { - - private static final JDKClassLoaderCache classCache - = new JDKClassLoaderCache(); - - private static final Bridge bridge = - (Bridge)AccessController.doPrivileged( - new PrivilegedAction() { - public Object run() { - return Bridge.get() ; - } - } - ) ; - - static Class loadClass(Class aClass, String className) - throws ClassNotFoundException { - - // Maintain the same error semantics as Class.forName() - if (className == null) { - throw new NullPointerException(); - } - if (className.length() == 0) { - throw new ClassNotFoundException(); - } - - // It would be nice to bypass JDKClassLoader's attempts completely - // if it's known that the latest user defined ClassLoader will - // fail. - // - // Otherwise, we end up calling Class.forName here as well as in - // the next step in JDKBridge. That can take a long time depending - // on the length of the classpath. - - // Note: Looking at the only place in JDKBridge where this code - // is invoked, it is clear that aClass will always be null. - ClassLoader loader; - if (aClass != null) { - loader = aClass.getClassLoader(); - } else { - loader = bridge.getLatestUserDefinedLoader(); - } - // See createKey for a description of what's involved - Object key = classCache.createKey(className, loader); - - if (classCache.knownToFail(key)) { - throw new ClassNotFoundException(className); - } else { - try { - // Loading this class with the call stack - // loader isn't known to fail, so try - // to load it. - return Class.forName(className, false, loader); - } catch(ClassNotFoundException cnfe) { - // Record that we failed to find the class - // with this particular loader. This way, we won't - // waste time looking with this loader, again. - classCache.recordFailure(key); - throw cnfe; - } - } - } - - /** - * Private cache implementation specific to JDKClassLoader. - */ - private static class JDKClassLoaderCache - { - // JDKClassLoader couldn't find the class with the located - // ClassLoader. Note this in our cache so JDKClassLoader - // can abort early next time. - public final void recordFailure(Object key) { - cache.put(key, JDKClassLoaderCache.KNOWN_TO_FAIL); - } - - // Factory for a key (CacheKey is an implementation detail - // of JDKClassLoaderCache). - // - // A key currently consists of the class name as well as - // the latest user defined class loader, so it's fairly - // expensive to create. - public final Object createKey(String className, ClassLoader latestLoader) { - return new CacheKey(className, latestLoader); - } - - // Determine whether or not this combination of class name - // and ClassLoader is known to fail. - public final boolean knownToFail(Object key) { - return cache.get(key) == JDKClassLoaderCache.KNOWN_TO_FAIL; - } - - // Synchronized WeakHashMap - private final Map cache - = Collections.synchronizedMap(new WeakHashMap()); - - // Cache result used to mark the caches when there is - // no way JDKClassLoader could succeed with the given - // key - private static final Object KNOWN_TO_FAIL = new Object(); - - // Key consisting of the class name and the latest - // user defined class loader - private static class CacheKey - { - String className; - ClassLoader loader; - - public CacheKey(String className, ClassLoader loader) { - this.className = className; - this.loader = loader; - } - - // Try to incorporate both class name and loader - // into the hashcode - public int hashCode() { - if (loader == null) - return className.hashCode(); - else - return className.hashCode() ^ loader.hashCode(); - } - - public boolean equals(Object obj) { - try { - - // WeakHashMap may compare null keys - if (obj == null) - return false; - - CacheKey other = (CacheKey)obj; - - // I've made a decision to actually compare the - // loader references. I don't want a case when - // two loader instances override their equals - // methods and only compare code base. - // - // This way, at worst, our performance will - // be slower, but we know we'll do the correct - // loading. - return (className.equals(other.className) && - loader == other.loader); - - } catch (ClassCastException cce) { - return false; - } - } - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/ORBProperties.java 2018-01-30 20:20:58.000000000 -0500 +++ /dev/null 2018-01-30 20:20:58.000000000 -0500 @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1998, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.PrintWriter; - -public class ORBProperties { - - public static final String ORB_CLASS = - "org.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl"; - public static final String ORB_SINGLETON_CLASS = - "org.omg.CORBA.ORBSingletonClass=com.sun.corba.se.impl.orb.ORBSingleton"; - - public static void main (String[] args) { - - try { - // Check if orb.properties exists - String javaHome = System.getProperty("java.home"); - File propFile = new File(javaHome + File.separator - + "lib" + File.separator - + "orb.properties"); - - if (propFile.exists()) - return; - - // Write properties to orb.properties - FileOutputStream out = new FileOutputStream(propFile); - PrintWriter pw = new PrintWriter(out); - - try { - pw.println(ORB_CLASS); - pw.println(ORB_SINGLETON_CLASS); - } finally { - pw.close(); - out.close(); - } - - } catch (Exception ex) { } - - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/PackagePrefixChecker.java 2018-01-30 20:20:58.000000000 -0500 +++ /dev/null 2018-01-30 20:20:58.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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.corba.se.impl.util; - -import java.io.File; - -/** - * PackagePrefixChecker provides static utility methods for getting package prefixes. - * @author M. Mortazavi - */ - -public final class PackagePrefixChecker { - - - private static final String PACKAGE_PREFIX = "org.omg.stub."; - - public static String packagePrefix(){ return PACKAGE_PREFIX;} - - public static String correctPackageName (String p){ - if (p==null) return p; - if ( hasOffendingPrefix(p)) - { - return PACKAGE_PREFIX+p; - } - return p; - } - - public static boolean isOffendingPackage(String p){ - return - !(p==null) - && - ( false || hasOffendingPrefix(p) ); - } - - public static boolean hasOffendingPrefix(String p){ - return - ( p.startsWith("java.") || p.equals("java") - // || p.startsWith("com.sun.") || p.equals("com.sun") - || p.startsWith("net.jini.") || p.equals("net.jini") - || p.startsWith("jini.") || p.equals("jini") - || p.startsWith("javax.") || p.equals("javax") - ); - } - - public static boolean hasBeenPrefixed(String p){ - return p.startsWith(packagePrefix()); - } - - public static String withoutPackagePrefix(String p){ - if(hasBeenPrefixed(p)) return p.substring(packagePrefix().length()); - else return p; - } - -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryId.java 2018-01-30 20:20:59.000000000 -0500 +++ /dev/null 2018-01-30 20:20:59.000000000 -0500 @@ -1,993 +0,0 @@ -/* - * Copyright (c) 1998, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; - -import java.util.StringTokenizer; -import java.util.Hashtable; -import java.io.IOException; -import java.lang.reflect.Method; - -// Imports for using codebase URL to load class -import java.net.MalformedURLException; -import org.omg.CORBA.portable.ValueBase; -import org.omg.CORBA.portable.IDLEntity; - -//d11638 files in the same package, therefore remove their reference -//import com.sun.corba.se.impl.util.JDKBridge; -//import com.sun.corba.se.impl.util.IdentityHashtable; -import com.sun.corba.se.impl.io.ObjectStreamClass; - -import javax.rmi.CORBA.Util; - -public class RepositoryId { - - // Legal IDL Identifier characters (1 = legal). Note - // that '.' (2E) is marked as legal even though it is - // not legal in IDL. This allows us to treat a fully - // qualified Java name with '.' package separators - // uniformly, and is safe because that is the only - // legal use of '.' in a Java name. - - private static final byte[] IDL_IDENTIFIER_CHARS = { - - // 0 1 2 3 4 5 6 7 8 9 a b c d e f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 00-0f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 10-1f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,1,0, // 20-2f - 1,1,1,1, 1,1,1,1, 1,1,0,0, 0,0,0,0, // 30-3f - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 40-4f - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,1, // 50-5f - 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // 60-6f - 1,1,1,1, 1,1,1,1, 1,1,1,0, 0,0,0,0, // 70-7f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 80-8f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // 90-9f - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // a0-af - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, // b0-bf - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // c0-cf - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // d0-df - 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, // e0-ef - 0,1,1,1, 1,1,1,0, 1,1,1,1, 1,0,0,1, // f0-ff - }; - - - private static final long serialVersionUID = 123456789L; - - private static String defaultServerURL = null; - private static boolean useCodebaseOnly = false; - - static { - if (defaultServerURL == null) - defaultServerURL = (String)JDKBridge.getLocalCodebase(); - useCodebaseOnly = JDKBridge.useCodebaseOnly(); - - } - - private static IdentityHashtable classToRepStr = new IdentityHashtable(); - private static IdentityHashtable classIDLToRepStr = new IdentityHashtable(); - private static IdentityHashtable classSeqToRepStr = new IdentityHashtable(); - - private static final IdentityHashtable repStrToByteArray = new IdentityHashtable(); - private static Hashtable repStrToClass = new Hashtable(); - - private String repId = null; - private boolean isSupportedFormat = true; - private String typeString = null; - private String versionString = null; - private boolean isSequence = false; - private boolean isRMIValueType = false; - private boolean isIDLType = false; - private String completeClassName = null; - private String unqualifiedName = null; - private String definedInId = null; - private Class clazz = null; - private String suid = null, actualSuid = null; - private long suidLong = ObjectStreamClass.kDefaultUID, actualSuidLong = ObjectStreamClass.kDefaultUID; - - // Repository ID fragments - private static final String kSequenceKeyword = "seq"; - private static final String kValuePrefix = "RMI:"; - private static final String kIDLPrefix = "IDL:"; - private static final String kIDLNamePrefix = "omg.org/"; - private static final String kIDLClassnamePrefix = "org.omg."; - private static final String kSequencePrefix = "["; - private static final String kCORBAPrefix = "CORBA/"; - private static final String kArrayPrefix = kValuePrefix + kSequencePrefix + kCORBAPrefix; - private static final int kValuePrefixLength = kValuePrefix.length(); - private static final int kIDLPrefixLength = kIDLPrefix.length(); - private static final int kSequencePrefixLength = kSequencePrefix.length(); - private static final String kInterfaceHashCode = ":0000000000000000"; - private static final String kInterfaceOnlyHashStr = "0000000000000000"; - private static final String kExternalizableHashStr = "0000000000000001"; - - // Value tag utility methods and constants - public static final int kInitialValueTag= 0x7fffff00; - public static final int kNoTypeInfo = 0; - public static final int kSingleRepTypeInfo = 0x02; - public static final int kPartialListTypeInfo = 0x06; - public static final int kChunkedMask = 0x08; - public static final int kPreComputed_StandardRMIUnchunked = RepositoryId.computeValueTag(false, RepositoryId.kSingleRepTypeInfo, false); - public static final int kPreComputed_CodeBaseRMIUnchunked = RepositoryId.computeValueTag(true, RepositoryId.kSingleRepTypeInfo, false); - public static final int kPreComputed_StandardRMIChunked = RepositoryId.computeValueTag(false, RepositoryId.kSingleRepTypeInfo, true); - public static final int kPreComputed_CodeBaseRMIChunked = RepositoryId.computeValueTag(true, RepositoryId.kSingleRepTypeInfo, true); - - public static final int kPreComputed_StandardRMIUnchunked_NoRep = RepositoryId.computeValueTag(false, RepositoryId.kNoTypeInfo, false); - public static final int kPreComputed_CodeBaseRMIUnchunked_NoRep = RepositoryId.computeValueTag(true, RepositoryId.kNoTypeInfo, false); - public static final int kPreComputed_StandardRMIChunked_NoRep = RepositoryId.computeValueTag(false, RepositoryId.kNoTypeInfo, true); - public static final int kPreComputed_CodeBaseRMIChunked_NoRep = RepositoryId.computeValueTag(true, RepositoryId.kNoTypeInfo, true); - - // Public, well known repository IDs - - // _REVISIT_ : A table structure with a good search routine for all of this - // would be more efficient and easier to maintain... - - // String - public static final String kWStringValueVersion = "1.0"; - public static final String kWStringValueHash = ":"+kWStringValueVersion; - public static final String kWStringStubValue = "WStringValue"; - public static final String kWStringTypeStr = "omg.org/CORBA/"+kWStringStubValue; - public static final String kWStringValueRepID = kIDLPrefix + kWStringTypeStr + kWStringValueHash; - - // Any - public static final String kAnyRepID = kIDLPrefix + "omg.org/CORBA/Any"; - - // Class - // Anita4: convert to uppercase - public static final String kClassDescValueHash = ":" + - Long.toHexString( - ObjectStreamClass.getActualSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase() + ":" + - Long.toHexString( - ObjectStreamClass.getSerialVersionUID(javax.rmi.CORBA.ClassDesc.class)).toUpperCase(); - public static final String kClassDescStubValue = "ClassDesc"; - public static final String kClassDescTypeStr = "javax.rmi.CORBA."+kClassDescStubValue; - public static final String kClassDescValueRepID = kValuePrefix + kClassDescTypeStr + kClassDescValueHash; - - // Object - public static final String kObjectValueHash = ":1.0"; - public static final String kObjectStubValue = "Object"; - - // Sequence - public static final String kSequenceValueHash = ":1.0"; - public static final String kPrimitiveSequenceValueHash = ":0000000000000000"; - - // Serializable - public static final String kSerializableValueHash = ":1.0"; - public static final String kSerializableStubValue = "Serializable"; - - // Externalizable - public static final String kExternalizableValueHash = ":1.0"; - public static final String kExternalizableStubValue = "Externalizable"; - - // Remote (The empty string is used for java.rmi.Remote) - public static final String kRemoteValueHash = ""; - public static final String kRemoteStubValue = ""; - public static final String kRemoteTypeStr = ""; - public static final String kRemoteValueRepID = ""; - - private static final Hashtable kSpecialArrayTypeStrings = new Hashtable(); - - static { - kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName())); - kSpecialArrayTypeStrings.put("javax.rmi.CORBA.ClassDesc", new StringBuffer(java.lang.Class.class.getName())); - kSpecialArrayTypeStrings.put("CORBA.Object", new StringBuffer(java.rmi.Remote.class.getName())); - - } - - private static final Hashtable kSpecialCasesRepIDs = new Hashtable(); - - static { - kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID); - kSpecialCasesRepIDs.put(java.lang.Class.class, kClassDescValueRepID); - kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID); - } - - private static final Hashtable kSpecialCasesStubValues = new Hashtable(); - - static { - kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue); - kSpecialCasesStubValues.put(java.lang.Class.class, kClassDescStubValue); - kSpecialCasesStubValues.put(java.lang.Object.class, kObjectStubValue); - kSpecialCasesStubValues.put(java.io.Serializable.class, kSerializableStubValue); - kSpecialCasesStubValues.put(java.io.Externalizable.class, kExternalizableStubValue); - kSpecialCasesStubValues.put(java.rmi.Remote.class, kRemoteStubValue); - } - - - private static final Hashtable kSpecialCasesVersions = new Hashtable(); - - static { - kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash); - kSpecialCasesVersions.put(java.lang.Class.class, kClassDescValueHash); - kSpecialCasesVersions.put(java.lang.Object.class, kObjectValueHash); - kSpecialCasesVersions.put(java.io.Serializable.class, kSerializableValueHash); - kSpecialCasesVersions.put(java.io.Externalizable.class, kExternalizableValueHash); - kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash); - } - - private static final Hashtable kSpecialCasesClasses = new Hashtable(); - - static { - kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class); - kSpecialCasesClasses.put(kClassDescTypeStr, java.lang.Class.class); - kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); - - kSpecialCasesClasses.put("org.omg.CORBA.WStringValue", java.lang.String.class); - kSpecialCasesClasses.put("javax.rmi.CORBA.ClassDesc", java.lang.Class.class); - //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class); - } - - private static final Hashtable kSpecialCasesArrayPrefix = new Hashtable(); - - static { - kSpecialCasesArrayPrefix.put(java.lang.String.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); - kSpecialCasesArrayPrefix.put(java.lang.Class.class, kValuePrefix + kSequencePrefix + "javax/rmi/CORBA/"); - kSpecialCasesArrayPrefix.put(java.lang.Object.class, kValuePrefix + kSequencePrefix + "java/lang/"); - kSpecialCasesArrayPrefix.put(java.io.Serializable.class, kValuePrefix + kSequencePrefix + "java/io/"); - kSpecialCasesArrayPrefix.put(java.io.Externalizable.class, kValuePrefix + kSequencePrefix + "java/io/"); - kSpecialCasesArrayPrefix.put(java.rmi.Remote.class, kValuePrefix + kSequencePrefix + kCORBAPrefix); - } - - private static final Hashtable kSpecialPrimitives = new Hashtable(); - - static { - kSpecialPrimitives.put("int","long"); - kSpecialPrimitives.put("long","longlong"); - kSpecialPrimitives.put("byte","octet"); - } - - /** - * Used to convert ascii to hex. - */ - private static final byte ASCII_HEX[] = { - (byte)'0', - (byte)'1', - (byte)'2', - (byte)'3', - (byte)'4', - (byte)'5', - (byte)'6', - (byte)'7', - (byte)'8', - (byte)'9', - (byte)'A', - (byte)'B', - (byte)'C', - (byte)'D', - (byte)'E', - (byte)'F', - }; - - - // bug fix for 4328952; to eliminate possibility of overriding this - // in a subclass. - public static final RepositoryIdCache cache = new RepositoryIdCache(); - - // Interface Rep ID Strings - public static final String kjava_rmi_Remote = createForAnyType(java.rmi.Remote.class); - public static final String korg_omg_CORBA_Object = createForAnyType(org.omg.CORBA.Object.class); - - // Dummy arguments for getIdFromHelper method - public static final Class kNoParamTypes[] ={}; - public static final Object kNoArgs[] = {}; - - - // To create a RepositoryID, use code similar to the following: - // RepositoryId.cache.getId( id ); - - RepositoryId(){} - - RepositoryId(String aRepId){ - init(aRepId); - } - - RepositoryId init(String aRepId) - { - this.repId = aRepId; - - // Special case for remote - if (aRepId.length() == 0) { - clazz = java.rmi.Remote.class; - typeString = ""; - isRMIValueType = true; - suid = kInterfaceOnlyHashStr; - return this; - } else if (aRepId.equals(kWStringValueRepID)) { - clazz = java.lang.String.class; - typeString = kWStringTypeStr; - isIDLType = true; - // fix where Attempting to obtain a FullValueDescription - // for an RMI value type with a String field causes an exception. - completeClassName = "java.lang.String"; - versionString = kWStringValueVersion; - return this; - } else { - String repId = convertFromISOLatin1(aRepId); - - int firstIndex = repId.indexOf(':') ; - if (firstIndex == -1) - throw new IllegalArgumentException( "RepsitoryId must have the form :" ) ; - int secondIndex = repId.indexOf( ':', firstIndex + 1 ) ; - - if (secondIndex == -1) - versionString = "" ; - else - versionString = repId.substring(secondIndex) ; - - if (repId.startsWith(kIDLPrefix)) { - typeString = - repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength)); - isIDLType = true; - - if (typeString.startsWith(kIDLNamePrefix)) - completeClassName = kIDLClassnamePrefix + - typeString.substring(kIDLNamePrefix.length()).replace('/','.'); - else - completeClassName = typeString.replace('/','.'); - - } else if (repId.startsWith(kValuePrefix)) { - typeString = - repId.substring(kValuePrefixLength, repId.indexOf(':', kValuePrefixLength)); - isRMIValueType = true; - - if (versionString.indexOf('.') == -1) { - actualSuid = versionString.substring(1); - suid = actualSuid; // default if not explicitly specified - - if (actualSuid.indexOf(':') != -1){ - // we have a declared hash also - int pos = actualSuid.indexOf(':')+1; - // actualSuid = suid.substring(pos); - // suid = suid.substring(0, pos-1); - suid = actualSuid.substring(pos); - actualSuid = actualSuid.substring(0, pos-1); - } - } else { - // _REVISIT_ : Special case version failure ? - } - } else { - isSupportedFormat = false; - typeString = "" ; - } - - if (typeString.startsWith(kSequencePrefix)) { - isSequence = true; - } - - return this; - } - } - - public final String getUnqualifiedName() { - if (unqualifiedName == null){ - String className = getClassName(); - int index = className.lastIndexOf('.'); - if (index == -1){ - unqualifiedName = className; - definedInId = "IDL::1.0"; - } - else { - unqualifiedName = className.substring(index); - definedInId = "IDL:" + className.substring(0, index).replace('.','/') + ":1.0"; - } - } - - return unqualifiedName; - } - - public final String getDefinedInId() { - if (definedInId == null){ - getUnqualifiedName(); - } - - return definedInId; - } - - public final String getTypeString() { - return typeString; - } - - public final String getVersionString() { - return versionString; - } - - public final String getSerialVersionUID() { - return suid; - } - - public final String getActualSerialVersionUID() { - return actualSuid; - } - public final long getSerialVersionUIDAsLong() { - return suidLong; - } - - public final long getActualSerialVersionUIDAsLong() { - return actualSuidLong; - } - - public final boolean isRMIValueType() { - return isRMIValueType; - } - - public final boolean isIDLType() { - return isIDLType; - } - - public final String getRepositoryId() { - return repId; - } - - public static byte[] getByteArray(String repStr) { - synchronized (repStrToByteArray){ - return (byte[]) repStrToByteArray.get(repStr); - } - } - - public static void setByteArray(String repStr, byte[] repStrBytes) { - synchronized (repStrToByteArray){ - repStrToByteArray.put(repStr, repStrBytes); - } - } - - public final boolean isSequence() { - return isSequence; - } - - public final boolean isSupportedFormat() { - return isSupportedFormat; - } - - - // This method will return the classname from the typestring OR if the classname turns out to be - // a special class "pseudo" name, then the matching real classname is returned. - public final String getClassName() { - - if (isRMIValueType) - return typeString; - else if (isIDLType) - return completeClassName; - else return null; - - } - - // This method calls getClazzFromType() and falls back to the repStrToClass - // cache if no class was found. It's used where any class matching the - // given repid is an acceptable result. - public final Class getAnyClassFromType() throws ClassNotFoundException { - try { - return getClassFromType(); - } catch (ClassNotFoundException cnfe) { - Class clz = (Class)repStrToClass.get(repId); - if (clz != null) - return clz; - else - throw cnfe; - } - } - - public final Class getClassFromType() - throws ClassNotFoundException { - if (clazz != null) - return clazz; - - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); - - if (specialCase != null){ - clazz = specialCase; - return specialCase; - } - else - { - try{ - return Util.loadClass(getClassName(), null, null); - } - catch(ClassNotFoundException cnfe){ - if (defaultServerURL != null) { - try{ - return getClassFromType(defaultServerURL); - } - catch(MalformedURLException mue){ - throw cnfe; - } - } - else throw cnfe; - } - } - - } - - public final Class getClassFromType(Class expectedType, String codebase) - throws ClassNotFoundException { - if (clazz != null) - return clazz; - - Class specialCase = (Class)kSpecialCasesClasses.get(getClassName()); - - if (specialCase != null){ - clazz = specialCase; - return specialCase; - } else { - ClassLoader expectedTypeClassLoader = (expectedType == null ? null : expectedType.getClassLoader()); - return Utility.loadClassOfType(getClassName(), - codebase, - expectedTypeClassLoader, - expectedType, - expectedTypeClassLoader); - } - - } - - public final Class getClassFromType(String url) - throws ClassNotFoundException, MalformedURLException { - return Util.loadClass(getClassName(), url, null); - } - - public final String toString() { - return repId; - } - - /** - * Checks to see if the FullValueDescription should be retrieved. - * @exception Throws IOException if suids do not match or if the repositoryID - * is not an RMIValueType - */ - public static boolean useFullValueDescription(Class clazz, String repositoryID) - throws IOException{ - - String clazzRepIDStr = createForAnyType(clazz); - - if (clazzRepIDStr.equals(repositoryID)) - return false; - - RepositoryId targetRepid; - RepositoryId clazzRepid; - - synchronized(cache) { - // to avoid race condition where multiple threads could be - // accessing this method, and their access to the cache may - // be interleaved giving unexpected results - - targetRepid = cache.getId(repositoryID); - clazzRepid = cache.getId(clazzRepIDStr); - } - //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz); - - if ((targetRepid.isRMIValueType()) && (clazzRepid.isRMIValueType())){ - if (!targetRepid.getSerialVersionUID().equals(clazzRepid.getSerialVersionUID())) { - - String mssg = "Mismatched serialization UIDs : Source (Rep. ID" + - clazzRepid + ") = " + - clazzRepid.getSerialVersionUID() + " whereas Target (Rep. ID " + repositoryID + - ") = " + targetRepid.getSerialVersionUID(); - //com.sun.corba.se.impl.io.ValueUtility.log("RepositoryId",mssg); - throw new IOException(mssg); - } - else { - return true; - } - } - else { - - throw new IOException("The repository ID is not of an RMI value type (Expected ID = " + clazzRepIDStr + "; Received ID = " + repositoryID +")"); - } - } - - private static String createHashString(java.io.Serializable ser) { - - return createHashString(ser.getClass()); - } - - private static String createHashString(java.lang.Class clazz) { - - if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz)) - return kInterfaceHashCode; - - //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz); - - long actualLong = ObjectStreamClass.getActualSerialVersionUID(clazz); - String hash = null; - if (actualLong == 0) - hash = kInterfaceOnlyHashStr; - else if (actualLong == 1) - hash = kExternalizableHashStr; - else - hash = Long.toHexString(actualLong).toUpperCase(); - while(hash.length() < 16){ - hash = "0" + hash; - } - - long declaredLong = ObjectStreamClass.getSerialVersionUID(clazz); - String declared = null; - if (declaredLong == 0) - declared = kInterfaceOnlyHashStr; - else if (declaredLong == 1) - declared = kExternalizableHashStr; - else - declared = Long.toHexString(declaredLong).toUpperCase(); - while (declared.length() < 16){ - declared = "0" + declared; - } - hash = hash + ":" + declared; - - return ":" + hash; - } - - /** - * Creates a repository ID for a sequence. This is for expert users only as - * this method assumes the object passed is an array. If passed an object - * that is not an array, it will produce a rep id for a sequence of zero - * length. This would be an error. - * @param ser The Java object to create a repository ID for - **/ - public static String createSequenceRepID(java.lang.Object ser){ - return createSequenceRepID(ser.getClass()); - } - - /** - * Creates a repository ID for a sequence. This is for expert users only as - * this method assumes the object passed is an array. If passed an object - * that is not an array, it will produce a malformed rep id. - * @param clazz The Java class to create a repository ID for - **/ - public static String createSequenceRepID(java.lang.Class clazz){ - synchronized (classSeqToRepStr){ - - String repid = (String)classSeqToRepStr.get(clazz); - if (repid != null) - return repid; - - Class originalClazz = clazz; - - Class type = null; - int numOfDims = 0; - - while ((type = clazz.getComponentType()) != null) { - numOfDims++; - clazz = type; - } - - if (clazz.isPrimitive()) - repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash; - else { - StringBuffer buf = new StringBuffer(); - buf.append(kValuePrefix); - while(numOfDims-- > 0) { - buf.append("["); - } - buf.append("L"); - buf.append(convertToISOLatin1(clazz.getName())); - buf.append(";"); - buf.append(createHashString(clazz)); - repid = buf.toString(); - } - classSeqToRepStr.put(originalClazz,repid); - return repid; - } - - } - - - public static String createForSpecialCase(java.lang.Class clazz){ - if (clazz.isArray()){ - return createSequenceRepID(clazz); - } - else { - return (String)kSpecialCasesRepIDs.get(clazz); - } - } - - public static String createForSpecialCase(java.io.Serializable ser){ - Class clazz = ser.getClass(); - if (clazz.isArray()){ - return createSequenceRepID(ser); - } - else - return createForSpecialCase(clazz); - } - - /** - * Creates a repository ID for a normal Java Type. - * @param ser The Java object to create a repository ID for - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. - **/ - public static String createForJavaType(java.io.Serializable ser) - throws com.sun.corba.se.impl.io.TypeMismatchException - { - synchronized (classToRepStr) { - String repid = createForSpecialCase(ser); - if (repid != null) - return repid; - Class clazz = ser.getClass(); - repid = (String)classToRepStr.get(clazz); - - if (repid != null) - return repid; - - repid = kValuePrefix + convertToISOLatin1(clazz.getName()) + - createHashString(clazz); - - classToRepStr.put(clazz, repid); - repStrToClass.put(repid, clazz); - return repid; - } - } - - /** - * Creates a repository ID for a normal Java Type. - * @param clz The Java class to create a repository ID for - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser implements the - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. - **/ - public static String createForJavaType(Class clz) - throws com.sun.corba.se.impl.io.TypeMismatchException - { - synchronized (classToRepStr){ - String repid = createForSpecialCase(clz); - if (repid != null) - return repid; - - repid = (String)classToRepStr.get(clz); - if (repid != null) - return repid; - - repid = kValuePrefix + convertToISOLatin1(clz.getName()) + - createHashString(clz); - - classToRepStr.put(clz, repid); - repStrToClass.put(repid, clz); - return repid; - } - } - - /** - * Creates a repository ID for an IDL Java Type. - * @param ser The IDL Value object to create a repository ID for - * @param major The major version number - * @param minor The minor version number - * @exception com.sun.corba.se.impl.io.TypeMismatchException if ser does not implement the - * org.omg.CORBA.portable.IDLEntity interface which indicates it is an IDL Value type. - **/ - public static String createForIDLType(Class ser, int major, int minor) - throws com.sun.corba.se.impl.io.TypeMismatchException - { - synchronized (classIDLToRepStr){ - String repid = (String)classIDLToRepStr.get(ser); - if (repid != null) - return repid; - - repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.','/') + - ":" + major + "." + minor; - classIDLToRepStr.put(ser, repid); - return repid; - } - } - - private static String getIdFromHelper(Class clazz){ - try { - Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null, - clazz.getClassLoader(), clazz, clazz.getClassLoader()); - Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes); - return (String)idMethod.invoke(null, kNoArgs); - } - catch(java.lang.ClassNotFoundException cnfe) - { - throw new org.omg.CORBA.MARSHAL(cnfe.toString()); - } - catch(java.lang.NoSuchMethodException nsme) - { - throw new org.omg.CORBA.MARSHAL(nsme.toString()); - } - catch(java.lang.reflect.InvocationTargetException ite) - { - throw new org.omg.CORBA.MARSHAL(ite.toString()); - } - catch(java.lang.IllegalAccessException iae) - { - throw new org.omg.CORBA.MARSHAL(iae.toString()); - } - } - - /** - * Createa a repository ID for the type if it is either a java type - * or an IDL type. - * @param type The type to create rep. id for - * @return The rep. id. - **/ - public static String createForAnyType(Class type) { - try{ - if (type.isArray()) - return createSequenceRepID(type); - else if (IDLEntity.class.isAssignableFrom(type)) - { - try{ - return getIdFromHelper(type); - } - catch(Throwable t) { - return createForIDLType(type, 1, 0); - } - } - else return createForJavaType(type); - } - catch(com.sun.corba.se.impl.io.TypeMismatchException e){ - return null; - } - - } - - public static boolean isAbstractBase(Class clazz) { - return (clazz.isInterface() && - IDLEntity.class.isAssignableFrom(clazz) && - (!ValueBase.class.isAssignableFrom(clazz)) && - (!org.omg.CORBA.Object.class.isAssignableFrom(clazz))); - - } - - public static boolean isAnyRequired(Class clazz) { - return ((clazz == java.lang.Object.class) || - (clazz == java.io.Serializable.class) || - (clazz == java.io.Externalizable.class)); - } - - public static long fromHex(String hexNumber) { - if (hexNumber.startsWith("0x")) - return Long.valueOf(hexNumber.substring(2), 16).longValue(); - else return Long.valueOf(hexNumber, 16).longValue(); - } - - /** - * Convert strings with illegal IDL identifier characters. - *

- * Section 5.5.7 of OBV spec. - */ - public static String convertToISOLatin1 (String name) { - - int length = name.length(); - if (length == 0) { - return name; - } - StringBuffer buffer = null; - - for (int i = 0; i < length; i++) { - - char c = name.charAt(i); - - if (c > 255 || IDL_IDENTIFIER_CHARS[c] == 0) { - - // We gotta convert. Have we already started? - - if (buffer == null) { - - // No, so get set up... - - buffer = new StringBuffer(name.substring(0,i)); - } - - // Convert the character into the IDL escape syntax... - buffer.append( - "\\U" + - (char)ASCII_HEX[(c & 0xF000) >>> 12] + - (char)ASCII_HEX[(c & 0x0F00) >>> 8] + - (char)ASCII_HEX[(c & 0x00F0) >>> 4] + - (char)ASCII_HEX[(c & 0x000F)]); - - } else { - if (buffer != null) { - buffer.append(c); - } - } - } - - if (buffer != null) { - name = buffer.toString(); - } - - return name; - } - - /** - * Convert strings with ISO Latin 1 escape sequences back to original strings. - *

- * Section 5.5.7 of OBV spec. - */ - private static String convertFromISOLatin1 (String name) { - - int index = -1; - StringBuffer buf = new StringBuffer(name); - - while ((index = buf.toString().indexOf("\\U")) != -1){ - String str = "0000" + buf.toString().substring(index+2, index+6); - - // Convert Hexadecimal - byte[] buffer = new byte[(str.length() - 4) / 2]; - for (int i=4, j=0; i < str.length(); i +=2, j++) { - buffer[j] = (byte)((Utility.hexOf(str.charAt(i)) << 4) & 0xF0); - buffer[j] |= (byte)((Utility.hexOf(str.charAt(i+1)) << 0) & 0x0F); - } - buf = new StringBuffer(delete(buf.toString(), index, index+6)); - buf.insert(index, (char)buffer[1]); - } - - return buf.toString(); - - - } - - private static String delete(String str, int from, int to) - { - return str.substring(0, from) + str.substring(to, str.length()); - } - - private static String replace(String target, String arg, String source) - { - int i = 0; - i = target.indexOf(arg); - - while(i != -1) - { - String left = target.substring(0, i); - String right = target.substring(i+arg.length()); - target = new String(left+source+right); - i = target.indexOf(arg); - } - return target; - } - - public static int computeValueTag(boolean codeBasePresent, int typeInfo, boolean chunkedEncoding){ - int value_tag = kInitialValueTag; - - if (codeBasePresent) - value_tag = value_tag | 0x00000001; - - value_tag = value_tag | typeInfo; - - if (chunkedEncoding) - value_tag = value_tag | kChunkedMask; - - return value_tag; - } - - public static boolean isCodeBasePresent(int value_tag){ - return ((value_tag & 0x00000001) == 1); - } - - public static int getTypeInfo(int value_tag){ - return (value_tag & 0x00000006); - } - - public static boolean isChunkedEncoding(int value_tag){ - return ((value_tag & kChunkedMask) != 0); - } - - public static String getServerURL(){ - return defaultServerURL; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryIdCache.java 2018-01-30 20:21:00.000000000 -0500 +++ /dev/null 2018-01-30 20:21:00.000000000 -0500 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1998, 2002, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; - -import java.util.Stack; -import java.util.Hashtable; -import java.util.EmptyStackException; -import java.util.Enumeration; - -// Really limited pool - in this case just creating several at a time... -class RepositoryIdPool extends Stack { - - private static int MAX_CACHE_SIZE = 4; - private RepositoryIdCache cache; - - public final synchronized RepositoryId popId() { - - try { - return (RepositoryId)super.pop(); - } - catch(EmptyStackException e) { - increasePool(5); - return (RepositoryId)super.pop(); - } - - } - - // Pool management - final void increasePool(int size) { - //if (cache.size() <= MAX_CACHE_SIZE) - for (int i = size; i > 0; i--) - push(new RepositoryId()); - /* - // _REVISIT_ This will not work w/out either thread tracing or weak references. I am - // betting that thread tracing almost completely negates benefit of reuse. Until either - // 1.2 only inclusion or proof to the contrary, I'll leave it this way... - else { - int numToReclaim = cache.size() / 2; - Enumeration keys = cache.keys(); - Enumeration elements = cache.elements(); - for (int i = numToReclaim; i > 0; i--) { - Object key = keys.nextElement(); - Object element = elements.nextElement(); - - push(element); - cache.remove(key); - } - } - */ - } - - final void setCaches(RepositoryIdCache cache) { - this.cache = cache; - } - -} - -public class RepositoryIdCache extends Hashtable { - - private RepositoryIdPool pool = new RepositoryIdPool(); - - public RepositoryIdCache() { - pool.setCaches(this); - } - - public final synchronized RepositoryId getId(String key) { - RepositoryId repId = (RepositoryId)super.get(key); - - if (repId != null) - return repId; - else { - //repId = pool.popId().init(key); - repId = new RepositoryId(key); - put(key, repId); - return repId; - } - - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/SUNVMCID.java 2018-01-30 20:21:00.000000000 -0500 +++ /dev/null 2018-01-30 20:21:00.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999, 2002, 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.corba.se.impl.util; - -/** - * The vendor minor code ID reserved for Sun by the OMG. - * All VMCIDs occupy the high order 20 bits. - */ - -public interface SUNVMCID { - - /** - * The vendor minor code ID reserved for Sun. This value is or'd with - * the high order 20 bits of the minor code to produce the minor value - * in a system exception. - */ - static final int value = 0x53550000; -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/Utility.java 2018-01-30 20:21:01.000000000 -0500 +++ /dev/null 2018-01-30 20:21:01.000000000 -0500 @@ -1,1002 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.BAD_OPERATION; -import org.omg.CORBA.BAD_INV_ORDER; -import org.omg.CORBA.BAD_PARAM; -import org.omg.CORBA.ORB; -import org.omg.CORBA.Any; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.portable.BoxedValueHelper; -import org.omg.CORBA.portable.ValueFactory; -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.Delegate; - - -import java.util.Hashtable; -import java.util.NoSuchElementException; - -import java.rmi.Remote; -import java.rmi.NoSuchObjectException; -import java.rmi.RemoteException; -import java.rmi.server.RemoteStub; - -import javax.rmi.PortableRemoteObject; -import javax.rmi.CORBA.Stub; -import javax.rmi.CORBA.Tie; -import javax.rmi.CORBA.Util; - -import java.io.Serializable; -import java.io.File; -import java.io.FileInputStream; - -import org.omg.PortableServer.POA; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.spi.presentation.rmi.PresentationManager; -import com.sun.corba.se.spi.presentation.rmi.StubAdapter ; - -import com.sun.corba.se.impl.logging.UtilSystemException ; -import com.sun.corba.se.impl.logging.OMGSystemException ; - -/** - * Handy class full of static functions. - */ -public final class Utility { - - public static final String STUB_PREFIX = "_"; - public static final String RMI_STUB_SUFFIX = "_Stub"; - public static final String DYNAMIC_STUB_SUFFIX = "_DynamicStub" ; - public static final String IDL_STUB_SUFFIX = "Stub"; - public static final String TIE_SUFIX = "_Tie"; - private static IdentityHashtable tieCache = new IdentityHashtable(); - private static IdentityHashtable tieToStubCache = new IdentityHashtable(); - private static IdentityHashtable stubToTieCache = new IdentityHashtable(); - private static Object CACHE_MISS = new Object(); - private static UtilSystemException wrapper = UtilSystemException.get( - CORBALogDomains.UTIL ) ; - private static OMGSystemException omgWrapper = OMGSystemException.get( - CORBALogDomains.UTIL ) ; - - /** - * Ensure that stubs, ties, and implementation objects - * are 'connected' to the runtime. Converts implementation - * objects to a type suitable for sending on the wire. - * @param obj the object to connect. - * @param orb the ORB to connect to if obj is exported to IIOP. - * @param convertToStub true if implementation types should be - * converted to Stubs rather than just org.omg.CORBA.Object. - * @return the connected object. - * @exception NoSuchObjectException if obj is an implementation - * which has not been exported. - */ - public static Object autoConnect(Object obj, ORB orb, boolean convertToStub) - { - if (obj == null) { - return obj; - } - - if (StubAdapter.isStub(obj)) { - try { - StubAdapter.getDelegate(obj) ; - } catch (BAD_OPERATION okay) { - try { - StubAdapter.connect( obj, orb ) ; - } catch (RemoteException e) { - // The stub could not be connected because it - // has an invalid IOR... - throw wrapper.objectNotConnected( e, - obj.getClass().getName() ) ; - } - } - - return obj; - } - - if (obj instanceof Remote) { - Remote remoteObj = (Remote)obj; - Tie theTie = Util.getTie(remoteObj); - if (theTie != null) { - try { - theTie.orb(); - } catch (SystemException okay) { - theTie.orb(orb); - } - - if (convertToStub) { - Object result = loadStub(theTie,null,null,true); - if (result != null) { - return result; - } else { - throw wrapper.couldNotLoadStub(obj.getClass().getName()); - } - } else { - return StubAdapter.activateTie( theTie ); - } - } else { - // This is an implementation object which has not been - // exported to IIOP OR is a JRMP stub or implementation - // object which cannot be marshalled into an ORB stream... - throw wrapper.objectNotExported( obj.getClass().getName() ) ; - } - } - - // Didn't need to do anything, just return the input... - - return obj; - } - - /* - * Get a new instance of an RMI-IIOP Tie for the - * given server object. - */ - public static Tie loadTie(Remote obj) { - Tie result = null; - Class objClass = obj.getClass(); - - // Have we tried to find this guy before? - - synchronized (tieCache) { - - Object it = tieCache.get(obj); - - if (it == null) { - - // No, so try it... - - try { - - // First try the classname... - - result = loadTie(objClass); - - // If we don't have a valid tie at this point, - // walk up the parent chain until we either - // load a tie or encounter PortableRemoteObject - // or java.lang.Object... - - while (result == null && - (objClass = objClass.getSuperclass()) != null && - objClass != PortableRemoteObject.class && - objClass != Object.class) { - - result = loadTie(objClass); - } - } catch (Exception ex) { - wrapper.loadTieFailed( ex, objClass.getName() ) ; - } - - // Did we get it? - - if (result == null) { - - // Nope, so cache that fact... - - tieCache.put(obj,CACHE_MISS); - - } else { - - // Yes, so cache it... - - tieCache.put(obj,result); - } - } else { - - // Yes, return a new instance or fail again if - // it was a miss last time... - - if (it != CACHE_MISS) { - try { - result = (Tie) it.getClass().newInstance(); - } catch (Exception e) { - } - } - } - } - - return result; - } - - /* - * Load an RMI-IIOP Tie - */ - private static Tie loadTie(Class theClass) - { - return com.sun.corba.se.spi.orb.ORB.getStubFactoryFactory(). - getTie( theClass ) ; - } - - /* - * Clear the stub/tie caches. Intended for use by - * test code. - */ - public static void clearCaches() { - synchronized (tieToStubCache) { - tieToStubCache.clear(); - } - synchronized (tieCache) { - tieCache.clear(); - } - synchronized (stubToTieCache) { - stubToTieCache.clear(); - } - } - - /* - * Load a class and check that it is assignable to a given type. - * @param className the class name. - * @param remoteCodebase the codebase to use. May be null. - * @param loader the class loader of last resort. May be null. - * @param expectedType the expected type. May be null. - * @return the loaded class. - */ - static Class loadClassOfType(String className, String remoteCodebase, - ClassLoader loader, Class expectedType, - ClassLoader expectedTypeClassLoader) throws ClassNotFoundException - { - Class loadedClass = null; - - try { - //Sequence finding of the stubs according to spec - try{ - //If-else is put here for speed up of J2EE. - //According to the OMG spec, the if clause is not dead code. - //It can occur if some compiler has allowed generation - //into org.omg.stub hierarchy for non-offending - //classes. This will encourage people to - //produce non-offending class stubs in their own hierarchy. - if (!PackagePrefixChecker.hasOffendingPrefix( - PackagePrefixChecker.withoutPackagePrefix(className))){ - loadedClass = Util.loadClass( - PackagePrefixChecker.withoutPackagePrefix(className), - remoteCodebase, - loader); - } else { - loadedClass = Util.loadClass(className, remoteCodebase, - loader); - } - } catch (ClassNotFoundException cnfe) { - loadedClass = Util.loadClass(className, remoteCodebase, - loader); - } - if (expectedType == null) - return loadedClass; - } catch (ClassNotFoundException cnfe) { - if (expectedType == null) - throw cnfe; - } - - // If no class was loaded, or if the loaded class is not of the - // correct type, make a further attempt to load the correct class - // using the classloader of the expected type. - // _REVISIT_ Is this step necessary, or should the Util,loadClass - // algorithm always produce a valid class if the setup is correct? - // Does the OMG standard algorithm need to be changed to include - // this step? - if (loadedClass == null || !expectedType.isAssignableFrom(loadedClass)){ - if (expectedType.getClassLoader() != expectedTypeClassLoader) - throw new IllegalArgumentException( - "expectedTypeClassLoader not class loader of " + - "expected Type."); - - if (expectedTypeClassLoader != null) - loadedClass = expectedTypeClassLoader.loadClass(className); - else { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (cl == null) - cl = ClassLoader.getSystemClassLoader(); - - loadedClass = cl.loadClass(className); - } - } - - return loadedClass; - } - - /* - * Load a class and check that it is compatible with a given type. - * @param className the class name. - * @param remoteCodebase the codebase to use. May be null. - * @param loadingContext the loading context. May be null. - * @param relatedType the related type. May be null. - * @return the loaded class. - */ - public static Class loadClassForClass (String className, - String remoteCodebase, - ClassLoader loader, - Class relatedType, - ClassLoader relatedTypeClassLoader) - throws ClassNotFoundException - { - if (relatedType == null) - return Util.loadClass(className, remoteCodebase, loader); - - Class loadedClass = null; - try { - loadedClass = Util.loadClass(className, remoteCodebase, loader); - } catch (ClassNotFoundException cnfe) { - if (relatedType.getClassLoader() == null) - throw cnfe; - } - - // If no class was not loaded, or if the loaded class is not of the - // correct type, make a further attempt to load the correct class - // using the classloader of the related type. - // _REVISIT_ Is this step necessary, or should the Util,loadClass - // algorithm always produce a valid class if the setup is correct? - // Does the OMG standard algorithm need to be changed to include - // this step? - if (loadedClass == null || - (loadedClass.getClassLoader() != null && - loadedClass.getClassLoader().loadClass(relatedType.getName()) != - relatedType)) - { - if (relatedType.getClassLoader() != relatedTypeClassLoader) - throw new IllegalArgumentException( - "relatedTypeClassLoader not class loader of relatedType."); - - if (relatedTypeClassLoader != null) - loadedClass = relatedTypeClassLoader.loadClass(className); - } - - return loadedClass; - } - - /** - * Get the helper for an IDLValue - * - * Throws MARSHAL exception if no helper found. - */ - public static BoxedValueHelper getHelper(Class clazz, String codebase, - String repId) - { - String className = null; - if (clazz != null) { - className = clazz.getName(); - if (codebase == null) - codebase = Util.getCodebase(clazz); - } else { - if (repId != null) - className = RepositoryId.cache.getId(repId).getClassName(); - if (className == null) // no repId or unrecognized repId - throw wrapper.unableLocateValueHelper( - CompletionStatus.COMPLETED_MAYBE); - } - - try { - ClassLoader clazzLoader = - (clazz == null ? null : clazz.getClassLoader()); - Class helperClass = - loadClassForClass(className+"Helper", codebase, clazzLoader, - clazz, clazzLoader); - return (BoxedValueHelper)helperClass.newInstance(); - - } catch (ClassNotFoundException cnfe) { - throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, - cnfe ); - } catch (IllegalAccessException iae) { - throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, - iae ); - } catch (InstantiationException ie) { - throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, - ie ); - } catch (ClassCastException cce) { - throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE, - cce ); - } - } - - /** - * Get the factory for an IDLValue - * - * Throws MARSHAL exception if no factory found. - */ - public static ValueFactory getFactory(Class clazz, String codebase, - ORB orb, String repId) - { - ValueFactory factory = null; - if ((orb != null) && (repId != null)) { - try { - factory = ((org.omg.CORBA_2_3.ORB)orb).lookup_value_factory( - repId); - } catch (org.omg.CORBA.BAD_PARAM ex) { - // Try other way - } - } - - String className = null; - if (clazz != null) { - className = clazz.getName(); - if (codebase == null) - codebase = Util.getCodebase(clazz); - } else { - if (repId != null) - className = RepositoryId.cache.getId(repId).getClassName(); - if (className == null) // no repId or unrecognized repId - throw omgWrapper.unableLocateValueFactory( - CompletionStatus.COMPLETED_MAYBE); - } - - // if earlier search found a non-default factory, or the same default - // factory that loadClassForClass would return, bale out now... - if (factory != null && - (!factory.getClass().getName().equals(className+"DefaultFactory") || - (clazz == null && codebase == null))) - return factory; - - try { - ClassLoader clazzLoader = - (clazz == null ? null : clazz.getClassLoader()); - Class factoryClass = - loadClassForClass(className+"DefaultFactory", codebase, - clazzLoader, clazz, clazzLoader); - return (ValueFactory)factoryClass.newInstance(); - - } catch (ClassNotFoundException cnfe) { - throw omgWrapper.unableLocateValueFactory( - CompletionStatus.COMPLETED_MAYBE, cnfe); - } catch (IllegalAccessException iae) { - throw omgWrapper.unableLocateValueFactory( - CompletionStatus.COMPLETED_MAYBE, iae); - } catch (InstantiationException ie) { - throw omgWrapper.unableLocateValueFactory( - CompletionStatus.COMPLETED_MAYBE, ie); - } catch (ClassCastException cce) { - throw omgWrapper.unableLocateValueFactory( - CompletionStatus.COMPLETED_MAYBE, cce); - } - } - - /* - * Load an RMI-IIOP Stub given a Tie. - * @param tie the tie. - * @param stubClass the stub class. May be null. - * @param remoteCodebase the codebase to use. May be null. - * @param onlyMostDerived if true, will fail if cannot load a stub for the - * first repID in the tie. If false, will walk all repIDs. - * @return the stub or null if not found. - */ - - public static Remote loadStub(Tie tie, - PresentationManager.StubFactory stubFactory, - String remoteCodebase, - boolean onlyMostDerived) - { - StubEntry entry = null; - - // Do we already have it cached? - synchronized (tieToStubCache) { - Object cached = tieToStubCache.get(tie); - if (cached == null) { - // No, so go try to load it... - entry = loadStubAndUpdateCache( - tie, stubFactory, remoteCodebase, onlyMostDerived); - } else { - // Yes, is it a stub? If not, it was a miss last - // time, so return null again... - if (cached != CACHE_MISS) { - // It's a stub. - entry = (StubEntry) cached; - - // Does the cached stub meet the requirements - // of the caller? If the caller does not require - // the most derived stub and does not require - // a specific stub type, we don't have to check - // any further because the cached type is good - // enough... - if (!entry.mostDerived && onlyMostDerived) { - // We must reload because we do not have - // the most derived cached already... - // The stubFactory arg must be null here - // to force onlyMostDerived=true to work - // correctly. - entry = loadStubAndUpdateCache(tie,null, - remoteCodebase,true); - } else if (stubFactory != null && - !StubAdapter.getTypeIds(entry.stub)[0].equals( - stubFactory.getTypeIds()[0]) ) - { - // We do not have exactly the right stub. First, try to - // upgrade the cached stub by forcing it to the most - // derived stub... - entry = loadStubAndUpdateCache(tie,null, - remoteCodebase,true); - - // If that failed, try again with the exact type - // we need... - if (entry == null) { - entry = loadStubAndUpdateCache(tie,stubFactory, - remoteCodebase,onlyMostDerived); - } - } else { - // Use the cached stub. Is the delegate set? - try { - Delegate stubDel = StubAdapter.getDelegate( - entry.stub ) ; - } catch (Exception e2) { - // No, so set it if we can... - try { - Delegate del = StubAdapter.getDelegate( - tie ) ; - StubAdapter.setDelegate( entry.stub, - del ) ; - } catch (Exception e) {} - } - } - } - } - } - - if (entry != null) { - return (Remote)entry.stub; - } else { - return null; - } - } - - /* - * Load an RMI-IIOP Stub given a Tie, but do not look in the cache. - * This method must be called with the lock held for tieToStubCache. - * @param tie the tie. - * @param stubFactory the stub factory. May be null. - * @param remoteCodebase the codebase to use. May be null. - * @param onlyMostDerived if true, will fail if cannot load a stub for the - * first repID in the tie. If false, will walk all repIDs. - * @return the StubEntry or null if not found. - */ - private static StubEntry loadStubAndUpdateCache ( - Tie tie, PresentationManager.StubFactory stubFactory, - String remoteCodebase, boolean onlyMostDerived) - { - org.omg.CORBA.Object stub = null; - StubEntry entry = null; - boolean tieIsStub = StubAdapter.isStub( tie ) ; - - if (stubFactory != null) { - try { - stub = stubFactory.makeStub(); - } catch (Throwable e) { - wrapper.stubFactoryCouldNotMakeStub( e ) ; - if (e instanceof ThreadDeath) { - throw (ThreadDeath) e; - } - } - } else { - String[] ids = null; - if (tieIsStub) { - ids = StubAdapter.getTypeIds( tie ) ; - } else { - // This will throw an exception if the tie - // is not a Servant. XXX Handle this better? - ids = ((org.omg.PortableServer.Servant)tie). - _all_interfaces( null, null ); - } - - if (remoteCodebase == null) { - remoteCodebase = Util.getCodebase(tie.getClass()); - } - - if (ids.length == 0) { - stub = new org.omg.stub.java.rmi._Remote_Stub(); - } else { - // Now walk all the RepIDs till we find a stub or fail... - for (int i = 0; i < ids.length; i++) { - if (ids[i].length() == 0) { - stub = new org.omg.stub.java.rmi._Remote_Stub(); - break; - } - - try { - PresentationManager.StubFactoryFactory stubFactoryFactory = - com.sun.corba.se.spi.orb.ORB.getStubFactoryFactory(); - RepositoryId rid = RepositoryId.cache.getId( ids[i] ) ; - String className = rid.getClassName() ; - boolean isIDLInterface = rid.isIDLType() ; - stubFactory = stubFactoryFactory.createStubFactory( - className, isIDLInterface, remoteCodebase, null, - tie.getClass().getClassLoader() ) ; - stub = stubFactory.makeStub(); - break; - } catch (Exception e) { - wrapper.errorInMakeStubFromRepositoryId( e ) ; - } - - if (onlyMostDerived) - break; - } - } - } - - if (stub == null) { - // Stub == null, so cache the miss... - tieToStubCache.put(tie,CACHE_MISS); - } else { - if (tieIsStub) { - try { - Delegate del = StubAdapter.getDelegate( tie ) ; - StubAdapter.setDelegate( stub, del ) ; - } catch( Exception e1 ) { - // The tie does not have a delegate set, so stash - // this tie away using the stub as a key so that - // later, when the stub is connected, we can find - // and connect the tie as well... - - synchronized (stubToTieCache) { - stubToTieCache.put(stub,tie); - } - } - } else { - // Tie extends Servant - try { - Delegate delegate = StubAdapter.getDelegate( tie ) ; - StubAdapter.setDelegate( stub, delegate ) ; - } catch( org.omg.CORBA.BAD_INV_ORDER bad) { - synchronized (stubToTieCache) { - stubToTieCache.put(stub,tie); - } - } catch( Exception e ) { - // Exception is caught because of any of the - // following reasons - // 1) POA is not associated with the TIE - // 2) POA Policies for the tie-associated POA - // does not support _this_object() call. - throw wrapper.noPoa( e ) ; - } - } - // Update the cache... - entry = new StubEntry(stub,onlyMostDerived); - tieToStubCache.put(tie,entry); - } - - return entry; - } - - /* - * If we loadStub(Tie,...) stashed away a tie which was - * not connected, remove it from the cache and return - * it. - */ - public static Tie getAndForgetTie (org.omg.CORBA.Object stub) { - synchronized (stubToTieCache) { - return (Tie) stubToTieCache.remove(stub); - } - } - - /* - * Remove any cached Stub for the given tie. - */ - public static void purgeStubForTie (Tie tie) { - StubEntry entry; - synchronized (tieToStubCache) { - entry = (StubEntry)tieToStubCache.remove(tie); - } - if (entry != null) { - synchronized (stubToTieCache) { - stubToTieCache.remove(entry.stub); - } - } - } - - /* - * Remove cached tie/servant pair. - */ - public static void purgeTieAndServant (Tie tie) { - synchronized (tieCache) { - Object target = tie.getTarget(); - if (target != null) - tieCache.remove(target); - } - } - - /* - * Convert a RepId to a stubName... - */ - public static String stubNameFromRepID (String repID) { - - // Convert the typeid to a RepositoryId instance, get - // the className and mangle it as needed... - - RepositoryId id = RepositoryId.cache.getId(repID); - String className = id.getClassName(); - - if (id.isIDLType()) { - className = idlStubName(className); - } else { - className = stubName(className); - } - return className; - } - - - /* - * Load an RMI-IIOP Stub. This is used in PortableRemoteObject.narrow. - */ - public static Remote loadStub (org.omg.CORBA.Object narrowFrom, - Class narrowTo) - { - Remote result = null; - - try { - // Get the codebase from the delegate to use when loading - // the new stub, if possible... - String codebase = null; - try { - // We can't assume that narrowFrom is a CORBA_2_3 stub, yet - // it may have a 2_3 Delegate that provides a codebase. Swallow - // the ClassCastException otherwise. - Delegate delegate = StubAdapter.getDelegate( narrowFrom ) ; - codebase = ((org.omg.CORBA_2_3.portable.Delegate)delegate). - get_codebase(narrowFrom); - - } catch (ClassCastException e) { - wrapper.classCastExceptionInLoadStub( e ) ; - } - - PresentationManager.StubFactoryFactory sff = - com.sun.corba.se.spi.orb.ORB.getStubFactoryFactory() ; - PresentationManager.StubFactory sf = sff.createStubFactory( - narrowTo.getName(), false, codebase, narrowTo, - narrowTo.getClassLoader() ) ; - result = (Remote)sf.makeStub() ; - StubAdapter.setDelegate( result, - StubAdapter.getDelegate( narrowFrom ) ) ; - } catch (Exception err) { - wrapper.exceptionInLoadStub( err ) ; - } - - return result; - } - - /* - * Load an RMI-IIOP Stub class. This is used in the - * StaticStubFactoryFactory code. - */ - public static Class loadStubClass(String repID, - String remoteCodebase, - Class expectedType) - throws ClassNotFoundException - { - // Get the repID and check for "" special case. - // We should never be called with it (See CDRInputStream - // and the loadStub() method)... - - if (repID.length() == 0) { - throw new ClassNotFoundException(); - } - - // Get the stubname from the repID and load - // the class. If we have a valid 'sender', fall - // back to using its codebase if we need to... - String className = Utility.stubNameFromRepID(repID); - ClassLoader expectedTypeClassLoader = (expectedType == null ? null : - expectedType.getClassLoader()); - - try { - return loadClassOfType(className, - remoteCodebase, - expectedTypeClassLoader, - expectedType, - expectedTypeClassLoader); - } catch (ClassNotFoundException e) { - return loadClassOfType(PackagePrefixChecker.packagePrefix() + className, - remoteCodebase, - expectedTypeClassLoader, - expectedType, - expectedTypeClassLoader); - } - } - - /** - * Create an RMI stub name. - */ - public static String stubName (String className) - { - return stubName( className, false ) ; - } - - public static String dynamicStubName( String className ) - { - return stubName( className, true ) ; - } - - private static String stubName( String className, - boolean isDynamic ) - { - String name = stubNameForCompiler( className, isDynamic ) ; - if (PackagePrefixChecker.hasOffendingPrefix( name )) - name = PackagePrefixChecker.packagePrefix() + name ; - return name ; - } - - public static String stubNameForCompiler (String className) - { - return stubNameForCompiler( className, false ) ; - } - - private static String stubNameForCompiler( String className, - boolean isDynamic ) - { - int index = className.indexOf('$'); - if (index < 0) { - index = className.lastIndexOf('.'); - } - - String suffix = isDynamic ? DYNAMIC_STUB_SUFFIX : - RMI_STUB_SUFFIX ; - - if (index > 0) { - return className.substring(0,index+1) + STUB_PREFIX + - className.substring(index+1) + suffix; - } else { - return STUB_PREFIX + className + suffix; - } - } - - /** - * Create an RMI tie name. - */ - public static String tieName (String className) - { - return - PackagePrefixChecker.hasOffendingPrefix(tieNameForCompiler(className)) ? - PackagePrefixChecker.packagePrefix() + tieNameForCompiler(className) : - tieNameForCompiler(className); - } - - public static String tieNameForCompiler (String className) - { - int index = className.indexOf('$'); - if (index < 0) { - index = className.lastIndexOf('.'); - } - if (index > 0) { - return className.substring(0,index+1) + - STUB_PREFIX + - className.substring(index+1) + - TIE_SUFIX; - } else { - return STUB_PREFIX + - className + - TIE_SUFIX; - } - } - - /** - * Throws the CORBA equivalent of a java.io.NotSerializableException - */ - public static void throwNotSerializableForCorba(String className) { - throw omgWrapper.notSerializable( CompletionStatus.COMPLETED_MAYBE, - className ) ; - } - - /** - * Create an IDL stub name. - */ - public static String idlStubName(String className) - { - String result = null; - int index = className.lastIndexOf('.'); - if (index > 0) { - result = className.substring(0,index+1) + - STUB_PREFIX + - className.substring(index+1) + - IDL_STUB_SUFFIX; - } else { - result = STUB_PREFIX + - className + - IDL_STUB_SUFFIX; - } - return result; - } - - public static void printStackTrace() - { - Throwable thr = new Throwable( "Printing stack trace:" ) ; - thr.fillInStackTrace() ; - thr.printStackTrace() ; - } - - /** - * Read an object reference from the input stream and narrow - * it to the desired type. - * @param in the stream to read from. - * @throws ClassCastException if narrowFrom cannot be cast to narrowTo. - */ - public static Object readObjectAndNarrow(InputStream in, - Class narrowTo) - throws ClassCastException - { - Object result = in.read_Object(); - if (result != null) - return PortableRemoteObject.narrow(result, narrowTo); - else - return null; - } - - /** - * Read an abstract interface type from the input stream and narrow - * it to the desired type. - * @param in the stream to read from. - * @throws ClassCastException if narrowFrom cannot be cast to narrowTo. - */ - public static Object readAbstractAndNarrow( - org.omg.CORBA_2_3.portable.InputStream in, Class narrowTo) - throws ClassCastException - { - Object result = in.read_abstract_interface(); - if (result != null) - return PortableRemoteObject.narrow(result, narrowTo); - else - return null; - } - - - /** Converts an Ascii Character into Hexadecimal digit - */ - static int hexOf( char x ) - { - int val; - - val = x - '0'; - if (val >=0 && val <= 9) - return val; - - val = (x - 'a') + 10; - if (val >= 10 && val <= 15) - return val; - - val = (x - 'A') + 10; - if (val >= 10 && val <= 15) - return val; - - throw wrapper.badHexDigit() ; - } -} - -class StubEntry { - org.omg.CORBA.Object stub; - boolean mostDerived; - - StubEntry(org.omg.CORBA.Object stub, boolean mostDerived) { - this.stub = stub; - this.mostDerived = mostDerived; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/impl/util/Version.java 2018-01-30 20:21:02.000000000 -0500 +++ /dev/null 2018-01-30 20:21:02.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1998, 2002, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package com.sun.corba.se.impl.util; -import java.util.Date; - -public class Version { - - public static final String PROJECT_NAME = "RMI-IIOP"; - public static final String VERSION = "1.0"; - public static final String BUILD = "0.0"; - public static final String BUILD_TIME = "unknown"; - public static final String FULL = PROJECT_NAME + " " + VERSION + " (" - + BUILD_TIME + ")"; - - public static String asString () { - return FULL; - } - - public static void main (String[] args) { - System.out.println(FULL); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/internal/CosNaming/BootstrapServer.java 2018-01-30 20:21:02.000000000 -0500 +++ /dev/null 2018-01-30 20:21:02.000000000 -0500 @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.internal.CosNaming; - -import java.util.Enumeration; -import java.util.Properties; - -import java.io.File; -import java.io.FileInputStream; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.resolver.Resolver ; -import com.sun.corba.se.spi.resolver.LocalResolver ; -import com.sun.corba.se.spi.resolver.ResolverDefault ; - -import com.sun.corba.se.impl.orbutil.CorbaResourceUtil; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -/** - * Class BootstrapServer is the main entry point for the bootstrap server - * implementation. The BootstrapServer makes all object references - * defined in a configurable file available using the old - * naming bootstrap protocol. - */ -public class BootstrapServer -{ - private ORB orb; - - /** - * Main startup routine for the bootstrap server. - * It first determines the port on which to listen, checks that the - * specified file is available, and then creates the resolver - * that will be used to service the requests in the - * BootstrapServerRequestDispatcher. - * @param args the command-line arguments to the main program. - */ - public static final void main(String[] args) - { - String propertiesFilename = null; - int initialPort = ORBConstants.DEFAULT_INITIAL_PORT; - - // Process arguments - for (int i=0;i"Y", and an - * object, YY, then a subsequent call to - * ORB.resolve_initial_references( "Y" ) will - * return object YY. - * - * @param id The ID by which the initial reference will be known. - * @param obj The initial reference itself. - * @throws InvalidName if this operation is called with an empty string id - * or this operation is called with an id that is already registered, - * including the default names defined by OMG. - * @throws BAD_PARAM if the obj parameter is null. - */ - public void register_initial_reference( String id, - org.omg.CORBA.Object obj ) - throws InvalidName - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/pept/broker/Broker.java 2018-01-30 20:21:06.000000000 -0500 +++ /dev/null 2018-01-30 20:21:06.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.pept.broker; - -import com.sun.corba.se.pept.protocol.ClientInvocationInfo; -import com.sun.corba.se.pept.transport.TransportManager; - -/** - * @author Harold Carr - */ -public interface Broker -{ - public ClientInvocationInfo createOrIncrementInvocationInfo(); - public ClientInvocationInfo getInvocationInfo(); - public void releaseOrDecrementInvocationInfo(); - - public abstract TransportManager getTransportManager(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/encoding/InputObject.java 2018-01-30 20:21:07.000000000 -0500 +++ /dev/null 2018-01-30 20:21:07.000000000 -0500 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.pept.encoding; - -import java.io.IOException; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -/** - *

An InputObject is the interface used by the - * presentation block to get programming language typed data from data - * encoded in a message.

- * - *

The implementation of an InputObject contains the - * encoded data. When the presentation block asks for data the - * implementation of InputObject is responsible for converting - * the encoded representation of the data to the types expected by the - * programming language.

- * - *

A particular encoding would subclass - * InputObject. The subclass would provide methods to get - * the data types appropriate to the presentation block (e.g., simple - * types such as int or boolean, all the way to any type derived from - * java.io.Serializable.).

- * - *

Note: the protocol block may also use the InputObject to - * obtain header metadata.

- * - * @author Harold Carr -*/ -public interface InputObject -{ - public void setMessageMediator(MessageMediator messageMediator); - - public MessageMediator getMessageMediator(); - - public void close() throws IOException; -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/encoding/OutputObject.java 2018-01-30 20:21:08.000000000 -0500 +++ /dev/null 2018-01-30 20:21:08.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.pept.encoding; - -import java.io.IOException; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -/** - *

An OutputObject is the interface used by the - * presentation block to give programming language typed data to - * the encoding block to be encoded and sent in a message.

- * - *

The implementation of an OutputObject contains the - * encoded data. When the presentation block gives programming language - * typed data to - * OutputObject, the - * implementation of OutputObject is responsible for converting - * that data to the encoded representation of the data for a particular - * encoding.

- * - *

A particular encoding would subclass - * OutputObject. The subclass would provide methods to set - * the data types appropriate to the presentation block (e.g., simple - * types such as int or boolean, all the way to any type derived from - * java.io.Serializable.).

- * - *

Note: the protocol block may also use the OutputObject to - * set header metadata.

- * - * @author Harold Carr -*/ -public interface OutputObject -{ - public void setMessageMediator(MessageMediator messageMediator); - - public MessageMediator getMessageMediator(); - - public void close() throws IOException; -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/package.html 2018-01-30 20:21:08.000000000 -0500 +++ /dev/null 2018-01-30 20:21:08.000000000 -0500 @@ -1,359 +0,0 @@ - - - - - - - -

This package is the top-level package for the PEPt Remoting -Architecture. PEPt enables remoting (i.e., RPC and Messaging) -systems to dynamically use alternate encodings, protocols and -transports.

- -

Related Documentation

- -

-For papers, slides and examples of the PEPt architecture, please see: -

-

- -

PEPt Architecture

- -

-PEPt stands for: -

    - -
  • Presentation: the data types that may be passed and the -APIs used to interact with the remoting system.
  • - -
  • Encoding: the process of transforming those programming -language data types into an underlying "wire" representation (and the -wire representation itself).
  • - -
  • Protocol: The metadata which accompanies a message and the -use of that metadata.
  • - -
  • transport: The mechanism used to move the encoded data and -metadata from one location to another.
  • - -
-

- -

Key PEPt Interfaces

-
    - -
  • {@link com.sun.corba.se.pept.transport.ContactInfoList ContactInfoList} - - Client-side address selection mechanism and factory for - alternate encodings, protocols and transports (EPT).
  • - -
  • {@link com.sun.corba.se.pept.transport.Acceptor Acceptor} - - Server-side endpoint, addressing and factory for alternate EPTs.
  • - -
-

- -

PEPt Client-side Interfaces

-
    -
  • Protocol -
      - -
    • {@link com.sun.corba.se.pept.protocol.ClientDelegate ClientDelegate} - - The presentation block interacts with ClientDelegate - to initiate and complete a message send (and a possible - response). ClientDelegate is a "portability" interface, - to allow different vendors to plug in their implementation into a - standard presentation block.
    • - -
    • {@link com.sun.corba.se.pept.protocol.ClientRequestDispatcher - ClientRequestDispatcher} - This interface controls the client-side - dispatch for a given EPT.
    • - -
    -
  • -
  • Transport -
      - -
    • {@link com.sun.corba.se.pept.protocol.ContactInfoList - ContactInfoList} - A list of ContactInfo associated - with a ClientDelegate
    • . - -
    • {@link com.sun.corba.se.pept.protocol.ContactInfoListIterator - ContactInfoListIterator} - An iterator which chooses the "next" - EPT-specific ContactInfo.
    • - -
    • {@link com.sun.corba.se.pept.protocol.ContactInfoList - ContactInfo} - The key PEPt client-side interface. The - presentation block uses a ClientDelegate to select an - EPT-specific ContactInfo. That ContactInfo - serves as a factory for EPT-specifc - ClientRequestDispatcher, - Input/OutputObjects and Connection.
    • - -
    -
  • -
-

- -

PEPt Server-side Interfaces

-
    -
  • Protocol -
      - -
    • {@link com.sun.corba.se.pept.protocol.ServerRequestDispatcher - ServerRequestDispatcher} - This interface controls the server-side - dispatch for a given EPT.
    • - -
    -
  • -
  • Transport -
      - -
    • {@link com.sun.corba.se.pept.protocol.Acceptor Acceptor} - - The key PEPt server-side interface. Aceptor - serves as a factory for EPT-specifc - ServerRequestDispatcher, - Input/OutputObjects and Connection.
    • - -
    -
  • -
-

- -

PEPt Client and Server Interfaces

-
    -
  • Presentation -
      - -
    • PEPt, at this time, does not provide interfaces for the - presentation level. PEPt is the architecture underlying Sun's CORBA - implementation. In that implementation the CORBA system provides - stubs, ties, DII and DSI presentation artifacts that interact with - the underlying PEPt interfaces.
    • - -
    -
  • -
  • Encoding -
      - -
    • {@link com.sun.corba.se.pept.encoding.InputObject InputObject} - - The presentation block uses an InputObject to - retrieve programming language typed data from encoded data sent in a - message.
    • - -
    • {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - - The presentation block uses an OutputObject to - post programming language typed data to be encoded and sent in a - message.
    • - -
    -
  • -
  • Protocol -
      - -
    • {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator} - - A "repository" of data associated with a message to be sent or one - received. It is the main object used as an argument for methods of - the interfaces of the PEPt architecture.
    • - -
    • {@link com.sun.corba.se.pept.protocol.ProtocolHandler ProtocolHandler} - - Used to determine an incoming message and dispatch it - appropriately.
    • - -
    -
  • -
  • transport -
      - -
    • {@link com.sun.corba.se.pept.protocol.Connection Connection} - - The top-level abstraction of a "connection" between two PEPt - peers. Concreate instances may be TCP/IP sockets, Solaris Doors, - Shared Memory, ATM, etc.
    • - -
    -
  • -
-

- -

High-level view of PEPt Operation

- -

PEPt Client-side Operation

- -
    -
  1. Presentation asks ClientDelegate for an -OutputObject.
  2. -
      -
    1. ClientDelegate gets an EPT-specific - ContactInfo.
    2. -
    3. ClientDelegate uses the chosen - ContactInfo as a factory to get an EPT-specific - ClientRequestDispatcher.
    4. -
    5. ClientDelegate transfers control to the - EPT-specific ClientRequestDispatcher.beginRequest. -
        -
      1. ClientRequestDispatcher.beginRequest uses - ContactInfo as a factory to get EPT-specific - OutputObject, MessageMediator and - Connection.
      2. -
      3. ClientRequestDispatcher.beginRequest may marshal - or set header information on the OutputObject and it - may execute interceptors (which may add additional header - information) before returning the OutputObject to the - presentation block.
      4. -
      -
    -
  3. Presentation block sets data objects to be sent by calling -OutputObject methods.
  4. -
  5. Presentation block signals the PEPt architecture to send the -message by calling -ClientRequestDispatcher.marshalingComplete.
  6. -
  7. ClientRequestDispatcher.marshalingComplete sends the -headers and data encoded in OutputObject on the -Connection.
  8. -
  9. Depending on the EPT, -ClientRequestDispatcher.marshalingComplete may return -immediately (i.e., an asynchronous message send with no -acknowledgment), may wait to get an indication that the message send -was successfully (i.e., an acknowledged asynchronous send) or wait for -a response (a synchronous message send). The following steps assume -waiting for a response.
  10. -
  11. ClientRequestDispatcher.marshalingComplete waits for a -response. This may mean blocking on a read of the -Connection (e.g., SOAP/HTTP), or putting the client -thread to sleep while another thread demultiplexes replies (e.g., -RMI-IIOP), or using the client thread itself to perform the -server-side operation (e.g., colocation optimization).
  12. -
  13. When a response arrives on the Connection it gives -the raw bits of the response to ContactInfo which creates -an EPT-specific InputObject and calls -ProtocolHandler.handleRequest to determine the message -type.
  14. -
      -
    1. ProtocolHandler.handleRequest determines the - message type (e.g., Request, Response, Error, Cancel, Close, ...).
    2. -
    3. Suppose it is a response to an RMI-IIOP request. In that case - it would find the thread and MessageMediator which - originated the request and wake it up, after having passed it the - response InputObject.
    4. -
    -
  15. ClientRequestDispatcher.marshalingComplete may run -interceptors and use reply header metadata befor returning control to -the presentation block.
  16. -
  17. The presentation block call to -ClientRequestDispatcher.marshalingComplete would return -the response InputObject.
  18. -
  19. The presentation block would get response data objects from the -InputObject.
  20. -
  21. The presentation block would signal the PEPt architecture that -the invocation is complete by calling -ClientRequestDispatcher.endRequest.
  22. -
  23. ClientRequestDispatcher.endRequest may clean up -resources used in the invocation.
  24. -
- -

PEPt Server-side Operation

- -

Suppose a server support several EPTs.

- -
    -
  1. For each EPT, register an Acceptor.
  2. -
  3. If the system supports the concept of an "object reference" then -the Acceptor is responsible for adding its EPT -information (e.g., address information) to the object reference.
  4. -
  5. The Acceptor acts as a "listener" for client -connection requests.
  6. -
  7. When the Acceptor receives a connection request it -creates an EPT-specific Connection on which to receive -messages.
  8. -
  9. When Connection receives a message, it gives the raw -bits of the message to Acceptor which creates an -EPT-specific InputObject and calls -ProtocolHandler.handleRequest to determine the message -type.
  10. -
      -
    1. ProtocolHandler.handleRequest determines the - message type.
    2. -
    3. Suppose it is a request. In that case it would read enough - header information to give to Acceptor to get an - EPT-specific InputObject, - ServerRequestDispatcher and MessageMediator.
    4. -
    5. Control would then transfer to - ServerRequestDispatcher.dispatch.
    6. -
        -
      1. ServerRequestDispatcher.dispatch uses header - information to obtain appropriate presentation block artifacts - (e.g., Ties, DSI handlers).
      2. -
      3. As an example, a Tie would be given the InputObject.
      4. -
          -
        1. The Tie would get the request data from the - InputObject and make it available to user - code.
        2. -
        3. In the case of a synchronous message, the Tie would ask the - ServerRequestDispatcher for an - OutputObject.
        4. -
            -
          1. The ServerRequestDispatcher would use the - Acceptor as a factory to create the EPT-specific - OutputObject.
          2. -
          -
        5. The Tie would set the response data (normal or error) on - the OutputObject.
        6. -
        -
      5. ServerRequestDispatcher.dispatch would send the - header and response data encoded in OutputObject on - the Connection.
      6. -
      -
    7. ServerRequestDispatcher.dispatch may clean up - any resources used in the invocation.
    8. -
    -
- - -

Initial ContactInfo and Acceptor Creation

- -

ContactInfo and Acceptor are the -factories for all other objects involved in a message for a particular -EPT. The question naturally arises, how are these created?

- -
    -
  • From a tool reading service descriptions (e.g., WSDL).
  • -
  • By reading the contents of an object reference (e.g., CORBA IOR).
  • -
  • From a configuration file.
  • -
- -

Other PEPt Interfaces

- -
    -
  • {@link com.sun.corba.se.pept.broker.Broker Broker} - A repository -of resources such as transport managers, thread pools, thread local -data structures, etc.
  • -
- - - --- old/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientDelegate.java 2018-01-30 20:21:09.000000000 -0500 +++ /dev/null 2018-01-30 20:21:09.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.pept.protocol; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.transport.ContactInfoList; - -/** - *

The presentation block interacts with the PEPt architecture - * via the ClientDelegate.

- * - * @author Harold Carr - */ -public interface ClientDelegate -{ - /** - * The {@link com.sun.corba.se.pept.broker.Broker Broker} associated - * with an invocation. - * - * @return {@link com.sun.corba.se.pept.broker.Broker Broker} - */ - public Broker getBroker(); - - /** - * Get the - * {@link com.sun.corba.se.pept.transport.ContactInfoList ContactInfoList} - * which represents they encoding/protocol/transport combinations that - * may be used to contact the service. - * - * @return - * {@link com.sun.corba.se.pept.transport.ContactInfoList ContactInfoList} - */ - public ContactInfoList getContactInfoList(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientInvocationInfo.java 2018-01-30 20:21:10.000000000 -0500 +++ /dev/null 2018-01-30 20:21:10.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.pept.protocol; - -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; -import java.util.Iterator; - -/** - * @author Harold Carr - */ -public interface ClientInvocationInfo -{ - public Iterator getContactInfoListIterator(); - - public void setContactInfoListIterator(Iterator contactInfoListIterator); - - public boolean isRetryInvocation(); - - public void setIsRetryInvocation(boolean isRetryInvocation); - - public int getEntryCount(); - - public void incrementEntryCount(); - - public void decrementEntryCount(); - - public void setClientRequestDispatcher(ClientRequestDispatcher clientRequestDispatcher); - - public ClientRequestDispatcher getClientRequestDispatcher(); - - public void setMessageMediator(MessageMediator messageMediator); - - public MessageMediator getMessageMediator(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientRequestDispatcher.java 2018-01-30 20:21:10.000000000 -0500 +++ /dev/null 2018-01-30 20:21:10.000000000 -0500 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.pept.protocol; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.transport.ContactInfo; - -/** - * ClientRequestDispatcher coordinates the request (and possible - * response) processing for a specific protocol. - * - * @author Harold Carr - */ -public interface ClientRequestDispatcher -{ - /** - * At the beginning of a request the presentation block uses this - * to obtain an - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - * to set data to be sent on a message. - * - * @param self - - * @param methodName - the remote method name - * @param isOneWay - true if the message is asynchronous - * @param contactInfo - the - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo} - * which which created/chose this ClientRequestDispatcher - * - * @return - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - */ - public OutputObject beginRequest(Object self, - String methodName, - boolean isOneWay, - ContactInfo contactInfo); - - /** - * After the presentation block has set data on the - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - * it signals the PEPt runtime to send the encoded data by calling this - * method. - * - * @param self - - * @param outputObject - * - * @return - * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} - * if the message is synchronous. - * - * @throws - * {@link org.omg.CORBA.portable.ApplicationException ApplicationException} - * if the remote side raises an exception declared in the remote interface. - * - * @throws - * {@link org.omg.CORBA.portable.RemarshalException RemarshalException} - * if the PEPt runtime would like the presentation block to start over. - */ - public InputObject marshalingComplete(java.lang.Object self, - OutputObject outputObject) - // REVISIT EXCEPTIONS - throws - org.omg.CORBA.portable.ApplicationException, - org.omg.CORBA.portable.RemarshalException; - - /** - * After the presentation block completes a request it signals - * the PEPt runtime by calling this method. - * - * This method may release resources. In some cases it may cause - * control or error messages to be sent. - * - * @param broker - - * @param inputObject - - */ - public void endRequest(Broker broker, - java.lang.Object self, - InputObject inputObject); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/MessageMediator.java 2018-01-30 20:21:11.000000000 -0500 +++ /dev/null 2018-01-30 20:21:11.000000000 -0500 @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2001, 2004, 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.corba.se.pept.protocol; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ContactInfo; - -import java.io.IOException; - -/** - * MessageMediator is a central repository for artifacts - * associated with an individual message. - * - * @author Harold Carr - */ -public interface MessageMediator -{ - /** - * The {@link com.sun.corba.se.pept.broker.Broker Broker} associated - * with an invocation. - * - * @return {@link com.sun.corba.se.pept.broker.Broker Broker} - */ - public Broker getBroker(); - - /** - * Get the - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo} - * which created this MessageMediator. - * - * @return - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo} - */ - public ContactInfo getContactInfo(); - - /** - * Get the - * {@link com.sun.corba.se.pept.transport.Connection Connection} - * on which this message is sent or received. - */ - public Connection getConnection(); - - /** - * Used to initialize message headers. - * - * Note: this should be moved to a RequestDispatcher. - */ - public void initializeMessage(); - - /** - * Used to send the message (or its last fragment). - * - * Note: this should be moved to a RequestDispatcher. - */ - public void finishSendingRequest(); - - /** - * Used to wait for a response for synchronous messages. - * - * @deprecated - */ - @Deprecated - public InputObject waitForResponse(); - - /** - * Used to set the - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - * used for the message. - * - * @param outputObject - */ - public void setOutputObject(OutputObject outputObject); - - /** - * Used to get the - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - * used for the message. - * - * @return - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - */ - public OutputObject getOutputObject(); - - /** - * Used to set the - * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} - * used for the message. - * - * @param inputObject - */ - public void setInputObject(InputObject inputObject); - - /** - * Used to get the - * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} - * used for the message. - * - * @return - * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} - */ - public InputObject getInputObject(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ProtocolHandler.java 2018-01-30 20:21:12.000000000 -0500 +++ /dev/null 2018-01-30 20:21:12.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.pept.protocol; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -/** - * ProtocolHandler is used to determine the - * type of an incoming message. - * - * @author Harold Carr - */ -public interface ProtocolHandler -{ - // REVISIT - return type - /** - * This method determines the type of an incoming message and - * dispatches it appropriately. - * - * For example, on the server side, it may find a - * {@link com.sun.corba.se.pept.protocol.ServerRequestDispatcher - * ServerRequestDispatcher} to handle the request. On the client-side - * it may signal a waiting thread to handle a reply. - * - * @return deprecated - */ - public boolean handleRequest(MessageMediator messageMediator); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ServerRequestDispatcher.java 2018-01-30 20:21:12.000000000 -0500 +++ /dev/null 2018-01-30 20:21:12.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.pept.protocol; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -/** - * ServerRequestDispatcher coordinates the request (and possible - * response) processing for a specific protocol. - - * @author Harold Carr - */ -public interface ServerRequestDispatcher -{ - /** - * This method coordinates the processing of a message received - * on the server side. - * - * For example, this may involve finding an "object adapter" which - * would return Ties/Servants to handle the request. - */ - public void dispatch(MessageMediator messageMediator); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Acceptor.java 2018-01-30 20:21:13.000000000 -0500 +++ /dev/null 2018-01-30 20:21:13.000000000 -0500 @@ -1,212 +0,0 @@ -/* - * Copyright (c) 2001, 2004, 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.corba.se.pept.transport; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.EventHandler; - -/** - *

The primary PEPt server-side plug-in point and enabler - * for altenate encodings, protocols and transports.

- * - *

Acceptor is a factory for client-side - * artifacts used to receive a message (and possibly send a response).

- * - * @author Harold Carr - */ -public interface Acceptor -{ - /** - * Used to initialize an Acceptor. - * - * For example, initialization may mean to create a - * {@link java.nio.channels.ServerSocketChannel ServerSocketChannel}. - * - * Note: this must be prepared to be be called multiple times. - * - * @return true when it performs initializatin - * actions (typically the first call. - */ - public boolean initialize(); - - /** - * Used to determine if an Acceptor has been initialized. - * - * @return true if the Acceptor has been - * initialized. - */ - public boolean initialized(); - - /** - * PEPt uses separate caches for each type of Acceptor - * as given by getConnectionCacheType. - * - * @return {@link java.lang.String} - */ - public String getConnectionCacheType(); - - /** - * Set the - * {@link com.sun.corba.se.pept.transport.InboundConnectionCache InboundConnectionCache} - * to be used by this Acceptor. - * - * PEPt uses separate caches for each type of Acceptor - * as given by {@link #getConnectionCacheType}. - * {@link #setConnectionCache} and {@link #getConnectionCache} support - * an optimzation to avoid hashing to find that cache. - * - * @param connectionCache. - */ - public void setConnectionCache(InboundConnectionCache connectionCache); - - /** - * Get the - * {@link com.sun.corba.se.pept.transport.InboundConnectionCache InboundConnectionCache} - * used by this Acceptor - * - * PEPt uses separate caches for each type of Acceptor - * as given by {@link #getConnectionCacheType}. - * {@link #setConnectionCache} and {@link #getConnectionCache} support - * an optimzation to avoid hashing to find that cache. - * - * @return - * {@link com.sun.corba.se.pept.transport.ConnectionCache ConnectionCache} - */ - public InboundConnectionCache getConnectionCache(); - - /** - * Used to determine if the Acceptor should register - * with - * {@link com.sun.corba.se.pept.transport.Selector Selector} - * to handle accept events. - * - * For example, this may be false in the case of Solaris Doors - * which do not actively listen. - * - * @return true if the Acceptor should be - * registered with - * {@link com.sun.corba.se.pept.transport.Selector Selector} - */ - public boolean shouldRegisterAcceptEvent(); - - /** - * Accept a connection request. - * - * This is called either when the selector gets an accept event - * for this Acceptor or by a - * {@link com.sun.corba.se.pept.transport.ListenerThread ListenerThread}. - * - * It results in a - * {@link com.sun.corba.se.pept.transport.Connection Connection} - * being created. - */ - public void accept(); - - /** - * Close the Acceptor. - */ - public void close(); - - /** - * Get the - * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler} - * associated with this Acceptor. - * - * @return - * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler} - */ - public EventHandler getEventHandler(); - - // - // Factory methods - // - - // REVISIT: Identical to ContactInfo method. Refactor into base interface. - - /** - * Used to get a - * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} - * to hold internal data for a message received using the specific - * encoding, protocol, transport combination represented by this - * Acceptor. - * - * @return - * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} - */ - public MessageMediator createMessageMediator(Broker xbroker, - Connection xconnection); - - // REVISIT: Identical to ContactInfo method. Refactor into base interface. - - /** - * Used to finish creating a - * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} - * to with internal data for a message received using the specific - * encoding, protocol, transport combination represented by this - * Acceptor. - * - * @return - * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator} - */ - - public MessageMediator finishCreatingMessageMediator(Broker broker, - Connection xconnection, - MessageMediator messageMediator); - - /** - * Used to get a - * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} - * for the specific encoding represented by this - * Acceptor. - * - * @return - * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} - */ - public InputObject createInputObject(Broker broker, - MessageMediator messageMediator); - - /** - * Used to get a - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - * for the specific encoding represented by this - * Acceptor. - * - * @return - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - */ - public OutputObject createOutputObject(Broker broker, - MessageMediator messageMediator); - - // - // Usage dictates implementation equals and hashCode. - // -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ByteBufferPool.java 2018-01-30 20:21:14.000000000 -0500 +++ /dev/null 2018-01-30 20:21:14.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.pept.transport; - -import java.nio.ByteBuffer; - -/** - * @author Charlie Hunt - */ -public interface ByteBufferPool -{ - public ByteBuffer getByteBuffer(int theSize); - public void releaseByteBuffer(ByteBuffer thebb); - public int activeCount(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Connection.java 2018-01-30 20:21:14.000000000 -0500 +++ /dev/null 2018-01-30 20:21:14.000000000 -0500 @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.pept.transport; - -import java.io.IOException; - -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.EventHandler; - - -/** - *

Connection represents a transport in the - * PEPt architecture.

- * - * @author Harold Carr -*/ -public interface Connection -{ - /** - * Used to determine if the Connection should register - * with the - * {@link com.sun.corba.se.pept.transport.TransportManager - * TransportManager} - * {@link com.sun.corba.se.pept.transport.Selector Selector} - * to handle read events. - * - * For example, an HTTP transport would not register since the requesting - * thread would just block on read when waiting for the reply. - * - * @return true if it should be registered. - */ - public boolean shouldRegisterReadEvent(); - - /** - * Used to determine if the Connection should register - * with the - * {@link com.sun.corba.se.pept.transport.TransportManager - * TransportManager} - * {@link com.sun.corba.se.pept.transport.Selector Selector} - * to handle read events. - * - * For example, an HTTP transport would not register since the requesting - * thread would just block on read when waiting for the reply. - * - * @return true if it should be registered. - */ - public boolean shouldRegisterServerReadEvent(); // REVISIT - why special? - - /** - * Called to read incoming messages. - * - * @return true if the thread calling read can be released. - */ - public boolean read(); - - /** - * Close the Connection. - * - */ - public void close(); - - // REVISIT: replace next two with PlugInFactory (implemented by ContactInfo - // and Acceptor). - - /** - * Get the - * {@link com.sun.corba.se.pept.transport.Acceptor Acceptor} - * that created this Connection. - * - * @return - * {@link com.sun.corba.se.pept.transport.Acceptor Acceptor} - */ - public Acceptor getAcceptor(); - - /** - * Get the - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo} - * that created this Connection. - * - * @return - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo} - */ - public ContactInfo getContactInfo(); - - /** - * Get the - * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler} - * associated with this Acceptor. - * - * @return - * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler} - */ - public EventHandler getEventHandler(); - - /** - * Indicates whether a - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo} - * or a - * {@link com.sun.corba.se.pept.transport.Acceptor Acceptor} - * created the - * Connection. - * - * @return true if Connection an - * {@link com.sun.corba.se.pept.transport.Acceptor Acceptor} - * created the Connection. - */ - public boolean isServer(); - - /** - * Indicates if the Connection is in the process of - * sending or receiving a message. - * - * @return true if the Connection is busy. - */ - public boolean isBusy(); - - /** - * Timestamps are used for connection management, in particular, for - * reclaiming idle Connections. - * - * @return the "time" the Connection was last used. - */ - public long getTimeStamp(); - - /** - * Timestamps are used for connection management, in particular, for - * reclaiming idle Connections. - * - * @param time - the "time" the Connection was last used. - */ - public void setTimeStamp(long time); - - /** - * The "state" of the Connection. - * - * param state - */ - public void setState(String state); - - /** - * Grab a write lock on the Connection. - * - * If another thread already has a write lock then the calling - * thread will block until the lock is released. The calling - * thread must call - * {@link #writeUnlock} - * when it is done. - */ - public void writeLock(); - - /** - * Release a write lock on the Connection. - */ - public void writeUnlock(); - - /* - * Send the data encoded in - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - * on the Connection. - * - * @param outputObject - */ - public void sendWithoutLock(OutputObject outputObject); - - /** - * Register an invocation's - * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator} - * with the Connection. - * - * This is useful in protocols which support fragmentation. - * - * @param messageMediator - */ - public void registerWaiter(MessageMediator messageMediator); - - /** - * If a message expect's a response then this method is called. - * - * This method might block on a read (e.g., HTTP), put the calling - * thread to sleep while another thread read's the response (e.g., GIOP), - * or it may use the calling thread to perform the server-side work - * (e.g., Solaris Doors). - * - * @param messageMediator - */ - public InputObject waitForResponse(MessageMediator messageMediator); - - /** - * Unregister an invocation's - * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator} - * with the Connection. - * - * @param messageMediator - */ - public void unregisterWaiter(MessageMediator messageMediator); - - public void setConnectionCache(ConnectionCache connectionCache); - - public ConnectionCache getConnectionCache(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java 2018-01-30 20:21:15.000000000 -0500 +++ /dev/null 2018-01-30 20:21:15.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.pept.transport; - -/** - * @author Harold Carr - */ -public interface ConnectionCache -{ - public String getCacheType(); - - public void stampTime(Connection connection); - - public long numberOfConnections(); - - public long numberOfIdleConnections(); - - public long numberOfBusyConnections(); - - public boolean reclaim(); - - /** Close all connections in the connection cache. - * This is used as a final cleanup, and will result - * in abrupt termination of any pending communications. - */ - public void close(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfo.java 2018-01-30 20:21:16.000000000 -0500 +++ /dev/null 2018-01-30 20:21:16.000000000 -0500 @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2001, 2004, 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.corba.se.pept.transport; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; -import com.sun.corba.se.pept.transport.ConnectionCache; - -/** - *

The primary PEPt client-side plug-in point and enabler - * for altenate encodings, protocols and transports.

- * - *

ContactInfo is a factory for client-side - * artifacts used - * to construct and send a message (and possibly receive and process a - * response).

- * - * @author Harold Carr - */ -public interface ContactInfo -{ - /** - * The {@link com.sun.corba.se.pept.broker.Broker Broker} associated - * with an invocation. - * - * @return {@link com.sun.corba.se.pept.broker.Broker Broker} - */ - public Broker getBroker(); - - /** - * The parent - * {@link com.sun.corba.se.pept.broker.ContactInfoList ContactInfoList} - * for this ContactInfo. - * - * @return - * {@link com.sun.corba.se.pept.broker.ContactInfoList ContactInfoList} - */ - public ContactInfoList getContactInfoList(); - - /** - * Used to get a - * {@link com.sun.corba.se.pept.protocol.ClientRequestDispatcher - * ClientRequestDispatcher} - * used to handle the specific protocol represented by this - * ContactInfo. - * - * @return - * {@link com.sun.corba.se.pept.protocol.ClientRequestDispatcher - * ClientRequestDispatcher} */ - public ClientRequestDispatcher getClientRequestDispatcher(); - - /** - * Used to determine if a - * {@link com.sun.corba.se.pept.transport.Connection Connection} - * will be present in an invocation. - * - * For example, it may be - * false in the case of shared-memory - * Input/OutputObjects. - * - * @return true if a - * {@link com.sun.corba.se.pept.transport.Connection Connection} - * will be used for an invocation. - */ - public boolean isConnectionBased(); - - /** - * Used to determine if the - * {@link com.sun.corba.se.pept.transport.Connection Connection} - * used for a request should be cached. - * - * If true then PEPt will attempt to reuse an existing - * {@link com.sun.corba.se.pept.transport.Connection Connection}. If - * one is not found it will create a new one and cache it for future use. - * - * - * @return true if - * {@link com.sun.corba.se.pept.transport.Connection Connection}s - * created by this ContactInfo should be cached. - */ - public boolean shouldCacheConnection(); - - /** - * PEPt uses separate caches for each type of ContactInfo - * as given by getConnectionCacheType. - * - * @return {@link java.lang.String} - */ - public String getConnectionCacheType(); - - /** - * Set the - * {@link com.sun.corba.se.pept.transport.Outbound.ConnectionCache OutboundConnectionCache} - * to be used by this ContactInfo. - * - * PEPt uses separate caches for each type of ContactInfo - * as given by {@link #getConnectionCacheType}. - * {@link #setConnectionCache} and {@link #getConnectionCache} support - * an optimzation to avoid hashing to find that cache. - * - * @param connectionCache. - */ - public void setConnectionCache(OutboundConnectionCache connectionCache); - - /** - * Get the - * {@link com.sun.corba.se.pept.transport.Outbound.ConnectionCache OutboundConnectionCache} - * used by this ContactInfo - * - * PEPt uses separate caches for each type of ContactInfo - * as given by {@link #getConnectionCacheType}. - * {@link #setConnectionCache} and {@link #getConnectionCache} support - * an optimzation to avoid hashing to find that cache. - * - * @return - * {@link com.sun.corba.se.pept.transport.ConnectionCache ConnectionCache} - */ - public OutboundConnectionCache getConnectionCache(); - - /** - * Used to get a - * {@link com.sun.corba.se.pept.transport.Connection Connection} - * to send and receive messages on the specific transport - * represented by this ContactInfo. - * - * @return - * {@link com.sun.corba.se.pept.transport.Connection Connection} - */ - public Connection createConnection(); - - /** - * Used to get a - * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} - * to hold internal data for a message to be sent using the specific - * encoding, protocol, transport combination represented by this - * ContactInfo. - * - * @return - * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator} - */ - public MessageMediator createMessageMediator(Broker broker, - ContactInfo contactInfo, - Connection connection, - String methodName, - boolean isOneWay); - - /** - * Used to get a - * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} - * to hold internal data for a message received using the specific - * encoding, protocol, transport combination represented by this - * ContactInfo. - * - * @return - * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} - */ - public MessageMediator createMessageMediator(Broker broker, - Connection connection); - - /** - * Used to finish creating a - * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator} - * with internal data for a message received using the specific - * encoding, protocol, transport combination represented by this - * ContactInfo. - * - * @return - * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator} - */ - public MessageMediator finishCreatingMessageMediator(Broker broker, - Connection connection, - MessageMediator messageMediator); - - /** - * Used to get a - * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} - * for the specific encoding represented by this - * ContactInfo. - * - * @return - * {@link com.sun.corba.se.pept.encoding.InputObject InputObject} - */ - public InputObject createInputObject(Broker broker, - MessageMediator messageMediator); - - /** - * Used to get a - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - * for the specific encoding represented by this - * ContactInfo. - * - * @return - * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject} - */ - public OutputObject createOutputObject(MessageMediator messageMediator); - - /** - * Used to lookup artifacts associated with this ContactInfo. - * - * @return the hash value. - */ - public int hashCode(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoList.java 2018-01-30 20:21:16.000000000 -0500 +++ /dev/null 2018-01-30 20:21:16.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.pept.transport; - -import java.util.Iterator; - -/** - *

ContactInfoList contains one or more - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}. - * - * @author Harold Carr - */ -public interface ContactInfoList -{ - /** - * Used to get a - * {@link com.sun.corba.se.pept.transport.ContactInfoListIterator - * ContactInfoListIterator} to retrieve individual - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo} - * from the list. - * - * @return A - * {@link com.sun.corba.se.pept.transport.ContactInfoListIterator - * ContactInfoListIterator}. - */ - public Iterator iterator(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoListIterator.java 2018-01-30 20:21:17.000000000 -0500 +++ /dev/null 2018-01-30 20:21:17.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.pept.transport; - -import java.util.Iterator; - -/** - * ContactInfoIterator is used to retrieve individual - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}. - * - * @author Harold Carr - */ -public interface ContactInfoListIterator - extends - Iterator -{ - /** - * The underlying list for this iterator. - * - * @return The underlying list for this iterator. - */ - public ContactInfoList getContactInfoList(); - - /** - * Used to report information to the iterator to be used - * in future invocations. - * - * @param contactInfo The - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo} - * obtained from this iterator which resulted in a successful invocation. - */ - public void reportSuccess(ContactInfo contactInfo); - - /** - * Used to report information to the iterator to be used - * in future invocations. - * - * @param contactInfo The - * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo} - * in effect when an invocation exception occurs. - * @param exception The - * {@link java.lang.RuntimeException RuntimeException}. - * - * @return Returns true if the request should be retried. - */ - public boolean reportException(ContactInfo contactInfo, - RuntimeException exception); - - /** - * The exception to report to the presentation block. - * - * @return If the iterator reaches the end before the invocation - * is successful one returns this exception (previously reported to - * the iterator via {@link #reportException}). - - */ - public RuntimeException getFailureException(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/EventHandler.java 2018-01-30 20:21:18.000000000 -0500 +++ /dev/null 2018-01-30 20:21:18.000000000 -0500 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.pept.transport; - -import java.nio.channels.SelectableChannel; -import java.nio.channels.SelectionKey; - -import com.sun.corba.se.spi.orbutil.threadpool.Work; - -/** - * @author Harold Carr - * - * This should only be registered with ONE selector. - */ -public interface EventHandler -{ - public void setUseSelectThreadToWait(boolean x); - public boolean shouldUseSelectThreadToWait(); - - public SelectableChannel getChannel(); - - public int getInterestOps(); - - public void setSelectionKey(SelectionKey selectionKey); - public SelectionKey getSelectionKey(); - - public void handleEvent(); - - // NOTE: if there is more than one interest op this does not - // allow discrimination between different ops and how threading - // is handled. - public void setUseWorkerThreadForEvent(boolean x); - public boolean shouldUseWorkerThreadForEvent(); - - public void setWork(Work work); - public Work getWork(); - - // REVISIT: need base class with two derived. - public Acceptor getAcceptor(); - public Connection getConnection(); - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/InboundConnectionCache.java 2018-01-30 20:21:19.000000000 -0500 +++ /dev/null 2018-01-30 20:21:19.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.pept.transport; - -/** - * @author Harold Carr - */ -public interface InboundConnectionCache - extends ConnectionCache -{ - public Connection get(Acceptor acceptor); // REVISIT - - public void put(Acceptor acceptor, Connection connection); - - public void remove(Connection connection); - - public Acceptor getAcceptor(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ListenerThread.java 2018-01-30 20:21:19.000000000 -0500 +++ /dev/null 2018-01-30 20:21:20.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.pept.transport; - -/** - * @author Harold Carr - */ -public interface ListenerThread -{ - public Acceptor getAcceptor(); - public void close(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/OutboundConnectionCache.java 2018-01-30 20:21:20.000000000 -0500 +++ /dev/null 2018-01-30 20:21:20.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.pept.transport; - -/** - * @author Harold Carr - */ -public interface OutboundConnectionCache - extends ConnectionCache -{ - public Connection get(ContactInfo contactInfo); - - public void put(ContactInfo contactInfo, Connection connection); - - public void remove(ContactInfo contactInfo); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ReaderThread.java 2018-01-30 20:21:21.000000000 -0500 +++ /dev/null 2018-01-30 20:21:21.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.pept.transport; - -/** - * @author Harold Carr - */ -public interface ReaderThread { - public Connection getConnection(); - public void close(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ResponseWaitingRoom.java 2018-01-30 20:21:22.000000000 -0500 +++ /dev/null 2018-01-30 20:21:22.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.pept.transport; - -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.encoding.InputObject; - -/** - * @author Harold Carr - */ -public interface ResponseWaitingRoom -{ - public void registerWaiter(MessageMediator messageMediator); - - // REVISIT: maybe return void (or MessageMediator). - public InputObject waitForResponse(MessageMediator messageMediator); - - public void responseReceived(InputObject inputObject); - - public void unregisterWaiter(MessageMediator messageMediator); - - public int numberRegistered(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Selector.java 2018-01-30 20:21:22.000000000 -0500 +++ /dev/null 2018-01-30 20:21:23.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.pept.transport; - -/** - * @author Harold Carr - */ -public interface Selector -{ - public void setTimeout(long timeout); - public long getTimeout(); - public void registerInterestOps(EventHandler eventHandler); - public void registerForEvent(EventHandler eventHander); - public void unregisterForEvent(EventHandler eventHandler); - public void close(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/pept/transport/TransportManager.java 2018-01-30 20:21:23.000000000 -0500 +++ /dev/null 2018-01-30 20:21:23.000000000 -0500 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.pept.transport; - -import java.util.Collection; - -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.pept.transport.ByteBufferPool; -import com.sun.corba.se.pept.transport.ConnectionCache; -import com.sun.corba.se.pept.transport.Selector; - -/** - * @author Harold Carr - */ -public interface TransportManager -{ - public ByteBufferPool getByteBufferPool(int id); - - public OutboundConnectionCache getOutboundConnectionCache( - ContactInfo contactInfo); - - public Collection getOutboundConnectionCaches(); - - public InboundConnectionCache getInboundConnectionCache(Acceptor acceptor); - - public Collection getInboundConnectionCaches(); - - public Selector getSelector(int id); - - public void registerAcceptor(Acceptor acceptor); - - public Collection getAcceptors(); - - public void unregisterAcceptor(Acceptor acceptor); - - public void close(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/activation/activation.idl 2018-01-30 20:21:24.000000000 -0500 +++ /dev/null 2018-01-30 20:21:24.000000000 -0500 @@ -1,305 +0,0 @@ -/* - * Copyright (c) 1997, 2002, 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. - */ - -// - -module activation { - // Possible values for endpointType argument on Server.getEndpoint() - // If you change the value of this constant then update - // core.EndPoint accordingly. It has a duplicate definition - // to avoid a compilation dependency. - const string IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT"; - - // REVISIT Use the CORBA 2.3 ORBid if we ever get the Java ORB ID - // issue resolved. - typedef string ORBid; - typedef long ServerId ; - typedef sequence POAName ; - - /** Raised if getEndpoint is called on a server callback object for - * an invalid endpoint type - */ - exception NoSuchEndPoint {} ; - - /** - * Raised if an attempt is made to retrieve ports corresponding to - * non-registered ORB - */ - - exception InvalidORBid {} ; - - /** Raised if an operation is attempted against an invalid server ID. - */ - exception ServerNotRegistered { - ServerId serverId ; - }; - - /** Raised if an operation is attempted for a server that is not running, - * and the server is required to be running for the operation. - */ - exception ServerNotActive { - ServerId serverId ; - }; - - /** Raised if an operation is attempted against a server that is in a - * hold down state. A server becomes held down if it fails to activate - * within 10 seconds. - */ - exception ServerHeldDown { - ServerId serverId ; - }; - - /** Raised if an attempt is made to activate a server that is already - * running. - */ - exception ServerAlreadyActive{ - ServerId serverId ; - }; - - /** Raised if an attempt is made to register a serverdef with the - * same applicationName as an existing serverdef. - */ - exception ServerAlreadyRegistered { - ServerId serverId; - }; - - /** Raised if an attempt is made to install a server that is currently - * installed. Note that a newly created server starts out in an uninstalled - * state. - */ - exception ServerAlreadyInstalled { - ServerId serverId; - } ; - - /** Raised if an attempt is made to uninstall a server that is currently - * uninstalled. Note that a newly created server starts out in an - * uninstalled - * state. - */ - exception ServerAlreadyUninstalled { - ServerId serverId; - } ; - - /** Raised if an attempt is made to register an invalid serverdef. - */ - exception BadServerDefinition { - string reason; - }; - - /** Raised if an attempt is made to register endpoints for the - * same ORB again - */ - exception ORBAlreadyRegistered { - ORBid orbId; - }; - - typedef long TCPPort ; - typedef sequence ServerIds; - - // passing a struct containing endpointType and port-#s - struct EndPointInfo { - string endpointType; - TCPPort port; - }; - - typedef sequence EndpointInfoList; - - // struct contain ORB and port info - struct ORBPortInfo { - ORBid orbId; - TCPPort port; - }; - - typedef sequence ORBPortInfoList; - - typedef sequence ORBidList; - - /** Server callback API, passed to Activator in active method. - */ - interface Server { - /** Shutdown this server. Returns after orb.shutdown() completes. - */ - void shutdown(); - - /** Install the server. Returns after the install hook completes - * execution in the server. - */ - void install(); - - /** Uninstall the server. Returns after the uninstall hook - * completes execution. - */ - void uninstall(); - }; - - interface Activator { - // A new ORB started server registers itself with the Activator - void active(in ServerId serverId, in Server serverObj) - raises (ServerNotRegistered); - - // Install a particular kind of endpoint - void registerEndpoints( in ServerId serverId, in ORBid orbId, - in EndpointInfoList endPointInfo) - raises (ServerNotRegistered,NoSuchEndPoint, ORBAlreadyRegistered) ; - - // list active servers - ServerIds getActiveServers(); - - // If the server is not running, start it up. - void activate(in ServerId serverId) - raises (ServerAlreadyActive, ServerNotRegistered, ServerHeldDown); - - // If the server is running, shut it down - void shutdown(in ServerId serverId) - raises (ServerNotActive, ServerNotRegistered); - - // Invoke the server install hook. If the server is not - // currently running, this method will activate it. - void install(in ServerId serverId) - raises (ServerNotRegistered, ServerHeldDown, - ServerAlreadyInstalled); - - // list all registered ORBs for a server - ORBidList getORBNames(in ServerId serverId) - raises (ServerNotRegistered); - - // Invoke the server uninstall hook. If the server is not - // currently running, this method will activate it. - // After this hook completes, the server may still be running. - void uninstall(in ServerId serverId) - raises (ServerNotRegistered, ServerHeldDown, - ServerAlreadyUninstalled); - }; - - interface Locator { - - // struct to return the list of endpoints for a server for a specific - // endpoint - struct ServerLocation { - string hostname; - ORBPortInfoList ports; - }; - - // struct to return the list of endpoints for a server for a specific - // ORB - struct ServerLocationPerORB { - string hostname; - EndpointInfoList ports; - }; - - // locate server - returns the port with a specific type for all registered - // ORBs of an active server. - // Starts the server if it is not already running. - ServerLocation locateServer( - in ServerId serverId, - in string endPoint) - raises(NoSuchEndPoint, ServerNotRegistered, ServerHeldDown); - - // locate server - returns all ports registered with a specified ORB for - // an active server - // Starts the server if it is not already running. - ServerLocationPerORB locateServerForORB( - in ServerId serverId, - in ORBid orbId) - raises(InvalidORBid, ServerNotRegistered, ServerHeldDown); - - // get the port for the endpoint of the locator - TCPPort getEndpoint(in string endPointType) - raises(NoSuchEndPoint); - - // Useful from external BadServerIdHandlers which need - // to pick a particular port type. - TCPPort getServerPortForType( - in ServerLocationPerORB location, - in string endPointType) - raises(NoSuchEndPoint); - }; - - interface ServerManager : Activator, Locator { }; - - interface InitialNameService { - exception NameAlreadyBound {}; - - // bind initial name - void bind ( - in string name, - in Object obj, - in boolean isPersistant) raises (NameAlreadyBound); - - }; - - interface Repository { - // server program definition. We should make this a ValueType. - struct ServerDef { - string applicationName; // alias used for servers with identical - // serverName values. - string serverName; // Class name of server's main class. - string serverClassPath; // class path used to run the server. - string serverArgs; - string serverVmArgs; - }; - - // register server definition - // This returns the serverId of the server. A newly created server is - // always uninstalled. - ServerId registerServer (in ServerDef serverDef) - raises (ServerAlreadyRegistered, BadServerDefinition); - - // unregister server definition - void unregisterServer (in ServerId serverId) - raises (ServerNotRegistered); - - // get server definition - ServerDef getServer(in ServerId serverId) - raises (ServerNotRegistered); - - // Return whether the server has been installed - boolean isInstalled( in ServerId serverId ) - raises (ServerNotRegistered); - - // Mark the server as being installed. Raises ServerAlreadyInstalled - // if the server is currently marked as installed. - void install( in ServerId serverId ) - raises (ServerNotRegistered, ServerAlreadyInstalled) ; - - // Mark the server as being uninstalled. Raises ServerAlreadyUninstalled - // if the server is currently marked as uninstalled. - void uninstall( in ServerId serverId ) - raises (ServerNotRegistered, ServerAlreadyUninstalled) ; - - // list registered servers - ServerIds listRegisteredServers (); - - typedef sequence StringSeq ; - - // Returns list of ALL applicationNames defined in ServerDefs of registered - // servers. - StringSeq getApplicationNames(); - - // Find the ServerID associated with the given application name. - ServerId getServerID( in string applicationName ) - raises (ServerNotRegistered) ; - }; -}; --- old/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopierManager.java 2018-01-30 20:21:25.000000000 -0500 +++ /dev/null 2018-01-30 20:21:25.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.copyobject ; - -/** Manager of ObjectCopier implementations used to support javax.rmi.CORBA.Util.copyObject(s). - * This provides simple methods for registering all supported ObjectCopier factories. - * A default copier is also supported, for use in contexts where no specific copier id - * is available. - */ -public interface CopierManager -{ - /** Set the Id of the copier to use if no other copier has been set. - */ - void setDefaultId( int id ) ; - - /** Return the copier for the default copier id. Throws a BAD_PARAM exception - * if no default copier id has been set. - */ - int getDefaultId() ; - - ObjectCopierFactory getObjectCopierFactory( int id ) ; - - ObjectCopierFactory getDefaultObjectCopierFactory() ; - - /** Register an ObjectCopierFactory under a particular id. This can be retrieved - * later by getObjectCopierFactory. - */ - void registerObjectCopierFactory( ObjectCopierFactory factory, int id ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopyobjectDefaults.java 2018-01-30 20:21:25.000000000 -0500 +++ /dev/null 2018-01-30 20:21:25.000000000 -0500 @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.spi.copyobject ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.impl.copyobject.ReferenceObjectCopierImpl ; -import com.sun.corba.se.impl.copyobject.FallbackObjectCopierImpl ; -import com.sun.corba.se.impl.copyobject.ORBStreamObjectCopierImpl ; -import com.sun.corba.se.impl.copyobject.JavaStreamObjectCopierImpl ; - -public abstract class CopyobjectDefaults -{ - private CopyobjectDefaults() { } - - /** Obtain the ORB stream copier factory. Note that this version behaves differently - * than the others: each ObjectCopier produced by the factory only preserves aliasing - * within a single call to copy. The others copiers all preserve aliasing across - * all calls to copy (on the same ObjectCopier instance). - */ - public static ObjectCopierFactory makeORBStreamObjectCopierFactory( final ORB orb ) - { - return new ObjectCopierFactory() { - public ObjectCopier make( ) - { - return new ORBStreamObjectCopierImpl( orb ) ; - } - } ; - } - - public static ObjectCopierFactory makeJavaStreamObjectCopierFactory( final ORB orb ) - { - return new ObjectCopierFactory() { - public ObjectCopier make( ) - { - return new JavaStreamObjectCopierImpl( orb ) ; - } - } ; - } - - private static final ObjectCopier referenceObjectCopier = new ReferenceObjectCopierImpl() ; - - private static ObjectCopierFactory referenceObjectCopierFactory = - new ObjectCopierFactory() { - public ObjectCopier make() - { - return referenceObjectCopier ; - } - } ; - - /** Obtain the reference object "copier". This does no copies: it just - * returns whatever is passed to it. - */ - public static ObjectCopierFactory getReferenceObjectCopierFactory() - { - return referenceObjectCopierFactory ; - } - - /** Create a fallback copier factory from the two ObjectCopierFactory - * arguments. This copier makes an ObjectCopierFactory that creates - * instances of a fallback copier that first tries an ObjectCopier - * created from f1, then tries one created from f2, if the first - * throws a ReflectiveCopyException. - */ - public static ObjectCopierFactory makeFallbackObjectCopierFactory( - final ObjectCopierFactory f1, final ObjectCopierFactory f2 ) - { - return new ObjectCopierFactory() { - public ObjectCopier make() - { - ObjectCopier c1 = f1.make() ; - ObjectCopier c2 = f2.make() ; - return new FallbackObjectCopierImpl( c1, c2 ) ; - } - } ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopier.java 2018-01-30 20:21:26.000000000 -0500 +++ /dev/null 2018-01-30 20:21:26.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.copyobject ; - -/** Provides an interface for a variety of means to copy an arbitrary - * object. Any implementation of this interface must return an exact - * copy of obj, preserving all aliasing across all objects reachable - * from obj. ReflectiveCopyException must be thrown if the implementation - * cannot copy obj for some reason. Note that a trivial implementation - * of this interface is possible (always return obj), but this is often - * not the desired implementation. - */ -public interface ObjectCopier { - Object copy( Object obj ) throws ReflectiveCopyException ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopierFactory.java 2018-01-30 20:21:27.000000000 -0500 +++ /dev/null 2018-01-30 20:21:27.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.copyobject ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** ObjectCopier factory interface used for registration. - */ -public interface ObjectCopierFactory { - /** Create a new instance of an ObjectCopier. - */ - ObjectCopier make() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ReflectiveCopyException.java 2018-01-30 20:21:27.000000000 -0500 +++ /dev/null 2018-01-30 20:21:27.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.copyobject ; - -public class ReflectiveCopyException extends Exception { - public ReflectiveCopyException() - { - super() ; - } - - public ReflectiveCopyException( String msg ) - { - super( msg ) ; - } - - public ReflectiveCopyException( String msg, Throwable t ) - { - super( msg, t ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaInputObject.java 2018-01-30 20:21:28.000000000 -0500 +++ /dev/null 2018-01-30 20:21:28.000000000 -0500 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.encoding ; - -import com.sun.corba.se.impl.encoding.CDRInputStream ; -import com.sun.corba.se.pept.encoding.InputObject ; - -public abstract class CorbaInputObject - extends CDRInputStream - implements InputObject -{ -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaOutputObject.java 2018-01-30 20:21:29.000000000 -0500 +++ /dev/null 2018-01-30 20:21:29.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.spi.encoding ; - -import com.sun.corba.se.pept.encoding.OutputObject ; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaConnection; - -import com.sun.corba.se.impl.encoding.CDROutputStream ; -import com.sun.corba.se.impl.encoding.BufferManagerWrite ; - - -public abstract class CorbaOutputObject - extends CDROutputStream - implements OutputObject -{ - public CorbaOutputObject( - ORB orb, GIOPVersion version, byte encodingVersion, - boolean littleEndian, BufferManagerWrite bufferManager, - byte streamFormatVersion, boolean usePooledByteBuffers) - { - super(orb, version, encodingVersion, littleEndian, bufferManager, - streamFormatVersion, usePooledByteBuffers); - } - - public abstract void writeTo(CorbaConnection connection) - throws java.io.IOException; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/extension/CopyObjectPolicy.java 2018-01-30 20:21:29.000000000 -0500 +++ /dev/null 2018-01-30 20:21:29.000000000 -0500 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.extension ; - -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -/** Policy used to specify the copyObject implementation to use. -*/ -public class CopyObjectPolicy extends LocalObject implements Policy -{ - private final int value ; - - public CopyObjectPolicy( int value ) - { - this.value = value ; - } - - public int getValue() - { - return value ; - } - - public int policy_type () - { - return ORBConstants.COPY_OBJECT_POLICY ; - } - - public org.omg.CORBA.Policy copy () - { - return this ; - } - - public void destroy () - { - // NO-OP - } - - public String toString() - { - return "CopyObjectPolicy[" + value + "]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/extension/RequestPartitioningPolicy.java 2018-01-30 20:21:30.000000000 -0500 +++ /dev/null 2018-01-30 20:21:30.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.extension ; - -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -/** Policy used to support the request partitioning feature and to - * specify the partition to use. -*/ -public class RequestPartitioningPolicy extends LocalObject implements Policy -{ - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.get( CORBALogDomains.OA_IOR ) ; - public final static int DEFAULT_VALUE = 0; - private final int value; - - public RequestPartitioningPolicy( int value ) - { - if (value < ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID || - value > ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID) { - throw wrapper.invalidRequestPartitioningPolicyValue( - new Integer(value), - new Integer( - ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID), - new Integer( - ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID)); - } - this.value = value; - } - - public int getValue() - { - return value; - } - - public int policy_type() - { - return ORBConstants.REQUEST_PARTITIONING_POLICY; - } - - public org.omg.CORBA.Policy copy() - { - return this; - } - - public void destroy() - { - // NO-OP - } - - public String toString() - { - return "RequestPartitioningPolicy[" + value + "]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/extension/ServantCachingPolicy.java 2018-01-30 20:21:31.000000000 -0500 +++ /dev/null 2018-01-30 20:21:31.000000000 -0500 @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.spi.extension ; - -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -/** Policy used to implement servant caching optimization in the POA. -* Creating a POA with an instance pol of this policy where -* pol.getType() > NO_SERVANT_CACHING will cause the servant to be -* looked up in the POA and cached in the LocalClientRequestDispatcher when -* the ClientRequestDispatcher is colocated with the implementation of the -* objref. This greatly speeds up invocations at the cost of violating the -* POA semantics. In particular, every request to a particular objref -* must be handled by the same servant. Note that this is typically the -* case for EJB implementations. -*

-* If servant caching is used, there are two different additional -* features of the POA that are expensive: -*

    -*
  1. POA current semantics -*
  2. Proper handling of POA destroy. -*
-* POA current semantics requires maintaining a ThreadLocal stack of -* invocation information that is always available for POACurrent operations. -* Maintaining this stack is expensive on the timescale of optimized co-located -* calls, so the option is provided to turn it off. Similarly, causing -* POA.destroy() calls to wait for all active calls in the POA to complete -* requires careful tracking of the entry and exit of invocations in the POA. -* Again, tracking this is somewhat expensive. -*/ -public class ServantCachingPolicy extends LocalObject implements Policy -{ - /** Do not cache servants in the ClientRequestDispatcher. This will - * always support the full POA semantics, including changing the - * servant that handles requests on a particular objref. - */ - public static final int NO_SERVANT_CACHING = 0 ; - - /** Perform servant caching, preserving POA current and POA destroy semantics. - * We will use this as the new default, as the app server is making heavier use - * now of POA facilities. - */ - public static final int FULL_SEMANTICS = 1 ; - - /** Perform servant caching, preservent only POA current semantics. - * At least this level is required in order to support selection of ObjectCopiers - * for co-located RMI-IIOP calls, as the current copier is stored in - * OAInvocationInfo, which must be present on the stack inside the call. - */ - public static final int INFO_ONLY_SEMANTICS = 2 ; - - /** Perform servant caching, not preserving POA current or POA destroy semantics. - */ - public static final int MINIMAL_SEMANTICS = 3 ; - - private static ServantCachingPolicy policy = null ; - private static ServantCachingPolicy infoOnlyPolicy = null ; - private static ServantCachingPolicy minimalPolicy = null ; - - private int type ; - - public String typeToName() - { - switch (type) { - case FULL_SEMANTICS: - return "FULL" ; - case INFO_ONLY_SEMANTICS: - return "INFO_ONLY" ; - case MINIMAL_SEMANTICS: - return "MINIMAL" ; - default: - return "UNKNOWN(" + type + ")" ; - } - } - - public String toString() - { - return "ServantCachingPolicy[" + typeToName() + "]" ; - } - - private ServantCachingPolicy( int type ) - { - this.type = type ; - } - - public int getType() - { - return type ; - } - - /** Return the default servant caching policy. - */ - public synchronized static ServantCachingPolicy getPolicy() - { - return getFullPolicy() ; - } - - public synchronized static ServantCachingPolicy getFullPolicy() - { - if (policy == null) - policy = new ServantCachingPolicy( FULL_SEMANTICS ) ; - - return policy ; - } - - public synchronized static ServantCachingPolicy getInfoOnlyPolicy() - { - if (infoOnlyPolicy == null) - infoOnlyPolicy = new ServantCachingPolicy( INFO_ONLY_SEMANTICS ) ; - - return infoOnlyPolicy ; - } - - public synchronized static ServantCachingPolicy getMinimalPolicy() - { - if (minimalPolicy == null) - minimalPolicy = new ServantCachingPolicy( MINIMAL_SEMANTICS ) ; - - return minimalPolicy ; - } - - public int policy_type () - { - return ORBConstants.SERVANT_CACHING_POLICY ; - } - - public org.omg.CORBA.Policy copy () - { - return this ; - } - - public void destroy () - { - // NO-OP - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/extension/ZeroPortPolicy.java 2018-01-30 20:21:31.000000000 -0500 +++ /dev/null 2018-01-30 20:21:31.000000000 -0500 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.extension ; - -import org.omg.CORBA.Policy ; -import org.omg.CORBA.LocalObject ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -/** Policy used to implement zero IIOP port policy in the POA. -*/ -public class ZeroPortPolicy extends LocalObject implements Policy -{ - private static ZeroPortPolicy policy = new ZeroPortPolicy( true ) ; - - private boolean flag = true ; - - private ZeroPortPolicy( boolean type ) - { - this.flag = type ; - } - - public String toString() - { - return "ZeroPortPolicy[" + flag + "]" ; - } - - public boolean forceZeroPort() - { - return flag ; - } - - public synchronized static ZeroPortPolicy getPolicy() - { - return policy ; - } - - public int policy_type () - { - return ORBConstants.ZERO_PORT_POLICY ; - } - - public org.omg.CORBA.Policy copy () - { - return this ; - } - - public void destroy () - { - // NO-OP - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/EncapsulationFactoryBase.java 2018-01-30 20:21:32.000000000 -0500 +++ /dev/null 2018-01-30 20:21:32.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior ; - -import org.omg.CORBA_2_3.portable.InputStream ; - -import com.sun.corba.se.impl.ior.EncapsulationUtility ; - -public abstract class EncapsulationFactoryBase implements IdentifiableFactory { - private int id ; - - public int getId() - { - return id ; - } - - public EncapsulationFactoryBase( int id ) - { - this.id = id ; - } - - public final Identifiable create( InputStream in ) - { - InputStream is = EncapsulationUtility.getEncapsulationStream( in ) ; - return readContents( is ) ; - } - - protected abstract Identifiable readContents( InputStream is ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IOR.java 2018-01-30 20:21:33.000000000 -0500 +++ /dev/null 2018-01-30 20:21:33.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.ior; - -import java.util.List ; -import java.util.Iterator ; - -import com.sun.corba.se.spi.orb.ORBVersion ; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** An IOR is represented as a list of profiles. -* Only instances of TaggedProfile are contained in the list. -*/ -public interface IOR extends List, Writeable, MakeImmutable -{ - ORB getORB() ; - - /** Return the type id string from the IOR. - */ - String getTypeId() ; - - /** Return an iterator that iterates over tagged profiles with - * identifier id. It is not possible to modify the list through this - * iterator. - */ - Iterator iteratorById( int id ) ; - - /** Return a representation of this IOR in the standard GIOP stringified - * format that begins with "IOR:". - */ - String stringify() ; - - /** Return a representation of this IOR in the standard GIOP marshalled - * form. - */ - org.omg.IOP.IOR getIOPIOR() ; - - /** Return true if this IOR has no profiles. - */ - boolean isNil() ; - - /** Return true if this IOR is equivalent to ior. Here equivalent means - * that the typeids are the same, they have the same number of profiles, - * and each profile is equivalent to the corresponding profile. - */ - boolean isEquivalent(IOR ior) ; - - /** Return the IORTemplate for this IOR. This is simply a list - * of all TaggedProfileTemplates derived from the TaggedProfiles - * of the IOR. - */ - IORTemplateList getIORTemplates() ; - - /** Return the first IIOPProfile in this IOR. - * XXX THIS IS TEMPORARY FOR BACKWARDS COMPATIBILITY AND WILL BE REMOVED - * SOON! - */ - IIOPProfile getProfile() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactories.java 2018-01-30 20:21:33.000000000 -0500 +++ /dev/null 2018-01-30 20:21:33.000000000 -0500 @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior ; - -import java.io.Serializable ; - -import org.omg.CORBA_2_3.portable.InputStream ; - -import org.omg.CORBA.BAD_PARAM ; -import org.omg.CORBA.portable.ValueFactory ; - -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ObjectReferenceFactory ; - -import com.sun.corba.se.impl.ior.ObjectIdImpl ; -import com.sun.corba.se.impl.ior.ObjectKeyImpl ; -import com.sun.corba.se.impl.ior.IORImpl ; -import com.sun.corba.se.impl.ior.IORTemplateImpl ; -import com.sun.corba.se.impl.ior.IORTemplateListImpl ; -import com.sun.corba.se.impl.ior.ObjectReferenceProducerBase ; -import com.sun.corba.se.impl.ior.ObjectReferenceFactoryImpl ; -import com.sun.corba.se.impl.ior.ObjectReferenceTemplateImpl ; -import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** This class provides a number of factory methods for creating - * various IOR SPI classes which are not subclassed for specific protocols. - * The following types must be created using this class: - *
    - *
  • ObjectId
  • - *
  • ObjectKey
  • - *
  • IOR
  • - *
  • IORTemplate
  • - *
- */ -public class IORFactories { - private IORFactories() {} - - /** Create an ObjectId for the given byte sequence. - */ - public static ObjectId makeObjectId( byte[] id ) - { - return new ObjectIdImpl( id ) ; - } - - /** Create an ObjectKey for the given ObjectKeyTemplate and - * ObjectId. - */ - public static ObjectKey makeObjectKey( ObjectKeyTemplate oktemp, ObjectId oid ) - { - return new ObjectKeyImpl( oktemp, oid ) ; - } - - /** Create an empty IOR for the given orb and typeid. The result is mutable. - */ - public static IOR makeIOR( ORB orb, String typeid ) - { - return new IORImpl( orb, typeid ) ; - } - - /** Create an empty IOR for the given orb with a null typeid. The result is mutable. - */ - public static IOR makeIOR( ORB orb ) - { - return new IORImpl( orb ) ; - } - - /** Read an IOR from an InputStream. ObjectKeys are not shared. - */ - public static IOR makeIOR( InputStream is ) - { - return new IORImpl( is ) ; - } - - /** Create an IORTemplate with the given ObjectKeyTemplate. The result - * is mutable. - */ - public static IORTemplate makeIORTemplate( ObjectKeyTemplate oktemp ) - { - return new IORTemplateImpl( oktemp ) ; - } - - /** Read an IORTemplate from an InputStream. - */ - public static IORTemplate makeIORTemplate( InputStream is ) - { - return new IORTemplateImpl( is ) ; - } - - public static IORTemplateList makeIORTemplateList() - { - return new IORTemplateListImpl() ; - } - - public static IORTemplateList makeIORTemplateList( InputStream is ) - { - return new IORTemplateListImpl( is ) ; - } - - public static IORFactory getIORFactory( ObjectReferenceTemplate ort ) - { - if (ort instanceof ObjectReferenceTemplateImpl) { - ObjectReferenceTemplateImpl orti = - (ObjectReferenceTemplateImpl)ort ; - return orti.getIORFactory() ; - } - - throw new BAD_PARAM() ; - } - - public static IORTemplateList getIORTemplateList( ObjectReferenceFactory orf ) - { - if (orf instanceof ObjectReferenceProducerBase) { - ObjectReferenceProducerBase base = - (ObjectReferenceProducerBase)orf ; - return base.getIORTemplateList() ; - } - - throw new BAD_PARAM() ; - } - - public static ObjectReferenceTemplate makeObjectReferenceTemplate( ORB orb, - IORTemplate iortemp ) - { - return new ObjectReferenceTemplateImpl( orb, iortemp ) ; - } - - public static ObjectReferenceFactory makeObjectReferenceFactory( ORB orb, - IORTemplateList iortemps ) - { - return new ObjectReferenceFactoryImpl( orb, iortemps ) ; - } - - public static ObjectKeyFactory makeObjectKeyFactory( ORB orb ) - { - return new ObjectKeyFactoryImpl( orb ) ; - } - - public static IOR getIOR( org.omg.CORBA.Object obj ) - { - return ORBUtility.getIOR( obj ) ; - } - - public static org.omg.CORBA.Object makeObjectReference( IOR ior ) - { - return ORBUtility.makeObjectReference( ior ) ; - } - - /** This method must be called in order to register the value - * factories for the ObjectReferenceTemplate and ObjectReferenceFactory - * value types. - */ - public static void registerValueFactories( ORB orb ) - { - // Create and register the factory for the Object Reference Template - // implementation. - ValueFactory vf = new ValueFactory() { - public Serializable read_value( InputStream is ) - { - return new ObjectReferenceTemplateImpl( is ) ; - } - } ; - - orb.register_value_factory( ObjectReferenceTemplateImpl.repositoryId, vf ) ; - - // Create and register the factory for the Object Reference Factory - // implementation. - vf = new ValueFactory() { - public Serializable read_value( InputStream is ) - { - return new ObjectReferenceFactoryImpl( is ) ; - } - } ; - - orb.register_value_factory( ObjectReferenceFactoryImpl.repositoryId, vf ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactory.java 2018-01-30 20:21:34.000000000 -0500 +++ /dev/null 2018-01-30 20:21:34.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** An IORFactory provides the capability of creating IORs. It contains - * some collection of TaggedProfileTemplates, which can be iterated over - * for portable interceptors. - */ -public interface IORFactory extends Writeable, MakeImmutable { - /** Construct an IOR containing the given ORB, typeid, and ObjectId. - * The same ObjectId will be used for all TaggedProfileTemplates in - * the IORFactory. - */ - IOR makeIOR( ORB orb, String typeid, ObjectId oid ) ; - - /** Return true iff this.makeIOR(orb,typeid,oid).isEquivalent( - * other.makeIOR(orb,typeid,oid) for all orb, typeid, and oid. - */ - boolean isEquivalent( IORFactory other ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplate.java 2018-01-30 20:21:35.000000000 -0500 +++ /dev/null 2018-01-30 20:21:35.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior ; - -import java.util.List ; -import java.util.Iterator ; - -/** An IORTemplate provides all of the data necessary to create an IOR except - * for the typeId and ObjectId. It is a list of TaggedProfileTemplates. - */ -public interface IORTemplate extends List, IORFactory, MakeImmutable { - /** Iterate over all TaggedProfileTemplates in this IORTemplate - * with the given id. - */ - Iterator iteratorById( int id ) ; - - ObjectKeyTemplate getObjectKeyTemplate() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplateList.java 2018-01-30 20:21:35.000000000 -0500 +++ /dev/null 2018-01-30 20:21:35.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior ; - -import java.util.List ; - -/** An IORTemplateList is a list of IORTemplate instances. It can be used to create IORs. - * This is useful for representing IORs made of profiles from different object - * adapters. - * Note that any IORFactory can be added to an IORTemplateList, but it is flattened - * so that the result is just a list of IORTemplate instances. - */ -public interface IORTemplateList extends List, IORFactory, MakeImmutable { -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTypeCheckRegistry.java 2018-01-30 20:21:36.000000000 -0500 +++ /dev/null 2018-01-30 20:21:36.000000000 -0500 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2017, 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.corba.se.spi.ior; - -public interface IORTypeCheckRegistry { - public boolean isValidIORType(String iorClassName); -} - --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/Identifiable.java 2018-01-30 20:21:37.000000000 -0500 +++ /dev/null 2018-01-30 20:21:37.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.ior; - - -/** This interface represents an entity that can be written to an - * OutputStream and has an identity that is represented by an integer. - * This identity is essentially the type of the entity, and is used in - * order to know how to read the entity back from an InputStream. - * @author Ken Cavanaugh - */ -public interface Identifiable extends Writeable -{ - /** Return the (type) identity of this entity. - * @return int - */ - public int getId(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableBase.java 2018-01-30 20:21:37.000000000 -0500 +++ /dev/null 2018-01-30 20:21:37.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.ior; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.Writeable ; -import com.sun.corba.se.spi.ior.WriteContents ; -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.impl.ior.EncapsulationUtility ; - -/** Provide support for properly reading and writing Identifiable objects -* that are also encapsulations (tagged profiles and components). -*/ -public abstract class IdentifiableBase implements Identifiable, - WriteContents -{ - /** Write the data for this object as a CDR encapsulation. - * This is used for writing tagged components and profiles. - * These data types must be written out as encapsulations, - * which means that we need to first write the data out to - * an encapsulation stream, then extract the data and write - * it to os as an array of octets. - */ - final public void write( OutputStream os ) - { - EncapsulationUtility.writeEncapsulation( (WriteContents)this, os ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableContainerBase.java 2018-01-30 20:21:38.000000000 -0500 +++ /dev/null 2018-01-30 20:21:38.000000000 -0500 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.ior; - -import java.util.List; -import java.util.ArrayList; -import java.util.Iterator; - -import com.sun.corba.se.impl.ior.FreezableList ; - -import com.sun.corba.se.spi.ior.TaggedComponent ; -import com.sun.corba.se.spi.ior.Identifiable ; - -/** Convenience class for defining objects that contain lists of Identifiables. - * Mainly implements iteratorById. Also note that the constructor creates the - * list, which here is always an ArrayList, as this is much more efficient overall - * for short lists. - * @author Ken Cavanaugh - */ -public class IdentifiableContainerBase extends FreezableList -{ - /** Create this class with an empty list of identifiables. - * The current implementation uses an ArrayList. - */ - public IdentifiableContainerBase() - { - super( new ArrayList() ) ; - } - - /** Return an iterator which iterates over all contained Identifiables - * with type given by id. - */ - public Iterator iteratorById( final int id) - { - return new Iterator() { - Iterator iter = IdentifiableContainerBase.this.iterator() ; - Object current = advance() ; - - private Object advance() - { - while (iter.hasNext()) { - Identifiable ide = (Identifiable)(iter.next()) ; - if (ide.getId() == id) - return ide ; - } - - return null ; - } - - public boolean hasNext() - { - return current != null ; - } - - public Object next() - { - Object result = current ; - current = advance() ; - return result ; - } - - public void remove() - { - iter.remove() ; - } - } ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactory.java 2018-01-30 20:21:39.000000000 -0500 +++ /dev/null 2018-01-30 20:21:39.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.ior ; - -import org.omg.CORBA_2_3.portable.InputStream ; - -import com.sun.corba.se.spi.ior.Identifiable ; - -/** Factory interface for creating Identifiables. - */ -public interface IdentifiableFactory { - /** Return the id of this factory, which is the id of the result - * of any create call. - */ - public int getId() ; - - /** Construct the appropriate Identifiable object with the - * given id from the InputStream is. - */ - public Identifiable create( InputStream in ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactoryFinder.java 2018-01-30 20:21:39.000000000 -0500 +++ /dev/null 2018-01-30 20:21:39.000000000 -0500 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.ior; - -import org.omg.CORBA_2_3.portable.InputStream ; - -/** Interface used to manage a group of related IdentifiableFactory instances. - * Factories can be registered, and invoked through a create method, which - * must be implemented to handle the case of no registered factory - * appropriately. - * @author Ken Cavanaugh - */ -public interface IdentifiableFactoryFinder -{ - /** If there is a registered factory for id, use it to - * read an Identifiable from is. Otherwise create an - * appropriate generic container, or throw an error. - * The type of generic container, or error behavior is - * a property of the implementation. - */ - Identifiable create(int id, InputStream is); - - /** Register a factory for the given id. - */ - void registerFactory( IdentifiableFactory factory ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/MakeImmutable.java 2018-01-30 20:21:40.000000000 -0500 +++ /dev/null 2018-01-30 20:21:40.000000000 -0500 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior ; - -public interface MakeImmutable { - void makeImmutable() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectAdapterId.java 2018-01-30 20:21:41.000000000 -0500 +++ /dev/null 2018-01-30 20:21:41.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.ior ; - -import java.util.Iterator ; - -/** This is the object adapter ID for an object adapter. -* Typically this is the path of strings starting from the -* Root POA to get to a POA, but other implementations are possible. -*/ -public interface ObjectAdapterId extends Writeable { - /** Return the number of elements in the adapter ID. - */ - int getNumLevels() ; - - /** Return an iterator that iterates over the components - * of this adapter ID. Each element is returned as a String. - */ - Iterator iterator() ; - - /** Get the adapter name simply as an array of strings. - */ - String[] getAdapterName() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectId.java 2018-01-30 20:21:41.000000000 -0500 +++ /dev/null 2018-01-30 20:21:42.000000000 -0500 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior; - -/** - * @author Ken Cavanaugh - */ -public interface ObjectId extends Writeable -{ - public byte[] getId() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKey.java 2018-01-30 20:21:42.000000000 -0500 +++ /dev/null 2018-01-30 20:21:42.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.ior; - -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** The full object key, which is contained in an IIOPProfile. -* The object identifier corresponds to the information passed into -* POA::create_reference_with_id and POA::create_reference -* (in the POA case). The template -* represents the information that is object adapter specific and -* shared across multiple ObjectKey instances. -*/ -public interface ObjectKey extends Writeable -{ - /** Return the object identifier for this Object key. - */ - ObjectId getId() ; - - /** Return the template for this object key. - */ - ObjectKeyTemplate getTemplate() ; - - byte[] getBytes( org.omg.CORBA.ORB orb ) ; - - CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyFactory.java 2018-01-30 20:21:43.000000000 -0500 +++ /dev/null 2018-01-30 20:21:43.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior; - -import org.omg.CORBA_2_3.portable.InputStream ; - -import com.sun.corba.se.spi.ior.ObjectKey ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; - -/** Construct ObjectKey and ObjectKeyTemplate instances from their - * CDR-marshalled representation. - */ -public interface ObjectKeyFactory -{ - /** Create an ObjectKey from its octet sequence representation. - */ - ObjectKey create( byte[] key ) ; - - /** Create an ObjectKeyTemplate from its representation - * in an InputStream. - */ - ObjectKeyTemplate createTemplate( InputStream is ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyTemplate.java 2018-01-30 20:21:44.000000000 -0500 +++ /dev/null 2018-01-30 20:21:44.000000000 -0500 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.ior; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; - -/** An ObjectKeyTemplate represents the part of an Object Key - * that corresponds to the object adapter used to create an - * object reference. The template is shared between many - * object references. - */ -public interface ObjectKeyTemplate extends Writeable -{ - public ORBVersion getORBVersion() ; - - /** An ID used to determine how to perform operations on this - * ObjectKeyTemplate. This id determines how to process requests - * on this object reference, and what object adapter type to use. - */ - public int getSubcontractId(); - - /** Return the server ID for this template. - * For CORBA 3.0, this should be a String, but it is currently - * an int in the object key template. - */ - public int getServerId() ; - - /** Return the ORB ID for this template. - */ - public String getORBId() ; - - /** Return the object adapter ID for this template. - */ - public ObjectAdapterId getObjectAdapterId() ; - - /** Compute an adapter ID for this template than includes - * all of the template information. - * This value is cached to avoid the expense of recomputing - * it. - */ - public byte[] getAdapterId() ; - - public void write(ObjectId objectId, OutputStream os); - - public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponent.java 2018-01-30 20:21:44.000000000 -0500 +++ /dev/null 2018-01-30 20:21:44.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.ior; - -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA.ORB ; - -/** Generic interface for all tagged components. Users of the ORB may -* create implementations of this class and also corresponding factories -* of type TaggedComponentFactory. The factories can be registered with an -* ORB instance, in which case they will be used to unmarshal IORs containing -* the registered tagged component. -*/ -public interface TaggedComponent extends Identifiable -{ - org.omg.IOP.TaggedComponent getIOPComponent( ORB orb ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java 2018-01-30 20:21:45.000000000 -0500 +++ /dev/null 2018-01-30 20:21:45.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2000, 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.corba.se.spi.ior; - -import org.omg.CORBA_2_3.portable.InputStream ; - -import com.sun.corba.se.impl.encoding.EncapsOutputStream ; - -import com.sun.corba.se.spi.orb.ORB ; - - -/** Base class to use for implementing TaggedComponents. It implements - * the getIOPComponent method using the TaggedComponent.write() method. - * @author Ken Cavanaugh - */ -public abstract class TaggedComponentBase extends IdentifiableBase - implements TaggedComponent -{ - public org.omg.IOP.TaggedComponent getIOPComponent( - org.omg.CORBA.ORB orb ) - { - EncapsOutputStream os = - sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb); - write( os ) ; - InputStream is = (InputStream)(os.create_input_stream() ) ; - return org.omg.IOP.TaggedComponentHelper.read( is ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentFactoryFinder.java 2018-01-30 20:21:46.000000000 -0500 +++ /dev/null 2018-01-30 20:21:46.000000000 -0500 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior; - -public interface TaggedComponentFactoryFinder extends IdentifiableFactoryFinder -{ - /** Create a tagged component from a GIOP marshalled representation - * of a tagged component. This is needed for portable interceptors. - */ - TaggedComponent create( org.omg.CORBA.ORB orb, - org.omg.IOP.TaggedComponent comp ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfile.java 2018-01-30 20:21:46.000000000 -0500 +++ /dev/null 2018-01-30 20:21:46.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.ior; - -import com.sun.corba.se.spi.orb.ORB ; - -/** TaggedProfile represents a tagged profile in an IOR. - * A profile contains all of the information necessary for an invocation. - * It contains one or more endpoints that may be used for an invocation. - * A TaggedProfile conceptually has three parts: A TaggedProfileTemplate, - * an ObjectKeyTemplate, and an ObjectId. - */ -public interface TaggedProfile extends Identifiable, MakeImmutable -{ - TaggedProfileTemplate getTaggedProfileTemplate() ; - - ObjectId getObjectId() ; - - ObjectKeyTemplate getObjectKeyTemplate() ; - - ObjectKey getObjectKey() ; - - /** Return true is prof is equivalent to this TaggedProfile. - * This means that this and prof are indistinguishable for - * the purposes of remote invocation. Typically this means that - * the profile data is identical and both profiles contain exactly - * the same components (if components are applicable). - * isEquivalent( prof ) should imply that getObjectId().equals( - * prof.getObjectId() ) is true, and so is - * getObjectKeyTemplate().equals( prof.getObjectKeyTemplate() ). - */ - boolean isEquivalent( TaggedProfile prof ) ; - - /** Return the TaggedProfile as a CDR encapsulation in the standard - * format. This is required for Portable interceptors. - */ - org.omg.IOP.TaggedProfile getIOPProfile(); - - /** Return true if this TaggedProfile was created in orb. - * Caches the result. - */ - boolean isLocal() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplate.java 2018-01-30 20:21:47.000000000 -0500 +++ /dev/null 2018-01-30 20:21:47.000000000 -0500 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.ior; - -import java.util.List ; -import java.util.Iterator ; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.Identifiable ; -import com.sun.corba.se.spi.ior.Writeable ; -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.WriteContents ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** Base template for creating TaggedProfiles. A TaggedProfile will often contain -* tagged components. A template that does not contain components acts like -* an empty immutable list. -* -* @author Ken Cavanaugh -*/ -public interface TaggedProfileTemplate extends List, Identifiable, - WriteContents, MakeImmutable -{ - /** Return an iterator that iterates over tagged components with - * identifier id. It is not possible to modify the list through this - * iterator. - */ - public Iterator iteratorById( int id ) ; - - /** Create a TaggedProfile from this template. - */ - TaggedProfile create( ObjectKeyTemplate oktemp, ObjectId id ) ; - - /** Write the profile create( oktemp, id ) to the OutputStream os. - */ - void write( ObjectKeyTemplate oktemp, ObjectId id, OutputStream os) ; - - /** Return true if temp is equivalent to this template. Equivalence - * means that in some sense an invocation on a profile created by this - * template has the same results as an invocation on a profile - * created from temp. Equivalence may be weaker than equality. - */ - boolean isEquivalent( TaggedProfileTemplate temp ); - - /** Return the tagged components in this profile (if any) - * in the GIOP marshalled form, which is required for Portable - * Interceptors. Returns null if either the profile has no - * components, or if this type of profile can never contain - * components. - */ - org.omg.IOP.TaggedComponent[] getIOPComponents( - ORB orb, int id ); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplateBase.java 2018-01-30 20:21:48.000000000 -0500 +++ /dev/null 2018-01-30 20:21:48.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior; - -import java.util.Iterator ; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.impl.ior.EncapsulationUtility ; - -public abstract class TaggedProfileTemplateBase - extends IdentifiableContainerBase - implements TaggedProfileTemplate -{ - public void write( OutputStream os ) - { - EncapsulationUtility.writeEncapsulation( this, os ) ; - } - - public org.omg.IOP.TaggedComponent[] getIOPComponents( ORB orb, int id ) - { - int count = 0 ; - Iterator iter = iteratorById( id ) ; - while (iter.hasNext()) { - iter.next() ; - count++ ; - } - - org.omg.IOP.TaggedComponent[] result = new - org.omg.IOP.TaggedComponent[count] ; - - int index = 0 ; - iter = iteratorById( id ) ; - while (iter.hasNext()) { - TaggedComponent comp = (TaggedComponent)(iter.next()) ; - result[index++] = comp.getIOPComponent( orb ) ; - } - - return result ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/WriteContents.java 2018-01-30 20:21:48.000000000 -0500 +++ /dev/null 2018-01-30 20:21:48.000000000 -0500 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.ior; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -public interface WriteContents { - void writeContents( OutputStream os ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/Writeable.java 2018-01-30 20:21:49.000000000 -0500 +++ /dev/null 2018-01-30 20:21:49.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.ior; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -/** This interface represents an entity that can be written to an OutputStream. - * @author Ken Cavanaugh - */ -public interface Writeable -{ - /** Write this object directly to the output stream. - */ - void write(OutputStream arg0); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/AlternateIIOPAddressComponent.java 2018-01-30 20:21:50.000000000 -0500 +++ /dev/null 2018-01-30 20:21:50.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.ior.iiop; - -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.TaggedComponent ; - -/** - * @author Ken Cavanaugh - */ -public interface AlternateIIOPAddressComponent extends TaggedComponent -{ - public IIOPAddress getAddress() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/CodeSetsComponent.java 2018-01-30 20:21:50.000000000 -0500 +++ /dev/null 2018-01-30 20:21:50.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.ior.iiop; - -import com.sun.corba.se.spi.ior.TaggedComponent ; - -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ; - -/** - * @author Ken Cavanaugh - */ -public interface CodeSetsComponent extends TaggedComponent -{ - public CodeSetComponentInfo getCodeSetComponentInfo() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/GIOPVersion.java 2018-01-30 20:21:51.000000000 -0500 +++ /dev/null 2018-01-30 20:21:51.000000000 -0500 @@ -1,219 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.spi.ior.iiop ; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.orb.ORBVersion; -import com.sun.corba.se.spi.orb.ORBVersionFactory; - -import com.sun.corba.se.impl.orbutil.ORBUtility; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; - -public class GIOPVersion { - - // Static fields - - public static final GIOPVersion V1_0 = new GIOPVersion((byte)1, (byte)0); - public static final GIOPVersion V1_1 = new GIOPVersion((byte)1, (byte)1); - public static final GIOPVersion V1_2 = new GIOPVersion((byte)1, (byte)2); - public static final GIOPVersion V1_3 = new GIOPVersion((byte)1, (byte)3); - - // Major version 13 indicates Java serialization, - // Minor version [00-FF] is the version number. - public static final GIOPVersion V13_XX = - new GIOPVersion((byte)13, (byte)Message.JAVA_ENC_VERSION); - - public static final GIOPVersion DEFAULT_VERSION = V1_2; - - public static final int VERSION_1_0 = 0x0100; - public static final int VERSION_1_1 = 0x0101; - public static final int VERSION_1_2 = 0x0102; - public static final int VERSION_1_3 = 0x0103; - public static final int VERSION_13_XX = - ((0x0D << 8) & 0x0000FF00) | Message.JAVA_ENC_VERSION; - - // Instance variables - - private byte major = (byte) 0; - private byte minor = (byte) 0; - - // Constructor - - public GIOPVersion() {} - - public GIOPVersion(byte majorB, byte minorB) { - this.major = majorB; - this.minor = minorB; - } - - public GIOPVersion(int major, int minor) { - this.major = (byte)major; - this.minor = (byte)minor; - } - - // Accessor methods - - public byte getMajor() { - return this.major; - } - - public byte getMinor() { - return this.minor; - } - - // General methods - - public boolean equals(GIOPVersion gv){ - return gv.major == this.major && gv.minor == this.minor ; - } - - public boolean equals(Object obj) { - if (obj != null && (obj instanceof GIOPVersion)) - return equals((GIOPVersion)obj); - else - return false; - } - - public int hashCode() - { - return 37*major + minor ; - } - - public boolean lessThan(GIOPVersion gv) { - if (this.major < gv.major) { - return true; - } else if (this.major == gv.major) { - if (this.minor < gv.minor) { - return true; - } - } - - return false; - } - - public int intValue() - { - return (major << 8 | minor); - } - - public String toString() - { - return major + "." + minor; - } - - public static GIOPVersion getInstance(byte major, byte minor) - { - switch(((major << 8) | minor)) { - case VERSION_1_0: - return GIOPVersion.V1_0; - case VERSION_1_1: - return GIOPVersion.V1_1; - case VERSION_1_2: - return GIOPVersion.V1_2; - case VERSION_1_3: - return GIOPVersion.V1_3; - case VERSION_13_XX: - return GIOPVersion.V13_XX; - default: - return new GIOPVersion(major, minor); - } - } - - public static GIOPVersion parseVersion(String s) - { - int dotIdx = s.indexOf('.'); - - if (dotIdx < 1 || dotIdx == s.length() - 1) - throw new NumberFormatException("GIOP major, minor, and decimal point required: " + s); - - int major = Integer.parseInt(s.substring(0, dotIdx)); - int minor = Integer.parseInt(s.substring(dotIdx + 1, s.length())); - - return GIOPVersion.getInstance((byte)major, (byte)minor); - } - - /** - * This chooses the appropriate GIOP version. - * - * @return the GIOP version 13.00 if Java serialization is enabled, or - * smallest(profGIOPVersion, orbGIOPVersion) - */ - public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) { - - GIOPVersion orbVersion = orb.getORBData().getGIOPVersion(); - IIOPProfile prof = ior.getProfile() ; - GIOPVersion profVersion = prof.getGIOPVersion(); - - // Check if the profile is from a legacy Sun ORB. - - ORBVersion targetOrbVersion = prof.getORBVersion(); - if (!(targetOrbVersion.equals(ORBVersionFactory.getFOREIGN())) && - targetOrbVersion.lessThan(ORBVersionFactory.getNEWER())) { - // we are dealing with a SUN legacy orb which emits 1.1 IORs, - // in spite of being able to handle only GIOP 1.0 messages. - return V1_0; - } - - // Now the target has to be (FOREIGN | NEWER*) - - byte prof_major = profVersion.getMajor(); - byte prof_minor = profVersion.getMinor(); - - byte orb_major = orbVersion.getMajor(); - byte orb_minor = orbVersion.getMinor(); - - if (orb_major < prof_major) { - return orbVersion; - } else if (orb_major > prof_major) { - return profVersion; - } else { // both major version are the same - if (orb_minor <= prof_minor) { - return orbVersion; - } else { - return profVersion; - } - } - } - - public boolean supportsIORIIOPProfileComponents() - { - return getMinor() > 0 || getMajor() > 1; - } - - // IO methods - - public void read(org.omg.CORBA.portable.InputStream istream) { - this.major = istream.read_octet(); - this.minor = istream.read_octet(); - } - - public void write(org.omg.CORBA.portable.OutputStream ostream) { - ostream.write_octet(this.major); - ostream.write_octet(this.minor); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPAddress.java 2018-01-30 20:21:52.000000000 -0500 +++ /dev/null 2018-01-30 20:21:52.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.ior.iiop; - -import com.sun.corba.se.spi.ior.Writeable ; - -/** IIOPAddress represents the host and port used to establish a - * TCP connection for an IIOP request. - */ -public interface IIOPAddress extends Writeable -{ - public String getHost() ; - - public int getPort() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPFactories.java 2018-01-30 20:21:52.000000000 -0500 +++ /dev/null 2018-01-30 20:21:53.000000000 -0500 @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.spi.ior.iiop ; - -import org.omg.CORBA_2_3.portable.InputStream ; - -import com.sun.corba.se.spi.ior.Identifiable ; -import com.sun.corba.se.spi.ior.IdentifiableFactory ; -import com.sun.corba.se.spi.ior.EncapsulationFactoryBase ; -import com.sun.corba.se.spi.ior.ObjectId ; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; - -import com.sun.corba.se.spi.ior.iiop.IIOPAddress ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.impl.encoding.MarshalInputStream ; - -import com.sun.corba.se.impl.ior.iiop.IIOPAddressImpl ; -import com.sun.corba.se.impl.ior.iiop.CodeSetsComponentImpl ; -import com.sun.corba.se.impl.ior.iiop.AlternateIIOPAddressComponentImpl ; -import com.sun.corba.se.impl.ior.iiop.JavaCodebaseComponentImpl ; -import com.sun.corba.se.impl.ior.iiop.MaxStreamFormatVersionComponentImpl ; -import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent; -import com.sun.corba.se.impl.ior.iiop.ORBTypeComponentImpl ; -import com.sun.corba.se.impl.ior.iiop.IIOPProfileImpl ; -import com.sun.corba.se.impl.ior.iiop.IIOPProfileTemplateImpl ; -import com.sun.corba.se.impl.ior.iiop.RequestPartitioningComponentImpl ; -import com.sun.corba.se.impl.orbutil.ORBConstants; -import com.sun.corba.se.impl.orbutil.ORBConstants; - -import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ; -import org.omg.IOP.TAG_CODE_SETS ; -import org.omg.IOP.TAG_JAVA_CODEBASE ; -import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT ; -import org.omg.IOP.TAG_ORB_TYPE ; -import org.omg.IOP.TAG_INTERNET_IOP ; - -/** This class provides all of the factories for the IIOP profiles and - * components. This includes direct construction of profiles and templates, - * as well as constructing factories that can be registered with an - * IdentifiableFactoryFinder. - */ -public abstract class IIOPFactories { - private IIOPFactories() {} - - public static IdentifiableFactory makeRequestPartitioningComponentFactory() - { - return new EncapsulationFactoryBase(ORBConstants.TAG_REQUEST_PARTITIONING_ID) { - public Identifiable readContents(InputStream in) - { - int threadPoolToUse = in.read_ulong(); - Identifiable comp = - new RequestPartitioningComponentImpl(threadPoolToUse); - return comp; - } - }; - } - - public static RequestPartitioningComponent makeRequestPartitioningComponent( - int threadPoolToUse) - { - return new RequestPartitioningComponentImpl(threadPoolToUse); - } - - public static IdentifiableFactory makeAlternateIIOPAddressComponentFactory() - { - return new EncapsulationFactoryBase(TAG_ALTERNATE_IIOP_ADDRESS.value) { - public Identifiable readContents( InputStream in ) - { - IIOPAddress addr = new IIOPAddressImpl( in ) ; - Identifiable comp = - new AlternateIIOPAddressComponentImpl( addr ) ; - return comp ; - } - } ; - } - - public static AlternateIIOPAddressComponent makeAlternateIIOPAddressComponent( - IIOPAddress addr ) - { - return new AlternateIIOPAddressComponentImpl( addr ) ; - } - - public static IdentifiableFactory makeCodeSetsComponentFactory() - { - return new EncapsulationFactoryBase(TAG_CODE_SETS.value) { - public Identifiable readContents( InputStream in ) - { - return new CodeSetsComponentImpl( in ) ; - } - } ; - } - - public static CodeSetsComponent makeCodeSetsComponent( ORB orb ) - { - return new CodeSetsComponentImpl( orb ) ; - } - - public static IdentifiableFactory makeJavaCodebaseComponentFactory() - { - return new EncapsulationFactoryBase(TAG_JAVA_CODEBASE.value) { - public Identifiable readContents( InputStream in ) - { - String url = in.read_string() ; - Identifiable comp = new JavaCodebaseComponentImpl( url ) ; - return comp ; - } - } ; - } - - public static JavaCodebaseComponent makeJavaCodebaseComponent( - String codebase ) - { - return new JavaCodebaseComponentImpl( codebase ) ; - } - - public static IdentifiableFactory makeORBTypeComponentFactory() - { - return new EncapsulationFactoryBase(TAG_ORB_TYPE.value) { - public Identifiable readContents( InputStream in ) - { - int type = in.read_ulong() ; - Identifiable comp = new ORBTypeComponentImpl( type ) ; - return comp ; - } - } ; - } - - public static ORBTypeComponent makeORBTypeComponent( int type ) - { - return new ORBTypeComponentImpl( type ) ; - } - - public static IdentifiableFactory makeMaxStreamFormatVersionComponentFactory() - { - return new EncapsulationFactoryBase(TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value) { - public Identifiable readContents(InputStream in) - { - byte version = in.read_octet() ; - Identifiable comp = new MaxStreamFormatVersionComponentImpl(version); - return comp ; - } - }; - } - - public static MaxStreamFormatVersionComponent makeMaxStreamFormatVersionComponent() - { - return new MaxStreamFormatVersionComponentImpl() ; - } - - public static IdentifiableFactory makeJavaSerializationComponentFactory() { - return new EncapsulationFactoryBase( - ORBConstants.TAG_JAVA_SERIALIZATION_ID) { - public Identifiable readContents(InputStream in) { - byte version = in.read_octet(); - Identifiable cmp = new JavaSerializationComponent(version); - return cmp; - } - }; - } - - public static JavaSerializationComponent makeJavaSerializationComponent() { - return JavaSerializationComponent.singleton(); - } - - public static IdentifiableFactory makeIIOPProfileFactory() - { - return new EncapsulationFactoryBase(TAG_INTERNET_IOP.value) { - public Identifiable readContents( InputStream in ) - { - Identifiable result = new IIOPProfileImpl( in ) ; - return result ; - } - } ; - } - - public static IIOPProfile makeIIOPProfile( ORB orb, ObjectKeyTemplate oktemp, - ObjectId oid, IIOPProfileTemplate ptemp ) - { - return new IIOPProfileImpl( orb, oktemp, oid, ptemp ) ; - } - - public static IIOPProfile makeIIOPProfile( ORB orb, - org.omg.IOP.TaggedProfile profile ) - { - return new IIOPProfileImpl( orb, profile ) ; - } - - public static IdentifiableFactory makeIIOPProfileTemplateFactory() - { - return new EncapsulationFactoryBase(TAG_INTERNET_IOP.value) { - public Identifiable readContents( InputStream in ) - { - Identifiable result = new IIOPProfileTemplateImpl( in ) ; - return result ; - } - } ; - } - - public static IIOPProfileTemplate makeIIOPProfileTemplate( ORB orb, - GIOPVersion version, IIOPAddress primary ) - { - return new IIOPProfileTemplateImpl( orb, version, primary ) ; - } - - public static IIOPAddress makeIIOPAddress( ORB orb, String host, int port ) - { - return new IIOPAddressImpl( orb, host, port ) ; - } - - public static IIOPAddress makeIIOPAddress( InputStream is ) - { - return new IIOPAddressImpl( is ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfile.java 2018-01-30 20:21:53.000000000 -0500 +++ /dev/null 2018-01-30 20:21:53.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.ior.iiop; - -import com.sun.corba.se.spi.ior.TaggedProfile ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.ORBVersion ; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; - -/** IIOPProfile represents an IIOP tagged profile. -* It is essentially composed of an object identifier and -* a template. The template contains all of the -* IIOP specific information in the profile. -* Templates are frequently shared between many different profiles, -* while the object identifiy is unique to each profile. -*/ -public interface IIOPProfile extends TaggedProfile -{ - ORBVersion getORBVersion() ; - - /** Return the servant for this profile, if it is local - * AND if the OA that implements this objref supports direct access to servants - * outside of an invocation. - * XXX move this to the ObjectKeyTemplate - */ - java.lang.Object getServant() ; - - /** Return the GIOPVersion of this profile. Caches the result. - */ - GIOPVersion getGIOPVersion() ; - - /** Return the Codebase of this profile. Caches the result. - */ - String getCodebase() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfileTemplate.java 2018-01-30 20:21:54.000000000 -0500 +++ /dev/null 2018-01-30 20:21:54.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.ior.iiop; - -import java.util.List ; -import java.util.Iterator ; - -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.ior.TaggedProfileTemplate ; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.se.spi.orb.ORB ; - -/** - * IIOPProfileTemplate represents the parts of an IIOPProfile that are independent - * of the object identifier. It is a container of tagged components. - */ -public interface IIOPProfileTemplate extends TaggedProfileTemplate -{ - /** Return the GIOP version of this profile. - */ - public GIOPVersion getGIOPVersion() ; - - /** Return the IIOP address from the IIOP profile. This is called the - * primary address here since other addresses may be contained in - * components. - */ - public IIOPAddress getPrimaryAddress() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/JavaCodebaseComponent.java 2018-01-30 20:21:55.000000000 -0500 +++ /dev/null 2018-01-30 20:21:55.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.ior.iiop; - -import com.sun.corba.se.spi.ior.TaggedComponent ; - -/** - * @author Ken Cavanaugh - */ -public interface JavaCodebaseComponent extends TaggedComponent -{ - public String getURLs() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/MaxStreamFormatVersionComponent.java 2018-01-30 20:21:55.000000000 -0500 +++ /dev/null 2018-01-30 20:21:55.000000000 -0500 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.ior.iiop; - -import com.sun.corba.se.spi.ior.TaggedComponent ; - -// Java to IDL ptc 02-01-12 1.4.11 -// TAG_RMI_CUSTOM_MAX_STREAM_FORMAT -public interface MaxStreamFormatVersionComponent extends TaggedComponent -{ - public byte getMaxStreamFormatVersion() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/ORBTypeComponent.java 2018-01-30 20:21:56.000000000 -0500 +++ /dev/null 2018-01-30 20:21:56.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.ior.iiop; - -import com.sun.corba.se.spi.ior.TaggedComponent ; - -/** - * @author Ken Cavanaugh - */ -public interface ORBTypeComponent extends TaggedComponent -{ - public int getORBType() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/RequestPartitioningComponent.java 2018-01-30 20:21:57.000000000 -0500 +++ /dev/null 2018-01-30 20:21:57.000000000 -0500 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.ior.iiop; - -import com.sun.corba.se.spi.ior.TaggedComponent; - -public interface RequestPartitioningComponent extends TaggedComponent -{ - public int getRequestPartitioningId(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iornotes 2018-01-30 20:21:57.000000000 -0500 +++ /dev/null 2018-01-30 20:21:58.000000000 -0500 @@ -1,107 +0,0 @@ -Implementation hierarchies in the IOR code - -Utility classes: - impl.ior.ByteBuffer class used to speed up computation of the adapter id - impl.ior.EncapsulationUtility misc. utilities for dealing with CDR encapsulation - impl.ior.FreezableList special list class that can change from mutable to immutable (one way only) - impl.ior.MinorCodes minor codes for all IOR errors - impl.ior.ORTImpl wrapper around IORTemplate for ORT - spi.ior.IORFactories factory for all basic IOR types - spi.ior.IIOP.???Factories factory for IIOP IOR factory types (IIOPProfile, IIOPProfileTemplate, - and all of the supported IIOP tagged component factories) - This needs to provide access to all of the IdentifiableFactory instances - we need for registration. It also needs to provide factory methods for - creating all of these types. - impl.ior.iiop.TaggedComponentFactories needs to be absorbed here. - - -Support for non-registered (unknown) TaggedComponent and TaggedProfile instances - impl.ior.GenericIdEncapsulation - impl.ior.GenericTaggedComponent - impl.ior.GenericTaggedProfile - -Basic common representation for writing, getting ids, inherited lists: - spi.ior.IdentifiableContainerBase - spi.ior.Writeable - spi.ior.Identifiable - spi.ior.IdentifiableBase - -Some basic IOR types and their implementation: - spi.ior.IOR - impl.ior.IORImpl - - spi.ior.IORTemplate - impl.ior.IORTemplateImpl - - spi.ior.IdentifiableFactory (the basic factory type, which is never created in the spi.ior package. - All instances of this factory are necessarily protocol dependent, for example IIOP in the - spi.ior.iiop package). - spi.ior.IdentifiableFactoryFinder - impl.ior.IdentifiableFactoryFinderBase - impl.ior.TaggedComponentFactoryFinderImpl - impl.ior.TaggedProfileFactoryFinderImpl - - spi.ior.ObjectAdapterId - impl.ior.ObjectAdapterIdBase - impl.ior.ObjectAdapterIdArray - impl.ior.ObjectAdapterIdNumber - - spi.ior.ObjectId - impl.ior.ObjectIdImpl - - spi.ior.ObjectKey - impl.ior.ObjectKeyImpl - -The ObjectKeyTemplate family, which needs some work for pluggability yet: - impl.ior.ObjectKeyFactory - impl.ior.ObjectKeyTemplateFactory : should this be in the SPI? - spi.ior.ObjectKeyTemplate - impl.ior.WireObjectKeyTemplate - impl.ior.ObjectKeyTemplateBase - impl.ior.OldObjectKeyTemplateBase - impl.ior.OldJIDLObjectKeyTemplate - impl.ior.OldPOAObjectKeyTemplate - impl.ior.NewObjectKeyTemplateBase - impl.ior.JIDLObjectKeyTemplate - impl.ior.POAObjectKeyTemplate - -IIOP types and their implementations: - spi.ior.TaggedComponent - spi.ior.TaggedComponentBase - impl.ior.iiop.AlternateIIOPAddressComponent - impl.ior.iiop.CodeSetsComponent - impl.ior.iiop.JavaCodebaseComponent - impl.ior.iiop.MaxStreamFormatVersionComponent - impl.ior.iiop.ORBTypeComponent - impl.ior.iiop.PoliciesComponent - - spi.ior.TaggedProfile - spi.ior.iiop.IIOPProfile - impl.ior.iiop.IIOPProfileImpl - - spi.ior.TaggedProfileTemplate - spi.ior.iiop.IIOPProfileTemplate - impl.ior.iiop.IIOPProfileTemplateImpl - - spi.ior.iiop.IIOPAddress - impl.ior.iiop.IIOPAddressBase - impl.ior.iiop.IIOPAddressFutureImpl - impl.ior.iiop.IIOPAddressImpl - -Issues: - -1. GIOPVersion.chooseRequestVersion( ORB, IOR ) is not well-defined: it should be - (ORB, IIOPProfile). - Call sites: - Connection.locate: not used - Called from GIOPImpl.locate: not used - CorbaContactInfoImpl.createMessageMediator - This needs a version that looks only at a single profile. - -2. MessageBase.createRequest takes an IOR instead of an IIOPProfile. - -3. CDRInputStream_1_0.read_Object( Class ) calls IOR.getCodebase() in - a call to Utility.loadStubClass, which is - only defined on a profile. What do we do here? - Similar problem in same class internalIORToObject, which call IOR.getServant - and IOR.getCodebase. IOR.getCodeBase is called in loadStub. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/ior/package.html 2018-01-30 20:21:58.000000000 -0500 +++ /dev/null 2018-01-30 20:21:58.000000000 -0500 @@ -1,64 +0,0 @@ - - - - - - - -

-Provides access to the components and profiles in an IOR without the overhead -of CDR encoding. -

-The abstract model of IORs works as follows: - -

    -
  • An IOR has a type ID string, and contains TaggedProfile instances.
  • -
  • An IIOPProfile isA TaggedProfile.
  • -
  • An IIOPProfile is composed of an IIOPProfileTemplate and an object ID.
  • -
  • An IIOPProfileTemplate has an ObjectKeyTemplate, and contains TaggedComponents.
  • -
  • A TaggedComponent has an ID, and can be written to an OuputStream.
  • -
  • A TaggedComponentFactory reads a TaggedComponent from an InputStream.
  • -
-

-In all cases, containment is represented by having the appropriate interface (IOR and -IIOPProfileTemplate above) extend java.util.List. This makes it easy to use all of the -facilities in the Java collections framework with IORs. However, note that all -objects available through these APIs are immutable. Thus all list update operations -through UnsupportedOperationException, and list iterators cannot modify the underlying -list. -

-Templates are used because the basic object adapter model for object creation is to -establish all properties of an IOR (except for type and object ID) when the object -adapter is created. This has been present for the POA essentially from the beginning, -since policies can only be passed to create_POA, and cannot be changed on an existing -POA. The Portable Interceptors work has also made this clear, since the IOR interceptor -runs only when an object adapter is created, which is the only time that user code -can add tagged components to an IOR. - - - --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/Connection.java 2018-01-30 20:21:59.000000000 -0500 +++ /dev/null 2018-01-30 20:21:59.000000000 -0500 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.legacy.connection; - -/** - * This interface represents the connection on which a request is made. - */ - -public interface Connection -{ - public java.net.Socket getSocket(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/GetEndPointInfoAgainException.java 2018-01-30 20:22:00.000000000 -0500 +++ /dev/null 2018-01-30 20:22:00.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.spi.legacy.connection; - -import com.sun.corba.se.spi.transport.SocketInfo; - -/** - * This exception is raised by ORBSocketFactory.createSocket. - * It informs the ORB that it should call - * ORBSocketFactory.getEndPointInfo again with the - * given socketInfo object as an argument (i.e., a cookie). - * - */ - -public class GetEndPointInfoAgainException - extends Exception -{ - private SocketInfo socketInfo; - - public GetEndPointInfoAgainException(SocketInfo socketInfo) - { - this.socketInfo = socketInfo; - } - - public SocketInfo getEndPointInfo() - { - return socketInfo; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketEndPointInfo.java 2018-01-30 20:22:00.000000000 -0500 +++ /dev/null 2018-01-30 20:22:00.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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.corba.se.spi.legacy.connection; - -/** - * LegacyServerSocketEndPointInfo is an abstraction of a port. - */ -public interface LegacyServerSocketEndPointInfo -{ - /** - * e.g.: "CLEAR_TEXT", "SSL", ... - */ - public String getType(); - - - /** - * Get the host name of this end point. Subcontracts must use this - * instead of InetAddress.getHostName() because this would take - * into account the value of the ORBServerHost property. - */ - public String getHostName(); - - public int getPort(); - - /** - * The ORBD's proxy port of this end point. - * Note: Pre-ORT "port-exchange" model. - */ - public int getLocatorPort(); - public void setLocatorPort(int port); - - // NAME is used while we still have a "port-exchange" ORBD - // to get what used to be called "default" or "bootstrap" endpoints. - - public static final String DEFAULT_ENDPOINT = "DEFAULT_ENDPOINT"; - public static final String BOOT_NAMING = "BOOT_NAMING"; - public static final String NO_NAME = "NO_NAME"; - - public String getName(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketManager.java 2018-01-30 20:22:01.000000000 -0500 +++ /dev/null 2018-01-30 20:22:01.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1998, 2003, 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.corba.se.spi.legacy.connection; - -import java.util.Collection; - -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo; -import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor; - -/** - * @author Harold Carr - */ -public interface LegacyServerSocketManager -{ - public int legacyGetTransientServerPort(String type); - public int legacyGetPersistentServerPort(String socketType); - public int legacyGetTransientOrPersistentServerPort(String socketType); - - public LegacyServerSocketEndPointInfo legacyGetEndpoint(String name); - - public boolean legacyIsLocalServerPort(int port); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/ORBSocketFactory.java 2018-01-30 20:22:02.000000000 -0500 +++ /dev/null 2018-01-30 20:22:02.000000000 -0500 @@ -1,358 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.spi.legacy.connection; - -import java.net.ServerSocket; -import java.net.Socket; -import java.io.IOException; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.transport.SocketInfo; - -/** - * - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

- * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

- * - * This interface gives one the ability to plug in their own socket - * factory class to an ORB.

- * - * Usage:

- * - * One specifies a class which implements this interface via the - * - * ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY - * - * property.

- * - * Example: - - *

- *   -Dcom.sun.CORBA.connection.ORBSocketFactoryClass=MySocketFactory
- * 

- * - * Typically one would use the same socket factory class on both the - * server side and the client side (but this is not required).

- * - * A ORBSocketFactory class should have a public default - * constructor which is called once per instantiating ORB.init call. - * That ORB then calls the methods of that ORBSocketFactory - * to obtain client and server sockets.

- * - * This interface also supports multiple server end points. See the - * documentation on createServerSocket below. - * - */ - -public interface ORBSocketFactory -{ - /** - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

- * - * A server ORB always creates an "IIOP_CLEAR_TEXT" listening port. - * That port is put into IOP profiles of object references exported - * by an ORB.

- * - * If - * - * createServerSocket(String type, int port) - * - * is passed IIOP_CLEAR_TEXT as a type - * argument it should then call and return - * - * new java.net.ServerSocket(int port)

- * - * If - * - * createSocket(SocketInfo socketInfo) - * - * is passed IIOP_CLEAR_TEXT in - * socketInfo.getType() it should - * then call and return - * - *

-     *     new java.net.Socket(socketInfo.getHost(),
-     *                         socketInfo.getPort())
-     * 
- * - */ - public static final String IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT"; - - - /** - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

- * - * This method is used by a server side ORB.

- * - * When an ORB needs to create a listen socket on which connection - * requests are accepted it calls - * - * createServerSocket(String type, int port). - * - * The type argument says which type of socket should be created.

- * - * The interpretation of the type argument is the responsibility of - * an instance of ORBSocketFactory, except in the case - * of IIOP_CLEAR_TEXT, in which case a standard server - * socket should be created.

- * - * - * Multiple Server Port API:

- * - * In addition to the IIOP_CLEAR_TEXT listening port, it is possible - * to specify that an ORB listen on additional port of specific types.

- * - * This API allows one to specify that an ORB should create an X, - * or an X and a Y listen socket.

- * - * If X, to the user, means SSL, then one just plugs in an SSL - * socket factory.

- * - * Or, another example, if X and Y, to the user, means SSL without - * authentication and SSL with authentication respectively, then they - * plug in a factory which will either create an X or a Y socket - * depending on the type given to - * - * createServerSocket(String type, int port).

- * - * One specifies multiple listening ports (in addition to the - * default IIOP_CLEAR_TEXT port) using the - * - * ORBConstants.LISTEN_SOCKET_PROPERTY - * - * property.

- * - * Example usage: - * - *

-     *    ... \
-     *    -Dcom.sun.CORBA.connection.ORBSocketFactoryClass=com.my.MySockFact \
-     *    -Dcom.sun.CORBA.connection.ORBListenSocket=SSL:0,foo:1 \
-     *    ...
-     * 
- * - * The meaning of the "type" (SSL and foo above) is controlled - * by the user.

- * - * ORBListenSocket is only meaningful for servers.

- * - * The property value is interpreted as follows. For each - * type/number pair:

- * - * If number is 0 then use an emphemeral port for the listener of - * the associated type.

- * - * If number is greater than 0 use that port number.

- * - * An ORB creates a listener socket for each type - * specified by the user by calling - * - * createServerSocket(String type, int port) - * - * with the type specified by the user.

- * - * After an ORB is initialized and the RootPOA has been resolved, - * it is then listening on - * all the end points which were specified. It may be necessary - * to add this additional end point information to object references - * exported by this ORB.

- * - * Each object reference will contain the ORB's default IIOP_CLEAR_TEXT - * end point in its IOP profile. To add additional end point information - * (i.e., an SSL port) to an IOR (i.e., an object reference) one needs - * to intercept IOR creation using - * an PortableInterceptor::IORInterceptor.

- * - * Using PortableInterceptors (with a non-standard extension):

- * - * Register an IORInterceptor. Inside its - * establish_components operation: - * - *

-     *
-     * com.sun.corba.se.spi.legacy.interceptor.IORInfoExt ext;
-     * ext = (com.sun.corba.se.spi.legacy.interceptor.IORInfoExt)info;
-     *
-     * int port = ext.getServerPort("myType");
-     *
-     * 
- * - * Once you have the port you may add information to references - * created by the associated adapter by calling - * - * IORInfo::add_ior_component

- * - * - * Note: if one is using a POA and the lifespan policy of that - * POA is persistent then the port number returned - * by getServerPort may - * be the corresponding ORBD port, depending on whether the POA/ORBD - * protocol is the present port exchange or if, in the future, - * the protocol is based on object reference template exchange. - * In either - * case, the port returned will be correct for the protocol. - * (In more detail, if the port exchange protocol is used then - * getServerPort will return the ORBD's port since the port - * exchange happens before, at ORB initialization. - * If object reference - * exchange is used then the server's transient port will be returned - * since the templates are exchanged after adding components.)

- * - * - * Persistent object reference support:

- * - * When creating persistent object references with alternate - * type/port info, ones needs to configure the ORBD to also support - * this alternate info. This is done as follows:

- * - * - Give the ORBD the same socket factory you gave to the client - * and server.

- * - * - specify ORBListenSocket ports of the same types that your - * servers support. You should probably specify explicit port - * numbers for ORBD if you embed these numbers inside IORs.

- * - * Note: when using the port exchange protocol - * the ORBD and servers will exchange port - * numbers for each given type so they know about each other. - * When using object reference template exchange the server's - * transient ports are contained in the template.

- * - * - * - specify your BadServerIdHandler (discussed below) - * using the - * - * ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY

- * - * Example: - * - *

-     *
-     * -Dcom.sun.CORBA.POA.ORBBadServerIdHandlerClass=corba.socketPersistent.MyBadServerIdHandler
-     *
-     * 
- * - * The BadServerIdHandler ...

- * - * See com.sun.corba.se.impl.activation.ServerManagerImpl.handle - * for example code on writing a bad server id handler. NOTE: This - * is an unsupported internal API. It will not exist in future releases. - *

- * - * - * Secure connections to other services:

- * - * If one wants secure connections to other services such as - * Naming then one should configure them with the same - * - * SOCKET_FACTORY_CLASS_PROPERTY and - * LISTEN_SOCKET_PROPERTY - * - * as used by other clients and servers in your distributed system. - * - */ - public ServerSocket createServerSocket(String type, int port) - throws - IOException; - - - - /** - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

- * - * This method is used by a client side ORB.

- * - * Each time a client invokes on an object reference, the reference's - * associated ORB will call - * - *

-     *    getEndPointInfo(ORB orb,
-     *                    IOR ior,
-     *                    SocketInfo socketInfo)
-     * 
- * - * NOTE: The type of the ior argument is an internal - * representation for efficiency. If the ORBSocketFactory - * interface ever becomes standardized then the ior will - * most likely change to a standard type (e.g., a stringified ior, - * an org.omg.IOP.IOR, or ...).

- * - * Typically, this method will look at tagged components in the - * given ior to determine what type of socket to create.

- * - * Typically, the ior will contain a tagged component - * specifying an alternate port type and number.

- * - * This method should return an SocketInfo object - * containing the type/host/port to be used for the connection. - * - * If there are no appropriate tagged components then this method - * should return an SocketInfo object with the type - * IIOP_CLEAR_TEXT and host/port from the ior's IOP - * profile.

- * - * If the ORB already has an existing connection to the returned - * type/host/port, then that connection is used. Otherwise the ORB calls - * - * createSocket(SocketInfo socketInfo)

- * - * The orb argument is useful for handling - * the ior argument.

- * - * The SocketInfo given to getEndPointInfo - * is either null or an object obtained - * from GetEndPointInfoAgainException - * - */ - public SocketInfo getEndPointInfo(org.omg.CORBA.ORB orb, - IOR ior, - SocketInfo socketInfo); - - - /** - * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED.

- * - * This method is used by a client side ORB.

- * - * This method should return a client socket of the given - * type/host/port.

- * - * Note: the SocketInfo is the same instance as was - * returned by getSocketInfo so extra cookie info may - * be attached.

- * - * If this method throws GetEndPointInfoAgainException then the - * ORB calls getEndPointInfo again, passing it the - * SocketInfo object contained in the exception. - * - */ - public Socket createSocket(SocketInfo socketInfo) - throws - IOException, - GetEndPointInfoAgainException; -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/README.txt 2018-01-30 20:22:02.000000000 -0500 +++ /dev/null 2018-01-30 20:22:02.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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. - */ - -Summary and suggested reading order: - -============================================================================== -Connection interceptor (called an ORBSocketFactory): - -Summary: - -The server side part of the ORBSocketFactory is told the type to -create as well as a port number. - -The client side part of the ORBSocketFactory is called on every client -request. An ORB first asks the factory for type/host/port information -(given an IOR). If the ORB already has a connection of the -type/host/port it will use the existing connection. Otherwise it will -then ask the factory to create a client socket, giving it that -type/host/port. Finally, the createSocket method may throw an -exception to tell the ORB to ask it for type/host/port info again. -The information passed back and forth between the ORB and factory can -act as a cookie for the factory if desired. - -Interfaces: - - com.sun.corba.se.spi.legacy.connection.ORBSocketFactory - com.sun.corba.se.spi.legacy.connection.EndPointInfo - com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException - -============================================================================== -Access to a request's socket: - -Summary: - -The request's socket is available via ClientRequestInfo and -ServerRequestInfo. We enable this by having them implement the -RequestInfoExt interface. - -Interfaces: - - com.sun.corba.se.spi.legacy.interceptor.RequestInfoExt - com.sun.corba.se.spi.legacy.connection.Connection - -============================================================================== -Extending IORInfo to support the multiple server port API: - -Summary: - -We support the multiple server port API in PortableInterceptors by -having IORInfo implement the IORInfoExt interface. The description on -how to use the multiple server port APIs is found in -ORBSocketFactory.java. - -Interfaces: - - com.sun.corba.se.spi.legacy.interceptor.IORInfoExt - com.sun.corba.se.spi.legacy.interceptor.UnknownType - -;; End. - - --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/IORInfoExt.java 2018-01-30 20:22:03.000000000 -0500 +++ /dev/null 2018-01-30 20:22:03.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.legacy.interceptor; - -import com.sun.corba.se.spi.oa.ObjectAdapter; - -public interface IORInfoExt -{ - public int getServerPort(String type) - throws - UnknownType; - - public ObjectAdapter getObjectAdapter(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/ORBInitInfoExt.java 2018-01-30 20:22:04.000000000 -0500 +++ /dev/null 2018-01-30 20:22:04.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.legacy.interceptor; - -import com.sun.corba.se.spi.orb.ORB ; - -/** The interface defines an extension to the standard ORBInitInfo - * that gives access to the ORB being initialized. Interceptors run - * as the last stage of initialization of the ORB, so the ORB - * instance returned by getORB is fully initialized. Note that - * this facility eventually shows up post-CORBA 3.0 as a result - * of the resolution of OMG core issue on accessing the ORB from - * local objects. - */ -public interface ORBInitInfoExt -{ - ORB getORB() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/RequestInfoExt.java 2018-01-30 20:22:04.000000000 -0500 +++ /dev/null 2018-01-30 20:22:05.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.legacy.interceptor; - -import com.sun.corba.se.spi.legacy.connection.Connection; - -/** - * This interface is implemented by our implementation of - * PortableInterceptor.ClientRequestInfo and - * PortableInterceptor.ServerRequestInfo. - */ - -public interface RequestInfoExt -{ - /** - * @return The connection on which the request is made. - * The return value will be null when a local transport - * is used. - */ - public Connection connection(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/UnknownType.java 2018-01-30 20:22:05.000000000 -0500 +++ /dev/null 2018-01-30 20:22:05.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.legacy.interceptor; - -public class UnknownType - extends - Exception -{ - public UnknownType() - { - super(); - } - - public UnknownType(String msg) - { - super(msg); - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java 2018-01-30 20:22:06.000000000 -0500 +++ /dev/null 2018-01-30 20:22:06.000000000 -0500 @@ -1,161 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.logging ; - -/** Defines constants for all of the logging domains used in the ORB. - * Note that this is the suffix to the log domain. The full domain is given by - * javax.enterprise.resource.corba.{ORBId}.{Log domain} - * where {ORBId} is the ORB ID of the ORB instance doing the logging. - *

- * The ORB implementation packages are mapped into these domains as follows: - *

    - *
  • activation: orbd.* - *
  • corba: rpc.presentation (CORBA API, typecode/any), oa.invocation (DII) - *
  • core: service context code in rpc.protocol (will eventually move to its own package) - *
  • dynamicany: rpc.presentation - *
  • encoding: rpc.encoding - *
  • iiop: rmiiop.delegate (ShutdownUtilDelegate needs to move somewhere) - *
  • interceptors: rpc.protocol - *
  • io: rpc.encoding - *
  • ior: oa.ior - *
  • javax: rmiiiop.delegate - *
  • logging: logging does not have a domain - *
  • naming: naming - *
  • oa: oa - *
  • orb: orb.lifecycle - *
  • orbutil: util - *
  • protocol: rpc.protocol - *
  • resolver: orb.resolver - *
  • transport: rpc.transport - *
  • txpoa: this will be removed in the future. - *
  • util: util - *
- */ -public abstract class CORBALogDomains { - private CORBALogDomains() {} - - // Top level log domain for CORBA - public static final String TOP_LEVEL_DOMAIN = "javax.enterprise.resource.corba"; - - public static final String RPC = "rpc" ; - - /** Log domain for code directly implementing the CORBA API and - * the typecode/any machinery. - */ - public static final String RPC_PRESENTATION = "rpc.presentation" ; - - /** Log domain for any sort of wire encoding used in marshalling - */ - public static final String RPC_ENCODING = "rpc.encoding" ; - - /** Log domain for the code used to handle any kind of invocation - * protocol. This includes client and server delegates, client and - * server request dispatchers, service contexts, portable interceptors, - * and the GIOP protocol (but not CDR representation of data). - */ - public static final String RPC_PROTOCOL = "rpc.protocol" ; - - /** Log domain for low-level transport details, which are - * independent of encoding and presentation details. This - * includes selectors, acceptors, connections, connection management, - * and any other transport management functions. - */ - public static final String RPC_TRANSPORT = "rpc.transport" ; - - public static final String NAMING = "naming" ; - - /** Log domain for naming context creation and destruction. - */ - public static final String NAMING_LIFECYCLE = "naming.lifecycle" ; - - /** Log domain for name service lookup. - */ - public static final String NAMING_READ = "naming.read" ; - - /** Log domain for name service bind, rebind, destroy, and other state - * change operations. - */ - public static final String NAMING_UPDATE = "naming.update" ; - - public static final String ORBD = "orbd" ; - - /** Log domain for the ORBD locator function, which forwards - * client requests to their current server incarnation. - */ - public static final String ORBD_LOCATOR = "orbd.locator" ; - - /** Log domain for the ORBD activator function, which starts - * server instances on demand. - */ - public static final String ORBD_ACTIVATOR = "orbd.activator" ; - - /** Log domain for the Implementation Repository. - */ - public static final String ORBD_REPOSITORY = "orbd.repository" ; - - /** Log domain for the servertool utilitiy used to update the - * implementation repository. - */ - public static final String ORBD_SERVERTOOL = "orbd.servertool" ; - - public static final String ORB = "orb" ; - - /** Log domain for ORB initialization, configuration, startup, - * and shutdown. - */ - public static final String ORB_LIFECYCLE = "orb.lifecycle" ; - - /** Log domain for ORB client side name resolution and supporting - * functions such as INS. - */ - public static final String ORB_RESOLVER = "orb.resolver" ; - - public static final String OA = "oa" ; - - /** Log domain for creation, destruction, and state change of - * Object Adapters and related classes (e.g. POAManager). - */ - public static final String OA_LIFECYCLE = "oa.lifecycle" ; - - /** Log domain for all IOR related code. - */ - public static final String OA_IOR = "oa.ior" ; - - /** Log domain for object adapter request dispatch. - */ - public static final String OA_INVOCATION = "oa.invocation" ; - - public static final String RMIIIOP = "rmiiiop" ; - - /** Log domain for the RMI-IIOP implementation in the Stub, Util, and - * PortableRemoteObject delegates. - */ - public static final String RMIIIOP_DELEGATE = "rmiiiop.delegate" ; - - /** Log domain for utility classes. - */ - public static final String UTIL = "util" ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperBase.java 2018-01-30 20:22:07.000000000 -0500 +++ /dev/null 2018-01-30 20:22:07.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.spi.logging ; - -import java.util.logging.Level ; -import java.util.logging.Logger ; -import java.util.logging.LogRecord ; - -public abstract class LogWrapperBase { - protected Logger logger ; - - protected String loggerName ; - - protected LogWrapperBase( Logger logger ) - { - this.logger = logger ; - this.loggerName = logger.getName( ); - } - - protected void doLog( Level level, String key, Object[] params, Class wrapperClass, - Throwable thr ) - { - LogRecord lrec = new LogRecord( level, key ) ; - if (params != null) - lrec.setParameters( params ) ; - inferCaller( wrapperClass, lrec ) ; - lrec.setThrown( thr ) ; - lrec.setLoggerName( loggerName ); - lrec.setResourceBundle( logger.getResourceBundle() ) ; - logger.log( lrec ) ; - } - - private void inferCaller( Class wrapperClass, LogRecord lrec ) - { - // Private method to infer the caller's class and method names - - // Get the stack trace. - StackTraceElement stack[] = (new Throwable()).getStackTrace(); - StackTraceElement frame = null ; - String wcname = wrapperClass.getName() ; - String baseName = LogWrapperBase.class.getName() ; - - // The top of the stack should always be a method in the wrapper class, - // or in this base class. - // Search back to the first method not in the wrapper class or this class. - int ix = 0; - while (ix < stack.length) { - frame = stack[ix]; - String cname = frame.getClassName(); - if (!cname.equals(wcname) && !cname.equals(baseName)) { - break; - } - - ix++; - } - - // Set the class and method if we are not past the end of the stack - // trace - if (ix < stack.length) { - lrec.setSourceClassName(frame.getClassName()); - lrec.setSourceMethodName(frame.getMethodName()); - } - } - - protected void doLog( Level level, String key, Class wrapperClass, Throwable thr ) - { - doLog( level, key, null, wrapperClass, thr ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperFactory.java 2018-01-30 20:22:07.000000000 -0500 +++ /dev/null 2018-01-30 20:22:07.000000000 -0500 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.logging ; - -import java.util.logging.Logger ; - -import com.sun.corba.se.spi.logging.LogWrapperBase ; - -public interface LogWrapperFactory { - LogWrapperBase create( Logger logger ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc 2018-01-30 20:22:08.000000000 -0500 +++ /dev/null 2018-01-30 20:22:08.000000000 -0500 @@ -1,36 +0,0 @@ -; -; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. -; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -; -; This code is free software; you can redistribute it and/or modify it -; under the terms of the GNU General Public License version 2 only, as -; published by the Free Software Foundation. Oracle designates this -; particular file as subject to the "Classpath" exception as provided -; by Oracle in the LICENSE file that accompanied this code. -; -; This code is distributed in the hope that it will be useful, but WITHOUT -; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -; version 2 for more details (a copy is included in the LICENSE file that -; accompanied this code). -; -; You should have received a copy of the GNU General Public License version -; 2 along with this work; if not, write to the Free Software Foundation, -; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -; -; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -; or visit www.oracle.com if you need additional information or have any -; questions. -; -("com.sun.corba.se.impl.logging" "ActivationSystemException" ACTIVATION - ( - (INITIALIZE - (CANNOT_READ_REPOSITORY_DB 1 WARNING "Cannot read repository datastore") - (CANNOT_ADD_INITIAL_NAMING 2 WARNING "Cannot add initial naming")) - (INTERNAL - (CANNOT_WRITE_REPOSITORY_DB 1 WARNING "Cannot write repository datastore") - (SERVER_NOT_EXPECTED_TO_REGISTER 3 WARNING "Server not expected to register") - (UNABLE_TO_START_PROCESS 4 WARNING "Unable to start server process") - (SERVER_NOT_RUNNING 6 WARNING "Server is not running")) - (OBJECT_NOT_EXIST - (ERROR_IN_BAD_SERVER_ID_HANDLER 1 WARNING "Error in BadServerIdHandler")))) --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc 2018-01-30 20:22:09.000000000 -0500 +++ /dev/null 2018-01-30 20:22:09.000000000 -0500 @@ -1,45 +0,0 @@ -; -; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. -; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -; -; This code is free software; you can redistribute it and/or modify it -; under the terms of the GNU General Public License version 2 only, as -; published by the Free Software Foundation. Oracle designates this -; particular file as subject to the "Classpath" exception as provided -; by Oracle in the LICENSE file that accompanied this code. -; -; This code is distributed in the hope that it will be useful, but WITHOUT -; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -; version 2 for more details (a copy is included in the LICENSE file that -; accompanied this code). -; -; You should have received a copy of the GNU General Public License version -; 2 along with this work; if not, write to the Free Software Foundation, -; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -; -; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -; or visit www.oracle.com if you need additional information or have any -; questions. -; -("com.sun.corba.se.impl.logging" "IORSystemException" IOR - ( - (INTERNAL - (ORT_NOT_INITIALIZED 1 WARNING "ObjectReferenceTemplate is not initialized") - (NULL_POA 2 WARNING "Null POA") - (BAD_MAGIC 3 WARNING "Bad magic number {0} in ObjectKeyTemplate") - (STRINGIFY_WRITE_ERROR 4 WARNING "Error while stringifying an object reference") - (TAGGED_PROFILE_TEMPLATE_FACTORY_NOT_FOUND 5 WARNING "Could not find a TaggedProfileTemplateFactory for id {0}") - (INVALID_JDK1_3_1_PATCH_LEVEL 6 WARNING "Found a JDK 1.3.1 patch level indicator with value {0} less than JDK 1.3.1_01 value of 1") - (GET_LOCAL_SERVANT_FAILURE 7 FINE "Exception occurred while looking for ObjectAdapter {0} in IIOPProfileImpl.getServant")) - (BAD_OPERATION - (ADAPTER_ID_NOT_AVAILABLE 1 WARNING "Adapter ID not available") - (SERVER_ID_NOT_AVAILABLE 2 WARNING "Server ID not available") - (ORB_ID_NOT_AVAILABLE 3 WARNING "ORB ID not available") - (OBJECT_ADAPTER_ID_NOT_AVAILABLE 4 WARNING "Object adapter ID not available")) - (BAD_PARAM - (BAD_OID_IN_IOR_TEMPLATE_LIST 1 WARNING "Profiles in IOR do not all have the same Object ID, so conversion to IORTemplateList is impossible") - (INVALID_TAGGED_PROFILE 2 WARNING "Error in reading IIOP TaggedProfile") - (BAD_IIOP_ADDRESS_PORT 3 WARNING "Attempt to create IIOPAdiress with port {0}, which is out of range")) - (INV_OBJREF - (IOR_MUST_HAVE_IIOP_PROFILE 1 WARNING "IOR must have at least one IIOP profile")))) --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc 2018-01-30 20:22:09.000000000 -0500 +++ /dev/null 2018-01-30 20:22:09.000000000 -0500 @@ -1,68 +0,0 @@ -; -; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. -; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -; -; This code is free software; you can redistribute it and/or modify it -; under the terms of the GNU General Public License version 2 only, as -; published by the Free Software Foundation. Oracle designates this -; particular file as subject to the "Classpath" exception as provided -; by Oracle in the LICENSE file that accompanied this code. -; -; This code is distributed in the hope that it will be useful, but WITHOUT -; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -; version 2 for more details (a copy is included in the LICENSE file that -; accompanied this code). -; -; You should have received a copy of the GNU General Public License version -; 2 along with this work; if not, write to the Free Software Foundation, -; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -; -; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -; or visit www.oracle.com if you need additional information or have any -; questions. -; -("com.sun.corba.se.impl.logging" "InterceptorsSystemException" INTERCEPTORS - ( - (BAD_PARAM - (TYPE_OUT_OF_RANGE 1 WARNING "Interceptor type {0} is out of range") - (NAME_NULL 2 WARNING "Interceptor's name is null: use empty string for anonymous interceptors")) - (BAD_INV_ORDER - (RIR_INVALID_PRE_INIT 1 WARNING "resolve_initial_reference is invalid during pre_init") - (BAD_STATE1 2 WARNING "Expected state {0}, but current state is {1}") - (BAD_STATE2 3 WARNING "Expected state {0} or {1}, but current state is {2}")) - (COMM_FAILURE - (IOEXCEPTION_DURING_CANCEL_REQUEST 1 WARNING "IOException during cancel request")) - (INTERNAL - (EXCEPTION_WAS_NULL 1 WARNING "Exception was null") - (OBJECT_HAS_NO_DELEGATE 2 WARNING "Object has no delegate") - (DELEGATE_NOT_CLIENTSUB 3 WARNING "Delegate was not a ClientRequestDispatcher") - (OBJECT_NOT_OBJECTIMPL 4 WARNING "Object is not an ObjectImpl") - (EXCEPTION_INVALID 5 WARNING "Assertion failed: Interceptor set exception to UserException or ApplicationException") - (REPLY_STATUS_NOT_INIT 6 WARNING "Assertion failed: Reply status is initialized but not SYSTEM_EXCEPTION or LOCATION_FORWARD") - (EXCEPTION_IN_ARGUMENTS 7 WARNING "Exception in arguments") - (EXCEPTION_IN_EXCEPTIONS 8 WARNING "Exception in exceptions") - (EXCEPTION_IN_CONTEXTS 9 WARNING "Exception in contexts") - (EXCEPTION_WAS_NULL_2 10 WARNING "Another exception was null") - (SERVANT_INVALID 11 WARNING "Servant invalid") - (CANT_POP_ONLY_PICURRENT 12 WARNING "Can't pop only PICurrent") - (CANT_POP_ONLY_CURRENT_2 13 WARNING "Can't pop another PICurrent") - (PI_DSI_RESULT_IS_NULL 14 WARNING "DSI result is null") - (PI_DII_RESULT_IS_NULL 15 WARNING "DII result is null") - (EXCEPTION_UNAVAILABLE 16 WARNING "Exception is unavailable") - (CLIENT_INFO_STACK_NULL 17 WARNING "Assertion failed: client request info stack is null") - (SERVER_INFO_STACK_NULL 18 WARNING "Assertion failed: Server request info stack is null") - (MARK_AND_RESET_FAILED 19 WARNING "Mark and reset failed") - (SLOT_TABLE_INVARIANT 20 WARNING "currentIndex > tableContainer.size(): {0} > {1}") - (INTERCEPTOR_LIST_LOCKED 21 WARNING "InterceptorList is locked") - (SORT_SIZE_MISMATCH 22 WARNING "Invariant: sorted size + unsorted size == total size was violated")) - (NO_IMPLEMENT - (PI_ORB_NOT_POLICY_BASED 1 WARNING "Policies not implemented")) - (OBJECT_NOT_EXIST - (ORBINITINFO_INVALID 1 FINE "ORBInitInfo object is only valid during ORB_init")) - (UNKNOWN - (UNKNOWN_REQUEST_INVOKE - 1 FINE "Unknown request invocation error")) - )) - -;;; End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc 2018-01-30 20:22:10.000000000 -0500 +++ /dev/null 2018-01-30 20:22:10.000000000 -0500 @@ -1,53 +0,0 @@ -; -; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. -; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -; -; This code is free software; you can redistribute it and/or modify it -; under the terms of the GNU General Public License version 2 only, as -; published by the Free Software Foundation. Oracle designates this -; particular file as subject to the "Classpath" exception as provided -; by Oracle in the LICENSE file that accompanied this code. -; -; This code is distributed in the hope that it will be useful, but WITHOUT -; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -; version 2 for more details (a copy is included in the LICENSE file that -; accompanied this code). -; -; You should have received a copy of the GNU General Public License version -; 2 along with this work; if not, write to the Free Software Foundation, -; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -; -; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -; or visit www.oracle.com if you need additional information or have any -; questions. -; -("com.sun.corba.se.impl.logging" "NamingSystemException" NAMING - ( - (BAD_PARAM - (TRANSIENT_NAME_SERVER_BAD_PORT 0 WARNING "Port 0 is not a valid port in the transient name server") - (TRANSIENT_NAME_SERVER_BAD_HOST 1 WARNING "A null hostname is not a valid hostname in the transient name server") - (OBJECT_IS_NULL 2 WARNING "Invalid object reference passed in rebind or bind operation") - (INS_BAD_ADDRESS 3 WARNING "Bad host address in -ORBInitDef")) - (UNKNOWN - (BIND_UPDATE_CONTEXT_FAILED 0 WARNING "Updated context failed for bind") - (BIND_FAILURE 1 WARNING "bind failure") - (RESOLVE_CONVERSION_FAILURE 2 WARNING "Resolve conversion failed") - (RESOLVE_FAILURE 3 WARNING "Resolve failure") - (UNBIND_FAILURE 4 WARNING "Unbind failure")) - (INITIALIZE - (TRANS_NS_CANNOT_CREATE_INITIAL_NC_SYS 50 WARNING "SystemException in transient name service while initializing") - (TRANS_NS_CANNOT_CREATE_INITIAL_NC 51 WARNING "Java exception in transient name service while initializing")) - (INTERNAL - (NAMING_CTX_REBIND_ALREADY_BOUND 0 WARNING "Unexpected AlreadyBound exception iun rebind") - (NAMING_CTX_REBINDCTX_ALREADY_BOUND 1 WARNING "Unexpected AlreadyBound exception in rebind_context") - (NAMING_CTX_BAD_BINDINGTYPE 2 WARNING "Bad binding type in internal binding implementation") - (NAMING_CTX_RESOLVE_CANNOT_NARROW_TO_CTX 3 WARNING "Object reference that is not CosNaming::NamingContext bound as a context") - (NAMING_CTX_BINDING_ITERATOR_CREATE 4 WARNING "Error in creating POA for BindingIterator") - (TRANS_NC_BIND_ALREADY_BOUND 100 WARNING "Bind implementation encountered a previous bind") - (TRANS_NC_LIST_GOT_EXC 101 WARNING "list operation caught an unexpected Java exception while creating list iterator") - (TRANS_NC_NEWCTX_GOT_EXC 102 WARNING "new_context operation caught an unexpected Java excpetion creating the NewContext servant") - (TRANS_NC_DESTROY_GOT_EXC 103 WARNING "Destroy operation caught a Java exception while disconnecting from ORB") - (INS_BAD_SCHEME_NAME 105 WARNING "Stringified object reference with unknown protocol specified") - (INS_BAD_SCHEME_SPECIFIC_PART 107 WARNING "Malformed URL in -ORBInitDef") - (INS_OTHER 108 WARNING "Malformed URL in -ORBInitDef")))) --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc 2018-01-30 20:22:11.000000000 -0500 +++ /dev/null 2018-01-30 20:22:11.000000000 -0500 @@ -1,177 +0,0 @@ -; -; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. -; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -; -; This code is free software; you can redistribute it and/or modify it -; under the terms of the GNU General Public License version 2 only, as -; published by the Free Software Foundation. Oracle designates this -; particular file as subject to the "Classpath" exception as provided -; by Oracle in the LICENSE file that accompanied this code. -; -; This code is distributed in the hope that it will be useful, but WITHOUT -; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -; version 2 for more details (a copy is included in the LICENSE file that -; accompanied this code). -; -; You should have received a copy of the GNU General Public License version -; 2 along with this work; if not, write to the Free Software Foundation, -; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -; -; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -; or visit www.oracle.com if you need additional information or have any -; questions. -; -("com.sun.corba.se.impl.logging" "OMGSystemException" OMG - ( - (BAD_CONTEXT - (IDL_CONTEXT_NOT_FOUND 1 WARNING "IDL context not found") - (NO_MATCHING_IDL_CONTEXT 2 WARNING "No matching IDL context property")) - (BAD_INV_ORDER - (DEP_PREVENT_DESTRUCTION 1 WARNING "Dependency exists in IFR preventing destruction of this object") - (DESTROY_INDESTRUCTIBLE 2 WARNING "Attempt to destroy indestructible objects in IFR") - (SHUTDOWN_WAIT_FOR_COMPLETION_DEADLOCK 3 WARNING "Operation would deadlock") - (BAD_OPERATION_AFTER_SHUTDOWN 4 WARNING "ORB has shutdown") - (BAD_INVOKE 5 WARNING "Attempt to invoke send or invoke operation of the same Request object more than once ") - (BAD_SET_SERVANT_MANAGER 6 WARNING "Attempt to set a servent manager after one has already been set") - (BAD_ARGUMENTS_CALL 7 WARNING "ServerRequest::arguments called more than once or after a call to ServerRequest::set_exception") - (BAD_CTX_CALL 8 WARNING "ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception") - (BAD_RESULT_CALL 9 WARNING "ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception") - (BAD_SEND 10 WARNING "Attempt to send a DII request after it was sent previously") - (BAD_POLL_BEFORE 11 WARNING "Attempt to poll a DII request or to retrieve its result before the request was sent") - (BAD_POLL_AFTER 12 WARNING "Attempt to poll a DII request or to retrieve its result after the result was retrieved previously") - (BAD_POLL_SYNC 13 WARNING "Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request") - (INVALID_PI_CALL1 14 FINE "Invalid call to forward_reference() when reply status is not LOCATION_FORWARD") - (INVALID_PI_CALL2 14 FINE "Cannot access this attribute or method at this point") - (INVALID_PI_CALL3 14 FINE "Cannot call set_slot from within an ORBInitializer") - (INVALID_PI_CALL4 14 FINE "Cannot call get_slot from within an ORBInitializer") - (SERVICE_CONTEXT_ADD_FAILED 15 FINE "Service context add failed in portable interceptor because a service context with id {0} already exists") - (POLICY_FACTORY_REG_FAILED 16 WARNING "Registration of PolicyFactory failed because a factory already exists for the given PolicyType {0}") - (CREATE_POA_DESTROY 17 WARNING "POA cannot create POAs while undergoing destruction") - (PRIORITY_REASSIGN 18 WARNING "Attempt to reassign priority") - (XA_START_OUTSIZE 19 WARNING "An OTS/XA integration xa_start() call returned XAER_OUTSIDE") - (XA_START_PROTO 20 WARNING "An OTS/XA integration xa_ call returned XAER_PROTO")) - (BAD_OPERATION - (BAD_SERVANT_MANAGER_TYPE 1 WARNING "ServantManager returned wrong servant type") - (OPERATION_UNKNOWN_TO_TARGET 2 WARNING "Operation or attribute not known to target object ")) - (BAD_PARAM - (UNABLE_REGISTER_VALUE_FACTORY 1 WARNING "Failure to register, unregister or lookup value factory") - (RID_ALREADY_DEFINED 2 WARNING "RID already defined in IFR") - (NAME_USED_IFR 3 WARNING "Name already used in the context in IFR ") - (TARGET_NOT_CONTAINER 4 WARNING "Target is not a valid container") - (NAME_CLASH 5 WARNING "Name clash in inherited context") - (NOT_SERIALIZABLE 6 WARNING "Class {0} is not Serializable") - (SO_BAD_SCHEME_NAME 7 WARNING "string_to_object conversion failed due to bad scheme name") - (SO_BAD_ADDRESS 8 WARNING "string_to_object conversion failed due to bad address") - (SO_BAD_SCHEMA_SPECIFIC 9 WARNING "string_to_object conversion failed due to bad bad schema specific part") - (SO_NON_SPECIFIC 10 WARNING "string_to_object conversion failed due to non specific reason") - (IR_DERIVE_ABS_INT_BASE 11 WARNING "Attempt to derive abstract interface from non-abstract base interface in the Interface Repository") - (IR_VALUE_SUPPORT 12 WARNING "Attempt to let a ValueDef support more than one non-abstract interface in the Interface Repository") - (INCOMPLETE_TYPECODE 13 WARNING "Attempt to use an incomplete TypeCode as a parameter") - (INVALID_OBJECT_ID 14 WARNING "Invalid object id passed to POA::create_reference_by_id ") - (TYPECODE_BAD_NAME 15 WARNING "Bad name argument in TypeCode operation") - (TYPECODE_BAD_REPID 16 WARNING "Bad RepositoryId argument in TypeCode operation") - (TYPECODE_INV_MEMBER 17 WARNING "Invalid member name in TypeCode operation ") - (TC_UNION_DUP_LABEL 18 WARNING "Duplicate label value in create_union_tc ") - (TC_UNION_INCOMPATIBLE 19 WARNING "Incompatible TypeCode of label and discriminator in create_union_tc ") - (TC_UNION_BAD_DISC 20 WARNING "Supplied discriminator type illegitimate in create_union_tc ") - (SET_EXCEPTION_BAD_ANY 21 WARNING "Any passed to ServerRequest::set_exception does not contain an exception ") - (SET_EXCEPTION_UNLISTED 22 WARNING "Unlisted user exception passed to ServerRequest::set_exception ") - (NO_CLIENT_WCHAR_CODESET_CTX 23 WARNING "wchar transmission code set not in service context") - (ILLEGAL_SERVICE_CONTEXT 24 WARNING "Service context is not in OMG-defined range") - (ENUM_OUT_OF_RANGE 25 WARNING "Enum value out of range") - (INVALID_SERVICE_CONTEXT_ID 26 FINE "Invalid service context Id in portable interceptor") - (RIR_WITH_NULL_OBJECT 27 WARNING "Attempt to call register_initial_reference with a null Object") - (INVALID_COMPONENT_ID 28 FINE "Invalid component Id {0} in portable interceptor") - (INVALID_PROFILE_ID 29 WARNING "Profile ID does not define a known profile or it is impossible to add components to that profile") - (POLICY_TYPE_DUPLICATE 30 WARNING "Two or more Policy objects with the same PolicyType value supplied to Object::set_policy_overrides or PolicyManager::set_policy_overrides") - (BAD_ONEWAY_DEFINITION 31 WARNING "Attempt to define a oneway operation with non-void result, out or inout parameters or user exceptions") - (DII_FOR_IMPLICIT_OPERATION 32 WARNING "DII asked to create request for an implicit operation") - (XA_CALL_INVAL 33 WARNING "An OTS/XA integration xa_ call returned XAER_INVAL") - (UNION_BAD_DISCRIMINATOR 34 WARNING "Union branch modifier method called with bad case label discriminator") - (CTX_ILLEGAL_PROPERTY_NAME 35 WARNING "Illegal IDL context property name") - (CTX_ILLEGAL_SEARCH_STRING 36 WARNING "Illegal IDL property search string") - (CTX_ILLEGAL_NAME 37 WARNING "Illegal IDL context name") - (CTX_NON_EMPTY 38 WARNING "Non-empty IDL context") - (INVALID_STREAM_FORMAT_VERSION 39 WARNING "Unsupported RMI/IDL custom value type stream format {0}") - (NOT_A_VALUEOUTPUTSTREAM 40 WARNING "ORB output stream does not support ValueOutputStream interface") - (NOT_A_VALUEINPUTSTREAM 41 WARNING "ORB input stream does not support ValueInputStream interface")) - (BAD_TYPECODE - (MARSHALL_INCOMPLETE_TYPECODE 1 WARNING "Attempt to marshal incomplete TypeCode") - (BAD_MEMBER_TYPECODE 2 WARNING "Member type code illegitimate in TypeCode operation") - (ILLEGAL_PARAMETER 3 WARNING "Illegal parameter type")) - (DATA_CONVERSION - (CHAR_NOT_IN_CODESET 1 WARNING "Character does not map to negotiated transmission code set") - (PRIORITY_MAP_FAILRE 2 WARNING "Failure of PriorityMapping object")) - (IMP_LIMIT - (NO_USABLE_PROFILE 1 WARNING "Unable to use any profile in IOR")) - (INITIALIZE - (PRIORITY_RANGE_RESTRICT 1 WARNING "Priority range too restricted for ORB")) - (INV_OBJREF - (NO_SERVER_WCHAR_CODESET_CMP 1 WARNING "wchar Code Set support not specified") - (CODESET_COMPONENT_REQUIRED 2 WARNING "Codeset component required for type using wchar or wstring data")) - (INV_POLICY - (IOR_POLICY_RECONCILE_ERROR 1 WARNING "Unable to reconcile IOR specified policy with effective policy override") - (POLICY_UNKNOWN 2 WARNING "Invalid PolicyType") - (NO_POLICY_FACTORY 3 WARNING "No PolicyFactory has been registered for the given PolicyType")) - (INTERNAL - (XA_RMERR 1 WARNING "An OTS/XA integration xa_ call returned XAER_RMERR") - (XA_RMFAIL 2 WARNING "An OTS/XA integration xa_ call returned XAER_RMFAIL")) - (INTF_REPOS - (NO_IR 1 WARNING "Interface Repository not available") - (NO_INTERFACE_IN_IR 2 WARNING "No entry for requested interface in Interface Repository")) - (MARSHAL - (UNABLE_LOCATE_VALUE_FACTORY 1 FINE "Unable to locate value factory") - (SET_RESULT_BEFORE_CTX 2 WARNING "ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause ") - (BAD_NVLIST 3 WARNING "NVList passed to ServerRequest::arguments does not describe all parameters passed by client") - (NOT_AN_OBJECT_IMPL 4 WARNING "Attempt to marshal Local object") - (WCHAR_BAD_GIOP_VERSION_SENT 5 WARNING "wchar or wstring data erroneosly sent by client over GIOP 1.0 connection ") - (WCHAR_BAD_GIOP_VERSION_RETURNED 6 WARNING "wchar or wstring data erroneously returned by server over GIOP 1.0 connection ") - (UNSUPPORTED_FORMAT_VERSION 7 WARNING "Unsupported RMI/IDL custom value type stream format") - (RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1 8 WARNING "No optional data available") - (RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE2 8 WARNING "Not enough space left in current chunk") - (RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE3 8 FINE "Not enough optional data available")) - (NO_IMPLEMENT - (MISSING_LOCAL_VALUE_IMPL 1 WARNING "Missing local value implementation") - (INCOMPATIBLE_VALUE_IMPL 2 WARNING "Incompatible value implementation version") - (NO_USABLE_PROFILE_2 3 WARNING "Unable to use any profile in IOR") - (DII_LOCAL_OBJECT 4 WARNING "Attempt to use DII on Local object") - (BIO_RESET 5 WARNING "Biomolecular Sequence Analysis iterator cannot be reset") - (BIO_META_NOT_AVAILABLE 6 WARNING "Biomolecular Sequence Analysis metadata is not available as XML") - (BIO_GENOMIC_NO_ITERATOR 7 WARNING "Genomic Maps iterator cannot be reset")) - (NO_RESOURCES - (PI_OPERATION_NOT_SUPPORTED1 1 FINE "The portable Java bindings do not support arguments()") - (PI_OPERATION_NOT_SUPPORTED2 1 FINE "The portable Java bindings do not support exceptions()") - (PI_OPERATION_NOT_SUPPORTED3 1 FINE "The portable Java bindings do not support contexts()") - (PI_OPERATION_NOT_SUPPORTED4 1 FINE "The portable Java bindings do not support operation_context()") - (PI_OPERATION_NOT_SUPPORTED5 1 FINE "The portable Java bindings do not support result()") - (PI_OPERATION_NOT_SUPPORTED6 1 FINE "The object ID was never set") - (PI_OPERATION_NOT_SUPPORTED7 1 FINE "The ObjectKeyTemplate was never set") - (PI_OPERATION_NOT_SUPPORTED8 1 FINE "ServerRequest::arguments() was never called") - (NO_CONNECTION_PRIORITY 2 WARNING "No connection for request's priority")) - (TRANSACTION_ROLLEDBACK - (XA_RB 1 WARNING "An OTS/XA integration xa_ call returned XAER_RB") - (XA_NOTA 2 WARNING "An OTS/XA integration xa_ call returned XAER_NOTA") - (XA_END_TRUE_ROLLBACK_DEFERRED 3 WARNING "OTS/XA integration end() was called with success set to TRUE while transaction rollback was deferred")) - (TRANSIENT - (POA_REQUEST_DISCARD 1 WARNING "Request discarded because of resource exhaustion in POA or because POA is in DISCARDING state") - (NO_USABLE_PROFILE_3 2 WARNING "No usable profile in IOR") - (REQUEST_CANCELLED 3 WARNING "Request cancelled") - (POA_DESTROYED 4 WARNING "POA destroyed")) - (OBJECT_NOT_EXIST - (UNREGISTERED_VALUE_AS_OBJREF 1 WARNING "Attempt to pass an unactivated (unregistered) value as an object reference") - (NO_OBJECT_ADAPTOR 2 FINE "Failed to create or locate Object Adaptor") - (BIO_NOT_AVAILABLE 3 WARNING "Biomolecular Sequence Analysis Service is no longer available") - (OBJECT_ADAPTER_INACTIVE 4 WARNING "Object Adapter Inactive")) - (OBJ_ADAPTER - (ADAPTER_ACTIVATOR_EXCEPTION 1 WARNING "System exception in POA::unknown_adapter for POA {0} with parent POA {1}") - (BAD_SERVANT_TYPE 2 WARNING "Incorrect servant type returned by servant manager ") - (NO_DEFAULT_SERVANT 3 WARNING "No default servant available [POA policy]") - (NO_SERVANT_MANAGER 4 WARNING "No servant manager available [POA Policy]") - (BAD_POLICY_INCARNATE 5 WARNING "Violation of POA policy by ServantActivator::incarnate") - (PI_EXC_COMP_ESTABLISHED 6 WARNING "Exception in PortableInterceptor::IORInterceptor.components_established") - (NULL_SERVANT_RETURNED 7 FINE "Null servant returned by servant manager")) - (UNKNOWN - (UNKNOWN_USER_EXCEPTION 1 FINE "Unlisted user exception received by client ") - (UNSUPPORTED_SYSTEM_EXCEPTION 2 WARNING "Non-standard System Exception not supported") - (PI_UNKNOWN_USER_EXCEPTION 3 WARNING "An unknown user exception received by a portable interceptor")))) --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc 2018-01-30 20:22:11.000000000 -0500 +++ /dev/null 2018-01-30 20:22:11.000000000 -0500 @@ -1,407 +0,0 @@ -; - -; Copyright (c) 2003, 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. -; -("com.sun.corba.se.impl.logging" "ORBUtilSystemException" ORBUTIL - ( - (BAD_OPERATION - (ADAPTER_ID_NOT_AVAILABLE 1 WARNING "Adapter ID not available") - (SERVER_ID_NOT_AVAILABLE 2 WARNING "Server ID not available") - (ORB_ID_NOT_AVAILABLE 3 WARNING "ORB ID not available") - (OBJECT_ADAPTER_ID_NOT_AVAILABLE 4 WARNING "Object adapter ID not available") - (CONNECTING_SERVANT 5 WARNING "Error connecting servant") - (EXTRACT_WRONG_TYPE 6 FINE "Expected typecode kind {0} but got typecode kind {1}") - (EXTRACT_WRONG_TYPE_LIST 7 WARNING "Expected typecode kind to be one of {0} but got typecode kind {1}") - (BAD_STRING_BOUNDS 8 WARNING "String length of {0} exceeds bounded string length of {1}") - (INSERT_OBJECT_INCOMPATIBLE 10 WARNING "Tried to insert an object of an incompatible type into an Any for an object reference") - (INSERT_OBJECT_FAILED 11 WARNING "insert_Object call failed on an Any") - (EXTRACT_OBJECT_INCOMPATIBLE 12 WARNING "extract_Object call failed on an Any") - (FIXED_NOT_MATCH 13 WARNING "Fixed type does not match typecode") - (FIXED_BAD_TYPECODE 14 WARNING "Tried to insert Fixed type for non-Fixed typecode") - (SET_EXCEPTION_CALLED_NULL_ARGS 23 WARNING "set_exception(Any) called with null args for DSI ServerRequest") - (SET_EXCEPTION_CALLED_BAD_TYPE 24 WARNING "set_exception(Any) called with a bad (non-exception) type") - (CONTEXT_CALLED_OUT_OF_ORDER 25 WARNING "ctx() called out of order for DSI ServerRequest") - (BAD_ORB_CONFIGURATOR 26 WARNING "ORB configurator class {0} could not be instantiated") - (ORB_CONFIGURATOR_ERROR 27 WARNING "Error in running ORB configurator") - (ORB_DESTROYED 28 WARNING "This ORB instance has been destroyed, so no operations can be performed on it") - (NEGATIVE_BOUNDS 29 WARNING "Negative bound for string TypeCode is illegal") - (EXTRACT_NOT_INITIALIZED 30 WARNING "Called typecode extract on an uninitialized typecode") - (EXTRACT_OBJECT_FAILED 31 WARNING "extract_Object failed on an uninitialized Any") - (METHOD_NOT_FOUND_IN_TIE 32 FINE "Could not find method named {0} in class {1} in reflective Tie") - (CLASS_NOT_FOUND1 33 FINE "ClassNotFoundException while attempting to load preferred stub named {0}") - (CLASS_NOT_FOUND2 34 FINE "ClassNotFoundException while attempting to load alternate stub named {0}") - (CLASS_NOT_FOUND3 35 FINE "ClassNotFoundException while attempting to load interface {0}") - (GET_DELEGATE_SERVANT_NOT_ACTIVE 36 WARNING "POA ServantNotActive exception while trying get an org.omg.CORBA.Portable.Delegate for an org.omg.PortableServer.Servant") - (GET_DELEGATE_WRONG_POLICY 37 WARNING "POA WrongPolicy exception while trying get an org.omg.CORBA.Portable.Delegate for an org.omg.PortableServer.Servant") - (SET_DELEGATE_REQUIRES_STUB 38 FINE "Call to StubAdapter.setDelegate did not pass a stub") - (GET_DELEGATE_REQUIRES_STUB 39 WARNING "Call to StubAdapter.getDelegate did not pass a stub") - (GET_TYPE_IDS_REQUIRES_STUB 40 WARNING "Call to StubAdapter.getTypeIds did not pass a stub") - (GET_ORB_REQUIRES_STUB 41 WARNING "Call to StubAdapter.getORB did not pass a stub") - (CONNECT_REQUIRES_STUB 42 WARNING "Call to StubAdapter.connect did not pass a stub") - (IS_LOCAL_REQUIRES_STUB 43 WARNING "Call to StubAdapter.isLocal did not pass a stub") - (REQUEST_REQUIRES_STUB 44 WARNING "Call to StubAdapter.request did not pass a stub") - (BAD_ACTIVATE_TIE_CALL 45 WARNING "Call to StubAdapter.activateTie did not pass a valid Tie") - (IO_EXCEPTION_ON_CLOSE 46 FINE "Useless exception on call to Closeable.close()") - ) - (BAD_PARAM - (NULL_PARAM 1 WARNING "Null parameter") - (UNABLE_FIND_VALUE_FACTORY 2 FINE "Unable to find value factory") - (ABSTRACT_FROM_NON_ABSTRACT 3 WARNING "Abstract interface derived from non-abstract interface") - (INVALID_TAGGED_PROFILE 4 WARNING "Error in reading IIOP TaggedProfile") - (OBJREF_FROM_FOREIGN_ORB 5 WARNING "Object reference came from foreign ORB") - (LOCAL_OBJECT_NOT_ALLOWED 6 FINE "Local object not allowed") - (NULL_OBJECT_REFERENCE 7 WARNING "null object reference") - (COULD_NOT_LOAD_CLASS 8 WARNING "Could not load class {0}") - (BAD_URL 9 WARNING "Malformed URL {0}") - (FIELD_NOT_FOUND 10 WARNING "Field {0} not found in parser data object") - (ERROR_SETTING_FIELD 11 WARNING "Error in setting field {0} to value {1} in parser data object") - (BOUNDS_ERROR_IN_DII_REQUEST 12 WARNING "Bounds error occurred in DII request") - (PERSISTENT_SERVER_INIT_ERROR 13 WARNING "Initialization error for persistent server") - (COULD_NOT_CREATE_ARRAY 14 WARNING "Could not create array for field {0} with component type {1} and size {2}") - (COULD_NOT_SET_ARRAY 15 WARNING "Could not set array for field {0} at index {1} with component type {2} and size {3} to value {4}") - (ILLEGAL_BOOTSTRAP_OPERATION 16 WARNING "Illegal bootstrap operation {0}") - (BOOTSTRAP_RUNTIME_EXCEPTION 17 WARNING "Runtime Exception during bootstrap operation") - (BOOTSTRAP_EXCEPTION 18 WARNING "Exception during bootstrap operation") - (STRING_EXPECTED 19 WARNING "Expected a string, but argument was not of String type") - (INVALID_TYPECODE_KIND 20 WARNING "{0} does not represent a valid kind of typecode") - (SOCKET_FACTORY_AND_CONTACT_INFO_LIST_AT_SAME_TIME - 21 WARNING "cannot have a SocketFactory and a ContactInfoList at the same time") - (ACCEPTORS_AND_LEGACY_SOCKET_FACTORY_AT_SAME_TIME - 22 WARNING "cannot have Acceptors and a legacy SocketFactory at the same time") - (BAD_ORB_FOR_SERVANT - 23 WARNING "Reflective POA Servant requires an instance of org.omg.CORBA_2_3.ORB") - (INVALID_REQUEST_PARTITIONING_POLICY_VALUE 24 WARNING - "Request partitioning value specified, {0}, is outside supported range, {1} - {2}") - (INVALID_REQUEST_PARTITIONING_COMPONENT_VALUE 25 WARNING - "Could not set request partitioning component value to {0}, valid values are {1} - {2}") - (INVALID_REQUEST_PARTITIONING_ID - 26 WARNING "Invalid request partitioning id {0}, valid values are {1} - {2}") - (ERROR_IN_SETTING_DYNAMIC_STUB_FACTORY_FACTORY - 27 FINE "ORBDynamicStubFactoryFactoryClass property had value {0}, which could not be loaded by the ORB ClassLoader" ) - ) - (BAD_INV_ORDER - (DSIMETHOD_NOTCALLED 1 WARNING "DSI method not called") - (ARGUMENTS_CALLED_MULTIPLE 2 WARNING "arguments(NVList) called more than once for DSI ServerRequest") - (ARGUMENTS_CALLED_AFTER_EXCEPTION 3 WARNING "arguments(NVList) called after exceptions set for DSI ServerRequest") - (ARGUMENTS_CALLED_NULL_ARGS 4 WARNING "arguments(NVList) called with null args for DSI ServerRequest") - (ARGUMENTS_NOT_CALLED 5 FINE "arguments(NVList) not called for DSI ServerRequest") - (SET_RESULT_CALLED_MULTIPLE 6 WARNING "set_result(Any) called more than once for DSI ServerRequest") - (SET_RESULT_AFTER_EXCEPTION 7 FINE "set_result(Any) called exception was set for DSI ServerRequest") - (SET_RESULT_CALLED_NULL_ARGS 8 WARNING "set_result(Any) called with null args for DSI ServerRequest")) - (BAD_TYPECODE - (BAD_REMOTE_TYPECODE 1 WARNING "Foreign to native typecode conversion constructor should not be called with native typecode") - (UNRESOLVED_RECURSIVE_TYPECODE 2 WARNING "Invoked operation on unresolved recursive TypeCode")) - (COMM_FAILURE - (CONNECT_FAILURE - 1 WARNING "Connection failure: socketType: {0}; hostname: {1}; port: {2}") - (CONNECTION_CLOSE_REBIND - 2 WARNING "Connection close: rebind") - (WRITE_ERROR_SEND - 3 FINE "Write error sent") - (GET_PROPERTIES_ERROR - 4 WARNING "Get properties error") - (BOOTSTRAP_SERVER_NOT_AVAIL - 5 WARNING "Bootstrap server is not available") - (INVOKE_ERROR - 6 WARNING "Invocation error") - (DEFAULT_CREATE_SERVER_SOCKET_GIVEN_NON_IIOP_CLEAR_TEXT - 7 WARNING "DefaultSocketFactory.createServerSocket only handles IIOP_CLEAR_TEXT, given {0}") - (CONNECTION_ABORT - 8 FINE "Connection abort") - (CONNECTION_REBIND - 9 FINE "Connection rebind") - (RECV_MSG_ERROR - 10 WARNING "Received a GIOP MessageError, indicating header corruption or version mismatch") - (IOEXCEPTION_WHEN_READING_CONNECTION - 11 FINE "IOException when reading connection") - (SELECTION_KEY_INVALID - 12 FINE "SelectionKey invalid on channel, {0}") - (EXCEPTION_IN_ACCEPT - 13 FINE "Unexpected {0} in accept") - (SECURITY_EXCEPTION_IN_ACCEPT - 14 FINE "Unexpected {0}, has permissions {1}") - (TRANSPORT_READ_TIMEOUT_EXCEEDED - 15 WARNING "Read of full message failed : bytes requested = {0} bytes read = {1} max wait time = {2} total time spent waiting = {3}") - (CREATE_LISTENER_FAILED - 16 SEVERE "Unable to create listener thread on the specified port: {0}") - (BUFFER_READ_MANAGER_TIMEOUT - 17 WARNING "Timeout while reading data in buffer manager") - ) - (DATA_CONVERSION - (BAD_STRINGIFIED_IOR_LEN 1 WARNING "A character did not map to the transmission code set") - (BAD_STRINGIFIED_IOR 2 WARNING "Bad stringified IOR") - (BAD_MODIFIER 3 WARNING "Unable to perform resolve_initial_references due to bad host or port configuration") - (CODESET_INCOMPATIBLE 4 WARNING "Codesets incompatible") - (BAD_HEX_DIGIT 5 WARNING "Illegal hexadecimal digit") - (BAD_UNICODE_PAIR 6 WARNING "Invalid unicode pair detected during code set conversion") - (BTC_RESULT_MORE_THAN_ONE_CHAR 7 WARNING "Tried to convert bytes to a single java char, but conversion yielded more than one Java char (Surrogate pair?)") - (BAD_CODESETS_FROM_CLIENT 8 WARNING "Client sent code set service context that we do not support") - (INVALID_SINGLE_CHAR_CTB 9 WARNING "Char to byte conversion for a CORBA char resulted in more than one byte") - (BAD_GIOP_1_1_CTB 10 WARNING "Character to byte conversion did not exactly double number of chars (GIOP 1.1 only)") - (BAD_SEQUENCE_BOUNDS 12 WARNING "Tried to insert a sequence of length {0} into a bounded sequence of maximum length {1} in an Any") - (ILLEGAL_SOCKET_FACTORY_TYPE 13 WARNING "Class {0} is not a subtype of ORBSocketFactory") - (BAD_CUSTOM_SOCKET_FACTORY 14 WARNING "{0} is not a valid custom socket factory") - (FRAGMENT_SIZE_MINIMUM 15 WARNING "Fragment size {0} is too small: it must be at least {1}") - (FRAGMENT_SIZE_DIV 16 WARNING "Illegal valiue for fragment size ({0}): must be divisible by {1}") - (ORB_INITIALIZER_FAILURE - 17 WARNING "Could not instantiate ORBInitializer {0}") - (ORB_INITIALIZER_TYPE - 18 WARNING "orb initializer class {0} is not a subtype of ORBInitializer") - (ORB_INITIALREFERENCE_SYNTAX - 19 WARNING "Bad syntax for ORBInitialReference") - (ACCEPTOR_INSTANTIATION_FAILURE - 20 WARNING "Could not instantiate Acceptor {0}") - (ACCEPTOR_INSTANTIATION_TYPE_FAILURE - 21 WARNING "Acceptor class {0} is not a subtype of Acceptor") - (ILLEGAL_CONTACT_INFO_LIST_FACTORY_TYPE - 22 WARNING "Class {0} is not a subtype of CorbaContactInfoListFactory") - (BAD_CONTACT_INFO_LIST_FACTORY - 23 WARNING "{0} is not a valid CorbaContactInfoListFactory") - (ILLEGAL_IOR_TO_SOCKET_INFO_TYPE - 24 WARNING "Class {0} is not a subtype of IORToSocketInfo") - (BAD_CUSTOM_IOR_TO_SOCKET_INFO - 25 WARNING "{0} is not a valid custom IORToSocketInfo") - (ILLEGAL_IIOP_PRIMARY_TO_CONTACT_INFO_TYPE - 26 WARNING "Class {0} is not a subtype of IIOPPrimaryToContactInfo") - (BAD_CUSTOM_IIOP_PRIMARY_TO_CONTACT_INFO - 27 WARNING "{0} is not a valid custom IIOPPrimaryToContactInfo") - - ) - (INV_OBJREF - (BAD_CORBALOC_STRING 1 WARNING "Bad corbaloc: URL") - (NO_PROFILE_PRESENT 2 WARNING "No profile in IOR")) - (INITIALIZE - (CANNOT_CREATE_ORBID_DB 1 WARNING "Cannot create ORB ID datastore") - (CANNOT_READ_ORBID_DB 2 WARNING "Cannot read ORB ID datastore") - (CANNOT_WRITE_ORBID_DB 3 WARNING "Cannot write ORB ID datastore") - (GET_SERVER_PORT_CALLED_BEFORE_ENDPOINTS_INITIALIZED 4 WARNING "legacyGetServerPort called before endpoints initialized") - (PERSISTENT_SERVERPORT_NOT_SET 5 WARNING "Persistent server port is not set") - (PERSISTENT_SERVERID_NOT_SET 6 WARNING "Persistent server ID is not set")) - (INTERNAL - (NON_EXISTENT_ORBID 1 WARNING "Non-existent ORB ID") - (NO_SERVER_SUBCONTRACT 2 WARNING "No server request dispatcher") - (SERVER_SC_TEMP_SIZE 3 WARNING "server request dispatcher template size error") - (NO_CLIENT_SC_CLASS 4 WARNING "No client request dispatcher class") - (SERVER_SC_NO_IIOP_PROFILE 5 WARNING "No IIOP profile in server request dispatcher") - (GET_SYSTEM_EX_RETURNED_NULL 6 WARNING "getSystemException returned null") - (PEEKSTRING_FAILED 7 WARNING "The repository ID of a user exception had a bad length") - (GET_LOCAL_HOST_FAILED 8 WARNING "Unable to determine local hostname from InetAddress.getLocalHost().getHostName()") - ;; 9 is not used at this time - it is available for reuse. - (BAD_LOCATE_REQUEST_STATUS 10 WARNING "Bad locate request status in IIOP locate reply") - (STRINGIFY_WRITE_ERROR 11 WARNING "Error while stringifying an object reference") - (BAD_GIOP_REQUEST_TYPE 12 WARNING "IIOP message with bad GIOP 1.0 message type") - (ERROR_UNMARSHALING_USEREXC 13 WARNING "Error in unmarshalling user exception") - (RequestDispatcherRegistry_ERROR 14 WARNING "Overflow in RequestDispatcherRegistry") - (LOCATIONFORWARD_ERROR 15 WARNING "Error in processing a LocationForward") - (WRONG_CLIENTSC 16 WARNING "Wrong client request dispatcher") - (BAD_SERVANT_READ_OBJECT 17 WARNING "Bad servant in read_Object") - (MULT_IIOP_PROF_NOT_SUPPORTED 18 WARNING "multiple IIOP profiles not supported") - (GIOP_MAGIC_ERROR 20 WARNING "Error in GIOP magic") - (GIOP_VERSION_ERROR 21 WARNING "Error in GIOP version") - (ILLEGAL_REPLY_STATUS 22 WARNING "Illegal reply status in GIOP reply message") - (ILLEGAL_GIOP_MSG_TYPE 23 WARNING "Illegal GIOP message type") - (FRAGMENTATION_DISALLOWED 24 WARNING "Fragmentation not allowed for this message type") - (BAD_REPLYSTATUS 25 WARNING "Bad status in the IIOP reply message") - (CTB_CONVERTER_FAILURE 26 WARNING "character to byte converter failure") - (BTC_CONVERTER_FAILURE 27 WARNING "byte to character converter failure") - (WCHAR_ARRAY_UNSUPPORTED_ENCODING 28 WARNING "Unsupported wchar encoding: ORB only supports fixed width UTF-16 encoding") - (ILLEGAL_TARGET_ADDRESS_DISPOSITION 29 WARNING "Illegal target address disposition value") - (NULL_REPLY_IN_GET_ADDR_DISPOSITION 30 WARNING "No reply while attempting to get addressing disposition") - (ORB_TARGET_ADDR_PREFERENCE_IN_EXTRACT_OBJECTKEY_INVALID 31 WARNING "Invalid GIOP target addressing preference") - (INVALID_ISSTREAMED_TCKIND 32 WARNING "Invalid isStreamed TCKind {0}") - (INVALID_JDK1_3_1_PATCH_LEVEL 33 WARNING "Found a JDK 1.3.1 patch level indicator with value less than JDK 1.3.1_01 value of 1") - (SVCCTX_UNMARSHAL_ERROR 34 WARNING "Error unmarshalling service context data") - (NULL_IOR 35 WARNING "null IOR") - (UNSUPPORTED_GIOP_VERSION 36 WARNING "Unsupported GIOP version {0}") - (APPLICATION_EXCEPTION_IN_SPECIAL_METHOD 37 WARNING "Application exception in special method: should not happen") - (STATEMENT_NOT_REACHABLE1 38 WARNING "Assertion failed: statement not reachable (1)") - (STATEMENT_NOT_REACHABLE2 39 WARNING "Assertion failed: statement not reachable (2)") - (STATEMENT_NOT_REACHABLE3 40 WARNING "Assertion failed: statement not reachable (3)") - (STATEMENT_NOT_REACHABLE4 41 FINE "Assertion failed: statement not reachable (4)") - (STATEMENT_NOT_REACHABLE5 42 WARNING "Assertion failed: statement not reachable (5)") - (STATEMENT_NOT_REACHABLE6 43 WARNING "Assertion failed: statement not reachable (6)") - (UNEXPECTED_DII_EXCEPTION 44 WARNING "Unexpected exception while unmarshalling DII user exception") - (METHOD_SHOULD_NOT_BE_CALLED 45 WARNING "This method should never be called") - (CANCEL_NOT_SUPPORTED 46 WARNING "We do not support cancel request for GIOP 1.1") - (EMPTY_STACK_RUN_SERVANT_POST_INVOKE 47 WARNING "Empty stack exception while calling runServantPostInvoke") - (PROBLEM_WITH_EXCEPTION_TYPECODE 48 WARNING "Bad exception typecode") - (ILLEGAL_SUBCONTRACT_ID 49 WARNING "Illegal Subcontract id {0}") - (BAD_SYSTEM_EXCEPTION_IN_LOCATE_REPLY 50 WARNING "Bad system exception in locate reply") - (BAD_SYSTEM_EXCEPTION_IN_REPLY 51 WARNING "Bad system exception in reply") - (BAD_COMPLETION_STATUS_IN_LOCATE_REPLY 52 WARNING "Bad CompletionStatus {0} in locate reply") - (BAD_COMPLETION_STATUS_IN_REPLY 53 WARNING "Bad CompletionStatus {0} in reply") - (BADKIND_CANNOT_OCCUR 54 WARNING "The BadKind exception should never occur here") - (ERROR_RESOLVING_ALIAS 55 WARNING "Could not resolve alias typecode") - (TK_LONG_DOUBLE_NOT_SUPPORTED 56 WARNING "The long double type is not supported in Java") - (TYPECODE_NOT_SUPPORTED 57 WARNING "Illegal typecode kind") - (BOUNDS_CANNOT_OCCUR 59 WARNING "Bounds exception cannot occur in this context") - (NUM_INVOCATIONS_ALREADY_ZERO 61 WARNING "Number of invocations is already zero, but another invocation has completed") - (ERROR_INIT_BADSERVERIDHANDLER 62 WARNING "Error in constructing instance of bad server ID handler") - (NO_TOA 63 WARNING "No TOAFactory is availble") - (NO_POA 64 WARNING "No POAFactory is availble") - (INVOCATION_INFO_STACK_EMPTY 65 WARNING "Invocation info stack is unexpectedly empty") - (BAD_CODE_SET_STRING 66 WARNING "Empty or null code set string") - (UNKNOWN_NATIVE_CODESET 67 WARNING "Unknown native codeset: {0}") - (UNKNOWN_CONVERSION_CODE_SET 68 WARNING "Unknown conversion codset: {0}") - (INVALID_CODE_SET_NUMBER 69 WARNING "Invalid codeset number") - (INVALID_CODE_SET_STRING 70 WARNING "Invalid codeset string {0}") - (INVALID_CTB_CONVERTER_NAME 71 WARNING "Invalid CTB converter {0}") - (INVALID_BTC_CONVERTER_NAME 72 WARNING "Invalid BTC converter {0}") - (COULD_NOT_DUPLICATE_CDR_INPUT_STREAM 73 WARNING "Could not duplicate CDRInputStream") - (BOOTSTRAP_APPLICATION_EXCEPTION 74 WARNING "BootstrapResolver caught an unexpected ApplicationException") - (DUPLICATE_INDIRECTION_OFFSET 75 WARNING "Old entry in serialization indirection table has a different value than the value being added with the same key") - (BAD_MESSAGE_TYPE_FOR_CANCEL 76 WARNING "GIOP Cancel request contained a bad request ID: the request ID did not match the request that was to be cancelled") - (DUPLICATE_EXCEPTION_DETAIL_MESSAGE 77 WARNING "Duplicate ExceptionDetailMessage") - (BAD_EXCEPTION_DETAIL_MESSAGE_SERVICE_CONTEXT_TYPE 78 WARNING "Bad ExceptionDetailMessage ServiceContext type") - (UNEXPECTED_DIRECT_BYTE_BUFFER_WITH_NON_CHANNEL_SOCKET 79 WARNING "unexpected direct ByteBuffer with non-channel socket") - (UNEXPECTED_NON_DIRECT_BYTE_BUFFER_WITH_CHANNEL_SOCKET 80 WARNING "unexpected non-direct ByteBuffer with channel socket") - (INVALID_CONTACT_INFO_LIST_ITERATOR_FAILURE_EXCEPTION 82 WARNING "There should be at least one CorbaContactInfo to try (and fail) so this error should not be seen.") - (REMARSHAL_WITH_NOWHERE_TO_GO 83 WARNING "Remarshal with nowhere to go") - (EXCEPTION_WHEN_SENDING_CLOSE_CONNECTION 84 WARNING "Exception when sending close connection") - (INVOCATION_ERROR_IN_REFLECTIVE_TIE 85 WARNING "A reflective tie got an error while invoking method {0} on class {1}") - (BAD_HELPER_WRITE_METHOD 86 WARNING "Could not find or invoke write method on exception Helper class {0}") - (BAD_HELPER_READ_METHOD 87 WARNING "Could not find or invoke read method on exception Helper class {0}") - (BAD_HELPER_ID_METHOD 88 WARNING "Could not find or invoke id method on exception Helper class {0}") - (WRITE_UNDECLARED_EXCEPTION 89 WARNING "Tried to write exception of type {0} that was not declared on method") - (READ_UNDECLARED_EXCEPTION 90 WARNING "Tried to read undeclared exception with ID {0}") - (UNABLE_TO_SET_SOCKET_FACTORY_ORB 91 WARNING "Unable to setSocketFactoryORB") - (UNEXPECTED_EXCEPTION 92 WARNING "Unexpected exception occurred where no exception should occur") - (NO_INVOCATION_HANDLER 93 WARNING "No invocation handler available for {0}") - (INVALID_BUFF_MGR_STRATEGY 94 WARNING "{0}: invalid buffer manager strategy for Java serialization") - (JAVA_STREAM_INIT_FAILED 95 WARNING "Java stream initialization failed") - (DUPLICATE_ORB_VERSION_SERVICE_CONTEXT 96 WARNING "An ORBVersionServiceContext was already in the service context list") - (DUPLICATE_SENDING_CONTEXT_SERVICE_CONTEXT 97 WARNING "A SendingContextServiceContext was already in the service context list") - (WORK_QUEUE_THREAD_INTERRUPTED 98 FINE "Worker Thread from thread pool {0} was interrupted: closeCalled is {1}.") - (WORKER_THREAD_CREATED - 104 FINE "Worker thread {0} has been created with ClassLoader {1}") - (WORKER_THREAD_THROWABLE_FROM_REQUEST_WORK - 109 FINE "Worker thread {0} caught throwable {1} when requesting work from work queue {2}.") - (WORKER_THREAD_NOT_NEEDED - 110 FINE "Worker thread {0} will exit; current thread count, {1}, greater than minunum worker threads needed, {2}.") - (WORKER_THREAD_DO_WORK_THROWABLE - 111 FINE "Worker thread {0} caught throwable {1} while executing work.") - (WORKER_THREAD_CAUGHT_UNEXPECTED_THROWABLE - 112 WARNING "Worker thread {0} caught unexpected throwable {1}.") - (WORKER_THREAD_CREATION_FAILURE - 113 SEVERE "Worker thread creation failure; cause {0}.") - (WORKER_THREAD_SET_NAME_FAILURE - 114 WARNING "Unable to set worker thread {0} name to {1}; cause {2}.") - (WORK_QUEUE_REQUEST_WORK_NO_WORK_FOUND - 116 WARNING "Ignoring unexpected {0} when retrieving of work from work queue, {1}.") - (THREAD_POOL_CLOSE_ERROR 126 WARNING "Error in closing ThreadPool") - (THREAD_GROUP_IS_DESTROYED 127 WARNING "ThreadGroup {0} is already destroyed: can't destroy it") - (THREAD_GROUP_HAS_ACTIVE_THREADS_IN_CLOSE 128 WARNING "ThreadGroup {0} has {1} active threads: destroy may cause exception") - (THREAD_GROUP_HAS_SUB_GROUPS_IN_CLOSE 129 WARNING "ThreadGroup {0} has {1} sub-thread groups: destroy may cause exception") - (THREAD_GROUP_DESTROY_FAILED 130 WARNING "ThreadGroup {0} could not be destroyed") - (INTERRUPTED_JOIN_CALL_WHILE_CLOSING_THREAD_POOL 131 WARNING "Join was interrupted on thread {0} while closing ThreadPool {1}") - ) - - (MARSHAL - (CHUNK_OVERFLOW 1 WARNING "Data read past end of chunk without closing the chunk") - (UNEXPECTED_EOF 2 WARNING "Grow buffer strategy called underflow handler") - (READ_OBJECT_EXCEPTION 3 WARNING "Error in reading marshalled object") - (CHARACTER_OUTOFRANGE 4 WARNING "Character not IOS Latin-1 compliant in marshalling") - (DSI_RESULT_EXCEPTION 5 WARNING "Exception thrown during result() on ServerRequest") - (IIOPINPUTSTREAM_GROW 6 WARNING "grow() called on IIOPInputStream") - (END_OF_STREAM 7 FINE "Underflow in BufferManagerReadStream after last fragment in message") - (INVALID_OBJECT_KEY 8 WARNING "Invalid ObjectKey in request header") - (MALFORMED_URL 9 WARNING "Unable to locate value class for repository ID {0} because codebase URL {1] is malformed") - (VALUEHANDLER_READ_ERROR 10 WARNING "Error from readValue on ValueHandler in CDRInputStream") - (VALUEHANDLER_READ_EXCEPTION 11 WARNING "Exception from readValue on ValueHandler in CDRInputStream") - (BAD_KIND 12 WARNING "Bad kind in isCustomType in CDRInputStream") - (CNFE_READ_CLASS 13 WARNING "Could not find class {0} in CDRInputStream.readClass") - (BAD_REP_ID_INDIRECTION 14 WARNING "Bad repository ID indirection at index {0}") - (BAD_CODEBASE_INDIRECTION 15 WARNING "Bad codebase string indirection at index {0}") - (UNKNOWN_CODESET 16 WARNING "Unknown code set {0} specified by client ORB as a negotiated code set") - (WCHAR_DATA_IN_GIOP_1_0 17 WARNING "Attempt to marshal wide character or string data in GIOP 1.0") - (NEGATIVE_STRING_LENGTH 18 WARNING "String or wstring with a negative length {0}") - (EXPECTED_TYPE_NULL_AND_NO_REP_ID 19 WARNING "CDRInputStream.read_value(null) called, but no repository ID information on the wire") - (READ_VALUE_AND_NO_REP_ID 20 WARNING "CDRInputStream.read_value() called, but no repository ID information on the wire") - (UNEXPECTED_ENCLOSING_VALUETYPE 22 WARNING "Received end tag {0}, which is less than the expected value {1}") - (POSITIVE_END_TAG 23 WARNING "Read non-negative end tag {0} at offset {1} (end tags should always be negative)") - (NULL_OUT_CALL 24 WARNING "Out call descriptor is missing") - (WRITE_LOCAL_OBJECT 25 WARNING "write_Object called with a local object") - (BAD_INSERTOBJ_PARAM 26 WARNING "Tried to insert non-ObjectImpl {0} into an Any via insert_Object") - (CUSTOM_WRAPPER_WITH_CODEBASE 27 WARNING "Codebase present in RMI-IIOP stream format version 1 optional data valuetype header") - (CUSTOM_WRAPPER_INDIRECTION 28 WARNING "Indirection preseint in RMI-IIOP stream format version 2 optional data valuetype header") - (CUSTOM_WRAPPER_NOT_SINGLE_REPID 29 WARNING "0 or more than one repository ID found reading the optional data valuetype header") - (BAD_VALUE_TAG 30 WARNING "Bad valuetag {0} found while reading repository IDs") - (BAD_TYPECODE_FOR_CUSTOM_VALUE 31 WARNING "Bad typecode found for custom valuetype") - (ERROR_INVOKING_HELPER_WRITE 32 WARNING "An error occurred using reflection to invoke IDL Helper write method") - (BAD_DIGIT_IN_FIXED 33 WARNING "A bad digit was found while marshalling an IDL fixed type") - (REF_TYPE_INDIR_TYPE 34 WARNING "Referenced type of indirect type not marshaled") - (BAD_RESERVED_LENGTH 35 WARNING "Request message reserved bytes has invalid length") - (NULL_NOT_ALLOWED 36 WARNING "A null object is not allowed here") - (UNION_DISCRIMINATOR_ERROR 38 WARNING "Error in typecode union discriminator") - (CANNOT_MARSHAL_NATIVE 39 WARNING "Cannot marshal a native TypeCode") - (CANNOT_MARSHAL_BAD_TCKIND 40 WARNING "Cannot marshal an invalid TypeCode kind") - (INVALID_INDIRECTION 41 WARNING "Invalid indirection value {0} (>-4): probable stream corruption") - (INDIRECTION_NOT_FOUND 42 FINE "No type found at indirection {0}: probably stream corruption") - (RECURSIVE_TYPECODE_ERROR 43 WARNING "Recursive TypeCode not supported by InputStream subtype") - (INVALID_SIMPLE_TYPECODE 44 WARNING "TypeCode is of wrong kind to be simple") - (INVALID_COMPLEX_TYPECODE 45 WARNING "TypeCode is of wrong kind to be complex") - (INVALID_TYPECODE_KIND_MARSHAL 46 WARNING "Cannot marshal typecode of invalid kind") - (UNEXPECTED_UNION_DEFAULT 47 WARNING "Default union branch not expected") - (ILLEGAL_UNION_DISCRIMINATOR_TYPE 48 WARNING "Illegal discriminator type in union") - (COULD_NOT_SKIP_BYTES 49 WARNING "Could not skip over {0} bytes at offset {1}") - (BAD_CHUNK_LENGTH 50 WARNING "Incorrect chunk length {0} at offset {1}") - (UNABLE_TO_LOCATE_REP_ID_ARRAY 51 WARNING "Unable to locate array of repository IDs from indirection {0}") - (BAD_FIXED 52 WARNING "Fixed of length {0} in buffer of length {1}") - (READ_OBJECT_LOAD_CLASS_FAILURE 53 WARNING "Failed to load stub for {0} with class {1}") - (COULD_NOT_INSTANTIATE_HELPER 54 WARNING "Could not instantiate Helper class {0}") - (BAD_TOA_OAID 55 WARNING "Bad ObjectAdapterId for TOA") - (COULD_NOT_INVOKE_HELPER_READ_METHOD 56 WARNING "Could not invoke helper read method for helper {0}") - (COULD_NOT_FIND_CLASS 57 WARNING "Could not find class") - (BAD_ARGUMENTS_NVLIST 58 FINE "Error in arguments(NVList) for DSI ServerRequest") - (STUB_CREATE_ERROR 59 FINE "Could not create stub") - (JAVA_SERIALIZATION_EXCEPTION 60 WARNING "Java serialization exception during {0} operation")) - (NO_IMPLEMENT - (GENERIC_NO_IMPL 1 FINE "feature not implemented") - (CONTEXT_NOT_IMPLEMENTED 2 FINE "IDL request context is not implemented") - (GETINTERFACE_NOT_IMPLEMENTED 3 FINE "getInterface() is not implemented") - (SEND_DEFERRED_NOTIMPLEMENTED 4 FINE "send deferred is not implemented") - (LONG_DOUBLE_NOT_IMPLEMENTED 5 FINE "IDL type long double is not supported in Java")) - (OBJ_ADAPTER - (NO_SERVER_SC_IN_DISPATCH 1 WARNING "No server request dispatcher found when dispatching request to object adapter") - (ORB_CONNECT_ERROR 2 WARNING "Error in connecting servant to ORB") - (ADAPTER_INACTIVE_IN_ACTIVATION 3 FINE "StubAdapter.getDelegate failed to activate a Servant")) - (OBJECT_NOT_EXIST - (LOCATE_UNKNOWN_OBJECT 1 WARNING "Locate response indicated that the object was unknown") - (BAD_SERVER_ID 2 FINE "The server ID in the target object key does not match the server key expected by the server") - (BAD_SKELETON 3 WARNING "No skeleton found in the server that matches the target object key") - (SERVANT_NOT_FOUND 4 WARNING "Servant not found") - (NO_OBJECT_ADAPTER_FACTORY 5 WARNING "No object adapter factory") - (BAD_ADAPTER_ID 6 WARNING "Bad adapter ID") - (DYN_ANY_DESTROYED 7 WARNING "Dynamic Any was destroyed: all operations are invalid")) - (TRANSIENT - (REQUEST_CANCELED 1 WARNING "Request cancelled by exception")) - (UNKNOWN - (UNKNOWN_CORBA_EXC 1 WARNING "Unknown user exception while unmarshalling") - (RUNTIMEEXCEPTION 2 WARNING "Unknown user exception thrown by the server") - (UNKNOWN_SERVER_ERROR 3 WARNING "Unknown exception or error thrown by the ORB or application") - (UNKNOWN_DSI_SYSEX 4 WARNING "Error while marshalling SystemException after DSI-based invocation") - (UNKNOWN_SYSEX 5 WARNING "Error while unmarshalling SystemException") - (WRONG_INTERFACE_DEF 6 WARNING "InterfaceDef object of wrong type returned by server") - (NO_INTERFACE_DEF_STUB 7 WARNING "org.omg.CORBA._InterfaceDefStub class not available") - (UNKNOWN_EXCEPTION_IN_DISPATCH 9 FINE "UnknownException in dispatch")))) --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/POA.mc 2018-01-30 20:22:12.000000000 -0500 +++ /dev/null 2018-01-30 20:22:12.000000000 -0500 @@ -1,107 +0,0 @@ -; -; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. -; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -; -; This code is free software; you can redistribute it and/or modify it -; under the terms of the GNU General Public License version 2 only, as -; published by the Free Software Foundation. Oracle designates this -; particular file as subject to the "Classpath" exception as provided -; by Oracle in the LICENSE file that accompanied this code. -; -; This code is distributed in the hope that it will be useful, but WITHOUT -; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -; version 2 for more details (a copy is included in the LICENSE file that -; accompanied this code). -; -; You should have received a copy of the GNU General Public License version -; 2 along with this work; if not, write to the Free Software Foundation, -; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -; -; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -; or visit www.oracle.com if you need additional information or have any -; questions. -; -("com.sun.corba.se.impl.logging" "POASystemException" POA - ( - (BAD_INV_ORDER - (SERVANT_MANAGER_ALREADY_SET 1 WARNING "Servant Manager already set") - (DESTROY_DEADLOCK 2 WARNING "Request to wait for POA destruction while servicing request would deadlock")) - (BAD_OPERATION - (SERVANT_ORB 1 WARNING "Bad operation on servant ORB???") - (BAD_SERVANT 2 WARNING "Bad Servant???") - (ILLEGAL_FORWARD_REQUEST 3 WARNING "Illegal Forward Request???")) - (BAD_PARAM - (BAD_TRANSACTION_CONTEXT 1 WARNING "Bad transaction context") - (BAD_REPOSITORY_ID 2 WARNING "Bad repository id")) - (INTERNAL - (INVOKESETUP 1 WARNING "invoke setup???") - (BAD_LOCALREPLYSTATUS 2 WARNING "bad local reply status???") - (PERSISTENT_SERVERPORT_ERROR 3 WARNING "persistent serverport error???") - (SERVANT_DISPATCH 4 WARNING "servant dispatch???") - (WRONG_CLIENTSC 5 WARNING "wrong client request dispatcher???") - (CANT_CLONE_TEMPLATE 6 WARNING "can't clone template???") - (POACURRENT_UNBALANCED_STACK 7 WARNING "POACurrent stack is unbalanced") - (POACURRENT_NULL_FIELD 8 WARNING "Null field in POACurrent") - (POA_INTERNAL_GET_SERVANT_ERROR 9 WARNING "POA internalGetServant error") - (MAKE_FACTORY_NOT_POA 10 WARNING "First Object Adapter name is {0}, should be RootPOA") - (DUPLICATE_ORB_VERSION_SC 11 WARNING "Duplicate ORB version service context") - (PREINVOKE_CLONE_ERROR 12 WARNING "preinvoke clone error") - (PREINVOKE_POA_DESTROYED 13 WARNING "preinvoke POA destroyed") - (PMF_CREATE_RETAIN 14 WARNING "Bad dispatch policy for RETAIN policy in POAPolicyMediatorFactory") - (PMF_CREATE_NON_RETAIN 15 WARNING "Bad dispatch policy for NON_RETAIN policy in POAPolicyMediatorFactory") - (POLICY_MEDIATOR_BAD_POLICY_IN_FACTORY 16 WARNING "Inconsistent policy in PolicyMediator") - (SERVANT_TO_ID_OAA 17 WARNING "ObjectAlreadyActive in servantToId") - (SERVANT_TO_ID_SAA 18 WARNING "ServantAlreadyActive in servantToId") - (SERVANT_TO_ID_WP 19 WARNING "WrongPolicy in servantToId") - (CANT_RESOLVE_ROOT_POA 20 WARNING "Can't resolve root POA") - (SERVANT_MUST_BE_LOCAL 21 WARNING "Call made to local client request dispatcher with non-local servant") - (NO_PROFILES_IN_IOR 22 WARNING "IOR does not have any profiles") - (AOM_ENTRY_DEC_ZERO 23 WARNING "Tried to decrement AOMEntry counter that is already 0") - (ADD_POA_INACTIVE 24 WARNING "Tried to add a POA to an inactive POAManager") - (ILLEGAL_POA_STATE_TRANS 25 WARNING "POA tried to make an illegal state transition") - (UNEXPECTED_EXCEPTION 26 WARNING "Unexpected exception in POA {0}")) - (NO_IMPLEMENT - (SINGLE_THREAD_NOT_SUPPORTED 1 WARNING "Single thread policy is not supported") - (METHOD_NOT_IMPLEMENTED 2 WARNING "This method is not implemented")) - (OBJ_ADAPTER - (POA_LOOKUP_ERROR 1 WARNING "Error in find_POA") - (POA_INACTIVE 2 FINE "POA is inactive") - (POA_NO_SERVANT_MANAGER 3 WARNING "POA has no servant manager") - (POA_NO_DEFAULT_SERVANT 4 WARNING "POA has no default servant") - (POA_SERVANT_NOT_UNIQUE 5 WARNING "POA servant is not unique") - (POA_WRONG_POLICY 6 WARNING "Bad policy in POA") - (FINDPOA_ERROR 7 WARNING "Another error in find_POA") - (POA_SERVANT_ACTIVATOR_LOOKUP_FAILED 9 WARNING "POA ServantActivator lookup failed") - (POA_BAD_SERVANT_MANAGER 10 WARNING "POA has bad servant manager") - (POA_SERVANT_LOCATOR_LOOKUP_FAILED 11 WARNING "POA ServantLocator lookup failed") - (POA_UNKNOWN_POLICY 12 WARNING "Unknown policy passed to POA") - (POA_NOT_FOUND 13 WARNING "POA not found") - (SERVANT_LOOKUP 14 WARNING "Error in servant lookup") - (LOCAL_SERVANT_LOOKUP 15 WARNING "Error in local servant lookup") - (SERVANT_MANAGER_BAD_TYPE 16 WARNING "Bad type for servant manager") - (DEFAULT_POA_NOT_POAIMPL 17 WARNING "Servant's _default_POA must be an instance of POAImpl") - (WRONG_POLICIES_FOR_THIS_OBJECT 18 WARNING "Wrong POA policies for _this_object called outside of an invocation context") - (THIS_OBJECT_SERVANT_NOT_ACTIVE 19 WARNING "ServantNotActive exception in _this_object") - (THIS_OBJECT_WRONG_POLICY 20 WARNING "WrongPolicy exception in _this_object") - (NO_CONTEXT 21 FINE "Operation called outside of invocation context") - (INCARNATE_RETURNED_NULL 22 WARNING "ServantActivator.incarnate() returned a null Servant")) - (INITIALIZE - (JTS_INIT_ERROR 1 WARNING "JTS initialization error") - (PERSISTENT_SERVERID_NOT_SET 2 WARNING "Persistent server ID is not set") - (PERSISTENT_SERVERPORT_NOT_SET 3 WARNING "Persistent server port is not set") - (ORBD_ERROR 4 WARNING "Error in ORBD") - (BOOTSTRAP_ERROR 5 WARNING "Error in bootstrap")) - (TRANSIENT - (POA_DISCARDING 1 FINE "POA is in discarding state")) - (UNKNOWN - (OTSHOOKEXCEPTION 1 WARNING "Error in OTS hook") - (UNKNOWN_SERVER_EXCEPTION 2 WARNING "Unknown server exception") - (UNKNOWN_SERVERAPP_EXCEPTION 3 WARNING "Unknown server application exception") - (UNKNOWN_LOCALINVOCATION_ERROR 4 WARNING "Unknon local invocation error")) - (OBJECT_NOT_EXIST - (ADAPTER_ACTIVATOR_NONEXISTENT 1 WARNING "AdapterActivator does not exist") - (ADAPTER_ACTIVATOR_FAILED 2 WARNING "AdapterActivator failed") - (BAD_SKELETON 3 WARNING "Bad skeleton") - (NULL_SERVANT 4 FINE "Null servant") - (ADAPTER_DESTROYED 5 WARNING "POA has been destroyed")))) --- old/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Util.mc 2018-01-30 20:22:13.000000000 -0500 +++ /dev/null 2018-01-30 20:22:13.000000000 -0500 @@ -1,64 +0,0 @@ -; -; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. -; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -; -; This code is free software; you can redistribute it and/or modify it -; under the terms of the GNU General Public License version 2 only, as -; published by the Free Software Foundation. Oracle designates this -; particular file as subject to the "Classpath" exception as provided -; by Oracle in the LICENSE file that accompanied this code. -; -; This code is distributed in the hope that it will be useful, but WITHOUT -; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -; version 2 for more details (a copy is included in the LICENSE file that -; accompanied this code). -; -; You should have received a copy of the GNU General Public License version -; 2 along with this work; if not, write to the Free Software Foundation, -; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. -; -; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA -; or visit www.oracle.com if you need additional information or have any -; questions. -; -("com.sun.corba.se.impl.logging" "UtilSystemException" UTIL - ( - (BAD_OPERATION - (STUB_FACTORY_COULD_NOT_MAKE_STUB 1 FINE "StubFactory failed on makeStub call") - (ERROR_IN_MAKE_STUB_FROM_REPOSITORY_ID 2 FINE "Error in making stub given RepositoryId") - (CLASS_CAST_EXCEPTION_IN_LOAD_STUB 3 FINE "ClassCastException in loadStub") - (EXCEPTION_IN_LOAD_STUB 4 FINE "Exception in loadStub") - ) - (BAD_PARAM - (NO_POA 2 WARNING "Error in loadStubAndUpdateCache caused by _this_object") - (CONNECT_WRONG_ORB 3 FINE "Tried to connect already connected Stub Delegate to a different ORB") - (CONNECT_NO_TIE 4 WARNING "Tried to connect unconnected Stub Delegate but no Tie was found") - (CONNECT_TIE_WRONG_ORB 5 WARNING "Tried to connect unconnected stub with Tie in a different ORB") - (CONNECT_TIE_NO_SERVANT 6 WARNING "Tried to connect unconnected stub to unconnected Tie") - (LOAD_TIE_FAILED 7 FINE "Failed to load Tie of class {0}") - ) - (DATA_CONVERSION - (BAD_HEX_DIGIT 1 WARNING "Bad hex digit in string_to_object")) - (MARSHAL - (UNABLE_LOCATE_VALUE_HELPER 2 WARNING "Could not locate value helper") - (INVALID_INDIRECTION 3 WARNING "Invalid indirection {0}")) - (INV_OBJREF - (OBJECT_NOT_CONNECTED 1 WARNING "{0} did not originate from a connected object") - (COULD_NOT_LOAD_STUB 2 WARNING "Could not load stub for class {0}") - (OBJECT_NOT_EXPORTED 3 WARNING "Class {0} not exported, or else is actually a JRMP stub")) - (INTERNAL - (ERROR_SET_OBJECT_FIELD 1 WARNING "Error in setting object field {0} in {1} to {2}") - (ERROR_SET_BOOLEAN_FIELD 2 WARNING "Error in setting boolean field {0} in {1} to {2}") - (ERROR_SET_BYTE_FIELD 3 WARNING "Error in setting byte field {0} in {1} to {2}") - (ERROR_SET_CHAR_FIELD 4 WARNING "Error in setting char field {0} in {1} to {2}") - (ERROR_SET_SHORT_FIELD 5 WARNING "Error in setting short field {0} in {1} to {2}") - (ERROR_SET_INT_FIELD 6 WARNING "Error in setting int field {0} in {1} to {2}") - (ERROR_SET_LONG_FIELD 7 WARNING "Error in setting long field {0} in {1} to {2}") - (ERROR_SET_FLOAT_FIELD 8 WARNING "Error in setting float field {0} in {1} to {2}") - (ERROR_SET_DOUBLE_FIELD 9 WARNING "Error in setting double field {0} in {1} to {2}") - (ILLEGAL_FIELD_ACCESS 10 WARNING "IllegalAccessException while trying to write to field {0}") - (BAD_BEGIN_UNMARSHAL_CUSTOM_VALUE 11 WARNING "State should be saved and reset first") - (CLASS_NOT_FOUND 12 WARNING "Failure while loading specific Java remote exception class: {0}")) - (UNKNOWN - (UNKNOWN_SYSEX 1 WARNING "Unknown System Exception")))) --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/LongMonitoredAttributeBase.java 2018-01-30 20:22:13.000000000 -0500 +++ /dev/null 2018-01-30 20:22:13.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -import java.util.*; - -/** - * @author Hemanth Puttaswamy - * - * A Cleaner Abstraction to provide a Monitored Attribute of type 'Long' - */ -public abstract class LongMonitoredAttributeBase extends MonitoredAttributeBase { - - /////////////////////////////////////// - // operations - - -/** - * Constructs LongMonitoredAttribute, by creating the - * MonitoredAttributeInfo with 'Long' as the class type. - * Users are expected to extend this class and provide the implementation - * for getValue() and if needed clearState() as well. - * - * @param name of the MonitoredAttribute - * @param description of the Attribute, Please provid a well thought out - * description, so that the admin can make sense of the attribute supplied. - */ - public LongMonitoredAttributeBase(String name, String description) { - super( name ); - MonitoredAttributeInfoFactory f = - MonitoringFactories.getMonitoredAttributeInfoFactory(); - MonitoredAttributeInfo maInfo = f.createMonitoredAttributeInfo( - description, Long.class, false, false ); - this.setMonitoredAttributeInfo( maInfo ); - } // end LongMonitoredAttributeBase - - -} // end LongMonitoredAttributeBase --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttribute.java 2018-01-30 20:22:14.000000000 -0500 +++ /dev/null 2018-01-30 20:22:14.000000000 -0500 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo; -import java.util.*; - -/** - * @author Hemanth Puttaswamy - * - * Monitored Attribute is the interface to represent a Monitorable - * Attribute. Using this interface, one can get the value of the attribute - * and set the value if it is a writeable attribute. - */ -public interface MonitoredAttribute { - - /////////////////////////////////////// - // operations - -/** - * Gets the Monitored Attribute Info for the attribute. - * - * @return monitoredAttributeInfo for this Monitored Attribute. - */ - public MonitoredAttributeInfo getAttributeInfo(); -/** - * Sets the value for the Monitored Attribute if isWritable() is false, the - * method will throw ILLEGAL Operation exception. - * - * Also, the type of 'value' should be same as specified in the - * MonitoredAttributeInfo for a particular instance. - * - * @param value should be any one of the Basic Java Type Objects which are - * Long, Double, Float, String, Integer, Short, Character, Byte. - */ - public void setValue(Object value); - - -/** - * Gets the value of the Monitored Attribute. The value can be obtained - * from different parts of the module. User may choose to delegate the call - * to getValue() to other variables. - * - * NOTE: It is important to make sure that the type of Object returned in - * getvalue is same as the one specified in MonitoredAttributeInfo for this - * attribute. - * - * @return the current value for this MonitoredAttribute - */ - public Object getValue(); -/** - * Gets the name of the Monitored Attribute. - * - * @return name of this Attribute - */ - public String getName(); -/** - * If this attribute needs to be cleared, the user needs to implement this - * method to reset the state to initial state. If the Monitored Attribute - * doesn't change like for example (ConnectionManager High Water Mark), - * then clearState() is a No Op. - */ - public void clearState(); - -} // end MonitoredAttribute --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeBase.java 2018-01-30 20:22:15.000000000 -0500 +++ /dev/null 2018-01-30 20:22:15.000000000 -0500 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -import java.util.*; - -/** - * @author Hemanth Puttaswamy - * - * A Convenient class provided to help users extend and implement only - * getValue(), if there is no need to clear the state and the attribute is not - * writable. - */ -public abstract class MonitoredAttributeBase implements MonitoredAttribute { - String name; - MonitoredAttributeInfo attributeInfo; - /** - * Constructor. - */ - public MonitoredAttributeBase( String name, MonitoredAttributeInfo info ) { - this.name = name; - this.attributeInfo = info; - } - - - /** - * A Package Private Constructor for internal use only. - */ - MonitoredAttributeBase( String name ) { - this.name = name; - } - - - /** - * A Package Private convenience method for setting MonitoredAttributeInfo - * for this Monitored Attribute. - */ - void setMonitoredAttributeInfo( MonitoredAttributeInfo info ) { - this.attributeInfo = info; - } - - /** - * If the concrete class decides not to provide the implementation of this - * method, then it's OK. Some of the examples where we may decide to not - * provide the implementation is the connection state. Irrespective of - * the call to clearState, the connection state will be showing the - * currect state of the connection. - * NOTE: This method is only used to clear the Monitored Attribute state, - * not the real state of the system itself. - */ - public void clearState( ) { - } - - /** - * This method should be implemented by the concrete class. - */ - public abstract Object getValue( ); - - /** - * This method should be implemented by the concrete class only if the - * attribute is writable. If the attribute is not writable and if this - * method called, it will result in an IllegalStateException. - */ - public void setValue( Object value ) { - if( !attributeInfo.isWritable() ) { - throw new IllegalStateException( - "The Attribute " + name + " is not Writable..." ); - } - throw new IllegalStateException( - "The method implementation is not provided for the attribute " + - name ); - } - - - /** - * Gets the MonitoredAttributeInfo for the attribute. - */ - public MonitoredAttributeInfo getAttributeInfo( ) { - return attributeInfo; - } - - /** - * Gets the name of the attribute. - */ - public String getName( ) { - return name; - } -} // end MonitoredAttributeBase --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfo.java 2018-01-30 20:22:15.000000000 -0500 +++ /dev/null 2018-01-30 20:22:15.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -import java.util.*; - -/** - * @author Hemanth Puttaswamy - * - * Monitored AttributeInfo contains the meta information of the Monitored - * Attribute. - */ -public interface MonitoredAttributeInfo { - - /////////////////////////////////////// - // operations - -/** - * If the Attribute is writable from ASAdmin then isWritable() will return - * true. - * - * @return a boolean with true or false - */ - public boolean isWritable(); -/** - * isStatistic() is true if the attribute is presented as a Statistic. - * - * @return a boolean with true or false - */ - public boolean isStatistic(); -/** - * Class Type: We will allow only basic class types: - *
    - *
  1. Boolean
  2. - *
  3. Integer
  4. - *
  5. Byte
  6. - *
  7. Long
  8. - *
  9. Float
  10. - *
  11. Double
  12. - *
  13. String
  14. - *
  15. Character
  16. - *
- * - * @return a Class Type - */ - public Class type(); -/** - * Get's the description for the Monitored Attribute. - * - * @return a String with description - */ - public String getDescription(); - -} // end MonitoredAttributeInfo --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfoFactory.java 2018-01-30 20:22:16.000000000 -0500 +++ /dev/null 2018-01-30 20:22:16.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -/** - * @author Hemanth Puttaswamy - * - * MonitoredAttributeInfoFactory used mostly by internal classes. If the - * User needs to define some special MonitoredAttributes like a Character - * type Monitored Attribute, they can use this factory to build the meta - * information. - */ - -public interface MonitoredAttributeInfoFactory { - /** - * A Simple Factory Method to create the Monitored Attribute Info. - */ - MonitoredAttributeInfo createMonitoredAttributeInfo( String description, - Class type, boolean isWritable, boolean isStatistic ); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObject.java 2018-01-30 20:22:17.000000000 -0500 +++ /dev/null 2018-01-30 20:22:17.000000000 -0500 @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - - -import com.sun.corba.se.spi.monitoring.MonitoredAttribute; -import java.util.*; -import java.util.Collection; - -/** - * @author Hemanth Puttaswamy - * - * Monitored Object provides an Hierarchichal view of the ORB Monitoring - * System. It can contain multiple children and a single parent. Each - * Monitored Object may also contain Multiple Monitored Attributes. - */ -public interface MonitoredObject { - - /////////////////////////////////////// - // operations -/** - * Gets the name of this MonitoredObject - * - * @return a String with name of this Monitored Object - */ - public String getName(); -/** - * Gets the description of MonitoredObject - * - * @return a String with Monitored Object Description. - */ - public String getDescription(); -/** - * This method will add a child Monitored Object to this Monitored Object. - */ - public void addChild( MonitoredObject m ); -/** - * This method will remove child Monitored Object identified by the given name - * - * @param name of the ChildMonitored Object - */ - public void removeChild( String name ); - -/** - * Gets the child MonitoredObject associated with this MonitoredObject - * instance using name as the key. The name should be fully qualified name - * like orb.connectionmanager - * - * @return a MonitoredObject identified by the given name - * @param name of the ChildMonitored Object - */ - public MonitoredObject getChild(String name); -/** - * Gets all the Children registered under this instance of Monitored - * Object. - * - * @return Collection of immediate Children associated with this MonitoredObject. - */ - public Collection getChildren(); -/** - * Sets the parent for this Monitored Object. - */ - public void setParent( MonitoredObject m ); -/** - * There will be only one parent for an instance of MontoredObject, this - * call gets parent and returns null if the Monitored Object is the root. - * - * @return a MonitoredObject which is a Parent of this Monitored Object instance - */ - public MonitoredObject getParent(); - -/** - * Adds the attribute with the given name. - * - * @param value is the MonitoredAttribute which will be set as one of the - * attribute of this MonitoredObject. - */ - public void addAttribute(MonitoredAttribute value); -/** - * Removes the attribute with the given name. - * - * @param name is the MonitoredAttribute name - */ - public void removeAttribute(String name); - -/** - * Gets the Monitored Object registered by the given name - * - * @return a MonitoredAttribute identified by the given name - * @param name of the attribute - */ - public MonitoredAttribute getAttribute(String name); -/** - * Gets all the Monitored Attributes for this Monitored Objects. It doesn't - * include the Child Monitored Object, that needs to be traversed using - * getChild() or getChildren() call. - * - * @return Collection of all the Attributes for this MonitoredObject - */ - public Collection getAttributes(); -/** - * Clears the state of all the Monitored Attributes associated with the - * Monitored Object. It will also clear the state on all it's child - * Monitored Object. The call to clearState will be initiated from - * CORBAMBean.startMonitoring() call. - */ - public void clearState(); - -} // end MonitoredObject --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObjectFactory.java 2018-01-30 20:22:17.000000000 -0500 +++ /dev/null 2018-01-30 20:22:17.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -/** - * @author Hemanth Puttaswamy - * - * MonitoredObject Factory to create Monitored Object. - */ -public interface MonitoredObjectFactory { - /** - * A Simple Factory Method to create the Monitored Object. The name - * should be the leaf level name. - */ - MonitoredObject createMonitoredObject( String name, String description ); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringConstants.java 2018-01-30 20:22:18.000000000 -0500 +++ /dev/null 2018-01-30 20:22:18.000000000 -0500 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -public interface MonitoringConstants -{ - public static final String DEFAULT_MONITORING_ROOT = "orb"; - public static final String DEFAULT_MONITORING_ROOT_DESCRIPTION = - "ORB Management and Monitoring Root"; - - // - // Connection Monitoring - // - - public static final String CONNECTION_MONITORING_ROOT = - "Connections"; - public static final String CONNECTION_MONITORING_ROOT_DESCRIPTION = - "Statistics on inbound/outbound connections"; - - public static final String INBOUND_CONNECTION_MONITORING_ROOT = - "Inbound"; - public static final String INBOUND_CONNECTION_MONITORING_ROOT_DESCRIPTION= - "Statistics on inbound connections"; - - public static final String OUTBOUND_CONNECTION_MONITORING_ROOT = - "Outbound"; - public static final String OUTBOUND_CONNECTION_MONITORING_ROOT_DESCRIPTION= - "Statistics on outbound connections"; - - public static final String CONNECTION_MONITORING_DESCRIPTION = - "Connection statistics"; - - public static final String CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS = - "NumberOfConnections"; - public static final String CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS_DESCRIPTION = - "The total number of connections"; - public static final String CONNECTION_NUMBER_OF_IDLE_CONNECTIONS = - "NumberOfIdleConnections"; - public static final String CONNECTION_NUMBER_OF_IDLE_CONNECTIONS_DESCRIPTION = - "The number of idle connections"; - public static final String CONNECTION_NUMBER_OF_BUSY_CONNECTIONS = - "NumberOfBusyConnections"; - public static final String CONNECTION_NUMBER_OF_BUSY_CONNECTIONS_DESCRIPTION = - "The number of busy connections"; - - // - // ThreadPool and WorkQueue monitoring constants - // - - public static final String THREADPOOL_MONITORING_ROOT = "threadpool"; - public static final String THREADPOOL_MONITORING_ROOT_DESCRIPTION = - "Monitoring for all ThreadPool instances"; - public static final String THREADPOOL_MONITORING_DESCRIPTION = - "Monitoring for a ThreadPool"; - public static final String THREADPOOL_CURRENT_NUMBER_OF_THREADS = - "currentNumberOfThreads"; - public static final String THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION = - "Current number of total threads in the ThreadPool"; - public static final String THREADPOOL_NUMBER_OF_AVAILABLE_THREADS = - "numberOfAvailableThreads"; - public static final String THREADPOOL_NUMBER_OF_AVAILABLE_THREADS_DESCRIPTION = - "Number of available threads in the ThreadPool"; - public static final String THREADPOOL_NUMBER_OF_BUSY_THREADS = - "numberOfBusyThreads"; - public static final String THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION = - "Number of busy threads in the ThreadPool"; - public static final String THREADPOOL_AVERAGE_WORK_COMPLETION_TIME = - "averageWorkCompletionTime"; - public static final String THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION = - "Average elapsed time taken to complete a work item by the ThreadPool"; - public static final String THREADPOOL_CURRENT_PROCESSED_COUNT = - "currentProcessedCount"; - public static final String THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION = - "Number of Work items processed by the ThreadPool"; - - public static final String WORKQUEUE_MONITORING_DESCRIPTION = - "Monitoring for a Work Queue"; - public static final String WORKQUEUE_TOTAL_WORK_ITEMS_ADDED = - "totalWorkItemsAdded"; - public static final String WORKQUEUE_TOTAL_WORK_ITEMS_ADDED_DESCRIPTION = - "Total number of Work items added to the Queue"; - public static final String WORKQUEUE_WORK_ITEMS_IN_QUEUE = - "workItemsInQueue"; - public static final String WORKQUEUE_WORK_ITEMS_IN_QUEUE_DESCRIPTION = - "Number of Work items in the Queue to be processed"; - public static final String WORKQUEUE_AVERAGE_TIME_IN_QUEUE = - "averageTimeInQueue"; - public static final String WORKQUEUE_AVERAGE_TIME_IN_QUEUE_DESCRIPTION = - "Average time a work item waits in the work queue"; -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringFactories.java 2018-01-30 20:22:19.000000000 -0500 +++ /dev/null 2018-01-30 20:22:19.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -import com.sun.corba.se.impl.monitoring.MonitoredObjectFactoryImpl; -import com.sun.corba.se.impl.monitoring.MonitoredAttributeInfoFactoryImpl; -import com.sun.corba.se.impl.monitoring.MonitoringManagerFactoryImpl; - -/** - * @author Hemanth Puttaswamy - * - * This is used for getting the default factories for - * MonitoredObject, MonitoredAttributeInfo and MonitoringManager. We do not - * expect users to use the MonitoredAttributeInfo factory most of the time - * because the Info is automatically built by StringMonitoredAttributeBase - * and LongMonitoredAttributeBase. - */ -public class MonitoringFactories { - /////////////////////////////////////// - // attributes - private static final MonitoredObjectFactoryImpl monitoredObjectFactory = - new MonitoredObjectFactoryImpl( ); - private static final MonitoredAttributeInfoFactoryImpl - monitoredAttributeInfoFactory = - new MonitoredAttributeInfoFactoryImpl( ); - private static final MonitoringManagerFactoryImpl monitoringManagerFactory = - new MonitoringManagerFactoryImpl( ); - - - /////////////////////////////////////// - // operations - -/** - * Gets the MonitoredObjectFactory - * - * @return a MonitoredObjectFactory - */ - public static MonitoredObjectFactory getMonitoredObjectFactory( ) { - return monitoredObjectFactory; - } - -/** - * Gets the MonitoredAttributeInfoFactory. The user is not expected to use this - * Factory, since the MonitoredAttributeInfo is internally created by - * StringMonitoredAttributeBase, LongMonitoredAttributeBase and - * StatisticMonitoredAttribute. If User wants to create a MonitoredAttribute - * of some other special type like a DoubleMonitoredAttribute, they can - * build a DoubleMonitoredAttributeBase like LongMonitoredAttributeBase - * and build a MonitoredAttributeInfo required by MonitoredAttributeBase - * internally by using this Factory. - * - * @return a MonitoredAttributeInfoFactory - */ - public static MonitoredAttributeInfoFactory - getMonitoredAttributeInfoFactory( ) - { - return monitoredAttributeInfoFactory; - } - -/** - * Gets the MonitoredManagerFactory. The user is not expected to use this - * Factory, since the ORB will be automatically initialized with the - * MonitoringManager. - * - * User can get hold of MonitoringManager associated with ORB by calling - * orb.getMonitoringManager( ) - * - * @return a MonitoredManagerFactory - */ - public static MonitoringManagerFactory getMonitoringManagerFactory( ) { - return monitoringManagerFactory; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManager.java 2018-01-30 20:22:19.000000000 -0500 +++ /dev/null 2018-01-30 20:22:19.000000000 -0500 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -import java.io.Closeable; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.monitoring.MonitoredObject; -import java.util.*; - -/** - * Monitoring Manager will have a 1 to 1 association with the ORB. This - * gives access to the top level Monitored Object, using which more - * Monitored Objects and Attributes can be added and traversed. - * - * @author Hemanth Puttaswamy - */ -public interface MonitoringManager extends Closeable { - - /////////////////////////////////////// - // operations - -/** - * Gets the Root Monitored Object which contains a Hierarchy Of Monitored - * Objects exposing various Monitorable Attributes of Various modules. - */ - public MonitoredObject getRootMonitoredObject(); -/** - * Initialize is called whenever there is a start monitoring call to CORBA - * MBean. This will result in triaging initialize to all the - * MonitoredObjects and it's Monitored Attributes. - */ - public void clearState(); - -} // end MonitoringManager --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManagerFactory.java 2018-01-30 20:22:20.000000000 -0500 +++ /dev/null 2018-01-30 20:22:20.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -/** - * @author Hemanth Puttaswamy - * - * MonitoringObjectFactory is used internally by the ORB, It is not for - * general public use. - */ -public interface MonitoringManagerFactory { - /** - * A Simple Factory Method to create the Monitored Attribute Info. - */ - MonitoringManager createMonitoringManager( String nameOfTheRoot, - String description ); - - void remove(String nameOfTheRoot); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticMonitoredAttribute.java 2018-01-30 20:22:21.000000000 -0500 +++ /dev/null 2018-01-30 20:22:21.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -import java.util.*; - -/** - * @author Hemanth Puttaswamy - * - * StatisticsMonitoredAttribute is provided as a convenience to collect the - * Statistics of any entity. The getValue() call will be delegated to the - * StatisticsAccumulator set by the user. - */ -public class StatisticMonitoredAttribute extends MonitoredAttributeBase { - - - // Every StatisticMonitoredAttribute will have a StatisticAccumulator. User - // will use Statisticsaccumulator to accumulate the samples associated with - // this Monitored Attribute - private StatisticsAccumulator statisticsAccumulator; - - // Mutex is passed from the user class which is providing the sample values. - // getValue() and clearState() is synchronized on this user provided mutex - private Object mutex; - - - /////////////////////////////////////// - // operations - - -/** - * Constructs the StaisticMonitoredAttribute, builds the required - * MonitoredAttributeInfo with Long as the class type and is always - * readonly attribute. - * - * @param name Of this attribute - * @param desc should provide a good description on the kind of statistics - * collected, a good example is "Connection Response Time Stats will Provide the - * detailed stats based on the samples provided from every request completion - * time" - * @param s is the StatisticsAcumulator that user will use to accumulate the - * samples and this Attribute Object will get the computed statistics values - * from. - * @param mutex using which clearState() and getValue() calls need to be locked. - */ - public StatisticMonitoredAttribute(String name, String desc, - StatisticsAccumulator s, Object mutex) - { - super( name ); - MonitoredAttributeInfoFactory f = - MonitoringFactories.getMonitoredAttributeInfoFactory(); - MonitoredAttributeInfo maInfo = f.createMonitoredAttributeInfo( - desc, String.class, false, true ); - - this.setMonitoredAttributeInfo( maInfo ); - this.statisticsAccumulator = s; - this.mutex = mutex; - } // end StatisticMonitoredAttribute - - - -/** - * Gets the value from the StatisticsAccumulator, the value will be a formatted - * String with the computed statistics based on the samples accumulated in the - * Statistics Accumulator. - */ - public Object getValue( ) { - synchronized( mutex ) { - return statisticsAccumulator.getValue( ); - } - } - -/** - * Clears the state on Statistics Accumulator, After this call all samples are - * treated fresh and the old sample computations are disregarded. - */ - public void clearState( ) { - synchronized( mutex ) { - statisticsAccumulator.clearState( ); - } - } - -/** - * Gets the statistics accumulator associated with StatisticMonitoredAttribute. - * Usually, the user don't need to use this method as they can keep the handle - * to Accumulator to collect the samples. - */ - public StatisticsAccumulator getStatisticsAccumulator( ) { - return statisticsAccumulator; - } -} // end StatisticMonitoredAttribute --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticsAccumulator.java 2018-01-30 20:22:21.000000000 -0500 +++ /dev/null 2018-01-30 20:22:21.000000000 -0500 @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -import java.util.*; - -/** - * @author Hemanth Puttaswamy - * - * StatisticsAccumulator accumulates the samples provided by the user and - * computes the value of minimum, maximum, sum and sample square sum. When - * the StatisticMonitoredAttribute calls getValue(), it will compute all - * the statistics for the collected samples (Which are Minimum, Maximum, - * Average, StandardDeviation) and provides a nice printable record as a - * String. - * - * Users can easily extend this class and provide the implementation of - * toString() method to format the stats as desired. By default all the stats - * are printed in a single line. - */ -public class StatisticsAccumulator { - - /////////////////////////////////////// - // attributes - - - // Users can extend this class to get access to current Max value - protected double max = Double.MIN_VALUE; - - // Users can extend this class to get access to current Min value - protected double min = Double.MAX_VALUE; - - private double sampleSum; - - private double sampleSquareSum; - - private long sampleCount; - - protected String unit; - - - - /////////////////////////////////////// - // operations - - - -/** - * User will use this method to just register a sample with the - * StatisticsAccumulator. This is the only method that User will use to - * expose the statistics, internally the StatisticMonitoredAttribute will - * collect the information when requested from the ASAdmin. - * - * @param value a double value to make it more precise - */ - public void sample(double value) { - sampleCount++; - if( value < min ) min = value; - if( value > max) max = value; - sampleSum += value; - sampleSquareSum += (value * value); - } // end sample - - - - /** - * Computes the Standard Statistic Results based on the samples collected - * so far and provides the complete value as a formatted String - */ - public String getValue( ) { - return toString(); - } - - /** - * Users can extend StatisticsAccumulator to provide the complete - * Stats in the format they prefer, if the default format doesn't suffice. - */ - public String toString( ) { - return "Minimum Value = " + min + " " + unit + " " + - "Maximum Value = " + max + " " + unit + " " + - "Average Value = " + computeAverage() + " " + unit + " " + - "Standard Deviation = " + computeStandardDeviation() + " " + unit + - " " + "Samples Collected = " + sampleCount; - } - - /** - * If users choose to custom format the stats. - */ - protected double computeAverage( ) { - return (sampleSum / sampleCount); - } - - - /** - * We use a derived Standard Deviation formula to compute SD. This way - * there is no need to hold on to all the samples provided. - * - * The method is protected to let users extend and format the results. - */ - protected double computeStandardDeviation( ) { - double sampleSumSquare = sampleSum * sampleSum; - return Math.sqrt( - (sampleSquareSum-((sampleSumSquare)/sampleCount))/(sampleCount-1)); - } - -/** - * Construct the Statistics Accumulator by providing the unit as a String. - * The examples of units are "Hours", "Minutes", - * "Seconds", "MilliSeconds", "Micro Seconds" etc. - * - * @param unit a String representing the units for the samples collected - */ - public StatisticsAccumulator( String unit ) { - this.unit = unit; - sampleCount = 0; - sampleSum = 0; - sampleSquareSum = 0; - } - - - /** - * Clears the samples and starts fresh on new samples. - */ - void clearState( ) { - min = Double.MAX_VALUE; - max = Double.MIN_VALUE; - sampleCount = 0; - sampleSum = 0; - sampleSquareSum = 0; - } - - /** - * This is an internal API to test StatisticsAccumulator... - */ - public void unitTestValidate( String expectedUnit, double expectedMin, - double expectedMax, long expectedSampleCount, double expectedAverage, - double expectedStandardDeviation ) - { - if( !expectedUnit.equals( unit ) ){ - throw new RuntimeException( - "Unit is not same as expected Unit" + - "\nUnit = " + unit + "ExpectedUnit = " + expectedUnit ); - } - if( min != expectedMin ) { - throw new RuntimeException( - "Minimum value is not same as expected minimum value" + - "\nMin Value = " + min + "Expected Min Value = " + expectedMin); - } - if( max != expectedMax ) { - throw new RuntimeException( - "Maximum value is not same as expected maximum value" + - "\nMax Value = " + max + "Expected Max Value = " + expectedMax); - } - if( sampleCount != expectedSampleCount ) { - throw new RuntimeException( - "Sample count is not same as expected Sample Count" + - "\nSampleCount = " + sampleCount + "Expected Sample Count = " + - expectedSampleCount); - } - if( computeAverage() != expectedAverage ) { - throw new RuntimeException( - "Average is not same as expected Average" + - "\nAverage = " + computeAverage() + "Expected Average = " + - expectedAverage); - } - // We are computing Standard Deviation from two different methods - // for comparison. So, the values will not be the exact same to the last - // few digits. So, we are taking the difference and making sure that - // the difference is not greater than 1. - double difference = Math.abs( - computeStandardDeviation() - expectedStandardDeviation); - if( difference > 1 ) { - throw new RuntimeException( - "Standard Deviation is not same as expected Std Deviation" + - "\nStandard Dev = " + computeStandardDeviation() + - "Expected Standard Dev = " + expectedStandardDeviation); - } - } - - -} // end StatisticsAccumulator --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StringMonitoredAttributeBase.java 2018-01-30 20:22:22.000000000 -0500 +++ /dev/null 2018-01-30 20:22:22.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.monitoring; - -import java.util.*; - -/** - * @author Hemanth Puttaswamy - * - * A Convenient Abstraction to present String type Monitored Attribute. One - * of the examples of StringMonitoredAttribute is the State information. - */ -public abstract class StringMonitoredAttributeBase - extends MonitoredAttributeBase -{ - - /////////////////////////////////////// - // operations - - -/** - * Constructs StringMonitoredAttribute with the MonitoredAttributeInfo - * built with the class type of String. - * - * @param name of this attribute - * @param description of this attribute - */ - public StringMonitoredAttributeBase(String name, String description) { - super( name ); - MonitoredAttributeInfoFactory f = - MonitoringFactories.getMonitoredAttributeInfoFactory(); - MonitoredAttributeInfo maInfo = f.createMonitoredAttributeInfo( - description, String.class, false, false ); - this.setMonitoredAttributeInfo( maInfo ); - } // end StringMonitoredAttributeBase - - -} // end StringMonitoredAttributeBase --- old/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html 2018-01-30 20:22:23.000000000 -0500 +++ /dev/null 2018-01-30 20:22:23.000000000 -0500 @@ -1,302 +0,0 @@ - - - - - - package - - - -General Information -

Monitoring Framework SPI's is used internally by the ORB to instrument -for JMX based Management and Monitoring. The -
framework is very generic and easy to use and acts as facade to retrieve -the information from the running CORBA system. -

This framework helps in building a nice Hierarchical Structure of Monitored -Objects that contains Monitored Attributes. -
com.sun.corba.se.spi.orb.ORB has an API to get the RootMonitoredObject -and then User can traverse through the tree to -
either instrument or retrieve the information for Monitoring. -

-Code Snippet to Instrument Connection Monitored Object

-This example shows on how to instrument CorbaConnectionImpl 's attributes. -It exposes two -
attributes, namely -

1. Connection State -
2. Response time statistics to Appeserver Admin Console or CLI -
  -

-1. Instrumenting Connection State

-/** -
 *  Code Snippet to Instrument Connection Monitored Object -with -
 *  ConnectionState Monitored Attribute. Steps to follow -
 * -
 *  Step 1: Define a Monitored Attribute (ConnectionStateMonitoredAttribute) -Class by extending -
 *               -StringMonitoredAttributeBase -
 * -
 *  Step 2: Create Connection Manager Monitored Object and -add that to -
 *                -Root Monitored Object. -
 * -
 *  Step 3: Create Connection Monitored Object  and -add it to Connection Manager Monitored Object -
 * -
 *  Step 4: Instantiate Concrete Attribute (ConnectionStateMonitoredAttribute) -Class and add that to -
 *                -the Connection MonitoredObject -
 * -
 *  Step 5: Adds ConnectionMonitoredObject to ConnectionManagerMonitoredObject -
 * -
 */ -

/** -
  *  Step 1: Define a Monitored Attribute Class by extending -
  *                -StringMonitoredAttributeBase -
  */ -

/** -
  *  ConnectionState gets the value on demand. -
  */ -
#import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase -
#import com.sun.corba.se.spi.transport.CorbaConnection; -

public class ConnectionStateMonitoredAttribute extends StringMonitoredAttributeBase -
{ -
    CorbaConnection connection; -
    public ConnectionInUseMonitoredAttribute( String -name, String desc, -
        CorbaConnection con ) -
    { -
        super( name, desc ); -
        connection = con; -
    } -

    public Object getValue( ) { -
        // Delegate the getValue -call to connection -
        // so, there is no state -maintained in this attribute object itself -
        // and also the locking -will be the responsibility of Connection -
        // Object. By doing this -we will avoid global locking and possibly -
        // avoiding the bottleneck -
        return connection.getState( -); -
    } -

    // IMPORTANT: In this case we don't have to implement -clearState() method -
    // If there is a need to implement this method like -for POACounter, the -
    // call again can be delegated to the Object which -maintains the real -
    // state. clearState() is invoked whenever there -is a call to CORBAMBean.startMonitoring() -
} -
  -

/** -
 *  Step 2: Create Connection Manager Monitored Object and -add that to -
 *          Root -Monitored Object. -
 */ -
import com.sun.corba.se.spi.monitoring.MonitoringFactories; -
import com.sun.corba.se.spi.monitoring.MonitoredObject; -

private static MonitoredObject connectionManagerMonitoredObject; -
private static MonitoredObject connectionMonitoredObject; -
  -

    private void instrumentConnectionManager( ) { -
        connectionManagerMonitoredObject -= -
            -MonitoringFactories.getMonitoredObjectFactory().createMonitoredObject( -
                -"ConnectionManagerMonitoredObject", -
                -"Used to Monitor the stats on All IIOP Connections " ); -
        orb.getRootMonitoredObject().addChild(connectionManagerMonitoredObject -); -
    } -
  -

/** -
  *  Step 3: Create Connection Monitored Object  and -add it to Connection Manager Monitored Object -
  * -
  *  Step 4: Instantiate Concrete Attribute (ConnectionStateMonitoredAttribute) -Class and add that to -
  *                -the Connection MonitoredObject -
  * -
  *  Step 5: Add ConnectionMonitoredObject to ConnectionManagerMonitoredObject -
  */ -
private void instrumentConnectionObject( CorbConnection connection -) { -
    // Step 3 -
    MonitoredObject connectionMonitoredObject = -
        MonitoringFactories.getMonitoredObjectFactory().createMonitoredObject( -
            -connection.getName(), -
            -"Used to Monitor the stats on one connection" ); -
    // Step 4 -
    ConnectionStateMonitoredAttribute connectionState -= -
        new ConnectionStateMonitoredAttribute( -"Connection_State", -
            -"Provides the state of the IIOP Connection ...",  connection ); -
    connectionMonitoredObject.addAttribute( connectionState -); -
    // Step 5 -
    connectionManagerMonitoredObject.addChild( connectionMonitoredObject -); -
} -
  -
  -

Code Snippet to Instrument A Statistic Type Monitored -Attribute -

/** -
  *  Assuming ConnectionMonitoredObject is already added -to the MonitoredObject Hierarchy. -
  *  This example code shows how to instrument ConnectionMonitoredObject -with a new -
  *   StatisticMonitoredAttribute. -
  * -
  *    IMPORTANT: StatisticsMonitoredAttribute -is mostly write mostly and read sparingly, i.e., -
  *    the frequency of writes(Collecting samples) -is high.  It is the responsibility of user to synchronize -
  *    the sample() method and the StatisticMonitoredAttribute -will synchronize clearState() and -
  *    getValue() using the mutex object sent. -
  */ -
private void instrumentStatsToConnectionObject( MonitoredObject connectionMonitoredObject  -) { -
     // Step 4 -
    StatisticsAccumulator connectRequestStatsAccumulator -= -
        // Microseconds is the unit -used for statistics measure -
        new StatisticsAccumulator( -"Micro Seconds" ); -

    // Pass Name, Description, Statistic Accumulator -Instance, Mutex (The -
    // Object on which we need to synchronize for stats -sample collection) -
    StatisticMonitoredAttribute sm = new StatisticMonitoredAttribute( -
        connection.getName() + "Stats", -
        "Connection Request Stats", -connectRequestStatsAccumulator, this ); -

    connectionMonitoredObject.addAttribute( sm ); -
  -

    // Now, The user can accumulate the samples by calling -into -
    // connectRequestStatsAccumulator.sample( <value> -); -
    // Finally When ASAdmin request for the value of -this Stats Monitored Attribute -
    // by using standard getValue() call. It will return -a formatted Stats Value like -
    //  For Example -
    // -
    //  Minimum Value = 200 Microseconds -
    //  Maximum Value = 928 Microseconds -
    //  Average Value = 523 Microseconds -
    //  Standard Deviation = 53.72 Microseconds -
    //  Sample Collected = 435 -

} -

Caution On Global Locking (Synchronization): -

It's important to make sure that collecting Stats and other state information -for monitoring doesn't impact performance. Please look at the following -don'ts -
to understand better. -

Do not add a special mutex for synchronizing MonitoredObject: -
Let's take an example of exposing a counter that counts Requests on -this connection and 2 possible ways of doing this -
1. Define Counter by extending LongMonitoredAttributeBase -
     public class Counter extends LongMonitoredAttributeBase -{ -
        private long counter; -
  -
        Counter( String name, String -desc ) { -
            -super( name, desc ); -
        } -
  -
         public synchronized -void increment( ) { -
              -counter++; -
         } -

          public synchronized -Object getValue( ) { -
              -return new Long( counter ); -
          } -
    } -
  -

2. Or Define a RequestCounter by extending LongMonitoredAttributeBase -again, but no special -
    synchronization is done -

    public class RequestCounter extends LongMonitoredAttributeBase -{ -
        private CorbaConnection -connection; -
        RequestCounter( String name, -String desc, CorbaConnection con ) { -
            -super( name, desc ); -
            -connection = con; -
        } -

        public Object getValue( ) -{ -
            -return connection.getRequestCount( ); -
       } -
    } -

    The problem with Alternative (1) is that there may -be unneccesary extra synchronization happening for every method and it -may become a bottle neck -
     particularly if this object is accessed quite -often. In Alternative (2), the synchronization happens only in the Connection -object and no special sync -
     is required in the RequestCounter object. -
  -

Important Thing To Know On StatisticMonitoredAttribute -type: -
The clearState() and getValue() call will be synchronized using the -mutex passed by the external object, but sample() method in StatisticsAccumulator -
is not synchronized. It is the responsibility of user to synchronize -to make sure that the samples collected (The mutex passed into the StatisticsAccumulator must be the one used to synchronize calls to sample() ). -
  -

@since JDK1.5 @serial exclude - - --- old/src/java.corba/share/classes/com/sun/corba/se/spi/oa/NullServant.java 2018-01-30 20:22:23.000000000 -0500 +++ /dev/null 2018-01-30 20:22:23.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.oa ; - -import org.omg.CORBA.SystemException ; - -/** NullServant is used to represent a null servant returned - * OAInvocationInfo after a - * ObjectAdapter.getInvocationServant( OAInvocationInfo ) call. - * If the getInvocationServant call could not locate a servant - * for the ObjectId in the OAInvocationInfo, getServantContainer - * will contain a NullServant. Later stages of the request - * dispatch may choose either to throw the exception or perform - * some other action in response to the NullServant result. - */ -public interface NullServant -{ - /** Obtain the exception that is associated with this - * NullServant instance. - */ - SystemException getException() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADefault.java 2018-01-30 20:22:24.000000000 -0500 +++ /dev/null 2018-01-30 20:22:24.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.oa ; - -import com.sun.corba.se.impl.oa.poa.POAFactory ; -import com.sun.corba.se.impl.oa.toa.TOAFactory ; -import com.sun.corba.se.spi.orb.ORB ; - -/** OADefault provides methods to create the standard ObjectAdapterFactory - * instances for this version of the ORB. These methods are generally - * used in ORBConfigurator instances to construct an ORB instance. - */ -public class OADefault { - public static ObjectAdapterFactory makePOAFactory( ORB orb ) - { - ObjectAdapterFactory oaf = new POAFactory() ; - oaf.init( orb ) ; - return oaf ; - } - - public static ObjectAdapterFactory makeTOAFactory( ORB orb ) - { - ObjectAdapterFactory oaf = new TOAFactory() ; - oaf.init( orb ) ; - return oaf ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADestroyed.java 2018-01-30 20:22:25.000000000 -0500 +++ /dev/null 2018-01-30 20:22:25.000000000 -0500 @@ -1,31 +0,0 @@ -/* - * Copyright (c) 1997, 2002, 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.corba.se.spi.oa; - -/** This exception is thrown when an operation on an ObjectAdapter - * fails because the ObjectAdapter was destroyed during the operation. - */ -public class OADestroyed extends java.lang.Exception { -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OAInvocationInfo.java 2018-01-30 20:22:25.000000000 -0500 +++ /dev/null 2018-01-30 20:22:25.000000000 -0500 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.spi.oa; - -import javax.rmi.CORBA.Tie ; - -import org.omg.CORBA.portable.ServantObject; - -import org.omg.PortableServer.Servant; - -import org.omg.PortableServer.ServantLocatorPackage.CookieHolder; - -import com.sun.corba.se.spi.oa.ObjectAdapter ; -import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ; - -/** This class is a holder for the information required to implement POACurrent. -* It is also used for the ServantObject that is returned by _servant_preinvoke calls. -* This allows us to avoid allocating an extra object on each collocated invocation. -*/ -public class OAInvocationInfo extends ServantObject { - // This is the container object for the servant. - // In the RMI-IIOP case, it is the RMI-IIOP Tie, and the servant is the - // target of the Tie. - // In all other cases, it is the same as the Servant. - private java.lang.Object servantContainer ; - - // These fields are to support standard OMG APIs. - private ObjectAdapter oa; - private byte[] oid; - - // These fields are to support the Object adapter implementation. - private CookieHolder cookieHolder; - private String operation; - - // This is the copier to be used by javax.rmi.CORBA.Util.copyObject(s) - // For the current request. - private ObjectCopierFactory factory ; - - public OAInvocationInfo(ObjectAdapter oa, byte[] id ) - { - this.oa = oa; - this.oid = id; - } - - // Copy constructor of sorts; used in local optimization path - public OAInvocationInfo( OAInvocationInfo info, String operation ) - { - this.servant = info.servant ; - this.servantContainer = info.servantContainer ; - this.cookieHolder = info.cookieHolder ; - this.oa = info.oa; - this.oid = info.oid; - this.factory = info.factory ; - - this.operation = operation; - } - - //getters - public ObjectAdapter oa() { return oa ; } - public byte[] id() { return oid ; } - public Object getServantContainer() { return servantContainer ; } - - // Create CookieHolder on demand. This is only called by a single - // thread, so no synchronization is needed. - public CookieHolder getCookieHolder() - { - if (cookieHolder == null) - cookieHolder = new CookieHolder() ; - - return cookieHolder; - } - - public String getOperation() { return operation; } - public ObjectCopierFactory getCopierFactory() { return factory; } - - //setters - public void setOperation( String operation ) { this.operation = operation ; } - public void setCopierFactory( ObjectCopierFactory factory ) { this.factory = factory ; } - - public void setServant(Object servant) - { - servantContainer = servant ; - if (servant instanceof Tie) - this.servant = ((Tie)servant).getTarget() ; - else - this.servant = servant; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapter.java 2018-01-30 20:22:26.000000000 -0500 +++ /dev/null 2018-01-30 20:22:26.000000000 -0500 @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.spi.oa ; - -import org.omg.CORBA.Policy ; - -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ObjectReferenceFactory ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.oa.OADestroyed ; - -import com.sun.corba.se.spi.ior.IORTemplate ; - -// REVISIT: What should the order be? enter/push...pop/exit? - -/** ObjectAdapter represents the abstract model of an object -* adapter that was introduced by ORT. This means that all -* object adapters must: -*

    -*
  • Have an ORB
  • -*
  • Have a name
  • -*
  • Have an adapter manager (represented by an ID)
  • -*
  • Have an adapter template
  • -*
  • Support getting and setting their ObjectReferenceFactory
  • -*
  • Provide access to their current state
  • -*
  • Support adding components to their profiles expressed in the adapter template
  • -*
-* Other requirements: -*
    -*
  • All object adapters must invoke ORB.AdapterCreated when they are created. -*
  • -*
  • All adapter managers must invoke ORB.AdapterManagerStateChanged when -* their state changes, mapping the internal state to an ORT state.
  • -*
  • AdapterStateChanged must be invoked (from somewhere) whenever -* an adapter state changes that is not due to an adapter manager state change.
  • -*
-*

-* Object adapters must also provide mechanisms for: -*

    -*
  • Managing object reference lifecycle
  • -*
  • Controlling how servants are associated with object references
  • -*
  • Manage the state of the adapter, if the adapter desires to implement such mechanisms
  • -*
-* Such mechanisms are all object adapter specific, and so we do not attempt to -* create general APIs for these functions here. The object adapter itself -* must provide these APIs directly to the user, and they do not affect the rest of the -* ORB. This interface basically makes it possible to plug any object adapter into the -* ORB and have the OA work propertly with portable interceptors, and also have requests -* dispatched properly to the object adapter. -*

-* The basic function of an ObjectAdapter is to map object IDs to servants and to support -* the dispatch operation of the subcontract, which dispatches requests to servants. -* This is the purpose of the getInvocationServant method. In addition, ObjectAdapters must be -* able to change state gracefully in the presence of executing methods. This -* requires the use of the enter/exit methods. Finally, ObjectAdapters often -* require access to information about requests. This is accomodated through the -* OAInvocationInfo class and the thread local stack maintained by push/pop/peekInvocationInfo -* on the ORB. -*

-* To be useful, this dispatch cycle must be extremely efficient. There are several -* scenarios that matter: -*

    -*
  1. A remote invocation, where the dispatch is handled in the server subcontract.
  2. -*
  3. A local invocation, where the dispatch is handled in the client subcontract.
  4. -*
  5. A cached local invocation, where the servant is cached when the IOR is established -* for the client subcontract, and the dispatch is handled in the client subcontract -* to the cached subcontract.
  6. -*
-*

-* Each of these 3 cases is handled a bit differently. On each request, assume as known -* ObjectId and ObjectAdapterId, which can be obtained from the object key. -* The ObjectAdaptorFactory is available in the subcontract registry, where it is -* registered under the subcontract ID. The Subcontract ID is also available in the -* object key. -*

    -*
  1. The remote pattern: -*
      -*
    1. oa = oaf.find( oaid )
    2. -*
    3. oa.enter()
    4. -*
    5. info = oa.makeInvocationInfo( oid )
    6. -*
    7. info.setOperation( operation )
    8. -*
    9. push info
    10. -*
    11. oa.getInvocationServant( info )
    12. -*
    13. sreq.setExecuteReturnServantInResponseConstructor( true )
    14. -*
    15. dispatch to servant
    16. -*
    17. oa.returnServant()
    18. -*
    19. oa.exit()
    20. -*
    21. pop info
    22. -*
    -*
  2. -* -*
  3. The local pattern: -*
      -*
    1. oa = oaf.find( oaid )
    2. -*
    3. oa.enter()
    4. -*
    5. info = oa.makeInvocationInfo( oid )
    6. -*
    7. info.setOperation( operation )
    8. -*
    9. push info
    10. -*
    11. oa.getInvocationServant( info )
    12. -*
    13. dispatch to servant
    14. -*
    15. oa.returnServant()
    16. -*
    17. oa.exit()
    18. -*
    19. pop info
    20. -*
    -*
  4. -* -*
  5. The fast local pattern: When delegate is constructed, -* first extract ObjectKey from IOR in delegate, -* then get ObjectId, ObjectAdapterId, and ObjectAdapterFactory (oaf). Then: -*
      -*
    1. oa = oaf.find( oaid )
    2. -*
    3. info = oa.makeInvocationInfo( oid ) (note: no operation!)
    4. -*
    5. push info (needed for the correct functioning of getInvocationServant)
    6. -*
    7. oa.getInvocationServant( info )
    8. -*
    9. pop info -*
    -* The info instance (which includes the Servant) is cached in the client subcontract. -*

    Then, on each invocation: -*

      -*
    1. newinfo = copy of info (clone)
    2. -*
    3. info.setOperation( operation )
    4. -*
    5. push newinfo
    6. -*
    7. oa.enter()
    8. -*
    9. dispatch to servant
    10. -*
    11. oa.returnServant()
    12. -*
    13. oa.exit()
    14. -*
    15. pop info
    16. -*
    -*
  6. -*
-* XXX fast local should not call returnServant: what is correct here? -*/ -public interface ObjectAdapter -{ - //////////////////////////////////////////////////////////////////////////// - // Basic methods for supporting interceptors - //////////////////////////////////////////////////////////////////////////// - - /** Returns the ORB associated with this adapter. - */ - ORB getORB() ; - - Policy getEffectivePolicy( int type ) ; - - /** Returns the IOR template of this adapter. The profiles - * in this template may be updated only during the AdapterCreated call. - * After that call completes, the IOR template must be made immutable. - * Note that the server ID, ORB ID, and adapter name are all available - * from the IOR template. - */ - IORTemplate getIORTemplate() ; - - //////////////////////////////////////////////////////////////////////////// - // Methods needed to support ORT. - //////////////////////////////////////////////////////////////////////////// - - /** Return the ID of the AdapterManager for this object adapter. - */ - int getManagerId() ; - - /** Return the current state of this object adapter (see - * org.omg.PortableInterceptors for states. - */ - short getState() ; - - ObjectReferenceTemplate getAdapterTemplate() ; - - ObjectReferenceFactory getCurrentFactory() ; - - /** Change the current factory. This may only be called during the - * AdapterCreated call. - */ - void setCurrentFactory( ObjectReferenceFactory factory ) ; - - //////////////////////////////////////////////////////////////////////////// - // Methods required for dispatching to servants - //////////////////////////////////////////////////////////////////////////// - - /** Get the servant corresponding to the given objectId, if this is supported. - * This method is only used for models where the servant is an ObjectImpl, - * which allows the servant to be used directly as the stub. This allows an object - * reference to be replaced by its servant when it is unmarshalled locally. - * Such objects are not ORB mediated. - */ - org.omg.CORBA.Object getLocalServant( byte[] objectId ) ; - - /** Get the servant for the request given by the parameters. - * info must contain a valid objectId in this call. - * The servant is set in the InvocationInfo argument that is passed into - * this call. - * @param info is the InvocationInfo object for the object reference - * @exception ForwardException (a runtime exception) is thrown if the request - * is to be handled by a different object reference. - */ - void getInvocationServant( OAInvocationInfo info ) ; - - /** enter must be called before each request is invoked on a servant. - * @exception OADestroyed is thrown when an OA has been destroyed, which - * requires a retry in the case where an AdapterActivator is present. - */ - void enter( ) throws OADestroyed ; - - /** exit must be called after each request has been completed. If enter - * is called, there must always be a corresponding exit. - */ - void exit( ) ; - - /** Must be called every time getInvocationServant is called after - * the request has completed. - */ - public void returnServant() ; - - /** Create an instance of InvocationInfo that is appropriate for this - * Object adapter. - */ - OAInvocationInfo makeInvocationInfo( byte[] objectId ) ; - - /** Return the most derived interface for the given servant and objectId. - */ - String[] getInterfaces( Object servant, byte[] objectId ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterBase.java 2018-01-30 20:22:27.000000000 -0500 +++ /dev/null 2018-01-30 20:22:27.000000000 -0500 @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.spi.oa ; - -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.ObjectReferenceFactory ; - -import org.omg.CORBA.Policy ; - -import org.omg.PortableInterceptor.ACTIVE ; - -import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ; -import com.sun.corba.se.spi.ior.IORFactories ; -import com.sun.corba.se.spi.ior.IORTemplate ; -import com.sun.corba.se.spi.ior.ObjectAdapterId; -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.spi.oa.OADestroyed ; -import com.sun.corba.se.spi.oa.ObjectAdapter ; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.protocol.PIHandler ; - -import com.sun.corba.se.impl.logging.POASystemException ; -import com.sun.corba.se.impl.logging.OMGSystemException ; -import com.sun.corba.se.impl.oa.poa.Policies; - -abstract public class ObjectAdapterBase extends org.omg.CORBA.LocalObject - implements ObjectAdapter -{ - private ORB orb; - - // Exception wrappers - private final POASystemException _iorWrapper ; - private final POASystemException _invocationWrapper ; - private final POASystemException _lifecycleWrapper ; - private final OMGSystemException _omgInvocationWrapper ; - private final OMGSystemException _omgLifecycleWrapper ; - - // Data related to the construction of object references and - // supporting the Object Reference Template. - private IORTemplate iortemp; - private byte[] adapterId ; - private ObjectReferenceTemplate adapterTemplate ; - private ObjectReferenceFactory currentFactory ; - - public ObjectAdapterBase( ORB orb ) - { - this.orb = orb ; - _iorWrapper = POASystemException.get( orb, - CORBALogDomains.OA_IOR ) ; - _lifecycleWrapper = POASystemException.get( orb, - CORBALogDomains.OA_LIFECYCLE ) ; - _omgLifecycleWrapper = OMGSystemException.get( orb, - CORBALogDomains.OA_LIFECYCLE ) ; - _invocationWrapper = POASystemException.get( orb, - CORBALogDomains.OA_INVOCATION ) ; - _omgInvocationWrapper = OMGSystemException.get( orb, - CORBALogDomains.OA_INVOCATION ) ; - } - - public final POASystemException iorWrapper() - { - return _iorWrapper ; - } - - public final POASystemException lifecycleWrapper() - { - return _lifecycleWrapper ; - } - - public final OMGSystemException omgLifecycleWrapper() - { - return _omgLifecycleWrapper ; - } - - public final POASystemException invocationWrapper() - { - return _invocationWrapper ; - } - - public final OMGSystemException omgInvocationWrapper() - { - return _omgInvocationWrapper ; - } - - /* - * This creates the complete template. - * When it is done, reference creation can proceed. - */ - final public void initializeTemplate( ObjectKeyTemplate oktemp, - boolean notifyORB, Policies policies, String codebase, - String objectAdapterManagerId, ObjectAdapterId objectAdapterId) - { - adapterId = oktemp.getAdapterId() ; - - iortemp = IORFactories.makeIORTemplate(oktemp) ; - - // This calls acceptors which create profiles and may - // add tagged components to those profiles. - orb.getCorbaTransportManager().addToIORTemplate( - iortemp, policies, - codebase, objectAdapterManagerId, objectAdapterId); - - adapterTemplate = IORFactories.makeObjectReferenceTemplate( orb, - iortemp ) ; - currentFactory = adapterTemplate ; - - if (notifyORB) { - PIHandler pih = orb.getPIHandler() ; - if (pih != null) - // This runs the IORInterceptors. - pih.objectAdapterCreated( this ) ; - } - - iortemp.makeImmutable() ; - } - - final public org.omg.CORBA.Object makeObject( String repId, byte[] oid ) - { - return currentFactory.make_object( repId, oid ) ; - } - - final public byte[] getAdapterId() - { - return adapterId ; - } - - final public ORB getORB() - { - return orb ; - } - - abstract public Policy getEffectivePolicy( int type ) ; - - final public IORTemplate getIORTemplate() - { - return iortemp ; - } - - abstract public int getManagerId() ; - - abstract public short getState() ; - - final public ObjectReferenceTemplate getAdapterTemplate() - { - return adapterTemplate ; - } - - final public ObjectReferenceFactory getCurrentFactory() - { - return currentFactory ; - } - - final public void setCurrentFactory( ObjectReferenceFactory factory ) - { - currentFactory = factory ; - } - - abstract public org.omg.CORBA.Object getLocalServant( byte[] objectId ) ; - - abstract public void getInvocationServant( OAInvocationInfo info ) ; - - abstract public void returnServant() ; - - abstract public void enter() throws OADestroyed ; - - abstract public void exit() ; - - abstract protected ObjectCopierFactory getObjectCopierFactory() ; - - // Note that all current subclasses share the same implementation of this method, - // but overriding it would make sense for OAs that use a different InvocationInfo. - public OAInvocationInfo makeInvocationInfo( byte[] objectId ) - { - OAInvocationInfo info = new OAInvocationInfo( this, objectId ) ; - info.setCopierFactory( getObjectCopierFactory() ) ; - return info ; - } - - abstract public String[] getInterfaces( Object servant, byte[] objectId ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterFactory.java 2018-01-30 20:22:27.000000000 -0500 +++ /dev/null 2018-01-30 20:22:27.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2001, 2003, 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.corba.se.spi.oa ; - -import com.sun.corba.se.spi.oa.ObjectAdapter ; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.ior.ObjectAdapterId ; - -public interface ObjectAdapterFactory { - /** Initialize this object adapter factory instance. - */ - void init( ORB orb ) ; - - /** Shutdown all object adapters and other state associated - * with this factory. - */ - void shutdown( boolean waitForCompletion ) ; - - /** Find the ObjectAdapter instance that corresponds to the - * given ObjectAdapterId. - */ - ObjectAdapter find( ObjectAdapterId oaid ) ; - - ORB getORB() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orb/DataCollector.java 2018-01-30 20:22:28.000000000 -0500 +++ /dev/null 2018-01-30 20:22:28.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.spi.orb ; - -import java.applet.Applet ; -import java.util.Properties ; -import java.util.Vector ; - -/** Interface for collecting all sources of ORB configuration properties - * into a single properties object. A PropertyParser is needed so that - * the set of property names of interest is known. - */ -public interface DataCollector { - /** Return true iff this DataCollector was created from - * applet data. - */ - boolean isApplet() ; - - /** Return true iff the local host and ORB initial host are the same. - * This is provided to avoid exposing the local host in insecure - * contexts. - */ - boolean initialHostIsLocal() ; - - /** Set the parser which is used to obtain property names. - * This must be called before getProperties - * may be called. It may be called multiple times if different - * sets of properties are needed for the same data sources. - */ - void setParser( PropertyParser parser ) ; - - /** Return the consolidated property information to be used - * for ORB configuration. Note that -ORBInitRef arguments are - * handled specially: all -ORBInitRef name=value arguments are - * converted into ( org.omg.CORBA.ORBInitRef.name, value ) - * mappings in the resulting properties. Also, -ORBInitialServices - * is handled specially in applet mode: they are converted from - * relative to absolute URLs. - * @throws IllegalStateException if setPropertyNames has not - * been called. - */ - Properties getProperties() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORB.java 2018-01-30 20:22:29.000000000 -0500 +++ /dev/null 2018-01-30 20:22:29.000000000 -0500 @@ -1,511 +0,0 @@ -/* - * Copyright (c) 2002, 2017, 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.corba.se.spi.orb; - -import java.util.Map ; -import java.util.HashMap ; -import java.util.Properties ; -import java.util.concurrent.ConcurrentHashMap; -import java.util.logging.Logger ; - -import org.omg.CORBA.TCKind ; - -import com.sun.corba.se.pept.broker.Broker ; -import com.sun.corba.se.pept.transport.ByteBufferPool; - -import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ; -import com.sun.corba.se.spi.protocol.ClientDelegateFactory ; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; -import com.sun.corba.se.spi.protocol.PIHandler ; -import com.sun.corba.se.spi.resolver.LocalResolver ; -import com.sun.corba.se.spi.resolver.Resolver ; -import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ; -import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager; -import com.sun.corba.se.spi.monitoring.MonitoringConstants; -import com.sun.corba.se.spi.monitoring.MonitoringManager; -import com.sun.corba.se.spi.monitoring.MonitoringFactories; - -import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ; -import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ; -import com.sun.corba.se.spi.ior.ObjectKey ; -import com.sun.corba.se.spi.ior.ObjectKeyFactory ; -import com.sun.corba.se.spi.ior.IOR ; - -import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager; - -import com.sun.corba.se.spi.oa.OAInvocationInfo ; -import com.sun.corba.se.spi.transport.CorbaTransportManager; - -import com.sun.corba.se.spi.logging.LogWrapperFactory ; -import com.sun.corba.se.spi.logging.LogWrapperBase ; -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.spi.copyobject.CopierManager ; - -import com.sun.corba.se.spi.presentation.rmi.PresentationManager ; -import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ; - -import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ; - -// XXX needs an SPI or else it does not belong here -import com.sun.corba.se.impl.corba.TypeCodeImpl ; -import com.sun.corba.se.impl.corba.TypeCodeFactory ; - -// XXX Should there be a SPI level constants ? -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ; - -import com.sun.corba.se.impl.transport.ByteBufferPoolImpl; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.logging.OMGSystemException ; - -import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ; - -public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB - implements Broker, TypeCodeFactory -{ - // As much as possible, this class should be stateless. However, - // there are a few reasons why it is not: - // - // 1. The ORB debug flags are defined here because they are accessed - // frequently, and we do not want a cast to the impl just for that. - // 2. typeCodeMap and primitiveTypeCodeConstants are here because they - // are needed in both ORBImpl and ORBSingleton. - // 3. Logging support is here so that we can avoid problems with - // incompletely initialized ORBs that need to perform logging. - - // Flag set at compile time to debug flag processing: this can't - // be one of the xxxDebugFlags because it is used to debug the mechanism - // that sets the xxxDebugFlags! - public static boolean ORBInitDebug = false; - - // Currently defined debug flags. Any additions must be called xxxDebugFlag. - // All debug flags must be public boolean types. - // These are set by passing the flag -ORBDebug x,y,z in the ORB init args. - // Note that x,y,z must not contain spaces. - public boolean transportDebugFlag = false ; - public boolean subcontractDebugFlag = false ; - public boolean poaDebugFlag = false ; - public boolean poaConcurrencyDebugFlag = false ; - public boolean poaFSMDebugFlag = false ; - public boolean orbdDebugFlag = false ; - public boolean namingDebugFlag = false ; - public boolean serviceContextDebugFlag = false ; - public boolean transientObjectManagerDebugFlag = false ; - public boolean giopVersionDebugFlag = false; - public boolean shutdownDebugFlag = false; - public boolean giopDebugFlag = false; - public boolean invocationTimingDebugFlag = false ; - public boolean orbInitDebugFlag = false ; - - // SystemException log wrappers. Protected so that they can be used in - // subclasses. - protected static ORBUtilSystemException staticWrapper ; - protected ORBUtilSystemException wrapper ; - protected OMGSystemException omgWrapper ; - - // This map is needed for resolving recursive type code placeholders - // based on the unique repository id. - // XXX Should this be a WeakHashMap for GC? - private Map typeCodeMap; - - private TypeCodeImpl[] primitiveTypeCodeConstants; - - // ByteBufferPool - needed by both ORBImpl and ORBSingleton - ByteBufferPool byteBufferPool; - - // Local testing - // XXX clean this up, probably remove these - public abstract boolean isLocalHost( String hostName ) ; - public abstract boolean isLocalServerId( int subcontractId, int serverId ) ; - - // Invocation stack manipulation - public abstract OAInvocationInfo peekInvocationInfo() ; - public abstract void pushInvocationInfo( OAInvocationInfo info ) ; - public abstract OAInvocationInfo popInvocationInfo() ; - - public abstract CorbaTransportManager getCorbaTransportManager(); - public abstract LegacyServerSocketManager getLegacyServerSocketManager(); - - // wrapperMap maintains a table of LogWrapper instances used by - // different classes to log exceptions. The key is a StringPair - // representing LogDomain and ExceptionGroup. - private Map wrapperMap; - - static class Holder { - static final PresentationManager defaultPresentationManager = - setupPresentationManager(); - } - - private static Map staticWrapperMap = - new ConcurrentHashMap<>(); - - protected MonitoringManager monitoringManager; - - private static PresentationManager setupPresentationManager() { - staticWrapper = ORBUtilSystemException.get( - CORBALogDomains.RPC_PRESENTATION ) ; - - boolean useDynamicStub = false; - - PresentationManager.StubFactoryFactory dynamicStubFactoryFactory = null; - - PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ; - pm.setStubFactoryFactory( false, - PresentationDefaults.getStaticStubFactoryFactory() ) ; - pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ; - return pm; - } - - public void destroy() { - wrapper = null; - omgWrapper = null; - typeCodeMap = null; - primitiveTypeCodeConstants = null; - byteBufferPool = null; - } - - /** Get the single instance of the PresentationManager - */ - public static PresentationManager getPresentationManager() - { - return Holder.defaultPresentationManager; - } - - /** Get the appropriate StubFactoryFactory. This - * will be dynamic or static depending on whether - * com.sun.CORBA.ORBUseDynamicStub is true or false. - */ - public static PresentationManager.StubFactoryFactory - getStubFactoryFactory() - { - PresentationManager gPM = getPresentationManager(); - boolean useDynamicStubs = gPM.useDynamicStubs() ; - return gPM.getStubFactoryFactory( useDynamicStubs ) ; - } - - protected ORB() - { - // Initialize logging first, since it is needed nearly - // everywhere (for example, in TypeCodeImpl). - wrapperMap = new ConcurrentHashMap<>(); - wrapper = ORBUtilSystemException.get( this, - CORBALogDomains.RPC_PRESENTATION ) ; - omgWrapper = OMGSystemException.get( this, - CORBALogDomains.RPC_PRESENTATION ) ; - - typeCodeMap = new HashMap<>(); - - primitiveTypeCodeConstants = new TypeCodeImpl[] { - new TypeCodeImpl(this, TCKind._tk_null), - new TypeCodeImpl(this, TCKind._tk_void), - new TypeCodeImpl(this, TCKind._tk_short), - new TypeCodeImpl(this, TCKind._tk_long), - new TypeCodeImpl(this, TCKind._tk_ushort), - new TypeCodeImpl(this, TCKind._tk_ulong), - new TypeCodeImpl(this, TCKind._tk_float), - new TypeCodeImpl(this, TCKind._tk_double), - new TypeCodeImpl(this, TCKind._tk_boolean), - new TypeCodeImpl(this, TCKind._tk_char), - new TypeCodeImpl(this, TCKind._tk_octet), - new TypeCodeImpl(this, TCKind._tk_any), - new TypeCodeImpl(this, TCKind._tk_TypeCode), - new TypeCodeImpl(this, TCKind._tk_Principal), - new TypeCodeImpl(this, TCKind._tk_objref), - null, // tk_struct - null, // tk_union - null, // tk_enum - new TypeCodeImpl(this, TCKind._tk_string), - null, // tk_sequence - null, // tk_array - null, // tk_alias - null, // tk_except - new TypeCodeImpl(this, TCKind._tk_longlong), - new TypeCodeImpl(this, TCKind._tk_ulonglong), - new TypeCodeImpl(this, TCKind._tk_longdouble), - new TypeCodeImpl(this, TCKind._tk_wchar), - new TypeCodeImpl(this, TCKind._tk_wstring), - new TypeCodeImpl(this, TCKind._tk_fixed), - new TypeCodeImpl(this, TCKind._tk_value), - new TypeCodeImpl(this, TCKind._tk_value_box), - new TypeCodeImpl(this, TCKind._tk_native), - new TypeCodeImpl(this, TCKind._tk_abstract_interface) - } ; - - monitoringManager = - MonitoringFactories.getMonitoringManagerFactory( ). - createMonitoringManager( - MonitoringConstants.DEFAULT_MONITORING_ROOT, - MonitoringConstants.DEFAULT_MONITORING_ROOT_DESCRIPTION); - } - - // Typecode support: needed in both ORBImpl and ORBSingleton - public TypeCodeImpl get_primitive_tc(int kind) - { - synchronized (this) { - checkShutdownState(); - } - try { - return primitiveTypeCodeConstants[kind] ; - } catch (Throwable t) { - throw wrapper.invalidTypecodeKind( t, new Integer(kind) ) ; - } - } - - public synchronized void setTypeCode(String id, TypeCodeImpl code) - { - checkShutdownState(); - typeCodeMap.put(id, code); - } - - public synchronized TypeCodeImpl getTypeCode(String id) - { - checkShutdownState(); - return typeCodeMap.get(id); - } - - public MonitoringManager getMonitoringManager( ) { - synchronized (this) { - checkShutdownState(); - } - return monitoringManager; - } - - // Special non-standard set_parameters method for - // creating a precisely controlled ORB instance. - // An ORB created by this call is affected only by - // those properties passes explicitly in props, not by - // the system properties and orb.properties files as - // with the standard ORB.init methods. - public abstract void set_parameters( Properties props ) ; - - // ORB versioning - public abstract ORBVersion getORBVersion() ; - public abstract void setORBVersion( ORBVersion version ) ; - - // XXX This needs a better name - public abstract IOR getFVDCodeBaseIOR() ; - - /** - * Handle a bad server id for the given object key. This should - * always through an exception: either a ForwardException to - * allow another server to handle the request, or else an error - * indication. XXX Remove after ORT for ORBD work is integrated. - */ - public abstract void handleBadServerId( ObjectKey okey ) ; - public abstract void setBadServerIdHandler( BadServerIdHandler handler ) ; - public abstract void initBadServerIdHandler() ; - - public abstract void notifyORB() ; - - public abstract PIHandler getPIHandler() ; - - public abstract void checkShutdownState(); - - // Dispatch support: in the ORB because it is needed for shutdown. - // This is used by the first level server side subcontract. - public abstract boolean isDuringDispatch() ; - public abstract void startingDispatch(); - public abstract void finishedDispatch(); - - /** Return this ORB's transient server ID. This is needed for - * initializing object adapters. - */ - public abstract int getTransientServerId(); - - public abstract ServiceContextRegistry getServiceContextRegistry() ; - - public abstract RequestDispatcherRegistry getRequestDispatcherRegistry(); - - public abstract ORBData getORBData() ; - - public abstract void setClientDelegateFactory( ClientDelegateFactory factory ) ; - - public abstract ClientDelegateFactory getClientDelegateFactory() ; - - public abstract void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory ) ; - - public abstract CorbaContactInfoListFactory getCorbaContactInfoListFactory() ; - - // XXX These next 7 methods should be moved to a ResolverManager. - - /** Set the resolver used in this ORB. This resolver will be used for list_initial_services - * and resolve_initial_references. - */ - public abstract void setResolver( Resolver resolver ) ; - - /** Get the resolver used in this ORB. This resolver will be used for list_initial_services - * and resolve_initial_references. - */ - public abstract Resolver getResolver() ; - - /** Set the LocalResolver used in this ORB. This LocalResolver is used for - * register_initial_reference only. - */ - public abstract void setLocalResolver( LocalResolver resolver ) ; - - /** Get the LocalResolver used in this ORB. This LocalResolver is used for - * register_initial_reference only. - */ - public abstract LocalResolver getLocalResolver() ; - - /** Set the operation used in string_to_object calls. The Operation must expect a - * String and return an org.omg.CORBA.Object. - */ - public abstract void setURLOperation( Operation stringToObject ) ; - - /** Get the operation used in string_to_object calls. The Operation must expect a - * String and return an org.omg.CORBA.Object. - */ - public abstract Operation getURLOperation() ; - - /** Set the ServerRequestDispatcher that should be used for handling INS requests. - */ - public abstract void setINSDelegate( CorbaServerRequestDispatcher insDelegate ) ; - - // XXX The next 5 operations should be moved to an IORManager. - - /** Factory finders for the various parts of the IOR: tagged components, tagged - * profiles, and tagged profile templates. - */ - public abstract TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() ; - public abstract IdentifiableFactoryFinder getTaggedProfileFactoryFinder() ; - public abstract IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() ; - - public abstract ObjectKeyFactory getObjectKeyFactory() ; - public abstract void setObjectKeyFactory( ObjectKeyFactory factory ) ; - - // Logging SPI - - /** - * Returns the logger based on the category. - */ - public Logger getLogger( String domain ) - { - synchronized (this) { - checkShutdownState(); - } - ORBData odata = getORBData() ; - - // Determine the correct ORBId. There are 3 cases: - // 1. odata is null, which happens if we are getting a logger before - // ORB initialization is complete. In this case we cannot determine - // the ORB ID (it's not known yet), so we set the ORBId to - // _INITIALIZING_. - // 2. odata is not null, so initialization is complete, but ORBId is set to - // the default "". To avoid a ".." in - // the log domain, we simply use _DEFAULT_ in this case. - // 3. odata is not null, ORBId is not "": just use the ORBId. - String ORBId ; - if (odata == null) - ORBId = "_INITIALIZING_" ; - else { - ORBId = odata.getORBId() ; - if (ORBId.equals("")) - ORBId = "_DEFAULT_" ; - } - - return getCORBALogger( ORBId, domain ) ; - } - - public static Logger staticGetLogger( String domain ) - { - return getCORBALogger( "_CORBA_", domain ) ; - } - - private static Logger getCORBALogger( String ORBId, String domain ) - { - String fqLogDomain = CORBALogDomains.TOP_LEVEL_DOMAIN + "." + - ORBId + "." + domain; - - return Logger.getLogger( fqLogDomain, ORBConstants.LOG_RESOURCE_FILE ); - } - - /** get the log wrapper class (its type is dependent on the exceptionGroup) for the - * given log domain and exception group in this ORB instance. - */ - public LogWrapperBase getLogWrapper(String logDomain, - String exceptionGroup, LogWrapperFactory factory) - { - return wrapperMap.computeIfAbsent( - new StringPair(logDomain, exceptionGroup), - x -> factory.create(getLogger(logDomain))); - } - - /** get the log wrapper class (its type is dependent on the exceptionGroup) for the - * given log domain and exception group in this ORB instance. - */ - public static LogWrapperBase staticGetLogWrapper(String logDomain, - String exceptionGroup, LogWrapperFactory factory) - { - return staticWrapperMap.computeIfAbsent( - new StringPair(logDomain, exceptionGroup), - x -> factory.create(staticGetLogger(logDomain))); - } - - // get a reference to a ByteBufferPool, a pool of NIO ByteBuffers - // NOTE: ByteBuffer pool must be unique per ORB, not per process. - // There can be more than one ORB per process. - // This method must also be inherited by both ORB and ORBSingleton. - public ByteBufferPool getByteBufferPool() - { - synchronized (this) { - checkShutdownState(); - } - if (byteBufferPool == null) - byteBufferPool = new ByteBufferPoolImpl(this); - - return byteBufferPool; - } - - public abstract void setThreadPoolManager(ThreadPoolManager mgr); - - public abstract ThreadPoolManager getThreadPoolManager(); - - public abstract CopierManager getCopierManager() ; - - /* - * This method is called to verify that a stringified IOR passed to - * an org.omg.CORBA.ORB::string_to_object method contains a valid and acceptable IOR type. - * If an ORB is configured with IOR type checking enabled, - * the ORB executes a IOR type registry lookup to - * validate that the class name extract from a type id in - * a stringified IOR is a known and accepted type. - * A CORBA {@code org.omg.CORBA.DATA_CONVERSION} exception will be thrown should the type check fail. - * - * @param iorClassName - * a string representing the class name corresponding to the type id of an IOR - * @throws org.omg.CORBA.DATA_CONVERSION - * exception with an indication that it is a "Bad stringified IOR", which is thrown - * when the type check fails. - */ - public abstract void validateIORClass(String iorClassName); - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBConfigurator.java 2018-01-30 20:22:29.000000000 -0500 +++ /dev/null 2018-01-30 20:22:29.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.spi.orb ; - -/** Interface used to configure an ORB instance. The DataCollector dc has all - * available config info available. The configure method may constructor a - * parser, call dc.setParser( parser ), get the consolidated properties from dc, - * and parse this information. The configure method may also register ORB - * components with the ORB and perform other parts of ORB initialization. - * Implementations of this interface must have a public no-args constructor. - */ -public interface ORBConfigurator { - void configure( DataCollector dc, ORB orb ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBData.java 2018-01-30 20:22:30.000000000 -0500 +++ /dev/null 2018-01-30 20:22:30.000000000 -0500 @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.spi.orb ; - -import java.lang.reflect.Field ; - -import java.util.Map ; -import java.util.Set ; -import java.util.Iterator ; -import java.util.Properties ; - -import org.omg.PortableInterceptor.ORBInitializer ; - -import com.sun.corba.se.pept.transport.Acceptor; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion ; -import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory; -import com.sun.corba.se.spi.transport.IORToSocketInfo; -import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo; -import com.sun.corba.se.spi.transport.ReadTimeouts; - -import com.sun.corba.se.impl.legacy.connection.USLPort; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ; - -public interface ORBData { - public String getORBInitialHost() ; - - public int getORBInitialPort() ; - - public String getORBServerHost() ; - - public int getORBServerPort() ; - - public String getListenOnAllInterfaces(); - - public com.sun.corba.se.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory () ; - - public com.sun.corba.se.spi.transport.ORBSocketFactory getSocketFactory(); - - public USLPort[] getUserSpecifiedListenPorts () ; - - public IORToSocketInfo getIORToSocketInfo(); - - public IIOPPrimaryToContactInfo getIIOPPrimaryToContactInfo(); - - public String getORBId() ; - - public boolean getORBServerIdPropertySpecified() ; - - public boolean isLocalOptimizationAllowed() ; - - public GIOPVersion getGIOPVersion() ; - - public int getHighWaterMark() ; - - public int getLowWaterMark() ; - - public int getNumberToReclaim() ; - - public int getGIOPFragmentSize() ; - - public int getGIOPBufferSize() ; - - public int getGIOPBuffMgrStrategy(GIOPVersion gv) ; - - /** - * @return the GIOP Target Addressing preference of the ORB. - * This ORB by default supports all addressing dispositions unless specified - * otherwise via a java system property ORBConstants.GIOP_TARGET_ADDRESSING - */ - public short getGIOPTargetAddressPreference() ; - - public short getGIOPAddressDisposition() ; - - public boolean useByteOrderMarkers() ; - - public boolean useByteOrderMarkersInEncapsulations() ; - - public boolean alwaysSendCodeSetServiceContext() ; - - public boolean getPersistentPortInitialized() ; - - public int getPersistentServerPort(); - - public boolean getPersistentServerIdInitialized() ; - - /** Return the persistent-server-id of this server. This id is the same - * across multiple activations of this server. This is in contrast to - * com.sun.corba.se.impl.iiop.ORB.getTransientServerId() which - * returns a transient id that is guaranteed to be different - * across multiple activations of - * this server. The user/environment is required to supply the - * persistent-server-id every time this server is started, in - * the ORBServerId parameter, System properties, or other means. - * The user is also required to ensure that no two persistent servers - * on the same host have the same server-id. - */ - public int getPersistentServerId(); - - public boolean getServerIsORBActivated() ; - - public Class getBadServerIdHandler(); - - /** - * Get the prefered code sets for connections. Should the client send the - * code set service context on every request? - */ - public CodeSetComponentInfo getCodeSetComponentInfo() ; - - public ORBInitializer[] getORBInitializers(); - - public StringPair[] getORBInitialReferences(); - - public String getORBDefaultInitialReference() ; - - public String[] getORBDebugFlags(); - - public Acceptor[] getAcceptors(); - - public CorbaContactInfoListFactory getCorbaContactInfoListFactory(); - - public String acceptorSocketType(); - public boolean acceptorSocketUseSelectThreadToWait(); - public boolean acceptorSocketUseWorkerThreadForEvent(); - public String connectionSocketType(); - public boolean connectionSocketUseSelectThreadToWait(); - public boolean connectionSocketUseWorkerThreadForEvent(); - - public ReadTimeouts getTransportTCPReadTimeouts(); - public boolean disableDirectByteBufferUse() ; - public boolean isJavaSerializationEnabled(); - public boolean useRepId(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersion.java 2018-01-30 20:22:31.000000000 -0500 +++ /dev/null 2018-01-30 20:22:31.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.orb ; - -import org.omg.CORBA.portable.OutputStream ; - -public interface ORBVersion extends Comparable -{ - byte FOREIGN = 0 ; // ORB from another vendor - byte OLD = 1 ; // JDK 1.3.0 or earlier - byte NEW = 2 ; // JDK 1.3.1 FCS - byte JDK1_3_1_01 = 3; // JDK1_3_1_01 patch - byte NEWER = 10 ; // JDK 1.4.x - byte PEORB = 20 ; // PEORB in JDK 1.5, S1AS 8, J2EE 1.4 - - byte getORBType() ; - - void write( OutputStream os ) ; - - public boolean lessThan( ORBVersion version ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersionFactory.java 2018-01-30 20:22:31.000000000 -0500 +++ /dev/null 2018-01-30 20:22:32.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.orb ; - -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.impl.orb.ORBVersionImpl ; -import org.omg.CORBA.portable.InputStream ; -import org.omg.CORBA.INTERNAL ; - -public class ORBVersionFactory { - private ORBVersionFactory() {} ; - - public static ORBVersion getFOREIGN() - { - return ORBVersionImpl.FOREIGN ; - } - - public static ORBVersion getOLD() - { - return ORBVersionImpl.OLD ; - } - - public static ORBVersion getNEW() - { - return ORBVersionImpl.NEW ; - } - - public static ORBVersion getJDK1_3_1_01() - { - return ORBVersionImpl.JDK1_3_1_01 ; - } - - public static ORBVersion getNEWER() - { - return ORBVersionImpl.NEWER ; - } - - public static ORBVersion getPEORB() - { - return ORBVersionImpl.PEORB ; - } - - /** Return the current version of this ORB - */ - public static ORBVersion getORBVersion() - { - return ORBVersionImpl.PEORB ; - } - - public static ORBVersion create( InputStream is ) - { - byte value = is.read_octet() ; - return byteToVersion( value ) ; - } - - private static ORBVersion byteToVersion( byte value ) - { - /* Throwing an exception here would cause this version to be - * incompatible with future versions of the ORB, to the point - * that this version could - * not even unmarshal objrefs from a newer version that uses - * extended versioning. Therefore, we will simply treat all - * unknown versions as the latest version. - if (value < 0) - throw new INTERNAL() ; - */ - - /** - * Update: If we treat all unknown versions as the latest version - * then when we send an IOR with a PEORB version to an ORB that - * doesn't know the PEORB version it will treat it as whatever - * its idea of the latest version is. Then, if that IOR is - * sent back to the server and compared with the original - * the equality check will fail because the versions will be - * different. - * - * Instead, just capture the version bytes. - */ - - switch (value) { - case ORBVersion.FOREIGN : return ORBVersionImpl.FOREIGN ; - case ORBVersion.OLD : return ORBVersionImpl.OLD ; - case ORBVersion.NEW : return ORBVersionImpl.NEW ; - case ORBVersion.JDK1_3_1_01: return ORBVersionImpl.JDK1_3_1_01 ; - case ORBVersion.NEWER : return ORBVersionImpl.NEWER ; - case ORBVersion.PEORB : return ORBVersionImpl.PEORB ; - default : return new ORBVersionImpl(value); - } - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orb/Operation.java 2018-01-30 20:22:32.000000000 -0500 +++ /dev/null 2018-01-30 20:22:32.000000000 -0500 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.spi.orb ; - -/** A generic class representing a function that takes a value and returns - * a value. This is a building block for property parsing. - */ -public interface Operation{ - /** Apply some function to a value and return the result. - */ - Object operate( Object value ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java 2018-01-30 20:22:33.000000000 -0500 +++ /dev/null 2018-01-30 20:22:33.000000000 -0500 @@ -1,567 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.spi.orb ; - -import java.util.StringTokenizer ; -import java.util.Arrays ; - -import java.lang.reflect.Array ; - -import java.net.URL ; -import java.net.MalformedURLException ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; - -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.orbutil.ObjectUtility ; - -import sun.corba.SharedSecrets; - -/** This is a static factory class for commonly used operations -* for property parsing. The following operations are supported: -*
    -*
  • maskErrorAction( Operation op ) executes op and returns the result. If op throws an -* exception, the result is null. -*
  • indexAction( int arg ) returns the [arg] element of value, which must be an Object[]
  • -*
  • identityAction() return the value
  • -*
  • booleanAction() return a Boolean representing true or false values of the String value
  • -*
  • integerAction() returns an Integer for the String value, which must be a decimal integer
  • -*
  • stringAction() returns the String value
  • -*
  • classAction() returns a class for the String value, as loaded by the ORB classloader
  • -*
  • setFlagAction() always return Boolean.TRUE
  • -*
  • URLAction() returns a java.net.URL for the String value, which must be a valid URL
  • -*
  • integerRangeAction( int min, int max ) returns an Integer for the String value, which must be a -* decimal integer in the range min to max inclusive
  • -*
  • listAction( String sep, Operation ) tokenizes the String value with sep as separator, then -* applies the Operation to each token, and returns an array of the result
  • -*
  • sequenceAction( String, Operation[] ) tokenizes the String value with sep as separator, then -* applies each Operation in the Operation array to successive tokens, and returns an array of the results
  • -*
  • compose( Operation op1, Operation op2 ) is the operation that applies op2 to the result of applying -* op1 to the value
  • -*
  • mapAction( Operation ) applies the Operation to each element of an array of objects, and returns -* an array of the results
  • -*
  • mapSequenceAction( Operation[] ) applies the corresponding element of the Operation array to an -* element of the Object[] value, and returns an array of the results
  • -*
  • convertIntegerToShort coerces an Integer into a Short.
  • -*
-* Other operations can be directly defined, and combined using these basic operations. -*/ -public abstract class OperationFactory { - private OperationFactory() {} - - private static String getString( Object obj ) - { - if (obj instanceof String) - return (String)obj ; - else - throw new Error( "String expected" ) ; - } - - private static Object[] getObjectArray( Object obj ) - { - if (obj instanceof Object[]) - return (Object[])obj ; - else - throw new Error( "Object[] expected" ) ; - } - - private static StringPair getStringPair( Object obj ) - { - if (obj instanceof StringPair) - return (StringPair)obj ; - else - throw new Error( "StringPair expected" ) ; - } - - private static abstract class OperationBase implements Operation{ - public boolean equals( Object obj ) - { - if (this==obj) - return true ; - - if (!(obj instanceof OperationBase)) - return false ; - - OperationBase other = (OperationBase)obj ; - - return toString().equals( other.toString() ) ; - } - - public int hashCode() - { - return toString().hashCode() ; - } - } - - private static class MaskErrorAction extends OperationBase - { - private Operation op ; - - public MaskErrorAction( Operation op ) - { - this.op = op ; - } - - public Object operate( Object arg ) - { - try { - return op.operate( arg ) ; - } catch (java.lang.Exception exc) { - return null ; - } - } - - public String toString() - { - return "maskErrorAction(" + op + ")" ; - } - } - - public static Operation maskErrorAction( Operation op ) - { - return new MaskErrorAction( op ) ; - } - - private static class IndexAction extends OperationBase - { - private int index ; - - public IndexAction( int index ) - { - this.index = index ; - } - - public Object operate( Object value ) - { - return getObjectArray( value )[ index ] ; - } - - public String toString() - { - return "indexAction(" + index + ")" ; - } - } - - public static Operation indexAction( int index ) - { - return new IndexAction( index ) ; - } - - private static class SuffixAction extends OperationBase - { - public Object operate( Object value ) - { - return getStringPair( value ).getFirst() ; - } - - public String toString() { return "suffixAction" ; } - } - - private static Operation suffixActionImpl = new SuffixAction() ; - - private static class ValueAction extends OperationBase - { - public Object operate( Object value ) - { - return getStringPair( value ).getSecond() ; - } - - public String toString() { return "valueAction" ; } - } - - private static Operation valueActionImpl = new ValueAction() ; - - private static class IdentityAction extends OperationBase - { - public Object operate( Object value ) - { - return value ; - } - - public String toString() { return "identityAction" ; } - } - - private static Operation identityActionImpl = new IdentityAction() ; - - private static class BooleanAction extends OperationBase - { - public Object operate( Object value ) - { - return new Boolean( getString( value ) ) ; - } - - public String toString() { return "booleanAction" ; } - } - - private static Operation booleanActionImpl = new BooleanAction() ; - - private static class IntegerAction extends OperationBase - { - public Object operate( Object value ) - { - return new Integer( getString( value ) ) ; - } - - public String toString() { return "integerAction" ; } - } - - private static Operation integerActionImpl = new IntegerAction() ; - - private static class StringAction extends OperationBase - { - public Object operate( Object value ) - { - return value ; - } - - public String toString() { return "stringAction" ; } - } - - private static Operation stringActionImpl = new StringAction() ; - - private static class ClassAction extends OperationBase - { - public Object operate( Object value ) - { - String className = getString( value ) ; - - try { - Class result = - SharedSecrets.getJavaCorbaAccess().loadClass( className ) ; - return result ; - } catch (Exception exc) { - ORBUtilSystemException wrapper = ORBUtilSystemException.get( - CORBALogDomains.ORB_LIFECYCLE ) ; - throw wrapper.couldNotLoadClass( exc, className ) ; - } - } - - public String toString() { return "classAction" ; } - } - - private static Operation classActionImpl = new ClassAction() ; - - private static class SetFlagAction extends OperationBase - { - public Object operate( Object value ) - { - return Boolean.TRUE ; - } - - public String toString() { return "setFlagAction" ; } - } - - private static Operation setFlagActionImpl = new SetFlagAction() ; - - private static class URLAction extends OperationBase - { - public Object operate( Object value ) - { - String val = (String)value ; - try { - return new URL( val ) ; - } catch (MalformedURLException exc) { - ORBUtilSystemException wrapper = ORBUtilSystemException.get( - CORBALogDomains.ORB_LIFECYCLE ) ; - throw wrapper.badUrl( exc, val ) ; - } - } - - public String toString() { return "URLAction" ; } - } - - private static Operation URLActionImpl = new URLAction() ; - - public static Operation identityAction() - { - return identityActionImpl ; - } - - public static Operation suffixAction() - { - return suffixActionImpl ; - } - - public static Operation valueAction() - { - return valueActionImpl ; - } - - public static Operation booleanAction() - { - return booleanActionImpl ; - } - - public static Operation integerAction() - { - return integerActionImpl ; - } - - public static Operation stringAction() - { - return stringActionImpl ; - } - - public static Operation classAction() - { - return classActionImpl ; - } - - public static Operation setFlagAction() - { - return setFlagActionImpl ; - } - - public static Operation URLAction() - { - return URLActionImpl ; - } - - private static class IntegerRangeAction extends OperationBase - { - private int min ; - private int max ; - - IntegerRangeAction( int min, int max ) - { - this.min = min ; - this.max = max ; - } - - public Object operate( Object value ) - { - int result = Integer.parseInt( getString( value ) ) ; - if ((result >= min) && (result <= max)) - return new Integer( result ) ; - else - throw new IllegalArgumentException( - "Property value " + result + " is not in the range " + - min + " to " + max ) ; - } - - public String toString() { - return "integerRangeAction(" + min + "," + max + ")" ; - } - } - - public static Operation integerRangeAction( int min, int max ) - { - return new IntegerRangeAction( min, max ) ; - } - - private static class ListAction extends OperationBase { - private String sep ; - private Operation act ; - - ListAction( String sep, Operation act ) - { - this.sep = sep ; - this.act = act ; - } - - // Note that this method carefully constructs an array of the type - // of the first result, rather than just using Object[], which is - // not convertible into the correct type. Also note that no tokens - // results in a null result. - public Object operate( Object value ) - { - StringTokenizer st = new StringTokenizer( getString( value ), - sep ) ; - int length = st.countTokens() ; - Object result = null ; - int ctr = 0 ; - while (st.hasMoreTokens()) { - String next = st.nextToken() ; - Object val = act.operate( next ) ; - if (result == null) - result = Array.newInstance( val.getClass(), length ) ; - Array.set( result, ctr++, val ) ; - } - - return result ; - } - - public String toString() { - return "listAction(separator=\"" + sep + - "\",action=" + act + ")" ; - } - } - - public static Operation listAction( String sep, Operation act ) - { - return new ListAction( sep, act ) ; - } - - private static class SequenceAction extends OperationBase - { - private String sep ; - private Operation[] actions ; - - SequenceAction( String sep, Operation[] actions ) - { - this.sep = sep ; - this.actions = actions ; - } - - public Object operate( Object value ) - { - StringTokenizer st = new StringTokenizer( getString( value ), - sep ) ; - - int numTokens = st.countTokens() ; - if (numTokens != actions.length) - throw new Error( - "Number of tokens and number of actions do not match" ) ; - - int ctr = 0 ; - Object[] result = new Object[ numTokens ] ; - while (st.hasMoreTokens()) { - Operation act = actions[ctr] ; - String next = st.nextToken() ; - result[ctr++] = act.operate( next ) ; - } - - return result ; - } - - public String toString() { - return "sequenceAction(separator=\"" + sep + - "\",actions=" + - Arrays.toString(actions) + ")" ; - } - } - - public static Operation sequenceAction( String sep, - Operation[] actions ) - { - return new SequenceAction( sep, actions ) ; - } - - private static class ComposeAction extends OperationBase - { - private Operation op1 ; - private Operation op2 ; - - ComposeAction( Operation op1, Operation op2 ) - { - this.op1 = op1 ; - this.op2 = op2 ; - } - - public Object operate( Object value ) - { - return op2.operate( op1.operate( value ) ) ; - } - - public String toString() { - return "composition(" + op1 + "," + op2 + ")" ; - } - } - - public static Operation compose( Operation op1, Operation op2 ) - { - return new ComposeAction( op1, op2 ) ; - } - - private static class MapAction extends OperationBase - { - Operation op ; - - MapAction( Operation op ) - { - this.op = op ; - } - - public Object operate( Object value ) - { - Object[] values = (Object[])value ; - Object[] result = new Object[ values.length ] ; - for (int ctr=0; ctrLet S be the current state of the FSM. - * If there are guarded actions for S with input in, evaluate their guards successively until - * all have been evaluted, or one returns a non-DISABLED Result. - *
    - *
  1. If a DEFERED result is returned, retry the input - *
  2. If a ENABLED result is returned, the action for the guarded action - * is the current action - *
  3. Otherwise there is no enabled action. If S has a default action and next state, use them; otherwise - * use the state engine default action (the next state is always the current state). - *
- * After the action is available, the transition proceeds as follows: - *
    - *
  1. If the next state is not the current state, execute the current state postAction method. - *
  2. Execute the action. - *
  3. If the next state is not the current state, execute the next state preAction method. - *
  4. Set the current state to the next state. - *
- */ - public void doIt( Input in ) - { - stateEngine.doIt( this, in, debug ) ; - } - - // Methods for use only by StateEngineImpl - - public void internalSetState( State nextState ) - { - if (debug) { - ORBUtility.dprint( this, "Calling internalSetState with nextState = " + - nextState ) ; - } - - state = nextState ; - - if (debug) { - ORBUtility.dprint( this, "Exiting internalSetState with state = " + - state ) ; - } - } -} - -// end of FSMImpl.java --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSMTest.java 2018-01-30 20:22:42.000000000 -0500 +++ /dev/null 2018-01-30 20:22:42.000000000 -0500 @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.orbutil.fsm ; - -import com.sun.corba.se.spi.orbutil.fsm.Input ; -import com.sun.corba.se.spi.orbutil.fsm.Action ; -import com.sun.corba.se.spi.orbutil.fsm.Guard ; -import com.sun.corba.se.spi.orbutil.fsm.StateEngine ; -import com.sun.corba.se.spi.orbutil.fsm.StateImpl ; -import com.sun.corba.se.spi.orbutil.fsm.StateEngineFactory ; -import com.sun.corba.se.spi.orbutil.fsm.FSM ; - -class TestInput { - TestInput( Input value, String msg ) - { - this.value = value ; - this.msg = msg ; - } - - public String toString() - { - return "Input " + value + " : " + msg ; - } - - public Input getInput() - { - return value ; - } - - Input value ; - String msg ; -} - -class TestAction1 implements Action -{ - public void doIt( FSM fsm, Input in ) - { - System.out.println( "TestAction1:" ) ; - System.out.println( "\tlabel = " + label ) ; - System.out.println( "\toldState = " + oldState ) ; - System.out.println( "\tnewState = " + newState ) ; - if (label != in) - throw new Error( "Unexcepted Input " + in ) ; - if (oldState != fsm.getState()) - throw new Error( "Unexpected old State " + fsm.getState() ) ; - } - - public TestAction1( State oldState, Input label, State newState ) - { - this.oldState = oldState ; - this.newState = newState ; - this.label = label ; - } - - private State oldState ; - private Input label ; - private State newState ; -} - -class TestAction2 implements Action -{ - private State oldState ; - private State newState ; - - public void doIt( FSM fsm, Input in ) - { - System.out.println( "TestAction2:" ) ; - System.out.println( "\toldState = " + oldState ) ; - System.out.println( "\tnewState = " + newState ) ; - System.out.println( "\tinput = " + in ) ; - if (oldState != fsm.getState()) - throw new Error( "Unexpected old State " + fsm.getState() ) ; - } - - public TestAction2( State oldState, State newState ) - { - this.oldState = oldState ; - this.newState = newState ; - } -} - -class TestAction3 implements Action { - private State oldState ; - private Input label ; - - public void doIt( FSM fsm, Input in ) - { - System.out.println( "TestAction1:" ) ; - System.out.println( "\tlabel = " + label ) ; - System.out.println( "\toldState = " + oldState ) ; - if (label != in) - throw new Error( "Unexcepted Input " + in ) ; - } - - public TestAction3( State oldState, Input label ) - { - this.oldState = oldState ; - this.label = label ; - } -} - -class NegateGuard implements Guard { - Guard guard ; - - public NegateGuard( Guard guard ) - { - this.guard = guard ; - } - - public Guard.Result evaluate( FSM fsm, Input in ) - { - return guard.evaluate( fsm, in ).complement() ; - } -} - -class MyFSM extends FSMImpl { - public MyFSM( StateEngine se ) - { - super( se, FSMTest.STATE1 ) ; - } - - public int counter = 0 ; -} - -public class FSMTest { - public static final State STATE1 = new StateImpl( "1" ) ; - public static final State STATE2 = new StateImpl( "2" ) ; - public static final State STATE3 = new StateImpl( "3" ) ; - public static final State STATE4 = new StateImpl( "4" ) ; - - public static final Input INPUT1 = new InputImpl( "1" ) ; - public static final Input INPUT2 = new InputImpl( "2" ) ; - public static final Input INPUT3 = new InputImpl( "3" ) ; - public static final Input INPUT4 = new InputImpl( "4" ) ; - - private Guard counterGuard = new Guard() { - public Guard.Result evaluate( FSM fsm, Input in ) - { - MyFSM mfsm = (MyFSM) fsm ; - return Guard.Result.convert( mfsm.counter < 3 ) ; - } - } ; - - private static void add1( StateEngine se, State oldState, Input in, State newState ) - { - se.add( oldState, in, new TestAction1( oldState, in, newState ), newState ) ; - } - - private static void add2( StateEngine se, State oldState, State newState ) - { - se.setDefault( oldState, new TestAction2( oldState, newState ), newState ) ; - } - - public static void main( String[] args ) - { - TestAction3 ta3 = new TestAction3( STATE3, INPUT1 ) ; - - StateEngine se = StateEngineFactory.create() ; - add1( se, STATE1, INPUT1, STATE1 ) ; - add2( se, STATE1, STATE2 ) ; - - add1( se, STATE2, INPUT1, STATE2 ) ; - add1( se, STATE2, INPUT2, STATE2 ) ; - add1( se, STATE2, INPUT3, STATE1 ) ; - add1( se, STATE2, INPUT4, STATE3 ) ; - - se.add( STATE3, INPUT1, ta3, STATE3 ) ; - se.add( STATE3, INPUT1, ta3, STATE4 ) ; - add1( se, STATE3, INPUT2, STATE1 ) ; - add1( se, STATE3, INPUT3, STATE2 ) ; - add1( se, STATE3, INPUT4, STATE2 ) ; - - MyFSM fsm = new MyFSM( se ) ; - TestInput in11 = new TestInput( INPUT1, "1.1" ) ; - TestInput in12 = new TestInput( INPUT1, "1.2" ) ; - TestInput in21 = new TestInput( INPUT2, "2.1" ) ; - TestInput in22 = new TestInput( INPUT2, "2.2" ) ; - TestInput in31 = new TestInput( INPUT3, "3.1" ) ; - TestInput in32 = new TestInput( INPUT3, "3.2" ) ; - TestInput in33 = new TestInput( INPUT3, "3.3" ) ; - TestInput in41 = new TestInput( INPUT4, "4.1" ) ; - - fsm.doIt( in11.getInput() ) ; - fsm.doIt( in12.getInput() ) ; - fsm.doIt( in41.getInput() ) ; - fsm.doIt( in11.getInput() ) ; - fsm.doIt( in22.getInput() ) ; - fsm.doIt( in31.getInput() ) ; - fsm.doIt( in33.getInput() ) ; - fsm.doIt( in41.getInput() ) ; - fsm.doIt( in41.getInput() ) ; - fsm.doIt( in41.getInput() ) ; - fsm.doIt( in22.getInput() ) ; - fsm.doIt( in32.getInput() ) ; - fsm.doIt( in41.getInput() ) ; - fsm.doIt( in11.getInput() ) ; - fsm.doIt( in12.getInput() ) ; - fsm.doIt( in11.getInput() ) ; - fsm.doIt( in11.getInput() ) ; - fsm.doIt( in11.getInput() ) ; - fsm.doIt( in11.getInput() ) ; - fsm.doIt( in11.getInput() ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Guard.java 2018-01-30 20:22:42.000000000 -0500 +++ /dev/null 2018-01-30 20:22:42.000000000 -0500 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.orbutil.fsm; - -/** - * - * @author Ken Cavanaugh - */ -public interface Guard -{ - public static final class Complement extends GuardBase { - private Guard guard ; - - public Complement( GuardBase guard ) - { - super( "not(" + guard.getName() + ")" ) ; - this.guard = guard ; - } - - public Result evaluate( FSM fsm, Input in ) - { - return guard.evaluate( fsm, in ).complement() ; - } - } - - public static final class Result { - private String name ; - - private Result( String name ) - { - this.name = name ; - } - - public static Result convert( boolean res ) - { - return res ? ENABLED : DISABLED ; - } - - public Result complement() - { - if (this == ENABLED) - return DISABLED ; - else if (this == DISABLED) - return ENABLED ; - else - return DEFERED ; - } - - public String toString() - { - return "Guard.Result[" + name + "]" ; - } - - public static final Result ENABLED = new Result( "ENABLED" ) ; - public static final Result DISABLED = new Result( "DISABLED" ) ; - public static final Result DEFERED = new Result( "DEFERED" ) ; - } - - /** Called by the state engine to determine whether a - * transition is enabled, defered, or disabled. - * The result is interpreted as follows: - *
    - *
  • ENABLED if the transition is ready to proceed - *
  • DISABLED if the transition is not ready to proceed - *
  • DEFERED if the action associated with the transition - * is to be deferred. This means that the input will not be - * acted upon, but rather it will be saved for later execution. - * Typically this is implemented using a CondVar wait, and the - * blocked thread represents the defered input. The defered - * input is retried when the thread runs again. - *
- * - * @param fsm is the state machine causing this action. - * @param in is the input that caused the transition. - */ - public Result evaluate( FSM fsm, Input in ) ; -} - -// end of Action.java --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/GuardBase.java 2018-01-30 20:22:43.000000000 -0500 +++ /dev/null 2018-01-30 20:22:43.000000000 -0500 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.orbutil.fsm ; - -import com.sun.corba.se.impl.orbutil.fsm.NameBase ; - -public abstract class GuardBase extends NameBase implements Guard { - public GuardBase( String name ) { super( name ) ; } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Input.java 2018-01-30 20:22:44.000000000 -0500 +++ /dev/null 2018-01-30 20:22:44.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.orbutil.fsm; - -/** - * This interface must be implemented by any class that is used as - * an input to a FSM. The FSM only needs the identity of this - * object, so all that is really needs is the default equals implementation. - * The toString() method should also be overridden to give a concise - * description or name of the input. - * - * @author Ken Cavanaugh - */ -public interface Input -{ -} - -// end of Input.java --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/InputImpl.java 2018-01-30 20:22:44.000000000 -0500 +++ /dev/null 2018-01-30 20:22:45.000000000 -0500 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.orbutil.fsm ; - -import com.sun.corba.se.impl.orbutil.fsm.NameBase ; - -public class InputImpl extends NameBase implements Input { - public InputImpl( String name ) { super( name ) ; } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/State.java 2018-01-30 20:22:45.000000000 -0500 +++ /dev/null 2018-01-30 20:22:45.000000000 -0500 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.orbutil.fsm ; - -/** - * This interface must be implemented by any class that is used as - * a state in a FSM. The FSM only needs the identity of this - * object, so all that is really needs is the default equals implementation. - * The toString() method should also be overridden to give a concise - * description or name of the state. The StateImpl class handles this. - *

- * Pre- and post- actions are taken only on completed transitions between - * different states. Assume that the FSM is in state A, and the FSM will - * transition to state B under input I with action X. If A != B and X completes - * successfully, then after X completes execution, A.postAction is executed, - * followed by B.preAction. - * - * @author Ken Cavanaugh - */ -public interface State -{ - /** Method that defines action that occurs whenever this state is entered. - * Any exceptions thrown by this method are ignored. - */ - void preAction( FSM fsm ) ; - - /** Method that defines action that occurs whenever this state is exited. - * Any exceptions thrown by this method are ignored. - */ - void postAction( FSM fsm ) ; -} - -// end of State.java --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngine.java 2018-01-30 20:22:46.000000000 -0500 +++ /dev/null 2018-01-30 20:22:46.000000000 -0500 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.orbutil.fsm; - -/** - * A StateEngine defines the state transition function for a - * finite state machine (FSM). A FSM always has a current state. - * In response to an Input, the FSM performs an Action and - * makes a transition to a new state. Note that any object can - * be used as an input if it supports the Input interface. - * For example, a protocol message may be an input. The FSM - * uses only the result of calling getLabel on the Input to - * drive the transition. - *

- * The function can be non-deterministic - * in that the same input may cause transitions to different new - * states from the current state. In this case, the action that - * is executed for the transition must set the correct new state. - * - * @author Ken Cavanaugh - */ -public interface StateEngine -{ - /** Add a new transition (old,in,guard,act,new) to the state engine. - * Multiple calls to add with the same old and in are permitted, - * in which case only a transition in which the guard evaluates to - * true will be taken. If no such transition is enabled, a default - * will be taken. If more than one transition is enabled, one will - * be chosen arbitrarily. - * This method can only be called before done(). An attempt to - * call it after done() results in an IllegalStateException. - */ - public StateEngine add( State oldState, Input input, Guard guard, - Action action, State newState ) throws IllegalStateException ; - - /** Add a transition with a guard that always evaluates to true. - */ - public StateEngine add( State oldState, Input input, - Action action, State newState ) throws IllegalStateException ; - - /** Set the default transition and action for a state. - * This transition will be used if no more specific transition was - * defined for the actual input. Repeated calls to this method - * simply change the default. - * This method can only be called before done(). An attempt to - * call it after done() results in an IllegalStateException. - */ - public StateEngine setDefault( State oldState, Action action, State newState ) - throws IllegalStateException ; - - /** Equivalent to setDefault( oldState, act, newState ) where act is an - * action that does nothing. - */ - public StateEngine setDefault( State oldState, State newState ) - throws IllegalStateException ; - - /** Euaivalent to setDefault( oldState, oldState ) - */ - public StateEngine setDefault( State oldState ) - throws IllegalStateException ; - - /** Set the default action used in this state engine. This is the - * action that is called whenever there is no applicable transition. - * Normally this would simply flag an error. This method can only - * be called before done(). An attempt to - * call it after done() results in an IllegalStateException. - */ - public void setDefaultAction( Action act ) throws IllegalStateException ; - - /** Called after all transitions have been added to the state engine. - * This provides an opportunity for the implementation to optimize - * its representation before the state engine is used. This method - * may only be called once. An attempt to call it more than once - * results in an IllegalStateException. - */ - public void done() throws IllegalStateException ; - - /** Create an instance of a FSM that uses this state engine. - * The initial state of the FSM will be the stateState specified - * here. This method can only be called after done(). An attempt - * to call it before done results in an IllegalStateException. - */ - public FSM makeFSM( State startState ) throws IllegalStateException ; -} - -// end of StateEngine.java --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngineFactory.java 2018-01-30 20:22:47.000000000 -0500 +++ /dev/null 2018-01-30 20:22:47.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.orbutil.fsm; - -import com.sun.corba.se.impl.orbutil.fsm.StateEngineImpl ; - -/** - * Factory for creating the standard state machine implementation. - * - * @author Ken Cavanaugh - */ -public class StateEngineFactory { - private StateEngineFactory() {} - - public static StateEngine create() - { - return new StateEngineImpl() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateImpl.java 2018-01-30 20:22:47.000000000 -0500 +++ /dev/null 2018-01-30 20:22:47.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.orbutil.fsm ; - -import com.sun.corba.se.impl.orbutil.fsm.NameBase ; - -import java.util.Map ; -import java.util.HashMap ; -import java.util.Set ; -import java.util.HashSet ; - -import com.sun.corba.se.impl.orbutil.fsm.GuardedAction ; -import com.sun.corba.se.impl.orbutil.fsm.NameBase ; - -/** Base class for all states in a StateEngine. This must be used -* as the base class for all states in transitions added to a StateEngine. -*/ -public class StateImpl extends NameBase implements State { - private Action defaultAction ; - private State defaultNextState ; - private Map inputToGuardedActions ; - - public StateImpl( String name ) - { - super( name ) ; - defaultAction = null ; - inputToGuardedActions = new HashMap() ; - } - - public void preAction( FSM fsm ) - { - } - - public void postAction( FSM fsm ) - { - } - - // Methods for use only by StateEngineImpl. - - public State getDefaultNextState() - { - return defaultNextState ; - } - - public void setDefaultNextState( State defaultNextState ) - { - this.defaultNextState = defaultNextState ; - } - - public Action getDefaultAction() - { - return defaultAction ; - } - - public void setDefaultAction( Action defaultAction ) - { - this.defaultAction = defaultAction ; - } - - public void addGuardedAction( Input in, GuardedAction ga ) - { - Set gas = (Set)inputToGuardedActions.get( in ) ; - if (gas == null) { - gas = new HashSet() ; - inputToGuardedActions.put( in, gas ) ; - } - - gas.add( ga ) ; - } - - public Set getGuardedActions( Input in ) - { - return (Set)inputToGuardedActions.get( in ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandler.java 2018-01-30 20:22:48.000000000 -0500 +++ /dev/null 2018-01-30 20:22:48.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.spi.orbutil.proxy ; - -import java.io.Serializable ; -import java.lang.reflect.InvocationHandler ; - -public interface CompositeInvocationHandler extends InvocationHandler, - Serializable -{ - /** Add an invocation handler for all methods on interface interf. - */ - void addInvocationHandler( Class interf, InvocationHandler handler ) ; - - /** Set the default invocation handler to use if none of the - * invocation handlers added by calls to addInvocationHandler apply. - */ - void setDefaultHandler( InvocationHandler handler ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java 2018-01-30 20:22:49.000000000 -0500 +++ /dev/null 2018-01-30 20:22:49.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.orbutil.proxy ; - -import java.io.Serializable ; - -import java.util.Map ; -import java.util.LinkedHashMap ; - -import java.lang.reflect.Proxy ; -import java.lang.reflect.Method ; -import java.lang.reflect.InvocationHandler ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; -import com.sun.corba.se.impl.presentation.rmi.DynamicAccessPermission; - -public class CompositeInvocationHandlerImpl implements - CompositeInvocationHandler -{ - private Map classToInvocationHandler = new LinkedHashMap() ; - private InvocationHandler defaultHandler = null ; - - public void addInvocationHandler( Class interf, - InvocationHandler handler ) - { - checkAccess(); - classToInvocationHandler.put( interf, handler ) ; - } - - public void setDefaultHandler( InvocationHandler handler ) - { - checkAccess(); - defaultHandler = handler ; - } - - public Object invoke( Object proxy, Method method, Object[] args ) - throws Throwable - { - // Note that the declaring class in method is the interface - // in which the method was defined, not the proxy class. - Class cls = method.getDeclaringClass() ; - InvocationHandler handler = - (InvocationHandler)classToInvocationHandler.get( cls ) ; - - if (handler == null) { - if (defaultHandler != null) - handler = defaultHandler ; - else { - ORBUtilSystemException wrapper = ORBUtilSystemException.get( - CORBALogDomains.UTIL ) ; - throw wrapper.noInvocationHandler( "\"" + method.toString() + - "\"" ) ; - } - } - - // handler should never be null here. - - return handler.invoke( proxy, method, args ) ; - } - - private static final DynamicAccessPermission perm = new DynamicAccessPermission("access"); - private void checkAccess() { - final SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - sm.checkPermission(perm); -} - } - - private static final long serialVersionUID = 4571178305984833743L; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/DelegateInvocationHandlerImpl.java 2018-01-30 20:22:49.000000000 -0500 +++ /dev/null 2018-01-30 20:22:49.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2004, 2006, 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.corba.se.spi.orbutil.proxy ; - -import java.io.Serializable ; - -import java.util.Map ; -import java.util.LinkedHashMap ; - -import java.lang.reflect.Proxy ; -import java.lang.reflect.Method ; -import java.lang.reflect.InvocationHandler ; -import java.lang.reflect.InvocationTargetException ; -import com.sun.corba.se.impl.presentation.rmi.DynamicAccessPermission ; - -public abstract class DelegateInvocationHandlerImpl -{ - private DelegateInvocationHandlerImpl() {} - - public static InvocationHandler create( final Object delegate ) - { - SecurityManager s = System.getSecurityManager(); - if (s != null) { - s.checkPermission(new DynamicAccessPermission("access")); - } - return new InvocationHandler() { - public Object invoke( Object proxy, Method method, Object[] args ) - throws Throwable - { - // This throws an IllegalArgument exception if the delegate - // is not assignable from method.getDeclaring class. - try { - return method.invoke( delegate, args ) ; - } catch (InvocationTargetException ite) { - // Propagate the underlying exception as the - // result of the invocation - throw ite.getCause() ; - } - } - } ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/InvocationHandlerFactory.java 2018-01-30 20:22:50.000000000 -0500 +++ /dev/null 2018-01-30 20:22:50.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.spi.orbutil.proxy ; - -import java.lang.reflect.InvocationHandler ; - -public interface InvocationHandlerFactory -{ - /** Get an InvocationHandler. - */ - InvocationHandler getInvocationHandler() ; - - /** Get the interfaces that InvocationHandler instances - * produced by this InvocationHandlerFactory support. - */ - Class[] getProxyInterfaces() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/LinkedInvocationHandler.java 2018-01-30 20:22:51.000000000 -0500 +++ /dev/null 2018-01-30 20:22:51.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.orbutil.proxy ; - -import java.lang.reflect.InvocationHandler ; -import java.lang.reflect.Proxy ; - -/** This interface is used for InvocationHandler types that are - * linked to their Proxy. This is useful when the InvocationHandler - * needs access to data keyed by identity on the Proxy. - */ -public interface LinkedInvocationHandler extends InvocationHandler -{ - void setProxy( Proxy proxy ) ; - - Proxy getProxy() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchThreadPoolException.java 2018-01-30 20:22:51.000000000 -0500 +++ /dev/null 2018-01-30 20:22:51.000000000 -0500 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.orbutil.threadpool; - -public class NoSuchThreadPoolException extends Exception -{ -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchWorkQueueException.java 2018-01-30 20:22:52.000000000 -0500 +++ /dev/null 2018-01-30 20:22:52.000000000 -0500 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.orbutil.threadpool; - -public class NoSuchWorkQueueException extends Exception -{ -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPool.java 2018-01-30 20:22:53.000000000 -0500 +++ /dev/null 2018-01-30 20:22:53.000000000 -0500 @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.orbutil.threadpool; - -import java.io.Closeable; - -/** This interface defines a thread pool execution service. The ORB uses this - * interface, which preceeds the JDK 5 ExecutorService. Note that the close - * method must be called in order to reclaim thread resources. - */ -public interface ThreadPool extends Closeable -{ - - /** - * This method will return any instance of the WorkQueue. If the ThreadPool - * instance only services one WorkQueue then that WorkQueue instance will - * be returned. If there are more than one WorkQueues serviced by this - * ThreadPool, then this method would return a WorkQueue based on the - * implementation of the class that implements this interface. For PE 8.0 we - * would return a WorkQueue in a roundrobin fashion everytime this method - * is called. In the future we could allow pluggability of Policy objects for this. - */ - public WorkQueue getAnyWorkQueue(); - - /** - * This method will return an instance of the of the WorkQueue given a queueId. - * This will be useful in situations where there are more than one WorkQueues - * managed by the ThreadPool and the user of the ThreadPool wants to always use - * the same WorkQueue for doing the Work. - * If the number of WorkQueues in the ThreadPool are 10, then queueIds will go - * from 0-9 - * - * @throws NoSuchWorkQueueException thrown when queueId passed is invalid - */ - public WorkQueue getWorkQueue(int queueId) throws NoSuchWorkQueueException; - - /** - * This method will return the number of WorkQueues serviced by the threadpool. - */ - public int numberOfWorkQueues(); - - /** - * This method will return the minimum number of threads maintained by the threadpool. - */ - public int minimumNumberOfThreads(); - - /** - * This method will return the maximum number of threads in the threadpool at any - * point in time, for the life of the threadpool - */ - public int maximumNumberOfThreads(); - - /** - * This method will return the time in milliseconds when idle threads in the threadpool are - * removed. - */ - public long idleTimeoutForThreads(); - - /** - * This method will return the current number of threads in the threadpool. This method - * returns a value which is not synchronized. - */ - public int currentNumberOfThreads(); - - /** - * This method will return the number of available threads in the threadpool which are - * waiting for work. This method returns a value which is not synchronized. - */ - public int numberOfAvailableThreads(); - - /** - * This method will return the number of busy threads in the threadpool - * This method returns a value which is not synchronized. - */ - public int numberOfBusyThreads(); - - /** - * This method returns the number of Work items processed by the threadpool - */ - public long currentProcessedCount(); - - /** - * This method returns the average elapsed time taken to complete a Work - * item. - */ - public long averageWorkCompletionTime(); - - /** - * This method will return the name of the threadpool. - */ - public String getName(); - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolChooser.java 2018-01-30 20:22:53.000000000 -0500 +++ /dev/null 2018-01-30 20:22:53.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.orbutil.threadpool; - - -public interface ThreadPoolChooser -{ - /** - * This method is used to return an instance of ThreadPool based on the - * strategy/policy implemented in the ThreadPoolChooser from the set of - * ThreadPools allowed to be used by the ORB. Typically, the set of - * ThreadPools would be specified by passing the threadpool-ids - * configured in the ORB element of the domain.xml of the appserver. - */ - public ThreadPool getThreadPool(); - - /** - * This method is used to return an instance of ThreadPool that is obtained - * by using the id argument passed to it. This method will be used in - * situations where the threadpool id is known to the caller e.g. by the - * connection object or looking at the high order bits of the request id - */ - public ThreadPool getThreadPool(int id); - - /** - * This method is a convenience method to see what threadpool-ids are being - * used by the ThreadPoolChooser - */ - public String[] getThreadPoolIds(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolManager.java 2018-01-30 20:22:54.000000000 -0500 +++ /dev/null 2018-01-30 20:22:54.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.orbutil.threadpool; - -import java.io.Closeable; - -public interface ThreadPoolManager extends Closeable -{ - /** - * This method will return an instance of the threadpool given a threadpoolId, - * that can be used by any component in the app. server. - * - * @throws NoSuchThreadPoolException thrown when invalid threadpoolId is passed - * as a parameter - */ - public ThreadPool getThreadPool(String threadpoolId) throws NoSuchThreadPoolException; - - /** - * This method will return an instance of the threadpool given a numeric threadpoolId. - * This method will be used by the ORB to support the functionality of - * dedicated threadpool for EJB beans - * - * @throws NoSuchThreadPoolException thrown when invalidnumericIdForThreadpool is passed - * as a parameter - */ - public ThreadPool getThreadPool(int numericIdForThreadpool) throws NoSuchThreadPoolException; - - /** - * This method is used to return the numeric id of the threadpool, given a String - * threadpoolId. This is used by the POA interceptors to add the numeric threadpool - * Id, as a tagged component in the IOR. This is used to provide the functionality of - * dedicated threadpool for EJB beans - */ - public int getThreadPoolNumericId(String threadpoolId); - - /** - * Return a String Id for a numericId of a threadpool managed by the threadpool - * manager - */ - public String getThreadPoolStringId(int numericIdForThreadpool); - - /** - * Returns the first instance of ThreadPool in the ThreadPoolManager - */ - public ThreadPool getDefaultThreadPool(); - - /** - * Return an instance of ThreadPoolChooser based on the componentId that was - * passed as argument - */ - public ThreadPoolChooser getThreadPoolChooser(String componentId); - - /** - * Return an instance of ThreadPoolChooser based on the componentIndex that was - * passed as argument. This is added for improved performance so that the caller - * does not have to pay the cost of computing hashcode for the componentId - */ - public ThreadPoolChooser getThreadPoolChooser(int componentIndex); - - /** - * Sets a ThreadPoolChooser for a particular componentId in the ThreadPoolManager. This - * would enable any component to add a ThreadPoolChooser for their specific use - */ - public void setThreadPoolChooser(String componentId, ThreadPoolChooser aThreadPoolChooser); - - /** - * Gets the numeric index associated with the componentId specified for a - * ThreadPoolChooser. This method would help the component call the more - * efficient implementation i.e. getThreadPoolChooser(int componentIndex) - */ - public int getThreadPoolChooserNumericId(String componentId); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/Work.java 2018-01-30 20:22:55.000000000 -0500 +++ /dev/null 2018-01-30 20:22:55.000000000 -0500 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.orbutil.threadpool; - -public interface Work -{ - - /** - * This method denotes the actual work that is done by the work item. - */ - public void doWork(); - - /** - * This methods sets the time in millis in the work item, when this - * work item was enqueued in the work queue. - */ - public void setEnqueueTime(long timeInMillis); - - /** - * This methods gets the time in millis in the work item, when this - * work item was enqueued in the work queue. - */ - public long getEnqueueTime(); - - /** - * This method will return the name of the work item. - */ - public String getName(); - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/WorkQueue.java 2018-01-30 20:22:56.000000000 -0500 +++ /dev/null 2018-01-30 20:22:56.000000000 -0500 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.orbutil.threadpool; - -public interface WorkQueue -{ - - /** - * This method is used to add work to the WorkQueue - */ - public void addWork(Work aWorkItem); - - /** - * This method will return the name of the WorkQueue. - */ - public String getName(); - - /** - * Returns the total number of Work items added to the Queue. - */ - public long totalWorkItemsAdded(); - - /** - * Returns the total number of Work items in the Queue to be processed. - */ - public int workItemsInQueue(); - - /** - * Returns the average time a work item is waiting in the queue before - * getting processed. - */ - public long averageTimeInQueue(); - - /** - * Set the ThreadPool instance servicing this WorkQueue - */ - public void setThreadPool(ThreadPool aThreadPool); - - /** - * Get the ThreadPool instance servicing this WorkQueue - */ - public ThreadPool getThreadPool(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicMethodMarshaller.java 2018-01-30 20:22:56.000000000 -0500 +++ /dev/null 2018-01-30 20:22:56.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.spi.presentation.rmi ; - -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA.portable.ApplicationException ; - -import java.lang.reflect.Method ; - -import java.rmi.RemoteException ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** Used to read and write arguments and results for a particular method. -* -*/ -public interface DynamicMethodMarshaller -{ - /** Returns the method used to create this DynamicMethodMarshaller. - */ - Method getMethod() ; - - /** Copy the arguments as needed for this particular method. - * Can be optimized so that as little copying as possible is - * performed. - */ - Object[] copyArguments( Object[] args, ORB orb ) throws RemoteException ; - - /** Read the arguments for this method from the InputStream. - * Returns null if there are no arguments. - */ - Object[] readArguments( InputStream is ) ; - - /** Write arguments for this method to the OutputStream. - * Does nothing if there are no arguments. - */ - void writeArguments( OutputStream os, Object[] args ) ; - - /** Copy the result as needed for this particular method. - * Can be optimized so that as little copying as possible is - * performed. - */ - Object copyResult( Object result, ORB orb ) throws RemoteException ; - - /** Read the result from the InputStream. Returns null - * if the result type is null. - */ - Object readResult( InputStream is ) ; - - /** Write the result to the OutputStream. Does nothing if - * the result type is null. - */ - void writeResult( OutputStream os, Object result ) ; - - /** Returns true iff thr's class is a declared exception (or a subclass of - * a declared exception) for this DynamicMethodMarshaller's method. - */ - boolean isDeclaredException( Throwable thr ) ; - - /** Write the repository ID of the exception and the value of the - * exception to the OutputStream. ex should be a declared exception - * for this DynamicMethodMarshaller's method. - */ - void writeException( OutputStream os, Exception ex ) ; - - /** Reads an exception ID and the corresponding exception from - * the input stream. This should be an exception declared in - * this method. - */ - Exception readException( ApplicationException ae ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicStub.java 2018-01-30 20:22:57.000000000 -0500 +++ /dev/null 2018-01-30 20:22:57.000000000 -0500 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.spi.presentation.rmi ; - -import java.rmi.RemoteException ; - -import org.omg.CORBA.portable.Delegate ; -import org.omg.CORBA.portable.OutputStream ; - -import org.omg.CORBA.ORB ; - -/** Interface used to support dynamically generated stubs. - * This supplies some methods that are found in - * org.omg.CORBA.portable.ObjectImpl that are not available - * in org.omg.CORBA.Object. - */ -public interface DynamicStub extends org.omg.CORBA.Object -{ - /** Similar to ObjectImpl._set_delegate - */ - void setDelegate( Delegate delegate ) ; - - /** Similar to ObjectImpl._get_delegate - */ - Delegate getDelegate() ; - - /** Similar to ObjectImpl._orb() - */ - ORB getORB() ; - - /** Similar to ObjectImpl._ids - */ - String[] getTypeIds() ; - - /** Connect this dynamic stub to an ORB. - * Just as in standard RMI-IIOP, this is required after - * a dynamic stub is deserialized from an ObjectInputStream. - * It is not needed when unmarshalling from a - * org.omg.CORBA.portable.InputStream. - */ - void connect( ORB orb ) throws RemoteException ; - - boolean isLocal() ; - - OutputStream request( String operation, boolean responseExpected ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/IDLNameTranslator.java 2018-01-30 20:22:57.000000000 -0500 +++ /dev/null 2018-01-30 20:22:58.000000000 -0500 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.spi.presentation.rmi ; - -import java.lang.reflect.Method ; - -/** Translates between methods on an interface and RMI-IIOP encodings - * of those methods as names. - */ -public interface IDLNameTranslator -{ - /** Get the interfaces that this IDLNameTranslator describes. - */ - Class[] getInterfaces() ; - - /** Get all methods for this remote interface. - * The methods are returned in a canonical order, that is, - * they are always in the same order for a particular interface. - */ - Method[] getMethods() ; - - /** Get the method from this IDLNameTranslator's interfaces that - * corresponds to the mangled name idlName. Returns null - * if there is no matching method. - */ - Method getMethod( String idlName ) ; - - /** Get the mangled name that corresponds to the given method - * on this IDLNameTranslator's interface. Returns null - * if there is no matching name. - */ - String getIDLName( Method method ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationDefaults.java 2018-01-30 20:22:58.000000000 -0500 +++ /dev/null 2018-01-30 20:22:58.000000000 -0500 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.presentation.rmi; - -import com.sun.corba.se.spi.orb.ORB; - -import com.sun.corba.se.spi.presentation.rmi.PresentationManager; - -import com.sun.corba.se.impl.presentation.rmi.StubFactoryFactoryProxyImpl; -import com.sun.corba.se.impl.presentation.rmi.StubFactoryFactoryStaticImpl; -import com.sun.corba.se.impl.presentation.rmi.StubFactoryStaticImpl; - -public abstract class PresentationDefaults -{ - private static StubFactoryFactoryStaticImpl staticImpl = null ; - - private PresentationDefaults() {} - - public synchronized static PresentationManager.StubFactoryFactory - getStaticStubFactoryFactory() - { - if (staticImpl == null) - staticImpl = new StubFactoryFactoryStaticImpl( ); - - return staticImpl ; - } - - public static PresentationManager.StubFactoryFactory - getProxyStubFactoryFactory() - { - return new StubFactoryFactoryProxyImpl(); - } - - public static PresentationManager.StubFactory makeStaticStubFactory( - Class stubClass ) - { - return new StubFactoryStaticImpl( stubClass ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationManager.java 2018-01-30 20:22:59.000000000 -0500 +++ /dev/null 2018-01-30 20:22:59.000000000 -0500 @@ -1,170 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.spi.presentation.rmi ; - -import java.util.Map ; - -import java.lang.reflect.Method ; -import java.lang.reflect.InvocationHandler ; - -import javax.rmi.CORBA.Tie ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ; - - -/** Provides access to RMI-IIOP stubs and ties. - * Any style of stub and tie generation may be used. - * This includes compiler generated stubs and runtime generated stubs - * as well as compiled and reflective ties. There is normally - * only one instance of this interface per VM. The instance - * is obtained from the static method - * com.sun.corba.se.spi.orb.ORB.getPresentationManager. - *

- * Note that - * the getClassData and getDynamicMethodMarshaller methods - * maintain caches to avoid redundant computation. - */ -public interface PresentationManager -{ - /** Creates StubFactory and Tie instances. - */ - public interface StubFactoryFactory - { - /** Return the standard name of a stub (according to the RMI-IIOP specification - * and rmic). This is needed so that the name of a stub is known for - * standalone clients of the app server. - */ - String getStubName( String className ) ; - - /** Create a stub factory for stubs for the interface whose type is given by - * className. className may identify either an IDL interface or an RMI-IIOP - * interface. - * @param className The name of the remote interface as a Java class name. - * @param isIDLStub True if className identifies an IDL stub, else false. - * @param remoteCodeBase The CodeBase to use for loading Stub classes, if - * necessary (may be null or unused). - * @param expectedClass The expected stub type (may be null or unused). - * @param classLoader The classLoader to use (may be null). - */ - PresentationManager.StubFactory createStubFactory( String className, - boolean isIDLStub, String remoteCodeBase, Class expectedClass, - ClassLoader classLoader); - - /** Return a Tie for the given class. - */ - Tie getTie( Class cls ) ; - - /** Return whether or not this StubFactoryFactory creates StubFactory - * instances that create dynamic stubs and ties. At the top level, - * true indicates that rmic -iiop is not needed for generating stubs - * or ties. - */ - boolean createsDynamicStubs() ; - } - - /** Creates the actual stub needed for RMI-IIOP remote - * references. - */ - public interface StubFactory - { - /** Create a new dynamic stub. It has the type that was - * used to create this factory. - */ - org.omg.CORBA.Object makeStub() ; - - /** Return the repository ID information for all Stubs - * created by this stub factory. - */ - String[] getTypeIds() ; - } - - public interface ClassData - { - /** Get the class used to create this ClassData instance - */ - Class getMyClass() ; - - /** Get the IDLNameTranslator for the class used to create - * this ClassData instance. - */ - IDLNameTranslator getIDLNameTranslator() ; - - /** Return the array of repository IDs for all of the remote - * interfaces implemented by this class. - */ - String[] getTypeIds() ; - - /** Get the InvocationHandlerFactory that is used to create - * an InvocationHandler for dynamic stubs of the type of the - * ClassData. - */ - InvocationHandlerFactory getInvocationHandlerFactory() ; - - /** Get the dictionary for this ClassData instance. - * This is used to hold class-specific information for a Class - * in the class data. This avoids the need to create other - * caches for accessing the information. - */ - Map getDictionary() ; - } - - /** Get the ClassData for a particular class. - * This class may be an implementation class, in which - * case the IDLNameTranslator handles all Remote interfaces implemented by - * the class. If the class implements more than one remote interface, and not - * all of the remote interfaces are related by inheritance, then the type - * IDs have the implementation class as element 0. - */ - ClassData getClassData( Class cls ) ; - - /** Given a particular method, return a DynamicMethodMarshaller - * for that method. This is used for dynamic stubs and ties. - */ - DynamicMethodMarshaller getDynamicMethodMarshaller( Method method ) ; - - /** Return the registered StubFactoryFactory. - */ - StubFactoryFactory getStubFactoryFactory( boolean isDynamic ) ; - - /** Register the StubFactoryFactory. Note that - * a static StubFactoryFactory is always required for IDL. The - * dynamic stubFactoryFactory is optional. - */ - void setStubFactoryFactory( boolean isDynamic, StubFactoryFactory sff ) ; - - /** Equivalent to getStubFactoryFactory( true ).getTie( null ). - * Provided for compatibility with earlier versions of PresentationManager - * as used in the app server. The class argument is ignored in - * the dynamic case, so this is safe. - */ - Tie getTie() ; - - /** Returns the value of the com.sun.CORBA.ORBUseDynamicStub - * property. - */ - boolean useDynamicStubs() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubAdapter.java 2018-01-30 20:22:59.000000000 -0500 +++ /dev/null 2018-01-30 20:22:59.000000000 -0500 @@ -1,209 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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.corba.se.spi.presentation.rmi ; - -import javax.rmi.CORBA.Tie ; - -import org.omg.CORBA.portable.Delegate ; -import org.omg.CORBA.portable.ObjectImpl ; -import org.omg.CORBA.portable.OutputStream ; - -import org.omg.PortableServer.POA ; -import org.omg.PortableServer.POAManager ; -import org.omg.PortableServer.Servant ; - -import org.omg.PortableServer.POAPackage.WrongPolicy ; -import org.omg.PortableServer.POAPackage.ServantNotActive ; -import org.omg.PortableServer.POAManagerPackage.AdapterInactive ; - -import org.omg.CORBA.ORB ; - -import com.sun.corba.se.spi.logging.CORBALogDomains ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -// XXX Getting rid of this requires introducing an ObjectAdapterManager abstraction -// as an interface into the OA framework. -import com.sun.corba.se.impl.oa.poa.POAManagerImpl ; - -/** Provide access to stub delegate and type id information - * independent of the stub type. This class exists because - * ObjectImpl does not have an interface for the 3 delegate and - * type id methods, so a DynamicStub has a different type. - * We cannot simply change ObjectImpl as it is a standard API. - * We also cannot change the code generation of Stubs, as that - * is also standard. Hence I am left with this ugly class. - */ -public abstract class StubAdapter -{ - private StubAdapter() {} - - private static ORBUtilSystemException wrapper = - ORBUtilSystemException.get( CORBALogDomains.RPC_PRESENTATION ) ; - - public static boolean isStubClass( Class cls ) - { - return (ObjectImpl.class.isAssignableFrom( cls )) || - (DynamicStub.class.isAssignableFrom( cls )) ; - } - - public static boolean isStub( Object stub ) - { - return (stub instanceof DynamicStub) || - (stub instanceof ObjectImpl) ; - } - - public static void setDelegate( Object stub, Delegate delegate ) - { - if (stub instanceof DynamicStub) - ((DynamicStub)stub).setDelegate( delegate ) ; - else if (stub instanceof ObjectImpl) - ((ObjectImpl)stub)._set_delegate( delegate ) ; - else - throw wrapper.setDelegateRequiresStub() ; - } - - /** Use implicit activation to get an object reference for the servant. - */ - public static org.omg.CORBA.Object activateServant( Servant servant ) - { - POA poa = servant._default_POA() ; - org.omg.CORBA.Object ref = null ; - - try { - ref = poa.servant_to_reference( servant ) ; - } catch (ServantNotActive sna) { - throw wrapper.getDelegateServantNotActive( sna ) ; - } catch (WrongPolicy wp) { - throw wrapper.getDelegateWrongPolicy( wp ) ; - } - - // Make sure that the POAManager is activated if no other - // POAManager state management has taken place. - POAManager mgr = poa.the_POAManager() ; - if (mgr instanceof POAManagerImpl) { - POAManagerImpl mgrImpl = (POAManagerImpl)mgr ; - mgrImpl.implicitActivation() ; - } - - return ref ; - } - - /** Given any Tie, return the corresponding object refernce, activating - * the Servant if necessary. - */ - public static org.omg.CORBA.Object activateTie( Tie tie ) - { - /** Any implementation of Tie should be either a Servant or an ObjectImpl, - * depending on which style of code generation is used. rmic -iiop by - * default results in an ObjectImpl-based Tie, while rmic -iiop -poa - * results in a Servant-based Tie. Dynamic RMI-IIOP also uses Servant-based - * Ties (see impl.presentation.rmi.ReflectiveTie). - */ - if (tie instanceof ObjectImpl) { - return tie.thisObject() ; - } else if (tie instanceof Servant) { - Servant servant = (Servant)tie ; - return activateServant( servant ) ; - } else { - throw wrapper.badActivateTieCall() ; - } - } - - - /** This also gets the delegate from a Servant by - * using Servant._this_object() - */ - public static Delegate getDelegate( Object stub ) - { - if (stub instanceof DynamicStub) - return ((DynamicStub)stub).getDelegate() ; - else if (stub instanceof ObjectImpl) - return ((ObjectImpl)stub)._get_delegate() ; - else if (stub instanceof Tie) { - Tie tie = (Tie)stub ; - org.omg.CORBA.Object ref = activateTie( tie ) ; - return getDelegate( ref ) ; - } else - throw wrapper.getDelegateRequiresStub() ; - } - - public static ORB getORB( Object stub ) - { - if (stub instanceof DynamicStub) - return ((DynamicStub)stub).getORB() ; - else if (stub instanceof ObjectImpl) - return (ORB)((ObjectImpl)stub)._orb() ; - else - throw wrapper.getOrbRequiresStub() ; - } - - public static String[] getTypeIds( Object stub ) - { - if (stub instanceof DynamicStub) - return ((DynamicStub)stub).getTypeIds() ; - else if (stub instanceof ObjectImpl) - return ((ObjectImpl)stub)._ids() ; - else - throw wrapper.getTypeIdsRequiresStub() ; - } - - public static void connect( Object stub, - ORB orb ) throws java.rmi.RemoteException - { - if (stub instanceof DynamicStub) - ((DynamicStub)stub).connect( - (com.sun.corba.se.spi.orb.ORB)orb ) ; - else if (stub instanceof javax.rmi.CORBA.Stub) - ((javax.rmi.CORBA.Stub)stub).connect( orb ) ; - else if (stub instanceof ObjectImpl) - orb.connect( (org.omg.CORBA.Object)stub ) ; - else - throw wrapper.connectRequiresStub() ; - } - - public static boolean isLocal( Object stub ) - { - if (stub instanceof DynamicStub) - return ((DynamicStub)stub).isLocal() ; - else if (stub instanceof ObjectImpl) - return ((ObjectImpl)stub)._is_local() ; - else - throw wrapper.isLocalRequiresStub() ; - } - - public static OutputStream request( Object stub, - String operation, boolean responseExpected ) - { - if (stub instanceof DynamicStub) - return ((DynamicStub)stub).request( operation, - responseExpected ) ; - else if (stub instanceof ObjectImpl) - return ((ObjectImpl)stub)._request( operation, - responseExpected ) ; - else - throw wrapper.requestRequiresStub() ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubWrapper.java 2018-01-30 20:23:00.000000000 -0500 +++ /dev/null 2018-01-30 20:23:00.000000000 -0500 @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.presentation.rmi ; - -import java.rmi.RemoteException ; - -import org.omg.CORBA.portable.Delegate ; -import org.omg.CORBA.ORB ; -import org.omg.CORBA.Request ; -import org.omg.CORBA.Context ; -import org.omg.CORBA.NamedValue ; -import org.omg.CORBA.NVList ; -import org.omg.CORBA.ContextList ; -import org.omg.CORBA.ExceptionList ; -import org.omg.CORBA.Policy ; -import org.omg.CORBA.DomainManager ; -import org.omg.CORBA.SetOverrideType ; - -import org.omg.CORBA.portable.OutputStream ; - -/** Wrapper that can take any stub (object x such that StubAdapter.isStub(x)) - * and treat it as a DynamicStub. - */ -public class StubWrapper implements DynamicStub -{ - private org.omg.CORBA.Object object ; - - public StubWrapper( org.omg.CORBA.Object object ) - { - if (!(StubAdapter.isStub(object))) - throw new IllegalStateException() ; - - this.object = object ; - } - - public void setDelegate( Delegate delegate ) - { - StubAdapter.setDelegate( object, delegate ) ; - } - - public Delegate getDelegate() - { - return StubAdapter.getDelegate( object ) ; - } - - public ORB getORB() - { - return StubAdapter.getORB( object ) ; - } - - public String[] getTypeIds() - { - return StubAdapter.getTypeIds( object ) ; - } - - public void connect( ORB orb ) throws RemoteException - { - StubAdapter.connect( object, (com.sun.corba.se.spi.orb.ORB)orb ) ; - } - - public boolean isLocal() - { - return StubAdapter.isLocal( object ) ; - } - - public OutputStream request( String operation, boolean responseExpected ) - { - return StubAdapter.request( object, operation, responseExpected ) ; - } - - public boolean _is_a(String repositoryIdentifier) - { - return object._is_a( repositoryIdentifier ) ; - } - - public boolean _is_equivalent(org.omg.CORBA.Object other) - { - return object._is_equivalent( other ) ; - } - - public boolean _non_existent() - { - return object._non_existent() ; - } - - public int _hash(int maximum) - { - return object._hash( maximum ) ; - } - - public org.omg.CORBA.Object _duplicate() - { - return object._duplicate() ; - } - - public void _release() - { - object._release() ; - } - - public org.omg.CORBA.Object _get_interface_def() - { - return object._get_interface_def() ; - } - - public Request _request(String operation) - { - return object._request( operation ) ; - } - - public Request _create_request( Context ctx, String operation, NVList arg_list, - NamedValue result) - { - return object._create_request( ctx, operation, arg_list, result ) ; - } - - public Request _create_request( Context ctx, String operation, NVList arg_list, - NamedValue result, ExceptionList exclist, ContextList ctxlist) - { - return object._create_request( ctx, operation, arg_list, result, - exclist, ctxlist ) ; - } - - public Policy _get_policy(int policy_type) - { - return object._get_policy( policy_type ) ; - } - - public DomainManager[] _get_domain_managers() - { - return object._get_domain_managers() ; - } - - public org.omg.CORBA.Object _set_policy_override( Policy[] policies, - SetOverrideType set_add) - { - return object._set_policy_override( policies, set_add ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ClientDelegateFactory.java 2018-01-30 20:23:01.000000000 -0500 +++ /dev/null 2018-01-30 20:23:01.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.protocol ; - -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; - -import com.sun.corba.se.spi.protocol.CorbaClientDelegate ; - -/** Interface used to create a ClientDelegate from a ContactInfoList. - */ -public interface ClientDelegateFactory { - CorbaClientDelegate create( CorbaContactInfoList list ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaClientDelegate.java 2018-01-30 20:23:02.000000000 -0500 +++ /dev/null 2018-01-30 20:23:02.000000000 -0500 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.protocol; - -public abstract class CorbaClientDelegate - extends org.omg.CORBA_2_3.portable.Delegate - implements com.sun.corba.se.pept.protocol.ClientDelegate -{ -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaMessageMediator.java 2018-01-30 20:23:02.000000000 -0500 +++ /dev/null 2018-01-30 20:23:02.000000000 -0500 @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.spi.protocol; - -import java.nio.ByteBuffer; - -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.portable.ResponseHandler; -import org.omg.CORBA.portable.UnknownException; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; - -import com.sun.corba.se.pept.broker.Broker; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.ProtocolHandler; -import com.sun.corba.se.pept.transport.Connection; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.ior.ObjectKey; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.protocol.CorbaProtocolHandler; -import com.sun.corba.se.spi.servicecontext.ServiceContexts; - -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyOrReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase; -import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageHandler; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_0; -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_0; - -/** - * @author Harold Carr - */ -public interface CorbaMessageMediator - extends - MessageMediator, - ResponseHandler -{ - public void setReplyHeader(LocateReplyOrReplyMessage header); - public LocateReplyMessage getLocateReplyHeader(); - public ReplyMessage getReplyHeader(); - public void setReplyExceptionDetailMessage(String message); - public RequestMessage getRequestHeader(); - public GIOPVersion getGIOPVersion(); - public byte getEncodingVersion(); - public int getRequestId(); - public Integer getRequestIdInteger(); - public boolean isOneWay(); - public short getAddrDisposition(); - public String getOperationName(); - public ServiceContexts getRequestServiceContexts(); - public ServiceContexts getReplyServiceContexts(); - public Message getDispatchHeader(); - public void setDispatchHeader(Message msg); - public ByteBuffer getDispatchBuffer(); - public void setDispatchBuffer(ByteBuffer byteBuffer); - public int getThreadPoolToUse(); - public byte getStreamFormatVersion(); // REVIST name ForRequest? - public byte getStreamFormatVersionForReply(); - - // REVISIT - not sure if the final fragment and DII stuff should - // go here. - - public void sendCancelRequestIfFinalFragmentNotSent(); - - public void setDIIInfo(org.omg.CORBA.Request request); - public boolean isDIIRequest(); - public Exception unmarshalDIIUserException(String repoId, - InputStream inputStream); - public void setDIIException(Exception exception); - public void handleDIIReply(InputStream inputStream); - - - public boolean isSystemExceptionReply(); - public boolean isUserExceptionReply(); - public boolean isLocationForwardReply(); - public boolean isDifferentAddrDispositionRequestedReply(); - public short getAddrDispositionReply(); - public IOR getForwardedIOR(); - public SystemException getSystemExceptionReply(); - - //////////////////////////////////////////////////// - // - // Server side - // - - public ObjectKey getObjectKey(); - public void setProtocolHandler(CorbaProtocolHandler protocolHandler); - public CorbaProtocolHandler getProtocolHandler(); - - //////////////////////////////////////////////////// - // - // ResponseHandler - // - - public org.omg.CORBA.portable.OutputStream createReply(); - public org.omg.CORBA.portable.OutputStream createExceptionReply(); - - //////////////////////////////////////////////////// - // - // from core.ServerRequest - // - - public boolean executeReturnServantInResponseConstructor(); - - public void setExecuteReturnServantInResponseConstructor(boolean b); - - public boolean executeRemoveThreadInfoInResponseConstructor(); - - public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b); - - public boolean executePIInResponseConstructor(); - - public void setExecutePIInResponseConstructor( boolean b ); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaProtocolHandler.java 2018-01-30 20:23:03.000000000 -0500 +++ /dev/null 2018-01-30 20:23:03.000000000 -0500 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.protocol; - -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.portable.UnknownException; - -import com.sun.corba.se.pept.protocol.ProtocolHandler; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.spi.servicecontext.ServiceContexts; -import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage; -import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage; - -/** - * @author Harold Carr - */ -public interface CorbaProtocolHandler - extends ProtocolHandler -{ - public void handleRequest(RequestMessage header, - CorbaMessageMediator messageMediator); - - public void handleRequest(LocateRequestMessage header, - CorbaMessageMediator messageMediator); - - public CorbaMessageMediator createResponse( - CorbaMessageMediator messageMediator, - ServiceContexts svc); - public CorbaMessageMediator createUserExceptionResponse( - CorbaMessageMediator messageMediator, - ServiceContexts svc); - public CorbaMessageMediator createUnknownExceptionResponse( - CorbaMessageMediator messageMediator, - UnknownException ex); - public CorbaMessageMediator createSystemExceptionResponse( - CorbaMessageMediator messageMediator, - SystemException ex, - ServiceContexts svc); - public CorbaMessageMediator createLocationForward( - CorbaMessageMediator messageMediator, - IOR ior, - ServiceContexts svc); - - public void handleThrowableDuringServerDispatch( - CorbaMessageMediator request, - Throwable exception, - CompletionStatus completionStatus); - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaServerRequestDispatcher.java 2018-01-30 20:23:04.000000000 -0500 +++ /dev/null 2018-01-30 20:23:04.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1998, 2003, 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.corba.se.spi.protocol; - -import com.sun.corba.se.pept.protocol.ServerRequestDispatcher; - -import com.sun.corba.se.spi.ior.ObjectKey; - -// XXX These must all be replaced by Sun private APIs. -import com.sun.corba.se.spi.ior.IOR ; - -/** - * Server delegate adds behavior on the server-side -- specifically - * on the dispatch path. A single server delegate instance serves - * many server objects. This is the second level of the dispatch - * on the server side: Acceptor to ServerSubcontract to ServerRequestDispatcher to - * ObjectAdapter to Servant, although this may be short-circuited. - * Instances of this class are registered in the subcontract Registry. - */ -public interface CorbaServerRequestDispatcher - extends ServerRequestDispatcher -{ - /** - * Handle a locate request. - */ - public IOR locate(ObjectKey key); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ForwardException.java 2018-01-30 20:23:04.000000000 -0500 +++ /dev/null 2018-01-30 20:23:04.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1996, 2003, 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.corba.se.spi.protocol; - -import org.omg.CORBA.BAD_PARAM ; - -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -import com.sun.corba.se.spi.ior.IOR ; - -import com.sun.corba.se.spi.orb.ORB ; - -/** - * Thrown to signal an OBJECT_FORWARD or LOCATION_FORWARD - */ -public class ForwardException extends RuntimeException { - private ORB orb ; - private org.omg.CORBA.Object obj; - private IOR ior ; - - public ForwardException( ORB orb, IOR ior ) { - super(); - - this.orb = orb ; - this.obj = null ; - this.ior = ior ; - } - - public ForwardException( ORB orb, org.omg.CORBA.Object obj) { - super(); - - // This check is done early so that no attempt - // may be made to do a location forward to a local - // object. Doing this lazily would allow - // forwarding to locals in some restricted cases. - if (obj instanceof org.omg.CORBA.LocalObject) - throw new BAD_PARAM() ; - - this.orb = orb ; - this.obj = obj ; - this.ior = null ; - } - - public synchronized org.omg.CORBA.Object getObject() - { - if (obj == null) { - obj = ORBUtility.makeObjectReference( ior ) ; - } - - return obj ; - } - - public synchronized IOR getIOR() - { - if (ior == null) { - ior = ORBUtility.getIOR( obj ) ; - } - - return ior ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/InitialServerRequestDispatcher.java 2018-01-30 20:23:05.000000000 -0500 +++ /dev/null 2018-01-30 20:23:05.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.protocol; - -import com.sun.corba.se.spi.resolver.Resolver ; - -/** InitialServerRequestDispatcher is a specialized version of a ServerRequestDispatcher - * that provides an initialization method. This delegate is used - * to implement bootstrapping of initial object references. - */ -public interface InitialServerRequestDispatcher - extends CorbaServerRequestDispatcher -{ - /** Plug in the resolver that this InitialServerRequestDispatcher should - * use in order to lookup or list initial name to object reference - * bindings. - */ - void init( Resolver resolver ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcher.java 2018-01-30 20:23:06.000000000 -0500 +++ /dev/null 2018-01-30 20:23:06.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.protocol; - -import org.omg.CORBA.portable.ServantObject; - -/** - * @author Harold Carr - */ - -public interface LocalClientRequestDispatcher -{ - public boolean useLocalInvocation(org.omg.CORBA.Object self); - - public boolean is_local(org.omg.CORBA.Object self); - - /** - * Returns a Java reference to the servant which should be used for this - * request. servant_preinvoke() is invoked by a local stub. - * If a ServantObject object is returned, then its servant field - * has been set to an object of the expected type (Note: the object may - * or may not be the actual servant instance). The local stub may cast - * the servant field to the expected type, and then invoke the operation - * directly. - * - * @param self The object reference which delegated to this delegate. - * - * @param operation a string containing the operation name. - * The operation name corresponds to the operation name as it would be - * encoded in a GIOP request. - * - * @param expectedType a Class object representing the expected type of the servant. - * The expected type is the Class object associated with the operations - * class of the stub's interface (e.g. A stub for an interface Foo, - * would pass the Class object for the FooOperations interface). - * - * @return a ServantObject object. - * The method may return a null value if it does not wish to support - * this optimization (e.g. due to security, transactions, etc). - * The method must return null if the servant is not of the expected type. - */ - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType); - - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servant); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcherFactory.java 2018-01-30 20:23:06.000000000 -0500 +++ /dev/null 2018-01-30 20:23:06.000000000 -0500 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.protocol; - -import com.sun.corba.se.spi.ior.IOR ; - -public interface LocalClientRequestDispatcherFactory { - public LocalClientRequestDispatcher create( int id, IOR ior ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/PIHandler.java 2018-01-30 20:23:07.000000000 -0500 +++ /dev/null 2018-01-30 20:23:07.000000000 -0500 @@ -1,306 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.spi.protocol; - -import java.io.Closeable; - -import org.omg.PortableInterceptor.ObjectReferenceTemplate ; -import org.omg.PortableInterceptor.Interceptor ; -import org.omg.PortableInterceptor.Current ; -import org.omg.PortableInterceptor.PolicyFactory ; -import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ; - -import org.omg.CORBA.NVList ; -import org.omg.CORBA.Any ; -import org.omg.CORBA.Policy ; -import org.omg.CORBA.PolicyError ; - -import org.omg.CORBA.portable.RemarshalException; - -import com.sun.corba.se.spi.oa.ObjectAdapter ; - -import com.sun.corba.se.spi.protocol.CorbaMessageMediator ; - -import com.sun.corba.se.spi.ior.ObjectKeyTemplate ; - -// XXX These need to go away. -import com.sun.corba.se.impl.corba.RequestImpl ; -import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage ; - -/** This interface defines the PI interface that is used to interface the rest of the - * ORB to the PI implementation. - */ -public interface PIHandler extends Closeable { - /** Complete the initialization of the PIHandler. This will execute the methods - * on the ORBInitializers, if any are defined. This must be done here so that - * the ORB can obtain the PIHandler BEFORE the ORBInitializers run, since they - * will need access to the PIHandler through the ORB. - */ - public void initialize() ; - - public void destroyInterceptors() ; - - /* - **************************** - * IOR interceptor PI hooks - ****************************/ - - /** - * Called when a new object adapter is created. - * - * @param oa The adapter associated with the interceptors to be - * invoked. - */ - void objectAdapterCreated( ObjectAdapter oa ) ; - - /** - * Called whenever a state change occurs in an adapter manager. - * - * @param managerId managerId The adapter manager id - * @param newState newState The new state of the adapter manager, - * and by implication of all object adapters managed by this manager. - */ - void adapterManagerStateChanged( int managerId, - short newState ) ; - - /** Called whenever a state change occurs in an object adapter that - * was not caused by an adapter manager state change. - * - * @param templates The templates that are changing state. - * @param newState The new state of the adapters identified by the - * templates. - */ - void adapterStateChanged( ObjectReferenceTemplate[] templates, - short newState ) ; - - /* - ***************** - * Client PI hooks - *****************/ - - /** - * Called for pseudo-ops to temporarily disable portable interceptor - * hooks for calls on this thread. Keeps track of the number of - * times this is called and increments the disabledCount. - */ - void disableInterceptorsThisThread() ; - - /** - * Called for pseudo-ops to re-enable portable interceptor - * hooks for calls on this thread. Decrements the disabledCount. - * If disabledCount is 0, interceptors are re-enabled. - */ - void enableInterceptorsThisThread() ; - - /** - * Called when the send_request or send_poll portable interception point - * is to be invoked for all appropriate client-side request interceptors. - * - * @exception RemarhsalException - Thrown when this request needs to - * be retried. - */ - void invokeClientPIStartingPoint() - throws RemarshalException ; - - /** - * Called when the appropriate client ending interception point is - * to be invoked for all apporpriate client-side request interceptors. - * - * @param replyStatus One of the constants in iiop.messages.ReplyMessage - * indicating which reply status to set. - * @param exception The exception before ending interception points have - * been invoked, or null if no exception at the moment. - * @return The exception to be thrown, after having gone through - * all ending points, or null if there is no exception to be - * thrown. Note that this exception can be either the same or - * different from the exception set using setClientPIException. - * There are four possible return types: null (no exception), - * SystemException, UserException, or RemarshalException. - */ - Exception invokeClientPIEndingPoint( - int replyStatus, Exception exception ) ; - - /** - * Called when a retry is needed after initiateClientPIRequest but - * before invokeClientPIRequest. In this case, we need to properly - * balance initiateClientPIRequest/cleanupClientPIRequest calls, - * but WITHOUT extraneous calls to invokeClientPIEndingPoint - * (see bug 6763340). - * - * @param replyStatus One of the constants in iiop.messages.ReplyMessage - * indicating which reply status to set. - * @param exception The exception before ending interception points have - * been invoked, or null if no exception at the moment. - * @return The exception to be thrown, after having gone through - * all ending points, or null if there is no exception to be - * thrown. Note that this exception can be either the same or - * different from the exception set using setClientPIException. - * There are four possible return types: null (no exception), - * SystemException, UserException, or RemarshalException. - */ - Exception makeCompletedClientRequest( - int replyStatus, Exception exception ) ; - - /** - * Invoked when a request is about to be created. Must be called before - * any of the setClientPI* methods so that a new info object can be - * prepared for information collection. - * - * @param diiRequest True if this is to be a DII request, or false if it - * is a "normal" request. In the DII case, initiateClientPIRequest - * is called twice and we need to ignore the second one. - */ - void initiateClientPIRequest( boolean diiRequest ) ; - - /** - * Invoked when a request is about to be cleaned up. Must be called - * after ending points are called so that the info object on the stack - * can be deinitialized and popped from the stack at the appropriate - * time. - */ - void cleanupClientPIRequest() ; - - /** - * Notifies PI of additional information for client-side interceptors. - * PI will use this information as a source of information for the - * ClientRequestInfo object. - */ - void setClientPIInfo( RequestImpl requestImpl ) ; - - /** - * Notify PI of the MessageMediator for the request. - */ - void setClientPIInfo(CorbaMessageMediator messageMediator) ; - - /* - ***************** - * Server PI hooks - *****************/ - - /** - * Called when the appropriate server starting interception point is - * to be invoked for all appropriate server-side request interceptors. - * - * @throws ForwardException Thrown if an interceptor raises - * ForwardRequest. This is an unchecked exception so that we need - * not modify the entire execution path to declare throwing - * ForwardException. - */ - void invokeServerPIStartingPoint() ; - - /** - * Called when the appropriate server intermediate interception point is - * to be invoked for all appropriate server-side request interceptors. - * - * @throws ForwardException Thrown if an interceptor raises - * ForwardRequest. This is an unchecked exception so that we need - * not modify the entire execution path to declare throwing - * ForwardException. - */ - void invokeServerPIIntermediatePoint() ; - - /** - * Called when the appropriate server ending interception point is - * to be invoked for all appropriate server-side request interceptors. - * - * @param replyMessage The iiop.messages.ReplyMessage containing the - * reply status. - * @throws ForwardException Thrown if an interceptor raises - * ForwardRequest. This is an unchecked exception so that we need - * not modify the entire execution path to declare throwing - * ForwardException. - */ - void invokeServerPIEndingPoint( ReplyMessage replyMessage ) ; - - /** - * Notifies PI to start a new server request and set initial - * information for server-side interceptors. - * PI will use this information as a source of information for the - * ServerRequestInfo object. poaimpl is declared as an Object so that - * we need not introduce a dependency on the POA package. - */ - void initializeServerPIInfo( CorbaMessageMediator request, - ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp ) ; - - /** - * Notifies PI of additional information reqired for ServerRequestInfo. - * - * @param servant The servant. This is java.lang.Object because in the - * POA case, this will be a org.omg.PortableServer.Servant whereas - * in the ServerRequestDispatcher case this will be an ObjectImpl. - * @param targetMostDerivedInterface. The most derived interface. This - * is passed in instead of calculated when needed because it requires - * extra information in the POA case that we didn't want to bother - * creating extra methods for to pass in. - */ - void setServerPIInfo( java.lang.Object servant, - String targetMostDerivedInterface ) ; - - /** - * Notifies PI of additional information required for ServerRequestInfo. - */ - void setServerPIInfo( Exception exception ) ; - - /** - * Notifies PI of additional information for server-side interceptors. - * PI will use this information as a source of information for the - * ServerRequestInfo object. These are the arguments for a DSI request. - */ - void setServerPIInfo( NVList arguments ) ; - - /** - * Notifies PI of additional information for server-side interceptors. - * PI will use this information as a source of information for the - * ServerRequestInfo object. This is the exception of a DSI request. - */ - void setServerPIExceptionInfo( Any exception ) ; - - /** - * Notifies PI of additional information for server-side interceptors. - * PI will use this information as a source of information for the - * ServerRequestInfo object. This is the result of a DSI request. - */ - void setServerPIInfo( Any result ) ; - - /** - * Invoked when a request is about to be cleaned up. Must be called - * after ending points are called so that the info object on the stack - * can be deinitialized and popped from the stack at the appropriate - * time. - */ - void cleanupServerPIRequest() ; - - Policy create_policy( int type, Any val ) throws PolicyError ; - - void register_interceptor( Interceptor interceptor, int type ) - throws DuplicateName ; - - Current getPICurrent() ; - - void registerPolicyFactory( int type, PolicyFactory factory ) ; - - int allocateServerRequestId() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherDefault.java 2018-01-30 20:23:08.000000000 -0500 +++ /dev/null 2018-01-30 20:23:08.000000000 -0500 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.protocol ; - -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; - -import com.sun.corba.se.spi.orb.ORB ; - -// Used only in the implementation: no client of this class ever needs these -import com.sun.corba.se.spi.ior.IOR ; - -import com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl ; -import com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl ; -import com.sun.corba.se.impl.protocol.MinimalServantCacheLocalCRDImpl ; -import com.sun.corba.se.impl.protocol.InfoOnlyServantCacheLocalCRDImpl ; -import com.sun.corba.se.impl.protocol.FullServantCacheLocalCRDImpl ; -import com.sun.corba.se.impl.protocol.JIDLLocalCRDImpl ; -import com.sun.corba.se.impl.protocol.POALocalCRDImpl ; -import com.sun.corba.se.impl.protocol.INSServerRequestDispatcher ; -import com.sun.corba.se.impl.protocol.BootstrapServerRequestDispatcher ; - -public final class RequestDispatcherDefault { - private RequestDispatcherDefault() {} - - public static ClientRequestDispatcher makeClientRequestDispatcher() - { - return new CorbaClientRequestDispatcherImpl() ; - } - - public static CorbaServerRequestDispatcher makeServerRequestDispatcher( ORB orb ) - { - return new CorbaServerRequestDispatcherImpl( (com.sun.corba.se.spi.orb.ORB)orb ) ; - } - - public static CorbaServerRequestDispatcher makeBootstrapServerRequestDispatcher( ORB orb ) - { - return new BootstrapServerRequestDispatcher( orb ) ; - } - - public static CorbaServerRequestDispatcher makeINSServerRequestDispatcher( ORB orb ) - { - return new INSServerRequestDispatcher( orb ) ; - } - - public static LocalClientRequestDispatcherFactory makeMinimalServantCacheLocalClientRequestDispatcherFactory( final ORB orb ) - { - return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new MinimalServantCacheLocalCRDImpl( orb, id, ior ) ; - } - } ; - } - - public static LocalClientRequestDispatcherFactory makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory( final ORB orb ) - { - return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new InfoOnlyServantCacheLocalCRDImpl( orb, id, ior ) ; - } - } ; - } - - public static LocalClientRequestDispatcherFactory makeFullServantCacheLocalClientRequestDispatcherFactory( final ORB orb ) - { - return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new FullServantCacheLocalCRDImpl( orb, id, ior ) ; - } - } ; - } - - public static LocalClientRequestDispatcherFactory makeJIDLLocalClientRequestDispatcherFactory( final ORB orb ) - { - return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new JIDLLocalCRDImpl( orb, id, ior ) ; - } - } ; - } - - public static LocalClientRequestDispatcherFactory makePOALocalClientRequestDispatcherFactory( final ORB orb ) - { - return new LocalClientRequestDispatcherFactory() { - public LocalClientRequestDispatcher create( int id, IOR ior ) { - return new POALocalCRDImpl( orb, id, ior ) ; - } - } ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherRegistry.java 2018-01-30 20:23:08.000000000 -0500 +++ /dev/null 2018-01-30 20:23:09.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.spi.protocol; - -import java.util.Set; - -import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ; -import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ; -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ; - -import com.sun.corba.se.spi.oa.ObjectAdapterFactory ; - -/** - * This is a registry of all subcontract ID dependent objects. This includes: - * LocalClientRequestDispatcherFactory, ClientRequestDispatcher, ServerRequestDispatcher, and - * ObjectAdapterFactory. - */ -public interface RequestDispatcherRegistry { - - /** Register a ClientRequestDispatcher for a particular subcontract ID. - * The subcontract ID appears in the ObjectKey of an object reference, and is used - * to control how a remote method invocation is processed by the ORB for a - * particular kind of object reference. - */ - void registerClientRequestDispatcher( ClientRequestDispatcher csc, int scid) ; - - /** Get the ClientRequestDispatcher for subcontract ID scid. - */ - ClientRequestDispatcher getClientRequestDispatcher( int scid ) ; - - /** Register a LocalClientRequestDispatcher for a particular subcontract ID. - * The subcontract ID appears in the ObjectKey of an object reference, and is used - * to control how a particular kind of colocated request is processed. - */ - void registerLocalClientRequestDispatcherFactory( LocalClientRequestDispatcherFactory csc, int scid) ; - - /** Get the LocalClientRequestDispatcher for subcontract ID scid. - */ - LocalClientRequestDispatcherFactory getLocalClientRequestDispatcherFactory( int scid ) ; - - /** Register a CorbaServerRequestDispatcher for a particular subcontract ID. - * The subcontract ID appears in the ObjectKey of an object reference, and is used - * to control how a particular kind of request is processed when received by the ORB. - */ - void registerServerRequestDispatcher( CorbaServerRequestDispatcher ssc, int scid) ; - - /** Get the CorbaServerRequestDispatcher for subcontract ID scid. - */ - CorbaServerRequestDispatcher getServerRequestDispatcher(int scid) ; - - /** Register a CorbaServerRequestDispatcher for handling an explicit object key name. - * This is used for non-standard invocations such as INS and the bootstrap name service. - */ - void registerServerRequestDispatcher( CorbaServerRequestDispatcher ssc, String name ) ; - - /** Get the CorbaServerRequestDispatcher for a particular object key. - */ - CorbaServerRequestDispatcher getServerRequestDispatcher( String name ) ; - - /** Register an ObjectAdapterFactory for a particular subcontract ID. - * This controls how Object references are created and managed. - */ - void registerObjectAdapterFactory( ObjectAdapterFactory oaf, int scid) ; - - /** Get the ObjectAdapterFactory for a particular subcontract ID scid. - */ - ObjectAdapterFactory getObjectAdapterFactory( int scid ) ; - - /** Return the set of all ObjectAdapterFactory instances that are registered. - */ - Set getObjectAdapterFactories(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RetryType.java 2018-01-30 20:23:09.000000000 -0500 +++ /dev/null 2018-01-30 20:23:09.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.spi.protocol ; - -// Introduce more information about WHY we are re-trying a request -// so we can properly handle the two cases: -// - BEFORE_RESPONSE means that the retry is caused by -// something that happened BEFORE the message was sent: either -// an exception from the SocketFactory, or one from the -// Client side send_request interceptor point. -// - AFTER_RESPONSE means that the retry is a result either of the -// request sent to the server (from the response), or from the -// Client side receive_xxx interceptor point. -public enum RetryType { - NONE( false ), - BEFORE_RESPONSE( true ), - AFTER_RESPONSE( true ) ; - - private final boolean isRetry ; - - RetryType( boolean isRetry ) { - this.isRetry = isRetry ; - } - - public boolean isRetry() { - return this.isRetry ; - } -} ; - --- old/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/LocalResolver.java 2018-01-30 20:23:10.000000000 -0500 +++ /dev/null 2018-01-30 20:23:10.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.resolver ; - -import com.sun.corba.se.spi.orbutil.closure.Closure ; - -/** A LocalResolver is a Resolver that allows registration of (name, CORBA object) - * bindings. - */ -public interface LocalResolver extends Resolver { - /** Register the Closure with the given name. - * The Closure must evaluate to an org.omg.CORBA.Object. - */ - void register( String name, Closure closure ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/Resolver.java 2018-01-30 20:23:11.000000000 -0500 +++ /dev/null 2018-01-30 20:23:11.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, 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.corba.se.spi.resolver ; - -/** Resolver defines the operations needed to support ORB operations for - * resolve_initial_references and list_initial_services. - */ -public interface Resolver { - /** Look up the name using this resolver and return the CORBA object - * reference bound to this name, if any. Returns null if no object - * is bound to the name. - */ - org.omg.CORBA.Object resolve( String name ) ; - - /** Return the entire collection of names that are currently bound - * by this resolver. Resulting collection contains only strings for - * which resolve does not return null. Some resolvers may not support - * this method, in which case they return an empty set. - */ - java.util.Set list() ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/ResolverDefault.java 2018-01-30 20:23:11.000000000 -0500 +++ /dev/null 2018-01-30 20:23:11.000000000 -0500 @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.resolver ; - -import java.io.File ; - -import com.sun.corba.se.impl.resolver.LocalResolverImpl ; -import com.sun.corba.se.impl.resolver.ORBInitRefResolverImpl ; -import com.sun.corba.se.impl.resolver.ORBDefaultInitRefResolverImpl ; -import com.sun.corba.se.impl.resolver.BootstrapResolverImpl ; -import com.sun.corba.se.impl.resolver.CompositeResolverImpl ; -import com.sun.corba.se.impl.resolver.INSURLOperationImpl ; -import com.sun.corba.se.impl.resolver.SplitLocalResolverImpl ; -import com.sun.corba.se.impl.resolver.FileResolverImpl ; - -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.orb.Operation ; -import com.sun.corba.se.spi.orb.StringPair ; - -/** Utility class that provides factory methods for all of the - * standard resolvers that we provide. - */ -public class ResolverDefault { - /** Return a local resolver that simply stores bindings in a map. - */ - public static LocalResolver makeLocalResolver( ) - { - return new LocalResolverImpl() ; - } - - /** Return a resolver that relies on configured values of ORBInitRef for data. - */ - public static Resolver makeORBInitRefResolver( Operation urlOperation, - StringPair[] initRefs ) - { - return new ORBInitRefResolverImpl( urlOperation, initRefs ) ; - } - - public static Resolver makeORBDefaultInitRefResolver( Operation urlOperation, - String defaultInitRef ) - { - return new ORBDefaultInitRefResolverImpl( urlOperation, - defaultInitRef ) ; - } - - /** Return a resolver that uses the proprietary bootstrap protocol - * to implement a resolver. Obtains the necessary host and port - * information from the ORB. - */ - public static Resolver makeBootstrapResolver( ORB orb, String host, int port ) - { - return new BootstrapResolverImpl( orb, host, port ) ; - } - - /** Return a resolver composed of the two given resolvers. result.list() is the - * union of first.list() and second.list(). result.resolve( name ) returns - * first.resolve( name ) if that is not null, otherwise returns the result of - * second.resolve( name ). - */ - public static Resolver makeCompositeResolver( Resolver first, Resolver second ) - { - return new CompositeResolverImpl( first, second ) ; - } - - public static Operation makeINSURLOperation( ORB orb, Resolver bootstrapResolver ) - { - return new INSURLOperationImpl( - (com.sun.corba.se.spi.orb.ORB)orb, bootstrapResolver ) ; - } - - public static LocalResolver makeSplitLocalResolver( Resolver resolver, - LocalResolver localResolver ) - { - return new SplitLocalResolverImpl( resolver, localResolver ) ; - } - - public static Resolver makeFileResolver( ORB orb, File file ) - { - return new FileResolverImpl( orb, file ) ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/CodeSetServiceContext.java 2018-01-30 20:23:12.000000000 -0500 +++ /dev/null 2018-01-30 20:23:12.000000000 -0500 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.spi.servicecontext; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.encoding.MarshalInputStream ; -import com.sun.corba.se.impl.encoding.MarshalOutputStream ; -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ; - -public class CodeSetServiceContext extends ServiceContext { - public CodeSetServiceContext( CodeSetComponentInfo.CodeSetContext csc ) - { - this.csc = csc ; - } - - public CodeSetServiceContext(InputStream is, GIOPVersion gv) - { - super(is, gv) ; - csc = new CodeSetComponentInfo.CodeSetContext() ; - csc.read( (MarshalInputStream)in ) ; - } - - // Required SERVICE_CONTEXT_ID and getId definitions - public static final int SERVICE_CONTEXT_ID = 1 ; - public int getId() { return SERVICE_CONTEXT_ID ; } - - public void writeData( OutputStream os ) throws SystemException - { - csc.write( (MarshalOutputStream)os ) ; - } - - public CodeSetComponentInfo.CodeSetContext getCodeSetContext() - { - return csc ; - } - - private CodeSetComponentInfo.CodeSetContext csc ; - - public String toString() - { - return "CodeSetServiceContext[ csc=" + csc + " ]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/MaxStreamFormatVersionServiceContext.java 2018-01-30 20:23:13.000000000 -0500 +++ /dev/null 2018-01-30 20:23:13.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.servicecontext; - -import org.omg.IOP.RMICustomMaxStreamFormat; -import javax.rmi.CORBA.*; -import org.omg.CORBA.SystemException; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.impl.encoding.MarshalInputStream; -import com.sun.corba.se.impl.encoding.MarshalOutputStream; -import com.sun.corba.se.impl.orbutil.ORBUtility; - -public class MaxStreamFormatVersionServiceContext extends ServiceContext { - - private byte maxStreamFormatVersion; - - // The singleton uses the maximum version indicated by our - // ValueHandler. - public static final MaxStreamFormatVersionServiceContext singleton - = new MaxStreamFormatVersionServiceContext(); - - public MaxStreamFormatVersionServiceContext() { - maxStreamFormatVersion = ORBUtility.getMaxStreamFormatVersion(); - } - - public MaxStreamFormatVersionServiceContext(byte maxStreamFormatVersion) { - this.maxStreamFormatVersion = maxStreamFormatVersion; - } - - public MaxStreamFormatVersionServiceContext(InputStream is, - GIOPVersion gv) { - super(is, gv) ; - - maxStreamFormatVersion = is.read_octet(); - } - - public static final int SERVICE_CONTEXT_ID = RMICustomMaxStreamFormat.value; - public int getId() { return SERVICE_CONTEXT_ID; } - - public void writeData(OutputStream os) throws SystemException - { - os.write_octet(maxStreamFormatVersion); - } - - public byte getMaximumStreamFormatVersion() - { - return maxStreamFormatVersion; - } - - public String toString() - { - return "MaxStreamFormatVersionServiceContext[" - + maxStreamFormatVersion + "]"; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ORBVersionServiceContext.java 2018-01-30 20:23:13.000000000 -0500 +++ /dev/null 2018-01-30 20:23:13.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2000, 2003, 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.corba.se.spi.servicecontext; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; - -import com.sun.corba.se.spi.orb.ORBVersion ; -import com.sun.corba.se.spi.orb.ORBVersionFactory ; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.servicecontext.ServiceContext ; -import com.sun.corba.se.impl.orbutil.ORBConstants ; - -public class ORBVersionServiceContext extends ServiceContext { - - public ORBVersionServiceContext( ) - { - version = ORBVersionFactory.getORBVersion() ; - } - - public ORBVersionServiceContext( ORBVersion ver ) - { - this.version = ver ; - } - - public ORBVersionServiceContext(InputStream is, GIOPVersion gv) - { - super(is, gv) ; - // pay particular attention to where the version is being read from! - // is contains an encapsulation, ServiceContext reads off the - // encapsulation and leaves the pointer in the variable "in", - // which points to the long value. - - version = ORBVersionFactory.create( in ) ; - } - - // Required SERVICE_CONTEXT_ID and getId definitions - public static final int SERVICE_CONTEXT_ID = ORBConstants.TAG_ORB_VERSION ; - public int getId() { return SERVICE_CONTEXT_ID ; } - - public void writeData( OutputStream os ) throws SystemException - { - version.write( os ) ; - } - - public ORBVersion getVersion() - { - return version ; - } - - // current ORB Version - private ORBVersion version = ORBVersionFactory.getORBVersion() ; - - public String toString() - { - return "ORBVersionServiceContext[ version=" + version + " ]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/SendingContextServiceContext.java 2018-01-30 20:23:14.000000000 -0500 +++ /dev/null 2018-01-30 20:23:14.000000000 -0500 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.spi.servicecontext; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.servicecontext.ServiceContext ; -import com.sun.corba.se.impl.encoding.MarshalOutputStream ; -import com.sun.corba.se.impl.ior.IORImpl ; - -public class SendingContextServiceContext extends ServiceContext { - public SendingContextServiceContext( IOR ior ) - { - this.ior = ior ; - } - - public SendingContextServiceContext(InputStream is, GIOPVersion gv) - { - super(is, gv) ; - ior = new IORImpl( in ) ; - } - - // Required SERVICE_CONTEXT_ID and getId definitions - public static final int SERVICE_CONTEXT_ID = 6 ; - public int getId() { return SERVICE_CONTEXT_ID ; } - - public void writeData( OutputStream os ) throws SystemException - { - ior.write( os ) ; - } - - public IOR getIOR() - { - return ior ; - } - - private IOR ior = null ; - - public String toString() - { - return "SendingContexServiceContext[ ior=" + ior + " ]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java 2018-01-30 20:23:15.000000000 -0500 +++ /dev/null 2018-01-30 20:23:15.000000000 -0500 @@ -1,120 +0,0 @@ -/* - * Copyright (c) 1998, 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.corba.se.spi.servicecontext; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA_2_3.portable.InputStream ; -import org.omg.CORBA_2_3.portable.OutputStream ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.impl.encoding.CDRInputStream ; -import com.sun.corba.se.impl.encoding.EncapsInputStream ; -import com.sun.corba.se.impl.encoding.EncapsOutputStream ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -/** Base class for all ServiceContext classes. -* There is a derived ServiceContext class for each service context that -* the ORB supports. Each subclass encapsulates the representation of -* the service context and provides any needed methods for manipulating -* the service context. Each subclass must provide the following -* members: -*

    -*
  • a public static final int SERVICE_CONTEXT_ID that gives the OMG -* (or other) defined id for the service context. This is needed for the -* registration mechanism defined in ServiceContexts. OMG defined -* service context ids are taken from section 13.6.7 of ptc/98-12-04.
  • -*
  • a public constructor that takes an InputStream as its argument.
  • -*
  • Appropriate definitions of getId() and writeData(). getId() must -* return SERVICE_CONTEXT_ID.
  • -*
-*

-* The subclass can be constructed either directly from the service context -* representation, or by reading the representation from an input stream. -* These cases are needed when the service context is created and written to -* the request or reply, and when the service context is read from the -* received request or reply. -*/ -public abstract class ServiceContext { - /** Simple default constructor used when subclass is constructed - * from its representation. - */ - protected ServiceContext() { } - - private void dprint( String msg ) - { - ORBUtility.dprint( this, msg ) ; - } - - /** Stream constructor used when subclass is constructed from an - * InputStream. This constructor must be called by super( stream ) - * in the subclass. After this constructor completes, the service - * context representation can be read from in. - * Note that the service context id has been consumed from the input - * stream before this object is constructed. - */ - protected ServiceContext(InputStream s, GIOPVersion gv) throws SystemException - { - in = s; - } - - /** Returns Service context id. Must be overloaded in subclass. - */ - public abstract int getId() ; - - /** Write the service context to an output stream. This method - * must be used for writing the service context to a request or reply - * header. - */ - public void write(OutputStream s, GIOPVersion gv) throws SystemException - { - EncapsOutputStream os = - sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv); - os.putEndian() ; - writeData( os ) ; - byte[] data = os.toByteArray() ; - - s.write_long(getId()); - s.write_long(data.length); - s.write_octet_array(data, 0, data.length); - } - - /** Writes the data used to represent the subclasses service context - * into an encapsulation stream. Must be overloaded in subclass. - */ - protected abstract void writeData( OutputStream os ) ; - - /** in is the stream containing the service context representation. - * It is constructed by the stream constructor, and available for use - * in the subclass stream constructor. - */ - protected InputStream in = null ; - - public String toString() - { - return "ServiceContext[ id=" + getId() + " ]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextData.java 2018-01-30 20:23:16.000000000 -0500 +++ /dev/null 2018-01-30 20:23:16.000000000 -0500 @@ -1,161 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.spi.servicecontext; - -import org.omg.CORBA.BAD_PARAM ; -import org.omg.CORBA_2_3.portable.InputStream ; -import com.sun.corba.se.spi.servicecontext.ServiceContext ; -import java.lang.reflect.InvocationTargetException ; -import java.lang.reflect.Modifier ; -import java.lang.reflect.Field ; -import java.lang.reflect.Constructor ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -/** Internal class used to hold data about a service context class. -*/ -public class ServiceContextData { - private void dprint( String msg ) - { - ORBUtility.dprint( this, msg ) ; - } - - private void throwBadParam( String msg, Throwable exc ) - { - BAD_PARAM error = new BAD_PARAM( msg ) ; - if (exc != null) - error.initCause( exc ) ; - throw error ; - } - - public ServiceContextData( Class cls ) - { - if (ORB.ORBInitDebug) - dprint( "ServiceContextData constructor called for class " + cls ) ; - - scClass = cls ; - - try { - if (ORB.ORBInitDebug) - dprint( "Finding constructor for " + cls ) ; - - // Find the appropriate constructor in cls - Class[] args = new Class[2] ; - args[0] = InputStream.class ; - args[1] = GIOPVersion.class; - try { - scConstructor = cls.getConstructor( args ) ; - } catch (NoSuchMethodException nsme) { - throwBadParam( "Class does not have an InputStream constructor", nsme ) ; - } - - if (ORB.ORBInitDebug) - dprint( "Finding SERVICE_CONTEXT_ID field in " + cls ) ; - - // get the ID from the public static final int SERVICE_CONTEXT_ID - Field fld = null ; - try { - fld = cls.getField( "SERVICE_CONTEXT_ID" ) ; - } catch (NoSuchFieldException nsfe) { - throwBadParam( "Class does not have a SERVICE_CONTEXT_ID member", nsfe ) ; - } catch (SecurityException se) { - throwBadParam( "Could not access SERVICE_CONTEXT_ID member", se ) ; - } - - if (ORB.ORBInitDebug) - dprint( "Checking modifiers of SERVICE_CONTEXT_ID field in " + cls ) ; - - int mod = fld.getModifiers() ; - if (!Modifier.isPublic(mod) || !Modifier.isStatic(mod) || - !Modifier.isFinal(mod) ) - throwBadParam( "SERVICE_CONTEXT_ID field is not public static final", null ) ; - - if (ORB.ORBInitDebug) - dprint( "Getting value of SERVICE_CONTEXT_ID in " + cls ) ; - - try { - scId = fld.getInt( null ) ; - } catch (IllegalArgumentException iae) { - throwBadParam( "SERVICE_CONTEXT_ID not convertible to int", iae ) ; - } catch (IllegalAccessException iae2) { - throwBadParam( "Could not access value of SERVICE_CONTEXT_ID", iae2 ) ; - } - } catch (BAD_PARAM nssc) { - if (ORB.ORBInitDebug) - dprint( "Exception in ServiceContextData constructor: " + nssc ) ; - throw nssc ; - } catch (Throwable thr) { - if (ORB.ORBInitDebug) - dprint( "Unexpected Exception in ServiceContextData constructor: " + - thr ) ; - } - - if (ORB.ORBInitDebug) - dprint( "ServiceContextData constructor completed" ) ; - } - - /** Factory method used to create a ServiceContext object by - * unmarshalling it from the InputStream. - */ - public ServiceContext makeServiceContext(InputStream is, GIOPVersion gv) - { - Object[] args = new Object[2]; - args[0] = is ; - args[1] = gv; - ServiceContext sc = null ; - - try { - sc = (ServiceContext)(scConstructor.newInstance( args )) ; - } catch (IllegalArgumentException iae) { - throwBadParam( "InputStream constructor argument error", iae ) ; - } catch (IllegalAccessException iae2) { - throwBadParam( "InputStream constructor argument error", iae2 ) ; - } catch (InstantiationException ie) { - throwBadParam( "InputStream constructor called for abstract class", ie ) ; - } catch (InvocationTargetException ite) { - throwBadParam( "InputStream constructor threw exception " + - ite.getTargetException(), ite ) ; - } - - return sc ; - } - - int getId() - { - return scId ; - } - - public String toString() - { - return "ServiceContextData[ scClass=" + scClass + " scConstructor=" + - scConstructor + " scId=" + scId + " ]" ; - } - - private Class scClass ; - private Constructor scConstructor ; - private int scId ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextRegistry.java 2018-01-30 20:23:16.000000000 -0500 +++ /dev/null 2018-01-30 20:23:16.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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.corba.se.spi.servicecontext; - -import org.omg.CORBA.BAD_PARAM; -import java.util.Vector ; -import java.util.Enumeration ; -import com.sun.corba.se.spi.servicecontext.ServiceContext ; -import com.sun.corba.se.spi.servicecontext.ServiceContextData ; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; - -public class ServiceContextRegistry { - private ORB orb ; - private Vector scCollection ; - - private void dprint( String msg ) - { - ORBUtility.dprint( this, msg ) ; - } - - public ServiceContextRegistry( ORB orb ) - { - scCollection = new Vector() ; - this.orb = orb ; - } - - /** Register the ServiceContext class so that it will be recognized - * by the read method. - * Class cls must have the following properties: - *

    - *
  • It must derive from com.sun.corba.se.spi.servicecontext.ServiceContext.
  • - *
  • It must have a public static final int SERVICE_CONTEXT_ID - * member.
  • - *
  • It must implement a constructor that takes a - * org.omg.CORBA_2_3.portable.InputStream argument.
  • - *
- */ - public void register( Class cls ) - { - if (ORB.ORBInitDebug) - dprint( "Registering service context class " + cls ) ; - - ServiceContextData scd = new ServiceContextData( cls ) ; - - if (findServiceContextData(scd.getId()) == null) - scCollection.addElement( scd ) ; - else - throw new BAD_PARAM( "Tried to register duplicate service context" ) ; - } - - public ServiceContextData findServiceContextData( int scId ) - { - if (ORB.ORBInitDebug) - dprint( "Searching registry for service context id " + scId ) ; - - Enumeration enumeration = scCollection.elements() ; - while (enumeration.hasMoreElements()) { - ServiceContextData scd = - (ServiceContextData)(enumeration.nextElement()) ; - if (scd.getId() == scId) { - if (ORB.ORBInitDebug) - dprint( "Service context data found: " + scd ) ; - - return scd ; - } - } - - if (ORB.ORBInitDebug) - dprint( "Service context data not found" ) ; - - return null ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java 2018-01-30 20:23:17.000000000 -0500 +++ /dev/null 2018-01-30 20:23:17.000000000 -0500 @@ -1,415 +0,0 @@ -/* - * Copyright (c) 1999, 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.corba.se.spi.servicecontext; - -import java.lang.reflect.InvocationTargetException ; -import java.lang.reflect.Modifier ; -import java.lang.reflect.Field ; -import java.lang.reflect.Constructor ; -import java.util.*; - -import org.omg.CORBA.OctetSeqHelper; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.INTERNAL; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA_2_3.portable.OutputStream ; -import org.omg.CORBA_2_3.portable.InputStream ; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; - -import com.sun.corba.se.spi.orb.ORB ; - -import com.sun.corba.se.spi.logging.CORBALogDomains; - - -import com.sun.corba.se.spi.servicecontext.ServiceContext ; -import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ; -import com.sun.corba.se.spi.servicecontext.ServiceContextData ; -import com.sun.corba.se.spi.servicecontext.UnknownServiceContext ; - -import com.sun.corba.se.impl.encoding.CDRInputStream; -import com.sun.corba.se.impl.encoding.EncapsInputStream ; -import com.sun.corba.se.impl.orbutil.ORBUtility ; -import com.sun.corba.se.impl.util.Utility ; -import com.sun.corba.se.impl.logging.ORBUtilSystemException ; - -import sun.corba.EncapsInputStreamFactory; - - -public class ServiceContexts { - private static boolean isDebugging( OutputStream os ) - { - ORB orb = (ORB)(os.orb()) ; - if (orb==null) - return false ; - return orb.serviceContextDebugFlag ; - } - - private static boolean isDebugging( InputStream is ) - { - ORB orb = (ORB)(is.orb()) ; - if (orb==null) - return false ; - return orb.serviceContextDebugFlag ; - } - - private void dprint( String msg ) - { - ORBUtility.dprint( this, msg ) ; - } - - public static void writeNullServiceContext( OutputStream os ) - { - if (isDebugging(os)) - ORBUtility.dprint( "ServiceContexts", "Writing null service context" ) ; - os.write_long( 0 ) ; - } - - /** - * Given the input stream, this fills our service - * context map. See the definition of scMap for - * details. Creates a HashMap. - * - * Note that we don't actually unmarshal the - * bytes of the service contexts here. That is - * done when they are actually requested via - * get(int). - */ - private void createMapFromInputStream(InputStream is) - { - orb = (ORB)(is.orb()) ; - if (orb.serviceContextDebugFlag) - dprint( "Constructing ServiceContexts from input stream" ) ; - - int numValid = is.read_long() ; - - if (orb.serviceContextDebugFlag) - dprint("Number of service contexts = " + numValid); - - for (int ctr = 0; ctr < numValid; ctr++) { - int scId = is.read_long(); - - if (orb.serviceContextDebugFlag) - dprint("Reading service context id " + scId); - - byte[] data = OctetSeqHelper.read(is); - - if (orb.serviceContextDebugFlag) - dprint("Service context" + scId + " length: " + data.length); - - scMap.put(new Integer(scId), data); - } - } - - public ServiceContexts( ORB orb ) - { - this.orb = orb ; - wrapper = ORBUtilSystemException.get( orb, - CORBALogDomains.RPC_PROTOCOL ) ; - - addAlignmentOnWrite = false ; - - scMap = new HashMap(); - - // Use the GIOP version of the ORB. Should - // be specified in ServiceContext. - // See REVISIT below concerning giopVersion. - giopVersion = orb.getORBData().getGIOPVersion(); - codeBase = null ; - } - - /** - * Read the Service contexts from the input stream. - */ - public ServiceContexts(InputStream s) - { - this( (ORB)(s.orb()) ) ; - - // We need to store this so that we can have access - // to the CodeBase for unmarshaling possible - // RMI-IIOP valuetype data within an encapsulation. - // (Known case: UnknownExceptionInfo) - codeBase = ((CDRInputStream)s).getCodeBase(); - - createMapFromInputStream(s); - - // Fix for bug 4904723 - giopVersion = ((CDRInputStream)s).getGIOPVersion(); - } - - /** - * Find the ServiceContextData for a given scId and unmarshal - * the bytes. - */ - private ServiceContext unmarshal(Integer scId, byte[] data) { - - ServiceContextRegistry scr = orb.getServiceContextRegistry(); - - ServiceContextData scd = scr.findServiceContextData(scId.intValue()); - ServiceContext sc = null; - - if (scd == null) { - if (orb.serviceContextDebugFlag) { - dprint("Could not find ServiceContextData for " - + scId - + " using UnknownServiceContext"); - } - - sc = new UnknownServiceContext(scId.intValue(), data); - - } else { - - if (orb.serviceContextDebugFlag) { - dprint("Found " + scd); - } - - // REVISIT. GIOP version should be specified as - // part of a service context's definition, so should - // be accessible from ServiceContextData via - // its ServiceContext implementation class. - // - // Since we don't have that, yet, I'm using the GIOP - // version of the input stream, presuming that someone - // can't send a service context of a later GIOP - // version than its stream version. - // - // Note: As of Jan 2001, no standard OMG or Sun service contexts - // ship wchar data or are defined as using anything but GIOP 1.0 CDR. - EncapsInputStream eis - = EncapsInputStreamFactory.newEncapsInputStream(orb, - data, - data.length, - giopVersion, - codeBase); - eis.consumeEndian(); - - // Now the input stream passed to a ServiceContext - // constructor is already the encapsulation input - // stream with the endianness read off, so the - // service context should just unmarshal its own - // data. - sc = scd.makeServiceContext(eis, giopVersion); - if (sc == null) - throw wrapper.svcctxUnmarshalError( - CompletionStatus.COMPLETED_MAYBE); - } - - return sc; - } - - public void addAlignmentPadding() - { - // Make service context 12 bytes longer by adding - // JAVAIDL_ALIGN_SERVICE_ID service context at end. - // The exact length - // must be >8 (minimum service context size) and - // =4 mod 8, so 12 is the minimum. - addAlignmentOnWrite = true ; - } - - /** - * Hopefully unused scid: This should be changed to a proper - * VMCID aligned value. REVISIT! - */ - private static final int JAVAIDL_ALIGN_SERVICE_ID = 0xbe1345cd ; - - /** - * Write the service contexts to the output stream. - * - * If they haven't been unmarshaled, we don't have to - * unmarshal them. - */ - public void write(OutputStream os, GIOPVersion gv) - { - if (isDebugging(os)) { - dprint( "Writing service contexts to output stream" ) ; - Utility.printStackTrace() ; - } - - int numsc = scMap.size(); - - if (addAlignmentOnWrite) { - if (isDebugging(os)) - dprint( "Adding alignment padding" ) ; - - numsc++ ; - } - - if (isDebugging(os)) - dprint( "Service context has " + numsc + " components" ) ; - - os.write_long( numsc ) ; - - writeServiceContextsInOrder(os, gv); - - if (addAlignmentOnWrite) { - if (isDebugging(os)) - dprint( "Writing alignment padding" ) ; - - os.write_long( JAVAIDL_ALIGN_SERVICE_ID ) ; - os.write_long( 4 ) ; - os.write_octet( (byte)0 ) ; - os.write_octet( (byte)0 ) ; - os.write_octet( (byte)0 ) ; - os.write_octet( (byte)0 ) ; - } - - if (isDebugging(os)) - dprint( "Service context writing complete" ) ; - } - - /** - * Write the service contexts in scMap in a desired order. - * Right now, the only special case we have is UnknownExceptionInfo, - * so I'm merely writing it last if present. - */ - private void writeServiceContextsInOrder(OutputStream os, GIOPVersion gv) { - - // Temporarily remove this rather than check it per iteration - Integer ueInfoId - = new Integer(UEInfoServiceContext.SERVICE_CONTEXT_ID); - - Object unknownExceptionInfo = scMap.remove(ueInfoId); - - Iterator iter = scMap.keySet().iterator(); - - while (iter.hasNext()) { - Integer id = (Integer)iter.next(); - - writeMapEntry(os, id, scMap.get(id), gv); - } - - // Write the UnknownExceptionInfo service context last - // (so it will be after the CodeBase) and restore it in - // the map. - if (unknownExceptionInfo != null) { - writeMapEntry(os, ueInfoId, unknownExceptionInfo, gv); - - scMap.put(ueInfoId, unknownExceptionInfo); - } - } - - /** - * Write the given entry from the scMap to the OutputStream. - * See note on giopVersion. The service context should - * know the GIOP version it is meant for. - */ - private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) { - - // If it's still in byte[] form, we don't need to - // unmarshal it here, just copy the bytes into - // the new stream. - - if (scObj instanceof byte[]) { - if (isDebugging(os)) - dprint( "Writing service context bytes for id " + id); - - OctetSeqHelper.write(os, (byte[])scObj); - - } else { - - // We actually unmarshaled it into a ServiceContext - // at some point. - ServiceContext sc = (ServiceContext)scObj; - - if (isDebugging(os)) - dprint( "Writing service context " + sc ) ; - - sc.write(os, gv); - } - } - - /** Add a service context to the stream, if there is not already - * a service context in this object with the same id as sc. - */ - public void put( ServiceContext sc ) - { - Integer id = new Integer(sc.getId()); - scMap.put(id, sc); - } - - public void delete( int scId ) { - this.delete(new Integer(scId)); - } - - public void delete(Integer id) - { - scMap.remove(id) ; - } - - public ServiceContext get(int scId) { - return this.get(new Integer(scId)); - } - - public ServiceContext get(Integer id) - { - Object result = scMap.get(id); - if (result == null) - return null ; - - // Lazy unmarshaling on first use. - if (result instanceof byte[]) { - - ServiceContext sc = unmarshal(id, (byte[])result); - - scMap.put(id, sc); - - return sc; - } else { - return (ServiceContext)result; - } - } - - private ORB orb ; - - /** - * Map of all ServiceContext objects in this container. - * - * Keys are java.lang.Integers for service context IDs. - * Values are either instances of ServiceContext or the - * unmarshaled byte arrays (unmarshaled on first use). - * - * This provides a mild optimization if we don't happen to - * use a given service context, but it's main advantage is - * that it allows us to change the order in which we - * unmarshal them. We need to do the UnknownExceptionInfo service - * context after the SendingContextRunTime service context so that we can - * get the CodeBase if necessary. - */ - private Map scMap; - - /** - * If true, write out a special alignment service context to force the - * correct alignment on re-marshalling. - */ - private boolean addAlignmentOnWrite ; - - private CodeBase codeBase; - private GIOPVersion giopVersion; - private ORBUtilSystemException wrapper ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UEInfoServiceContext.java 2018-01-30 20:23:18.000000000 -0500 +++ /dev/null 2018-01-30 20:23:18.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.spi.servicecontext; - -import java.io.Serializable ; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.CompletionStatus; -import org.omg.CORBA.UNKNOWN; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.servicecontext.ServiceContext ; - -public class UEInfoServiceContext extends ServiceContext { - public UEInfoServiceContext( Throwable ex ) - { - unknown = ex ; - } - - public UEInfoServiceContext(InputStream is, GIOPVersion gv) - { - super(is, gv) ; - - try { - unknown = (Throwable) in.read_value() ; - } catch (ThreadDeath d) { - throw d ; - } catch (Throwable e) { - unknown = new UNKNOWN( 0, CompletionStatus.COMPLETED_MAYBE ) ; - } - } - - // Required SERVICE_CONTEXT_ID and getId definitions - public static final int SERVICE_CONTEXT_ID = 9 ; - public int getId() { return SERVICE_CONTEXT_ID ; } - - public void writeData( OutputStream os ) throws SystemException - { - os.write_value( (Serializable)unknown ) ; - } - - public Throwable getUE() { return unknown ; } - - private Throwable unknown = null ; - - public String toString() - { - return "UEInfoServiceContext[ unknown=" + unknown.toString() + " ]" ; - } -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UnknownServiceContext.java 2018-01-30 20:23:18.000000000 -0500 +++ /dev/null 2018-01-30 20:23:18.000000000 -0500 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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.corba.se.spi.servicecontext; - -import org.omg.CORBA.SystemException; -import org.omg.CORBA_2_3.portable.InputStream; -import org.omg.CORBA_2_3.portable.OutputStream; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.servicecontext.ServiceContext ; - -public class UnknownServiceContext extends ServiceContext { - public UnknownServiceContext( int id, byte[] data ) - { - this.id = id ; - this.data = data ; - } - - public UnknownServiceContext( int id, InputStream is ) - { - this.id = id ; - - int len = is.read_long(); - data = new byte[len]; - is.read_octet_array(data,0,len); - } - - public int getId() { return id ; } - - public void writeData( OutputStream os ) throws SystemException - { - } - - public void write( OutputStream os , GIOPVersion gv) - throws SystemException - { - os.write_long( id ) ; - os.write_long( data.length ) ; - os.write_octet_array( data, 0, data.length ) ; - } - - public byte[] getData() - { - return data ; - } - - private int id = -1 ; - private byte[] data = null ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaAcceptor.java 2018-01-30 20:23:19.000000000 -0500 +++ /dev/null 2018-01-30 20:23:19.000000000 -0500 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.transport; - -import com.sun.corba.se.pept.transport.Acceptor; - -import com.sun.corba.se.spi.ior.IORTemplate; - -// REVISIT - impl/poa specific: -import com.sun.corba.se.impl.oa.poa.Policies; - -/** - * @author Harold Carr - */ -public interface CorbaAcceptor - extends - Acceptor -{ - public String getObjectAdapterId(); - public String getObjectAdapterManagerId(); - public void addToIORTemplate(IORTemplate iorTemplate, Policies policies, - String codebase); - public String getMonitoringName(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java 2018-01-30 20:23:20.000000000 -0500 +++ /dev/null 2018-01-30 20:23:20.000000000 -0500 @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.corba.se.spi.transport; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.nio.channels.SocketChannel; - -import org.omg.CORBA.SystemException; - -import com.sun.org.omg.SendingContext.CodeBase; - -import com.sun.corba.se.pept.encoding.InputObject; -import com.sun.corba.se.pept.encoding.OutputObject; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.Connection; -import com.sun.corba.se.pept.transport.ResponseWaitingRoom; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import com.sun.corba.se.impl.encoding.CodeSetComponentInfo; -import com.sun.corba.se.impl.logging.ORBUtilSystemException; - -/** - * @author Harold Carr - */ -public interface CorbaConnection - extends - Connection, - com.sun.corba.se.spi.legacy.connection.Connection -{ - public boolean shouldUseDirectByteBuffers(); - - public boolean shouldReadGiopHeaderOnly(); - - public ByteBuffer read(int size, int offset, int length, long max_wait_time) - throws IOException; - - public ByteBuffer read(ByteBuffer byteBuffer, int offset, - int length, long max_wait_time) throws IOException; - - public void write(ByteBuffer byteBuffer) - throws IOException; - - public void dprint(String msg); - - // - // From iiop.Connection.java - // - - public int getNextRequestId(); - public ORB getBroker(); - public CodeSetComponentInfo.CodeSetContext getCodeSetContext(); - public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc); - - // - // from iiop.IIOPConnection.java - // - - // Facade to ResponseWaitingRoom. - public MessageMediator clientRequestMapGet(int requestId); - - public void clientReply_1_1_Put(MessageMediator x); - public MessageMediator clientReply_1_1_Get(); - public void clientReply_1_1_Remove(); - - public void serverRequest_1_1_Put(MessageMediator x); - public MessageMediator serverRequest_1_1_Get(); - public void serverRequest_1_1_Remove(); - - public boolean isPostInitialContexts(); - - // Can never be unset... - public void setPostInitialContexts(); - - public void purgeCalls(SystemException systemException, - boolean die, boolean lockHeld); - - // - // Connection status - // - public static final int OPENING = 1; - public static final int ESTABLISHED = 2; - public static final int CLOSE_SENT = 3; - public static final int CLOSE_RECVD = 4; - public static final int ABORT = 5; - - // Begin Code Base methods --------------------------------------- - // - // Set this connection's code base IOR. The IOR comes from the - // SendingContext. This is an optional service context, but all - // JavaSoft ORBs send it. - // - // The set and get methods don't need to be synchronized since the - // first possible get would occur during reading a valuetype, and - // that would be after the set. - - // Sets this connection's code base IOR. This is done after - // getting the IOR out of the SendingContext service context. - // Our ORBs always send this, but it's optional in CORBA. - - void setCodeBaseIOR(IOR ior); - - IOR getCodeBaseIOR(); - - // Get a CodeBase stub to use in unmarshaling. The CachedCodeBase - // won't connect to the remote codebase unless it's necessary. - CodeBase getCodeBase(); - - // End Code Base methods ----------------------------------------- - - public void sendCloseConnection(GIOPVersion giopVersion) - throws IOException; - - public void sendMessageError(GIOPVersion giopVersion) - throws IOException; - - public void sendCancelRequest(GIOPVersion giopVersion, int requestId) - throws - IOException; - - public void sendCancelRequestWithLock(GIOPVersion giopVersion, - int requestId) - throws - IOException; - - public ResponseWaitingRoom getResponseWaitingRoom(); - - public void serverRequestMapPut(int requestId, - CorbaMessageMediator messageMediator); - public CorbaMessageMediator serverRequestMapGet(int requestId); - public void serverRequestMapRemove(int requestId); - - // REVISIT: WRONG: should not expose sockets here. - public SocketChannel getSocketChannel(); - - // REVISIT - MessageMediator parameter? - public void serverRequestProcessingBegins(); - public void serverRequestProcessingEnds(); - - /** Clean up all connection resources. Used when shutting down an ORB. - */ - public void closeConnectionResources(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnectionCache.java 2018-01-30 20:23:20.000000000 -0500 +++ /dev/null 2018-01-30 20:23:20.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.transport; - -/** - * @author Harold Carr - */ -public interface CorbaConnectionCache -{ - public String getMonitoringName(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfo.java 2018-01-30 20:23:21.000000000 -0500 +++ /dev/null 2018-01-30 20:23:21.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.transport; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.ior.iiop.IIOPProfile; - -import com.sun.corba.se.pept.transport.ContactInfo ; - -/** - * @author Harold Carr - */ -public interface CorbaContactInfo - extends - ContactInfo -{ - public IOR getTargetIOR(); - public IOR getEffectiveTargetIOR(); - public IIOPProfile getEffectiveProfile(); // REVISIT - type - public void setAddressingDisposition(short addressingDisposition); - public short getAddressingDisposition(); - public String getMonitoringName(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoList.java 2018-01-30 20:23:22.000000000 -0500 +++ /dev/null 2018-01-30 20:23:22.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.spi.transport; - -import com.sun.corba.se.spi.ior.IOR ; - -import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ; - -import com.sun.corba.se.pept.transport.ContactInfoList ; - -/** - * @author Harold Carr - */ -public interface CorbaContactInfoList - extends - ContactInfoList -{ - public void setTargetIOR(IOR ior); - public IOR getTargetIOR(); - - public void setEffectiveTargetIOR(IOR locatedIor); - public IOR getEffectiveTargetIOR(); - - public LocalClientRequestDispatcher getLocalClientRequestDispatcher(); - - public int hashCode(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListFactory.java 2018-01-30 20:23:23.000000000 -0500 +++ /dev/null 2018-01-30 20:23:23.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.transport ; - -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.orb.ORB; - -/** Interface used to create a ContactInfoList from an IOR, as required - * for supporting CORBA semantics using the DCS framework. This is a - * natural correspondence since an IOR contains the information for - * contacting one or more communication endpoints that can be used to - * invoke a method on an object, along with the necessary information - * on particular transports, encodings, and protocols to use. - * Note that the actual implementation may support more than one - * IOR in the case of GIOP with Location Forward messages. - */ -public interface CorbaContactInfoListFactory { - /** - * This will be called after the no-arg constructor before - * create is called. - */ - public void setORB(ORB orb); - - public CorbaContactInfoList create( IOR ior ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListIterator.java 2018-01-30 20:23:23.000000000 -0500 +++ /dev/null 2018-01-30 20:23:23.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.transport ; - -import com.sun.corba.se.pept.transport.ContactInfoListIterator ; - -import com.sun.corba.se.spi.ior.IOR; -import com.sun.corba.se.spi.transport.CorbaContactInfo; - -public interface CorbaContactInfoListIterator extends ContactInfoListIterator -{ - // REVISIT: this is GIOP specific. - public void reportAddrDispositionRetry(CorbaContactInfo contactInfo, - short disposition); - - public void reportRedirect(CorbaContactInfo contactInfo, - IOR forwardedIOR); - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaResponseWaitingRoom.java 2018-01-30 20:23:24.000000000 -0500 +++ /dev/null 2018-01-30 20:23:24.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.transport; - -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.pept.transport.ResponseWaitingRoom; -import org.omg.CORBA.SystemException; - -/** - * @author Harold Carr - */ -public interface CorbaResponseWaitingRoom - extends - ResponseWaitingRoom -{ - public void signalExceptionToAllWaiters(SystemException systemException); - - public MessageMediator getMessageMediator(int requestId); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaTransportManager.java 2018-01-30 20:23:25.000000000 -0500 +++ /dev/null 2018-01-30 20:23:25.000000000 -0500 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.transport; - -import java.util.Collection; - -import com.sun.corba.se.pept.transport.TransportManager; -import com.sun.corba.se.spi.ior.IORTemplate; -import com.sun.corba.se.spi.ior.ObjectAdapterId; - -// REVISIT - impl/poa specific: -import com.sun.corba.se.impl.oa.poa.Policies; - -/** - * @author Harold Carr - */ -public interface CorbaTransportManager - extends - TransportManager -{ - public static final String SOCKET_OR_CHANNEL_CONNECTION_CACHE = - "SocketOrChannelConnectionCache"; - - public Collection getAcceptors(String objectAdapterManagerId, - ObjectAdapterId objectAdapterId); - - // REVISIT - POA specific policies - public void addToIORTemplate(IORTemplate iorTemplate, - Policies policies, - String codebase, - String objectAdapterManagerId, - ObjectAdapterId objectAdapterId); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IIOPPrimaryToContactInfo.java 2018-01-30 20:23:25.000000000 -0500 +++ /dev/null 2018-01-30 20:23:25.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.transport; - -import java.util.List; - -import com.sun.corba.se.pept.transport.ContactInfo; - -/** - * This interface is the "sticky manager" for IIOP failover. The default - * ORB does NOT contain a sticky manager. One is registered by supplying - * a class via the com.sun.CORBA.transport.ORBIIOPPrimaryToContactInfoClass. - * - * It uses the IIOP primary host/port (with a SocketInfo.IIOP_CLEAR_TEXT type) - * as a key to map to the last ContactInfo that resulted in successful' - * communication. - * - * It mainly prevents "fallback" - if a previously failed replica comes - * back up we do NOT want to switch back to using it - particularly in the - * case of statefull session beans. - * - * Note: This assumes static lists of replicas (e.g., AS 8.1 EE). - * This does NOT work well with LOCATION_FORWARD. - * - * @author Harold Carr - */ -public interface IIOPPrimaryToContactInfo -{ - /** - * @param primary - clear any state relating to primary. - */ - public void reset(ContactInfo primary); - - /** - * @param primary - the key. - * @param previous - if null return true. Otherwise, find previous in - * contactInfos and if another ContactInfo - * follows it in the list then return true. Otherwise false. - * @param contactInfos - the list of replicas associated with the - * primary. - */ - public boolean hasNext(ContactInfo primary, - ContactInfo previous, - List contactInfos); - - /** - * @param primary - the key. - * @param previous - if null then map primary to failover. If failover is - * empty then map primary to primary and return primary. If failover is - * non-empty then return failover. If previous is non-null that - * indicates that the previous failed. Therefore, find previous in - * contactInfos. Map the ContactInfo following - * previous to primary and return that ContactInfo. - */ - public ContactInfo next(ContactInfo primary, - ContactInfo previous, - List contactInfos); - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORToSocketInfo.java 2018-01-30 20:23:26.000000000 -0500 +++ /dev/null 2018-01-30 20:23:26.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.transport; - -import java.util.List; - -import com.sun.corba.se.spi.ior.IOR; - -public interface IORToSocketInfo -{ - /** - * Used to extract socket address information from an IOR. - * - * @param ior. - * - * @return List - a list of SocketInfo. - * - */ - public List getSocketInfo(IOR ior); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORTransformer.java 2018-01-30 20:23:27.000000000 -0500 +++ /dev/null 2018-01-30 20:23:27.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, 2003, 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.corba.se.spi.transport ; - -import com.sun.corba.se.spi.ior.IOR ; -import com.sun.corba.se.spi.encoding.CorbaInputObject ; -import com.sun.corba.se.spi.encoding.CorbaOutputObject ; - -/** Interface that provides operations to transorm an IOR - * between its programmatic representation and a representation - * in an Input or Output object. - */ -public interface IORTransformer { - IOR unmarshal( CorbaInputObject io ) ; - - void marshal( CorbaOutputObject oo, IOR ior ) ; -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ORBSocketFactory.java 2018-01-30 20:23:27.000000000 -0500 +++ /dev/null 2018-01-30 20:23:27.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.transport; - -import java.io.IOException; -import java.net.InetSocketAddress; -import java.net.Socket; -import java.net.SocketException; -import java.net.ServerSocket; - -import com.sun.corba.se.pept.transport.Acceptor; -import com.sun.corba.se.spi.orb.ORB; - -/** - * @author Harold Carr - */ -public interface ORBSocketFactory -{ - public void setORB(ORB orb); - - public ServerSocket createServerSocket(String type, - InetSocketAddress inetSocketAddress) - throws IOException; - - public Socket createSocket(String type, - InetSocketAddress inetSocketAddress) - throws IOException; - - public void setAcceptedSocketOptions(Acceptor acceptor, - ServerSocket serverSocket, - Socket socket) - throws SocketException; - -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeouts.java 2018-01-30 20:23:28.000000000 -0500 +++ /dev/null 2018-01-30 20:23:28.000000000 -0500 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.transport; - -public interface ReadTimeouts { - public int get_initial_time_to_wait(); - public int get_max_time_to_wait(); - public double get_backoff_factor(); - public int get_max_giop_header_time_to_wait(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeoutsFactory.java 2018-01-30 20:23:29.000000000 -0500 +++ /dev/null 2018-01-30 20:23:29.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2004, 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.corba.se.spi.transport ; - -import com.sun.corba.se.spi.transport.ReadTimeouts; - -public interface ReadTimeoutsFactory { - // create transport read timeouts - public ReadTimeouts create(int initial_wait_time, - int max_wait_time, - int max_giop_hdr_wait_time, - int backoff_percent_factor); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketInfo.java 2018-01-30 20:23:29.000000000 -0500 +++ /dev/null 2018-01-30 20:23:30.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2000, 2004, 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.corba.se.spi.transport; - -public interface SocketInfo -{ - // Endpoint types known in advance. - // If you change the value of this constant then update - // activation.idl accordingly. It has a duplicate definition - // to avoid a compilation dependency. - - public static final String IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT"; - - - public String getType(); - - public String getHost(); - - public int getPort(); -} --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketOrChannelAcceptor.java 2018-01-30 20:23:30.000000000 -0500 +++ /dev/null 2018-01-30 20:23:30.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2003, 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.corba.se.spi.transport; - -import java.net.ServerSocket; - -/** - * @author Harold Carr - */ -public interface SocketOrChannelAcceptor -{ - public ServerSocket getServerSocket(); -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/corba/se/spi/transport/TransportDefault.java 2018-01-30 20:23:31.000000000 -0500 +++ /dev/null 2018-01-30 20:23:31.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2002, 2004, 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.corba.se.spi.transport ; - -import com.sun.corba.se.spi.protocol.CorbaClientDelegate ; -import com.sun.corba.se.spi.protocol.ClientDelegateFactory ; -import com.sun.corba.se.spi.transport.CorbaContactInfoList ; -import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ; -import com.sun.corba.se.spi.transport.ReadTimeouts; -import com.sun.corba.se.spi.transport.ReadTimeoutsFactory; -import com.sun.corba.se.spi.orb.ORB ; -import com.sun.corba.se.spi.ior.IOR ; - -// Internal imports, not used in the interface to this package -import com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl ; -import com.sun.corba.se.impl.transport.CorbaContactInfoListImpl; -import com.sun.corba.se.impl.transport.ReadTCPTimeoutsImpl; - -/** This class provices standard building blocks for the ORB, as do all Default classes - * in the various packages. - */ -public abstract class TransportDefault { - private TransportDefault() {} - - public static CorbaContactInfoListFactory makeCorbaContactInfoListFactory( - final ORB broker ) - { - return new CorbaContactInfoListFactory() { - public void setORB(ORB orb) { } - public CorbaContactInfoList create( IOR ior ) { - return new CorbaContactInfoListImpl( - (com.sun.corba.se.spi.orb.ORB)broker, ior ) ; - } - }; - } - - public static ClientDelegateFactory makeClientDelegateFactory( - final ORB broker ) - { - return new ClientDelegateFactory() { - public CorbaClientDelegate create( CorbaContactInfoList info ) { - return new CorbaClientDelegateImpl( - (com.sun.corba.se.spi.orb.ORB)broker, info ) ; - } - }; - } - - public static IORTransformer makeIORTransformer( - final ORB broker ) - { - return null ; - } - - public static ReadTimeoutsFactory makeReadTimeoutsFactory() - { - return new ReadTimeoutsFactory() { - public ReadTimeouts create(int initial_wait_time, - int max_wait_time, - int max_giop_hdr_wait_time, - int backoff_percent_factor) - { - return new ReadTCPTimeoutsImpl( - initial_wait_time, - max_wait_time, - max_giop_hdr_wait_time, - backoff_percent_factor); - }; - }; - } -} - -// End of file. --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java 2018-01-30 20:23:32.000000000 -0500 +++ /dev/null 2018-01-30 20:23:32.000000000 -0500 @@ -1,240 +0,0 @@ -/* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jndi.cosnaming; - -import javax.naming.*; -import javax.naming.spi.NamingManager; - -import java.util.NoSuchElementException; -import java.util.Hashtable; - -import org.omg.CosNaming.*; - -import com.sun.jndi.toolkit.corba.CorbaUtils; - -/** - * Implements the JNDI NamingEnumeration interface for COS - * Naming. Gets hold of a list of bindings from the COS Naming Server - * and allows the client to iterate through them. - * - * @author Raj Krishnamurthy - * @author Rosanna Lee - */ - -final class CNBindingEnumeration - implements NamingEnumeration { - - private static final int DEFAULT_BATCHSIZE = 100; - private BindingListHolder _bindingList; // list of bindings - private BindingIterator _bindingIter; // iterator for getting list of bindings - private int counter; // pointer in _bindingList - private int batchsize = DEFAULT_BATCHSIZE; // how many to ask for each time - private CNCtx _ctx; // ctx to list - private Hashtable _env; // environment for getObjectInstance - private boolean more = false; // iterator done? - private boolean isLookedUpCtx = false; // iterating on a context beneath this context ? - - /** - * Creates a CNBindingEnumeration object. - * @param ctx Context to enumerate - */ - CNBindingEnumeration(CNCtx ctx, boolean isLookedUpCtx, Hashtable env) { - // Get batch size to use - String batch = (env != null ? - (String)env.get(javax.naming.Context.BATCHSIZE) : null); - if (batch != null) { - try { - batchsize = Integer.parseInt(batch); - } catch (NumberFormatException e) { - throw new IllegalArgumentException("Batch size not numeric: " + batch); - } - } - _ctx = ctx; - _ctx.incEnumCount(); - this.isLookedUpCtx = isLookedUpCtx; - _env = env; - _bindingList = new BindingListHolder(); - BindingIteratorHolder _bindingIterH = new BindingIteratorHolder(); - - // Perform listing and request that bindings be returned in _bindingIter - // Upon return,_bindingList returns a zero length list - _ctx._nc.list(0, _bindingList, _bindingIterH); - - _bindingIter = _bindingIterH.value; - - // Get first batch using _bindingIter - if (_bindingIter != null) { - more = _bindingIter.next_n(batchsize, _bindingList); - } else { - more = false; - } - counter = 0; - } - - /** - * Returns the next binding in the list. - * @exception NamingException any naming exception. - */ - - public javax.naming.Binding next() throws NamingException { - if (more && counter >= _bindingList.value.length) { - getMore(); - } - if (more && counter < _bindingList.value.length) { - org.omg.CosNaming.Binding bndg = _bindingList.value[counter]; - counter++; - return mapBinding(bndg); - } else { - throw new NoSuchElementException(); - } - } - - - /** - * Returns true or false depending on whether there are more bindings. - * @return boolean value - */ - - public boolean hasMore() throws NamingException { - // If there's more, check whether current bindingList has been exhausted, - // and if so, try to get more. - // If no more, just say so. - return more ? (counter < _bindingList.value.length || getMore()) : false; - } - - /** - * Returns true or false depending on whether there are more bindings. - * Need to define this to satisfy the Enumeration api requirement. - * @return boolean value - */ - - public boolean hasMoreElements() { - try { - return hasMore(); - } catch (NamingException e) { - return false; - } - } - - /** - * Returns the next binding in the list. - * @exception NoSuchElementException Thrown when the end of the - * list is reached. - */ - - public javax.naming.Binding nextElement() { - try { - return next(); - } catch (NamingException ne) { - throw new NoSuchElementException(); - } - } - - public void close() throws NamingException { - more = false; - if (_bindingIter != null) { - _bindingIter.destroy(); - _bindingIter = null; - } - if (_ctx != null) { - _ctx.decEnumCount(); - - /** - * context was obtained by CNCtx, the user doesn't have a handle to - * it, close it as we are done enumerating through the context - */ - if (isLookedUpCtx) { - _ctx.close(); - } - _ctx = null; - } - } - - protected void finalize() { - try { - close(); - } catch (NamingException e) { - // ignore failures - } - } - - /** - * Get the next batch using _bindingIter. Update the 'more' field. - */ - private boolean getMore() throws NamingException { - try { - more = _bindingIter.next_n(batchsize, _bindingList); - counter = 0; // reset - } catch (Exception e) { - more = false; - NamingException ne = new NamingException( - "Problem getting binding list"); - ne.setRootCause(e); - throw ne; - } - return more; - } - - /** - * Constructs a JNDI Binding object from the COS Naming binding - * object. - * @exception NameNotFound No objects under the name. - * @exception CannotProceed Unable to obtain a continuation context - * @exception InvalidName Name not understood. - * @exception NamingException One of the above. - */ - - private javax.naming.Binding mapBinding(org.omg.CosNaming.Binding bndg) - throws NamingException { - java.lang.Object obj = _ctx.callResolve(bndg.binding_name); - - Name cname = CNNameParser.cosNameToName(bndg.binding_name); - - try { - // Check whether object factory codebase is trusted - if (CorbaUtils.isObjectFactoryTrusted(obj)) { - obj = NamingManager.getObjectInstance(obj, cname, _ctx, _env); - } - } catch (NamingException e) { - throw e; - } catch (Exception e) { - NamingException ne = new NamingException( - "problem generating object using object factory"); - ne.setRootCause(e); - throw ne; - } - - // Use cname.toString() instead of bindingName because the name - // in the binding should be a composite name - String cnameStr = cname.toString(); - javax.naming.Binding jbndg = new javax.naming.Binding(cnameStr, obj); - - NameComponent[] comps = _ctx.makeFullName(bndg.binding_name); - String fullName = CNNameParser.cosNameToInsString(comps); - jbndg.setNameInNamespace(fullName); - return jbndg; - } -} --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java 2018-01-30 20:23:32.000000000 -0500 +++ /dev/null 2018-01-30 20:23:32.000000000 -0500 @@ -1,1178 +0,0 @@ -/* - * Copyright (c) 1999, 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.jndi.cosnaming; - -import javax.naming.*; -import javax.naming.spi.NamingManager; -import javax.naming.spi.ResolveResult; - -import java.util.Hashtable; -import java.net.MalformedURLException; -import java.net.URL; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.BufferedReader; -import java.io.IOException; -import java.security.AccessController; -import java.security.PrivilegedAction; - -import org.omg.CosNaming.*; -import org.omg.CosNaming.NamingContextPackage.*; -import org.omg.CORBA.*; - -import com.sun.jndi.toolkit.corba.CorbaUtils; - -// Needed for creating default ORB -import java.applet.Applet; - -/** - * Provides a bridge to the CosNaming server provided by - * JavaIDL. This class provides the InitialContext from CosNaming. - * - * @author Raj Krishnamurthy - * @author Rosanna Lee - */ - -public class CNCtx implements javax.naming.Context { - - private final static boolean debug = false; - - /* - * Implement one shared ORB among all CNCtx. However, there is a public constructor - * accepting an ORB, so we need the option of using a given ORB. - */ - private static ORB _defaultOrb; - ORB _orb; // used by ExceptionMapper and RMI/IIOP factory - public NamingContext _nc; // public for accessing underlying NamingContext - - private synchronized static ORB getDefaultOrb() { - if (_defaultOrb == null) { - _defaultOrb = CorbaUtils.getOrb(null, -1, - new Hashtable()); - } - return _defaultOrb; - } - - private NameComponent[] _name = null; - - Hashtable _env; // used by ExceptionMapper - static final CNNameParser parser = new CNNameParser(); - - private static final String FED_PROP = "com.sun.jndi.cosnaming.federation"; - boolean federation = false; - - /** - * Determines whether classes may be loaded from an arbitrary URL code base. - */ - public static final boolean trustURLCodebase; - static { - // System property to control whether classes may be loaded from an - // arbitrary URL code base - PrivilegedAction act = () -> System.getProperty( - "com.sun.jndi.cosnaming.object.trustURLCodebase", "false"); - String trust = AccessController.doPrivileged(act); - trustURLCodebase = "true".equalsIgnoreCase(trust); - } - - // Reference counter for tracking _orb references - OrbReuseTracker orbTracker = null; - int enumCount; - boolean isCloseCalled = false; - - /** - * Create a CNCtx object. Gets the initial naming - * reference for the COS Naming Service from the ORB. - * The ORB can be passed in via the java.naming.corba.orb property - * or be created using properties in the environment properties. - * @param env Environment properties for initializing name service. - * @exception NamingException Cannot initialize ORB or naming context. - */ - @SuppressWarnings("unchecked") - CNCtx(Hashtable env) throws NamingException { - if (env != null) { - env = (Hashtable)env.clone(); - } - _env = (Hashtable)env; - federation = "true".equals(env != null ? env.get(FED_PROP) : null); - initOrbAndRootContext(env); - } - - private CNCtx() { - } - - /** - * This method is used by the iiop and iiopname URL Context factories. - */ - @SuppressWarnings("unchecked") - public static ResolveResult createUsingURL(String url, Hashtable env) - throws NamingException { - CNCtx ctx = new CNCtx(); - if (env != null) { - env = (Hashtable) env.clone(); - } - ctx._env = (Hashtable)env; - String rest = ctx.initUsingUrl( - env != null ? - (org.omg.CORBA.ORB) env.get("java.naming.corba.orb") - : null, - url, env); - - // rest is the INS name - // Return the parsed form to prevent subsequent lookup - // from parsing the string as a composite name - // The caller should be aware that a toString() of the name, - // which came from the environment will yield its INS syntax, - // rather than a composite syntax - return new ResolveResult(ctx, parser.parse(rest)); - } - - /** - * Creates a CNCtx object which supports the javax.naming - * apis given a COS Naming Context object. - * @param orb The ORB used by this context - * @param tracker The ORB reuse tracker for tracking references to the - * orb object - * @param nctx The COS NamingContext object associated with this context - * @param name The name of this context relative to the root - */ - - CNCtx(ORB orb, OrbReuseTracker tracker, NamingContext nctx, - Hashtable env, NameComponent[]name) - throws NamingException { - if (orb == null || nctx == null) - throw new ConfigurationException( - "Must supply ORB or NamingContext"); - if (orb != null) { - _orb = orb; - } else { - _orb = getDefaultOrb(); - } - _nc = nctx; - _env = env; - _name = name; - federation = "true".equals(env != null ? env.get(FED_PROP) : null); - } - - NameComponent[] makeFullName(NameComponent[] child) { - if (_name == null || _name.length == 0) { - return child; - } - NameComponent[] answer = new NameComponent[_name.length+child.length]; - - // parent - System.arraycopy(_name, 0, answer, 0, _name.length); - - // child - System.arraycopy(child, 0, answer, _name.length, child.length); - return answer; - } - - - public String getNameInNamespace() throws NamingException { - if (_name == null || _name.length == 0) { - return ""; - } - return CNNameParser.cosNameToInsString(_name); - } - - /** - * These are the URL schemes that need to be processed. - * IOR and corbaloc URLs can be passed directly to ORB.string_to_object() - */ - private static boolean isCorbaUrl(String url) { - return url.startsWith("iiop://") - || url.startsWith("iiopname://") - || url.startsWith("corbaname:") - ; - } - - /** - * Initializes the COS Naming Service. - * This method initializes the three instance fields: - * _nc : The root naming context. - * _orb: The ORB to use for connecting RMI/IIOP stubs and for - * getting the naming context (_nc) if one was not specified - * explicitly via PROVIDER_URL. - * _name: The name of the root naming context. - *

- * _orb is obtained from java.naming.corba.orb if it has been set. - * Otherwise, _orb is created using the host/port from PROVIDER_URL - * (if it contains an "iiop" or "iiopname" URL), or from initialization - * properties specified in env. - *

- * _nc is obtained from the IOR stored in PROVIDER_URL if it has been - * set and does not contain an "iiop" or "iiopname" URL. It can be - * a stringified IOR, "corbaloc" URL, "corbaname" URL, - * or a URL (such as file/http/ftp) to a location - * containing a stringified IOR. If PROVIDER_URL has not been - * set in this way, it is obtained from the result of - * ORB.resolve_initial_reference("NameService"); - *

- * _name is obtained from the "iiop", "iiopname", or "corbaname" URL. - * It is the empty name by default. - * - * @param env Environment The possibly null environment. - * @exception NamingException When an error occurs while initializing the - * ORB or the naming context. - */ - private void initOrbAndRootContext(Hashtable env) throws NamingException { - org.omg.CORBA.ORB inOrb = null; - String ncIor = null; - - if (inOrb == null && env != null) { - inOrb = (org.omg.CORBA.ORB) env.get("java.naming.corba.orb"); - } - - if (inOrb == null) - inOrb = getDefaultOrb(); // will create a default ORB if none exists - - // Extract PROVIDER_URL from environment - String provUrl = null; - if (env != null) { - provUrl = (String)env.get(javax.naming.Context.PROVIDER_URL); - } - - if (provUrl != null && !isCorbaUrl(provUrl)) { - // Initialize the root naming context by using the IOR supplied - // in the PROVIDER_URL - ncIor = getStringifiedIor(provUrl); - setOrbAndRootContext(inOrb, ncIor); - } else if (provUrl != null) { - // Initialize the root naming context by using the URL supplied - // in the PROVIDER_URL - String insName = initUsingUrl(inOrb, provUrl, env); - - // If name supplied in URL, resolve it to a NamingContext - if (insName.length() > 0) { - _name = CNNameParser.nameToCosName(parser.parse(insName)); - try { - org.omg.CORBA.Object obj = _nc.resolve(_name); - _nc = NamingContextHelper.narrow(obj); - if (_nc == null) { - throw new ConfigurationException(insName + - " does not name a NamingContext"); - } - } catch (org.omg.CORBA.BAD_PARAM e) { - throw new ConfigurationException(insName + - " does not name a NamingContext"); - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, _name); - } - } - } else { - // No PROVIDER_URL supplied; initialize using defaults - if (debug) { - System.err.println("Getting default ORB: " + inOrb + env); - } - setOrbAndRootContext(inOrb, (String)null); - } - } - - - private String initUsingUrl(ORB orb, String url, Hashtable env) - throws NamingException { - if (url.startsWith("iiop://") || url.startsWith("iiopname://")) { - return initUsingIiopUrl(orb, url, env); - } else { - return initUsingCorbanameUrl(orb, url, env); - } - } - - /** - * Handles "iiop" and "iiopname" URLs (INS 98-10-11) - */ - private String initUsingIiopUrl(ORB defOrb, String url, Hashtable env) - throws NamingException { - - if (defOrb == null) - defOrb = getDefaultOrb(); - - try { - IiopUrl parsedUrl = new IiopUrl(url); - - NamingException savedException = null; - - for (IiopUrl.Address addr : parsedUrl.getAddresses()) { - - try { - try { - String tmpUrl = "corbaloc:iiop:" + addr.host - + ":" + addr.port + "/NameService"; - if (debug) { - System.err.println("Using url: " + tmpUrl); - } - org.omg.CORBA.Object rootCtx = - defOrb.string_to_object(tmpUrl); - setOrbAndRootContext(defOrb, rootCtx); - return parsedUrl.getStringName(); - } catch (Exception e) {} // keep going - - // Get ORB - if (debug) { - System.err.println("Getting ORB for " + addr.host - + " and port " + addr.port); - } - - // Assign to fields - setOrbAndRootContext(defOrb, (String)null); - return parsedUrl.getStringName(); - - } catch (NamingException ne) { - savedException = ne; - } - } - if (savedException != null) { - throw savedException; - } else { - throw new ConfigurationException("Problem with URL: " + url); - } - } catch (MalformedURLException e) { - throw new ConfigurationException(e.getMessage()); - } - } - - /** - * Initializes using "corbaname" URL (INS 99-12-03) - */ - private String initUsingCorbanameUrl(ORB orb, String url, Hashtable env) - throws NamingException { - - if (orb == null) - orb = getDefaultOrb(); - - try { - CorbanameUrl parsedUrl = new CorbanameUrl(url); - - String corbaloc = parsedUrl.getLocation(); - String cosName = parsedUrl.getStringName(); - - setOrbAndRootContext(orb, corbaloc); - - return parsedUrl.getStringName(); - } catch (MalformedURLException e) { - throw new ConfigurationException(e.getMessage()); - } - } - - private void setOrbAndRootContext(ORB orb, String ncIor) - throws NamingException { - _orb = orb; - try { - org.omg.CORBA.Object ncRef; - if (ncIor != null) { - if (debug) { - System.err.println("Passing to string_to_object: " + ncIor); - } - ncRef = _orb.string_to_object(ncIor); - } else { - ncRef = _orb.resolve_initial_references("NameService"); - } - if (debug) { - System.err.println("Naming Context Ref: " + ncRef); - } - _nc = NamingContextHelper.narrow(ncRef); - if (_nc == null) { - if (ncIor != null) { - throw new ConfigurationException( - "Cannot convert IOR to a NamingContext: " + ncIor); - } else { - throw new ConfigurationException( -"ORB.resolve_initial_references(\"NameService\") does not return a NamingContext"); - } - } - } catch (org.omg.CORBA.ORBPackage.InvalidName in) { - NamingException ne = - new ConfigurationException( -"COS Name Service not registered with ORB under the name 'NameService'"); - ne.setRootCause(in); - throw ne; - } catch (org.omg.CORBA.COMM_FAILURE e) { - NamingException ne = - new CommunicationException("Cannot connect to ORB"); - ne.setRootCause(e); - throw ne; - } catch (org.omg.CORBA.BAD_PARAM e) { - NamingException ne = new ConfigurationException( - "Invalid URL or IOR: " + ncIor); - ne.setRootCause(e); - throw ne; - } catch (org.omg.CORBA.INV_OBJREF e) { - NamingException ne = new ConfigurationException( - "Invalid object reference: " + ncIor); - ne.setRootCause(e); - throw ne; - } - } - - private void setOrbAndRootContext(ORB orb, org.omg.CORBA.Object ncRef) - throws NamingException { - _orb = orb; - try { - _nc = NamingContextHelper.narrow(ncRef); - if (_nc == null) { - throw new ConfigurationException( - "Cannot convert object reference to NamingContext: " + ncRef); - } - } catch (org.omg.CORBA.COMM_FAILURE e) { - NamingException ne = - new CommunicationException("Cannot connect to ORB"); - ne.setRootCause(e); - throw ne; - } - } - - private String getStringifiedIor(String url) throws NamingException { - if (url.startsWith("IOR:") || url.startsWith("corbaloc:")) { - return url; - } else { - InputStream in = null; - try { - URL u = new URL(url); - in = u.openStream(); - if (in != null) { - BufferedReader bufin = - new BufferedReader(new InputStreamReader(in, "8859_1")); - String str; - while ((str = bufin.readLine()) != null) { - if (str.startsWith("IOR:")) { - return str; - } - } - } - } catch (IOException e) { - NamingException ne = - new ConfigurationException("Invalid URL: " + url); - ne.setRootCause(e); - throw ne; - } finally { - try { - if (in != null) { - in.close(); - } - } catch (IOException e) { - NamingException ne = - new ConfigurationException("Invalid URL: " + url); - ne.setRootCause(e); - throw ne; - } - } - throw new ConfigurationException(url + " does not contain an IOR"); - } - } - - - /** - * Does the job of calling the COS Naming API, - * resolve, and performs the exception mapping. If the resolved - * object is a COS Naming Context (sub-context), then this function - * returns a new JNDI naming context object. - * @param path the NameComponent[] object. - * @exception NotFound No objects under the name. - * @exception CannotProceed Unable to obtain a continuation context - * @exception InvalidName Name not understood. - * @return Resolved object returned by the COS Name Server. - */ - java.lang.Object callResolve(NameComponent[] path) - throws NamingException { - try { - org.omg.CORBA.Object obj = _nc.resolve(path); - try { - NamingContext nc = - NamingContextHelper.narrow(obj); - if (nc != null) { - return new CNCtx(_orb, orbTracker, nc, _env, - makeFullName(path)); - } else { - return obj; - } - } catch (org.omg.CORBA.SystemException e) { - return obj; - } - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, path); - } - } - - /** - * Converts the "String" name into a CompositeName - * returns the object resolved by the COS Naming api, - * resolve. Returns the current context if the name is empty. - * Returns either an org.omg.CORBA.Object or javax.naming.Context object. - * @param name string used to resolve the object. - * @exception NamingException See callResolve. - * @return the resolved object - */ - public java.lang.Object lookup(String name) throws NamingException { - if (debug) { - System.out.println("Looking up: " + name); - } - return lookup(new CompositeName(name)); - } - - /** - * Converts the "Name" name into a NameComponent[] object and - * returns the object resolved by the COS Naming api, - * resolve. Returns the current context if the name is empty. - * Returns either an org.omg.CORBA.Object or javax.naming.Context object. - * @param name JNDI Name used to resolve the object. - * @exception NamingException See callResolve. - * @return the resolved object - */ - public java.lang.Object lookup(Name name) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - if (name.size() == 0 ) - return this; // %%% should clone() so that env can be changed - NameComponent[] path = CNNameParser.nameToCosName(name); - java.lang.Object answer = null; - - try { - answer = callResolve(path); - try { - // Check whether object factory codebase is trusted - if (CorbaUtils.isObjectFactoryTrusted(answer)) { - answer = NamingManager.getObjectInstance( - answer, name, this, _env); - } - } catch (NamingException e) { - throw e; - } catch (Exception e) { - NamingException ne = new NamingException( - "problem generating object using object factory"); - ne.setRootCause(e); - throw ne; - } - } catch (CannotProceedException cpe) { - javax.naming.Context cctx = getContinuationContext(cpe); - return cctx.lookup(cpe.getRemainingName()); - } - return answer; - } - - /** - * Performs bind or rebind in the context depending on whether the - * flag rebind is set. The only objects allowed to be bound are of - * types org.omg.CORBA.Object, org.omg.CosNaming.NamingContext. - * You can use a state factory to turn other objects (such as - * Remote) into these acceptable forms. - * - * Uses the COS Naming apis bind/rebind or - * bind_context/rebind_context. - * @param pth NameComponent[] object - * @param obj Object to be bound. - * @param rebind perform rebind ? if true performs a rebind. - * @exception NotFound No objects under the name. - * @exception CannotProceed Unable to obtain a continuation context - * @exception AlreadyBound An object is already bound to this name. - */ - private void callBindOrRebind(NameComponent[] pth, Name name, - java.lang.Object obj, boolean rebind) throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - try { - // Call state factories to convert - obj = NamingManager.getStateToBind(obj, name, this, _env); - - if (obj instanceof CNCtx) { - // Use naming context object reference - obj = ((CNCtx)obj)._nc; - } - - if ( obj instanceof org.omg.CosNaming.NamingContext) { - NamingContext nobj = - NamingContextHelper.narrow((org.omg.CORBA.Object)obj); - if (rebind) - _nc.rebind_context(pth,nobj); - else - _nc.bind_context(pth,nobj); - - } else if (obj instanceof org.omg.CORBA.Object) { - if (rebind) - _nc.rebind(pth,(org.omg.CORBA.Object)obj); - else - _nc.bind(pth,(org.omg.CORBA.Object)obj); - } - else - throw new IllegalArgumentException( - "Only instances of org.omg.CORBA.Object can be bound"); - } catch (BAD_PARAM e) { - // probably narrow() failed? - NamingException ne = new NotContextException(name.toString()); - ne.setRootCause(e); - throw ne; - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, pth); - } - } - - /** - * Converts the "Name" name into a NameComponent[] object and - * performs the bind operation. Uses callBindOrRebind. Throws an - * invalid name exception if the name is empty. We need a name to - * bind the object even when we work within the current context. - * @param name JNDI Name object - * @param obj Object to be bound. - * @exception NamingException See callBindOrRebind - */ - public void bind(Name name, java.lang.Object obj) - throws NamingException { - if (name.size() == 0 ) { - throw new InvalidNameException("Name is empty"); - } - - if (debug) { - System.out.println("Bind: " + name); - } - NameComponent[] path = CNNameParser.nameToCosName(name); - - try { - callBindOrRebind(path, name, obj, false); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - cctx.bind(e.getRemainingName(), obj); - } - } - - static private javax.naming.Context - getContinuationContext(CannotProceedException cpe) - throws NamingException { - try { - return NamingManager.getContinuationContext(cpe); - } catch (CannotProceedException e) { - java.lang.Object resObj = e.getResolvedObj(); - if (resObj instanceof Reference) { - Reference ref = (Reference)resObj; - RefAddr addr = ref.get("nns"); - if (addr.getContent() instanceof javax.naming.Context) { - NamingException ne = new NameNotFoundException( - "No object reference bound for specified name"); - ne.setRootCause(cpe.getRootCause()); - ne.setRemainingName(cpe.getRemainingName()); - throw ne; - } - } - throw e; - } - } - - /** - * Converts the "String" name into a CompositeName object and - * performs the bind operation. Uses callBindOrRebind. Throws an - * invalid name exception if the name is empty. - * @param name string - * @param obj Object to be bound. - * @exception NamingException See callBindOrRebind - */ - public void bind(String name, java.lang.Object obj) throws NamingException { - bind(new CompositeName(name), obj); - } - - /** - * Converts the "Name" name into a NameComponent[] object and - * performs the rebind operation. Uses callBindOrRebind. Throws an - * invalid name exception if the name is empty. We must have a name - * to rebind the object to even if we are working within the current - * context. - * @param name string - * @param obj Object to be bound. - * @exception NamingException See callBindOrRebind - */ - public void rebind(Name name, java.lang.Object obj) - throws NamingException { - if (name.size() == 0 ) { - throw new InvalidNameException("Name is empty"); - } - NameComponent[] path = CNNameParser.nameToCosName(name); - try { - callBindOrRebind(path, name, obj, true); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - cctx.rebind(e.getRemainingName(), obj); - } - } - - /** - * Converts the "String" name into a CompositeName object and - * performs the rebind operation. Uses callBindOrRebind. Throws an - * invalid name exception if the name is an empty string. - * @param name string - * @param obj Object to be bound. - * @exception NamingException See callBindOrRebind - */ - public void rebind(String name, java.lang.Object obj) - throws NamingException { - rebind(new CompositeName(name), obj); - } - - /** - * Calls the unbind api of COS Naming and uses the exception mapper - * class to map the exceptions - * @param path NameComponent[] object - * @exception NotFound No objects under the name. If leaf - * is not found, that's OK according to the JNDI spec - * @exception CannotProceed Unable to obtain a continuation context - * @exception InvalidName Name not understood. - */ - private void callUnbind(NameComponent[] path) throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - try { - _nc.unbind(path); - } catch (NotFound e) { - // If leaf is the one missing, return success - // as per JNDI spec - - if (leafNotFound(e, path[path.length-1])) { - // do nothing - } else { - throw ExceptionMapper.mapException(e, this, path); - } - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, path); - } - } - - private boolean leafNotFound(NotFound e, NameComponent leaf) { - - // This test is not foolproof because some name servers - // always just return one component in rest_of_name - // so you might not be able to tell whether that is - // the leaf (e.g. aa/aa/aa, which one is missing?) - - NameComponent rest; - return e.why.value() == NotFoundReason._missing_node && - e.rest_of_name.length == 1 && - (rest=e.rest_of_name[0]).id.equals(leaf.id) && - (rest.kind == leaf.kind || - (rest.kind != null && rest.kind.equals(leaf.kind))); - } - - /** - * Converts the "String" name into a CompositeName object and - * performs the unbind operation. Uses callUnbind. If the name is - * empty, throws an invalid name exception. Do we unbind the - * current context (JNDI spec says work with the current context if - * the name is empty) ? - * @param name string - * @exception NamingException See callUnbind - */ - public void unbind(String name) throws NamingException { - unbind(new CompositeName(name)); - } - - /** - * Converts the "Name" name into a NameComponent[] object and - * performs the unbind operation. Uses callUnbind. Throws an - * invalid name exception if the name is empty. - * @param name string - * @exception NamingException See callUnbind - */ - public void unbind(Name name) - throws NamingException { - if (name.size() == 0 ) - throw new InvalidNameException("Name is empty"); - NameComponent[] path = CNNameParser.nameToCosName(name); - try { - callUnbind(path); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - cctx.unbind(e.getRemainingName()); - } - } - - /** - * Renames an object. Since COS Naming does not support a rename - * api, this method unbinds the object with the "oldName" and - * creates a new binding. - * @param oldName string, existing name for the binding. - * @param newName string, name used to replace. - * @exception NamingException See bind - */ - public void rename(String oldName,String newName) - throws NamingException { - rename(new CompositeName(oldName), new CompositeName(newName)); - } - - /** - * Renames an object. Since COS Naming does not support a rename - * api, this method unbinds the object with the "oldName" and - * creates a new binding. - * @param oldName JNDI Name, existing name for the binding. - * @param newName JNDI Name, name used to replace. - * @exception NamingException See bind - */ - public void rename(Name oldName,Name newName) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - if (oldName.size() == 0 || newName.size() == 0) - throw new InvalidNameException("One or both names empty"); - java.lang.Object obj = lookup(oldName); - bind(newName,obj); - unbind(oldName); - } - - /** - * Returns a NameClassEnumeration object which has a list of name - * class pairs. Lists the current context if the name is empty. - * @param name string - * @exception NamingException All exceptions thrown by lookup - * with a non-null argument - * @return a list of name-class objects as a NameClassEnumeration. - */ - public NamingEnumeration list(String name) throws NamingException { - return list(new CompositeName(name)); - } - - /** - * Returns a NameClassEnumeration object which has a list of name - * class pairs. Lists the current context if the name is empty. - * @param name JNDI Name - * @exception NamingException All exceptions thrown by lookup - * @return a list of name-class objects as a NameClassEnumeration. - */ - @SuppressWarnings("unchecked") - public NamingEnumeration list(Name name) - throws NamingException { - return (NamingEnumeration)listBindings(name); - } - - /** - * Returns a BindingEnumeration object which has a list of name - * object pairs. Lists the current context if the name is empty. - * @param name string - * @exception NamingException all exceptions returned by lookup - * @return a list of bindings as a BindingEnumeration. - */ - public NamingEnumeration listBindings(String name) - throws NamingException { - return listBindings(new CompositeName(name)); - } - - /** - * Returns a BindingEnumeration object which has a list of name - * class pairs. Lists the current context if the name is empty. - * @param name JNDI Name - * @exception NamingException all exceptions returned by lookup. - * @return a list of bindings as a BindingEnumeration. - */ - public NamingEnumeration listBindings(Name name) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - if (name.size() > 0) { - try { - java.lang.Object obj = lookup(name); - if (obj instanceof CNCtx) { - return new CNBindingEnumeration( - (CNCtx) obj, true, _env); - } else { - throw new NotContextException(name.toString()); - } - } catch (NamingException ne) { - throw ne; - } catch (BAD_PARAM e) { - NamingException ne = - new NotContextException(name.toString()); - ne.setRootCause(e); - throw ne; - } - } - return new CNBindingEnumeration(this, false, _env); - } - - /** - * Calls the destroy on the COS Naming Server - * @param nc The NamingContext object to use. - * @exception NotEmpty when the context is not empty and cannot be destroyed. - */ - private void callDestroy(NamingContext nc) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - try { - nc.destroy(); - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, null); - } - } - - /** - * Uses the callDestroy function to destroy the context. If name is - * empty destroys the current context. - * @param name string - * @exception OperationNotSupportedException when list is invoked - * with a non-null argument - */ - public void destroySubcontext(String name) throws NamingException { - destroySubcontext(new CompositeName(name)); - } - - /** - * Uses the callDestroy function to destroy the context. Destroys - * the current context if name is empty. - * @param name JNDI Name - * @exception OperationNotSupportedException when list is invoked - * with a non-null argument - */ - public void destroySubcontext(Name name) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - NamingContext the_nc = _nc; - NameComponent[] path = CNNameParser.nameToCosName(name); - if ( name.size() > 0) { - try { - javax.naming.Context ctx = - (javax.naming.Context) callResolve(path); - CNCtx cnc = (CNCtx)ctx; - the_nc = cnc._nc; - cnc.close(); //remove the reference to the context - } catch (ClassCastException e) { - throw new NotContextException(name.toString()); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - cctx.destroySubcontext(e.getRemainingName()); - return; - } catch (NameNotFoundException e) { - // If leaf is the one missing, return success - // as per JNDI spec - - if (e.getRootCause() instanceof NotFound && - leafNotFound((NotFound)e.getRootCause(), - path[path.length-1])) { - return; // leaf missing OK - } - throw e; - } catch (NamingException e) { - throw e; - } - } - callDestroy(the_nc); - callUnbind(path); - } - - /** - * Calls the bind_new_context COS naming api to create a new subcontext. - * @param path NameComponent[] object - * @exception NotFound No objects under the name. - * @exception CannotProceed Unable to obtain a continuation context - * @exception InvalidName Name not understood. - * @exception AlreadyBound An object is already bound to this name. - * @return the new context object. - */ - private javax.naming.Context callBindNewContext(NameComponent[] path) - throws NamingException { - if (_nc == null) - throw new ConfigurationException( - "Context does not have a corresponding NamingContext"); - try { - NamingContext nctx = _nc.bind_new_context(path); - return new CNCtx(_orb, orbTracker, nctx, _env, - makeFullName(path)); - } catch (Exception e) { - throw ExceptionMapper.mapException(e, this, path); - } - } - - /** - * Uses the callBindNewContext convenience function to create a new - * context. Throws an invalid name exception if the name is empty. - * @param name string - * @exception NamingException See callBindNewContext - * @return the new context object. - */ - public javax.naming.Context createSubcontext(String name) - throws NamingException { - return createSubcontext(new CompositeName(name)); - } - - /** - * Uses the callBindNewContext convenience function to create a new - * context. Throws an invalid name exception if the name is empty. - * @param name string - * @exception NamingException See callBindNewContext - * @return the new context object. - */ - public javax.naming.Context createSubcontext(Name name) - throws NamingException { - if (name.size() == 0 ) - throw new InvalidNameException("Name is empty"); - NameComponent[] path = CNNameParser.nameToCosName(name); - try { - return callBindNewContext(path); - } catch (CannotProceedException e) { - javax.naming.Context cctx = getContinuationContext(e); - return cctx.createSubcontext(e.getRemainingName()); - } - } - - /** - * Is mapped to resolve in the COS Naming api. - * @param name string - * @exception NamingException See lookup. - * @return the resolved object. - */ - public java.lang.Object lookupLink(String name) throws NamingException { - return lookupLink(new CompositeName(name)); - } - - /** - * Is mapped to resolve in the COS Naming api. - * @param name string - * @exception NamingException See lookup. - * @return the resolved object. - */ - public java.lang.Object lookupLink(Name name) throws NamingException { - return lookup(name); - } - - /** - * Allow access to the name parser object. - * @param name JNDI name, is ignored since there is only one Name - * Parser object. - * @exception NamingException -- - * @return NameParser object - */ - public NameParser getNameParser(String name) throws NamingException { - return parser; - } - - /** - * Allow access to the name parser object. - * @param name JNDI name, is ignored since there is only one Name - * Parser object. - * @exception NamingException -- - * @return NameParser object - */ - public NameParser getNameParser(Name name) throws NamingException { - return parser; - } - - /** - * Returns the current environment. - * @return Environment. - */ - @SuppressWarnings("unchecked") - public Hashtable getEnvironment() throws NamingException { - if (_env == null) { - return new Hashtable<>(5, 0.75f); - } else { - return (Hashtable)_env.clone(); - } - } - - public String composeName(String name, String prefix) throws NamingException { - return composeName(new CompositeName(name), - new CompositeName(prefix)).toString(); - } - - public Name composeName(Name name, Name prefix) throws NamingException { - Name result = (Name)prefix.clone(); - return result.addAll(name); - } - - /** - * Adds to the environment for the current context. - * Record change but do not reinitialize ORB. - * - * @param propName The property name. - * @param propValue The ORB. - * @return the previous value of this property if any. - */ - @SuppressWarnings("unchecked") - public java.lang.Object addToEnvironment(String propName, - java.lang.Object propValue) - throws NamingException { - if (_env == null) { - _env = new Hashtable<>(7, 0.75f); - } else { - // copy-on-write - _env = (Hashtable)_env.clone(); - } - - return _env.put(propName, propValue); - } - - // Record change but do not reinitialize ORB - @SuppressWarnings("unchecked") - public java.lang.Object removeFromEnvironment(String propName) - throws NamingException { - if (_env != null && _env.get(propName) != null) { - // copy-on-write - _env = (Hashtable)_env.clone(); - return _env.remove(propName); - } - return null; - } - - synchronized public void incEnumCount() { - enumCount++; - if (debug) { - System.out.println("incEnumCount, new count:" + enumCount); - } - } - - synchronized public void decEnumCount() - throws NamingException { - enumCount--; - if (debug) { - System.out.println("decEnumCount, new count:" + enumCount + - " isCloseCalled:" + isCloseCalled); - } - if ((enumCount == 0) && isCloseCalled) { - close(); - } - } - - synchronized public void close() throws NamingException { - - if (enumCount > 0) { - isCloseCalled = true; - return; - } - - // Never destroy an orb in CNCtx. - // The orb we have is either the shared/default orb, or one passed in to a constructor - // from elsewhere, so that orb is somebody else's responsibility. - } - - protected void finalize() { - try { - close(); - } catch (NamingException e) { - // ignore failures - } - } -} --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtxFactory.java 2018-01-30 20:23:33.000000000 -0500 +++ /dev/null 2018-01-30 20:23:33.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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.jndi.cosnaming; - -import javax.naming.spi.InitialContextFactory; -import javax.naming.*; - -import java.util.Hashtable; - -/** - * Implements the JNDI SPI InitialContextFactory interface used to - * create the InitialContext objects. - * - * @author Raj Krishnamurthy - */ - -public class CNCtxFactory implements InitialContextFactory { - - /** - * Creates the InitialContext object. Properties parameter should - * should contain the ORB object for the value jndi.corba.orb. - * @param env Properties object - */ - - public Context getInitialContext(Hashtable env) throws NamingException { - return new CNCtx(env); - } -} --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java 2018-01-30 20:23:34.000000000 -0500 +++ /dev/null 2018-01-30 20:23:34.000000000 -0500 @@ -1,500 +0,0 @@ -/* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jndi.cosnaming; - -import javax.naming.*; -import java.util.Properties; -import java.util.Vector; -import java.util.Enumeration; - -import org.omg.CosNaming.NameComponent; - -/** - * Parsing routines for NameParser as well as COS Naming stringified names. - * This is used by CNCtx to create a NameComponent[] object and vice versa. - * It follows Section 4.5 of Interoperable Naming Service (INS) 98-10-11. - * In summary, the stringified form is a left-to-right, forward-slash - * separated name. id and kinds are separated by '.'. backslash is the - * escape character. - * - * @author Rosanna Lee - */ - -final public class CNNameParser implements NameParser { - - private static final Properties mySyntax = new Properties(); - private static final char kindSeparator = '.'; - private static final char compSeparator = '/'; - private static final char escapeChar = '\\'; - static { - mySyntax.put("jndi.syntax.direction", "left_to_right"); - mySyntax.put("jndi.syntax.separator", ""+compSeparator); - mySyntax.put("jndi.syntax.escape", ""+escapeChar); - }; - - /** - * Constructs a new name parser for parsing names in INS syntax. - */ - public CNNameParser() { - } - - /** - * Returns a CompoundName given a string in INS syntax. - * @param name The non-null string representation of the name. - * @return a non-null CompoundName - */ - public Name parse(String name) throws NamingException { - Vector comps = insStringToStringifiedComps(name); - return new CNCompoundName(comps.elements()); - } - - /** - * Creates a NameComponent[] from a Name structure. - * Used by CNCtx to convert the input Name arg into a NameComponent[]. - * @param a CompoundName or a CompositeName; - * each component must be the stringified form of a NameComponent. - */ - static NameComponent[] nameToCosName(Name name) - throws InvalidNameException { - int len = name.size(); - if (len == 0) { - return new NameComponent[0]; - } - - NameComponent[] answer = new NameComponent[len]; - for (int i = 0; i < len; i++) { - answer[i] = parseComponent(name.get(i)); - } - return answer; - } - - /** - * Returns the INS stringified form of a NameComponent[]. - * Used by CNCtx.getNameInNamespace(), CNCompoundName.toString(). - */ - static String cosNameToInsString(NameComponent[] cname) { - StringBuilder str = new StringBuilder(); - for ( int i = 0; i < cname.length; i++) { - if ( i > 0) { - str.append(compSeparator); - } - str.append(stringifyComponent(cname[i])); - } - return str.toString(); - } - - /** - * Creates a CompositeName from a NameComponent[]. - * Used by ExceptionMapper and CNBindingEnumeration to convert - * a NameComponent[] into a composite name. - */ - static Name cosNameToName(NameComponent[] cname) { - Name nm = new CompositeName(); - for ( int i = 0; cname != null && i < cname.length; i++) { - try { - nm.add(stringifyComponent(cname[i])); - } catch (InvalidNameException e) { - // ignore - } - } - return nm; - } - - /** - * Converts an INS-syntax string name into a Vector in which - * each element of the vector contains a stringified form of - * a NameComponent. - */ - private static Vector insStringToStringifiedComps(String str) - throws InvalidNameException { - - int len = str.length(); - Vector components = new Vector<>(10); - char[] id = new char[len]; - char[] kind = new char[len]; - int idCount, kindCount; - boolean idMode; - for (int i = 0; i < len; ) { - idCount = kindCount = 0; // reset for new component - idMode = true; // always start off parsing id - while (i < len) { - if (str.charAt(i) == compSeparator) { - break; - - } else if (str.charAt(i) == escapeChar) { - if (i + 1 >= len) { - throw new InvalidNameException(str + - ": unescaped \\ at end of component"); - } else if (isMeta(str.charAt(i+1))) { - ++i; // skip escape and let meta through - if (idMode) { - id[idCount++] = str.charAt(i++); - } else { - kind[kindCount++] = str.charAt(i++); - } - } else { - throw new InvalidNameException(str + - ": invalid character being escaped"); - } - - } else if (idMode && str.charAt(i) == kindSeparator) { - // just look for the first kindSeparator - ++i; // skip kind separator - idMode = false; - - } else { - if (idMode) { - id[idCount++] = str.charAt(i++); - } else { - kind[kindCount++] = str.charAt(i++); - } - } - } - components.addElement(stringifyComponent( - new NameComponent(new String(id, 0, idCount), - new String(kind, 0, kindCount)))); - - if (i < len) { - ++i; // skip separator - } - } - - return components; - } - - /** - * Return a NameComponent given its stringified form. - */ - private static NameComponent parseComponent(String compStr) - throws InvalidNameException { - NameComponent comp = new NameComponent(); - int kindSep = -1; - int len = compStr.length(); - - int j = 0; - char[] newStr = new char[len]; - boolean escaped = false; - - // Find the kind separator - for (int i = 0; i < len && kindSep < 0; i++) { - if (escaped) { - newStr[j++] = compStr.charAt(i); - escaped = false; - } else if (compStr.charAt(i) == escapeChar) { - if (i + 1 >= len) { - throw new InvalidNameException(compStr + - ": unescaped \\ at end of component"); - } else if (isMeta(compStr.charAt(i+1))) { - escaped = true; - } else { - throw new InvalidNameException(compStr + - ": invalid character being escaped"); - } - } else if (compStr.charAt(i) == kindSeparator) { - kindSep = i; - } else { - newStr[j++] = compStr.charAt(i); - } - } - - // Set id - comp.id = new String(newStr, 0, j); - - // Set kind - if (kindSep < 0) { - comp.kind = ""; // no kind separator - } else { - // unescape kind - j = 0; - escaped = false; - for (int i = kindSep+1; i < len; i++) { - if (escaped) { - newStr[j++] = compStr.charAt(i); - escaped = false; - } else if (compStr.charAt(i) == escapeChar) { - if (i + 1 >= len) { - throw new InvalidNameException(compStr + - ": unescaped \\ at end of component"); - } else if (isMeta(compStr.charAt(i+1))) { - escaped = true; - } else { - throw new InvalidNameException(compStr + - ": invalid character being escaped"); - } - } else { - newStr[j++] = compStr.charAt(i); - } - } - comp.kind = new String(newStr, 0, j); - } - return comp; - } - - private static String stringifyComponent(NameComponent comp) { - StringBuilder one = new StringBuilder(escape(comp.id)); - if (comp.kind != null && !comp.kind.equals("")) { - one.append(kindSeparator).append(escape(comp.kind)); - } - if (one.length() == 0) { - return ""+kindSeparator; // if neither id nor kind specified - } else { - return one.toString(); - } - } - - /** - * Returns a string with '.', '\', '/' escaped. Used when - * stringifying the name into its INS stringified form. - */ - private static String escape(String str) { - if (str.indexOf(kindSeparator) < 0 && - str.indexOf(compSeparator) < 0 && - str.indexOf(escapeChar) < 0) { - return str; // no meta characters to escape - } else { - int len = str.length(); - int j = 0; - char[] newStr = new char[len+len]; - for (int i = 0; i < len; i++) { - if (isMeta(str.charAt(i))) { - newStr[j++] = escapeChar; // escape meta character - } - newStr[j++] = str.charAt(i); - } - return new String(newStr, 0, j); - } - } - - /** - * In INS, there are three meta characters: '.', '/' and '\'. - */ - private static boolean isMeta(char ch) { - switch (ch) { - case kindSeparator: - case compSeparator: - case escapeChar: - return true; - } - return false; - } - - /** - * An implementation of CompoundName that bypasses the parsing - * and stringifying code of the default CompoundName. - */ - static final class CNCompoundName extends CompoundName { - CNCompoundName(Enumeration enum_) { - super(enum_, CNNameParser.mySyntax); - } - - public Object clone() { - return new CNCompoundName(getAll()); - } - - public Name getPrefix(int posn) { - Enumeration comps = super.getPrefix(posn).getAll(); - return new CNCompoundName(comps); - } - - public Name getSuffix(int posn) { - Enumeration comps = super.getSuffix(posn).getAll(); - return new CNCompoundName(comps); - } - - public String toString() { - try { - // Convert Name to NameComponent[] then stringify - return cosNameToInsString(nameToCosName(this)); - } catch (InvalidNameException e) { - return super.toString(); - } - } - - private static final long serialVersionUID = -6599252802678482317L; - } - -// for testing only -/* - private static void print(String input) { - try { - System.out.println("\n >>>>>> input: " + input); - - System.out.println("--Compound Name: "); - NameParser parser = new CNNameParser(); - Name name = parser.parse(input); - for (int i = 0; i < name.size(); i++) { - System.out.println("\t" + i + ": " + name.get(i)); - NameComponent cp = parseComponent(name.get(i)); - System.out.println("\t\t" + "id: " + cp.id + ";kind: " + cp.kind); - } - System.out.println("\t" + name.toString()); - - System.out.println("--Composite Name: "); - Name composite = new CompositeName(input); - for (int i = 0; i < composite.size(); i++) { - System.out.println("\t" + i+": " + composite.get(i)); - } - System.out.println("\t" + composite.toString()); - - System.out.println("--Composite To NameComponent"); - NameComponent[] names = nameToCosName(composite); - for (int i = 0; i < composite.size(); i++) { - System.out.println("\t" + i+": id: " + names[i].id + "; kind: " + names[i].kind); - } - System.out.println("\t" + cosNameToInsString(names)); - } catch (NamingException e) { - System.out.println(e); - } - } - - private static void checkName(Name name, String[] comps) throws Exception { - if (name.size() != comps.length) { - throw new Exception( - "test failed; incorrect component count in " + name + "; " + - "expecting " + comps.length + " got " + name.size()); - } - for (int i = 0; i < name.size(); i++) { - if (!comps[i].equals(name.get(i))) { - throw new Exception ( - "test failed; invalid component in " + name + "; " + - "expecting '" + comps[i] + "' got '" + name.get(i) + "'"); - } - } - } - - private static void checkCompound(NameParser parser, - String input, String[] comps) throws Exception { - checkName(parser.parse(input), comps); - } - - private static void checkComposite(String input, String[] comps) - throws Exception { - checkName(new CompositeName(input), comps); - } - - private static String[] compounds = { - "a/b/c", - "a.b/c.d", - "a", - ".", - "a.", - "c.d", - ".e", - "a/x\\/y\\/z/b", - "a\\.b.c\\.d/e.f", - "a/b\\\\/c", - "x\\\\.y", - "x\\.y", - "x.\\\\y", - "x.y\\\\", - "\\\\x.y", - "a.b\\.c/d" - }; - private static String[][] compoundComps = { - {"a", "b", "c"}, - {"a.b", "c.d"}, - {"a"}, - {"."}, - {"a"}, - {"c.d"}, - {".e"}, - {"a", "x\\/y\\/z", "b"}, - {"a\\.b.c\\.d", "e.f"}, - {"a", "b\\\\", "c"}, - {"x\\\\.y"}, - {"x\\.y"}, - {"x.\\\\y"}, - {"x.y\\\\"}, - {"\\\\x.y"}, - {"a.b\\.c", "d"}, - }; - - private static String[] composites = { - "a/b/c", - "a.b/c.d", - "a", - ".", - "a.", - "c.d", - ".e", - "a/x\\\\\\/y\\\\\\/z/b", - "a\\\\.b.c\\\\.d/e.f", - "a/b\\\\\\\\/c", - "x\\\\\\.y", - "x\\\\.y", - "x.\\\\\\\\y", - "x.y\\\\\\\\", - "\\\\\\\\x.y" - }; - - private static String[][] compositeComps = { - {"a", "b", "c"}, - {"a.b", "c.d"}, - {"a"}, - {"."}, - {"a."}, // unlike compound, kind sep is not consumed - {"c.d"}, - {".e"}, - {"a", "x\\/y\\/z", "b"}, - {"a\\.b.c\\.d", "e.f"}, - {"a", "b\\\\", "c"}, - {"x\\\\.y"}, - {"x\\.y"}, - {"x.\\\\y"}, - {"x.y\\\\"}, - {"\\\\x.y"} - }; - - public static void main(String[] args) throws Exception { - if (args.length > 0) { - for (int i = 0; i < args.length; i++) { - print(args[0]); - } - } else { - print("x\\\\.y"); - print("x\\.y"); - print("x.\\\\y"); - print("x.y\\\\"); - print("\\\\x.y"); - } - - NameParser parser = new com.sun.jndi.cosnaming.CNNameParser(); - for (int i = 0; i < compounds.length; i++) { - checkCompound(parser, compounds[i], compoundComps[i]); - } - for (int i = 0; i < composites.length; i++) { - checkComposite(composites[i], compositeComps[i]); - } - - System.out.println("hardwire"); - NameComponent[] foo = new NameComponent[1]; - foo[0] = new NameComponent("foo\\", "bar"); - - System.out.println(cosNameToInsString(foo)); - System.out.println(cosNameToName(foo)); - } -*/ -} --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/CorbanameUrl.java 2018-01-30 20:23:34.000000000 -0500 +++ /dev/null 2018-01-30 20:23:34.000000000 -0500 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2000, 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.jndi.cosnaming; - -import javax.naming.Name; -import javax.naming.NamingException; - -import java.net.MalformedURLException; -import com.sun.jndi.toolkit.corba.CorbaUtils; - -/** - * Extract components of a "corbaname" URL. - * - * The format of an corbaname URL is defined in INS 99-12-03 as follows. - *

{@code
- * corbaname url = "corbaname:"  ["#" ]
- * corbaloc_obj  =  ["/" ]
- * obj_addr_list = as defined in a corbaloc URL
- * key_string    = as defined in a corbaloc URL
- * string_name   = stringified COS name | empty_string
- * }
- * Characters in {@code } are escaped as follows. - * US-ASCII alphanumeric characters are not escaped. Any characters outside - * of this range are escaped except for the following: - *
{@code
- *        ; / : ? @ & = + $ , - _ . ! ~ * ; ( )
- * }
- * Escaped characters is escaped by using a % followed by its 2 hexadecimal - * numbers representing the octet. - *

- * The corbaname URL is parsed into two parts: a corbaloc URL and a COS name. - * The corbaloc URL is constructed by concatenation {@code "corbaloc:"} with - * {@code }. - * The COS name is {@code } with the escaped characters resolved. - *

- * A corbaname URL is resolved by: - *

    - *
  1. Construct a corbaloc URL by concatenating {@code "corbaloc:"} and {@code }. - *
  2. Resolve the corbaloc URL to a NamingContext by using - *
    {@code
    - *     nctx = ORB.string_to_object(corbalocUrl);
    - * }
    - *
  3. Resolve {@code } in the NamingContext. - *
- * - * @author Rosanna Lee - */ - -public final class CorbanameUrl { - private String stringName; - private String location; - - /** - * Returns a possibly empty but non-null string that is the "string_name" - * portion of the URL. - */ - public String getStringName() { - return stringName; - } - - public Name getCosName() throws NamingException { - return CNCtx.parser.parse(stringName); - } - - public String getLocation() { - return "corbaloc:" + location; - } - - public CorbanameUrl(String url) throws MalformedURLException { - - if (!url.startsWith("corbaname:")) { - throw new MalformedURLException("Invalid corbaname URL: " + url); - } - - int addrStart = 10; // "corbaname:" - - int addrEnd = url.indexOf('#', addrStart); - if (addrEnd < 0) { - addrEnd = url.length(); - stringName = ""; - } else { - stringName = CorbaUtils.decode(url.substring(addrEnd+1)); - } - location = url.substring(addrStart, addrEnd); - - int keyStart = location.indexOf('/'); - if (keyStart >= 0) { - // Has key string - if (keyStart == (location.length() -1)) { - location += "NameService"; - } - } else { - location += "/NameService"; - } - } -/* - // for testing only - public static void main(String[] args) { - try { - CorbanameUrl url = new CorbanameUrl(args[0]); - - System.out.println("location: " + url.getLocation()); - System.out.println("string name: " + url.getStringName()); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } -*/ -} --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java 2018-01-30 20:23:35.000000000 -0500 +++ /dev/null 2018-01-30 20:23:35.000000000 -0500 @@ -1,247 +0,0 @@ -/* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jndi.cosnaming; - -import javax.naming.*; -import javax.naming.directory.*; -import javax.naming.spi.*; - -import org.omg.CosNaming.*; -import org.omg.CosNaming.NamingContextPackage.*; -import org.omg.CORBA.*; - -import com.sun.jndi.toolkit.corba.CorbaUtils; - -/** - * A convenience class to map the COS Naming exceptions to the JNDI exceptions. - * @author Raj Krishnamurthy - */ - -public final class ExceptionMapper { - private ExceptionMapper() {} // ensure no instance - private static final boolean debug = false; - - public static final NamingException mapException(Exception e, - CNCtx ctx, NameComponent[] inputName) throws NamingException { - if (e instanceof NamingException) { - return (NamingException)e; - } - - if (e instanceof RuntimeException) { - throw (RuntimeException)e; - } - - NamingException ne; - if (e instanceof NotFound) { - if (ctx.federation) { - return tryFed((NotFound)e, ctx, inputName); - - } else { - ne = new NameNotFoundException(); - } - - } else if (e instanceof CannotProceed) { - - ne = new CannotProceedException(); - NamingContext nc = ((CannotProceed) e).cxt; - NameComponent[] rest = ((CannotProceed) e).rest_of_name; - - // %%% We assume that rest returns *all* unprocessed components. - // Don't' know if that is a good assumption, given - // NotFound doesn't set rest as expected. -RL - if (inputName != null && (inputName.length > rest.length)) { - NameComponent[] resolvedName = - new NameComponent[inputName.length - rest.length]; - System.arraycopy(inputName, 0, resolvedName, 0, resolvedName.length); - // Wrap resolved NamingContext inside a CNCtx - // Guess that its name (which is relative to ctx) - // is the part of inputName minus rest_of_name - ne.setResolvedObj(new CNCtx(ctx._orb, ctx.orbTracker, nc, - ctx._env, - ctx.makeFullName(resolvedName))); - } else { - ne.setResolvedObj(ctx); - } - - ne.setRemainingName(CNNameParser.cosNameToName(rest)); - - } else if (e instanceof InvalidName) { - ne = new InvalidNameException(); - } else if (e instanceof AlreadyBound) { - ne = new NameAlreadyBoundException(); - } else if (e instanceof NotEmpty) { - ne = new ContextNotEmptyException(); - } else { - ne = new NamingException("Unknown reasons"); - } - - ne.setRootCause(e); - return ne; - } - - private static final NamingException tryFed(NotFound e, CNCtx ctx, - NameComponent[] inputName) throws NamingException { - NameComponent[] rest = e.rest_of_name; - - if (debug) { - System.out.println(e.why.value()); - System.out.println(rest.length); - } - - // %%% Using 1.2 & 1.3 Sun's tnameserv, 'rest' contains only the first - // component that failed, not *rest* as advertized. This is useless - // because what if you have something like aa/aa/aa/aa/aa. - // If one of those is not found, you get "aa" as 'rest'. - if (rest.length == 1 && inputName != null) { - // Check that we're not talking to 1.2/1.3 Sun tnameserv - NameComponent lastIn = inputName[inputName.length-1]; - if (rest[0].id.equals(lastIn.id) && - rest[0].kind != null && - rest[0].kind.equals(lastIn.kind)) { - // Might be legit - ; - } else { - // Due to 1.2/1.3 bug that always returns single-item 'rest' - NamingException ne = new NameNotFoundException(); - ne.setRemainingName(CNNameParser.cosNameToName(rest)); - ne.setRootCause(e); - throw ne; - } - } - // Fixed in 1.4; perform calculations based on correct (1.4) behavior - - // Calculate the components of the name that has been resolved - NameComponent[] resolvedName = null; - int len = 0; - if (inputName != null && (inputName.length >= rest.length)) { - - if (e.why == NotFoundReason.not_context) { - // First component of rest is found but not a context; keep it - // as part of resolved name - len = inputName.length - (rest.length - 1); - - // Remove resolved component from rest - if (rest.length == 1) { - // No more remaining - rest = null; - } else { - NameComponent[] tmp = new NameComponent[rest.length-1]; - System.arraycopy(rest, 1, tmp, 0, tmp.length); - rest = tmp; - } - } else { - len = inputName.length - rest.length; - } - - if (len > 0) { - resolvedName = new NameComponent[len]; - System.arraycopy(inputName, 0, resolvedName, 0, len); - } - } - - // Create CPE and set common fields - CannotProceedException cpe = new CannotProceedException(); - cpe.setRootCause(e); - if (rest != null && rest.length > 0) { - cpe.setRemainingName(CNNameParser.cosNameToName(rest)); - } - cpe.setEnvironment(ctx._env); - - if (debug) { - System.out.println("rest of name: " + cpe.getRemainingName()); - } - - // Lookup resolved name to get resolved object - final java.lang.Object resolvedObj = - (resolvedName != null) ? ctx.callResolve(resolvedName) : ctx; - - if (resolvedObj instanceof javax.naming.Context) { - // obj is a context and child is not found - // try getting its nns dynamically by constructing - // a Reference containing obj. - RefAddr addr = new RefAddr("nns") { - public java.lang.Object getContent() { - return resolvedObj; - } - private static final long serialVersionUID = - 669984699392133792L; - }; - Reference ref = new Reference("java.lang.Object", addr); - - // Resolved name has trailing slash to indicate nns - CompositeName cname = new CompositeName(); - cname.add(""); // add trailing slash - - cpe.setResolvedObj(ref); - cpe.setAltName(cname); - cpe.setAltNameCtx((javax.naming.Context)resolvedObj); - - return cpe; - } else { - // Not a context, use object factory to transform object. - - Name cname = CNNameParser.cosNameToName(resolvedName); - java.lang.Object resolvedObj2 = null; - try { - // Check whether object factory codebase is trusted - if (CorbaUtils.isObjectFactoryTrusted(resolvedObj)) { - resolvedObj2 = NamingManager.getObjectInstance(resolvedObj, - cname, ctx, ctx._env); - } - } catch (NamingException ge) { - throw ge; - } catch (Exception ge) { - NamingException ne = new NamingException( - "problem generating object using object factory"); - ne.setRootCause(ge); - throw ne; - } - - // If a context, continue operation with context - if (resolvedObj2 instanceof javax.naming.Context) { - cpe.setResolvedObj(resolvedObj2); - } else { - // Add trailing slash - cname.add(""); - cpe.setAltName(cname); - - // Create nns reference - final java.lang.Object rf2 = resolvedObj2; - RefAddr addr = new RefAddr("nns") { - public java.lang.Object getContent() { - return rf2; - } - private static final long serialVersionUID = - -785132553978269772L; - }; - Reference ref = new Reference("java.lang.Object", addr); - cpe.setResolvedObj(ref); - cpe.setAltNameCtx(ctx); - } - return cpe; - } - } -} --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/IiopUrl.java 2018-01-30 20:23:36.000000000 -0500 +++ /dev/null 2018-01-30 20:23:36.000000000 -0500 @@ -1,228 +0,0 @@ -/* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jndi.cosnaming; - -import javax.naming.Name; -import javax.naming.NamingException; - -import java.net.MalformedURLException; -import java.util.Vector; -import java.util.StringTokenizer; -import com.sun.jndi.toolkit.corba.CorbaUtils; - -/** - * Extract components of an "iiop" or "iiopname" URL. - * - * The format of an iiopname URL is defined in INS 98-10-11 as follows: - * - *
- * iiopname url = "iiopname://" [addr_list]["/" string_name]
- * addr_list    = [address ","]* address
- * address      = [version host [":" port]]
- * host         = DNS style host name | IP address
- * version      = major "." minor "@" | empty_string
- * port         = number
- * major        = number
- * minor        = number
- * string_name  = stringified name | empty_string
- * 
- * - * The default port is 9999. The default version is "1.0" - * US-ASCII alphanumeric characters are not escaped. Any characters outside - * of this range are escaped except for the following: - *
{@code
- * ; / : ? : @ & = + $ , - _ . ! ~ *  ' ( )
- * }
- * Escaped characters is escaped by using a % followed by its 2 hexadecimal - * numbers representing the octet. - * - * For backward compatibility, the "iiop" URL as defined in INS 97-6-6 - * is also supported: - *
{@code
- * iiop url     = "iiop://" [host [":" port]] ["/" string_name]
- * }
- * The default port is 900. - * - * @author Rosanna Lee - */ - -public final class IiopUrl { - static final private int DEFAULT_IIOPNAME_PORT = 9999; - static final private int DEFAULT_IIOP_PORT = 900; - static final private String DEFAULT_HOST = "localhost"; - private Vector
addresses; - private String stringName; - - public static class Address { - public int port = -1; - public int major, minor; - public String host; - - public Address(String hostPortVers, boolean oldFormat) - throws MalformedURLException { - // [version host [":" port]] - int start; - - // Parse version - int at; - if (oldFormat || (at = hostPortVers.indexOf('@')) < 0) { - major = 1; - minor = 0; - start = 0; // start at the beginning - } else { - int dot = hostPortVers.indexOf('.'); - if (dot < 0) { - throw new MalformedURLException( - "invalid version: " + hostPortVers); - } - try { - major = Integer.parseInt(hostPortVers.substring(0, dot)); - minor = Integer.parseInt(hostPortVers.substring(dot+1, at)); - } catch (NumberFormatException e) { - throw new MalformedURLException( - "Nonnumeric version: " + hostPortVers); - } - start = at + 1; // skip '@' sign - } - - // Parse host and port - int slash = hostPortVers.indexOf('/', start); - if (slash < 0) { - slash = hostPortVers.length(); - } - if (hostPortVers.startsWith("[", start)) { // at IPv6 literal - int brac = hostPortVers.indexOf(']', start + 1); - if (brac < 0 || brac > slash) { - throw new IllegalArgumentException( - "IiopURL: name is an Invalid URL: " + hostPortVers); - } - - // include brackets - host = hostPortVers.substring(start, brac + 1); - start = brac + 1; - } else { // at hostname or IPv4 - int colon = hostPortVers.indexOf(':', start); - int hostEnd = (colon < 0 || colon > slash) - ? slash - : colon; - if (start < hostEnd) { - host = hostPortVers.substring(start, hostEnd); - } - start = hostEnd; // skip past host - } - if ((start + 1 < slash)) { - if ( hostPortVers.startsWith(":", start)) { // parse port - start++; // skip past ":" - port = Integer.parseInt(hostPortVers. - substring(start, slash)); - } else { - throw new IllegalArgumentException( - "IiopURL: name is an Invalid URL: " + hostPortVers); - } - } - start = slash; - if ("".equals(host) || host == null) { - host = DEFAULT_HOST ; - } - if (port == -1) { - port = (oldFormat ? DEFAULT_IIOP_PORT : - DEFAULT_IIOPNAME_PORT); - } - } - } - - public Vector
getAddresses() { - return addresses; - } - - /** - * Returns a possibly empty but non-null string that is the "string_name" - * portion of the URL. - */ - public String getStringName() { - return stringName; - } - - public Name getCosName() throws NamingException { - return CNCtx.parser.parse(stringName); - } - - public IiopUrl(String url) throws MalformedURLException { - int addrStart; - boolean oldFormat; - - if (url.startsWith("iiopname://")) { - oldFormat = false; - addrStart = 11; - } else if (url.startsWith("iiop://")) { - oldFormat = true; - addrStart = 7; - } else { - throw new MalformedURLException("Invalid iiop/iiopname URL: " + url); - } - int addrEnd = url.indexOf('/', addrStart); - if (addrEnd < 0) { - addrEnd = url.length(); - stringName = ""; - } else { - stringName = CorbaUtils.decode(url.substring(addrEnd+1)); - } - addresses = new Vector<>(3); - if (oldFormat) { - // Only one host:port part, not multiple - addresses.addElement( - new Address(url.substring(addrStart, addrEnd), oldFormat)); - } else { - StringTokenizer tokens = - new StringTokenizer(url.substring(addrStart, addrEnd), ","); - while (tokens.hasMoreTokens()) { - addresses.addElement(new Address(tokens.nextToken(), oldFormat)); - } - if (addresses.size() == 0) { - addresses.addElement(new Address("", oldFormat)); - } - } - } - - // for testing only - /*public static void main(String[] args) { - try { - IiopUrl url = new IiopUrl(args[0]); - Vector addrs = url.getAddresses(); - String name = url.getStringName(); - - for (int i = 0; i < addrs.size(); i++) { - Address addr = (Address)addrs.elementAt(i); - System.out.println("host: " + addr.host); - System.out.println("port: " + addr.port); - System.out.println("version: " + addr.major + " " + addr.minor); - } - System.out.println("name: " + name); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } */ -} --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/OrbReuseTracker.java 2018-01-30 20:23:36.000000000 -0500 +++ /dev/null 2018-01-30 20:23:36.000000000 -0500 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2005, 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.jndi.cosnaming; - -import org.omg.CORBA.ORB; - -/** - * This class keeps track of references to the shared ORB object - * and destroys it when no more references are made to the ORB - * object. This object is created for each ORB object that CNCtx - * creates. - */ -class OrbReuseTracker { - - int referenceCnt; - ORB orb; - - private static final boolean debug = false; - - OrbReuseTracker(ORB orb) { - this.orb = orb; - referenceCnt++; - if (debug) { - System.out.println("New OrbReuseTracker created"); - } - } - - synchronized void incRefCount() { - referenceCnt++; - if (debug) { - System.out.println("Increment orb ref count to:" + referenceCnt); - } - } - - synchronized void decRefCount() { - referenceCnt--; - if (debug) { - System.out.println("Decrement orb ref count to:" + referenceCnt); - } - if ((referenceCnt == 0)) { - if (debug) { - System.out.println("Destroying the ORB"); - } - orb.destroy(); - } - } -} --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/RemoteToCorba.java 2018-01-30 20:23:37.000000000 -0500 +++ /dev/null 2018-01-30 20:23:37.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1999, 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.jndi.cosnaming; - -import javax.naming.*; -import javax.naming.spi.StateFactory; -import java.util.Hashtable; - -import org.omg.CORBA.ORB; - -import java.rmi.Remote; -import java.rmi.server.ExportException; - -import com.sun.jndi.toolkit.corba.CorbaUtils; // for RMI-IIOP - -/** - * StateFactory that turns java.rmi.Remote objects to org.omg.CORBA.Object. - * - * @author Rosanna Lee - */ - -public class RemoteToCorba implements StateFactory { - public RemoteToCorba() { - } - - /** - * Returns the CORBA object for a Remote object. - * If input is not a Remote object, or if Remote object uses JRMP, return null. - * If the RMI-IIOP library is not available, throw ConfigurationException. - * - * @param orig The object to turn into a CORBA object. If not Remote, - * or if is a JRMP stub or impl, return null. - * @param name Ignored - * @param ctx The non-null CNCtx whose ORB to use. - * @param env Ignored - * @return The CORBA object for {@code orig} or null. - * @exception ConfigurationException If the CORBA object cannot be obtained - * due to configuration problems, for instance, if RMI-IIOP not available. - * @exception NamingException If some other problem prevented a CORBA - * object from being obtained from the Remote object. - */ - public Object getStateToBind(Object orig, Name name, Context ctx, - Hashtable env) throws NamingException { - if (orig instanceof org.omg.CORBA.Object) { - // Already a CORBA object, just use it - return null; - } - - if (orig instanceof Remote) { - // Turn remote object into org.omg.CORBA.Object - // Returns null if JRMP; let next factory try - // CNCtx will eventually throw IllegalArgumentException if - // no CORBA object gotten - return CorbaUtils.remoteToCorba((Remote)orig, ((CNCtx)ctx)._orb); - } - return null; // pass and let next state factory try - } -} --- old/src/java.corba/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties 2018-01-30 20:23:38.000000000 -0500 +++ /dev/null 2018-01-30 20:23:38.000000000 -0500 @@ -1,4 +0,0 @@ -# Provider resource file for the COS Naming service provider. - -# State factory to turn java.rmi.Remote into org.omg.CORBA.Object. -java.naming.factory.state=com.sun.jndi.cosnaming.RemoteToCorba --- old/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java 2018-01-30 20:23:39.000000000 -0500 +++ /dev/null 2018-01-30 20:23:39.000000000 -0500 @@ -1,244 +0,0 @@ -/* - * Copyright (c) 1999, 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.jndi.toolkit.corba; - -// Needed for RMI/IIOP -import java.rmi.Remote; - -import java.rmi.RemoteException; -import java.util.Hashtable; -import java.util.Properties; -import java.util.Enumeration; -import java.applet.Applet; - -import org.omg.CORBA.ORB; - -import javax.naming.*; -import javax.rmi.CORBA.Stub; -import javax.rmi.PortableRemoteObject; - -import com.sun.jndi.cosnaming.CNCtx; - -import java.io.UnsupportedEncodingException; -import java.net.MalformedURLException; -import java.net.URLDecoder; - -/** - * Contains utilities for performing CORBA-related tasks: - * 1. Get the org.omg.CORBA.Object for a java.rmi.Remote object. - * 2. Create an ORB to use for a given host/port, and environment properties. - * ... - * - * @author Simon Nash - * @author Bryan Atsatt - */ - -public class CorbaUtils { - /** - * Returns the CORBA object reference associated with a Remote - * object by using the javax.rmi.CORBA package. - *

- * This method effective does the following: - *

-      * java.lang.Object stub;
-      * try {
-      *     stub = PortableRemoteObject.toStub(remoteObj);
-      * } catch (Exception e) {
-      *     throw new ConfigurationException("Object not exported or not found");
-      * }
-      * if (!(stub instanceof javax.rmi.CORBA.Stub)) {
-      *     return null; // JRMP impl or JRMP stub
-      * }
-      * try {
-      *     ((javax.rmi.CORBA.Stub)stub).connect(orb);  // try to connect IIOP stub
-      * } catch (RemoteException e) {
-      *     // ignore 'already connected' error
-      * }
-      * return (javax.rmi.CORBA.Stub)stub;
-      * 
- * - * @param remoteObj The non-null remote object for - * @param orb The non-null ORB to connect the remote object to - * @return The CORBA Object for remoteObj; null if {@code remoteObj} - * is a JRMP implementation or JRMP stub. - * @exception ConfigurationException The CORBA Object cannot be obtained - * because of configuration problems. - */ - public static org.omg.CORBA.Object remoteToCorba(Remote remoteObj, ORB orb) - throws ConfigurationException { - -// First, get remoteObj's stub - - // javax.rmi.CORBA.Stub stub = PortableRemoteObject.toStub(remoteObj); - - Remote stub; - - try { - stub = PortableRemoteObject.toStub(remoteObj); - } catch (Throwable t) { - ConfigurationException ce = new ConfigurationException( - "Problem with PortableRemoteObject.toStub(); object not exported or stub not found"); - ce.setRootCause(t); - throw ce; - } - -// Next, make sure that the stub is javax.rmi.CORBA.Stub - - if (!(stub instanceof Stub)) { - return null; // JRMP implementation or JRMP stub - } - -// Next, make sure that the stub is connected - try { - ((Stub) stub).connect(orb); - } catch (RemoteException e) { - // ignore RemoteException because stub might have already - // been connected - } catch (Throwable t) { - ConfigurationException ce = new ConfigurationException( - "Problem invoking javax.rmi.CORBA.Stub.connect()"); - ce.setRootCause(t); - throw ce; - } -// Finally, return stub - return (org.omg.CORBA.Object)stub; - } - - /** - * Get ORB using given server and port number, and properties from environment. - * - * @param server Possibly null server; if null means use default; - * For applet, it is the applet host; for app, it is localhost. - * @param port Port number, -1 means default port - * @param env Possibly null environment. Contains environment properties. - * Could contain ORB itself; or applet used for initializing ORB. - * Use all String properties from env for initializing ORB - * @return A non-null ORB. - */ - public static ORB getOrb(String server, int port, Hashtable env) { - // See if we can get info from environment - Properties orbProp; - - // Extract any org.omg.CORBA properties from environment - if (env != null) { - if (env instanceof Properties) { - // Already a Properties, just clone - orbProp = (Properties) env.clone(); - } else { - // Get all String properties - Enumeration envProp; - orbProp = new Properties(); - for (envProp = env.keys(); envProp.hasMoreElements();) { - String key = (String)envProp.nextElement(); - Object val = env.get(key); - if (val instanceof String) { - orbProp.put(key, val); - } - } - } - } else { - orbProp = new Properties(); - } - - if (server != null) { - orbProp.put("org.omg.CORBA.ORBInitialHost", server); - } - if (port >= 0) { - orbProp.put("org.omg.CORBA.ORBInitialPort", ""+port); - } - - // Get Applet from environment - if (env != null) { - @SuppressWarnings("deprecation") - Applet applet = (Applet) env.get(Context.APPLET); - if (applet != null) { - // Create ORBs using applet and orbProp - return ORB.init(applet, orbProp); - } - } - - return ORB.init(new String[0], orbProp); - } - - /** - * Check whether object factory code base is trusted. - * Classes may only be loaded from an arbitrary URL code base when - * the system property com.sun.jndi.rmi.object.trustURLCodebase - * has been set to "true". - */ - public static boolean isObjectFactoryTrusted(Object obj) - throws NamingException { - - // Extract Reference, if possible - Reference ref = null; - if (obj instanceof Reference) { - ref = (Reference) obj; - } else if (obj instanceof Referenceable) { - ref = ((Referenceable)(obj)).getReference(); - } - - if (ref != null && ref.getFactoryClassLocation() != null && - !CNCtx.trustURLCodebase) { - throw new ConfigurationException( - "The object factory is untrusted. Set the system property" + - " 'com.sun.jndi.cosnaming.object.trustURLCodebase' to 'true'."); - } - return true; - } - - /** - * Decode a URI string (according to RFC 2396). - */ - public static final String decode(String s) throws MalformedURLException { - try { - return decode(s, "8859_1"); - } catch (UnsupportedEncodingException e) { - // ISO-Latin-1 should always be available? - throw new MalformedURLException("ISO-Latin-1 decoder unavailable"); - } - } - - /** - * Decode a URI string (according to RFC 2396). - * - * Three-character sequences '%xy', where 'xy' is the two-digit - * hexadecimal representation of the lower 8-bits of a character, - * are decoded into the character itself. - * - * The string is subsequently converted using the specified encoding - */ - public static final String decode(String s, String enc) - throws MalformedURLException, UnsupportedEncodingException { - try { - return URLDecoder.decode(s, enc); - } catch (IllegalArgumentException iae) { - MalformedURLException mue = new MalformedURLException("Invalid URI encoding: " + s); - mue.initCause(iae); - throw mue; - } - } - -} --- old/src/java.corba/share/classes/com/sun/jndi/url/corbaname/corbanameURLContextFactory.java 2018-01-30 20:23:39.000000000 -0500 +++ /dev/null 2018-01-30 20:23:39.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 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.jndi.url.corbaname; - -import com.sun.jndi.url.iiop.iiopURLContextFactory; - -/** - * A corbaname URL context factory. - * It just uses the iiop URL context factory but is needed here - * so that NamingManager.getURLContext() will find it. - * - * @author Rosanna Lee - */ -final public class corbanameURLContextFactory extends iiopURLContextFactory { -} --- old/src/java.corba/share/classes/com/sun/jndi/url/iiop/GenericURLContext.java 2018-01-30 20:23:40.000000000 -0500 +++ /dev/null 2018-01-30 20:23:40.000000000 -0500 @@ -1,537 +0,0 @@ -/* - * Copyright (c) 1999, 2016, 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.jndi.url.iiop; - -import com.sun.jndi.toolkit.corba.CorbaUtils; - -import javax.naming.*; -import javax.naming.spi.ResolveResult; -import javax.naming.spi.NamingManager; - -import java.util.Hashtable; -import java.net.MalformedURLException; - -/** - * This abstract class is a generic URL context that accepts as the - * name argument either a string URL or a Name whose first component - * is a URL. It resolves the URL to a target context and then continues - * the operation using the remaining name in the target context as if - * the first component names a junction. - * - * A subclass must define getRootURLContext() - * to process the URL into head/tail pieces. If it wants to control how - * URL strings are parsed and compared for the rename() operation, then - * it should override getNonRootURLSuffixes() and urlEquals(). - * - * @author Scott Seligman - * @author Rosanna Lee - */ -abstract public class GenericURLContext implements Context { - protected Hashtable myEnv = null; - - @SuppressWarnings("unchecked") // Expect Hashtable - public GenericURLContext(Hashtable env) { - // context that is not tied to any specific URL - myEnv = - (Hashtable)(env == null ? null : env.clone()); - } - - public void close() throws NamingException { - myEnv = null; - } - - public String getNameInNamespace() throws NamingException { - return ""; // %%% check this out: A URL context's name is "" - } - - /** - * Resolves 'name' into a target context with remaining name. - * For example, with a JNDI URL "jndi://dnsname/rest_name", - * this method resolves "jndi://dnsname/" to a target context, - * and returns the target context with "rest_name". - * The definition of "root URL" and how much of the URL to - * consume is implementation specific. - * If rename() is supported for a particular URL scheme, - * getRootURLContext(), getURLPrefix(), and getURLSuffix() - * must be in sync wrt how URLs are parsed and returned. - */ - abstract protected ResolveResult getRootURLContext(String url, - Hashtable env) throws NamingException; - - /** - * Returns the suffix of the url. The result should be identical to - * that of calling getRootURLContext().getRemainingName(), but - * without the overhead of doing anything with the prefix like - * creating a context. - *

- * This method returns a Name instead of a String because to give - * the provider an opportunity to return a Name (for example, - * for weakly separated naming systems like COS naming). - *

- * The default implementation uses skips 'prefix', calls - * CorbaUtils.decode() on it, and returns the result as a single component - * CompositeName. - * Subclass should override if this is not appropriate. - * This method is used only by rename(). - * If rename() is supported for a particular URL scheme, - * getRootURLContext(), getURLPrefix(), and getURLSuffix() - * must be in sync wrt how URLs are parsed and returned. - *

- * For many URL schemes, this method is very similar to URL.getFile(), - * except getFile() will return a leading slash in the - * 2nd, 3rd, and 4th cases. For schemes like "ldap" and "iiop", - * the leading slash must be skipped before the name is an acceptable - * format for operation by the Context methods. For schemes that treat the - * leading slash as significant (such as "file"), - * the subclass must override getURLSuffix() to get the correct behavior. - * Remember, the behavior must match getRootURLContext(). - * - *

{@code
-     * URL                                     Suffix
-     * foo://host:port                         
-     * foo://host:port/rest/of/name            rest/of/name
-     * foo:///rest/of/name                     rest/of/name
-     * foo:/rest/of/name                       rest/of/name
-     * foo:rest/of/name                        rest/of/name
-     * }
- */ - protected Name getURLSuffix(String prefix, String url) throws NamingException { - String suffix = url.substring(prefix.length()); - if (suffix.length() == 0) { - return new CompositeName(); - } - - if (suffix.charAt(0) == '/') { - suffix = suffix.substring(1); // skip leading slash - } - - try { - return new CompositeName().add(CorbaUtils.decode(suffix)); - } catch (MalformedURLException e) { - throw new InvalidNameException(e.getMessage()); - } - } - - /** - * Finds the prefix of a URL. - * Default implementation looks for slashes and then extracts - * prefixes using String.substring(). - * Subclass should override if this is not appropriate. - * This method is used only by rename(). - * If rename() is supported for a particular URL scheme, - * getRootURLContext(), getURLPrefix(), and getURLSuffix() - * must be in sync wrt how URLs are parsed and returned. - *

- * URL Prefix - * foo://host:port foo://host:port - * foo://host:port/rest/of/name foo://host:port - * foo:///rest/of/name foo:// - * foo:/rest/of/name foo: - * foo:rest/of/name foo: - */ - protected String getURLPrefix(String url) throws NamingException { - int start = url.indexOf(':'); - - if (start < 0) { - throw new OperationNotSupportedException("Invalid URL: " + url); - } - ++start; // skip ':' - - if (url.startsWith("//", start)) { - start += 2; // skip double slash - - // find last slash - int posn = url.indexOf('/', start); - if (posn >= 0) { - start = posn; - } else { - start = url.length(); // rest of URL - } - } - - // else 0 or 1 initial slashes; start is unchanged - return url.substring(0, start); - } - - /** - * Determines whether two URLs are the same. - * Default implementation uses String.equals(). - * Subclass should override if this is not appropriate. - * This method is used by rename(). - */ - protected boolean urlEquals(String url1, String url2) { - return url1.equals(url2); - } - - /** - * Gets the context in which to continue the operation. This method - * is called when this context is asked to process a multicomponent - * Name in which the first component is a URL. - * Treat the first component like a junction: resolve it and then use - * NamingManager.getContinuationContext() to get the target context in - * which to operate on the remainder of the name (n.getSuffix(1)). - */ - protected Context getContinuationContext(Name n) throws NamingException { - Object obj = lookup(n.get(0)); - CannotProceedException cpe = new CannotProceedException(); - cpe.setResolvedObj(obj); - cpe.setEnvironment(myEnv); - return NamingManager.getContinuationContext(cpe); - } - - public Object lookup(String name) throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - return ctx.lookup(res.getRemainingName()); - } finally { - ctx.close(); - } - } - - public Object lookup(Name name) throws NamingException { - if (name.size() == 1) { - return lookup(name.get(0)); - } else { - Context ctx = getContinuationContext(name); - try { - return ctx.lookup(name.getSuffix(1)); - } finally { - ctx.close(); - } - } - } - - public void bind(String name, Object obj) throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - ctx.bind(res.getRemainingName(), obj); - } finally { - ctx.close(); - } - } - - public void bind(Name name, Object obj) throws NamingException { - if (name.size() == 1) { - bind(name.get(0), obj); - } else { - Context ctx = getContinuationContext(name); - try { - ctx.bind(name.getSuffix(1), obj); - } finally { - ctx.close(); - } - } - } - - public void rebind(String name, Object obj) throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - ctx.rebind(res.getRemainingName(), obj); - } finally { - ctx.close(); - } - } - - public void rebind(Name name, Object obj) throws NamingException { - if (name.size() == 1) { - rebind(name.get(0), obj); - } else { - Context ctx = getContinuationContext(name); - try { - ctx.rebind(name.getSuffix(1), obj); - } finally { - ctx.close(); - } - } - } - - public void unbind(String name) throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - ctx.unbind(res.getRemainingName()); - } finally { - ctx.close(); - } - } - - public void unbind(Name name) throws NamingException { - if (name.size() == 1) { - unbind(name.get(0)); - } else { - Context ctx = getContinuationContext(name); - try { - ctx.unbind(name.getSuffix(1)); - } finally { - ctx.close(); - } - } - } - - public void rename(String oldName, String newName) throws NamingException { - String oldPrefix = getURLPrefix(oldName); - String newPrefix = getURLPrefix(newName); - if (!urlEquals(oldPrefix, newPrefix)) { - throw new OperationNotSupportedException( - "Renaming using different URL prefixes not supported : " + - oldName + " " + newName); - } - - ResolveResult res = getRootURLContext(oldName, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - ctx.rename(res.getRemainingName(), getURLSuffix(newPrefix, newName)); - } finally { - ctx.close(); - } - } - - public void rename(Name name, Name newName) throws NamingException { - if (name.size() == 1) { - if (newName.size() != 1) { - throw new OperationNotSupportedException( - "Renaming to a Name with more components not supported: " + newName); - } - rename(name.get(0), newName.get(0)); - } else { - // > 1 component with 1st one being URL - // URLs must be identical; cannot deal with diff URLs - if (!urlEquals(name.get(0), newName.get(0))) { - throw new OperationNotSupportedException( - "Renaming using different URLs as first components not supported: " + - name + " " + newName); - } - - Context ctx = getContinuationContext(name); - try { - ctx.rename(name.getSuffix(1), newName.getSuffix(1)); - } finally { - ctx.close(); - } - } - } - - public NamingEnumeration list(String name) throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - return ctx.list(res.getRemainingName()); - } finally { - ctx.close(); - } - } - - public NamingEnumeration list(Name name) throws NamingException { - if (name.size() == 1) { - return list(name.get(0)); - } else { - Context ctx = getContinuationContext(name); - try { - return ctx.list(name.getSuffix(1)); - } finally { - ctx.close(); - } - } - } - - public NamingEnumeration listBindings(String name) - throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - return ctx.listBindings(res.getRemainingName()); - } finally { - ctx.close(); - } - } - - public NamingEnumeration listBindings(Name name) throws NamingException { - if (name.size() == 1) { - return listBindings(name.get(0)); - } else { - Context ctx = getContinuationContext(name); - try { - return ctx.listBindings(name.getSuffix(1)); - } finally { - ctx.close(); - } - } - } - - public void destroySubcontext(String name) throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - ctx.destroySubcontext(res.getRemainingName()); - } finally { - ctx.close(); - } - } - - public void destroySubcontext(Name name) throws NamingException { - if (name.size() == 1) { - destroySubcontext(name.get(0)); - } else { - Context ctx = getContinuationContext(name); - try { - ctx.destroySubcontext(name.getSuffix(1)); - } finally { - ctx.close(); - } - } - } - - public Context createSubcontext(String name) throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - return ctx.createSubcontext(res.getRemainingName()); - } finally { - ctx.close(); - } - } - - public Context createSubcontext(Name name) throws NamingException { - if (name.size() == 1) { - return createSubcontext(name.get(0)); - } else { - Context ctx = getContinuationContext(name); - try { - return ctx.createSubcontext(name.getSuffix(1)); - } finally { - ctx.close(); - } - } - } - - public Object lookupLink(String name) throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - return ctx.lookupLink(res.getRemainingName()); - } finally { - ctx.close(); - } - } - - public Object lookupLink(Name name) throws NamingException { - if (name.size() == 1) { - return lookupLink(name.get(0)); - } else { - Context ctx = getContinuationContext(name); - try { - return ctx.lookupLink(name.getSuffix(1)); - } finally { - ctx.close(); - } - } - } - - public NameParser getNameParser(String name) throws NamingException { - ResolveResult res = getRootURLContext(name, myEnv); - Context ctx = (Context)res.getResolvedObj(); - try { - return ctx.getNameParser(res.getRemainingName()); - } finally { - ctx.close(); - } - } - - public NameParser getNameParser(Name name) throws NamingException { - if (name.size() == 1) { - return getNameParser(name.get(0)); - } else { - Context ctx = getContinuationContext(name); - try { - return ctx.getNameParser(name.getSuffix(1)); - } finally { - ctx.close(); - } - } - } - - public String composeName(String name, String prefix) - throws NamingException { - if (prefix.equals("")) { - return name; - } else if (name.equals("")) { - return prefix; - } else { - return (prefix + "/" + name); - } - } - - public Name composeName(Name name, Name prefix) throws NamingException { - Name result = (Name)prefix.clone(); - result.addAll(name); - return result; - } - - public Object removeFromEnvironment(String propName) - throws NamingException { - if (myEnv == null) { - return null; - } - return myEnv.remove(propName); - } - - public Object addToEnvironment(String propName, Object propVal) - throws NamingException { - if (myEnv == null) { - myEnv = new Hashtable(11, 0.75f); - } - return myEnv.put(propName, propVal); - } - - @SuppressWarnings("unchecked") // clone() - public Hashtable getEnvironment() throws NamingException { - if (myEnv == null) { - return new Hashtable<>(5, 0.75f); - } else { - return (Hashtable)myEnv.clone(); - } - } - -/* -// To test, declare getURLPrefix and getURLSuffix static. - - public static void main(String[] args) throws Exception { - String[] tests = {"file://host:port", - "file:///rest/of/name", - "file://host:port/rest/of/name", - "file:/rest/of/name", - "file:rest/of/name"}; - for (int i = 0; i < tests.length; i++) { - String pre = getURLPrefix(tests[i]); - System.out.println(pre); - System.out.println(getURLSuffix(pre, tests[i])); - } - } -*/ -} --- old/src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContext.java 2018-01-30 20:23:41.000000000 -0500 +++ /dev/null 2018-01-30 20:23:41.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jndi.url.iiop; - -import javax.naming.spi.ResolveResult; -import javax.naming.*; -import java.util.Hashtable; -import java.net.MalformedURLException; - -import com.sun.jndi.cosnaming.IiopUrl; -import com.sun.jndi.cosnaming.CorbanameUrl; - -/** - * An IIOP URL context. - * - * @author Rosanna Lee - */ - -public class iiopURLContext - extends GenericURLContext { - - iiopURLContext(Hashtable env) { - super(env); - } - - /** - * Resolves 'name' into a target context with remaining name. - * It only resolves the hostname/port number. The remaining name - * contains the rest of the name found in the URL. - * - * For example, with a iiop URL "iiop://localhost:900/rest/of/name", - * this method resolves "iiop://localhost:900/" to the "NameService" - * context on for the ORB at 'localhost' on port 900, - * and returns as the remaining name "rest/of/name". - */ - protected ResolveResult getRootURLContext(String name, Hashtable env) - throws NamingException { - return iiopURLContextFactory.getUsingURLIgnoreRest(name, env); - } - - /** - * Return the suffix of an "iiop", "iiopname", or "corbaname" url. - * prefix parameter is ignored. - */ - protected Name getURLSuffix(String prefix, String url) - throws NamingException { - try { - if (url.startsWith("iiop://") || url.startsWith("iiopname://")) { - IiopUrl parsedUrl = new IiopUrl(url); - return parsedUrl.getCosName(); - } else if (url.startsWith("corbaname:")) { - CorbanameUrl parsedUrl = new CorbanameUrl(url); - return parsedUrl.getCosName(); - } else { - throw new MalformedURLException("Not a valid URL: " + url); - } - } catch (MalformedURLException e) { - throw new InvalidNameException(e.getMessage()); - } - } -} --- old/src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContextFactory.java 2018-01-30 20:23:41.000000000 -0500 +++ /dev/null 2018-01-30 20:23:41.000000000 -0500 @@ -1,101 +0,0 @@ -/* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jndi.url.iiop; - -import javax.naming.*; -import javax.naming.spi.*; - -import java.util.Hashtable; - -import com.sun.jndi.cosnaming.CNCtx; - -/** - * An IIOP URL context factory. - * - * @author Rosanna Lee - */ - -public class iiopURLContextFactory implements ObjectFactory { - - public Object getObjectInstance(Object urlInfo, Name name, Context nameCtx, - Hashtable env) throws Exception { - -//System.out.println("iiopURLContextFactory " + urlInfo); - if (urlInfo == null) { - return new iiopURLContext(env); - } - if (urlInfo instanceof String) { - return getUsingURL((String)urlInfo, env); - } else if (urlInfo instanceof String[]) { - return getUsingURLs((String[])urlInfo, env); - } else { - throw (new IllegalArgumentException( - "iiopURLContextFactory.getObjectInstance: " + - "argument must be a URL String or array of URLs")); - } - } - - /** - * Resolves 'name' into a target context with remaining name. - * It only resolves the hostname/port number. The remaining name - * contains the rest of the name found in the URL. - * - * For example, with a iiop URL "iiop://localhost:900/rest/of/name", - * this method resolves "iiop://localhost:900/" to the "NameService" - * context on for the ORB at 'localhost' on port 900, - * and returns as the remaining name "rest/of/name". - */ - static ResolveResult getUsingURLIgnoreRest(String url, Hashtable env) - throws NamingException { - return CNCtx.createUsingURL(url, env); - } - - private static Object getUsingURL(String url, Hashtable env) - throws NamingException { - ResolveResult res = getUsingURLIgnoreRest(url, env); - - Context ctx = (Context)res.getResolvedObj(); - try { - return ctx.lookup(res.getRemainingName()); - } finally { - ctx.close(); - } - } - - private static Object getUsingURLs(String[] urls, Hashtable env) { - for (int i = 0; i < urls.length; i++) { - String url = urls[i]; - try { - Object obj = getUsingURL(url, env); - if (obj != null) { - return obj; - } - } catch (NamingException e) { - } - } - return null; // %%% exception?? - } -} --- old/src/java.corba/share/classes/com/sun/jndi/url/iiopname/iiopnameURLContextFactory.java 2018-01-30 20:23:42.000000000 -0500 +++ /dev/null 2018-01-30 20:23:42.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 1999, 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.jndi.url.iiopname; - -import com.sun.jndi.url.iiop.iiopURLContextFactory; - -/** - * An iiopname URL context factory. - * It just uses the iiop URL context factory but is needed here - * so that NamingManager.getURLContext() will find it. - * - * @author Rosanna Lee - */ -final public class iiopnameURLContextFactory extends iiopURLContextFactory { -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java 2018-01-30 20:23:43.000000000 -0500 +++ /dev/null 2018-01-30 20:23:43.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ - -public final class AttrDescriptionSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/AttrDescriptionSeq:1.0"; - - public AttrDescriptionSeqHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.AttributeDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.AttributeDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.AttributeDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.id (), "AttrDescriptionSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.AttributeDescription[] read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.AttributeDescription value[] = null; - int _len0 = istream.read_long (); - value = new com.sun.org.omg.CORBA.AttributeDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.AttributeDescriptionHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.AttributeDescriptionHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescription.java 2018-01-30 20:23:44.000000000 -0500 +++ /dev/null 2018-01-30 20:23:44.000000000 -0500 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/AttributeDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class AttributeDescription implements org.omg.CORBA.portable.IDLEntity -{ - public String name = null; - public String id = null; - public String defined_in = null; - public String version = null; - public org.omg.CORBA.TypeCode type = null; - public com.sun.org.omg.CORBA.AttributeMode mode = null; - - public AttributeDescription () - { - } // ctor - - public AttributeDescription (String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _type, com.sun.org.omg.CORBA.AttributeMode _mode) - { - name = _name; - id = _id; - defined_in = _defined_in; - version = _version; - type = _type; - mode = _mode; - } // ctor - -} // class AttributeDescription --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescriptionHelper.java 2018-01-30 20:23:44.000000000 -0500 +++ /dev/null 2018-01-30 20:23:44.000000000 -0500 @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/AttributeDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class AttributeDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/AttributeDescription:1.0"; - - public AttributeDescriptionHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.AttributeDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.AttributeDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [6]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[2] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[3] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[4] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.AttributeModeHelper.type (); - _members0[5] = new org.omg.CORBA.StructMember ( - "mode", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.AttributeDescriptionHelper.id (), "AttributeDescription", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.AttributeDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.AttributeDescription value = new com.sun.org.omg.CORBA.AttributeDescription (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.type = istream.read_TypeCode (); - value.mode = com.sun.org.omg.CORBA.AttributeModeHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeDescription value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - ostream.write_TypeCode (value.type); - com.sun.org.omg.CORBA.AttributeModeHelper.write (ostream, value.mode); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeMode.java 2018-01-30 20:23:45.000000000 -0500 +++ /dev/null 2018-01-30 20:23:45.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/AttributeMode.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public class AttributeMode implements org.omg.CORBA.portable.IDLEntity -{ - private int __value; - private static int __size = 2; - private static com.sun.org.omg.CORBA.AttributeMode[] __array = new com.sun.org.omg.CORBA.AttributeMode [__size]; - - public static final int _ATTR_NORMAL = 0; - public static final com.sun.org.omg.CORBA.AttributeMode ATTR_NORMAL = new com.sun.org.omg.CORBA.AttributeMode(_ATTR_NORMAL); - public static final int _ATTR_READONLY = 1; - public static final com.sun.org.omg.CORBA.AttributeMode ATTR_READONLY = new com.sun.org.omg.CORBA.AttributeMode(_ATTR_READONLY); - - public int value () - { - return __value; - } - - public static com.sun.org.omg.CORBA.AttributeMode from_int (int value) - { - if (value >= 0 && value < __size) - return __array[value]; - else - throw new org.omg.CORBA.BAD_PARAM (); - } - - protected AttributeMode (int value) - { - __value = value; - __array[__value] = this; - } -} // class AttributeMode --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeModeHelper.java 2018-01-30 20:23:46.000000000 -0500 +++ /dev/null 2018-01-30 20:23:46.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/AttributeModeHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class AttributeModeHelper -{ - private static String _id = "IDL:omg.org/CORBA/AttributeMode:1.0"; - - public AttributeModeHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.AttributeMode that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.AttributeMode extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (com.sun.org.omg.CORBA.AttributeModeHelper.id (), "AttributeMode", new String[] { "ATTR_NORMAL", "ATTR_READONLY"} ); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.AttributeMode read (org.omg.CORBA.portable.InputStream istream) - { - return com.sun.org.omg.CORBA.AttributeMode.from_int (istream.read_long ()); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeMode value) - { - ostream.write_long (value.value ()); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdSeqHelper.java 2018-01-30 20:23:46.000000000 -0500 +++ /dev/null 2018-01-30 20:23:46.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ContextIdSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ - -public final class ContextIdSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ContextIdSeq:1.0"; - - public ContextIdSeqHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, String[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdentifierHelper.id (), "ContextIdentifier", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdSeqHelper.id (), "ContextIdSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String[] read (org.omg.CORBA.portable.InputStream istream) - { - String value[] = null; - int _len0 = istream.read_long (); - value = new String[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ContextIdentifierHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ContextIdentifierHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdentifierHelper.java 2018-01-30 20:23:47.000000000 -0500 +++ /dev/null 2018-01-30 20:23:47.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ContextIdentifierHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class ContextIdentifierHelper -{ - private static String _id = "IDL:omg.org/CORBA/ContextIdentifier:1.0"; - - public ContextIdentifierHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdentifierHelper.id (), "ContextIdentifier", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/DefinitionKindHelper.java 2018-01-30 20:23:48.000000000 -0500 +++ /dev/null 2018-01-30 20:23:48.000000000 -0500 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/DefinitionKindHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:43 AM PDT -*/ - -// This file has been manually _CHANGED_ - -public final class DefinitionKindHelper -{ - private static String _id = "IDL:omg.org/CORBA/DefinitionKind:1.0"; - - public DefinitionKindHelper() - { - } - - // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.DefinitionKind that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.DefinitionKind that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.DefinitionKind extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.DefinitionKind extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (com.sun.org.omg.CORBA.DefinitionKindHelper.id (), "DefinitionKind", new String[] { "dk_none", "dk_all", "dk_Attribute", "dk_Constant", "dk_Exception", "dk_Interface", "dk_Module", "dk_Operation", "dk_Typedef", "dk_Alias", "dk_Struct", "dk_Union", "dk_Enum", "dk_Primitive", "dk_String", "dk_Sequence", "dk_Array", "dk_Repository", "dk_Wstring", "dk_Fixed", "dk_Value", "dk_ValueBox", "dk_ValueMember", "dk_Native"} ); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.DefinitionKind read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.DefinitionKind read (org.omg.CORBA.portable.InputStream istream) - { - // _CHANGED_ - //return com.sun.org.omg.CORBA.DefinitionKind.from_int (istream.read_long ()); - return org.omg.CORBA.DefinitionKind.from_int (istream.read_long ()); - } - - // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.DefinitionKind value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.DefinitionKind value) - { - ostream.write_long (value.value ()); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java 2018-01-30 20:23:48.000000000 -0500 +++ /dev/null 2018-01-30 20:23:48.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ - -public final class ExcDescriptionSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ExcDescriptionSeq:1.0"; - - public ExcDescriptionSeqHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ExceptionDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.ExceptionDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.ExceptionDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.id (), "ExcDescriptionSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.ExceptionDescription[] read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.ExceptionDescription value[] = null; - int _len0 = istream.read_long (); - value = new com.sun.org.omg.CORBA.ExceptionDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ExceptionDescriptionHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ExceptionDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ExceptionDescriptionHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescription.java 2018-01-30 20:23:49.000000000 -0500 +++ /dev/null 2018-01-30 20:23:49.000000000 -0500 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ExceptionDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class ExceptionDescription implements org.omg.CORBA.portable.IDLEntity -{ - public String name = null; - public String id = null; - public String defined_in = null; - public String version = null; - public org.omg.CORBA.TypeCode type = null; - - public ExceptionDescription () - { - } // ctor - - public ExceptionDescription (String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _type) - { - name = _name; - id = _id; - defined_in = _defined_in; - version = _version; - type = _type; - } // ctor - -} // class ExceptionDescription --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java 2018-01-30 20:23:50.000000000 -0500 +++ /dev/null 2018-01-30 20:23:50.000000000 -0500 @@ -1,135 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class ExceptionDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/ExceptionDescription:1.0"; - - public ExceptionDescriptionHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ExceptionDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.ExceptionDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [5]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[2] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[3] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[4] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.ExceptionDescriptionHelper.id (), "ExceptionDescription", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.ExceptionDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.ExceptionDescription value = new com.sun.org.omg.CORBA.ExceptionDescription (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.type = istream.read_TypeCode (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ExceptionDescription value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - ostream.write_TypeCode (value.type); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/IDLTypeHelper.java 2018-01-30 20:23:50.000000000 -0500 +++ /dev/null 2018-01-30 20:23:51.000000000 -0500 @@ -1,112 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/IDLTypeHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:45 AM PDT -*/ - -// This file has been _CHANGED_ - -public final class IDLTypeHelper -{ - private static String _id = "IDL:omg.org/CORBA/IDLType:1.0"; - - public IDLTypeHelper() - { - } - - // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.IDLType that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.IDLType that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.IDLType extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.IDLType extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (com.sun.org.omg.CORBA.IDLTypeHelper.id (), "IDLType"); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.IDLType read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.IDLType read (org.omg.CORBA.portable.InputStream istream) - { - return narrow (istream.read_Object (_IDLTypeStub.class)); - } - - // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.IDLType value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.IDLType value) - { - ostream.write_Object ((org.omg.CORBA.Object) value); - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.IDLType narrow (org.omg.CORBA.Object obj) - public static org.omg.CORBA.IDLType narrow (org.omg.CORBA.Object obj) - { - if (obj == null) - return null; - // _CHANGED_ - //else if (obj instanceof com.sun.org.omg.CORBA.IDLType) - else if (obj instanceof org.omg.CORBA.IDLType) - // _CHANGED_ - //return (com.sun.org.omg.CORBA.IDLType)obj; - return (org.omg.CORBA.IDLType)obj; - else if (!obj._is_a (id ())) - throw new org.omg.CORBA.BAD_PARAM (); - else - { - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); - return new com.sun.org.omg.CORBA._IDLTypeStub (delegate); - } - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/IdentifierHelper.java 2018-01-30 20:23:51.000000000 -0500 +++ /dev/null 2018-01-30 20:23:51.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/IdentifierHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:42 AM PDT -*/ - -public final class IdentifierHelper -{ - private static String _id = "IDL:omg.org/CORBA/Identifier:1.0"; - - public IdentifierHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/Initializer.java 2018-01-30 20:23:52.000000000 -0500 +++ /dev/null 2018-01-30 20:23:52.000000000 -0500 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/Initializer.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ - -// This file has been _CHANGED_ - -public final class Initializer implements org.omg.CORBA.portable.IDLEntity -{ - // _CHANGED_ - //public com.sun.org.omg.CORBA.StructMember members[] = null; - public org.omg.CORBA.StructMember members[] = null; - public String name = null; - - public Initializer () - { - } // ctor - - // _CHANGED_ - //public Initializer (com.sun.org.omg.CORBA.StructMember[] _members, String _name) - public Initializer (org.omg.CORBA.StructMember[] _members, String _name) - { - members = _members; - name = _name; - } // ctor - -} // class Initializer --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerHelper.java 2018-01-30 20:23:53.000000000 -0500 +++ /dev/null 2018-01-30 20:23:53.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/InitializerHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ - -public final class InitializerHelper -{ - private static String _id = "IDL:omg.org/CORBA/Initializer:1.0"; - - public InitializerHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.Initializer that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.Initializer extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [2]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = com.sun.org.omg.CORBA.StructMemberHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.StructMemberSeqHelper.id (), "StructMemberSeq", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "members", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.InitializerHelper.id (), "Initializer", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.Initializer read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.Initializer value = new com.sun.org.omg.CORBA.Initializer (); - value.members = com.sun.org.omg.CORBA.StructMemberSeqHelper.read (istream); - value.name = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.Initializer value) - { - com.sun.org.omg.CORBA.StructMemberSeqHelper.write (ostream, value.members); - ostream.write_string (value.name); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerSeqHelper.java 2018-01-30 20:23:53.000000000 -0500 +++ /dev/null 2018-01-30 20:23:53.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/InitializerSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ - -public final class InitializerSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/InitializerSeq:1.0"; - - public InitializerSeqHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.Initializer[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.Initializer[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.InitializerHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.InitializerSeqHelper.id (), "InitializerSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.Initializer[] read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.Initializer value[] = null; - int _len0 = istream.read_long (); - value = new com.sun.org.omg.CORBA.Initializer[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.InitializerHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.Initializer[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.InitializerHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java 2018-01-30 20:23:54.000000000 -0500 +++ /dev/null 2018-01-30 20:23:54.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ - -public final class OpDescriptionSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/OpDescriptionSeq:1.0"; - - public OpDescriptionSeqHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.OperationDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.OperationDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.OperationDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.OpDescriptionSeqHelper.id (), "OpDescriptionSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.OperationDescription[] read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.OperationDescription value[] = null; - int _len0 = istream.read_long (); - value = new com.sun.org.omg.CORBA.OperationDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.OperationDescriptionHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.OperationDescriptionHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescription.java 2018-01-30 20:23:55.000000000 -0500 +++ /dev/null 2018-01-30 20:23:55.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/OperationDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ - -public final class OperationDescription implements org.omg.CORBA.portable.IDLEntity -{ - public String name = null; - public String id = null; - public String defined_in = null; - public String version = null; - public org.omg.CORBA.TypeCode result = null; - public com.sun.org.omg.CORBA.OperationMode mode = null; - public String contexts[] = null; - public com.sun.org.omg.CORBA.ParameterDescription parameters[] = null; - public com.sun.org.omg.CORBA.ExceptionDescription exceptions[] = null; - - public OperationDescription () - { - } // ctor - - public OperationDescription (String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _result, com.sun.org.omg.CORBA.OperationMode _mode, String[] _contexts, com.sun.org.omg.CORBA.ParameterDescription[] _parameters, com.sun.org.omg.CORBA.ExceptionDescription[] _exceptions) - { - name = _name; - id = _id; - defined_in = _defined_in; - version = _version; - result = _result; - mode = _mode; - contexts = _contexts; - parameters = _parameters; - exceptions = _exceptions; - } // ctor - -} // class OperationDescription --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescriptionHelper.java 2018-01-30 20:23:55.000000000 -0500 +++ /dev/null 2018-01-30 20:23:55.000000000 -0500 @@ -1,171 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/OperationDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ - -public final class OperationDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/OperationDescription:1.0"; - - public OperationDescriptionHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.OperationDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.OperationDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [9]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[2] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[3] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[4] = new org.omg.CORBA.StructMember ( - "result", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.OperationModeHelper.type (); - _members0[5] = new org.omg.CORBA.StructMember ( - "mode", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdentifierHelper.id (), "ContextIdentifier", _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ContextIdSeqHelper.id (), "ContextIdSeq", _tcOf_members0); - _members0[6] = new org.omg.CORBA.StructMember ( - "contexts", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.ParameterDescriptionHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ParDescriptionSeqHelper.id (), "ParDescriptionSeq", _tcOf_members0); - _members0[7] = new org.omg.CORBA.StructMember ( - "parameters", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.ExceptionDescriptionHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.id (), "ExcDescriptionSeq", _tcOf_members0); - _members0[8] = new org.omg.CORBA.StructMember ( - "exceptions", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.OperationDescriptionHelper.id (), "OperationDescription", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.OperationDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.OperationDescription value = new com.sun.org.omg.CORBA.OperationDescription (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.result = istream.read_TypeCode (); - value.mode = com.sun.org.omg.CORBA.OperationModeHelper.read (istream); - value.contexts = com.sun.org.omg.CORBA.ContextIdSeqHelper.read (istream); - value.parameters = com.sun.org.omg.CORBA.ParDescriptionSeqHelper.read (istream); - value.exceptions = com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationDescription value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - ostream.write_TypeCode (value.result); - com.sun.org.omg.CORBA.OperationModeHelper.write (ostream, value.mode); - com.sun.org.omg.CORBA.ContextIdSeqHelper.write (ostream, value.contexts); - com.sun.org.omg.CORBA.ParDescriptionSeqHelper.write (ostream, value.parameters); - com.sun.org.omg.CORBA.ExcDescriptionSeqHelper.write (ostream, value.exceptions); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationMode.java 2018-01-30 20:23:56.000000000 -0500 +++ /dev/null 2018-01-30 20:23:56.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/OperationMode.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public class OperationMode implements org.omg.CORBA.portable.IDLEntity -{ - private int __value; - private static int __size = 2; - private static com.sun.org.omg.CORBA.OperationMode[] __array = new com.sun.org.omg.CORBA.OperationMode [__size]; - - public static final int _OP_NORMAL = 0; - public static final com.sun.org.omg.CORBA.OperationMode OP_NORMAL = new com.sun.org.omg.CORBA.OperationMode(_OP_NORMAL); - public static final int _OP_ONEWAY = 1; - public static final com.sun.org.omg.CORBA.OperationMode OP_ONEWAY = new com.sun.org.omg.CORBA.OperationMode(_OP_ONEWAY); - - public int value () - { - return __value; - } - - public static com.sun.org.omg.CORBA.OperationMode from_int (int value) - { - if (value >= 0 && value < __size) - return __array[value]; - else - throw new org.omg.CORBA.BAD_PARAM (); - } - - protected OperationMode (int value) - { - __value = value; - __array[__value] = this; - } -} // class OperationMode --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationModeHelper.java 2018-01-30 20:23:57.000000000 -0500 +++ /dev/null 2018-01-30 20:23:57.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/OperationModeHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class OperationModeHelper -{ - private static String _id = "IDL:omg.org/CORBA/OperationMode:1.0"; - - public OperationModeHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.OperationMode that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.OperationMode extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (com.sun.org.omg.CORBA.OperationModeHelper.id (), "OperationMode", new String[] { "OP_NORMAL", "OP_ONEWAY"} ); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.OperationMode read (org.omg.CORBA.portable.InputStream istream) - { - return com.sun.org.omg.CORBA.OperationMode.from_int (istream.read_long ()); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationMode value) - { - ostream.write_long (value.value ()); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java 2018-01-30 20:23:57.000000000 -0500 +++ /dev/null 2018-01-30 20:23:58.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class ParDescriptionSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ParDescriptionSeq:1.0"; - - public ParDescriptionSeqHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ParameterDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.ParameterDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.ParameterDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ParDescriptionSeqHelper.id (), "ParDescriptionSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.ParameterDescription[] read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.ParameterDescription value[] = null; - int _len0 = istream.read_long (); - value = new com.sun.org.omg.CORBA.ParameterDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ParameterDescriptionHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ParameterDescriptionHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescription.java 2018-01-30 20:23:58.000000000 -0500 +++ /dev/null 2018-01-30 20:23:58.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ParameterDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -// This file has been _CHANGED_ - -public final class ParameterDescription implements org.omg.CORBA.portable.IDLEntity -{ - public String name = null; - public org.omg.CORBA.TypeCode type = null; - // _CHANGED_ - //public com.sun.org.omg.CORBA.IDLType type_def = null; - public org.omg.CORBA.IDLType type_def = null; - public com.sun.org.omg.CORBA.ParameterMode mode = null; - - public ParameterDescription () - { - } // ctor - - // _CHANGED_ - //public ParameterDescription (String _name, org.omg.CORBA.TypeCode _type, com.sun.org.omg.CORBA.IDLType _type_def, com.sun.org.omg.CORBA.ParameterMode _mode) - public ParameterDescription (String _name, org.omg.CORBA.TypeCode _type, org.omg.CORBA.IDLType _type_def, com.sun.org.omg.CORBA.ParameterMode _mode) - { - name = _name; - type = _type; - type_def = _type_def; - mode = _mode; - } // ctor - -} // class ParameterDescription --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescriptionHelper.java 2018-01-30 20:23:59.000000000 -0500 +++ /dev/null 2018-01-30 20:23:59.000000000 -0500 @@ -1,125 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ParameterDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class ParameterDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/ParameterDescription:1.0"; - - public ParameterDescriptionHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ParameterDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.ParameterDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [4]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[1] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.IDLTypeHelper.type (); - _members0[2] = new org.omg.CORBA.StructMember ( - "type_def", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.ParameterModeHelper.type (); - _members0[3] = new org.omg.CORBA.StructMember ( - "mode", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.ParameterDescriptionHelper.id (), "ParameterDescription", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.ParameterDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.ParameterDescription value = new com.sun.org.omg.CORBA.ParameterDescription (); - value.name = istream.read_string (); - value.type = istream.read_TypeCode (); - value.type_def = com.sun.org.omg.CORBA.IDLTypeHelper.read (istream); - value.mode = com.sun.org.omg.CORBA.ParameterModeHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterDescription value) - { - ostream.write_string (value.name); - ostream.write_TypeCode (value.type); - com.sun.org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def); - com.sun.org.omg.CORBA.ParameterModeHelper.write (ostream, value.mode); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterMode.java 2018-01-30 20:24:00.000000000 -0500 +++ /dev/null 2018-01-30 20:24:00.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ParameterMode.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public class ParameterMode implements org.omg.CORBA.portable.IDLEntity -{ - private int __value; - private static int __size = 3; - private static com.sun.org.omg.CORBA.ParameterMode[] __array = new com.sun.org.omg.CORBA.ParameterMode [__size]; - - public static final int _PARAM_IN = 0; - public static final com.sun.org.omg.CORBA.ParameterMode PARAM_IN = new com.sun.org.omg.CORBA.ParameterMode(_PARAM_IN); - public static final int _PARAM_OUT = 1; - public static final com.sun.org.omg.CORBA.ParameterMode PARAM_OUT = new com.sun.org.omg.CORBA.ParameterMode(_PARAM_OUT); - public static final int _PARAM_INOUT = 2; - public static final com.sun.org.omg.CORBA.ParameterMode PARAM_INOUT = new com.sun.org.omg.CORBA.ParameterMode(_PARAM_INOUT); - - public int value () - { - return __value; - } - - public static com.sun.org.omg.CORBA.ParameterMode from_int (int value) - { - if (value >= 0 && value < __size) - return __array[value]; - else - throw new org.omg.CORBA.BAD_PARAM (); - } - - protected ParameterMode (int value) - { - __value = value; - __array[__value] = this; - } -} // class ParameterMode --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterModeHelper.java 2018-01-30 20:24:00.000000000 -0500 +++ /dev/null 2018-01-30 20:24:00.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ParameterModeHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:50 AM PDT -*/ - -public final class ParameterModeHelper -{ - private static String _id = "IDL:omg.org/CORBA/ParameterMode:1.0"; - - public ParameterModeHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ParameterMode that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.ParameterMode extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (com.sun.org.omg.CORBA.ParameterModeHelper.id (), "ParameterMode", new String[] { "PARAM_IN", "PARAM_OUT", "PARAM_INOUT"} ); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.ParameterMode read (org.omg.CORBA.portable.InputStream istream) - { - return com.sun.org.omg.CORBA.ParameterMode.from_int (istream.read_long ()); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterMode value) - { - ostream.write_long (value.value ()); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/Repository.java 2018-01-30 20:24:01.000000000 -0500 +++ /dev/null 2018-01-30 20:24:01.000000000 -0500 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - -public interface Repository extends org.omg.CORBA.IRObject, org.omg.CORBA.portable.IDLEntity -{ -} // interface Repository --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryHelper.java 2018-01-30 20:24:02.000000000 -0500 +++ /dev/null 2018-01-30 20:24:02.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - -public final class RepositoryHelper -{ - private static String _id = "IDL:com.sun.omg.org/CORBA/Repository:3.0"; - - public RepositoryHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, Repository that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static Repository extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryHelper.id (), "Repository", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static Repository read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return null; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, Repository value) - { - ostream.write_string (null); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdHelper.java 2018-01-30 20:24:02.000000000 -0500 +++ /dev/null 2018-01-30 20:24:02.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/RepositoryIdHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:43 AM PDT -*/ - -public final class RepositoryIdHelper -{ - private static String _id = "IDL:omg.org/CORBA/RepositoryId:1.0"; - - public RepositoryIdHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java 2018-01-30 20:24:03.000000000 -0500 +++ /dev/null 2018-01-30 20:24:03.000000000 -0500 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:51 AM PDT -*/ - -public final class RepositoryIdSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/RepositoryIdSeq:1.0"; - - public RepositoryIdSeqHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, String[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdSeqHelper.id (), "RepositoryIdSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String[] read (org.omg.CORBA.portable.InputStream istream) - { - String value[] = null; - int _len0 = istream.read_long (); - value = new String[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.RepositoryIdHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.RepositoryIdHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberHelper.java 2018-01-30 20:24:04.000000000 -0500 +++ /dev/null 2018-01-30 20:24:04.000000000 -0500 @@ -1,130 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/StructMemberHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ - -// This file has been manually _CHANGED_ - -public final class StructMemberHelper -{ - private static String _id = "IDL:omg.org/CORBA/StructMember:1.0"; - - public StructMemberHelper() - { - } - - // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.StructMember that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.StructMember that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.StructMember extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.StructMember extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [3]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[1] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.IDLTypeHelper.type (); - _members0[2] = new org.omg.CORBA.StructMember ( - "type_def", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.StructMemberHelper.id (), "StructMember", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.StructMember read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.StructMember read (org.omg.CORBA.portable.InputStream istream) - { - // _CHANGED_ - //com.sun.org.omg.CORBA.StructMember value = new com.sun.org.omg.CORBA.StructMember (); - org.omg.CORBA.StructMember value = new org.omg.CORBA.StructMember (); - value.name = istream.read_string (); - value.type = istream.read_TypeCode (); - value.type_def = com.sun.org.omg.CORBA.IDLTypeHelper.read (istream); - return value; - } - - // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.StructMember value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.StructMember value) - { - ostream.write_string (value.name); - ostream.write_TypeCode (value.type); - com.sun.org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberSeqHelper.java 2018-01-30 20:24:04.000000000 -0500 +++ /dev/null 2018-01-30 20:24:05.000000000 -0500 @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/StructMemberSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ - -// This file has been _CHANGED_ - -public final class StructMemberSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/StructMemberSeq:1.0"; - - public StructMemberSeqHelper() - { - } - - // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.StructMember[] that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.StructMember[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.StructMember[] extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.StructMember[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.StructMemberHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.StructMemberSeqHelper.id (), "StructMemberSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.StructMember[] read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.StructMember[] read (org.omg.CORBA.portable.InputStream istream) - { - // _CHANGED_ - //com.sun.org.omg.CORBA.StructMember value[] = null; - org.omg.CORBA.StructMember value[] = null; - int _len0 = istream.read_long (); - // _CHANGED_ - //value = new com.sun.org.omg.CORBA.StructMember[_len0]; - value = new org.omg.CORBA.StructMember[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.StructMemberHelper.read (istream); - return value; - } - - // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.StructMember[] value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.StructMember[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.StructMemberHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java 2018-01-30 20:24:05.000000000 -0500 +++ /dev/null 2018-01-30 20:24:05.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA.ValueDefPackage; - - -/** -* com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:52 AM PDT -*/ - -// This file has been manually _CHANGED_ - -public final class FullValueDescription implements org.omg.CORBA.portable.IDLEntity -{ - public String name = null; - public String id = null; - public boolean is_abstract = false; - public boolean is_custom = false; - public String defined_in = null; - public String version = null; - public com.sun.org.omg.CORBA.OperationDescription operations[] = null; - public com.sun.org.omg.CORBA.AttributeDescription attributes[] = null; - - // _CHANGED_ - //public com.sun.org.omg.CORBA.ValueMember members[] = null; - public org.omg.CORBA.ValueMember members[] = null; - - public com.sun.org.omg.CORBA.Initializer initializers[] = null; - public String supported_interfaces[] = null; - public String abstract_base_values[] = null; - public boolean is_truncatable = false; - public String base_value = null; - public org.omg.CORBA.TypeCode type = null; - - public FullValueDescription () - { - } // ctor - - // _CHANGED_ - //public FullValueDescription (String _name, String _id, boolean _is_abstract, boolean _is_custom, String _defined_in, String _version, com.sun.org.omg.CORBA.OperationDescription[] _operations, com.sun.org.omg.CORBA.AttributeDescription[] _attributes, com.sun.org.omg.CORBA.ValueMember[] _members, com.sun.org.omg.CORBA.Initializer[] _initializers, String[] _supported_interfaces, String[] _abstract_base_values, boolean _is_truncatable, String _base_value, org.omg.CORBA.TypeCode _type) - public FullValueDescription (String _name, String _id, boolean _is_abstract, boolean _is_custom, String _defined_in, String _version, com.sun.org.omg.CORBA.OperationDescription[] _operations, com.sun.org.omg.CORBA.AttributeDescription[] _attributes, org.omg.CORBA.ValueMember[] _members, com.sun.org.omg.CORBA.Initializer[] _initializers, String[] _supported_interfaces, String[] _abstract_base_values, boolean _is_truncatable, String _base_value, org.omg.CORBA.TypeCode _type) - { - name = _name; - id = _id; - is_abstract = _is_abstract; - is_custom = _is_custom; - defined_in = _defined_in; - version = _version; - operations = _operations; - attributes = _attributes; - members = _members; - initializers = _initializers; - supported_interfaces = _supported_interfaces; - abstract_base_values = _abstract_base_values; - is_truncatable = _is_truncatable; - base_value = _base_value; - type = _type; - } // ctor - -} // class FullValueDescription --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java 2018-01-30 20:24:06.000000000 -0500 +++ /dev/null 2018-01-30 20:24:06.000000000 -0500 @@ -1,220 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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.org.omg.CORBA.ValueDefPackage; - - -/** -* com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:52 AM PDT -*/ - -public final class FullValueDescriptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/ValueDef/FullValueDescription:1.0"; - - public FullValueDescriptionHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [15]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean); - _members0[2] = new org.omg.CORBA.StructMember ( - "is_abstract", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean); - _members0[3] = new org.omg.CORBA.StructMember ( - "is_custom", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[4] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[5] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.OperationDescriptionHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.OpDescriptionSeqHelper.id (), "OpDescriptionSeq", _tcOf_members0); - _members0[6] = new org.omg.CORBA.StructMember ( - "operations", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.AttributeDescriptionHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.id (), "AttrDescriptionSeq", _tcOf_members0); - _members0[7] = new org.omg.CORBA.StructMember ( - "attributes", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.ValueMemberHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ValueMemberSeqHelper.id (), "ValueMemberSeq", _tcOf_members0); - _members0[8] = new org.omg.CORBA.StructMember ( - "members", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.InitializerHelper.type (); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.InitializerSeqHelper.id (), "InitializerSeq", _tcOf_members0); - _members0[9] = new org.omg.CORBA.StructMember ( - "initializers", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdSeqHelper.id (), "RepositoryIdSeq", _tcOf_members0); - _members0[10] = new org.omg.CORBA.StructMember ( - "supported_interfaces", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_sequence_tc (0, _tcOf_members0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdSeqHelper.id (), "RepositoryIdSeq", _tcOf_members0); - _members0[11] = new org.omg.CORBA.StructMember ( - "abstract_base_values", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean); - _members0[12] = new org.omg.CORBA.StructMember ( - "is_truncatable", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[13] = new org.omg.CORBA.StructMember ( - "base_value", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[14] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.id (), "FullValueDescription", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription value = new com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.is_abstract = istream.read_boolean (); - value.is_custom = istream.read_boolean (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.operations = com.sun.org.omg.CORBA.OpDescriptionSeqHelper.read (istream); - value.attributes = com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.read (istream); - value.members = com.sun.org.omg.CORBA.ValueMemberSeqHelper.read (istream); - value.initializers = com.sun.org.omg.CORBA.InitializerSeqHelper.read (istream); - value.supported_interfaces = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (istream); - value.abstract_base_values = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (istream); - value.is_truncatable = istream.read_boolean (); - value.base_value = istream.read_string (); - value.type = istream.read_TypeCode (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_boolean (value.is_abstract); - ostream.write_boolean (value.is_custom); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - com.sun.org.omg.CORBA.OpDescriptionSeqHelper.write (ostream, value.operations); - com.sun.org.omg.CORBA.AttrDescriptionSeqHelper.write (ostream, value.attributes); - com.sun.org.omg.CORBA.ValueMemberSeqHelper.write (ostream, value.members); - com.sun.org.omg.CORBA.InitializerSeqHelper.write (ostream, value.initializers); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (ostream, value.supported_interfaces); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (ostream, value.abstract_base_values); - ostream.write_boolean (value.is_truncatable); - ostream.write_string (value.base_value); - ostream.write_TypeCode (value.type); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberHelper.java 2018-01-30 20:24:07.000000000 -0500 +++ /dev/null 2018-01-30 20:24:07.000000000 -0500 @@ -1,162 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ValueMemberHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ - -// This file has been _CHANGED_ - -public final class ValueMemberHelper -{ - private static String _id = "IDL:omg.org/CORBA/ValueMember:1.0"; - - public ValueMemberHelper() - { - } - - // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueMember that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.ValueMember that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.ValueMember extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.ValueMember extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [7]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[2] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[3] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[4] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = com.sun.org.omg.CORBA.IDLTypeHelper.type (); - _members0[5] = new org.omg.CORBA.StructMember ( - "type_def", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VisibilityHelper.id (), "Visibility", _tcOf_members0); - _members0[6] = new org.omg.CORBA.StructMember ( - "access", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (com.sun.org.omg.CORBA.ValueMemberHelper.id (), "ValueMember", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.ValueMember read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.ValueMember read (org.omg.CORBA.portable.InputStream istream) - { - // _CHANGED_ - //com.sun.org.omg.CORBA.ValueMember value = new com.sun.org.omg.CORBA.ValueMember (); - org.omg.CORBA.ValueMember value = new org.omg.CORBA.ValueMember (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.type = istream.read_TypeCode (); - value.type_def = com.sun.org.omg.CORBA.IDLTypeHelper.read (istream); - value.access = istream.read_short (); - return value; - } - - // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueMember value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.ValueMember value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - ostream.write_TypeCode (value.type); - com.sun.org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def); - ostream.write_short (value.access); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberSeqHelper.java 2018-01-30 20:24:07.000000000 -0500 +++ /dev/null 2018-01-30 20:24:07.000000000 -0500 @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/ValueMemberSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ - -// This file has been _CHANGED_ - -public final class ValueMemberSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ValueMemberSeq:1.0"; - - public ValueMemberSeqHelper() - { - } - - // _CHANGED_ - //public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueMember[] that) - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.ValueMember[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.ValueMember[] extract (org.omg.CORBA.Any a) - public static org.omg.CORBA.ValueMember[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.ValueMemberHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.ValueMemberSeqHelper.id (), "ValueMemberSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - // _CHANGED_ - //public static com.sun.org.omg.CORBA.ValueMember[] read (org.omg.CORBA.portable.InputStream istream) - public static org.omg.CORBA.ValueMember[] read (org.omg.CORBA.portable.InputStream istream) - { - // _CHANGED_ - //com.sun.org.omg.CORBA.ValueMember value[] = null; - org.omg.CORBA.ValueMember value[] = null; - int _len0 = istream.read_long (); - // _CHANGED_ - //value = new com.sun.org.omg.CORBA.ValueMember[_len0]; - value = new org.omg.CORBA.ValueMember[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ValueMemberHelper.read (istream); - return value; - } - - // _CHANGED_ - //public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueMember[] value) - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.ValueMember[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ValueMemberHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/VersionSpecHelper.java 2018-01-30 20:24:08.000000000 -0500 +++ /dev/null 2018-01-30 20:24:08.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/VersionSpecHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:43 AM PDT -*/ - -public final class VersionSpecHelper -{ - private static String _id = "IDL:omg.org/CORBA/VersionSpec:1.0"; - - public VersionSpecHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/VisibilityHelper.java 2018-01-30 20:24:09.000000000 -0500 +++ /dev/null 2018-01-30 20:24:09.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/VisibilityHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:44 AM PDT -*/ - - -// orbos 98-01-18: Objects By Value -- begin -public final class VisibilityHelper -{ - private static String _id = "IDL:omg.org/CORBA/Visibility:1.0"; - - public VisibilityHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, short that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static short extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.CORBA.VisibilityHelper.id (), "Visibility", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static short read (org.omg.CORBA.portable.InputStream istream) - { - short value = (short)0; - value = istream.read_short (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, short value) - { - ostream.write_short (value); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/_IDLTypeStub.java 2018-01-30 20:24:09.000000000 -0500 +++ /dev/null 2018-01-30 20:24:09.000000000 -0500 @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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.org.omg.CORBA; - - -/** -* com/sun/org/omg/CORBA/_IDLTypeStub.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* Thursday, May 6, 1999 1:51:45 AM PDT -*/ - -// This file has been manually _CHANGED_ - -// _CHANGED_ -//public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl implements com.sun.org.omg.CORBA.IDLType -public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.IDLType -{ - // Constructors - // NOTE: If the default constructor is used, the - // object is useless until _set_delegate (...) - // is called. - public _IDLTypeStub () - { - super (); - } - - public _IDLTypeStub (org.omg.CORBA.portable.Delegate delegate) - { - super (); - _set_delegate (delegate); - } - - public org.omg.CORBA.TypeCode type () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("_get_type", true); - _in = _invoke (_out); - org.omg.CORBA.TypeCode __result = _in.read_TypeCode (); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return type (); - } finally { - _releaseReply (_in); - } - } // type - - - // read interface - // _CHANGED_ - //public com.sun.org.omg.CORBA.DefinitionKind def_kind () - public org.omg.CORBA.DefinitionKind def_kind () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("_get_def_kind", true); - _in = _invoke (_out); - // _CHANGED_ - //com.sun.org.omg.CORBA.DefinitionKind __result = com.sun.org.omg.CORBA.DefinitionKindHelper.read (_in); - org.omg.CORBA.DefinitionKind __result = com.sun.org.omg.CORBA.DefinitionKindHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return def_kind (); - } finally { - _releaseReply (_in); - } - } // def_kind - - - // write interface - public void destroy () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("destroy", true); - _in = _invoke (_out); - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - destroy (); - } finally { - _releaseReply (_in); - } - } // destroy - - // Type-specific CORBA::Object operations - private static String[] __ids = { - "IDL:omg.org/CORBA/IDLType:1.0", - "IDL:omg.org/CORBA/IRObject:1.0"}; - - public String[] _ids () - { - return (String[])__ids.clone (); - } - - private void readObject (java.io.ObjectInputStream s) - { - try - { - String str = s.readUTF (); - org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str); - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); - _set_delegate (delegate); - } catch (java.io.IOException e) {} - } - - private void writeObject (java.io.ObjectOutputStream s) - { - try - { - String str = org.omg.CORBA.ORB.init ().object_to_string (this); - s.writeUTF (str); - } catch (java.io.IOException e) {} - } -} // class _IDLTypeStub --- old/src/java.corba/share/classes/com/sun/org/omg/CORBA/portable/ValueHelper.java 2018-01-30 20:24:10.000000000 -0500 +++ /dev/null 2018-01-30 20:24:10.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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.org.omg.CORBA.portable; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.BoxedValueHelper; - -/** - * An interface that is implemented by valuetype helper classes. - * This interface appeared in CORBA 2.3 drafts but was removed from - * the published CORBA 2.3 specification. - * - * @deprecated Deprecated by CORBA 2.3. - */ -@Deprecated -public interface ValueHelper extends BoxedValueHelper { - Class get_class(); - String[] get_truncatable_base_ids(); - TypeCode get_type(); -} --- old/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBase.java 2018-01-30 20:24:11.000000000 -0500 +++ /dev/null 2018-01-30 20:24:11.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.SendingContext; - - -/** -* com/sun/org/omg/SendingContext/CodeBase.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ - -// Edited to leave RunTime in org.omg.CORBA - -public interface CodeBase extends CodeBaseOperations, org.omg.SendingContext.RunTime, org.omg.CORBA.portable.IDLEntity -{ -} // interface CodeBase --- old/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseHelper.java 2018-01-30 20:24:11.000000000 -0500 +++ /dev/null 2018-01-30 20:24:11.000000000 -0500 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.SendingContext; - - -/** -* com/sun/org/omg/SendingContext/CodeBaseHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ - -public final class CodeBaseHelper -{ - private static String _id = "IDL:omg.org/SendingContext/CodeBase:1.0"; - - public CodeBaseHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.SendingContext.CodeBase that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.SendingContext.CodeBase extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (com.sun.org.omg.SendingContext.CodeBaseHelper.id (), "CodeBase"); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.SendingContext.CodeBase read (org.omg.CORBA.portable.InputStream istream) - { - return narrow (istream.read_Object (_CodeBaseStub.class)); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.SendingContext.CodeBase value) - { - ostream.write_Object ((org.omg.CORBA.Object) value); - } - - public static com.sun.org.omg.SendingContext.CodeBase narrow (org.omg.CORBA.Object obj) - { - if (obj == null) - return null; - else if (obj instanceof com.sun.org.omg.SendingContext.CodeBase) - return (com.sun.org.omg.SendingContext.CodeBase)obj; - else if (!obj._is_a (id ())) - throw new org.omg.CORBA.BAD_PARAM (); - else - { - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); - return new com.sun.org.omg.SendingContext._CodeBaseStub (delegate); - } - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseOperations.java 2018-01-30 20:24:12.000000000 -0500 +++ /dev/null 2018-01-30 20:24:12.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.SendingContext; - - -/** -* com/sun/org/omg/SendingContext/CodeBaseOperations.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ - -// Edited to leave RunTime in org.omg.CORBA - -public interface CodeBaseOperations extends org.omg.SendingContext.RunTimeOperations -{ - - // Operation to obtain the IR from the sending context - com.sun.org.omg.CORBA.Repository get_ir (); - - // Operations to obtain a URL to the implementation code - String implementation (String x); - String[] implementations (String[] x); - - // the same information - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription meta (String x); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] metas (String[] x); - - // information - String[] bases (String x); -} // interface CodeBaseOperations --- old/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java 2018-01-30 20:24:13.000000000 -0500 +++ /dev/null 2018-01-30 20:24:13.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.SendingContext.CodeBasePackage; - - -/** -* com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ - -public final class URLHelper -{ - private static String _id = "IDL:omg.org/SendingContext/CodeBase/URL:1.0"; - - public URLHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.id (), "URL", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java 2018-01-30 20:24:13.000000000 -0500 +++ /dev/null 2018-01-30 20:24:13.000000000 -0500 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.SendingContext.CodeBasePackage; - - -/** -* com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ - -public final class URLSeqHelper -{ - private static String _id = "IDL:omg.org/SendingContext/CodeBase/URLSeq:1.0"; - - public URLSeqHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, String[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.id (), "URL", __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.SendingContext.CodeBasePackage.URLSeqHelper.id (), "URLSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String[] read (org.omg.CORBA.portable.InputStream istream) - { - String value[] = null; - int _len0 = istream.read_long (); - value = new String[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java 2018-01-30 20:24:14.000000000 -0500 +++ /dev/null 2018-01-30 20:24:14.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.SendingContext.CodeBasePackage; - - -/** -* com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ - -public final class ValueDescSeqHelper -{ - private static String _id = "IDL:omg.org/SendingContext/CodeBase/ValueDescSeq:1.0"; - - public ValueDescSeqHelper() - { - } - - public static void insert (org.omg.CORBA.Any a, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (com.sun.org.omg.SendingContext.CodeBasePackage.ValueDescSeqHelper.id (), "ValueDescSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] read (org.omg.CORBA.portable.InputStream istream) - { - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription value[] = null; - int _len0 = istream.read_long (); - value = new com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java 2018-01-30 20:24:15.000000000 -0500 +++ /dev/null 2018-01-30 20:24:15.000000000 -0500 @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.org.omg.SendingContext; - - -/** -* com/sun/org/omg/SendingContext/_CodeBaseImplBase.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ - -public abstract class _CodeBaseImplBase extends org.omg.CORBA.portable.ObjectImpl - implements com.sun.org.omg.SendingContext.CodeBase, org.omg.CORBA.portable.InvokeHandler -{ - - // Constructors - public _CodeBaseImplBase () - { - } - - private static java.util.Hashtable _methods = new java.util.Hashtable (); - static - { - _methods.put ("get_ir", new java.lang.Integer (0)); - _methods.put ("implementation", new java.lang.Integer (1)); - _methods.put ("implementations", new java.lang.Integer (2)); - _methods.put ("meta", new java.lang.Integer (3)); - _methods.put ("metas", new java.lang.Integer (4)); - _methods.put ("bases", new java.lang.Integer (5)); - } - - public org.omg.CORBA.portable.OutputStream _invoke (String method, - org.omg.CORBA.portable.InputStream in, - org.omg.CORBA.portable.ResponseHandler rh) - { - org.omg.CORBA.portable.OutputStream out = rh.createReply(); - java.lang.Integer __method = (java.lang.Integer)_methods.get (method); - if (__method == null) - throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - - switch (__method.intValue ()) - { - - // Operation to obtain the IR from the sending context - case 0: // SendingContext/CodeBase/get_ir - { - com.sun.org.omg.CORBA.Repository __result = null; - __result = this.get_ir (); - com.sun.org.omg.CORBA.RepositoryHelper.write (out, __result); - break; - } - - - // Operations to obtain a URL to the implementation code - case 1: // SendingContext/CodeBase/implementation - { - String x = com.sun.org.omg.CORBA.RepositoryIdHelper.read (in); - String __result = null; - __result = this.implementation (x); - out.write_string (__result); - break; - } - - case 2: // SendingContext/CodeBase/implementations - { - String x[] = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (in); - String __result[] = null; - __result = this.implementations (x); - com.sun.org.omg.SendingContext.CodeBasePackage.URLSeqHelper.write (out, __result); - break; - } - - - // the same information - case 3: // SendingContext/CodeBase/meta - { - String x = com.sun.org.omg.CORBA.RepositoryIdHelper.read (in); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result = null; - __result = this.meta (x); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.write (out, __result); - break; - } - - case 4: // SendingContext/CodeBase/metas - { - String x[] = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (in); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result[] = null; - __result = this.metas (x); - com.sun.org.omg.SendingContext.CodeBasePackage.ValueDescSeqHelper.write (out, __result); - break; - } - - - // information - case 5: // SendingContext/CodeBase/bases - { - String x = com.sun.org.omg.CORBA.RepositoryIdHelper.read (in); - String __result[] = null; - __result = this.bases (x); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (out, __result); - break; - } - - default: - throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - } - - return out; - } // _invoke - - // Type-specific CORBA::Object operations - private static String[] __ids = { - "IDL:omg.org/SendingContext/CodeBase:1.0", - "IDL:omg.org/SendingContext/RunTime:1.0"}; - - public String[] _ids () - { - return (String[]) __ids.clone(); - } - - -} // class _CodeBaseImplBase --- old/src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseStub.java 2018-01-30 20:24:15.000000000 -0500 +++ /dev/null 2018-01-30 20:24:15.000000000 -0500 @@ -1,208 +0,0 @@ -/* - * Copyright (c) 1999, 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.org.omg.SendingContext; - - -/** -* com/sun/org/omg/SendingContext/_CodeBaseStub.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from rt.idl -* Thursday, May 6, 1999 1:52:08 AM PDT -*/ - -public class _CodeBaseStub extends org.omg.CORBA.portable.ObjectImpl implements com.sun.org.omg.SendingContext.CodeBase -{ - // Constructors - // NOTE: If the default constructor is used, the - // object is useless until _set_delegate (...) - // is called. - public _CodeBaseStub () - { - super (); - } - - public _CodeBaseStub (org.omg.CORBA.portable.Delegate delegate) - { - super (); - _set_delegate (delegate); - } - - - // Operation to obtain the IR from the sending context - public com.sun.org.omg.CORBA.Repository get_ir () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("get_ir", true); - _in = _invoke (_out); - com.sun.org.omg.CORBA.Repository __result = com.sun.org.omg.CORBA.RepositoryHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return get_ir (); - } finally { - _releaseReply (_in); - } - } // get_ir - - - // Operations to obtain a URL to the implementation code - public String implementation (String x) - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("implementation", true); - com.sun.org.omg.CORBA.RepositoryIdHelper.write (_out, x); - _in = _invoke (_out); - String __result = com.sun.org.omg.SendingContext.CodeBasePackage.URLHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return implementation (x); - } finally { - _releaseReply (_in); - } - } // implementation - - public String[] implementations (String[] x) - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("implementations", true); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (_out, x); - _in = _invoke (_out); - String __result[] = com.sun.org.omg.SendingContext.CodeBasePackage.URLSeqHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return implementations (x); - } finally { - _releaseReply (_in); - } - } // implementations - - - // the same information - public com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription meta (String x) - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("meta", true); - com.sun.org.omg.CORBA.RepositoryIdHelper.write (_out, x); - _in = _invoke (_out); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result = com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescriptionHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return meta (x); - } finally { - _releaseReply (_in); - } - } // meta - - public com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription[] metas (String[] x) - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("metas", true); - com.sun.org.omg.CORBA.RepositoryIdSeqHelper.write (_out, x); - _in = _invoke (_out); - com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription __result[] = com.sun.org.omg.SendingContext.CodeBasePackage.ValueDescSeqHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return metas (x); - } finally { - _releaseReply (_in); - } - } // metas - - - // information - public String[] bases (String x) - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("bases", true); - com.sun.org.omg.CORBA.RepositoryIdHelper.write (_out, x); - _in = _invoke (_out); - String __result[] = com.sun.org.omg.CORBA.RepositoryIdSeqHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return bases (x); - } finally { - _releaseReply (_in); - } - } // bases - - // Type-specific CORBA::Object operations - private static String[] __ids = { - "IDL:omg.org/SendingContext/CodeBase:1.0", - "IDL:omg.org/SendingContext/RunTime:1.0"}; - - public String[] _ids () - { - return (String[])__ids.clone (); - } - - private void readObject (java.io.ObjectInputStream s) - { - try - { - String str = s.readUTF (); - org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str); - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); - _set_delegate (delegate); - } catch (java.io.IOException e) {} - } - - private void writeObject (java.io.ObjectOutputStream s) - { - try - { - String str = org.omg.CORBA.ORB.init ().object_to_string (this); - s.writeUTF (str); - } catch (java.io.IOException e) {} - } -} // class _CodeBaseStub --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Arguments.java 2018-01-30 20:24:16.000000000 -0500 +++ /dev/null 2018-01-30 20:24:16.000000000 -0500 @@ -1,325 +0,0 @@ -/* - * Copyright (c) 1999, 2007, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -F46082.51 Remove -stateful option. "Stateful interfaces" obsolete. -// -D58319 Add -version option. Note that this may occur as the last -// argument on the command-line. -// -F60858.1 Add -corba [level] option. Accept IDL upto this level, and -// behave in a "proprietary manner" otherwise. -// -D62023 Add -noWarn option to supress warnings. - -import java.io.DataInputStream; -import java.io.IOException; -import java.util.Hashtable; -import java.util.Properties; -import java.util.Vector; -import java.util.StringTokenizer; -import java.lang.reflect.Modifier; -import java.lang.reflect.Field; - -import com.sun.tools.corba.se.idl.som.cff.FileLocator; - -/** - * This class is responsible for parsing the command line arguments to the - * compiler. To add new arguments to the compiler, this class must be extended - * and the parseOtherArgs method overridden. - **/ -public class Arguments -{ - /** - * Method parseOtherArgs() is called when the framework detects arguments - * which are unknown to it. The default implementation of this method simply - * throws an InvalidArgument exception. Any overriding implementation - * must check the arguments passed to it for validity and process the - * arguments appropriately. If it detects an invalid argument, it should - * throw an InvalidArgument exception. Arguments MUST be of the form - * {@code '/ []'} or {@code '- []'} where {@code } - * is optional (for example, -iC:\includes, 'C:\includes' is the qualifier - * for the argument 'i'). - * @param args The arguments which are unknown by the framework. - * @param properties Environment-style properties collected from the - * file idl.config. - * @exception idl.InvalidArgument if the argument is unknown. - **/ - protected void parseOtherArgs (String[] args, Properties properties) throws InvalidArgument - { - if (args.length > 0) - throw new InvalidArgument (args[0]); - } // parseOtherArgs - - - protected void setDebugFlags( String args ) - { - StringTokenizer st = new StringTokenizer( args, "," ) ; - while (st.hasMoreTokens()) { - String token = st.nextToken() ; - - // If there is a public boolean data member in this class - // named token + "DebugFlag", set it to true. - try { - Field fld = this.getClass().getField( token + "DebugFlag" ) ; - int mod = fld.getModifiers() ; - if (Modifier.isPublic( mod ) && !Modifier.isStatic( mod )) - if (fld.getType() == boolean.class) - fld.setBoolean( this, true ) ; - } catch (Exception exc) { - // ignore it - } - } - } - - /** - * Collect the command-line parameters. - **/ - void parseArgs (String[] args) throws InvalidArgument { - Vector unknownArgs = new Vector (); - int i = 0; - - try { - // Process command line parameters - for (i = 0; i < args.length - 1; ++i) { - String lcArg = args[i].toLowerCase (); - if (lcArg.charAt (0) != '-' && lcArg.charAt (0) != '/') - throw new InvalidArgument (args[i]); - if (lcArg.charAt (0) == '-' ) { - lcArg = lcArg.substring (1); - } - - // Include path - if (lcArg.equals ("i")) { - includePaths.addElement (args[++i]); - } else if (lcArg.startsWith ("i")) { - includePaths.addElement (args[i].substring (2)); - } else if (lcArg.equals ("v") || lcArg.equals ("verbose")) { - // Verbose mode - verbose = true; - } else if (lcArg.equals ("d")) { - // Define symbol - definedSymbols.put (args[++i], ""); - } else if (lcArg.equals( "debug" )) { - // Turn on debug flags - setDebugFlags( args[++i] ) ; - } else if (lcArg.startsWith ("d")) { - definedSymbols.put (args[i].substring (2), ""); - } else if (lcArg.equals ("emitall")) { - // Emit bindings for included sources - emitAll = true; - } else if (lcArg.equals ("keep")) { - // Keep old files - keepOldFiles = true; - } else if (lcArg.equals ("nowarn")) { - // Suppress warnings - noWarn = true; - } else if (lcArg.equals ("trace")) { - // Allow tracing. - Runtime.getRuntime ().traceMethodCalls (true); - } - // Remove -stateful feature. - //else if (lcArg.equals ("stateful")) - //{ - // Emit stateful bindings. - // parseStateful = true; - //} - // CPPModule - else if ( lcArg.equals ("cppmodule")) { - cppModule = true; - } else if (lcArg.equals ("version")) { - // Version - versionRequest = true; - } else if (lcArg.equals ("corba")) { - // CORBA level - if (i + 1 >= args.length) - throw new InvalidArgument (args[i]); - String level = args[++i]; - if (level.charAt (0) == '-') - throw new InvalidArgument (args[i - 1]); - try { - corbaLevel = new Float (level).floatValue (); - } catch (NumberFormatException e) { - throw new InvalidArgument (args[i]); - } - } else { - unknownArgs.addElement (args[i]); - ++i; - while (i < (args.length - 1) && - args[i].charAt (0) != '-' && - args[i].charAt (0) != '/') { - unknownArgs.addElement (args[i++]); - } - --i; - } - } - } catch (ArrayIndexOutOfBoundsException e) { - // If there is any array indexing problem, it is probably - // because the qualifier on the last argument is missing. - // Report that this last argument is invalid. - throw new InvalidArgument (args[args.length - 1]); - } - - // - // The last argument is the file argument or "-version", which may - // be specified without a file argument. - if (i == args.length - 1) { - if (args[i].toLowerCase ().equals ("-version")) - versionRequest = true; - else - file = args[i]; - } else - throw new InvalidArgument (); - - // Get and process the idl.config file. - Properties props = new Properties (); - try { - DataInputStream stream = FileLocator.locateFileInClassPath ("idl.config"); - props.load (stream); - addIncludePaths (props); - } catch (IOException e) { - } - - // Call parseOtherArgs. By default, if there are unknown args, - // InvalidArgument is called. A call to parseOtherArgs is useful - // only when this framework has been extended. - String[] otherArgs; - if (unknownArgs.size () > 0) { - otherArgs = new String[unknownArgs.size ()]; - unknownArgs.copyInto (otherArgs); - } else - otherArgs = new String[0]; - - parseOtherArgs (otherArgs, props); - } // parseArgs - - /** - * - **/ - private void addIncludePaths (Properties props) - { - String paths = props.getProperty ("includes"); - if (paths != null) - { - String separator = System.getProperty ("path.separator"); - int end = -separator.length (); // so the first pass paths == original paths - do - { - paths = paths.substring (end + separator.length ()); - end = paths.indexOf (separator); - if (end < 0) - end = paths.length (); - includePaths.addElement (paths.substring (0, end)); - } - while (end != paths.length ()); - } - } // addIncludePaths - - /** - * The name of the IDL file. - **/ - public String file = null; - - /** - * True if the user wishes to see processing remarks. - **/ - public boolean verbose = false; - - /** - * If this is true, then existing files should not be overwritten - * by the compiler. - **/ - public boolean keepOldFiles = false; - - /** - * If this is true, then the types in all included files are also emitted. - **/ - public boolean emitAll = false; - - // Remove -stateful feature. - ///** - // * If this is true, then stateful interfaces (for the Objects-by-Value - // * proposal) are allowed. This is not yet a standard, so it must - // * explicitly be called for by setting the -stateful argument to the - // * compiler. If -stateful does not appear on the command line, then - // * the IDL will be parsed according to the standards. - // **/ - //public boolean parseStateful = false; - /** - * A list of strings, each of which is a path from which included files - * are found. - **/ - public Vector includePaths = new Vector (); - - /** - * A table of defined symbols. The key is the symbol name; the value - * (if any) is the replacement value for the symbol. - **/ - public Hashtable definedSymbols = new Hashtable (); - - /** - * (f46082.46.01) True if new module entries are created for each - * re-opened module. - **/ - public boolean cppModule = false; - - /** - * -version option. - **/ - public boolean versionRequest = false; // - - // Specify the maximal level of the CORBA spec. the parser - // will support. - // - // NOTE: For BOSS 3.0, specify at 2.2. Raise to greater value in future - // releases. - /** - * -corba [level] option, where [level] is a floating-point number indicating - * the maximal level of CORBA IDL the parser framework can accept. - **/ - public float corbaLevel = 2.2f; - // - /** - * -noWarn option. Suppress warnings when true. - **/ - public boolean noWarn = false; // Issue warnings by default. - - // Currently defined debug flags. Any additions must be called xxxDebugFlag. - // All debug flags must be public boolean types. - // These are set by passing the flag -ORBDebug x,y,z in the ORB init args. - // Note that x,y,z must not contain spaces. - public boolean scannerDebugFlag = false ; - public boolean tokenDebugFlag = false ; - -} // class Arguments --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeEntry.java 2018-01-30 20:24:17.000000000 -0500 +++ /dev/null 2018-01-30 20:24:17.000000000 -0500 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -/** - * This is the symbol table entry for attributes. An attribute is simply - * two methods with no exceptions or contexts: a get method and, if not - * readOnly, a set method. - **/ -public class AttributeEntry extends MethodEntry -{ - protected AttributeEntry () - { - super (); - } // ctor - - protected AttributeEntry (AttributeEntry that) - { - super (that); - _readOnly = that._readOnly; - } // ctor - - protected AttributeEntry (InterfaceEntry that, IDLID clone) - { - super (that, clone); - } // ctor - - public Object clone () - { - return new AttributeEntry (this); - } // clone - - /** Invoke the attribute generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - attributeGen.generate (symbolTable, this, stream); - } // generate - - /** Access the attribute generator. - @return an object which implements the AttributeGen interface. - @see AttributeGen */ - public Generator generator () - { - return attributeGen; - } // generator - - /** if true, only a get method will be generated. */ - public boolean readOnly () - { - return _readOnly; - } // readOnly - - /** if true, only a get method will be generated. */ - public void readOnly (boolean readOnly) - { - _readOnly = readOnly; - } // readOnly - - static AttributeGen attributeGen; - - public boolean _readOnly = false; -} // class AttributeEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeGen.java 2018-01-30 20:24:17.000000000 -0500 +++ /dev/null 2018-01-30 20:24:17.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -public interface AttributeGen extends Generator -{ - void generate (Hashtable symbolTable, AttributeEntry entry, PrintWriter stream); -} // interface AttributeGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Comment.java 2018-01-30 20:24:18.000000000 -0500 +++ /dev/null 2018-01-30 20:24:18.000000000 -0500 @@ -1,208 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.io.IOException; -import java.util.StringTokenizer; - -public class Comment -{ - // Styles - static final int UNKNOWN = -1; - static final int JAVA_DOC = 0; - static final int C_BLOCK = 1; - static final int CPP_LINE = 2; - - // System-dependent line separator - private static String _eol = System.getProperty ("line.separator"); - - private String _text = new String (""); - private int _style = UNKNOWN; - - Comment () {_text = new String (""); _style = UNKNOWN;} // ctor - - Comment (String text) {_text = text; _style = style (_text);} // ctor - - /** Sets comment text */ - public void text (String string) {_text = string; _style = style (_text);} - - /** Returns comment text */ - public String text () {return _text;} - - /** Returns the comment style of a string. */ - private int style (String text) - { - if (text == null) - return UNKNOWN; - else if (text.startsWith ("/**") && text.endsWith ("*/")) - return JAVA_DOC; - else if (text.startsWith ("/*") && text.endsWith ("*/")) - return C_BLOCK; - else if (text.startsWith ("//")) - return CPP_LINE; - else - return UNKNOWN; - } // style - - /** Writes comment text to standard output (debug). */ - public void write () {System.out.println (_text);} - - /** Writes comment text to the specified print stream in the appropriate format. */ - public void generate (String indent, PrintWriter printStream) - { - if (_text == null || printStream == null) - return; - if (indent == null) - indent = new String (""); - switch (_style) - { - case JAVA_DOC: - //printJavaDoc (indent, printStream); - print (indent, printStream); - break; - case C_BLOCK: - //printCBlock (indent, printStream); - print (indent, printStream); - break; - case CPP_LINE: - //printCppLine (indent, printStream); - print (indent, printStream); - break; - default: - break; - } - } // generate - - /** Writes comment to the specified print stream without altering its format. - This routine does not alter vertical or horizontal spacing of comment text, - thus, it only works well for comments with a non-indented first line. */ - private void print (String indent, PrintWriter stream) - { - String text = _text.trim () + _eol; - String line = null; - - int iLineStart = 0; - int iLineEnd = text.indexOf (_eol); - int iTextEnd = text.length () - 1; - - stream.println (); - while (iLineStart < iTextEnd) - { - line = text.substring (iLineStart, iLineEnd); - stream.println (indent + line); - iLineStart = iLineEnd + _eol.length (); - iLineEnd = iLineStart + text.substring (iLineStart).indexOf (_eol); - } - } // print - - /* - * The following routines print formatted comments of differing styles. - * Each routine will alter the horizontal spacing of the comment text, - * but not the vertical spacing. - */ - - /** Writes comment in JavaDoc-style to the specified print stream. */ - private void printJavaDoc (String indent, PrintWriter stream) - { - // Strip surrounding "/**", "*/", and whitespace; append sentinel - String text = _text.substring (3, (_text.length () - 2)).trim () + _eol; - String line = null; - - int iLineStart = 0; - int iLineEnd = text.indexOf (_eol); - int iTextEnd = text.length () - 1; // index of last text character - - stream.println (_eol + indent + "/**"); - while (iLineStart < iTextEnd) - { - line = text.substring (iLineStart, iLineEnd).trim (); - if (line.startsWith ("*")) - // Strip existing "*" prefix - stream.println (indent + " * " + line.substring (1, line.length ()).trim ()); - else - stream.println (indent + " * " + line); - iLineStart = iLineEnd + _eol.length (); - iLineEnd = iLineStart + text.substring (iLineStart).indexOf (_eol); - } - stream.println (indent + " */"); - } // printJavaDoc - - /** Writes comment in c-block-style to the specified print stream. */ - private void printCBlock (String indent, PrintWriter stream) - { - // Strip surrounding "/*", "*/", and whitespace; append sentinel - String text = _text.substring (2, (_text.length () - 2)).trim () + _eol; - String line = null; - - int iLineStart = 0; - int iLineEnd = text.indexOf (_eol); - int iTextEnd = text.length () - 1; // index of last text character - - stream.println (indent + "/*"); - while (iLineStart < iTextEnd) - { - line = text.substring (iLineStart, iLineEnd).trim (); - if (line.startsWith ("*")) - // Strip existing "*[ws]" prefix - stream.println (indent + " * " + line.substring (1, line.length ()).trim ()); - else - stream.println (indent + " * " + line); - iLineStart = iLineEnd + _eol.length (); - iLineEnd = iLineStart + text.substring (iLineStart).indexOf (_eol); - } - stream.println (indent + " */"); - } // printCBlock - - /** Writes a line comment to the specified print stream. */ - private void printCppLine (String indent, PrintWriter stream) - { - stream.println (indent + "//"); - // Strip "//[ws]" prefix - stream.println (indent + "// " + _text.substring (2).trim ()); - stream.println (indent + "//"); - } // printCppLine -} // class Comment - - -/*================================================================================== - DATE ACTION - ---------------------------------------------------------------------------------- - 11aug1997 Initial version completed. - 18aug1997 Modified generate to write comment unformatted. - ==================================================================================*/ --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Compile.java 2018-01-30 20:24:19.000000000 -0500 +++ /dev/null 2018-01-30 20:24:19.000000000 -0500 @@ -1,520 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -D56351 Update computation of RepositoryIDs to CORBA 2.3 (see spec.). -// -D58319 Display version info. for -version option. - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.constExpr.ExprFactory; -import com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory; - -/** - * Compiler usage: - *

- * - * {@code java com.sun.tools.corba.se.idl.toJava.compile [options] } - *

- * - * where <idl file> is the name of a file containing IDL definitions, - * and [options] is any combination of the options listed below. The options - * and the idl file name can appear in any order. - *

- * - * Options: - *

- *
{@code -i } - *
By default, the current directory is scanned for included files. - * This option adds another directory. See also Note 1 below. - * - *
{@code -d } - *
This is equivalent to the following line in an IDL file: {@code #define } - * - *
{@code -emitAll} - *
Emit all types, including those found in #included files. - * - *
{@code -v} - *
Verbose mode. - *
- * - * Note 1: If you have an include path or paths that you will always be using, - * it can get tedious putting these on the command with the -i option all the - * time. Instead, these can be placed into a config file called idl.config. - * This file must be in the CLASSPATH. The format of the includes line is: - * - *
{@code
- * includes=;;...;
- * }
- * - * Note that the path separator character, here shown as a semicolon, is - * machine dependent. For instance, on Windows 95 this character is a - * semicolon, on UNIX it is a colon. - * - *

- * Note 2: If you are directly invoking the main method on this class (not - * a subclass), then it will only check that the IDL file is syntactically - * correct. It does not generate any files. Only extensions to this - * framework generate files, therefore an extension must be invoked if you - * want files to be generated. - *

- * - * To Extend the compiler: - *

- * - * You only need to extend the compiler if you want it to generate something - * other than what it currently generates. - *

- * - * Step 1 - Implement the generator interfaces: - *

- * - * Each generator interface defines one method: generate (Hashtable, XXXEntry, PrintWriter); - *
- * - The Hashtable is the symbol table; each element is a SymtabEntry (or a - * subclass of SymtabEntry) and is keyed by its fully qualified name; - *
- * - XXXEntry is the appropriate entry for the type to be generated. For - * example: AttributeGen defines generate (Hashtable, AttributeEntry, PrintWriter); - * ConstGen defines generate (Hashtable, ConstEntry, PrintWriter); etc. - *
- * - The PrintWriter is a stream to the file being generated. For the - * generators called by the compiler framework, this will be null. The - * generator is responsible for creating and opening files. But for - * generators that are called by other generators - for instance, - * MethodGen.generate will most likely be called by InterfaceGen.generate - - * this parameter is provided so that the proper file can be written to. - *

- * - * Step 2 - Implement the GenFactory interface: - *

- * - * All of the generators implemented in Step 1 must be created somehow. There - * is an interface for a factory, GenFactory, which must be implemented. The - * name of this factory must be set in the extension to the Compile class (see - * Step 3, below). - *

- * - * Step 3 - Extend com.sun.tools.corba.se.idl.Factories: - *

- * - * Extend com.sun.tools.corba.se.idl.Factories and override the method genFactory. This - * method must return an instance of the factory which you implemented in - * step 2. Your extension of this class may also do more, this is only the - * minimum. See com.sun.tools.corba.se.idl.Factories for more information. - *

- * - * Step 4 - Extend com.sun.tools.corba.se.idl.Compile: - *

- * - * Your extension of com.sun.tools.corba.se.idl.Compile should contain a minimum of - * two methods: - *

- *
protected com.sun.tools.corba.se.idl.Factories () - *
This method overrides com.sun.tools.corba.se.idl.Compile.factories and returns your - * extension from Step 3. - * - *
public static void main (String[] args) - *
This main method must instantiate this class and call its start method. - *
- * - * Given that the extension of Factories is MyFactories, the extension of - * Compile could be: - * - *
- * public class MyCompile extends com.sun.tools.corba.se.idl.Compile
- * {
- *   protected com.sun.tools.corba.se.idl.Factories factories ()
- *   {
- *     return new MyFactories ();
- *   }
- *   public static void main (String[] args)
- *   {
- *     MyCompile compile = new MyCompile ();
- *     compile.start (args);
- *   }
- * }
- * 
- * - * If you would like a bit more control over the processing of the framework, - * you can replace compile.start with what it calls. But then you also have - * to handle the exceptions which start handles for you: - *
- * public class MyCompile extends com.sun.tools.corba.se.idl.Compile
- * {
- *   ...
- *
- *   public static void main (String[] args)
- *   {
- *     MyCompile compile = new MyCompile ();
- *     try
- *     {
- *       compile.init (args);
- *       java.util.Enumeration emitList = compile.parse ();
- *       compile.generate ();
- *     }
- *     catch (com.sun.tools.corba.se.idl.InvalidArgument e)
- *     {
- *       System.err.println (e);
- *     }
- *     catch (java.io.IOException e)
- *     {
- *       System.err.println (e);
- *     }
- *   }
- * }
- * 
- * - * Note that compile.parse returns an enumeration. This enumerates the - * SymtabEntry's which should be generated. If the parse method detects - * errors, it returns null. Note that you do not have to check that - * `emitList' is valid before calling generate (that's done internally), but - * if you do any processing between parse and generate, emitList should be - * checked before executing that code. - *

- **/ -public class Compile -{ - public Compile () - { - noPragma.init (preprocessor); - preprocessor.registerPragma (noPragma); - - // Reset static variables to allow parsing multiple sources. - // DO NOT reset SymtabEntry.maxKey because it crashes IDLC. - ParseException.detected = false; - SymtabEntry.includeStack = new java.util.Stack (); - SymtabEntry.setEmit = true; - //SymtabEntry.maxKey = -1; - Parser.repIDStack = new java.util.Stack (); // - } // ctor - - public static void main (String[] args) - { - (new Compile ()).start (args); - } // main - - protected Factories factories () - { - return new Factories (); - } // genFactoryName - - protected void registerPragma (PragmaHandler handler) - { - handler.init (preprocessor); - preprocessor.registerPragma (handler); - } // registerPragma - - /** - * Initialize the framework. - **/ - protected void init (String[] args) throws InvalidArgument - { - initFactories (); - arguments.parseArgs (args); - initGenerators (); - parser = new Parser (preprocessor, arguments, overrideNames, symbolTable, symtabFactory, exprFactory, keywords); - preprocessor.init (parser); - parser.includes = includes; - parser.includeEntries = includeEntries; - } // init - - /** - * Parse the IDL file and return an enumeration of the symbols to be - * generated. All elements of the Enumeration will be extensions of - * SymtabEntry. If any errors were encountered during parsing, null - * will be returned. - **/ - protected Enumeration parse () throws IOException - { - if (arguments.verbose) - System.out.println (Util.getMessage ("Compile.parsing", arguments.file)); - parser.parse (arguments.file); - if ( !ParseException.detected ) - { - parser.forwardEntryCheck(); - - // <46082.03> Revert to "IDL:"-style (i.e., regular) repository ID. - //parser.updateRepositoryIds(); - } - if (arguments.verbose) - System.out.println (Util.getMessage ("Compile.parseDone", arguments.file)); - if (ParseException.detected) - { - symbolTable = null; - emitList = null; - } - else - { - symbolTable = parser.symbolTable; - emitList = parser.emitList.elements (); - } - return emitList; - } // parse - - /** - * Invoke the generators. - **/ - protected void generate () throws IOException - { - /* - // print the symbol table - Enumeration v = parser.symbolTable.elements (); - Enumeration k = parser.symbolTable.keys (); - while (k.hasMoreElements ()) - System.out.println (k.nextElement () + ": " + v.nextElement ()); - */ - if (ParseException.detected) - emitList = null; - else - emitList = parser.emitList.elements (); - if (emitList != null) - { - // Emit the output files for all of the types in the IDL file - if (arguments.verbose) - System.out.println (); - while (emitList.hasMoreElements ()) - { - SymtabEntry entry = (SymtabEntry)emitList.nextElement (); - if (arguments.verbose) - if (entry.generator () instanceof Noop) - ; // Nothing will be generated, so don't say so. - else if (entry.module () . equals ("")) - System.out.println (Util.getMessage ("Compile.generating", entry.name ())); - else - System.out.println (Util.getMessage ("Compile.generating", entry.module () + '/' + entry.name ())); - entry.generate (symbolTable, null); - if (arguments.verbose) - if (entry.generator () instanceof Noop) - ; // Nothing will be generated, so don't say so. - else if (entry.module () . equals ("")) - System.out.println (Util.getMessage ("Compile.genDone", entry.name ())); - else - System.out.println (Util.getMessage ("Compile.genDone", entry.module () + '/' + entry.name ())); - } - } - } // generate - - /** - * Start the parse/code generation process. This method calls init, - * parse, generate. If more control is desired, rather than call start, - * those three methods could be called explicitly. - **/ - public void start (String[] args) - { - try - { - init (args); - if (arguments.versionRequest) // - displayVersion (); - else - { - parse (); - generate (); - } - } - catch (InvalidArgument e) - { - System.err.println (e); - } - catch (IOException e) - { - System.err.println (e); - } - } // start - - private void initFactories () - { - // Get the factories. - Factories factories = factories (); - if (factories == null) factories = new Factories (); - - // Get the argument processor from the factories. - Arguments tmpArgs = factories.arguments (); - if (tmpArgs == null) - arguments = new Arguments (); - else - arguments = tmpArgs; - - // Get the symbol table entry factory from the factories. - SymtabFactory tmpSTF = factories.symtabFactory (); - if (tmpSTF == null) - symtabFactory = new DefaultSymtabFactory (); - else - symtabFactory = tmpSTF; - - // Get the expression factory from the factories. - ExprFactory tmpExpF = factories.exprFactory (); - if (tmpExpF == null) - exprFactory = new DefaultExprFactory (); - else - exprFactory = tmpExpF; - - // Get the generator factory from the factories. - GenFactory tmpGenF = factories.genFactory (); - if (tmpGenF == null) - genFactory = noop; - else - genFactory = tmpGenF; - - // Get the language keywords. - keywords = factories.languageKeywords (); - if (keywords == null) - keywords = new String[0]; - } // initFactories - - private void initGenerators () - { - AttributeGen agen = genFactory.createAttributeGen (); - AttributeEntry.attributeGen = agen == null ? noop : agen; - - ConstGen cgen = genFactory.createConstGen (); - ConstEntry.constGen = cgen == null ? noop : cgen; - - EnumGen egen = genFactory.createEnumGen (); - EnumEntry.enumGen = egen == null ? noop : egen; - - ExceptionGen exgen = genFactory.createExceptionGen (); - ExceptionEntry.exceptionGen = exgen == null ? noop : exgen; - - ForwardGen fgen = genFactory.createForwardGen (); - ForwardEntry.forwardGen = fgen == null ? noop : fgen; - - ForwardValueGen fvgen = genFactory.createForwardValueGen (); - ForwardValueEntry.forwardValueGen = fvgen == null ? noop : fvgen; - - IncludeGen ingen = genFactory.createIncludeGen (); - IncludeEntry.includeGen = ingen == null ? noop : ingen; - - InterfaceGen igen = genFactory.createInterfaceGen (); - InterfaceEntry.interfaceGen = igen == null ? noop : igen; - - ValueGen vgen = genFactory.createValueGen (); - ValueEntry.valueGen = vgen == null ? noop : vgen; - - ValueBoxGen vbgen = genFactory.createValueBoxGen (); - ValueBoxEntry.valueBoxGen = vbgen == null ? noop : vbgen; - - MethodGen mgen = genFactory.createMethodGen (); - MethodEntry.methodGen = mgen == null ? noop : mgen; - - ModuleGen modgen = genFactory.createModuleGen (); - ModuleEntry.moduleGen = modgen == null ? noop : modgen; - - NativeGen ngen = genFactory.createNativeGen (); - NativeEntry.nativeGen = ngen == null ? noop : ngen; - - ParameterGen pgen = genFactory.createParameterGen (); - ParameterEntry.parameterGen = pgen == null ? noop : pgen; - - PragmaGen prgen = genFactory.createPragmaGen (); - PragmaEntry.pragmaGen = prgen == null ? noop : prgen; - - PrimitiveGen primgen = genFactory.createPrimitiveGen (); - PrimitiveEntry.primitiveGen = primgen == null ? noop : primgen; - - SequenceGen seqgen = genFactory.createSequenceGen (); - SequenceEntry.sequenceGen = seqgen == null ? noop : seqgen; - - StringGen strgen = genFactory.createStringGen (); - StringEntry.stringGen = strgen == null ? noop : strgen; - - StructGen sgen = genFactory.createStructGen (); - StructEntry.structGen = sgen == null ? noop : sgen; - - TypedefGen tgen = genFactory.createTypedefGen (); - TypedefEntry.typedefGen = tgen == null ? noop : tgen; - - UnionGen ugen = genFactory.createUnionGen (); - UnionEntry.unionGen = ugen == null ? noop : ugen; - } // initGenerators - - /** - * Write the version number of this compiler to standard out. - **/ - protected void displayVersion () - { - String message = Util.getMessage ("Version.product", Util.getMessage ("Version.number")); - System.out.println (message); - } - - /** - * This is the repository of emitter arguments. - **/ - public Arguments arguments = null; - /** - * This hashtable contains {@code } pairs. It is filled in by - * extenders in cases where they wish to override an IDL type name with - * some other name. For instance, when mapping to Java, there could be - * an overrideNames entry of {@code <"TRUE", "true">}. NOTE: Do NOT change this - * variable to a new Hash table. Just add elements to it. - **/ - protected Hashtable overrideNames = new Hashtable (); - /** - * This is the symbol table. It will be empty until the parse method - * executes. If errors are encountered, the state of the symbol table - * is undefined. - **/ - protected Hashtable symbolTable = new Hashtable (); - /** - * This is a vector of strings of the form {@code "IDLfile"} or {@code }. - * It is a list of the files included in the given IDL file. It will be empty - * until the parse method executes. If errors are encountered, the state - * of this vector is undefined. - **/ - protected Vector includes = new Vector (); - /** - * This is a vector of IncludeEntry's. It is a list of the files included - * in the given IDL file. It mirrors the includes vector. It will be empty - * until the parse method executes. If errors are encountered, the state of - * this vector is undefined. - **/ - protected Vector includeEntries = new Vector (); - static Noop noop = new Noop (); - private GenFactory genFactory = null; - private SymtabFactory symtabFactory = null; - private ExprFactory exprFactory = null; - private Parser parser = null; - Preprocessor preprocessor = new Preprocessor (); - private NoPragma noPragma = new NoPragma (); - private Enumeration emitList = null; - private String[] keywords = null; -} // class Compile --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstEntry.java 2018-01-30 20:24:19.000000000 -0500 +++ /dev/null 2018-01-30 20:24:19.000000000 -0500 @@ -1,112 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.constExpr.Expression; - -/** - * This is the symbol table entry for constants. - **/ -public class ConstEntry extends SymtabEntry -{ - protected ConstEntry () - { - super (); - } // ctor - - protected ConstEntry (ConstEntry that) - { - super (that); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - _value = that._value; - } // ctor - - /** This is a shallow copy constructor. */ - protected ConstEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - /** This is a shallow copy clone. */ - public Object clone () - { - return new ConstEntry (this); - } // clone - - /** Invoke the constant generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - constGen.generate (symbolTable, this, stream); - } // generate - - /** Access the constant generator. - @return an object which implements the ConstGen interface. - @see ConstGen */ - public Generator generator () - { - return constGen; - } // generator - - public Expression value () - { - return _value; - } // value - - public void value (Expression newValue) - { - _value = newValue; - } // value - - static ConstGen constGen; - private Expression _value = null; -} // class ConstEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstGen.java 2018-01-30 20:24:20.000000000 -0500 +++ /dev/null 2018-01-30 20:24:20.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -public interface ConstGen extends Generator -{ - void generate (Hashtable symbolTable, ConstEntry entry, PrintWriter stream); -} // interface ConstGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/DefaultSymtabFactory.java 2018-01-30 20:24:21.000000000 -0500 +++ /dev/null 2018-01-30 20:24:21.000000000 -0500 @@ -1,257 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -/** - * This factory constructs the default symbol table entries, namely, - * those declared within the package com.sun.tools.corba.se.idl. - **/ -public class DefaultSymtabFactory implements SymtabFactory -{ - public AttributeEntry attributeEntry () - { - return new AttributeEntry (); - } // attributeEntry - - public AttributeEntry attributeEntry (InterfaceEntry container, IDLID id) - { - return new AttributeEntry (container, id); - } // attributeEntry - - public ConstEntry constEntry () - { - return new ConstEntry (); - } // constEntry - - public ConstEntry constEntry (SymtabEntry container, IDLID id) - { - return new ConstEntry (container, id); - } // constEntry - - public NativeEntry nativeEntry () - { - return new NativeEntry (); - } // interfaceEntry - - public NativeEntry nativeEntry (SymtabEntry container, IDLID id) - { - return new NativeEntry (container, id); - } // interfaceEntry - - public EnumEntry enumEntry () - { - return new EnumEntry (); - } // enumEntry - - public EnumEntry enumEntry (SymtabEntry container, IDLID id) - { - return new EnumEntry (container, id); - } // enumEntry - - public ExceptionEntry exceptionEntry () - { - return new ExceptionEntry (); - } // exceptionEntry - - public ExceptionEntry exceptionEntry (SymtabEntry container, IDLID id) - { - return new ExceptionEntry (container, id); - } // exceptionEntry - - public ForwardEntry forwardEntry () - { - return new ForwardEntry (); - } // forwardEntry - - public ForwardEntry forwardEntry (ModuleEntry container, IDLID id) - { - return new ForwardEntry (container, id); - } // forwardEntry - - public ForwardValueEntry forwardValueEntry () - { - return new ForwardValueEntry (); - } // forwardValueEntry - - public ForwardValueEntry forwardValueEntry (ModuleEntry container, IDLID id) - { - return new ForwardValueEntry (container, id); - } // forwardValueEntry - - public IncludeEntry includeEntry () - { - return new IncludeEntry (); - } // includeEntry - - public IncludeEntry includeEntry (SymtabEntry container) - { - return new IncludeEntry (container); - } // includeEntry - - public InterfaceEntry interfaceEntry () - { - return new InterfaceEntry (); - } // interfaceEntry - - public InterfaceEntry interfaceEntry (ModuleEntry container, IDLID id) - { - return new InterfaceEntry (container, id); - } // interfaceEntry - - public ValueEntry valueEntry () - { - return new ValueEntry (); - } // valueEntry - - public ValueEntry valueEntry (ModuleEntry container, IDLID id) - { - return new ValueEntry (container, id); - } // valueEntry - - public ValueBoxEntry valueBoxEntry () - { - return new ValueBoxEntry (); - } // valueBoxEntry - - public ValueBoxEntry valueBoxEntry (ModuleEntry container, IDLID id) - { - return new ValueBoxEntry (container, id); - } // valueBoxEntry - - public MethodEntry methodEntry () - { - return new MethodEntry (); - } // methodEntry - - public MethodEntry methodEntry (InterfaceEntry container, IDLID id) - { - return new MethodEntry (container, id); - } // methodEntry - - public ModuleEntry moduleEntry () - { - return new ModuleEntry (); - } // moduleEntry - - public ModuleEntry moduleEntry (ModuleEntry container, IDLID id) - { - return new ModuleEntry (container, id); - } // moduleEntry - - public ParameterEntry parameterEntry () - { - return new ParameterEntry (); - } // parameterEntry - - public ParameterEntry parameterEntry (MethodEntry container, IDLID id) - { - return new ParameterEntry (container, id); - } // parameterEntry - - public PragmaEntry pragmaEntry () - { - return new PragmaEntry (); - } // pragmaEntry - - public PragmaEntry pragmaEntry (SymtabEntry container) - { - return new PragmaEntry (container); - } // pragmaEntry - - public PrimitiveEntry primitiveEntry () - { - return new PrimitiveEntry (); - } // primitiveEntry - - /** "name" can be, but is not limited to, the primitive idl type names: - 'char', 'octet', 'short', 'long', etc. The reason it is not limited - to these is that, as an extender, you may wish to override these names. - For instance, when generating Java code, octet translates to byte, so - there is an entry in Compile.overrideNames: {@code <"octet", "byte">} and a - PrimitiveEntry in the symbol table for "byte". */ - public PrimitiveEntry primitiveEntry (String name) - { - return new PrimitiveEntry (name); - } // primitiveEntry - - public SequenceEntry sequenceEntry () - { - return new SequenceEntry (); - } // sequenceEntry - - public SequenceEntry sequenceEntry (SymtabEntry container, IDLID id) - { - return new SequenceEntry (container, id); - } // sequenceEntry - - public StringEntry stringEntry () - { - return new StringEntry (); - } // stringEntry - - public StructEntry structEntry () - { - return new StructEntry (); - } // structEntry - - public StructEntry structEntry (SymtabEntry container, IDLID id) - { - return new StructEntry (container, id); - } // structEntry - - public TypedefEntry typedefEntry () - { - return new TypedefEntry (); - } // typedefEntry - - public TypedefEntry typedefEntry (SymtabEntry container, IDLID id) - { - return new TypedefEntry (container, id); - } // typedefEntry - - public UnionEntry unionEntry () - { - return new UnionEntry (); - } // unionEntry - - public UnionEntry unionEntry (SymtabEntry container, IDLID id) - { - return new UnionEntry (container, id); - } // unionEntry - -} // interface DefaultSymtabFactory --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumEntry.java 2018-01-30 20:24:21.000000000 -0500 +++ /dev/null 2018-01-30 20:24:21.000000000 -0500 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Vector; - -/** - * This is the symbol table entry for enumerated types. - **/ -public class EnumEntry extends SymtabEntry -{ - protected EnumEntry () - { - super (); - } // ctor - - protected EnumEntry (EnumEntry that) - { - super (that); - _elements = (Vector)that._elements.clone (); - } // ctor - - protected EnumEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - public Object clone () - { - return new EnumEntry (this); - } // clone - - /** Invoke the enumerator generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - enumGen.generate (symbolTable, this, stream); - } // generate - - /** Access the enumerator generator. - @return an object which implements the EnumGen interface. - @see EnumGen */ - public Generator generator () - { - return enumGen; - } // generator - - /** Add an element to the list of elements. */ - public void addElement (String element) - { - _elements.addElement (element); - } // addElement - - /** Each element of the vector is a String. */ - public Vector elements () - { - return _elements; - } // elements - - static EnumGen enumGen; - private Vector _elements = new Vector (); -} // class EnumEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumGen.java 2018-01-30 20:24:22.000000000 -0500 +++ /dev/null 2018-01-30 20:24:22.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface EnumGen extends Generator -{ - void generate (Hashtable symbolTable, EnumEntry entry, PrintWriter stream); -} // interface EnumGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionEntry.java 2018-01-30 20:24:23.000000000 -0500 +++ /dev/null 2018-01-30 20:24:23.000000000 -0500 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -/** - * This is the symbol table entry for exceptions. An exception is simply - * a struct by a different name. - **/ -public class ExceptionEntry extends StructEntry -{ - protected ExceptionEntry () - { - super (); - } // ctor - - protected ExceptionEntry (ExceptionEntry that) - { - super (that); - } // ctor - - protected ExceptionEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - } // ctor - - public Object clone () - { - return new ExceptionEntry (this); - } // clone - - /** Invoke the exception generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - exceptionGen.generate (symbolTable, this, stream); - } // generate - - /** Access the exception generator. - @return an object which implements the ExceptionGen interface. - @see ExceptionGen */ - public Generator generator () - { - return exceptionGen; - } // generator - - static ExceptionGen exceptionGen; -} // class ExceptionEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionGen.java 2018-01-30 20:24:23.000000000 -0500 +++ /dev/null 2018-01-30 20:24:23.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface ExceptionGen extends Generator -{ - void generate (Hashtable symbolTable, ExceptionEntry entry, PrintWriter stream); -} // interface ExceptionGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Factories.java 2018-01-30 20:24:24.000000000 -0500 +++ /dev/null 2018-01-30 20:24:24.000000000 -0500 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -/** - * If the framework is being extended, this class must be extended. - * At very least, the genFactory method must be overridden to return - * the code generator extensions. The remaining methods may be overridden - * if necessary: - *
- *
symtabFactory - *
If you wish to extend the symbol table entries, this method must return the factory which constructs those extensions. If you only want to extend a few of the symbol table entries, it may be useful to extend com.sun.tools.corba.se.idl.DefaultSymtabFactory and only override the pertinent methods. - *
exprFactory - *
If you wish to extend the expression classes, this method must return the factory which constructs those extensions. If you only want to extend a few of the expression classes, it may be useful to extend com.sun.tools.corba.se.idl.constExpr.DefaultSymtabFactory and only override the pertinent methods. - *
arguments - *
If you wish to add additional arguments to the base set of arguments, extend com.sun.tools.corba.se.idl.Arguments and override this method to return that class. - *
languageKeywords - *
If the language you are generating code in has keywords other than IDL keywords, these keywords should be returned by this method. The framework will prepend any IDL identifiers it encounters which are in this list with an underscore (`_') to avoid compilation errors. For instance, `catch' is a Java keyword. If the generators are emitting Java code for the following IDL, emitting `catch' as is will cause compile errors, so it is changed to `_catch': - *
- * IDL: - *
- * const long catch = 22; - *
- * Possible generated code: - *
- * public static final int _catch = 22; - *
- **/ -public class Factories -{ - /** Return the implementation of the GenFactory interface. If this - returns null, then the compiler cannot generate anything. */ - public GenFactory genFactory () - { - return null; - } // genFactory - - /** Return the implementation of the SymtabFactory interface. If this - returns null, the default symbol table entries will be used. */ - public SymtabFactory symtabFactory () - { - return new DefaultSymtabFactory (); - } // symtabFactory - - /** Return the implementation of the ExprFactory interface. If this - returns null, the default expressions will be used. */ - public com.sun.tools.corba.se.idl.constExpr.ExprFactory exprFactory () - { - return new com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory (); - } // exprFactory - - /** Return a subclass of the Arguments class. If this returns null, - the default will be used. */ - public Arguments arguments () - { - return new Arguments (); - } // arguments - - /** Return the list of keywords in the generated language. - Note that these keywords may contain the following wildcards: -
-
`*' -
matches zero or more characters -
`+' -
matches one or more characters -
`.' -
matches any single character -
*/ - public String[] languageKeywords () - { - return null; - } // languageKeywords -} // interface Factories --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardEntry.java 2018-01-30 20:24:25.000000000 -0500 +++ /dev/null 2018-01-30 20:24:25.000000000 -0500 @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -/** - * This is the symbol table entry for forward declarations of interfaces. - **/ -public class ForwardEntry extends SymtabEntry implements InterfaceType -{ - protected ForwardEntry () - { - super (); - } // ctor - - protected ForwardEntry (ForwardEntry that) - { - super (that); - } // ctor - - protected ForwardEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - public Object clone () - { - return new ForwardEntry (this); - } // clone - - /** Invoke the forward declaration generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - forwardGen.generate (symbolTable, this, stream); - } // generate - - /** Access the interface generator. - @return an object which implements the InterfaceGen interface. - @see InterfaceGen */ - public Generator generator () - { - return forwardGen; - } // generator - - static boolean replaceForwardDecl (InterfaceEntry interfaceEntry) - { - boolean result = true; - try - { - ForwardEntry forwardEntry = - (ForwardEntry)Parser.symbolTable.get (interfaceEntry.fullName ()); - if ( forwardEntry != null ) - { - result = (interfaceEntry.getInterfaceType () == - forwardEntry.getInterfaceType ()); - forwardEntry.type (interfaceEntry); - - // If this interface has been forward declared, there are probably - // other interfaces which derive from a ForwardEntry. Replace - // those ForwardEntry's with this InterfaceEntry: - interfaceEntry.forwardedDerivers = forwardEntry.derivers; - for ( Enumeration derivers = forwardEntry.derivers.elements(); - derivers.hasMoreElements(); ) - ((InterfaceEntry)derivers.nextElement ()).replaceForwardDecl (forwardEntry, interfaceEntry); - - // Replace the entry's whose types are forward declarations: - for ( Enumeration types = forwardEntry.types.elements (); - types.hasMoreElements (); ) - ((SymtabEntry)types.nextElement ()).type (interfaceEntry); - } - } - catch (Exception exception) - {} - return result; - } // replaceForwardDecl - - /////////////// - // Implement interface InterfaceType - - public int getInterfaceType () - { - return _type; - } - - public void setInterfaceType (int type) - { - _type = type; - } - - static ForwardGen forwardGen; - Vector derivers = new Vector (); // Vector of InterfaceEntry's. - Vector types = new Vector (); // Vector of the entry's whose type is a forward declaration. - private int _type = InterfaceType.NORMAL; // interface type -} // class ForwardEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardGen.java 2018-01-30 20:24:25.000000000 -0500 +++ /dev/null 2018-01-30 20:24:25.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface ForwardGen extends Generator -{ - void generate (Hashtable symbolTable, ForwardEntry entry, PrintWriter stream); -} // interface ForwardGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueEntry.java 2018-01-30 20:24:26.000000000 -0500 +++ /dev/null 2018-01-30 20:24:26.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -/** - * This is the symbol table entry for forward declarations of values. - **/ -public class ForwardValueEntry extends ForwardEntry -{ - protected ForwardValueEntry () - { - super (); - } // ctor - - protected ForwardValueEntry (ForwardValueEntry that) - { - super (that); - } // ctor - - protected ForwardValueEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - } // ctor - - public Object clone () - { - return new ForwardValueEntry (this); - } // clone - - /** Invoke the forward value declaration generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - forwardValueGen.generate (symbolTable, this, stream); - } // generate - - /** Access the interface generator. - @return an object which implements the ForwardValueGen interface. - @see ValueGen */ - public Generator generator () - { - return forwardValueGen; - } // generator - - static ForwardValueGen forwardValueGen; -} // class ForwardValueEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueGen.java 2018-01-30 20:24:27.000000000 -0500 +++ /dev/null 2018-01-30 20:24:27.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface ForwardValueGen extends Generator -{ - void generate (Hashtable symbolTable, ForwardValueEntry entry, PrintWriter stream); -} // interface ForwardValueGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFactory.java 2018-01-30 20:24:27.000000000 -0500 +++ /dev/null 2018-01-30 20:24:27.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -/** - * To extend this compiler framework to generate something other than - * the default, this factory interface must be implemented and the name - * of it must be set in the main method (see idl.Compile). - *

- * The implementation of each method should be quite simple. Take - * createAttributeGen, for instance. If the interface AttributeGen is - * implemented by a class called MyAttributeGen, then createAttributeGen - * will be the following: - *

- * public AttributeGen createAttributeGen ()
- * {
- *   return new MyAttributeGen ();
- * }
- * 
- *

- * If it is desired that a generator do nothing, it is not necessary to - * implement one which does nothing; you may simply write that particular - * create method so that it returns null. - *

- * Note that this class MUST have a public default constructor (one which - * takes no parameters). - **/ -public interface GenFactory -{ - public AttributeGen createAttributeGen (); - public ConstGen createConstGen (); - public EnumGen createEnumGen (); - public ExceptionGen createExceptionGen (); - public ForwardGen createForwardGen (); - public ForwardValueGen createForwardValueGen (); - public IncludeGen createIncludeGen (); - public InterfaceGen createInterfaceGen (); - public ValueGen createValueGen (); - public ValueBoxGen createValueBoxGen (); - public MethodGen createMethodGen (); - public ModuleGen createModuleGen (); - public NativeGen createNativeGen (); - public ParameterGen createParameterGen (); - public PragmaGen createPragmaGen (); - public PrimitiveGen createPrimitiveGen (); - public SequenceGen createSequenceGen (); - public StringGen createStringGen (); - public StructGen createStructGen (); - public TypedefGen createTypedefGen (); - public UnionGen createUnionGen (); -} // interface GenFactory --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFileStream.java 2018-01-30 20:24:28.000000000 -0500 +++ /dev/null 2018-01-30 20:24:28.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.CharArrayWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.PrintWriter; - -public class GenFileStream extends PrintWriter -{ - public GenFileStream (String filename) - { - // What I really want to do here is: - // super (byteStream = new ByteArrayOutputStream ()); - // but that isn't legal. The super constructor MUST - // be called before any instance variables are used. - // This implementation gets around that problem. - // - //super (tmpByteStream = new ByteArrayOutputStream ()); - //byteStream = tmpByteStream; - super (tmpCharArrayWriter = new CharArrayWriter()); - charArrayWriter = tmpCharArrayWriter; - name = filename; - } // ctor - - public void close () - { - File file = new File (name); - try - { - if (checkError ()) - throw new IOException (); - // - //FileOutputStream fileStream = new FileOutputStream (file); - //fileStream.write (byteStream.toByteArray ()); - //fileStream.close (); - FileWriter fileWriter = new FileWriter (file); - fileWriter.write (charArrayWriter.toCharArray ()); - fileWriter.close (); - } - catch (IOException e) - { - String[] parameters = {name, e.toString ()}; - System.err.println (Util.getMessage ("GenFileStream.1", parameters)); - } - super.close (); - } // close - - public String name () - { - return name; - } // name - - // - //private ByteArrayOutputStream byteStream; - //private static ByteArrayOutputStream tmpByteStream; - private CharArrayWriter charArrayWriter; - private static CharArrayWriter tmpCharArrayWriter; - private String name; -} // GenFileStream --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Generator.java 2018-01-30 20:24:29.000000000 -0500 +++ /dev/null 2018-01-30 20:24:29.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -public interface Generator -{ -} // interface Generator --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IDLID.java 2018-01-30 20:24:29.000000000 -0500 +++ /dev/null 2018-01-30 20:24:29.000000000 -0500 @@ -1,134 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -public class IDLID extends RepositoryID -{ - public IDLID () - { - _prefix = ""; - _name = ""; - _version = "1.0"; - } // ctor - - public IDLID (String prefix, String name, String version) - { - _prefix = prefix; - _name = name; - _version = version; - } // ctor - - public String ID () - { - if (_prefix.equals ("")) - return "IDL:" + _name + ':' + _version; - else - return "IDL:" + _prefix + '/' + _name + ':' + _version; - } // ID - - public String prefix () - { - return _prefix; - } // prefix - - void prefix (String prefix) - { - if (prefix == null) - _prefix = ""; - else - _prefix = prefix; - } // prefix - - public String name () - { - return _name; - } // name - - void name (String name) - { - if (name == null) - _name = ""; - else - _name = name; - } // name - - public String version () - { - return _version; - } // version - - void version (String version) - { - if (version == null) - _version = ""; - else - _version = version; - } // version - - void appendToName (String name) - { - if (name != null) - if (_name.equals ("")) - _name = name; - else - _name = _name + '/' + name; - } // appendToName - - void replaceName (String name) - { - if (name == null) - _name = ""; - else - { - int index = _name.lastIndexOf ('/'); - if (index < 0) - _name = name; - else - _name = _name.substring (0, index + 1) + name; - } - } // replaceName - - public Object clone () - { - return new IDLID (_prefix, _name, _version); - } // clone - - private String _prefix; - private String _name; - private String _version; -} // class IDLID --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeEntry.java 2018-01-30 20:24:30.000000000 -0500 +++ /dev/null 2018-01-30 20:24:30.000000000 -0500 @@ -1,125 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Vector; - -/** - * This is the symbol table entry for the #include statement. - **/ -public class IncludeEntry extends SymtabEntry -{ - protected IncludeEntry () - { - super (); - repositoryID (Util.emptyID); - } // ctor - - protected IncludeEntry (SymtabEntry that) - { - super (that, new IDLID ()); - module (that.name ()); - name (""); - } // ctor - - protected IncludeEntry (IncludeEntry that) - { - super (that); - } // ctor - - public Object clone () - { - return new IncludeEntry (this); - } // clone - - /** Invoke the Include type generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - includeGen.generate (symbolTable, this, stream); - } // generate - - /** Access the Include type generator. - @return an object which implements the IncludeGen interface. - @see IncludeGen */ - public Generator generator () - { - return includeGen; - } // generator - - //d44810 - /** Set the fully-qualified file specification of this include file. */ - public void absFilename (String afn) - { - _absFilename = afn; - } - - //d44810 - /** Access the fully-qualified file specification of this include. - @return a string containing the path of the include file. */ - public String absFilename () - { - return _absFilename; - } - - /** Add an IncludeEntry to the list of files which this included - file includes. */ - public void addInclude (IncludeEntry entry) - { - includeList.addElement (entry); - } // addInclude - - /** Get the list of files which this file includes. */ - public Vector includes () - { - return includeList; - } // includes - - static IncludeGen includeGen; - /** List of files this file includes */ - private Vector includeList = new Vector (); - //d44810 - /** Absolute file name for .u file generation. */ - private String _absFilename = null; -} // class IncludeEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeGen.java 2018-01-30 20:24:31.000000000 -0500 +++ /dev/null 2018-01-30 20:24:31.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface IncludeGen extends Generator -{ - void generate (Hashtable symbolTable, IncludeEntry entry, PrintWriter stream); -} // interface IncludeGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceEntry.java 2018-01-30 20:24:31.000000000 -0500 +++ /dev/null 2018-01-30 20:24:31.000000000 -0500 @@ -1,355 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -/** - * This is the symbol table entry for interfaces. - **/ -public class InterfaceEntry extends SymtabEntry implements InterfaceType -{ - - protected InterfaceEntry () - { - super (); - } // ctor - - protected InterfaceEntry (InterfaceEntry that) - { - super (that); - _derivedFromNames = (Vector)that._derivedFromNames.clone (); - _derivedFrom = (Vector)that._derivedFrom.clone (); - _methods = (Vector)that._methods.clone (); - _allMethods = (Vector)that._allMethods.clone (); - forwardedDerivers = (Vector)that.forwardedDerivers.clone (); - _contained = (Vector)that._contained.clone (); - _interfaceType = that._interfaceType; - } // ctor - - protected InterfaceEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - public boolean isAbstract() - { - return _interfaceType == ABSTRACT ; - } - - public boolean isLocal() - { - return _interfaceType == LOCAL ; - } - - public boolean isLocalServant() - { - return _interfaceType == LOCALSERVANT ; - } - - public boolean isLocalSignature() - { - return _interfaceType == LOCAL_SIGNATURE_ONLY ; - } - - public Object clone () - { - return new InterfaceEntry (this); - } // clone - - /** Invoke the interface generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - interfaceGen.generate (symbolTable, this, stream); - } // generate - - /** Access the interface generator. - @return an object which implements the InterfaceGen interface. - @see InterfaceGen */ - public Generator generator () - { - return interfaceGen; - } // generator - - /** Add an InterfaceEntry to the list of interfaces which this interface - is derivedFrom. During parsing, the parameter to this method COULD - be a ForwardEntry, but when parsing is complete, calling derivedFrom - will return a vector which only contains InterfaceEntry's. */ - public void addDerivedFrom (SymtabEntry derivedFrom) - { - _derivedFrom.addElement (derivedFrom); - } // addDerivedFrom - - /** This method returns a vector of InterfaceEntry's. */ - public Vector derivedFrom () - { - return _derivedFrom; - } // derivedFrom - - /** Add to the list of derivedFrom names. */ - public void addDerivedFromName (String name) - { - _derivedFromNames.addElement (name); - } // addDerivedFromName - - /** This method returns a vector of Strings, each of which is a fully - qualified name of an interface. This vector corresponds to the - derivedFrom vector. The first element of this vector is the name - of the first element of the derivedFrom vector, etc. */ - public Vector derivedFromNames () - { - return _derivedFromNames; - } // derivedFromNames - - /** Add a method/attribute to the list of methods. */ - public void addMethod (MethodEntry method) - { - _methods.addElement (method); - } // addMethod - - /** This is a vector of MethodEntry's. These are the methods and - attributes contained within this Interface. */ - public Vector methods () - { - return _methods; - } // methods - - /** Add a symbol table entry to this interface's contained vector. */ - public void addContained (SymtabEntry entry) - { - _contained.addElement (entry); - } // addContained - - /** This is a vector of SymtabEntry's. Valid entries in this vector are: - AttributeEntry, ConstEntry, EnumEntry, ExceptionEntry, MethodEntry, - StructEntry, NativeEntry, TypedefEntry, UnionEntry. - Note that the methods vector is a subset of this vector. */ - public Vector contained () - { - return _contained; - } // contained - - void methodsAddElement (MethodEntry method, Scanner scanner) - { - if (verifyMethod (method, scanner, false)) - { - addMethod (method); - _allMethods.addElement (method); - - // Add this method to the 'allMethods' list of any interfaces - // which may have inherited this one when it was a forward - // reference. - addToForwardedAllMethods (method, scanner); - } - } // methodsAddElement - - void addToForwardedAllMethods (MethodEntry method, Scanner scanner) - { - Enumeration e = forwardedDerivers.elements (); - while (e.hasMoreElements ()) - { - InterfaceEntry derived = (InterfaceEntry)e.nextElement (); - if (derived.verifyMethod (method, scanner, true)) - derived._allMethods.addElement (method); - } - } // addToForwardedAllMethods - - // Make sure a method by this name doesn't exist in this class or - // in this class's parents - private boolean verifyMethod (MethodEntry method, Scanner scanner, boolean clash) - { - boolean unique = true; - String lcName = method.name ().toLowerCase (); - Enumeration e = _allMethods.elements (); - while (e.hasMoreElements ()) - { - MethodEntry emethod = (MethodEntry)e.nextElement (); - - // Make sure the method doesn't exist either in its - // original name or in all lower case. In IDL, identifiers - // which differ only in case are collisions. - String lceName = emethod.name ().toLowerCase (); - if (method != emethod && lcName.equals (lceName)) - { - if (clash) - ParseException.methodClash (scanner, fullName (), method.name ()); - else - ParseException.alreadyDeclared (scanner, method.name ()); - unique = false; - break; - } - } - return unique; - } // verifyMethod - - void derivedFromAddElement (SymtabEntry e, Scanner scanner) - { - addDerivedFrom (e); - addDerivedFromName (e.fullName ()); - addParentType( e, scanner ); - } // derivedFromAddElement - - void addParentType (SymtabEntry e, Scanner scanner) - { - if (e instanceof ForwardEntry) - addToDerivers ((ForwardEntry)e); - else - { // e instanceof InterfaceEntry - InterfaceEntry derivedFrom = (InterfaceEntry)e; - - // Compare all of the parent's methods to the methods on this - // interface, looking for name clashes: - for ( Enumeration enumeration = derivedFrom._allMethods.elements (); - enumeration.hasMoreElements (); ) - { - MethodEntry method = (MethodEntry)enumeration.nextElement (); - if ( verifyMethod (method, scanner, true)) - _allMethods.addElement (method); - - // Add this method to the 'allMethods' list of any interfaces - // which may have inherited this one when it was a forward - // reference: - addToForwardedAllMethods (method, scanner); - } - - // If any of the parent's parents are forward entries, make - // sure this interface gets added to their derivers list so - // that when the forward entry is defined, the 'allMethods' - // list of this interface can be updated. - lookForForwardEntrys (scanner, derivedFrom); - } - } // addParentType - - private void lookForForwardEntrys (Scanner scanner, InterfaceEntry entry) - { - Enumeration parents = entry.derivedFrom ().elements (); - while (parents.hasMoreElements ()) - { - SymtabEntry parent = (SymtabEntry)parents.nextElement (); - if (parent instanceof ForwardEntry) - addToDerivers ((ForwardEntry)parent); - else if (parent == entry) - ParseException.selfInherit (scanner, entry.fullName ()); - else // it must be an InterfaceEntry - lookForForwardEntrys (scanner, (InterfaceEntry)parent); - } - } // lookForForwardEntrys - - public boolean replaceForwardDecl (ForwardEntry oldEntry, InterfaceEntry newEntry) - { - int index = _derivedFrom.indexOf( oldEntry ); - if ( index >= 0 ) - _derivedFrom.setElementAt( newEntry, index ); - return (index >= 0); - } // replaceForwardDecl - - private void addToDerivers (ForwardEntry forward) - { - // Add this interface to the derivers list on the forward entry - // so that when the forward entry is defined, the 'allMethods' - // list of this interface can be updated. - forward.derivers.addElement (this); - Enumeration e = forwardedDerivers.elements (); - while (e.hasMoreElements ()) - forward.derivers.addElement ((InterfaceEntry)e.nextElement ()); - } // addToDerivers - - /** This method returns a vector of the elements in the state block. - If it is null, this is not a stateful interface. If it is non-null, - but of zero length, then it is still stateful; it has no state - entries itself, but it has an ancestor which does. */ - public Vector state () - { - return _state; - } // state - - public void initState () - { - _state = new Vector (); - } // initState - - public void addStateElement (InterfaceState state, Scanner scanner) - { - if (_state == null) - _state = new Vector (); - String name = state.entry.name (); - for (Enumeration e = _state.elements (); e.hasMoreElements ();) - if (name.equals (((InterfaceState) e.nextElement ()).entry.name ())) - ParseException.duplicateState (scanner, name); - _state.addElement (state); - } // state - - public int getInterfaceType () - { - return _interfaceType; - } - - public void setInterfaceType (int type) - { - _interfaceType = type; - } - - /** Get the allMethods vector. */ - public Vector allMethods () - { - return _allMethods; - } - - private Vector _derivedFromNames = new Vector(); - private Vector _derivedFrom = new Vector(); - private Vector _methods = new Vector(); - Vector _allMethods = new Vector(); - Vector forwardedDerivers = new Vector(); - private Vector _contained = new Vector(); - private Vector _state = null; - private int _interfaceType = NORMAL; - - static InterfaceGen interfaceGen; -} // class InterfaceEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceGen.java 2018-01-30 20:24:32.000000000 -0500 +++ /dev/null 2018-01-30 20:24:32.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface InterfaceGen extends Generator -{ - void generate (Hashtable symbolTable, InterfaceEntry entry, PrintWriter stream); -} // interface InterfaceGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceState.java 2018-01-30 20:24:33.000000000 -0500 +++ /dev/null 2018-01-30 20:24:33.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -/** - * This class is only used within an InterfaceEntry. If the interface - * is stateful, then its state vector will contain one or more of these - * InterfaceStates. - **/ -public class InterfaceState -{ - public static final int Private = 0, - Protected = 1, - Public = 2; - - public InterfaceState (int m, TypedefEntry e) - { - modifier = m; - entry = e; - if (modifier < Private || modifier > Public) - modifier = Public; - } // ctor - - public int modifier = Public; - public TypedefEntry entry = null; -} // class InterfaceState --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceType.java 2018-01-30 20:24:33.000000000 -0500 +++ /dev/null 2018-01-30 20:24:33.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface InterfaceType -{ - public static final int NORMAL = 0 ; - public static final int ABSTRACT = 1 ; - - // LOCAL generates code according to the Local interfaces - // Here helper and holder classes are the only ones generated - public static final int LOCAL = 2 ; - - // intermediate solution to enable people to extend ServantLocatorPOA - // and ServantActivatorPOA for interoperability. This is until the - // POA is declared Local officially by OMG - public static final int LOCALSERVANT = 3 ; - - // generate only signature interfaces, no helper/holders are generated - public static final int LOCAL_SIGNATURE_ONLY = 4 ; - - public int getInterfaceType (); - - public void setInterfaceType( int type ) ; -} // interface InterfaceType --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidArgument.java 2018-01-30 20:24:34.000000000 -0500 +++ /dev/null 2018-01-30 20:24:34.000000000 -0500 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -/** - * An invalid argument for the compiler has been encountered. - **/ -public class InvalidArgument extends Exception -{ - /** @param arg the invalid argument. */ - public InvalidArgument (String arg) - { - message = Util.getMessage ("InvalidArgument.1", arg) + "\n\n" + Util.getMessage ("usage"); - } // ctor - - public InvalidArgument () - { - message = Util.getMessage ("InvalidArgument.2") + "\n\n" + Util.getMessage ("usage"); - } // ctor - - public String getMessage () - { - return message; - } // getMessage - - private String message = null; -} // class InvalidArgument --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidCharacter.java 2018-01-30 20:24:35.000000000 -0500 +++ /dev/null 2018-01-30 20:24:35.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -D62023 Cast char to byte for JDK 1.2 compatability. - -import java.io.IOException; - -public class InvalidCharacter extends IOException -{ - public InvalidCharacter (String filename, String line, int lineNumber, int pos, char ch) - { - String pointer = "^"; - if (pos > 1) - { - byte[] bytes = new byte [pos - 1]; - for (int i = 0; i < pos - 1; ++i) - bytes[i] = (byte)' '; // - pointer = new String (bytes) + pointer; - } - String[] parameters = {filename, Integer.toString (lineNumber), "" + ch, Integer.toString ((int)ch), line, pointer}; - message = Util.getMessage ("InvalidCharacter.1", parameters); - } - - public String getMessage () - { - return message; - } // getMessage - - private String message = null; -} // class InvalidCharacter --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodEntry.java 2018-01-30 20:24:35.000000000 -0500 +++ /dev/null 2018-01-30 20:24:35.000000000 -0500 @@ -1,197 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// - What does oneway mean? - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -/** - * This is the symbol table entry for methods. - **/ -public class MethodEntry extends SymtabEntry -{ - protected MethodEntry () - { - super (); - } // ctor - - protected MethodEntry (MethodEntry that) - { - super (that); - _exceptionNames = (Vector)that._exceptionNames.clone (); - _exceptions = (Vector)that._exceptions.clone (); - _contexts = (Vector)that._contexts.clone (); - _parameters = (Vector)that._parameters.clone (); - _oneway = that._oneway; - } // ctor - - protected MethodEntry (InterfaceEntry that, IDLID clone) - { - super (that, clone); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - public Object clone () - { - return new MethodEntry (this); - } // clone - - /** Invoke the method generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - methodGen.generate (symbolTable, this, stream); - } // generate - - /** Access the method generator. - @return an object which implements the MethodGen interface. - @see MethodGen */ - public Generator generator () - { - return methodGen; - } // generator - - public void type (SymtabEntry newType) - { - super.type (newType); - if (newType == null) - typeName ("void"); - } // type - - /** Add an exception to the exception list. */ - public void addException (ExceptionEntry exception) - { - _exceptions.addElement (exception); - } // addException - - /** This a a vector of the exceptions which this method raises. */ - public Vector exceptions () - { - return _exceptions; - } // exceptions - - /** Add an exception name to the list of exception names. */ - public void addExceptionName (String name) - { - _exceptionNames.addElement (name); - } // addExceptionName - - /** This is a vector of strings, each of which is the full name of an - exception which this method throws. This vector corresponds to the - exceptions vector. The first element of this vector is the name - of the first element of the exceptions vector, etc. */ - public Vector exceptionNames () - { - return _exceptionNames; - } // exceptionNames - - /* Add a context to the context list. */ - public void addContext (String context) - { - _contexts.addElement (context); - } // addContext - - /** This is a vector of strings, each of which is the name of a context. */ - public Vector contexts () - { - return _contexts; - } // contexts - - /** Add a parameter to the parameter list. */ - public void addParameter (ParameterEntry parameter) - { - _parameters.addElement (parameter); - } // addParameter - - /** This is a vector of ParameterEntry's. They are the parameters on - this method and their order in the vector is the order they appear - on the method. */ - public Vector parameters () - { - return _parameters; - } // parameters - - /** Is this a oneway method? */ - public void oneway (boolean yes) - { - _oneway = yes; - } // oneway - - /** Is this a oneway method? */ - public boolean oneway () - { - return _oneway; - } // oneway - - /** Is this a value method? */ - public void valueMethod (boolean yes) - { - _valueMethod = yes; - } // valueMethod - - /** Is this a value method? */ - public boolean valueMethod () - { - return _valueMethod; - } // valueMethod - - void exceptionsAddElement (ExceptionEntry e) - { - addException (e); - addExceptionName (e.fullName ()); - } // exceptionsAddElement - - private Vector _exceptionNames = new Vector (); - private Vector _exceptions = new Vector (); - private Vector _contexts = new Vector (); - private Vector _parameters = new Vector (); - private boolean _oneway = false; - private boolean _valueMethod = false; - - static MethodGen methodGen; -} // class MethodEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodGen.java 2018-01-30 20:24:36.000000000 -0500 +++ /dev/null 2018-01-30 20:24:36.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface MethodGen extends Generator -{ - void generate (Hashtable symbolTable, MethodEntry entry, PrintWriter stream); -} // interface MethodGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleEntry.java 2018-01-30 20:24:37.000000000 -0500 +++ /dev/null 2018-01-30 20:24:37.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Vector; - -/** - * This is the symbol table entry for modules. - **/ -public class ModuleEntry extends SymtabEntry -{ - protected ModuleEntry () - { - super (); - } // ctor - - protected ModuleEntry (ModuleEntry that) - { - super (that); - _contained = (Vector)that._contained.clone (); - } // ctor - - protected ModuleEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - public Object clone () - { - return new ModuleEntry (this); - } // clone - - /** Invoke the module generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - moduleGen.generate (symbolTable, this, stream); - } // generate - - /** Access the module generator. - @return an object which implements the ModuleGen interface. - @see ModuleGen */ - public Generator generator () - { - return moduleGen; - } // generator - - /** alid entries in this vector are: TypedefEntry, ExceptionEntry, - StructEntry, UnionEntry, EnumEntry, ConstEntry, InterfaceEntry, - ModuleEntry. */ - public void addContained (SymtabEntry entry) - { - _contained.addElement (entry); - } // addContained - - /** This is a vector of SymtabEntry's. Valid entries in this vector are: - TypedefEntry, ExceptionEntry, StructEntry, UnionEntry, EnumEntry, - ConstEntry, InterfaceEntry, ModuleEntry. */ - public Vector contained () - { - return _contained; - } // contained - - private Vector _contained = new Vector (); - - static ModuleGen moduleGen; -} // class ModuleEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleGen.java 2018-01-30 20:24:37.000000000 -0500 +++ /dev/null 2018-01-30 20:24:37.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface ModuleGen extends Generator -{ - void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream); -} // interface ModuleGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeEntry.java 2018-01-30 20:24:38.000000000 -0500 +++ /dev/null 2018-01-30 20:24:38.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -/** - * This is the symbol table entry for constants. - **/ -public class NativeEntry extends SymtabEntry -{ - protected NativeEntry () - { - super (); - repositoryID (Util.emptyID); - } // ctor - - protected NativeEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - protected NativeEntry (NativeEntry that) - { - super (that); - } // ctor - - /** This is a shallow copy clone. */ - public Object clone () - { - return new NativeEntry (this); - } // clone - - /** Invoke the constant generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - nativeGen.generate(symbolTable, this, stream); - } // generate - - /** Access the constant generator. - @return an object which implements the ConstGen interface. - @see ConstGen */ - public Generator generator () - { - return nativeGen; - } // generator - - static NativeGen nativeGen; -} // class NativeEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeGen.java 2018-01-30 20:24:39.000000000 -0500 +++ /dev/null 2018-01-30 20:24:39.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -public interface NativeGen extends Generator -{ - void generate (Hashtable symbolTable, NativeEntry entry, PrintWriter stream); -} // interface NativeGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NoPragma.java 2018-01-30 20:24:39.000000000 -0500 +++ /dev/null 2018-01-30 20:24:39.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.IOException; - -class NoPragma extends PragmaHandler -{ - public boolean process (String pragma, String currentToken) throws IOException - { - parseException (Util.getMessage ("Preprocessor.unknownPragma", pragma)); - skipToEOL (); - return true; - } // process -} // class NoPragma --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Noop.java 2018-01-30 20:24:40.000000000 -0500 +++ /dev/null 2018-01-30 20:24:40.000000000 -0500 @@ -1,241 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.constExpr.ExprFactory; - -public class Noop implements - AttributeGen, ConstGen, EnumGen, ExceptionGen, ForwardGen, - ForwardValueGen, IncludeGen, InterfaceGen, ValueGen, ValueBoxGen, - MethodGen, ModuleGen, NativeGen, ParameterGen, PragmaGen, - PrimitiveGen, SequenceGen, StringGen, StructGen, TypedefGen, - UnionGen, GenFactory -{ - public void generate (Hashtable symbolTable, AttributeEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, ConstEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, EnumEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, ExceptionEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, ForwardEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, ForwardValueEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, IncludeEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, InterfaceEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, ValueEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, ValueBoxEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, MethodEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, ParameterEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, PragmaEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, PrimitiveEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, SequenceEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, StringEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, StructEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, TypedefEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, UnionEntry entry, PrintWriter stream) - { - } // generate - - public void generate (Hashtable symbolTable, NativeEntry entry, PrintWriter stream) - { - } // generate - - // For GenFactory - public AttributeGen createAttributeGen () - { - return null; - } // createAttributeGen - - public ConstGen createConstGen () - { - return null; - } // createConstGen - - public EnumGen createEnumGen () - { - return null; - } // createEnumGen - - public ExceptionGen createExceptionGen () - { - return null; - } // createExceptionGen - - public ForwardGen createForwardGen () - { - return null; - } // createForwardGen - - public ForwardValueGen createForwardValueGen () - { - return null; - } // createForwardValueGen - - public IncludeGen createIncludeGen () - { - return null; - } // createIncludeGen - - public InterfaceGen createInterfaceGen () - { - return null; - } // createInterfaceGen - - public ValueGen createValueGen () - { - return null; - } // createValueGen - - public ValueBoxGen createValueBoxGen () - { - return null; - } // createValueBoxGen - - public MethodGen createMethodGen () - { - return null; - } // createMethodGen - - public ModuleGen createModuleGen () - { - return null; - } // createModuleGen - - public NativeGen createNativeGen () - { - return null; - } // createNativeGen - - public ParameterGen createParameterGen () - { - return null; - } // createParameterGen - - public PragmaGen createPragmaGen () - { - return null; - } // createPragmaGen - - public PrimitiveGen createPrimitiveGen () - { - return null; - } // createPrimitiveGen - - public SequenceGen createSequenceGen () - { - return null; - } // createSequenceGen - - public StringGen createStringGen () - { - return null; - } // createStringGen - - public StructGen createStructGen () - { - return null; - } // createStructGen - - public TypedefGen createTypedefGen () - { - return null; - } // createTypedefGen - - public UnionGen createUnionGen () - { - return null; - } // createUnionGen -} // class Noop --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterEntry.java 2018-01-30 20:24:41.000000000 -0500 +++ /dev/null 2018-01-30 20:24:41.000000000 -0500 @@ -1,114 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -/** - * This is the symbol table entry for parameters. - **/ -public class ParameterEntry extends SymtabEntry -{ - /** This is a set of class constants. A parameter can be passed - as one of In, Out, or Inout. */ - public static final int In = 0, - Inout = 1, - Out = 2; - - protected ParameterEntry () - { - super (); - } // ctor - - protected ParameterEntry (ParameterEntry that) - { - super (that); - _passType = that._passType; - } // ctor - - protected ParameterEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - public Object clone () - { - return new ParameterEntry (this); - } // clone - - /** Invoke the paramter generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - parameterGen.generate (symbolTable, this, stream); - } // generate - - /** Access the parameter generator. - @return an object which implements the ParameterGen interface. - @see ParameterGen */ - public Generator generator () - { - return parameterGen; - } // generator - - /** This indicates the pass type of this parameter. */ - public void passType (int passType) - { - if (passType >= In && passType <= Out) - _passType = passType; - } // passType - - /** This indicates the pass type of this parameter. */ - public int passType () - { - return _passType; - } // passType - - private int _passType = In; - - static ParameterGen parameterGen; -} // class ParameterEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterGen.java 2018-01-30 20:24:41.000000000 -0500 +++ /dev/null 2018-01-30 20:24:41.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface ParameterGen extends Generator -{ - void generate (Hashtable symbolTable, ParameterEntry entry, PrintWriter stream); -} // interface ParameterGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParseException.java 2018-01-30 20:24:42.000000000 -0500 +++ /dev/null 2018-01-30 20:24:42.000000000 -0500 @@ -1,456 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -D56351 Update Prefix pragma directive to CORBA 2.3 (see spec.). -// -D57110 Update ID pragma directive to CORBA 2.3 (see spec.). -// -D46094 Prohibit exceptions from appearing wihtin structs, unions, exceptions. -// -D46094 Prohibit attributes from appearing as operation parameter types, -// operation return types, attribute types. -// -D59166 Prohibit identifiers form colliding with IDL keywords. -// -F60858.1 Add keyword collision warning. -// -F60942 Prohibit operations from appearing as operation parameter types. -// -D62023 Add deprecated keyword warning; cast char to byte for JDK 1.2 compatability. - -import java.io.IOException; - -/** - * - **/ -class ParseException extends Exception -{ - /** - * Constructor: print the supplied message to Standard.err - * and create a new ParseException - * @return a new ParseException. - **/ - ParseException (String message) - { - super (message); - System.err.println (message); - detected = true; - } // ctor - - /** - * Constructor: print the supplied message to Standard.err, if it - * is not a warning, and create a new ParseException. - * @return a new ParseException. - **/ - ParseException (String message, boolean onlyAWarning) - { - super (message); - System.err.println (message); - if (!onlyAWarning) - detected = true; - } - - static ParseException abstractValueBox (Scanner scanner) - { - return arg0 ("abstractValueBox", scanner); - } - - static ParseException alreadyDeclared (Scanner scanner, String type) - { - return arg1 ("alreadyDeclared", scanner, type); - } - - static ParseException declNotInSameFile( Scanner scanner, String type, - String firstFile ) - { - return arg2 ("declNotInSameFile", scanner, type, firstFile) ; - } - - static ParseException alreadyDefaulted (Scanner scanner) - { - return arg0 ("alreadydefaulted", scanner); - } - - static ParseException alreadyDerived (Scanner scanner, String derived, String iface) - { - return arg2 ("alreadyDerived", scanner, derived, iface); - } - - static ParseException alreadyRaised (Scanner scanner, String exception) - { - return arg1 ("alreadyRaised", scanner, exception); - } - - // - static ParseException attributeNotType (Scanner scanner, String attr) - { - return arg1 ("attributeNotType", scanner, attr); - } - - static ParseException badAbstract (Scanner scanner, String name) - { - return arg1 ("badAbstract", scanner, name); - } - - static ParseException badCustom (Scanner scanner) - { - return arg0 ("badCustom", scanner); - } - - // - static ParseException badRepIDAlreadyAssigned (Scanner scanner, String entry) - { - return arg1 ("badRepIDAlreadyAssigned", scanner, entry); - } - - // - static ParseException badRepIDForm (Scanner scanner, String entry) - { - return arg1 ("badRepIDForm", scanner, entry); - } - - // - static ParseException badRepIDPrefix (Scanner scanner, String entry, String expected, String got) - { - return arg3 ("badRepIDPrefix", scanner, entry, expected, got); - } - - static ParseException badState (Scanner scanner, String entry) - { - return arg1 ("badState", scanner, entry); - } - - static ParseException branchLabel (Scanner scanner, String label) - { - return arg1 ("branchLabel", scanner, label); - } - - static ParseException branchName (Scanner scanner, String name) - { - return arg1 ("branchName", scanner, name); - } - - static ParseException duplicateInit (Scanner scanner) - { - return arg0 ("duplicateInit", scanner); - } - - static ParseException duplicateState (Scanner scanner, String name) - { - return arg1 ("duplicateState", scanner, name); - } - - static ParseException elseNoIf (Scanner scanner) - { - return arg0 ("elseNoIf", scanner); - } - - static ParseException endNoIf (Scanner scanner) - { - return arg0 ("endNoIf", scanner); - } - - static ParseException evaluationError (Scanner scanner, String problem) - { - return arg1 ("evaluation", scanner, problem); - } - - static ParseException forwardEntry (Scanner scanner, String name) - { - return arg1 ("forwardEntry", scanner, name); - } - - // Cannot forward value boxes. - static ParseException forwardedValueBox (Scanner scanner, String name) - { - return arg1 ("forwardedValueBox", scanner, name); - } - - static ParseException generic (Scanner scanner, String message) - { - return arg1 ("generic", scanner, message); - } - - static ParseException illegalArray (Scanner scanner, String name) - { - return arg1 ("illegalArray", scanner, name); - } - - static ParseException illegalException (Scanner scanner, String name) - { - return arg1 ("illegalException", scanner, name); - } - - static ParseException invalidConst (Scanner scanner, String mustBe, String is) - { - return arg2 ("invalidConst1", scanner, mustBe, is); - } - - static ParseException invalidConst (Scanner scanner, String type) - { - return arg1 ("invalidConst2", scanner, type); - } - - // Non-escaped identifiers that collide with keywords are illegal. - static ParseException keywordCollision (Scanner scanner, String id) - { - return arg1 ("keywordCollision", scanner, id); - } - - // Warning for keywords that will be removed in a future version of IDL. - static ParseException deprecatedKeywordWarning (Scanner scanner, String id) - { - return arg1Warning ("deprecatedKeywordWarning", scanner, id); - } - - // Warning for above error. - static ParseException keywordCollisionWarning (Scanner scanner, String id) - { - return arg1Warning ("keywordCollisionWarning", scanner, id); - } - - static ParseException methodClash (Scanner scanner, String interf, String method) - { - return arg2 ("methodClash", scanner, interf, method); - } - - static ParseException moduleNotType (Scanner scanner, String module) - { - return arg1 ("moduleNotType", scanner, module); - } - - // - static ParseException nestedValueBox (Scanner scanner) - { - return arg0 ("nestedValueBox", scanner); - } - - static ParseException noDefault (Scanner scanner) - { - return arg0 ("noDefault", scanner); - } - - static ParseException nonAbstractParent (Scanner scanner, String baseClass, String parentClass) - { - return arg2 ("nonAbstractParent", scanner, baseClass, parentClass); - } - - static ParseException nonAbstractParent2 (Scanner scanner, String baseClass, String parentClass) - { - return arg2 ("nonAbstractParent2", scanner, baseClass, parentClass); - } - - static ParseException nonAbstractParent3 (Scanner scanner, String baseClass, String parentClass) - { - return arg2 ("nonAbstractParent3", scanner, baseClass, parentClass); - } - - static ParseException notANumber (Scanner scanner, String notNumber) - { - return arg1 ("notANumber", scanner, notNumber); - } - - static ParseException nothing (String filename) - { - return new ParseException (Util.getMessage ("ParseException.nothing", filename)); - } - - static ParseException notPositiveInt (Scanner scanner, String notPosInt) - { - return arg1 ("notPosInt", scanner, notPosInt); - } - - static ParseException oneway (Scanner scanner, String method) - { - return arg1 ("oneway", scanner, method); - } - - // - static ParseException operationNotType (Scanner scanner, String op) - { - return arg1 ("operationNotType", scanner, op); - } - - static ParseException outOfRange (Scanner scanner, String value, String type) - { - return arg2 ("outOfRange", scanner, value, type); - } - - static ParseException recursive (Scanner scanner, String type, String name) - { - return arg2 ("recursive", scanner, type, name); - } - - static ParseException selfInherit (Scanner scanner, String name) - { - return arg1 ("selfInherit", scanner, name); - } - - static ParseException stringTooLong (Scanner scanner, String str, String max) - { - return arg2 ("stringTooLong", scanner, str, max); - } - - static ParseException syntaxError (Scanner scanner, int expected, int got) - { - return arg2 ("syntax1", scanner, Token.toString (expected), Token.toString (got)); - } - - static ParseException syntaxError (Scanner scanner, String expected, String got) - { - return arg2 ("syntax1", scanner, expected, got); - } - - static ParseException syntaxError (Scanner scanner, int[] expected, int got) - { - return syntaxError (scanner, expected, Token.toString (got)); - } - - static ParseException syntaxError (Scanner scanner, int[] expected, String got) - { - String tokenList = ""; - for (int i = 0; i < expected.length; ++i) - tokenList += " `" + Token.toString (expected[i]) + "'"; - return arg2 ("syntax2", scanner, tokenList, got); - } - - static ParseException unclosedComment (String filename) - { - return new ParseException (Util.getMessage ("ParseException.unclosed", filename)); - } - - static ParseException undeclaredType (Scanner scanner, String undeclaredType) - { - return arg1 ("undeclaredType", scanner, undeclaredType); - } - - static ParseException warning (Scanner scanner, String message) - { - scannerInfo (scanner); - String[] parameters = { filename, Integer.toString (lineNumber), message, line, pointer }; - return new ParseException (Util.getMessage ("ParseException.warning", parameters), true); - } - - static ParseException wrongType (Scanner scanner, String name, String mustBe, String is) - { - scannerInfo (scanner); - String[] parameters = {filename, Integer.toString (lineNumber), name, is, mustBe, line, pointer}; - return new ParseException (Util.getMessage ("ParseException.wrongType", parameters)); - } - - static ParseException wrongExprType (Scanner scanner, String mustBe, String is) - { - scannerInfo (scanner); - String[] parameters = {filename, Integer.toString (lineNumber), - is, mustBe, line, pointer}; - return new ParseException (Util.getMessage ("ParseException.constExprType", - parameters)); - } - - static ParseException illegalForwardInheritance( Scanner scanner, String declName, - String baseName ) - { - scannerInfo( scanner ) ; - String[] parameters = { filename, Integer.toString(lineNumber), - declName, baseName, line, pointer } ; - return new ParseException (Util.getMessage( - "ParseException.forwardInheritance", parameters ) ) ; - } - - static ParseException illegalIncompleteTypeReference( Scanner scanner, - String declName ) - { - scannerInfo( scanner ) ; - String[] parameters = { filename, Integer.toString(lineNumber), - declName, line, pointer } ; - return new ParseException (Util.getMessage( - "ParseException.illegalIncompleteTypeReference", parameters ) ) ; - } - - private static void scannerInfo (Scanner scanner) - { - filename = scanner.filename (); - line = scanner.lastTokenLine (); - lineNumber = scanner.lastTokenLineNumber (); - int pos = scanner.lastTokenLinePosition (); - pointer = "^"; - if (pos > 1) - { - byte[] bytes = new byte[ pos - 1 ]; - for (int i = 0; i < pos - 1; ++i) - bytes[i] = (byte)' '; // - pointer = new String (bytes) + pointer; - } - } - - private static ParseException arg0 (String msgId, Scanner scanner) - { - scannerInfo (scanner); - String[] parameters = {filename, Integer.toString (lineNumber), line, pointer}; - return new ParseException (Util.getMessage ("ParseException." + msgId, parameters)); - } - - private static ParseException arg1 (String msgId, Scanner scanner, String arg1) - { - scannerInfo (scanner); - String[] parameters = {filename, Integer.toString (lineNumber), arg1, line, pointer}; - return new ParseException (Util.getMessage ("ParseException." + msgId, parameters)); - } - - // - private static ParseException arg1Warning (String msgId, Scanner scanner, String arg1) - { - scannerInfo (scanner); - String[] parameters = {filename, Integer.toString (lineNumber), arg1, line, pointer}; - return new ParseException (Util.getMessage ("ParseException." + msgId, parameters), true); - } - - private static ParseException arg2 (String msgId, Scanner scanner, String arg1, String arg2) - { - scannerInfo (scanner); - String[] parameters = {filename, Integer.toString (lineNumber), arg1, arg2, line, pointer}; - return new ParseException (Util.getMessage ("ParseException." + msgId, parameters)); - } - - private static ParseException arg3 (String msgId, Scanner scanner, String arg1, String arg2, String arg3) - { - scannerInfo (scanner); - String[] parameters = {filename, Integer.toString (lineNumber), arg1, arg2, arg3, line, pointer}; - return new ParseException (Util.getMessage ("ParseException." + msgId, parameters)); - } - - private static String filename = ""; - private static String line = ""; - private static int lineNumber = 0; - private static String pointer = "^"; - - static boolean detected = false; -} // class ParseException --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Parser.java 2018-01-30 20:24:43.000000000 -0500 +++ /dev/null 2018-01-30 20:24:43.000000000 -0500 @@ -1,3905 +0,0 @@ -/* - * Copyright (c) 1999, 2009, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -F46082.51 Remove -stateful feature. -// -D52042 Allow floating-point constants to be initialized with -// integral as well as floating-point literals. No other variations allowed. -// -D58058 Set index array type to long rather than array element type. -// -D56351 Update computation of RepositoryIDs to CORBA 2.3 (see spec.). -// -D57110 Provide method() to set/clear ability for scoped names to -// resolve to modules. Allows rep. ids to be assigned to modules. -// -D46094 Prohibit exceptions from appearing wihtin structs, unions, exceptions. -// -D46094 Prohibit attributes from appearing as operation parameter types, -// operation return types, attribute types. -// -D59067 Prohibit nested value boxes. -// -D59166 Prohibit collisions between keywords and non-escaped identifiers. -// -D59809 At Pigeonhole(), add map short name of CORBA types to long name -// (e.g., CORBA/StringValue --> org/omg/CORBA/StringValue), which allows fully- -// qualified CORBA type names to resolve successfully. -// -F60858.1 Support "-corba" option, level <= 2.2: issue warning for -// keyowrd collisions; -// -D60942 Prohibit operations from appearing within parameter types. -// -D61643 Repair pigeonhole() to correctly filter bad RepIDs. -// -D62023 Support -noWarn option; Issue warnings when tokens are -// deprecated keywords or keywords in greater release version. -// -D61919 Emit entries for modules originally opened in #include files -// appearing at global scope and then reopened in the main IDL file. Only -// types appearing in the main IDL source will be emitted. - -import java.io.EOFException; -import java.io.IOException; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Stack; -import java.util.Vector; -import java.util.List ; -import java.util.ArrayList ; -import java.util.Iterator ; - -import java.math.BigInteger; - -import com.sun.tools.corba.se.idl.constExpr.*; - -/** - * - **/ -class Parser -{ - /** - * - **/ - Parser (Preprocessor preprocessor, Arguments arguments, Hashtable overrides, - Hashtable symtab, SymtabFactory stFac, ExprFactory exprFac, String [] genKeywords) - { - this.arguments = arguments; - noWarn = arguments.noWarn; // - corbaLevel = arguments.corbaLevel; // - paths = arguments.includePaths; - symbols = arguments.definedSymbols; - verbose = arguments.verbose; - emitAll = arguments.emitAll; - // - cppModule = arguments.cppModule; - // Remove -stateful feature. - //parseStateful = arguments.parseStateful; - overrideNames = (overrides == null) ? new Hashtable () : overrides; - symbolTable = (symtab == null) ? new Hashtable () : symtab; - keywords = (genKeywords == null) ? new String [0] : genKeywords; - stFactory = stFac; - exprFactory = exprFac; - currentModule = topLevelModule = new ModuleEntry (); - prep = preprocessor; - repIDStack.push (new IDLID ()); - addPrimEntries (); - } // ctor - - /** - * - **/ - void parse (String file) throws IOException - { - IncludeEntry fileEntry = stFactory.includeEntry (); - fileEntry.name ('"' + file + '"'); - try - { - // Set absolute file path - fileEntry.absFilename (Util.getAbsolutePath (file, paths)); - } - catch (IOException ioe) - {} - - // Remove -stateful feature. - //scanner = new Scanner (fileEntry, keywords, verbose, parseStateful, emitAll); - // Support "-corba [level]" option. - //scanner = new Scanner (fileEntry, keywords, verbose, emitAll); - scanner = new Scanner (fileEntry, keywords, verbose, emitAll, corbaLevel, - arguments.scannerDebugFlag ); - topLevelModule.sourceFile (fileEntry); - - // Prime the pump... - // Match handles preprocessor directives, so use match to - // call scanner.getToken just in case the first token is - // such a directive. But match depends on the token - // already having a value, so fudge something. - token = new Token (0); - tokenHistory.insert (token); // Initialize look back buffer <26jul1997daz>. - try - { - match (0); - if (token.equals (Token.EOF)) - ParseException.nothing (file); - else - specification (topLevelModule); - } - catch (ParseException exception) // Match MIGHT throw this - { - // It has already been reported, just end. - } - catch (EOFException exception) // skipToSemicolon MIGHT throw this - { - // It has already been reported, just end. - } - } // parse - - /** - * - **/ - private void addPrimEntries () - { - symbolTable.put ("short", stFactory.primitiveEntry ("short")); - symbolTable.put ("long", stFactory.primitiveEntry ("long")); - symbolTable.put ("long long", stFactory.primitiveEntry ("long long")); - symbolTable.put ("unsigned short", stFactory.primitiveEntry ("unsigned short")); - symbolTable.put ("unsigned long", stFactory.primitiveEntry ("unsigned long")); - symbolTable.put ("unsigned long long", stFactory.primitiveEntry ("unsigned long long")); - symbolTable.put ("char", stFactory.primitiveEntry ("char")); - symbolTable.put ("wchar", stFactory.primitiveEntry ("wchar")); - symbolTable.put ("float", stFactory.primitiveEntry ("float")); - //Support fixed type: symbolTable.put ("fixed", stFactory.primitiveEntry ("fixed")); - symbolTable.put ("double", stFactory.primitiveEntry ("double")); - symbolTable.put ("boolean", stFactory.primitiveEntry ("boolean")); - symbolTable.put ("octet", stFactory.primitiveEntry ("octet")); - symbolTable.put ("any", stFactory.primitiveEntry ("any")); - - InterfaceEntry object = stFactory.interfaceEntry(); - object.name ("Object"); - symbolTable.put ("Object", object); - - ValueEntry valueBase = stFactory.valueEntry(); - valueBase.name ("ValueBase"); - symbolTable.put ("ValueBase", valueBase); - - // put these same entries in the lowercase symbol table - lcSymbolTable.put ("short", stFactory.primitiveEntry ("short")); - lcSymbolTable.put ("long", stFactory.primitiveEntry ("long")); - lcSymbolTable.put ("long long", stFactory.primitiveEntry ("long long")); - lcSymbolTable.put ("unsigned short", stFactory.primitiveEntry ("unsigned short")); - lcSymbolTable.put ("unsigned long", stFactory.primitiveEntry ("unsigned long")); - lcSymbolTable.put ("unsigned long long", stFactory.primitiveEntry ("unsigned long long")); - lcSymbolTable.put ("char", stFactory.primitiveEntry ("char")); - lcSymbolTable.put ("wchar", stFactory.primitiveEntry ("wchar")); - lcSymbolTable.put ("float", stFactory.primitiveEntry ("float")); - // Support fixed type: lcSymbolTable.put ("fixed", stFactory.primitiveEntry ("fixed")); - lcSymbolTable.put ("double", stFactory.primitiveEntry ("double")); - lcSymbolTable.put ("boolean", stFactory.primitiveEntry ("boolean")); - lcSymbolTable.put ("octet", stFactory.primitiveEntry ("octet")); - lcSymbolTable.put ("any", stFactory.primitiveEntry ("any")); - lcSymbolTable.put ("object", object); - lcSymbolTable.put ("valuebase", valueBase); - } // addPrimEntries - - /** - * - **/ - private void specification (ModuleEntry entry) throws IOException - { - while (!token.equals (Token.EOF)) - { - definition (entry); - addToEmitList (entry); - } - } // specification - - // ModuleEntry is the topLevelModule; add its contained types to the emit list. - /** - * - **/ - private void addToEmitList (ModuleEntry entry) - { - for (Enumeration e = entry.contained ().elements (); e.hasMoreElements();) - { - SymtabEntry emitEntry = (SymtabEntry)e.nextElement (); - if (emitEntry.emit ()) - { - emitList.addElement (emitEntry); - - // I think the absence of the following statement was an - // oversight. If module X.Y.Z first appears in an include file, then is - // reopened in the main IDL source, this statement guarantees that X.Y.Z - // definitions within the main IDL source are emitted. - ///--------------------------------------------------------------------- - // If any of this module's elements should be emitted, add - // this module to the emit list. - if (emitEntry instanceof ModuleEntry) - checkContained ((ModuleEntry)emitEntry); - if (emitEntry instanceof IncludeEntry) - { - includes.addElement (emitEntry.name ()); - includeEntries.addElement (emitEntry); - } - } - else - // If any of this module's elements should be emitted, add - // this module to the emit list. - if (emitEntry instanceof ModuleEntry) - checkContained ((ModuleEntry)emitEntry); - } - entry.contained ().removeAllElements (); - } // addToEmitList - - /** - * - **/ - private void checkContained (ModuleEntry entry) - { - // If any of this module's elements is to be emitted, - // then add the module to the emit list. - for (Enumeration e = entry.contained ().elements (); e.hasMoreElements ();) - { - SymtabEntry contained = (SymtabEntry)e.nextElement (); - if (contained instanceof ModuleEntry) - checkContained ((ModuleEntry)contained); - if (contained.emit ()) - { - if (!emitList.contains (entry)) - emitList.addElement (entry); - entry.emit (true); - break; - } - } - } // checkContained - - /** - * - **/ - private void definition (ModuleEntry entry) throws IOException - { - try - { - switch (token.type) - { - case Token.Typedef: - case Token.Struct: - case Token.Union: - case Token.Enum: - typeDcl (entry); - break; - case Token.Const: - constDcl (entry); - break; - case Token.Native: - nativeDcl (entry); - break; - case Token.Exception: - exceptDcl (entry); - break; - case Token.Interface: - interfaceProd (entry, InterfaceEntry.NORMAL); - break; - case Token.Local: - match( Token.Local ) ; - if (token.type == Token.Interface) - interfaceProd( entry, InterfaceEntry.LOCAL ) ; - else - throw ParseException.syntaxError( scanner, new int[] { - Token.Interface }, token.type ) ; - break ; - case Token.Module: - module (entry); - break; - case Token.Abstract: - match (Token.Abstract); - if (token.type == Token.Interface) - interfaceProd (entry, InterfaceEntry.ABSTRACT); - else if (token.type == Token.Valuetype) - valueProd (entry, true); - else - throw ParseException.syntaxError (scanner, new int[] { - Token.Interface, Token.Valuetype }, token.type); - break; - case Token.Custom: - case Token.Valuetype: - valueProd (entry, false); - break; - default: - throw ParseException.syntaxError (scanner, new int[] { - Token.Typedef, Token.Struct, Token.Union, Token.Enum, - Token.Const, Token.Exception, Token.Interface, Token.Valuetype, - Token.Module }, token.type); - } - match (Token.Semicolon); - } - catch (ParseException e) - { - skipToSemicolon (); - } - } // definition - - /** - * - **/ - private void module (ModuleEntry entry) throws IOException, ParseException - { - match (Token.Module); - repIDStack.push (((IDLID)repIDStack.peek ()).clone ()); - ModuleEntry newEntry = newModule (entry); - ((IDLID)repIDStack.peek ()).appendToName (newEntry.name ()); - // comment must immediately precede "module" keyword - newEntry.comment (tokenHistory.lookBack (1).comment); - currentModule = newEntry; - match (Token.Identifier); - prep.openScope (newEntry); - match (Token.LeftBrace); - definition (newEntry); - while (!token.equals (Token.EOF) && !token.equals (Token.RightBrace)) - definition (newEntry); - prep.closeScope (newEntry); - match (Token.RightBrace); - currentModule = entry; - repIDStack.pop (); - } // module - - /** - * - **/ - private void interfaceProd (ModuleEntry entry, int interfaceType) - throws IOException, ParseException - { - match (Token.Interface); - String name = token.name; - match (Token.Identifier); - interface2 (entry, name, interfaceType); - } // interfaceProd - - /** - * - **/ - private void interface2 (ModuleEntry module, String name, int interfaceType) - throws IOException, ParseException - { - if (token.type == Token.Colon || token.type == Token.LeftBrace) { - repIDStack.push (((IDLID)repIDStack.peek ()).clone ()); - InterfaceEntry entry = stFactory.interfaceEntry (module, - (IDLID)repIDStack.peek ()); - entry.sourceFile (scanner.fileEntry ()); - entry.name (name); - entry.setInterfaceType(interfaceType); - // Comment must immediately precede "[local | abstract] interface" keyword - entry.comment (tokenHistory.lookBack ( - entry.getInterfaceType() == InterfaceEntry.NORMAL ? 2 : 3).comment); - - if (!ForwardEntry.replaceForwardDecl (entry)) - ParseException.badAbstract (scanner, entry.fullName ()); - pigeonhole (module, entry); - ((IDLID)repIDStack.peek ()).appendToName (name); - currentModule = entry; - interfaceDcl (entry); - currentModule = module; - repIDStack.pop (); - } else { // This is a forward declaration - ForwardEntry entry = stFactory.forwardEntry (module, (IDLID)repIDStack.peek ()); - entry.sourceFile (scanner.fileEntry ()); - entry.name (name); - entry.setInterfaceType(interfaceType); - // comment must immediately precede "interface" keyword. - entry.comment (tokenHistory.lookBack ( - entry.getInterfaceType() == InterfaceEntry.NORMAL ? 2 : 3).comment); - pigeonhole (module, entry); - } - } // interface2 - - /** - * - **/ - private void interfaceDcl (InterfaceEntry entry) throws IOException, ParseException - { - if (token.type != Token.LeftBrace) - inheritanceSpec (entry); - else if (!entry.isAbstract ()) { - SymtabEntry objectEntry = qualifiedEntry ("Object"); - SymtabEntry realOEntry = typeOf (objectEntry); - if (objectEntry == null) - ; // qualifiedEntry already generated an error message - else if (!isInterface(realOEntry)) - ParseException.wrongType (scanner, overrideName ("Object"), - "interface", objectEntry.typeName ()); - else - entry.derivedFromAddElement (realOEntry, scanner); - } - - prep.openScope (entry); - match (Token.LeftBrace); - while (token.type != Token.RightBrace) - export (entry); - prep.closeScope (entry); - match (Token.RightBrace); - } // interfaceDcl - - /** - * - **/ - private void export (InterfaceEntry entry) throws IOException - { - try - { - switch (token.type) - { - case Token.Typedef: - case Token.Struct: - case Token.Union: - case Token.Enum: - typeDcl (entry); - break; - case Token.Const: - constDcl (entry); - break; - case Token.Native: - nativeDcl (entry); - break; - case Token.Exception: - exceptDcl (entry); - break; - case Token.Readonly: - case Token.Attribute: - attrDcl (entry); - break; - case Token.Oneway: - case Token.Float: - case Token.Double: - case Token.Long: - case Token.Short: - case Token.Unsigned: - case Token.Char: - case Token.Wchar: - case Token.Boolean: - case Token.Octet: - case Token.Any: - case Token.String: - case Token.Wstring: - case Token.Identifier: - case Token.Object: - // Value base type. - case Token.ValueBase: - case Token.DoubleColon: - case Token.Void: - opDcl (entry); - break; - // Remove -stateful feature. - //case Token.State: if (parseStateful) { - // stateDef (entry); - // break; } - default: - throw ParseException.syntaxError(scanner, new int [] { - Token.Typedef, Token.Struct, Token.Union, Token.Enum, - Token.Const, Token.Exception, Token.Readonly, Token.Attribute, - Token.Oneway, Token.Float, Token.Double, Token.Long, - Token.Short, Token.Unsigned, Token.Char, Token.Wchar, - Token.Boolean, Token.Octet, Token.Any, Token.String, - Token.Wstring, Token.Identifier, Token.DoubleColon, Token.Void, - Token.ValueBase }, token.type); - } - match (Token.Semicolon); - } - catch (ParseException exception) - { - skipToSemicolon (); - } - } // export - - private void inheritanceSpec (InterfaceEntry entry) throws IOException, ParseException - { - for (match (Token.Colon); ; match (Token.Comma)) { - SymtabEntry parent = scopedName (entry.container (), - stFactory.interfaceEntry ()); - SymtabEntry realParent = typeOf (parent); - - if (isInterfaceOnly (realParent)) { - boolean isInterface = (realParent instanceof InterfaceEntry); - if (entry.derivedFrom ().contains (realParent)) - ParseException.alreadyDerived (scanner, realParent.fullName (), entry.fullName ()); - else if (!entry.isAbstract () || - (((InterfaceType)realParent).getInterfaceType() == InterfaceType.ABSTRACT)) - entry.derivedFromAddElement (realParent, scanner); - else - ParseException.nonAbstractParent (scanner, entry.fullName (), parent.fullName ()); - } else if (isForward( realParent )) { - ParseException.illegalForwardInheritance( scanner, - entry.fullName(), parent.fullName() ) ; - } else - ParseException.wrongType (scanner, parent.fullName (), "interface", entryName (parent)); - - if ((parent instanceof InterfaceEntry) && (((InterfaceEntry)parent).state () != null)) - if (entry.state () == null) - entry.initState (); - else - throw ParseException.badState (scanner, entry.fullName ()); - - if (token.type != Token.Comma) - break; - } - } // inheritanceSpec - - // <57110> Member _moduleIsLegalType may be set by any feature to allow - // method scopedName() and any of its helper methods -- qualifiedName(), - // partlyQualifiedName(), and unqualifiedName() -- to return a ModuleEntry - // rather than a parse error in the event a name resolves to a module. The - // flag must be cleared (set to false) to resume normal parsing behavior. - // - // Currently, this is used only when preprocessing the ID pragma directive. - - private boolean _isModuleLegalType = false; - - /** - * - **/ - public boolean isModuleLegalType () - { - return _isModuleLegalType; - }; // moduleIsLegaType - - /** - * - **/ - public void isModuleLegalType (boolean b) - { - _isModuleLegalType = b; - }; // moduleIsLegalType - - /** - * - **/ - SymtabEntry scopedName (SymtabEntry container, - SymtabEntry expected) throws IOException, ParseException - { - return scopedName( container, expected, true ) ; - } - - SymtabEntry scopedName (SymtabEntry container, SymtabEntry expected, - boolean mustBeReferencable ) throws IOException, ParseException - { - boolean globalScope = false; - boolean partialScope = false; - String name = null; - if (token.type == Token.DoubleColon) - globalScope = true; - else - { - if (token.type == Token.Object) - { - name = "Object"; - match (Token.Object); - } - else if (token.type == Token.ValueBase) // - { - name = "ValueBase"; - match (Token.ValueBase); - } - else - { - name = token.name; - match (Token.Identifier); - } - } - while (token.type == Token.DoubleColon) - { - match (Token.DoubleColon); - partialScope = true; - if (name != null) - name += '/' + token.name; - else name = token.name; - match (Token.Identifier); - } - SymtabEntry entry = null; - if (globalScope) - entry = qualifiedEntry (name); - else if (partialScope) - entry = partlyQualifiedEntry (name, container); - else - entry = unqualifiedEntry (name, container); - - if (entry == null) - // Make the entry the expected entry. The generators will - // not be called now, since a semantic exception ocurred, but - // the parse has to finish and something valid has to be - // returned. - (entry = expected).name (name); - else if (!entry.isReferencable() && mustBeReferencable) - throw ParseException.illegalIncompleteTypeReference( scanner, name ) ; - - return entry; - } // scopedName - - private void valueProd (ModuleEntry entry, boolean isAbstract) throws IOException, ParseException - { - boolean isCustom = (token.type == Token.Custom); - if (isCustom) - match (Token.Custom); - match (Token.Valuetype); - String name = token.name; - match (Token.Identifier); - - switch (token.type) - { - case Token.LeftBrace: - case Token.Colon: - case Token.Supports: - value2 (entry, name, isAbstract, isCustom); - return; - case Token.Semicolon: - if (isCustom) - break; - valueForwardDcl (entry, name, isAbstract); - return; - } - if (isCustom) - throw ParseException.badCustom (scanner); - if (isAbstract) - throw ParseException.abstractValueBox (scanner); - valueBox (entry, name); - } // valueProd - - /** - * - **/ - private void value2 (ModuleEntry module, String name, boolean isAbstract, - boolean isCustom) throws IOException, ParseException - { - repIDStack.push (((IDLID)repIDStack.peek ()).clone ()); - // The 'actual' repository ID will be calculated at the end of the - // parsing phase, since it is based on the entire contents of the - // declaration, and needs to have all forward references resolved: - ValueEntry entry = stFactory.valueEntry (module, (IDLID)repIDStack.peek ()); - entry.sourceFile (scanner.fileEntry ()); - entry.name (name); - entry.setInterfaceType (isAbstract ? InterfaceType.ABSTRACT : InterfaceType.NORMAL); - entry.setCustom (isCustom); - // Comment must immediately precede "[abstract | custom] value" keyword - entry.comment (tokenHistory.lookBack ((isAbstract || isCustom) ? 3 : 2).comment); - // If this value has been forward declared, there are probably - // other values which derive from a ForwardValueEntry. Replace - // those ForwardValueEntry's with this ValueEntry: - if (!ForwardEntry.replaceForwardDecl (entry)) - ParseException.badAbstract (scanner, entry.fullName ()); - pigeonhole (module, entry); - ((IDLID)repIDStack.peek ()).appendToName (name); - currentModule = entry; - valueDcl (entry); - entry.tagMethods (); - currentModule = module; - repIDStack.pop (); - } // value2 - - /** - * - **/ - private void valueDcl (ValueEntry entry) throws IOException, ParseException - { - if (token.type == Token.Colon) - valueInheritanceSpec (entry); - else if (!entry.isAbstract ()) - { - SymtabEntry objectEntry = qualifiedEntry ("ValueBase"); - SymtabEntry realOEntry = typeOf (objectEntry); - if (objectEntry == null) - ; // qualifiedEntry already generated an error message - else if (!isValue (realOEntry)) - ParseException.wrongType (scanner, overrideName ("ValueBase"), "value", objectEntry.typeName ()); - else - entry.derivedFromAddElement (realOEntry, false, scanner); - } - if (token.type == Token.Supports) - valueSupportsSpec (entry); - prep.openScope (entry); - match (Token.LeftBrace); - while (token.type != Token.RightBrace) - { - valueElement (entry); - } - prep.closeScope (entry); - match (Token.RightBrace); - } // valueDcl - - /** - * - **/ - private void valueInheritanceSpec (ValueEntry entry) throws IOException, ParseException - { - match (Token.Colon); - boolean isTruncatable = (token.type == Token.Truncatable); - if (isTruncatable) - match (Token.Truncatable); - for (; ; match (Token.Comma), isTruncatable = false) { - SymtabEntry parent = scopedName (entry.container (), - stFactory.valueEntry ()); - SymtabEntry realParent = typeOf (parent); - if (isValue (realParent) && !(realParent instanceof ValueBoxEntry)) - entry.derivedFromAddElement (realParent, isTruncatable, - scanner); - else if (isForward(realParent)) - ParseException.illegalForwardInheritance( scanner, - entry.fullName(), parent.fullName() ) ; - else - ParseException.wrongType (scanner, - parent.fullName (), "value", entryName (parent)); - if (token.type != Token.Comma) - break; - } - } // valueInheritanceSpec - - /** - * - **/ - private void valueSupportsSpec (ValueEntry entry) throws IOException, ParseException - { - match (Token.Supports) ; - for (; ; match( Token.Comma ) ) { - SymtabEntry parent = scopedName (entry.container (), stFactory.interfaceEntry ()); - SymtabEntry realParent = typeOf (parent); - if (isInterface(realParent)) - entry.derivedFromAddElement (realParent, scanner); - else - ParseException.wrongType (scanner, parent.fullName (), "interface", - entryName (parent)); - - if (token.type != Token.Comma) - break; - } - } // valueSupportsSpec - - private void valueElement (ValueEntry entry) throws IOException, ParseException - { - if (entry.isAbstract ()) - export (entry); - else - switch (token.type) - { - case Token.Private: - case Token.Public: - valueStateMember (entry); - break; - case Token.Init: - case Token.Factory: // "factory" supplants "init" in 2.4RTF - initDcl (entry); - break; - case Token.Typedef: - case Token.Struct: - case Token.Union: - case Token.Enum: - case Token.Const: - case Token.Native: - case Token.Exception: - case Token.Readonly: - case Token.Attribute: - case Token.Oneway: - case Token.Float: - case Token.Double: - case Token.Long: - case Token.Short: - case Token.Unsigned: - case Token.Char: - case Token.Wchar: - case Token.Boolean: - case Token.Octet: - case Token.Any: - case Token.String: - case Token.Wstring: - case Token.Identifier: - case Token.Object: - case Token.ValueBase: - case Token.DoubleColon: - case Token.Void: - export (entry); - break; - default: - throw ParseException.syntaxError(scanner, new int[] { - Token.Private, Token.Public, Token.Init, Token.ValueBase, - Token.Typedef, Token.Struct, Token.Union, Token.Enum, - Token.Const, Token.Exception, Token.Readonly, Token.Attribute, - Token.Oneway, Token.Float, Token.Double, Token.Long, - Token.Short, Token.Unsigned, Token.Char, Token.Wchar, - Token.Boolean, Token.Octet, Token.Any, Token.String, - Token.Wstring, Token.Identifier, Token.DoubleColon, Token.Void }, - token.type); - } // switch - } // valueElement - - // - /** - * - **/ - private void valueStateMember (ValueEntry entry) throws IOException, ParseException - { - TypedefEntry typedefEntry = - stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ()); - typedefEntry.sourceFile (scanner.fileEntry ()); - // comment must immediately precede "public", "private" keywords - typedefEntry.comment (token.comment); - boolean isPublic = (token.type == Token.Public); - if (isPublic) - match (Token.Public); - else - match (Token.Private); - // Add constructed types declared "inline" to the contained - // vector of this value entry. - boolean isConstTypeSpec = - (token.type == Token.Struct || token.type == Token.Union || token.type == Token.Enum); - // Make typedefEntry anonymous. If this line is removed, - // the entry will be named incorrectly. See . - typedefEntry.name (""); - typedefEntry.type (typeSpec (typedefEntry)); - addDeclarators (entry, typedefEntry, isPublic); - // - if (isConstTypeSpec) - entry.addContained (typedefEntry); - match (Token.Semicolon); - } // valueStateMember - - - private void addDeclarators (ValueEntry entry, TypedefEntry typedefEntry, - boolean isPublic) throws IOException, ParseException - { - int modifier = isPublic ? InterfaceState.Public : InterfaceState.Private; - try - { - Vector typedefList = new Vector (); - declarators (typedefEntry, typedefList); - for (Enumeration e = typedefList.elements (); e.hasMoreElements ();) - entry.addStateElement ( - new InterfaceState (modifier, (TypedefEntry)e.nextElement ()), scanner); - } - catch (ParseException exception) - { - skipToSemicolon (); - } - } // addDeclarators - - /** - * - **/ - private void initDcl (ValueEntry entry) throws IOException, ParseException - { - MethodEntry method = stFactory.methodEntry (entry, (IDLID)repIDStack.peek ()); - method.sourceFile (scanner.fileEntry ()); - // Comment must immediately precede "init" keyword: - method.comment (token.comment); - repIDStack.push (((IDLID)repIDStack.peek ()).clone ()); - ((IDLID)repIDStack.peek ()).appendToName (token.name); - - // In 2.3 prelim, ::= "init" "(" ... - if (token.type == Token.Init) - { - method.name ("init"); - match (Token.Init); - match (Token.LeftParen); - } - else // In 2.4rtf, ::= "factory" "(" ... - { - match (Token.Factory); - method.name (token.name); - if (token.type == Token.MacroIdentifier) - match (Token.MacroIdentifier); // "(" already consumed. - else - { - match (Token.Identifier); - match (Token.LeftParen); - } - } - - if (token.type != Token.RightParen) - for (;;) - { - initParamDcl (method); - if (token.type == Token.RightParen) - break; - match (Token.Comma); - } - entry.initializersAddElement (method, scanner); - match (Token.RightParen); - match (Token.Semicolon); - repIDStack.pop (); - } // initDcl - - /** - * - **/ - private void initParamDcl (MethodEntry entry) throws IOException, ParseException - { - ParameterEntry parmEntry = stFactory.parameterEntry (entry, (IDLID)repIDStack.peek ()); - parmEntry.sourceFile (scanner.fileEntry()); - // Comment must immediately precede parameter attribute - parmEntry.comment (token.comment); - match (Token.In); - parmEntry.passType (ParameterEntry.In); - parmEntry.type (paramTypeSpec (entry)); - parmEntry.name (token.name); - match (Token.Identifier); - if (isntInList (entry.parameters (), parmEntry.name ())) - entry.addParameter (parmEntry); - } // initParamDcl - - /** - * - **/ - private void valueBox (ModuleEntry module, String name) throws IOException, ParseException - { - repIDStack.push (((IDLID)repIDStack.peek ()).clone ()); - // Note: The 'actual' repository ID will be calculated at the end of - // the parsing phase, since it is based on the entire contents of the - // declaration, and needs to have all forward references resolved: - ValueEntry entry = stFactory.valueBoxEntry (module, (IDLID)repIDStack.peek ()); - entry.sourceFile (scanner.fileEntry ()); - entry.name (name); - // comment must immediately precede "value" keyword - entry.comment (tokenHistory.lookBack (2).comment); - // Value boxes may not be forwarded. - // If this value has been forward declared, there are probably - // other values which derive from a ForwardValueEntry. - // Replace those ForwardValueEntry's with this ValueEntry: - //if (!ForwardValueEntry.replaceForwardDecl (entry)) - // ParseException.badAbstract (scanner, entry.fullName()); - SymtabEntry valueForward = (SymtabEntry)Parser.symbolTable.get (entry.fullName ()); - if (valueForward != null && valueForward instanceof ForwardEntry) - ParseException.forwardedValueBox (scanner, entry.fullName ()); - pigeonhole (module, entry); - ((IDLID)repIDStack.peek ()).appendToName (name); - currentModule = entry; - TypedefEntry typedefEntry = stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ()); - typedefEntry.sourceFile (scanner.fileEntry ()); - typedefEntry.comment (token.comment); - // Workaround to place typedefEntry in the _contained vector of - // this value box entry ONLY when is a constructed type declared - // at this point (i.e., not an identifier that resolves to a constructed - // type), so that emitters may generate bindings for it. - boolean isConstTypeSpec = - token.type == Token.Struct || token.type == Token.Union || token.type == Token.Enum; - // Make typedefEntry anonymous. If this line is removed, the - // entry will be named incorrectly. - typedefEntry.name (""); - typedefEntry.type (typeSpec (typedefEntry)); - // Value boxes cannot be nested. - if (typedefEntry.type () instanceof ValueBoxEntry) - ParseException.nestedValueBox (scanner); - //typedefEntry.name (""); - entry.addStateElement (new InterfaceState (InterfaceState.Public, typedefEntry), scanner); - if (isConstTypeSpec) - entry.addContained (typedefEntry); - currentModule = module; - repIDStack.pop (); - } // valueBox - - /** - * - **/ - private void valueForwardDcl (ModuleEntry module, String name, boolean isAbstract) - throws IOException, ParseException - { - ForwardValueEntry entry = stFactory.forwardValueEntry (module, (IDLID)repIDStack.peek ()); - entry.sourceFile (scanner.fileEntry ()); - entry.name (name); - entry.setInterfaceType(isAbstract ? InterfaceType.ABSTRACT : InterfaceType.NORMAL ); - // Comment must immediately precede "[abstract] value" keyword[s] - entry.comment (tokenHistory.lookBack (isAbstract? 3 : 2).comment); - pigeonhole (module, entry); - } // valueForwardDcl - - private void nativeDcl (SymtabEntry entry) throws IOException, ParseException - { - match (Token.Native); - NativeEntry nativeEntry = stFactory.nativeEntry (entry, (IDLID)repIDStack.peek ()); - nativeEntry.sourceFile (scanner.fileEntry ()); - // Comment must immediately precede "native" keyword - nativeEntry.comment (tokenHistory.lookBack (1).comment); - nativeEntry.name (token.name); - match (Token.Identifier); - pigeonhole (entry, nativeEntry); - } // nativeDcl - /** - * - **/ - private void constDcl (SymtabEntry entry) throws IOException, ParseException - { - match (Token.Const); - ConstEntry constEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek ()); - constEntry.sourceFile (scanner.fileEntry ()); - // Comment must immediately precede "const" keyword - constEntry.comment (tokenHistory.lookBack (1).comment); - constType (constEntry); - constEntry.name (token.name); - match (Token.Identifier); - match (Token.Equal); - constEntry.value (constExp (constEntry)); - verifyConstType (constEntry.value (), typeOf (constEntry.type ())); - pigeonhole (entry, constEntry); - } // constDcl - - /** - * - **/ - private void constType (SymtabEntry entry) throws IOException, ParseException - { - switch (token.type) - { - case Token.Octet: - entry.type( octetType()) ; - break ; - case Token.Long: - case Token.Short: - case Token.Unsigned: - entry.type (integerType (entry)); - break; - case Token.Char: - case Token.Wchar: - entry.type (charType ()); - break; - case Token.Boolean: - entry.type (booleanType ()); - break; - case Token.Float: - case Token.Double: - entry.type (floatingPtType ()); - break; - case Token.String: - case Token.Wstring: - entry.type (stringType (entry)); - break; - case Token.Identifier: - case Token.DoubleColon: - entry.type (scopedName (entry.container (), stFactory.primitiveEntry ())); - if (hasArrayInfo (entry.type ())) - ParseException.illegalArray (scanner, "const"); - SymtabEntry entryType = typeOf (entry.type ()); - if (!((entryType instanceof PrimitiveEntry) || (entryType instanceof StringEntry))) - { - ParseException.wrongType(scanner, entry.fullName (), "primitive or string", entryName (entry.type ())); - entry.type (qualifiedEntry ("long")); - } - else if (entryType instanceof PrimitiveEntry) - { - String any = overrideName ("any"); - if (entryType.name().equals (any)) - { - ParseException.wrongType (scanner, entry.fullName (), "primitive or string (except " + any + ')', any); - entry.type (qualifiedEntry ("long")); - } - } - break; - default: - throw ParseException.syntaxError (scanner, new int [] { - Token.Long, Token.Short, Token.Unsigned, Token.Char, - Token.Wchar, Token.Boolean, Token.Float, Token.Double, - Token.String, Token.Wstring, Token.Identifier, - Token.DoubleColon }, token.type); - } - } // constType - - /** - * - **/ - private boolean hasArrayInfo (SymtabEntry entry) - { - while (entry instanceof TypedefEntry) - { - if (((TypedefEntry)entry).arrayInfo ().size () != 0) - return true; - entry = entry.type (); - } - return false; - } // hasArrayInfo - - /** - * - **/ - public static String overrideName (String string) - { - String name = (String)overrideNames.get (string); - return (name == null) ? string : name; - } // overrideName - - // If entry is boolean, expression value must be boolean - // If entry is float/double, expression value must be float/double - // If entry is integral, expression value must be integral - // If entry is string, expression value must be string - - /** - * - **/ - private void verifyConstType (Expression e, SymtabEntry t) - { - Object value = e.value (); - if (value instanceof BigInteger) - verifyIntegral ((Number)value, t); - else if (value instanceof String) - verifyString (e, t); - else if (value instanceof Boolean) - verifyBoolean (t); - else if (value instanceof Character) - verifyCharacter (e, t); - else if (value instanceof Float || value instanceof Double) - verifyFloat((Number)value, t); - else if (value instanceof ConstEntry) - verifyConstType (((ConstEntry)value).value (), t); - else - ParseException.wrongExprType (scanner, t.fullName (), - (value == null) ? "" : value.toString ()); - } // verifyConstType - - private static final int MAX_SHORT = 32767; - private static final int MIN_SHORT = -32768; - private static final int MAX_USHORT = 65535; - - /** - * - **/ - private void verifyIntegral (Number n, SymtabEntry t) - { - boolean outOfRange = false; - //KEEP: Useful for debugging com.sun.tools.corba.se.idl.constExpr package - //System.out.println ("verifyIntegral, n = " + n.toString ()); - - if (t == qualifiedEntry( "octet" )) { - if ((n.longValue() > 255) || (n.longValue() < 0)) - outOfRange = true ; - } else if (t == qualifiedEntry ("long")) { - if (n.longValue () > Integer.MAX_VALUE || n.longValue() < Integer.MIN_VALUE) - outOfRange = true; - } else if (t == qualifiedEntry ("short")) { - if (n.intValue () > Short.MAX_VALUE || n.intValue () < Short.MIN_VALUE) - outOfRange = true; - } else if (t == qualifiedEntry ("unsigned long")) { - if (n.longValue () > (long)Integer.MAX_VALUE*2+1 || n.longValue() < 0) - outOfRange = true; - } else if (t == qualifiedEntry ("unsigned short")) { - if (n.intValue () > (int) Short.MAX_VALUE*2+1 || n.intValue () < 0) - outOfRange = true; - } else if (t == qualifiedEntry ("long long")) { - // BigInteger required because value being compared may exceed - // java.lang.Long.MAX_VALUE/MIN_VALUE: - BigInteger llMax = BigInteger.valueOf (Long.MAX_VALUE); - BigInteger llMin = BigInteger.valueOf (Long.MIN_VALUE); - if (((BigInteger)n).compareTo (llMax) > 0 || - ((BigInteger)n).compareTo (llMin) < 0) - outOfRange = true; - } else if (t == qualifiedEntry ("unsigned long long")) { - BigInteger ullMax = BigInteger.valueOf (Long.MAX_VALUE). - multiply (BigInteger.valueOf (2)). - add (BigInteger.valueOf (1)); - BigInteger ullMin = BigInteger.valueOf (0); - if (((BigInteger)n).compareTo (ullMax) > 0 || - ((BigInteger)n).compareTo (ullMin) < 0) - outOfRange = true; - } else { - String got = null; - // THIS MUST BE CHANGED; BIGINTEGER IS ALWAYS THE CONTAINER - /* - if (n instanceof Short) - got = "short"; - else if (n instanceof Integer) - got = "long"; - else - got = "long long"; - */ - got = "long"; - ParseException.wrongExprType (scanner, t.fullName (), got); - } - - if (outOfRange) - ParseException.outOfRange (scanner, n.toString (), t.fullName ()); - } // verifyIntegral - - /** - * - **/ - private void verifyString (Expression e, SymtabEntry t) - { - String string = (String)(e.value()) ; - if (!(t instanceof StringEntry)) { - ParseException.wrongExprType (scanner, t.fullName (), e.type() ); - } else if (((StringEntry)t).maxSize () != null) { - Expression maxExp = ((StringEntry)t).maxSize (); - try { - Number max = (Number)maxExp.value (); - if (string.length () > max.intValue ()) - ParseException.stringTooLong (scanner, string, max.toString ()); - } catch (Exception exception) { - // If the above statement is not valid and throws an - // exception, then an error occurred and was reported - // earlier. Move on. - } - } - - if (!e.type().equals( t.name())) { - // cannot mix strings and wide strings - ParseException.wrongExprType (scanner, t.name(), e.type() ) ; - } - } // verifyString - - /** - * - **/ - private void verifyBoolean (SymtabEntry t) - { - if (!t.name ().equals (overrideName ("boolean"))) - ParseException.wrongExprType(scanner, t.name(), "boolean"); - } // verifyBoolean - - /** - * - **/ - private void verifyCharacter (Expression e, SymtabEntry t) - { - // Bug fix 4382578: Can't compile a wchar literal. - // Allow a Character to be either a char or a wchar. - if (!t.name ().equals (overrideName ("char")) && - !t.name ().equals (overrideName ("wchar")) || - !t.name().equals(e.type()) ) - ParseException.wrongExprType (scanner, t.fullName(), e.type() ) ; - } // verifyCharacter - - /** - * - **/ - private void verifyFloat (Number f, SymtabEntry t) - { - // Added range checking for floats. - //if (!(t.name ().equals (overrideName ("float")) || - // t.name ().equals (overrideName ("double")))) - // ParseException.wrongExprType (scanner, - // t.fullName (), (f instanceof Float) ? "float" : "double"); - //KEEP: Useful for debugging com.sun.tools.corba.se.idl.constExpr package - //System.out.println ("verifyFloat, f = " + f.toString ()); - boolean outOfRange = false; - if (t.name ().equals (overrideName ("float"))) - { - double absVal = (f.doubleValue () < 0.0) ? - f.doubleValue () * -1.0 : f.doubleValue (); - if ((absVal != 0.0) && - (absVal > Float.MAX_VALUE || absVal < Float.MIN_VALUE)) - outOfRange = true; - } - else if (t.name ().equals (overrideName ("double"))) - { - // Cannot check range of double until BigDecimal is the basis - // of all floating-point types. Currently, it is Double. The - // parser will fail when instantiating a Double with an exception. - } - else - { - ParseException.wrongExprType (scanner, t.fullName (), - (f instanceof Float) ? "float" : "double"); - } - if (outOfRange) - ParseException.outOfRange (scanner, f.toString (), t.fullName ()); - } // verifyFloat - - /** - * - **/ - Expression constExp (SymtabEntry entry) throws IOException, ParseException - { - // Parse the expression. - Expression expr = orExpr (null, entry); - - // Set its target type. - if (expr.type() == null) - expr.type (entry.typeName ()); - // Compute its value and coerce it to the target type. - try - { - expr.evaluate (); - - // Coerces integral value to Double if an integer literal - // was used to initialize a floating-point constant expression. - if (expr instanceof Terminal && - expr.value () instanceof BigInteger && - (overrideName (expr.type ()).equals ("float") || - overrideName (expr.type ()).indexOf ("double") >= 0)) - { - expr.value (new Double (((BigInteger)expr.value ()).doubleValue ())); - } - } - catch (EvaluationException exception) - { - ParseException.evaluationError (scanner, exception.toString ()); - } - return expr; - } // constExp - - /** - * - **/ - private Expression orExpr (Expression e, SymtabEntry entry) throws IOException, ParseException - { - if (e == null) - e = xorExpr (null, entry); - else - { - BinaryExpr b = (BinaryExpr)e; - b.right (xorExpr (null, entry)); - e.rep (e.rep () + b.right ().rep ()); - } - if (token.equals (Token.Bar)) - { - match (token.type); - Or or = exprFactory.or (e, null); - or.type (entry.typeName ()); - or.rep (e.rep () + " | "); - return orExpr (or, entry); - } - return e; - } // orExpr - - /** - * - **/ - private Expression xorExpr (Expression e, SymtabEntry entry) throws IOException, ParseException - { - if (e == null) - e = andExpr (null, entry); - else - { - BinaryExpr b = (BinaryExpr)e; - b.right (andExpr (null, entry)); - e.rep (e.rep () + b.right ().rep ()); - } - if (token.equals (Token.Carat)) - { - match (token.type); - Xor xor = exprFactory.xor (e, null); - xor.rep (e.rep () + " ^ "); - xor.type (entry.typeName ()); - return xorExpr (xor, entry); - } - return e; - } // xorExpr - - /** - * - **/ - private Expression andExpr (Expression e, SymtabEntry entry) throws IOException, ParseException - { - if (e == null) - e = shiftExpr (null, entry); - else - { - BinaryExpr b = (BinaryExpr)e; - b.right (shiftExpr (null, entry)); - e.rep (e.rep () + b.right ().rep ()); - } - if (token.equals (Token.Ampersand)) - { - match (token.type); - And and = exprFactory.and (e, null); - and.rep(e.rep () + " & "); - and.type (entry.typeName ()); - return andExpr (and, entry); - } - return e; - } // andExpr - - /** - * - **/ - private Expression shiftExpr (Expression e, SymtabEntry entry) throws IOException, ParseException - { - if (e == null) - e = addExpr (null, entry); - else - { - BinaryExpr b = (BinaryExpr)e; - b.right (addExpr (null, entry)); - e.rep (e.rep () + b.right ().rep ()); - } - if (token.equals (Token.ShiftLeft)) - { - match (token.type); - ShiftLeft sl = exprFactory.shiftLeft (e, null); - sl.type (entry.typeName ()); - sl.rep (e.rep () + " << "); - return shiftExpr (sl, entry); - } - if (token.equals (Token.ShiftRight)) - { - match (token.type); - ShiftRight sr = exprFactory.shiftRight (e, null); - sr.type (entry.typeName ()); - sr.rep (e.rep () + " >> "); - return shiftExpr (sr, entry); - } - return e; - } // shiftExpr - - /** - * - **/ - private Expression addExpr (Expression e, SymtabEntry entry) throws IOException, ParseException - { - if (e == null) - e = multExpr (null, entry); - else - { - BinaryExpr b = (BinaryExpr)e; - b.right (multExpr (null, entry)); - e.rep (e.rep () + b.right ().rep ()); - } - if (token.equals (Token.Plus)) - { - match (token.type); - Plus p = exprFactory.plus (e, null); - p.type (entry.typeName ()); - p.rep (e.rep () + " + "); - return addExpr (p, entry); - } - if (token.equals (Token.Minus)) - { - match (token.type); - Minus m = exprFactory.minus (e, null); - m.type (entry.typeName ()); - m.rep (e.rep () + " - "); - return addExpr (m, entry); - } - return e; - } // addExpr - - /** - * - **/ - private Expression multExpr (Expression e, SymtabEntry entry) throws IOException, ParseException - { - if (e == null) - e = unaryExpr (entry); - else - { - BinaryExpr b = (BinaryExpr)e; - b.right (unaryExpr (entry)); - e.rep (e.rep () + b.right ().rep ()); - } - if (token.equals (Token.Star)) - { - match (token.type); - Times t = exprFactory.times (e, null); - t.type (entry.typeName ()); - t.rep (e.rep () + " * "); - return multExpr (t, entry); - } - if (token.equals (Token.Slash)) - { - match (token.type); - Divide d = exprFactory.divide (e, null); - d.type (entry.typeName ()); - d.rep (e.rep () + " / "); - return multExpr (d, entry); - } - if (token.equals (Token.Percent)) - { - match (token.type); - Modulo m = exprFactory.modulo (e, null); - m.type (entry.typeName ()); - m.rep (e.rep () + " % "); - return multExpr (m, entry); - } - return e; - } // multExpr - - /** - * - **/ - private Expression unaryExpr (SymtabEntry entry) throws IOException, ParseException - { - if (token.equals (Token.Plus)) - { - match (token.type); - Expression e = primaryExpr (entry); - Positive pos = exprFactory.positive (e); - pos.type (entry.typeName()); - pos.rep ('+' + e.rep()); - return pos; - } - if (token.equals (Token.Minus)) - { - match (token.type); - Expression e = primaryExpr (entry); - Negative neg = exprFactory.negative (e); - neg.type (entry.typeName()); - neg.rep ('-' + e.rep()); - return neg; - } - if (token.equals (Token.Tilde)) - { - match (token.type); - Expression e = primaryExpr (entry); - Not not = exprFactory.not (e); - not.type (entry.typeName()); - not.rep ('~' + e.rep()); - return not; - } - return primaryExpr (entry); - } // unaryExpr - - /** - * - **/ - private Expression primaryExpr (SymtabEntry entry) - throws IOException, ParseException - { - Expression primary = null; - if (parsingConditionalExpr) - { - prep.token = token; // Give current token to preprocessor - primary = prep.primaryExpr (entry); - token = prep.token; // Get the current token from preprocessor - } - else - switch (token.type) - { - case Token.Identifier: - case Token.DoubleColon: - ConstEntry expectedC = stFactory.constEntry (); - expectedC.value (exprFactory.terminal ("1", BigInteger.valueOf (1))); - SymtabEntry ref = scopedName (entry.container (), expectedC); - if (!(ref instanceof ConstEntry)) - { - ParseException.invalidConst (scanner, ref.fullName ()); - // An error occurred. Just give it some bogus value. - //primary = exprFactory.terminal ("1", new Long (1)); - primary = exprFactory.terminal ("1", BigInteger.valueOf (1)); - } - else - primary = exprFactory.terminal ((ConstEntry)ref); - break; - case Token.BooleanLiteral: - case Token.CharacterLiteral: - case Token.IntegerLiteral: - case Token.FloatingPointLiteral: - case Token.StringLiteral: - primary = literal (entry); - break; - case Token.LeftParen: - match (Token.LeftParen); - primary = constExp (entry); - match (Token.RightParen); - primary.rep ('(' + primary.rep () + ')'); - break; - default: - throw ParseException.syntaxError (scanner, new int [] { - Token.Identifier, Token.DoubleColon, Token.Literal, Token.LeftParen}, - token.type); - } - return primary; - } // primaryExpr - - /** - * - **/ - Expression literal (SymtabEntry entry) throws IOException, ParseException - { - String string = token.name; - Expression literal = null; - switch (token.type) - { - case Token.IntegerLiteral: - match (Token.IntegerLiteral); - try - { - literal = exprFactory.terminal (string, parseString (string)); - literal.type (entry.typeName ()); - } - catch (NumberFormatException exception) - { - ParseException.notANumber (scanner, string); - literal = exprFactory.terminal ("0", BigInteger.valueOf (0)); - } - break; - case Token.CharacterLiteral: - boolean isWide = token.isWide(); - match (Token.CharacterLiteral); - literal = exprFactory.terminal ("'" + string.substring (1) + "'", - new Character (string.charAt (0)), isWide ); - break; - case Token.FloatingPointLiteral: - match (Token.FloatingPointLiteral); - try - { - literal = exprFactory.terminal (string, new Double (string)); - literal.type (entry.typeName ()); - } - catch (NumberFormatException e) - { - ParseException.notANumber (scanner, string); - } - break; - case Token.BooleanLiteral: - literal = booleanLiteral (); - break; - case Token.StringLiteral: - literal = stringLiteral (); - break; - default: - throw ParseException.syntaxError (scanner, Token.Literal,token.type); - } - return literal; - } // literal - - /** - * - **/ - private BigInteger parseString (String string) throws NumberFormatException - { - int radix = 10; - if (string.length() > 1) - if (string.charAt (0) == '0') - if (string.charAt (1) == 'x' || string.charAt (1) == 'X') - { - string = string.substring (2); - radix = 16; - } - else - radix = 8; - return new BigInteger (string, radix); - } // parseString - - /** - * - **/ - private Terminal booleanLiteral () throws IOException, ParseException - { - Boolean bool = null; - if (token.name.equals ("TRUE")) - bool = new Boolean (true); - else if (token.name.equals ("FALSE")) - bool = new Boolean (false); - else - { - ParseException.invalidConst (scanner, token.name); - bool = new Boolean (false); - } - String name = token.name; - match (Token.BooleanLiteral); - return exprFactory.terminal (name, bool); - } // booleanLiteral - - /** - * - **/ - private Expression stringLiteral () throws IOException, ParseException - { - // If string literals appear together, concatenate them. Ie: - // "Twas " "brillig " "and " "the " "slithy " "toves" - // becomes - // "Twas brillig and the slithy toves" - boolean isWide = token.isWide() ; - String literal = ""; - do - { - literal += token.name; - match (Token.StringLiteral); - } while (token.equals (Token.StringLiteral)); - Expression stringExpr = exprFactory.terminal (literal, isWide ); - stringExpr.rep ('"' + literal + '"'); - return stringExpr; - } // stringLiteral - - /** - * - **/ - private Expression positiveIntConst (SymtabEntry entry) throws IOException, ParseException - { - Expression e = constExp (entry); - Object value = e.value (); - while (value instanceof ConstEntry) - value = ((ConstEntry)value).value ().value (); - if (!(value instanceof Number) || value instanceof Float || value instanceof Double) - { - ParseException.notPositiveInt (scanner, e.rep ()); - //e = exprFactory.terminal ("1", new Long (1)); - e = exprFactory.terminal ("1", BigInteger.valueOf (1)); - } - //else if (((Number)value).longValue () <= 0) { - // ParseException.notPositiveInt (scanner, value.toString ()); - // e = exprFactory.terminal ("1", new Long (1)); } - else if (((BigInteger)value).compareTo (BigInteger.valueOf (0)) <= 0) - { - ParseException.notPositiveInt (scanner, value.toString ()); - //e = exprFactory.terminal ("1", new Long (1)); - e = exprFactory.terminal ("1", BigInteger.valueOf (1)); - } - return e; - } // positiveIntConst - - /** - * - **/ - private SymtabEntry typeDcl (SymtabEntry entry) throws IOException, ParseException - { - switch (token.type) - { - case Token.Typedef: - match (Token.Typedef); - return typeDeclarator (entry); - case Token.Struct: - return structType (entry); - case Token.Union: - return unionType (entry); - case Token.Enum: - return enumType (entry); - default: - throw ParseException.syntaxError (scanner, new int [] { - Token.Typedef, Token.Struct, Token.Union, Token.Enum}, token.type); - } - } // typeDcl - - /** - * - **/ - private TypedefEntry typeDeclarator (SymtabEntry entry) throws IOException, ParseException - { - TypedefEntry typedefEntry = stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ()); - typedefEntry.sourceFile (scanner.fileEntry ()); - // Comment must immediately precede "typedef" keyword - typedefEntry.comment (tokenHistory.lookBack (1).comment); - typedefEntry.type (typeSpec (entry)); - Vector typedefList = new Vector (); - declarators (typedefEntry, typedefList); - for (Enumeration e = typedefList.elements(); e.hasMoreElements();) - pigeonhole (entry, (SymtabEntry)e.nextElement ()); - return typedefEntry; - } // typeDeclarator - - /** - * - **/ - private SymtabEntry typeSpec (SymtabEntry entry) throws IOException, ParseException - { - return ((token.type == Token.Struct) || - (token.type == Token.Union) || - (token.type == Token.Enum)) - ? constrTypeSpec (entry) - : simpleTypeSpec (entry, true); - } // typeSpec - - /** - * - **/ - private SymtabEntry simpleTypeSpec (SymtabEntry entry, - boolean mustBeReferencable ) throws IOException, ParseException - { - // - //if ((token.type == Token.Identifier) || - // (token.type == Token.DoubleColon) || - // (token.type == Token.Object)) { - if ((token.type == Token.Identifier) || - (token.type == Token.DoubleColon) || - (token.type == Token.Object) || - (token.type == Token.ValueBase)) - { - SymtabEntry container = ((entry instanceof InterfaceEntry) || - (entry instanceof ModuleEntry) || - (entry instanceof StructEntry) || - (entry instanceof UnionEntry)) - ? entry - : entry.container (); - return scopedName (container, stFactory.primitiveEntry (), - mustBeReferencable); - } - return ((token.type == Token.Sequence) || - (token.type == Token.String) || - (token.type == Token.Wstring)) - ? templateTypeSpec (entry) - : baseTypeSpec (entry); - } // simpleTypeSpec - - /** - * - **/ - private SymtabEntry baseTypeSpec (SymtabEntry entry) throws IOException, ParseException - { - switch (token.type) - { - case Token.Float: - case Token.Double: - return floatingPtType (); - case Token.Long: - case Token.Short: - case Token.Unsigned: - return integerType (entry); - case Token.Char: - case Token.Wchar: - return charType (); - case Token.Boolean: - return booleanType (); - case Token.Octet: - return octetType (); - case Token.Any: - return anyType (); - // NOTE: Object and ValueBase are s, but both - // are processed at simpleTypeSpec(), not here. parmTypeSpec() - // directly checks for these types. Could make baseTypeSpec() do - // the same - default: - throw ParseException.syntaxError (scanner, new int [] { - Token.Float, Token.Double, Token.Long, Token.Short, - Token.Unsigned, Token.Char, Token.Wchar, Token.Boolean, - Token.Octet, Token.Any}, token.type); - } - } // baseTypeSpec - - /** - * - **/ - private SymtabEntry templateTypeSpec (SymtabEntry entry) throws IOException, ParseException - { - switch (token.type) - { - case Token.Sequence: - return sequenceType (entry); - case Token.String: - case Token.Wstring: - return stringType (entry); - } - throw ParseException.syntaxError (scanner, new int [] {Token.Sequence, Token.String, Token.Wstring}, token.type); - } // templateTypeSpec - - /** - * - **/ - private SymtabEntry constrTypeSpec (SymtabEntry entry) throws IOException, ParseException - { - switch (token.type) - { - case Token.Struct: - return structType (entry); - case Token.Union: - return unionType (entry); - case Token.Enum: - return enumType (entry); - } - throw ParseException.syntaxError (scanner, new int [] {Token.Struct, Token.Union, Token.Enum}, token.type); - } // constrTypeSpec - - /** - * - **/ - private void declarators (TypedefEntry entry, Vector list) throws IOException, ParseException - { - for (; ; match (Token.Comma)) - { - TypedefEntry newEntry = (TypedefEntry)entry.clone (); - declarator (newEntry); - if (isntInList (list, newEntry.name ())) - list.addElement (newEntry); - if (token.type != Token.Comma) - break; - } - } // declarators - - /** - * - **/ - private void declarator (TypedefEntry entry) throws IOException, ParseException - { - entry.name (token.name); - // If the declarator is commented then override the comment cloned from the parent - // entry. <08aug1997daz> - if (!token.comment.text ().equals ("")) - entry.comment (token.comment); - match (Token.Identifier); - while (token.type == Token.LeftBracket) - fixedArraySize (entry); - } // declarator - - /** - * - **/ - private PrimitiveEntry floatingPtType () throws IOException, ParseException - { - String name = "double"; - if (token.type == Token.Float) - { - match (Token.Float); - name = "float"; - } - else if (token.type == Token.Double) - match (Token.Double); - else - { - int [] expected = {Token.Float, Token.Double}; - ParseException.syntaxError (scanner, new int [] {Token.Float, Token.Double }, token.type); - } - PrimitiveEntry ret = null; - try - { - ret = (PrimitiveEntry)qualifiedEntry (name); - } - catch (ClassCastException exception) - { - ParseException.undeclaredType (scanner, name); - } - return ret; - } // floatingPtType - - /** - * - **/ - private PrimitiveEntry integerType (SymtabEntry entry) throws IOException, ParseException - { - String name = ""; - if (token.type == Token.Unsigned) - { - match (Token.Unsigned); - name = "unsigned "; - } - name += signedInt(); - PrimitiveEntry ret = null; - try - { - ret = (PrimitiveEntry) qualifiedEntry (name); - } - catch (ClassCastException exception) - { - ParseException.undeclaredType (scanner, name); - } - return ret; - } // integerType - - /** - * - **/ - private String signedInt () throws IOException, ParseException - { - String ret = "long"; - if (token.type == Token.Long) - { - match (Token.Long); - // ::= "long" | e - if (token.type == Token.Long) - { - ret = "long long"; - match (Token.Long); - } - } - else if (token.type == Token.Short) - { - ret = "short"; - match (Token.Short); - } - else - ParseException.syntaxError (scanner, new int [] {Token.Long, Token.Short}, token.type); - return ret; - } // signedInt - - /** - * - **/ - private PrimitiveEntry charType () throws IOException, ParseException - { - String tokenName; - if (token.type == Token.Char) - { - match (Token.Char); - tokenName = "char"; - } - else - { - match (Token.Wchar); - tokenName = "wchar"; - } - PrimitiveEntry ret = null; - try - { - ret = (PrimitiveEntry) qualifiedEntry (tokenName); - } - catch (ClassCastException exception) - { - ParseException.undeclaredType (scanner, overrideName (tokenName)); - } - return ret; - } // charType - - /** - * - **/ - private PrimitiveEntry booleanType () throws IOException, ParseException - { - PrimitiveEntry ret = null; - match (Token.Boolean); - try - { - ret = (PrimitiveEntry) qualifiedEntry ("boolean"); - } - catch (ClassCastException exception) - { - ParseException.undeclaredType (scanner, overrideName ("boolean")); - } - return ret; - } // booleanType - - /** - * - **/ - private PrimitiveEntry octetType () throws IOException, ParseException - { - PrimitiveEntry ret = null; - match (Token.Octet); - try - { - ret = (PrimitiveEntry) qualifiedEntry ("octet"); - } - catch (ClassCastException exception) - { - ParseException.undeclaredType (scanner, overrideName ("octet")); - } - return ret; - } // octetType - - /** - * - **/ - private SymtabEntry anyType () throws IOException, ParseException - { - match (Token.Any); - try - { - return qualifiedEntry ("any"); - } - catch (ClassCastException exception) - { - ParseException.undeclaredType (scanner, overrideName ("any")); - return null; - } - } // anyType - - /** - * - **/ - private StructEntry structType (SymtabEntry entry) throws IOException, - ParseException - { - match (Token.Struct); - String name = token.name; - match (Token.Identifier); - StructEntry structEntry = null ; - - if (token.type == Token.LeftBrace) { - repIDStack.push(((IDLID)repIDStack.peek ()).clone ()) ; - structEntry = makeStructEntry( name, entry, false ) ; - ((IDLID)repIDStack.peek ()).appendToName (name); - prep.openScope (structEntry); - match (Token.LeftBrace) ; - member (structEntry) ; - memberList2 (structEntry) ; - prep.closeScope (structEntry); - match (Token.RightBrace) ; - repIDStack.pop() ; - } else if (token.equals( Token.Semicolon )) { - structEntry = makeStructEntry( name, entry, true ) ; - } else { - throw ParseException.syntaxError (scanner, - new int[] { Token.Semicolon, Token.LeftBrace }, token.type); - } - return structEntry; - } // structType - - private StructEntry makeStructEntry( String name, SymtabEntry entry, - boolean isForward ) - { - StructEntry structEntry = stFactory.structEntry (entry, - (IDLID)repIDStack.peek () ); - structEntry.isReferencable( !isForward ) ; - structEntry.sourceFile (scanner.fileEntry ()); - structEntry.name (name); - // Comment must immediately preceed "struct" keyword - structEntry.comment (tokenHistory.lookBack (1).comment); - pigeonhole( entry, structEntry ) ; - return structEntry ; - } - - /** - * - **/ - private void memberList2 (StructEntry entry) throws IOException - { - while (token.type != Token.RightBrace) - member (entry); - } // memberList2 - - /** - * - **/ - private void member (StructEntry entry) throws IOException - { - TypedefEntry newEntry = stFactory.typedefEntry(entry, (IDLID)repIDStack.peek()); - newEntry.sourceFile (scanner.fileEntry ()); - // comment must immediately precede lexeme - newEntry.comment (token.comment); - try - { - newEntry.type (typeSpec (entry)); - if (newEntry.type () == entry) - throw ParseException.recursive (scanner, entry.fullName (), - (token.name == null) ? "" : token.name); - // Exception cannot appear within a struct, union, or exception - if (typeOf (newEntry) instanceof ExceptionEntry) - throw ParseException.illegalException (scanner, entryName (entry)); - declarators (newEntry, entry.members ()); - match (Token.Semicolon); - } - catch (ParseException exception) - { - skipToSemicolon (); - } - } // member - - /** - * - **/ - private final boolean isConstTypeSpec (Token t) - { - return (t.type == Token.Struct || t.type == Token.Union || t.type == Token.Enum); - } // isConstTypeSpec - - /** - * - **/ - private UnionEntry unionType (SymtabEntry entry) throws IOException, ParseException - { - match (Token.Union) ; - String name = token.name ; - match (Token.Identifier) ; - UnionEntry unionEntry = null ; - - if (token.type == Token.Switch) { - repIDStack.push (((IDLID)repIDStack.peek ()).clone ()); - unionEntry = makeUnionEntry( name, entry, false ) ; - ((IDLID)repIDStack.peek ()).appendToName (name); - match (Token.Switch); - match (Token.LeftParen); - unionEntry.type (switchTypeSpec (unionEntry)); - match (Token.RightParen); - prep.openScope (unionEntry); - match (Token.LeftBrace); - switchBody (unionEntry); - verifyUnion (unionEntry); - prep.closeScope (unionEntry); - match (Token.RightBrace); - repIDStack.pop (); - } else if (token.equals( Token.Semicolon )) { - unionEntry = makeUnionEntry( name, entry, true ) ; - } else { - throw ParseException.syntaxError (scanner, - new int[] { Token.Semicolon, Token.Switch }, token.type); - } - - return unionEntry ; - } // unionType - - private UnionEntry makeUnionEntry( String name, SymtabEntry entry, - boolean isForward ) - { - UnionEntry unionEntry = stFactory.unionEntry (entry, - (IDLID)repIDStack.peek () ); - unionEntry.isReferencable( !isForward ) ; - unionEntry.sourceFile (scanner.fileEntry ()); - unionEntry.name (name); - // Comment must immediately preceed "union" keyword - unionEntry.comment (tokenHistory.lookBack (1).comment); - pigeonhole( entry, unionEntry ) ; - return unionEntry ; - } - - /** - * - **/ - private void verifyUnion (UnionEntry u) - { - if (u.typeName ().equals (overrideName ("boolean"))) - { - if (caseCount (u) > 2) - ParseException.noDefault (scanner); - } - else if (u.type () instanceof EnumEntry) - { - if (caseCount (u) > ((EnumEntry)u.type ()).elements ().size ()) - ParseException.noDefault (scanner); - } - } // verifyUnion - - /** - * - **/ - private long caseCount (UnionEntry u) - { - long cases = 0; - Enumeration branches = u.branches ().elements (); - while (branches.hasMoreElements ()) - { - UnionBranch branch = (UnionBranch)branches.nextElement (); - cases += branch.labels.size (); - if (branch.isDefault) - ++cases; - } - return cases; - } // caseCount - - /** - * - **/ - private SymtabEntry switchTypeSpec (UnionEntry entry) throws IOException, ParseException - { - SymtabEntry ret = null; - switch (token.type) - { - case Token.Long: - case Token.Short: - case Token.Unsigned: - return integerType (entry); - case Token.Char: - case Token.Wchar: - return charType(); - case Token.Boolean: - return booleanType(); - case Token.Enum: - return enumType (entry); - case Token.Identifier: - case Token.DoubleColon: - ret = scopedName (entry, stFactory.primitiveEntry ()); - if (hasArrayInfo (entry.type ())) - ParseException.illegalArray (scanner, "switch"); - SymtabEntry retType = typeOf (ret); - if (!(retType instanceof EnumEntry || retType instanceof PrimitiveEntry)) - ParseException.wrongType (scanner, ret.fullName (), - "long, unsigned long, short, unsigned short, char, boolean, enum", - entryName (ret.type ())); - else if (ret instanceof PrimitiveEntry) - { - SymtabEntry octet = qualifiedEntry ("octet"); - SymtabEntry flt = qualifiedEntry ("float"); - SymtabEntry dbl = qualifiedEntry ("double"); - if (retType == octet || retType == flt || retType == dbl) - ParseException.wrongType (scanner, ret.fullName(), - "long, unsigned long, short, unsigned short, char, boolean, enum", - entryName(ret.type ())); - } - break; - default: - throw ParseException.syntaxError (scanner, new int [] { - Token.Long, Token.Short, Token.Unsigned, Token.Char, - Token.Boolean, Token.Enum, Token.Identifier, - Token.DoubleColon }, token.type); - } - return ret; - } // switchTypeSpec - - // This is only used by the union methods - UnionBranch defaultBranch = null; - - /** - * - **/ - private void switchBody (UnionEntry entry) throws IOException, ParseException - { - caseProd (entry); - while (!token.equals (Token.RightBrace)) - caseProd (entry); - entry.defaultBranch ((defaultBranch == null) ? null : defaultBranch.typedef); - defaultBranch = null; - } // switchBody - - /** - * - **/ - private void caseProd (UnionEntry entry) throws IOException, ParseException - { - UnionBranch branch = new UnionBranch (); - entry.addBranch (branch); - caseLabel (entry, branch); - while (token.equals (Token.Case) || token.equals (Token.Default)) - caseLabel (entry, branch); - elementSpec (entry, branch); - match (Token.Semicolon); - } // caseProd - - /** - * - **/ - private void caseLabel (UnionEntry entry, UnionBranch branch) throws IOException, ParseException - { - if (token.type == Token.Case) - { - match (Token.Case); - ConstEntry tmpEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek ()); - tmpEntry.sourceFile (scanner.fileEntry ()); - tmpEntry.type (entry); - - Expression label; - SymtabEntry type = typeOf (entry.type ()); - if (type instanceof EnumEntry) - label = matchEnum ((EnumEntry)type); - else - { - label = constExp (tmpEntry); - verifyConstType (label, type); - } - if (entry.has (label)) - ParseException.branchLabel (scanner, label.rep ()); - branch.labels.addElement (label); - match (Token.Colon); - } - else if (token.type == Token.Default) - { - match (Token.Default); - match (Token.Colon); - if (entry.defaultBranch () != null) - ParseException.alreadyDefaulted (scanner); - branch.isDefault = true; - defaultBranch = branch; - } - else - throw ParseException.syntaxError (scanner, new int [] { Token.Case, Token.Default }, token.type); - } // caselabel - - /** - * - **/ - private Expression matchEnum (EnumEntry entry) throws IOException, ParseException - { - // Get the symbol table entry for the case label based on the - // scope of the EnumEntry, NOT the UnionEntry (the union could be - // in a different scope than the enum). Given - // module M { enum E {A, B, C, D}; }; - // a case label for A could be one of the following: - // case A: - // case M::A: - // case ::M::A: - SymtabEntry label = scopedName (entry.container(), new SymtabEntry ()); - return exprFactory.terminal (label.name (), false); - } // matchEnum - - /** - * - **/ - private void elementSpec (UnionEntry entry, UnionBranch branch) throws IOException, ParseException - { - TypedefEntry typedef = stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ()); - typedef.sourceFile (scanner.fileEntry ()); - // Comment must immediately precede lexeme - typedef.comment (token.comment); - typedef.type (typeSpec (entry)); - if (typedef.type () == entry) - throw ParseException.recursive (scanner, entry.fullName (), (token.name == null)? "" : token.name); - // Exception cannot appear within a struct, union, or exception - if (typeOf (typedef) instanceof ExceptionEntry) - throw ParseException.illegalException (scanner, entryName (entry)); - declarator (typedef); - branch.typedef = typedef; - // Ensure a branch with the same name doesn't already exist. - if (entry.has (typedef)) - ParseException.branchName (scanner, typedef.name ()); - } // elementSpec - - /** - * - **/ - private EnumEntry enumType (SymtabEntry entry) throws IOException, ParseException - { - match (Token.Enum); - EnumEntry enumEntry = newEnumEntry (entry); - // comment must immediately precede "enum" keyword - enumEntry.comment (tokenHistory.lookBack (1).comment); - enumEntry.name (token.name); - match (Token.Identifier); - prep.openScope (enumEntry); - match (Token.LeftBrace); - if (isntInStringList (enumEntry.elements (), token.name)) - { - enumEntry.addElement (token.name); - SymtabEntry element = new SymtabEntry (entry, (IDLID)repIDStack.peek ()); - // if block taken from EnumEntry ctor - if (element.module ().equals ("")) - element.module (element.name ()); - else if (!element.name ().equals ("")) - element.module (element.module () + "/" + element.name ()); - element.name (token.name); - // Place the SymtabEntry representing this enumeration - // contant into the SymtabEntry defining its scope (e.g., InterfaceEntry, - // ValueEntry, etc.) rather than the SymtabEntry passed in, which - // may not define the contant's scope (e.g., TypedefEntry). - //pigeonhole (entry, element); } - pigeonhole (enumEntry.container (), element); - } - match (Token.Identifier); - enumType2 (enumEntry); - prep.closeScope (enumEntry); - match (Token.RightBrace); - return enumEntry; - } // enumType - - /** - * - **/ - private void enumType2 (EnumEntry entry) throws IOException, ParseException - { - while (token.type == Token.Comma) - { - match (Token.Comma); - String name = token.name; - match (Token.Identifier); - if (isntInStringList (entry.elements (), name)) - { - entry.addElement (name); - SymtabEntry element = new SymtabEntry (entry.container (), (IDLID)repIDStack.peek ()); - // if block taken from EnumEntry ctor: - if (element.module ().equals ("")) - element.module (element.name ()); - else if (!element.name().equals ("")) - element.module (element.module () + "/" + element.name ()); - element.name (name); - pigeonhole (entry.container (), element); - } - } - } // enumType2 - - /** - * - **/ - private SequenceEntry sequenceType (SymtabEntry entry) throws IOException, ParseException - { - match (Token.Sequence); - match (Token.LessThan); - - SequenceEntry newEntry = newSequenceEntry (entry); - SymtabEntry tsentry = simpleTypeSpec (newEntry, false ); - newEntry.type (tsentry); - if (!tsentry.isReferencable()) { - // This is a sequence type that is referencing an - // incomplete forward declaration of a struct or - // union. Save the sequence in a list for later - // backpatching. - try { - List fwdTypes = (List)tsentry.dynamicVariable( ftlKey ) ; - if (fwdTypes == null) { - fwdTypes = new ArrayList() ; - tsentry.dynamicVariable( ftlKey, fwdTypes ) ; - } - fwdTypes.add( newEntry ) ; - } catch (NoSuchFieldException exc) { - throw new IllegalStateException() ; - } - } - - if (token.type == Token.Comma) - { - match (Token.Comma); - ConstEntry tmpEntry = stFactory.constEntry (newEntry, (IDLID)repIDStack.peek ()); - tmpEntry.sourceFile (scanner.fileEntry ()); - tmpEntry.type (qualifiedEntry ("long")); - newEntry.maxSize (positiveIntConst (tmpEntry)); - verifyConstType (newEntry.maxSize(), qualifiedEntry ("long")); - } - match (Token.GreaterThan); - return newEntry; - } // sequenceType - - /** - * - **/ - private StringEntry stringType (SymtabEntry entry) throws IOException, ParseException - { - StringEntry string = stFactory.stringEntry (); - if (token.type == Token.String) - { - string.name (overrideName ("string")); - match (Token.String); - } - else - { - string.name (overrideName ("wstring")); - match (Token.Wstring); - } - string.maxSize (stringType2 (entry)); - return string; - } // stringType - - /** - * - **/ - private Expression stringType2 (SymtabEntry entry) throws IOException, ParseException - { - if (token.type == Token.LessThan) - { - match (Token.LessThan); - - // START IBM.11417 failure in the IDL compiler - //Expression maxSize = positiveIntConst (entry); IBM.11417 - - ConstEntry tmpEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek -()); - tmpEntry.sourceFile (scanner.fileEntry ()); - tmpEntry.type (qualifiedEntry ("long")); - Expression maxSize = positiveIntConst (tmpEntry); - - // END IBM.11417 - - verifyConstType (maxSize, qualifiedEntry ("long")); - match (Token.GreaterThan); - return maxSize; - } - return null; - } // stringType2 - - /** - * - **/ - private void fixedArraySize (TypedefEntry entry) throws IOException, ParseException - { - match (Token.LeftBracket); - ConstEntry tmpEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek ()); - tmpEntry.sourceFile (scanner.fileEntry ()); - // Set type of tmpExpr to "long", which is the array index type. - // Previously, this type was erroneously set to the array element type. - //tmpEntry.type (entry.type ()); - tmpEntry.type (qualifiedEntry ("long")); - Expression expr = positiveIntConst (tmpEntry); - entry.addArrayInfo (expr); - verifyConstType (expr, qualifiedEntry ("long")); - match (Token.RightBracket); - } // fixedArraySize - - /** - * - **/ - private void attrDcl (InterfaceEntry entry) throws IOException, ParseException - { - AttributeEntry attribute = stFactory.attributeEntry (entry, (IDLID)repIDStack.peek ()); - attribute.sourceFile (scanner.fileEntry ()); - // Comment must immediately precede the "attribute" keyword. Save the - // comment preceding the declaration for use below. - attribute.comment (token.comment); - Comment dclComment = attribute.comment (); - - if (token.type == Token.Readonly) - { - match (Token.Readonly); - attribute.readOnly (true); - } - match (Token.Attribute); - attribute.type (paramTypeSpec (attribute)); - attribute.name (token.name); - // Override declaration comment if attribute identifier is commented - if (!token.comment.text ().equals ("")) - attribute.comment (token.comment); - entry.methodsAddElement (attribute, scanner); - pigeonholeMethod (entry, attribute); - // Declaration comment was overriden: - if (!token.comment.text ().equals ("")) - { - // Create a temporary attribute with declaration comment so cloning in - // attrdcl2() can use declaration comment as default. - AttributeEntry attributeClone = (AttributeEntry) attribute.clone (); - attributeClone.comment (dclComment); - - match (Token.Identifier); - attrDcl2 (entry, attributeClone); - } - else - { - match (Token.Identifier); - attrDcl2 (entry, attribute); - } - //match (Token.Identifier); - //attrDcl2 (entry, attribute); - } // attrDcl - - /** - * - **/ - private void attrDcl2 (InterfaceEntry entry, AttributeEntry clone) - throws IOException, ParseException - { - while (token.type == Token.Comma) - { - match (Token.Comma); - AttributeEntry attribute = (AttributeEntry)clone.clone (); - attribute.name (token.name); - // Override the declaration comment (i.e., that preceding the - // "attribute" keyword) if the attribute identifier is commented. - if (!token.comment.text ().equals ("")) - attribute.comment (token.comment); - entry.methodsAddElement (attribute, scanner); - pigeonholeMethod (entry, attribute); - match (Token.Identifier); - } - } // attrDcl2 - - /** - * - **/ - private void exceptDcl (SymtabEntry entry) throws IOException, ParseException - { - match (Token.Exception); - repIDStack.push (((IDLID)repIDStack.peek ()).clone ()); - ExceptionEntry exceptEntry = stFactory.exceptionEntry (entry, (IDLID)repIDStack.peek ()); - ((IDLID)repIDStack.peek ()).appendToName (token.name); - exceptEntry.sourceFile (scanner.fileEntry ()); - // Comment must immediately precede "exception" keyword - exceptEntry.comment (tokenHistory.lookBack (1).comment); - exceptEntry.name (token.name); - match (Token.Identifier); - pigeonhole (entry, exceptEntry); - if (token.equals (Token.LeftBrace)) - { - prep.openScope (exceptEntry); - match (Token.LeftBrace); - memberList2 (exceptEntry); - prep.closeScope (exceptEntry); - match (Token.RightBrace); - repIDStack.pop (); - } - else - throw ParseException.syntaxError (scanner, Token.LeftBrace,token.type); - } // exceptDcl - - /** - * - **/ - private void opDcl (InterfaceEntry entry) throws IOException, ParseException - { - MethodEntry method = stFactory.methodEntry (entry, (IDLID)repIDStack.peek ()); - method.sourceFile (scanner.fileEntry ()); - // Comment must immediately precede "oneway" keyword or - method.comment (token.comment); - if (token.type == Token.Oneway) - { - match (Token.Oneway); - method.oneway (true); - } - method.type (opTypeSpec (method)); - repIDStack.push (((IDLID)repIDStack.peek ()).clone ()); - ((IDLID)repIDStack.peek ()).appendToName (token.name); - method.name (token.name); - entry.methodsAddElement (method, scanner); - pigeonholeMethod (entry, method); - opDcl2 (method); - if (method.oneway ()) - checkIfOpLegalForOneway (method); - repIDStack.pop (); - } // opDcl - - /** - * - **/ - private void checkIfOpLegalForOneway (MethodEntry method) - { - boolean notLegal = false; - if ((method.type() != null) || - (method.exceptions().size() != 0)) notLegal = true; - else - { - for (Enumeration e = method.parameters().elements(); e.hasMoreElements();) - { - if (((ParameterEntry)e.nextElement ()).passType () != ParameterEntry.In) - { - notLegal = true; - break; - } - } - } - if (notLegal) - ParseException.oneway (scanner, method.name ()); - } // checkifOpLegalForOneway - - /** - * - **/ - private void opDcl2 (MethodEntry method) throws IOException, ParseException - { - if (token.equals (Token.MacroIdentifier)) - { - match (Token.MacroIdentifier); - parameterDcls2 (method); - } - else - { - match (Token.Identifier); - parameterDcls (method); - } - opDcl3 (method); - } // opDcl2 - - /** - * - **/ - private void opDcl3 (MethodEntry entry) throws IOException, ParseException - { - if (token.type != Token.Semicolon) - { - if (!token.equals (Token.Raises) && !token.equals (Token.Context)) - throw ParseException.syntaxError (scanner, new int [] { - Token.Raises, Token.Context, Token.Semicolon }, token.type); - if (token.type == Token.Raises) - raisesExpr (entry); - if (token.type == Token.Context) - contextExpr (entry); - } - } // opDcl3 - - /** - * - **/ - private SymtabEntry opTypeSpec (SymtabEntry entry) throws IOException, ParseException - { - SymtabEntry ret = null; - if (token.type == Token.Void) - match (Token.Void); - else - ret = paramTypeSpec (entry); - return ret; - } // opTypeSpec - - /** - * - **/ - private void parameterDcls (MethodEntry entry) throws IOException, ParseException - { - match (Token.LeftParen); - parameterDcls2 (entry); - } // parameterDcls - - /** - * - **/ - private void parameterDcls2 (MethodEntry entry) throws IOException, ParseException - { - if (token.type == Token.RightParen) - match (Token.RightParen); - else - { - paramDcl (entry); - while (token.type == Token.Comma) - { - match (Token.Comma); - paramDcl (entry); - } - match (Token.RightParen); - } - } // paraneterDcls2 - - /** - * - **/ - private void paramDcl (MethodEntry entry) throws IOException, ParseException - { - ParameterEntry parmEntry = stFactory.parameterEntry (entry, (IDLID)repIDStack.peek ()); - parmEntry.sourceFile (scanner.fileEntry ()); - // Comment must immeiately precede the parameter attribute - parmEntry.comment (token.comment); - paramAttribute (parmEntry); - parmEntry.type (paramTypeSpec (entry)); - parmEntry.name (token.name); - match (Token.Identifier); - if (isntInList (entry.parameters (), parmEntry.name ())) - entry.addParameter (parmEntry); - } // paramDcl - - /** - * - **/ - private void paramAttribute (ParameterEntry entry) throws IOException, ParseException - { - if (token.type == Token.In) - { - entry.passType (ParameterEntry.In); - match (Token.In); - } - else if (token.type == Token.Out) - { - entry.passType (ParameterEntry.Out); - match (Token.Out); - } - else if (token.type == Token.Inout) - { - entry.passType (ParameterEntry.Inout); - match (Token.Inout); - } - else - throw ParseException.syntaxError (scanner, new int [] { - Token.In, Token.Out, Token.Inout }, token.type); - } // paramAttribute - - /** - * - **/ - private void raisesExpr (MethodEntry entry) throws IOException, ParseException - { - match (Token.Raises); - match (Token.LeftParen); - // Comment must immediately precede for exception - Comment tempComment = token.comment; - SymtabEntry exception = scopedName(entry.container (), stFactory.exceptionEntry ()); - if (typeOf (exception) instanceof ExceptionEntry) - { - // Comment must immediately precede for exception - exception.comment (tempComment); - if (isntInList (entry.exceptions (), exception)) - entry.exceptionsAddElement ((ExceptionEntry) exception); - } - else - ParseException.wrongType (scanner, exception.fullName(), - "exception", entryName (exception.type ())); - raisesExpr2 (entry); - match (Token.RightParen); - } // raisesExpr - - /** - * - **/ - private void raisesExpr2 (MethodEntry entry) throws IOException, ParseException - { - while (token.type == Token.Comma) - { - match (Token.Comma); - // Comment must immediately precede of exception - Comment tempComment = token.comment; - SymtabEntry exception = scopedName (entry.container (), stFactory.exceptionEntry ()); - if (typeOf (exception) instanceof ExceptionEntry) - { - // Comment must immediately precede of exception - exception.comment (tempComment); - if (isntInList (entry.exceptions (), exception)) - entry.addException ((ExceptionEntry)exception); - } - else - ParseException.wrongType (scanner, exception.fullName (), - "exception", entryName (exception.type ())); - } - } // raisesExpr2 - - /** - * - **/ - private void contextExpr (MethodEntry entry) throws IOException, ParseException - { - match (Token.Context); - match (Token.LeftParen); - String stringLit = (String)stringLiteral ().value (); - if (isntInStringList (entry.contexts (), stringLit)) - entry.addContext (stringLit); - contextExpr2 (entry); - match (Token.RightParen); - } // contextExpr - - - private void contextExpr2 (MethodEntry entry) throws IOException, ParseException - { - while (token.type == Token.Comma) - { - match (Token.Comma); - String stringLit = (String)stringLiteral ().value (); - if (isntInStringList (entry.contexts (), stringLit)) - entry.addContext (stringLit); - } - } // contextExpr2 - - /** - * - **/ - private SymtabEntry paramTypeSpec (SymtabEntry entry) throws IOException, ParseException - { - SymtabEntry ret = null; - switch (token.type) - { - case Token.Float: - case Token.Double: - case Token.Long: - case Token.Short: - case Token.Unsigned: - case Token.Char: - case Token.Wchar: - case Token.Boolean: - case Token.Octet: - case Token.Any: - return baseTypeSpec (entry); - case Token.String: - case Token.Wstring: - return stringType (entry); - case Token.Identifier: - case Token.Object: - // - case Token.ValueBase: - case Token.DoubleColon: - ret = scopedName (entry.container (), stFactory.primitiveEntry ()); - if (typeOf (ret) instanceof AttributeEntry) - //ParseException.attributeParamType (scanner); - ParseException.attributeNotType (scanner, ret.name ()); - else // - if (typeOf (ret) instanceof MethodEntry) - ParseException.operationNotType (scanner, ret.name ()); - - //if (!(returnType instanceof PrimitiveEntry || - // returnType instanceof StringEntry)) - //ParseException.wrongType (scanner, ret.fullName(), - // "primitive or string", entryName (ret.type())); - break; - default: - throw ParseException.syntaxError (scanner, new int [] { - Token.Float, Token.Double, Token.Long, Token.Short, - Token.Unsigned, Token.Char, Token.Wchar, Token.Boolean, - Token.Octet, Token.Any, Token.String, Token.Wstring, - Token.Identifier, Token.DoubleColon, Token.ValueBase }, token.type); - } - return ret; - } // paramTypeSpec - - /** - * - **/ - private void match (int type) throws IOException, ParseException - { - ParseException exception = null; - if (!token.equals (type)) - { - exception = ParseException.syntaxError (scanner, type, token.type); - // Missing a semicolon is a common error. If a semicolon was expected, - // assume it exists and keep the current token (don't get the next one). - // BEWARE!!! THIS HAS THE POTENTIAL FOR AN INFINITE LOOP! - if (type == Token.Semicolon) - return; - } - // Unecessary due to new valueElement() algorithm. - //if (!tokenStack.empty()) - //{ - // token = (Token)tokenStack.pop (); - // return; - //} - - // Fetch the next token. - token = scanner.getToken (); - - // Issue warnings about tokens. - issueTokenWarnings (); - - // Maintain history of most recent tokens. - tokenHistory.insert (token); - - // Identifiers that collide with keywords are illegal. Note - // that escaped identifers never collide! - /* - if (token.collidesWithKeyword ()) - { - // Issue a warning only - if (corbaLevel <= 2.2f) - ParseException.keywordCollisionWarning (scanner, token.name); - else - exception = ParseException.keywordCollision (scanner, token.name); - } - */ - - while (token.isDirective ()) - token = prep.process (token); - - // If the token is a defined thingy, scan the defined string - // instead of the input stream for a while. - if (token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier)) - { - String string = (String)symbols.get (token.name); - if (string != null && !string.equals ("")) - { - // If this is a macro, parse the macro - if (macros.contains (token.name)) - { - scanner.scanString (prep.expandMacro (string, token)); - match (token.type); - } - else // This is just a normal define. - { - scanner.scanString (string); - match (token.type); - } - } - } - if (exception != null) - throw exception; - } // match - - // - /** - * Issue warnings according to attributes of current Token. - **/ - private void issueTokenWarnings () - { - if (noWarn) - return; - - if ((token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier)) - && !token.isEscaped ()) - { - // Identifier collision with keyword in another release. - // Identifier collision with keyword in letter, but not in case. - if (token.collidesWithKeyword ()) - ParseException.warning (scanner, Util.getMessage ("Migration.keywordCollision", token.name)); - } - // Deprecated keyword. - if (token.isKeyword () && token.isDeprecated ()) - ParseException.warning (scanner, Util.getMessage ("Deprecated.keyword", token.toString ())); - } // issueTokenWarnings - - /** - * - **/ - private ModuleEntry newModule (ModuleEntry oldEntry) - { - ModuleEntry entry = stFactory.moduleEntry (oldEntry, (IDLID)repIDStack.peek ()); - entry.sourceFile (scanner.fileEntry ()); - entry.name (token.name); - // If this named module already exists, just reopen it. - /* <46082.46.01> if cppModule, always create new module entry */ - SymtabEntry prevEntry = (SymtabEntry) symbolTable.get (entry.fullName ()); - if (!cppModule && prevEntry != null && prevEntry instanceof ModuleEntry) - { - // A module has been reopened, return that ModuleEntry. - entry = (ModuleEntry) prevEntry; - if (oldEntry == topLevelModule) - { - // Do a little checking: - if (!entry.emit ()) - // The entry module is being reopened to put new stuff into it. - // The module itself is not marked as "emit", but the new stuff - // may be, so put the module on the emitList (add it to topLevelModule). - addToContainer (oldEntry, entry); - else if (!oldEntry.contained().contains (entry)) - // The entry module being reopened is to be emitted, but - // will not be placed on the emitList! I.E., it was not added to - // topLevelModule. Occurs when a generator manually inserts - // ModuleEntrys into the symbol table (e.g., org; see preParse() - // in ...idl.toJava.Compile). - addToContainer (oldEntry, entry); - } - } - else - pigeonhole (oldEntry, entry); - return entry; - } // newModule - - /** - * - **/ - private EnumEntry newEnumEntry (SymtabEntry oldEntry) - { - EnumEntry entry = stFactory.enumEntry (oldEntry, (IDLID)repIDStack.peek ()); - entry.sourceFile (scanner.fileEntry ()); - entry.name (token.name); - pigeonhole (oldEntry, entry); - return entry; - } // newEnumEntry - - /** - * - **/ - private SequenceEntry newSequenceEntry (SymtabEntry oldEntry) - { - SequenceEntry entry = stFactory.sequenceEntry (oldEntry, (IDLID)repIDStack.peek ()); - entry.sourceFile (scanner.fileEntry ()); - entry.name (""); - pigeonhole (oldEntry, entry); - return entry; - } // newSequenceEntry - - private void updateSymbolTable( String fullName, SymtabEntry entry, boolean lcCheck ) - { - // Check for case-insensitive collision (IDL error). - String lcFullName = fullName.toLowerCase(); - if (lcCheck) - if (lcSymbolTable.get (lcFullName) != null) { - ParseException.alreadyDeclared (scanner, fullName); - } - symbolTable.put (fullName, entry); - lcSymbolTable.put (lcFullName, entry); - // Allow fully-qualified CORBA types to be resolved by mapping - // short name (e.g., CORBA/StringValue) to long name, actual name. - String omgPrefix = "org/omg/CORBA" ; - if (fullName.startsWith (omgPrefix)) { - overrideNames.put ( - "CORBA" + fullName.substring (omgPrefix.length()), fullName); - } - } - - private void pigeonhole (SymtabEntry container, SymtabEntry entry) - { - if (entry.name().equals ("")) - entry.name (unknownNamePrefix + ++sequence); - - // If this object is not in the overrides list, then it is - // ok to put it in the table (if it IS in the overrides list, - // it is already in the table under a different name). - String fullName = entry.fullName(); - if (overrideNames.get (fullName) == null) { - addToContainer (container, entry); - - // It is an error is this name already exists in the symbol - // table, unless this is a redefinition of a forward decl. - // Re-opening a module is also legal, but not handled here. - SymtabEntry oldEntry = (SymtabEntry) symbolTable.get (fullName); - - if (oldEntry == null) { - updateSymbolTable( fullName, entry, true ) ; - } else if (oldEntry instanceof ForwardEntry && - entry instanceof InterfaceEntry) { - - String repIDPrefix = ((IDLID)entry.repositoryID ()).prefix (); - String oldRepIDPrefix = ((IDLID)oldEntry.repositoryID ()).prefix (); - if (repIDPrefix.equals (oldRepIDPrefix)) { - updateSymbolTable( fullName, entry, false ) ; - } else { - ParseException.badRepIDPrefix (scanner, fullName, - oldRepIDPrefix, repIDPrefix); - } - } else if (entry instanceof ForwardEntry && - (oldEntry instanceof InterfaceEntry || - oldEntry instanceof ForwardEntry)) { - if (oldEntry instanceof ForwardEntry && - entry.repositoryID () instanceof IDLID && - oldEntry.repositoryID () instanceof IDLID) { - - String repIDPrefix = - ((IDLID)entry.repositoryID ()).prefix (); - String oldRepIDPrefix = - ((IDLID)oldEntry.repositoryID ()).prefix (); - - if (!(repIDPrefix.equals (oldRepIDPrefix))) { - // Disallow multiple ForwardEntry's having same Repository - // ID prefixes (CORBA 2.3). - ParseException.badRepIDPrefix (scanner, fullName, - oldRepIDPrefix, repIDPrefix); - } - } - } else if (cppModule && entry instanceof ModuleEntry && - oldEntry instanceof ModuleEntry) { - // Allow multiple ModuleEntrys when user submits - // the -cppModule flag. - } else if (fullName.startsWith ("org/omg/CORBA") || - fullName.startsWith ("CORBA")) { - // Ignore CORBA PIDL types entered at preParse() by generator. - } else if (isForwardable( oldEntry, entry )) { - // Both oldEntry and entry are structs or unions. - // Legality depends on isReferencable on the two entries: - // oldEntry Entry - // T T ERROR alreadyDeclared - // T F legal fwd decl - // F T if defined in same file legal, - // otherwise ERROR - // F F legal fwd decl - if (oldEntry.isReferencable() && entry.isReferencable()) - ParseException.alreadyDeclared (scanner, fullName); - - if (entry.isReferencable()) { - String firstFile = - oldEntry.sourceFile().absFilename() ; - String defFile = - entry.sourceFile().absFilename() ; - if (!firstFile.equals( defFile )) - ParseException.declNotInSameFile( scanner, - fullName, firstFile ) ; - else { - updateSymbolTable( fullName, entry, false ) ; - - List oldRefList ; - - try { - oldRefList = (List)oldEntry.dynamicVariable( - ftlKey ) ; - } catch (NoSuchFieldException exc) { - throw new IllegalStateException() ; - } - - if (oldRefList != null) { - // Update entries in backpatch list - Iterator iter = oldRefList.iterator() ; - while (iter.hasNext()) { - SymtabEntry elem = (SymtabEntry)iter.next() ; - elem.type( entry ) ; - } - } - } - } - } else { - ParseException.alreadyDeclared (scanner, fullName); - } - } - } // pigeonhole - - private boolean isForwardable( SymtabEntry oldEntry, - SymtabEntry entry ) - { - return ((oldEntry instanceof StructEntry) && - (entry instanceof StructEntry)) || - ((oldEntry instanceof UnionEntry) && - (entry instanceof UnionEntry)) ; - } - - // pigeonhole checks to see if this entry is already in the symbol - // table and generates an error if it is. Methods must be checked - // not only against the symbol table but also against their - // interface's parent's methods. This is done in InterfaceEntry. - // verifyMethod, so no checking need be done here. - - /** - * - **/ - private void pigeonholeMethod (InterfaceEntry container, MethodEntry entry) - { - if (entry.name ().equals ("")) - entry.name (unknownNamePrefix + ++sequence); - - // If this object is not in the overrides list, then it is - // ok to put it in the table (if it IS in the overrides list, - // it is already in the table under a different name). - String fullName = entry.fullName (); - if (overrideNames.get (fullName) == null) - { - addToContainer (container, entry); - String lcFullName = fullName.toLowerCase (); - symbolTable.put (fullName, entry); - lcSymbolTable.put (lcFullName, entry); - // Allow fully-qualified CORBA types to be resolved by mapping - // short name (e.g., CORBA/StringValue) to long name, actual name. - if (fullName.startsWith ("org/omg/CORBA")) - overrideNames.put ("CORBA" + fullName.substring (13), fullName); - } - } // pigeonholeMethod - - /** - * - **/ - private void addToContainer (SymtabEntry container, SymtabEntry contained) - { - if (container instanceof ModuleEntry) - ((ModuleEntry)container).addContained (contained); - else if (container instanceof InterfaceEntry) - ((InterfaceEntry)container).addContained (contained); - else if (container instanceof StructEntry) - ((StructEntry)container).addContained (contained); - else if (container instanceof UnionEntry) - ((UnionEntry)container).addContained (contained); - else if (container instanceof SequenceEntry) - ((SequenceEntry)container).addContained (contained); - } // addToContainer - - // NOTE: qualifiedEntry/partlyQualifiedEntry/unqualifiedEntry and - // their court could probably use some performance improvements, - // but I'm scared to touch anything. It's the most complex bit of - // code in this parser. - - // The qualified named type is searched for in the following order: - // 1. OverrideNames - // 2. Global scope - // 3. Inheritance scope (if container is an interface) - // A qualified name is one which begins with :: or is assumed to be - // in the global scope (like long, short, etc). - - /** - * - **/ - SymtabEntry qualifiedEntry (String typeName) - { - SymtabEntry type = recursiveQualifiedEntry (typeName); - if (type == null) - // Then it's not anywhere, report the error. - ParseException.undeclaredType (scanner, typeName); - - // Relax this retriction when parsing ID pragma directive, e.g.. - //else if (type instanceof ModuleEntry) { - else if (type instanceof ModuleEntry && !_isModuleLegalType) - { - // Module's are not valid types. - ParseException.moduleNotType (scanner, typeName); - type = null; - } - return type; - } // qualifiedEntry - - /** - * - **/ - SymtabEntry recursiveQualifiedEntry (String typeName) - { - SymtabEntry type = null; - if (typeName != null && !typeName.equals ("void")) - { - int index = typeName.lastIndexOf ('/'); - if (index >= 0) - { - // Figure out if the container of this thing exists, converting any typedefs to interfaces if necessary. - type = recursiveQualifiedEntry (typeName.substring (0, index)); - if (type == null) - return null; - else if (type instanceof TypedefEntry) - typeName = typeOf (type).fullName () + typeName.substring (index); - } - - // If we got this far, a container exists, start over looking - // for the thing itself (this is the meat of the method): - type = searchOverrideNames (typeName); - if (type == null) - type = (SymtabEntry) symbolTable.get (typeName); // search global scope: - if (type == null) - type = searchGlobalInheritanceScope (typeName); - } - return type; - } // recursiveQualifiedEntry - - // A partially qualified name is of the form ::. - // First the scope is defined (meaning it is fully qualified); - // Then the name is searched for in the scope. - - /** - * - **/ - SymtabEntry partlyQualifiedEntry (String typeName, SymtabEntry container) - { - // This is the simple logic of this method: - // type = searchModuleScope (typeName.substring (0, typeName.lastIndexOf ('/')), container); - // type = qualifiedEntry (type.fullName () + typeName.substring (typeName.lastIndexOf ('/'))); - // But searchModuleScope only finds the first module that fits. - // The name might not be in that module but in one further out - // in the module scope. Should others be searched? - SymtabEntry type = null; - if (typeName != null) - { - int index = typeName.lastIndexOf ('/'); - - // Figure out if the container of this thing exists, converting any - // typedefs to interfaces if necessary: - type = recursivePQEntry (typeName.substring (0, index), container); - if (type instanceof TypedefEntry) - typeName = typeOf (type).fullName () + typeName.substring (index); - - // If we got this far, a container exists, start over looking - // for the thing itself. - - if (container != null) - type = searchModuleScope (typeName.substring (0, typeName.lastIndexOf ('/')), container); - if (type == null) - type = qualifiedEntry (typeName); - else - type = qualifiedEntry (type.fullName () + typeName.substring (typeName.lastIndexOf ('/'))); - } - return type; - } // partlyQualifiedEntry - - // partlyQualifiedEntry and recursivePQEntry are almost identical. - // They are different because when the recursive one is looking for - // the existence of containers, the error check for a module type - // must not occur (this check is done in qualifiedEntry). Only - // when the full partly qualified name is being processed must this - // check be performed. - - /** - * - **/ - SymtabEntry recursivePQEntry (String typeName, SymtabEntry container) - { - SymtabEntry type = null; - if (typeName != null) - { - int index = typeName.lastIndexOf ('/'); - if (index < 0) - type = searchModuleScope (typeName, container); - else - { - // Figure out if the container of this thing exists, converting any - // typedefs to interfaces if necessary: - type = recursivePQEntry (typeName.substring (0, index), container); - if (type == null) - return null; - else if (type instanceof TypedefEntry) - typeName = typeOf (type).fullName () + typeName.substring (index); - - // If we got this far, a container exists, start over, looking - // for the thing itself (This is the meat of the method): - if (container != null) - type = searchModuleScope (typeName.substring (0, typeName.lastIndexOf ('/')), container); - if (type == null) - recursiveQualifiedEntry (typeName); - else - type = recursiveQualifiedEntry (type.fullName () + typeName.substring (typeName.lastIndexOf ('/'))); - } - } - return type; - } // recursivePQEntry - - // The named type is searched for in the following order: - // 1. Local scope - // 2. Inheritance scope - // 3. OverrideNames - // 4. Module scope - - /** - * - **/ - SymtabEntry unqualifiedEntry (String typeName, SymtabEntry container) - { - SymtabEntry type = unqualifiedEntryWMod (typeName, container); - - // Relax this retriction in special cases, e.g., when - // parsing a ID pragma directive. - //if (type instanceof ModuleEntry) { - if (type instanceof ModuleEntry && !_isModuleLegalType) - { - // Module's are not valid types: - ParseException.moduleNotType (scanner, typeName); - type = null; - } - return type; - } // unqualifiedEntry - - /** - * - **/ - SymtabEntry unqualifiedEntryWMod (String typeName, SymtabEntry container) - { - SymtabEntry type = null; - if ((typeName != null) && !typeName.equals ("void")) - { - // Search local scope: - type = (SymtabEntry)symbolTable.get (container.fullName () + '/' + typeName); - if (type == null) - type = searchLocalInheritanceScope (typeName, container); - if (type == null) - type = searchOverrideNames (typeName); - if ((type == null) && (container != null)) - type = searchModuleScope (typeName, container); - if (type == null) - type = searchParentInheritanceScope (typeName, container); - } - if (type == null) - // Then it's not anywhere, report the error: - ParseException.undeclaredType (scanner, typeName); - return type; - } // unqualifiedEntryWMod - - /** - * Walks up the enclosing scopes until it finds an interface type. Then, - * searches up that interface inheritance tree for the type definition. - * - * @param name type name to be searched for. - * @param ptype parent type entry. - **/ - SymtabEntry searchParentInheritanceScope(String name, SymtabEntry ptype) { - - String cname = ptype.fullName(); - - while ((ptype != null) && !(cname.equals ("")) && - !(ptype instanceof InterfaceEntry)) { - int index = cname.lastIndexOf ('/'); - if (index < 0) { - cname = ""; - } else { - cname = cname.substring (0, index); - ptype = (SymtabEntry) symbolTable.get(cname); - } - } - - if ((ptype == null) || !(ptype instanceof InterfaceEntry)) { - return null; // could not find an enclosing interface type - give up. - } - - // check if the enclosing interface supports the type definition. - String fullName = ptype.fullName () + '/' + name; - SymtabEntry type = (SymtabEntry) symbolTable.get (fullName); - if (type != null) { - return type; // found type definition. - } - - // search up the interface inheritance tree. - return searchLocalInheritanceScope(name, ptype); - } - - /** - * - **/ - SymtabEntry searchGlobalInheritanceScope (String name) - { - // See if the container of this named object is an interface: - int index = name.lastIndexOf ('/'); - SymtabEntry entry = null; - if (index >= 0) - { - String containerName = name.substring (0, index); - entry = (SymtabEntry)symbolTable.get (containerName); - entry = (entry instanceof InterfaceEntry) - // It's an interface, now look in its inheritance scope: - ? searchLocalInheritanceScope (name.substring (index + 1), entry) - : null; - } - return entry; - } // searchGlobalInheritanceScope - - /** - * - **/ - SymtabEntry searchLocalInheritanceScope (String name, SymtabEntry container) - { - return (container instanceof InterfaceEntry) - ? searchDerivedFrom (name, (InterfaceEntry) container) - : null; - } // searchLocalInheritanceScope - - /** - * - **/ - SymtabEntry searchOverrideNames (String name) - { - String overrideName = (String)overrideNames.get (name); - return (overrideName != null) - ? (SymtabEntry)symbolTable.get (overrideName) - : null; - } // searchOverrideNames - - /** - * - **/ - SymtabEntry searchModuleScope (String name, SymtabEntry container) - { - String module = container.fullName (); - String fullName = module + '/' + name; - SymtabEntry type = (SymtabEntry)symbolTable.get (fullName); - while ((type == null) && !module.equals ("")) - { - int index = module.lastIndexOf ('/'); - if (index < 0) - module = ""; - else - { - module = module.substring (0, index); - fullName = module + '/' + name; - type = (SymtabEntry)symbolTable.get (fullName); - } - } - return (type == null) ? (SymtabEntry)symbolTable.get (name) : type; - } // searchModuleScope - - /** - * - **/ - SymtabEntry searchDerivedFrom (String name, InterfaceEntry i) - { - for (Enumeration e = i.derivedFrom ().elements (); e.hasMoreElements ();) - { - SymtabEntry tmp = (SymtabEntry)e.nextElement (); - if (tmp instanceof InterfaceEntry) - { - InterfaceEntry parent = (InterfaceEntry)tmp; - String fullName = parent.fullName () + '/' + name; - SymtabEntry type = (SymtabEntry)symbolTable.get (fullName); - if (type != null) - return type; - type = searchDerivedFrom (name, parent); - if (type != null) - return type; - } - // else it is a ForwardEntry and nothing can be done at this point. - } - return null; - } // searchDerivedFrom - - /** - * - **/ - String entryName (SymtabEntry entry) - { - if (entry instanceof AttributeEntry) - return "attribute"; - if (entry instanceof ConstEntry) - return "constant"; - if (entry instanceof EnumEntry) - return "enumeration"; - if (entry instanceof ExceptionEntry) - return "exception"; - if (entry instanceof ValueBoxEntry) - return "value box"; - if (entry instanceof ForwardValueEntry || entry instanceof ValueEntry) - return "value"; - if (entry instanceof ForwardEntry || entry instanceof InterfaceEntry) - return "interface"; - if (entry instanceof MethodEntry) - return "method"; - if (entry instanceof ModuleEntry) - return "module"; - if (entry instanceof ParameterEntry) - return "parameter"; - if (entry instanceof PrimitiveEntry) - return "primitive"; - if (entry instanceof SequenceEntry) - return "sequence"; - if (entry instanceof StringEntry) - return "string"; - if (entry instanceof StructEntry) - return "struct"; - if (entry instanceof TypedefEntry) - return "typedef"; - if (entry instanceof UnionEntry) - return "union"; - return "void"; - } // entryName - - /** - * - **/ - private boolean isInterface (SymtabEntry entry) - { - return entry instanceof InterfaceEntry || (entry instanceof ForwardEntry - && !(entry instanceof ForwardValueEntry)) ; - } - - private boolean isValue (SymtabEntry entry) - { - return entry instanceof ValueEntry ; // || entry instanceof ForwardValueEntry; - } - - private boolean isInterfaceOnly (SymtabEntry entry) - { - return entry instanceof InterfaceEntry ; - } - - private boolean isForward(SymtabEntry entry) - { - return entry instanceof ForwardEntry ; - } - - // list must be a vector of Strings. - /** - * - **/ - private boolean isntInStringList (Vector list, String name) - { - boolean isnt = true; - Enumeration e = list.elements (); - while (e.hasMoreElements ()) - if (name.equals ((String)e.nextElement ())) - { - ParseException.alreadyDeclared (scanner, name); - isnt = false; - break; - } - return isnt; - } // isntInStringList - - // list must be a vector of SymtabEntry's. - /** - * - **/ - private boolean isntInList (Vector list, String name) - { - boolean isnt = true; - for (Enumeration e = list.elements (); e.hasMoreElements ();) - if (name.equals (((SymtabEntry)e.nextElement ()).name ())) - { - ParseException.alreadyDeclared (scanner, name); - isnt = false; - break; - } - return isnt; - } // isntInList - - // list must be a vector of SymtabEntry's. - /** - * - **/ - private boolean isntInList (Vector list, SymtabEntry entry) - { - boolean isnt = true; - for (Enumeration e = list.elements (); e.hasMoreElements ();) - { - SymtabEntry eEntry = (SymtabEntry)e.nextElement (); - if (entry == eEntry) // && entry.fullName().equals (eEntry.fullName())) - { - ParseException.alreadyDeclared (scanner, entry.fullName ()); - isnt = false; - break; - } - } - return isnt; - } // isntInList - - /** - * - **/ - public static SymtabEntry typeOf (SymtabEntry entry) - { - while (entry instanceof TypedefEntry) - entry = entry.type (); - return entry; - } // typeOf - - /** - * - **/ - void forwardEntryCheck () - { - for (Enumeration e = symbolTable.elements (); e.hasMoreElements ();) - { - SymtabEntry entry = (SymtabEntry)e.nextElement (); - if (entry instanceof ForwardEntry) - ParseException.forwardEntry (scanner, entry.fullName ()); - } - } // forwardEntryCheck - - // <46082.03> Revert to "IDL:"-style (i.e., regular) repository ID. - /* - void updateRepositoryIds () { - for (Enumeration e = symbolTable.elements(); e.hasMoreElements();) { - SymtabEntry entry = (SymtabEntry) e.nextElement(); - if (entry instanceof ValueEntry) - ((ValueEntry) entry).calcRepId(); - } - } // updateRepositoryIds - */ - - //////////////////// - // Error Handling Methods - - // A syntax error occurred. Skip until a semicolon is encountered. - // Ignore semicolons within {...} blocks - /** - * - **/ - private void skipToSemicolon () throws IOException - { - while (!token.equals (Token.EOF) && !token.equals (Token.Semicolon)) - { - if (token.equals (Token.LeftBrace)) - skipToRightBrace(); - try - { - match (token.type); - } - catch (ParseException exception) - { - // The error has already been reported... - } - } - if (token.equals (Token.EOF)) - throw new EOFException (); - try - { - match (Token.Semicolon); - } - catch (Exception exception) - { - } - } // skipToSemicolon - - /** - * - **/ - private void skipToRightBrace () throws IOException - { - boolean firstTime = true; - while (!token.equals (Token.EOF) && !token.equals (Token.RightBrace)) - { - if (firstTime) - firstTime = false; - else if (token.equals (Token.LeftBrace)) - skipToRightBrace (); - try - { - match (token.type); - } - catch (ParseException exception) - { - // The error has already been reported... - } - } - if (token.equals (Token.EOF)) - throw new EOFException(); - } // skipToRightBrace - - // Error Handling Methods - //////////////////// - - // In CORBA 2.3, an IDL file provides a new scope for Repository IDs. - // The following methods provide a means for other classes in the framework - // to manage this scoping (see Preprocessor and Scanner). - - // public static int nPush = 0; - // public static int nPop = 0; - - /** - * - **/ - public static void enteringInclude () - { - repIDStack.push (new IDLID ()); - } // enteringInclude - - /** - * - **/ - public static void exitingInclude () - { - repIDStack.pop (); - } // exitingInclude - - - public static final String unknownNamePrefix = "uN__"; - - static Hashtable symbolTable; - Hashtable lcSymbolTable = new Hashtable (); - static Hashtable overrideNames; - Vector emitList = new Vector (); - boolean emitAll; - // - boolean cppModule; - // - boolean noWarn; - Scanner scanner; - // No longer necessary due to new valueElement() algorithm. - // Stack tokenStack = new Stack(); - Hashtable symbols; - Vector macros = new Vector (); - Vector paths; - - // Only needed for the pragma directive - SymtabEntry currentModule = null; - - // Static field necessary to allow Scanner access to enterind/exiting - // Include() methods. Must reset in Compile class, too! - // Stack repIDStack = new Stack (); - static Stack repIDStack = new Stack (); - - // Dynamic variable key used for forward type lists. - // A struct or union X entry may have this attached, - // which always contains a List. - // The elements are entries E such that E.type() == X. - // This list must be resolved in pigeonhole when the - // type is finally defined. This is similar to - // ForwardEntry.replaceForwardDecl. - private static int ftlKey = SymtabEntry.getVariableKey() ; - - int sequence = 0; - Vector includes; - Vector includeEntries; - - // Only needed in primaryExpr. Set in Preprocessor.booleanConstExpr. - boolean parsingConditionalExpr = false; - - Token token; - ModuleEntry topLevelModule; - private Preprocessor prep; - private boolean verbose; - SymtabFactory stFactory; - ExprFactory exprFactory; - private String[] keywords; - // Remove -stateful feature. - //private boolean parseStateful = false; - - // Circular buffer containing most recent tokens, including the current token. - private TokenBuffer tokenHistory = new TokenBuffer (); - protected float corbaLevel; // - private Arguments arguments; - -} // class Parser --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaEntry.java 2018-01-30 20:24:44.000000000 -0500 +++ /dev/null 2018-01-30 20:24:44.000000000 -0500 @@ -1,103 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -/** - * This is the symbol table entry for the #pragma statement. - **/ -public class PragmaEntry extends SymtabEntry -{ - protected PragmaEntry () - { - super (); - repositoryID (Util.emptyID); - } // ctor - - protected PragmaEntry (SymtabEntry that) - { - super (that, new IDLID ()); - module (that.name ()); - name (""); - } // ctor - - protected PragmaEntry (PragmaEntry that) - { - super (that); - } // ctor - - public Object clone () - { - return new PragmaEntry (this); - } // clone - - /** Invoke the Include type generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - pragmaGen.generate (symbolTable, this, stream); - } // generate - - /** Access the Include type generator. - @return an object which implements the IncludeGen interface. - @see IncludeGen */ - public Generator generator () - { - return pragmaGen; - } // generator - - public String data () - { - return _data; - } // data - - public void data (String newData) - { - _data = newData; - } // data - - static PragmaGen pragmaGen; - - private String _data = null; -} // class PragmaEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaGen.java 2018-01-30 20:24:44.000000000 -0500 +++ /dev/null 2018-01-30 20:24:44.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface PragmaGen extends Generator -{ - void generate (Hashtable symbolTable, PragmaEntry entry, PrintWriter stream); -} // interface PragmaGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaHandler.java 2018-01-30 20:24:45.000000000 -0500 +++ /dev/null 2018-01-30 20:24:45.000000000 -0500 @@ -1,148 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// - Add openScope and closeScope. - -import java.io.IOException; - -public abstract class PragmaHandler -{ - public abstract boolean process (String pragma, String currentToken) throws IOException; - - void init (Preprocessor p) - { - preprocessor = p; - } // init - - // Utility methods. - - /** Get the current token. */ - protected String currentToken () - { - return preprocessor.currentToken (); - } // currentToken - - /** This method, given an entry name, returns the entry with that name. - It can take fully or partially qualified names and returns the - appropriate entry defined within the current scope. If no entry - exists, null is returned. */ - protected SymtabEntry getEntryForName (String string) - { - return preprocessor.getEntryForName (string); - } // getEntryForName - - /** This method returns a string of all of the characters from the input - file from the current position up to, but not including, the end-of-line - character(s). */ - protected String getStringToEOL () throws IOException - { - return preprocessor.getStringToEOL (); - } // getStringToEOL - - /** This method returns a string of all of the characters from the input - file from the current position up to, but not including, the given - character. It encapsulates parenthesis and quoted strings, meaning - it does not stop if the given character is found within parentheses - or quotes. For instance, given the input of `start(inside)end', - getUntil ('n') will return "start(inside)e" */ - protected String getUntil (char c) throws IOException - { - return preprocessor.getUntil (c); - } // getUntil - - /** This method returns the next token String from the input file. */ - protected String nextToken () throws IOException - { - return preprocessor.nextToken (); - } // nextToken - - /** This method assumes that the current token marks the beginning - of a scoped name. It then parses the subsequent identifier and - double colon tokens, builds the scoped name, and finds the symbol - table entry with that name. */ - protected SymtabEntry scopedName () throws IOException - { - return preprocessor.scopedName (); - } // scopedName - - /** Skip to the end of the line. */ - protected void skipToEOL () throws IOException - { - preprocessor.skipToEOL (); - } // skipToEOL - - /** This method skips the data in the input file until the specified - character is encountered, then it returns the next token. */ - protected String skipUntil (char c) throws IOException - { - return preprocessor.skipUntil (c); - } // skipUntil - - /** This method displays a Parser Exception complete with line number - and position information with the given message string. */ - protected void parseException (String message) - { - preprocessor.parseException (message); - } // parseException - - /** This method is called when the parser encounters a left curly brace. - An extender of PragmaHandler may find scope information useful. - For example, the prefix pragma takes effect as soon as it is - encountered and stays in effect until the current scope is closed. - If a similar pragma extension is desired, then the openScope and - closeScope methods are available for overriding. - @param entry the symbol table entry whose scope has just been opened. - Be aware that, since the scope has just been entered, this entry is - incomplete at this point. */ - protected void openScope (SymtabEntry entry) - { - } // openScope - - /** This method is called when the parser encounters a right curly brace. - An extender of PragmaHandler may find scope information useful. - For example, the prefix pragma takes effect as soon as it is - encountered and stays in effect until the current scope is closed. - If a similar pragma extension is desired, then the openScope and - closeScope methods are available for overriding. - @param entry the symbol table entry whose scope has just been closed. */ - protected void closeScope (SymtabEntry entry) - { - } // closeScope - - private Preprocessor preprocessor = null; -} // class PragmaHandler --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Preprocessor.java 2018-01-30 20:24:46.000000000 -0500 +++ /dev/null 2018-01-30 20:24:46.000000000 -0500 @@ -1,1431 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -D57110 Allow ID pragma directive to be applied to modules and update -// feature in accordance to CORBA 2.3. -// -D59165 Enable escaped identifiers when processing pragmas. -// -f60858.1 Support -corba option, level = 2.2: Accept identifiers that -// collide with keywords, in letter but not case, and issue a warning. -// -d62023 support -noWarn option; suppress inappropriate warnings when -// parsing IBM-specific pragmas (#meta abstract). - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.math.BigInteger; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Stack; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.RepositoryID; - -import com.sun.tools.corba.se.idl.constExpr.*; - -/** - * This class should be extended if new pragmas are desired. If the - * preprocessor encounters a pragma name which it doesn't recognize - * (anything other than ID, prefix, or version), it calls the method - * otherPragmas. This is the only method which need be overridden. - * The Preprocessor base class has a number of utility-like methods - * which can be used by the overridden otherPragmas method. - **/ -public class Preprocessor -{ - /** - * Public zero-argument constructor. - **/ - Preprocessor () - { - } // ctor - - /** - * - **/ - void init (Parser p) - { - parser = p; - symbols = p.symbols; - macros = p.macros; - } // init - - /** - * - **/ - protected Object clone () - { - return new Preprocessor (); - } // clone - - /** - * - **/ - Token process (Token t) throws IOException, ParseException - { - token = t; - scanner = parser.scanner; - // Deactivate escaped identifier processing in Scanner while - // preprocessing. - //scanner.underscoreOK = true; - scanner.escapedOK = false; - try - { - switch (token.type) - { - case Token.Include: - include (); - break; - case Token.If: - ifClause (); - break; - case Token.Ifdef: - ifdef (false); - break; - case Token.Ifndef: - ifdef (true); - break; - case Token.Else: - if (alreadyProcessedABranch.empty ()) - throw ParseException.elseNoIf (scanner); - else if (((Boolean)alreadyProcessedABranch.peek ()).booleanValue ()) - skipToEndif (); - else - { - alreadyProcessedABranch.pop (); - alreadyProcessedABranch.push (new Boolean (true)); - token = scanner.getToken (); - } - break; - case Token.Elif: - elif (); - break; - case Token.Endif: - if (alreadyProcessedABranch.empty ()) - throw ParseException.endNoIf (scanner); - else - { - alreadyProcessedABranch.pop (); - token = scanner.getToken (); - break; - } - case Token.Define: - define (); - break; - case Token.Undef: - undefine (); - break; - case Token.Pragma: - pragma (); - break; - case Token.Unknown: - if (!parser.noWarn) - ParseException.warning (scanner, Util.getMessage ("Preprocessor.unknown", token.name)); - case Token.Error: - case Token.Line: - case Token.Null: - // ignore - default: - scanner.skipLineComment (); - token = scanner.getToken (); - } - } - catch (IOException e) - { - // Underscore may now precede any identifier, so underscoreOK - // is vestigal. The Preprocessor must reset escapedOK so that Scanner - // will process escaped identifiers according to specification. - //scanner.underscoreOK = false; - scanner.escapedOK = true; - throw e; - } - catch (ParseException e) - { - // See above. - //scanner.underscoreOK = false; - scanner.escapedOK = true; - throw e; - } - // See above. - //scanner.underscoreOK = false; - scanner.escapedOK = true; - return token; - } // process - - /** - * - **/ - private void include () throws IOException, ParseException - { - match (Token.Include); - IncludeEntry include = parser.stFactory.includeEntry (parser.currentModule); - include.sourceFile (scanner.fileEntry ()); - scanner.fileEntry ().addInclude (include); - if (token.type == Token.StringLiteral) - include2 (include); - else if (token.type == Token.LessThan) - include3 (include); - else - { - int[] expected = {Token.StringLiteral, Token.LessThan}; - throw ParseException.syntaxError (scanner, expected, token.type); - } - if (parser.currentModule instanceof ModuleEntry) - ((ModuleEntry)parser.currentModule).addContained (include); - else if (parser.currentModule instanceof InterfaceEntry) - ((InterfaceEntry)parser.currentModule).addContained (include); - } // include - - /** - * - **/ - private void include2 (IncludeEntry include) throws IOException, ParseException - { - include.name ('"' + token.name + '"'); - include4 (include, token.name); - match (Token.StringLiteral); - } // include2 - - /** - * - **/ - private void include3 (IncludeEntry include) throws IOException, ParseException - { - if (token.type != Token.LessThan) - // match will throw an exception - match (Token.LessThan); - else - { - try - { - String includeFile = getUntil ('>'); - token = scanner.getToken (); - include.name ('<' + includeFile + '>'); - include4 (include, includeFile); - match (Token.GreaterThan); - } - catch (IOException e) - { - throw ParseException.syntaxError (scanner, ">", "EOF"); - } - } - } // include3 - - /** - * - **/ - private void include4 (IncludeEntry include, String filename) throws IOException, ParseException - { - try - { - // If the #include is at the global scope, it is treated as - // an import statement. If it is within some other scope, it - // is treated as a normal #include. - boolean includeIsImport = parser.currentModule == parser.topLevelModule; - //daz - include.absFilename (Util.getAbsolutePath (filename, parser.paths)); - scanner.scanIncludedFile (include, getFilename (filename), includeIsImport); - } - catch (IOException e) - { - ParseException.generic (scanner, e.toString ()); - } - } // include4 - - /** - * - **/ - private void define () throws IOException, ParseException - { - match (Token.Define); - if (token.equals (Token.Identifier)) - { - String symbol = scanner.getStringToEOL (); - symbols.put (token.name, symbol.trim ()); - match (Token.Identifier); - } - else if (token.equals (Token.MacroIdentifier)) - { - symbols.put (token.name, '(' + scanner.getStringToEOL () . trim ()); - macros.addElement (token.name); - match (Token.MacroIdentifier); - } - else - throw ParseException.syntaxError (scanner, Token.Identifier, token.type); - } // define - - /** - * - **/ - private void undefine () throws IOException, ParseException - { - match (Token.Undef); - if (token.equals (Token.Identifier)) - { - symbols.remove (token.name); - macros.removeElement (token.name); - match (Token.Identifier); - } - else - throw ParseException.syntaxError (scanner, Token.Identifier, token.type); - } // undefine - - /** - * - **/ - private void ifClause () throws IOException, ParseException - { - match (Token.If); - constExpr (); - } // ifClause - - /** - * - **/ - private void constExpr () throws IOException, ParseException - { - SymtabEntry dummyEntry = new SymtabEntry (parser.currentModule); - dummyEntry.container (parser.currentModule); - parser.parsingConditionalExpr = true; - Expression boolExpr = booleanConstExpr (dummyEntry); - parser.parsingConditionalExpr = false; - boolean expr; - if (boolExpr.value () instanceof Boolean) - expr = ((Boolean)boolExpr.value ()).booleanValue (); - else - expr = ((Number)boolExpr.value ()).longValue () != 0; - alreadyProcessedABranch.push (new Boolean (expr)); - if (!expr) - skipToEndiforElse (); - } // constExpr - - /** - * - **/ - Expression booleanConstExpr (SymtabEntry entry) throws IOException, ParseException - { - Expression expr = orExpr (null, entry); - try - { - expr.evaluate (); - } - catch (EvaluationException e) - { - ParseException.evaluationError (scanner, e.toString ()); - } - return expr; - } // booleanConstExpr - - /** - * - **/ - private Expression orExpr (Expression e, SymtabEntry entry) throws IOException, ParseException - { - if (e == null) - e = andExpr (null, entry); - else - { - BinaryExpr b = (BinaryExpr)e; - b.right (andExpr (null, entry)); - e.rep (e.rep () + b.right ().rep ()); - } - if (token.equals (Token.DoubleBar)) - { - match (token.type); - BooleanOr or = parser.exprFactory.booleanOr (e, null); - or.rep (e.rep () + " || "); - return orExpr (or, entry); - } - else - return e; - } // orExpr - - /** - * - **/ - private Expression andExpr (Expression e, SymtabEntry entry) throws IOException, ParseException - { - if (e == null) - e = notExpr (entry); - else - { - BinaryExpr b = (BinaryExpr)e; - b.right (notExpr (entry)); - e.rep (e.rep () + b.right ().rep ()); - } - if (token.equals (Token.DoubleAmpersand)) - { - match (token.type); - BooleanAnd and = parser.exprFactory.booleanAnd (e, null); - and.rep (e.rep () + " && "); - return andExpr (and, entry); - } - else - return e; - } // andExpr - - /** - * - **/ - private Expression notExpr (/*boolean alreadySawExclamation, */SymtabEntry entry) throws IOException, ParseException - { - Expression e; - if (token.equals (Token.Exclamation)) - { - match (Token.Exclamation); - e = parser.exprFactory.booleanNot (definedExpr (entry)); - e.rep ("!" + ((BooleanNot)e).operand ().rep ()); - } - else - e = definedExpr (entry); - return e; - } // notExpr - - /** - * - **/ - private Expression definedExpr (SymtabEntry entry) throws IOException, ParseException - { - if (token.equals (Token.Identifier) && token.name.equals ("defined")) - match (Token.Identifier); - return equalityExpr (null, entry); - } // definedExpr - - /** - * - **/ - private Expression equalityExpr (Expression e, SymtabEntry entry) throws IOException, ParseException - { - if (e == null) - { - parser.token = token; // Since parser to parse, give it this token - e = parser.constExp (entry); - token = parser.token; // Since parser last parsed, get its token - } - else - { - BinaryExpr b = (BinaryExpr)e; - parser.token = token; // Since parser to parse, give it this token - Expression constExpr = parser.constExp (entry); - token = parser.token; // Since parser last parsed, get its token - b.right (constExpr); - e.rep (e.rep () + b.right ().rep ()); - } - if (token.equals (Token.DoubleEqual)) - { - match (token.type); - Equal eq = parser.exprFactory.equal (e, null); - eq.rep (e.rep () + " == "); - return equalityExpr (eq, entry); - } - else if (token.equals (Token.NotEqual)) - { - match (token.type); - NotEqual n = parser.exprFactory.notEqual (e, null); - n.rep (e.rep () + " != "); - return equalityExpr (n, entry); - } - else if (token.equals (Token.GreaterThan)) - { - match (token.type); - GreaterThan g = parser.exprFactory.greaterThan (e, null); - g.rep (e.rep () + " > "); - return equalityExpr (g, entry); - } - else if (token.equals (Token.GreaterEqual)) - { - match (token.type); - GreaterEqual g = parser.exprFactory.greaterEqual (e, null); - g.rep (e.rep () + " >= "); - return equalityExpr (g, entry); - } - else if (token.equals (Token.LessThan)) - { - match (token.type); - LessThan l = parser.exprFactory.lessThan (e, null); - l.rep (e.rep () + " < "); - return equalityExpr (l, entry); - } - else if (token.equals (Token.LessEqual)) - { - match (token.type); - LessEqual l = parser.exprFactory.lessEqual (e, null); - l.rep (e.rep () + " <= "); - return equalityExpr (l, entry); - } - else - return e; - } // equalityExpr - - /** - * - **/ - Expression primaryExpr (SymtabEntry entry) throws IOException, ParseException - { - Expression primary = null; - switch (token.type) - { - case Token.Identifier: - // If an identifier gets this far, it means that no - // preprocessor variable was defined with that name. - // Generate a FALSE boolean expr. - //daz primary = parser.exprFactory.terminal ("0", new Long (0)); - primary = parser.exprFactory.terminal ("0", BigInteger.valueOf (0)); - token = scanner.getToken (); - break; - case Token.BooleanLiteral: - case Token.CharacterLiteral: - case Token.IntegerLiteral: - case Token.FloatingPointLiteral: - case Token.StringLiteral: - //daz primary = parser.literal (); - primary = parser.literal (entry); - token = parser.token; - break; - case Token.LeftParen: - match (Token.LeftParen); - primary = booleanConstExpr (entry); - match (Token.RightParen); - primary.rep ('(' + primary.rep () + ')'); - break; - default: - int[] expected = {Token.Literal, Token.LeftParen}; - throw ParseException.syntaxError (scanner, expected, token.type); - } - return primary; - } // primaryExpr - - /** - * - **/ - private void ifDefine (boolean inParens, boolean not) throws IOException, ParseException - { - if (token.equals (Token.Identifier)) - if ((not && symbols.containsKey (token.name)) || (!not && !symbols.containsKey (token.name))) - { - alreadyProcessedABranch.push (new Boolean (false)); - skipToEndiforElse (); - } - else - { - alreadyProcessedABranch.push (new Boolean (true)); - match (Token.Identifier); - if (inParens) - match (Token.RightParen); - } - else - throw ParseException.syntaxError (scanner, Token.Identifier, token.type); - } // ifDefine - - /** - * - **/ - private void ifdef (boolean not) throws IOException, ParseException - { - if (not) - match (Token.Ifndef); - else - match (Token.Ifdef); - if (token.equals (Token.Identifier)) - if ((not && symbols.containsKey (token.name)) || (!not && !symbols.containsKey (token.name))) - { - alreadyProcessedABranch.push (new Boolean (false)); - skipToEndiforElse (); - } - else - { - alreadyProcessedABranch.push (new Boolean (true)); - match (Token.Identifier); - } - else - throw ParseException.syntaxError (scanner, Token.Identifier, token.type); - } // ifdef - - /** - * - **/ - private void elif () throws IOException, ParseException - { - if (alreadyProcessedABranch.empty ()) - throw ParseException.elseNoIf (scanner); - else if (((Boolean)alreadyProcessedABranch.peek ()).booleanValue ()) - skipToEndif (); - else - { - match (Token.Elif); - constExpr (); - } - } // elif - - /** - * - **/ - private void skipToEndiforElse () throws IOException, ParseException - { - while (!token.equals (Token.Endif) && !token.equals (Token.Else) && !token.equals (Token.Elif)) - { - if (token.equals (Token.Ifdef) || token.equals (Token.Ifndef)) - { - alreadyProcessedABranch.push (new Boolean (true)); - skipToEndif (); - } - else - token = scanner.skipUntil ('#'); - } - process (token); - } // skipToEndiforElse - - /** - * - **/ - private void skipToEndif () throws IOException, ParseException - { - while (!token.equals (Token.Endif)) - { - token = scanner.skipUntil ('#'); - if (token.equals (Token.Ifdef) || token.equals (Token.Ifndef)) - { - alreadyProcessedABranch.push (new Boolean (true)); - skipToEndif (); - } - } - alreadyProcessedABranch.pop (); - match (Token.Endif); - } // skipToEndif - - /////////////// - // For Pragma - - /** - * - **/ - private void pragma () throws IOException, ParseException - { - match (Token.Pragma); - String pragmaType = token.name; - - // Enable escaped identifiers while processing pragma internals. - // Don't enable until scanning pragma name! - scanner.escapedOK = true; - match (Token.Identifier); - - // Add pragma entry to container - PragmaEntry pragmaEntry = parser.stFactory.pragmaEntry (parser.currentModule); - pragmaEntry.name (pragmaType); - pragmaEntry.sourceFile (scanner.fileEntry ()); - pragmaEntry.data (scanner.currentLine ()); - if (parser.currentModule instanceof ModuleEntry) - ((ModuleEntry)parser.currentModule).addContained (pragmaEntry); - else if (parser.currentModule instanceof InterfaceEntry) - ((InterfaceEntry)parser.currentModule).addContained (pragmaEntry); - - // If the token was an identifier, then pragmaType WILL be non-null. - if (pragmaType.equals ("ID")) - idPragma (); - else if (pragmaType.equals ("prefix")) - prefixPragma (); - else if (pragmaType.equals ("version")) - versionPragma (); - - // we are adding extensions to the Sun's idlj compiler to - // handle correct code generation for local Objects, where - // the OMG is taking a long time to formalize stuff. Good - // example of this is poa.idl. Two proprietory pragmas - // sun_local and sun_localservant are defined. sun_local - // generates only Holder and Helper classes, where read - // and write methods throw marshal exceptions. sun_localservant - // is to generate Helper, Holder, and only Skel with _invoke - // throwing an exception, since it does not make sense for - // local objects. - - else if (pragmaType.equals ("sun_local")) - localPragma(); - else if (pragmaType.equals ("sun_localservant")) - localServantPragma(); - else - { - otherPragmas (pragmaType, tokenToString ()); - token = scanner.getToken (); - } - - scanner.escapedOK = false; // Disable escaped identifiers. - } // pragma - - // Pragma ID can be appiled to modules and it is an error to - // name a type in more than one ID pragma directive. - - private Vector PragmaIDs = new Vector (); - - private void localPragma () throws IOException, ParseException - { - // Before I can use a parser method, I must make sure it has the current token. - parser.token = token; - // this makes sense only for interfaces, if specified for modules, - // parser should throw an error - SymtabEntry anErrorOccurred = new SymtabEntry (); - SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred); - // Was the indicated type found in the symbol table? - if (entry == anErrorOccurred) - { - System.out.println("Error occured "); - // Don't have to generate an error, scopedName already has. - scanner.skipLineComment (); - token = scanner.getToken (); - } - else - { - // by this time we have already parsed the ModuleName and the - // pragma type, therefore setInterfaceType - if (entry instanceof InterfaceEntry) { - InterfaceEntry ent = (InterfaceEntry) entry; - ent.setInterfaceType (InterfaceEntry.LOCAL_SIGNATURE_ONLY); - } - token = parser.token; - String string = token.name; - match (Token.StringLiteral); - // for non-interfaces it doesn't make sense, so just ignore it - } - } // localPragma - - private void localServantPragma () throws IOException, ParseException - { - // Before I can use a parser method, I must make sure it has the current token. - parser.token = token; - // this makes sense only for interfaces, if specified for modules, - // parser should throw an error - SymtabEntry anErrorOccurred = new SymtabEntry (); - SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred); - - // Was the indicated type found in the symbol table? - if (entry == anErrorOccurred) - { - // Don't have to generate an error, scopedName already has. - scanner.skipLineComment (); - token = scanner.getToken (); - System.out.println("Error occured "); - } - else - { - // by this time we have already parsed the ModuleName and the - // pragma type, therefore setInterfaceType - if (entry instanceof InterfaceEntry) { - InterfaceEntry ent = (InterfaceEntry) entry; - ent.setInterfaceType (InterfaceEntry.LOCALSERVANT); - } - token = parser.token; - String string = token.name; - match (Token.StringLiteral); - // for non-interfaces it doesn't make sense, so just ignore it - } - } // localServantPragma - - - /** - * - **/ - private void idPragma () throws IOException, ParseException - { - // Before I can use a parser method, I must make sure it has the current token. - parser.token = token; - - // This flag will relax the restriction that the scopedNamed - // in this ID pragma directive cannot resolve to a module. - parser.isModuleLegalType (true); - SymtabEntry anErrorOccurred = new SymtabEntry (); - SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred); - parser.isModuleLegalType (false); // <57110> - - // Was the indicated type found in the symbol table? - if (entry == anErrorOccurred) - { - // Don't have to generate an error, scopedName already has. - scanner.skipLineComment (); - token = scanner.getToken (); - } - // - //else if (PragmaIDs.contains (entry)) - //{ - // ParseException.badRepIDAlreadyAssigned (scanner, entry.name ()); - // scanner.skipLineComment (); - // token = scanner.getToken (); - //} - else - { - token = parser.token; - String string = token.name; - // Do not match token until after raise exceptions, otherwise - // incorrect messages will be emitted! - if (PragmaIDs.contains (entry)) // - { - ParseException.badRepIDAlreadyAssigned (scanner, entry.name ()); - } - else if (!RepositoryID.hasValidForm (string)) // - { - ParseException.badRepIDForm (scanner, string); - } - else - { - entry.repositoryID (new RepositoryID (string)); - PragmaIDs.addElement (entry); // - } - match (Token.StringLiteral); - } - } // idPragma - - /** - * - **/ - private void prefixPragma () throws IOException, ParseException - { - String string = token.name; - match (Token.StringLiteral); - ((IDLID)parser.repIDStack.peek ()).prefix (string); - ((IDLID)parser.repIDStack.peek ()).name (""); - } // prefixPragma - - /** - * - **/ - private void versionPragma () throws IOException, ParseException - { - // Before I can use a parser method, I must make sure it has the current token. - parser.token = token; - // This flag will relax the restriction that the scopedNamed - // in this Version pragma directive cannot resolve to a module. - parser.isModuleLegalType (true); - SymtabEntry anErrorOccurred = new SymtabEntry (); - SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred); - // reset the flag to original value - parser.isModuleLegalType (false); - if (entry == anErrorOccurred) - { - // Don't have to generate an error, scopedName already has. - scanner.skipLineComment (); - token = scanner.getToken (); - } - else - { - token = parser.token; - String string = token.name; - match (Token.FloatingPointLiteral); - if (entry.repositoryID () instanceof IDLID) - ((IDLID)entry.repositoryID ()).version (string); - } - } // versionPragma - - private Vector pragmaHandlers = new Vector (); - - /** - * - **/ - void registerPragma (PragmaHandler handler) - { - pragmaHandlers.addElement (handler); - } // registerPragma - - /** - * - **/ - private void otherPragmas (String pragmaType, String currentToken) throws IOException - { - for (int i = pragmaHandlers.size () - 1; i >= 0; --i) - { - PragmaHandler handler = (PragmaHandler)pragmaHandlers.elementAt (i); - if (handler.process (pragmaType, currentToken)) - break; - } - } // otherPragmas - - /* - * These protected methods are used by extenders, by the code - * which implements otherPragma. - */ - - /** - * Get the current token. - **/ - String currentToken () - { - return tokenToString (); - } // currentToken - - /** - * This method, given an entry name, returns the entry with that name. - * It can take fully or partially qualified names and returns the - * appropriate entry defined within the current scope. If no entry - * exists, null is returned. - **/ - SymtabEntry getEntryForName (String string) - { - boolean partialScope = false; - boolean globalScope = false; - - // Change all ::'s to /'s - if (string.startsWith ("::")) - { - globalScope = true; - string = string.substring (2); - } - int index = string.indexOf ("::"); - while (index >= 0) - { - partialScope = true; - string = string.substring (0, index) + '/' + string.substring (index + 2); - index = string.indexOf ("::"); - } - - // Get the entry for that string - SymtabEntry entry = null; - if (globalScope) - entry = parser.recursiveQualifiedEntry (string); - else if (partialScope) - entry = parser.recursivePQEntry (string, parser.currentModule); - else - entry = parser.unqualifiedEntryWMod (string, parser.currentModule); - return entry; - } // getEntryForName - - /** - * This method returns a string of all of the characters from the - * input file from the current position up to, but not including, - * the end-of-line character(s). - **/ - String getStringToEOL () throws IOException - { - return scanner.getStringToEOL (); - } // getStringToEOL - - /** - * This method returns a string of all of the characters from the - * input file from the current position up to, but not including, - * the given character. It encapsulates parenthesis and quoted strings, - * meaning it does not stop if the given character is found within - * parentheses or quotes. For instance, given the input of - * `start(inside)end', getUntil ('n') will return "start(inside)e" - **/ - String getUntil (char c) throws IOException - { - return scanner.getUntil (c); - } // getUntil - - private boolean lastWasMacroID = false; - - /** - * - **/ - private String tokenToString () - { - if (token.equals (Token.MacroIdentifier)) - { - lastWasMacroID = true; - return token.name; - } - else if (token.equals (Token.Identifier)) - return token.name; - else - return token.toString (); - } // tokenToString - - /** - * This method returns the next token String from the input file. - **/ - String nextToken () throws IOException - { - if (lastWasMacroID) - { - lastWasMacroID = false; - return "("; - } - else - { - token = scanner.getToken (); - return tokenToString (); - } - } // nextToken - - /** - * This method assumes that the current token marks the beginning - * of a scoped name. It then parses the subsequent identifier and - * double colon tokens, builds the scoped name, and finds the symbol - * table entry with that name. - **/ - SymtabEntry scopedName () throws IOException - { - boolean globalScope = false; - boolean partialScope = false; - String name = null; - SymtabEntry entry = null; - try - { - if (token.equals (Token.DoubleColon)) - globalScope = true; - else - { - if (token.equals (Token.Object)) - { - name = "Object"; - match (Token.Object); - } - else if (token.type == Token.ValueBase) - { - name = "ValueBase"; - match (Token.ValueBase); - } - else - { - name = token.name; - match (Token.Identifier); - } - } - while (token.equals (Token.DoubleColon)) - { - match (Token.DoubleColon); - partialScope = true; - if (name != null) - name = name + '/' + token.name; - else - name = token.name; - match (Token.Identifier); - } - if (globalScope) - entry = parser.recursiveQualifiedEntry (name); - else if (partialScope) - entry = parser.recursivePQEntry (name, parser.currentModule); - else - entry = parser.unqualifiedEntryWMod (name, parser.currentModule); - } - catch (ParseException e) - { - entry = null; - } - return entry; - } // scopedName - - /** - * Skip to the end of the line. - **/ - void skipToEOL () throws IOException - { - scanner.skipLineComment (); - } // skipToEOL - - /** - * This method skips the data in the input file until the specified - * character is encountered, then it returns the next token. - **/ - String skipUntil (char c) throws IOException - { - if (!(lastWasMacroID && c == '(')) - token = scanner.skipUntil (c); - return tokenToString (); - } // skipUntil - - /** - * This method displays a Parser Exception complete with line number - * and position information with the given message string. - **/ - void parseException (String message) - { - // Suppress warnings - if (!parser.noWarn) - ParseException.warning (scanner, message); - } // parseException - - // For Pragma - /////////////// - // For macro expansion - - /** - * - **/ - String expandMacro (String macroDef, Token t) throws IOException, ParseException - { - token = t; - // Get the parameter values from the macro 'call' - Vector parmValues = getParmValues (); - - // Get the parameter names from the macro definition - // NOTE: a newline character is appended here so that when - // getStringToEOL is called, it stops scanning at the end - // of this string. - scanner.scanString (macroDef + '\n'); - Vector parmNames = new Vector (); - macro (parmNames); - - if (parmValues.size () < parmNames.size ()) - throw ParseException.syntaxError (scanner, Token.Comma, Token.RightParen); - else if (parmValues.size () > parmNames.size ()) - throw ParseException.syntaxError (scanner, Token.RightParen, Token.Comma); - - macroDef = scanner.getStringToEOL (); - for (int i = 0; i < parmNames.size (); ++i) - macroDef = replaceAll (macroDef, (String)parmNames.elementAt (i), (String)parmValues.elementAt (i)); - return removeDoublePound (macroDef); - } // expandMacro - - // This method is only used by the macro expansion methods. - /** - * - **/ - private void miniMatch (int type) throws ParseException - { - // A normal production would now execute: - // match (type); - // But match reads the next token. I don't want to do that now. - // Just make sure the current token is a 'type'. - if (!token.equals (type)) - throw ParseException.syntaxError (scanner, type, token.type); - } // miniMatch - - /** - * - **/ - private Vector getParmValues () throws IOException, ParseException - { - Vector values = new Vector (); - if (token.equals (Token.Identifier)) - { - match (Token.Identifier); - miniMatch (Token.LeftParen); - } - else if (!token.equals (Token.MacroIdentifier)) - throw ParseException.syntaxError (scanner, Token.Identifier, token.type); - - if (!token.equals (Token.RightParen)) - { - values.addElement (scanner.getUntil (',', ')').trim ()); - token = scanner.getToken (); - macroParmValues (values); - } - return values; - } // getParmValues - - /** - * - **/ - private void macroParmValues (Vector values) throws IOException, ParseException - { - while (!token.equals (Token.RightParen)) - { - miniMatch (Token.Comma); - values.addElement (scanner.getUntil (',', ')').trim ()); - token = scanner.getToken (); - } - } // macroParmValues - - /** - * - **/ - private void macro (Vector parmNames) throws IOException, ParseException - { - match (token.type); - match (Token.LeftParen); - macroParms (parmNames); - miniMatch (Token.RightParen); - } // macro - - /** - * - **/ - private void macroParms (Vector parmNames) throws IOException, ParseException - { - if (!token.equals (Token.RightParen)) - { - parmNames.addElement (token.name); - match (Token.Identifier); - macroParms2 (parmNames); - } - } // macroParms - - /** - * - **/ - private void macroParms2 (Vector parmNames) throws IOException, ParseException - { - while (!token.equals (Token.RightParen)) - { - match (Token.Comma); - parmNames.addElement (token.name); - match (Token.Identifier); - } - } // macroParms2 - - /** - * - **/ - private String replaceAll (String string, String from, String to) - { - int index = 0; - while (index != -1) - { - index = string.indexOf (from, index); - if (index != -1) - { - if (!embedded (string, index, index + from.length ())) - if (index > 0 && string.charAt(index) == '#') - string = string.substring (0, index) + '"' + to + '"' + string.substring (index + from.length ()); - else - string = string.substring (0, index) + to + string.substring (index + from.length ()); - index += to.length (); - } - } - return string; - } // replaceAll - - /** - * - **/ - private boolean embedded (String string, int index, int endIndex) - { - // Don't replace if found substring is not an independent id. - // For example, don't replace "thither".indexOf ("it", 0) - boolean ret = false; - char preCh = index == 0 ? ' ' : string.charAt (index - 1); - char postCh = endIndex >= string.length () - 1 ? ' ' : string.charAt (endIndex); - if ((preCh >= 'a' && preCh <= 'z') || (preCh >= 'A' && preCh <= 'Z')) - ret = true; - else if ((postCh >= 'a' && postCh <= 'z') || (postCh >= 'A' && postCh <= 'Z') || (postCh >= '0' && postCh <= '9') || postCh == '_') - ret = true; - else - ret = inQuotes (string, index); - return ret; - } // embedded - - /** - * - **/ - private boolean inQuotes (String string, int index) - { - int quoteCount = 0; - for (int i = 0; i < index; ++i) - if (string.charAt (i) == '"') ++quoteCount; - // If there are an odd number of quotes before this region, - // then this region is within quotes - return quoteCount % 2 != 0; - } // inQuotes - - /** - * Remove any occurrences of ##. - **/ - private String removeDoublePound (String string) - { - int index = 0; - while (index != -1) - { - index = string.indexOf ("##", index); - if (index != -1) - { - int startSkip = index - 1; - int stopSkip = index + 2; - if (startSkip < 0) - startSkip = 0; - if (stopSkip >= string.length ()) - stopSkip = string.length () - 1; - while (startSkip > 0 && - (string.charAt (startSkip) == ' ' || - string.charAt (startSkip) == '\t')) - --startSkip; - while (stopSkip < string.length () - 1 && - (string.charAt (stopSkip) == ' ' || - string.charAt (stopSkip) == '\t')) - ++stopSkip; - string = string.substring (0, startSkip + 1) + string.substring (stopSkip); - } - } - return string; - } // removeDoublePound - - // For macro expansion - /////////////// - - /** - * - **/ - private String getFilename (String name) throws FileNotFoundException - { - String fullName = null; - File file = new File (name); - if (file.canRead ()) - fullName = name; - else - { - Enumeration pathList = parser.paths.elements (); - while (!file.canRead () && pathList.hasMoreElements ()) - { - fullName = (String)pathList.nextElement () + File.separatorChar + name; - file = new File (fullName); - } - if (!file.canRead ()) - throw new FileNotFoundException (name); - } - return fullName; - } // getFilename - - /** - * - **/ - private void match (int type) throws IOException, ParseException - { - if (!token.equals (type)) - throw ParseException.syntaxError (scanner, type, token.type); - token = scanner.getToken (); - - // Added for convenience, but commented-out because there is - // no reason to issue warnings for tokens scanned during preprocessing. - // See issueTokenWarnings(). - //issueTokenWarnings (); - - //System.out.println ("Preprocessor.match token = " + token.type); - //if (token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier)) - // System.out.println ("Preprocessor.match token name = " + token.name); - - // If the token is a defined thingy, scan the defined string - // instead of the input stream for a while. - if (token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier)) - { - String string = (String)symbols.get (token.name); - if (string != null && !string.equals ("")) - // If this is a macro, parse the macro - if (macros.contains (token.name)) - { - scanner.scanString (expandMacro (string, token)); - token = scanner.getToken (); - } - // else this is just a normal define - else - { - scanner.scanString (string); - token = scanner.getToken (); - } - } - } // match - - // - /** - * Issue warnings about tokens scanned during preprocessing. - **/ - private void issueTokenWarnings () - { - if (parser.noWarn) - return; - - // There are no keywords defined for preprocessing (only directives), so: - // - // 1.) Do not issue warnings for identifiers known to be keywords in - // another level of IDL. - // 2.) Do not issue warnings for identifiers that collide with keywords - // in letter, but not case. - // 3.) Do not issue warnings for deprecated keywords. - // - // Should we warn when a macro identifier replaces a keyword? Hmmm. - - // Deprecated directives? None to date. - //if (token.isDirective () && token.isDeprecated ()) - // ParseException.warning (scanner, Util.getMesage ("Deprecated.directive", token.name)); - } // issueTokenWarnings - - /** - * This method is called when the parser encounters a left curly brace. - * An extender of PragmaHandler may find scope information useful. - * For example, the prefix pragma takes effect as soon as it is - * encountered and stays in effect until the current scope is closed. - * If a similar pragma extension is desired, then the openScope and - * closeScope methods are available for overriding. - * @param entry the symbol table entry whose scope has just been opened. - * Be aware that, since the scope has just been entered, this entry is - * incomplete at this point. - **/ - void openScope (SymtabEntry entry) - { - for (int i = pragmaHandlers.size () - 1; i >= 0; --i) - { - PragmaHandler handler = (PragmaHandler)pragmaHandlers.elementAt (i); - handler.openScope (entry); - } - } // openScope - - /** - * This method is called when the parser encounters a right curly brace. - * An extender of PragmaHandler may find scope information useful. - * For example, the prefix pragma takes effect as soon as it is - * encountered and stays in effect until the current scope is closed. - * If a similar pragma extension is desired, then the openScope and - * closeScope methods are available for overriding. - * @param entry the symbol table entry whose scope has just been closed. - **/ - void closeScope (SymtabEntry entry) - { - for (int i = pragmaHandlers.size () - 1; i >= 0; --i) - { - PragmaHandler handler = (PragmaHandler)pragmaHandlers.elementAt (i); - handler.closeScope (entry); - } - } // closeScope - - private Parser parser; - private Scanner scanner; - private Hashtable symbols; - private Vector macros; - - // The logic associated with this stack is scattered above. - // A concise map of the logic is: - // case #if false, #ifdef false, #ifndef true - // push (false); - // skipToEndifOrElse (); - // case #if true, #ifdef true, #ifndef false - // push (true); - // case #elif - // if (top == true) - // skipToEndif (); - // else if (conditional == true) - // pop (); - // push (true); - // else if (conditional == false) - // skipToEndifOrElse (); - // case #else - // if (top == true) - // skipToEndif (); - // else - // pop (); - // push (true); - // case #endif - // pop (); - private Stack alreadyProcessedABranch = new Stack (); - Token token; - - private static String indent = ""; -} --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveEntry.java 2018-01-30 20:24:46.000000000 -0500 +++ /dev/null 2018-01-30 20:24:46.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -/** - * This is the symbol table entry for primitive types: octet, char, - * short, long, long long (and unsigned versions), float, double, string. - **/ -public class PrimitiveEntry extends SymtabEntry -{ - protected PrimitiveEntry () - { - super (); - repositoryID (Util.emptyID); - } // ctor - - protected PrimitiveEntry (String name) - { - name (name); - module (""); - repositoryID (Util.emptyID); - } // ctor - - protected PrimitiveEntry (PrimitiveEntry that) - { - super (that); - } // ctor - - public Object clone () - { - return new PrimitiveEntry (this); - } // clone - - /** Invoke the primitive type generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - primitiveGen.generate (symbolTable, this, stream); - } // generate - - /** Access the primitive type generator. - @return an object which implements the PrimitiveGen interface. - @see PrimitiveGen */ - public Generator generator () - { - return primitiveGen; - } // generator - - static PrimitiveGen primitiveGen; -} // class PrimitiveEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveGen.java 2018-01-30 20:24:47.000000000 -0500 +++ /dev/null 2018-01-30 20:24:47.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface PrimitiveGen extends Generator -{ - void generate (Hashtable symbolTable, PrimitiveEntry entry, PrintWriter stream); -} // interface PrimitiveGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/RepositoryID.java 2018-01-30 20:24:48.000000000 -0500 +++ /dev/null 2018-01-30 20:24:48.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -D57110 Add method to verify format (CORBA 2.3). - -public class RepositoryID -{ - public RepositoryID () - { - _id = ""; - } // ctor - - public RepositoryID (String id) - { - _id = id; - } // ctor - - public String ID () - { - return _id; - } // ID - - public Object clone () - { - return new RepositoryID (_id); - } // clone - - public String toString () - { - return ID (); - } // toString - - /** - * Determine is a supplied string meets the minimal format requirement - * for a Repository ID. - * @return true if supplied string has form {@code ':'}, where - * {@code } is any non-empty string not containing ':'. - **/ - public static boolean hasValidForm (String string) - { - return string != null && string.indexOf (':') > 0; - } // hasValidForm - - private String _id; -} // class RepositoryID --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ResourceBundleUtil.java 2018-01-30 20:24:48.000000000 -0500 +++ /dev/null 2018-01-30 20:24:48.000000000 -0500 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -capitalize and parseTypeModifier should probably be in the -// generators package. -// -D58319 Add version() method. - -import java.util.ResourceBundle; -import java.text.MessageFormat; -import java.util.Hashtable; - -public class ResourceBundleUtil -{ - // - /** - * Fetch the version number of this build of the IDL Parser Framework. - * This method may be called before or after the framework has been - * initialized. If the framework is inititialized, the version information - * is extracted from the message properties object; otherwise, it is extracted - * from the indicated resouce bundle. - * @return the version number. - **/ - public static String getVersion () - { - String version = getMessage ("Version.product", getMessage ("Version.number")); - return version; - } // getVersion - - - ////////////// - // Message-related methods - - public static String getMessage (String key) - { - return fBundle.getString(key); - } // getMessage - - public static String getMessage (String key, String fill) - { - Object[] args = { fill }; - return MessageFormat.format(fBundle.getString(key), args); - } // getMessage - - public static String getMessage (String key, String[] fill) - { - return MessageFormat.format(fBundle.getString(key), fill); - } // getMessage - - - /** Register a ResourceBundle. This file will be searched for - in the CLASSPATH. */ - public static void registerResourceBundle (ResourceBundle bundle) - { - if (bundle != null) - fBundle = bundle; - } // registerResourceBundle - - - /** Gets the current ResourceBundle. */ - public static ResourceBundle getResourceBundle () - { - return fBundle; - } // getResourceBundle - - private static ResourceBundle fBundle; - static - { - // get the resource bundle for the locale on this machine - fBundle = ResourceBundle.getBundle("com.sun.tools.corba.se.idl.idl"); - } - -} // class ResourceBundleUtil --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Scanner.java 2018-01-30 20:24:49.000000000 -0500 +++ /dev/null 2018-01-30 20:24:49.000000000 -0500 @@ -1,1615 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -F46082.51 Remove -stateful feature. -// -D56351 Update computation of RepositoryIDs to CORBA 2.3 (see spec.). -// -D59166 Add escaped-id. info. to identifiers. -// -F60858.1 Add support for -corba option, levels 2.2 and 2.3: accept 2.3 -// keywords as ids.; accept ids. that match keywords in letter, but not in case. -// -D62023 Add support for -corba option, level 2.4: see keyword checking. - -import java.io.EOFException; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.PushbackInputStream; - -import java.util.Enumeration; -import java.util.Stack; -import java.util.StringTokenizer; -import java.util.Vector; - -/** - * - **/ -class Scanner -{ - // -Remove stateful feature. - //Scanner (IncludeEntry file, String[] keywords, boolean vbose, boolean scanStateful, boolean emitAllIncludes) throws IOException - // - //Scanner (IncludeEntry file, String[] keywords, boolean vbose, boolean emitAllIncludes) throws IOException - /** - * - **/ - Scanner (IncludeEntry file, String[] keywords, boolean vbose, - boolean emitAllIncludes, float cLevel, boolean debug) throws IOException - { - readFile (file); - verbose = vbose; - // - //stateful = scanStateful; - emitAll = emitAllIncludes; - sortKeywords (keywords); - corbaLevel = cLevel; - this.debug = debug ; - } // ctor - - /** - * - **/ - void sortKeywords (String[] keywords) - { - for (int i = 0; i < keywords.length; ++i) - if (wildcardAtEitherEnd (keywords[i])) - this.openEndedKeywords.addElement (keywords[i]); - else if (wildcardsInside (keywords[i])) - this.wildcardKeywords.addElement (keywords[i]); - else - this.keywords.addElement (keywords[i]); - } // sortKeywords - - /** - * - **/ - private boolean wildcardAtEitherEnd (String string) - { - return string.startsWith ("*") || - string.startsWith ("+") || - string.startsWith (".") || - string.endsWith ("*") || - string.endsWith ("+") || - string.endsWith ("."); - } // wildcardAtEitherEnd - - /** - * - **/ - private boolean wildcardsInside (String string) - { - return string.indexOf ("*") > 0 || - string.indexOf ("+") > 0 || - string.indexOf (".") > 0; - } // wildcardsInside - - /** - * - **/ - void readFile (IncludeEntry file) throws IOException - { - String filename = file.name (); - filename = filename.substring (1, filename.length () - 1); - readFile (file, filename); - } // readFile - - /** - * - **/ - void readFile (IncludeEntry file, String filename) throws IOException - { - data.fileEntry = file; - data.filename = filename; - // - //FileInputStream stream = new FileInputStream (data.filename); - //data.fileBytes = new byte [stream.available ()]; - //stream.read (data.fileBytes); - //stream.close (); - File idlFile = new File (data.filename); - int len = (int)idlFile.length (); - FileReader fileReader = new FileReader (idlFile); - // data.fileBytes = new char [len]; - final String EOL = System.getProperty ("line.separator"); - data.fileBytes = new char [len + EOL.length ()]; - - fileReader.read (data.fileBytes, 0, len); - fileReader.close (); - - // - for (int i = 0; i < EOL.length (); i++) - data.fileBytes[len + i] = EOL.charAt (i); - - readChar (); - } // readFile - - /** - * - **/ - Token getToken () throws IOException - { - //System.out.println ("Scanner.getToken char = |" + data.ch + "| (ASCII " + (int)data.ch + ")."); - - // The token could be null if the next set of characters - // is not a token: white space, comments, ignored preprocessor - // commands. - Token token = null; - String commentText = new String (""); - - while (token == null) - try - { - data.oldIndex = data.fileIndex; - data.oldLine = data.line; - if (data.ch <= ' ') { - skipWhiteSpace (); - continue; - } - - // Special case for wchar and wstring literals. - // The values are preceded by an L. - // - // Bug fix 4382578: Can't compile a wchar literal. - // - // REVISIT. This maps wchar/wstring literals to - // our char/string literal types. Eventually, we - // need to write stronger checking to be spec - // compliant in negative cases such as leaving the - // L off of a wide string or putting it on a string. - if (data.ch == 'L') { - // Check to see if the next character is an - // apostrophe. - readChar(); - // Note: This doesn't allow for space between - // the L and the apostrophe or quote. - if (data.ch == '\'') { - // It was a wchar literal. Get the value - // and return the token. - token = getCharacterToken(true); - readChar(); - continue; - } else - if (data.ch == '"') { - // It was a wstring literal. - // - // getUntil assumes we've already passed the - // first quote. - readChar (); - token = new Token (Token.StringLiteral, getUntil ('"'), true); - readChar (); - continue; - } else { - // It must not have been a wchar literal. - // Push the input back into the buffer, and - // fall to the next if case. - unread(data.ch); - unread('L'); - readChar(); - } - } - - if ((data.ch >= 'a' && data.ch <= 'z') || - (data.ch >= 'A' && data.ch <= 'Z') || - // Escaped identifier; see data member comments. - //(data.ch == '_' && underscoreOK) || - (data.ch == '_') || - Character.isLetter (data.ch)) { - token = getString (); - } else - if ((data.ch >= '0' && data.ch <= '9') || data.ch == '.') { - token = getNumber (); - } else { - switch (data.ch) - { - case ';': - token = new Token (Token.Semicolon); - break; - case '{': - token = new Token (Token.LeftBrace); - break; - case '}': - token = new Token (Token.RightBrace); - break; - case ':': - readChar (); - if (data.ch == ':') - token = new Token (Token.DoubleColon); - else - { - unread (data.ch); - token = new Token (Token.Colon); - } - break; - case ',': - token = new Token (Token.Comma); - break; - case '=': - readChar (); - if (data.ch == '=') - token = new Token (Token.DoubleEqual); - else - { - unread (data.ch); - token = new Token (Token.Equal); - } - break; - case '+': - token = new Token (Token.Plus); - break; - case '-': - token = new Token (Token.Minus); - break; - case '(': - token = new Token (Token.LeftParen); - break; - case ')': - token = new Token (Token.RightParen); - break; - case '<': - readChar (); - if (data.ch == '<') - token = new Token (Token.ShiftLeft); - else if (data.ch == '=') - token = new Token (Token.LessEqual); - else - { - unread (data.ch); - token = new Token (Token.LessThan); - } - break; - case '>': - readChar (); - if (data.ch == '>') - token = new Token (Token.ShiftRight); - else if (data.ch == '=') - token = new Token (Token.GreaterEqual); - else - { - unread (data.ch); - token = new Token (Token.GreaterThan); - } - break; - case '[': - token = new Token (Token.LeftBracket); - break; - case ']': - token = new Token (Token.RightBracket); - break; - case '\'': - token = getCharacterToken(false); - break; - case '"': - readChar (); - token = new Token (Token.StringLiteral, getUntil ('"', false, false, false)); - break; - case '\\': - readChar (); - // If this is at the end of a line, then it is the - // line continuation character - treat it as white space - if (data.ch == '\n' || data.ch == '\r') - token = null; - else - token = new Token (Token.Backslash); - break; - case '|': - readChar (); - if (data.ch == '|') - token = new Token (Token.DoubleBar); - else - { - unread (data.ch); - token = new Token (Token.Bar); - } - break; - case '^': - token = new Token (Token.Carat); - break; - case '&': - readChar (); - if (data.ch == '&') - token = new Token (Token.DoubleAmpersand); - else - { - unread (data.ch); - token = new Token (Token.Ampersand); - } - break; - case '*': - token = new Token (Token.Star); - break; - case '/': - readChar (); - // <21jul1997daz> Extract comments rather than skipping them. - // Preserve only the comment immediately preceding the next token. - if (data.ch == '/') - //skipLineComment (); - commentText = getLineComment(); - else if (data.ch == '*') - //skipBlockComment (); - commentText = getBlockComment(); - else - { - unread (data.ch); - token = new Token (Token.Slash); - } - break; - case '%': - token = new Token (Token.Percent); - break; - case '~': - token = new Token (Token.Tilde); - break; - - // The period token is recognized in getNumber. - // The period is only valid in a floating ponit number. - //case '.': - // token = new Token (Token.Period); - // break; - - case '#': - token = getDirective (); - break; - case '!': - readChar (); - if (data.ch == '=') - token = new Token (Token.NotEqual); - else - { - unread (data.ch); - token = new Token (Token.Exclamation); - } - break; - case '?': - try - { - token = replaceTrigraph (); - break; - } - catch (InvalidCharacter e) {} - default: - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch); - } - readChar (); - } - } - catch (EOFException e) - { - token = new Token (Token.EOF); - } - - // Transfer comment to parser via token. 21jul1997 - token.comment = new Comment( commentText ); - - //System.out.println ("Scanner.getToken returning token.type = " + token.type); - //if (token.type == Token.Identifier || token.type == Token.MacroIdentifier || (token.type >= Token.BooleanLiteral && token.type <= Token.StringLiteral)) - // System.out.println ("Scanner.getToken returns token.name = " + token.name); - - if (debug) - System.out.println( "Token: " + token ) ; - - return token; - } // getToken - - /** - * - **/ - void scanString (String string) - { - dataStack.push (data); - - data = new ScannerData (data); - - data.fileIndex = 0; - data.oldIndex = 0; - // data.fileBytes = string.getBytes (); - int strLen = string.length(); - data.fileBytes = new char[strLen]; - string.getChars (0, strLen, data.fileBytes, 0); - - data.macrodata = true; - - try {readChar ();} catch (IOException e) {} - } // scanString - - /** - * - **/ - void scanIncludedFile (IncludeEntry file, String filename, boolean includeIsImport) throws IOException - { - dataStack.push (data); - data = new ScannerData (); - data.indent = ((ScannerData)dataStack.peek ()).indent + ' '; - data.includeIsImport = includeIsImport; - try - { - readFile (file, filename); - if (!emitAll && includeIsImport) - SymtabEntry.enteringInclude (); - // As of CORBA 2.3, include files define new scope for Repository - // ID prefixes. The previous Rep. ID is just below the top of the stack and - // must be restored when the contents of this include file are parsed (see readCh()). - Parser.enteringInclude (); - - if (verbose) - System.out.println (data.indent + Util.getMessage ("Compile.parsing", filename)); - } - catch (IOException e) - { - data = (ScannerData)dataStack.pop (); - throw e; - } - } // scanIncludedFile - - /** - * - **/ - private void unread (char ch) - { - if (ch == '\n' && !data.macrodata) --data.line; - --data.fileIndex; - } // unread - - /** - * - **/ - void readChar () throws IOException - { - if (data.fileIndex >= data.fileBytes.length) - if (dataStack.empty ()) - throw new EOFException (); - else - { - // Indicate end-of-scope for include file to parser. - //Parser.exitingInclude (); - - // IBM.11666 - begin - //if (!emitAll && data.includeIsImport && !data.macrodata) - //{ - //SymtabEntry.exitingInclude (); - //Parser.exitingInclude (); // - //} - if (!data.macrodata) - { - if (!emitAll && data.includeIsImport) - SymtabEntry.exitingInclude(); - Parser.exitingInclude(); - } // IBM.11666 - end - - if (verbose && !data.macrodata) - System.out.println (data.indent + Util.getMessage ("Compile.parseDone", data.filename)); - data = (ScannerData)dataStack.pop (); - } - else - { - data.ch = (char)(data.fileBytes[data.fileIndex++] & 0x00ff); - if (data.ch == '\n' && !data.macrodata) ++data.line; - } - } // readChar - - /** - * Starting at a quote, reads a string with possible - * unicode or octal values until an end quote. Doesn't - * handle line feeds or comments. - */ - private String getWString() throws IOException - { - readChar(); - StringBuffer result = new StringBuffer(); - - while (data.ch != '"') { - if (data.ch == '\\') { - // Could be a \ooo octal or - // unicode hex - readChar(); - if (data.ch == 'u') { - // Unicode hex - int num = getNDigitHexNumber(4); - System.out.println("Got num: " + num); - System.out.println("Which is: " + (int)(char)num); - result.append((char)num); - // result.append((char)getNDigitHexNumber(4)); - // getNDigitHexNumber reads the next - // character, so loop without reading another - continue; - } else - if (data.ch >= '0' && data.ch <= '7') { - // Octal - result.append((char)get3DigitOctalNumber()); - // get3DigitOctalNumber reads the next - // character, so loop without reading another - continue; - } else { - // Wasn't either, so just append the - // slash and current character. - result.append('\\'); - result.append(data.ch); - } - } else { - // Just append the character - result.append(data.ch); - } - - // Advance to the next character - readChar(); - } - - return result.toString(); - } - - /** - * - **/ - private Token getCharacterToken(boolean isWide) throws IOException - { - // The token name returned contains a string with two elements: - // first the character appears, then the representation of the - // character. These are typically the same, but they CAN be - // different, for example "O\117" - Token token = null; - readChar (); - if ( data.ch == '\\' ) - { - readChar (); - if ((data.ch == 'x') || (data.ch == 'u')) - { - char charType = data.ch; - int hexNum = getNDigitHexNumber ((charType == 'x') ? 2 : 4); - return new Token (Token.CharacterLiteral, - ((char)hexNum) + "\\" + charType + Integer.toString (hexNum, 16), isWide ); - } - if ((data.ch >= '0') && (data.ch <= '7')) - { - int octNum = get3DigitOctalNumber (); - return new Token (Token.CharacterLiteral, - ((char)octNum) + "\\" + Integer.toString (octNum, 8), isWide ); - } - return singleCharEscapeSequence (isWide); - } - token = new Token (Token.CharacterLiteral, "" + data.ch + data.ch, isWide ); - readChar (); - return token; - } // getCharacterToken - - /** - * - **/ - private Token singleCharEscapeSequence (boolean isWide) throws IOException - { - Token token; - if (data.ch == 'n') - // newline - token = new Token (Token.CharacterLiteral, "\n\\n", isWide); - else if (data.ch == 't') - // horizontal tab - token = new Token (Token.CharacterLiteral, "\t\\t", isWide); - else if (data.ch == 'v') - // vertical tab - token = new Token (Token.CharacterLiteral, "\013\\v", isWide); - else if (data.ch == 'b') - // backspace - token = new Token (Token.CharacterLiteral, "\b\\b", isWide); - else if (data.ch == 'r') - // carriage return - token = new Token (Token.CharacterLiteral, "\r\\r", isWide); - else if (data.ch == 'f') - // form feed - token = new Token (Token.CharacterLiteral, "\f\\f", isWide); - else if (data.ch == 'a') - // alert - token = new Token (Token.CharacterLiteral, "\007\\a", isWide); - else if (data.ch == '\\') - // backslash - token = new Token (Token.CharacterLiteral, "\\\\\\", isWide); - else if (data.ch == '?') - // question mark - token = new Token (Token.CharacterLiteral, "?\\?", isWide); - else if (data.ch == '\'') - // single quote - token = new Token (Token.CharacterLiteral, "'\\'", isWide); - else if (data.ch == '"') - // double quote - token = new Token (Token.CharacterLiteral, "\"\\\"", isWide); - else - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch); - readChar (); - return token; - } // singleCharEscapeSequence - - private Token getString () throws IOException - { - StringBuffer sbuf = new StringBuffer() ; - boolean escaped = false; // - boolean[] collidesWithKeyword = { false } ; // - - // An escaped id. begins with '_', which is followed by a normal - // identifier. Disallow prefixes of '_' having length > 1. - if (data.ch == '_') { - sbuf.append( data.ch ) ; - readChar (); - if (escaped = escapedOK) - if (data.ch == '_') - throw new InvalidCharacter (data.filename, currentLine (), - currentLineNumber (), currentLinePosition (), data.ch); - } - - // Build up the string of valid characters until a non-string - // character is encountered. - while (Character.isLetterOrDigit( data.ch ) || (data.ch == '_')) { - sbuf.append( data.ch ) ; - readChar() ; - } - - String string = sbuf.toString() ; - - // Escaped identifiers - If identifier has '_' prefix, ignore - // keyword check and strip '_'; otherwise, perform keyword check. - - if (!escaped) { // Escaped id ==> ignore keyword check - Token result = Token.makeKeywordToken( string, corbaLevel, escapedOK, - collidesWithKeyword ) ; - if (result != null) - return result ; - } - - // At this point the string is an identifier. If it is a - // string which is also a Java keyword, prepend an underscore - // so that it doesn't generate a compiler error. - string = getIdentifier (string); - - // If a left paren immediately follows, this could be a - // macro definition, return a MacroIdentifier - if (data.ch == '(') { - readChar (); - return new Token (Token.MacroIdentifier, string, escaped, - collidesWithKeyword[0], false); - } else - return new Token (Token.Identifier, string, escaped, - collidesWithKeyword[0], false); - } - - // Wildcard values - static final int Star = 0, Plus = 1, Dot = 2, None = 3; - - /** - * - **/ - private boolean matchesClosedWildKeyword (String string) - { - boolean found = true; - String tmpString = string; - Enumeration e = wildcardKeywords.elements (); - while (e.hasMoreElements ()) - { - int wildcard = None; - StringTokenizer tokens = new StringTokenizer ((String)e.nextElement (), "*+.", true); - if (tokens.hasMoreTokens ()) - { - String token = tokens.nextToken (); - if (tmpString.startsWith (token)) - { - tmpString = tmpString.substring (token.length ()); - while (tokens.hasMoreTokens () && found) - { - token = tokens.nextToken (); - if (token.equals ("*")) - wildcard = Star; - else if (token.equals ("+")) - wildcard = Plus; - else if (token.equals (".")) - wildcard = Dot; - else if (wildcard == Star) - { - int index = tmpString.indexOf (token); - if (index >= 0) - tmpString = tmpString.substring (index + token.length ()); - else - found = false; - } - else if (wildcard == Plus) - { - int index = tmpString.indexOf (token); - if (index > 0) - tmpString = tmpString.substring (index + token.length ()); - else - found = false; - } - else if (wildcard == Dot) - { - int index = tmpString.indexOf (token); - if (index == 1) - tmpString = tmpString.substring (1 + token.length ()); - else - found = false; - } - } - if (found && tmpString.equals ("")) - break; - } - } - } - return found && tmpString.equals (""); - } // matchesClosedWildKeyword - - /** - * - **/ - private String matchesOpenWildcard (String string) - { - Enumeration e = openEndedKeywords.elements (); - String prepend = ""; - while (e.hasMoreElements ()) - { - int wildcard = None; - boolean found = true; - String tmpString = string; - StringTokenizer tokens = new StringTokenizer ((String)e.nextElement (), "*+.", true); - while (tokens.hasMoreTokens () && found) - { - String token = tokens.nextToken (); - if (token.equals ("*")) - wildcard = Star; - else if (token.equals ("+")) - wildcard = Plus; - else if (token.equals (".")) - wildcard = Dot; - else if (wildcard == Star) - { - wildcard = None; - int index = tmpString.lastIndexOf (token); - if (index >= 0) - tmpString = blankOutMatch (tmpString, index, token.length ()); - else - found = false; - } - else if (wildcard == Plus) - { - wildcard = None; - int index = tmpString.lastIndexOf (token); - if (index > 0) - tmpString = blankOutMatch (tmpString, index, token.length ()); - else - found = false; - } - else if (wildcard == Dot) - { - wildcard = None; - int index = tmpString.lastIndexOf (token); - if (index == 1) - tmpString = blankOutMatch (tmpString, 1, token.length ()); - else - found = false; - } - else if (wildcard == None) - if (tmpString.startsWith (token)) - tmpString = blankOutMatch (tmpString, 0, token.length ()); - else - found = false; - } - - // Make sure that, if the last character of the keyword is a - // wildcard, that the string matches what the wildcard - // requires. - if (found) - { - if (wildcard == Star) - ; - else if (wildcard == Plus && tmpString.lastIndexOf (' ') != tmpString.length () - 1) - ; - else if (wildcard == Dot && tmpString.lastIndexOf (' ') == tmpString.length () - 2) - ; - else if (wildcard == None && tmpString.lastIndexOf (' ') == tmpString.length () - 1) - ; - else - found = false; - } - // If found, then prepend an underscore. But also try matching - // again after leading and trailing blanks are removed from - // tmpString. This isn't quite right, but it solves a problem - // which surfaced in the Java mapping. For example: - // openEndedKeywords = {"+Helper", "+Holder", "+Package"}; - // string = fooHelperPackage. - // Given the mechanics of the Java mapping, _fooHelperPackage - // COULD have a conflict, so for each occurance of a keyword, - // an underscore is added, so this would cause two underscores: - // __fooHelperPackage. To accomplish this, the first time thru - // tmpString is "fooHelper " at this point, strip off the - // trailing blanks and try matching "fooHelper". This also - // matches, so two underscores are prepended. - if (found) - { - prepend = prepend + "_" + matchesOpenWildcard (tmpString.trim ()); - break; - } - } - return prepend; - } // matchesOpenWildcard - - /** - * - **/ - private String blankOutMatch (String string, int start, int length) - { - char[] blanks = new char [length]; - for (int i = 0; i < length; ++i) - blanks[i] = ' '; - return string.substring (0, start) + new String (blanks) + string.substring (start + length); - } // blankOutMatch - - /** - * - **/ - private String getIdentifier (String string) - { - if (keywords.contains (string)) - // string matches a non-wildcard keyword - string = '_' + string; - else - { - // Check to see if string matches any wildcard keywords that - // aren't open ended (don't have a wildcard as the first or - // last character. - String prepend = ""; - if (matchesClosedWildKeyword (string)) - prepend = "_"; - else - // string did not match any closed wildcard keywords (that - // is, keywords with wildcards anywhere but at the beginning - // or end of the word). - // Now check for * + or . at the beginning or end. - // These require special handling because they could match - // more than one keyword. prepend an underscore for each - // matched keyword. - prepend = matchesOpenWildcard (string); - string = prepend + string; - } - return string; - } // getIdentifier - - /** - * - **/ - private Token getDirective () throws IOException - { - readChar (); - String string = new String (); - while ((data.ch >= 'a' && data.ch <= 'z') || (data.ch >= 'A' && data.ch <= 'Z')) - { - string = string + data.ch; - readChar (); - } - unread (data.ch); - for (int i = 0; i < Token.Directives.length; ++i) - if (string.equals (Token.Directives[i])) - return new Token (Token.FirstDirective + i); - // If it got this far, it is an unknown preprocessor directive. - return new Token (Token.Unknown, string); - } // getDirective - - /** - * - **/ - private Token getNumber () throws IOException - { - if (data.ch == '.') - return getFractionNoInteger (); - else if (data.ch == '0') - return isItHex (); - else // the only other possibliities are 1..9 - return getInteger (); - } // getNumber - - /** - * - **/ - private Token getFractionNoInteger () throws IOException - { - readChar (); - if (data.ch >= '0' && data.ch <= '9') - return getFraction ("."); - else - return new Token (Token.Period); - } // getFractionNoInteger - - /** - * - **/ - private Token getFraction (String string) throws IOException - { - while (data.ch >= '0' && data.ch <= '9') - { - string = string + data.ch; - readChar (); - } - if (data.ch == 'e' || data.ch == 'E') - return getExponent (string + 'E'); - else - return new Token (Token.FloatingPointLiteral, string); - } // getFraction - - /** - * - **/ - private Token getExponent (String string) throws IOException - { - readChar (); - if (data.ch == '+' || data.ch == '-') - { - string = string + data.ch; - readChar (); - } - else if (data.ch < '0' || data.ch > '9') - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch); - while (data.ch >= '0' && data.ch <= '9') - { - string = string + data.ch; - readChar (); - } - return new Token (Token.FloatingPointLiteral, string); - } // getExponent - - /** - * - **/ - private Token isItHex () throws IOException - { - readChar (); - if (data.ch == '.') - { - readChar (); - return getFraction ("0."); - } - else if (data.ch == 'x' || data.ch == 'X') - return getHexNumber ("0x"); - else if (data.ch == '8' || data.ch == '9') - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch); - else if (data.ch >= '0' && data.ch <= '7') - return getOctalNumber (); - else if (data.ch == 'e' || data.ch == 'E') - return getExponent ("0E"); - else - return new Token (Token.IntegerLiteral, "0"); - } // isItHex - - /** - * - **/ - private Token getOctalNumber () throws IOException - { - String string = "0" + data.ch; - readChar (); - while ((data.ch >= '0' && data.ch <= '9')) - { - if (data.ch == '8' || data.ch == '9') - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch); - string = string + data.ch; - readChar (); - } - return new Token (Token.IntegerLiteral, string); - } // getOctalNumber - - /** - * - **/ - private Token getHexNumber (String string) throws IOException - { - readChar (); - if ((data.ch < '0' || data.ch > '9') && (data.ch < 'a' || data.ch > 'f') && (data.ch < 'A' || data.ch > 'F')) - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch); - else - while ((data.ch >= '0' && data.ch <= '9') || (data.ch >= 'a' && data.ch <= 'f') || (data.ch >= 'A' && data.ch <= 'F')) - { - string = string + data.ch; - readChar (); - } - return new Token (Token.IntegerLiteral, string); - } // getHexNumber - - /** - * - **/ - private int getNDigitHexNumber (int n) throws IOException - { - readChar (); - if (!isHexChar (data.ch)) - throw new InvalidCharacter (data.filename, currentLine (), - currentLineNumber (), currentLinePosition (), data.ch); - String string = "" + data.ch; - readChar (); - for (int i = 2; i <= n; i++) - { - if (!isHexChar( data.ch)) - break; - string += data.ch; - readChar (); - } - try - { - return Integer.parseInt (string, 16); - } - catch (NumberFormatException e) - { - } - return 0; - } // getNDigitHexNumber - - /** - * - **/ - private boolean isHexChar ( char hex ) - { - return ((data.ch >= '0') && (data.ch <= '9')) || - ((data.ch >= 'a') && (data.ch <= 'f')) || - ((data.ch >= 'A') && (data.ch <= 'F')); - } - - /** - * - **/ - private int get3DigitOctalNumber () throws IOException - { - char firstDigit = data.ch; - String string = "" + data.ch; - readChar (); - if (data.ch >= '0' && data.ch <= '7') - { - string = string + data.ch; - readChar (); - if (data.ch >= '0' && data.ch <= '7') - { - string = string + data.ch; - if (firstDigit > '3') - // This is a 3-digit number bigger than 377 - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), firstDigit); - readChar (); - } - } - int ret = 0; - try - { - ret = Integer.parseInt (string, 8); - } - catch (NumberFormatException e) - { - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), string.charAt (0)); - } - return ret; - } // get3DigitOctalNumber - - /** - * - **/ - private Token getInteger () throws IOException - { - String string = "" + data.ch; - readChar (); - if (data.ch == '.') - { - readChar (); - return getFraction (string + '.'); - } - else if (data.ch == 'e' || data.ch == 'E') - return getExponent (string + 'E'); - else if (data.ch >= '0' && data.ch <= '9') - while (data.ch >= '0' && data.ch <= '9') - { - string = string + data.ch; - readChar (); - if (data.ch == '.') - { - readChar (); - return getFraction (string + '.'); - } - } - return new Token (Token.IntegerLiteral, string); - } // getInteger - - /** - * - **/ - private Token replaceTrigraph () throws IOException - { - readChar (); - if (data.ch == '?') - { - readChar (); - if (data.ch == '=') - data.ch = '#'; - else if (data.ch == '/') - data.ch = '\\'; - else if (data.ch == '\'') - data.ch = '^'; - else if (data.ch == '(') - data.ch = '['; - else if (data.ch == ')') - data.ch = ']'; - else if (data.ch == '!') - data.ch = '|'; - else if (data.ch == '<') - data.ch = '{'; - else if (data.ch == '>') - data.ch = '}'; - else if (data.ch == '-') - data.ch = '~'; - else - { - unread (data.ch); - unread ('?'); - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch); - } - return getToken (); - } - else - { - unread ('?'); - throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch); - } - } // replaceTrigraph - - /** - * - **/ - void skipWhiteSpace () throws IOException - { - while (data.ch <= ' ') - readChar (); - } // skipWhiteSpace - - /** - * - **/ - private void skipBlockComment () throws IOException - { - try - { - boolean done = false; - readChar (); - while (!done) - { - while (data.ch != '*') - readChar (); - readChar (); - if (data.ch == '/') - done = true; - } - } - catch (EOFException e) - { - ParseException.unclosedComment (data.filename); - throw e; - } - } // skipBlockComment - - /** - * - **/ - void skipLineComment () throws IOException - { - while (data.ch != '\n') - readChar (); - } // skipLineComment - - // The following two routines added to extract comments rather - // than ignore them. - - /** - * Extract a line comment from the input buffer. - **/ - private String getLineComment () throws IOException - { - StringBuffer sb = new StringBuffer( "/" ); - while (data.ch != '\n') - { - if (data.ch != '\r') - sb.append (data.ch); - readChar (); - } - return sb.toString(); - } // getLineComment - - /** - * Extract a block comment from the input buffer. - **/ - private String getBlockComment () throws IOException - { - StringBuffer sb = new StringBuffer ("/*"); - try - { - boolean done = false; - readChar (); - sb.append (data.ch); - while (!done) - { - while (data.ch != '*') - { - readChar (); - sb.append (data.ch); - } - readChar (); - sb.append (data.ch); - if (data.ch == '/') - done = true; - } - } - catch (EOFException e) - { - ParseException.unclosedComment (data.filename); - throw e; - } - return sb.toString (); - } // getBlockComment - - /** - * - **/ - Token skipUntil (char c) throws IOException - { - while (data.ch != c) - { - if (data.ch == '/') - { - readChar (); - if (data.ch == '/') - { - skipLineComment (); - // If this is skipping until the newline, skipLineComment - // reads past the newline, so it won't be seen by the - // while loop conditional check. - if (c == '\n') break; - } - else if (data.ch == '*') - skipBlockComment (); - } - else - readChar (); - } - return getToken (); - } // skipUntil - - // getUntil is used for macro definitions and to get quoted - // strings, so characters within "("...")" and '"'...'"' are - // ignored. Ie getUntil ',' on (,,,,),X will return (,,,,) - - String getUntil (char c) throws IOException - { - return getUntil (c, true, true, true); - } - - String getUntil (char c, boolean allowQuote, boolean allowCharLit, boolean allowComment) throws IOException - { - String string = ""; - while (data.ch != c) - string = appendToString (string, allowQuote, allowCharLit, allowComment); - return string; - } // getUntil - - /** - * - **/ - String getUntil (char c1, char c2) throws IOException - { - String string = ""; - while (data.ch != c1 && data.ch != c2) - string = appendToString (string, false, false, false); - return string; - } // getUntil - - /** - * - **/ - private String appendToString (String string, boolean allowQuote, boolean allowCharLit, boolean allowComment) throws IOException - { - // Ignore any comments if they are allowed - if (allowComment && data.ch == '/') - { - readChar (); - if (data.ch == '/') - skipLineComment (); - else if (data.ch == '*') - skipBlockComment (); - else - string = string + '/'; - } - // Handle line continuation character - else if (data.ch == '\\') - { - readChar (); - if (data.ch == '\n') - readChar (); - else if (data.ch == '\r') - { - readChar (); - if (data.ch == '\n') - readChar (); - } - else - { - string = string + '\\' + data.ch; - readChar (); - } - } - // characters within "("...")" and '"'...'"' are ignored. - // Ie getUntil ',' on (,,,,),X will return (,,,) - else - { - if (allowCharLit && data.ch == '"') - { - readChar (); - string = string + '"'; - while (data.ch != '"') - string = appendToString (string, true, false, allowComment); - } - else if (allowQuote && allowCharLit && data.ch == '(') - { - readChar (); - string = string + '('; - while (data.ch != ')') - string = appendToString (string, false, false, allowComment); - } - else if (allowQuote && data.ch == '\'') - { - readChar (); - string = string + "'"; - while (data.ch != '\'') - string = appendToString (string, false, true, allowComment); - } - string = string + data.ch; - readChar (); - } - return string; - } // appendToString - - /** - * - **/ - String getStringToEOL () throws IOException - { - String string = new String (); - while (data.ch != '\n') - { - if (data.ch == '\\') - { - readChar (); - if (data.ch == '\n') - readChar (); - else if (data.ch == '\r') - { - readChar (); - if (data.ch == '\n') - readChar (); - } - else - { - string = string + data.ch; - readChar (); - } - } - else - { - string = string + data.ch; - readChar (); - } - } - return string; - } // getStringToEOL - - /** - * - **/ - String filename () - { - return data.filename; - } // filename - - /** - * - **/ - IncludeEntry fileEntry () - { - return data.fileEntry; - } // fileEntry - - /** - * - **/ - int currentLineNumber () - { - return data.line; - } // currentLineNumber - - /** - * - **/ - int lastTokenLineNumber () - { - return data.oldLine; - } // lastTokenLineNumber - - private int BOL; // Beginning Of Line - - /** - * - **/ - String currentLine () - { - BOL = data.fileIndex - 1; - try - { - // If the current position is at the end of the line, - // set BOL to before the end of the line so the whole - // line is returned. - if (data.fileBytes[BOL - 1] == '\r' && data.fileBytes[BOL] == '\n') - BOL -= 2; - else if (data.fileBytes[BOL] == '\n') - --BOL; - while (data.fileBytes[BOL] != '\n') - --BOL; - } - catch (ArrayIndexOutOfBoundsException e) - { - BOL = -1; - } - ++BOL; // Go to the first character AFTER the newline - int EOL = data.fileIndex - 1; - try - { - while (data.fileBytes[EOL] != '\n' && data.fileBytes[EOL] != '\r') - ++EOL; - } - catch (ArrayIndexOutOfBoundsException e) - { - EOL = data.fileBytes.length; - } - if (BOL < EOL) - return new String (data.fileBytes, BOL, EOL - BOL); - else - return ""; - } // currentLine - - /** - * - **/ - String lastTokenLine () - { - int saveFileIndex = data.fileIndex; - data.fileIndex = data.oldIndex; - String ret = currentLine (); - data.fileIndex = saveFileIndex; - return ret; - } // lastTokenLine - - /** - * - **/ - int currentLinePosition () - { - return data.fileIndex - BOL; - } // currentLinePosition - - /** - * - **/ - int lastTokenLinePosition () - { - return data.oldIndex - BOL; - } // lastTokenLinePosition - - // The scanner data is moved to a separate class so that all of the - // data can easily be pushed and popped to a stack. - - // The data must be stackable for macros and #included files. When - // a macro is encountered: the current stack data is reserved on - // the stack; the stack is loaded with the macro info; processing - // proceeds with this data. The same is true for #included files. - - // It may seem that the entire Scanner should be put on a stack in - // the Parser since all the scanner data is stackable. But that - // would mean instantiating a new scanner. The scanner must - // continue from where it left off; when certain things cross file - // boundaries, they must be handled by the scanner, not the parser, - // things like: block comments, quoted strings, tokens. - private ScannerData data = new ScannerData (); - private Stack dataStack = new Stack (); - private Vector keywords = new Vector (); - private Vector openEndedKeywords = new Vector (); - private Vector wildcardKeywords = new Vector (); - private boolean verbose; - // Identifiers starting with '_' are considered "Escaped", - // except when scanned during preprocessing. Class Preprocessor is - // responsible to modify the escapedOK flag accordingly. Since preceding - // underscores are now legal when scanning identifiers as well as - // macro identifier, underscoreOK is obsolete. - // - // boolean underscoreOK = false; - boolean escapedOK = true; - // Remove -stateful feature. - // boolean stateful; - private boolean emitAll; - private float corbaLevel; - private boolean debug ; -} // class Scanner - -// This is a dumb class, really just a struct. It contains all of the -// scanner class's data in one place so that that data can be easily -// pushed and popped to a stack. - -/** - * - **/ -class ScannerData -{ - /** - * - **/ - public ScannerData () - { - } // ctor - - /** - * - **/ - public ScannerData (ScannerData that) - { - indent = that.indent; - fileEntry = that.fileEntry; - filename = that.filename; - fileBytes = that.fileBytes; - fileIndex = that.fileIndex; - oldIndex = that.oldIndex; - ch = that.ch; - line = that.line; - oldLine = that.oldLine; - macrodata = that.macrodata; - includeIsImport = that.includeIsImport; - } // copy ctor - - String indent = ""; - IncludeEntry fileEntry = null; - String filename = ""; - - // fileBytes is a byte array rather than a char array. This is - // safe because OMG IDL is specified to be ISO Latin-1 whose high- - // order byte is always 0x0. Converted from byte[] to char[] - // to employ Reader classes, which have Character encoding features. - //byte[] fileBytes = null; - char[] fileBytes = null; - int fileIndex = 0; - int oldIndex = 0; - char ch; - int line = 1; - int oldLine = 1; - boolean macrodata = false; - boolean includeIsImport = false; -} // class ScannerData --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceEntry.java 2018-01-30 20:24:50.000000000 -0500 +++ /dev/null 2018-01-30 20:24:50.000000000 -0500 @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.constExpr.Expression; - -/** - * This is the symbol table entry for sequences. - **/ -public class SequenceEntry extends SymtabEntry -{ - protected SequenceEntry () - { - super (); - repositoryID (Util.emptyID); - } // ctor - - protected SequenceEntry (SequenceEntry that) - { - super (that); - _maxSize = that._maxSize; - } // ctor - - protected SequenceEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - if (!(that instanceof SequenceEntry)) - // If that is a SequenceEntry, then it is a container of this sequence, but it is not a module of this sequence. It's name doesn't belong in the module name. - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - repositoryID (Util.emptyID); - } // ctor - - public Object clone () - { - return new SequenceEntry (this); - } // clone - - public boolean isReferencable() - { - // A sequence is referencable if its component - // type is. - return type().isReferencable() ; - } - - public void isReferencable( boolean value ) - { - // NO-OP: this cannot be set for a sequence. - } - - /** Invoke the sequence generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - sequenceGen.generate (symbolTable, this, stream); - } // generate - - /** Access the sequence generator. - @return an object which implements the SequenceGen interface. - @see SequenceGen */ - public Generator generator () - { - return sequenceGen; - } // generator - - /** the constant expression defining the maximum size of the sequence. - If it is null, then the sequence is unbounded. */ - public void maxSize (Expression expr) - { - _maxSize = expr; - } // maxSize - - /** the constant expression defining the maximum size of the sequence. - If it is null, then the sequence is unbounded. */ - public Expression maxSize () - { - return _maxSize; - } // maxSize - - /** Only sequences can be contained within sequences. */ - public void addContained (SymtabEntry entry) - { - _contained.addElement (entry); - } // addContained - - /** Only sequences can be contained within sequences. */ - public Vector contained () - { - return _contained; - } // contained - - static SequenceGen sequenceGen; - - private Expression _maxSize = null; - private Vector _contained = new Vector (); -} // class SequenceEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceGen.java 2018-01-30 20:24:50.000000000 -0500 +++ /dev/null 2018-01-30 20:24:50.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface SequenceGen extends Generator -{ - void generate (Hashtable symbolTable, SequenceEntry entry, PrintWriter stream); -} // interface SequenceGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringEntry.java 2018-01-30 20:24:51.000000000 -0500 +++ /dev/null 2018-01-30 20:24:51.000000000 -0500 @@ -1,118 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.constExpr.Expression; - -public class StringEntry extends SymtabEntry -{ - protected StringEntry () - { - super (); - String override = (String)Parser.overrideNames.get ("string"); - if (override == null) - name ("string"); - else - name (override); - repositoryID (Util.emptyID); - } // ctor - - protected StringEntry (StringEntry that) - { - super (that); - _maxSize = that._maxSize; - } // ctor - - protected StringEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - module (""); - - String override = (String)Parser.overrideNames.get ("string"); - if (override == null) - name ("string"); - else - name (override); - repositoryID (Util.emptyID); - } // ctor - - public Object clone () - { - return new StringEntry (this); - } // clone - - /** Invoke the string type generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - stringGen.generate (symbolTable, this, stream); - } // generate - - /** Access the primitive type generator. - @return an object which implements the PrimitiveGen interface. - @see PrimitiveGen */ - public Generator generator () - { - return stringGen; - } // generator - - /** The constant expression defining the maximum size of the string. - If it is null, then the string is unbounded. */ - public void maxSize (Expression expr) - { - _maxSize = expr; - } // maxSize - - /** The constant expression defining the maximum size of the string. - If it is null, then the string is unbounded. */ - public Expression maxSize () - { - return _maxSize; - } // maxSize - - static StringGen stringGen; - - private Expression _maxSize = null; -} // class StringEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringGen.java 2018-01-30 20:24:52.000000000 -0500 +++ /dev/null 2018-01-30 20:24:52.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface StringGen extends Generator -{ - void generate (Hashtable symbolTable, StringEntry entry, PrintWriter stream); -} // interface StringGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructEntry.java 2018-01-30 20:24:53.000000000 -0500 +++ /dev/null 2018-01-30 20:24:53.000000000 -0500 @@ -1,143 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -/** - * This is the symbol table entry for structs. - **/ -public class StructEntry extends SymtabEntry -{ - protected StructEntry () - { - super (); - } // ctor - - protected StructEntry (StructEntry that) - { - super (that); - if (!name ().equals ("")) - { - module (module () + name ()); - name (""); - } - _members = (Vector)that._members.clone (); - _contained = (Vector)that._contained.clone (); - } // ctor - - protected StructEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - public Object clone () - { - return new StructEntry (this); - } // clone - - /** Invoke the struct generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - structGen.generate (symbolTable, this, stream); - } // generate - - /** Access the struct generator. - @return an object which implements the StructGen interface. - @see StructGen */ - public Generator generator () - { - return structGen; - } // generator - - /** Add a member to the member list. */ - public void addMember (TypedefEntry member) - { - _members.addElement (member); - } // addMember - - /** This is a vector of TypedefEntry's. In this context, only the name, - type, and arrayInfo fields hold any meaning. */ - public Vector members () - { - return _members; - } // members - - public void addContained (SymtabEntry entry) - { - _contained.addElement (entry); - } // addContained - - /** This is a vector of SymtabEntry's. It itemizes any types which - this struct contains. It is different than the member list. - For example: -

-      struct A
-      {
-        long x;
-        Struct B
-        {
-          long a;
-          long b;
-        } y;
-      }
-      
- Struct B is contained within struct A. - The members vector will contain entries for x and y. */ - public Vector contained () - { - return _contained; - } // contained - - private Vector _members = new Vector (); - private Vector _contained = new Vector (); - - static StructGen structGen; -} // class StructEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructGen.java 2018-01-30 20:24:53.000000000 -0500 +++ /dev/null 2018-01-30 20:24:53.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface StructGen extends Generator -{ - void generate (Hashtable symbolTable, StructEntry entry, PrintWriter stream); -} // interface StructGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabEntry.java 2018-01-30 20:24:54.000000000 -0500 +++ /dev/null 2018-01-30 20:24:54.000000000 -0500 @@ -1,375 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; - -import java.util.Hashtable; -import java.util.Stack; -import java.util.Vector; - -/** - * This is the base class for all symbol table entries. - * @see AttributeEntry - * @see ConstEntry - * @see EnumEntry - * @see ExceptionEntry - * @see IncludeEntry - * @see InterfaceEntry - * @see MethodEntry - * @see ModuleEntry - * @see ParameterEntry - * @see PragmaEntry - * @see PrimitiveEntry - * @see SequenceEntry - * @see StructEntry - * @see TypedefEntry - * @see UnionEntry - **/ -public class SymtabEntry -{ - public SymtabEntry () - { - initDynamicVars (); - } // ctor - - SymtabEntry (SymtabEntry that, IDLID clone) - { - _module = that._module; - _name = that._name; - _type = that._type; - _typeName = that._typeName; - _sourceFile = that._sourceFile; - _info = that._info; - _repID = (RepositoryID)clone.clone (); - ((IDLID)_repID).appendToName (_name); - if (that instanceof InterfaceEntry || that instanceof ModuleEntry || that instanceof StructEntry || that instanceof UnionEntry || (that instanceof SequenceEntry && this instanceof SequenceEntry)) - _container = that; - else - _container = that._container; - initDynamicVars (); - _comment = that._comment; // <21jul1997daz> - } // ctor - - /** This is a shallow copy constructor */ - SymtabEntry (SymtabEntry that) - { - _module = that._module; - _name = that._name; - _type = that._type; - _typeName = that._typeName; - _sourceFile = that._sourceFile; - _info = that._info; - _repID = (RepositoryID)that._repID.clone (); - _container = that._container; - - if (_type instanceof ForwardEntry) - ((ForwardEntry)_type).types.addElement (this); - - initDynamicVars (); - // <21JUL1997> - _comment = that._comment; - } // ctor - - void initDynamicVars () - { - _dynamicVars = new Vector (maxKey + 1); - for (int i = 0; i <= maxKey; ++i) - _dynamicVars.addElement (null); - } // initDynamicVars - - /** This is a shallow copy clone */ - public Object clone () - { - return new SymtabEntry (this); - } // clone - - /** @return the concatenation of the module and the name, delimited by '/'. */ - public final String fullName () - { - return _module.equals ("") ? _name : _module + '/' + _name; - } // fullName - - /** Get the name of this entry's module. If there are modules within - modules, each module name is separated by '/'. - @return this entry's module name. */ - public String module () - { - return _module; - } // module - - /** Set the module for this entry. - @param newName the new name of the module. */ - public void module (String newName) - { - if (newName == null) - _module = ""; - else - _module = newName; - } // module - - /** @return the name of this entry. */ - public String name () - { - return _name; - } // name - - /** Set the name. - @param newName the new name. */ - public void name (String newName) - { - if (newName == null) - _name = ""; - else - _name = newName; - - // Update the RepositoryID - if (_repID instanceof IDLID) - ((IDLID)_repID).replaceName (newName); - } // name - - /** @return the type name of this entry. */ - public String typeName () - { - return _typeName; - } // typeName - - protected void typeName (String typeName) - { - _typeName = typeName; - } // typeName - - /** @return the type entry of this entry */ - public SymtabEntry type () - { - return _type; - } // type - - public void type (SymtabEntry newType) - { - if (newType == null) - typeName (""); - else - typeName (newType.fullName ()); - _type = newType; - - if (_type instanceof ForwardEntry) - ((ForwardEntry)_type).types.addElement (this); - } // type - - /** The file name in which this entry was defined. */ - public IncludeEntry sourceFile () - { - return _sourceFile; - } // sourceFile - - /** The file name in which this entry was defined. */ - public void sourceFile (IncludeEntry file) - { - _sourceFile = file; - } // sourceFile - - /** This must be either an InterfaceEntry or a ModuleEntry. - It can be nothing else. */ - public SymtabEntry container () - { - return _container; - } // container - - /** This must be either an InterfaceEntry or a ModuleEntry. - It can be nothing else. */ - public void container (SymtabEntry newContainer) - { - if (newContainer instanceof InterfaceEntry || newContainer instanceof ModuleEntry) - _container = newContainer; - } // container - - /** @return the repository ID for this entry. */ - public RepositoryID repositoryID () - { - return _repID; - } // repositoryID - - /** Set the repository ID for this entry. - @param id the new repository ID. */ - public void repositoryID (RepositoryID id) - { - _repID = id; - } // repositoryID - - /** Should this type be emitted? */ - public boolean emit () - { - return _emit && _isReferencable ; - } // emit - - public void emit (boolean emit) - { - _emit = emit; - } // emit - - /* <21jul1997daz> Accessors for comment */ - - public Comment comment() - { - return _comment; - } - - public void comment( Comment comment ) - { - _comment = comment; - } - - public boolean isReferencable() - { - return _isReferencable ; - } - - public void isReferencable( boolean value ) - { - _isReferencable = value ; - } - - static Stack includeStack = new Stack (); - - static void enteringInclude () - { - includeStack.push (new Boolean (setEmit)); - setEmit = false; - } // enteringInclude - - static void exitingInclude () - { - setEmit = ((Boolean)includeStack.pop ()).booleanValue (); - } // exitingInclude - - /** Other variables besides the default ones can be dynamically placed - into SymTabEntry (and therefore on all symbol table entries) by - extenders. Before such a variable can exist, its key must be - obtained by calling getVariableKey. */ - public static int getVariableKey () - { - return ++maxKey; - } // dynamicVariable - - /** Other variables besides the default ones can be dynamically placed - into SymTabEntry (and therefore on all symbol table entries) by - extenders. This method assigns the value to the variable of the - given key. A valid key must be obtained by calling the method - getVariableKey. If the key is invalid, NoSuchFieldException is - thrown. */ - public void dynamicVariable (int key, Object value) throws NoSuchFieldException - { - if (key > maxKey) - throw new NoSuchFieldException (Integer.toString (key)); - else - { - if (key >= _dynamicVars.size ()) - growVars (); - _dynamicVars.setElementAt (value, key); - } - } // dynamicVariable - - /** Other variables besides the default ones can be dynamically placed - into SymTabEntry (and therefore on all symbol table entries) by - extenders. This method gets the value of the variable of the - given key. A valid key must be obtained by calling the method - getVariableKey. If the key is invalid, NoSuchFieldException is - thrown. */ - public Object dynamicVariable (int key) throws NoSuchFieldException - { - if (key > maxKey) - throw new NoSuchFieldException (Integer.toString (key)); - else - { - if (key >= _dynamicVars.size ()) - growVars (); - return _dynamicVars.elementAt (key); - } - } // dynamicVariable - - void growVars () - { - int diff = maxKey - _dynamicVars.size () + 1; - for (int i = 0; i < diff; ++i) - _dynamicVars.addElement (null); - } // growVars - - /** Invoke a generator. A call to this method is only meaningful - for subclasses of SymtabEntry. If called on this class, it - is a no-op. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - } // generate - - /** Access a generator. A call to this method is only meaningful - for subclasses of SymtabEntry. If called on this class, it - is a no-op. - @return an object which implements the Generator interface. */ - public Generator generator () - { - return null; - } // generator - - static boolean setEmit = true; - static int maxKey = -1; - - private SymtabEntry _container = null; - private String _module = ""; - private String _name = ""; - private String _typeName = ""; - private SymtabEntry _type = null; - private IncludeEntry _sourceFile = null; - private Object _info = null; - private RepositoryID _repID = new IDLID ("", "", "1.0"); - private boolean _emit = setEmit; - private Comment _comment = null; - private Vector _dynamicVars; - private boolean _isReferencable = true ; -} // class SymtabEntry - -/*======================================================================================= - DATE ACTION - --------------------------------------------------------------------------------------- - 21jul1997 Added _comment data member to afford transferring comments from source - file to target; added acessor methods for comment. - =======================================================================================*/ --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabFactory.java 2018-01-30 20:24:55.000000000 -0500 +++ /dev/null 2018-01-30 20:24:55.000000000 -0500 @@ -1,117 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -/** - * Each entry must have three ways in which it can be instantiated: - *
    - *
  • with no parameters; - *
  • cloned from a copy of itself; - *
  • the normal-use instantiation (usually with 2 parameters: the container and the id of the container). - *
- **/ -public interface SymtabFactory -{ - AttributeEntry attributeEntry (); - AttributeEntry attributeEntry (InterfaceEntry container, IDLID id); - - ConstEntry constEntry (); - ConstEntry constEntry (SymtabEntry container, IDLID id); - - NativeEntry nativeEntry (); - NativeEntry nativeEntry (SymtabEntry container, IDLID id); - - EnumEntry enumEntry (); - EnumEntry enumEntry (SymtabEntry container, IDLID id); - - ExceptionEntry exceptionEntry (); - ExceptionEntry exceptionEntry (SymtabEntry container, IDLID id); - - ForwardEntry forwardEntry (); - ForwardEntry forwardEntry (ModuleEntry container, IDLID id); - - ForwardValueEntry forwardValueEntry (); - ForwardValueEntry forwardValueEntry (ModuleEntry container, IDLID id); - - IncludeEntry includeEntry (); - IncludeEntry includeEntry (SymtabEntry container); - - InterfaceEntry interfaceEntry (); - InterfaceEntry interfaceEntry (ModuleEntry container, IDLID id); - - ValueEntry valueEntry (); - ValueEntry valueEntry (ModuleEntry container, IDLID id); - - ValueBoxEntry valueBoxEntry (); - ValueBoxEntry valueBoxEntry (ModuleEntry container, IDLID id); - - MethodEntry methodEntry (); - MethodEntry methodEntry (InterfaceEntry container, IDLID id); - - ModuleEntry moduleEntry (); - ModuleEntry moduleEntry (ModuleEntry container, IDLID id); - - ParameterEntry parameterEntry (); - ParameterEntry parameterEntry (MethodEntry container, IDLID id); - - PragmaEntry pragmaEntry (); - PragmaEntry pragmaEntry (SymtabEntry container); - - PrimitiveEntry primitiveEntry (); - /** name can be, but is not limited to, the primitive idl type names: - char, octet, short, long, etc. The reason it is not limited to - these is that, as an extender, you may wish to override these names. - For instance, when generating Java code, octet translates to byte, - so there is an entry in Compile.overrideNames: {@code <"octet", "byte">} - and a PrimitiveEntry in the symbol table for "byte". */ - PrimitiveEntry primitiveEntry (String name); - - SequenceEntry sequenceEntry (); - SequenceEntry sequenceEntry (SymtabEntry container, IDLID id); - - StringEntry stringEntry (); - - StructEntry structEntry (); - StructEntry structEntry (SymtabEntry container, IDLID id); - - TypedefEntry typedefEntry (); - TypedefEntry typedefEntry (SymtabEntry container, IDLID id); - - UnionEntry unionEntry (); - UnionEntry unionEntry (SymtabEntry container, IDLID id); -} // interface SymtabFactory --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Token.java 2018-01-30 20:24:55.000000000 -0500 +++ /dev/null 2018-01-30 20:24:55.000000000 -0500 @@ -1,689 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -F46082.51 Remove -stateful feature. -// -D59166 Add support for keyword/identifier collision detection. This -// feature is implemented here, rather than class Scanner, to allow the Parser -// to handle the problem. -// -F60858.1 Support -corba option, level <= 2.2: identify 2.3 keywords. -// -D62023 Support -corba option, level <= 2.3, identify 2.4 keywords. -// KMC Support -corba, level <= 3.0. Added 3.0 keywords. -// -// Should escaped Identifier should be a type rather than an attribute? -// - -/** - * Class Token represents a lexeme appearing within an IDL source. Every - * Token has a type. Depending on its type and on the supported version - * of IDL, a Token will have other associated attributes, such as a name - * (identifier, e.g.), and whether it is escaped, deprecated, or is a type - * that is known to be in a future version of IDL. - **/ -class Token -{ - /////////////// - // Available types - - static final int // Keywords - Any = 0, // 2.2 - Attribute = 1, // | - Boolean = 2, // . - Case = 3, // . - Char = 4, // . - Const = 5, - Context = 6, - Default = 7, - Double = 8, - Enum = 9, - Exception = 10, - FALSE = 11, - Fixed = 12, // New addition - Float = 13, - In = 14, - Inout = 15, - Interface = 16, - Long = 17, - Module = 18, - Native = 19, // New addition - Object = 20, - Octet = 21, - Oneway = 22, - Out = 23, - Raises = 24, - Readonly = 25, - Sequence = 26, - Short = 27, - String = 28, - Struct = 29, - Switch = 30, - TRUE = 31, - Typedef = 32, - Unsigned = 33, // . - Union = 34, // . - Void = 35, // . - Wchar = 36, // | - Wstring = 37, // 2.2 - // New OBV keywords... - // In 2.4rtf, "factory" is synonymous to "init" in 2.3 - Init = 38, // 2.3 only - Abstract = 39, // 2.3 2.4rtf - Custom = 40, // | | - Private = 41, // | | - Public = 42, // | | - Supports = 43, // | | - Truncatable = 44, // | | - ValueBase = 45, // | | - Valuetype = 46, // 2.3 2.4rtf - Factory = 47, // 2.4rtf only - - // Keywords in CORBA 3.0 - Component = 48, - Consumes = 49, - Emits = 50, - Finder = 51, - GetRaises = 52, - Home = 53, - Import = 54, - Local = 55, - Manages = 56, - Multiple = 57, - PrimaryKey = 58, - Provides = 59, - Publishes = 60, - SetRaises = 61, - TypeId = 62, - TypePrefix = 63, - Uses = 64, - - Identifier = 80, // Identifier - MacroIdentifier = 81, // Macro Identifier - - Semicolon = 100, // Symbols - LeftBrace = 101, - RightBrace = 102, - Colon = 103, - Comma = 104, - Equal = 105, - Plus = 106, - Minus = 107, - LeftParen = 108, - RightParen = 109, - LessThan = 110, - GreaterThan = 111, - LeftBracket = 112, - RightBracket = 113, - Apostrophe = 114, - Quote = 115, - Backslash = 116, - Bar = 117, - Carat = 118, - Ampersand = 119, - Star = 120, - Slash = 121, - Percent = 122, - Tilde = 123, - DoubleColon = 124, - ShiftLeft = 125, - ShiftRight = 126, - Period = 127, - Hash = 128, - Exclamation = 129, - DoubleEqual = 130, - NotEqual = 131, - GreaterEqual = 132, - LessEqual = 133, - DoubleBar = 134, - DoubleAmpersand = 135, - - BooleanLiteral = 200, // Literals - CharacterLiteral = 201, - IntegerLiteral = 202, - FloatingPointLiteral = 203, - StringLiteral = 204, - Literal = 205, - - Define = 300, // Directives - Undef = 301, - If = 302, - Ifdef = 303, - Ifndef = 304, - Else = 305, - Elif = 306, - Include = 307, - Endif = 308, - Line = 309, - Error = 310, - Pragma = 311, - Null = 312, - Unknown = 313, - - Defined = 400, - - // Keyword identifiers. - //Abstract = 500, - //Custom = 501, - //Init = 502, - //Private2 = 503, - //Public2 = 504, - //Supports = 505, - //Truncatable = 506, - //ValueBase = 507, - //Valuetype = 508, - - EOF = 999; // End of Input - - // Available types - /////////////// - // Keywords - - static final String [] Keywords = { - "any", "attribute", "boolean", - "case", "char", "const", - "context", "default", "double", - "enum", "exception", "FALSE", "fixed", - "float", "in", "inout", - "interface", "long", "module", "native", - "Object", "octet", "oneway", - "out", "raises", "readonly", - "sequence", "short", "string", - "struct", "switch", "TRUE", - "typedef", "unsigned", "union", - "void", "wchar", "wstring", - "init", // In 2.3 only - "abstract", "custom", "private", // 2.3 and 2.4rtf - "public", "supports", "truncatable", - "ValueBase", "valuetype", - "factory", // In 2.4rtf only - // CORBA 3.0 keywords - "component", "consumes", "emits", - "finder", "getRaises", "home", - "import", "local", "manages", - "multiple", "primaryKey", "provides", - "publishes", "setRaises", "supports", - "typeId", "typePrefix", "uses" } ; - - // Remove keyword identifiers. - //static final int - // FirstKeywordIdentifier = 500, - // LastKeywordIdentifier = Valuetype; - // - //static final String[] KeywordIdentifiers = { - // "abstract", "custom", "init", - // "private", "public", "supports", - // "truncatable", "valueBase", "valuetype"}; - - /** - * Determine whether this token is a keyword. - * @return true iff this token is a keyword. - **/ - boolean isKeyword () - { - return type >= FirstKeyword && type <= LastKeyword; - } // isKeyword - - private static final int - FirstKeyword = Any, // 0 - LastKeyword = Uses; - - // Keywords in CORBA 2.2 that we support. - private static final int - First22Keyword = Any, // 0 - Last22Keyword = Wstring; - - // New keywords in CORBA 2.3 (preliminary) that we support. - private static final int - First23Keyword = Init, - Last23Keyword = Valuetype; - - // New keywords in CORBA 2.4rtf (accepted 2.3) that we support. - // Note that "factory" replaces "init". Scanner must account for this in - // keyword scan. - private static final int - First24rtfKeyword = Abstract, - Last24rtfKeyword = Factory; - - // New keywords in CORBA 3.0 (from CORBA components v. 1) - private static final int - First30Keyword = Component, - Last30Keyword = Uses; - - // Current valid CORBA levels: - // 2.2 (or <2.3): the default: no OBV support - // 2.3: add OBV with init - // >2.3: OBV with init replcaed by factory - // 3.0: adds components, attr exceptions, local interfaces, type repository - // decls. - - private static final int CORBA_LEVEL_22 = 0 ; - private static final int CORBA_LEVEL_23 = 1 ; - private static final int CORBA_LEVEL_24RTF = 2 ; - private static final int CORBA_LEVEL_30 = 3 ; - - // Do the conversion from a floating point CORBA level to an int - private static int getLevel( float cLevel ) - { - if (cLevel < 2.3f) - return CORBA_LEVEL_22 ; - if (Util.absDelta( cLevel, 2.3f ) < 0.001f) - return CORBA_LEVEL_23 ; - if (cLevel < 3.0f) - return CORBA_LEVEL_24RTF ; - return CORBA_LEVEL_30 ; - } - - // Return the last keyword corresponding to a particular CORBA level - private static int getLastKeyword( int level ) - { - if (level == CORBA_LEVEL_22) - return Last22Keyword ; - if (level == CORBA_LEVEL_23) - return Last23Keyword ; - if (level == CORBA_LEVEL_24RTF) - return Last24rtfKeyword ; - return Last30Keyword ; - } - - /** Create a keyword token from a string. - * Determines whether the string is an IDL keyword based on the corbaLevel. - * Strings that are keywords at higher CORBA levels than the corbaLevel - * argument create identifier tokens that are marked as "collidesWithKeyword", unless - * escapedOK is FALSE, which is the case only when preprocessing is taking place. - * In the case of the "init" keyword, which was only defined in CORBA 2.3, init is - * marked deprecated in CORBA 2.3 since it is not supported in higher levels. - * @param String string The string we are converting to a token. - * @param float corbaLevel The CORBA level, currently in the interval [2.2, 3.0]. - * @param boolean escapedOK Flag set true if _ is used to escape an IDL keyword for use - * as an identifier. - * @param boolean[] collidesWithKeyword is an array containing one value: a flag - * representing whether this string is an identifier that collides with a keyword. - * This is set by this method. - * @return Token The resulting Token corresponding to string. - */ - public static Token makeKeywordToken( - String string, float corbaLevel, boolean escapedOK, boolean[] collision ) - { - int level = getLevel( corbaLevel ) ; - int lastKeyword = getLastKeyword( level ) ; - boolean deprecated = false ; - collision[0] = false ; - - // If the string is a keyword token, return that token - for (int i = Token.FirstKeyword; i <= Token.LastKeyword; ++i) { - if (string.equals (Token.Keywords[i])) { - // Return identifier if lexeme is a keyword in a - // greater CORBA level; collect attributes indicating future keyword/ - // identifier collision and deprecations. - - // Init is really a funny case. I don't want to mark it as - // a keyword collision in the 2.2 case, since it was only - // defined to be a keyword briefly in 2.3. - if (i == Token.Init) { - if (level == CORBA_LEVEL_23) - deprecated = true ; - else - break ; - } - - if (i > lastKeyword) { - collision[0] |= escapedOK; // escapedOK true iff not preprocessing - break ; - } - - if (string.equals ("TRUE") || string.equals ("FALSE")) - return new Token (Token.BooleanLiteral, string) ; - else - return new Token (i, deprecated); - } else if (string.equalsIgnoreCase (Token.Keywords[i])) { - // PU! This will go away in a future release, because - // case-insensitive keyword checking will be standard. For now, - // indicate that a keyword collision has occurred. - collision[0] |= true; - break; - } - } // for i <= lastKeyword - - return null ; - } // makeKeywordToken - - // Keywords - /////////////// - // Symbols - - static final int - FirstSymbol = 100, - LastSymbol = 199; - - static final String [] Symbols = { - ";", "{", "}", ":", ",", "=", "+", "-", - "(", ")", "<", ">", "[", "]", "'", "\"", - "\\", "|", "^", "&", "*", "/", "%", "~", - "::", "<<", ">>", ".", "#", "!", "==", "!=", - ">=", "<=", "||", "&&"}; - - // Symbols - /////////////// - // Literals - - static final int - FirstLiteral = 200, - LastLiteral = 299; - - static final String [] Literals = { - Util.getMessage ("Token.boolLit"), - Util.getMessage ("Token.charLit"), - Util.getMessage ("Token.intLit"), - Util.getMessage ("Token.floatLit"), - Util.getMessage ("Token.stringLit"), - Util.getMessage ("Token.literal")}; - - // Literals - /////////////// - // Directives - - /** - * Determine whether this token is a preprocessor directive. - * @return true iff this token is a preprocessor directive. - **/ - boolean isDirective () - { - return type >= FirstDirective && type <= LastDirective; - } // isDirective - - static final int - FirstDirective = 300, - LastDirective = 399; - - static final String [] Directives = { - "define", "undef", "if", - "ifdef", "ifndef", "else", - "elif", "include","endif", - "line", "error", "pragma", - ""}; - - // Directives - /////////////// - // Specials - - static final int - FirstSpecial = 400, - LastSpecial = 499; - - static final String [] Special = { - "defined"}; - - // Specials - /////////////// - - /** - * Constructor. - * @return a Token of the supplied type. - **/ - Token (int tokenType) - { - type = tokenType; - } // ctor - - // - /** - * Constructor. - * @return a Token having the supplied attributes. - **/ - Token (int tokenType, boolean deprecated) - { - this.type = tokenType; - this.isDeprecated = deprecated; - } // ctor - - /** - * Constructor. - * @return a Token having the supplied attributes. - **/ - Token (int tokenType, String tokenName) - { - type = tokenType; - name = tokenName; - } // ctor - - /** - * Constructor. - * @return a Token having the supplied attribtues. - * having - **/ - Token (int tokenType, String tokenName, boolean isWide) - { - this (tokenType, tokenName); - this.isWide = isWide; - } // ctor - - - // - /** - * Constructor. - * @return a Token having the supplied attributes. - **/ - Token (int tokenType, String tokenName, boolean escaped, - boolean collision, boolean deprecated) - { - this (tokenType, tokenName); - this.isEscaped = escaped; - this.collidesWithKeyword = collision; - this.isDeprecated = deprecated; - } // ctor - - // Remove keyword identifiers. - ///** - // * Constructor. - // * @return a Token having the supplied attributes. - // **/ - //Token (int tokenType, int tokenSubType, String tokenName) - //{ - // type = tokenType; - // subType = tokenSubType; - // name = tokenName; - //} // ctor - - /** - * Get the String representation of this Token. - * @return a String containing representation of this Token. - **/ - public String toString () - { - if (type == Identifier) - return name; - if (type == MacroIdentifier) - return name + '('; - return Token.toString (type); - } // toString - - /** - * Get the String representation of a supplied Token type. - * @return A String containing the name of the supplied Token type. - **/ - static String toString (int type) - { - if (type <= LastKeyword) - return Keywords[type]; - // Remove keyword identifiers. - //if ( (type >= FirstKeywordIdentifier) && (type <= LastKeywordIdentifier) ) - // return KeywordIdentifiers[ type - FirstKeywordIdentifier ]; - if (type == Identifier || type == MacroIdentifier) - return Util.getMessage ("Token.identifier"); - if (type <= LastSymbol) - return Symbols[type - FirstSymbol]; - if (type <= LastLiteral) - return Literals[type - FirstLiteral]; - if (type <= LastDirective) - return Directives[type - FirstDirective]; - if (type <= LastSpecial) - return Special[type - FirstSpecial]; - if (type == EOF) - return Util.getMessage ("Token.endOfFile"); - return Util.getMessage ("Token.unknown"); - } // toString - - /////////////// - // Accessors and Predicates - - /** - * Determine whether this token equals a supplied token. - * @return true iff the types and names of this and the supplied - * Token are equal. - **/ - boolean equals (Token that) - { - if (this.type == that.type) - if (this.name == null) - return that.name == null; - else - return this.name.equals (that.name); - return false; - } // equals - - /** - * Determine whether the this token is of a supplied type. - * @return true iff the type of this Token equals that supplied. - **/ - boolean equals (int type) - { - return this.type == type; - } // equals - - /** - * Determine whether this identifier has the supplied name. - * @return true iff this Token is an identifier having the supplied name. - **/ - boolean equals (String name) - { - return (this.type == Identifier && this.name.equals (name)); - } // equals - - // Although isEscaped is an independent attribute, it may be true only - // when type is Identifer. - /** - * Accessor. - * @return true iff this token is an escaped identifier. - **/ - public boolean isEscaped () - { - return type == Identifier && isEscaped; - } // isEscaped - - // - /** - * Accessor. - * @return true iff this token is an identifier having a name matching - * a keyword in a version of CORBA greater than the specified CORBA level, - * or iff it matches a keyword in letter, but note case. - **/ - public boolean collidesWithKeyword () - { - return collidesWithKeyword; - } // collidesWithKeyword - - // Storing deprecation information in a token seems a natural - // means to notify the parser about deprecated types. - /** - * Accessor. - * @return true iff this token is a deprecated lexeme or lexical type with - * respect to the specified CORBA level. - **/ - public boolean isDeprecated () - { - return isDeprecated; - } - // isDeprecated - - public boolean isWide() - { - return isWide ; - } - - // It's more efficient if Scanner determines this attribute. - /** - * Determine whether this token collides with an IDL keyword. - **/ - //public boolean collidesWithKeyword () - //{ - // if (name != null && type == Identifier && !isEscaped) - // { - // String lcName = name.toLowerCase (); - // for (int i = FirstKeyword; i <= LastKeyword; ++i) - // if (lcName.equals (Token.Keywords [i].toLowerCase ())) - // return true; - // } - // return false; - //} // collidesWithKeyword - - // Accessors and Predicates - /////////////// - - /** - * Code identifying the lexical class to which this token belongs, e.g., - * Keyword, Identifier, ... - **/ - int type; - /** - * Lexeme extracted from the source for this token. - **/ - String name = null; - /** - * Source comment associated with this token. - **/ - Comment comment = null; - /** - * True iff this token is an escaped identifier. - **/ - boolean isEscaped = false; // - /** - * True iff this token is an identifier that is known to be a keyword - * in another version of CORBA or matches a keyword in letter, but not case. - **/ - boolean collidesWithKeyword = false; // - /** - * True iff this token is deprecated. - **/ - boolean isDeprecated = false; // - // Remove keyword identifier implementation. - ///** - // * Non-zero only when type = [Macro]Identifier - // **/ - //int subType = 0; - - boolean isWide = false ; // Only for string and char literals: indicates that this is - // a wide string or char. -} // class Token --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TokenBuffer.java 2018-01-30 20:24:56.000000000 -0500 +++ /dev/null 2018-01-30 20:24:56.000000000 -0500 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -class TokenBuffer -{ - private final int DEFAULT_SIZE = 10; - - private int _size = 0; - private Token _buffer [] = null; - private int _currPos = -1; - - TokenBuffer () - { - _size = DEFAULT_SIZE; - _buffer = new Token [_size]; - _currPos = -1; - } // ctor - - TokenBuffer (int size) throws Exception - { - _size = size; // _size == 0 is legal, but useless and problematic - _buffer = new Token [_size]; - _currPos = -1; - } // ctor - - /** Inserts a token at the head of the buffer. */ - void insert (Token token) - { - // _size == 0 ==> ArithmeticException: divide by zero - _currPos = ++_currPos % _size; - _buffer [_currPos] = token; - } - - /** Returns the token residing "i" elements from the head of the buffer. */ - Token lookBack (int i) - { - // Beware: i > _size ==> idx < 0 ==> ArrayOutOfBoundsException - return _buffer [(_currPos - i) >= 0 ? _currPos - i : _currPos - i + _size]; - } - - /** Return the token most recently inserted into the buffer (i.e., the head of the buffer.) */ - Token current () - { - // Beware: _buffer empty || _size == 0 ==> ArrayOutOfBoundsException - return _buffer [_currPos]; - } -} // class TokenBuffer - - -/*================================================================================== - DATE ACTION - ---------------------------------------------------------------------------------- - 11aug1997 Initial version completed. Buffer used to maintain history of - comments extracted from source file during parse. - ==================================================================================*/ --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefEntry.java 2018-01-30 20:24:57.000000000 -0500 +++ /dev/null 2018-01-30 20:24:57.000000000 -0500 @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.constExpr.Expression; - -/** - * This is the symbol table entry for typedefs. - **/ -public class TypedefEntry extends SymtabEntry -{ - protected TypedefEntry () - { - super (); - } // ctor - - protected TypedefEntry (TypedefEntry that) - { - super (that); - _arrayInfo = (Vector)that._arrayInfo.clone (); - } // ctor - - protected TypedefEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - /** This method returns a vector of Expressions, each expression - represents a dimension in an array. A zero-length vector indicates - no array information.*/ - public Vector arrayInfo () - { - return _arrayInfo; - } // arrayInfo - - public void addArrayInfo (Expression e) - { - _arrayInfo.addElement (e); - } // addArrayInfo - - public Object clone () - { - return new TypedefEntry (this); - } // clone - - /** Invoke the typedef generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - typedefGen.generate (symbolTable, this, stream); - } // generate - - public boolean isReferencable() - { - // A typedef is referencable if its component - // type is. - return type().isReferencable() ; - } - - public void isReferencable( boolean value ) - { - // NO-OP: this cannot be set for a typedef. - } - - /** Access the typedef generator. - @return an object which implements the TypedefGen interface. - @see TypedefGen */ - public Generator generator () - { - return typedefGen; - } // generator - - private Vector _arrayInfo = new Vector (); - - static TypedefGen typedefGen; -} // class TypedefEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefGen.java 2018-01-30 20:24:57.000000000 -0500 +++ /dev/null 2018-01-30 20:24:57.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface TypedefGen extends Generator -{ - void generate (Hashtable symbolTable, TypedefEntry entry, PrintWriter stream); -} // interface TypedefGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionBranch.java 2018-01-30 20:24:58.000000000 -0500 +++ /dev/null 2018-01-30 20:24:58.000000000 -0500 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.util.Vector; - -import com.sun.tools.corba.se.idl.TypedefEntry; - -/** - * This class encapsulates one branch of a union. Here are some examples - * of what it may contain: - *
- *
- * {@code case 1: short x;} - *
{@code , false>} - *
- * {@code case 0:}
- * {@code case 8:}
- * {@code case 2: long x;} - *
{@code , false>} - *
- * {@code default: long x;} - *
{@code , true>} - *
- * {@code case 0:}
- * {@code case 2:}
- * {@code default: char c;} - *
{@code , true>} - *
- **/ -public class UnionBranch -{ - /** The type definition for the branch. */ - public TypedefEntry typedef; - /** A vector of Expression's, one for each label in the order in which - they appear in the IDL file. The default branch has no label. */ - public Vector labels = new Vector (); - /** true if this is the default branch. */ - public boolean isDefault = false; -} // class UnionBranch --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionEntry.java 2018-01-30 20:24:59.000000000 -0500 +++ /dev/null 2018-01-30 20:24:59.000000000 -0500 @@ -1,191 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.constExpr.Expression; - -/** - * This is the symbol table entry for unions. - **/ -public class UnionEntry extends SymtabEntry -{ - protected UnionEntry () - { - super (); - } // ctor - - protected UnionEntry (UnionEntry that) - { - super (that); - if (!name ().equals ("")) - { - module (module () + name ()); - name (""); - } - _branches = (Vector)that._branches.clone (); - _defaultBranch = that._defaultBranch; - _contained = that._contained; - } // ctor - - protected UnionEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - if (module ().equals ("")) - module (name ()); - else if (!name ().equals ("")) - module (module () + "/" + name ()); - } // ctor - - public Object clone () - { - return new UnionEntry (this); - } // clone - - /** Invoke the union generator. - @param symbolTable the symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - unionGen.generate (symbolTable, this, stream); - } // generate - - /** Access the union generator. - @return an object which implements the UnionGen interface. - @see UnionGen */ - public Generator generator () - { - return unionGen; - } // generator - - public void addBranch (UnionBranch branch) - { - _branches.addElement (branch); - } // addBranch - - /** This is a vector of UnionBranch's. */ - public Vector branches () - { - return _branches; - } // branches - - /** This TypedefEntry describes the type and name for the default branch. - Like the entries in the branches vector, only the type and name fields - are pertinent. */ - public void defaultBranch (TypedefEntry branch) - { - _defaultBranch = branch; - } // defaultBranch - - /** This TypedefEntry describes the type and name for the default branch. - Like the entries in the branches vector, only the type and name fields - are pertinent. */ - public TypedefEntry defaultBranch () - { - return _defaultBranch; - } // defaultBranch - - public void addContained (SymtabEntry entry) - { - _contained.addElement (entry); - } // addContained - - /** This is a vector of SymtabEntry's. It itemizes any types which - this union contains. For example: - -
-      union A
-      switch (long)
-      {
-        case 0: long x;
-        case 1:
-          Struct B
-          {
-            long a;
-            long b;
-          } y;
-      }
-      
- Struct B is contained within union A. */ - public Vector contained () - { - return _contained; - } // contained - - boolean has (Expression label) - { - Enumeration eBranches = _branches.elements (); - while (eBranches.hasMoreElements ()) - { - Enumeration eLabels = ((UnionBranch)eBranches.nextElement ()).labels.elements (); - while (eLabels.hasMoreElements ()) - { - Expression exp = (Expression)eLabels.nextElement (); - if (exp.equals (label) || exp.value ().equals (label.value ())) - return true; - } - } - return false; - } // has - - boolean has (TypedefEntry typedef) - { - Enumeration e = _branches.elements (); - while (e.hasMoreElements ()) - { - UnionBranch branch = (UnionBranch)e.nextElement (); - if (!branch.typedef.equals (typedef) && branch.typedef.name ().equals (typedef.name ())) - return true; - } - return false; - } // has - - /** A vector of UnionBranch's. */ - private Vector _branches = new Vector (); - private TypedefEntry _defaultBranch = null; - private Vector _contained = new Vector (); - - static UnionGen unionGen; -} // class UnionEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionGen.java 2018-01-30 20:24:59.000000000 -0500 +++ /dev/null 2018-01-30 20:24:59.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -public interface UnionGen extends Generator -{ - void generate (Hashtable symtab, UnionEntry entry, PrintWriter stream); -} // interface UnionGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Util.java 2018-01-30 20:25:00.000000000 -0500 +++ /dev/null 2018-01-30 20:25:00.000000000 -0500 @@ -1,379 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: -// -capitalize and parseTypeModifier should probably be in the -// generators package. -// -D58319 Add version() method. -// -D62023 Add absDelta() method to support float computations. - -import java.io.DataInputStream; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Properties; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.som.cff.FileLocator; - -public class Util -{ - // - /** - * Fetch the version number of this build of the IDL Parser Framework - * from the appropriate properties file. - * @return the version number contained within the appropriate properties - * file, which indicates the build of this IDL Parser Framework. - **/ - public static String getVersion () - { - return getVersion ("com/sun/tools/corba/se/idl/idl.prp"); - } // getVersion - - /** - * Fetch the version number of this build of the IDL Parser Framework. - * This method may be called before or after the framework has been - * initialized. If the framework is inititialized, the version information - * is extracted from the message properties object; otherwise, it is extracted - * from the indicated messages file. - * @return the version number. - **/ - public static String getVersion (String filename) - { - String version = ""; - if (messages == null) // Use supplied file - { - Vector oldMsgFiles = msgFiles; - if (filename == null || filename.equals ("")) - filename = "com/sun/tools/corba/se/idl/idl.prp"; - filename = filename.replace ('/', File.separatorChar); - registerMessageFile (filename); - version = getMessage ("Version.product", getMessage ("Version.number")); - msgFiles = oldMsgFiles; - messages = null; - } - else - { - version = getMessage ("Version.product", getMessage ("Version.number")); - } - return version; - } // getVersion - - public static boolean isAttribute (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof AttributeEntry; - } // isAttribute - - public static boolean isConst (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof ConstEntry; - } // isConst - - public static boolean isEnum (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof EnumEntry; - } // isEnum - - public static boolean isException (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof ExceptionEntry; - } // isException - - public static boolean isInterface (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof InterfaceEntry; - } // isInterface - - public static boolean isMethod (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof MethodEntry; - } // isMethod - - public static boolean isModule (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof ModuleEntry; - } // isModule - - public static boolean isParameter (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof ParameterEntry; - } // isParameter - - public static boolean isPrimitive (String name, Hashtable symbolTable) - { - // Distinguish "string" because the name could be something like: - // string(25 + 1) - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - if (entry == null) - { - // If it is null then it may be of the form string(). - // Don't just check for string because the name "string" may - // have been overridden. - int parenIndex = name.indexOf ('('); - if (parenIndex >= 0) - entry = (SymtabEntry)symbolTable.get (name.substring (0, parenIndex)); - } - return entry == null ? false : entry instanceof PrimitiveEntry; - } // isPrimitive - - public static boolean isSequence (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof SequenceEntry; - } // isSequence - - public static boolean isStruct (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof StructEntry; - } // isStruct - - public static boolean isString (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof StringEntry; - } // isString - - public static boolean isTypedef (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof TypedefEntry; - } // isTypedef - - public static boolean isUnion (String name, Hashtable symbolTable) - { - SymtabEntry entry = (SymtabEntry)symbolTable.get (name); - return entry == null ? false : entry instanceof UnionEntry; - } // isUnion - - ////////////// - // Message-related methods - - public static String getMessage (String key) - { - if (messages == null) - readMessages (); - String message = messages.getProperty (key); - if (message == null) - message = getDefaultMessage (key); - return message; - } // getMessage - - public static String getMessage (String key, String fill) - { - if (messages == null) - readMessages (); - String message = messages.getProperty (key); - if (message == null) - message = getDefaultMessage (key); - else - { - int index = message.indexOf ("%0"); - if (index >= 0) - message = message.substring (0, index) + fill + message.substring (index + 2); - } - return message; - } // getMessage - - public static String getMessage (String key, String[] fill) - { - if (messages == null) - readMessages (); - String message = messages.getProperty (key); - if (message == null) - message = getDefaultMessage (key); - else - for (int i = 0; i < fill.length; ++i) - { - int index = message.indexOf ("%" + i); - if (index >= 0) - message = message.substring (0, index) + fill[i] + message.substring (index + 2); - } - return message; - } // getMessage - - private static String getDefaultMessage (String keyNotFound) - { - String message = messages.getProperty (defaultKey); - int index = message.indexOf ("%0"); - if (index > 0) - message = message.substring (0, index) + keyNotFound; - return message; - } // getDefaultMessage - - /* - findFile is no longer used now that FileLocator has been provided - by Larry Raper of the Shasta team. - - static File findFile (String name) throws FileNotFoundException - { - String classpath = System.getProperty ("java.class.path"); - String separator = System.getProperty ("path.separator"); - int end = -separator.length (); // so the first pass classpath == original classpath - File file; - do - { - classpath = classpath.substring (end + separator.length ()); - end = classpath.indexOf (separator); - if (end < 0) end = classpath.length (); - file = new File (classpath.substring (0, end) + File.separator + "com" + File.separator + "ibm" + File.separator + "idl" + File.separator + name); - } while (!file.exists () && end != classpath.length ()); - if (!file.exists ()) throw new FileNotFoundException (); - return file; - } // findFile - */ - - private static void readMessages () - { - messages = new Properties (); - Enumeration fileList = msgFiles.elements (); - DataInputStream stream; - while (fileList.hasMoreElements ()) - try - { - stream = FileLocator.locateLocaleSpecificFileInClassPath ((String)fileList.nextElement ()); - messages.load (stream); - } - catch (IOException e) - { - } - if (messages.size () == 0) - messages.put (defaultKey, "Error reading Messages File."); - } // readMessages - - /** Register a message file. This file will be searched for - in the CLASSPATH. */ - public static void registerMessageFile (String filename) - { - if (filename != null) - if (messages == null) - msgFiles.addElement (filename); - else - try - { - DataInputStream stream = FileLocator.locateLocaleSpecificFileInClassPath (filename); - messages.load (stream); - } - catch (IOException e) - { - } - } // registerMessageFile - - private static Properties messages = null; - private static String defaultKey = "default"; - private static Vector msgFiles = new Vector (); - static - { - msgFiles.addElement ("com/sun/tools/corba/se/idl/idl.prp"); - } - - // Message-related methods - /////////////// - - public static String capitalize (String lc) - { - String first = new String (lc.substring (0, 1)); - first = first.toUpperCase (); - return first + lc.substring (1); - } // capitalize - - /////////////// - // General file methods - - /** Searches the current user directory and a list of directories for - a given short file name and returns its absolute file specification. - @return Absolute file name of a given short filename - @throws FileNotFoundException The file does not exist in the - current user or specified directories. - @see java.io.File.getAbsolutePath */ - public static String getAbsolutePath (String filename, Vector includePaths) throws FileNotFoundException - { - String filepath = null; - File file = new File (filename); - if (file.canRead ()) - filepath = file.getAbsolutePath (); - else - { - String fullname = null; - Enumeration pathList = includePaths.elements (); - while (!file.canRead () && pathList.hasMoreElements ()) - { - fullname = (String)pathList.nextElement () + File.separatorChar + filename; - file = new File (fullname); - } - if (file.canRead ()) - filepath = file.getPath (); - else - throw new FileNotFoundException (filename); - } - return filepath; - } // getAbsolutePath - - // General file methods - /////////////// - - /////////////// - // Numeric computations - - // - /** - * Compute the absolute value of the difference between two floating-point - * numbers having single precision. - * @return the absolute value of the difference between two floats. - **/ - public static float absDelta (float f1, float f2) - { - double delta = f1 - f2; - return (float)((delta < 0) ? delta * -1.0 : delta); - } // absDelta - - // Numeric computations - /////////////// - - static RepositoryID emptyID = new RepositoryID (); -} // class Util --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxEntry.java 2018-01-30 20:25:01.000000000 -0500 +++ /dev/null 2018-01-30 20:25:01.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -/** - * This is the symbol table entry for valuesBoxes. - **/ -public class ValueBoxEntry extends ValueEntry -{ - protected ValueBoxEntry () - { - super (); - } // ctor - - protected ValueBoxEntry (ValueBoxEntry that) - { - super (that); - } // ctor - - protected ValueBoxEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - } // ctor - - public Object clone () - { - return new ValueBoxEntry (this); - } // clone - - /** Invoke the interface generator. - @param symbolTable the symbol table is a hash table whose key is a fully - qualified type name and whose value is a SymtabEntry or a subclass of - SymtabEntry. - @param stream the stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - valueBoxGen.generate (symbolTable, this, stream); - } // generate - - /** Access the value generator. - @return an object which implements the ValueGen interface. - @see ValueGen */ - public Generator generator () - { - return valueBoxGen; - } // generator - - static ValueBoxGen valueBoxGen; -} // class ValueEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxGen.java 2018-01-30 20:25:01.000000000 -0500 +++ /dev/null 2018-01-30 20:25:01.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; -import com.sun.tools.corba.se.idl.*; - -public interface ValueBoxGen extends Generator -{ - void generate (Hashtable symbolTable, ValueBoxEntry entry, PrintWriter stream); -} // interface ValueBoxGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueEntry.java 2018-01-30 20:25:02.000000000 -0500 +++ /dev/null 2018-01-30 20:25:02.000000000 -0500 @@ -1,414 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; -import com.sun.tools.corba.se.idl.constExpr.Expression; -// import com.sun.tools.corba.se.idl.som.idlemit.TypeCode; - -/** -* This is the symbol table entry for values. -**/ -public class ValueEntry extends InterfaceEntry -{ - protected ValueEntry () - { - super (); - } // ctor - - protected ValueEntry (ValueEntry that) - { - super (that); - _supportsNames = (Vector)that._supportsNames.clone (); - _supports = (Vector)that._supports.clone (); - _initializers = (Vector)that._initializers.clone (); - _custom = that._custom; - _isSafe = that._isSafe; - } // ctor - - protected ValueEntry (SymtabEntry that, IDLID clone) - { - super (that, clone); - } // ctor - - public Object clone () - { - return new ValueEntry (this); - } // clone - - /** Invoke the interface generator. - @param symbolTable The symbol table is a hash table whose key is - a fully qualified type name and whose value is a SymtabEntry or - a subclass of SymtabEntry. - @param stream The stream to which the generator should sent its output. - @see SymtabEntry */ - public void generate (Hashtable symbolTable, PrintWriter stream) - { - valueGen.generate (symbolTable, this, stream); - } // generate - - /** Access the value generator. - @return an object which implements the ValueGen interface. - @see ValueGen */ - public Generator generator () - { - return valueGen; - } // generator - - /** Add an InterfaceEntry to the list of interfaces which this value - supports. During parsing, the parameter to this method COULD be a - ForwardEntry, but when parsing is complete, calling supports will - return a vector which only contains InterfaceEntry's. */ - public void addSupport (SymtabEntry supports) - { - _supports.addElement (supports); - } // addSupport - - /** This method returns a vector of InterfaceEntry's. */ - public Vector supports () - { - return _supports; - } // supports - - /** Add to the list of support names. */ - public void addSupportName (String name) - { - _supportsNames.addElement (name); - } // addSupportName - - /** This method returns a vector of Strings, each of which is a fully - qualified name of an interface. This vector corresponds to the - supports vector. The first element of this vector is the name of - the first element of the supports vector, etc. */ - public Vector supportsNames () - { - return _supportsNames; - } // supportsNames - - /** Add a parent value type to the list of parent types for the value. - This method: -
    -
  • Allows only the first added class to be concrete if the receiver is - concrete. -
  • Does not allow any added classes to be concrete if the receiver is - abstract. -
  • Does not allow duplicate classes to be added. -
*/ - void derivedFromAddElement (SymtabEntry e, boolean isSafe, Scanner scanner) - { - if (((InterfaceType)e).getInterfaceType() != InterfaceType.ABSTRACT) { - if (isAbstract ()) - ParseException.nonAbstractParent2 (scanner, fullName (), e.fullName ()); - else if (derivedFrom ().size () > 0) - ParseException.nonAbstractParent3 (scanner, fullName (), e.fullName ()); - } - - if (derivedFrom ().contains (e)) - ParseException.alreadyDerived (scanner, e.fullName (), fullName ()); - - if (isSafe) - _isSafe = true; - - addDerivedFrom (e); - addDerivedFromName (e.fullName ()); - addParentType (e, scanner); - } // derivedFromAddElement - - void derivedFromAddElement (SymtabEntry e, Scanner scanner) - { - // This code must check for duplicate interfaces being supported... - addSupport (e); - addSupportName (e.fullName ()); - addParentType (e, scanner); - } // derivedFromAddElement - - public boolean replaceForwardDecl (ForwardEntry oldEntry, InterfaceEntry newEntry) - { - if (super.replaceForwardDecl (oldEntry, newEntry)) - return true; - int index = _supports.indexOf (oldEntry); - if ( index >= 0) - _supports.setElementAt (newEntry, index); - return (index >= 0); - } - - void initializersAddElement (MethodEntry method, Scanner scanner) - { - // Check to see if the parameter signature is a duplicate: - Vector params = method.parameters (); - int args = params.size (); - for (Enumeration e = _initializers.elements (); e.hasMoreElements ();) - { - Vector params2 = ( (MethodEntry) e.nextElement ()).parameters (); - if (args == params2.size ()) - { - int i = 0; - for (; i < args; i++) - if (!((ParameterEntry)params.elementAt (i)).type ().equals ( - ((ParameterEntry)params2.elementAt (i)).type ())) - break; - if (i >= args) - ParseException.duplicateInit (scanner); - } - } - _initializers.addElement (method); - } // initializersAddElement - - public Vector initializers () - { - return _initializers; - } - - /** Tag all methods introduced by the value type as 'value methods' so - they can be differentiated in the emitters from any interface methods - that the value type supports. */ - public void tagMethods () - { - for (Enumeration e = methods ().elements (); e.hasMoreElements ();) - ((MethodEntry)e.nextElement ()).valueMethod (true); - } - - // <46082.03> Revert to "IDL:"-style (i.e., regular) repository ID. - - /** Calculate the 'repository ID' for the value. This method should not be - called before the complete value type has been parsed, since it computes - the repository ID by computing hashcodes using all information contained - in the value type definition, not just the value type's fully qualified - name.*/ - /* - public void calcRepId () - { - ValueRepositoryId repId = new ValueRepositoryId (); - repId.addType (this); - calcRepId (repId); - String scopedName = fullName (); - // KLR - following switched to new format 8/26/98 per Simon's request - repositoryID (new RepositoryID ( "H:" + repId.getHashcode() + ":" + scopedName)); - } // calcRepId - */ - - /* - public void calcRepId (ValueRepositoryId repId) - { - Vector baseClasses = derivedFrom (); - if (baseClasses.size () >= 1) - ((ValueEntry)baseClasses.elementAt (0)).calcRepId (repId); - Vector state = state (); - if (state != null) - for (Enumeration e = state.elements (); e.hasMoreElements ();) - calcTypedefType (((InterfaceState)e.nextElement ()).entry, repId); - } // calcRepId - - private void calcValueType (ValueEntry entry, ValueRepositoryId repId) - { - if (repId.isNewType (entry)) - { - // repId.addValue (TypeCode.tk_value); - repId.addValue (org.omg.CORBA.TCKind._tk_value); - entry.calcRepId (repId); - } - } // calcValueType - - private void calcValueBoxType (ValueBoxEntry entry, ValueRepositoryId repId) - { - if (repId.isNewType (entry)) - { - // repId.addValue (TypeCode.tk_value_box); - repId.addValue (org.omg.CORBA.TCKind._tk_value_box); - entry.calcRepId (repId); - } - } // calcValueBoxType - - private void calcTypedefType (TypedefEntry entry, ValueRepositoryId repId) - { - if (repId.isNewType (entry)) - { - Vector arrayInfo = entry.arrayInfo (); - if (arrayInfo.size () > 0) - { - // repId.addValue (TypeCode.tk_array); - repId.addValue (org.omg.CORBA.TCKind._tk_array); - for (Enumeration e = arrayInfo.elements (); e.hasMoreElements ();) - repId.addValue (((Number)((Expression)e.nextElement ()).value ()).intValue ()); - } - calcType (entry.type (), repId); - } - } // calcTypedefType - - private void calcType (SymtabEntry entry, ValueRepositoryId repId) - { - if (entry instanceof TypedefEntry) - calcTypedefType ((TypedefEntry)entry, repId); - else if (entry instanceof PrimitiveEntry) - calcPrimitiveType (entry, repId); - else if (entry instanceof InterfaceEntry) - // repId.addValue (TypeCode._tk_objref); - repId.addValue (org.omg.CORBA.TCKind._tk_objref); - else if (entry instanceof EnumEntry) - // repId.addValue (TypeCode._tk_enum); - repId.addValue (org.omg.CORBA.TCKind._tk_enum); - else if (entry instanceof StringEntry) - calcStringType ( (StringEntry) entry, repId); - else if (entry instanceof SequenceEntry) - calcSequenceType ( (SequenceEntry) entry, repId); - else if (entry instanceof StructEntry) - calcStructType ( (StructEntry) entry, repId); - else if (entry instanceof UnionEntry) - calcUnionType ( (UnionEntry) entry, repId); - else if (entry instanceof ValueBoxEntry) - calcValueBoxType ( (ValueBoxEntry) entry, repId); - else if (entry instanceof ValueEntry) - calcValueType ( (ValueEntry) entry, repId); - } // calcType - - private static Hashtable primTypes; - - private void calcPrimitiveType (SymtabEntry entry, ValueRepositoryId repId) - { - if (primTypes == null) - { - primTypes = new Hashtable (); - // primTypes.put ("short", new Integer (TypeCode.tk_short )); - primTypes.put ("short", new Integer (org.omg.CORBA.TCKind._tk_short )); - // primTypes.put ("long", new Integer (TypeCode.tk_long )); - primTypes.put ("long", new Integer (org.omg.CORBA.TCKind._tk_long )); - // primTypes.put ("unsigned short", new Integer (TypeCode.tk_ushort )); - primTypes.put ("unsigned short", new Integer (org.omg.CORBA.TCKind._tk_ushort )); - // primTypes.put ("unsigned long", new Integer (TypeCode.tk_ulong )); - primTypes.put ("unsigned long", new Integer (org.omg.CORBA.TCKind._tk_ulong )); - // primTypes.put ("char", new Integer (TypeCode.tk_char )); - primTypes.put ("char", new Integer (org.omg.CORBA.TCKind._tk_char )); - // primTypes.put ("wchar", new Integer (TypeCode.tk_wchar )); - primTypes.put ("wchar", new Integer (org.omg.CORBA.TCKind._tk_wchar )); - // primTypes.put ("float", new Integer (TypeCode.tk_float )); - primTypes.put ("float", new Integer (org.omg.CORBA.TCKind._tk_float )); - // primTypes.put ("double", new Integer (TypeCode.tk_double )); - primTypes.put ("double", new Integer (org.omg.CORBA.TCKind._tk_double )); - // primTypes.put ("boolean", new Integer (TypeCode.tk_boolean)); - primTypes.put ("boolean", new Integer (org.omg.CORBA.TCKind._tk_boolean)); - // primTypes.put ("octet", new Integer (TypeCode.tk_octet )); - primTypes.put ("octet", new Integer (org.omg.CORBA.TCKind._tk_octet )); - // primTypes.put ("any", new Integer (TypeCode.tk_any )); } - primTypes.put ("any", new Integer (org.omg.CORBA.TCKind._tk_any )); - } - repId.addValue (((Integer)primTypes.get (entry.name ())).intValue ()); - } // calcPrimitiveType - - private void calcStringType (StringEntry entry, ValueRepositoryId repId) - { - repId.addValue (entry.name ().equals (Parser.overrideName ("string")) ? - // TypeCode.tk_string: - org.omg.CORBA.TCKind._tk_string : - // TypeCode.tk_wstring); - org.omg.CORBA.TCKind._tk_wstring); - if (entry.maxSize () != null) - try - { - repId.addValue ( ( (Number) (entry.maxSize ()).value ()). intValue ()); - } - catch (Exception exception) - {} - } // calcStringType - - private void calcSequenceType (SequenceEntry entry, ValueRepositoryId repId) - { - // repId.addValue (TypeCode.tk_sequence); - repId.addValue (org.omg.CORBA.TCKind._tk_sequence); - if (entry.maxSize () != null) - try - { - repId.addValue (((Number)(entry.maxSize ()).value ()).intValue ()); - } - catch (Exception exception) - {} - } // calcSequenceType - - private void calcStructType (StructEntry entry, ValueRepositoryId repId) - { - if (repId.isNewType (entry)) - { - // repId.addValue (TypeCode.tk_struct); - repId.addValue (org.omg.CORBA.TCKind._tk_struct); - for (Enumeration e = entry.members ().elements (); e.hasMoreElements ();) - calcTypedefType ( (TypedefEntry) e.nextElement (), repId); - } - } // calcStructType - - private void calcUnionType (UnionEntry entry, ValueRepositoryId repId) - { - if (repId.isNewType (entry)) - { - // repId.addValue (TypeCode.tk_union); - repId.addValue (org.omg.CORBA.TCKind._tk_union); - calcType (entry.type (), repId); - for (Enumeration e = entry.branches ().elements (); e.hasMoreElements ();) - calcTypedefType ( ( (UnionBranch) e.nextElement ()).typedef, repId); - } - } // calcUnionType -*/ - - /** Get the 'custom' marshaling property. */ - public boolean isCustom () - { - return _custom; - } - - /** Set the 'custom' marshaling property. */ - public void setCustom (boolean isCustom) - { - _custom = isCustom; - } - - /** Return whether or not the value type can be "safely" truncated to - its concrete parent type. */ - public boolean isSafe () - { - return _isSafe; - } - - private Vector _supportsNames = new Vector (); - private Vector _supports = new Vector (); - private Vector _initializers = new Vector (); - private boolean _custom = false; - private boolean _isSafe = false; - - static ValueGen valueGen; -} // class ValueEntry --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueGen.java 2018-01-30 20:25:03.000000000 -0500 +++ /dev/null 2018-01-30 20:25:03.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; -import com.sun.tools.corba.se.idl.*; - -public interface ValueGen extends Generator { - void generate ( Hashtable symbolTable, ValueEntry entry, PrintWriter stream); -} // interface ValueGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueRepositoryId.java 2018-01-30 20:25:04.000000000 -0500 +++ /dev/null 2018-01-30 20:25:04.000000000 -0500 @@ -1,131 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl; - -// NOTES: - -import java.security.MessageDigest; -import java.util.Hashtable; - -/** - * - **/ -public class ValueRepositoryId -{ - private MessageDigest sha; // Message digest used to compute SHA-1 - private int index; // Current index in the 'logical' sequence - private Hashtable types; // Already processed types - private String hashcode; // The computed hashcode - - public ValueRepositoryId () - { - try - { - sha = MessageDigest.getInstance ("SHA-1"); - } - catch (Exception exception) - {} - index = 0; - types = new Hashtable (); - hashcode = null; - } // ctor - - /**Add a value to the hashcode being computed. - @param value the value to be added to the value RepositoryID. */ - public void addValue (int value) - { - sha.update ((byte)((value >> 24) & 0x0F)); - sha.update ((byte)((value >> 16) & 0x0F)); - sha.update ((byte)((value >> 8) & 0x0F)); - sha.update ((byte)(value & 0x0F)); - index++; - } // addValue - - /** Add a type to the list of types which have already been included. - Note that the type should be added prior to its value. - @param entry the type to be added to the value RepositoryID. */ - public void addType (SymtabEntry entry) - { - types.put (entry, new Integer (index)); - } - - /** Check to see if a specified type has already been processed. If so, - add the appropriate 'previously processed' code (0xFFFFFFFF) and - sequence offset, and return false; otherwise add the symbol table entry - and current offset to the hashtable and return false. - @param entry the type to be checked - @return true if the symbol table entry has not been previously added; - and false otherwise. */ - public boolean isNewType (SymtabEntry entry) - { - Object index = types.get (entry); - if (index == null) - { - addType (entry); - return true; - } - addValue (0xFFFFFFFF); - addValue (((Integer)index).intValue ()); - return false; - } // isNewType - - /** Get the hashcode computed for the value type. This method MUST not be - called until all fields have been added, since it computes the hash - code from the values entered for each field. - @return the 64 bit hashcode for the value type represented as a - 16 character hexadecimal string. */ - public String getHashcode () - { - if (hashcode == null) - { - byte [] digest = sha.digest (); - hashcode = hexOf (digest[0]) + hexOf (digest[1]) + - hexOf (digest[2]) + hexOf (digest[3]) + - hexOf (digest[4]) + hexOf (digest[5]) + - hexOf (digest[6]) + hexOf (digest[7]); - } - return hashcode; - } // getHashCode - - // Convert a byte to a two character hex string: - private static String hexOf (byte value) - { - int d1 = (value >> 4) & 0x0F; - int d2 = value & 0x0F; - return "0123456789ABCDEF".substring (d1, d1 + 1) + - "0123456789ABCDEF".substring (d2, d2 + 1); - } // hexOf -} // class ValueRepositoryId --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/And.java 2018-01-30 20:25:04.000000000 -0500 +++ /dev/null 2018-01-30 20:25:04.000000000 -0500 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class And extends BinaryExpr -{ - protected And (Expression leftOperand, Expression rightOperand) - { - super ("&", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - { - String[] parameters = {Util.getMessage ("EvaluationException.and"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - // Arithmetic and (&) - //daz value (new Long (l.longValue () & r.longValue ())); - BigInteger uL = (BigInteger)coerceToTarget ((BigInteger)l); - BigInteger uR = (BigInteger)coerceToTarget ((BigInteger)r); - value (uL.and (uR)); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.and"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class And --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java 2018-01-30 20:25:05.000000000 -0500 +++ /dev/null 2018-01-30 20:25:05.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public abstract class BinaryExpr extends Expression -{ - public BinaryExpr (String operation, Expression leftOperand, Expression rightOperand) - { - _op = operation; - _left = leftOperand; - _right = rightOperand; - } // ctor - - public void op (String op) {_op = (op == null)? "": op;} - public String op () {return _op;} - - public void left (Expression left) {_left = left;} - public Expression left () {return _left;} - - public void right (Expression right) {_right = right;} - public Expression right () {return _right;} - - private String _op = ""; - private Expression _left = null; - private Expression _right = null; -} // class BinaryExpr --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java 2018-01-30 20:25:06.000000000 -0500 +++ /dev/null 2018-01-30 20:25:06.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class BooleanAnd extends BinaryExpr -{ - protected BooleanAnd (Expression leftOperand, Expression rightOperand) - { - super ("&&", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Object tmpL = left ().evaluate (); - Object tmpR = right ().evaluate (); - Boolean l; - Boolean r; - - //daz if (tmpL instanceof Number) - // l = new Boolean (((Number)tmpL).longValue () != 0); - // else - // l = (Boolean)tmpL; - if (tmpL instanceof Number) - { - if (tmpL instanceof BigInteger) - l = new Boolean (((BigInteger)tmpL).compareTo (BigInteger.valueOf (0)) != 0); - else - l = new Boolean (((Number)tmpL).longValue () != 0); - } - else - l = (Boolean)tmpL; - //daz if (tmpR instanceof Number) - // r = new Boolean (((Number)tmpR).longValue () != 0); - // else - // r = (Boolean)tmpR; - if (tmpR instanceof Number) - { - if (tmpR instanceof BigInteger) - r = new Boolean (((BigInteger)tmpR).compareTo (zero) != 0); - else - r = new Boolean (((Number)tmpR).longValue () != 0); - } - else - r = (Boolean)tmpR; - - value (new Boolean (l.booleanValue () && r.booleanValue ())); - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.booleanAnd"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class BooleanAnd --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanNot.java 2018-01-30 20:25:06.000000000 -0500 +++ /dev/null 2018-01-30 20:25:06.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class BooleanNot extends UnaryExpr -{ - protected BooleanNot (Expression operand) - { - super ("!", operand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Object tmp = operand ().evaluate (); - Boolean op; - //daz if (tmp instanceof Number) - // op = new Boolean (((Number)tmp).longValue () != 0); - // else - // op = (Boolean)tmp; - if (tmp instanceof Number) - { - if (tmp instanceof BigInteger) - op = new Boolean (((BigInteger)tmp).compareTo (zero) != 0); - else - op = new Boolean (((Number)tmp).longValue () != 0); - } - else - op = (Boolean)tmp; - - value (new Boolean (!op.booleanValue ())); - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.booleanNot"), operand ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters)); - } - return value (); - } // evaluate -} // class BooleanNot --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanOr.java 2018-01-30 20:25:07.000000000 -0500 +++ /dev/null 2018-01-30 20:25:07.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class BooleanOr extends BinaryExpr -{ - protected BooleanOr (Expression leftOperand, Expression rightOperand) - { - super ("||", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Object tmpL = left ().evaluate (); - Object tmpR = right ().evaluate (); - Boolean l; - Boolean r; - - //daz if (tmpL instanceof Number) - // l = new Boolean (((Number)tmpL).longValue () != 0); - // else - // l = (Boolean)tmpL; - if (tmpL instanceof Number) - { - if (tmpL instanceof BigInteger) - l = new Boolean (((BigInteger)tmpL).compareTo (zero) != 0); - else - l = new Boolean (((Number)tmpL).longValue () != 0); - } - else - l = (Boolean)tmpL; - //daz if (tmpR instanceof Number) - // r = new Boolean (((Number)tmpR).longValue () != 0); - // else - // r = (Boolean)tmpR; - if (tmpR instanceof Number) - { - if (tmpR instanceof BigInteger) - r = new Boolean (((BigInteger)tmpR).compareTo (BigInteger.valueOf (0)) != 0); - else - r = new Boolean (((Number)tmpR).longValue () != 0); - } - else - r = (Boolean)tmpR; - value (new Boolean (l.booleanValue () || r.booleanValue ())); - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.booleanOr"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class BooleanOr --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java 2018-01-30 20:25:08.000000000 -0500 +++ /dev/null 2018-01-30 20:25:08.000000000 -0500 @@ -1,191 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.ConstEntry; -import java.math.BigInteger; - -public class DefaultExprFactory implements ExprFactory -{ - public And and (Expression left, Expression right) - { - return new And (left, right); - } // and - - public BooleanAnd booleanAnd (Expression left, Expression right) - { - return new BooleanAnd (left, right); - } // booleanAnd - - public BooleanNot booleanNot (Expression operand) - { - return new BooleanNot (operand); - } // booleanNot - - public BooleanOr booleanOr (Expression left, Expression right) - { - return new BooleanOr (left, right); - } // booleanOr - - public Divide divide (Expression left, Expression right) - { - return new Divide (left, right); - } // divide - - public Equal equal (Expression left, Expression right) - { - return new Equal (left, right); - } // equal - - public GreaterEqual greaterEqual (Expression left, Expression right) - { - return new GreaterEqual (left, right); - } // greaterEqual - - public GreaterThan greaterThan (Expression left, Expression right) - { - return new GreaterThan (left, right); - } // greaterThan - - public LessEqual lessEqual (Expression left, Expression right) - { - return new LessEqual (left, right); - } // lessEqual - - public LessThan lessThan (Expression left, Expression right) - { - return new LessThan (left, right); - } // lessThan - - public Minus minus (Expression left, Expression right) - { - return new Minus (left, right); - } // minus - - public Modulo modulo (Expression left, Expression right) - { - return new Modulo (left, right); - } // modulo - - public Negative negative (Expression operand) - { - return new Negative (operand); - } // negative - - public Not not (Expression operand) - { - return new Not (operand); - } // not - - public NotEqual notEqual (Expression left, Expression right) - { - return new NotEqual (left, right); - } // notEqual - - public Or or (Expression left, Expression right) - { - return new Or (left, right); - } // or - - public Plus plus (Expression left, Expression right) - { - return new Plus (left, right); - } // plus - - public Positive positive (Expression operand) - { - return new Positive (operand); - } // positive - - public ShiftLeft shiftLeft (Expression left, Expression right) - { - return new ShiftLeft (left, right); - } // shiftLeft - - public ShiftRight shiftRight (Expression left, Expression right) - { - return new ShiftRight (left, right); - } // shiftRight - - public Terminal terminal (String representation, Character charValue, - boolean isWide ) - { - return new Terminal (representation, charValue, isWide ); - } // ctor - - public Terminal terminal (String representation, Boolean booleanValue) - { - return new Terminal (representation, booleanValue); - } // ctor - - // Support long long - public Terminal terminal (String representation, BigInteger bigIntegerValue) - { - return new Terminal (representation, bigIntegerValue); - } // ctor - - //daz public Terminal terminal (String representation, Long longValue) - // { - // return new Terminal (representation, longValue); - // } // ctor - - public Terminal terminal (String representation, Double doubleValue) - { - return new Terminal (representation, doubleValue); - } // ctor - - public Terminal terminal (String stringValue, boolean isWide ) - { - return new Terminal (stringValue, isWide); - } // ctor - - public Terminal terminal (ConstEntry constReference) - { - return new Terminal (constReference); - } // ctor - - public Times times (Expression left, Expression right) - { - return new Times (left, right); - } // times - - public Xor xor (Expression left, Expression right) - { - return new Xor (left, right); - } // xor -} // class DefaultExprFactory --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Divide.java 2018-01-30 20:25:08.000000000 -0500 +++ /dev/null 2018-01-30 20:25:08.000000000 -0500 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: -// -D52042 Added protypical code for computing mixed-operand binary -// expressions, which promotes result to Double only when the target type -// is floating-point. Code violates spec, but may be usable at some future -// time. - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -/** - * - **/ -public class Divide extends BinaryExpr -{ - /** - * Constructor: set operation and operands. - **/ - protected Divide (Expression leftOperand, Expression rightOperand) - { - super ("/", leftOperand, rightOperand); - } // ctor - - /** - * - **/ - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - boolean lIsNonInteger = l instanceof Float || l instanceof Double; - boolean rIsNonInteger = r instanceof Float || r instanceof Double; - - if (lIsNonInteger && rIsNonInteger) - value (new Double (l.doubleValue () / r.doubleValue ())); - else if (lIsNonInteger || rIsNonInteger) - { - String[] parameters = {Util.getMessage ("EvaluationException.divide"), - left ().value ().getClass ().getName (), - right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r; - value (tmpL.divide (tmpR)); - } - // Allow evaluation over mixed operands. Supplant code above. - /* - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - boolean lIsNonInteger = l instanceof Float || l instanceof Double; - boolean rIsNonInteger = r instanceof Float || r instanceof Double; - - // Floating-point operands. - if (lIsNonInteger && rIsNonInteger) - { - value (new Double (l.doubleValue () / r.doubleValue ())); - } - // Integral operands. - else if (!(lIsNonInteger || rIsNonInteger)) - { - BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r; - value (tmpL.divide (tmpR)); - } - // Mixed operands: one operand is floating-point, the other is integral. - else - { - // Legal over floating-point types only. - if (type ().equals ("float") || - type ().equals ("double")) - { - value (new Double (l.doubleValue () / r.doubleValue ())); - } - else - { - String[] parameters = {Util.getMessage ("EvaluationException.divide"), - left ().value ().getClass ().getName (), - right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - } - */ - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.divide"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class Divide --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Equal.java 2018-01-30 20:25:09.000000000 -0500 +++ /dev/null 2018-01-30 20:25:09.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Equal extends BinaryExpr -{ - protected Equal (Expression leftOperand, Expression rightOperand) - { - super ("==", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Object left = left ().evaluate (); - if (left instanceof Boolean) - { - Boolean l = (Boolean)left; - Boolean r = (Boolean)right ().evaluate (); - value (new Boolean (l.booleanValue () == r.booleanValue())); - } - else - { - Number l = (Number)left; - Number r = (Number)right ().evaluate (); - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - value (new Boolean (l.doubleValue () == r.doubleValue ())); - else - //daz value (new Boolean (l.longValue () == r.longValue ())); - value (new Boolean (((BigInteger)l).equals ((BigInteger)r))); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.equal"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class Equal --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/EvaluationException.java 2018-01-30 20:25:10.000000000 -0500 +++ /dev/null 2018-01-30 20:25:10.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -public class EvaluationException extends Exception -{ - public EvaluationException (String message) - { - super (message); - } // ctor -} // class EvaluationException --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ExprFactory.java 2018-01-30 20:25:10.000000000 -0500 +++ /dev/null 2018-01-30 20:25:10.000000000 -0500 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.ConstEntry; -import java.math.BigInteger; - -public interface ExprFactory -{ - And and (Expression left, Expression right); - BooleanAnd booleanAnd (Expression left, Expression right); - BooleanNot booleanNot (Expression operand); - BooleanOr booleanOr (Expression left, Expression right); - Divide divide (Expression left, Expression right); - Equal equal (Expression left, Expression right); - GreaterEqual greaterEqual (Expression left, Expression right); - GreaterThan greaterThan (Expression left, Expression right); - LessEqual lessEqual (Expression left, Expression right); - LessThan lessThan (Expression left, Expression right); - Minus minus (Expression left, Expression right); - Modulo modulo (Expression left, Expression right); - Negative negative (Expression operand); - Not not (Expression operand); - NotEqual notEqual (Expression left, Expression right); - Or or (Expression left, Expression right); - Plus plus (Expression left, Expression right); - Positive positive (Expression operand); - ShiftLeft shiftLeft (Expression left, Expression right); - ShiftRight shiftRight (Expression left, Expression right); - Terminal terminal (String representation, Character charValue, - boolean isWide ); - Terminal terminal (String representation, Boolean booleanValue); - //daz Terminal terminal (String representation, Long longValue); - Terminal terminal (String representation, Double doubleValue); - Terminal terminal (String representation, BigInteger bigIntegerValue); - Terminal terminal (String stringValue, boolean isWide ); - Terminal terminal (ConstEntry constReference); - Times times (Expression left, Expression right); - Xor xor (Expression left, Expression right); -} // interface ExprFactory --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Expression.java 2018-01-30 20:25:11.000000000 -0500 +++ /dev/null 2018-01-30 20:25:11.000000000 -0500 @@ -1,258 +0,0 @@ -/* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import java.math.BigInteger; - -public abstract class Expression -{ - /** - * Compute the value of this expression. - **/ - public abstract Object evaluate () throws EvaluationException; - - /** - * Set the value of this expression. - **/ - public void value (Object value) - { - _value = value; - } - /** - * Get the value of this expression. - **/ - public Object value () - { - return _value; - } - - /** - * Set the representation of this expression. - **/ - public void rep (String rep) - { - _rep = rep; - } - /** - * Get the representation of this expression. - **/ - public String rep () - { - return _rep; - } - - /** - * Set the target type of this expression. - **/ - public void type (String type) - { - _type = type; - } - /** - * Get the target type of this expression. - **/ - public String type () - { - return _type; - } - - /** - * Return the default computation type for the given target type. - **/ - protected static String defaultType (String targetType) - { - return (targetType == null) ? new String ("") : targetType; - } // defaultType - - // BigInteger is a multi-precision number whose representation contains - // a signum (sign-number = 1, -1) and a magnitude. To support "long long", - // all integer expressions are now performed over BigInteger and stored as - // such. During the evaluation of an integer expression, the signum of its - // value may toggle, which may cause the value of an expression to conflict - // with its target type: [Case 1] If the resulting value is negative - // (signum=-1) and the target type is unsigned; or [Case 2] if the resulting - // value is positive (signum=1) and greater than 2**(target-type-length - 1), - // and the target type is signed, then the resulting value will be out of - // range. However, this value is correct and must be coerced to the target - // type. E.G., After appying "not" to a BigInteger, the result is - // a BigInteger that represents its 2's-complement (~5 => -6 in a byte-space). - // In this example, the signum toggles and the magnatude is 6. If the target - // type of this value were unsigned short, it must be coerced to a positive - // number whose bits truly represent -6 in 2's-complement (250 in a byte-space). - // - // Also, floating types may now be intialized with any integer expression. - // The result must be coerced to Double. - // - // Use the following routines to coerce this expression's value to its - // "target" type. - - /** - * Coerces a number to the target type of this expression. - * @param obj The number to coerce. - * @return the value of number coerced to the (target) type of - * this expression. - **/ - public Object coerceToTarget (Object obj) - { - if (obj instanceof BigInteger) - { - if (type ().indexOf ("unsigned") >= 0) - return toUnsignedTarget ((BigInteger)obj); - else - return toSignedTarget ((BigInteger)obj); - } - return obj; - } // coerceToTarget - - /** - * Coerces an integral value (BigInteger) to its corresponding unsigned - * representation, if the target type of this expression is unsigned. - * @param b The BigInteger to be coerced. - * @return the value of an integral type coerced to its corresponding - * unsigned integral type, if the target type of this expression is - * unsigned. - **/ - protected BigInteger toUnsignedTarget (BigInteger b) - { - if (type ().equals ("unsigned short")) // target type of this expression - { - if (b != null && b.compareTo (zero) < 0) // error if value < min = -(2**(l-1)). - return b.add (twoPow16); - } - else if (type ().equals ("unsigned long")) - { - if (b != null && b.compareTo (zero) < 0) - return b.add (twoPow32); - } - else if (type ().equals ("unsigned long long")) - { - if (b != null && b.compareTo (zero) < 0) - return b.add (twoPow64); - } - return b; - } // toUnsignedTarget - - /** - * Coerces an integral value (BigInteger) to its corresponding signed - * representation, if the target type of this expression is signed. - * @param b The BigInteger to be coerced. - * @return the value of an integral type coerced to its corresponding - * signed integral type, if the target type of this expression is - * signed. - **/ - protected BigInteger toSignedTarget (BigInteger b) - { - if (type ().equals ("short")) - { - if (b != null && b.compareTo (sMax) > 0) - return b.subtract (twoPow16); - } - else if (type ().equals ("long")) - { - if (b != null && b.compareTo (lMax) > 0) - return b.subtract (twoPow32); - } - else if (type ().equals ("long long")) - { - if (b != null && b.compareTo (llMax) > 0) - return b.subtract (twoPow64); - } - return b; - } // toSignedTarget - - /** - * Return the unsigned value of a BigInteger. - **/ - protected BigInteger toUnsigned (BigInteger b) - { - if (b != null && b.signum () == -1) - if (type ().equals ("short")) - return b.add (twoPow16); - else if (type ().equals ("long")) - return b.add (twoPow32); - else if (type ().equals ("long long")) - return b.add (twoPow64); - return b; - } - - // Integral-type boundaries. - - public static final BigInteger negOne = BigInteger.valueOf (-1); - public static final BigInteger zero = BigInteger.valueOf (0); - public static final BigInteger one = BigInteger.valueOf (1); - public static final BigInteger two = BigInteger.valueOf (2); - - public static final BigInteger twoPow15 = two.pow (15); - public static final BigInteger twoPow16 = two.pow (16); - public static final BigInteger twoPow31 = two.pow (31); - public static final BigInteger twoPow32 = two.pow (32); - public static final BigInteger twoPow63 = two.pow (63); - public static final BigInteger twoPow64 = two.pow (64); - - public static final BigInteger sMax = BigInteger.valueOf (Short.MAX_VALUE); - public static final BigInteger sMin = BigInteger.valueOf (Short.MAX_VALUE); - - public static final BigInteger usMax = sMax.multiply (two).add (one); - public static final BigInteger usMin = zero; - - public static final BigInteger lMax = BigInteger.valueOf (Integer.MAX_VALUE); - public static final BigInteger lMin = BigInteger.valueOf (Integer.MAX_VALUE); - - public static final BigInteger ulMax = lMax.multiply (two).add (one); - public static final BigInteger ulMin = zero; - - public static final BigInteger llMax = BigInteger.valueOf (Long.MAX_VALUE); - public static final BigInteger llMin = BigInteger.valueOf (Long.MIN_VALUE); - - public static final BigInteger ullMax = llMax.multiply (two).add (one); - public static final BigInteger ullMin = zero; - - /** - * Value of this expression: Boolean, Char, Byte, BigInteger, Double, - * String, Expression, ConstEntry. - **/ - private Object _value = null; - /** - * String representation of this expression. - **/ - private String _rep = null; - /** - * Computation type of this (sub)expression = Target type for now. - **/ - private String _type = null; -} // abstract class Expression --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java 2018-01-30 20:25:12.000000000 -0500 +++ /dev/null 2018-01-30 20:25:12.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class GreaterEqual extends BinaryExpr -{ - protected GreaterEqual (Expression leftOperand, Expression rightOperand) - { - super (">=", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Object left = left ().evaluate (); - Object right = right ().evaluate (); - if (left instanceof Boolean) - { - String[] parameters = {Util.getMessage ("EvaluationException.greaterEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - Number l = (Number)left; - Number r = (Number)right ().evaluate (); - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - value (new Boolean (l.doubleValue () >= r.doubleValue ())); - else - //daz value (new Boolean (l.longValue () >= r.longValue ())); - value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) >= 0)); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.greaterEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class GreaterEqual --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java 2018-01-30 20:25:13.000000000 -0500 +++ /dev/null 2018-01-30 20:25:13.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class GreaterThan extends BinaryExpr -{ - protected GreaterThan (Expression leftOperand, Expression rightOperand) - { - super (">", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Object left = left ().evaluate (); - Object right = right ().evaluate (); - if (left instanceof Boolean) - { - String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - Number l = (Number)left; - Number r = (Number)right ().evaluate (); - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - value (new Boolean (l.doubleValue () > r.doubleValue ())); - else - //daz value (new Boolean (l.longValue () > r.longValue ())); - value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) > 0)); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class GreaterThan --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessEqual.java 2018-01-30 20:25:13.000000000 -0500 +++ /dev/null 2018-01-30 20:25:13.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class LessEqual extends BinaryExpr -{ - protected LessEqual (Expression leftOperand, Expression rightOperand) - { - super ("<=", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Object left = left ().evaluate (); - Object right = right ().evaluate (); - if (left instanceof Boolean) - { - String[] parameters = {Util.getMessage ("EvaluationException.lessEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - Number l = (Number)left; - Number r = (Number)right ().evaluate (); - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - value (new Boolean (l.doubleValue () <= r.doubleValue ())); - else - //daz value (new Boolean (l.longValue () <= r.longValue ())); - value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) <= 0)); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.lessEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class LessEqual --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessThan.java 2018-01-30 20:25:14.000000000 -0500 +++ /dev/null 2018-01-30 20:25:14.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class LessThan extends BinaryExpr -{ - protected LessThan (Expression leftOperand, Expression rightOperand) - { - super ("<", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Object left = left ().evaluate (); - Object right = right ().evaluate (); - if (left instanceof Boolean) - { - String[] parameters = {Util.getMessage ("EvaluationException.lessThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - Number l = (Number)left; - Number r = (Number)right ().evaluate (); - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - value (new Boolean (l.doubleValue () < r.doubleValue ())); - else - //daz value (new Boolean (l.longValue () < r.longValue ())); - value (new Boolean (((BigInteger)l).compareTo ((BigInteger)r) < 0)); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.lessThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class LessThan --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Minus.java 2018-01-30 20:25:15.000000000 -0500 +++ /dev/null 2018-01-30 20:25:15.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Minus extends BinaryExpr -{ - protected Minus (Expression leftOperand, Expression rightOperand) - { - super ("-", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - boolean lIsNonInteger = l instanceof Float || l instanceof Double; - boolean rIsNonInteger = r instanceof Float || r instanceof Double; - - if (lIsNonInteger && rIsNonInteger) - value (new Double (l.doubleValue () - r.doubleValue ())); - else if (lIsNonInteger || rIsNonInteger) - { - String[] parameters = {Util.getMessage ("EvaluationException.minus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - // Subtraction (-) - BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r; - value (tmpL.subtract (tmpR)); - //daz value (new Long (l.longValue () - r.longValue ())); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.minus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class Minus --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Modulo.java 2018-01-30 20:25:15.000000000 -0500 +++ /dev/null 2018-01-30 20:25:16.000000000 -0500 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Modulo extends BinaryExpr -{ - protected Modulo (Expression leftOperand, Expression rightOperand) - { - super ("%", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - { - String[] parameters = {Util.getMessage ("EvaluationException.mod"), left().value ().getClass ().getName (), right().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - // Modulo (%) - BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r; - value (tmpL.remainder (tmpR)); - //daz value (tmpL.mod (tmpR)); Requires positive modulus; not required by IDL. - //daz value (new Long (l.longValue () % r.longValue ())); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.mod"), left().value ().getClass ().getName (), right().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class Modulo --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Negative.java 2018-01-30 20:25:16.000000000 -0500 +++ /dev/null 2018-01-30 20:25:16.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Negative extends UnaryExpr -{ - protected Negative (Expression operand) - { - super ("-", operand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number op = (Number)operand ().evaluate (); - - if (op instanceof Float || op instanceof Double) - value (new Double (-op.doubleValue ())); - else - { - // Multiply by -1 - //daz value (new Long (-op.longValue ())); - BigInteger tmpOp = (BigInteger)op; - value (tmpOp.multiply (BigInteger.valueOf (-1))); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.neg"), operand ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters)); - } - return value (); - } // evaluate -} // class Negative --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Not.java 2018-01-30 20:25:17.000000000 -0500 +++ /dev/null 2018-01-30 20:25:17.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Not extends UnaryExpr -{ - protected Not (Expression operand) - { - super ("~", operand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number op = (Number)operand ().evaluate (); - - if (op instanceof Float || op instanceof Double) - { - String[] parameters = {Util.getMessage ("EvaluationException.not"), operand ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters)); - } - else - { - // Complement (~) - //daz value (new Long (~op.longValue ())); - BigInteger b = (BigInteger)coerceToTarget((BigInteger)op); - - // Compute according to CORBA 2.1 specifications for specified type. - if (type ().equals ("short") || type ().equals ("long") || type ().equals ("long long")) - value (b.add (one).multiply (negOne)); - else if (type ().equals("unsigned short")) - // "short" not CORBA compliant, but necessary for logical operations--size matters! - value (twoPow16.subtract (one).subtract (b)); - else if (type ().equals ("unsigned long")) - value (twoPow32.subtract (one).subtract (b)); - else if (type ().equals ("unsigned long long")) - value (twoPow64.subtract (one).subtract (b)); - else - value (b.not ()); // Should never execute... - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.not"), operand ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters)); - } - return value (); - } // evaluate -} // class Not --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/NotEqual.java 2018-01-30 20:25:18.000000000 -0500 +++ /dev/null 2018-01-30 20:25:18.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class NotEqual extends BinaryExpr -{ - protected NotEqual (Expression leftOperand, Expression rightOperand) - { - super ("!=", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Object left = left ().evaluate (); - if (left instanceof Boolean) - { - Boolean l = (Boolean)left; - Boolean r = (Boolean)right ().evaluate (); - value (new Boolean (l.booleanValue () != r.booleanValue())); - } - else - { - Number l = (Number)left; - Number r = (Number)right ().evaluate (); - - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - value (new Boolean (l.doubleValue () != r.doubleValue ())); - else - //daz value (new Boolean (l.longValue () != r.longValue ())); - value (new Boolean (!((BigInteger)l).equals ((BigInteger)r))); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.notEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class NotEqual --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Or.java 2018-01-30 20:25:18.000000000 -0500 +++ /dev/null 2018-01-30 20:25:18.000000000 -0500 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Or extends BinaryExpr -{ - protected Or (Expression leftOperand, Expression rightOperand) - { - super ("|", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - { - String[] parameters = {Util.getMessage ("EvaluationException.or"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - // or - //daz value (new Long (l.longValue () | r.longValue ())); - BigInteger uL = (BigInteger)toUnsigned((BigInteger)l); - BigInteger uR = (BigInteger)toUnsigned((BigInteger)r); - value((BigInteger)coerceToTarget(uL.or (uR))); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.or"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class Or --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Plus.java 2018-01-30 20:25:19.000000000 -0500 +++ /dev/null 2018-01-30 20:25:19.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Plus extends BinaryExpr -{ - protected Plus (Expression leftOperand, Expression rightOperand) - { - super ("+", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - boolean lIsNonInteger = l instanceof Float || l instanceof Double; - boolean rIsNonInteger = r instanceof Float || r instanceof Double; - - if (lIsNonInteger && rIsNonInteger) - value (new Double (l.doubleValue () + r.doubleValue ())); - else if (lIsNonInteger || rIsNonInteger) - { - String[] parameters = {Util.getMessage ("EvaluationException.plus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - // Addition (+) - BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r; - value (tmpL.add (tmpR)); - //daz value (new Long (l.longValue () + r.longValue ())); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.plus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class Plus --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Positive.java 2018-01-30 20:25:20.000000000 -0500 +++ /dev/null 2018-01-30 20:25:20.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Positive extends UnaryExpr -{ - protected Positive (Expression operand) - { - super ("+", operand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number op = (Number)operand ().evaluate (); - - if (op instanceof Float || op instanceof Double) - value (new Double (+op.doubleValue ())); - else - { - // Multiply by sign - //daz value (new Long (+op.longValue ())); - value (((BigInteger)op).multiply (BigInteger.valueOf (((BigInteger)op).signum ()))); - //promote (); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.pos"), operand ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters)); - } - return value (); - } // evaluate -} // class Positive --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java 2018-01-30 20:25:20.000000000 -0500 +++ /dev/null 2018-01-30 20:25:20.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class ShiftLeft extends BinaryExpr -{ - protected ShiftLeft (Expression leftOperand, Expression rightOperand) - { - super ("<<", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - { - String[] parameters = {Util.getMessage ("EvaluationException.left"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - // Shift left (<<) - //daz value (new Long (l.longValue () << r.longValue ())); - BigInteger bL = (BigInteger)coerceToTarget (l); - BigInteger bR = (BigInteger)r; - - BigInteger ls = bL.shiftLeft (bR.intValue ()); - - if (type ().indexOf ("short") >= 0) - ls = ls.mod (twoPow16); - else if (type ().indexOf ("long") >= 0) - ls = ls.mod (twoPow32); - else if (type ().indexOf ("long long") >= 0) - ls = ls.mod (twoPow64); - - value (coerceToTarget (ls)); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.left"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class ShiftLeft --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftRight.java 2018-01-30 20:25:21.000000000 -0500 +++ /dev/null 2018-01-30 20:25:21.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class ShiftRight extends BinaryExpr -{ - protected ShiftRight (Expression leftOperand, Expression rightOperand) - { - super (">>", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - { - String[] parameters = {Util.getMessage ("EvaluationException.right"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - // Shift right (>>) - //daz value (new Long (l.longValue () >> r.longValue ())); - BigInteger bL = (BigInteger)coerceToTarget ((BigInteger)l); - BigInteger bR = (BigInteger)r; - - // Change signed to unsigned (Clear sign bit--can be done when setting bL!) - if (bL.signum () == -1) - if (type ().equals ("short")) - bL = bL.add (twoPow16); - else if (type ().equals ("long")) - bL = bL.add (twoPow32); - else if (type ().equals ("long long")) - bL = bL.add (twoPow64); - - value (bL.shiftRight (bR.intValue ())); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.right"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class ShiftRight --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Terminal.java 2018-01-30 20:25:22.000000000 -0500 +++ /dev/null 2018-01-30 20:25:22.000000000 -0500 @@ -1,122 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.ConstEntry; -import java.math.BigInteger; - -/** - * This class contains values. Objects of this class are the terminal - * nodes of an expression tree. - *

- * Note that there is a constructor for Double values, but not Float. - * CORBA defines that all floating point expressions are evaluated as - * double, and that the result is coerced back to float if necessary. - *

- * Note also that there is a constructor for long values, but not for - * int or short. CORBA defines that all integral expressions are evaluated - * as unsigned long. A CORBA long is a Java int. There is no unsigned int - * in Java, so the next larger type, long, is used. - **/ -public class Terminal extends Expression -{ - protected Terminal (String representation, Character charValue, - boolean isWide) - { - rep (representation); - value (charValue); - if (isWide) - type( "wchar" ) ; - else - type( "char" ) ; - } // ctor - - protected Terminal (String representation, Boolean booleanValue) - { - rep (representation); - value (booleanValue); - } // ctor - - // Support long long - protected Terminal (String representation, BigInteger bigIntegerValue) - { - rep (representation); - value (bigIntegerValue); - } // ctor - - protected Terminal (String representation, Long longValue) - { - long lv = longValue.longValue (); - rep (representation); - if (lv > Integer.MAX_VALUE || lv < Integer.MIN_VALUE) - value (longValue); - else - value (new Integer (longValue.intValue ())); - } // ctor - - protected Terminal (String representation, Double doubleValue) - { - rep (representation); - value (doubleValue); - } // ctor - - protected Terminal (String stringValue, boolean isWide ) - { - rep (stringValue); - value (stringValue); - if (isWide) - type( "wstring" ) ; - else - type( "string" ) ; - } // ctor - - protected Terminal (ConstEntry constReference) - { - rep (constReference.fullName ()); - value (constReference); - } // ctor - - ///// INSTANCE METHODS - public Object evaluate () throws EvaluationException - { - if (value () instanceof ConstEntry) - return ((ConstEntry)value ()).value ().evaluate (); - else - return value (); - } // evaluate -} // class Terminal --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Times.java 2018-01-30 20:25:23.000000000 -0500 +++ /dev/null 2018-01-30 20:25:23.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Times extends BinaryExpr -{ - protected Times (Expression leftOperand, Expression rightOperand) - { - super ("*", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - boolean lIsNonInteger = l instanceof Float || l instanceof Double; - boolean rIsNonInteger = r instanceof Float || r instanceof Double; - - if (lIsNonInteger && rIsNonInteger) - value (new Double (l.doubleValue () * r.doubleValue ())); - else if (lIsNonInteger || rIsNonInteger) - { - String[] parameters = {Util.getMessage ("EvaluationException.times"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - // Multiplication (*) - BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r; - value (tmpL.multiply (tmpR)); - //daz value (new Long (l.longValue () * r.longValue ())); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.times"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class Times --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java 2018-01-30 20:25:23.000000000 -0500 +++ /dev/null 2018-01-30 20:25:23.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public abstract class UnaryExpr extends Expression -{ - public UnaryExpr (String operation, Expression unaryOperand) - { - _op = operation; - _operand = unaryOperand; - } // ctor - - public void op (String op) {_op = (op == null)? "": op;} - public String op () {return _op;} - - public void operand (Expression operand) {_operand = operand;} - public Expression operand () {return _operand;} - - private String _op = ""; - private Expression _operand = null; -} // class UnaryExpr --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Xor.java 2018-01-30 20:25:24.000000000 -0500 +++ /dev/null 2018-01-30 20:25:24.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.constExpr; - -// NOTES: - -import com.sun.tools.corba.se.idl.Util; -import java.math.BigInteger; - -public class Xor extends BinaryExpr -{ - protected Xor (Expression leftOperand, Expression rightOperand) - { - super ("^", leftOperand, rightOperand); - } // ctor - - public Object evaluate () throws EvaluationException - { - try - { - Number l = (Number)left ().evaluate (); - Number r = (Number)right ().evaluate (); - - if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double) - { - String[] parameters = {Util.getMessage ("EvaluationException.xor"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - else - { - // Xor (^) - //daz value (new Long (l.longValue () ^ r.longValue ())); - //BigInteger uL = (BigInteger)toUnsigned((BigInteger)l); - //BigInteger uR = (BigInteger)toUnsigned((BigInteger)r); - //value (coerceToTarget(uL.xor (uR))); - BigInteger uL = (BigInteger)coerceToTarget((BigInteger)l); - BigInteger uR = (BigInteger)coerceToTarget((BigInteger)r); - value (uL.xor (uR)); - } - } - catch (ClassCastException e) - { - String[] parameters = {Util.getMessage ("EvaluationException.xor"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()}; - throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters)); - } - return value (); - } // evaluate -} // class Xor --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/first.set 2018-01-30 20:25:25.000000000 -0500 +++ /dev/null 2018-01-30 20:25:25.000000000 -0500 @@ -1,233 +0,0 @@ -/* - * Copyright (c) 1999, 2009, 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. - */ - -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998 - * - */ - -CORBA IDL ---------------- - - typedef, struct, union, enum, const, exception, interface, module - - , typedef, struct, union, enum, const, exception, interface, module - - typedef, struct, union, enum, const, exception, interface, module - - module - - typedef, struct, union, enum, const, exception, interface, module - - typedef, struct, union, enum, const, exception, interface, module, - - interface - - , :, { - - :, { - - typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state - - , typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state - - typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state - - state - - private, protected, public, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum, - - private, protected, public, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - private, protected, public - - : - - , "," - - id, :: - - , :: - - const - - long, short, unsigned, char, boolean, float, double, string, id, :: - - -, +, ~, id, ::, literal, ( - - -, +, ~, id, ::, literal, ( - - , | - - -, +, ~, id, ::, literal, ( - - , ^ - - -, +, ~, id, ::, literal, ( - - , & - - -, +, ~, id, ::, literal, ( - - , >>, << - - -, +, ~, id, ::, literal, ( - - , +, - - - -, +, ~, id, ::, literal, ( - - , *, /, % - - -, +, ~, id, ::, literal, ( - - -, +, ~ - - id, ::, literal, ( - - literals - - -, +, ~, id, ::, literal, ( - - typedef, struct, union, enum - - float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, :: - - float, double, long, short, unsigned, char, boolean, octet, any - - sequence, string - - struct, union, enum - - id - - , "," - - id - - , [ - - float, double - - long, short, unsigned - - long, short - - unsigned - - char - - boolean - - octet - - any - - struct - - float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - , float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - union - - long, short, unsigned, char, boolean, enum, id, :: - - case, default - - , case, default - - case, default - - , case, default - - case, default - - float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - enum - - , "," - - sequence - - ",", > - - string - - , < - - [ - - readonly, attribute - - , "," - - exception - - , float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void - - id, macroID - - , raises, context, ; - - , context - - oneway - - float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void - - ( - - in, out, inout, ) - - , "," - - in, out, inout - - in, out, inout - - raises - - , "," - - context - - , "," - - float, double, long, short, unsigned, char, boolean, octet, any, string, id, :: - --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/follow.set 2018-01-30 20:25:26.000000000 -0500 +++ /dev/null 2018-01-30 20:25:26.000000000 -0500 @@ -1,233 +0,0 @@ -/* - * Copyright (c) 1999, 2009, 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. - */ - -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998 - * - */ - -CORBA IDL ------------------ - - EOF - - EOF - - EOF, typedef, struct, union, enum, const, exception, interface, module, } - - ; - - } - - } - - ; - - ; - - ; - - } - - } - - typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state, } - - typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state, } - - } - - private, protected, public, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum, } - - float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - { - - { - - ",", {, id, ::, literal, (, >, ), macroID - - ",", {, id, ::, literal, (, >, ), macroID - - ; - - id - - ;, ), >, ], : - - ;, ), >, ], : - - ;, ), >, ], : - - |, ;, ), >, ], : - - | ;, ), >, ], : - - ^, |, ;, ), >, ], : - - ^, |, ;, ), >, ], : - - &, ^, |, ;, ), >, ], : - - &, ^, |, ;, ), >, ], : - - >>, <<, &, ^, |, ;, ), >, ], : - - >>, <<, &, ^, |, ;, ), >, ], : - - >>, <<, &, ^, |, ;, ), >, ], : - - +, -, >>, <<, &, ^, |, ;, ), >, ], : - - *, /, %, +, -, >>, <<, &, ^, |, ;, ), >, ], : - - id, ::, literal, ( - - *, /, %, +, -, >>, <<, &, ^, |, ;, ), >, ], : - - *, /, %, +, -, >>, <<, &, ^, |, ;, ), >, ], : (and , for string literal in ) - - >, ] - - ; - - ; - - id - - id, ",", > - - id, ",", >, macroID - - id, ",", > - - id - - ; - - ; - - ",", ; - - ",", ; - - id, ",", >, macroID - - id, ",", >, macroID, ) - - id, ",", >, macroID, ) - - id, ",", >, macroID, ) - - id, ",", >, macroID, ) - - id, ",", >, macroID, ) - - id, ",", >, macroID - - id, ",", >, macroID - - ;, id - - } - - } - - float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum, } - - ;, id - - ) - - } - - } - - case, default, } - - float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - case, default, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum - - ; - - ;, id, ) - - } - - id, ",", > - - id, ",", > - - id, ",", >, macroID - - id, ",", >, macroID - - [, ",", ; - - ; - - ; - - ; - - } - - ; - - ; - - ; - - ; - - float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void - - id, macroID - - raises, context, ; - - raises, context, ; - - ) - - , ) - - float, double, long, short, unsigned, char, boolean, octet, any, string, id, :: - - context, ; - - ) - - ; - - ) - - id, macroID - --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar.idl 2018-01-30 20:25:26.000000000 -0500 +++ /dev/null 2018-01-30 20:25:26.000000000 -0500 @@ -1,422 +0,0 @@ -/* - * Copyright (c) 1999, 2009, 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. - */ - -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998 - * - */ - -CORBA 2.3 IDL ---------------- - -(1) - -(1) e - - -(2) ";" - ";" - ";" - ";" - ";" - ";" - -(3) "module" "{" "}" - -(3) - -(3) - e - -(4) - - -(5) "{" "}" - -(6) "abstract" "interface" - "interface" - -(7) "abstract" "interface" - "interface" - -(7) e - - -(8) - -(8) e - - -(9) ";" - ";" - ";" - ";" - ";" - - - -(10) ":" - -(10) e - "," - -(12) - "::" - -(12) e - "::" - -(13) - - - - -(14) "abstract" "valuetype" - "valuetype" - -(15) "valuetype" - -(16) "abstract" "valuetype" "{" "}" - "abstract" "valuetype" "{" "}" - -(16) e - - -(17) "{" "}" - -(17) e - - -(18) "custom" "valuetype" - "valuetype" - "custom" "valuetype" - "valuetype" - -(19) - -(19) e - ":" "truncatable" - ":" - -(19) e - "," - -(19) e - "supports" - -(19) e - "," - -(20) - -(21) - - - -(22) "public" ";" - "private" ";" - -(23) "factory" "(" ")" - "factory" "(" ")" - -(24) - "," - -(25) - -(26) "in" - -(27) "const" "=" - -(28) - - - - - - - - - -(29) - -(30) - -(30) e - "|" - -(31) - -(31) e - "^" - -(32) - -(32) e - "&" - -(33) - -(33) e - ">>" - "<<" - -(34) - -(34) e - "+" - "-" - -(35) - -(35) e - "*" - "/" - "%" - -(36) - - -(37) "-" - "+" - "~" - -(38) - - "(" ")" - -(39) <> - <>> - <>> - <> - <> - <> - <> - <> - -(40) "TRUE" - "FALSE" - -(41) - -(42) "typedef" - - - - "native" - -(43) - -(44) - - -(45) - - - -(46) - - - - - - - - - -(47) - - - - -(48) - - - -(49) - -(49) e - "," - -(50) - - -(51) - -(52) - -(53) "float" - "double" - "long" "double" - -(54) - - -(55) "long" - "short" - "long" "long" - -// 56-58 omitted - -(59) "unsigned" - -// 60-62 omitted - -(63) "char" - -(64) "wchar" - -(65) "boolean" - -(66) "octet" - -(67) "any" - -(68) "Object" - -(69) "struct" "{" "}" - -(70) - -(70) e - - -(71) ";" - -(72) "union" "switch" "(" ")" "{" "}" - -(73) - - - - - -(74) - -(74) e - - -(75) ";" - -(75) e - - -(76) "case" ":" - "default" ":" - -(77) - -(78) "enum" "{" "}" - -(78) e - "," - -// 79 omitted - -(80) "sequence" "<" - -(80) "," ">" - ">" - -(81) "string" - "string" "<" ">" - -(82) "wstring" - "wstring" "<" ">" - -(83) - -(84) "[" "]" - -(85) "readonly" "attribute" - "attribute" - -(85) e - "," - -(86) "exception" "{" "}" - -(86) e - - -(87) - - -(87) - - -(87) e - - - - -(88) "oneway" - -(89) - "void" - -(90) "(" - -(90) ")" - ")" - -(90) e - "," - -(91) - -(92) "in" - "out" - "inout" - -(93) "raises" "(" ")" - -(93) e - "," - -(94) "context" "(" ")" - -(94) e - "," - -(95) - - - - -(96) "fixed" "<" "," ">" - -(97) "fixed" - -(98) "ValueBase" - -NOTES: - -- #define id(id, id, ...) token-string is a macro definition. There can be no space between the first id and the left paren. Since id( must be treated as a token and id( can also appear in op_dcl, see that production for the effect of this token. - --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar3.idl 2018-01-30 20:25:27.000000000 -0500 +++ /dev/null 2018-01-30 20:25:27.000000000 -0500 @@ -1,539 +0,0 @@ -/* - * Copyright (c) 1999, 2009, 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. - */ - -/* - * COMPONENT_NAME: idl.parser - * - * ORIGINS: 27 - * - * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998 - * - */ - -(1) // CORBA3 - -(1) e // CORBA3 - // CORBA3 - -(1) "import" ";" // CORBA3 - -(1) // CORBA3 - // CORBA3 - -(1) e - - -(2) ";" - ";" - ";" - ";" - ";" - ";" - ";" // CORBA3 - ";" // CORBA3 - ";" // CORBA3 - ";" // CORBA3 - -(2) "typeId" // CORBA3 - -(2) "typePrefix" // CORBA3 - -(3) "module" "{" "}" - -(3) - -(3) - e - -(4) - - -(5) "{" "}" - -(6) "abstract" "interface" - "local" "interface" // CORBA3 - "interface" - -(7) "abstract" "interface" - "local" "interface" // CORBA3 - "interface" - -(7) e - - -(8) - -(8) e - - -(9) ";" - ";" - ";" - ";" - ";" - ";" // CORBA3 - ";" // CORBA3 - -(10) ":" - -(10) e - "," - -(12) - "::" - -(12) e - "::" - -(13) - - - - -(14) "abstract" "valuetype" - "valuetype" - -(15) "valuetype" - -(16) "abstract" "valuetype" "{" "}" - "abstract" "valuetype" "{" "}" - -(16) e - - -(17) "{" "}" - -(17) e - - -(18) "custom" "valuetype" - "valuetype" - "custom" "valuetype" - "valuetype" - -(19) - -(19) e - ":" "truncatable" - ":" - -(19) e - "," - -(19) e - "supports" - -(19) e - "," - -(20) - -(21) - - - -(22) "public" ";" - "private" ";" - -(23) "factory" "(" ")" - "factory" "(" ")" - -(24) - "," - -(25) - -(26) "in" - -(27) "const" "=" - -(28) - - - - - - - - - -(29) - -(30) - -(30) e - "|" - -(31) - -(31) e - "^" - -(32) - -(32) e - "&" - -(33) - -(33) e - ">>" - "<<" - -(34) - -(34) e - "+" - "-" - -(35) - -(35) e - "*" - "/" - "%" - -(36) - - -(37) "-" - "+" - "~" - -(38) - - "(" ")" - -(39) <> - <>> - <>> - <> - <> - <> - <> - <> - -(40) "TRUE" - "FALSE" - -(41) - -(42) "typedef" - - - - "native" - -(43) - -(44) - - -(45) - - - -(46) - - - - - - - - - -(47) - - - - -(48) - - - -(49) - -(49) e - "," - -(50) - - -(51) - -(52) - -(53) "float" - "double" - "long" "double" - -(54) - - -(55) "long" - "short" - "long" "long" - -// 56-58 omitted - -(59) "unsigned" - -// 60-62 omitted - -(63) "char" - -(64) "wchar" - -(65) "boolean" - -(66) "octet" - -(67) "any" - -(68) "Object" - -(69) "struct" "{" "}" - -(70) - -(70) e - - -(71) ";" - -(72) "union" "switch" "(" ")" "{" "}" - -(73) - - - - - -(74) - -(74) e - - -(75) ";" - -(75) e - - -(76) "case" ":" - "default" ":" - -(77) - -(78) "enum" "{" "}" - -(78) e - "," - -// 79 omitted - -(80) "sequence" "<" - -(80) "," ">" - ">" - -(81) "string" - "string" "<" ">" - -(82) "wstring" - "wstring" "<" ">" - -(83) - -(84) "[" "]" - -(85) // CORBA3 - // CORBA3 - -(85) // CORBA3 - -(85) "readonly" "attribute" // CORBA3 - -(85) // CORBA3 - // CORBA3 - -(85) e // CORBA3 - // CORBA3 - -(85) "attribute" // CORBA3 - -(85) // CORBA3 - // CORBA3 - -(85) // CORBA3 - // CORBA3 - // CORBA3 - -(85) "getRaises" // CORBA3 - -(85) "setRaises" // CORBA3 - -(85) "(" ")" // CORBA3 - -(85) e // CORBA3 - "," // CORBA3 - -(86) "exception" "{" "}" - -(86) e - - -(87) - - -(87) - - -(87) e - - - - -(88) "oneway" - -(89) - "void" - -(90) "(" - -(90) ")" - ")" - -(90) e - "," - -(91) - -(92) "in" - "out" - "inout" - -(93) "raises" "(" ")" - -(93) e - "," - -(94) "context" "(" ")" - -(94) e - "," - -(95) - - - - -(96) "fixed" "<" "," ">" - -(97) "fixed" - -(98) "ValueBase" - -// CORBA3 Component and Home IDL - -(200) - - -(201) "component" - -(202) "{" "}" - -(203) "component" - "component" - "component" - "component" - -(204) "supports" - -(204) e - "," - -(205) ":" - -(206) - -(206) e - - -(207) ";" - ";" - ";" - ";" - ";" - ";" - -(208) "provides" - -(209) - "Object" - -(210) "uses" - "uses" "multiple" - -(211) "emits" - -(212) "publishes" - -(213) "consumes" - -(214) - -(215) "home" "manages" - "home" "manages" - "home" "manages" - "home" "manages" - -(216) ":" - -(217) "primaryKey" - -(218) "{" "}" - -(218) e - - -(219) - ";" - ";" - -(220) "factory" "(" ")" - "factory" "(" ")" - "factory" "(" ")" - "factory" "(" ")" - -(221) "finder" "(" ")" - "finder" "(" ")" - "finder" "(" ")" - "finder" "(" ")" - -NOTES: - -- #define id(id, id, ...) token-string is a macro definition. There can be no space between the first id and the left paren. Since id( must be treated as a token and id( can also appear in op_dcl, see that production for the effect of this token. - --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl.prp 2018-01-30 20:25:28.000000000 -0500 +++ /dev/null 2018-01-30 20:25:28.000000000 -0500 @@ -1,195 +0,0 @@ -# -# Copyright (c) 1999, 2009, 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. -# - -# -# COMPONENT_NAME: idl.parser -# -# ORIGINS: 27 -# -# Licensed Materials - Property of IBM -# 5639-D57 (C) COPYRIGHT International Business Machines Corp., 1997, 1999 -# RMI-IIOP v1.0 -# - -# Translator: Each line below is of the form "=". -# The keys are NOT to be translated. -# The messages ARE to be translated. -# -# DO NOT translate the following: -# ASCII -# #else -# #endif -# IDL -# -# %0, %1, etc. are postional parameters to the message. Do not -# translate these. The number order is the order they are given to -# the message writer. It is OK to change their order in the message -# if the language grammar so dictates. -# -# Lines of the form "%0 (line %1): \n%x\n%y" are error -# messages: %0 is a filename; %1 is a line number; %x is line %1 from -# %0; %y is the error marker. So the message comes out looking like: -# (line xxx): -# Line xxx from where the carat points to the error -# ^ -# So the first two and the last two parameters of these messages must -# remain in their positions. -# -# A backslash (\) at the end of a line is a line continuation -# character. A backslash at the beginning of a line means don't -# ignore leading blanks (they normally are). These backslashes -# should remain in the message. -# -# Translator: Start Translating - -Compile.parsing=Parsing %0 -Compile.parseDone=done - %0 -Compile.generating=Generating %0 -Compile.genDone=done - %0 -Deprecated.keyword=WARNING: Keyword `%0' is deprecated. -EvaluationException.1=Operands of %0 operator are inconsistent: %1 and %2. -EvaluationException.2=Operand of %0 operator must be a number, not a %1. -EvaluationException.or=bitwise or -EvaluationException.xor=bitwise xor -EvaluationException.and=bitwise and -EvaluationException.plus=addition -EvaluationException.minus=subtraction -EvaluationException.left=left shift -EvaluationException.right=right shift -EvaluationException.times=multiplication -EvaluationException.divide=division -EvaluationException.mod=modulo -EvaluationException.pos=unary positive -EvaluationException.neg=unary negation -EvaluationException.not=bitwise not -EvaluationException.booleanNot=boolean not -EvaluationException.booleanAnd=boolean and -EvaluationException.booleanOr=boolean or -EvaluationException.equal=equal -EvaluationException.notEqual=not equal -EvaluationException.greaterThan=greater than -EvaluationException.lessThan=less than -EvaluationException.greaterEqual=greater than or equal -EvaluationException.lessEqual=less than or equal -GenFileStream.1=%0 could not be generated: %1 -InvalidArgument.1=Invalid argument: %0. -InvalidArgument.2=No IDL file was specified. -InvalidCharacter.1=%0 (line %1): invalid character: %2 (ASCII %3).\n%4\n%5 -Migration.futureKeyword=WARNING: Identifier `%0' collides with a keyword; use an escaped identifier to ensure future compatibility. -Migration.keywordCollision=WARNING: Identifier `%0' collides with a keyword; use an escaped identifier to ensure future compatibility. -ParseException.abstractValueBox=%0 (line %1): A value box cannot be declared abstract.\n%2\n%3 -ParseException.alreadyDeclared=%0 (line %1): %2 has already been declared.\n%3\n%4 -ParseException.declNotInSameFile=%0 (line %1): %2 was declared previously in a forward declaration in file %3.\n%4\n%5 -ParseException.alreadyDerived=%0 (line %1): %2 has already been declared as a parent of %3.\n%4\n%5 -ParseException.alreadyDefaulted=%0 (line %1): The default branch has already been encountered.\n%2\n%3 -ParseException.alreadyRaised=%0 (line %1): %2 already specified in raises clause.\n%3\n%4 -ParseException.attributeNotType=%0 (line %1): %2 is an attribute. It cannot be used as a type.\n%3\n%4 -ParseException.badAbstract=%0 (line %1): The forward and actual declaration of %2 is inconsistent. One is abstract and the other is not.\n%3\n%4 -ParseException.badCustom=%0 (line %1): A forward value declaration cannot be declared custom.\n%2\n%3 -ParseException.badRepIDAlreadyAssigned=%0 (line %1): Type %2 has already been assigned a Repository ID in a previous ID pragma directive.\n%3\n%4 -ParseException.badRepIDForm=%0 (line %1): Repository ID '%2' should have form ':'.\n%3\n%4 -ParseException.badRepIDPrefix=%0 (line %1): Interface %2 should have Repository ID prefix `%3', not '%4'.\n%5\n%6 -ParseException.badState=%0 (line %1): %2 cannot be a stateful interface; it has more than one stateful parent.\n%3\n%4 -ParseException.branchLabel=%0 (line %1): case %2 has already been declared.\n%3\n%4 -ParseException.branchName=%0 (line %1): A branch named %2 has already been declared.\n%3\n%4 -ParseException.duplicateInit=%0 (line %1): An initializer has the same signature as a previous initializer.\n%2\n%3 -ParseException.duplicateState=%0 (line %1): The data member %2 has the same name as a previous data member.\n%3\n%4 -ParseException.elseNoIf=%0 (line %1): #else encountered without a matching #if.\n%2\n%3 -ParseException.endNoIf=%0 (line %1): #endif encountered without a matching #if.\n%2\n%3 -ParseException.evaluation=%0 (line %1): %2\n%3\n%4 -ParseException.forwardEntry=%0 (line %1): There is a forward reference to %2, but it is not defined.\n%3\n%4 -ParseException.forwardedValueBox=%0 (line %1): %2 has a forward declaration. A value box cannot be forward declared.\n%3\n%4 -ParseException.forwardInheritance=%0 (line %1): It is illegal for %2 to inherit from the incomplete forward declaration of %3.\n%4\n%5 -ParseException.generic=%0 (line %1): %2\n%3\n%4 -ParseException.illegalArray=%0 (line %1): An array is not a legal type in a %2.\n%3\n%4 -ParseException.illegalException=%0 (line %1): Exceptions cannot appear within %2s.\n%3\n%4 -ParseException.invalidConst1=%0 (line %1): Constant expression must be of type %2, not %3.\n%4\n%5 -ParseException.invalidConst2=%0 (line %1): Identifiers in constant expressions must be constants, not %2.\n%3\n%4 -ParseException.keywordCollision=%0 (line %1): Identifier `%2' collides with keyword; use escaped identifier if necessary.\n%3\n%4 -ParseException.methodClash=%0 (line %1): Method name clash in interface %2: %3.\n%4\n%5 -ParseException.moduleNotType=%0 (line %1): %2 is a module. It cannot be used as a type.\n%3\n%4 -ParseException.nestedValueBox=%0 (line %1): Value boxes cannot be nested.\n%2\n%3 -ParseException.noDefault=%0 (line %1): A default branch is not allowed when all possible cases are fully covered.\n%2\n%3 -ParseException.nonAbstractParent=%0 (line %1): The abstract interface %2 cannot inherit from the non-abstract interface %3.\n%4\n%5 -ParseException.nonAbstractParent2=%0 (line %1): The abstract value %2 cannot inherit from the non-abstract value %3.\n%4\n%5 -ParseException.nonAbstractParent3=%0 (line %1): The value %2 cannot inherit from the non-abstract value %3 as specified.\n%4\n%5 -ParseException.notANumber=%0 (line %1): A number was expected. %2 is not a valid number.\n%3\n%4 -ParseException.nothing=%0 is empty. There is nothing to compile. -ParseException.notPosInt=%0 (line %1): Expected a positive integer constant, not %2.\n%3\n%4 -ParseException.oneway=%0 (line %1): %2 is declared to be oneway. Oneway methods must: return void; have only in parameters; raise no exceptions.\n%3\n%4 -ParseException.operationNotType=%0 (line %1): %2 is an operation. It cannot be used as a type.\n%3\n%4 -ParseException.outOfRange=%0 (line %1): The value of the constant expression, %2, is out of range for type %3.\n%4\n%5 -ParseException.recursive=%0 (line %1): The only legal recursive definition is: sequence<%2> %3.\n%4\n%5 -ParseException.selfInherit=%0 (line %1): %2 cannot inherit from itself.\n%3\n%4 -ParseException.stringTooLong=%0 (line %1): "%2" cannot be more than %3 characters long.\n%4\n%5 -ParseException.syntax1=%0 (line %1): Expected `%2'; encountered `%3'.\n%4\n%5 -ParseException.syntax2=%0 (line %1): Expected one of%2; encountered `%3'.\n%4\n%5 -ParseException.unclosed=%0: Unexpected end of file encountered in comment. -ParseException.undeclaredType=%0 (line %1): %2 is an undeclared type.\n%3\n%4 -ParseException.warning=%0 (line %1): %2\n%3\n%4 -ParseException.constExprType=%0 (line %1): The type of the constant expression is %2, but it should be %3.\n%4\n%5 -ParseException.wrongType=%0 (line %1): The type of %2 is %3, but it should be %4.\n%5\n%6 -ParseException.illegalIncompleteTypeReference=%0 (line %1): Illegal reference to incomplete forward declaration of type %2.\n%3\n%4 -Preprocessor.unknown=Unknown preprocessor directive, `%0'. Line ignored. -Preprocessor.unknownPragma=Unknown pragma `%0'. Line ignored. -Preprocessor.undefinedName=Undefined type name for pragma %0: %1. Line ignored. -Token.boolLit= -Token.charLit= -Token.intLit= -Token.floatLit= -Token.stringLit= -Token.literal= -Token.identifier= -Token.endOfFile=EOF -Token.unknown=? -Util.cantCreatePkg=Cannot create the package %0. -Version.product=IDL Parser Framework, version "%0" -Version.number=3.2 -default=Error! A message was requested which does not exist. The messages file does not contain the key: %0. - -# Translator: In the list of options below, do not translate: -# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define -# Do not translate the string "java com.sun.tools.corba.se.idl.Compile" - -usage=Compiler Usage:\n\ -\ java com.sun.tools.corba.se.idl.Compile [options] \n\ -where is the name of a file containing IDL definitions, and\n\ -[options] is any combination of the options listed below. The options\n\ -are optional and may appear in any order; is required and\n\ -must appear last.\n\ -\ \n\ -Options:\n\ - -d This is equivalent to the following line in an\n\ -\ IDL file: #define \n\ - -emitAll Emit all types, including those found in #included\n\ -\ files.\n\ - -i By default, the current directory is scanned for\n\ -\ included files. This option adds another directory.\n\ - -keep If a file to be generated already exists, do not\n\ -\ overwrite it. By default it is overwritten.\n\ - -noWarn Suppress warnings.\n\ - -v, -verbose Verbose mode.\n\ - -version Display the version number.\n - --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp 2018-01-30 20:25:28.000000000 -0500 +++ /dev/null 2018-01-30 20:25:29.000000000 -0500 @@ -1,177 +0,0 @@ -# -# Copyright (c) 1999, 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. -# - -# -# COMPONENT_NAME: idl.parser -# -# ORIGINS: 27 -# -# Licensed Materials - Property of IBM -# 5639-D57 (C) COPYRIGHT International Business Machines Corp., 1997, 1999 -# RMI-IIOP v1.0 -# - -# Translator: Each line below is of the form "=". -# The keys are NOT to be translated. -# The messages ARE to be translated. -# -# DO NOT translate the following: -# ASCII -# #else -# #endif -# IDL -# -# %0, %1, etc. are postional parameters to the message. Do not -# translate these. The number order is the order they are given to -# the message writer. It is OK to change their order in the message -# if the language grammar so dictates. -# -# Lines of the form "%0 (line %1): \n%x\n%y" are error -# messages: %0 is a filename; %1 is a line number; %x is line %1 from -# %0; %y is the error marker. So the message comes out looking like: -# (line xxx): -# Line xxx from where the carat points to the error -# ^ -# So the first two and the last two parameters of these messages must -# remain in their positions. -# -# A backslash (\) at the end of a line is a line continuation -# character. A backslash at the beginning of a line means don't -# ignore leading blanks (they normally are). These backslashes -# should remain in the message. -# -# Translator: Start Translating - -Compile.parsing=%0\u306E\u89E3\u6790\u4E2D -Compile.parseDone=\u5B8C\u4E86 - %0 -Compile.generating=%0\u306E\u751F\u6210\u4E2D -Compile.genDone=\u5B8C\u4E86 - %0 -Deprecated.keyword=\u8B66\u544A: \u30AD\u30FC\u30EF\u30FC\u30C9`%0'\u306F\u975E\u63A8\u5968\u3067\u3059\u3002 -EvaluationException.1=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u305B\u3093: %1\u304A\u3088\u3073%2\u3002 -EvaluationException.2=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306F\u3001%1\u3067\u306F\u306A\u304F\u6570\u5024\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002 -EvaluationException.or=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EOR\u6F14\u7B97 -EvaluationException.xor=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EXOR\u6F14\u7B97 -EvaluationException.and=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EAND\u6F14\u7B97 -EvaluationException.plus=\u52A0\u7B97 -EvaluationException.minus=\u6E1B\u7B97 -EvaluationException.left=\u5DE6\u30B7\u30D5\u30C8 -EvaluationException.right=\u53F3\u30B7\u30D5\u30C8 -EvaluationException.times=\u4E57\u7B97 -EvaluationException.divide=\u9664\u7B97 -EvaluationException.mod=\u3079\u304D\u4E57 -EvaluationException.pos=\u5358\u9805\u30D7\u30E9\u30B9 -EvaluationException.neg=\u5358\u9805\u30DE\u30A4\u30CA\u30B9 -EvaluationException.not=\u30D3\u30C3\u30C8\u5358\u4F4D\u306ENOT\u6F14\u7B97 -EvaluationException.booleanNot=boolean NOT -EvaluationException.booleanAnd=boolean AND -EvaluationException.booleanOr=boolean OR -EvaluationException.equal=\u6B21\u3068\u7B49\u3057\u3044 -EvaluationException.notEqual=\u6B21\u3068\u7B49\u3057\u304F\u306A\u3044 -EvaluationException.greaterThan=\u304C\u6B21\u306E\u5024\u3088\u308A\u5927\u304D\u3044 -EvaluationException.lessThan=\u304C\u6B21\u306E\u5024\u3088\u308A\u5C0F\u3055\u3044 -EvaluationException.greaterEqual=\u304C\u6B21\u306E\u5024\u4EE5\u4E0A -EvaluationException.lessEqual=\u304C\u6B21\u306E\u5024\u4EE5\u4E0B -GenFileStream.1=%0\u3092\u751F\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: %1 -InvalidArgument.1=\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: %0\u3002 -InvalidArgument.2=IDL\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 -InvalidCharacter.1=%0 (\u884C%1): \u6587\u5B57\u304C\u7121\u52B9\u3067\u3059: %2 (ASCII %3)\u3002\n%4\n%5 -Migration.futureKeyword=\u8B66\u544A: \u8B58\u5225\u5B50`%0'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5C06\u6765\u306E\u4E92\u63DB\u6027\u306E\u305F\u3081\u306B\u3001\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002 -Migration.keywordCollision=\u8B66\u544A: \u8B58\u5225\u5B50`%0'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5C06\u6765\u306E\u4E92\u63DB\u6027\u306E\u305F\u3081\u306B\u3001\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002 -ParseException.abstractValueBox=%0 (\u884C%1): \u5024\u30DC\u30C3\u30AF\u30B9\u306Fabstract\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3 -ParseException.alreadyDeclared=%0 (\u884C%1): %2\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4 -ParseException.declNotInSameFile=%0 (\u884C%1): %2\u306F\u30D5\u30A1\u30A4\u30EB%3\u306Eforward\u5BA3\u8A00\u3067\u4EE5\u524D\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%4\n%5 -ParseException.alreadyDerived=%0 (\u884C%1): %2\u306F%3\u306E\u89AA\u3068\u3057\u3066\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%4\n%5 -ParseException.alreadyDefaulted=%0 (\u884C%1): \u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5206\u5C90\u306F\u3059\u3067\u306B\u691C\u51FA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%2\n%3 -ParseException.alreadyRaised=%0 (\u884C%1): %2\u306Fraises\u53E5\u3067\u3059\u3067\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4 -ParseException.attributeNotType=%0 (\u884C%1): %2\u306F\u5C5E\u6027\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.badAbstract=%0 (\u884C%1): %2\u306Eforward\u5BA3\u8A00\u3068\u5B9F\u969B\u306E\u5BA3\u8A00\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u4E00\u65B9\u306Fabstract\u3067\u3059\u304C\u3001\u3082\u3046\u4E00\u65B9\u306Fabstract\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.badCustom=%0 (\u884C%1): forward\u5024\u5BA3\u8A00\u306Fcustom\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3 -ParseException.badRepIDAlreadyAssigned=%0 (\u884C%1): \u578B%2\u306B\u306F\u3001\u524D\u306EID\u30D7\u30E9\u30B0\u30DE\u30FB\u30C7\u30A3\u30EC\u30AF\u30C6\u30A3\u30D6\u306E\u30EA\u30DD\u30B8\u30C8\u30EAID\u304C\u3059\u3067\u306B\u5272\u308A\u5F53\u3066\u3089\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4 -ParseException.badRepIDForm=%0 (\u884C%1): \u30EA\u30DD\u30B8\u30C8\u30EAID '%2'\u306E\u5F62\u5F0F\u306F':'\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4 -ParseException.badRepIDPrefix=%0 (\u884C%1): \u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u306B\u306F\u3001'%4'\u3067\u306F\u306A\u304F\u30EA\u30DD\u30B8\u30C8\u30EAID\u63A5\u982D\u8F9E`%3'\u304C\u5FC5\u8981\u3067\u3059\u3002\n%5\n%6 -ParseException.badState=%0 (\u884C%1): %2\u306F\u30B9\u30C6\u30FC\u30C8\u30D5\u30EB\u30FB\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u3067\u304D\u307E\u305B\u3093\u3002\u8907\u6570\u306E\u30B9\u30C6\u30FC\u30C8\u30D5\u30EB\u89AA\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4 -ParseException.branchLabel=%0 (\u884C%1): case %2\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4 -ParseException.branchName=%0 (\u884C%1): %2\u3068\u3044\u3046\u540D\u524D\u306E\u5206\u5C90\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4 -ParseException.duplicateInit=%0 (\u884C%1): \u521D\u671F\u5316\u5B50\u306B\u306F\u524D\u306E\u521D\u671F\u5316\u5B50\u3068\u540C\u3058\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u3042\u308A\u307E\u3059\u3002\n%2\n%3 -ParseException.duplicateState=%0 (\u884C%1): \u30C7\u30FC\u30BF\u30FB\u30E1\u30F3\u30D0\u30FC%2\u306E\u540D\u524D\u304C\u524D\u306E\u30C7\u30FC\u30BF\u30FB\u30E1\u30F3\u30D0\u30FC\u3068\u540C\u3058\u3067\u3059\u3002\n%3\n%4 -ParseException.elseNoIf=%0 (\u884C%1): \u4E00\u81F4\u3059\u308B#if\u304C\u306A\u3044#else\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%2\n%3 -ParseException.endNoIf=%0 (\u884C%1): \u4E00\u81F4\u3059\u308B#if\u304C\u306A\u3044#endif\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%2\n%3 -ParseException.evaluation=%0 (\u884C%1): %2\n%3\n%4 -ParseException.forwardEntry=%0 (\u884C%1): %2\u3078\u306E\u524D\u65B9\u53C2\u7167\u304C\u3042\u308A\u307E\u3059\u304C\u3001\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.forwardedValueBox=%0 (\u884C%1): %2\u306B\u306Fforward\u5BA3\u8A00\u304C\u3042\u308A\u307E\u3059\u3002\u5024\u30DC\u30C3\u30AF\u30B9\u306Fforward\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.forwardInheritance=%0 (\u884C%1): %3\u306E\u4E0D\u5B8C\u5168\u306Aforward\u5BA3\u8A00\u304B\u3089\u306E%2\u306E\u7D99\u627F\u306F\u7121\u52B9\u3067\u3059\u3002\n%4\n%5 -ParseException.generic=%0 (\u884C%1): %2\n%3\n%4 -ParseException.illegalArray=%0 (\u884C%1): \u914D\u5217\u306F%2\u306E\u6B63\u3057\u3044\u578B\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.illegalException=%0 (\u884C%1): \u4F8B\u5916\u3092%2s\u5185\u306B\u8868\u793A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.invalidConst1=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306F%3\u578B\u3067\u306F\u306A\u304F%2\u578B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%4\n%5 -ParseException.invalidConst2=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u8B58\u5225\u5B50\u306F\u3001%2\u3067\u306F\u306A\u304F\u5B9A\u6570\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4 -ParseException.keywordCollision=%0 (\u884C%1): \u8B58\u5225\u5B50`%2'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5FC5\u8981\u306A\u5834\u5408\u306F\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n%3\n%4 -ParseException.methodClash=%0 (\u884C%1): \u30E1\u30BD\u30C3\u30C9\u540D\u304C\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u3067\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059: %3\u3002\n%4\n%5 -ParseException.moduleNotType=%0 (\u884C%1): %2\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.nestedValueBox=%0 (\u884C%1): \u5024\u30DC\u30C3\u30AF\u30B9\u306F\u30CD\u30B9\u30C8\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3 -ParseException.noDefault=%0 (\u884C%1): \u8003\u3048\u3089\u308C\u308B\u3059\u3079\u3066\u306Ecase\u304C\u5B8C\u5168\u306B\u9069\u7528\u3055\u308C\u308B\u5834\u5408\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5206\u5C90\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002\n%2\n%3 -ParseException.nonAbstractParent=%0 (\u884C%1): abstract\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u306F\u975Eabstract\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5 -ParseException.nonAbstractParent2=%0 (\u884C%1): abstract\u5024%2\u306F\u975Eabstract\u5024%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5 -ParseException.nonAbstractParent3=%0 (\u884C%1): \u5024%2\u306F\u6307\u5B9A\u3069\u304A\u308A\u306B\u975Eabstract\u5024%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5 -ParseException.notANumber=%0 (\u884C%1): \u6570\u5024\u304C\u5FC5\u8981\u3067\u3059\u3002%2\u306F\u6709\u52B9\u306A\u6570\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.nothing=%0\u306F\u7A7A\u3067\u3059\u3002\u30B3\u30F3\u30D1\u30A4\u30EB\u3059\u308B\u3082\u306E\u304C\u3042\u308A\u307E\u305B\u3093\u3002 -ParseException.notPosInt=%0 (\u884C%1): %2\u3067\u306F\u306A\u304F\u6B63\u306E\u6574\u6570\u306E\u5B9A\u6570\u304C\u5FC5\u8981\u3067\u3059\u3002\n%3\n%4 -ParseException.oneway=%0 (\u884C%1): %2\u306Foneway\u306B\u306A\u308B\u3088\u3046\u306B\u5BA3\u8A00\u3055\u308C\u307E\u3059\u3002oneway\u30E1\u30BD\u30C3\u30C9\u306F\u3001void\u3092\u8FD4\u3057\u3001\u30D1\u30E9\u30E1\u30FC\u30BF\u5185\u3067\u306E\u307F\u4F7F\u7528\u3057\u3001\u4F8B\u5916\u3092\u767A\u751F\u3057\u306A\u3044\u3088\u3046\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4 -ParseException.operationNotType=%0 (\u884C%1): %2\u306F\u64CD\u4F5C\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.outOfRange=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u5024%2\u304C\u578B%3\u306E\u7BC4\u56F2\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\n%4\n%5 -ParseException.recursive=%0 (\u884C%1): \u552F\u4E00\u306E\u6B63\u3057\u3044\u518D\u5E30\u7684\u5B9A\u7FA9\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059: \u30B7\u30FC\u30B1\u30F3\u30B9<%2> %3\u3002\n%4\n%5 -ParseException.selfInherit=%0 (\u884C%1): %2\u3092\u305D\u308C\u81EA\u4F53\u304B\u3089\u7D99\u627F\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4 -ParseException.stringTooLong=%0 (\u884C%1): "%2"\u306F%3\u6587\u5B57\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n%4\n%5 -ParseException.syntax1=%0 (\u884C%1): `%2'\u304C\u5FC5\u8981\u3067\u3059\u304C\u3001`%3'\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%4\n%5 -ParseException.syntax2=%0 (\u884C%1): %2\u306E1\u3064\u304C\u5FC5\u8981\u3067\u3059\u304C\u3001`%3'\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%4\n%5 -ParseException.unclosed=%0: \u30B3\u30E1\u30F3\u30C8\u3067\u4E88\u671F\u3057\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u306E\u7D42\u308F\u308A\u3092\u691C\u51FA\u3057\u307E\u3057\u305F\u3002 -ParseException.undeclaredType=%0 (\u884C%1): %2\u306F\u5BA3\u8A00\u3055\u308C\u3066\u3044\u306A\u3044\u578B\u3067\u3059\u3002\n%3\n%4 -ParseException.warning=%0 (\u884C%1): %2\n%3\n%4 -ParseException.constExprType=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u578B\u306F%2\u3067\u3059\u304C\u3001%3\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%4\n%5 -ParseException.wrongType=%0 (\u884C%1): %2\u306E\u578B\u306F%3\u3067\u3059\u304C\u3001%4\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%5\n%6 -ParseException.illegalIncompleteTypeReference=%0 (\u884C%1): %2\u578B\u306E\u4E0D\u5B8C\u5168\u306Aforward\u5BA3\u8A00\u3078\u306E\u7121\u52B9\u306A\u53C2\u7167\u3067\u3059\u3002\n%3\n%4 -Preprocessor.unknown=\u4E0D\u660E\u306A\u30D7\u30EA\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30C7\u30A3\u30EC\u30AF\u30C6\u30A3\u30D6`%0'\u3067\u3059\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002 -Preprocessor.unknownPragma=\u4E0D\u660E\u306A\u30D7\u30E9\u30B0\u30DE`%0'\u3067\u3059\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002 -Preprocessor.undefinedName=\u30D7\u30E9\u30B0\u30DE%0\u306E\u578B\u540D\u304C\u672A\u5B9A\u7FA9\u3067\u3059: %1\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002 -Token.boolLit= -Token.charLit= -Token.intLit= -Token.floatLit= -Token.stringLit= -Token.literal= -Token.identifier= -Token.endOfFile=EOF -Token.unknown=? -Util.cantCreatePkg=\u30D1\u30C3\u30B1\u30FC\u30B8%0\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002 -Version.product=IDL\u30D1\u30FC\u30B5\u30FC\u30FB\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF\u3001\u30D0\u30FC\u30B8\u30E7\u30F3"%0" -Version.number=3.2 -default=\u30A8\u30E9\u30FC\u3002\u5B58\u5728\u3057\u306A\u3044\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u30EA\u30AF\u30A8\u30B9\u30C8\u3055\u308C\u307E\u3057\u305F\u3002\u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30D5\u30A1\u30A4\u30EB\u306B\u30AD\u30FC\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093: %0\u3002 - -# Translator: In the list of options below, do not translate: -# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define -# Do not translate the string "java com.sun.tools.corba.se.idl.Compile" - -usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n java com.sun.tools.corba.se.idl.Compile [options] \n\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n \u540C\u3058\u3067\u3059: #define \n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\n \u767A\u884C\u3057\u307E\u3059\u3002\n-i \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n - --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp 2018-01-30 20:25:29.000000000 -0500 +++ /dev/null 2018-01-30 20:25:30.000000000 -0500 @@ -1,177 +0,0 @@ -# -# Copyright (c) 1999, 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. -# - -# -# COMPONENT_NAME: idl.parser -# -# ORIGINS: 27 -# -# Licensed Materials - Property of IBM -# 5639-D57 (C) COPYRIGHT International Business Machines Corp., 1997, 1999 -# RMI-IIOP v1.0 -# - -# Translator: Each line below is of the form "=". -# The keys are NOT to be translated. -# The messages ARE to be translated. -# -# DO NOT translate the following: -# ASCII -# #else -# #endif -# IDL -# -# %0, %1, etc. are postional parameters to the message. Do not -# translate these. The number order is the order they are given to -# the message writer. It is OK to change their order in the message -# if the language grammar so dictates. -# -# Lines of the form "%0 (line %1): \n%x\n%y" are error -# messages: %0 is a filename; %1 is a line number; %x is line %1 from -# %0; %y is the error marker. So the message comes out looking like: -# (line xxx): -# Line xxx from where the carat points to the error -# ^ -# So the first two and the last two parameters of these messages must -# remain in their positions. -# -# A backslash (\) at the end of a line is a line continuation -# character. A backslash at the beginning of a line means don't -# ignore leading blanks (they normally are). These backslashes -# should remain in the message. -# -# Translator: Start Translating - -Compile.parsing=\u6B63\u5728\u89E3\u6790 %0 -Compile.parseDone=\u5B8C\u6210 - %0 -Compile.generating=\u6B63\u5728\u751F\u6210 %0 -Compile.genDone=\u5B8C\u6210 - %0 -Deprecated.keyword=\u8B66\u544A: \u5173\u952E\u5B57 `%0' \u5DF2\u8FC7\u65F6\u3002 -EvaluationException.1=%0 \u8FD0\u7B97\u7B26\u7684\u64CD\u4F5C\u6570\u4E0D\u4E00\u81F4: %1 \u548C %2\u3002 -EvaluationException.2=%0 \u8FD0\u7B97\u7B26\u7684\u64CD\u4F5C\u6570\u5FC5\u987B\u662F\u6570\u5B57, \u800C\u4E0D\u662F %1\u3002 -EvaluationException.or=\u6309\u4F4D\u6216 -EvaluationException.xor=\u6309\u4F4D\u5F02\u6216 -EvaluationException.and=\u6309\u4F4D\u4E0E -EvaluationException.plus=\u6DFB\u52A0 -EvaluationException.minus=\u51CF\u6CD5 -EvaluationException.left=\u5411\u5DE6\u79FB\u4F4D -EvaluationException.right=\u5411\u53F3\u79FB\u4F4D -EvaluationException.times=\u4E58\u6CD5 -EvaluationException.divide=\u9664\u6CD5 -EvaluationException.mod=\u53D6\u6A21 -EvaluationException.pos=\u4E00\u5143\u6B63\u6570 -EvaluationException.neg=\u4E00\u5143\u8D1F\u6570 -EvaluationException.not=\u6309\u4F4D\u975E -EvaluationException.booleanNot=\u5E03\u5C14\u975E -EvaluationException.booleanAnd=\u5E03\u5C14\u4E0E -EvaluationException.booleanOr=\u5E03\u5C14\u6216 -EvaluationException.equal=\u7B49\u4E8E -EvaluationException.notEqual=\u4E0D\u7B49\u4E8E -EvaluationException.greaterThan=\u5927\u4E8E -EvaluationException.lessThan=\u5C0F\u4E8E -EvaluationException.greaterEqual=\u5927\u4E8E\u7B49\u4E8E -EvaluationException.lessEqual=\u5C0F\u4E8E\u7B49\u4E8E -GenFileStream.1=\u65E0\u6CD5\u751F\u6210%0: %1 -InvalidArgument.1=\u53C2\u6570\u65E0\u6548: %0\u3002 -InvalidArgument.2=\u672A\u6307\u5B9A IDL \u6587\u4EF6\u3002 -InvalidCharacter.1=%0 (\u884C %1): \u5B57\u7B26\u65E0\u6548: %2 (ASCII %3)\u3002\n%4\n%5 -Migration.futureKeyword=\u8B66\u544A: \u6807\u8BC6\u7B26 `%0' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u4EE5\u786E\u4FDD\u5C06\u6765\u517C\u5BB9\u3002 -Migration.keywordCollision=\u8B66\u544A: \u6807\u8BC6\u7B26 `%0' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u4EE5\u786E\u4FDD\u5C06\u6765\u517C\u5BB9\u3002 -ParseException.abstractValueBox=%0 (\u884C %1): \u4E0D\u80FD\u5C06\u503C\u6846\u58F0\u660E\u4E3A\u62BD\u8C61\u3002\n%2\n%3 -ParseException.alreadyDeclared=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u3002\n%3\n%4 -ParseException.declNotInSameFile=%0 (\u884C %1): %2\u4EE5\u524D\u66FE\u5728\u6587\u4EF6%3\u7684\u524D\u5411\u58F0\u660E\u4E2D\u58F0\u660E\u3002\n%4\n%5 -ParseException.alreadyDerived=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u4E3A%3\u7684\u7236\u7EA7\u3002\n%4\n%5 -ParseException.alreadyDefaulted=%0 (\u884C %1): \u5DF2\u9047\u5230\u9ED8\u8BA4\u5206\u652F\u3002\n%2\n%3 -ParseException.alreadyRaised=%0 (\u884C %1): %2\u5DF2\u5728 raise \u5B50\u53E5\u4E2D\u6307\u5B9A\u3002\n%3\n%4 -ParseException.attributeNotType=%0 (\u884C %1): %2 \u662F\u5C5E\u6027\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4 -ParseException.badAbstract=%0 (\u884C %1): %2\u7684\u524D\u5411\u58F0\u660E\u548C\u5B9E\u9645\u58F0\u660E\u4E0D\u4E00\u81F4\u3002\u4E00\u4E2A\u662F\u62BD\u8C61\u7684, \u800C\u53E6\u4E00\u4E2A\u4E0D\u662F\u62BD\u8C61\u7684\u3002\n%3\n%4 -ParseException.badCustom=%0 (\u884C %1): \u65E0\u6CD5\u5C06\u524D\u5411\u503C\u58F0\u660E\u58F0\u660E\u4E3A\u5B9A\u5236\u3002\n%2\n%3 -ParseException.badRepIDAlreadyAssigned=%0 (\u884C %1): \u5DF2\u5728\u4E0A\u4E00\u4E2A ID \u7F16\u8BD1\u6307\u793A\u6307\u4EE4\u4E2D\u4E3A\u7C7B\u578B%2\u5206\u914D\u4E86\u8D44\u6599\u6863\u6848\u5E93 ID\u3002\n%3\n%4 -ParseException.badRepIDForm=%0 (\u884C %1): \u8D44\u6599\u6863\u6848\u5E93 ID '%2' \u7684\u683C\u5F0F\u5E94\u4E3A ':'\u3002\n%3\n%4 -ParseException.badRepIDPrefix=%0 (\u884C %1): \u63A5\u53E3 %2 \u7684\u8D44\u6599\u6863\u6848\u5E93 ID \u524D\u7F00\u5E94\u4E3A `%3', \u800C\u975E '%4'\u3002\n%5\n%6 -ParseException.badState=%0 (\u884C %1): %2 \u4E0D\u80FD\u662F\u6709\u72B6\u6001\u63A5\u53E3; \u5B83\u5305\u542B\u591A\u4E2A\u6709\u72B6\u6001\u7236\u7EA7\u3002\n%3\n%4 -ParseException.branchLabel=%0 (\u884C %1): case %2\u5DF2\u58F0\u660E\u3002\n%3\n%4 -ParseException.branchName=%0 (\u884C %1): \u540D\u4E3A%2\u7684\u5206\u652F\u5DF2\u58F0\u660E\u3002\n%3\n%4 -ParseException.duplicateInit=%0 (\u884C %1): \u67D0\u4E2A\u521D\u59CB\u5316\u7A0B\u5E8F\u4E0E\u4E0A\u4E00\u4E2A\u521D\u59CB\u5316\u7A0B\u5E8F\u5177\u6709\u76F8\u540C\u7684\u7B7E\u540D\u3002\n%2\n%3 -ParseException.duplicateState=%0 (\u884C %1): \u6570\u636E\u6210\u5458 %2 \u4E0E\u4E0A\u4E00\u4E2A\u6570\u636E\u6210\u5458\u5177\u6709\u76F8\u540C\u7684\u540D\u79F0\u3002\n%3\n%4 -ParseException.elseNoIf=%0 (\u884C %1): \u9047\u5230\u4E86 #else, \u4F46\u6CA1\u6709\u5339\u914D\u7684 #if\u3002\n%2\n%3 -ParseException.endNoIf=%0 (\u884C %1): \u9047\u5230\u4E86 #endif, \u4F46\u6CA1\u6709\u5339\u914D\u7684 #if\u3002\n%2\n%3 -ParseException.evaluation=%0 (\u884C %1): %2\n%3\n%4 -ParseException.forwardEntry=%0 (\u884C %1): \u5B58\u5728\u9488\u5BF9%2\u7684\u524D\u5411\u5F15\u7528, \u4F46\u5B83\u5C1A\u672A\u5B9A\u4E49\u3002\n%3\n%4 -ParseException.forwardedValueBox=%0 (\u884C %1): %2 \u5177\u6709\u524D\u5411\u58F0\u660E\u3002\u4E0D\u80FD\u5BF9\u503C\u6846\u8FDB\u884C\u524D\u5411\u58F0\u660E\u3002\n%3\n%4 -ParseException.forwardInheritance=%0 (\u884C %1): \u5BF9\u4E8E%2, \u4ECE%3\u7684\u4E0D\u5B8C\u6574\u524D\u5411\u58F0\u660E\u8FDB\u884C\u7EE7\u627F\u662F\u975E\u6CD5\u7684\u3002\n%4\n%5 -ParseException.generic=%0 (\u884C %1): %2\n%3\n%4 -ParseException.illegalArray=%0 (\u884C %1): %2\u4E2D\u67D0\u4E2A\u6570\u7EC4\u7684\u7C7B\u578B\u975E\u6CD5\u3002\n%3\n%4 -ParseException.illegalException=%0 (\u884C %1): %2s \u4E2D\u4E0D\u80FD\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\u3002\n%3\n%4 -ParseException.invalidConst1=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u7684\u7C7B\u578B\u5FC5\u987B\u662F%2, \u800C\u4E0D\u80FD\u662F%3\u3002\n%4\n%5 -ParseException.invalidConst2=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u4E2D\u7684\u6807\u8BC6\u7B26\u5FC5\u987B\u662F\u5E38\u91CF, \u800C\u4E0D\u80FD\u662F%2\u3002\n%3\n%4 -ParseException.keywordCollision=%0 (\u884C %1): \u6807\u8BC6\u7B26 `%2' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u5982\u6709\u5FC5\u8981, \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u3002\n%3\n%4 -ParseException.methodClash=%0 (\u884C %1): \u63A5\u53E3 %2 \u4E2D\u7684\u65B9\u6CD5\u540D\u51B2\u7A81: %3\u3002\n%4\n%5 -ParseException.moduleNotType=%0 (\u884C %1): %2 \u662F\u6A21\u5757\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4 -ParseException.nestedValueBox=%0 (\u884C %1): \u503C\u6846\u4E0D\u80FD\u5D4C\u5957\u3002\n%2\n%3 -ParseException.noDefault=%0 (\u884C %1): \u5F53\u5B8C\u5168\u6D89\u53CA\u6240\u6709\u53EF\u80FD\u7684 case \u65F6, \u4E0D\u5141\u8BB8\u4F7F\u7528\u9ED8\u8BA4\u5206\u652F\u3002\n%2\n%3 -ParseException.nonAbstractParent=%0 (\u884C %1): \u62BD\u8C61\u63A5\u53E3 %2 \u4E0D\u80FD\u4ECE\u975E\u62BD\u8C61\u63A5\u53E3 %3 \u7EE7\u627F\u3002\n%4\n%5 -ParseException.nonAbstractParent2=%0 (\u884C %1): \u62BD\u8C61\u503C %2 \u4E0D\u80FD\u4ECE\u975E\u62BD\u8C61\u503C %3 \u7EE7\u627F\u3002\n%4\n%5 -ParseException.nonAbstractParent3=%0 (\u884C %1): \u503C %2 \u4E0D\u80FD\u6839\u636E\u6307\u5B9A\u4ECE\u975E\u62BD\u8C61\u503C %3 \u7EE7\u627F\u3002\n%4\n%5 -ParseException.notANumber=%0 (\u884C %1): \u5E94\u4E3A\u6570\u5B57\u3002%2\u4E0D\u662F\u6709\u6548\u7684\u6570\u5B57\u3002\n%3\n%4 -ParseException.nothing=%0\u4E3A\u7A7A\u3002\u6CA1\u6709\u8981\u7F16\u8BD1\u7684\u5BF9\u8C61\u3002 -ParseException.notPosInt=%0 (\u884C %1): \u5E94\u4E3A\u6B63\u6574\u6570\u5E38\u91CF, \u800C\u975E%2\u3002\n%3\n%4 -ParseException.oneway=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u4E3A\u5355\u5411\u3002\u5355\u5411\u65B9\u6CD5\u5FC5\u987B: \u8FD4\u56DE\u7A7A\u503C; \u53EA\u6709 in \u53C2\u6570; \u4E0D\u5F15\u53D1\u5F02\u5E38\u9519\u8BEF\u3002\n%3\n%4 -ParseException.operationNotType=%0 (\u884C %1): %2\u662F\u8FD0\u7B97\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4 -ParseException.outOfRange=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F %2 \u7684\u503C\u8D85\u51FA\u4E86\u7C7B\u578B%3\u7684\u8303\u56F4\u3002\n%4\n%5 -ParseException.recursive=%0 (\u884C %1): \u552F\u4E00\u7684\u5408\u6CD5\u9012\u5F52\u5B9A\u4E49\u662F: sequence<%2> %3\u3002\n%4\n%5 -ParseException.selfInherit=%0 (\u884C %1): %2 \u4E0D\u80FD\u4ECE\u81EA\u8EAB\u7EE7\u627F\u3002\n%3\n%4 -ParseException.stringTooLong=%0 (\u884C %1): "%2" \u7684\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7 %3 \u4E2A\u5B57\u7B26\u3002\n%4\n%5 -ParseException.syntax1=%0 (\u884C %1): \u5E94\u4E3A `%2'; \u4F46\u9047\u5230 `%3'\u3002\n%4\n%5 -ParseException.syntax2=%0 (\u884C %1): \u5E94\u4E3A %2 \u4E4B\u4E00; \u4F46\u9047\u5230 `%3'\u3002\n%4\n%5 -ParseException.unclosed=%0: \u5728\u6CE8\u91CA\u4E2D\u9047\u5230\u610F\u5916\u7684\u6587\u4EF6\u7ED3\u5C3E\u3002 -ParseException.undeclaredType=%0 (\u884C %1): %2 \u662F\u672A\u58F0\u660E\u7684\u7C7B\u578B\u3002\n%3\n%4 -ParseException.warning=%0 (\u884C %1): %2\n%3\n%4 -ParseException.constExprType=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u7684\u7C7B\u578B\u4E3A %2, \u4F46\u5E94\u4E3A %3\u3002\n%4\n%5 -ParseException.wrongType=%0 (\u884C %1): %2\u7684\u7C7B\u578B\u4E3A%3, \u4F46\u5E94\u4E3A%4\u3002\n%5\n%6 -ParseException.illegalIncompleteTypeReference=%0 (\u884C %1): \u5BF9\u7C7B\u578B%2\u7684\u4E0D\u5B8C\u6574\u524D\u5411\u58F0\u660E\u7684\u5F15\u7528\u975E\u6CD5\u3002\n%3\n%4 -Preprocessor.unknown=\u672A\u77E5\u7684\u9884\u5904\u7406\u7A0B\u5E8F\u6307\u4EE4 `%0'\u3002\u5DF2\u5FFD\u7565\u884C\u3002 -Preprocessor.unknownPragma=\u672A\u77E5\u7684\u7F16\u8BD1\u6307\u793A\u6307\u4EE4 `%0'\u3002\u5DF2\u5FFD\u7565\u884C\u3002 -Preprocessor.undefinedName=\u7F16\u8BD1\u6307\u793A %0 \u7684\u672A\u5B9A\u4E49\u7C7B\u578B\u540D: %1\u3002\u5DF2\u5FFD\u7565\u884C\u3002 -Token.boolLit=<\u5E03\u5C14\u6587\u5B57> -Token.charLit=<\u5B57\u7B26\u6587\u5B57> -Token.intLit=<\u6574\u578B\u6587\u5B57> -Token.floatLit=<\u6D6E\u70B9\u6587\u5B57> -Token.stringLit=<\u5B57\u7B26\u4E32\u6587\u5B57> -Token.literal=<\u6587\u5B57> -Token.identifier=<\u6807\u8BC6\u7B26> -Token.endOfFile=EOF -Token.unknown=? -Util.cantCreatePkg=\u65E0\u6CD5\u521B\u5EFA\u7A0B\u5E8F\u5305%0\u3002 -Version.product=IDL \u89E3\u6790\u5668\u6846\u67B6, \u7248\u672C "%0" -Version.number=3.2 -default=\u9519\u8BEF! \u8BF7\u6C42\u4E86\u4E0D\u5B58\u5728\u7684\u6D88\u606F\u3002\u6D88\u606F\u6587\u4EF6\u672A\u5305\u542B\u5173\u952E\u5B57: %0\u3002 - -# Translator: In the list of options below, do not translate: -# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define -# Do not translate the string "java com.sun.tools.corba.se.idl.Compile" - -usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n java com.sun.tools.corba.se.idl.Compile [\u9009\u9879] \n\u5176\u4E2D, \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u8FD9\u4E9B\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; \u662F\u5FC5\u9700\u7684\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included\n \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u3002\n - --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl 2018-01-30 20:25:30.000000000 -0500 +++ /dev/null 2018-01-30 20:25:30.000000000 -0500 @@ -1,778 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ - -/* - * This file contains OMG IDL from CORBA V2.0, July 1995. - * It also contains the TypeCode creation APIs in CORBA::ORB - **/ - -#pragma prefix "omg.org" - -module CORBA { - typedef string Identifier; - typedef string ScopedName; - typedef string RepositoryId; - - enum DefinitionKind { - dk_none, dk_all, - dk_Attribute, dk_Constant, dk_Exception, dk_Interface, - dk_Module, dk_Operation, dk_Typedef, - dk_Alias, dk_Struct, dk_Union, dk_Enum, - dk_Primitive, dk_String, dk_Sequence, dk_Array, - dk_Repository, - dk_Wstring, dk_Fixed, - dk_Value, dk_ValueBox, dk_ValueMember, // orbos 98-01-18: Objects By Value - dk_Native - }; - - - interface IRObject - /** - An IRObject IDL interface represents the most generic interface - from which all other Interface Repository interfaces are derived, - even the Repository itself. - */ - { - // read interface - readonly attribute DefinitionKind def_kind; - - // write interface - void destroy (); - }; - - - - typedef string VersionSpec; - - interface Contained; - interface Repository; - interface Container; - - interface Contained : IRObject - /** - The Contained Interface is inherited by all Interface Repository - interfaces that are contained by other objects. - */ - { - // read/write interface - - attribute RepositoryId id; - attribute Identifier name; - attribute VersionSpec version; - - // read interface - - readonly attribute Container defined_in; - readonly attribute ScopedName absolute_name; - readonly attribute Repository containing_repository; - - struct Description { - DefinitionKind kind; - any value; - }; - - Description describe (); - - // write interface - - void move ( - in Container new_container, - in Identifier new_name, - in VersionSpec new_version - ); - }; - - - interface ModuleDef; - interface ConstantDef; - interface IDLType; - interface StructDef; - interface UnionDef; - interface EnumDef; - interface AliasDef; - interface InterfaceDef; - interface ExceptionDef; - interface ValueDef; // orbos 98-01-18: Objects By Value - interface ValueMemberDef; // orbos 98-01-18: Objects By Value - interface ValueBoxDef; // orbos 98-01-18: Objects By Value - interface NativeDef; - - - typedef sequence InterfaceDefSeq; - - - typedef sequence ContainedSeq; - - struct StructMember { - Identifier name; - TypeCode type; - IDLType type_def; - }; - typedef sequence StructMemberSeq; - - struct UnionMember { - Identifier name; - any label; - TypeCode type; - IDLType type_def; - }; - typedef sequence UnionMemberSeq; - - - typedef sequence EnumMemberSeq; - - // orbos 98-01-18: Objects By Value -- begin - typedef short Visibility; - const Visibility PRIVATE_MEMBER = 0; - const Visibility PUBLIC_MEMBER = 1; - - struct ValueMember { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - IDLType type_def; - Visibility access; - }; - typedef sequence ValueMemberSeq; - - struct Initializer { - StructMemberSeq members; - }; - typedef sequence InitializerSeq; - - typedef sequence ValueDefSeq; - - // orbos 98-01-18: Objects By Value -- end - - - interface Container : IRObject - /** - The Container interface is used to form a containment hierarchy - in the Interface Repository. A Container can contain any number - of objects derived from the Contained interface. - */ - { - // read interface - - Contained lookup ( in ScopedName search_name); - - ContainedSeq contents ( - in DefinitionKind limit_type, - in boolean exclude_inherited - ); - - ContainedSeq lookup_name ( - in Identifier search_name, - in long levels_to_search, - in DefinitionKind limit_type, - in boolean exclude_inherited - ); - - struct Description { - Contained contained_object; - DefinitionKind kind; - any value; - }; - - typedef sequence DescriptionSeq; - - DescriptionSeq describe_contents ( - in DefinitionKind limit_type, - in boolean exclude_inherited, - in long max_returned_objs - ); - - // write interface - - ModuleDef create_module ( - in RepositoryId id, - in Identifier name, - in VersionSpec version - ); - - ConstantDef create_constant ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type, - in any value - ); - - StructDef create_struct ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in StructMemberSeq members - ); - - UnionDef create_union ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType discriminator_type, - in UnionMemberSeq members - ); - - EnumDef create_enum ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in EnumMemberSeq members - ); - - AliasDef create_alias ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType original_type - ); - - ExceptionDef create_exception ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in StructMemberSeq members - ); - - - InterfaceDef create_interface ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in boolean is_abstract, - in InterfaceDefSeq base_interfaces - ); - - // orbos 98-01-18: Objects By Value - ValueDef create_value( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in boolean is_custom, - in boolean is_abstract, - in octet flags, // must be 0 - in ValueDef base_value, - in boolean has_safe_base, - in ValueDefSeq abstract_base_values, - in InterfaceDefSeq supported_interfaces, - in InitializerSeq initializers - ); - - // orbos 98-01-18: Objects By Value - ValueBoxDef create_value_box( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType original_type_def - ); - - NativeDef create_native( - in RepositoryId id, - in Identifier name, - in VersionSpec version - ); - - }; - - - - interface IDLType : IRObject - /** - The IDLType interface is an abstract interface inherited by all - IR objects that represent the OMG IDL types. It provides access - to the TypeCode describing the type, and is used in defining the - other interfaces wherever definitions of IDLType must be referenced. - */ - { - readonly attribute TypeCode type; - }; - - - - interface PrimitiveDef; - interface StringDef; - interface SequenceDef; - interface ArrayDef; - - enum PrimitiveKind { - pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong, - pk_float, pk_double, pk_boolean, pk_char, pk_octet, - pk_any, pk_TypeCode, pk_Principal, pk_string, pk_objref - }; - - interface Repository : Container - /** - Repository is an interface that provides global access to the - Interface Repository. Repository objects can contain constants, - typedefs, exceptions, interfaces, and modules. - */ - { - // read interface - - Contained lookup_id (in RepositoryId search_id); - - PrimitiveDef get_primitive (in PrimitiveKind kind); - - // write interface - - StringDef create_string (in unsigned long bound); - - SequenceDef create_sequence ( - in unsigned long bound, - in IDLType element_type - ); - - ArrayDef create_array ( - in unsigned long length, - in IDLType element_type - ); - }; - - - interface ModuleDef : Container, Contained - /** - A ModuleDef can contain constants, typedefs, exceptions, interfaces, - and other module objects. - */ - { - }; - - struct ModuleDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - }; - - - interface ConstantDef : Contained - /** - A ConstantDef object defines a named constant. - */ - { - readonly attribute TypeCode type; - attribute IDLType type_def; - attribute any value; - }; - - struct ConstantDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - any value; - }; - - - interface TypedefDef : Contained, IDLType - /** - TypedefDef is an abstract interface used as a base interface for - all named non-object types(structures, unions, enumerations, - aliases). The TypedefDef interface is not inherited by the definition - objects for the primitive or anonymous types. - */ - { - }; - - struct TypeDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - }; - - - interface StructDef : TypedefDef, Container - /** - A StructDef represents an OMG IDL structure definition. - */ - { - attribute StructMemberSeq members; - }; - - - interface UnionDef : TypedefDef, Container - /** - A UnionDef represents an OMG IDL union definition. - */ - { - readonly attribute TypeCode discriminator_type; - attribute IDLType discriminator_type_def; - attribute UnionMemberSeq members; - }; - - - interface EnumDef : TypedefDef - /** - A EnumDef represents an OMG IDL enum definition. - */ - { - attribute EnumMemberSeq members; - }; - - - interface AliasDef : TypedefDef - /** - An AliasDef represents an OMG IDL typedef that aliases other - definition. - */ - { - attribute IDLType original_type_def; - }; - - - interface PrimitiveDef: IDLType - /** - A PrimitiveDef represents one of the IDL primitive types. As - primitive types are unnamed, this interface is not derived from - TypedefDef or Contained. - */ - { - readonly attribute PrimitiveKind kind; - }; - - - interface StringDef : IDLType - /** - A StringDef represents an OMG IDL string type. As string - types are anonymous, this interface is not derived from TypedefDef - or Contained. - */ - { - attribute unsigned long bound; - }; - - - interface SequenceDef : IDLType - /** - A SequenceDef represents an OMG IDL sequence type. As sequence - types are anonymous, this interface is not derived from TypedefDef - or Contained. - */ - { - attribute unsigned long bound; - readonly attribute TypeCode element_type; - attribute IDLType element_type_def; - }; - - interface ArrayDef : IDLType - /** - An ArrayDef represents an OMG IDL array type. As array - types are anonymous, this interface is not derived from TypedefDef - or Contained. - */ - { - attribute unsigned long length; - readonly attribute TypeCode element_type; - attribute IDLType element_type_def; - }; - - - interface ExceptionDef : Contained, Container - /** - An ExceptionDef represents an exception definition. - */ - { - readonly attribute TypeCode type; - attribute StructMemberSeq members; - }; - struct ExceptionDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - }; - - - - enum AttributeMode {ATTR_NORMAL, ATTR_READONLY}; - - interface AttributeDef : Contained - /** - An AttributeDef represents the information that defines an - attribute of an interface. - */ - { - readonly attribute TypeCode type; - attribute IDLType type_def; - attribute AttributeMode mode; - }; - - struct AttributeDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - AttributeMode mode; - }; - - - - enum OperationMode {OP_NORMAL, OP_ONEWAY}; - - enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT}; - struct ParameterDescription { - Identifier name; - TypeCode type; - IDLType type_def; - ParameterMode mode; - }; - typedef sequence ParDescriptionSeq; - - typedef Identifier ContextIdentifier; - typedef sequence ContextIdSeq; - - typedef sequence ExceptionDefSeq; - typedef sequence ExcDescriptionSeq; - - interface OperationDef : Contained - /** - An OperationDef represents the information that defines an - operation of an interface. - */ - { - readonly attribute TypeCode result; - attribute IDLType result_def; - attribute ParDescriptionSeq params; - attribute OperationMode mode; - attribute ContextIdSeq contexts; - attribute ExceptionDefSeq exceptions; - }; - - struct OperationDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode result; - OperationMode mode; - ContextIdSeq contexts; - ParDescriptionSeq parameters; - ExcDescriptionSeq exceptions; - }; - - - - typedef sequence RepositoryIdSeq; - typedef sequence OpDescriptionSeq; - typedef sequence AttrDescriptionSeq; - - interface InterfaceDef : Container, Contained, IDLType - /** - An InterfaceDef object represents an interface definition. It can - contains constants, typedefs, exceptions, operations, and - attributes. - */ - { - // read/write interface - - attribute InterfaceDefSeq base_interfaces; - attribute boolean is_abstract; - - // read interface - - boolean is_a (in RepositoryId interface_id); - - struct FullInterfaceDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - boolean is_abstract; - OpDescriptionSeq operations; - AttrDescriptionSeq attributes; - RepositoryIdSeq base_interfaces; - TypeCode type; - }; - - FullInterfaceDescription describe_interface(); - - // write interface - - AttributeDef create_attribute ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type, - in AttributeMode mode - ); - - OperationDef create_operation ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType result, - in OperationMode mode, - in ParDescriptionSeq params, - in ExceptionDefSeq exceptions, - in ContextIdSeq contexts - ); - }; - - struct InterfaceDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - RepositoryIdSeq base_interfaces; - }; - - - // orbos 98-01-18: Objects By Value -- begin - - interface ValueMemberDef : Contained - - /** A ValueMemberDef object represents the public - and private data member definition of a Value type - */ - - { - readonly attribute TypeCode type; - attribute IDLType type_def; - attribute Visibility access; - }; - - interface ValueDef : Container, Contained, IDLType - /** - A ValueDef object represents the definition of the - Value object used to pass the object state - between hosts - */ - - { - // read/write interface - attribute InterfaceDefSeq supported_interfaces; - attribute InitializerSeq initializers; - attribute ValueDef base_value; - attribute ValueDefSeq abstract_base_values; - attribute boolean is_abstract; - attribute boolean is_custom; - attribute octet flags; // always 0 - attribute boolean has_safe_base; - - // read interface - boolean is_a(in RepositoryId value_id); - - struct FullValueDescription { - Identifier name; - RepositoryId id; - boolean is_abstract; - boolean is_custom; - octet flags; // always 0 - RepositoryId defined_in; - VersionSpec version; - OpDescriptionSeq operations; - AttrDescriptionSeq attributes; - ValueMemberSeq members; - InitializerSeq initializers; - RepositoryIdSeq supported_interfaces; - RepositoryIdSeq abstract_base_values; - boolean has_safe_base; - RepositoryId base_value; - TypeCode type; - }; - - FullValueDescription describe_value(); - - // write interface - - ValueMemberDef create_value_member( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type_def, - in Visibility access - ); - - AttributeDef create_attribute( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type, - in AttributeMode mode - ); - - OperationDef create_operation( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType result, - in OperationMode mode, - in ParDescriptionSeq params, - in ExceptionDefSeq exceptions, - in ContextIdSeq contexts - ); - }; - struct ValueDescription { - Identifier name; - RepositoryId id; - boolean is_abstract; - boolean is_custom; - octet flags; // always 0 - RepositoryId defined_in; - VersionSpec version; - RepositoryIdSeq supported_interfaces; - RepositoryIdSeq abstract_base_values; - boolean has_safe_base; - RepositoryId base_value; - }; - - interface ValueBoxDef : IDLType - - /** ValueBoxDef is an interface that reresents a value type with - a single data member inside its state section and no - inheritance or methods. For example, when transmitting a - string or sequence as an actual parameter on an interface - operation or as a data member of a value type that is an - actual parameter, it may be important to preserve any sharing - of the string or sequence within the object graph being - transmitted. Because current IDL data types do not preserve - referential integrity in this way, this requirement is - conveniently handled by using a value type. Value types also - support the transmission of nulls (as a distinguished value), - whereas IDL data types such as string and sequence (which are - mapped to empty strings and sequences) do not. The Java to IDL - mapping requires both preservation of referential integrity - and transmission of nulls. Because it would be cumbersome to - require the full IDL syntax for a value type for this specific - usage, this shorthand notation is introduced to cover this use - of value types for simple containment of a single data member. - */ - -{ - attribute IDLType original_type_def; - }; - - // orbos 98-01-18: Objects By Value -- end - - interface NativeDef : TypedefDef { - }; -}; --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/keywords 2018-01-30 20:25:31.000000000 -0500 +++ /dev/null 2018-01-30 20:25:31.000000000 -0500 @@ -1,81 +0,0 @@ -IDL Tokens: - -Grouping: ( ) [ ] { } -Separators: : :: ; -Operators: % & * + , - / < << = > >> ^ | ~ - -Keywords: - CORBA 2.2 or earlier: - any - attribute - boolean - case - char - const - context - default - double - enum - exception - FALSE - float - in - inout - interface - long - module - Object - octet - oneway - out - raises - readonly - sequence - short - string - struct - switch - TRUE - typedef - unsigned - union - void - wchar - wstring - - CORBA 2.3 only: - init (replaced by factory) - - CORBA 2.3 and 2.4rtf: - abstract - custom - private - public - truncatable - ValueBase - valuetype - factory - - CORBA 2.3, not supported by IBM compiler - native - fixed - - CORBA 3.0: - component - consumes - emits - finder - getRaises - home - import - local - manages - multiple - primaryKey - provides - publishes - setRaises - supports - typeId - typePrefix - uses --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl 2018-01-30 20:25:32.000000000 -0500 +++ /dev/null 2018-01-30 20:25:32.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ - -// IDL not generated by rmic, do not edit -// These are all in IDL module CORBA -// The Java classes are in the package org.omg.CORBA -// See ValueType Semantics:Standard Value Box Definitions (5.3) in CORBA 2.3 spec - -#ifndef __org_omg_CORBA__ -#define __org_omg_CORBA__ - -#pragma prefix "omg.org" - -module CORBA{ - - valuetype StringValue string; - valuetype WStringValue wstring; - -}; - -#include "ir.idl" - -#pragma prefix "" - -#endif --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java 2018-01-30 20:25:33.000000000 -0500 +++ /dev/null 2018-01-30 20:25:33.000000000 -0500 @@ -1,418 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997,1998 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.som.cff; - -import java.lang.Exception; -import java.lang.String; -import java.lang.System; -import java.io.BufferedInputStream; -import java.io.DataInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.InputStream; -import java.io.IOException; -import java.util.Locale; -import java.util.NoSuchElementException; -import java.util.Properties; -import java.util.StringTokenizer; -import java.util.zip.*; - -/** - * FileLocator is an abstract class (one that cannot be instantiated) that - * provides class methods for finding files in the directories or zip - * archives that make up the CLASSPATH. - * - * @author Larry K. Raper - */ -public abstract class FileLocator extends Object { - - /* Class variables */ - - - static final Properties pp = System.getProperties (); - static final String classPath = pp.getProperty ("java.class.path", "."); - static final String pathSeparator = pp.getProperty ("path.separator", ";"); - - /* Instance variables */ - - /* [None, no instances of this class are ever instantiated.] */ - - /** - * locateClassFile returns a DataInputStream with mark/reset - * capability that can be used to read the requested class file. The - * CLASSPATH is used to locate the class. - * - * @param classFileName The name of the class to locate. The class name - * should be given in fully-qualified form, for example: - *

-     *     java.lang.Object
-     *     java.io.DataInputStream
-     * 
- * - * @exception java.io.FileNotFoundException The requested class file - * could not be found. - * @exception java.io.IOException The requested class file - * could not be opened. - */ - public static DataInputStream locateClassFile (String classFileName) - throws FileNotFoundException, IOException { - - boolean notFound = true; - StringTokenizer st; - String path = ""; - String pathNameForm; - File cf = null; - NamedDataInputStream result; - - st = new StringTokenizer (classPath, pathSeparator, false); - pathNameForm = classFileName.replace ('.', File.separatorChar) + - ".class"; - - while (st.hasMoreTokens () && notFound) { - - try {path = st.nextToken ();} - catch (NoSuchElementException nse) {break;} - int pLen = path.length (); - String pathLast4 = pLen > 3 ? path.substring (pLen - 4) : ""; - if (pathLast4.equalsIgnoreCase (".zip") || - pathLast4.equalsIgnoreCase (".jar")) { - - try { - - result = locateInZipFile (path, classFileName, true, true); - if (result == null) - continue; - return (DataInputStream) result; - - } catch (ZipException zfe) { - continue; - } catch (IOException ioe) { - continue; - } - - } else { - try {cf = new File (path + File.separator + pathNameForm); - } catch (NullPointerException npe) { continue; } - if ((cf != null) && cf.exists ()) - notFound = false; - } - } - - if (notFound) { - - /* Make one last attempt to find the file in the current - * directory - */ - - int lastdot = classFileName.lastIndexOf ('.'); - String simpleName = - (lastdot >= 0) ? classFileName.substring (lastdot+1) : - classFileName; - - result = new NamedDataInputStream (new BufferedInputStream ( - new FileInputStream (simpleName + ".class")), - simpleName + ".class", false); - return (DataInputStream) result; - } - - result = new NamedDataInputStream (new BufferedInputStream ( - new FileInputStream (cf)), path + File.separator + pathNameForm, - false); - return (DataInputStream) result; - - } - - /** - * locateLocaleSpecificFileInClassPath returns a DataInputStream that - * can be used to read the requested file, but the name of the file is - * determined using information from the current locale and the supplied - * file name (which is treated as a "base" name, and is supplemented with - * country and language related suffixes, obtained from the current - * locale). The CLASSPATH is used to locate the file. - * - * @param fileName The name of the file to locate. The file name - * may be qualified with a partial path name, using '/' as the separator - * character or using separator characters appropriate for the host file - * system, in which case each directory or zip file in the CLASSPATH will - * be used as a base for finding the fully-qualified file. - * Here is an example of how the supplied fileName is used as a base - * for locating a locale-specific file: - * - *
-     *     Supplied fileName: a/b/c/x.y,  current locale: US English
-     *
-     *                     Look first for: a/b/c/x_en_US.y
-     *     (if that fails) Look next for:  a/b/c/x_en.y
-     *     (if that fails) Look last for:  a/b/c/x.y
-     *
-     *     All elements of the class path are searched for each name,
-     *     before the next possible name is tried.
-     * 
- * - * @exception java.io.FileNotFoundException The requested class file - * could not be found. - * @exception java.io.IOException The requested class file - * could not be opened. - */ - public static DataInputStream locateLocaleSpecificFileInClassPath ( - String fileName) throws FileNotFoundException, IOException { - - String localeSuffix = "_" + Locale.getDefault ().toString (); - int lastSlash = fileName.lastIndexOf ('/'); - int lastDot = fileName.lastIndexOf ('.'); - String fnFront, fnEnd; - DataInputStream result = null; - boolean lastAttempt = false; - - if ((lastDot > 0) && (lastDot > lastSlash)) { - fnFront = fileName.substring (0, lastDot); - fnEnd = fileName.substring (lastDot); - } else { - fnFront = fileName; - fnEnd = ""; - } - - while (true) { - if (lastAttempt) - result = locateFileInClassPath (fileName); - else try { - result = locateFileInClassPath (fnFront + localeSuffix + fnEnd); - } catch (Exception e) { /* ignore */ } - if ((result != null) || lastAttempt) - break; - int lastUnderbar = localeSuffix.lastIndexOf ('_'); - if (lastUnderbar > 0) - localeSuffix = localeSuffix.substring (0, lastUnderbar); - else - lastAttempt = true; - } - return result; - - } - - /** - * locateFileInClassPath returns a DataInputStream that can be used - * to read the requested file. The resource is located in the java.corba - * module or if not found, then the CLASSPATH is searched. - * - * @param fileName The name of the file to locate. The file name - * may be qualified with a partial path name, using '/' as the separator - * character or using separator characters appropriate for the host file - * system, in which case each directory or zip file in the CLASSPATH will - * be used as a base for finding the fully-qualified file. - * - * @exception java.io.FileNotFoundException The requested class file - * could not be found. - * @exception java.io.IOException The requested class file - * could not be opened. - */ - public static DataInputStream locateFileInClassPath (String fileName) - throws FileNotFoundException, IOException { - - // The resource should be in the java.corba module - InputStream in = FileLocator.class.getResourceAsStream("/" + fileName); - if (in != null) { - return new DataInputStream(in); - } - - boolean notFound = true; - StringTokenizer st; - String path = ""; - File cf = null; - NamedDataInputStream result; - - String zipEntryName = File.separatorChar == '/' ? fileName : - fileName.replace (File.separatorChar, '/'); - - String localFileName = File.separatorChar == '/' ? fileName : - fileName.replace ('/', File.separatorChar); - - st = new StringTokenizer (classPath, pathSeparator, false); - - while (st.hasMoreTokens () && notFound) { - - try {path = st.nextToken ();} - catch (NoSuchElementException nse) {break;} - int pLen = path.length (); - String pathLast4 = pLen > 3 ? path.substring (pLen - 4) : ""; - if (pathLast4.equalsIgnoreCase (".zip") || - pathLast4.equalsIgnoreCase (".jar")) { - - try { - - result = locateInZipFile (path, zipEntryName, false, false); - if (result == null) - continue; - return (DataInputStream) result; - - } catch (ZipException zfe) { - continue; - } catch (IOException ioe) { - continue; - } - - } else { - try {cf = new File (path + File.separator + localFileName); - } catch (NullPointerException npe) { continue; } - if ((cf != null) && cf.exists ()) - notFound = false; - } - } - - if (notFound) { - - /* Make one last attempt to find the file in the current - * directory - */ - - int lastpart = localFileName.lastIndexOf (File.separator); - String simpleName = - (lastpart >= 0) ? localFileName.substring (lastpart+1) : - localFileName; - - result = new NamedDataInputStream (new BufferedInputStream ( - new FileInputStream (simpleName)), simpleName, false); - return (DataInputStream) result; - } - - result = new NamedDataInputStream (new BufferedInputStream ( - new FileInputStream (cf)), path + File.separator + localFileName, - false); - return (DataInputStream) result; - - } - - /** - * Returns the fully qualified file name associated with the passed - * DataInputStream if the DataInputStream was created using one - * of the static locate methods supplied with this class, otherwise - * returns a zero length string. - */ - public static String getFileNameFromStream (DataInputStream ds) { - - if (ds instanceof NamedDataInputStream) - return ((NamedDataInputStream) ds).fullyQualifiedFileName; - return ""; - - } - - /** - * Returns an indication of whether the passed DataInputStream is - * associated with a member of a zip file if the DataInputStream was - * created using one of the static locate methods supplied with this - * class, otherwise returns false. - */ - public static boolean isZipFileAssociatedWithStream (DataInputStream ds) { - - if (ds instanceof NamedDataInputStream) - return ((NamedDataInputStream) ds).inZipFile; - return false; - - } - - private static NamedDataInputStream locateInZipFile (String zipFileName, - String fileName, boolean wantClass, boolean buffered) - throws ZipException, IOException { - - ZipFile zf; - ZipEntry ze; - zf = new ZipFile (zipFileName); - - if (zf == null) - return null; - String zeName = wantClass ? - fileName.replace ('.', '/') + ".class" : - fileName; - - // This code works with JDK 1.0 level SUN zip classes - // - - // ze = zf.get (zeName); - // if (ze == null) - // return null; - // return new NamedDataInputStream ( - // new BufferedInputStream (new ZipInputStream (ze)), - // zipFileName + '(' +zeName + ')', true); - - // This code works with JDK 1.0.2 and JDK 1.1 level SUN zip classes - // - - ze = zf.getEntry (zeName); - if (ze == null) { - zf.close(); // D55355, D56419 - zf = null; - return null; - } - InputStream istream = zf.getInputStream(ze); - if (buffered) - istream = new BufferedInputStream(istream); - return new NamedDataInputStream (istream, - zipFileName + '(' + zeName + ')', true); - - } - -} - -/** - * This class is used to associate a filename with a DataInputStream - * The host platform's file naming conventions are assumed for the filename. - * - * @author Larry K. Raper - * - */ -/* default access */ class NamedDataInputStream extends DataInputStream { - - /* Instance variables */ - - /** - * The name of the file associated with the DataInputStream. - */ - public String fullyQualifiedFileName; - - /** - * Indicates whether or not the file is contained in a .zip file. - */ - public boolean inZipFile; - - /* Constructors */ - - protected NamedDataInputStream (InputStream in, String fullyQualifiedName, - boolean inZipFile) { - - super (in); - this.fullyQualifiedFileName = fullyQualifiedName; - this.inZipFile = inZipFile; - - } - -} --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/Messages.java 2018-01-30 20:25:34.000000000 -0500 +++ /dev/null 2018-01-30 20:25:34.000000000 -0500 @@ -1,356 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997,1998 - * RMI-IIOP v1.0 - * - * Defect History - * - * #26964 LKR 11/25/96 \u0020 at end-of-message not handled properly by Java. - * #31840 LKR 06/05/97 Replace \n in templates with Java's line separator. - * - */ - -package com.sun.tools.corba.se.idl.som.cff; - -import java.io.IOException; -import java.util.Enumeration; -import java.util.Properties; -import java.lang.String; -import java.lang.System; - -/** - * This class provides messaging services for accessing, and merging - * parameters into, translatable message text. The text is presumed - * to reside in a .properties file. A "cff.properties" file that - * contains all of the message text needed for the CFF framework itself - * is loaded during class initialization. All of the messages in the - * cff.properties file that are needed by the CFF framework contain keys - * that begin with the string "cff.". - *

- * The static method Messages.msgLoad may be used to merge additional - * message text .properties files needed by other frameworks or user - * programs. - * - * @see com.sun.tools.corba.se.idl.som.cff.Messages#msgLoad - * - * @author Larry K. Raper - */ - -public abstract class Messages { - - /* Class variables */ - - - /* Metasymbol for leading or trailing blank */ - private static final String LTB = "%B"; - /* Metasymbol for line separator */ - private static final char NL = '\n'; - - private static final String lineSeparator = - System.getProperty ("line.separator"); - - private static final Properties m = new Properties (); - private static boolean loadNeeded = true; - - /* Class methods for message loading and formatting */ - - private static final synchronized void loadDefaultProperties () { - - if (!loadNeeded) - return; - try { - m.load (FileLocator.locateLocaleSpecificFileInClassPath ( - "com/sun/tools/corba/se/idl/som/cff/cff.properties")); - } catch (IOException ioe) { } - fixMessages (m); /* #26964 Replace any metasymbols */ - loadNeeded = false; - - } - - /** - * This method was introduced to fix defect #26964. For Java 1.0.2 - * on Win NT, the escape sequence \u0020 was not being handled - * correctly by the Java Properties class when it was the final - * character of a line. Instead the trailing blank was dropped - * and the next line was swallowed as a continuation. To work - * around the problem, we introduced our own metasymbol to represent - * a trailing blank. Hence: - * - * Performs substitution for any metasymbols in the message - * templates. So far only %B is needed. This was introduced - * to make it more convenient for .properties files to - * contain message templates with leading or trailing blanks - * (although %B may actually occur anywhere in a template). - * Subsequently, checking for '\n' has also been added. Now, - * wherever '\n' occurs in a message template, it is replaced - * with the value of System.getProperty ("line.separator"). - */ - private static final void fixMessages (Properties p) { - - Enumeration keys = p.keys (); - Enumeration elems = p.elements (); - while (keys.hasMoreElements ()) { - String key = (String) keys.nextElement (); - String elem = (String) elems.nextElement (); - int i = elem.indexOf (LTB); - boolean changed = false; - while (i != -1) { - if (i == 0) - elem = " " + elem.substring (2); - else - elem = elem.substring (0, i) + " " + elem.substring (i+2); - changed = true; - i = elem.indexOf (LTB); - } - int lsIncr = lineSeparator.length () - 1; - for (i=0; i - * If the msgkey cannot be found, its value is used as the - * message text. - */ - public static final String msg (String msgkey, String parm) { - - if (loadNeeded) - loadDefaultProperties (); - String msgtext = m.getProperty (msgkey, msgkey); - int i = msgtext.indexOf ("%1"); - if (i >= 0) { - String ending = ""; - if ((i+2) < msgtext.length ()) - ending = msgtext.substring (i+2); - return msgtext.substring (0, i) + parm + ending; - } else - msgtext += " " + parm; - return msgtext; - - } - - /** - * Returns the message text corresponding to the passed msgkey - * string. The message text is assumed to require the insertion - * of a single argument, supplied by the "parm" parameter. - * If the message text does not contain the meta characters "%1" - * that indicate where to place the argument, the passed argument - * is appended at the end of the message text. - *

- * If the msgkey cannot be found, its value is used as the - * message text. - */ - public static final String msg (String msgkey, int parm) { - - return msg (msgkey, String.valueOf (parm)); - - } - - /** - * Returns the message text corresponding to the passed msgkey - * string. The message text is assumed to require the insertion - * of two arguments, supplied by the "parm1" and "parm2" parameters. - * If the message text does not contain the meta characters "%1" and - * "%2" that indicate where to place the arguments, the passed arguments - * are appended at the end of the message text. - *

- * If the msgkey cannot be found, its value is used as the - * message text. - */ - public static final String msg (String msgkey, String parm1, String parm2) { - - if (loadNeeded) - loadDefaultProperties (); - String result = m.getProperty (msgkey, msgkey); - String ending = ""; - int i = result.indexOf ("%1"); - if (i >= 0) { - if ((i+2) < result.length ()) - ending = result.substring (i+2); - result = result.substring (0, i) + parm1 + ending; - } else - result += " " + parm1; - i = result.indexOf ("%2"); - if (i >= 0) { - ending = ""; - if ((i+2) < result.length ()) - ending = result.substring (i+2); - result = result.substring (0, i) + parm2 + ending; - } else - result += " " + parm2; - return result; - - } - - /** - * Returns the message text corresponding to the passed msgkey - * string. The message text is assumed to require the insertion - * of two arguments, supplied by the "parm1" and "parm2" parameters. - * If the message text does not contain the meta characters "%1" and - * "%2" that indicate where to place the arguments, the passed arguments - * are appended at the end of the message text. - *

- * If the msgkey cannot be found, its value is used as the - * message text. - */ - public static final String msg (String msgkey, int parm1, String parm2) { - - return msg (msgkey, String.valueOf (parm1), parm2); - - } - - /** - * Returns the message text corresponding to the passed msgkey - * string. The message text is assumed to require the insertion - * of two arguments, supplied by the "parm1" and "parm2" parameters. - * If the message text does not contain the meta characters "%1" and - * "%2" that indicate where to place the arguments, the passed arguments - * are appended at the end of the message text. - *

- * If the msgkey cannot be found, its value is used as the - * message text. - */ - public static final String msg (String msgkey, String parm1, int parm2) { - - return msg (msgkey, parm1, String.valueOf (parm2)); - - } - - /** - * Returns the message text corresponding to the passed msgkey - * string. The message text is assumed to require the insertion - * of two arguments, supplied by the "parm1" and "parm2" parameters. - * If the message text does not contain the meta characters "%1" and - * "%2" that indicate where to place the arguments, the passed arguments - * are appended at the end of the message text. - *

- * If the msgkey cannot be found, its value is used as the - * message text. - */ - public static final String msg (String msgkey, int parm1, int parm2) { - - return msg (msgkey, String.valueOf (parm1), String.valueOf (parm2)); - - } - - - /** - * Returns the message text corresponding to the passed msgkey - * string. The message text is assumed to require the insertion - * of three arguments, supplied by the "parm1", "parm2" and "parm3" - * parameters. - * If the message text does not contain the meta characters "%1" and - * "%2" that indicate where to place the arguments, the passed arguments - * are appended at the end of the message text. - *

- * If the msgkey cannot be found, its value is used as the - * message text. - */ - public static final String msg (String msgkey, String parm1, - String parm2, String parm3) { - if (loadNeeded) - loadDefaultProperties (); - String result = m.getProperty (msgkey, msgkey); - result = substituteString(result, 1, parm1); - result = substituteString(result, 2, parm2); - result = substituteString(result, 3, parm3); - - return result; - } - - /* helper function for string substition. - @return the substituted string, it substitution is possible. - Otherwise, return a new string with subst at the end. - @orig: original string - @paramNum the parameter number to search. For example, - paramNam == 1 means search for "%1". - @subst: string for the substitution. - */ - private static String substituteString(String orig, int paramNum, - String subst){ - String result = orig; - String paramSubst = "%"+ paramNum; - int len = paramSubst.length(); - int index = result.indexOf (paramSubst); - String ending = ""; - if (index >= 0) { - if ((index+len) < result.length ()) - ending = result.substring (index+len); - result = result.substring (0, index) + subst + ending; - } - else result += " " + subst; - - return result; - } - - -} --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java 2018-01-30 20:25:34.000000000 -0500 +++ /dev/null 2018-01-30 20:25:35.000000000 -0500 @@ -1,259 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: shasta - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997,1998,1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.som.idlemit; -import java.util.Vector; -import com.sun.tools.corba.se.idl.som.cff.Messages; -/** - * This is an implementation that handles - * #pragma meta scoped_name string - * where - *

    - *
  • scoped_name == "::" separated scoped name - *
  • string == separated identifiers, such as "localonly", - * "abstract", or "init". - * D59407: NOTE: any non-white-space is grouped - * as part of the identifier. - *
- * - * This pragma handler places a vector of Strings into the dynamicVariable() - * part of the SymtabEntry. The key to access the dynamicVariable() - * is com.sun.tools.corba.se.idl.som.idlemit.MetaPragma.metaKey - * - * It is possible to associate a meta pragma with a forward entry. - * At some point after the parser has completed, - * the method processForward(ForwardEntry entry) should be called - * for each ForwardEntry so that the meta information can be folded from - * the ForwardEntry into the corresponding InterfaceEntry. - */ -public class MetaPragma extends com.sun.tools.corba.se.idl.PragmaHandler { - /* Class variables */ - - /* key to access the Cached meta info in com.sun.tools.corba.se.idl.SymtabEntry */ - public static int metaKey = com.sun.tools.corba.se.idl.SymtabEntry.getVariableKey(); - - - /** - * Main entry point for the MetaPragma handler - * @param pragma string for pragma name - * @param currentToken next token in the input stream. - * @return true if this is a meta pragma. - */ - public boolean process(String pragma, String currentToken) { - if ( !pragma.equals("meta")) - return false; - - com.sun.tools.corba.se.idl.SymtabEntry entry ; - String msg; - try { - entry = scopedName(); - if ( entry == null){ - /* scoped name not found */ - parseException(Messages.msg("idlemit.MetaPragma.scopedNameNotFound")); - skipToEOL(); - } - else { - msg = (currentToken()+ getStringToEOL()); -// System.out.println(entry + ": " + msg); - Vector v; - v = (Vector) entry.dynamicVariable(metaKey); - if ( v== null){ - v = new Vector(); - entry.dynamicVariable(metaKey, v); - } - parseMsg(v, msg); - } - } catch(Exception e){ -// System.out.println("exception in MetaPragma"); - } - return true; - } - - - /** - * Fold the meta info from the forward entry into its corresponding - * interface entry. - * @param forwardEntry the forward entry to process - */ - static public void processForward(com.sun.tools.corba.se.idl.ForwardEntry forwardEntry){ - - Vector forwardMeta; - try { - forwardMeta = (Vector)forwardEntry.dynamicVariable(metaKey); - } catch (Exception e){ - forwardMeta = null; - } - com.sun.tools.corba.se.idl.SymtabEntry forwardInterface = forwardEntry.type(); - if (forwardMeta != null && forwardInterface!= null) { - Vector interfaceMeta; - try { - interfaceMeta= (Vector)forwardInterface.dynamicVariable(metaKey); - } catch ( Exception e){ - interfaceMeta = null; - } - - if ( interfaceMeta == null) { - /* set */ - try { - forwardInterface.dynamicVariable(MetaPragma.metaKey, forwardMeta); - } catch(Exception e){}; - } - else if (interfaceMeta != forwardMeta) { - /* The above check is needed because sometimes - a forward entry is processed more the once. - Not sure why */ - /* merge */ - for (int i=0; i < forwardMeta.size(); i++){ - try { - Object obj = forwardMeta.elementAt(i); - interfaceMeta.addElement(obj); - } catch (Exception e){}; - } - } - } - } - - /** - * parse pragma message and place into vector v. - * @param v: vector to add message - * @param msg: string of comma separated message, perhaps with comment. - * This is implemented as a state machine as follows: - * - * State token next action - * ----------------------------------------------------- - * initial whitespace initial - * initial SlashStar comment - * initial SlashSlash final - * initial no more final - * initial text text add to text buffer - * initial StarSlash initial - * comment StarSlash initial - * comment SlashStar comment - * comment whitespace comment - * comment SlashSlash comment - * comment text comment - * comment no more final - * text text text add to buffer - * text SlashStar comment put in vector - * text whitespace initial put in vector - * text SlashSlash final put in vector - * text StarSlash initial put in vector - * text no more final put in vector - * - */ - private static int initialState = 0; - private static int commentState = 1; - private static int textState = 2; - private static int finalState =3; - - private void parseMsg(Vector v, String msg){ - int state = initialState; - String text = ""; - int index = 0; - while ( state != finalState ){ - boolean isNoMore = index >= msg.length(); - char ch = ' '; - boolean isSlashStar = false; - boolean isSlashSlash = false; - boolean isWhiteSpace = false; - boolean isStarSlash = false; - boolean isText = false; - if (!isNoMore ){ - ch = msg.charAt(index); - if (ch == '/' && index+1 < msg.length()){ - if (msg.charAt(index+1) == '/'){ - isSlashSlash = true; - index++; - } - else if (msg.charAt(index+1) == '*'){ - isSlashStar= true; - index++; - } else isText = true; - } - else if (ch == '*' && index+1 < msg.length() ){ - if (msg.charAt(index+1) == '/'){ - isStarSlash = true; - index++; - } else isText = true; - } - else if ( Character.isSpace(ch) || (ch == ',') // 59601 - || (ch == ';') ) // 59683 - isWhiteSpace = true; - else isText = true; - } - - if (state == initialState){ - if (isSlashStar){ - state = commentState; - } - else if (isSlashSlash || isNoMore){ - state = finalState; - } - else if (isText){ - state = textState; - text = text+ ch; - } - } - else if (state == commentState){ - if (isNoMore){ - state = finalState; - } - else if ( isStarSlash){ - state = initialState; - } - } - else if (state == textState){ - if (isNoMore || isStarSlash || isSlashSlash || - isSlashStar || isWhiteSpace ){ - if (!text.equals("")) { - v.addElement(text); -// System.err.println("adding " + text); - text = ""; - } - if (isNoMore) - state = finalState; - else if (isSlashStar) - state = commentState; - else state = initialState; - } - else if (isText){ - text = text+ch; - } - } - index++; - } - } - -} --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java 2018-01-30 20:25:35.000000000 -0500 +++ /dev/null 2018-01-30 20:25:35.000000000 -0500 @@ -1,342 +0,0 @@ -/* - * Copyright (c) 1999, 2007, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -09/23/98 Ported -td option to change output directory -// -09/23/98 Ported -m option to generate make dependencies -// -F46082.51 Transferred -m, -mmin, mall, -mdepend options to com.sun.tools.corba.se.idl.toJava -// since these are IBM-specific (see f46838); cleaned-out dead code. -// -D57482 Added method setDefaultEmitter so could be overridden. -// -F60858.1 Set corba level to 2.3. - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Properties; -import java.util.Vector; -import java.io.File; - -import com.sun.tools.corba.se.idl.InvalidArgument; - -/** - * - **/ -public class Arguments extends com.sun.tools.corba.se.idl.Arguments -{ - /** - * Public, zero-argument constructor. - **/ - public Arguments () - { - super (); - corbaLevel = 2.4f; - } // ctor - - /** - * - **/ - protected void parseOtherArgs (String[] args, - Properties properties) throws InvalidArgument - { - String skeletonPattern = null ; - String tiePattern = null ; - - // Get package prefixes from user's properties file. - packages.put ("CORBA", "org.omg"); // klr - always needed - packageFromProps (properties); - - // Now get package prefixes from command line (along with other args). - // This order has the effect of making command line packages - // supercede any idl.config file packages. - try - { - Vector unknownArgs = new Vector (); - - // Process command line parameters - for (int i = 0; i < args.length; ++i) - { - String lcArg = args[i].toLowerCase (); - - if (lcArg.charAt (0) != '-' && lcArg.charAt (0) != '/') - throw new InvalidArgument (args[i]); - if (lcArg.charAt (0) == '-' ) { - lcArg = lcArg.substring (1); - } - - // Proxy options; default is -fclient. - if (lcArg.startsWith ("f")) - { - // If the command line had '-f client', make it '-fclient' - if (lcArg.equals ("f")) - lcArg = 'f' + args[++i].toLowerCase (); - - // Determine whether to emit bindings for client, server or both; and - // whether to emit delegate-style (TIE) rather than derived-style - // skeletons, which are the default. - - if (lcArg.equals ("fclient")) - { - emit = ((emit == Server || emit == All) ? All : Client); - } - else if (lcArg.equals ("fserver")) - { - emit = ((emit == Client || emit == All) ? All : Server); - TIEServer = false; - } - else if (lcArg.equals ("fall")) - { - emit = All; - TIEServer = false; - //Should be removed and incorporated in the clause below - // POAServer = true; - } - else if (lcArg.equals ("fservertie")) - { - emit = ((emit == Client || emit == All) ? All : Server); - TIEServer = true; - } - else if (lcArg.equals ("falltie")) - { - emit = All; - TIEServer = true; - } - else - i = collectUnknownArg (args, i, unknownArgs); - } - else if (lcArg.equals ("pkgtranslate")) - { - if (i + 2 >= args.length) - throw new InvalidArgument( args[i] ) ; - - String orig = args[++i] ; - String trans = args[++i] ; - checkPackageNameValid( orig ) ; - checkPackageNameValid( trans ) ; - if (orig.equals( "org" ) || orig.startsWith( "org.omg" )) - throw new InvalidArgument( args[i] ) ; - orig = orig.replace( '.', '/' ) ; - trans = trans.replace( '.', '/' ) ; - packageTranslation.put( orig, trans ) ; - } - // Package prefix - else if (lcArg.equals ("pkgprefix")) - { - if (i + 2 >= args.length) - throw new InvalidArgument (args[i]); - - String type = args[++i]; - String pkg = args[++i]; - checkPackageNameValid( type ) ; - checkPackageNameValid( pkg ) ; - packages.put (type, pkg); - } - // Target directory - else if (lcArg.equals ("td")) // - { - if (i + 1 >= args.length) - throw new InvalidArgument (args[i]); - String trgtDir = args[++i]; - if (trgtDir.charAt (0) == '-') - throw new InvalidArgument (args[i - 1]); - else - { - targetDir = trgtDir.replace ('/', File.separatorChar); - if (targetDir.charAt (targetDir.length () - 1) != File.separatorChar) - targetDir = targetDir + File.separatorChar; - } - } - // Separator - else if (lcArg.equals ("sep")) - { - if (i + 1 >= args.length) - throw new InvalidArgument (args[i]); - separator = args[++i]; - } - // POA flag ? - else if (lcArg.equals ("oldimplbase")){ - POAServer = false; - } - else if (lcArg.equals("skeletonname")){ - if (i + 1 >= args.length) - throw new InvalidArgument (args[i]); - skeletonPattern = args[++i]; - } - else if (lcArg.equals("tiename")){ - if (i + 1 >= args.length) - throw new InvalidArgument (args[i]); - tiePattern = args[++i]; - } - else if (lcArg.equals("localoptimization")) { - LocalOptimization = true; - } - else i = collectUnknownArg (args, i, unknownArgs); - } - - // Encountered unknown arguments? - if (unknownArgs.size () > 0) - { - String [] otherArgs = new String [unknownArgs.size ()]; - unknownArgs.copyInto (otherArgs); - // Throws InvalidArgument by default - super.parseOtherArgs (otherArgs, properties); - } - - setDefaultEmitter(); // d57482 - setNameModifiers( skeletonPattern, tiePattern ) ; - } - catch (ArrayIndexOutOfBoundsException e) - { - // If there is any array indexing problem, it is probably - // because the qualifier on the last argument is missing. - // Report that this last argument is invalid. - throw new InvalidArgument (args[args.length - 1]); - } - } // parseOtherArgs - - /** - * - **/ - protected int collectUnknownArg (String[] args, int i, Vector unknownArgs) - { - unknownArgs.addElement (args [i]); - ++i; - while (i < args.length && args[i].charAt (0) != '-' && args[i].charAt (0) != '/') - unknownArgs.addElement (args[i++]); - return --i; - } // collectUnknownArg - - /** - * - **/ - // XXX Either generalize this facility or remove it completely. - protected void packageFromProps (Properties props) throws InvalidArgument - { - Enumeration propsEnum = props.propertyNames (); - while (propsEnum.hasMoreElements ()) - { - String prop = (String)propsEnum.nextElement (); - if (prop.startsWith ("PkgPrefix.")) - { - String type = prop.substring (10); - String pkg = props.getProperty (prop); - checkPackageNameValid( pkg ) ; - checkPackageNameValid( type ) ; - packages.put (type, pkg); - } - } - } // packageFromProps - - /** - * d57482 (klr) method added so default emitter check could be overriden. - **/ - protected void setDefaultEmitter () { - // If the flag -fclient was not found, assume it. - if (emit == None) emit = Client; - } - - protected void setNameModifiers( String skeletonPattern, - String tiePattern ) { - if (emit>Client) { - String tp ; - String sp ; - - if (skeletonPattern != null) - sp = skeletonPattern ; - else if (POAServer) - sp = "%POA" ; - else - sp = "_%ImplBase" ; - - if (tiePattern != null) - tp = tiePattern ; - else if (POAServer) - tp = "%POATie" ; - else - tp = "%_Tie" ; - - skeletonNameModifier = new NameModifierImpl( sp ) ; - tieNameModifier = new NameModifierImpl( tp ) ; - } - } - - /** - * - **/ - private void checkPackageNameValid (String name) throws InvalidArgument - { - if (name.charAt (0) == '.') - throw new InvalidArgument (name); - for (int i = 0; i < name.length ();++i) - if (name.charAt (i) == '.') - { - if (i == name.length () - 1 || !Character.isJavaIdentifierStart (name.charAt (++i))) - throw new InvalidArgument (name); - } - else if (!Character.isJavaIdentifierPart (name.charAt (i))) - throw new InvalidArgument (name); - } // validatePackageName - - // <46082.03><46838> Modified access restrictions from protected to public. - - // This is a hash table whose keys are top-level typenames and - // whose values are the package prefixes to those types. - // For instance, <"CORBA", "org.omg"> is a possible entry. - public Hashtable packages = new Hashtable (); - - public String separator = null; - - public static final int - None = 0, - Client = 1, - Server = 2, - All = 3; - public int emit = None; - public boolean TIEServer = false; - public boolean POAServer = true; - // By default we do not generate Locally Optimized stub because of an - // unresolved PI problem. We will generate only if -localOptimization flag - // is passed - public boolean LocalOptimization = false; - public NameModifier skeletonNameModifier = null ; - public NameModifier tieNameModifier = null ; - - // Key is original package name; value is translated package name. - // Note that this translation happens AFTER prefixes are added in the - // packages table. - public Hashtable packageTranslation = new Hashtable() ; - - public String targetDir = ""; // -} // class Arguments --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java 2018-01-30 20:25:36.000000000 -0500 +++ /dev/null 2018-01-30 20:25:36.000000000 -0500 @@ -1,195 +0,0 @@ -/* - * Copyright (c) 1999, 2002, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.AttributeEntry; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.ParameterEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; - -/** - * - **/ -public class AttributeGen extends MethodGen implements com.sun.tools.corba.se.idl.AttributeGen -{ - /** - * Public zero-argument constructor. - **/ - public AttributeGen () - { - } // ctor - - /** - * - **/ - private boolean unique (InterfaceEntry entry, String name) - { - // Compare the name to the methods of this interface - Enumeration methods = entry.methods ().elements (); - while (methods.hasMoreElements ()) - { - SymtabEntry method = (SymtabEntry)methods.nextElement (); - if (name.equals (method.name ())) - return false; - } - - // Recursively call unique on each derivedFrom interface - Enumeration derivedFrom = entry.derivedFrom ().elements (); - while (derivedFrom.hasMoreElements ()) - if (!unique ((InterfaceEntry)derivedFrom.nextElement (), name)) - return false; - - // If the name isn't in any method, nor in any method of the - // derivedFrom interfaces, then the name is unique. - return true; - } // unique - - /** - * Method generate() is not used in MethodGen. They are replaced by the - * more granular interfaceMethod, stub, skeleton, dispatchSkeleton. - **/ - public void generate (Hashtable symbolTable, AttributeEntry m, PrintWriter stream) - { - } // generate - - /** - * - **/ - protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - AttributeEntry a = (AttributeEntry)m; - - // Generate for the get method - super.interfaceMethod (symbolTable, a, stream); - - // Generate for the set method if the attribute is not readonly - if (!a.readOnly ()) - { - setupForSetMethod (); - super.interfaceMethod (symbolTable, a, stream); - clear (); - } - } // interfaceMethod - - /** - * - **/ - protected void stub (String className, boolean isAbstract, Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index) - { - AttributeEntry a = (AttributeEntry)m; - - // Generate for the get method - super.stub (className, isAbstract, symbolTable, a, stream, index); - - // Generate for the set method if the attribute is not readonly - if (!a.readOnly ()) - { - setupForSetMethod (); - super.stub (className, isAbstract, symbolTable, a, stream, index + 1); - clear (); - } - } // stub - - /** - * - **/ - protected void skeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index) - { - AttributeEntry a = (AttributeEntry)m; - - // Generate for the get method - super.skeleton (symbolTable, a, stream, index); - - // Generate for the set method if the attribute is not readonly - if (!a.readOnly ()) - { - setupForSetMethod (); - super.skeleton (symbolTable, a, stream, index + 1); - clear (); - } - } // skeleton - - /** - * - **/ - protected void dispatchSkeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index) - { - AttributeEntry a = (AttributeEntry)m; - - // Generate for the get method - super.dispatchSkeleton (symbolTable, a, stream, index); - - // Generate for the set method if the attribute is not readonly - if (!a.readOnly ()) - { - setupForSetMethod (); - super.dispatchSkeleton (symbolTable, m, stream, index + 1); - clear (); - } - } // dispatchSkeleton - - private SymtabEntry realType = null; - - /** - * - **/ - protected void setupForSetMethod () - { - ParameterEntry parm = Compile.compiler.factory.parameterEntry (); - parm.type (m.type ()); - parm.name ("new" + Util.capitalize (m.name ())); - m.parameters ().addElement (parm); - realType = m.type (); - m.type (null); - } // setupForSetMethod - - /** - * - **/ - protected void clear () - { - // Set back to normal - m.parameters ().removeAllElements (); - m.type (realType); - } // clear -} // class AttributeGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java 2018-01-30 20:25:37.000000000 -0500 +++ /dev/null 2018-01-30 20:25:37.000000000 -0500 @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D62023 New file to implement CORBA 2.4 RTF -// REVISIT: These changes should be folded into AttributeGen. - -import java.io.PrintWriter; - -import java.util.Enumeration; -import java.util.Vector; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.ParameterEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.AttributeEntry; - -/** - * - **/ -public class AttributeGen24 extends MethodGenClone24 -{ - /** - * Public zero-argument constructor. - **/ - public AttributeGen24 () - { - } // ctor - - /** - * (d62023-klr) Added for 2.4 RTF - **/ - protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - AttributeEntry a = (AttributeEntry)m; - - // Generate for the get method - super.abstractMethod (symbolTable, a, stream); - - // Generate for the set method if the attribute is not readonly - if (!a.readOnly ()) - { - setupForSetMethod (); - super.abstractMethod (symbolTable, a, stream); - clear (); - } - } // abstractMethod - - /** - * (d62023-klr) Added for 2.4 RTF - **/ - protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - AttributeEntry a = (AttributeEntry)m; - - // Generate for the get method - super.interfaceMethod (symbolTable, a, stream); - - // Generate for the set method if the attribute is not readonly - if (!a.readOnly ()) - { - setupForSetMethod (); - super.interfaceMethod (symbolTable, a, stream); - clear (); - } - } // interfaceMethod - -} // class AttributeGen24 --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java 2018-01-30 20:25:38.000000000 -0500 +++ /dev/null 2018-01-30 20:25:38.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: - -/** - * - **/ -public interface AuxGen -{ - void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry); -} // interface AuxGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Compile.java 2018-01-30 20:25:38.000000000 -0500 +++ /dev/null 2018-01-30 20:25:38.000000000 -0500 @@ -1,430 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -09/23/98 KLR Ported -m updates (F46838.1-3) -// -f46082.51 Transferred makefile list generation (for ODE delta-builds, -// see f46838) to toJava; cleaned-out dead code. -// -D58319 Display version info. for -version option. -// -D58951 Modify to allow QuickTest to build. -// -D49526 Remove "TypeCode" symbol from preParse(). -// -D58591 Publicise _factories and compile for QuickTest. Need to revert -// t0 private and add accessor methods. -// -D59437 Fill typename information for value boxes. - -import java.io.File; -import java.io.IOException; -import java.io.BufferedWriter; -import java.io.FileWriter; -import java.io.PrintWriter; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.SymtabFactory; -import com.sun.tools.corba.se.idl.IncludeEntry; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.ModuleEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StructEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.UnionBranch; -import com.sun.tools.corba.se.idl.UnionEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.InvalidArgument; - -/** - * Compiler usage: - *

- * - * java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] <idl file> - *

- * - * where <idl file> is the name of a file containing IDL definitions, - * and [options] is any combination of the options listed below. The options - * may appear in any order. - *

- * - * Options: - *
- *
{@code -i } - *
By default, the current directory is scanned for included files. - * This option adds another directory. See also the note below. - * - *
{@code -d } - *
This is equivalent to the following line in an IDL file: - * {@code #define } - * - *
{@code -f } - *
Defines what bindings to emit. {@code } is one of client, server, all, - * serverTIE, allTIE. serverTIE and allTIE cause delegate model skeletons - * to be emitted. If this flag is not used, -fclient is assumed. - * allPOA has the same effect as all, except for generation POA type skeletons. - * - *
{@code -keep} - *
If a file to be generated already exists, do not overwrite it. By - * default it is overwritten. - * - *
{@code -sep } - *
Only valid with -m. Replace the file separator character with - * {@code } in the file names listed in the .u file. - * - *
{@code -emitAll} - *
Emit all types, including those found in #included files. - * - *
{@code -v} - *
Verbose mode. - * - *
{@code -pkgPrefix } - *
Whereever {@code } is encountered, make sure it resides within - * {@code } in all generated files. {@code } is a fully - * qualified, java-style name. - *
- * - * Note: If you have an include path or paths that you will always - * be using, it can get tedious putting these on the command with the -i - * option all the time. Instead, these can be placed into a config file - * called idl.config. This file must be in the CLASSPATH. The format of - * the includes line is: - * - *
{@code
- * includes=;;...;
- * }
- * - * Note that the path separator character, here shown as a semicolon, - * is machine dependent. For instance, on Windows 95 this character - * is a semicolon, on UNIX it is a colon. - **/ -public class Compile extends com.sun.tools.corba.se.idl.Compile -{ - /** - * - **/ - public static void main (String[] args) - { - compiler = new Compile (); - compiler.start (args); - } // main - - /** - * - **/ - public void start (String[] args) - { - try - { - // Use generator-specific messages file. - //Util.registerMessageFile ("com/sun/corba/se/idl/toJavaPortable/toJava.prp"); - Util.registerMessageFile ("com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp"); - init (args); - if (arguments.versionRequest) - displayVersion (); - else - { - preParse (); - Enumeration e = parse (); - if (e != null) - { - preEmit (e); - generate (); - // Move ODE delta-build support to toJava - //if (((Arguments)arguments).genMakefileLists) - // generateMakefileLists (); - } - } - } - catch (InvalidArgument e) - { - System.err.println (e); - } - catch (IOException e) - { - System.err.println (e); - } - } // start - - /** - * - **/ - protected Compile () - { - factory = factories ().symtabFactory (); - } // ctor - - // _factories was made public for QuickTest to operate correctly, - // but the code needs to be changed to this: - //private Factories _factories = null; - //protected com.sun.tools.corba.se.idl.Factories factories () - //{ - // if (_factories == null) - // _factories = new Factories (); - // return _factories; - //} // factories - - public Factories _factories = new Factories (); // 58974 - changed for quicktest - protected com.sun.tools.corba.se.idl.Factories factories () - { - return _factories; - } // factories - - - ModuleEntry org; - ModuleEntry omg; - ModuleEntry corba; - InterfaceEntry object; - - /** - * - **/ - protected void preParse () - { - Util.setSymbolTable (symbolTable); - Util.setPackageTranslation( ((Arguments)arguments).packageTranslation ) ; - - // Need modules for the predefined objects - org = factory.moduleEntry (); - // Suppress generation of this module. If the parser reopens it - // while parsing the main IDL source, any definitions appearing in the module - // -- and not appearing in a global-scope include file -- will be added to - // the emit list with emit=true for eventual generation. - org.emit (false); - org.name ("org"); - org.container (null); - omg = factory.moduleEntry (); - omg.emit (false); // - omg.name ("omg"); - omg.module ("org"); - omg.container (org); - org.addContained (omg); - corba = factory.moduleEntry (); - corba.emit (false); // - corba.name ("CORBA"); - corba.module ("org/omg"); - corba.container (omg); - omg.addContained (corba); - symbolTable.put ("org", org); - symbolTable.put ("org/omg", omg); - symbolTable.put ("org/omg/CORBA", corba); - - // Add CORBA::Object to symbol table. - object = (InterfaceEntry)symbolTable.get ("Object"); - object.module ("org/omg/CORBA"); - object.container (corba); - symbolTable.put ("org/omg/CORBA/Object", object); - - // Add PIDL type (primitive) CORBA::TypeCode to symbol table. - PrimitiveEntry pEntry = factory.primitiveEntry (); - pEntry.name ("TypeCode"); - pEntry.module ("org/omg/CORBA"); - pEntry.container (corba); - symbolTable.put ("org/omg/CORBA/TypeCode", pEntry); - symbolTable.put ("CORBA/TypeCode", pEntry); // - overrideNames.put ("CORBA/TypeCode", "org/omg/CORBA/TypeCode"); // - overrideNames.put ("org/omg/CORBA/TypeCode", "CORBA/TypeCode"); // - // Allow user to specify types named "TypeCode" - //symbolTable.put ("TypeCode", pEntry); - //overrideNames.put ("TypeCode", "org/omg/CORBA/TypeCode"); - - // CORBA::Principal is deprecated! - // Add PIDL type (primitive) CORBA::Principal to symbol table. - pEntry = factory.primitiveEntry (); - pEntry.name ("Principal"); - pEntry.module ("org/omg/CORBA"); - pEntry.container (corba); - symbolTable.put ("org/omg/CORBA/Principle", pEntry); - symbolTable.put ("CORBA/Principal", pEntry); - overrideNames.put ("CORBA/Principal", "org/omg/CORBA/Principal"); - overrideNames.put ("org/omg/CORBA/Principal", "CORBA/Principal"); - - // Add PIDL type (interface) CORBA::Current to symbol table. - //InterfaceEntry iEntry = factory.interfaceEntry (); - //iEntry.name ("Current"); - //iEntry.module ("org/omg/CORBA"); - //iEntry.container (corba); - //symbolTable.put ("org/omg/CORBA/Current", iEntry); - //symbolTable.put ("CORBA/Current", iEntry); - //overrideNames.put ("CORBA/Current", "org/omg/CORBA/Current"); - //overrideNames.put ("org/omg/CORBA/Current", "CORBA/Current"); - - overrideNames.put ("TRUE", "true"); - overrideNames.put ("FALSE", "false"); - //overrideNames.put ("any", "org/omg/CORBA/Any"); - - // Add CORBA module to symbol table - symbolTable.put ("CORBA", corba); // 55699 - overrideNames.put ("CORBA", "org/omg/CORBA"); // - overrideNames.put ("org/omg/CORBA", "CORBA"); // - } // preParse - - - protected void preEmit (Enumeration emitList) - { - typedefInfo = SymtabEntry.getVariableKey (); - Hashtable tempST = (Hashtable)symbolTable.clone (); - - for (Enumeration e = tempST.elements (); e.hasMoreElements ();) - { - SymtabEntry element = (SymtabEntry)e.nextElement (); - - // Any other symbolTable processing? - preEmitSTElement (element); - } - - // Do this processing AFTER any other processing to get the - // correct names. - Enumeration elements = symbolTable.elements (); - while (elements.hasMoreElements ()) - { - // Find all TypedefEntry's and fill in the SymtabEntry.info - // field with it's real type , including [][]... with const - // exprs. - SymtabEntry element = (SymtabEntry)elements.nextElement (); - if (element instanceof TypedefEntry || element instanceof SequenceEntry) - Util.fillInfo (element); - - // Members of constructed types may now be value boxes, and value - // boxes may contain types that are directly defined rather than typedef-ed - // (e.g., "valuetype vb sequence ;"). If member resolves to a value - // box, then check and fillInfo() for value box and its content type BEFORE - // doing fillInfo() on member; otherwise, could get an exception. There's - // code in fillInfo() that performs this check, so it does not appear here. - - else if (element instanceof StructEntry) - { - Enumeration members = ((StructEntry)element).members ().elements (); - while (members.hasMoreElements ()) - Util.fillInfo ((SymtabEntry)members.nextElement ()); - } - else if (element instanceof InterfaceEntry && ((InterfaceEntry)element).state () != null) - { - Enumeration members = ((InterfaceEntry)element).state ().elements (); - while (members.hasMoreElements ()) - Util.fillInfo (((InterfaceState)members.nextElement ()).entry); - } - else if (element instanceof UnionEntry) - { - Enumeration branches = ((UnionEntry)element).branches ().elements (); - while (branches.hasMoreElements ()) - Util.fillInfo (((UnionBranch)branches.nextElement ()).typedef); - } - - // For each type that is at the top level that is NOT a module - // or IncludeEntry, add it to the imports list. If there are - // types within modules which refer to these, their types must - // be explicitly stated in an import statement. - if (element.module ().equals ("") && !(element instanceof ModuleEntry || element instanceof IncludeEntry || element instanceof PrimitiveEntry)) - importTypes.addElement (element); - } - - while (emitList.hasMoreElements ()) - { - SymtabEntry entry = (SymtabEntry)emitList.nextElement (); - - // Any other emitList processing: - preEmitELElement (entry); - } - } // preEmit - - /** - * This method is called by preEmit once for each symbol table entry. - * It can be called by extenders. - **/ - protected void preEmitSTElement (SymtabEntry entry) - { - // If the -package argument was used, search the packages list - // for the given type name and prepend the package to it. - Hashtable packages = ((Arguments)arguments).packages; - if (packages.size () > 0) - { - String substr = (String)packages.get (entry.fullName ()); - if (substr != null) - { - String pkg = null; - ModuleEntry mod = null; - ModuleEntry prev = null; - while (substr != null) - { - int dot = substr.indexOf ('.'); - if (dot < 0) - { - pkg = substr; - substr = null; - } - else - { - pkg = substr.substring (0, dot); - substr = substr.substring (dot + 1); - } - - String fullName = prev == null ? pkg : prev.fullName () + '/' + pkg; - mod = (ModuleEntry)symbolTable.get (fullName); - if (mod == null) - { - mod = factory.moduleEntry (); - mod.name (pkg); - mod.container (prev); - if (prev != null) mod.module (prev.fullName ()); - symbolTable.put (pkg, mod); - } - prev = mod; - } - entry.module (mod.fullName ()); - entry.container (mod); - } - } - } // preEmitSTElement - - /** - * This method is called by preEmit once for each emitList entry. - * It can be called by extenders. - **/ - protected void preEmitELElement (SymtabEntry entry) - { - } // preEmitELElement - - public Vector importTypes = new Vector (); - public SymtabFactory factory; - public static int typedefInfo; - public Hashtable list = new Hashtable (); - public static Compile compiler = null; // -} // class Compile --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java 2018-01-30 20:25:39.000000000 -0500 +++ /dev/null 2018-01-30 20:25:39.000000000 -0500 @@ -1,197 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: - -import java.io.File; -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.ConstEntry; -import com.sun.tools.corba.se.idl.ModuleEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; - -/** - * - **/ -public class ConstGen implements com.sun.tools.corba.se.idl.ConstGen -{ - /** - * Public zero-argument constructor. - **/ - public ConstGen () - { - } // ctor - - /** - * Generate Java code for an IDL constant. A constant is written to - * a new class only when it is not a member of an interface; otherwise - * it written to the interface class in which it resides. - **/ - public void generate (Hashtable symbolTable, ConstEntry c, PrintWriter s) - { - this.symbolTable = symbolTable; - this.c = c; - this.stream = s; - init (); - - if (c.container () instanceof ModuleEntry) - generateConst (); - else if (stream != null) - writeConstExpr (); - } // generate - - /** - * Initialize members unique to this generator. - **/ - protected void init () - { - } // init - - /** - * Generate the class defining the constant. - **/ - protected void generateConst () - { - openStream (); - if (stream == null) - return; - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generateConst - - /** - * Open a new print stream only if the constant is not a member - * of an interface. - **/ - protected void openStream () - { - stream = Util.stream (c, ".java"); - } // openStream - - /** - * Write the heading for the class defining the constant. - **/ - protected void writeHeading () - { - Util.writePackage (stream, c); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - stream.println ("public interface " + c.name ()); - // should not be done according to the mapping - // + " extends org.omg.CORBA.portable.IDLEntity"); - stream.println ("{"); - } // writeHeading - - /** - * Write the constant expression and any comment, if present. - **/ - protected void writeBody () - { - writeConstExpr (); - } // writeBody - - /** - * Write the entire constant expression and any comment, if present. - **/ - protected void writeConstExpr () - { - if (c.comment () != null) - c.comment ().generate (" ", stream); - if (c.container () instanceof ModuleEntry) { - - stream.print (" public static final " + Util.javaName (c.type ()) + " value = "); - } else { - stream.print (" public static final " + Util.javaName (c.type ()) + ' ' + c.name () + " = "); - } - writeConstValue (c.type ()); - } // writeConstExpr - - /** - * Write the constant's value according to its type. - **/ - private void writeConstValue (SymtabEntry type) - { - if (type instanceof PrimitiveEntry) - stream.println ('(' + Util.javaName (type) + ")(" + Util.parseExpression (c.value ()) + ");"); - else if (type instanceof StringEntry) - stream.println (Util.parseExpression (c.value ()) + ';'); - else if (type instanceof TypedefEntry) - { - while (type instanceof TypedefEntry) - type = type.type (); - writeConstValue (type); - } - else - stream.println (Util.parseExpression (c.value ()) + ';'); - } // writeValue - - /** - * Generate any last words and close the class. - **/ - protected void writeClosing () - { - stream.println ("}"); - } // writeClosing - - /** - * Close the print stream, causing the file to be written. - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - protected java.util.Hashtable symbolTable = null; - protected ConstEntry c = null; - protected PrintWriter stream = null; -} // class ConstGen - - -/*======================================================================================= - DATE-AUTHOR ACTION - --------------------------------------------------------------------------------------- - 11sep1997daz Return when print stream is null and container is NOT a module. Fixes - -keep option, which causes null print stream to be sent to ConstGen. - 31jul1997daz Write source comment immediately preceding constant declaration. - =======================================================================================*/ --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java 2018-01-30 20:25:40.000000000 -0500 +++ /dev/null 2018-01-30 20:25:40.000000000 -0500 @@ -1,200 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D62023 klr new class - -import java.io.PrintWriter; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.ValueEntry; - -/** - * - **/ -public class DefaultFactory implements AuxGen -{ - /** - * Public zero-argument constructor. - **/ - public DefaultFactory () - { - } // ctor - - /** - * Generate the default value factory class. Provides general algorithm for - * auxiliary binding generation: - * 1.) Initialize symbol table and symbol table entry members, - * common to all generators. - * 2.) Initialize members unique to this generator. - * 3.) Open print stream - * 4.) Write class heading (package, prologue, source comment, class - * statement, open curly - * 5.) Write class body (member data and methods) - * 6.) Write class closing (close curly) - * 7.) Close the print stream - **/ - public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry) - { - this.symbolTable = symbolTable; - this.entry = entry; - init (); - openStream (); - if (stream == null) - return; - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generate - - /** - * Initialize variables unique to this generator. - **/ - protected void init () - { - factoryClass = entry.name () + "DefaultFactory"; - factoryInterface = entry.name () + "ValueFactory"; - factoryType = Util.javaName (entry); - implType = entry.name () + "Impl"; // default implementation class - } // init - - /** - * @return true if entry has any factory methods declared - **/ - protected boolean hasFactoryMethods () - { - Vector init = ((ValueEntry)entry).initializers (); - if (init != null && init.size () > 0) - return true; - else - return false; - } // hasFactoryMethods - - /** - * Open the print stream for subsequent output. - **/ - protected void openStream () - { - stream = Util.stream (entry, "DefaultFactory.java"); - } // openStream - - /** - * Generate the heading, including the package, imports, - * source comment, class statement, and left curly. - **/ - protected void writeHeading () - { - Util.writePackage (stream, entry, Util.TypeFile); // REVISIT - same as interface? - Util.writeProlog (stream, stream.name ()); - if (entry.comment () != null) - entry.comment ().generate ("", stream); - stream.print ("public class " + factoryClass + " implements "); - if (hasFactoryMethods ()) - stream.print (factoryInterface); - else - stream.print ("org.omg.CORBA.portable.ValueFactory"); - stream.println (" {"); - } // writeHeading - - /** - * Generate the contents of this class - **/ - protected void writeBody () - { - writeFactoryMethods (); - stream.println (); - writeReadValue (); - } // writeBody - - /** - * Generate members of this class. - **/ - protected void writeFactoryMethods () - { - Vector init = ((ValueEntry)entry).initializers (); - if (init != null) - { - for (int i = 0; i < init.size (); i++) - { - MethodEntry element = (MethodEntry) init.elementAt (i); - element.valueMethod (true); //tag value method if not tagged previously - ((MethodGen24) element.generator ()).defaultFactoryMethod (symbolTable, element, stream); - } - } - } // writeFactoryMethods - - /** - * Generate default read_value - **/ - protected void writeReadValue () - { - stream.println (" public java.io.Serializable read_value (org.omg.CORBA_2_3.portable.InputStream is)"); - stream.println (" {"); - stream.println (" return is.read_value(new " + implType + " ());"); - stream.println (" }"); - } // writeReadValue - - /** - * Generate the closing statements. - **/ - protected void writeClosing () - { - stream.println ('}'); - } // writeClosing - - /** - * Write the stream to file by closing the print stream. - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - protected java.util.Hashtable symbolTable; - protected com.sun.tools.corba.se.idl.SymtabEntry entry; - protected GenFileStream stream; - - // Unique to this generator - protected String factoryClass; - protected String factoryInterface; - protected String factoryType; - protected String implType; -} // class Holder --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java 2018-01-30 20:25:41.000000000 -0500 +++ /dev/null 2018-01-30 20:25:41.000000000 -0500 @@ -1,279 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D61056 Use Util.helperName - -import java.io.File; -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.EnumEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; - -/** - * - **/ -public class EnumGen implements com.sun.tools.corba.se.idl.EnumGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public EnumGen () - { - } // ctor - - /** - * Generate the Java code for an IDL enumeration. - **/ - public void generate (Hashtable symbolTable, EnumEntry e, PrintWriter s) - { - this.symbolTable = symbolTable; - this.e = e; - init (); - - openStream (); - if (stream == null) return; - generateHolder (); - generateHelper (); - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generate - - /** - * Initialize members unique to this generator. - **/ - protected void init () - { - className = e.name (); - fullClassName = Util.javaName (e); - } - - /** - * Open the print stream to which to write the enumeration class. - **/ - protected void openStream () - { - stream = Util.stream (e, ".java"); - } - - /** - * Generate the holder class for this enumeration. - **/ - protected void generateHolder () - { - ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, e); - } - - /** - * Generate the helper class for this enumeration. - **/ - protected void generateHelper () - { - ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, e); - } - - /** - * Write the heading of the enumeration class, including the package, - * imports, class statement, and open curly. - **/ - protected void writeHeading () - { - Util.writePackage (stream, e); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - if (e.comment () != null) - e.comment ().generate ("", stream); - stream.println ("public class " + className + " implements org.omg.CORBA.portable.IDLEntity"); - stream.println ("{"); - } - - /** - * Write the members of enumeration class. - **/ - protected void writeBody () - { - stream.println (" private int __value;"); - stream.println (" private static int __size = " + (e.elements ().size ()) + ';'); - stream.println (" private static " + fullClassName + "[] __array = new " + fullClassName + " [__size];"); - stream.println (); - for (int i = 0; i < e.elements ().size (); ++i) - { - String label = (String)e.elements ().elementAt (i); - stream.println (" public static final int _" + label + " = " + i + ';'); - stream.println (" public static final " + fullClassName + ' ' + label + " = new " + fullClassName + "(_" + label + ");"); - } - stream.println (); - writeValue (); - writeFromInt (); - writeCtors (); - } - - /** - * Write the value method for the enumeration class. - **/ - protected void writeValue () - { - stream.println (" public int value ()"); - stream.println (" {"); - stream.println (" return __value;"); - stream.println (" }"); - stream.println (); - } // writeValue - - /** - * Write the from_int method for the enumeration class. - **/ - protected void writeFromInt () - { - stream.println (" public static " + fullClassName + " from_int (int value)"); - stream.println (" {"); - stream.println (" if (value >= 0 && value < __size)"); - stream.println (" return __array[value];"); - stream.println (" else"); - stream.println (" throw new org.omg.CORBA.BAD_PARAM ();"); - stream.println (" }"); - stream.println (); - } - - /** - * Write the protected constructor for the enumeration class. - **/ - protected void writeCtors () - { - stream.println (" protected " + className + " (int value)"); - stream.println (" {"); - stream.println (" __value = value;"); - stream.println (" __array[__value] = this;"); - stream.println (" }"); - } - - /** - * Close the enumeration class. - **/ - protected void writeClosing () - { - stream.println ("} // class " + className); - } - - /** - * Close the print stream, which writes the stream to file. - **/ - protected void closeStream () - { - stream.close (); - } - - /////////////// - // From JavaGenerator - - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - tcoffsets.set (entry); - EnumEntry enumEntry = (EnumEntry)entry; - StringBuffer emit = new StringBuffer ("new String[] { "); - Enumeration e = enumEntry.elements ().elements (); - boolean firstTime = true; - while (e.hasMoreElements ()) - { - if (firstTime) - firstTime = false; - else - emit.append (", "); - emit.append ('"' + Util.stripLeadingUnderscores ((String)e.nextElement ()) + '"'); - } - emit.append ("} "); - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_enum_tc (" - + Util.helperName (enumEntry, true) + ".id (), \"" // <54697> // -// + "_id, \"" <54697> - + Util.stripLeadingUnderscores (entry.name ()) + "\", " - + new String (emit) + ");"); - return index + 1; - - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) { - stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // - return index; - } // type - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - stream.println (" return " + Util.javaQualifiedName (entry) + ".from_int (istream.read_long ());"); - } // helperRead - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - stream.println (" ostream.write_long (value.value ());"); - } // helperWrite - - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - stream.println (indent + name + " = " + Util.javaQualifiedName (entry) + ".from_int (istream.read_long ());"); - return index; - } // read - - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - stream.println (indent + "ostream.write_long (" + name + ".value ());"); - return index; - } // write - - // From JavaGenerator - /////////////// - - protected Hashtable symbolTable = null; - protected EnumEntry e = null; - protected PrintWriter stream = null; - - // Member data unique to this generator - String className = null; - String fullClassName = null; -} // class EnumGen - - -/*============================================================================ - DATE ACTION - ---------------------------------------------------------------------------- - 31jul1997 Modified to write comment immediately preceding class defining - enumeration declaration. - 12dec1998 D55971 - omg 98-11-03 Java 2.4 RTF - make subclassable - ===========================================================================*/ --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java 2018-01-30 20:25:42.000000000 -0500 +++ /dev/null 2018-01-30 20:25:42.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.ExceptionEntry; - -/** - * - **/ -public class ExceptionGen extends StructGen implements com.sun.tools.corba.se.idl.ExceptionGen -{ - /** - * Public zero-argument constructor. - **/ - public ExceptionGen () - { - super (true); - } // ctor - - /** - * - **/ - public void generate (Hashtable symbolTable, ExceptionEntry entry, PrintWriter stream) - { - super.generate (symbolTable, entry, stream); - } // generate -} // class ExceptionGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Factories.java 2018-01-30 20:25:43.000000000 -0500 +++ /dev/null 2018-01-30 20:25:43.000000000 -0500 @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D62023 Add corbaLevel=2.4 - -/** - * - **/ -public class Factories extends com.sun.tools.corba.se.idl.Factories -{ - public com.sun.tools.corba.se.idl.GenFactory genFactory () - { - return new GenFactory (); - } // genFactory - - public com.sun.tools.corba.se.idl.Arguments arguments () - { - return new Arguments (); - } // arguments - - public String[] languageKeywords () - { - // These are Java keywords that are not also IDL keywords. - return keywords; - } // languageKeywords - - static String[] keywords = - {"abstract", "break", "byte", - "catch", "class", "continue", - "do", "else", "extends", - "false", "final", "finally", - "for", "goto", "if", - "implements", "import", "instanceof", - "int", "interface", "native", - "new", "null", "operator", - "outer", "package", "private", - "protected", "public", "return", - "static", "super", "synchronized", - "this", "throw", "throws", - "transient", "true", "try", - "volatile", "while", -// Special reserved suffixes: - "+Helper", "+Holder", "+Package", -// These following are not strictly keywords. They -// are methods on java.lang.Object and, as such, must -// not have conflicts with methods defined on IDL -// interfaces. Treat them the same as keywords. - "clone", "equals", "finalize", - "getClass", "hashCode", "notify", - "notifyAll", "toString", "wait"}; - - /////////////// - // toJava-specific factory methods - - private Helper _helper = null; // <62023> - public Helper helper () - { - if (_helper == null) - if (Util.corbaLevel (2.4f, 99.0f)) // - _helper = new Helper24 (); // - else - _helper = new Helper (); - return _helper; - } // helper - - private ValueFactory _valueFactory = null; // <62023> - public ValueFactory valueFactory () - { - if (_valueFactory == null) - if (Util.corbaLevel (2.4f, 99.0f)) // - _valueFactory = new ValueFactory (); // - // else return null since shouldn't be used - return _valueFactory; - } // valueFactory - - private DefaultFactory _defaultFactory = null; // <62023> - public DefaultFactory defaultFactory () - { - if (_defaultFactory == null) - if (Util.corbaLevel (2.4f, 99.0f)) // - _defaultFactory = new DefaultFactory (); // - // else return null since shouldn't be used - return _defaultFactory; - } // defaultFactory - - private Holder _holder = new Holder (); - public Holder holder () - { - return _holder; - } // holder - - private Skeleton _skeleton = new Skeleton (); - public Skeleton skeleton () - { - return _skeleton; - } // skeleton - - private Stub _stub = new Stub (); - public Stub stub () - { - return _stub; - } // stub - - // toJava-specific factory methods - /////////////// -} // class Factories --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java 2018-01-30 20:25:44.000000000 -0500 +++ /dev/null 2018-01-30 20:25:44.000000000 -0500 @@ -1,206 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D61056 Use Util.helperName - -import java.io.File; -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.ForwardValueEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.MethodEntry; - -/** - * - **/ -public class ForwardValueGen implements com.sun.tools.corba.se.idl.ForwardValueGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public ForwardValueGen () - { - } // ctor - - /** - * - **/ - public void generate (Hashtable symbolTable, ForwardValueEntry v, PrintWriter str) - { - this.symbolTable = symbolTable; - this.v = v; - - openStream (); - if (stream == null) - return; - generateHelper (); - generateHolder (); - generateStub (); - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generate - - /** - * - **/ - protected void openStream () - { - stream = Util.stream (v, ".java"); - } // openStream - - /** - * - **/ - protected void generateHelper () - { - ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, v); - } // generateHelper - - /** - * - **/ - protected void generateHolder () - { - ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, v); - } // generateHolder - - /** - * - **/ - protected void generateStub () - { - } // generateStub - - /** - * - **/ - protected void writeHeading () - { - Util.writePackage (stream, v); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - - if (v.comment () != null) - v.comment ().generate ("", stream); - - stream.print ("public class " + v.name () + " implements org.omg.CORBA.portable.IDLEntity"); - // There should ALWAYS be at least one: ValueBase - - stream.println ("{"); - } // writeHeading - - /** - * - **/ - protected void writeBody () - { - } // writeBody - - /** - * - **/ - protected void writeClosing () - { - stream.println ("} // class " + v.name ()); - } // writeClosing - - /** - * - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - /////////////// - // From JavaGenerator - - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - return index; - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) { - stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // - return index; - } // type - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - stream.println (" " + entryName + " value = new " + entryName + " ();"); - read (0, " ", "value", entry, stream); - stream.println (" return value;"); - } // helperRead - - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - return index; - } // read - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - write (0, " ", "value", entry, stream); - } // helperWrite - - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - return index; - } // write - - // From JavaGenerator - /////////////// - - /** - * - **/ - protected void writeAbstract () - { - } // writeAbstract - - protected Hashtable symbolTable = null; - protected ForwardValueEntry v = null; - protected PrintWriter stream = null; -} // class ForwardValueGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java 2018-01-30 20:25:44.000000000 -0500 +++ /dev/null 2018-01-30 20:25:44.000000000 -0500 @@ -1,162 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: - -/** - * - **/ -public class GenFactory implements com.sun.tools.corba.se.idl.GenFactory -{ - - public com.sun.tools.corba.se.idl.AttributeGen createAttributeGen () - { - if (Util.corbaLevel (2.4f, 99.0f)) // - return new AttributeGen24 (); - else - return new AttributeGen (); - } // createAttributeGen - - public com.sun.tools.corba.se.idl.ConstGen createConstGen () - { - return new ConstGen (); - } // createConstGen - - public com.sun.tools.corba.se.idl.NativeGen createNativeGen () - { - return new NativeGen (); - } // createNativeGen - - public com.sun.tools.corba.se.idl.EnumGen createEnumGen () - { - return new EnumGen (); - } // createEnumGen - - public com.sun.tools.corba.se.idl.ExceptionGen createExceptionGen () - { - return new ExceptionGen (); - } // createExceptionGen - - public com.sun.tools.corba.se.idl.ForwardGen createForwardGen () - { - return null; - } // createForwardGen - - public com.sun.tools.corba.se.idl.ForwardValueGen createForwardValueGen () - { - return null; - } // createForwardValueGen - - public com.sun.tools.corba.se.idl.IncludeGen createIncludeGen () - { - return null; - } // createIncludeGen - - public com.sun.tools.corba.se.idl.InterfaceGen createInterfaceGen () - { - return new InterfaceGen (); - } // createInterfaceGen - - public com.sun.tools.corba.se.idl.ValueGen createValueGen () - { - if (Util.corbaLevel (2.4f, 99.0f)) // - return new ValueGen24 (); - else - return new ValueGen (); - } // createValueGen - - public com.sun.tools.corba.se.idl.ValueBoxGen createValueBoxGen () - { - if (Util.corbaLevel (2.4f, 99.0f)) // - return new ValueBoxGen24 (); - else - return new ValueBoxGen (); - } // createValueBoxGen - - public com.sun.tools.corba.se.idl.MethodGen createMethodGen () - { - if (Util.corbaLevel (2.4f, 99.0f)) // - return new MethodGen24 (); - else - return new MethodGen (); - } // createMethodGen - - public com.sun.tools.corba.se.idl.ModuleGen createModuleGen () - { - return new ModuleGen (); - } // createModuleGen - - public com.sun.tools.corba.se.idl.ParameterGen createParameterGen () - { - return null; - } // createParameterGen - - public com.sun.tools.corba.se.idl.PragmaGen createPragmaGen () - { - return null; - } // createPragmaGen - - public com.sun.tools.corba.se.idl.PrimitiveGen createPrimitiveGen () - { - return new PrimitiveGen (); - } // createPrimitiveGen - - public com.sun.tools.corba.se.idl.SequenceGen createSequenceGen () - { - return new SequenceGen (); - } // createSequenceGen - - public com.sun.tools.corba.se.idl.StringGen createStringGen () - { - return new StringGen (); - } // createSequenceGen - - public com.sun.tools.corba.se.idl.StructGen createStructGen () - { - return new StructGen (); - } // createStructGen - - public com.sun.tools.corba.se.idl.TypedefGen createTypedefGen () - { - return new TypedefGen (); - } // createTypedefGen - - public com.sun.tools.corba.se.idl.UnionGen createUnionGen () - { - return new UnionGen (); - } // createUnionGen -} // class GenFactory --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java 2018-01-30 20:25:45.000000000 -0500 +++ /dev/null 2018-01-30 20:25:45.000000000 -0500 @@ -1,699 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -F46082.51 Remove -stateful feature. -// -D57118 Fix "narrow" in helper for abstract interface -// -D58889 re-Fix "narrow" in helper for abstract interface -// -D59383 'get_class' in value helper returns value class, not helper. -// -D59413 Remove Helper interface references for non-value types. -// -D59435 Remove read_Object, write_Object completely. -// -D59418 Move read_Value, write_Value to generator's helperRead. - -import java.io.PrintWriter; - -import java.util.Enumeration; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.ParameterEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.StructEntry; - -/** - * - **/ -public class Helper implements AuxGen -{ - /** - * Public zero-argument constructor. - **/ - public Helper () - { - } // ctor - - /** - * Generate the helper class. Provides general algorithm - * for auxiliary binding generation: - * - * 1.) Initialize symbol table and symbol table entry members, - * common to all generators. - * 2.) Initialize members unique to this generator. - * 3.) Open print stream - * 4.) Write class heading: package, prologue, class statement, open curly - * 5.) Write class body: member data and methods - * 6.) Write class closing: close curly - * 7.) Close the print stream - **/ - public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry) - { - this.symbolTable = symbolTable; - this.entry = entry; - init (); - - openStream (); - if (stream == null) - return; - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generate - - /** - * Initialize variables unique to this generator. - **/ - protected void init () - { - helperClass = entry.name () + "Helper"; - if (entry instanceof ValueBoxEntry) - { - ValueBoxEntry v = (ValueBoxEntry) entry; - TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry; - SymtabEntry mType = member.type (); - - if (mType instanceof PrimitiveEntry) - helperType = Util.javaName (entry); - else - helperType = Util.javaName (mType); - } - else - helperType = Util.javaName (entry); - } // init - - /** - * Open the print stream for subsequent output. - **/ - protected void openStream () - { - stream = Util.stream (entry, "Helper.java"); - } // openStream - - /** - * Generate the heading, including package, imports, class statements, - * and open curly. - **/ - protected void writeHeading () - { - Util.writePackage (stream, entry, Util.HelperFile); - Util.writeProlog (stream, stream.name ()); - - // Transfer comment to target <30jul1997daz>. - if (entry.comment () != null) - entry.comment ().generate ("", stream); - - stream.print ("public final class " + helperClass); - if (entry instanceof ValueEntry) - stream.println (" implements org.omg.CORBA.portable.ValueHelper"); - else - stream.println (); - stream.println ('{'); - } - - /** - * Generate members of this class. - **/ - protected void writeBody () - { - writeInstVars (); - writeCtors (); - writeInsert (); - writeExtract (); - writeType (); - writeID (); - writeRead (); - writeWrite (); - if (entry instanceof InterfaceEntry && !(entry instanceof ValueEntry)) { - writeNarrow (); - writeUncheckedNarrow (); - } - writeHelperInterface (); - if (entry instanceof ValueEntry) - writeValueHelperInterface (); - } // writeBody - - /** - * Generate members of the Helper interface. - **/ - protected void writeHelperInterface () - { - } // writeHelperInterface - - /** - * Generate members of the ValueHelper interface. - **/ - protected void writeValueHelperInterface () - { - writeGetID (); // moved for - writeGetType (); // moved for - writeGetInstance (); // not in ValueHelper interface - writeGetClass (); - writeGetSafeBaseIds (); - } // writeHelperInterface - - /** - * Generate the closing statements. - **/ - protected void writeClosing () - { - stream.println ('}'); - } - - /** - * Write the stream to file by closing the print stream. - **/ - protected void closeStream () - { - stream.close (); - } - - /** - * Generate the instance variables. - **/ - protected void writeInstVars () - { - stream.println (" private static String _id = \"" + Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()) + "\";"); - if (entry instanceof ValueEntry) - { - stream.println (); - stream.println (" private static " + helperClass + " helper = new " + helperClass + " ();"); - stream.println (); - stream.println (" private static String[] _truncatable_ids = {"); - stream.print (" _id"); - - // Any safe ValueEntry must have a concete value parent. - // The topmost parent cannot be safe since it doesn't have - // a concrete parent. - ValueEntry child = (ValueEntry) entry; - while (child.isSafe ()) - { - stream.println(","); - ValueEntry parent = (ValueEntry)child.derivedFrom ().elementAt (0); - stream.print(" \"" + Util.stripLeadingUnderscoresFromID (parent.repositoryID ().ID ()) + "\""); - child = parent; - } - stream.println(" };"); - } - stream.println (); - } // writeInstVars - - /** - * Generate the constructors. - **/ - protected void writeCtors () - { - stream.println (" public " + helperClass + "()"); - stream.println (" {"); - stream.println (" }"); - stream.println (); - } // writeCtors - - /** - * Generate the insert method. - **/ - protected void writeInsert () - { - stream.println (" public static void insert (org.omg.CORBA.Any a, " + helperType + " that)"); - stream.println (" {"); - stream.println (" org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();"); - stream.println (" a.type (type ());"); - stream.println (" write (out, that);"); - stream.println (" a.read_value (out.create_input_stream (), type ());"); - stream.println (" }"); - stream.println (); - } // writeInsert - - /** - * Generate the extract method. - **/ - protected void writeExtract () - { - stream.println (" public static " + helperType + " extract (org.omg.CORBA.Any a)"); - stream.println (" {"); - stream.println (" return read (a.create_input_stream ());"); - stream.println (" }"); - stream.println (); - } // writeExtract - - /** - * Generate the typecode variable and type method. - **/ - protected void writeType () - { - boolean canRecurse = entry instanceof ValueEntry - || entry instanceof ValueBoxEntry - || entry instanceof StructEntry; - stream.println (" private static org.omg.CORBA.TypeCode __typeCode = null;"); - if (canRecurse) - stream.println (" private static boolean __active = false;"); - stream.println (" synchronized public static org.omg.CORBA.TypeCode type ()"); - stream.println (" {"); - stream.println (" if (__typeCode == null)"); - stream.println (" {"); - if (canRecurse) { - stream.println (" synchronized (org.omg.CORBA.TypeCode.class)"); - stream.println (" {"); - stream.println (" if (__typeCode == null)"); - stream.println (" {"); - stream.println (" if (__active)"); - stream.println (" {"); - stream.println (" return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );"); - stream.println (" }"); - stream.println (" __active = true;"); - ((JavaGenerator)entry.generator ()).helperType (0, " ", new TCOffsets (), "__typeCode", entry, stream); - } - else - ((JavaGenerator)entry.generator ()).helperType (0, " ", new TCOffsets (), "__typeCode", entry, stream); - - // Generate body of type() method - - if (canRecurse) { - stream.println (" __active = false;"); - stream.println (" }"); - stream.println (" }"); - } - stream.println (" }"); - stream.println (" return __typeCode;"); - stream.println (" }"); - stream.println (); - } // writeType - - /** - * Generate the ID method. - **/ - protected void writeID () - { - stream.println (" public static String id ()"); - stream.println (" {"); - stream.println (" return _id;"); - stream.println (" }"); - stream.println (); - } // writeID - - /** - * Generate the read method. - **/ - protected void writeRead () - { - - boolean isLocalInterface = false; - - if (entry instanceof InterfaceEntry) { - InterfaceEntry ie = (InterfaceEntry) entry; - - // for #pragma sun_local or sun_localservant, or actual local - // local interface, set the flag by checking on both - isLocalInterface = ie.isLocal() | ie.isLocalServant(); - } - - stream.println (" public static " + helperType + " read (org.omg.CORBA.portable.InputStream istream)"); - stream.println (" {"); - if ( !isLocalInterface ) { // nonLocal Interface and other types - ((JavaGenerator)entry.generator ()).helperRead (helperType, entry, stream); - } else { //Local interface should throw exception - stream.println (" throw new org.omg.CORBA.MARSHAL ();"); - } - stream.println (" }"); - stream.println (); - } // writeRead - - /** - * Generate the write method. - **/ - protected void writeWrite () - { - - boolean isLocalInterface = false; - - if (entry instanceof InterfaceEntry) { - InterfaceEntry ie = (InterfaceEntry) entry; - - // for #pragma sun_local or sun_localservant, or actual local - // local interface, set the flag by checking on both - isLocalInterface = ie.isLocal() | ie.isLocalServant(); - } - - stream.println (" public static void write (org.omg.CORBA.portable.OutputStream ostream, " + helperType + " value)"); - stream.println (" {"); - if ( !isLocalInterface ) { // nonLocal Interface and other types - ((JavaGenerator)entry.generator ()).helperWrite (entry, stream); - } else { //Local interface should throw exception - stream.println (" throw new org.omg.CORBA.MARSHAL ();"); - } - stream.println (" }"); - stream.println (); - } // writeWrite - - - /** - * Generate the narrow method. - **/ - protected void writeNarrow () - { - writeRemoteNarrow (); - stream.println (); - } - - /** - * Write the narrow() method for a remotable object. - **/ - protected void writeRemoteNarrow () - { - InterfaceEntry ie = (InterfaceEntry) entry; - - // narrow for LocalObject interface - if (ie.isLocal ()) { - writeRemoteNarrowForLocal (false); - return; - } - - // narrow for Abstract interface - if (ie.isAbstract ()) { - writeRemoteNarrowForAbstract (false); - return; - } else { - // Determine if the non-abstract interface has any abstract parents - for (int i = 0; i < ie.derivedFrom ().size (); i++) { - SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i); - if (((InterfaceEntry) parent).isAbstract ()) { - writeRemoteNarrowForAbstract (true); - break; - } - } - } - - stream.println (" public static " + helperType + " narrow (org.omg.CORBA.Object obj)"); - stream.println (" {"); - stream.println (" if (obj == null)"); - stream.println (" return null;"); - stream.println (" else if (obj instanceof " + helperType + ')'); - stream.println (" return (" + helperType + ")obj;"); - stream.println (" else if (!obj._is_a (id ()))"); - stream.println (" throw new org.omg.CORBA.BAD_PARAM ();"); - stream.println (" else"); - stream.println (" {"); - stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();"); - String stubNameofEntry = stubName ((InterfaceEntry)entry); - stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();"); - stream.println (" stub._set_delegate(delegate);"); - stream.println (" return stub;"); - stream.println (" }"); - stream.println (" }"); - } // writeRemoteNarrow - - /** - * Write the narrow() method for local interface. - **/ - private void writeRemoteNarrowForLocal (boolean hasAbstractParent) - { - stream.println (" public static " + helperType + " narrow (org.omg.CORBA.Object obj)"); - stream.println (" {"); - stream.println (" if (obj == null)"); - stream.println (" return null;"); - stream.println (" else if (obj instanceof " + helperType + ')'); - stream.println (" return (" + helperType + ")obj;"); - stream.println (" else"); - stream.println (" throw new org.omg.CORBA.BAD_PARAM ();"); - stream.println (" }"); - } // writeRemoteNarrowForLocal - - /** - * Write the narrow() method for abstract interface. - **/ - private void writeRemoteNarrowForAbstract (boolean hasAbstractParent) - { - stream.print (" public static " + helperType + " narrow (java.lang.Object obj)"); - stream.println (" {"); - stream.println (" if (obj == null)"); - stream.println (" return null;"); - if (hasAbstractParent) - { - stream.println (" else if (obj instanceof org.omg.CORBA.Object)"); - stream.println (" return narrow ((org.omg.CORBA.Object) obj);"); - } - else - { - stream.println (" else if (obj instanceof " + helperType + ')'); - stream.println (" return (" + helperType + ")obj;"); - } - - // If hasAbstractParent is false, then THIS entry must be abstract. - // This method is also called in case THIS entry is not abstract, but - // there is an abstract parent. If this entry is not abstract, - // it can never narrow to a CORBA object reference. - if (!hasAbstractParent) { // - String stubNameofEntry = stubName ((InterfaceEntry)entry); - - stream.println (" else if ((obj instanceof org.omg.CORBA.portable.ObjectImpl) &&"); - stream.println (" (((org.omg.CORBA.Object)obj)._is_a (id ()))) {"); - stream.println (" org.omg.CORBA.portable.ObjectImpl impl = (org.omg.CORBA.portable.ObjectImpl)obj ;" ) ; - stream.println (" org.omg.CORBA.portable.Delegate delegate = impl._get_delegate() ;" ) ; - stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();"); - stream.println (" stub._set_delegate(delegate);"); - stream.println (" return stub;" ) ; - stream.println (" }" ) ; - }; - // end - - stream.println (" throw new org.omg.CORBA.BAD_PARAM ();"); - stream.println (" }"); - stream.println (); - } // writeRemoteNarrowForAbstract - - - /** - * Generate the unchecked narrow method. - **/ - protected void writeUncheckedNarrow () - { - writeUncheckedRemoteNarrow (); - stream.println (); - } - - /** - * Write the unchecked narrow() method for a remotable object. - **/ - protected void writeUncheckedRemoteNarrow () - { - InterfaceEntry ie = (InterfaceEntry) entry; - - // unchecked narrow for LocalObject interface - if (ie.isLocal ()) { - writeRemoteUncheckedNarrowForLocal (false); - return; - } - - // unchecked narrow for Abstract interface - if (ie.isAbstract ()) { - writeRemoteUncheckedNarrowForAbstract (false); - return; - } else { - // Determine if the non-abstract interface has any abstract parents - for (int i = 0; i < ie.derivedFrom ().size (); i++) { - SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i); - if (((InterfaceEntry) parent).isAbstract ()) { - writeRemoteUncheckedNarrowForAbstract (true); - break; - } - } - } - - stream.println (" public static " + helperType + " unchecked_narrow (org.omg.CORBA.Object obj)"); - stream.println (" {"); - stream.println (" if (obj == null)"); - stream.println (" return null;"); - stream.println (" else if (obj instanceof " + helperType + ')'); - stream.println (" return (" + helperType + ")obj;"); - stream.println (" else"); - stream.println (" {"); - stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();"); - String stubNameofEntry = stubName ((InterfaceEntry)entry); - stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();"); - stream.println (" stub._set_delegate(delegate);"); - stream.println (" return stub;"); - stream.println (" }"); - stream.println (" }"); - } // writeUncheckedRemoteNarrow - - /** - * Write the unchecked narrow() method for local interface. - **/ - private void writeRemoteUncheckedNarrowForLocal (boolean hasAbstractParent) - { - stream.println (" public static " + helperType + " unchecked_narrow (org.omg.CORBA.Object obj)"); - stream.println (" {"); - stream.println (" if (obj == null)"); - stream.println (" return null;"); - stream.println (" else if (obj instanceof " + helperType + ')'); - stream.println (" return (" + helperType + ")obj;"); - stream.println (" else"); - stream.println (" throw new org.omg.CORBA.BAD_PARAM ();"); - stream.println (" }"); - } // writeRemoteUncheckedNarrowForLocal - - /** - * Write the unchecked narrow() method for abstract interface. - **/ - private void writeRemoteUncheckedNarrowForAbstract (boolean hasAbstractParent) - { - stream.print (" public static " + helperType + " unchecked_narrow (java.lang.Object obj)"); - stream.println (" {"); - stream.println (" if (obj == null)"); - stream.println (" return null;"); - if (hasAbstractParent) - { - stream.println (" else if (obj instanceof org.omg.CORBA.Object)"); - stream.println (" return unchecked_narrow ((org.omg.CORBA.Object) obj);"); - } - else - { - stream.println (" else if (obj instanceof " + helperType + ')'); - stream.println (" return (" + helperType + ")obj;"); - } - - if (!hasAbstractParent) { - String stubNameofEntry = stubName ((InterfaceEntry)entry); - - stream.println (" else if (obj instanceof org.omg.CORBA.portable.ObjectImpl) {"); - stream.println (" org.omg.CORBA.portable.ObjectImpl impl = (org.omg.CORBA.portable.ObjectImpl)obj ;" ) ; - stream.println (" org.omg.CORBA.portable.Delegate delegate = impl._get_delegate() ;" ) ; - stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();"); - stream.println (" stub._set_delegate(delegate);"); - stream.println (" return stub;" ) ; - stream.println (" }" ) ; - }; - - stream.println (" throw new org.omg.CORBA.BAD_PARAM ();"); - stream.println (" }"); - stream.println (); - } // writeRemoteUncheckedNarrowForAbstract - - - /** - * Generate the GetID method. - **/ - protected void writeGetID () - { - if ( !Util.IDLEntity (entry)) - return; - stream.println (" public String get_id ()"); - stream.println (" {"); - stream.println (" return _id;"); - stream.println (" }"); - stream.println (); - } // writeGetID - - /** - * Generate the GetType method. - **/ - protected void writeGetType () - { - if ( !Util.IDLEntity (entry)) - return; - stream.println (" public org.omg.CORBA.TypeCode get_type ()"); - stream.println (" {"); - stream.println (" return type ();"); - stream.println (" }"); - stream.println (); - } // writeGetID - - /** - * Generate the get_class method. - **/ - protected void writeGetClass () - { - stream.println (" public Class get_class ()"); - stream.println (" {"); - stream.println (" return " + helperType + ".class;"); // - stream.println (" }"); - stream.println (); - } // writeGetClass - - /** - * Generate the get_instance method. - **/ - protected void writeGetInstance () - { - stream.println (" public static org.omg.CORBA.portable.ValueHelper get_instance ()"); - stream.println (" {"); - stream.println (" return helper;"); - stream.println (" }"); - stream.println (); - } // writeGetInstance - - /** - * Generate the GetSafeBaseIds method. - **/ - protected void writeGetSafeBaseIds () - { - stream.println (" public String[] get_truncatable_base_ids ()"); - stream.println (" {"); - stream.println (" return _truncatable_ids;"); - stream.println (" }"); - stream.println (); - } // writeGetSafeBaseIds - - /** - * Return the stub name for the interface entry. - **/ - protected String stubName (InterfaceEntry entry) - { - String name; - if (entry.container ().name ().equals ("")) - name = '_' + entry.name () + "Stub"; - else - { - name = Util.containerFullName (entry.container ()) + "._" + entry.name () + "Stub"; - } - return name.replace ('/', '.'); - } // stubName - - protected java.util.Hashtable symbolTable; - protected com.sun.tools.corba.se.idl.SymtabEntry entry; - protected GenFileStream stream; - - // Unique to this generator - protected String helperClass; - protected String helperType; -} // class Helper --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java 2018-01-30 20:25:46.000000000 -0500 +++ /dev/null 2018-01-30 20:25:46.000000000 -0500 @@ -1,160 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D62023 New file to implement CORBA 2.4 RTF - -import java.io.PrintWriter; - -import java.util.Enumeration; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.ParameterEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.StructEntry; - -/** - * - **/ -public class Helper24 extends Helper -{ - /** - * Public zero-argument constructor. - **/ - public Helper24 () - { - } // ctor - - /** - * Generate the heading, including package, imports, class statements, - * and open curly. - * d62023 - don't implement ValueHelper, make non-boxed helpers abstract - **/ - protected void writeHeading () - { - Util.writePackage (stream, entry, Util.HelperFile); - Util.writeProlog (stream, stream.name ()); - - // Transfer comment to target <30jul1997daz>. - if (entry.comment () != null) - entry.comment ().generate ("", stream); - - if (entry instanceof ValueBoxEntry) { - stream.print ("public final class " + helperClass); - stream.println (" implements org.omg.CORBA.portable.BoxedValueHelper"); - } - else - stream.println ("abstract public class " + helperClass); - stream.println ('{'); - } - - /** - * Generate the instance variables. - *
-   * d62023 - no helper instance except for boxed valuetypes;
-   *        - move truncatable_ids to mapped class.
-   * 
- **/ - protected void writeInstVars () - { - stream.println (" private static String _id = \"" + Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()) + "\";"); - if (entry instanceof ValueEntry) - { - stream.println (); - if (entry instanceof ValueBoxEntry) { - stream.println (" private static " + helperClass + " _instance = new " + helperClass + " ();"); - stream.println (); - } - } - stream.println (); - } // writeInstVars - - /** - * d62023 - generate members of BoxedValueHelper interface if boxed - * - * d62023 - hook in here to write factory methods for non-boxed ValueTypes - * into Helper. - **/ - protected void writeValueHelperInterface () - { - if (entry instanceof ValueBoxEntry) { - writeGetID (); - } else if (entry instanceof ValueEntry) { - writeHelperFactories (); - } - } // writeValueHelperInterface - - /** - * - **/ - protected void writeHelperFactories () - { - Vector init = ((ValueEntry)entry).initializers (); - if (init != null) - { - stream.println (); - for (int i = 0; i < init.size (); i++) - { - MethodEntry element = (MethodEntry) init.elementAt (i); - element.valueMethod (true); //tag value method if not tagged previously - ((MethodGen24) element.generator ()). helperFactoryMethod (symbolTable, element, entry, stream); - } - } - } // writeHelperFactories - - /** - * d62023 - generate constructors only for boxed valuetype helpers. - * All other helpers are abstract. - **/ - protected void writeCtors () - { - if (entry instanceof ValueBoxEntry) { - stream.println (" public " + helperClass + "()"); - stream.println (" {"); - stream.println (" }"); - stream.println (); - } - } // writeCtors -} --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java 2018-01-30 20:25:47.000000000 -0500 +++ /dev/null 2018-01-30 20:25:47.000000000 -0500 @@ -1,255 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D61056 Use Util.helperName - -import java.io.PrintWriter; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; - -/** - * - **/ -public class Holder implements AuxGen -{ - /** - * Public zero-argument constructor. - **/ - public Holder () - { - } // ctor - - /** - * Generate the holder class. Provides general algorithm for - * auxiliary binding generation: - * 1.) Initialize symbol table and symbol table entry members, - * common to all generators. - * 2.) Initialize members unique to this generator. - * 3.) Open print stream - * 4.) Write class heading (package, prologue, source comment, class - * statement, open curly - * 5.) Write class body (member data and methods) - * 6.) Write class closing (close curly) - * 7.) Close the print stream - **/ - public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry) - { - this.symbolTable = symbolTable; - this.entry = entry; - init (); - - openStream (); - if (stream == null) - return; - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generate - - /** - * Initialize variables unique to this generator. - **/ - protected void init () - { - holderClass = entry.name () + "Holder"; - helperClass = Util.helperName (entry, true); // - if (entry instanceof ValueBoxEntry) - { - ValueBoxEntry v = (ValueBoxEntry) entry; - TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry; - SymtabEntry mType = member.type (); - holderType = Util.javaName (mType); - } - else - holderType = Util.javaName (entry); - } // init - - /** - * Open the print stream for subsequent output. - **/ - protected void openStream () - { - stream = Util.stream (entry, "Holder.java"); - } // openStream - - /** - * Generate the heading, including the package, imports, - * source comment, class statement, and left curly. - **/ - protected void writeHeading () - { - Util.writePackage (stream, entry, Util.HolderFile); - Util.writeProlog (stream, stream.name ()); - if (entry.comment () != null) - entry.comment ().generate ("", stream); - stream.println ("public final class " + holderClass + " implements org.omg.CORBA.portable.Streamable"); - stream.println ('{'); - } // writeHeading - - /** - * Generate members of this class. - **/ - protected void writeBody () - { - if (entry instanceof ValueBoxEntry) - stream.println (" public " + holderType + " value;"); - else - Util.writeInitializer (" public ", "value", "", entry, stream); - stream.println (); - writeCtors (); - writeRead (); - writeWrite (); - writeType (); - } // writeBody - - /** - * Generate the closing statements. - **/ - protected void writeClosing () - { - stream.println ('}'); - } // writeClosing - - /** - * Write the stream to file by closing the print stream. - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - /** - * Generate the constructors. - **/ - protected void writeCtors () - { - stream.println (" public " + holderClass + " ()"); - stream.println (" {"); - stream.println (" }"); - stream.println (); - stream.println (" public " + holderClass + " (" + holderType + " initialValue)"); - stream.println (" {"); - stream.println (" value = initialValue;"); - stream.println (" }"); - stream.println (); - } // writeCtors - - /** - * Generate the _read method. - **/ - protected void writeRead () - { - stream.println (" public void _read (org.omg.CORBA.portable.InputStream i)"); - stream.println (" {"); - if (entry instanceof ValueBoxEntry) - { - TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry; - SymtabEntry mType = member.type (); - if (mType instanceof StringEntry) - stream.println (" value = i.read_string ();"); - - else if (mType instanceof PrimitiveEntry) - stream.println (" value = " + helperClass + ".read (i).value;"); - - else - stream.println (" value = " + helperClass + ".read (i);"); - } - else - stream.println (" value = " + helperClass + ".read (i);"); - stream.println (" }"); - stream.println (); - } // writeRead - - /** - * Generate the _write method. - **/ - protected void writeWrite () - { - stream.println (" public void _write (org.omg.CORBA.portable.OutputStream o)"); - stream.println (" {"); - if (entry instanceof ValueBoxEntry) - { - TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry; - SymtabEntry mType = member.type (); - if (mType instanceof StringEntry) - stream.println (" o.write_string (value);"); - - else if (mType instanceof PrimitiveEntry) - { - String name = entry.name (); - stream.println (" " + name + " vb = new " + name + " (value);"); - stream.println (" " + helperClass + ".write (o, vb);"); - } - - else - stream.println (" " + helperClass + ".write (o, value);"); - } - else - stream.println (" " + helperClass + ".write (o, value);"); - stream.println (" }"); - stream.println (); - } // writeWrite - - /** - * Generate the _type method. - **/ - protected void writeType () - { - stream.println (" public org.omg.CORBA.TypeCode _type ()"); - stream.println (" {"); - stream.println (" return " + helperClass + ".type ();"); - stream.println (" }"); - stream.println (); - } // writeType - - protected java.util.Hashtable symbolTable; - protected com.sun.tools.corba.se.idl.SymtabEntry entry; - protected GenFileStream stream; - - // Unique to this generator - protected String holderClass; - protected String helperClass; - protected String holderType; -} // class Holder --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java 2018-01-30 20:25:48.000000000 -0500 +++ /dev/null 2018-01-30 20:25:48.000000000 -0500 @@ -1,864 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -The ctor should really throw an exception, but then it must have a -// throws clause. How much of a ripple effect is this? -// -F46082.51 Remove -stateful feature. -// -D60929 Update for RTF2.4 changes -// -D61056 Use Util.helperName -// -D62014 Move const definitions from signature to operations interf. -// -D62310 Fix declaration of interfaces extending abstract intf. -// -D62023 Move const definitions back from operations to signature. - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.ConstEntry; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; - -/** - * - **/ -public class InterfaceGen implements com.sun.tools.corba.se.idl.InterfaceGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public InterfaceGen () - { - //emit = ((Arguments)Compile.compiler.arguments).emit; - //factories = (Factories)Compile.compiler.factories (); - } // ctor - - /** - * Generate the interface and all the files associated with it. - * Provides general algorithm for binding generation: - * 1.) Initialize symbol table and symbol table entry members, common to all generators. - * 2.) Generate the skeleton if required by calling generateSkeletn () - * 3.) Generate the holder by calling generateHolder () - * 4.) Generate the helper by calling generateHelper () - * 5.) Generate the stub if required by calling generateStub () - * 6.) Generate the interface by calling generateInterface () - **/ - public void generate (Hashtable symbolTable, InterfaceEntry i, PrintWriter stream) - { - if (!isPseudo(i)) - { - this.symbolTable = symbolTable; - this.i = i; - init (); - - // for sun_local pragma, just generate the signature and operations interfaces - // for sun_localservant pragma, generate the Local Stubs, and Skel, should not - // have _invoke defined. - // for local (is_local()) case, generate only Helpers and Holder, where they - // have been modified to throw appropriate exceptions for read and write, and - // narrow is modified to not invoke _is_a - - if (! (i.isLocalSignature())) { - // generate the stubs and skeletons for non-local interfaces - if (! (i.isLocal())) { - // for local servant case just generate the skeleton, but - // for others generate the stubs also - generateSkeleton (); - - // _REVISIT_, Whenever there is time restructure the code to - // encapsulate stub and skeleton generation. - - // If the option is -fallTie then generate the Tie class first - // and then generate the ImplBase class to make the generation - // complete for the Hierarchy. - Arguments theArguments = (Arguments)Compile.compiler.arguments; - if( (theArguments.TIEServer == true ) - &&(theArguments.emit == theArguments.All ) ) - { - theArguments.TIEServer = false; - // Generate the ImplBase class - generateSkeleton (); - // Revert in case file contains multiple interfaces - theArguments.TIEServer = true; - } - generateStub (); - } - generateHolder (); - generateHelper (); - } - intfType = SIGNATURE; - generateInterface (); - intfType = OPERATIONS; - generateInterface (); - intfType = 0; - } - } // generate - - /** - * Initialize members unique to this generator. - **/ - protected void init () - { - emit = ((Arguments)Compile.compiler.arguments).emit; - factories = (Factories)Compile.compiler.factories (); - } // init - - /** - * Generate a Skeleton when the user does not want just the client-side code. - **/ - protected void generateSkeleton () - { - // Remove -stateful feature. - // The Skeleton is generated only when the user doesn't want - // JUST the client code OR when the interface is stateful - //if (emit != Arguments.Client || i.state () != null) - // factories.skeleton ().generate (symbolTable, i); - if (emit != Arguments.Client) - factories.skeleton ().generate (symbolTable, i); - } // generateSkeleton - - /** - * Generate a Stub when the user does not want just the server-side code. - **/ - protected void generateStub () - { - // According to Simon on 10/28/98, we should generate stubs for - // abstract interfaces too. - if (emit != Arguments.Server /* && !i.isAbstract () */) - factories.stub ().generate (symbolTable, i); - } // generateStub - - /** - * Generate a Helper when the user does not want just the server-side code. - **/ - protected void generateHelper () - { - if (emit != Arguments.Server) - factories.helper ().generate (symbolTable, i); - } // generateHelper - - /** - * Generate a Holder when the user does not want just the server-side code. - **/ - protected void generateHolder () - { - if (emit != Arguments.Server) - factories.holder ().generate (symbolTable, i); - } // generateHolder - - /** - * Generate the interface. Provides general algorithm for binding generation: - *
    - *
  1. Initialize members unique to this generator - init()
  2. - *
  3. Open print stream - openStream()
  4. - *
  5. Write class heading (package, prologue, class statement, open curly - writeHeading()
  6. - *
  7. Write class body (member data and methods) - write*Body()
  8. - *
  9. Write class closing (close curly) - writeClosing()
  10. - *
  11. Close the print stream - closeStream ()
  12. - *
- * - * For CORBA 2.3, interfaces are mapped to Operations and Signature - * interfaces. The Operations interface contains the method definitions. - * The Signature interface extends the Operations interface and adds - * CORBA::Object. (klr) - **/ - protected void generateInterface () - { - init (); - openStream (); - if (stream == null) - return; - writeHeading (); - if (intfType == OPERATIONS) - writeOperationsBody (); - if (intfType == SIGNATURE) - writeSignatureBody (); - writeClosing (); - closeStream (); - } // generateInterface - - /** - * - **/ - protected void openStream () - { - if (i.isAbstract () || intfType == SIGNATURE) - stream = Util.stream (i, ".java"); - else if (intfType == OPERATIONS) - stream = Util.stream (i, "Operations.java"); - } // openStream - - /** - * - **/ - protected void writeHeading () - { - Util.writePackage (stream, i, Util.TypeFile); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - - // Transfer interface comment to target <31jul1997>. - if (i.comment () != null) - i.comment ().generate ("", stream); - - String className = i.name (); -// if (((Arguments)Compile.compiler.arguments).TIEServer) -// { -// // For the delegate model, don't make interface a subclass of CORBA.Object -// stream.print ("public interface " + className); -// boolean firstTime = true; -// for (int ii = 0; ii < i.derivedFrom ().size (); ++ii) -// { -// SymtabEntry parent = (SymtabEntry)i.derivedFrom ().elementAt (ii); -// if (!parent.fullName ().equals ("org/omg/CORBA/Object")) -// { -// if (firstTime) -// { -// firstTime = false; -// stream.print (" extends "); -// } -// else -// stream.print (", "); -// stream.print (Util.javaName (parent)); -// } -// } -// if (i.derivedFrom ().size () > 0) -// stream.print (", "); -// stream.print ("org.omg.CORBA.portable.IDLEntity "); -// } -// -// else -// { - if (intfType == SIGNATURE) - writeSignatureHeading (); - else if (intfType == OPERATIONS) - writeOperationsHeading (); -// } - - stream.println (); - stream.println ('{'); - } // writeHeading - - /** - * - **/ - protected void writeSignatureHeading () - { - String className = i.name (); - stream.print ("public interface " + className + " extends " + className + "Operations, "); - boolean firstTime = true; - boolean hasNonAbstractParent = false; // - for (int k = 0; k < i.derivedFrom ().size (); ++k) - { - if (firstTime) - firstTime = false; - else - stream.print (", "); - InterfaceEntry parent = (InterfaceEntry)i.derivedFrom ().elementAt (k); - stream.print (Util.javaName (parent)); - if (! parent.isAbstract ()) // - hasNonAbstractParent = true; // - } - // - begin - // If this interface extends only abstract interfaces, - // it should extend both org.omg.CORBA.Object and IDLEntity. - if (!hasNonAbstractParent) { - stream.print (", org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity "); - } - else { - // - end - // extends IDLEntity if there's only one default parent - CORBA.Object - if (i.derivedFrom ().size () == 1) - stream.print (", org.omg.CORBA.portable.IDLEntity "); - } - } // writeSignatureHeading - - /** - * - **/ - protected void writeOperationsHeading () - { - stream.print ("public interface " + i.name ()); - if ( !i.isAbstract ()) - stream.print ("Operations "); - else { - // - base abstract interfaces extend AbstractBase - // changed to IDLEntity by SCN per latest spec... - if (i.derivedFrom ().size () == 0) - stream.print (" extends org.omg.CORBA.portable.IDLEntity"); - } - - boolean firstTime = true; - for (int k = 0; k < i.derivedFrom ().size (); ++k) - { - InterfaceEntry parent = (InterfaceEntry) i.derivedFrom ().elementAt (k); - String parentName = Util.javaName (parent); - - // ignore the default parent - CORBA.Object - if (parentName.equals ("org.omg.CORBA.Object")) - continue; - - if (firstTime) - { - firstTime = false; - stream.print (" extends "); - } - else - stream.print (", "); - - // Don't append suffix Operations to the parents of abstract interface - // or to the abstract parents of regular interface - if (parent.isAbstract () || i.isAbstract ()) - stream.print (parentName); - else - stream.print (parentName + "Operations"); - } - } // writeOperationsHeading - - - /** - * - **/ - protected void writeOperationsBody () - { - // Generate everything but constants - Enumeration e = i.contained ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry contained = (SymtabEntry)e.nextElement (); - if (contained instanceof MethodEntry) - { - MethodEntry element = (MethodEntry)contained; - ((MethodGen)element.generator ()).interfaceMethod (symbolTable, element, stream); - } - else - if ( !(contained instanceof ConstEntry)) - contained.generate (symbolTable, stream); - } - } // writeOperationsBody - - /** - * - **/ - protected void writeSignatureBody () - { - // Generate only constants - Enumeration e = i.contained ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry contained = (SymtabEntry)e.nextElement (); - if (contained instanceof ConstEntry) - contained.generate (symbolTable, stream); - } - } // writeSignatureBody - - /** - * - **/ - protected void writeClosing () - { - String intfName = i.name (); - if ( !i.isAbstract () && intfType == OPERATIONS) - intfName = intfName + "Operations"; - stream.println ("} // interface " + intfName); - } // writeClosing - - /** - * - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - /////////////// - // From JavaGenerator - - // Remove -stateful feature. - /* - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - InterfaceEntry i = (InterfaceEntry)entry; - if (i.state () != null && i.state ().size () > 0) - index = structHelperType (index, indent, tcoffsets, name, entry, stream); - else - { - tcoffsets.set (entry); - if (entry.fullName ().equals ("org/omg/CORBA/Object")) - stream.println (indent + name - + " = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_objref);"); - else - stream.println (indent + name - // <54697> - //+ " = org.omg.CORBA.ORB.init ().create_interface_tc (_id, " - + " = org.omg.CORBA.ORB.init ().create_interface_tc (" + Util.helperName (i, true) + ".id (), " // - + '\"' + Util.stripLeadingUnderscores (entry.name ()) + "\");"); - } - return index; - } // helperType - */ - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - InterfaceEntry i = (InterfaceEntry)entry; - tcoffsets.set (entry); - if (entry.fullName ().equals ("org/omg/CORBA/Object")) - stream.println (indent + name - + " = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_objref);"); - else - stream.println (indent + name - // <54697> - //+ " = org.omg.CORBA.ORB.init ().create_interface_tc (_id, " - + " = org.omg.CORBA.ORB.init ().create_interface_tc (" + Util.helperName (i, true) + ".id (), " // - + '\"' + Util.stripLeadingUnderscores (entry.name ()) + "\");"); - return index; - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) { - stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // - return index; - } // type - - // Remove -stateful feature. - /* - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - InterfaceEntry i = (InterfaceEntry)entry; - if (i.state () != null) - structHelperRead (entryName, i, stream); - else - { - if (i.isAbstract ()) - stream.println (" return narrow (((org.omg.CORBA_2_3.portable.InputStream)istream).read_abstract_interface (_" + i.name () + "Stub.class));"); // - else - stream.println (" return narrow (istream.read_Object (_" + i.name () + "Stub.class));"); - } - } // helperRead - - */ - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - InterfaceEntry i = (InterfaceEntry)entry; - if (i.isAbstract ()) - stream.println (" return narrow (((org.omg.CORBA_2_3.portable.InputStream)istream).read_abstract_interface (_" + i.name () + "Stub.class));"); // - else - stream.println (" return narrow (istream.read_Object (_" + i.name () + "Stub.class));"); - } // helperRead - - // Remove -stateful feature. - /* - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - InterfaceEntry i = (InterfaceEntry)entry; - if (i.state () != null) - structHelperWrite (entry, stream); - else - write (0, " ", "value", entry, stream); - } // helperWrite - */ - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - write (0, " ", "value", entry, stream); - } // helperWrite - - // Remove -stateful feature. - /* - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - InterfaceEntry i = (InterfaceEntry)entry; - if (i.state () != null) - index = structRead (index, indent, name, i, stream); - else - { - if (entry.fullName ().equals ("org/omg/CORBA/Object")) - stream.println (indent + name + " = istream.read_Object (_" + i.name () + "Stub.class);"); - else - stream.println (indent + name + " = " + Util.helperName (entry, false) + ".narrow (istream.read_Object (_" + i.name () + "Stub.class));"); // - } - return index; - } // read - */ - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - InterfaceEntry i = (InterfaceEntry)entry; - if (entry.fullName ().equals ("org/omg/CORBA/Object")) - stream.println (indent + name + " = istream.read_Object (_" + i.name () + "Stub.class);"); - else - stream.println (indent + name + " = " + Util.helperName (entry, false) + ".narrow (istream.read_Object (_" + i.name () + "Stub.class));"); // - return index; - } // read - - // Remove -stateful feature. - /* - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - InterfaceEntry i = (InterfaceEntry)entry; - if (i.state () != null) - index = structWrite (index, indent, name, entry, stream); - else - { - if (i.isAbstract ()) - stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_abstract_interface ((java.lang.Object) " + name + ");"); // - else - stream.println (indent + "ostream.write_Object ((org.omg.CORBA.Object) " + name + ");"); - } - return index; - } // write - */ - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - InterfaceEntry i = (InterfaceEntry)entry; - if (i.isAbstract ()) - stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_abstract_interface ((java.lang.Object) " + name + ");"); // - else - stream.println (indent + "ostream.write_Object ((org.omg.CORBA.Object) " + name + ");"); - return index; - } // write - - // Remove -stateful feature. - /* - // These methods are cobbled from StructGen. Stateful interfaces - // are sent across the wire as if they were structs, with the first - // element being a string - the Java name of the class. - - public int structHelperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - TCOffsets innerOffsets = new TCOffsets (); - innerOffsets.set (entry); - int offsetForStruct = innerOffsets.currentOffset (); - InterfaceEntry i = (InterfaceEntry)entry; - String membersName = "_members" + index++; - Vector state = i.state (); - stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + (state.size () + 1) + "];"); - String tcOfMembers = "_tcOf" + membersName; - stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + ';'); - - // The name string is the first element of the struct - String memberName = "_name"; - StringEntry stringEntry = Compile.compiler.factory.stringEntry (); - index = ((JavaGenerator)stringEntry.generator ()).helperType (index, indent, innerOffsets, tcOfMembers, stringEntry, stream); - stream.println (indent + membersName + "[0] = new org.omg.CORBA.StructMember ("); - stream.println (indent + " \"" + memberName + "\","); - stream.println (indent + " " + tcOfMembers + ','); - stream.println (indent + " null);"); - int offsetSoFar = innerOffsets.currentOffset (); - innerOffsets = new TCOffsets (); - innerOffsets.set (entry); - innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct); - - for (int idx = 0; idx < state.size (); ++idx) - { - TypedefEntry member = ((InterfaceState)state.elementAt (idx)).entry; - memberName = member.name (); - index = ((JavaGenerator)member.generator ()).helperType (index, indent, innerOffsets, tcOfMembers, member, stream); - stream.println (indent + membersName + '[' + (idx + 1) + "] = new org.omg.CORBA.StructMember ("); - stream.println (indent + " \"" + memberName + "\","); - stream.println (indent + " " + tcOfMembers + ','); - stream.println (indent + " null);"); - offsetSoFar = innerOffsets.currentOffset (); - innerOffsets = new TCOffsets (); - innerOffsets.set (entry); - innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct); - } - tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ()); - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + entry.name () + "\", " + membersName + ");"); - return index; - } // structHelperType - - public void structHelperRead (String entryName, InterfaceEntry entry, PrintWriter stream) - { - String impl = implName ((InterfaceEntry)entry); - stream.println (" " + Util.javaStatefulName (entry) + " value = null;"); - structRead (0, " ", "value", entry, stream); - stream.println (" return value;"); - } // structHelperRead - - private String implName (InterfaceEntry entry) - { - String name; - if (entry.container ().name ().equals ("")) - name = '_' + entry.name () + "Impl"; - else - name = Util.containerFullName (entry.container ()) + "._" + entry.name () + "Impl"; - return name.replace ('/', '.'); - } // implName - - public int structRead (int index, String indent, String name, InterfaceEntry entry, PrintWriter stream) - { - // The first element will be the name of the Java implementation class. - String stringName = "_name" + index++; - stream.println (indent + "String " + stringName + " = istream.read_string ();"); - stream.println (indent + "try"); - stream.println (indent + "{"); - stream.println (indent + " " + name + " = (" + Util.javaStatefulName (entry) + ")com.sun.CORBA.iiop.ORB.getImpl (" + stringName + ".replace ('/', '.'));"); - stream.println (indent + "}"); - stream.println (indent + "catch (Exception e)"); - stream.println (indent + "{"); - stream.println (indent + " " + name + " = null;"); - stream.println (indent + "}"); - stream.println (indent + "if (" + name + " == null)"); - stream.println (indent + " throw new org.omg.CORBA.NO_IMPLEMENT (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);"); - stream.println (); - - stream.println (indent + "if (!" + stringName + ".equals (\"" + entry.fullName () + "\"))"); - stream.println (indent + '{'); - stream.println (indent + " Class _cls = " + name + ".getClass ();"); - stream.println (indent + " boolean _found = false;"); - stream.println (indent + " while (!_found && _cls != null)"); - stream.println (indent + " {"); - stream.println (indent + " Class[] interfaces = _cls.getInterfaces ();"); - stream.println (indent + " for (int i = 0; i < interfaces.length; ++i)"); - stream.println (indent + " if (interfaces[i].getName ().indexOf (\"State\") > 0)"); - stream.println (indent + " {"); - stream.println (indent + " _cls = interfaces[i];"); - stream.println (indent + " _found = true;"); - stream.println (indent + " break;"); - stream.println (indent + " }"); - stream.println (indent + " if (!_found)"); - stream.println (indent + " _cls = _cls.getSuperclass ();"); - stream.println (indent + " }"); - stream.println (indent + " if (_cls == null)"); - stream.println (indent + " throw new org.omg.CORBA.NO_IMPLEMENT (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);"); - stream.println (); - stream.println (indent + " String _className = _cls.getName ();"); - stream.println (indent + " int _index = _className.lastIndexOf ('.');"); - stream.println (indent + " String _helperName = _className.substring (0, _index + 1) + _className.substring (_index + 2, _className.length () - 5) + \"Helper\"; // 5 == \"State\".length"); - stream.println (indent + " try"); - stream.println (indent + " {"); - stream.println (indent + " Class _helperClass = Class.forName (_helperName);"); - stream.println (indent + " Class[] _formalParms = new Class [1];"); - stream.println (indent + " _formalParms[0] = Class.forName (\"org.omg.CORBA.portable.InputStream\");"); - stream.println (indent + " java.lang.reflect.Method _read = _helperClass.getMethod (\"read\", _formalParms);"); - stream.println (indent + " Object[] _actualParms = new Object [1];"); - stream.println (indent + " _actualParms[0] = istream;"); - stream.println (indent + " " + name + " = (" + Util.javaStatefulName (entry) + ")_read.invoke (null, _actualParms);"); - stream.println (indent + " }"); - stream.println (indent + " catch (Exception e)"); - stream.println (indent + " {"); - stream.println (indent + " throw new org.omg.CORBA.NO_IMPLEMENT (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);"); - stream.println (indent + " }"); - stream.println (indent + '}'); - - // instantiate an implementation - stream.println (indent + "else"); - stream.println (indent + '{'); - - // Load the state - readState (index, indent, name, (InterfaceEntry)entry, stream); - - stream.println (indent + '}'); - return index; - } // structRead - - private void readState (int index, String indent, String name, InterfaceEntry entry, PrintWriter stream) - { - // First write the state from all parents - Enumeration e = entry.derivedFrom ().elements (); - while (e.hasMoreElements ()) - { - InterfaceEntry parent = (InterfaceEntry)e.nextElement (); - if (parent.state () != null) - { - if (parent.state ().size () > 0) - readState (index, indent, name, parent, stream); - break; - } - } - - // Now write the state for the local entry - e = entry.state ().elements (); - while (e.hasMoreElements ()) - { - TypedefEntry member = ((InterfaceState)e.nextElement ()).entry; - String tmpName = '_' + member.name () + "Tmp"; - Util.writeInitializer (indent + " ", tmpName, "", member, stream); - if (!member.arrayInfo ().isEmpty () || member.type () instanceof SequenceEntry || member.type () instanceof PrimitiveEntry || member.type () instanceof StringEntry) - index = ((JavaGenerator)member.generator ()).read (index, indent + " ", tmpName, member, stream); - else - stream.println (indent + " " + tmpName + " = " + Util.helperName (member.type (), true) + ".read (istream);"); // - stream.println (indent + " " + name + '.' + member.name () + " (" + tmpName + ");"); - } - } // readState - - public void structHelperWrite (SymtabEntry entry, PrintWriter stream) - { - structWrite (0, " ", "value", entry, stream); - } // structHelperWrite - - public int structWrite (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - // The first element of the struct must be the name of the real interface. - stream.println (indent + "Class _cls = " + name + ".getClass ();"); - stream.println (indent + "boolean _found = false;"); - stream.println (indent + "while (!_found && _cls != null)"); - stream.println (indent + "{"); - stream.println (indent + " Class[] interfaces = _cls.getInterfaces ();"); - stream.println (indent + " for (int i = 0; i < interfaces.length; ++i)"); - stream.println (indent + " if (interfaces[i].getName ().indexOf (\"State\") > 0)"); - stream.println (indent + " {"); - stream.println (indent + " _cls = interfaces[i];"); - stream.println (indent + " _found = true;"); - stream.println (indent + " break;"); - stream.println (indent + " }"); - stream.println (indent + " if (!_found)"); - stream.println (indent + " _cls = _cls.getSuperclass ();"); - stream.println (indent + '}'); - stream.println (); - stream.println (indent + "if (_cls == null)"); - stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);"); - stream.println (); - stream.println (indent + "String _className = _cls.getName ();"); - stream.println (indent + "int _index = _className.lastIndexOf ('.');"); - stream.println (indent + "String _interfaceName = _className.substring (0, _index + 1) + _className.substring (_index + 2, _className.length () - 5); // 5 == \"State\".length"); - stream.println (indent + "ostream.write_string (_interfaceName.replace ('.', '/'));"); - - // If _className != Util.javaName (entry), then call that class's helper class. - stream.println (); - stream.println (indent + "if (!_interfaceName.equals (\"" + Util.javaName (entry) + "\"))"); - stream.println (indent + '{'); - stream.println (indent + " try"); - stream.println (indent + " {"); - stream.println (indent + " Class _helperClass = Class.forName (_interfaceName + \"Helper\");"); - stream.println (indent + " Class[] _formalParms = new Class [2];"); - stream.println (indent + " _formalParms[0] = Class.forName (\"org.omg.CORBA.portable.OutputStream\");"); - stream.println (indent + " _formalParms[1] = _cls;"); - stream.println (indent + " java.lang.reflect.Method _write = _helperClass.getMethod (\"write\", _formalParms);"); - stream.println (indent + " Object[] _actualParms = new Object [2];"); - stream.println (indent + " _actualParms[0] = ostream;"); - stream.println (indent + " _actualParms[1] = " + name + ';'); - stream.println (indent + " _write.invoke (null, _actualParms);"); - stream.println (indent + " }"); - stream.println (indent + " catch (Exception e)"); - stream.println (indent + " {"); - stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);"); - stream.println (indent + " }"); - stream.println (indent + '}'); - - stream.println (indent + "else"); - stream.println (indent + '{'); - - writeState (index, indent, name, (InterfaceEntry)entry, stream); - - stream.println (indent + '}'); - return index; - } // structWrite - - private void writeState (int index, String indent, String name, InterfaceEntry entry, PrintWriter stream) - { - // First write the state from all parents - Enumeration e = entry.derivedFrom ().elements (); - while (e.hasMoreElements ()) - { - InterfaceEntry parent = (InterfaceEntry)e.nextElement (); - if (parent.state () != null) - { - if (parent.state ().size () > 0) - writeState (index, indent, name, parent, stream); - break; - } - } - - // Now write the state for the local entry - Vector members = entry.state (); - for (int i = 0; i < members.size (); ++i) - { - TypedefEntry member = ((InterfaceState)members.elementAt (i)).entry; - if (!member.arrayInfo ().isEmpty () || member.type () instanceof SequenceEntry || member.type () instanceof PrimitiveEntry || member.type () instanceof StringEntry) - index = ((JavaGenerator)member.generator ()).write (index, indent + " ", name + '.' + member.name () + "()", member, stream); - else - stream.println (indent + " " + Util.helperName (member.type (), true) + ".write (ostream, " + name + '.' + member.name () + " ());"); // - } - } // writeState - */ - - /** - * @return true if the entry is for a CORBA pseudo-object. - **/ - private boolean isPseudo(InterfaceEntry i) { - java.lang.String fullname = i.fullName(); - if (fullname.equalsIgnoreCase("CORBA/TypeCode")) - return true; - if (fullname.equalsIgnoreCase("CORBA/Principal")) - return true; - if (fullname.equalsIgnoreCase("CORBA/ORB")) - return true; - if (fullname.equalsIgnoreCase("CORBA/Any")) - return true; - if (fullname.equalsIgnoreCase("CORBA/Context")) - return true; - if (fullname.equalsIgnoreCase("CORBA/ContextList")) - return true; - if (fullname.equalsIgnoreCase("CORBA/DynamicImplementation")) - return true; - if (fullname.equalsIgnoreCase("CORBA/Environment")) - return true; - if (fullname.equalsIgnoreCase("CORBA/ExceptionList")) - return true; - if (fullname.equalsIgnoreCase("CORBA/NVList")) - return true; - if (fullname.equalsIgnoreCase("CORBA/NamedValue")) - return true; - if (fullname.equalsIgnoreCase("CORBA/Request")) - return true; - if (fullname.equalsIgnoreCase("CORBA/ServerRequest")) - return true; - if (fullname.equalsIgnoreCase("CORBA/UserException")) - return true; - return false; - } - - // From JavaGenerator - /////////////// - - protected int emit = 0; - protected Factories factories = null; - - protected Hashtable symbolTable = null; - protected InterfaceEntry i = null; - protected PrintWriter stream = null; - - // Modify access to protected. - protected static final int SIGNATURE = 1; - protected static final int OPERATIONS = 2; - protected int intfType = 0; -} // class InterfaceGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java 2018-01-30 20:25:48.000000000 -0500 +++ /dev/null 2018-01-30 20:25:49.000000000 -0500 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: - -import java.io.PrintWriter; - -import com.sun.tools.corba.se.idl.SymtabEntry; - -/** - * - **/ -public interface JavaGenerator -{ - // The helper methods print the specific helper method. - // The helper read/write methods call the read/write methods. - - int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream); - - void helperRead (String entryName, SymtabEntry entry, PrintWriter stream); - - void helperWrite (SymtabEntry entry, PrintWriter stream); - - // The read/write methods print the streaming of the type. - // This printed code is found in the helper method but it is only - // that code that is concerned with streaming itself. - - int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream); - - int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream); - - int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream); - -} // interface JavaGenerator --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java 2018-01-30 20:25:49.000000000 -0500 +++ /dev/null 2018-01-30 20:25:49.000000000 -0500 @@ -1,1091 +0,0 @@ -/* - * Copyright (c) 1999, 2002, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -After demarshalling an IOR, think about how to deal with the exceptions. -// -catching Exception throws a string which should be in a properties file. -// -30jul1997 Modified to write comment immediately preceding method signature. -// -07May1998 Modified to support RMI Portable Stub -// -26Aug1998 Modified to pass helper instance to read_Value. -// -F46082.51 Remove -stateful feature; javaStatefulName() obsolete. -// -D56554 Port bounded string checks from toJava to toJavaPortable -// -D58549 bounded string checks on in/inout parms throw BAD_PARAM -// -D57112 Valuetype initializers map to ctor, regardless of name, and -// "void _init(...)" methods now mapped correctly. -// -D59297 pass context parm when Remarshalling -// -D59560 call read/write_Context -// -D60929 Update for RTF2.4 changes -// -D61056 Use Util.helperName -// -D61650 Remove '\n' from generated strings; use println()'s. - -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.EnumEntry; -import com.sun.tools.corba.se.idl.ExceptionEntry; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.ParameterEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.AttributeEntry; - -import com.sun.tools.corba.se.idl.constExpr.Expression; - -/** - * - **/ -public class MethodGen implements com.sun.tools.corba.se.idl.MethodGen -{ - private static final String ONE_INDENT = " "; - private static final String TWO_INDENT = " "; - private static final String THREE_INDENT = " "; - private static final String FOUR_INDENT = " "; - private static final String FIVE_INDENT = " "; - // This is the length of _get_ and _set_ - private static final int ATTRIBUTE_METHOD_PREFIX_LENGTH = 5; - /** - * Public zero-argument constructor. - **/ - public MethodGen () - { - } // ctor - - /** - * Method generate() is not used in MethodGen. They are replaced by the - * more granular interfaceMethod, stub, skeleton, dispatchSkeleton. - **/ - public void generate (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - } // generate - - /** - * - **/ - protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - if (m.comment () != null) - m.comment ().generate ("", stream); - stream.print (" "); - SymtabEntry container = (SymtabEntry)m.container (); - boolean isAbstract = false; - boolean valueContainer = false; - if (container instanceof ValueEntry) - { - isAbstract = ((ValueEntry)container).isAbstract (); - valueContainer = true; - } - if (valueContainer && !isAbstract) - stream.print ("public "); - writeMethodSignature (); - if (valueContainer && !isAbstract) - { - stream.println (); - stream.println (" {"); - stream.println (" }"); - stream.println (); - } - else - stream.println (";"); - } // interfaceMethod - - /** - * - **/ - protected void stub (String className, boolean isAbstract, - Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index) - { - localOptimization = - ((Arguments)Compile.compiler.arguments).LocalOptimization; - this.isAbstract = isAbstract; - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - this.methodIndex = index; - if (m.comment () != null) - m.comment ().generate (" ", stream); - stream.print (" public "); - writeMethodSignature (); - stream.println (); - stream.println (" {"); - writeStubBody ( className ); - stream.println (" } // " + m.name ()); - stream.println (); - } // stub - - /** - * - **/ - protected void localstub (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index, InterfaceEntry i) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - this.methodIndex = index; - if (m.comment () != null) - m.comment ().generate (" ", stream); - stream.print (" public "); - writeMethodSignature (); - stream.println (); - stream.println (" {"); - writeLocalStubBody (i); - stream.println (" } // " + m.name ()); - stream.println (); - } // stub - /** - * - **/ - protected void skeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - this.methodIndex = index; - if (m.comment () != null) - m.comment ().generate (" ", stream); - stream.print (" public "); - writeMethodSignature (); - stream.println (); - stream.println (" {"); - writeSkeletonBody (); - stream.println (" } // " + m.name ()); - } // skeleton - - /** - * - **/ - protected void dispatchSkeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - this.methodIndex = index; - if (m.comment () != null) - m.comment ().generate (" ", stream); - writeDispatchCall (); - } // dispatchSkeleton - - // - /** - * Determine whether method entry m is a valuetype initializer. - * @return true if is m is valuetype initializer, false otherwise. - **/ - protected boolean isValueInitializer () - { - MethodEntry currentInit = null; - if ((m.container () instanceof ValueEntry)) - { - Enumeration e = ((ValueEntry)m.container ()).initializers ().elements (); - while (currentInit != m && e.hasMoreElements ()) - currentInit = (MethodEntry)e.nextElement (); - } - return (currentInit == m) && (null != m); // True ==> yes, false ==> no. - } // isValueInitializer - - /** - * - **/ - protected void writeMethodSignature () - { - boolean isValueInitializer = isValueInitializer (); // - - // Step 0. Print the return type and name. - // A return type of null indicates the "void" return type. If m is a - // Valuetype intitializer, it has name "init" and a null return type, - // but it maps to a ctor. - // - //if (m.type () == null) - //{ - // if (m.name ().compareTo ("init") != 0) - // stream.print ("void"); - //} - if (m.type () == null) - { - if (!isValueInitializer) - stream.print ("void"); - } - else - { - // Remove -stateful feature; javaStatefulName() obsolete. - //stream.print (Util.javaStatefulName (m.type ())); - stream.print (Util.javaName (m.type ())); - } - // Value initializers map to constructors. - // If the value has an 'init' method with a return type, handle - // the method like other regular methods - //if (m.valueMethod () && m.name ().compareTo ("init") == 0 && - // m.type () == null) - if (isValueInitializer) - stream.print (' ' + m.container ().name () + " ("); - else - stream.print (' ' + m.name () + " ("); - - // Step 1. Print the parameter list. - boolean firstTime = true; - Enumeration e = m.parameters ().elements (); - while (e.hasMoreElements ()) - { - if (firstTime) - firstTime = false; - else - stream.print (", "); - ParameterEntry parm = (ParameterEntry)e.nextElement (); - - writeParmType (parm.type (), parm.passType ()); - - // Print parm name - stream.print (' ' + parm.name ()); - } - - // Step 2. Add the context parameter if necessary. - if (m.contexts ().size () > 0) - { - if (!firstTime) - stream.print (", "); - stream.print ("org.omg.CORBA.Context $context"); - } - - // Step 3. Print the throws clause (if necessary). - if (m.exceptions ().size () > 0) - { - stream.print (") throws "); - e = m.exceptions ().elements (); - firstTime = true; - while (e.hasMoreElements ()) - { - if (firstTime) - firstTime = false; - else - stream.print (", "); - stream.print (Util.javaName ((SymtabEntry)e.nextElement ())); - } - } - else - stream.print (')'); - } // writeMethodSignature - - /** - * - **/ - protected void writeParmType (SymtabEntry parm, int passType) - { - if (passType != ParameterEntry.In) - { - parm = Util.typeOf (parm); - stream.print (Util.holderName (parm)); - } - else // passType is `in' - // Remove -stateful feature; javaStatefulName() obsolete. - //stream.print (Util.javaStatefulName (parm)); - stream.print (Util.javaName (parm)); - } // writeParmType - - /** - * - **/ - protected void writeDispatchCall () - { - String indent = " "; - String fullMethodName = m.fullName (); - if (m instanceof AttributeEntry) - { - // determine the index at which the attribute name starts in the full name - int index = fullMethodName.lastIndexOf ('/') + 1; - if (m.type () == null) // if it's a modifier - fullMethodName = fullMethodName.substring (0, index) + "_set_" + m.name (); - else - fullMethodName = fullMethodName.substring (0, index) + "_get_" + m.name (); - } - stream.println (indent + "case " + methodIndex + ": // " + fullMethodName); - stream.println (indent + "{"); - indent = indent + " "; - if (m.exceptions ().size () > 0) - { - stream.println (indent + "try {"); - indent = indent + " "; - } - - // Step 1 Read arguments from the input stream - SymtabEntry mtype = Util.typeOf (m.type ()); - Enumeration parms = m.parameters ().elements (); - parms = m.parameters ().elements (); - while (parms.hasMoreElements ()) - { - ParameterEntry parm = (ParameterEntry) parms.nextElement (); - String name = parm.name (); - String anyName = '_' + name; - SymtabEntry type = parm.type (); - int passType = parm.passType (); - - if (passType == ParameterEntry.In) - Util.writeInitializer (indent, name, "", type, writeInputStreamRead ("in", type), stream); - - else // the parm is a holder - { - String holderName = Util.holderName (type); - stream.println (indent + holderName + ' ' + name + " = new " + holderName + " ();"); - if (passType == ParameterEntry.Inout) - { - if (type instanceof ValueBoxEntry) - { - ValueBoxEntry v = (ValueBoxEntry) type; - TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry; - SymtabEntry mType = member.type (); - if (mType instanceof PrimitiveEntry) - stream.println (indent + name + ".value = (" + writeInputStreamRead ("in", parm.type ()) + ").value;"); - else - stream.println (indent + name + ".value = " + writeInputStreamRead ("in", parm.type ()) + ";"); - } - else - stream.println (indent + name + ".value = " + writeInputStreamRead ("in", parm.type ()) + ";"); - } - } - } - - // Step 1a. Read the context parameter if necessary. - if (m.contexts ().size () > 0) - { - stream.println (indent + "org.omg.CORBA.Context $context = in.read_Context ();"); - } - - // Step 2 Load return if necessary - if (mtype != null) - Util.writeInitializer (indent, "$result", "", mtype, stream); - - // Step 3 Call the method with the list of parameters - writeMethodCall (indent); - - parms = m.parameters ().elements (); - boolean firstTime = true; - while (parms.hasMoreElements ()) - { - ParameterEntry parm = (ParameterEntry)parms.nextElement (); - if (firstTime) - firstTime = false; - else - stream.print (", "); - stream.print (parm.name ()); - } - - // Step 3a. Add the context parameter if necessary. - if (m.contexts ().size () > 0) - { - if (!firstTime) - stream.print (", "); - stream.print ("$context"); - } - - stream.println (");"); - - //Step 3b. Create reply; - writeCreateReply (indent); - - // Step 4 Write method's result to the output stream - if (mtype != null) - { - writeOutputStreamWrite (indent, "out", "$result", mtype, stream); - } - - // Step 5 Write inout/out value to the output stream - parms = m.parameters ().elements (); - while (parms.hasMoreElements ()) - { - ParameterEntry parm = (ParameterEntry)parms.nextElement (); - int passType = parm.passType (); - if (passType != ParameterEntry.In) - { - writeOutputStreamWrite (indent, "out", parm.name () + ".value", parm.type (), stream); - } - } - - // Step 6 Handle exception - if (m.exceptions ().size () > 0) - { - Enumeration exceptions = m.exceptions ().elements (); - while (exceptions.hasMoreElements ()) - { - indent = " "; - ExceptionEntry exc = (ExceptionEntry) exceptions.nextElement (); - String fullName = Util.javaQualifiedName (exc); - stream.println (indent + "} catch (" + fullName + " $ex) {"); - indent = indent + " "; - stream.println (indent + "out = $rh.createExceptionReply ();"); - stream.println (indent + Util.helperName (exc, true) + ".write (out, $ex);"); // - } - - indent = " "; - stream.println (indent + "}"); - } - - stream.println (" break;"); - stream.println (" }"); - stream.println (); - } // writeDispatchCall - - /** - * - **/ - protected void writeStubBody ( String className ) - { - // Step 1 Create a request - String methodName = Util.stripLeadingUnderscores (m.name ()); - if (m instanceof AttributeEntry) - { - if (m.type () == null) // if it's a modifier - methodName = "_set_" + methodName; - else - methodName = "_get_" + methodName; - } - if( localOptimization && !isAbstract ) { - stream.println (ONE_INDENT + "while(true) {" ); - stream.println(TWO_INDENT + "if(!this._is_local()) {" ); - } - stream.println(THREE_INDENT + - "org.omg.CORBA.portable.InputStream $in = null;"); - stream.println(THREE_INDENT + "try {"); - stream.println(FOUR_INDENT + "org.omg.CORBA.portable.OutputStream $out =" + - " _request (\"" + methodName + "\", " + !m.oneway() + ");"); - - // Step 1.b. Check string bounds - // begin in/inout string bounds check - Enumeration parms = m.parameters ().elements (); - while (parms.hasMoreElements ()) - { - ParameterEntry parm = (ParameterEntry)parms.nextElement (); - SymtabEntry parmType = Util.typeOf (parm.type ()); - if (parmType instanceof StringEntry) - if ((parm.passType () == ParameterEntry.In) || - (parm.passType () == ParameterEntry.Inout)) - { - StringEntry string = (StringEntry)parmType; - if (string.maxSize () != null) - { - stream.print (THREE_INDENT + "if (" + parm.name ()); - if (parm.passType () == ParameterEntry.Inout) - stream.print (".value"); // get from holder - stream.print (" == null || " + parm.name ()); - if (parm.passType () == ParameterEntry.Inout) - stream.print (".value"); // get from holder - stream.println (".length () > (" + - Util.parseExpression (string.maxSize ()) + "))"); - stream.println (THREE_INDENT + - "throw new org.omg.CORBA.BAD_PARAM (0," + - " org.omg.CORBA.CompletionStatus.COMPLETED_NO);"); - } - } - } - // end in/inout string bounds check - - // Step 2 Load the parameters into the outputStream - parms = m.parameters ().elements (); - while (parms.hasMoreElements ()) - { - ParameterEntry parm = (ParameterEntry)parms.nextElement (); - if (parm.passType () == ParameterEntry.In) - writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name (), parm.type (), - stream); - else if (parm.passType () == ParameterEntry.Inout) - writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name () + ".value", - parm.type (), stream); - } - - // Step 2a. Write the context parameter if necessary. - if (m.contexts ().size () > 0) - { - stream.println(FOUR_INDENT + "org.omg.CORBA.ContextList $contextList =" + - "_orb ().create_context_list ();"); - - for (int cnt = 0; cnt < m.contexts ().size (); cnt++) - { - stream.println(FOUR_INDENT + - "$contextList.add (\"" + m.contexts (). elementAt (cnt) + "\");"); - } - stream.println(FOUR_INDENT + - "$out.write_Context ($context, $contextList);"); - } - - // Step 3 Invoke the method with the output stream - stream.println (FOUR_INDENT + "$in = _invoke ($out);"); - - SymtabEntry mtype = m.type (); - if (mtype != null) - Util.writeInitializer (FOUR_INDENT, "$result", "", mtype, - writeInputStreamRead ("$in", mtype), stream); - - // Step 4 Read the inout/out values - parms = m.parameters ().elements (); - while (parms.hasMoreElements ()) - { - ParameterEntry parm = (ParameterEntry)parms.nextElement (); - if (parm.passType () != ParameterEntry.In) - { - if (parm.type () instanceof ValueBoxEntry) - { - ValueBoxEntry v = (ValueBoxEntry) parm.type (); - TypedefEntry member = - ((InterfaceState) v.state ().elementAt (0)).entry; - SymtabEntry mType = member.type (); - if (mType instanceof PrimitiveEntry) - stream.println(FOUR_INDENT + parm.name () + - ".value = (" + writeInputStreamRead ("$in", parm.type ()) + - ").value;"); - else - stream.println(FOUR_INDENT + parm.name () + - ".value = " + writeInputStreamRead ("$in", parm.type ()) +";"); - } - else - stream.println (FOUR_INDENT + parm.name () + ".value = " + - writeInputStreamRead ("$in", parm.type ()) + ";"); - } - } - // Step 4.b. Check string bounds - // begin out/inout/return string bounds check - parms = m.parameters ().elements (); - while (parms.hasMoreElements ()) - { - ParameterEntry parm = (ParameterEntry)parms.nextElement (); - SymtabEntry parmType = Util.typeOf (parm.type ()); - if (parmType instanceof StringEntry) - if ((parm.passType () == ParameterEntry.Out) || - (parm.passType () == ParameterEntry.Inout)) - { - StringEntry string = (StringEntry)parmType; - if (string.maxSize () != null) - { - stream.print (FOUR_INDENT + "if (" + parm.name () + - ".value.length ()"); - stream.println (" > (" + - Util.parseExpression (string.maxSize ()) + "))"); - stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL(0,"+ - "org.omg.CORBA.CompletionStatus.COMPLETED_NO);"); - } - } - } - if (mtype instanceof StringEntry) - { - StringEntry string = (StringEntry)mtype; - if (string.maxSize () != null) - { - stream.println(FOUR_INDENT + "if ($result.length () > (" + - Util.parseExpression (string.maxSize ()) + "))"); - stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL (0," + - " org.omg.CORBA.CompletionStatus.COMPLETED_NO);"); - } - } - // end out/inout/return string bounds check - - // Step 5 Handle return if necessary - if (mtype != null) { - stream.println(FOUR_INDENT + "return $result;"); - } else { - stream.println(FOUR_INDENT + "return;"); - } - - // Step 6 Handle exceptions - stream.println(THREE_INDENT + - "} catch (org.omg.CORBA.portable.ApplicationException " + "$ex) {"); - stream.println(FOUR_INDENT + "$in = $ex.getInputStream ();"); - stream.println(FOUR_INDENT + "String _id = $ex.getId ();"); - - if (m.exceptions ().size () > 0) - { - Enumeration exceptions = m.exceptions ().elements (); - boolean firstExc = true; - while (exceptions.hasMoreElements ()) - { - ExceptionEntry exc = (ExceptionEntry)exceptions.nextElement (); - if (firstExc) - { - stream.print(FOUR_INDENT + "if "); - firstExc = false; - } - else - stream.print(FOUR_INDENT + "else if "); - - stream.println( "(_id.equals (\"" + exc.repositoryID ().ID () + "\"))"); - stream.println (FIVE_INDENT + "throw " + - Util.helperName ((SymtabEntry)exc, false) + ".read ($in);"); - } - stream.println(FOUR_INDENT + "else"); - stream.println(FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL (_id);"); - } - else - stream.println(FOUR_INDENT + "throw new org.omg.CORBA.MARSHAL (_id);"); - - stream.println(THREE_INDENT + - "} catch (org.omg.CORBA.portable.RemarshalException $rm) {"); - stream.print( FOUR_INDENT ); - if (m.type () != null) // not a void method - stream.print ("return "); - stream.print (m.name () + " ("); - { - // write parm names - boolean firstTime = true; - Enumeration e = m.parameters ().elements (); - while (e.hasMoreElements ()) - { - if (firstTime) - firstTime = false; - else - stream.print (", "); - ParameterEntry parm = (ParameterEntry)e.nextElement (); - stream.print (parm.name ()); - } - // Step 2. Add the context parameter if necessary. - if (m.contexts ().size () > 0) - { - if (!firstTime) - stream.print (", "); - stream.print ("$context"); - } - } - stream.println (TWO_INDENT + ");"); - stream.println (THREE_INDENT + "} finally {"); - stream.println (FOUR_INDENT + "_releaseReply ($in);"); - stream.println (THREE_INDENT + "}"); - if( localOptimization && !isAbstract ) { - stream.println (TWO_INDENT + "}"); - writeStubBodyForLocalInvocation( className, methodName ); - } - - } // writeStubBody - - - /** - * This method writes the else part of the stub method invocation to - * enable local invocation in case of collocation. - * NOTE: This will only be invoked from writeStubBody. - */ - private void writeStubBodyForLocalInvocation( String className, - String methodName ) - { - stream.println (TWO_INDENT + "else {" ); - stream.println (THREE_INDENT + - "org.omg.CORBA.portable.ServantObject _so ="); - stream.println (FOUR_INDENT + "_servant_preinvoke(\"" + methodName + - "\", _opsClass);" ); - stream.println(THREE_INDENT + "if (_so == null ) {"); - stream.println(FOUR_INDENT + "continue;" ); - stream.println(THREE_INDENT + "}"); - stream.println(THREE_INDENT + className + "Operations _self =" ); - stream.println(FOUR_INDENT + "(" + className + "Operations) _so.servant;"); - stream.println(THREE_INDENT + "try {" ); - Enumeration parms = m.parameters ().elements (); - if (m instanceof AttributeEntry) - { - // Local Method Name should drop _get_ or _set_ prefix for attribute - // entry - methodName = methodName.substring( ATTRIBUTE_METHOD_PREFIX_LENGTH ); - } - boolean voidReturnType = (this.m.type() == null); - if ( !voidReturnType ) { - stream.println (FOUR_INDENT + Util.javaName (this.m.type ()) + - " $result;"); - } - if( !isValueInitializer() ) { - if ( voidReturnType ) { - stream.print(FOUR_INDENT + "_self." + methodName + "( " ); - } else { - stream.print(FOUR_INDENT + "$result = _self." + - methodName + "( " ); - } - while (parms.hasMoreElements ()) { - ParameterEntry param = (ParameterEntry)parms.nextElement (); - if( parms.hasMoreElements( ) ) { - stream.print( " " + param.name() + "," ); - } else { - stream.print( " " + param.name() ); - } - } - stream.print( ");" ); - stream.println( " " ); - if( voidReturnType ) { - stream.println(FOUR_INDENT + "return;" ); - } else { - stream.println(FOUR_INDENT + "return $result;" ); - } - } - stream.println(" "); - stream.println (THREE_INDENT + "}" ); - stream.println (THREE_INDENT + "finally {" ); - stream.println (FOUR_INDENT + "_servant_postinvoke(_so);" ); - stream.println (THREE_INDENT + "}" ); - stream.println (TWO_INDENT + "}" ); - stream.println (ONE_INDENT + "}" ); - } - - - protected void writeLocalStubBody (InterfaceEntry i) - { - // Step 1 Create a request - String methodName = Util.stripLeadingUnderscores (m.name ()); - if (m instanceof AttributeEntry) - { - if (m.type () == null) // if it's a modifier - methodName = "_set_" + methodName; - else - methodName = "_get_" + methodName; - } - //stream.println (" while(true) {"); - stream.println (" org.omg.CORBA.portable.ServantObject $so = " + - "_servant_preinvoke (\"" + methodName + "\", " + "_opsClass);"); - //stream.println (" if ($so == null) {"); - //stream.println (" continue;"); - //stream.println (" }"); - String opsName = i.name() + "Operations"; - stream.println (" " + opsName + " $self = " + "(" + opsName + ") " + "$so.servant;"); - stream.println (); - stream.println (" try {"); - stream.print (" "); - if (m.type () != null) // not a void method - stream.print ("return "); - stream.print ("$self." + m.name () + " ("); - { - // write parm names - boolean firstTime = true; - Enumeration e = m.parameters ().elements (); - while (e.hasMoreElements ()) - { - if (firstTime) - firstTime = false; - else - stream.print (", "); - ParameterEntry parm = (ParameterEntry)e.nextElement (); - stream.print (parm.name ()); - } - // Step 2. Add the context parameter if necessary. - if (m.contexts ().size () > 0) - { - if (!firstTime) - stream.print (", "); - stream.print ("$context"); - } - } - stream.println (");"); - //stream.println (" } catch (org.omg.CORBA.portable.RemarshalException $rm) {"); - //stream.println (" continue; "); - stream.println (" } finally {"); - stream.println (" _servant_postinvoke ($so);"); - stream.println (" }"); - //stream.println (" }"); - - } // writeLocalStubBody - - - - /** - * - **/ - private void writeInsert (String indent, String target, String source, SymtabEntry type, PrintWriter stream) - { - String typeName = type.name (); - if (type instanceof PrimitiveEntry) - { - // RJB does something have to be done with TC offsets? - if (typeName.equals ("long long")) - stream.println (indent + source + ".insert_longlong (" + target + ");"); - else if (typeName.equals ("unsigned short")) - stream.println (indent + source + ".insert_ushort (" + target + ");"); - else if (typeName.equals ("unsigned long")) - stream.println (indent + source + ".insert_ulong (" + target + ");"); - else if (typeName.equals ("unsigned long long")) - stream.println (indent + source + ".insert_ulonglong (" + target + ");"); - else - stream.println (indent + source + ".insert_" + typeName + " (" + target + ");"); - } - else if (type instanceof StringEntry) - stream.println (indent + source + ".insert_" + typeName + " (" + target + ");"); - else - stream.println (indent + Util.helperName (type, true) + ".insert (" + source + ", " + target + ");"); // - } // writeInsert - - /** - * - **/ - private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream) - { - if (type instanceof PrimitiveEntry) - { - // RJB does something have to be done with TC offsets? - if (type.name ().equals ("long long")) - stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));"); - else if (type.name ().equals ("unsigned short")) - stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));"); - else if (type.name ().equals ("unsigned long")) - stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));"); - else if (type.name ().equals ("unsigned long long")) - stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));"); - else - stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));"); - } - else if (type instanceof StringEntry) - { - StringEntry s = (StringEntry)type; - Expression e = s.maxSize (); - if (e == null) - stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));"); - else - stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));"); - } - else - stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // - } // writeType - - /** - * - **/ - private void writeExtract (String indent, String target, String source, SymtabEntry type, PrintWriter stream) - { - if (type instanceof PrimitiveEntry) - { - if (type.name ().equals ("long long")) - stream.println (indent + target + " = " + source + ".extract_longlong ();"); - else if (type.name ().equals ("unsigned short")) - stream.println (indent + target + " = " + source + ".extract_ushort ();"); - else if (type.name ().equals ("unsigned long")) - stream.println (indent + target + " = " + source + ".extract_ulong ();"); - else if (type.name ().equals ("unsigned long long")) - stream.println (indent + target + " = " + source + ".extract_ulonglong ();"); - else - stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();"); - } - else if (type instanceof StringEntry) - stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();"); - else - stream.println (indent + target + " = " + Util.helperName (type, true) + ".extract (" + source + ");"); // - } // writeExtract - - /** - * - **/ - private String writeExtract (String source, SymtabEntry type) - { - String extract; - if (type instanceof PrimitiveEntry) - { - if (type.name ().equals ("long long")) - extract = source + ".extract_longlong ()"; - else if (type.name ().equals ("unsigned short")) - extract = source + ".extract_ushort ()"; - else if (type.name ().equals ("unsigned long")) - extract = source + ".extract_ulong ()"; - else if (type.name ().equals ("unsigned long long")) - extract = source + ".extract_ulonglong ()"; - else - extract = source + ".extract_" + type.name () + " ()"; - } - else if (type instanceof StringEntry) - extract = source + ".extract_" + type.name () + " ()"; - else - extract = Util.helperName (type, true) + ".extract (" + source + ')'; // - return extract; - } // writeExtract - - /** - * - **/ - private void writeSkeletonBody () - { - SymtabEntry mtype = Util.typeOf (m.type ()); - - // If there is a return value, increment the appropriate counter - stream.print (" "); - if (mtype != null) - stream.print ("return "); - stream.print ("_impl." + m.name () + '('); - - // Load the parameters - Enumeration parms = m.parameters ().elements (); - boolean first = true; - while (parms.hasMoreElements ()) - { - ParameterEntry parm = (ParameterEntry)parms.nextElement (); - if (first) - first = false; - else - stream.print (", "); - stream.print (parm.name ()); - } - if (m.contexts ().size () != 0) - { - if (!first) - stream.print (", "); - stream.print ("$context"); - } - - stream.println (");"); - } // writeSkeletonBody - - /** - * - **/ - protected String passType (int passType) - { - String type; - switch (passType) - { - case ParameterEntry.Inout: - type = "org.omg.CORBA.ARG_INOUT.value"; - break; - case ParameterEntry.Out: - type = "org.omg.CORBA.ARG_OUT.value"; - break; - case ParameterEntry.In: - default: - type = "org.omg.CORBA.ARG_IN.value"; - break; - } - return type; - } // passType - - /** - * This is only used by AttributeGen. The java mapping says - * the names should be getXXX and setXXX, but CORBA says they - * should be _get_XXX and _set_XXX. this.name () will be - * getXXX. realName is set by AttributeGen to _get_XXX. - **/ - protected void serverMethodName (String name) - { - realName = (name == null) ? "" : name; - } // serverMethodName - - /** - * - **/ - private void writeOutputStreamWrite (String indent, String oStream, String name, SymtabEntry type, PrintWriter stream) - { - String typeName = type.name (); - stream.print (indent); - if (type instanceof PrimitiveEntry) - { - if (typeName.equals ("long long")) - stream.println (oStream + ".write_longlong (" + name +");"); - else if (typeName.equals ("unsigned short")) - stream.println (oStream + ".write_ushort (" + name + ");"); - else if (typeName.equals ("unsigned long")) - stream.println (oStream + ".write_ulong (" + name + ");"); - else if (typeName.equals ("unsigned long long")) - stream.println (oStream + ".write_ulonglong (" + name + ");"); - else - stream.println (oStream + ".write_" + typeName + " (" + name + ");"); - } - else if (type instanceof StringEntry) - stream.println (oStream + ".write_" + typeName + " (" + name + ");"); - else if (type instanceof SequenceEntry) - stream.println (oStream + ".write_" + type.type().name() + " (" + name + ");"); - else if (type instanceof ValueBoxEntry) - { - ValueBoxEntry v = (ValueBoxEntry) type; - TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry; - SymtabEntry mType = member.type (); - - // if write value to the boxed holder indicated by the name ending with ".value" - if (mType instanceof PrimitiveEntry && name.endsWith (".value")) - stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " // - + " new " + Util.javaQualifiedName (type) + " (" + name + "));"); // - else - stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " + name + ");"); // // - } - else if (type instanceof ValueEntry) - stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " + name + ");"); // // - else - stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " + name + ");"); // - } // writeOutputStreamWrite - - /** - * - **/ - private String writeInputStreamRead (String source, SymtabEntry type) - { - String read = ""; - if (type instanceof PrimitiveEntry) - { - if (type.name ().equals ("long long")) - read = source + ".read_longlong ()"; - else if (type.name ().equals ("unsigned short")) - read = source + ".read_ushort ()"; - else if (type.name ().equals ("unsigned long")) - read = source + ".read_ulong ()"; - else if (type.name ().equals ("unsigned long long")) - read = source + ".read_ulonglong ()"; - else - read = source + ".read_" + type.name () + " ()"; - } - else if (type instanceof StringEntry) - read = source + ".read_" + type.name () + " ()"; - else - read = Util.helperName (type, true) + ".read (" + source + ')'; // - return read; - } // writeInputStreamRead - - /** - * - **/ - protected void writeMethodCall (String indent) - { - SymtabEntry mtype = Util.typeOf (m.type ()); - if (mtype == null) - stream.print (indent + "this." + m.name () + " ("); - else - stream.print (indent + "$result = this." + m.name () + " ("); - } // writeMethodCall - - /** - * - **/ - protected void writeCreateReply(String indent){ - stream.println(indent + "out = $rh.createReply();"); - } - - protected int methodIndex = 0; - protected String realName = ""; - protected Hashtable symbolTable = null; - protected MethodEntry m = null; - protected PrintWriter stream = null; - protected boolean localOptimization = false; - protected boolean isAbstract = false; -} // class MethodGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java 2018-01-30 20:25:50.000000000 -0500 +++ /dev/null 2018-01-30 20:25:50.000000000 -0500 @@ -1,258 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D62023 New file to implement CORBA 2.4 RTF -// -D62794 Fix problem with no-arg create functions - -import java.io.PrintWriter; - -import java.util.Enumeration; -import java.util.Vector; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.ParameterEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.StructEntry; - -/** - * - **/ -public class MethodGen24 extends MethodGen -{ - /** - * Public zero-argument constructor. - **/ - public MethodGen24 () - { - } // ctor - - /** - * Print the parameter list for the factory method. - * @param m The method to list parameters for - * @param listTypes If try, declare the parms, otherwise just list them - * @param stream The PrintWriter to print on - */ - protected void writeParmList (MethodEntry m, boolean listTypes, PrintWriter stream) { - boolean firstTime = true; - Enumeration e = m.parameters ().elements (); - while (e.hasMoreElements ()) - { - if (firstTime) - firstTime = false; - else - stream.print (", "); - ParameterEntry parm = (ParameterEntry)e.nextElement (); - if (listTypes) { - writeParmType (parm.type (), parm.passType ()); - stream.print (' '); - } - // Print parm name - stream.print (parm.name ()); - // end of parameter list - } - } - - /** - * d62023 - write the methodEntry for a valuetype factory method into - * the Value Helper class. Contents from email from Simon, - * 4/25/99. - **/ - protected void helperFactoryMethod (Hashtable symbolTable, MethodEntry m, SymtabEntry t, PrintWriter stream) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - String initializerName = m.name (); - String typeName = Util.javaName (t); - String factoryName = typeName + "ValueFactory"; - - // Step 1. Print factory method decl up to parms. - stream.print (" public static " + typeName + " " + initializerName + - " (org.omg.CORBA.ORB $orb"); - if (!m.parameters ().isEmpty ()) - stream.print (", "); // - - // Step 2. Print the declaration parameter list. - writeParmList (m, true, stream); - - // Step 3. Print the body of the factory method - stream.println (")"); - stream.println (" {"); - stream.println (" try {"); - stream.println (" " + factoryName + " $factory = (" + factoryName + ")"); - stream.println (" ((org.omg.CORBA_2_3.ORB) $orb).lookup_value_factory(id());"); - stream.print (" return $factory." + initializerName + " ("); - writeParmList (m, false, stream); - stream.println (");"); - stream.println (" } catch (ClassCastException $ex) {"); - stream.println (" throw new org.omg.CORBA.BAD_PARAM ();"); - stream.println (" }"); - stream.println (" }"); - stream.println (); - } // helperFactoryMethod - - /** - * d62023 - write an abstract method definition - **/ - protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - if (m.comment () != null) - m.comment ().generate (" ", stream); - stream.print (" "); - stream.print ("public abstract "); - writeMethodSignature (); - stream.println (";"); - stream.println (); - } // abstractMethod - - /** - * d62023 - write a default factory method implementation for the - * {@code DefaultFactory}. m is a methodEntry for a factory - * method contained in a non-abstract ValueEntry. - **/ - protected void defaultFactoryMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - String typeName = m.container (). name (); - stream.println (); - if (m.comment () != null) - m.comment ().generate (" ", stream); - stream.print (" public " + typeName + " " + m.name () + " ("); - writeParmList (m, true, stream); - stream.println (")"); - stream.println (" {"); - stream.print (" return new " + typeName + "Impl ("); - writeParmList (m, false, stream); - stream.println (");"); - stream.println (" }"); - } // defaultFactoryMethod - - /** - * d62023 - remove all valueInitializer junk - **/ - protected void writeMethodSignature () - { - // Step 0. Print the return type and name. - // A return type of null indicates the "void" return type. If m is a - // Valuetype factory method, it has a null return type, - if (m.type () == null) - { - // if factory method, result type is container - if (isValueInitializer ()) - stream.print (m.container ().name ()); - else - stream.print ("void"); - } - else - { - stream.print (Util.javaName (m.type ())); - } - stream.print (' ' + m.name () + " ("); - - // Step 1. Print the parameter list. - boolean firstTime = true; - Enumeration e = m.parameters ().elements (); - while (e.hasMoreElements ()) - { - if (firstTime) - firstTime = false; - else - stream.print (", "); - ParameterEntry parm = (ParameterEntry)e.nextElement (); - - writeParmType (parm.type (), parm.passType ()); - - // Print parm name - stream.print (' ' + parm.name ()); - } - - // Step 2. Add the context parameter if necessary. - if (m.contexts ().size () > 0) - { - if (!firstTime) - stream.print (", "); - stream.print ("org.omg.CORBA.Context $context"); - } - - // Step 3. Print the throws clause (if necessary). - if (m.exceptions ().size () > 0) - { - stream.print (") throws "); - e = m.exceptions ().elements (); - firstTime = true; - while (e.hasMoreElements ()) - { - if (firstTime) - firstTime = false; - else - stream.print (", "); - stream.print (Util.javaName ((SymtabEntry)e.nextElement ())); - } - } - else - stream.print (')'); - } // writeMethodSignature - - /** - * d62023 - delete method templates for valuetypes - **/ - protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - if (m.comment () != null) - m.comment ().generate (" ", stream); - stream.print (" "); - writeMethodSignature (); - stream.println (";"); - } // interfaceMethod -} --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java 2018-01-30 20:25:50.000000000 -0500 +++ /dev/null 2018-01-30 20:25:51.000000000 -0500 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D62023 New file to implement CORBA 2.4 RTF -// NOTE: The methods in this class should be exact copies of the -// correspoind methods in MethodGen24. The purpose of this class is -// to inject the changes made in MethodGen24 between AttributeGen -// and AttributeGen24. When the AttributeGen24 changes are merged, this -// class should be deleted. - -import java.io.PrintWriter; - -import java.util.Enumeration; -import java.util.Vector; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.ParameterEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.StructEntry; - -/** - * - **/ -public class MethodGenClone24 extends AttributeGen -{ - /** - * Public zero-argument constructor. - **/ - public MethodGenClone24 () - { - } // ctor - - /** - * d62023 - write an abstract method definition - **/ - protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - if (m.comment () != null) - m.comment ().generate (" ", stream); - stream.print (" "); - stream.print ("public abstract "); - writeMethodSignature (); - stream.println (";"); - stream.println (); - } // abstractMethod - - /** - * d62023 - delete method templates for valuetypes - **/ - protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream) - { - this.symbolTable = symbolTable; - this.m = m; - this.stream = stream; - if (m.comment () != null) - m.comment ().generate (" ", stream); - stream.print (" "); - writeMethodSignature (); - stream.println (";"); - } // interfaceMethod -} --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java 2018-01-30 20:25:51.000000000 -0500 +++ /dev/null 2018-01-30 20:25:51.000000000 -0500 @@ -1,78 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: - -import java.io.File; -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.ModuleEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; - -/** - * - **/ -public class ModuleGen implements com.sun.tools.corba.se.idl.ModuleGen -{ - /** - * Public zero-argument constructor. - **/ - public ModuleGen () - { - } // ctor - - /** - * Generate Java code for all members of an IDL module. - **/ - public void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream) - { - // Generate the package directory - String name = Util.containerFullName( entry ) ; - Util.mkdir (name); - - // Generate all of the contained types - Enumeration e = entry.contained ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry element = (SymtabEntry)e.nextElement (); - if (element.emit ()) - element.generate (symbolTable, stream); - } - } // generate -} // class ModuleGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java 2018-01-30 20:25:52.000000000 -0500 +++ /dev/null 2018-01-30 20:25:52.000000000 -0500 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.corba.se.idl.toJavaPortable ; - -public interface NameModifier { - /** Create a modified name from the base name. - */ - String makeName( String base ) ; -} ; --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java 2018-01-30 20:25:53.000000000 -0500 +++ /dev/null 2018-01-30 20:25:53.000000000 -0500 @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.tools.corba.se.idl.toJavaPortable ; - -import com.sun.tools.corba.se.idl.toJavaPortable.NameModifier ; - -public class NameModifierImpl implements NameModifier { - private String prefix ; - private String suffix ; - - public NameModifierImpl( ) - { - this.prefix = null ; - this.suffix = null ; - } - - public NameModifierImpl( String prefix, String suffix ) - { - this.prefix = prefix ; - this.suffix = suffix ; - } - - /** Construct a NameModifier from a pattern of the form xxx%xxx. - * The pattern must consist of characters chosen from the - * set [A-Za-z0-9%$_]. In addition, the pattern must contain - * exactly one % character. Finally, if % is not the first char in - * the pattern, the pattern must not start with a number. - *

- * The semantics of makeName are very simply: just replace the - * % character with the base in the pattern and return the result. - */ - public NameModifierImpl( String pattern ) - { - int first = pattern.indexOf( '%' ) ; - int last = pattern.lastIndexOf( '%' ) ; - - if (first != last) - throw new IllegalArgumentException( - Util.getMessage( "NameModifier.TooManyPercent" ) ) ; - - if (first == -1) - throw new IllegalArgumentException( - Util.getMessage( "NameModifier.NoPercent" ) ) ; - - for (int ctr = 0; ctr - emit = "tk_Principal"; - else if (entry.name ().equals ("wchar")) - emit = "tk_wchar"; - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind." + emit + ");"); - return index; - } // type - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - } // helperRead - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - } // helperWrite - - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - stream.println (indent + name + " = " + "istream.read_" + Util.collapseName (entry.name ()) + " ();"); - return index; - } // read - - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - stream.println (indent + "ostream.write_" + Util.collapseName (entry.name ()) + " (" + name + ");"); - return index; - } // write - - // From JavaGenerator - /////////////// -} // class PrimitiveGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java 2018-01-30 20:25:55.000000000 -0500 +++ /dev/null 2018-01-30 20:25:55.000000000 -0500 @@ -1,271 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -F46082.51 Remove -stateful feature; javaStatefulName() obsolete. -// -D61056 Use Util.helperName - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; - -import com.sun.tools.corba.se.idl.constExpr.Expression; - -/** - * - **/ -public class SequenceGen implements com.sun.tools.corba.se.idl.SequenceGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public SequenceGen () - { - } // ctor - - /** - * - **/ - public void generate (Hashtable symbolTable, SequenceEntry s, PrintWriter stream) - { - } // generator - - /////////////// - // From JavaGenerator - - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - int offsetOfType = tcoffsets.offset (entry.type ().fullName ()); - if (offsetOfType >= 0) - { - // This code uses the deprecated create_recursive_sequence_tc() - // It should be eliminated when the API is removed from the ORB class - // Regardles, this code will not be emitted since updated emitters invoke - // method type() below instead of helperType() when handling sequences - - // This is a recursive sequence - tcoffsets.set (null); - Expression maxSize = ((SequenceEntry)entry).maxSize (); - if (maxSize == null) - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_sequence_tc (0, " + (offsetOfType - tcoffsets.currentOffset ()) + ");"); - else - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_sequence_tc (" + Util.parseExpression (maxSize) + ", " + (offsetOfType - tcoffsets.currentOffset ()) + ");"); - tcoffsets.bumpCurrentOffset (4); // add indirection field - } - else - { - // This is a normal sequence - tcoffsets.set (entry); - index = ((JavaGenerator)entry.type ().generator ()).helperType (index + 1, indent, tcoffsets, name, entry.type (), stream); - Expression maxSize = ((SequenceEntry)entry).maxSize (); - if (maxSize == null) - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");"); - else - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");"); - } - tcoffsets.bumpCurrentOffset (4); // add on the seq max size - return index; - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) { - int offsetOfType = tcoffsets.offset (entry.type ().fullName ()); - if (offsetOfType >= 0) - { - // This is a recursive sequence - tcoffsets.set (null); - - // Need to fix later: how to get repositoryId of IDL type containing this sequence? - // entry.repositoryID().ID() returns empty string and - // Util.javaQualifiedName(entry) returns internal name which is not valid repId - - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_tc (" + "\"\"" + ");"); - tcoffsets.bumpCurrentOffset (4); // add indirection field - } - else - { - // This is a normal sequence - tcoffsets.set (entry); - index = ((JavaGenerator)entry.type ().generator ()).type (index + 1, indent, tcoffsets, name, entry.type (), stream); - Expression maxSize = ((SequenceEntry)entry).maxSize (); - if (maxSize == null) - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");"); - else - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");"); - } - //stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // - return index; - } // type - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - } // helperRead - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - } // helperWrite - - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - SequenceEntry seq = (SequenceEntry)entry; - String length = "_len" + index++; - stream.println (indent + "int " + length + " = istream.read_long ();"); - if (seq.maxSize () != null) - { - stream.println (indent + "if (" + length + " > (" + Util.parseExpression (seq.maxSize ()) + "))"); - stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);"); - } - String seqOfName; - try - { - seqOfName = Util.sansArrayInfo ((String)seq.dynamicVariable (Compile.typedefInfo)); - } - catch (NoSuchFieldException e) - { - seqOfName = seq.name (); - } - int startArray = seqOfName.indexOf ('['); - String arrayDcl = seqOfName.substring (startArray); - seqOfName = seqOfName.substring (0, startArray); - - // For interfaces having state, e.g., valuetypes. - SymtabEntry seqOfEntry = (SymtabEntry)Util.symbolTable.get (seqOfName.replace ('.', '/')); - if (seqOfEntry != null && seqOfEntry instanceof InterfaceEntry && ((InterfaceEntry)seqOfEntry).state () != null) - // Remove -stateful feature; javaStatefulName() obsolete. - //seqOfName = Util.javaStatefulName ((InterfaceEntry)seqOfEntry); - seqOfName = Util.javaName ((InterfaceEntry)seqOfEntry); - - arrayDcl = arrayDcl.substring (2); - stream.println (indent + name + " = new " + seqOfName + '[' + length + ']' + arrayDcl + ';'); - if (seq.type () instanceof PrimitiveEntry) - // Check for CORBA::Principal, too - //if (seq.type ().name ().equals ("any") || seq.type ().name ().equals ("TypeCode")) - if (seq.type ().name ().equals ("any") || - seq.type ().name ().equals ("TypeCode") || - seq.type ().name ().equals ("Principal")) - { - String loopIndex = "_o" + index; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')'); - stream.println (indent + " " + name + '[' + loopIndex + "] = istream.read_" + seq.type ().name () + " ();"); - } - else - { // special case for ValueBox: if name is "xxx tmp", drop xxx - String varName = name; - int nameIndex = varName.indexOf (' '); - if ( nameIndex != -1 ) - varName = varName.substring( nameIndex + 1 ); - stream.println (indent + "istream.read_" + Util.collapseName (entry.type ().name ()) + "_array (" + varName + ", 0, " + length + ");"); - } - else if (entry.type () instanceof StringEntry) - { - String loopIndex = "_o" + index; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')'); - stream.println (indent + " " + name + '[' + loopIndex + "] = istream.read_" + seq.type ().name () + " ();"); - } - else if (entry.type () instanceof SequenceEntry) - { - String loopIndex = "_o" + index; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')'); - stream.println (indent + '{'); - index = ((JavaGenerator)seq.type ().generator ()).read (index, indent + " ", name + '[' + loopIndex + ']', seq.type (), stream); - stream.println (indent + '}'); - } - else - { // special case for ValueBox: if name is "xxx tmp", drop xxx - String varName = name; - int nameIndex = varName.indexOf (' '); - if ( nameIndex != -1 ) - varName = varName.substring( nameIndex + 1 ); - String loopIndex = "_o" + index; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + varName + ".length; ++" + loopIndex + ')'); - stream.println (indent + " " + varName + '[' + loopIndex + "] = " + Util.helperName (seq.type (), true) + ".read (istream);"); // - } - return index; - } // read - - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - SequenceEntry seq = (SequenceEntry)entry; - if (seq.maxSize () != null) - { - stream.println (indent + "if (" + name + ".length > (" + Util.parseExpression (seq.maxSize ()) + "))"); - stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);"); - } - stream.println (indent + "ostream.write_long (" + name + ".length);"); - if (entry.type () instanceof PrimitiveEntry) - // Check for CORBA::Principal, too. - //if (entry.type ().name ().equals ("any") || entry.type ().name ().equals ("TypeCode")) - if (entry.type ().name ().equals ("any") || - entry.type ().name ().equals ("TypeCode") || - entry.type ().name ().equals ("Principal")) - { - String loopIndex = "_i" + index++; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')'); - stream.println (indent + " ostream.write_" + seq.type ().name () + " (" + name + '[' + loopIndex + "]);"); - } - else - stream.println (indent + "ostream.write_" + Util.collapseName (entry.type ().name ()) + "_array (" + name + ", 0, " + name + ".length);"); - else if (entry.type () instanceof StringEntry) - { - String loopIndex = "_i" + index++; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')'); - stream.println (indent + " ostream.write_" + seq.type ().name () + " (" + name + '[' + loopIndex + "]);"); - } - else if (entry.type () instanceof SequenceEntry) - { - String loopIndex = "_i" + index++; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')'); - stream.println (indent + '{'); - index = ((JavaGenerator)seq.type ().generator ()).write (index, indent + " ", name + '[' + loopIndex + ']', seq.type (), stream); - stream.println (indent + '}'); - } - else - { - String loopIndex = "_i" + index++; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')'); - stream.println (indent + " " + Util.helperName (seq.type (), true) + ".write (ostream, " + name + '[' + loopIndex + "]);"); // - } - return index; - } // write - - // From JavaGenerator - /////////////// -} // class SequenceGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java 2018-01-30 20:25:55.000000000 -0500 +++ /dev/null 2018-01-30 20:25:56.000000000 -0500 @@ -1,568 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -F46082.51 Remove -stateful feature; javaStatefulName() obsolete. -// -D57147 Make _Tie implement org.omg.CORBA.portable.InvokeHandler -// -D58037 Make _Tie delegate to Operations interface -// -D62739 no TIE for values that support abstract interfaces, etc. - -import java.io.File; -import java.io.PrintWriter; - -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.AttributeEntry; -import com.sun.tools.corba.se.idl.GenFileStream; - -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.ValueEntry; - -/** - * - **/ -public class Skeleton implements AuxGen -{ - private NameModifier skeletonNameModifier ; - private NameModifier tieNameModifier ; - - public Skeleton () - { - } - - public void generate (Hashtable symbolTable, SymtabEntry entry) - { - // - // Per Simon, 5-12-99, don't generate TIE or Skeleton for - // - // 1) valuetypes supporting abstract interfaces - // 2) valuetypes with no supports. - // 3) abstract interfaces - // - if (entry instanceof ValueEntry) - { - ValueEntry v = (ValueEntry) entry; - if ((v.supports ().size () == 0) || - ((InterfaceEntry) v.supports ().elementAt (0)).isAbstract ()) { - return; - } - } - if (((InterfaceEntry) entry).isAbstract ()) { - return; - } - // - - this.symbolTable = symbolTable; - - this.i = (InterfaceEntry)entry; - init (); - openStream (); - if (stream == null) - return; - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generate - - /** - * Initialize members unique to this generator. - **/ - protected void init () - { - tie = ((Arguments)Compile.compiler.arguments).TIEServer ; - poa = ((Arguments)Compile.compiler.arguments).POAServer ; - - skeletonNameModifier = - ((Arguments)Compile.compiler.arguments).skeletonNameModifier ; - tieNameModifier = - ((Arguments)Compile.compiler.arguments).tieNameModifier ; - - tieClassName = tieNameModifier.makeName( i.name() ) ; - skeletonClassName = skeletonNameModifier.makeName( i.name() ) ; - - intfName = Util.javaName (i); - // for valuetype, get the name of the interface the valuetype supports - if (i instanceof ValueEntry) - { - ValueEntry v = (ValueEntry) i; - InterfaceEntry intf = (InterfaceEntry) v.supports ().elementAt (0); - intfName = Util.javaName (intf); - } - } // init - - protected void openStream () - { - if (tie) - stream = Util.stream( i, tieNameModifier, ".java" ) ; - else - stream = Util.stream( i, skeletonNameModifier, ".java" ) ; - } // openStream - - protected void writeHeading () - { - Util.writePackage (stream, i, Util.StubFile); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - if (i.comment () != null) - i.comment ().generate ("", stream); - writeClassDeclaration (); - stream.println ('{'); - stream.println (); - } // writeHeading - - protected void writeClassDeclaration () - { - if (tie){ - stream.println ("public class " + tieClassName + - " extends " + skeletonClassName ) ; - } else { - if (poa) { - stream.println ("public abstract class " + skeletonClassName + - " extends org.omg.PortableServer.Servant"); - stream.print (" implements " + intfName + "Operations, "); - stream.println ("org.omg.CORBA.portable.InvokeHandler"); - } else { - stream.println ("public abstract class " + skeletonClassName + - " extends org.omg.CORBA.portable.ObjectImpl"); - stream.print (" implements " + intfName + ", "); - stream.println ("org.omg.CORBA.portable.InvokeHandler"); - } - } - } // writeClassDeclaration - - /** - * - **/ - protected void writeBody () - { - // Remove -stateful feature. ????? - //if (i.state () != null) - // writeState (); - writeCtors (); - if (i instanceof ValueEntry) - { - // use the interface the valuetype supports to generate the - // tie class instead of using the valuetype itself - ValueEntry v = (ValueEntry) i; - this.i = (InterfaceEntry) v.supports ().elementAt (0); - } - buildMethodList (); - //DispatchMethod and MethodTable - if (tie){ //Concrete class implementing the remote interface - //The logic is here for future use - if (poa) { - writeMethods (); - stream.println (" private " + intfName + "Operations _impl;"); - stream.println (" private org.omg.PortableServer.POA _poa;"); - } else { - writeMethods (); - stream.println (" private " + intfName + "Operations _impl;"); - } - } else { //Both POA and ImplBase are abstract InvokeHandler - //The logic is here for future use - if (poa) { - writeMethodTable (); - writeDispatchMethod (); - writeCORBAOperations (); - } else { - writeMethodTable (); - writeDispatchMethod (); - writeCORBAOperations (); - } - } - //legacy !! - writeOperations (); - } // writeBody - - /** - * Close the skeleton class. The singleton ORB member is - * necessary only for portable skeletons. - **/ - protected void writeClosing () - { - stream.println (); - if (tie){ - stream.println ("} // class " + tieClassName); - } else { - stream.println ("} // class " + skeletonClassName); - } - } // writeClosing - - /** - * Close the print stream, which flushes the stream to file. - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - protected void writeCtors () - { - stream.println (" // Constructors"); - // Empty argument constructors - if (!poa) { - if (tie){ - stream.println (" public " + tieClassName + " ()"); - stream.println (" {"); - stream.println (" }"); - } else { - stream.println (" public " + skeletonClassName + " ()"); - stream.println (" {"); - stream.println (" }"); - } - } - stream.println (); - // Argumented constructors - if (tie){ - if (poa) { - //Write constructors - writePOATieCtors(); - //Write state setters and getters - writePOATieFieldAccessMethods(); - } else { - stream.println (" public " + tieClassName + - " (" + intfName + "Operations impl)"); - stream.println (" {"); - // Does it derive from a interface having state, e.g., valuetype? - if (((InterfaceEntry)i.derivedFrom ().firstElement ()).state () != null) - stream.println (" super (impl);"); - else - stream.println (" super ();"); - stream.println (" _impl = impl;"); - stream.println (" }"); - stream.println (); - } - } else { //Skeleton is not Tie so it has no constructors. - if (poa) { - } else { - } - } - - } // writeCtors - - - private void writePOATieCtors(){ - //First constructor - stream.println (" public " + tieClassName + " ( " + intfName + "Operations delegate ) {"); - stream.println (" this._impl = delegate;"); - stream.println (" }"); - //Second constructor specifying default poa. - stream.println (" public " + tieClassName + " ( " + intfName + - "Operations delegate , org.omg.PortableServer.POA poa ) {"); - stream.println (" this._impl = delegate;"); - stream.println (" this._poa = poa;"); - stream.println (" }"); - } - - private void writePOATieFieldAccessMethods(){ - //Getting delegate - stream.println (" public " + intfName+ "Operations _delegate() {"); - stream.println (" return this._impl;"); - stream.println (" }"); - //Setting delegate - stream.println (" public void _delegate (" + intfName + "Operations delegate ) {"); - stream.println (" this._impl = delegate;"); - stream.println (" }"); - //Overriding default poa - stream.println (" public org.omg.PortableServer.POA _default_POA() {"); - stream.println (" if(_poa != null) {"); - stream.println (" return _poa;"); - stream.println (" }"); - stream.println (" else {"); - stream.println (" return super._default_POA();"); - stream.println (" }"); - stream.println (" }"); - } - - /** - * Build a list of all of the methods, keeping out duplicates. - **/ - protected void buildMethodList () - { - // Start from scratch - methodList = new Vector (); - - buildMethodList (i); - } // buildMethodList - - /** - * - **/ - private void buildMethodList (InterfaceEntry entry) - { - // Add the local methods - Enumeration locals = entry.methods ().elements (); - while (locals.hasMoreElements ()) - addMethod ((MethodEntry)locals.nextElement ()); - - // Add the inherited methods - Enumeration parents = entry.derivedFrom ().elements (); - while (parents.hasMoreElements ()) - { - InterfaceEntry parent = (InterfaceEntry)parents.nextElement (); - if (!parent.name ().equals ("Object")) - buildMethodList (parent); - } - } // buildMethodList - - /** - * - **/ - private void addMethod (MethodEntry method) - { - if (!methodList.contains (method)) - methodList.addElement (method); - } // addMethod - - /** - * - **/ - protected void writeDispatchMethod () - { - String indent = " "; - stream.println (" public org.omg.CORBA.portable.OutputStream _invoke (String $method,"); - stream.println (indent + "org.omg.CORBA.portable.InputStream in,"); - stream.println (indent + "org.omg.CORBA.portable.ResponseHandler $rh)"); - stream.println (" {"); - - // this is a special case code generation for cases servantLocator and - // servantActivator, where OMG is taking too long to define them - // as local objects - - boolean isLocalInterface = false; - if (i instanceof InterfaceEntry) { - isLocalInterface = i.isLocalServant(); - } - - if (!isLocalInterface) { - // Per Simon 8/26/98, create and return reply stream for all methods - KLR - stream.println (" org.omg.CORBA.portable.OutputStream out = null;"); - stream.println (" java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);"); - stream.println (" if (__method == null)"); - stream.println (" throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);"); - stream.println (); - if (methodList.size () > 0) - { - stream.println (" switch (__method.intValue ())"); - stream.println (" {"); - - // Write the method case statements - int realI = 0; - for (int i = 0; i < methodList.size (); ++i) - { - MethodEntry method = (MethodEntry)methodList.elementAt (i); - ((MethodGen)method.generator ()).dispatchSkeleton (symbolTable, method, stream, realI); - if (method instanceof AttributeEntry && !((AttributeEntry)method).readOnly ()) - realI += 2; - else - ++realI; - } - - indent = " "; - stream.println (indent + "default:"); - stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);"); - stream.println (" }"); - stream.println (); - } - stream.println (" return out;"); - } else { - stream.println(" throw new org.omg.CORBA.BAD_OPERATION();"); - } - stream.println (" } // _invoke"); - stream.println (); - } // writeDispatchMethod - - /** - * - **/ - protected void writeMethodTable () - { - // Write the methods hashtable - stream.println (" private static java.util.Hashtable _methods = new java.util.Hashtable ();"); - stream.println (" static"); - stream.println (" {"); - - int count = -1; - Enumeration e = methodList.elements (); - while (e.hasMoreElements ()) - { - MethodEntry method = (MethodEntry)e.nextElement (); - if (method instanceof AttributeEntry) - { - stream.println (" _methods.put (\"_get_" + Util.stripLeadingUnderscores (method.name ()) + "\", new java.lang.Integer (" + (++count) + "));"); - if (!((AttributeEntry)method).readOnly ()) - stream.println (" _methods.put (\"_set_" + Util.stripLeadingUnderscores (method.name ()) + "\", new java.lang.Integer (" + (++count) + "));"); - } - else - stream.println (" _methods.put (\"" + Util.stripLeadingUnderscores (method.name ()) + "\", new java.lang.Integer (" + (++count) + "));"); - } - stream.println (" }"); - stream.println (); - } // writeMethodTable - - /** - * - **/ - protected void writeMethods () - { - int realI = 0; - for (int i = 0; i < methodList.size (); ++i) - { - MethodEntry method = (MethodEntry)methodList.elementAt (i); - ((MethodGen)method.generator ()).skeleton - (symbolTable, method, stream, realI); - if (method instanceof AttributeEntry && - !((AttributeEntry)method).readOnly ()) - realI += 2; - else - ++realI; - stream.println (); - } - } // writeMethods - - /** - * - **/ - private void writeIDs () - { - Vector list = new Vector (); - buildIDList (i, list); - Enumeration e = list.elements (); - boolean first = true; - while (e.hasMoreElements ()) - { - if (first) - first = false; - else - stream.println (", "); - stream.print (" \"" + (String)e.nextElement () + '"'); - } - } // writeIDs - - /** - * - **/ - private void buildIDList (InterfaceEntry entry, Vector list) - { - if (!entry.fullName ().equals ("org/omg/CORBA/Object")) - { - String id = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()); - if (!list.contains (id)) - list.addElement (id); - Enumeration e = entry.derivedFrom ().elements (); - while (e.hasMoreElements ()) - buildIDList ((InterfaceEntry)e.nextElement (), list); - } - } // buildIDList - - /** - * - **/ - protected void writeCORBAOperations () - { - stream.println (" // Type-specific CORBA::Object operations"); - - stream.println (" private static String[] __ids = {"); - writeIDs (); - stream.println ("};"); - stream.println (); - if (poa) - writePOACORBAOperations(); - else - writeNonPOACORBAOperations(); - - } // writeCORBAOperations - - protected void writePOACORBAOperations(){ - stream.println (" public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)"); - //Right now, with our POA implementation, the same - //implementation of _ids() type methods seem to work for both non-POA - //as well as POA servers. We need to REVISIT since the equivalent - //POA interface, i.e. _all_interfaces, has parameters which are not being - //used in the _ids() implementation. - stream.println (" {"); - stream.println (" return (String[])__ids.clone ();"); - stream.println (" }"); - stream.println (); - //_this() - stream.println (" public "+ i.name() +" _this() "); - stream.println (" {"); - stream.println (" return "+ i.name() +"Helper.narrow(" ); - stream.println (" super._this_object());"); - stream.println (" }"); - stream.println (); - //_this(org.omg.CORBA.ORB orb) - stream.println (" public "+ i.name() +" _this(org.omg.CORBA.ORB orb) "); - stream.println (" {"); - stream.println (" return "+ i.name() +"Helper.narrow(" ); - stream.println (" super._this_object(orb));"); - stream.println (" }"); - stream.println (); - } - protected void writeNonPOACORBAOperations(){ - stream.println (" public String[] _ids ()"); - stream.println (" {"); - stream.println (" return (String[])__ids.clone ();"); - stream.println (" }"); - stream.println (); - } - /** - * - **/ - protected void writeOperations () - { - // _get_ids removed at Simon's request 8/26/98 - KLR - } // writeOperations - - protected Hashtable symbolTable = null; - protected InterfaceEntry i = null; - protected PrintWriter stream = null; - - // Unique to this generator - protected String tieClassName = null; - protected String skeletonClassName = null; - protected boolean tie = false; - protected boolean poa = false; - protected Vector methodList = null; - protected String intfName = ""; -} // class Skeleton --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java 2018-01-30 20:25:56.000000000 -0500 +++ /dev/null 2018-01-30 20:25:56.000000000 -0500 @@ -1,139 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D61056 Use Util.helperName - -import java.io.PrintWriter; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; - -/** - * Handles generation of CORBA strings as well as wstrings. Be careful - * not to forget the wstrings. - **/ -public class StringGen implements com.sun.tools.corba.se.idl.StringGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public StringGen () - { - } // ctor - - /** - * This should never be called. This class exists for the - * JavaGenerator interface. - **/ - public void generate (Hashtable symbolTable, StringEntry e, PrintWriter stream) - { - } // generate - - /////////////// - // From JavaGenerator - - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - return type(index, indent, tcoffsets, name, entry, stream); - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) { - tcoffsets.set (entry); - StringEntry stringEntry = (StringEntry)entry; - String bound; - if (stringEntry.maxSize () == null) - bound = "0"; - else - bound = Util.parseExpression (stringEntry.maxSize ()); - - // entry.name() is necessary to determine whether it is a - // string or wstring - - stream.println (indent - + name - + " = org.omg.CORBA.ORB.init ().create_" - + entry.name() - + "_tc (" - + bound + ");"); - return index; - } // type - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - } // helperRead - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - } // helperWrite - - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - StringEntry string = (StringEntry)entry; - String entryName = entry.name (); - if (entryName.equals ("string")) - stream.println (indent + name + " = istream.read_string ();"); - else if (entryName.equals ("wstring")) - stream.println (indent + name + " = istream.read_wstring ();"); - if (string.maxSize () != null) - { - stream.println (indent + "if (" + name + ".length () > (" + Util.parseExpression (string.maxSize ()) + "))"); - stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);"); - } - return index; - } // read - - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - StringEntry string = (StringEntry)entry; - if (string.maxSize () != null) - { - stream.print (indent + "if (" + name + ".length () > (" + Util.parseExpression (string.maxSize ()) + "))"); - stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);"); - } - String entryName = entry.name (); - if (entryName.equals ("string")) - stream.println (indent + "ostream.write_string (" + name + ");"); - else if (entryName.equals ("wstring")) - stream.println (indent + "ostream.write_wstring (" + name + ");"); - return index; - } // write - - // From JavaGenerator - /////////////// -} // class StringGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java 2018-01-30 20:25:57.000000000 -0500 +++ /dev/null 2018-01-30 20:25:57.000000000 -0500 @@ -1,455 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// - Think about arrays (and sequences?) as members -// - A sequence must be converted to an array, but a memory of the -// max size must be retained. -// - After demarshalling an IOR, think about how to deal with the exceptions. -// - The demarshall method should be throwing a ClientException, -// but should it, really? -// -D60929 Update for RTF2.4 changes -// -D61056 Use Util.helperName -// -D62023 Use corbaLevel in read/write generation -// -D59437 Modify read() to enit qualified name of value box helper. - -import java.io.File; -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.EnumEntry; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.StructEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.InterfaceState; - -/** - * - **/ -public class StructGen implements com.sun.tools.corba.se.idl.StructGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public StructGen () - { - } // ctor - - /** - * Constructor for ExceptionGen. - **/ - protected StructGen (boolean exception) - { - thisIsReallyAnException = exception; - } // ctor - - /** - * - **/ - public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str) - { - this.symbolTable = symbolTable; - this.s = s; - //init (); - - openStream (); - if (stream == null) - return; - generateHelper (); - generateHolder (); - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - generateContainedTypes (); - } // generate - - /** - * Initialize members unique to this generator. - **/ - protected void init () - { - } // init - - /** - * - **/ - protected void openStream () - { - stream = Util.stream (s, ".java"); - } // openStream - - /** - * - **/ - protected void generateHelper () - { - ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, s); - } // generateHelper - - /** - * - **/ - protected void generateHolder () - { - ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, s); - } // generateHolder - - /** - * - **/ - protected void writeHeading () - { - Util.writePackage (stream, s); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - - if (s.comment () != null) - s.comment ().generate ("", stream); - - stream.print ("public final class " + s.name ()); - if (thisIsReallyAnException) - stream.print (" extends org.omg.CORBA.UserException"); - else - stream.print(" implements org.omg.CORBA.portable.IDLEntity"); - stream.println (); - stream.println ("{"); - } // writeHeading - - /** - * - **/ - protected void writeBody () - { - writeMembers (); - writeCtors (); - } // writeBody - - /** - * - **/ - protected void writeClosing () - { - stream.println ("} // class " + s.name ()); - } // writeClosing - - /** - * - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - /** - * - **/ - protected void generateContainedTypes () - { - // Generate all of the contained types - Enumeration e = s.contained ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry entry = (SymtabEntry)e.nextElement (); - - // Don't generate contained entries if they are sequences. - // Sequences are unnamed and since they translate to arrays, - // no classes are generated for them, not even holders in this - // case since they cannot be accessed outside of this struct. - - if (!(entry instanceof SequenceEntry)) - entry.generate (symbolTable, stream); - } - } // generateContainedTypes - - /** - * - **/ - protected void writeMembers () - { - // Write members and populate quality arrays - int size = s.members ().size (); - memberIsPrimitive = new boolean [size]; - memberIsInterface = new boolean [size]; - memberIsTypedef = new boolean [size]; - for (int i = 0; i < s.members ().size (); ++i) - { - SymtabEntry member = (SymtabEntry)s.members ().elementAt (i); - memberIsPrimitive[i] = member.type () instanceof PrimitiveEntry; - memberIsInterface[i] = member.type () instanceof InterfaceEntry; - memberIsTypedef[i] = member.type () instanceof TypedefEntry; - Util.fillInfo (member); - // Transfer member comment to target <31jul1997>. - if (member.comment () != null) - member.comment ().generate (" ", stream); - Util.writeInitializer (" public ", member.name (), "", member, stream); - } - } // writeMembers - - /** - * - **/ - protected void writeCtors () - { - // Write default ctor - stream.println (); - stream.println (" public " + s.name () + " ()"); - stream.println (" {"); - // fixed mapping for exceptions - if (thisIsReallyAnException) - stream.println (" super(" + s.name() + "Helper.id());"); - stream.println (" } // ctor"); - writeInitializationCtor(true); - if (thisIsReallyAnException) { - // for exception according to mapping we should always - // have a full constructor - writeInitializationCtor(false); - } - } - - private void writeInitializationCtor(boolean init) - { - // Write initialization ctor - if (!init || (s.members ().size () > 0)) - { - stream.println (); - stream.print (" public " + s.name () + " ("); - boolean firstTime = true; - if (!init) { - stream.print ("String $reason"); - firstTime = false; - } - - for (int i = 0; i < s.members ().size (); ++i) - { - SymtabEntry member = (SymtabEntry)s.members ().elementAt (i); - if (firstTime) - firstTime = false; - else - stream.print (", "); - stream.print (Util.javaName (member) + " _" + member.name ()); - } - stream.println (")"); - stream.println (" {"); - // fixed mapping for exceptions - if (thisIsReallyAnException) { - if (init) - stream.println (" super(" + s.name() + "Helper.id());"); - else - stream.println (" super(" + s.name() + "Helper.id() + \" \" + $reason);"); - } - for (int i = 0; i < s.members ().size (); ++i) - { - SymtabEntry member = (SymtabEntry)s.members ().elementAt (i); - stream.println (" " + member.name () + " = _" + member.name () + ";"); - } - stream.println (" } // ctor"); - } - stream.println (); - } // writeInitializationCtor - - /////////////// - // From JavaGenerator - - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - TCOffsets innerOffsets = new TCOffsets (); - innerOffsets.set (entry); - int offsetForStruct = innerOffsets.currentOffset (); - StructEntry s = (StructEntry)entry; - String membersName = "_members" + index++; - stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + s.members ().size () + "];"); - String tcOfMembers = "_tcOf" + membersName; - stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;"); - for (int i = 0; i < s.members ().size (); ++i) - { - TypedefEntry member = (TypedefEntry)s.members ().elementAt (i); - String memberName = member.name (); - // Generate and assign member TypeCode to tcofMembers - index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream); - stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.StructMember ("); - stream.println (indent + " \"" + Util.stripLeadingUnderscores (memberName) + "\","); - stream.println (indent + " " + tcOfMembers + ','); - stream.println (indent + " null);"); - int offsetSoFar = innerOffsets.currentOffset (); - innerOffsets = new TCOffsets (); - innerOffsets.set (entry); - innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct); - - } - tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ()); - // <54697> - //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");"); - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_" + (thisIsReallyAnException ? "exception" : "struct") + "_tc (" + Util.helperName (s, true) + ".id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");"); // - return index; - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) { - stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // - return index; - } // type - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - stream.println (" " + entryName + " value = new " + entryName + " ();"); - read (0, " ", "value", entry, stream); - stream.println (" return value;"); - } // helperRead - - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - if (thisIsReallyAnException) - { - stream.println (indent + "// read and discard the repository ID"); - stream.println (indent + "istream.read_string ();"); - } - - Enumeration e = ((StructEntry)entry).members ().elements (); - while (e.hasMoreElements ()) - { - TypedefEntry member = (TypedefEntry)e.nextElement (); - SymtabEntry mType = member.type (); - - if (!member.arrayInfo ().isEmpty () || mType instanceof SequenceEntry || - mType instanceof PrimitiveEntry || mType instanceof StringEntry || - mType instanceof TypedefEntry) - index = ((JavaGenerator)member.generator ()).read (index, indent, name + '.' + member.name (), member, stream); - else if (mType instanceof ValueBoxEntry) - { - // call read_value instead of Helper.read for the value - Vector st = ((ValueBoxEntry) mType).state (); - TypedefEntry vbMember = ((InterfaceState) st.elementAt (0)).entry; - SymtabEntry vbType = vbMember.type (); - - String jName = null; - String jHelper = null; - - if (vbType instanceof SequenceEntry || vbType instanceof StringEntry || - !vbMember.arrayInfo ().isEmpty ()) - { - jName = Util.javaName (vbType); // name of mapped Java type - // REVISIT. Typename info. now correct for value boxes, so - // these two cases may be obsolete. See UnionGen.read(). - //jHelper = Util.helperName (vbType, false); // - jHelper = Util.helperName (mType, true); - } - else - { - jName = Util.javaName (mType); // name of mapped Java class - // - //jHelper = Util.helperName (mType, false); // - jHelper = Util.helperName (mType, true); - } - // Call xHelper.read() for valueboxes for RTF2.4 - if (Util.corbaLevel (2.4f, 99.0f)) - stream.println (indent + name + '.' + member.name () + " = (" + jName + ") " + jHelper + ".read (istream);"); - else - stream.println (indent + name + '.' + member.name () + " = (" + jName + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + jHelper + ".get_instance ());"); // - } - // for corbaLevel 2.4 and up, use Helper.read like - // everything else - else if ((mType instanceof ValueEntry) && - !Util.corbaLevel (2.4f, 99.0f)) // - { - // call read_value instead of Helper.read for the value - stream.println (indent + name + '.' + member.name () + " = (" + Util.javaName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, false) + ".get_instance ());"); // // - } - else - stream.println (indent + name + '.' + member.name () + " = " + Util.helperName (member.type (), true) + ".read (istream);"); // - } - return index; - } // read - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - write (0, " ", "value", entry, stream); - } // helperWrite - - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - if (thisIsReallyAnException) - { - stream.println (indent + "// write the repository ID"); - stream.println (indent + "ostream.write_string (id ());"); - } - - Vector members = ((StructEntry)entry).members (); - for (int i = 0; i < members.size (); ++i) - { - TypedefEntry member = (TypedefEntry)members.elementAt (i); - SymtabEntry mType = member.type (); - - if (!member.arrayInfo ().isEmpty () || mType instanceof SequenceEntry || - mType instanceof TypedefEntry || mType instanceof PrimitiveEntry || - mType instanceof StringEntry) - index = ((JavaGenerator)member.generator ()).write (index, " ", name + '.' + member.name (), member, stream); - - // for corbaLevel 2.4 and up, use Helper.write like - // everything else - else if ((mType instanceof ValueEntry || mType instanceof ValueBoxEntry) - && !Util.corbaLevel (2.4f, 99.0f)) { // - stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) " // - + name + '.' + member.name () + ", " - + Util.helperName (member.type (), true) // - + ".get_instance ());"); // - } - else - stream.println (indent + Util.helperName (member.type (), true) + ".write (ostream, " + name + '.' + member.name () + ");"); // - } - return index; - } // write - - // From JavaGenerator - /////////////// - - protected Hashtable symbolTable = null; - protected StructEntry s = null; - protected PrintWriter stream = null; - - protected boolean thisIsReallyAnException = false; - private boolean[] memberIsPrimitive; - private boolean[] memberIsInterface; - private boolean[] memberIsTypedef; -} // class StructGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java 2018-01-30 20:25:58.000000000 -0500 +++ /dev/null 2018-01-30 20:25:58.000000000 -0500 @@ -1,380 +0,0 @@ -/* - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: - -import java.io.File; -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.AttributeEntry; -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; - -/** - * - **/ -public class Stub implements AuxGen -{ - /** - * Public zero-argument constructor. - **/ - public Stub () - { - } // ctor - - /** - * - **/ - public void generate (Hashtable symbolTable, SymtabEntry entry) - { - this.symbolTable = symbolTable; - this.i = (InterfaceEntry)entry; - this.localStub = i.isLocalServant(); - this.isAbstract = i.isAbstract( ); - init (); - - openStream (); - if (stream == null) - return; - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generate - - /** - * Initialize unique members of this generator. - **/ - protected void init () - { - classSuffix = "Stub"; - } // init - - /** - * - **/ - protected void openStream () - { - String name = '_' + i.name () + classSuffix; - String pkg = Util.containerFullName (i.container ()); - if (pkg != null && !pkg.equals ("")) - { - Util.mkdir (pkg); - name = pkg + '/' + name; - } - stream = Util.getStream (name.replace ('/', File.separatorChar) + ".java", i); - } // openStream - - /** - * - **/ - protected void writeHeading () - { - Util.writePackage (stream, i, Util.StubFile); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - - // Transfer interface comment to target <31jul1997>. - if (i.comment () != null) - i.comment ().generate ("", stream); - - writeClassDeclaration (); - stream.println ('{'); - } // writeHeading - - /** - * - **/ - protected void writeClassDeclaration () - { - stream.print ("public class _" + i.name () + classSuffix + " extends org.omg.CORBA.portable.ObjectImpl"); - stream.println (" implements " + Util.javaName (i)); - } // writeClassDeclaration - - /** - * Steps done within writeBody include: - * 1.) makeCtors (); - * 2.) buildMethodList (); - * 3.) makeMethods (); - * 4.) makeCORBAObjectMethods () - **/ - protected void writeBody () - { - writeCtors (); - buildMethodList (); - writeMethods (); - writeCORBAObjectMethods (); - writeSerializationMethods (); - } // writeBody - - /** - * - **/ - protected void writeClosing () - { - stream.println ("} // class _" + i.name () + classSuffix); - } // writeClosing - - /** - * - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - /** - * - **/ - protected void writeCtors () - { - String name = i.name (); - - /*** the constructors are not generated as per ptc/00-01-08.pdf - * since these are non-standard APIs, and same can be accomplished - * programatically, we need to comment this out, in order to - * be able to generate standard stubs - */ - - /************* - stream.println (" // Constructors"); - stream.println (" // NOTE: If the default constructor is used, the"); - stream.println (" // object is useless until _set_delegate (...)"); - stream.println (" // is called."); - stream.println (" public _" + name + classSuffix + " ()"); - stream.println (" {"); - stream.println (" super ();"); - stream.println (" }"); - stream.println (); - stream.println (" public _" + name + classSuffix + " (org.omg.CORBA.portable.Delegate delegate)"); - stream.println (" {"); - stream.println (" super ();"); - stream.println (" _set_delegate (delegate);"); - stream.println (" }"); - ***************/ - // This is confusing since we have localOptimization flag as well. - // We have left this code because JCK team filed a P1 bug for changing - // _opsClass to $opsClass. Will clean it up in Tiger - // _REVISIT_ (Hemanth 03/05/2002) - if (localStub) { - stream.println (" final public static java.lang.Class _opsClass = " + - name + "Operations.class;"); - stream.println (); - } - stream.println (); - } // writeCtors - - /** - * Build a list of all of the methods, keeping out duplicates. - **/ - protected void buildMethodList () - { - // Start from scratch - methodList = new Vector (); - - buildMethodList (i); - } // buildMethodList - - /** - * - **/ - private void buildMethodList (InterfaceEntry entry) - { - // Add the local methods - Enumeration locals = entry.methods ().elements (); - while (locals.hasMoreElements ()) - addMethod ((MethodEntry)locals.nextElement ()); - - // Add the inherited methods - Enumeration parents = entry.derivedFrom ().elements (); - while (parents.hasMoreElements ()) - { - InterfaceEntry parent = (InterfaceEntry)parents.nextElement (); - if (!parent.name ().equals ("Object")) - buildMethodList (parent); - } - } // buildMethodList - - /** - * - **/ - private void addMethod (MethodEntry method) - { - if (!methodList.contains (method)) - methodList.addElement (method); - } // addMethod - - /** - * - **/ - protected void writeMethods () - { - // Count the methods, attributes which are not readonly are - // counted as 2 methods. - int count = methodList.size (); - Enumeration e = methodList.elements (); - while (e.hasMoreElements ()) - { - Object method = e.nextElement (); - if (method instanceof AttributeEntry && !((AttributeEntry)method).readOnly ()) - ++count; - } - - if( (((Arguments)Compile.compiler.arguments).LocalOptimization ) - && !isAbstract ) - { - stream.println( " final public static java.lang.Class _opsClass =" ); - stream.println( " " + this.i.name() + "Operations.class;" ); - } - - // Write the methods - int realI = 0; - for (int i = 0; i < methodList.size (); ++i) - { - MethodEntry method = (MethodEntry)methodList.elementAt (i); - if (!localStub) { - ((MethodGen)method.generator ()).stub (this.i.name(), isAbstract, symbolTable, method, stream, realI); - } else { - ((MethodGen)method.generator ()).localstub (symbolTable, method, stream, realI, this.i); - } - if (method instanceof AttributeEntry && !((AttributeEntry)method).readOnly ()) - realI += 2; - else - ++realI; - } - } // writeMethods - - /** - * - **/ - private void buildIDList (InterfaceEntry entry, Vector list) - { - if (!entry.fullName ().equals ("org/omg/CORBA/Object")) - { - String id = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()); - if (!list.contains (id)) - list.addElement (id); - Enumeration e = entry.derivedFrom ().elements (); - while (e.hasMoreElements ()) - buildIDList ((InterfaceEntry)e.nextElement (), list); - } - } // buildIDList - - /** - * - **/ - private void writeIDs () - { - Vector list = new Vector (); - buildIDList (i, list); - Enumeration e = list.elements (); - boolean first = true; - while (e.hasMoreElements ()) - { - if (first) - first = false; - else - stream.println (", "); - stream.print (" \"" + (String)e.nextElement () + '"'); - } - } // writeIDs - - /** - * - **/ - protected void writeCORBAObjectMethods () - { - stream.println (" // Type-specific CORBA::Object operations"); - stream.println (" private static String[] __ids = {"); - writeIDs (); - stream.println ("};"); - stream.println (); - stream.println (" public String[] _ids ()"); - stream.println (" {"); - stream.println (" return (String[])__ids.clone ();"); - stream.println (" }"); - stream.println (); - } // writeCORBAObjectMethods - - /** - * - **/ - protected void writeSerializationMethods () - { - stream.println (" private void readObject (java.io.ObjectInputStream s) throws java.io.IOException"); - stream.println (" {"); - stream.println (" String str = s.readUTF ();"); - stream.println (" String[] args = null;"); - stream.println (" java.util.Properties props = null;"); - stream.println (" org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);"); - stream.println (" try {"); - stream.println (" org.omg.CORBA.Object obj = orb.string_to_object (str);"); - stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();"); - stream.println (" _set_delegate (delegate);"); - stream.println (" } finally {"); - stream.println (" orb.destroy() ;"); - stream.println (" }"); - stream.println (" }"); - stream.println (); - stream.println (" private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException"); - stream.println (" {"); - stream.println (" String[] args = null;"); - stream.println (" java.util.Properties props = null;"); - stream.println (" org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);"); - stream.println (" try {"); - stream.println (" String str = orb.object_to_string (this);"); - stream.println (" s.writeUTF (str);"); - stream.println (" } finally {"); - stream.println (" orb.destroy() ;"); - stream.println (" }"); - stream.println (" }"); - } - - protected Hashtable symbolTable = null; - protected InterfaceEntry i = null; - protected PrintWriter stream = null; - - // Unique to this generator - protected Vector methodList = null; - protected String classSuffix = ""; - protected boolean localStub = false; - private boolean isAbstract = false; -} // class Stub --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java 2018-01-30 20:25:58.000000000 -0500 +++ /dev/null 2018-01-30 20:25:59.000000000 -0500 @@ -1,145 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: - -import java.util.Enumeration; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.*; - -// This class is passed through the JavaGenerator.HelperType methods. -// It is ONLY used when a recursive sequence is detected. ie. -// -// struct S1 -// { -// sequence others; -// }; - -/** - * - **/ -public class TCOffsets -{ - /** - * Return -1 if the given name is not in the list of types. - **/ - public int offset (String name) - { - Integer value = (Integer)tcs.get (name); - return value == null ? -1 : value.intValue (); - } // offset - - /** - * - **/ - public void set (SymtabEntry entry) - { - if (entry == null) - offset += 8; - else - { - tcs.put (entry.fullName (), new Integer (offset)); - offset += 4; - String repID = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()); - if (entry instanceof InterfaceEntry) - offset += alignStrLen (repID) + alignStrLen (entry.name ()); - else if (entry instanceof StructEntry) - offset += alignStrLen (repID) + alignStrLen (entry.name ()) + 4; - else if (entry instanceof UnionEntry) - offset += alignStrLen (repID) + alignStrLen (entry.name ()) + 12; - else if (entry instanceof EnumEntry) - { - offset += alignStrLen (repID) + alignStrLen (entry.name ()) + 4; - Enumeration e = ((EnumEntry)entry).elements ().elements (); - while (e.hasMoreElements ()) - offset += alignStrLen ((String)e.nextElement ()); - } - else if (entry instanceof StringEntry) - offset += 4; - else if (entry instanceof TypedefEntry) - { - offset += alignStrLen (repID) + alignStrLen (entry.name ()); - if (((TypedefEntry)entry).arrayInfo ().size () != 0) - offset += 8; - } - } - } // set - - /** - * Return the full length of the string type: 4 byte length, x bytes for - * string + 1 for the null terminator, align it so it ends on a 4-byte - * boundary. This method assumes the string starts at a 4-byte boundary - * since it doesn't do any leading alignment. - **/ - public int alignStrLen (String string) - { - int len = string.length () + 1; - int align = 4 - (len % 4); - if (align == 4) align = 0; - return len + align + 4; - } // alignStrLen - - /** - * - **/ - public void setMember (SymtabEntry entry) - { - offset += alignStrLen (entry.name ()); - if (((TypedefEntry)entry).arrayInfo ().size () != 0) - offset += 4; - } // setMember - - /** - * - **/ - public int currentOffset () - { - return offset; - } // currentOffset - - /** - * - **/ - public void bumpCurrentOffset (int value) - { - offset += value; - } // bumpCurrentOffset - - private Hashtable tcs = new Hashtable (); - private int offset = 0; -} // class TCOffsets --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java 2018-01-30 20:25:59.000000000 -0500 +++ /dev/null 2018-01-30 20:25:59.000000000 -0500 @@ -1,326 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -11aug1997 No modification: comments for type_defs will appear in -// helper, holder classes as a result of modifications to routines -// makeHelper(), makeHolder() in class com.sun.tools.corba.se.idl.toJava.Util. -// -F46082.51 Remove -stateful feature; javaStatefulName() obsolete. -// -D61056 Use Util.helperName - -import java.io.PrintWriter; - -import java.util.Enumeration; -import java.util.Hashtable; - -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.StructEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.UnionEntry; - -import com.sun.tools.corba.se.idl.constExpr.Expression; - -// Notes: - -/** - * - **/ -public class TypedefGen implements com.sun.tools.corba.se.idl.TypedefGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public TypedefGen () - { - } // ctor - - /** - * - **/ - public void generate (Hashtable symbolTable, TypedefEntry t, PrintWriter stream) - { - this.symbolTable = symbolTable; - this.t = t; - - if (t.arrayInfo ().size () > 0 || t.type () instanceof SequenceEntry) - generateHolder (); - generateHelper (); - } // generator - - /** - * - **/ - protected void generateHolder () - { - ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, t); - } - - /** - * - **/ - protected void generateHelper () - { - ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, t); - } - - /////////////// - // From JavaGenerator - - private boolean inStruct (TypedefEntry entry) - { - boolean inStruct = false; - if (entry.container () instanceof StructEntry || entry.container () instanceof UnionEntry) - inStruct = true; - else if (entry.container () instanceof InterfaceEntry) - { - InterfaceEntry i = (InterfaceEntry)entry.container (); - if (i.state () != null) - { - Enumeration e = i.state ().elements (); - while (e.hasMoreElements ()) - if (((InterfaceState)e.nextElement ()).entry == entry) - { - inStruct = true; - break; - } - } - } - return inStruct; - } // inStruct - - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - TypedefEntry td = (TypedefEntry)entry; - boolean inStruct = inStruct (td); - if (inStruct) - tcoffsets.setMember (entry); - else - tcoffsets.set (entry); - - // Print the base types typecode - index = ((JavaGenerator)td.type ().generator ()).type (index, indent, tcoffsets, name, td.type (), stream); - - if (inStruct && td.arrayInfo ().size () != 0) - tcoffsets.bumpCurrentOffset (4); // for array length field - - // Print the array typecodes (if there are any) - int dimensions = td.arrayInfo ().size (); - for (int i = 0; i < dimensions; ++i) - { - String size = Util.parseExpression ((Expression)td.arrayInfo ().elementAt (i)); - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_array_tc (" + size + ", " + name + " );"); - } - - // If this typedef describes a struct/union member, don't put it - // in an alias typedef; otherwise that's where it belongs. - if (!inStruct) - // <54697> - //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_alias_tc (id (), \"" + Util.stripLeadingUnderscores (td.name ()) + "\", " + name + ");"); - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_alias_tc (" + Util.helperName (td, true) + ".id (), \"" + Util.stripLeadingUnderscores (td.name ()) + "\", " + name + ");"); // - - return index; - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - // The type() method is invoked from other emitters instead of when an IDL - // typedef statement is being processed. Code generated is identical minus the - // generation of a create_alias_tc() which is required for IDL typedef's but not - // needed when typedef is being processed as a member of struct/union/valuetype. - - return helperType( index, indent, tcoffsets, name, entry, stream); - } // type - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - Util.writeInitializer (" ", "value", "", entry, stream); - read (0, " ", "value", entry, stream); - stream.println (" return value;"); - } // helperRead - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - write (0, " ", "value", entry, stream); - } // helperWrite - - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - TypedefEntry td = (TypedefEntry)entry; - String modifier = Util.arrayInfo (td.arrayInfo ()); - if (!modifier.equals ("")) - { - // arrayInfo is a vector of Expressions which indicate the - // number of array dimensions for this typedef. But what if - // this is a typedef of a sequence? - // The `new' statement being generated must know the full - // number of brackets. That can be found in td.info. - // For instance: - // typedef sequence A[10][10]; - // void proc (out A a); - // typeModifier = "[10][10]" - // td.info = "short[][][]"; - // The first new statement generated is: - // a.value = new short[10][][]; - // Note that the 3 sets of brackets come from td.info, not - // arrayInfo; - // The second new statement generated is: - // a.value[_i1] = new short[10][]; - // ------------ ---- ------ - // \ \ \ - // name baseName arrayDcl - int closingBrackets = 0; - String loopIndex = ""; - String baseName; - try - { - baseName = (String)td.dynamicVariable (Compile.typedefInfo); - } - catch (NoSuchFieldException e) - { - baseName = td.name (); - } - int startArray = baseName.indexOf ('['); - String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop. - baseName = baseName.substring (0, startArray); - - // For interfaces having state, e.g., valuetypes. - SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/')); - if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null) - // Remove -stateful feature; javaStatefulName() obsolete. - //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry); - baseName = Util.javaName ((InterfaceEntry)baseEntry); - - int end1stArray; - while (!modifier.equals ("")) - { - int rbracket = modifier.indexOf (']'); - String size = modifier.substring (1, rbracket); - end1stArray = arrayDcl.indexOf (']'); - arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2); - stream.println (indent + name + " = new " + baseName + arrayDcl + ';'); - loopIndex = "_o" + index++; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')'); - stream.println (indent + '{'); - ++closingBrackets; - modifier = modifier.substring (rbracket + 1); - indent = indent + " "; - name = name + '[' + loopIndex + ']'; - } - end1stArray = arrayDcl.indexOf (']'); - if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry) - index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream); - else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object")) - stream.println (indent + name + " = istream.read_Object ();"); - else - stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // - for (int i = 0; i < closingBrackets; ++i) - { - indent = indent.substring (2); - stream.println (indent + '}'); - } - } - else - { - SymtabEntry tdtype = Util.typeOf (td.type ()); - if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry) - index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream); - else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object")) - stream.println (indent + name + " = istream.read_Object ();"); - else - stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // - } - return index; - } // read - - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - TypedefEntry td = (TypedefEntry)entry; - String modifier = Util.arrayInfo (td.arrayInfo ()); - if (!modifier.equals ("")) - { - int closingBrackets = 0; - String loopIndex = ""; - while (!modifier.equals ("")) - { - int rbracket = modifier.indexOf (']'); - String size = modifier.substring (1, rbracket); - stream.println (indent + "if (" + name + ".length != (" + size + "))"); - stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);"); - loopIndex = "_i" + index++; - stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')'); - stream.println (indent + '{'); - ++closingBrackets; - modifier = modifier.substring (rbracket + 1); - indent = indent + " "; - name = name + '[' + loopIndex + ']'; - } - if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry) - index = ((JavaGenerator)td.type ().generator ()).write (index, indent, name, td.type (), stream); - else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object")) - stream.println (indent + "ostream.write_Object (" + name + ");"); - else - stream.println (indent + Util.helperName (td.type (), true) + ".write (ostream, " + name + ");"); // - for (int i = 0; i < closingBrackets; ++i) - { - indent = indent.substring (2); - stream.println (indent + '}'); - } - } - else - { - SymtabEntry tdtype = Util.typeOf (td.type ()); - if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry) - index = ((JavaGenerator)tdtype.generator ()).write (index, indent, name, tdtype, stream); - else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object")) - stream.println (indent + "ostream.write_Object (" + name + ");"); - else - stream.println (indent + Util.helperName (tdtype, true) + ".write (ostream, " + name + ");"); // - } - return index; - } // write - - // From JavaGenerator - //////////////// - - protected Hashtable symbolTable = null; - protected TypedefEntry t = null; -} // class TypedefGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java 2018-01-30 20:26:00.000000000 -0500 +++ /dev/null 2018-01-30 20:26:00.000000000 -0500 @@ -1,1074 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -cast() does not support longlong types yet. -// -Deal with typedef changes. -// -Scoped names for the discriminator are ignored at the moment. -// -F46082.51 Remove -stateful feature; javaStatefulName() obsolete. -// -D61056 Use Util.helperName - -import java.io.File; -import java.io.IOException; -import java.io.PrintWriter; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.ConstEntry; -import com.sun.tools.corba.se.idl.EnumEntry; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.UnionBranch; -import com.sun.tools.corba.se.idl.UnionEntry; - -import com.sun.tools.corba.se.idl.constExpr.Expression; -import com.sun.tools.corba.se.idl.constExpr.EvaluationException; - -/** - * - **/ -public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public UnionGen () - { - } // ctor - - /** - * - **/ - public void generate (Hashtable symbolTable, UnionEntry u, PrintWriter s) - { - this.symbolTable = symbolTable; - this.u = u; - init (); - - openStream (); - if (stream == null) - return; - generateHelper (); - generateHolder (); - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - generateContainedTypes (); - } // generate - - /** - * Initialize members unique to this generator. - **/ - protected void init () - { - utype = Util.typeOf (u.type ()); - unionIsEnum = utype instanceof EnumEntry; - } // init - - /** - * - **/ - protected void openStream () - { - stream = Util.stream (u, ".java"); - } // openStream - - /** - * - **/ - protected void generateHelper () - { - ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, u); - } // generateHelper - - /** - * - **/ - protected void generateHolder () - { - ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, u); - } // generateHolder - - /** - * - **/ - protected void writeHeading () - { - // If the discriminator is an enum, assign the typePackage string. - if (unionIsEnum) - typePackage = Util.javaQualifiedName (utype) + '.'; - else - typePackage = ""; - - Util.writePackage (stream, u); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - - String className = u.name (); - stream.println ("public final class " + u.name () + " implements org.omg.CORBA.portable.IDLEntity"); - stream.println ("{"); - } // writeHeading - - /** - * - **/ - protected void writeBody () - { - // Write branches and populate quality arrays - int size = u.branches ().size () + 1; - Enumeration e = u.branches ().elements (); - int i = 0; - while (e.hasMoreElements ()) - { - UnionBranch branch = (UnionBranch)e.nextElement (); - Util.fillInfo (branch.typedef); - // Remove -stateful feature; javaStatefulName() obsolete. - //stream.println (" private " + Util.javaStatefulName (branch.typedef) + " ___" + branch.typedef.name () + ";"); - stream.println (" private " + Util.javaName (branch.typedef) + " ___" + branch.typedef.name () + ";"); - ++i; - } - stream.println (" private " + Util.javaName (utype) + " __discriminator;"); - stream.println (" private boolean __uninitialized = true;"); - - // Write ctor - stream.println (); - stream.println (" public " + u.name () + " ()"); - stream.println (" {"); - stream.println (" }"); - - // Write discriminator - stream.println (); - stream.println (" public " + Util.javaName (utype) + " " + safeName (u, "discriminator") + " ()"); - stream.println (" {"); - stream.println (" if (__uninitialized)"); - stream.println (" throw new org.omg.CORBA.BAD_OPERATION ();"); - stream.println (" return __discriminator;"); - stream.println (" }"); - - // Write for each branch: - // - setter - // - getter - // - private verifyXXX - e = u.branches ().elements (); - i = 0; - while (e.hasMoreElements ()) - { - UnionBranch branch = (UnionBranch)e.nextElement (); - writeBranchMethods (stream, u, branch, i++); - } - if (u.defaultBranch () == null && !coversAll (u)) - { - stream.println (); - stream.println (" public void _default ()"); - stream.println (" {"); - stream.println (" __discriminator = " + defaultDiscriminator (u) + ';'); - stream.println (" __uninitialized = false;"); - stream.println (" }"); - - stream.println (); - stream.println (" public void _default (" + Util.javaName(utype) + - " discriminator)"); - stream.println (" {"); - stream.println (" verifyDefault( discriminator ) ;" ); - stream.println (" __discriminator = discriminator ;"); - stream.println (" __uninitialized = false;"); - stream.println (" }"); - - writeVerifyDefault() ; - } - stream.println (); - } // writeBody - - /** - * - **/ - protected void writeClosing () - { - stream.println ("} // class " + u.name ()); - } // writeClosing - - /** - * - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - /** - * - **/ - protected void generateContainedTypes () - { - Enumeration e = u.contained ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry entry = (SymtabEntry)e.nextElement (); - - // Don't generate contained entries if they are sequences. - // Sequences are unnamed and since they translate to arrays, - // no classes are generated for them, not even holders in this - // case since they cannot be accessed outside of this union. - if (!(entry instanceof SequenceEntry)) - entry.generate (symbolTable, stream); - } - } // generateContainedTypes - - private void writeVerifyDefault() - { - Vector labels = vectorizeLabels (u.branches (), true); - - if (Util.javaName(utype).equals ("boolean")) { - stream.println( "" ) ; - stream.println( " private void verifyDefault (boolean discriminator)" ) ; - stream.println( " {" ) ; - if (labels.contains ("true")) - stream.println (" if ( discriminator )"); - else - stream.println (" if ( !discriminator )"); - stream.println( " throw new org.omg.CORBA.BAD_OPERATION();" ) ; - stream.println( " }" ) ; - return; - } - - stream.println( "" ) ; - stream.println( " private void verifyDefault( " + Util.javaName(utype) + - " value )" ) ; - stream.println( " {" ) ; - - if (unionIsEnum) - stream.println( " switch (value.value()) {" ) ; - else - stream.println( " switch (value) {" ) ; - - Enumeration e = labels.elements() ; - while (e.hasMoreElements()) { - String str = (String)(e.nextElement()) ; - stream.println( " case " + str + ":" ) ; - } - - stream.println( " throw new org.omg.CORBA.BAD_OPERATION() ;" ) ; - stream.println( "" ) ; - stream.println( " default:" ) ; - stream.println( " return;" ) ; - stream.println( " }" ) ; - stream.println( " }" ) ; - } - - private String defaultDiscriminator (UnionEntry u) - { - Vector labels = vectorizeLabels (u.branches (), false ); - String ret = null; - SymtabEntry utype = Util.typeOf (u.type ()); - if (utype instanceof PrimitiveEntry && utype.name ().equals ("boolean")) { - // If it got this far, then: - // - there is only one branch; - // - that branch has only one label. - if (labels.contains ("true")) - ret = "false"; - else - ret = "true"; - } else if (utype.name ().equals ("char")) { - // This doesn't handle '\u0030' == '0'. Unions are so - // seldom used. I don't have time to make this perfect. - int def = 0; - String string = "'\\u0000'"; - while (def != 0xFFFF && labels.contains (string)) - if (++def / 0x10 == 0) - string = "'\\u000" + def + "'"; - else if (def / 0x100 == 0) - string = "\\u00" + def + "'"; - else if (def / 0x1000 == 0) - string = "\\u0" + def + "'"; - else - string = "\\u" + def + "'"; - ret = string; - } else if (utype instanceof EnumEntry) { - Enumeration e = labels.elements (); - EnumEntry enumEntry = (EnumEntry)utype; - Vector enumList = (Vector)enumEntry.elements ().clone (); - // cull out those elements in the enumeration list that are - // in the cases of this union - while (e.hasMoreElements ()) - enumList.removeElement (e.nextElement ()); - // If all of the enum elements are covered in this union and - // there is a default statement, just pick one of the - // elements for the default. If there are enum elements - // which are NOT covered by the cases, pick one as the - // default. - if (enumList.size () == 0) - ret = typePackage + (String)enumEntry.elements ().lastElement (); - else - ret = typePackage + (String)enumList.firstElement (); - } else if (utype.name ().equals ("octet")) { - short def = Byte.MIN_VALUE; - while (def != Byte.MAX_VALUE && labels.contains (Integer.toString (def))) - ++def; - ret = Integer.toString (def); - } else if (utype.name ().equals ("short")) { - short def = Short.MIN_VALUE; - while (def != Short.MAX_VALUE && labels.contains (Integer.toString (def))) - ++def; - ret = Integer.toString (def); - } else if (utype.name ().equals ("long")) { - int def = Integer.MIN_VALUE; - while (def != Integer.MAX_VALUE && labels.contains (Integer.toString (def))) - ++def; - ret = Integer.toString (def); - } else if (utype.name ().equals ("long long")) { - long def = Long.MIN_VALUE; - while (def != Long.MAX_VALUE && labels.contains (Long.toString (def))) - ++def; - ret = Long.toString (def); - } else if (utype.name ().equals ("unsigned short")) { - short def = 0; - while (def != Short.MAX_VALUE && labels.contains (Integer.toString (def))) - ++def; - ret = Integer.toString (def); - } else if (utype.name ().equals ("unsigned long")) { - int def = 0; - while (def != Integer.MAX_VALUE && labels.contains (Integer.toString (def))) - ++def; - ret = Integer.toString (def); - } else if (utype.name ().equals ("unsigned long long")) { - long def = 0; - while (def != Long.MAX_VALUE && labels.contains (Long.toString (def))) - ++def; - ret = Long.toString (def); - } - - return ret; - } // defaultDiscriminator - - /** - * - **/ - private Vector vectorizeLabels (Vector branchVector, boolean useIntsForEnums ) - { - Vector mergedLabels = new Vector (); - Enumeration branches = branchVector.elements (); - while (branches.hasMoreElements ()) - { - UnionBranch branch = (UnionBranch)branches.nextElement (); - Enumeration labels = branch.labels.elements (); - while (labels.hasMoreElements ()) - { - Expression expr = (Expression)labels.nextElement (); - String str ; - - if (unionIsEnum) - if (useIntsForEnums) - str = typePackage + "_" + Util.parseExpression( expr ) ; - else - str = typePackage + Util.parseExpression( expr ) ; - else - str = Util.parseExpression( expr ) ; - - mergedLabels.addElement (str); - } - } - return mergedLabels; - } // vectorizeLabels - - /** - * - **/ - private String safeName (UnionEntry u, String name) - { - Enumeration e = u.branches ().elements (); - while (e.hasMoreElements ()) - if (((UnionBranch)e.nextElement ()).typedef.name ().equals (name)) - { - name = '_' + name; - break; - } - return name; - } // safeName - - /** - * - **/ - private boolean coversAll (UnionEntry u) - { - // This assumes that it is not possible to cover types other than - // boolean and enums. This is not quite correct, but since octet - // is not a valid discriminator type, it's not too bad in practice. - // It may also be possible to cover a char type, but we won't worry - // about that either. - SymtabEntry utype = Util.typeOf (u.type ()); - - boolean coversAll = false; - if (utype.name ().equals ("boolean")) { - if (u.branches ().size () == 2) - coversAll = true; - } else if (utype instanceof EnumEntry) { - Vector labels = vectorizeLabels (u.branches (), true); - if (labels.size () == ((EnumEntry)utype).elements ().size ()) - coversAll = true; - } - - return coversAll; - } // coversAll - - /** - * - **/ - private void writeBranchMethods (PrintWriter stream, UnionEntry u, UnionBranch branch, int i) - { - // Write getter - stream.println (); - // Remove -stateful feature; javaStatefulName() obsolete. - //stream.println (" public " + Util.javaStatefulName (branch.typedef) + " " + branch.typedef.name () + " ()"); - stream.println (" public " + Util.javaName (branch.typedef) + " " + branch.typedef.name () + " ()"); - stream.println (" {"); - stream.println (" if (__uninitialized)"); - stream.println (" throw new org.omg.CORBA.BAD_OPERATION ();"); - stream.println (" verify" + branch.typedef.name () + " (__discriminator);"); - stream.println (" return ___" + branch.typedef.name () + ";"); - stream.println (" }"); - - // Write setter(s) - stream.println (); - // Remove -stateful feature; javaStatefulName() obsolete. - //stream.println (" public void " + branch.typedef.name () + " (" + Util.javaStatefulName (branch.typedef) + " value)"); - stream.println (" public void " + branch.typedef.name () + " (" + Util.javaName (branch.typedef) + " value)"); - stream.println (" {"); - if (branch.labels.size () == 0) - { - // This is a default branch - stream.println (" __discriminator = " + defaultDiscriminator (u) + ";"); - } - else - { - // This is a non-default branch - if (unionIsEnum) - stream.println (" __discriminator = " + typePackage + Util.parseExpression ((Expression)branch.labels.firstElement ()) + ";"); - else - stream.println (" __discriminator = " + cast ((Expression)branch.labels.firstElement (), u.type ()) + ";"); - } - stream.println (" ___" + branch.typedef.name () + " = value;"); - stream.println (" __uninitialized = false;"); - stream.println (" }"); - - SymtabEntry utype = Util.typeOf (u.type ()); - - // If there are multiple labels for one branch, write the - // setter that takes a discriminator. - if (branch.labels.size () > 0 || branch.isDefault) - { - stream.println (); - // Remove -stateful feature; javaStatefulName() obsolete. - //stream.println (" public void " + branch.typedef.name () + " (" + Util.javaName (utype) + " discriminator, " + Util.javaStatefulName (branch.typedef) + " value)"); - stream.println (" public void " + branch.typedef.name () + " (" + Util.javaName (utype) + " discriminator, " + Util.javaName (branch.typedef) + " value)"); - stream.println (" {"); - stream.println (" verify" + branch.typedef.name () + " (discriminator);"); - stream.println (" __discriminator = discriminator;"); - stream.println (" ___" + branch.typedef.name () + " = value;"); - stream.println (" __uninitialized = false;"); - stream.println (" }"); - } - - // Write verifyXXX - stream.println (); - stream.println (" private void verify" + branch.typedef.name () + " (" + Util.javaName (utype) + " discriminator)"); - stream.println (" {"); - - boolean onlyOne = true; - - if (branch.isDefault && u.branches ().size () == 1) - ;// If all that is in this union is a default branch, - // all discriminators are legal. Don't print any - // body to this method in that case. - else - { - // Otherwise this code is executed and a body is printed. - stream.print (" if ("); - if (branch.isDefault) - { - Enumeration eBranches = u.branches ().elements (); - while (eBranches.hasMoreElements ()) - { - UnionBranch b = (UnionBranch)eBranches.nextElement (); - if (b != branch) - { - Enumeration eLabels = b.labels.elements (); - while (eLabels.hasMoreElements ()) - { - Expression label = (Expression)eLabels.nextElement (); - if (!onlyOne) - stream.print (" || "); - if (unionIsEnum) - stream.print ("discriminator == " + typePackage + Util.parseExpression (label)); - else - stream.print ("discriminator == " + Util.parseExpression (label)); - onlyOne = false; - } - } - } - } - else - { - Enumeration e = branch.labels.elements (); - while (e.hasMoreElements ()) - { - Expression label = (Expression)e.nextElement (); - if (!onlyOne) - stream.print (" && "); - if (unionIsEnum) - stream.print ("discriminator != " + typePackage + Util.parseExpression (label)); - else - stream.print ("discriminator != " + Util.parseExpression (label)); - onlyOne = false; - } - } - stream.println (")"); - stream.println (" throw new org.omg.CORBA.BAD_OPERATION ();"); - } - stream.println (" }"); - } // writeBranchMethods - - /////////////// - // From JavaGenerator - - /** - * - **/ - - // Computes the total number of labels in the union, which is the sum - // of the number of labels in each branch of the union. Note that the - // label for the default branch has size 0, but still counts in the total - // size. - private int unionLabelSize( UnionEntry un ) - { - int size = 0 ; - Vector branches = un.branches() ; - for (int i = 0; i < branches.size (); ++i) { - UnionBranch branch = (UnionBranch)(branches.get(i)) ; - int branchSize = branch.labels.size() ; - size += ((branchSize == 0) ? 1 : branchSize) ; - } - return size ; - } - - public int helperType (int index, String indent, TCOffsets tcoffsets, - String name, SymtabEntry entry, PrintWriter stream) - { - TCOffsets innerOffsets = new TCOffsets (); - UnionEntry u = (UnionEntry)entry; - String discTypeCode = "_disTypeCode" + index; - String membersName = "_members" + index; - - // Build discriminator tc - stream.println (indent + "org.omg.CORBA.TypeCode " + discTypeCode + ';'); - index = ((JavaGenerator)u.type ().generator ()).type (index + 1, indent, - innerOffsets, discTypeCode, u.type (), stream); - tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ()); - - stream.println (indent + "org.omg.CORBA.UnionMember[] " + membersName + - " = new org.omg.CORBA.UnionMember [" + unionLabelSize(u) + "];"); - String tcOfMembers = "_tcOf" + membersName; - String anyOfMembers = "_anyOf" + membersName; - stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + ';'); - stream.println (indent + "org.omg.CORBA.Any " + anyOfMembers + ';'); - - innerOffsets = new TCOffsets (); - innerOffsets.set (entry); - int offsetForUnion = innerOffsets.currentOffset (); - for (int i = 0; i < u.branches ().size (); ++i) { - UnionBranch branch = (UnionBranch)u.branches ().elementAt (i); - TypedefEntry member = branch.typedef; - Vector labels = branch.labels; - String memberName = Util.stripLeadingUnderscores (member.name ()); - - if (labels.size() == 0) { - stream.println (); - stream.println (indent + "// Branch for " + memberName + - " (Default case)" ); - SymtabEntry utype = Util.typeOf (u.type ()); - stream.println (indent + anyOfMembers + " = org.omg.CORBA.ORB.init ().create_any ();"); - // For default member, label is the zero octet (per CORBA spec.) - stream.println (indent + anyOfMembers + ".insert_octet ((byte)0); // default member label"); - - // Build typecode - innerOffsets.bumpCurrentOffset (4); // label value - index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream); - int offsetSoFar = innerOffsets.currentOffset (); - innerOffsets = new TCOffsets (); - innerOffsets.set (entry); - innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForUnion); - - // Build union member - stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.UnionMember ("); - stream.println (indent + " \"" + memberName + "\","); - stream.println (indent + " " + anyOfMembers + ','); - stream.println (indent + " " + tcOfMembers + ','); - stream.println (indent + " null);"); - } else { - Enumeration enumeration = labels.elements() ; - while (enumeration.hasMoreElements()) { - Expression expr = (Expression)(enumeration.nextElement()) ; - String elem = Util.parseExpression( expr ) ; - - stream.println (); - stream.println (indent + "// Branch for " + memberName + - " (case label " + elem + ")" ); - - SymtabEntry utype = Util.typeOf (u.type ()); - - // Build any - stream.println (indent + anyOfMembers + " = org.omg.CORBA.ORB.init ().create_any ();"); - - if (utype instanceof PrimitiveEntry) - stream.println (indent + anyOfMembers + ".insert_" + - Util.collapseName (utype.name ()) + " ((" + Util.javaName (utype) + - ')' + elem + ");"); - else { // it must be enum - String enumClass = Util.javaName (utype); - stream.println (indent + Util.helperName (utype, false) + ".insert (" + - anyOfMembers + ", " + enumClass + '.' + elem + ");"); // - } - - // Build typecode - innerOffsets.bumpCurrentOffset (4); // label value - index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream); - int offsetSoFar = innerOffsets.currentOffset (); - innerOffsets = new TCOffsets (); - innerOffsets.set (entry); - innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForUnion); - - // Build union member - stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.UnionMember ("); - stream.println (indent + " \"" + memberName + "\","); - stream.println (indent + " " + anyOfMembers + ','); - stream.println (indent + " " + tcOfMembers + ','); - stream.println (indent + " null);"); - } - } - } - - tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ()); - - // Build create_union_tc - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_union_tc (" + - Util.helperName (u, true) + ".id (), \"" + entry.name () + "\", " + - discTypeCode + ", " + membersName + ");"); - return index; - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, - SymtabEntry entry, PrintWriter stream) - { - stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); - return index; - } - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - stream.println (" " + entryName + " value = new " + entryName + " ();"); - read (0, " ", "value", entry, stream); - stream.println (" return value;"); - } - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - write (0, " ", "value", entry, stream); - } - - public int read (int index, String indent, String name, - SymtabEntry entry, PrintWriter stream) - { - UnionEntry u = (UnionEntry)entry; - String disName = "_dis" + index++; - SymtabEntry utype = Util.typeOf (u.type ()); - Util.writeInitializer (indent, disName, "", utype, stream); - - if (utype instanceof PrimitiveEntry) - index = ((JavaGenerator)utype.generator ()).read (index, indent, disName, utype, stream); - else - stream.println (indent + disName + " = " + Util.helperName (utype, true) + ".read (istream);"); - - if (utype.name ().equals ("boolean")) - index = readBoolean (disName, index, indent, name, u, stream); - else - index = readNonBoolean (disName, index, indent, name, u, stream); - - return index; - } - - private int readBoolean (String disName, int index, String indent, - String name, UnionEntry u, PrintWriter stream) - { - UnionBranch firstBranch = (UnionBranch)u.branches ().firstElement (); - UnionBranch secondBranch; - - if (u.branches ().size () == 2) - secondBranch = (UnionBranch)u.branches ().lastElement (); - else - secondBranch = null; - - boolean firstBranchIsTrue = false; - boolean noCases = false; - try { - if (u.branches ().size () == 1 && - (u.defaultBranch () != null || firstBranch.labels.size () == 2)) { - noCases = true; - } else { - Expression expr = (Expression)(firstBranch.labels.firstElement()) ; - Boolean bool = (Boolean)(expr.evaluate()) ; - firstBranchIsTrue = bool.booleanValue (); - } - } catch (EvaluationException ex) { - // no action - } - - if (noCases) { - // There is only a default label. Since there are no cases, - // there is no need for if...else branches. - index = readBranch (index, indent, firstBranch.typedef.name (), "", firstBranch.typedef, stream); - } else { - // If first branch is false, swap branches - if (!firstBranchIsTrue) { - UnionBranch tmp = firstBranch; - firstBranch = secondBranch; - secondBranch = tmp; - } - - stream.println (indent + "if (" + disName + ')'); - - if (firstBranch == null) - stream.println (indent + " value._default(" + disName + ");"); - else { - stream.println (indent + '{'); - index = readBranch (index, indent + " ", firstBranch.typedef.name (), - disName, firstBranch.typedef, stream); - stream.println (indent + '}'); - } - - stream.println (indent + "else"); - - if (secondBranch == null) - stream.println (indent + " value._default(" + disName + ");"); - else { - stream.println (indent + '{'); - index = readBranch (index, indent + " ", secondBranch.typedef.name (), - disName, secondBranch.typedef, stream); - stream.println (indent + '}'); - } - } - - return index; - } - - private int readNonBoolean (String disName, int index, String indent, - String name, UnionEntry u, PrintWriter stream) - { - SymtabEntry utype = Util.typeOf (u.type ()); - - if (utype instanceof EnumEntry) - stream.println (indent + "switch (" + disName + ".value ())"); - else - stream.println (indent + "switch (" + disName + ')'); - - stream.println (indent + '{'); - String typePackage = Util.javaQualifiedName (utype) + '.'; - - Enumeration e = u.branches ().elements (); - while (e.hasMoreElements ()) { - UnionBranch branch = (UnionBranch)e.nextElement (); - Enumeration labels = branch.labels.elements (); - - while (labels.hasMoreElements ()) { - Expression label = (Expression)labels.nextElement (); - - if (utype instanceof EnumEntry) { - String key = Util.parseExpression (label); - stream.println (indent + " case " + typePackage + '_' + key + ':'); - } else - stream.println (indent + " case " + cast (label, utype) + ':'); - } - - if (!branch.typedef.equals (u.defaultBranch ())) { - index = readBranch (index, indent + " ", branch.typedef.name (), - branch.labels.size() > 1 ? disName : "" , - branch.typedef, stream); - stream.println (indent + " break;"); - } - } - - // We need a default branch unless all of the case of the discriminator type - // are listed in the case branches. - if (!coversAll(u)) { - stream.println( indent + " default:") ; - - if (u.defaultBranch () == null) { - // If the union does not have a default branch, we still need to initialize - // the discriminator. - stream.println( indent + " value._default( " + disName + " ) ;" ) ; - } else { - index = readBranch (index, indent + " ", u.defaultBranch ().name (), disName, - u.defaultBranch (), stream); - } - - stream.println (indent + " break;"); - } - - stream.println (indent + '}'); - - return index; - } - - private int readBranch (int index, String indent, String name, String disName, TypedefEntry entry, PrintWriter stream) - { - SymtabEntry type = entry.type (); - Util.writeInitializer (indent, '_' + name, "", entry, stream); - - if (!entry.arrayInfo ().isEmpty () || - type instanceof SequenceEntry || - type instanceof PrimitiveEntry || - type instanceof StringEntry) { - index = ((JavaGenerator)entry.generator ()).read (index, indent, '_' + name, entry, stream); - } else { - stream.println (indent + '_' + name + " = " + Util.helperName (type, true) + ".read (istream);"); - } - - stream.print (indent + "value." + name + " ("); - if( disName == "" ) - stream.println("_" + name + ");"); - else - stream.println(disName + ", " + "_" + name + ");"); - - return index; - } - - /** - * - **/ - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - UnionEntry u = (UnionEntry)entry; - SymtabEntry utype = Util.typeOf (u.type ()); - if (utype instanceof PrimitiveEntry) - index = ((JavaGenerator)utype.generator ()).write (index, indent, name + ".discriminator ()", utype, stream); - else - stream.println (indent + Util.helperName (utype, true) + ".write (ostream, " + name + ".discriminator ());"); // - if (utype.name ().equals ("boolean")) - index = writeBoolean (name + ".discriminator ()", index, indent, name, u, stream); - else - index = writeNonBoolean (name + ".discriminator ()", index, indent, name, u, stream); - return index; - } // write - - /** - * - **/ - private int writeBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream) - { - SymtabEntry utype = Util.typeOf (u.type ()); - UnionBranch firstBranch = (UnionBranch)u.branches ().firstElement (); - UnionBranch secondBranch; - if (u.branches ().size () == 2) - secondBranch = (UnionBranch)u.branches ().lastElement (); - else - secondBranch = null; - boolean firstBranchIsTrue = false; - boolean noCases = false; - try - { - if (u.branches ().size () == 1 && (u.defaultBranch () != null || firstBranch.labels.size () == 2)) - noCases = true; - else - firstBranchIsTrue = ((Boolean)((Expression)firstBranch.labels.firstElement ()).evaluate ()).booleanValue (); - } - catch (EvaluationException ex) - {} - - if (noCases) - { - // There is only a default label. Since there are no cases, - // there is no need for if...else branches. - index = writeBranch (index, indent, name, firstBranch.typedef, stream); - } - else - { - // If first branch is false, swap branches - if (!firstBranchIsTrue) - { - UnionBranch tmp = firstBranch; - firstBranch = secondBranch; - secondBranch = tmp; - } - if (firstBranch != null && secondBranch != null) { - stream.println (indent + "if (" + disName + ')'); - stream.println (indent + '{'); - index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream); - stream.println (indent + '}'); - stream.println (indent + "else"); - stream.println (indent + '{'); - index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream); - stream.println (indent + '}'); - } else if (firstBranch != null) { - stream.println (indent + "if (" + disName + ')'); - stream.println (indent + '{'); - index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream); - stream.println (indent + '}'); - } else { - stream.println (indent + "if (!" + disName + ')'); - stream.println (indent + '{'); - index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream); - stream.println (indent + '}'); - } - } - return index; - } // writeBoolean - - /** - * - **/ - private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream) - { - SymtabEntry utype = Util.typeOf (u.type ()); - if (utype instanceof EnumEntry) - stream.println (indent + "switch (" + name + ".discriminator ().value ())"); - else - stream.println (indent + "switch (" + name + ".discriminator ())"); - stream.println (indent + "{"); - String typePackage = Util.javaQualifiedName (utype) + '.'; - Enumeration e = u.branches ().elements (); - while (e.hasMoreElements ()) - { - UnionBranch branch = (UnionBranch)e.nextElement (); - Enumeration labels = branch.labels.elements (); - while (labels.hasMoreElements ()) - { - Expression label = (Expression)labels.nextElement (); - if (utype instanceof EnumEntry) - { - String key = Util.parseExpression (label); - stream.println (indent + " case " + typePackage + '_' + key + ":"); - } - else - stream.println (indent + " case " + cast (label, utype) + ':'); - } - if (!branch.typedef.equals (u.defaultBranch ())) - { - index = writeBranch (index, indent + " ", name, branch.typedef, stream); - stream.println (indent + " break;"); - } - } - if (u.defaultBranch () != null) { - stream.println (indent + " default:"); - index = writeBranch (index, indent + " ", name, u.defaultBranch (), stream); - stream.println (indent + " break;"); - } - stream.println (indent + "}"); - return index; - } // writeNonBoolean - - /** - * - **/ - private int writeBranch (int index, String indent, String name, TypedefEntry entry, PrintWriter stream) - { - SymtabEntry type = entry.type (); - if (!entry.arrayInfo ().isEmpty () || type instanceof SequenceEntry || type instanceof PrimitiveEntry || type instanceof StringEntry) - index = ((JavaGenerator)entry.generator ()).write (index, indent, name + '.' + entry.name () + " ()", entry, stream); - else - stream.println (indent + Util.helperName (type, true) + ".write (ostream, " + name + '.' + entry.name () + " ());"); // - return index; - } // writeBranch - - // From JavaGenerator - /////////////// - - /** - * - **/ - private String cast (Expression expr, SymtabEntry type) - { - String ret = Util.parseExpression (expr); - if (type.name ().indexOf ("short") >= 0) - { - if (expr.value () instanceof Long) - { - long value = ((Long)expr.value ()).longValue (); - if (value > Short.MAX_VALUE) - ret = "(short)(" + ret + ')'; - } - else if (expr.value () instanceof Integer) - { - int value = ((Integer)expr.value ()).intValue (); - if (value > Short.MAX_VALUE) - ret = "(short)(" + ret + ')'; - } - } - else if (type.name ().indexOf ("long") >= 0) - { - if (expr.value () instanceof Long) - { - long value = ((Long)expr.value ()).longValue (); - // value == Integer.MIN_VALUE because if the number is - // Integer.MIN_VALUE, then it will have the 'L' suffix and - // the cast will be necessary. - if (value > Integer.MAX_VALUE || value == Integer.MIN_VALUE) - ret = "(int)(" + ret + ')'; - } - else if (expr.value () instanceof Integer) - { - int value = ((Integer)expr.value ()).intValue (); - // value == Integer.MIN_VALUE because if the number is - // Integer.MIN_VALUE, then it will have the 'L' suffix and - // the cast will be necessary. - if (value > Integer.MAX_VALUE || value == Integer.MIN_VALUE) - ret = "(int)(" + ret + ')'; - } - } - return ret; - } // cast - - protected Hashtable symbolTable = null; - protected UnionEntry u = null; - protected PrintWriter stream = null; - protected SymtabEntry utype = null; - protected boolean unionIsEnum; - protected String typePackage = ""; -} // class UnionGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java 2018-01-30 20:26:01.000000000 -0500 +++ /dev/null 2018-01-30 20:26:01.000000000 -0500 @@ -1,1429 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// Notes: -// -F46838.4 Ported -td option from toJava. -// -10/17/98 KLR Ported fix for d48911 from toJava -// -10/18/98 KLR Ported fix from toJava for "unsigned long" constants -// -F46082.51 Removed code to collect makefile list generation inforamtion -// from getStream(); see f46830. -// -F46082.51 Removed -stateful feature: methods javaStatefulName(String) -// and javaStatefulName(SymtabEntry) are obsolete, supplanted by javaName(). -// -D54640 Represent unsigned long long expressions with their computed -// value rather than their actual representation (see notes in method -// parseTerminal(), parseBinary(), and parseUnary().) -// -D58319 Add getVersion() method. -// -D48034 Import Helper classes for typedef struct members when generating -// helper. See method addImportLines(). -// -D59851 Modify to enable QuickTest build. (pending) -// -D42256 Determine import lines for template types, which may specify any -// positive int., constant expression for a boundary. Such expression containing -// non-literal contansts previously caused problems when appearing in constructs -// structs, unions, exceptions, typedefs, operation types and parameters, -// attributes; and of course, sequences, strings. -// -D59063 Add helper for global exception to stub import list. -// -D58951 Publicise members for QuickTest. -// -D59421 Change ValueBaseHolder to SerializableHolder -// -D59596 Prevent accesses to elements of empty Vectors. -// -D59771 Add import stmt for Helper of global type in stubs. -// -D59355 Remove target dir. from filename when writing to prolog. -// -D59437 Fill typename information for value boxes. -// -D62023 Don't import ValueBase* -// -D62023 Add corbaLevel - -import java.io.File; -import java.io.PrintWriter; -import java.math.BigInteger; -import java.text.DateFormat; -import java.util.Date; -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Locale; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.ConstEntry; -import com.sun.tools.corba.se.idl.EnumEntry; -import com.sun.tools.corba.se.idl.ExceptionEntry; -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.NativeEntry; -import com.sun.tools.corba.se.idl.ParameterEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.StructEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.UnionBranch; -import com.sun.tools.corba.se.idl.UnionEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.InterfaceState; - -import com.sun.tools.corba.se.idl.constExpr.*; - -/** - * Class Util is a repository of static members available for general - * use by the IDL parser framework and any generator extensions. - **/ -public class Util extends com.sun.tools.corba.se.idl.Util -{ - // - /** - * Fetch the version number of this build of the IDL-to-Java (portable) - * compiler from the appropriate properties file. - * @return the version number of this compiler build. - **/ - public static String getVersion () - { - return com.sun.tools.corba.se.idl.Util.getVersion ("com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp"); - } // getVersion - - /** - * This method is called by Setup.preEmit, so - * symbolTable is available for all Util methods. - **/ - static void setSymbolTable (Hashtable symtab) - { - symbolTable = symtab; - } // setSymbolTable - - public static void setPackageTranslation( Hashtable pkgtrans ) - { - packageTranslation = pkgtrans ; - } - - public static boolean isInterface (String name) - { - return isInterface (name, symbolTable); - } // isInterface - - static String arrayInfo (Vector arrayInfo) - { - int arrays = arrayInfo.size (); - String info = ""; - Enumeration e = arrayInfo.elements (); - while (e.hasMoreElements ()) - info = info + '[' + parseExpression ((Expression)e.nextElement ()) + ']'; - return info; - } // arrayInfo - - // static String sansArrayInfo (Vector arrayInfo) - public static String sansArrayInfo (Vector arrayInfo) - { - int arrays = arrayInfo.size (); - String brackets = ""; - for (int i = 0; i < arrays; ++i) - brackets = brackets + "[]"; - return brackets; - } // sansArrayInfo - - // static String sansArrayInfo (String name) - static public String sansArrayInfo (String name) - { - int index = name.indexOf ('['); - if (index >= 0) - { - String array = name.substring (index); - name = name.substring (0, index); - while (!array.equals ("")) - { - name = name + "[]"; - array = array.substring (array.indexOf (']') + 1); - } - } - return name; - } // sansArrayInfo - - /** - * Given a symbol table entry, return the name of - * the file which should be created. - **/ - public static String fileName (SymtabEntry entry, String extension ) - { - NameModifier nm = new NameModifierImpl() ; - return fileName( entry, nm, extension ) ; - } // fileName - - public static String fileName (SymtabEntry entry, NameModifier modifier, String extension ) - { - // This may not be the most appropriate place for - // the mkdir calls, but it's common to everything: - String pkg = containerFullName (entry.container ()); - if (pkg != null && !pkg.equals ("")) - mkdir (pkg); - - String name = entry.name (); - name = modifier.makeName( name ) + extension ; - if (pkg != null && !pkg.equals ("")) - name = pkg + '/' + name; - - return name.replace ('/', File.separatorChar); - } // fileName - - public static GenFileStream stream (SymtabEntry entry, String extension) - { - NameModifier nm = new NameModifierImpl() ; - return stream(entry, nm, extension); - } // stream - - public static GenFileStream stream (SymtabEntry entry, NameModifier modifier, String extension ) - { - return getStream ( fileName (entry,modifier,extension), entry ) ; - } - - public static GenFileStream getStream (String name, SymtabEntry entry) - { - // - String absPathName = ((Arguments)Compile.compiler.arguments).targetDir + name; - if (Compile.compiler.arguments.keepOldFiles && new File (absPathName).exists ()) - return null; - else - // Write the data to the file stream - return new GenFileStream (absPathName); - } // getStream - - public static String containerFullName( SymtabEntry container) - { - String name = doContainerFullName( container ) ; - if (packageTranslation.size() > 0) - name = translate( name ) ; - return name ; - } - - public static String translate( String name ) - { - String head = name ; - String tail = "" ; - int index ; - String trname ; - - // Check for package name translations, starting with the - // most specific match. - do { - trname = (String)(packageTranslation.get( head )) ; - if (trname != null) - return trname + tail ; - - index = head.lastIndexOf( '/' ) ; - if (index >= 0) { - tail = head.substring( index ) + tail ; - head = head.substring( 0, index ) ; - } - } while (index >= 0) ; - - return name ; - } - - private static String doContainerFullName (SymtabEntry container) - { - String name = ""; - - if (container == null) - name = ""; - else - { - if (container instanceof InterfaceEntry || - container instanceof StructEntry || - container instanceof UnionEntry) - name = container.name () + "Package"; - else - name = container.name (); - - if (container.container () != null && - !container.container ().name ().equals ("")) - name = doContainerFullName (container.container ()) + '/' + name; - } - - return name; - } // doContainerFullName - - /** - * Given a SymtabEntry, return the string which should be used - * for this entry. Enums are converted to ints, typedefs and - * sequences are converted to their info types. javaQualifiedName - * does not do any of these conversions. - **/ - public static String javaName (SymtabEntry entry) - { - // First get the real name of this type - String name = ""; - if (entry instanceof TypedefEntry || entry instanceof SequenceEntry) - try - { - name = sansArrayInfo ((String)entry.dynamicVariable (Compile.typedefInfo)); - } - catch (NoSuchFieldException e) - { - name = entry.name (); - } - else if (entry instanceof PrimitiveEntry) - name = javaPrimName (entry.name ()); - else if (entry instanceof StringEntry) - name = "String"; - else if (entry instanceof NativeEntry) - name = javaNativeName (entry.name()); - else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase")) - name = "java.io.Serializable"; - else if (entry instanceof ValueBoxEntry) - { - ValueBoxEntry v = (ValueBoxEntry) entry; - TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry; - SymtabEntry mType = member.type (); - if (mType instanceof PrimitiveEntry) - { - name = containerFullName (entry.container ()); - if (!name.equals ("")) - name = name + '.'; - name = name + entry.name (); - } - else - name = javaName (mType); - } - else - { - name = containerFullName (entry.container ()); - if (name.equals ("")) - name = entry.name (); - else - name = name + '.' + entry.name (); - } - - // Make it a fully package-qualified name - return name.replace ('/', '.'); - } // javaName - - public static String javaPrimName (String name) - { - if (name.equals ("long") || name.equals ("unsigned long")) - name = "int"; - else if (name.equals ("octet")) - name = "byte"; - // "unisigned long long" exceeds Java long. - else if (name.equals ("long long") || name.equals ("unsigned long long")) - name = "long"; - else if (name.equals ("wchar")) - name = "char"; - else if (name.equals ("unsigned short")) - name = "short"; - else if (name.equals ("any")) - name = "org.omg.CORBA.Any"; - else if (name.equals ("TypeCode")) - name = "org.omg.CORBA.TypeCode"; - else if (name.equals ("Principal")) // - name = "org.omg.CORBA.Principal"; - return name; - } // javaPrimName - - public static String javaNativeName (String name) - { - - // translations for Native declarations according to CORBA 2.3 spec - - if (name.equals ("AbstractBase") || name.equals ("Cookie")) - name = "java.lang.Object"; - else if (name.equals ("Servant")) - name = "org.omg.PortableServer.Servant"; - else if (name.equals ("ValueFactory")) - name = "org.omg.CORBA.portable.ValueFactory"; - return name; - } - - - /** - * Given a symtabEntry, return the name of this entry. This - * method does not do any conversions like javaName does. - **/ - public static String javaQualifiedName (SymtabEntry entry) - { - String name = ""; - if (entry instanceof PrimitiveEntry) - name = javaPrimName (entry.name ()); - else if (entry instanceof StringEntry) - name = "String"; - else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase")) - name = "java.io.Serializable"; - else - { - SymtabEntry container = entry.container (); - if (container != null) - name = container.name (); - if (name.equals ("")) - name = entry.name (); - else - name = containerFullName (entry.container ()) + '.' + entry.name (); - } - return name.replace ('/', '.'); - } // javaQualifiedName - - // Publicize for extensions. - //static String collapseName (String name) - - /** - * Collapse primitive type names. - **/ - public static String collapseName (String name) - { - if (name.equals ("unsigned short")) - name = "ushort"; - else if (name.equals ("unsigned long")) - name = "ulong"; - else if (name.equals ("unsigned long long")) - name = "ulonglong"; - else if (name.equals ("long long")) - name = "longlong"; - return name; - } // collapseName - - /** - * - **/ - public static SymtabEntry typeOf (SymtabEntry entry) - { - while (entry instanceof TypedefEntry && ((TypedefEntry)entry).arrayInfo ().isEmpty () && !(entry.type () instanceof SequenceEntry)) - entry = entry.type (); - return entry; - } // typeOf - - /** - * Fill the info field with the full name (with array info) of the type. - **/ - static void fillInfo (SymtabEntry infoEntry) - { - String arrayInfo = ""; - SymtabEntry entry = infoEntry; - boolean alreadyHave = false; - - do - { - try - { - alreadyHave = entry.dynamicVariable (Compile.typedefInfo) != null; - } - catch (NoSuchFieldException e) - {} - // If this entry's info has already been processed - // don't bother processing it again, just take it. - if (!alreadyHave) - { - if (entry instanceof TypedefEntry) - arrayInfo = arrayInfo + arrayInfo (((TypedefEntry)entry).arrayInfo ()); - else if (entry instanceof SequenceEntry) - { - Expression maxSize = ((SequenceEntry)entry).maxSize (); - if (maxSize == null) - arrayInfo = arrayInfo + "[]"; - else - arrayInfo = arrayInfo + '[' + parseExpression (maxSize) + ']'; - } - if (entry.type () == null) - { - // Suppress this message. It tells the developer nothing, and - // this path does not cause the algorithm to fail. Value boxes may - // contain anonymous types, like a struct or enum. - //System.err.println (getMessage ("PreEmit.indeterminateTypeInfo", entry.typeName ())); - } - else - entry = entry.type (); - } - } while (!alreadyHave && entry != null && - (entry instanceof TypedefEntry || entry instanceof SequenceEntry)); - // Value boxes may contain types lacking typename info., which - // causes the 2nd case, below, to fail with exception when retrieving the - // javaName(). - if (entry instanceof ValueBoxEntry) - fillValueBoxInfo ((ValueBoxEntry)entry); - try - { - if (alreadyHave) - infoEntry.dynamicVariable (Compile.typedefInfo, (String)entry.dynamicVariable (Compile.typedefInfo) + arrayInfo); - else - infoEntry.dynamicVariable (Compile.typedefInfo, javaName (entry) + arrayInfo); - } - catch (NoSuchFieldException e) - {} - } // fillInfo - - // - /** - * - **/ - static void fillValueBoxInfo (ValueBoxEntry vb) - { - SymtabEntry stateMember = (((InterfaceState) vb.state ().elementAt (0)).entry); - if (stateMember.type() != null) - Util.fillInfo (stateMember.type ()); - Util.fillInfo (stateMember); - } // fillValueBoxInfo - - /** - * - **/ - public static String holderName (SymtabEntry entry) - { - String name; - if (entry instanceof PrimitiveEntry) - if (entry.name ().equals ("any")) - name = "org.omg.CORBA.AnyHolder"; - else if (entry.name ().equals ("TypeCode")) - name = "org.omg.CORBA.TypeCodeHolder"; - else if (entry.name ().equals ("Principal")) // - name = "org.omg.CORBA.PrincipalHolder"; - else - name = "org.omg.CORBA." + capitalize (javaQualifiedName (entry)) + "Holder"; - else if (entry instanceof TypedefEntry) - { - TypedefEntry td = (TypedefEntry)entry; - if (!td.arrayInfo ().isEmpty () || td.type () instanceof SequenceEntry) - name = javaQualifiedName (entry) + "Holder"; - else - name = holderName (entry.type ()); - } - else if (entry instanceof StringEntry) - name = "org.omg.CORBA.StringHolder"; - else if (entry instanceof ValueEntry) - { - if (entry.name ().equals ("ValueBase")) - name = "org.omg.CORBA.ValueBaseHolder"; // , - else - name = javaName (entry) + "Holder"; - } else if (entry instanceof NativeEntry) { - // do not attach holder to the translation for Native Entries, e.g. - // for Cookie it should be CookieHolder instead of java.lang.ObjectHolder - // returns the complete name for the package, etc. - name = javaQualifiedName(entry) + "Holder"; - } - else - name = javaName (entry) + "Holder"; - return name; - } // holderName - - /** - * d61056 - **/ - public static String helperName (SymtabEntry entry, boolean qualifiedName) - { - if (entry instanceof ValueEntry) - if (entry.name ().equals ("ValueBase")) - return "org.omg.CORBA.ValueBaseHelper"; - - if (qualifiedName) - return javaQualifiedName (entry) + "Helper"; - else - return javaName (entry) + "Helper"; - } // helperName - - public static final short - TypeFile = 0, - StubFile = 1, - HelperFile = 2, - HolderFile = 3, - StateFile = 4; - - /** - * - **/ - public static void writePackage (PrintWriter stream, SymtabEntry entry) - { - writePackage (stream, entry, TypeFile); - } // writePackage - - /** - * - **/ - public static void writePackage (PrintWriter stream, SymtabEntry entry, String name, short type) - { - if (name != null && !name.equals ("")) - { - stream.println ("package " + name.replace ('/', '.') + ';'); - - // This type is in a module. Just in case it refers to types - // in the unnamed module, add an import statement for each of - // those types. - if (!Compile.compiler.importTypes.isEmpty ()) - { - stream.println (); - Vector v = addImportLines (entry, Compile.compiler.importTypes, type); - printImports (v, stream); - } - } - } // writePackage - - /** - * - **/ - public static void writePackage (PrintWriter stream, SymtabEntry entry, short type) - { - String fullName = containerFullName (entry.container ()); - if (fullName != null && !fullName.equals ("")) - { - stream.println ("package " + fullName.replace ('/', '.') + ';'); - // This type is in a module. Just in case it refers to types - // in the unnamed module, add an import statement for each of - // those types. - if ((type != HolderFile || entry instanceof TypedefEntry) && !Compile.compiler.importTypes.isEmpty ()) - { - stream.println (); - Vector v = addImportLines (entry, Compile.compiler.importTypes, type); - printImports (v, stream); - } - /* - Enumeration e = Compile.compiler.importTypes.elements (); - while (e.hasMoreElements ()) - { - SymtabEntry i = (SymtabEntry)e.nextElement (); - // Write import for type - if (!(i instanceof TypedefEntry)) - stream.println ("import " + i.name () + ';'); - - // Write import for Helper - if (!(i instanceof ConstEntry)) - stream.println ("import " + i.name () + "Helper;"); - - // Write import for Holder - if (!(i instanceof ConstEntry)) - if (!(i instanceof TypedefEntry) || (i.type () instanceof SequenceEntry || !((TypedefEntry)i).arrayInfo ().isEmpty ())) - stream.println ("import " + i.name () + "Holder;"); - } - */ - } - } // writePackage - - /** - * - **/ - static private void printImports (Vector importList, PrintWriter stream) - { - Enumeration e = importList.elements (); - while (e.hasMoreElements ()) - stream.println ("import " + (String)e.nextElement () + ';'); - } // printImport - - /** - * - **/ - static private void addTo (Vector importList, String name) - { - // REVISIT - was also importing ValueBaseHolder and Helper - if (name.startsWith ("ValueBase")) // don't import ValueBase* - if ((name.compareTo ("ValueBase") == 0) || - (name.compareTo ("ValueBaseHolder") == 0) || - (name.compareTo ("ValueBaseHelper") == 0)) - return; - if (!importList.contains (name)) - importList.addElement (name); - } // addTo - - /** - * - **/ - static private Vector addImportLines (SymtabEntry entry, Vector importTypes, short type) - { - Vector importList = new Vector (); - if (entry instanceof ConstEntry) - { - ConstEntry c = (ConstEntry)entry; - Object cvalue = c.value ().value (); - if (cvalue instanceof ConstEntry && importTypes.contains (cvalue)) - addTo (importList, ((ConstEntry)cvalue).name ()); - } - else if (entry instanceof ValueEntry && type == HelperFile) // - { - // This code inspired by ValueGen.getConcreteBaseTypeCode(). Helper method - // type() could be invoked against a global valuetype. - if (((ValueEntry)entry).derivedFrom ().size () > 0) // <59596> KLR HACK - { - ValueEntry base = (ValueEntry)((ValueEntry)entry).derivedFrom ().elementAt (0); - String baseName = base.name (); - if (!"ValueBase".equals (baseName)) - if (importTypes.contains (base)) - addTo (importList, baseName + "Helper"); - } - } - else if (entry instanceof InterfaceEntry && (type == TypeFile || type == StubFile)) - { - InterfaceEntry i = (InterfaceEntry)entry; - - if (i instanceof ValueEntry) // - { - // Examine interface parents in supports vector. - Enumeration e = ((ValueEntry)i).supports ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry parent = (SymtabEntry)e.nextElement (); - if (importTypes.contains (parent)) - { - addTo (importList, parent.name () + "Operations"); - } - // If this is a stub, then recurse to the parents - if (type == StubFile) - { - if (importTypes.contains (parent)) - addTo (importList, parent.name ()); - Vector subImportList = addImportLines (parent, importTypes, StubFile); - Enumeration en = subImportList.elements (); - while (en.hasMoreElements ()) - { - addTo (importList, (String)en.nextElement ()); - } - } - } - } - // Interface or valuetype -- Examine interface and valuetype parents, - // Look through derivedFrom vector - Enumeration e = i.derivedFrom ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry parent = (SymtabEntry)e.nextElement (); - if (importTypes.contains (parent)) - { - addTo (importList, parent.name ()); - // Always add both imports, even though superfluous. Cannot - // tell when writing Operations or Signature interface! - if (!(parent instanceof ValueEntry)) // && parent.name ().equals ("ValueBase"))) - addTo (importList, parent.name () + "Operations"); - } - // If this is a stub, then recurse to the parents - if (type == StubFile) - { - Vector subImportList = addImportLines (parent, importTypes, StubFile); - Enumeration en = subImportList.elements (); - while (en.hasMoreElements ()) - { - addTo (importList, (String)en.nextElement ()); - } - } - } - // Look through methods vector - e = i.methods ().elements (); - while (e.hasMoreElements ()) - { - MethodEntry m = (MethodEntry)e.nextElement (); - - // Look at method type - SymtabEntry mtype = typeOf (m.type ()); - if (mtype != null && importTypes.contains (mtype)) - if (type == TypeFile || type == StubFile) - { - addTo (importList, mtype.name ()); - addTo (importList, mtype.name () + "Holder"); - if (type == StubFile) - addTo (importList, mtype.name () + "Helper"); - } - checkForArrays (mtype, importTypes, importList); - // Print import lines for globals constants and constants - // within global interfaces. - if (type == StubFile) - checkForBounds (mtype, importTypes, importList); - - // Look through exceptions - Enumeration exEnum = m.exceptions ().elements (); - while (exEnum.hasMoreElements ()) - { - ExceptionEntry ex = (ExceptionEntry)exEnum.nextElement (); - if (importTypes.contains (ex)) - { - addTo (importList, ex.name ()); - addTo (importList, ex.name () + "Helper"); // - } - } - - // Look through parameters - Enumeration parms = m.parameters ().elements (); - while (parms.hasMoreElements ()) - { - ParameterEntry parm = (ParameterEntry)parms.nextElement (); - SymtabEntry parmType = typeOf (parm.type ()); - if (importTypes.contains (parmType)) - { - // Helper needed in stubs. - if (type == StubFile) - addTo (importList, parmType.name () + "Helper"); - if (parm.passType () == ParameterEntry.In) - addTo (importList, parmType.name ()); - else - addTo (importList, parmType.name () + "Holder"); - } - checkForArrays (parmType, importTypes, importList); - // - if (type == StubFile) - checkForBounds (parmType, importTypes, importList); - } - } - } - else if (entry instanceof StructEntry) - { - StructEntry s = (StructEntry)entry; - - // Look through the members - Enumeration members = s.members ().elements (); - while (members.hasMoreElements ()) - { - SymtabEntry member = (TypedefEntry)members.nextElement (); - // Need to add helper name for typedef members. This name - // is referenced at typecode generation in Helper class. - SymtabEntry memberType = member.type (); - member = typeOf (member); - if (importTypes.contains (member)) - { - // If this IS a typedef, then there are only Helper/Holder classes. - //if (!(member instanceof TypedefEntry)) - // Valueboxes - if (!(member instanceof TypedefEntry) && !(member instanceof ValueBoxEntry)) - addTo (importList, member.name ()); - // Add helper name of alias, too, if member is a typedef. - //if (type == HelperFile) - // addTo (importList, member.name () + "Helper"); - if (type == HelperFile) - { - addTo (importList, member.name () + "Helper"); - if (memberType instanceof TypedefEntry) - addTo (importList, memberType.name () + "Helper"); - } - } - checkForArrays (member, importTypes, importList); - checkForBounds (member, importTypes, importList); - } - } - else if (entry instanceof TypedefEntry) - { - TypedefEntry t = (TypedefEntry)entry; - String arrays = checkForArrayBase (t, importTypes, importList); - if (type == HelperFile) - { - checkForArrayDimensions (arrays, importTypes, importList); - try - { - String name = (String)t.dynamicVariable (Compile.typedefInfo); - int index = name.indexOf ('['); - if (index >= 0) - name = name.substring (0, index); - // See if the base type should be added to the list. - SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name); - if (typeEntry != null && importTypes.contains (typeEntry)) - addTo (importList, typeEntry.name () + "Helper"); - } - catch (NoSuchFieldException e) - {} - - // Typedefs for global bounded strings need import - // statement when bound expression contains non-literal constants. - checkForBounds (typeOf (t), importTypes, importList); - } - Vector subImportList = addImportLines (t.type (), importTypes, type); - Enumeration e = subImportList.elements (); - while (e.hasMoreElements ()) - addTo (importList, (String)e.nextElement ()); - } - else if (entry instanceof UnionEntry) - { - UnionEntry u = (UnionEntry)entry; - - // Look at the discriminant type - SymtabEntry utype = typeOf (u.type ()); - if (utype instanceof EnumEntry && importTypes.contains (utype)) - addTo (importList, utype.name ()); - - // Look through the branches - Enumeration branches = u.branches ().elements (); - while (branches.hasMoreElements ()) - { - UnionBranch branch = (UnionBranch)branches.nextElement (); - SymtabEntry branchEntry = typeOf (branch.typedef); - if (importTypes.contains (branchEntry)) - { - addTo (importList, branchEntry.name ()); - if (type == HelperFile) - addTo (importList, branchEntry.name () + "Helper"); - } - checkForArrays (branchEntry, importTypes, importList); - // - checkForBounds (branchEntry, importTypes, importList); - } - } - - // If a typedef is not a sequence or an array, only holders and - // helpers are generated for it. Remove references to such - // class names. - Enumeration en = importList.elements (); - while (en.hasMoreElements ()) - { - String name = (String)en.nextElement (); - SymtabEntry e = (SymtabEntry)symbolTable.get (name); - if (e != null && e instanceof TypedefEntry) - { - TypedefEntry t = (TypedefEntry)e; - if (t.arrayInfo ().size () == 0 || !(t.type () instanceof SequenceEntry)) - importList.removeElement (name); - } - } - return importList; - } // addImportLines - - /** - * - **/ - static private void checkForArrays (SymtabEntry entry, Vector importTypes, Vector importList) - { - if (entry instanceof TypedefEntry) - { - TypedefEntry t = (TypedefEntry)entry; - String arrays = checkForArrayBase (t, importTypes, importList); - checkForArrayDimensions (arrays, importTypes, importList); - } - } // checkForArrays - - /** - * - **/ - static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList) - { - String arrays = ""; - try - { - String name = (String)t.dynamicVariable (Compile.typedefInfo); - int index = name.indexOf ('['); - if (index >= 0) - { - arrays = name.substring (index); - name = name.substring (0, index); - } - - // See if the base type should be added to the list. - SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name); - if (typeEntry != null && importTypes.contains (typeEntry)) - addTo (importList, typeEntry.name ()); - } - catch (NoSuchFieldException e) - {} - return arrays; - } // checkForArrayBase - - /** - * - **/ - static private void checkForArrayDimensions (String arrays, Vector importTypes, Vector importList) - { - // See if any of the arrays contain a constentry. - // If so, see if it should be added to the list. - while (!arrays.equals ("")) - { - int index = arrays.indexOf (']'); - String dim = arrays.substring (1, index); - arrays = arrays.substring (index + 1); - SymtabEntry constant = (SymtabEntry)symbolTable.get (dim); - if (constant == null) - { - // A constant expr could be of the form OR - // .. This if branch checks for that case. - int i = dim.lastIndexOf ('.'); - if (i >= 0) - constant = (SymtabEntry)symbolTable.get (dim.substring (0, i)); - } - if (constant != null && importTypes.contains (constant)) - addTo (importList, constant.name ()); - } - } // checkForArrayDimensions - - // Call the following method when its necessary to determine the - // the import types for IDL constructs containing arbitrary positive int. - // expressions, which may specify non-literal constants. - - /** - * Determine the import lines for template types. - **/ - static private void checkForBounds (SymtabEntry entry, Vector importTypes, Vector importList) - { - // Obtain actual type, just to be complete. - SymtabEntry entryType = entry; - while (entryType instanceof TypedefEntry) - entryType = entryType.type (); - - if (entryType instanceof StringEntry && ((StringEntry)entryType).maxSize () != null) - checkForGlobalConstants (((StringEntry)entryType).maxSize ().rep (), importTypes, importList); - else - if (entryType instanceof SequenceEntry && ((SequenceEntry)entryType).maxSize () != null) - checkForGlobalConstants (((SequenceEntry)entryType).maxSize ().rep (), importTypes, importList); - } // checkForBounds - - /** - * Extract the global constants from the supplied integer expression - * representation (string) and add them to the supplied import list. - **/ - static private void checkForGlobalConstants (String exprRep, Vector importTypes, Vector importList) - { - // NOTE: Do not use '/' as a delimiter. Symbol table names use '/' as a - // delimiter and would not be otherwise properly collected. Blanks and - // arithmetic symbols do not appear in tokens, except for '/'. - java.util.StringTokenizer st = new java.util.StringTokenizer (exprRep, " +-*()~&|^%<>"); - while (st.hasMoreTokens ()) - { - String token = st.nextToken (); - // When token contains '/', it represents the division symbol or - // a nested type (e.g., I/x). Ignore the division symbol, and don't - // forget constants declared within global interfaces! - if (!token.equals ("/")) - { - SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (token); - if (typeEntry instanceof ConstEntry) - { - int slashIdx = token.indexOf ('/'); - if (slashIdx < 0) // Possible global constant - { - if (importTypes.contains (typeEntry)) - addTo (importList, typeEntry.name ()); - } - else // Possible constant in global interface - { - SymtabEntry constContainer = (SymtabEntry)symbolTable.get (token.substring (0, slashIdx)); - if (constContainer instanceof InterfaceEntry && importTypes.contains (constContainer)) - addTo (importList, constContainer.name ()); - } - } - } - } - } // checkForGlobalConstants - - /** - * - **/ - public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, PrintWriter stream) - { - if (entry instanceof TypedefEntry) - { - TypedefEntry td = (TypedefEntry)entry; - writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), stream); - } - else if (entry instanceof SequenceEntry) - writeInitializer (indent, name, arrayDcl + "[]", entry.type (), stream); - else if (entry instanceof EnumEntry) - if (arrayDcl.length () > 0) - stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;"); - else - stream.println (indent + javaName (entry) + ' ' + name + " = null;"); - else if (entry instanceof PrimitiveEntry) - { - boolean array = arrayDcl.length () > 0; - String tname = javaPrimName (entry.name ()); - if (tname.equals ("boolean")) - stream.println (indent + "boolean " + name + arrayDcl + " = " + (array ? "null;" : "false;")); - else if (tname.equals ("org.omg.CORBA.TypeCode")) - stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = null;"); - else if (tname.equals ("org.omg.CORBA.Any")) - stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = null;"); - else if (tname.equals ("org.omg.CORBA.Principal")) // - stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = null;"); - else - stream.println (indent + tname + ' ' + name + arrayDcl + " = " + (array ? "null;" : '(' + tname + ")0;")); - } - // Remove -stateful feature. This case is identical to next one - // because javaName() supplants javaStatefulName(). - //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null) - // stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = null;"); - else - stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;"); - } // writeInitializer - - /** - * - **/ - public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, String initializer, PrintWriter stream) - { - if (entry instanceof TypedefEntry) - { - TypedefEntry td = (TypedefEntry)entry; - writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), initializer, stream); - } - else if (entry instanceof SequenceEntry) - writeInitializer (indent, name, arrayDcl + "[]", entry.type (), initializer, stream); - else if (entry instanceof EnumEntry) - if (arrayDcl.length () > 0) - stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';'); - else - stream.println (indent + javaName (entry) + ' ' + name + " = " + initializer + ';'); - else if (entry instanceof PrimitiveEntry) - { - boolean array = arrayDcl.length () > 0; - String tname = javaPrimName (entry.name ()); - if (tname.equals ("boolean")) - stream.println (indent + "boolean " + name + arrayDcl + " = " + initializer + ';'); - else if (tname.equals ("org.omg.CORBA.TypeCode")) - stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = " + initializer + ';'); - else if (tname.equals ("org.omg.CORBA.Any")) - stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = " + initializer + ';'); - else if (tname.equals ("org.omg.CORBA.Principal")) // - stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = " + initializer + ';'); - else - stream.println (indent + tname + ' ' + name + arrayDcl + " = " + initializer + ';'); - } - // Remove -stateful feature. This case is identical to next one - // because javaName() supplants javaStatefulName(). - //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null) - // stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = " + initializer + ';'); - else - stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';'); - } // writeInitializer - - /** - * - **/ - public static void mkdir (String name) - { - String targetDir = ((Arguments)Compile.compiler.arguments).targetDir; // F46838.4 - name = (targetDir + name).replace ('/', File.separatorChar); // F46838.4 - File pkg = new File (name); - if (!pkg.exists ()) - if (!pkg.mkdirs ()) - System.err.println (getMessage ("Util.cantCreatePkg", name)); - } // mkdir - - /** - * - **/ - public static void writeProlog (PrintWriter stream, String filename) - { - // Remove target directory - String targetDir = ((Arguments)Compile.compiler.arguments).targetDir; - if (targetDir != null) - filename = filename.substring (targetDir.length ()); - stream.println (); - stream.println ("/**"); - stream.println ("* " + filename.replace (File.separatorChar, '/') + - " ."); - stream.println ("* " + Util.getMessage ("toJavaProlog1", - Util.getMessage ("Version.product", Util.getMessage ("Version.number")))); - // Do not introduce invalid escape characters into comment! - //stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file)); - stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file.replace (File.separatorChar, '/'))); - - /////////////// - // This SHOULD work, but there's a bug in the JDK. - // stream.println ("* " + DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ()).format (new Date ())); - // This gets around the bug: - - DateFormat formatter = DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ()); - - // Japanese-specific workaround. JDK bug 4069784 being repaired by JavaSoft. - // Keep this transient solution until bug fix is reported.cd . - - if (Locale.getDefault () == Locale.JAPAN) - formatter.setTimeZone (java.util.TimeZone.getTimeZone ("JST")); - else - formatter.setTimeZone (java.util.TimeZone.getDefault ()); - - stream.println ("* " + formatter.format (new Date ())); - - // - /////////////// - - stream.println ("*/"); - stream.println (); - } // writeProlog - - // keywords ending in Holder or Helper or Package have '_' prepended. - // These prepended underscores must not be part of anything sent - // across the wire, so these two methods are provided to strip them - // off. - - /** - * - **/ - public static String stripLeadingUnderscores (String string) - { - while (string.startsWith ("_")) - string = string.substring (1); - return string; - } // stripLeadingUnderscores - - /** - * - **/ - public static String stripLeadingUnderscoresFromID (String string) - { - String stringPrefix = ""; - int slashIndex = string.indexOf (':'); - if (slashIndex >= 0) - do - { - stringPrefix = stringPrefix + string.substring (0, slashIndex + 1); - string = string.substring (slashIndex + 1); - while (string.startsWith ("_")) - string = string.substring (1); - slashIndex = string.indexOf ('/'); - } while (slashIndex >= 0); - return stringPrefix + string; - } // stripLeadingUnderscoresFromID - - /** - * - **/ - public static String parseExpression (Expression e) - { - if (e instanceof Terminal) - return parseTerminal ((Terminal)e); - else if (e instanceof BinaryExpr) - return parseBinary ((BinaryExpr)e); - else if (e instanceof UnaryExpr) - return parseUnary ((UnaryExpr)e); - else - return "(UNKNOWN_VALUE)"; // This shouldn't happen unless someone slips - // in another type of expression. - } // parseExpression - - /** - * - **/ - static String parseTerminal (Terminal e) - { - if (e.value () instanceof ConstEntry) - { - ConstEntry c = (ConstEntry)e.value (); - if (c.container () instanceof InterfaceEntry) - return javaQualifiedName (c.container ()) + '.' + c.name (); - else - return javaQualifiedName (c) + ".value"; - } - else if (e.value () instanceof Expression) - return '(' + parseExpression ((Expression)e.value ()) + ')'; - else if (e.value () instanceof Character) - { - if (((Character)e.value ()).charValue () == '\013') - // e.rep is \v. \v for vertical tab is meaningless in Java. - return "'\\013'"; - else if (((Character)e.value ()).charValue () == '\007') - // e.rep is \a. \a for alert is meaningless in Java. - return "'\\007'"; - else if (e.rep ().startsWith ("'\\x")) - return hexToOctal (e.rep ()); - else if (e.rep ().equals ("'\\?'")) - return "'?'"; - else - return e.rep (); - } - else if (e.value () instanceof Boolean) - return e.value ().toString (); - - // If value is type "unsigned long long" (ull) and its magnitude - // is greater than the maximal Java long (i.e., IDL long long) value, then - // return its signed representation rather than its actual representation. - /* - // Support long long - //else if (e.value () instanceof Long) - else if (e.value () instanceof BigInteger && - (e.type ().indexOf ("long long") >= 0 || e.type ().equals ("unsigned long"))) // - { - String rep = e.rep (); - int index = rep.indexOf (')'); - if (index < 0) - return rep + 'L'; - else - return rep.substring (0, index) + 'L' + rep.substring (index); - } - */ - else if (e.value () instanceof BigInteger) - { - // Get the correct primitive type. Since integer types (octet, short, - // long, long long, unsigned short, unsigned long, unsigned long long) - // could be aliased (typedef'ed) to any arbitrary levels, the code - // below walks up the alias chain to get to the primitive type. - - // Get the symbol table entry corresponding to the 'type'. - SymtabEntry typeEntry = (SymtabEntry) symbolTable.get(e.type()); - - // Get to the primitive type. - while (typeEntry.type() != null) { - typeEntry = typeEntry.type(); - } - String type = typeEntry.name(); - - if (type.equals("unsigned long long") && - ((BigInteger)e.value ()).compareTo (Expression.llMax) > 0) // value > long long Max? - { - // Convert to signed value, which will always be negative. - BigInteger v = (BigInteger)e.value (); - v = v.subtract (Expression.twoPow64); - int index = e.rep ().indexOf (')'); - if (index < 0) - return v.toString () + 'L'; - else - return '(' + v.toString () + 'L' + ')'; - } - else if ( type.indexOf("long long") >= 0 || type.equals("unsigned long") ) - { - String rep = e.rep (); - int index = rep.indexOf (')'); - if (index < 0) - return rep + 'L'; - else - return rep.substring (0, index) + 'L' + rep.substring (index); - } - else - return e.rep (); - } // end - else - return e.rep (); - } // parseTerminal - - /** - * - **/ - static String hexToOctal (String hex) - { - // The format of hex is '/xXX' where XX is one or two hex digits. - // This statement pulls off XX. - hex = hex.substring (3, hex.length () - 1); - return "'\\" + Integer.toString (Integer.parseInt (hex, 16), 8) + "'"; - } // hexToOctal - - /** - * - **/ - static String parseBinary (BinaryExpr e) - { - String castString = ""; - if (e.value () instanceof Float || e.value () instanceof Double) - { - castString = "(double)"; - if (!(e instanceof Plus || e instanceof Minus || - e instanceof Times || e instanceof Divide)) - System.err.println ("Operator " + e.op () + " is invalid on floating point numbers"); - } - else if (e.value () instanceof Number) - { - if (e.type (). indexOf ("long long") >= 0) - castString = "(long)"; - else - castString = "(int)"; - } - else - { - castString = ""; - System.err.println ("Unknown type in constant expression"); - } - - // Must emit value rather than representation when type "unsigned - // long long" (ull) because emitted binary arithmetic expressions containing - // ull's converted to long (i.e., IDL long long) do not always compute to - // the correct result. - - //return castString + '(' + parseExpression (e.left ()) + ' ' + e.op () + ' ' + parseExpression (e.right ()) + ')'; - if (e.type ().equals ("unsigned long long")) - { - BigInteger value = (BigInteger)e.value (); - if (value.compareTo (Expression.llMax) > 0) // value > long long max? - value = value.subtract (Expression.twoPow64); // Convert to Java long (signed) - return castString + '(' + value.toString () + 'L' + ')'; - } - else - return castString + '(' + parseExpression (e.left ()) + ' ' + e.op () + ' ' + parseExpression (e.right ()) + ')'; - // end - } // parseBinary - - /** - * - **/ - static String parseUnary (UnaryExpr e) - { - if (!(e.value () instanceof Number)) - return "(UNKNOWN_VALUE)"; // This shouldn't happen if the parser checked the expression types correctly. - else if ((e.value () instanceof Float || e.value () instanceof Double) && e instanceof Not) - return "(UNKNOWN_VALUE)"; // This shouldn't happen if the parser checked the expression types correctly. - else - { - String castString = ""; - if (e.operand ().value () instanceof Float || - e.operand ().value () instanceof Double) - castString = "(double)"; - // Support long long. - //else - // castString = "(long)"; - else if (e.type (). indexOf ("long long") >= 0) - castString = "(long)"; - else - castString = "(int)"; - - // Must emit value rather than representation when type is - // "unsigned long long" (ull) because emitted unary arithmetic expressions - // containing a ull converted to long (i.e., IDL long long) do not always - // compute to the correct result. - - //return castString + e.op () + parseExpression (e.operand ()); - if (e.type ().equals ("unsigned long long")) - { - BigInteger value = (BigInteger)e.value (); - if (value.compareTo (Expression.llMax) > 0) // value > long long max? - value = value.subtract (Expression.twoPow64); // Convert to Java long (signed) - return castString + '(' + value.toString () + 'L' + ')'; - } - else - return castString + e.op () + parseExpression (e.operand ()); - // end - } - } // parseUnary - - /** - * - **/ - public static boolean IDLEntity (SymtabEntry entry) - { - boolean rc = true; - if (entry instanceof PrimitiveEntry || entry instanceof StringEntry) - rc = false; - else if (entry instanceof TypedefEntry) - rc = IDLEntity (entry.type ()); - return rc; - } // IDLEntity - - // - /** - * @return true if the current setting of corbaLevel is within delta of - * the range {@code min <= corbaLevel <= max} - **/ - public static boolean corbaLevel (float min, float max) - { - float level = Compile.compiler.arguments.corbaLevel; - float delta = 0.001f; - if ((level - min + delta >= 0.0f) && (max - level + delta >= 0.0f)) - return true; - else - return false; - } // corbaLevel - - static Hashtable symbolTable = new Hashtable (); - static Hashtable packageTranslation = new Hashtable() ; -} // class Util --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java 2018-01-30 20:26:01.000000000 -0500 +++ /dev/null 2018-01-30 20:26:01.000000000 -0500 @@ -1,349 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D60929 Update for RTF2.4 changes -// -D61056 Use Util.helperName -// -D62023 Fix generation botch in helper.read for boxed bounded strings - -import java.io.File; -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; - -/** - * - **/ -public class ValueBoxGen implements com.sun.tools.corba.se.idl.ValueBoxGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public ValueBoxGen () - { - } // ctor - - /** - * - **/ - public void generate (Hashtable symbolTable, ValueBoxEntry v, PrintWriter str) - { - this.symbolTable = symbolTable; - this.v = v; - - TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry; - SymtabEntry mType = member.type (); - // if it's primitive type, generate a java class - if (mType instanceof PrimitiveEntry) - { - openStream (); - if (stream == null) - return; - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } - else - { - // If a constructed type is nested in the value box, - // value v struct s {...}; - // the bindings for the nested type must be handled here - Enumeration e = v.contained ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry contained = (SymtabEntry) e.nextElement (); - - // in case of value box w/ nested enum, ex: value v enum e {e0, e1,...}; - // the SymtabEntry for the enum and labels are contained in the vector. - // Must check the type to ignore the SymtabEntry for labels. - if (contained.type () != null) - contained.type ().generate (symbolTable, stream); - } - } - generateHelper (); - generateHolder (); - } // generate - - /** - * - **/ - protected void openStream () - { - stream = Util.stream (v, ".java"); - } // openStream - - /** - * - **/ - protected void generateHelper () - { - ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, v); - } // generateHelper - - /** - * - **/ - protected void generateHolder () - { - ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, v); - } // generateHolder - - /** - * - **/ - protected void writeHeading () - { - Util.writePackage (stream, v); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - if (v.comment () != null) - v.comment ().generate ("", stream); -// stream.println ("public class " + v.name () + " implements org.omg.CORBA.portable.ValueBase, org.omg.CORBA.portable.Streamable"); - stream.println ("public class " + v.name () + " implements org.omg.CORBA.portable.ValueBase"); // - stream.println ("{"); - } // writeHeading - - /** - * - **/ - protected void writeBody () - { - InterfaceState member = (InterfaceState) v.state ().elementAt (0); - SymtabEntry entry = (SymtabEntry) member.entry; - Util.fillInfo (entry); - if (entry.comment () != null) - entry.comment ().generate (" ", stream); - stream.println (" public " + Util.javaName (entry) + " value;"); - stream.println (" public " + v.name () + " (" + Util.javaName (entry) + " initial)"); - stream.println (" {"); - stream.println (" value = initial;"); - stream.println (" }"); - stream.println (); - writeTruncatable (); // -// writeStreamableMethods (); - } // writeBody - - /** - * - **/ - protected void writeTruncatable () // - { - // Per Simon, 4/6/98, emit _truncatable_ids() - stream.println (" public String[] _truncatable_ids() {"); - stream.println (" return " + Util.helperName(v, true) + ".get_instance().get_truncatable_base_ids();"); // - stream.println (" }"); - stream.println (); - } // writeTruncatable - - /** - * - **/ - protected void writeClosing () - { - stream.println ("} // class " + v.name ()); - } // writeClosing - - /** - * - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - /** - * - **/ - protected void writeStreamableMethods () - { - stream.println (" public void _read (org.omg.CORBA.portable.InputStream istream)"); - stream.println (" {"); - streamableRead ("this", v, stream); - stream.println (" }"); - stream.println (); - stream.println (" public void _write (org.omg.CORBA.portable.OutputStream ostream)"); - stream.println (" {"); - write (0, " ", "this", v, stream); - stream.println (" }"); - stream.println (); - stream.println (" public org.omg.CORBA.TypeCode _type ()"); - stream.println (" {"); - stream.println (" return " + Util.helperName (v, false) + ".type ();"); // - stream.println (" }"); - } // writeStreamableMethods - - /////////////// - // From JavaGenerator - - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - ValueEntry vt = (ValueEntry) entry; - TypedefEntry member = (TypedefEntry) ((InterfaceState) (vt.state ()).elementAt (0)).entry; - SymtabEntry mType = Util.typeOf (member); - index = ((JavaGenerator)mType.generator ()).type (index, indent, tcoffsets, name, mType, stream); - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_value_box_tc (" - + "_id, " - + '"' + entry.name () + "\", " - + name - + ");"); - return index; - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) { - stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // - return index; - } // type - - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - return index; - } // read - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - // per Simon, make "static" read call istream.read_value. - // put real marshalling code in read_value. - stream.println (" return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (get_instance());"); // - stream.println (" }"); - stream.println (); - - // done with "read", now do "read_value with real marshalling code. - - stream.println (" public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // - stream.println (" {"); - // end of changes - - String indent = " "; - Vector vMembers = ((ValueBoxEntry) entry).state (); - TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry; - SymtabEntry mType = member.type (); - if (mType instanceof PrimitiveEntry || - mType instanceof SequenceEntry || - mType instanceof TypedefEntry || - mType instanceof StringEntry || - !member.arrayInfo ().isEmpty ()) { - stream.println (indent + Util.javaName (mType) + " tmp;"); // - ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream); - } - else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry) - stream.println (indent + Util.javaQualifiedName (mType) + " tmp = (" + - Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, true) + ".get_instance ());"); // // - else - stream.println (indent + Util.javaName (mType) + " tmp = " + - Util.helperName ( mType, true ) + ".read (istream);"); // - if (mType instanceof PrimitiveEntry) - stream.println (indent + "return new " + entryName + " (tmp);"); - else - stream.println (indent + "return tmp;"); - } // helperRead - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - // per Simon, make "static" write call istream.write_value. - // put real marshalling code in write_value. - stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, get_instance());"); // - stream.println (" }"); - stream.println (); - - // done with "write", now do "write_value with real marshalling code. - - stream.println (" public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable obj)"); // - stream.println (" {"); - - String entryName = Util.javaName(entry); - stream.println (" " + entryName + " value = (" + entryName + ") obj;"); - write (0, " ", "value", entry, stream); - } // helperWrite - - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - Vector vMembers = ( (ValueEntry) entry ).state (); - TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry; - SymtabEntry mType = member.type (); - - if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ()) - index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream); - else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ()) - index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream); - else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry) - stream.println (indent - + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // - + Util.helperName (mType, true) // - + ".get_instance ());"); // - else - stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // - return index; - } // write - - protected void writeAbstract () - { - } // writeAbstract - - protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - Vector vMembers = ( (ValueBoxEntry) entry ).state (); - TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry; - SymtabEntry mType = member.type (); - if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry || - mType instanceof StringEntry || !member.arrayInfo ().isEmpty ()) - { - SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry; - ((JavaGenerator)member.generator ()).read (0, " ", entryName + ".value", member, stream); - } - else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry) - stream.println (" " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // // - else - stream.println (" " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // - } // streamableRead - - protected Hashtable symbolTable = null; - protected ValueBoxEntry v = null; - protected PrintWriter stream = null; -} // class ValueBoxGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java 2018-01-30 20:26:02.000000000 -0500 +++ /dev/null 2018-01-30 20:26:02.000000000 -0500 @@ -1,163 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D62023 Update for Java 2.4 RTF - -import java.io.File; -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; - -/** - * - **/ -public class ValueBoxGen24 extends ValueBoxGen -{ - /** - * Public zero-argument constructor. - **/ - public ValueBoxGen24 () - { - } // ctor - - /** - * d62023 - Move from helper to mapped class - **/ - protected void writeTruncatable () // - { - stream.print (" private static String[] _truncatable_ids = {"); - stream.println (Util.helperName(v, true) + ".id ()};"); - stream.println (); - stream.println (" public String[] _truncatable_ids() {"); - stream.println (" return _truncatable_ids;"); - stream.println (" }"); - stream.println (); - } // writeTruncatable - - - /** - * d62023 - **/ - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - stream.println (" if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {"); - stream.println (" throw new org.omg.CORBA.BAD_PARAM(); }"); - stream.println (" return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);"); - stream.println (" }"); - stream.println (); - - // done with "read", now do "read_value with real marshalling code. - - stream.println (" public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // - stream.println (" {"); - - String indent = " "; - Vector vMembers = ((ValueBoxEntry) entry).state (); - TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry; - SymtabEntry mType = member.type (); - if (mType instanceof PrimitiveEntry || - mType instanceof SequenceEntry || - mType instanceof TypedefEntry || - mType instanceof StringEntry || - !member.arrayInfo ().isEmpty ()) { - stream.println (indent + Util.javaName (mType) + " tmp;"); - ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream); - } - else - stream.println (indent + Util.javaName (mType) + " tmp = " + - Util.helperName ( mType, true ) + ".read (istream);"); - if (mType instanceof PrimitiveEntry) - stream.println (indent + "return new " + entryName + " (tmp);"); - else - stream.println (indent + "return (java.io.Serializable) tmp;"); - } // helperRead - - /** - * d62023 - **/ - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - stream.println (" if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {"); - stream.println (" throw new org.omg.CORBA.BAD_PARAM(); }"); - stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);"); - stream.println (" }"); - stream.println (); - - // done with "write", now do "write_value with real marshalling code. - - stream.println (" public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)"); - stream.println (" {"); - - String entryName = Util.javaName(entry); - stream.println (" if (!(value instanceof " + entryName + ")) {"); - stream.println (" throw new org.omg.CORBA.MARSHAL(); }"); - stream.println (" " + entryName + " valueType = (" + entryName + ") value;"); - write (0, " ", "valueType", entry, stream); - } // helperWrite - - /** - * d62023 - **/ - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - Vector vMembers = ( (ValueEntry) entry ).state (); - TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry; - SymtabEntry mType = member.type (); - - if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ()) - index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream); - else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ()) - index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream); - else - stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // - return index; - } // write -} --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java 2018-01-30 20:26:03.000000000 -0500 +++ /dev/null 2018-01-30 20:26:03.000000000 -0500 @@ -1,173 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D62023 klr new class - -import java.io.PrintWriter; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.ValueEntry; - -/** - * - **/ -public class ValueFactory implements AuxGen -{ - /** - * Public zero-argument constructor. - **/ - public ValueFactory () - { - } // ctor - - /** - * Generate the default value factory class. Provides general algorithm for - * auxiliary binding generation: - * 1.) Initialize symbol table and symbol table entry members, - * common to all generators. - * 2.) Initialize members unique to this generator. - * 3.) Open print stream - * 4.) Write class heading (package, prologue, source comment, class - * statement, open curly - * 5.) Write class body (member data and methods) - * 6.) Write class closing (close curly) - * 7.) Close the print stream - **/ - public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry) - { - this.symbolTable = symbolTable; - this.entry = entry; - init (); - if (hasFactoryMethods ()) { - openStream (); - if (stream == null) - return; - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } - } // generate - - /** - * Initialize variables unique to this generator. - **/ - protected void init () - { - factoryClass = entry.name () + "ValueFactory"; - factoryType = Util.javaName (entry); - } // init - - /** - * @return true if entry has any factory methods declared - **/ - protected boolean hasFactoryMethods () - { - Vector init = ((ValueEntry)entry).initializers (); - if (init != null && init.size () > 0) - return true; - else - return false; - } // hasFactoryMethods - - /** - * Open the print stream for subsequent output. - **/ - protected void openStream () - { - stream = Util.stream (entry, "ValueFactory.java"); - } // openStream - - /** - * Generate the heading, including the package, imports, - * source comment, class statement, and left curly. - **/ - protected void writeHeading () - { - Util.writePackage (stream, entry, Util.TypeFile); // REVISIT - same as interface? - Util.writeProlog (stream, stream.name ()); - if (entry.comment () != null) - entry.comment ().generate ("", stream); - stream.println ("public interface " + factoryClass + " extends org.omg.CORBA.portable.ValueFactory"); - stream.println ('{'); - } // writeHeading - - /** - * Generate members of this class. - **/ - protected void writeBody () - { - Vector init = ((ValueEntry)entry).initializers (); - if (init != null) - { - for (int i = 0; i < init.size (); i++) - { - MethodEntry element = (MethodEntry) init.elementAt (i); - element.valueMethod (true); //tag value method if not tagged previously - ((MethodGen) element.generator ()). interfaceMethod (symbolTable, element, stream); - } - } - } // writeBody - - /** - * Generate the closing statements. - **/ - protected void writeClosing () - { - stream.println ('}'); - } // writeClosing - - /** - * Write the stream to file by closing the print stream. - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - protected java.util.Hashtable symbolTable; - protected com.sun.tools.corba.se.idl.SymtabEntry entry; - protected GenFileStream stream; - - // Unique to this generator - protected String factoryClass; - protected String factoryType; -} // class Holder --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java 2018-01-30 20:26:03.000000000 -0500 +++ /dev/null 2018-01-30 20:26:04.000000000 -0500 @@ -1,767 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -F46082.51 Remove -stateful feature; javaStatefulName() obsolete. -// -D57067 suppress default init if an emit init explicitly specified. -// -D59071 Clone method entries when their content needs modification. -// -D59092 Valuetype supporting interfaces should implement interface. -// -D59418 Custom values implement org.omg.CORBA.CustomMarshal -// -D59418 Invert read/read_Value, write/write_Value for Simon -// -D60929 Update for RTF2.4 changes -// -D62018 write_value for value with value field x calls xHelper.write. -// -D62062 Add _write to value Helper to marshal state. -// write_value for value subclass calls parent._write -// -D61650 Remove '\n' from generated strings; use println()'s. - -import java.io.File; -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.StructEntry; - -/** - * - **/ -public class ValueGen implements com.sun.tools.corba.se.idl.ValueGen, JavaGenerator -{ - /** - * Public zero-argument constructor. - **/ - public ValueGen () - { - } // ctor - - /** - * - **/ - public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str) - { - this.symbolTable = symbolTable; - this.v = v; - init (); - - openStream (); - if (stream == null) - return; - generateTie (); - generateHelper (); - generateHolder (); - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generate - - /** - * Initialize members unique to this generator. - **/ - protected void init () - { - emit = ((Arguments)Compile.compiler.arguments).emit; - factories = (Factories)Compile.compiler.factories (); - } // init - - /** - * - **/ - protected void openStream () - { - stream = Util.stream (v, ".java"); - } // openStream - - /** - * Generate a Tie class only when the user specifies the TIE option - * and the valuetype does support an interface. - **/ - protected void generateTie () - { - boolean tie = ((Arguments)Compile.compiler.arguments).TIEServer; - if (v.supports ().size () > 0 && tie) - { - Factories factories = (Factories)Compile.compiler.factories (); - factories.skeleton ().generate (symbolTable, v); - } - } // generateTie - - /** - * - **/ - protected void generateHelper () - { - ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, v); - } // generateHelper - - /** - * - **/ - protected void generateHolder () - { - ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, v); - } // generateHolder - - /** - * - **/ - protected void writeHeading () - { - Util.writePackage (stream, v); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - - if (v.comment () != null) - v.comment ().generate ("", stream); - - if (v.isAbstract ()) - { - writeAbstract (); - return; - } - else - stream.print ("public class " + v.name ()); - - // There should always be at least one parent: ValueBase - SymtabEntry parent = (SymtabEntry) v.derivedFrom ().elementAt (0); - - // If parent is ValueBase, it's mapped to java.io.Serializable - String parentName = Util.javaName (parent); - boolean impl = false; - - if (parentName.equals ("java.io.Serializable")) - { -// stream.print (" implements org.omg.CORBA.portable.ValueBase, org.omg.CORBA.portable.Streamable"); - stream.print (" implements org.omg.CORBA.portable.ValueBase"); // - impl = true; - } - else if ( !((ValueEntry)parent).isAbstract ()) - stream.print (" extends " + parentName); - - // if inheriting from abstract values - for (int i = 0; i < v.derivedFrom ().size (); i++) { - parent = (SymtabEntry) v.derivedFrom ().elementAt (i); - if ( ((ValueEntry)parent).isAbstract ()) - { - if (!impl) - { - stream.print (" implements "); - impl = true; - } - else - stream.print (", "); - stream.print (Util.javaName (parent)); - } - } -// Valuetype supporting interface implement Operations interface -// for supported IDL interface - if (((ValueEntry)v).supports ().size () > 0) { - if (!impl) - { - stream.print (" implements "); - impl = true; - } - else - stream.print (", "); - - InterfaceEntry s =(InterfaceEntry)((ValueEntry)v).supports().elementAt(0); - // abstract supported classes don't have "Operations" - if (s.isAbstract ()) - stream.print (Util.javaName (s)); - else - stream.print (Util.javaName (s) + "Operations"); - } - -// Custom valuetypes implement org.omg.CORBA.CustomMarshal. - if ( ((ValueEntry)v).isCustom ()) { - if (!impl) - { - stream.print (" implements "); - impl = true; - } - else - stream.print (", "); - - stream.print ("org.omg.CORBA.CustomMarshal "); - } - - stream.println (); - stream.println ("{"); - } // writeHeading - - /** - * - **/ - protected void writeBody () - { - writeMembers (); - writeInitializers (); - writeConstructor (); // - writeTruncatable (); // - writeMethods (); - } // writeBody - - /** - * - **/ - protected void writeClosing () - { - if (v.isAbstract ()) - stream.println ("} // interface " + v.name ()); - else - stream.println ("} // class " + v.name ()); - } // writeClosing - - /** - * - **/ - protected void closeStream () - { - stream.close (); - } // closeStream - - /** - * - **/ - protected void writeConstructor () - { - // Per Simon, 9/3/98, emit a protected default constructor - if (!v.isAbstract () && !explicitDefaultInit) { // - stream.println (" protected " + v.name () + " () {}"); - stream.println (); - } - } // writeConstructor - - /** - * - **/ - protected void writeTruncatable () // - { - // Per Simon, 4/6/98, emit _truncatable_ids() - if (!v.isAbstract ()) { - stream.println (" public String[] _truncatable_ids() {"); - stream.println (" return " + Util.helperName(v, true) + ".get_instance().get_truncatable_base_ids();"); // - stream.println (" }"); - stream.println (); - } - } // writeTruncatable - - /** - * - **/ - protected void writeMembers () - { - // if the value type contains no data members, a null return is expected - if (v.state () == null) - return; - - for (int i = 0; i < v.state ().size (); i ++) - { - InterfaceState member = (InterfaceState) v.state ().elementAt (i); - SymtabEntry entry = (SymtabEntry) member.entry; - Util.fillInfo (entry); - - if (entry.comment () != null) - entry.comment ().generate (" ", stream); - - String modifier = " "; - if (member.modifier == InterfaceState.Public) - modifier = " public "; - Util.writeInitializer (modifier, entry.name (), "", entry, stream); - } - } // writeMembers - - /** - * - **/ - protected void writeInitializers () - { - Vector init = v.initializers (); - if (init != null) - { - stream.println (); - for (int i = 0; i < init.size (); i++) - { - MethodEntry element = (MethodEntry) init.elementAt (i); - element.valueMethod (true); - ((MethodGen) element.generator ()). interfaceMethod (symbolTable, element, stream); - if (element.parameters ().isEmpty ()) // - explicitDefaultInit = true; - } - } - } // writeInitializers - - /** - * - **/ - protected void writeMethods () - { - // contained vector contains methods, attributes, const, enums, exceptions, - // structs, unions, or typedefs that are declared inside the value object. - // State members of the nested types are also included in this vector. - // Thus, if the declaration of a constructed type is nested in the decl. - // of a state member, e.g struct x {boolean b;} memberx; - // the generation of the nested type must be handled here. - Enumeration e = v.contained ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry contained = (SymtabEntry)e.nextElement (); - if (contained instanceof MethodEntry) - { - MethodEntry element = (MethodEntry)contained; - ((MethodGen)element.generator ()).interfaceMethod (symbolTable, element, stream); - } - else - { - // Generate the type referenced by the typedef. - if (contained instanceof TypedefEntry) - contained.type ().generate (symbolTable, stream); - - // Note that we also need to generate the typedef itself if - // contained is a typedef. - contained.generate (symbolTable, stream); - } - } - - // Abstract values are mapped to interfaces. There is no need to generate - // the bindings for inheriting methods in case of inheritance from other - // abstract values or supporting interface - if (v.isAbstract ()) - return; - - // workaround: if the value type doesnot support any interfaces, a null - // return is expected instead of an empty vector - - // if supporting an interfaces, generate bindings for inheriting methods - if (v.supports ().size () > 0) - { - InterfaceEntry intf = (InterfaceEntry) v.supports ().elementAt (0); - Enumeration el = intf.allMethods ().elements (); - while (el.hasMoreElements ()) - { - MethodEntry m = (MethodEntry) el.nextElement (); - // Don't alter the symbol table/emit list elements! - //m.container (v); - //((MethodGen)m.generator ()).interfaceMethod (symbolTable, m, stream); - MethodEntry mClone = (MethodEntry)m.clone (); - mClone.container (v); - ((MethodGen)mClone.generator ()).interfaceMethod (symbolTable, mClone, stream); - } - } - - // if inheriting from abstract values, generating bindings for all - // inheriting methods - for (int i = 0; i < v.derivedFrom ().size (); i++) { - ValueEntry parentValue = (ValueEntry) v.derivedFrom ().elementAt (i); - if (parentValue.isAbstract ()) - { - Enumeration el = parentValue.allMethods ().elements (); - while (el.hasMoreElements ()) - { - MethodEntry m = (MethodEntry) el.nextElement (); - // Don't alter the symbol table/emit list elements! - //m.container (v); - //((MethodGen)m.generator ()).interfaceMethod (symbolTable, m, stream); - MethodEntry mClone = (MethodEntry)m.clone (); - mClone.container (v); - ((MethodGen)mClone.generator ()).interfaceMethod (symbolTable, mClone, stream); - } - } - } - - //writeStreamableMethods (); - } // writeMethods - - /** - * - **/ - protected void writeStreamableMethods () - { - stream.println (" public void _read (org.omg.CORBA.portable.InputStream istream)"); - stream.println (" {"); - read (0, " ", "this", v, stream); - stream.println (" }"); - stream.println (); - stream.println (" public void _write (org.omg.CORBA.portable.OutputStream ostream)"); - stream.println (" {"); - write (0, " ", "this", v, stream); - stream.println (" }"); - stream.println (); - stream.println (" public org.omg.CORBA.TypeCode _type ()"); - stream.println (" {"); - stream.println (" return " + Util.helperName (v, false) + ".type ();"); // - stream.println (" }"); - } // writeStreamableMethods - - /////////////// - // From JavaGenerator - - public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) - { - ValueEntry vt = (ValueEntry) entry; - Vector state = vt.state (); - int noOfMembers = state == null ? 0 : state.size (); - String members = "_members" + index++; - String tcOfMembers = "_tcOf" + members; - - stream.println (indent + "org.omg.CORBA.ValueMember[] " - + members + " = new org.omg.CORBA.ValueMember[" - + noOfMembers - + "];"); - stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;"); - //stream.println (""); // - - String definedInrepId = "_id"; - String repId, version; - - for (int k=0; k - if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry) - // OBV spec is silent on defining VersionSpec for valuetype RepIds - version = "\"\""; - else - { - String id = mType.repositoryID ().ID (); - version = '"' + id.substring (id.lastIndexOf (':')+1) + '"'; - } - } - else - { - repId = "\"\""; - version = "\"\""; - } - - // Get TypeCode for valuetype member and store it var. name given by tcOfMembers - stream.println (indent + "// ValueMember instance for " + member.name ()); - index = ((JavaGenerator)member.generator ()).type (index, indent, tcoffsets, tcOfMembers, member, stream); - stream.println (indent + members + "[" + k + "] = new org.omg.CORBA.ValueMember (" // - + '"' + member.name () + "\", "); // name - stream.println (indent + " " + repId + ", "); // id - stream.println (indent + " " + definedInrepId + ", "); // defined_in - stream.println (indent + " " + version + ", "); // version - stream.println (indent + " " + tcOfMembers + ", "); // type - stream.println (indent + " " + "null, "); // type_def - stream.println (indent + " " + "org.omg.CORBA." + - (valueMember.modifier == InterfaceState.Public ? - "PUBLIC_MEMBER" : "PRIVATE_MEMBER") + ".value" + ");"); // access - } // end for - - stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_value_tc (" - + "_id, " - + '"' + entry.name () + "\", " - + getValueModifier (vt) + ", " - + getConcreteBaseTypeCode (vt) + ", " - + members - + ");"); - - return index; - } // helperType - - public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) { - stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // - return index; - } // type - - // Check for types which don't have a Repository ID: primitive, - // string, arrays and sequences. - - private static boolean hasRepId (SymtabEntry member) - { - SymtabEntry mType = Util.typeOf (member); - return !( mType instanceof PrimitiveEntry || - mType instanceof StringEntry || - ( mType instanceof TypedefEntry && - !(((TypedefEntry)mType).arrayInfo ().isEmpty ()) ) || - ( mType instanceof TypedefEntry && member.type () instanceof SequenceEntry) ); - } // hasRepId - - private static String getValueModifier (ValueEntry vt) - { - String mod = "NONE"; - if (vt.isCustom ()) - mod = "CUSTOM"; - else if (vt.isAbstract ()) - mod = "ABSTRACT"; - else if (vt.isSafe ()) - mod = "TRUNCATABLE"; - return "org.omg.CORBA.VM_" + mod + ".value"; - } // getValueModifier - - private static String getConcreteBaseTypeCode (ValueEntry vt) - { - Vector v = vt.derivedFrom (); - if (!vt.isAbstract ()) - { - SymtabEntry base = (SymtabEntry)vt.derivedFrom ().elementAt (0); - if (!"ValueBase".equals (base.name ())) - return Util.helperName (base, true) + ".type ()"; // - } - return "null"; - } // getConcreteBaseTypeCode - - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - // per Simon, make "static" read call istream.read_value. - // put real marshalling code in read_value. - - if (((ValueEntry)entry).isAbstract ()) - { - stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"abstract value cannot be instantiated\");"); - } - else - { - stream.println (" return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (get_instance());"); // - } - stream.println (" }"); - stream.println (); - - // done with "read", now do "read_value with real marshalling code. - - stream.println (" public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // - stream.println (" {"); - - // per Simon, 3/3/99, read_value for custom values throws an exception - if (((ValueEntry)entry).isAbstract ()) - { - stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"abstract value cannot be instantiated\");"); - } - else - if (((ValueEntry)entry).isCustom ()) - { - stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"custom values should use unmarshal()\");"); - } - else - { - stream.println (" " + entryName + " value = new " + entryName + " ();"); - read (0, " ", "value", entry, stream); - stream.println (" return value;"); - } - stream.println (" }"); - stream.println (); - // End of normal read method - - // Per Simon, 8/26/98 - Value helpers get an additional overloaded - // read method where the value is passed in instead of "new'd" up. This is - // used for reading parent value state. - - // Per Simon, 3/3/99 - Don't change this "read" for custom marshalling - stream.println (" public static void read (org.omg.CORBA.portable.InputStream istream, " + entryName + " value)"); - stream.println (" {"); - read (0, " ", "value", entry, stream); - } // helperRead - - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - // First do the state members from concrete parent hierarchy - Vector vParents = ((ValueEntry) entry).derivedFrom (); - if (vParents != null && vParents.size() != 0) - { - ValueEntry parent = (ValueEntry) vParents.elementAt (0); - if (parent == null) - return index; - // Per Simon, 4/6/99 - call parent read. - if (! Util.javaQualifiedName(parent).equals ("java.io.Serializable")) // - stream.println(indent + Util.helperName (parent, true) + ".read (istream, value);"); // // - } - - Vector vMembers = ((ValueEntry) entry).state (); - int noOfMembers = vMembers == null ? 0 : vMembers.size (); - - for (int k = 0; k < noOfMembers; k++) - { - TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry; - String memberName = member.name (); - SymtabEntry mType = member.type (); - - if (mType instanceof PrimitiveEntry || - mType instanceof TypedefEntry || - mType instanceof SequenceEntry || - mType instanceof StringEntry || - !member.arrayInfo ().isEmpty ()) - index = ((JavaGenerator)member.generator ()).read (index, indent, name + '.' + memberName, member, stream); - else if (mType instanceof ValueEntry) - { - String returnType = Util.javaQualifiedName (mType); - if (mType instanceof ValueBoxEntry) - // Remove -stateful. - //returnType = Util.javaStatefulName (mType); - returnType = Util.javaName (mType); - stream.println (" " + name + '.' + memberName + " = (" + returnType + - ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, true) + // - ".get_instance ());"); // - } - else - stream.println (indent + name + '.' + memberName + " = " + - Util.helperName (mType, true) + ".read (istream);"); // - } - - return index; - } // read - - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - // per Simon, make "static" write call istream.write_value. - // put real marshalling code in write_value. - stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, get_instance());"); // - stream.println (" }"); - stream.println (); - - // - // per Simon, 4/27/99, add static _write that marshals the state of this - // value for non-custom valuetypes - if (!((ValueEntry)entry).isCustom ()) - { - stream.println (" public static void _write (org.omg.CORBA.portable.OutputStream ostream, " + Util.javaName (entry) + " value)"); - stream.println (" {"); - write (0, " ", "value", entry, stream); - stream.println (" }"); - stream.println (); - } - - // done with "_write", now do "write_value - stream.println (" public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable obj)"); // - stream.println (" {"); - - // per Simon, 3/3/99, write_value for custom values throws an exception - if (((ValueEntry)entry).isCustom ()) - { - stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"custom values should use marshal()\");"); - } - else { - String entryName = Util.javaName(entry); - stream.println (" _write (ostream, (" + entryName + ") obj);"); // -// write (0, " ", "value", entry, stream); - } - } // helperWrite - - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - // First do the state members from concrete parent hierarchy - Vector vParents = ((ValueEntry)entry).derivedFrom (); - if (vParents != null && vParents.size () != 0) - { - ValueEntry parent = (ValueEntry)vParents.elementAt (0); - if (parent == null) - return index; - // Per Simon, 4/06/99 - call parent write. - // Per Simon, 4/27/99 - call parent _write. - if (! Util.javaQualifiedName(parent).equals ("java.io.Serializable")) // - stream.println(indent + Util.helperName (parent, true) + "._write (ostream, value);"); // - } - - Vector vMembers = ((ValueEntry) entry ).state (); - int noOfMembers = vMembers == null ? 0 : vMembers.size (); - for (int k = 0; k < noOfMembers; k++) - { - TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry; - String memberName = member.name (); - SymtabEntry mType = member.type (); - - if (mType instanceof PrimitiveEntry || - mType instanceof TypedefEntry || - mType instanceof SequenceEntry || - mType instanceof StringEntry || - !member.arrayInfo ().isEmpty ()) - index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream); - else - stream.println (indent + Util.helperName (mType, true) + // - ".write (ostream, " + name + '.' + memberName + ");"); - } - - return index; - } // write - - /** - * - **/ - protected void writeAbstract () - { - stream.print ("public interface " + v.name ()); - - // workaround: if the abstract value type does not have any parent, a vector - // containing ValueBase should be returned instead of an empty vector - if (v.derivedFrom ().size () == 0) - stream.print (" extends org.omg.CORBA.portable.ValueBase"); // - else - { - SymtabEntry parent; - // list the values the abstract value type inherits - for (int i = 0; i < v.derivedFrom ().size (); i++) - { - if (i == 0) - stream.print (" extends "); - else - stream.print (", "); - parent = (SymtabEntry) v.derivedFrom ().elementAt (i); - stream.print (Util.javaName (parent)); - } - } - - // list the interface the abstract value type supports - if (v.supports ().size () > 0) - { - stream.print (", "); - SymtabEntry intf = (SymtabEntry) v.supports ().elementAt (0); - stream.print (Util.javaName (intf)); - } - stream.println (); - stream.println ("{"); - } - - protected int emit = 0; - protected Factories factories = null; - protected Hashtable symbolTable = null; - protected ValueEntry v = null; - protected PrintWriter stream = null; - protected boolean explicitDefaultInit = false; // -} // class ValueGen --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java 2018-01-30 20:26:04.000000000 -0500 +++ /dev/null 2018-01-30 20:26:04.000000000 -0500 @@ -1,417 +0,0 @@ -/* - * Copyright (c) 1999, 2004, 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. - */ -/* - * COMPONENT_NAME: idl.toJava - * - * ORIGINS: 27 - * - * Licensed Materials - Property of IBM - * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 - * RMI-IIOP v1.0 - * - */ - -package com.sun.tools.corba.se.idl.toJavaPortable; - -// NOTES: -// -D62023 Update for Java 2.4 RTF -// -D62794.1 Don't include operations inherited from abstract valuetypes -// -D62794.1 Don't include operations inherited from supported interfaces - -import java.io.File; -import java.io.PrintWriter; -import java.util.Hashtable; -import java.util.Enumeration; -import java.util.Vector; - -import com.sun.tools.corba.se.idl.GenFileStream; -import com.sun.tools.corba.se.idl.InterfaceEntry; -import com.sun.tools.corba.se.idl.SymtabEntry; -import com.sun.tools.corba.se.idl.TypedefEntry; -import com.sun.tools.corba.se.idl.ValueEntry; -import com.sun.tools.corba.se.idl.ValueBoxEntry; -import com.sun.tools.corba.se.idl.InterfaceState; -import com.sun.tools.corba.se.idl.MethodEntry; -import com.sun.tools.corba.se.idl.AttributeEntry; -import com.sun.tools.corba.se.idl.PrimitiveEntry; -import com.sun.tools.corba.se.idl.SequenceEntry; -import com.sun.tools.corba.se.idl.StringEntry; -import com.sun.tools.corba.se.idl.StructEntry; - -/** - * - **/ -public class ValueGen24 extends ValueGen -{ - /** - * Public zero-argument constructor. - **/ - public ValueGen24 () - { - } // ctor - - /** - * d62023 - delete constructor; helper is abstract - **/ - protected void writeConstructor () - { - } // writeConstructor - - /** - *

-   * d62023 - delete write_value from non-boxed helpers
-   *        - delete _write from non-boxed helpers
-   * 
- **/ - public void helperWrite (SymtabEntry entry, PrintWriter stream) - { - // REVISIT: Abstract/Custom?? - // per Simon mail 5/17/99 - stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, id ());"); - } // helperWrite - - /** - * d62023 - **/ - public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream) - { - // REVISIT: Abstract/Custom?? - // per Simon mail 5/17/99 - stream.println (" return (" + entryName + ")((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (id ());"); - } // helperRead - - /** - * d62023 - suppress initializers from mapped value; now generated in - * the Helper class and Factory class - **/ - protected void writeInitializers () - { - // override to do nothing - } // writeInitializers - - /** - * d62023 - goes in mapped class, not Helper - **/ - protected void writeTruncatable () // - { - if (!v.isAbstract ()) { - stream.println (" private static String[] _truncatable_ids = {"); - stream.print (" " + Util.helperName(v, true) + ".id ()"); - - // Any safe ValueEntry must have a concete value parent. - // The topmost parent cannot be safe since it doesn't have - // a concrete parent. - ValueEntry child = v; - while (child.isSafe ()) - { - stream.println(","); - ValueEntry parent = (ValueEntry)child.derivedFrom ().elementAt (0); - stream.print(" \"" + Util.stripLeadingUnderscoresFromID (parent.repositoryID ().ID ()) + "\""); - child = parent; - } - stream.println(); - stream.println(" };"); - stream.println(); - stream.println (" public String[] _truncatable_ids() {"); - stream.println (" return _truncatable_ids;"); - stream.println (" }"); - stream.println (); - } - } // writeTruncatable - - class ImplStreamWriter { - private boolean isImplementsWritten = false ; - - public void writeClassName( String name ) - { - if (!isImplementsWritten) { - stream.print( " implements " ) ; - isImplementsWritten = true ; - } else - stream.print( ", " ) ; - - stream.print( name ) ; - } - } - - /** - * d62023 - CustomMarshal {@literal ->} CustomValue for custom valuetypes - * mapped class is abstract - **/ - protected void writeHeading () - { - ImplStreamWriter isw = new ImplStreamWriter() ; - - Util.writePackage (stream, v); - Util.writeProlog (stream, ((GenFileStream)stream).name ()); - - if (v.comment () != null) - v.comment ().generate ("", stream); - - if (v.isAbstract ()) { - writeAbstract (); - return; - } else - stream.print ("public abstract class " + v.name ()); - - // There should always be at least one parent: ValueBase - SymtabEntry parent = (SymtabEntry) v.derivedFrom ().elementAt (0); - - // If parent is ValueBase, it's mapped to java.io.Serializable - String parentName = Util.javaName (parent); - boolean cv = false; // true if we've already implemented CustomValue - - if (parentName.equals ("java.io.Serializable")) { - if (((ValueEntry)v).isCustom ()) { - isw.writeClassName( "org.omg.CORBA.portable.CustomValue" ) ; - cv = true; - } else - isw.writeClassName( "org.omg.CORBA.portable.StreamableValue" ) ; - } else if ( !((ValueEntry)parent).isAbstract ()) - stream.print (" extends " + parentName); - - // if inheriting from abstract values - for (int i = 0; i < v.derivedFrom ().size (); i++) { - parent = (SymtabEntry) v.derivedFrom ().elementAt (i); - if ( ((ValueEntry)parent).isAbstract ()) { - isw.writeClassName( Util.javaName(parent) ) ; - } - } - - // Write out the supported interfaces - Enumeration enumeration = v.supports().elements(); - while (enumeration.hasMoreElements()) { - InterfaceEntry ie = (InterfaceEntry)(enumeration.nextElement()) ; - String cname = Util.javaName(ie) ; - if (!ie.isAbstract()) - cname += "Operations" ; - isw.writeClassName( cname ) ; - } - - // for when a custom valuetype inherits from a non-custom valuetype - if ( v.isCustom () && !cv) - isw.writeClassName( "org.omg.CORBA.portable.CustomValue" ) ; - - stream.println (); - stream.println ("{"); - } // writeHeading - - /** - * d62023 - private state maps to protected, not default - **/ - protected void writeMembers () - { - // if the value type contains no data members, a null return is expected - if (v.state () == null) - return; - - for (int i = 0; i < v.state ().size (); i ++) - { - InterfaceState member = (InterfaceState) v.state ().elementAt (i); - SymtabEntry entry = (SymtabEntry) member.entry; - Util.fillInfo (entry); - - if (entry.comment () != null) - entry.comment ().generate (" ", stream); - - String modifier = " "; - if (member.modifier == InterfaceState.Public) - modifier = " public "; - else - modifier = " protected "; - Util.writeInitializer (modifier, entry.name (), "", entry, stream); - } - stream.println(); - } // writeMembers - - /** - * d62023 - methods need to be abstract writeStreamable - **/ - protected void writeMethods () - { - // contained vector contains methods, attributes, const, enums, exceptions, - // structs, unions, or typedefs that are declared inside the value object. - // State members of the nested types are also included in this vector. - // Thus, if the declaration of a constructed type is nested in the decl. - // of a state member, e.g struct x {boolean b;} memberx; - // the generation of the nested type must be handled here. - Enumeration e = v.contained ().elements (); - while (e.hasMoreElements ()) - { - SymtabEntry contained = (SymtabEntry)e.nextElement (); - if (contained instanceof AttributeEntry) - { - AttributeEntry element = (AttributeEntry)contained; - ((AttributeGen24)element.generator ()).abstractMethod (symbolTable, element, stream); - } - else if (contained instanceof MethodEntry) - { - MethodEntry element = (MethodEntry)contained; - ((MethodGen24)element.generator ()).abstractMethod (symbolTable, element, stream); - } - else - { - // Generate the type referenced by the typedef. - if (contained instanceof TypedefEntry) - contained.type ().generate (symbolTable, stream); - - // Note that we also need to generate the typedef itself if - // contained is a typedef. - contained.generate (symbolTable, stream); - } - } - - // Abstract values are mapped to interfaces. There is no need to generate - // the bindings for inheriting methods in case of inheritance from other - // abstract values or supporting interface - if (v.isAbstract ()) - return; - - // Non-abstract, Non-Custom valuetypes support the Streamable interface - if (!(v.isCustom () || v.isAbstract ())) - writeStreamableMethods (); - } // writeMethods - - /** - * d62023 - call super._read() - **/ - public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - // First do the state members from concrete parent hierarchy - Vector vParents = ((ValueEntry) entry).derivedFrom (); - if (vParents != null && vParents.size() != 0) - { - ValueEntry parent = (ValueEntry) vParents.elementAt (0); - if (parent == null) - return index; - - // call super._read if non-abstract value parent - if ((!parent.isAbstract ()) && (! Util.javaQualifiedName(parent).equals ("java.io.Serializable"))) // - stream.println(indent + "super._read (istream);"); - } - - Vector vMembers = ((ValueEntry) entry).state (); - int noOfMembers = vMembers == null ? 0 : vMembers.size (); - - for (int k = 0; k < noOfMembers; k++) - { - TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry; - String memberName = member.name (); - SymtabEntry mType = member.type (); - - if (mType instanceof PrimitiveEntry || - mType instanceof TypedefEntry || - mType instanceof SequenceEntry || - mType instanceof StringEntry || - !member.arrayInfo ().isEmpty ()) - index = ((JavaGenerator)member.generator ()).read (index, indent, name + '.' + memberName, member, stream); - else - stream.println (indent + name + '.' + memberName + " = " + - Util.helperName (mType, true) + ".read (istream);"); // - } - - return index; - } // read - - /** - * d62023 - call super._write() - **/ - public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream) - { - // First do the state members from concrete parent hierarchy - Vector vParents = ((ValueEntry)entry).derivedFrom (); - if (vParents != null && vParents.size () != 0) - { - ValueEntry parent = (ValueEntry)vParents.elementAt (0); - if (parent == null) - return index; - // call super._read if non-abstract value parent - if ((!parent.isAbstract ()) && (! Util.javaQualifiedName(parent).equals ("java.io.Serializable"))) // - stream.println(indent + "super._write (ostream);"); - } - - Vector vMembers = ((ValueEntry) entry ).state (); - int noOfMembers = vMembers == null ? 0 : vMembers.size (); - for (int k = 0; k < noOfMembers; k++) - { - TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry; - String memberName = member.name (); - SymtabEntry mType = member.type (); - - if (mType instanceof PrimitiveEntry || - mType instanceof TypedefEntry || - mType instanceof SequenceEntry || - mType instanceof StringEntry || - !member.arrayInfo ().isEmpty ()) - index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream); - else - stream.println (indent + Util.helperName (mType, true) + // - ".write (ostream, " + name + '.' + memberName + ");"); - } - - return index; - } // write - - /** - * d62023 - generate factory interface and default factory - **/ - public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str) - { - this.symbolTable = symbolTable; - this.v = v; - init (); - - openStream (); - if (stream == null) - return; - generateTie (); - generateHelper (); - generateHolder (); - if (!v.isAbstract ()) { - generateValueFactory (); - generateDefaultFactory (); - } - writeHeading (); - writeBody (); - writeClosing (); - closeStream (); - } // generate - - /** - * - **/ - protected void generateValueFactory () - { - ((Factories)Compile.compiler.factories ()).valueFactory ().generate (symbolTable, v); - } // generateValueFactory - - /** - * - **/ - protected void generateDefaultFactory () - { - ((Factories)Compile.compiler.factories ()).defaultFactory ().generate (symbolTable, v); - } // generateDefaultFactory -} --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp 2018-01-30 20:26:05.000000000 -0500 +++ /dev/null 2018-01-30 20:26:05.000000000 -0500 @@ -1,111 +0,0 @@ -# -# Copyright (c) 1999, 2009, 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. -# - -# -# COMPONENT_NAME: idl.toJava -# -# ORIGINS: 27 -# -# Licensed Materials - Property of IBM -# 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 -# RMI-IIOP v1.0 -# -# -# Translator: Each line below is of the form "=". -# The keys are NOT to be translated. -# The messages ARE to be translated. -# -# DO NOT translate the following: -# IBM -# IDL -# Java -# -# %0 is a parameter to the message. Do not translate it. -# -# A backslash (\) at the end of a line is a line continuation -# character. A backslash at the beginning of a line means don't -# ignore leading blanks (they normally are). These backslashes -# should remain in the message. -# -# Translator: Start Translating -# -toJavaProlog1=Generated by the %0 -toJavaProlog2=from %0 -PreEmit.indeterminateTypeInfo=Cannot determine type infomation for %0. -InterfaceGen.noImpl=No local implementation found for %0. -Version.product=IDL-to-Java compiler (portable), version "%0" -Version.number=3.2 -NameModifier.TooManyPercent=Pattern contains more than one percent characters -NameModifier.NoPercent=Pattern does not contain a percent character -NameModifier.InvalidChar=Pattern contains an invalid character %0 -# -# Translator: In the list of options below, do not translate: -# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase -# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile" -# -usage=Compiler Usage:\n\ -\n\ -\ java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] \n\ -\n\ -where is the name of a file containing IDL definitions, and\n\ -[options] is any combination of the options listed below. The options\n\ -are optional and may appear in any order; is required and\n\ -must appear last.\n\ -\ \n\ -Options:\n\ - -d This is equivalent to the following line in an\n\ -\ IDL file: #define \n\ - -emitAll Emit all types, including those found in #included files.\n\ - -f Define what bindings to emit. is one of client,\n\ -\ server, all, serverTIE, allTIE. serverTIE and allTIE\n\ -\ cause delegate model skeletons to be emitted. If this\n\ -\ flag is not used, -fclient is assumed.\n\ - -i By default, the current directory is scanned for\n\ -\ included files. This option adds another directory.\n\ - -keep If a file to be generated already exists, do not\n\ -\ overwrite it. By default it is overwritten.\n\ - -noWarn Suppress warnings.\n\ - -oldImplBase Generate skeletons compatible with old (pre-1.4) JDK ORBs.\n\ - -pkgPrefix When the type or module name is encountered at\n\ -\ file scope, begin the Java package name for all files\n\ -\ generated for with .\n\ - -pkgTranslate When the type or module name in encountered, replace\n\ -\ it with in the generated java package. Note that\n\ -\ pkgPrefix changes are made first. must match the\n\ -\ full package name exactly. Also, must not be\n\ -\ org, org.omg, or any subpackage of org.omg.\n\ - -skeletonName Name the skeleton according to the pattern.\n\ -\ The defaults are:\n\ -\ %POA for the POA base class (-fserver or -fall) \n\ -\ _%ImplBase for the oldImplBase base class\n\ -\ (-oldImplBase and (-fserver or -fall)).\n\ - -td use for the output directory instead of\n\ -\ the current directory.\n\ - -tieName Name the tie according to the pattern. The defaults are:\n\ -\ %POATie for the POA tie (-fserverTie or -fallTie) \n\ -\ %_Tie for the oldImplBase tie\n\ -\ (-oldImplBase and (-fserverTie or -fallTie)).\n\ - -v, -verbose Verbose mode.\n\ - -version Display the version number and quit.\n --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp 2018-01-30 20:26:06.000000000 -0500 +++ /dev/null 2018-01-30 20:26:06.000000000 -0500 @@ -1,69 +0,0 @@ -# -# Copyright (c) 1999, 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. -# - -# -# COMPONENT_NAME: idl.toJava -# -# ORIGINS: 27 -# -# Licensed Materials - Property of IBM -# 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 -# RMI-IIOP v1.0 -# -# -# Translator: Each line below is of the form "=". -# The keys are NOT to be translated. -# The messages ARE to be translated. -# -# DO NOT translate the following: -# IBM -# IDL -# Java -# -# %0 is a parameter to the message. Do not translate it. -# -# A backslash (\) at the end of a line is a line continuation -# character. A backslash at the beginning of a line means don't -# ignore leading blanks (they normally are). These backslashes -# should remain in the message. -# -# Translator: Start Translating -# -toJavaProlog1=%0\u306B\u3088\u3063\u3066\u751F\u6210\u3055\u308C\u307E\u3057\u305F -toJavaProlog2=%0\u304B\u3089 -PreEmit.indeterminateTypeInfo=%0\u306E\u30BF\u30A4\u30D7\u60C5\u5831\u3092\u5224\u5225\u3067\u304D\u307E\u305B\u3093\u3002 -InterfaceGen.noImpl=%0\u306E\u30ED\u30FC\u30AB\u30EB\u5B9F\u88C5\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002 -Version.product=IDL-to-Java\u30B3\u30F3\u30D1\u30A4\u30E9(\u30DD\u30FC\u30BF\u30D6\u30EB)\u3001\u30D0\u30FC\u30B8\u30E7\u30F3"%0" -Version.number=3.2 -NameModifier.TooManyPercent=\u30D1\u30BF\u30FC\u30F3\u306B\u8907\u6570\u306E\u30D1\u30FC\u30BB\u30F3\u30C8\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059 -NameModifier.NoPercent=\u30D1\u30BF\u30FC\u30F3\u306B\u30D1\u30FC\u30BB\u30F3\u30C8\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093 -NameModifier.InvalidChar=\u30D1\u30BF\u30FC\u30F3\u306B\u7121\u52B9\u306A\u6587\u5B57%0\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059 -# -# Translator: In the list of options below, do not translate: -# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase -# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile" -# -usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n\n java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] \n\n\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n \u540C\u3058\u3067\u3059: #define \n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\u767A\u884C\u3057\u307E\u3059\u3002\n-f \u767A\u884C\u3059\u308B\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u3092\u5B9A\u7FA9\u3057\u307E\u3059\u3002\u306Fclient\u3001\n server\u3001all\u3001serverTIE\u3001allTIE\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002serverTIE\u3068allTIE\u306F\n \u59D4\u4EFB\u30E2\u30C7\u30EB\u30FB\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u767A\u884C\u3057\u307E\u3059\u3002\u3053\u306E\u30D5\u30E9\u30B0\u3092\n \u4F7F\u7528\u3057\u306A\u3044\u5834\u5408\u306F\u3001-fclient\u3068\u307F\u306A\u3055\u308C\u307E\u3059\u3002\n-i \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-oldImplBase \u53E4\u3044(1.4\u4EE5\u524D) JDK ORB\u3068\u4E92\u63DB\u6027\u306E\u3042\u308B\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n-pkgPrefix \u30D5\u30A1\u30A4\u30EB\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n \u306B\u5BFE\u3057\u3066\u751F\u6210\u3055\u308C\u305F\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u306EJava\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u3092\n \u3067\u59CB\u3081\u307E\u3059\u3002\n-pkgTranslate \u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n \u751F\u6210\u3055\u308C\u305FJava\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u3067\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002pkgPrefix\u306E\n \u5909\u66F4\u304C\u5148\u306B\u884C\u308F\u308C\u308B\u3053\u3068\u306B\u6CE8\u610F\u3057\u3066\u304F\u3060\u3055\u3044\u3002\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n \u6B63\u5F0F\u540D\u3068\u5B8C\u5168\u306B\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u307E\u305F\u3001\u3092\n \ -org\u3001org.omg\u307E\u305F\u306Forg.omg\u306E\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\n-skeletonName \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066\u30B9\u30B1\u30EB\u30C8\u30F3\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\n \u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n POA\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F%POA (-fserver\u307E\u305F\u306F-fall) \n oldImplBase\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F_%ImplBase\n (-oldImplBase\u304A\u3088\u3073(-fserver\u307E\u305F\u306F-fall))\u3002\n-td \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u304B\u308F\u308A\u306B\u3092\n \u4F7F\u7528\u3057\u307E\u3059\u3002\n-tieName \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066tie\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n POA tie\u306E\u5834\u5408\u306F%POATie (-fserverTie\u307E\u305F\u306F-fallTie) \n oldImplBase tie\u306E\u5834\u5408\u306F%_Tie\n (-oldImplBase\u304A\u3088\u3073(-fserverTie\u307E\u305F\u306F-fallTie))\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3057\u307E\u3059\u3002\n --- old/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp 2018-01-30 20:26:06.000000000 -0500 +++ /dev/null 2018-01-30 20:26:06.000000000 -0500 @@ -1,68 +0,0 @@ -# -# Copyright (c) 1999, 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. -# - -# -# COMPONENT_NAME: idl.toJava -# -# ORIGINS: 27 -# -# Licensed Materials - Property of IBM -# 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999 -# RMI-IIOP v1.0 -# -# -# Translator: Each line below is of the form "=". -# The keys are NOT to be translated. -# The messages ARE to be translated. -# -# DO NOT translate the following: -# IBM -# IDL -# Java -# -# %0 is a parameter to the message. Do not translate it. -# -# A backslash (\) at the end of a line is a line continuation -# character. A backslash at the beginning of a line means don't -# ignore leading blanks (they normally are). These backslashes -# should remain in the message. -# -# Translator: Start Translating -# -toJavaProlog1=\u7531%0\u751F\u6210 -toJavaProlog2=\u4ECE%0 -PreEmit.indeterminateTypeInfo=\u65E0\u6CD5\u786E\u5B9A%0\u7684\u7C7B\u578B\u4FE1\u606F\u3002 -InterfaceGen.noImpl=\u627E\u4E0D\u5230%0\u7684\u672C\u5730\u5B9E\u73B0\u3002 -Version.product=IDL-to-Java \u7F16\u8BD1\u5668 (\u53EF\u79FB\u690D), \u7248\u672C "%0" -Version.number=3.2 -NameModifier.TooManyPercent=\u6A21\u5F0F\u4E2D\u5305\u542B\u591A\u4E2A\u767E\u5206\u6BD4\u5B57\u7B26 -NameModifier.NoPercent=\u6A21\u5F0F\u4E2D\u4E0D\u5305\u542B\u767E\u5206\u6BD4\u5B57\u7B26 -NameModifier.InvalidChar=\u6A21\u5F0F\u4E2D\u5305\u542B\u65E0\u6548\u5B57\u7B26 %0 -# -# Translator: In the list of options below, do not translate: -# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase -# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile" -# -usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n\n java com.sun.tools.corba.se.idl.toJavaPortable.Compile [\u9009\u9879] \n\n\u5176\u4E2D, \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; \u662F\u5FC5\u9700\u7684,\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-f \u5B9A\u4E49\u8981\u53D1\u51FA\u54EA\u4E9B\u7ED1\u5B9A\u3002 \u662F client,\n server, all, serverTIE, allTIE \u4E4B\u4E00\u3002serverTIE \u548C allTIE\n \u5BFC\u81F4\u53D1\u51FA\u59D4\u6D3E\u6A21\u578B\u9AA8\u67B6\u3002\u5982\u679C\u672A\u4F7F\u7528\n \u6B64\u6807\u8BB0, \u5C06\u5047\u5B9A\u4E3A -fclient\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-oldImplBase \u751F\u6210\u4E0E\u65E7\u7248 (1.4 \u7248\u4E4B\u524D) JDK ORB \u517C\u5BB9\u7684\u9AA8\u67B6\u3002\n-pkgPrefix <\u524D\u7F00> \u5F53\u5728\u6587\u4EF6\u8303\u56F4\u5185\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D \u65F6,\n \u5728\u4E3A \u751F\u6210\u7684\u6240\u6709\u6587\u4EF6\u7684 Java \u7A0B\u5E8F\u5305\u540D\u524D\n \u6DFB\u52A0 <\u524D\u7F00>\u3002\n-pkgTranslate \u5F53\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D \u65F6, \u5728\n \u751F\u6210\u7684 Java \u7A0B\u5E8F\u5305\u4E2D\u5C06\u5176\u66FF\u6362\u4E3A \u3002\u8BF7\u6CE8\u610F, \n \u5C06\u9996\u5148\u8FDB\u884C pkgPrefix \u66F4\u6539\u3002 \u5FC5\u987B\u4E0E\n \u5B8C\u6574\u7A0B\u5E8F\u5305\u540D\u5B8C\u5168\u5339\u914D\u3002\u53E6\u5916, \u4E0D\u80FD\u4E3A\n org, org.omg \u6216 org.omg \u7684\u4EFB\u4F55\u5B50\u7A0B\u5E8F\u5305\u3002\n-skeletonName \u6839\u636E\u6A21\u5F0F\u547D\u540D\u9AA8\u67B6\u3002\n \u9ED8\u8BA4\u503C\u4E3A:\n %POA \u8868\u793A POA \u57FA\u7C7B (-fserver \u6216 -fall) \n _%ImplBase \u8868\u793A oldImplBase \u57FA\u7C7B\n (-oldImplBase \u548C (-fserver \u6216 -fall))\u3002\n-td \u4F7F\u7528 \u8868\u793A\u8F93\u51FA\u76EE\u5F55\u4EE5\u4EE3\u66FF\n \u5F53\u524D\u76EE\u5F55\u3002\n-tieName \u6839\u636E\u6A21\u5F0F\u547D\u540D tie\u3002\u9ED8\u8BA4\u503C\u4E3A:\n %POATie \u8868\u793A POA tie (-fserverTie \u6216 -fallTie) \n %_Tie \u8868\u793A oldImplBase tie\n (-oldImplBase \u548C (-fserverTie \u6216 -fallTie))\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u5E76\u9000\u51FA\u3002\n --- old/src/java.corba/share/classes/javax/activity/ActivityCompletedException.java 2018-01-30 20:26:07.000000000 -0500 +++ /dev/null 2018-01-30 20:26:07.000000000 -0500 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.activity; - -/** - * This exception may be thrown on any method for which Activity context is - * accessed and indicates that ongoing work within the Activity is not - * possible. This may be because the Activity has been instructed to complete - * with CompletionStatusFailOnly or has ended as a result of a timeout. This - * exception will be propagated across ORB boundaries via an - * org.omg.CORBA.ACTIVITY_COMPLETED system exception. An application should - * handle this error by attempting to complete the Activity. - */ -public class ActivityCompletedException extends java.rmi.RemoteException -{ - /** - * Constructs a new instance with null as its detail message. - */ - public ActivityCompletedException() { super(); } - - /** - * Constructs a new instance with the specified detail message. - * - * @param message the detail message. - */ - public ActivityCompletedException(String message) { - super(message); - } - - /** - * Constructs a new throwable with the specified cause. - * - * @param cause a chained exception of type - * Throwable. - */ - public ActivityCompletedException(Throwable cause) { - this("", cause); - } - - /** - * Constructs a new throwable with the specified detail message and cause. - * - * @param message the detail message. - * - * @param cause a chained exception of type - * Throwable. - */ - public ActivityCompletedException(String message, Throwable cause) { - super(message, cause); - } -} --- old/src/java.corba/share/classes/javax/activity/ActivityRequiredException.java 2018-01-30 20:26:08.000000000 -0500 +++ /dev/null 2018-01-30 20:26:08.000000000 -0500 @@ -1,72 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.activity; - -/** - * This exception is thrown by a container if Activity context is not received - * on a method for which Activity context is mandatory. This exception - * indicates a deployment or application configuration error. This exception - * will be propagated across ORB boundaries via an - * org.omg.CORBA.ACTIVITY_REQUIRED system exception. - */ -public class ActivityRequiredException extends java.rmi.RemoteException -{ - /** - * Constructs a new instance with null as its detail message. - */ - public ActivityRequiredException() { super(); } - - /** - * Constructs a new instance with the specified detail message. - * - * @param message the detail message. - */ - public ActivityRequiredException(String message) { - super(message); - } - - /** - * Constructs a new throwable with the specified cause. - * - * @param cause a chained exception of type - * Throwable. - */ - public ActivityRequiredException(Throwable cause) { - this("", cause); - } - - /** - * Constructs a new throwable with the specified detail message and cause. - * - * @param message the detail message. - * - * @param cause a chained exception of type - * Throwable. - */ - public ActivityRequiredException(String message, Throwable cause) { - super(message, cause); - } -} --- old/src/java.corba/share/classes/javax/activity/InvalidActivityException.java 2018-01-30 20:26:08.000000000 -0500 +++ /dev/null 2018-01-30 20:26:08.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.activity; - -/** - * This exception may be thrown on any method for which Activity context - * is accessed and indicates that the attempted invocation or the Activity - * context associated with the attempted invocation is incompatible with - * the Activity's current state. It may also be thrown by a container if - * Activity context is received on a method for which Activity context is - * forbidden. This exception will be propagated across J2EE Activity Service - * ORB boundaries via an org.omg.CORBA.INVALID_ACTIVITY system exception. - * An application should handle this error by attempting to complete the - * Activity. - */ -public class InvalidActivityException extends java.rmi.RemoteException -{ - /** - * Constructs a new instance with null as its detail message. - */ - public InvalidActivityException() { super(); } - - /** - * Constructs a new instance with the specified detail message. - * - * @param message the detail message. - */ - public InvalidActivityException(String message) { - super(message); - } - - /** - * Constructs a new throwable with the specified cause. - * - * @param cause a chained exception of type - * Throwable. - */ - public InvalidActivityException(Throwable cause) { - this("", cause); - } - - /** - * Constructs a new throwable with the specified detail message and cause. - * - * @param message the detail message. - * - * @param cause a chained exception of type - * Throwable. - */ - public InvalidActivityException(String message, Throwable cause) { - super(message, cause); - } -} --- old/src/java.corba/share/classes/javax/activity/package.html 2018-01-30 20:26:09.000000000 -0500 +++ /dev/null 2018-01-30 20:26:09.000000000 -0500 @@ -1,36 +0,0 @@ - - - - - - - -Contains Activity service related exceptions thrown by the ORB machinery during -unmarshalling. - -@since 1.5 - - --- old/src/java.corba/share/classes/javax/rmi/CORBA/ClassDesc.java 2018-01-30 20:26:10.000000000 -0500 +++ /dev/null 2018-01-30 20:26:10.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.rmi.CORBA; - -/** - * This class is used to marshal java.lang.Class objects over IIOP. - */ -public class ClassDesc implements java.io.Serializable { - - /** - * @serial The class's RepositoryId. - */ - private String repid; - - /** - * @serial A space-separated list of codebase URLs. - */ - private String codebase; -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/GetORBPropertiesFileAction.java 2018-01-30 20:26:10.000000000 -0500 +++ /dev/null 2018-01-30 20:26:10.000000000 -0500 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ - -/* - * (C) Copyright IBM Corp. 1993 - 1997 - All Rights Reserved - * - * The original version of this source code and documentation is - * copyrighted and owned by IBM, Inc. These materials are provided under - * terms of a License Agreement between IBM and Sun. This technology is - * protected by multiple US and International patents. This notice and - * attribution to IBM may not be removed. - * - */ - - -package javax.rmi.CORBA; - -import java.io.IOException; -import java.io.File; -import java.io.FileInputStream; - -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Properties; - -class GetORBPropertiesFileAction implements PrivilegedAction { - private boolean debug = false ; - - public GetORBPropertiesFileAction () { - } - - private String getSystemProperty(final String name) { - // This will not throw a SecurityException because this - // class was loaded from rt.jar using the bootstrap classloader. - String propValue = (String) AccessController.doPrivileged( - new PrivilegedAction() { - public java.lang.Object run() { - return System.getProperty(name); - } - } - ); - - return propValue; - } - - private void getPropertiesFromFile( Properties props, String fileName ) - { - try { - File file = new File( fileName ) ; - if (!file.exists()) - return ; - - FileInputStream in = new FileInputStream( file ) ; - - try { - props.load( in ) ; - } finally { - in.close() ; - } - } catch (Exception exc) { - if (debug) - System.out.println( "ORB properties file " + fileName + - " not found: " + exc) ; - } - } - - public Object run() - { - Properties defaults = new Properties() ; - - String javaHome = getSystemProperty( "java.home" ) ; - String fileName = javaHome + File.separator + "lib" + File.separator + - "orb.properties" ; - - getPropertiesFromFile( defaults, fileName ) ; - - Properties results = new Properties( defaults ) ; - - String userHome = getSystemProperty( "user.home" ) ; - fileName = userHome + File.separator + "orb.properties" ; - - getPropertiesFromFile( results, fileName ) ; - return results ; - } -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/PortableRemoteObjectDelegate.java 2018-01-30 20:26:11.000000000 -0500 +++ /dev/null 2018-01-30 20:26:11.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.rmi.CORBA; - -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; -import java.rmi.Remote; - -/** - * Supports delegation for method implementations in {@link javax.rmi.PortableRemoteObject}. - * The delegate is a singleton instance of a class that implements this - * interface and provides a replacement implementation for all the - * methods of javax.rmi.PortableRemoteObject. - * - * Delegates are enabled by providing the delegate's class name as the - * value of the - * javax.rmi.CORBA.PortableRemoteObjectClass - * system property. - * - * @see javax.rmi.PortableRemoteObject - */ -public interface PortableRemoteObjectDelegate { - - /** - * Delegation call for {@link javax.rmi.PortableRemoteObject#exportObject}. - */ - void exportObject(Remote obj) - throws RemoteException; - - /** - * Delegation call for {@link javax.rmi.PortableRemoteObject#toStub}. - */ - Remote toStub (Remote obj) - throws NoSuchObjectException; - - /** - * Delegation call for {@link javax.rmi.PortableRemoteObject#unexportObject}. - */ - void unexportObject(Remote obj) - throws NoSuchObjectException; - - /** - * Delegation call for {@link javax.rmi.PortableRemoteObject#narrow}. - */ - java.lang.Object narrow (java.lang.Object narrowFrom, - java.lang.Class narrowTo) - throws ClassCastException; - - /** - * Delegation call for {@link javax.rmi.PortableRemoteObject#connect}. - */ - void connect (Remote target, Remote source) - throws RemoteException; - -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/Stub.java 2018-01-30 20:26:12.000000000 -0500 +++ /dev/null 2018-01-30 20:26:12.000000000 -0500 @@ -1,261 +0,0 @@ -/* - * Copyright (c) 1998, 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. - */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.rmi.CORBA; - -import org.omg.CORBA.ORB; -import org.omg.CORBA.INITIALIZE; -import org.omg.CORBA_2_3.portable.ObjectImpl; - -import java.io.IOException; -import java.rmi.RemoteException; -import java.io.File; -import java.io.FileInputStream; -import java.net.MalformedURLException ; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Properties; -import java.rmi.server.RMIClassLoader; - -import com.sun.corba.se.impl.orbutil.GetPropertyAction; - - -/** - * Base class from which all RMI-IIOP stubs must inherit. - */ -public abstract class Stub extends ObjectImpl - implements java.io.Serializable { - - private static final long serialVersionUID = 1087775603798577179L; - - // This can only be set at object construction time (no sync necessary). - private transient StubDelegate stubDelegate = null; - private static Class stubDelegateClass = null; - private static final String StubClassKey = "javax.rmi.CORBA.StubClass"; - - static { - Object stubDelegateInstance = createDelegate(StubClassKey); - if (stubDelegateInstance != null) - stubDelegateClass = stubDelegateInstance.getClass(); - } - - - /** - * Returns a hash code value for the object which is the same for all stubs - * that represent the same remote object. - * @return the hash code value. - */ - public int hashCode() { - - if (stubDelegate == null) { - setDefaultDelegate(); - } - - if (stubDelegate != null) { - return stubDelegate.hashCode(this); - } - - return 0; - } - - /** - * Compares two stubs for equality. Returns true when used to compare stubs - * that represent the same remote object, and false otherwise. - * @param obj the reference object with which to compare. - * @return true if this object is the same as the obj - * argument; false otherwise. - */ - public boolean equals(java.lang.Object obj) { - - if (stubDelegate == null) { - setDefaultDelegate(); - } - - if (stubDelegate != null) { - return stubDelegate.equals(this, obj); - } - - return false; - } - - /** - * Returns a string representation of this stub. Returns the same string - * for all stubs that represent the same remote object. - * @return a string representation of this stub. - */ - public String toString() { - - - if (stubDelegate == null) { - setDefaultDelegate(); - } - - String ior; - if (stubDelegate != null) { - ior = stubDelegate.toString(this); - if (ior == null) { - return super.toString(); - } else { - return ior; - } - } - return super.toString(); - } - - /** - * Connects this stub to an ORB. Required after the stub is deserialized - * but not after it is demarshalled by an ORB stream. If an unconnected - * stub is passed to an ORB stream for marshalling, it is implicitly - * connected to that ORB. Application code should not call this method - * directly, but should call the portable wrapper method - * {@link javax.rmi.PortableRemoteObject#connect}. - * @param orb the ORB to connect to. - * @exception RemoteException if the stub is already connected to a different - * ORB, or if the stub does not represent an exported remote or local object. - */ - public void connect(ORB orb) throws RemoteException { - - if (stubDelegate == null) { - setDefaultDelegate(); - } - - if (stubDelegate != null) { - stubDelegate.connect(this, orb); - } - - } - - /** - * Serialization method to restore the IOR state. - */ - private void readObject(java.io.ObjectInputStream stream) - throws IOException, ClassNotFoundException { - - if (stubDelegate == null) { - setDefaultDelegate(); - } - - if (stubDelegate != null) { - stubDelegate.readObject(this, stream); - } - - } - - /** - * Serialization method to save the IOR state. - * @serialData The length of the IOR type ID (int), followed by the IOR type ID - * (byte array encoded using ISO8859-1), followed by the number of IOR profiles - * (int), followed by the IOR profiles. Each IOR profile is written as a - * profile tag (int), followed by the length of the profile data (int), followed - * by the profile data (byte array). - */ - private void writeObject(java.io.ObjectOutputStream stream) throws IOException { - - if (stubDelegate == null) { - setDefaultDelegate(); - } - - if (stubDelegate != null) { - stubDelegate.writeObject(this, stream); - } - } - - private void setDefaultDelegate() { - if (stubDelegateClass != null) { - try { - stubDelegate = (javax.rmi.CORBA.StubDelegate) stubDelegateClass.newInstance(); - } catch (Exception ex) { - // what kind of exception to throw - // delegate not set therefore it is null and will return default - // values - } - } - } - - // Same code as in PortableRemoteObject. Can not be shared because they - // are in different packages and the visibility needs to be package for - // security reasons. If you know a better solution how to share this code - // then remove it from PortableRemoteObject. Also in Util.java - private static Object createDelegate(String classKey) { - String className = (String) - AccessController.doPrivileged(new GetPropertyAction(classKey)); - if (className == null) { - Properties props = getORBPropertiesFile(); - if (props != null) { - className = props.getProperty(classKey); - } - } - - if (className == null) { - return new com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl(); - } - - try { - return loadDelegateClass(className).newInstance(); - } catch (ClassNotFoundException ex) { - INITIALIZE exc = new INITIALIZE( "Cannot instantiate " + className); - exc.initCause( ex ) ; - throw exc ; - } catch (Exception ex) { - INITIALIZE exc = new INITIALIZE( "Error while instantiating" + className); - exc.initCause( ex ) ; - throw exc ; - } - - } - - private static Class loadDelegateClass( String className ) throws ClassNotFoundException - { - try { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - return Class.forName(className, false, loader); - } catch (ClassNotFoundException e) { - // ignore, then try RMIClassLoader - } - - try { - return RMIClassLoader.loadClass(className); - } catch (MalformedURLException e) { - String msg = "Could not load " + className + ": " + e.toString(); - ClassNotFoundException exc = new ClassNotFoundException( msg ) ; - throw exc ; - } - } - - /** - * Load the orb.properties file. - */ - private static Properties getORBPropertiesFile () { - return (Properties) AccessController.doPrivileged(new GetORBPropertiesFileAction()); - } - -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/StubDelegate.java 2018-01-30 20:26:13.000000000 -0500 +++ /dev/null 2018-01-30 20:26:13.000000000 -0500 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.rmi.CORBA; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.rmi.RemoteException; -import org.omg.CORBA.ORB; - -/** - * Supports delegation for method implementations in {@link Stub}. - * A delegate is an instance of a class that implements this - * interface and provides a replacement implementation for all the - * methods of javax.rmi.CORBA.Stub. If delegation is - * enabled, each stub has an associated delegate. - * - * Delegates are enabled by providing the delegate's class name as the - * value of the - * javax.rmi.CORBA.StubClass - * system property. - * - * @see Stub - */ -public interface StubDelegate { - - /** - * Delegation call for {@link Stub#hashCode}. - */ - int hashCode(Stub self); - - /** - * Delegation call for {@link Stub#equals}. - */ - boolean equals(Stub self, java.lang.Object obj); - - /** - * Delegation call for {@link Stub#toString}. - */ - String toString(Stub self); - - /** - * Delegation call for {@link Stub#connect}. - */ - void connect(Stub self, ORB orb) - throws RemoteException; - - // _REVISIT_ cannot link to Stub.readObject directly... why not? - /** - * Delegation call for - * Stub.readObject(java.io.ObjectInputStream). - */ - void readObject(Stub self, ObjectInputStream s) - throws IOException, ClassNotFoundException; - - // _REVISIT_ cannot link to Stub.writeObject directly... why not? - /** - * Delegation call for - * Stub.writeObject(java.io.ObjectOutputStream). - */ - void writeObject(Stub self, ObjectOutputStream s) - throws IOException; - -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/Tie.java 2018-01-30 20:26:13.000000000 -0500 +++ /dev/null 2018-01-30 20:26:13.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.rmi.CORBA; - -import java.rmi.Remote; -import java.util.Hashtable; - -import org.omg.CORBA.portable.ApplicationException; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.portable.ObjectImpl; -import org.omg.CORBA.portable.ResponseHandler; -import org.omg.CORBA.portable.Delegate; -import org.omg.CORBA.ORB; - -/** - * Defines methods which all RMI-IIOP server side ties must implement. - */ -public interface Tie extends org.omg.CORBA.portable.InvokeHandler { - /** - * Returns an object reference for the target object represented by - * this tie. - * @return an object reference for the target object. - */ - org.omg.CORBA.Object thisObject(); - - /** - * Deactivates the target object represented by this tie. - */ - void deactivate() throws java.rmi.NoSuchObjectException; - - /** - * Returns the ORB for this tie. - * @return the ORB. - */ - ORB orb(); - - /** - * Sets the ORB for this tie. - * @param orb the ORB. - */ - void orb(ORB orb); - - /** - * Called by {@link Util#registerTarget} to set the target - * for this tie. - * @param target the object to use as the target for this tie. - */ - void setTarget(java.rmi.Remote target); - - /** - * Returns the target for this tie. - * @return the target. - */ - java.rmi.Remote getTarget(); -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/Util.java 2018-01-30 20:26:14.000000000 -0500 +++ /dev/null 2018-01-30 20:26:14.000000000 -0500 @@ -1,405 +0,0 @@ -/* - * Copyright (c) 1998, 2016, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.rmi.CORBA; - -import java.rmi.RemoteException; - -import org.omg.CORBA.ORB; -import org.omg.CORBA.INITIALIZE; -import org.omg.CORBA.SystemException; -import org.omg.CORBA.Any; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.portable.ObjectImpl; - -import javax.rmi.CORBA.Tie; -import java.rmi.Remote; -import java.io.File; -import java.io.FileInputStream; -import java.io.SerializablePermission; -import java.net.MalformedURLException ; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Properties; -import java.rmi.server.RMIClassLoader; - -import com.sun.corba.se.impl.orbutil.GetPropertyAction; - -/** - * Provides utility methods that can be used by stubs and ties to - * perform common operations. - */ -public class Util { - - // This can only be set at static initialization time (no sync necessary). - private static final javax.rmi.CORBA.UtilDelegate utilDelegate; - private static final String UtilClassKey = "javax.rmi.CORBA.UtilClass"; - - static { - utilDelegate = (javax.rmi.CORBA.UtilDelegate)createDelegate(UtilClassKey); - } - - private Util(){} - - /** - * Maps a SystemException to a RemoteException. - * @param ex the SystemException to map. - * @return the mapped exception. - */ - public static RemoteException mapSystemException(SystemException ex) { - - if (utilDelegate != null) { - return utilDelegate.mapSystemException(ex); - } - return null; - } - - /** - * Writes any java.lang.Object as a CORBA any. - * @param out the stream in which to write the any. - * @param obj the object to write as an any. - */ - public static void writeAny(OutputStream out, Object obj) { - - if (utilDelegate != null) { - utilDelegate.writeAny(out, obj); - } - } - - /** - * Reads a java.lang.Object as a CORBA any. - * @param in the stream from which to read the any. - * @return the object read from the stream. - */ - public static Object readAny(InputStream in) { - - if (utilDelegate != null) { - return utilDelegate.readAny(in); - } - return null; - } - - /** - * Writes a java.lang.Object as a CORBA Object. If {@code obj} is - * an exported RMI-IIOP server object, the tie is found - * and wired to {@code obj}, then written to - * {@code out.write_Object(org.omg.CORBA.Object)}. - * If {@code obj} is a CORBA Object, it is written to - * {@code out.write_Object(org.omg.CORBA.Object)}. - * @param out the stream in which to write the object. - * @param obj the object to write. - */ - public static void writeRemoteObject(OutputStream out, - java.lang.Object obj) { - - if (utilDelegate != null) { - utilDelegate.writeRemoteObject(out, obj); - } - - } - - /** - * Writes a java.lang.Object as either a value or a CORBA Object. - * If {@code obj} is a value object or a stub object, it is written to - * {@code out.write_abstract_interface(java.lang.Object)}. - * If {@code obj} is an exported - * RMI-IIOP server object, the tie is found and wired to {@code obj}, - * then written to {@code out.write_abstract_interface(java.lang.Object)}. - * @param out the stream in which to write the object. - * @param obj the object to write. - */ - public static void writeAbstractObject(OutputStream out, - java.lang.Object obj) { - - if (utilDelegate != null) { - utilDelegate.writeAbstractObject(out, obj); - } - } - - /** - * Registers a target for a tie. Adds the tie to an internal table and calls - * {@link Tie#setTarget} on the tie object. - * @param tie the tie to register. - * @param target the target for the tie. - */ - public static void registerTarget(javax.rmi.CORBA.Tie tie, - java.rmi.Remote target) { - - if (utilDelegate != null) { - utilDelegate.registerTarget(tie, target); - } - - } - - /** - * Removes the associated tie from an internal table - * and calls {@link Tie#deactivate} - * to deactivate the object. - * @param target the object to unexport. - */ - public static void unexportObject(java.rmi.Remote target) - throws java.rmi.NoSuchObjectException - { - - if (utilDelegate != null) { - utilDelegate.unexportObject(target); - } - - } - - /** - * Returns the tie (if any) for a given target object. - * @return the tie or null if no tie is registered for the given target. - */ - public static Tie getTie (Remote target) { - - if (utilDelegate != null) { - return utilDelegate.getTie(target); - } - return null; - } - - - /** - * Returns a singleton instance of a class that implements the - * {@link ValueHandler} interface. - * @return a class which implements the ValueHandler interface. - */ - public static ValueHandler createValueHandler() { - - isCustomSerializationPermitted(); - - if (utilDelegate != null) { - return utilDelegate.createValueHandler(); - } - return null; - } - - /** - * Returns the codebase, if any, for the given class. - * @param clz the class to get a codebase for. - * @return a space-separated list of URLs, or null. - */ - public static String getCodebase(java.lang.Class clz) { - if (utilDelegate != null) { - return utilDelegate.getCodebase(clz); - } - return null; - } - - /** - * Returns a class instance for the specified class. - *

The spec for this method is the "Java to IDL language - * mapping", ptc/00-01-06. - *

In Java SE Platform, this method works as follows: - *

  • Find the first non-null {@code ClassLoader} on the - * call stack and attempt to load the class using this - * {@code ClassLoader}. - *
  • If the first step fails, and if {@code remoteCodebase} - * is non-null and - * {@code useCodebaseOnly} is false, then call - * {@code java.rmi.server.RMIClassLoader.loadClass(remoteCodebase, className)}. - *
  • If {@code remoteCodebase} is null or {@code useCodebaseOnly} - * is true, then call {@code java.rmi.server.RMIClassLoader.loadClass(className)}. - *
  • If a class was not successfully loaded by step 1, 2, or 3, - * and {@code loader} is non-null, then call {@code loader.loadClass(className)}. - *
  • If a class was successfully loaded by step 1, 2, 3, or 4, then - * return the loaded class, else throw {@code ClassNotFoundException}. - *
- * - * @param className the name of the class. - * @param remoteCodebase a space-separated list of URLs at which - * the class might be found. May be null. - * @param loader a {@code ClassLoader} that may be used to - * load the class if all other methods fail. - * @return the {@code Class} object representing the loaded class. - * @exception ClassNotFoundException if class cannot be loaded. - */ - public static Class loadClass(String className, - String remoteCodebase, - ClassLoader loader) - throws ClassNotFoundException { - if (utilDelegate != null) { - return utilDelegate.loadClass(className,remoteCodebase,loader); - } - return null ; - } - - - /** - * The {@code isLocal} method has the same semantics as the - * {@code ObjectImpl._is_local} - * method, except that it can throw a {@code RemoteException}. - * - * The {@code _is_local()} method is provided so that stubs may determine if a - * particular object is implemented by a local servant and hence local - * invocation APIs may be used. - * - * @param stub the stub to test. - * - * @return The {@code _is_local()} method returns true if - * the servant incarnating the object is located in the same process as - * the stub and they both share the same ORB instance. The {@code _is_local()} - * method returns false otherwise. The default behavior of {@code _is_local()} is - * to return false. - * - * @throws RemoteException The Java to IDL specification does not - * specify the conditions that cause a {@code RemoteException} to be thrown. - */ - public static boolean isLocal(Stub stub) throws RemoteException { - - if (utilDelegate != null) { - return utilDelegate.isLocal(stub); - } - - return false; - } - - /** - * Wraps an exception thrown by an implementation - * method. It returns the corresponding client-side exception. - * @param orig the exception to wrap. - * @return the wrapped exception. - */ - public static RemoteException wrapException(Throwable orig) { - - if (utilDelegate != null) { - return utilDelegate.wrapException(orig); - } - - return null; - } - - /** - * Copies or connects an array of objects. Used by local stubs - * to copy any number of actual parameters, preserving sharing - * across parameters as necessary to support RMI semantics. - * @param obj the objects to copy or connect. - * @param orb the ORB. - * @return the copied or connected objects. - * @exception RemoteException if any object could not be copied or connected. - */ - public static Object[] copyObjects (Object[] obj, ORB orb) - throws RemoteException { - - if (utilDelegate != null) { - return utilDelegate.copyObjects(obj, orb); - } - - return null; - } - - /** - * Copies or connects an object. Used by local stubs to copy - * an actual parameter, result object, or exception. - * @param obj the object to copy. - * @param orb the ORB. - * @return the copy or connected object. - * @exception RemoteException if the object could not be copied or connected. - */ - public static Object copyObject (Object obj, ORB orb) - throws RemoteException { - - if (utilDelegate != null) { - return utilDelegate.copyObject(obj, orb); - } - return null; - } - - // Same code as in PortableRemoteObject. Can not be shared because they - // are in different packages and the visibility needs to be package for - // security reasons. If you know a better solution how to share this code - // then remove it from PortableRemoteObject. Also in Stub.java - private static Object createDelegate(String classKey) { - - String className = (String) - AccessController.doPrivileged(new GetPropertyAction(classKey)); - if (className == null) { - Properties props = getORBPropertiesFile(); - if (props != null) { - className = props.getProperty(classKey); - } - } - if (className == null) { - return new com.sun.corba.se.impl.javax.rmi.CORBA.Util(); - } - - try { - return loadDelegateClass(className).newInstance(); - } catch (ClassNotFoundException ex) { - INITIALIZE exc = new INITIALIZE( "Cannot instantiate " + className); - exc.initCause( ex ) ; - throw exc ; - } catch (Exception ex) { - INITIALIZE exc = new INITIALIZE( "Error while instantiating" + className); - exc.initCause( ex ) ; - throw exc ; - } - } - - private static Class loadDelegateClass( String className ) throws ClassNotFoundException - { - try { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - return Class.forName(className, false, loader); - } catch (ClassNotFoundException e) { - // ignore, then try RMIClassLoader - } - - try { - return RMIClassLoader.loadClass(className); - } catch (MalformedURLException e) { - String msg = "Could not load " + className + ": " + e.toString(); - ClassNotFoundException exc = new ClassNotFoundException( msg ) ; - throw exc ; - } - } - /** - * Load the orb.properties file. - */ - private static Properties getORBPropertiesFile () - { - return (Properties) AccessController.doPrivileged( - new GetORBPropertiesFileAction()); - } - - private static void isCustomSerializationPermitted() { - SecurityManager sm = System.getSecurityManager(); - if ( sm != null) { - // check that a serialization permission has been - // set to allow the loading of the Util delegate - // which provides access to custom ValueHandler - sm.checkPermission(new SerializablePermission( - "enableCustomValueHandler")); -} - } -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/UtilDelegate.java 2018-01-30 20:26:15.000000000 -0500 +++ /dev/null 2018-01-30 20:26:15.000000000 -0500 @@ -1,135 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.rmi.CORBA; - -import java.io.Serializable; -import java.rmi.Remote; -import java.rmi.RemoteException; -import javax.rmi.CORBA.Tie; -import javax.rmi.CORBA.ValueHandler; -import org.omg.CORBA.ORB; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.SystemException; - -/** - * Supports delegation for method implementations in {@link Util}. The - * delegate is a singleton instance of a class that implements this - * interface and provides a replacement implementation for all the - * methods of javax.rmi.CORBA.Util. - * - * Delegation is enabled by providing the delegate's class name as the - * value of the - * javax.rmi.CORBA.UtilClass - * system property. - * - * @see Util - */ -public interface UtilDelegate { - - /** - * Delegation call for {@link Util#mapSystemException}. - */ - RemoteException mapSystemException(SystemException ex); - - /** - * Delegation call for {@link Util#writeAny}. - */ - void writeAny(OutputStream out, Object obj); - - /** - * Delegation call for {@link Util#readAny}. - */ - java.lang.Object readAny(InputStream in); - - /** - * Delegation call for {@link Util#writeRemoteObject}. - */ - void writeRemoteObject(OutputStream out, Object obj); - - /** - * Delegation call for {@link Util#writeAbstractObject}. - */ - void writeAbstractObject(OutputStream out, Object obj); - - /** - * Delegation call for {@link Util#registerTarget}. - */ - void registerTarget(Tie tie, Remote target); - - /** - * Delegation call for {@link Util#unexportObject}. - */ - void unexportObject(Remote target) throws java.rmi.NoSuchObjectException; - - /** - * Delegation call for {@link Util#getTie}. - */ - Tie getTie(Remote target); - - /** - * Delegation call for {@link Util#createValueHandler}. - */ - ValueHandler createValueHandler(); - - /** - * Delegation call for {@link Util#getCodebase}. - */ - String getCodebase(Class clz); - - /** - * Delegation call for {@link Util#loadClass}. - */ - Class loadClass(String className, String remoteCodebase, ClassLoader loader) - throws ClassNotFoundException; - - /** - * Delegation call for {@link Util#isLocal}. - */ - boolean isLocal(Stub stub) throws RemoteException; - - /** - * Delegation call for {@link Util#wrapException}. - */ - RemoteException wrapException(Throwable obj); - - /** - * Delegation call for {@link Util#copyObject}. - */ - Object copyObject(Object obj, ORB orb) throws RemoteException; - - /** - * Delegation call for {@link Util#copyObjects}. - */ - Object[] copyObjects(Object[] obj, ORB orb) throws RemoteException; - -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/ValueHandler.java 2018-01-30 20:26:16.000000000 -0500 +++ /dev/null 2018-01-30 20:26:16.000000000 -0500 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.rmi.CORBA; - -/** - * Defines methods which allow serialization of Java objects - * to and from GIOP streams. - **/ -public interface ValueHandler { - - /** - * Writes a value to the stream using Java semantics. - * @param out the stream to write the value to. - * @param value the value to be written to the stream. - **/ - void writeValue(org.omg.CORBA.portable.OutputStream out, - java.io.Serializable value); - - /** - * Reads a value from the stream using Java semantics. - * @param in the stream to read the value from. - * @param offset the current position in the input stream. - * @param clz the type of the value to be read in. - * @param repositoryID the RepositoryId of the value to be read in. - * @param sender the sending context runtime codebase. - * @return the value read from the stream. - **/ - java.io.Serializable readValue(org.omg.CORBA.portable.InputStream in, - int offset, - java.lang.Class clz, - String repositoryID, - org.omg.SendingContext.RunTime sender); - - /** - * Returns the CORBA RepositoryId for the given Java class. - * @param clz a Java class. - * @return the CORBA RepositoryId for the class. - **/ - java.lang.String getRMIRepositoryID(java.lang.Class clz); - - /** - * Indicates whether the given class performs custom or - * default marshaling. - * @param clz the class to test for custom marshaling. - * @return true if the class performs custom marshaling, false - * if it does not. - **/ - boolean isCustomMarshaled(java.lang.Class clz); - - /** - * Returns the CodeBase for this ValueHandler. This is used by - * the ORB runtime. The server sends the service context containing - * the IOR for this CodeBase on the first GIOP reply. The client - * does the same on the first GIOP request. - * @return the SendingContext.CodeBase of this ValueHandler. - **/ - org.omg.SendingContext.RunTime getRunTimeCodeBase(); - - /** - * If the value contains a writeReplace method then the result - * is returned. Otherwise, the value itself is returned. - * @param value the value to be marshaled. - * @return the true value to marshal on the wire. - **/ - java.io.Serializable writeReplace(java.io.Serializable value); - -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/ValueHandlerMultiFormat.java 2018-01-30 20:26:17.000000000 -0500 +++ /dev/null 2018-01-30 20:26:17.000000000 -0500 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, 2006, 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 javax.rmi.CORBA; - -/** - * Java to IDL ptc 02-01-12 1.5.1.5 - * @since 1.5 - */ -public interface ValueHandlerMultiFormat extends ValueHandler { - - /** - * Returns the maximum stream format version for - * RMI/IDL custom value types that is supported - * by this ValueHandler object. The ValueHandler - * object must support the returned stream format version and - * all lower versions. - * - * An ORB may use this value to include in a standard - * IOR tagged component or service context to indicate to other - * ORBs the maximum RMI-IIOP stream format that it - * supports. If not included, the default for GIOP 1.2 - * is stream format version 1, and stream format version - * 2 for GIOP 1.3 and higher. - */ - byte getMaximumStreamFormatVersion(); - - /** - * Allows the ORB to pass the stream format - * version for RMI/IDL custom value types. If the ORB - * calls this method, it must pass a stream format version - * between 1 and the value returned by the - * getMaximumStreamFormatVersion method inclusive, - * or else a BAD_PARAM exception with standard minor code - * will be thrown. - * - * If the ORB calls the older ValueHandler.writeValue(OutputStream, - * Serializable) method, stream format version 1 is implied. - * - * The ORB output stream passed to the ValueHandlerMultiFormat.writeValue - * method must implement the ValueOutputStream interface, and the - * ORB input stream passed to the ValueHandler.readValue method must - * implement the ValueInputStream interface. - */ - void writeValue(org.omg.CORBA.portable.OutputStream out, - java.io.Serializable value, - byte streamFormatVersion); -} --- old/src/java.corba/share/classes/javax/rmi/CORBA/package.html 2018-01-30 20:26:17.000000000 -0500 +++ /dev/null 2018-01-30 20:26:17.000000000 -0500 @@ -1,35 +0,0 @@ - - -javax.rmi.CORBA package - - - -Contains portability APIs for RMI-IIOP. These APIs -provide a standard interface between the generated stubs and ties and the -RMI-IIOP runtime. They also allow third party ORBs to be used for RMI over IIOP -as an alternative to the ORB supplied by Sun. They are not intended to be called -directly from RMI-IIOP applications. See also the {@link javax.rmi} package. - --- old/src/java.corba/share/classes/javax/rmi/PortableRemoteObject.java 2018-01-30 20:26:18.000000000 -0500 +++ /dev/null 2018-01-30 20:26:19.000000000 -0500 @@ -1,295 +0,0 @@ -/* - * Copyright (c) 1998, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.rmi; - -import java.lang.reflect.Method ; - -import org.omg.CORBA.INITIALIZE; -import javax.rmi.CORBA.Util; - -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; -import java.rmi.Remote; -import java.io.File; -import java.io.FileInputStream; -import java.util.Properties; -import java.net.MalformedURLException ; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.rmi.server.RMIClassLoader; - -import com.sun.corba.se.impl.orbutil.GetPropertyAction; - -/** - * Server implementation objects may either inherit from - * javax.rmi.PortableRemoteObject or they may implement a remote interface - * and then use the exportObject method to register themselves as a server object. - * The toStub method takes a server implementation and returns a stub that - * can be used to access that server object. - * The connect method makes a Remote object ready for remote communication. - * The unexportObject method is used to deregister a server object, allowing it to become - * available for garbage collection. - * The narrow method takes an object reference or abstract interface type and - * attempts to narrow it to conform to - * the given interface. If the operation is successful the result will be an - * object of the specified type, otherwise an exception will be thrown. - * - *

See also {@extLink rmi_iiop_guides RMI-IIOP developer's guides}.

- */ -public class PortableRemoteObject { - - private static final javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate; - - private static final String PortableRemoteObjectClassKey = - "javax.rmi.CORBA.PortableRemoteObjectClass"; - - static { - proDelegate = (javax.rmi.CORBA.PortableRemoteObjectDelegate) - createDelegate(PortableRemoteObjectClassKey); - } - - /** - * Initializes the object by calling exportObject(this). - * @exception RemoteException if export fails. - */ - protected PortableRemoteObject() throws RemoteException { - if (proDelegate != null) { - PortableRemoteObject.exportObject((Remote)this); - } - } - - /** - * Makes a server object ready to receive remote calls. Note - * that subclasses of PortableRemoteObject do not need to call this - * method, as it is called by the constructor. - * @param obj the server object to export. - * @exception RemoteException if export fails. - */ - public static void exportObject(Remote obj) - throws RemoteException { - - // Let the delegate do everything, including error handling. - if (proDelegate != null) { - proDelegate.exportObject(obj); - } - } - - /** - * Returns a stub for the given server object. - * @param obj the server object for which a stub is required. Must either be a subclass - * of PortableRemoteObject or have been previously the target of a call to - * {@link #exportObject}. - * @return the most derived stub for the object. - * @exception NoSuchObjectException if a stub cannot be located for the given server object. - */ - public static Remote toStub (Remote obj) - throws NoSuchObjectException { - - if (proDelegate != null) { - return proDelegate.toStub(obj); - } - return null; - } - - /** - * Deregisters a server object from the runtime, allowing the object to become - * available for garbage collection. - * @param obj the object to unexport. - * @exception NoSuchObjectException if the remote object is not - * currently exported. - */ - public static void unexportObject(Remote obj) - throws NoSuchObjectException { - - if (proDelegate != null) { - proDelegate.unexportObject(obj); - } - - } - - /** - * Checks to ensure that an object of a remote or abstract interface type - * can be cast to a desired type. - * @param narrowFrom the object to check. - * @param narrowTo the desired type. - * @return an object which can be cast to the desired type. - * @throws ClassCastException if narrowFrom cannot be cast to narrowTo. - */ - public static java.lang.Object narrow ( java.lang.Object narrowFrom, - java.lang.Class narrowTo) - throws ClassCastException { - - if (proDelegate != null) { - return proDelegate.narrow(narrowFrom, narrowTo); - } - return null; - - } - - /** - * Makes a Remote object ready for remote communication. This normally - * happens implicitly when the object is sent or received as an argument - * on a remote method call, but in some circumstances it is useful to - * perform this action by making an explicit call. See the - * {@link javax.rmi.CORBA.Stub#connect} method for more information. - * @param target the object to connect. - * @param source a previously connected object. - * @throws RemoteException if source is not connected - * or if target is already connected to a different ORB than - * source. - */ - public static void connect (Remote target, Remote source) - throws RemoteException { - - if (proDelegate != null) { - proDelegate.connect(target, source); - } - - } - - // Same code as in javax.rmi.CORBA.Util. Can not be shared because they - // are in different packages and the visibility needs to be package for - // security reasons. If you know a better solution how to share this code - // then remove it from here. - private static Object createDelegate(String classKey) { - String className = (String) - AccessController.doPrivileged(new GetPropertyAction(classKey)); - if (className == null) { - Properties props = getORBPropertiesFile(); - if (props != null) { - className = props.getProperty(classKey); - } - } - if (className == null) { - return new com.sun.corba.se.impl.javax.rmi.PortableRemoteObject(); - } - - try { - return (Object) loadDelegateClass(className).newInstance(); - } catch (ClassNotFoundException ex) { - INITIALIZE exc = new INITIALIZE( "Cannot instantiate " + className); - exc.initCause( ex ) ; - throw exc ; - } catch (Exception ex) { - INITIALIZE exc = new INITIALIZE( "Error while instantiating" + className); - exc.initCause( ex ) ; - throw exc ; - } - - } - - private static Class loadDelegateClass( String className ) throws ClassNotFoundException - { - try { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - return Class.forName(className, false, loader); - } catch (ClassNotFoundException e) { - // ignore, then try RMIClassLoader - } - - try { - return RMIClassLoader.loadClass(className); - } catch (MalformedURLException e) { - String msg = "Could not load " + className + ": " + e.toString(); - ClassNotFoundException exc = new ClassNotFoundException( msg ) ; - throw exc ; - } - } - - /** - * Load the orb.properties file. - */ - private static Properties getORBPropertiesFile () { - return (Properties) AccessController.doPrivileged(new GetORBPropertiesFileAction()); - } -} - -class GetORBPropertiesFileAction implements PrivilegedAction { - private boolean debug = false ; - - public GetORBPropertiesFileAction () { - } - - private String getSystemProperty(final String name) { - // This will not throw a SecurityException because this - // class was loaded from rt.jar using the bootstrap classloader. - String propValue = (String) AccessController.doPrivileged( - new PrivilegedAction() { - public java.lang.Object run() { - return System.getProperty(name); - } - } - ); - - return propValue; - } - - private void getPropertiesFromFile( Properties props, String fileName ) - { - try { - File file = new File( fileName ) ; - if (!file.exists()) - return ; - - FileInputStream in = new FileInputStream( file ) ; - - try { - props.load( in ) ; - } finally { - in.close() ; - } - } catch (Exception exc) { - if (debug) - System.out.println( "ORB properties file " + fileName + - " not found: " + exc) ; - } - } - - public Object run() - { - Properties defaults = new Properties() ; - - String javaHome = getSystemProperty( "java.home" ) ; - String fileName = javaHome + File.separator + "lib" + File.separator + - "orb.properties" ; - - getPropertiesFromFile( defaults, fileName ) ; - - Properties results = new Properties( defaults ) ; - - String userHome = getSystemProperty( "user.home" ) ; - fileName = userHome + File.separator + "orb.properties" ; - - getPropertiesFromFile( results, fileName ) ; - return results ; - } -} --- old/src/java.corba/share/classes/javax/rmi/package.html 2018-01-30 20:26:19.000000000 -0500 +++ /dev/null 2018-01-30 20:26:19.000000000 -0500 @@ -1,34 +0,0 @@ - - -javax.rmi package - - - -Contains user APIs for RMI-IIOP. These APIs are -provided for use by RMI-IIOP applications, and provide equivalent -semantics when running over either IIOP or JRMP. See also the -{@link javax.rmi.CORBA} package. - --- old/src/java.corba/share/classes/module-info.java 2018-01-30 20:26:20.000000000 -0500 +++ /dev/null 2018-01-30 20:26:21.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2014, 2016, 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. - */ - -/** - * Defines the Java binding of the OMG CORBA APIs, and the RMI-IIOP API. - * - *

This module is upgradeable. - * - * @moduleGraph - * @since 9 - */ -@Deprecated(since="9", forRemoval=true) -module java.corba { - requires java.logging; - requires java.naming; - requires java.transaction; - requires jdk.unsupported; - - requires transitive java.desktop; - requires transitive java.rmi; - - exports javax.activity; - exports javax.rmi; - exports javax.rmi.CORBA; - exports org.omg.CORBA; - exports org.omg.CORBA.DynAnyPackage; - exports org.omg.CORBA.ORBPackage; - exports org.omg.CORBA.TypeCodePackage; - exports org.omg.CORBA.portable; - exports org.omg.CORBA_2_3; - exports org.omg.CORBA_2_3.portable; - exports org.omg.CosNaming; - exports org.omg.CosNaming.NamingContextExtPackage; - exports org.omg.CosNaming.NamingContextPackage; - exports org.omg.Dynamic; - exports org.omg.DynamicAny; - exports org.omg.DynamicAny.DynAnyFactoryPackage; - exports org.omg.DynamicAny.DynAnyPackage; - exports org.omg.IOP; - exports org.omg.IOP.CodecFactoryPackage; - exports org.omg.IOP.CodecPackage; - exports org.omg.Messaging; - exports org.omg.PortableInterceptor; - exports org.omg.PortableInterceptor.ORBInitInfoPackage; - exports org.omg.PortableServer; - exports org.omg.PortableServer.CurrentPackage; - exports org.omg.PortableServer.POAManagerPackage; - exports org.omg.PortableServer.POAPackage; - exports org.omg.PortableServer.ServantLocatorPackage; - exports org.omg.PortableServer.portable; - exports org.omg.SendingContext; - exports org.omg.stub.java.rmi; - - // rmic --iiop - exports com.sun.corba.se.impl.util to jdk.rmic; - - // JNDI CosNaming provider - opens com.sun.jndi.cosnaming to java.naming; // jndiprovider.properties - exports com.sun.jndi.url.corbaname to java.naming; - exports com.sun.jndi.url.iiop to java.naming; - exports com.sun.jndi.url.iiopname to java.naming; -} --- old/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_COMPLETED.java 2018-01-30 20:26:21.000000000 -0500 +++ /dev/null 2018-01-30 20:26:22.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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 org.omg.CORBA; - -/** - * The ACTIVITY_COMPLETED system exception may be raised on any - * method for which Activity context is accessed. It indicates that the - * Activity context in which the method call was made has been completed due - * to a timeout of either the Activity itself or a transaction that encompasses - * the Activity, or that the Activity completed in a manner other than that - * originally requested. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since J2SE 1.5 - */ - -public final class ACTIVITY_COMPLETED extends SystemException { - - /** - * Constructs an ACTIVITY_COMPLETED exception with - * minor code set to 0 and CompletionStatus set to COMPLETED_NO. - */ - public ACTIVITY_COMPLETED() { - this(""); - } - - /** - * Constructs an ACTIVITY_COMPLETED exception with the - * specified message. - * - * @param detailMessage string containing a detailed message. - */ - public ACTIVITY_COMPLETED(String detailMessage) { - this(detailMessage, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an ACTIVITY_COMPLETED exception with the - * specified minor code and completion status. - * - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public ACTIVITY_COMPLETED(int minorCode, - CompletionStatus completionStatus) { - this("", minorCode, completionStatus); - } - - /** - * Constructs an ACTIVITY_COMPLETED exception with the - * specified message, minor code, and completion status. - * - * @param detailMessage string containing a detailed message. - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public ACTIVITY_COMPLETED(String detailMessage, - int minorCode, - CompletionStatus completionStatus) { - super(detailMessage, minorCode, completionStatus); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_REQUIRED.java 2018-01-30 20:26:22.000000000 -0500 +++ /dev/null 2018-01-30 20:26:22.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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 org.omg.CORBA; - -/** - * The ACTIVITY_REQUIRED system exception may be raised on any - * method for which an Activity context is required. It indicates that an - * Activity context was necessary to perform the invoked operation, but one - * was not found associated with the calling thread. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since J2SE 1.5 - */ - -public final class ACTIVITY_REQUIRED extends SystemException { - - /** - * Constructs an ACTIVITY_REQUIRED exception with - * minor code set to 0 and CompletionStatus set to COMPLETED_NO. - */ - public ACTIVITY_REQUIRED() { - this(""); - } - - /** - * Constructs an ACTIVITY_REQUIRED exception with the - * specified message. - * - * @param detailMessage string containing a detailed message. - */ - public ACTIVITY_REQUIRED(String detailMessage) { - this(detailMessage, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an ACTIVITY_REQUIRED exception with the - * specified minor code and completion status. - * - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public ACTIVITY_REQUIRED(int minorCode, - CompletionStatus completionStatus) { - this("", minorCode, completionStatus); - } - - /** - * Constructs an ACTIVITY_REQUIRED exception with the - * specified message, minor code, and completion status. - * - * @param detailMessage string containing a detailed message. - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public ACTIVITY_REQUIRED(String detailMessage, - int minorCode, - CompletionStatus completionStatus) { - super(detailMessage, minorCode, completionStatus); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ARG_IN.java 2018-01-30 20:26:23.000000000 -0500 +++ /dev/null 2018-01-30 20:26:23.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1997, 1999, 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 org.omg.CORBA; - -/** - * Signifies an "input" argument to an invocation, - * meaning that the argument is being passed from the client to - * the server. - * ARG_IN.value is one of the possible values used to - * indicate the direction in - * which a parameter is being passed during an invocation performed - * using the Dynamic Invocation Interface (DII). - *

- * The code fragment below shows a typical usage: - *

- *    ORB orb = ORB.init(args, null);
- *    org.omg.CORBA.NamedValue nv = orb.create_named_value(
- *         "IDLArgumentIdentifier", myAny, org.omg.CORBA.ARG_IN.value);
- * 
- * - * @see org.omg.CORBA.NamedValue - * @since JDK1.2 - */ -public interface ARG_IN { - - /** - * The value indicating an input argument. - */ - int value = 1; -} --- old/src/java.corba/share/classes/org/omg/CORBA/ARG_INOUT.java 2018-01-30 20:26:24.000000000 -0500 +++ /dev/null 2018-01-30 20:26:24.000000000 -0500 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1997, 1999, 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 org.omg.CORBA; - -/** - * Signifies an argument used for both input and output in an invocation, - * meaning that the argument is being passed from the client to - * the server and then back from the server to the client. - * ARG_INOUT.value is one of the possible values used to - * indicate the direction in - * which a parameter is being passed during a dynamic invocation - * using the Dynamic Invocation Interface (DII). - *

- * The code fragment below shows a typical usage: - *

- *  ORB orb = ORB.init(args, null);
- *  org.omg.CORBA.NamedValue nv = orb.create_named_value(
- *        "argumentIdentifier", myAny, org.omg.CORBA.ARG_INOUT.value);
- * 
- * - * @see org.omg.CORBA.NamedValue - * @since JDK1.2 - */ -public interface ARG_INOUT { - -/** - * The constant value indicating an argument used for both - * input and output. - */ - int value = 3; -} --- old/src/java.corba/share/classes/org/omg/CORBA/ARG_OUT.java 2018-01-30 20:26:25.000000000 -0500 +++ /dev/null 2018-01-30 20:26:25.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1997, 1999, 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 org.omg.CORBA; - -/** - * A constant that signifies an "output" argument to an invocation, - * meaning that the argument is being passed from the server to - * the client. - * ARG_OUT.value is one of the possible values used - * to indicate the direction in - * which a parameter is being passed during a dynamic invocation - * using the Dynamic Invocation Interface (DII). - *

- * The code fragment below shows a typical usage: - *

- *  ORB orb = ORB.init(args, null);
- *  org.omg.CORBA.NamedValue nv = orb.create_named_value(
- *        "argumentIdentifier", myAny, org.omg.CORBA.ARG_OUT.value);
- * 
- * - * @see org.omg.CORBA.NamedValue - * @since JDK1.2 - */ -public interface ARG_OUT { - -/** - * The constant value indicating an output argument. - */ - int value = 2; -} --- old/src/java.corba/share/classes/org/omg/CORBA/Any.java 2018-01-30 20:26:26.000000000 -0500 +++ /dev/null 2018-01-30 20:26:26.000000000 -0500 @@ -1,721 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.IDLEntity; - -/** - * Serves as a container for any data that can be - * described in IDL or for any IDL primitive type. - * An Any object is used as a component of a - * NamedValue object, which provides information about - * arguments or return values in requests, and which is used to define - * name/value pairs in Context objects. -

- * - * An Any object consists of two parts: - *

    - *
  1. a data value - *
  2. a TypeCode object describing the type of the data - * value contained in the Any object. For example, - * a TypeCode object for an array contains - * a field for the length of the array and a field for - * the type of elements in the array. (Note that in this case, the - * second field of the TypeCode object is itself a - * TypeCode object.) - *
- * - *

- * - * A large part of the Any class consists of pairs of methods - * for inserting values into and extracting values from an - * Any object. - *

- * For a given primitive type X, these methods are: - *

- *
void insert_X(X x) - *
This method allows the insertion of - * an instance x of primitive type X - * into the value field of the Any object. - * Note that the method - * insert_X also resets the Any object's - * type field if necessary. - *
X extract_X() - *
This method allows the extraction of an instance of - * type X from the Any object. - *
- *

- * This method throws the exception BAD_OPERATION under two conditions: - *

    - *
  1. the type of the element contained in the Any object is not - * X - *
  2. the method extract_X is called before - * the value field of the Any object - * has been set - *
- *
- *

- * There are distinct method pairs for each - * primitive IDL data type (insert_long and extract_long, - * insert_string and extract_string, and so on).
- *

- * The class Any also has methods for - * getting and setting the type code, - * for testing two Any objects for equality, - * and for reading an Any object from a stream or - * writing it to a stream. - *
- * @since JDK1.2 - */ -abstract public class Any implements IDLEntity { - - /** - * Checks for equality between this Any object and the - * given Any object. Two Any objects are - * equal if both their values and type codes are equal. - * - * @param a the Any object to test for equality - * @return true if the Any objects are equal; - * false otherwise - * @see CORBA package - * comments for unimplemented features - */ - abstract public boolean equal(Any a); - - /** - * Returns type information for the element contained in this - * Any object. - * - * @return the TypeCode object containing type information - * about the value contained in this Any object - */ - abstract public TypeCode type(); - - /** - * Sets this Any object's type field - * to the given TypeCode object and clears its value. - *

- * Note that using this method to set the type code wipes out the - * value if there is one. The method - * is provided primarily so that the type may be set properly for - * IDL out parameters. Generally, setting the type - * is done by the insert_X methods, which will set the type - * to X if it is not already set to X. - * - * @param t the TypeCode object giving - * information for the value in - * this Any object - */ - abstract public void type(TypeCode t); - - /////////////////////////////////////////////////////////////////////////// - // marshalling/unmarshalling routines - - /** - * Reads off (unmarshals) the value of an Any object from - * the given input stream using the given typecode. - * - * @param is the org.omg.CORBA.portable.InputStream - * object from which to read - * the value contained in this Any object - * - * @param t a TypeCode object containing type information - * about the value to be read - * - * @exception MARSHAL when the given TypeCode object is - * not consistent with the value that was contained - * in the input stream - */ - abstract public void read_value(InputStream is, TypeCode t) - throws MARSHAL; - - /** - * Writes out the value of this Any object - * to the given output stream. If both typecode - * and value need to be written, use - * create_output_stream() to create an OutputStream, - * then use write_any on the OutputStream. - *

- * If this method is called on an Any object that has not - * had a value inserted into its value field, it will throw - * the exception java.lang.NullPointerException. - * - * @param os the org.omg.CORBA.portable.OutputStream - * object into which to marshal the value - * of this Any object - * - */ - abstract public void write_value(OutputStream os); - - /** - * Creates an output stream into which this Any object's - * value can be marshalled. - * - * @return the newly-created OutputStream - */ - abstract public OutputStream create_output_stream(); - - /** - * Creates an input stream from which this Any object's value - * can be unmarshalled. - * - * @return the newly-created InputStream - */ - abstract public InputStream create_input_stream(); - - /////////////////////////////////////////////////////////////////////////// - // basic insertion/extraction methods - - /** - * Extracts the short in this - * Any object's value field. - * - * @return the short stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a short or the - * value field has not yet been set - */ - abstract public short extract_short() throws BAD_OPERATION; - - /** - * Inserts the given short - * into this Any object's value field. - * - * @param s the short to insert into this - * Any object - */ - abstract public void insert_short(short s); - - /** - * Extracts the int in this - * Any object's value field. - * - * @return the int stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than an int or the - * value field has not yet been set - */ - abstract public int extract_long() throws BAD_OPERATION; - - /** - * Inserts the given int - * into this Any object's value field. - * - * @param l the int to insert into this - * Any object - */ - abstract public void insert_long(int l); - - - /** - * Extracts the long in this - * Any object's value field. - * - * @return the long stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a long or the - * value field has not yet been set - */ - abstract public long extract_longlong() throws BAD_OPERATION; - - /** - * Inserts the given long - * into this Any object's value field. - * - * @param l the long to insert into this - * Any object - */ - abstract public void insert_longlong(long l); - - /** - * Extracts the short in this - * Any object's value field. - * - * @return the short stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a short or the - * value field has not yet been set - */ - abstract public short extract_ushort() throws BAD_OPERATION; - - /** - * Inserts the given short - * into this Any object's value field. - * - * @param s the short to insert into this - * Any object - */ - abstract public void insert_ushort(short s); - - /** - * Extracts the int in this - * Any object's value field. - * - * @return the int stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than an int or the - * value field has not yet been set - */ - abstract public int extract_ulong() throws BAD_OPERATION; - - /** - * Inserts the given int - * into this Any object's value field. - * - * @param l the int to insert into this - * Any object - */ - abstract public void insert_ulong(int l); - - /** - * Extracts the long in this - * Any object's value field. - * - * @return the long stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a long or the - * value field has not yet been set - */ - abstract public long extract_ulonglong() throws BAD_OPERATION; - - /** - * Inserts the given long - * into this Any object's value field. - * - * @param l the long to insert into this - * Any object - */ - abstract public void insert_ulonglong(long l); - - /** - * Extracts the float in this - * Any object's value field. - * - * @return the float stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a float or the - * value field has not yet been set - */ - abstract public float extract_float() throws BAD_OPERATION; - - /** - * Inserts the given float - * into this Any object's value field. - * - * @param f the float to insert into this - * Any object - */ - abstract public void insert_float(float f); - - /** - * Extracts the double in this - * Any object's value field. - * - * @return the double stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a double or the - * value field has not yet been set - */ - abstract public double extract_double() throws BAD_OPERATION; - - /** - * Inserts the given double - * into this Any object's value field. - * - * @param d the double to insert into this - * Any object - */ - abstract public void insert_double(double d); - - /** - * Extracts the boolean in this - * Any object's value field. - * - * @return the boolean stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a boolean or the - * value field has not yet been set - */ - abstract public boolean extract_boolean() throws BAD_OPERATION; - - /** - * Inserts the given boolean - * into this Any object's value field. - * - * @param b the boolean to insert into this - * Any object - */ - abstract public void insert_boolean(boolean b); - - /** - * Extracts the char in this - * Any object's value field. - * - * @return the char stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a char or the - * value field has not yet been set - */ - abstract public char extract_char() throws BAD_OPERATION; - - /** - * Inserts the given char - * into this Any object's value field. - * - * @param c the char to insert into this - * Any object - * @exception DATA_CONVERSION if there is a data conversion - * error - */ - abstract public void insert_char(char c) throws DATA_CONVERSION; - - /** - * Extracts the char in this - * Any object's value field. - * - * @return the char stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a char or the - * value field has not yet been set - */ - abstract public char extract_wchar() throws BAD_OPERATION; - - /** - * Inserts the given char - * into this Any object's value field. - * - * @param c the char to insert into this - * Any object - */ - abstract public void insert_wchar(char c); - - /** - * Extracts the byte in this - * Any object's value field. - * - * @return the byte stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a byte or the - * value field has not yet been set - */ - abstract public byte extract_octet() throws BAD_OPERATION; - - /** - * Inserts the given byte - * into this Any object's value field. - * - * @param b the byte to insert into this - * Any object - */ - abstract public void insert_octet(byte b); - - /** - * Extracts the Any object in this - * Any object's value field. - * - * @return the Any object stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than an Any object or the - * value field has not yet been set - */ - abstract public Any extract_any() throws BAD_OPERATION; - - /** - * Inserts the given Any object - * into this Any object's value field. - * - * @param a the Any object to insert into this - * Any object - */ - abstract public void insert_any(Any a); - - /** - * Extracts the org.omg.CORBA.Object in this - * Any object's value field. - * - * @return the org.omg.CORBA.Object stored in - * this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than an - * org.omg.CORBA.Object or the - * value field has not yet been set - */ - abstract public org.omg.CORBA.Object extract_Object() throws BAD_OPERATION; - - /** - * Inserts the given org.omg.CORBA.Object object - * into this Any object's value field. - * - * @param o the org.omg.CORBA.Object object to insert into this - * Any object - */ - abstract public void insert_Object(org.omg.CORBA.Object o); - - /** - * Extracts the java.io.Serializable object in this - * Any object's value field. - * - * @return the java.io.Serializable object stored in - * this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a java.io.Serializable - * object or the - * value field has not yet been set - */ - abstract public java.io.Serializable extract_Value() throws BAD_OPERATION ; - - /** - * Inserts the given java.io.Serializable object - * into this Any object's value field. - * - * @param v the java.io.Serializable object to insert into this - * Any object - */ - abstract public void insert_Value(java.io.Serializable v) ; - - /** - * Inserts the given java.io.Serializable object - * into this Any object's value field. - * - * @param v the java.io.Serializable object to insert into this - * Any object - * @param t the TypeCode object that is to be inserted into - * this Any object's type field - * and that describes the java.io.Serializable - * object being inserted - * @throws MARSHAL if the ORB has a problem marshalling or - * unmarshalling parameters - */ - abstract public void insert_Value(java.io.Serializable v, TypeCode t) - throws MARSHAL ; -/** - * Inserts the given org.omg.CORBA.Object object - * into this Any object's value field. - * - * @param o the org.omg.CORBA.Object instance to insert into this - * Any object - * @param t the TypeCode object that is to be inserted into - * this Any object and that describes - * the Object being inserted - * @exception BAD_OPERATION if this method is invalid for this - * Any object - * - */ - abstract public void insert_Object(org.omg.CORBA.Object o, TypeCode t) - throws BAD_PARAM; - - /** - * Extracts the String object in this - * Any object's value field. - * - * @return the String object stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a String object or the - * value field has not yet been set - */ - abstract public String extract_string() throws BAD_OPERATION; - - /** - * Inserts the given String object - * into this Any object's value field. - * - * @param s the String object to insert into this - * Any object - * @exception DATA_CONVERSION if there is a data conversion error - * @exception MARSHAL if the ORB has a problem marshalling or - * unmarshalling parameters - */ - abstract public void insert_string(String s) throws DATA_CONVERSION, MARSHAL; - - /** - * Extracts the String object in this - * Any object's value field. - * - * @return the String object stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a String object or the - * value field has not yet been set - */ - abstract public String extract_wstring() throws BAD_OPERATION; - - /** - * Inserts the given String object - * into this Any object's value field. - * - * @param s the String object to insert into this - * Any object - * @exception MARSHAL if the ORB has a problem marshalling or - * unmarshalling parameters - */ - abstract public void insert_wstring(String s) throws MARSHAL; - - /** - * Extracts the TypeCode object in this - * Any object's value field. - * - * @return the TypeCode object stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a TypeCode object or the - * value field has not yet been set - */ - abstract public TypeCode extract_TypeCode() throws BAD_OPERATION; - - /** - * Inserts the given TypeCode object - * into this Any object's value field. - * - * @param t the TypeCode object to insert into this - * Any object - */ - abstract public void insert_TypeCode(TypeCode t); - - /** - * Extracts the Principal object in this - * Any object's value field. - * Note that the class Principal has been deprecated. - * - * @return the Principal object stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a - * Principal object or the - * value field has not yet been set - * @see CORBA package - * comments for unimplemented features - * @deprecated Deprecated by CORBA 2.2. - */ - @Deprecated - public Principal extract_Principal() throws BAD_OPERATION { - throw new org.omg.CORBA.NO_IMPLEMENT() ; - } - - /** - * Inserts the given Principal object - * into this Any object's value field. - * Note that the class Principal has been deprecated. - * - * @param p the Principal object to insert into this - * Any object - * @see CORBA package - * comments for unimplemented features - * @deprecated Deprecated by CORBA 2.2. - */ - @Deprecated - public void insert_Principal(Principal p) { - throw new org.omg.CORBA.NO_IMPLEMENT() ; - } - - /////////////////////////////////////////////////////////////////////////// - // insertion/extraction of streamables - - /** - * Extracts a Streamable from this Any object's - * value field. This method allows the extraction of - * non-primitive IDL types. - * - * @return the Streamable stored in the Any object. - * @throws BAD_INV_ORDER if the caller has invoked operations in the wrong order - * @see CORBA package - * comments for unimplemented features - */ - public org.omg.CORBA.portable.Streamable extract_Streamable() - throws org.omg.CORBA.BAD_INV_ORDER { - throw new org.omg.CORBA.NO_IMPLEMENT() ; - } - - /** - * Inserts the given Streamable object - * into this Any object's value field. - * This method allows the insertion of non-primitive IDL types. - * - * @param s the Streamable object to insert into this - * Any object; may be a non-primitive - * IDL type - * @see CORBA package - * comments for unimplemented features - */ - public void insert_Streamable(Streamable s) { - throw new org.omg.CORBA.NO_IMPLEMENT() ; - } - - /** - * Extracts the java.math.BigDecimal object in this - * Any object's value field. - * - * @return the java.math.BigDecimal object - * stored in this Any object - * @exception BAD_OPERATION if this Any object - * contains something other than a - * java.math.BigDecimal object or the - * value field has not yet been set - * @see CORBA package - * comments for unimplemented features - */ - public java.math.BigDecimal extract_fixed() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Throws an - * org.omg.CORBA.NO_IMPLEMENT exception. - *

- * Inserts the given java.math.BigDecimal object - * into this Any object's value field. - * - * @param value the java.math.BigDecimal object - * to insert into this Any object - * @see CORBA package - * comments for unimplemented features - */ - public void insert_fixed(java.math.BigDecimal value) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Throws an - * org.omg.CORBA.NO_IMPLEMENT exception. - *

- * Inserts the given java.math.BigDecimal object - * into this Any object's value field. - * - * @param value the java.math.BigDecimal object - * to insert into this Any object - * @param type the TypeCode object that is to be inserted into - * this Any object's type field - * and that describes the java.math.BigDecimal - * object being inserted - * @throws org.omg.CORBA.BAD_INV_ORDER if this method is invoked improperly - * @see CORBA package - * comments for unimplemented features - */ - public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type) - throws org.omg.CORBA.BAD_INV_ORDER - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/AnyHolder.java 2018-01-30 20:26:26.000000000 -0500 +++ /dev/null 2018-01-30 20:26:26.000000000 -0500 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1996, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code Any}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for {@code Any} objects - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code any} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code AnyHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myAnyHolder} is an instance of {@code AnyHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myAnyHolder.value}. - * - * @since JDK1.2 - */ -public final class AnyHolder implements Streamable { - /** - * The {@code Any} value held by this {@code AnyHolder} object. - */ - - public Any value; - - /** - * Constructs a new {@code AnyHolder} object with its - * {@code value} field initialized to {@code null}. - */ - public AnyHolder() { - } - - /** - * Constructs a new {@code AnyHolder} object for the given - * {@code Any} object. - * @param initial the {@code Any} object with which to initialize - * the {@code value} field of the new - * {@code AnyHolder} object - */ - public AnyHolder(Any initial) { - value = initial; - } - - /** - * Reads from {@code input} and initalizes the value in the Holder - * with the unmarshalled data. - * - * @param input the InputStream containing CDR formatted data from the wire. - */ - public void _read(InputStream input) { - value = input.read_any(); - } - - /** - * Marshals to {@code output} the value in - * this {@code AnyHolder} object. - * - * @param output the OutputStream which will contain the CDR formatted data. - */ - public void _write(OutputStream output) { - output.write_any(value); - } - - /** - * Returns the {@code TypeCode} object corresponding to the value - * held in this {@code AnyHolder} object. - * - * @return the TypeCode of the value held in - * this {@code AnyHolder} object - */ - public TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_any); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/AnySeqHelper.java 2018-01-30 20:26:27.000000000 -0500 +++ /dev/null 2018-01-30 20:26:27.000000000 -0500 @@ -1,101 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code AnySeq}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/AnySeqHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - * - * The class definition has been modified to conform to the following - * OMG specifications : - *

    - *
  • ORB core as defined by CORBA 2.3.1 - * (formal/99-10-07) - *
  • - * - *
  • IDL/Java Language Mapping as defined in - * ptc/00-01-08 - *
  • - *
- */ - -public abstract class AnySeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/AnySeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Any[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.Any[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.AnySeqHelper.id (), "AnySeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.Any[] read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.Any value[] = null; - int _len0 = istream.read_long (); - value = new org.omg.CORBA.Any[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = istream.read_any (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - ostream.write_any (value[_i0]); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/AnySeqHolder.java 2018-01-30 20:26:28.000000000 -0500 +++ /dev/null 2018-01-30 20:26:28.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Holder for {@code AnySeq}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/AnySeqHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - */ - -public final class AnySeqHolder implements org.omg.CORBA.portable.Streamable -{ - public org.omg.CORBA.Any value[] = null; - - public AnySeqHolder () - { - } - - public AnySeqHolder (org.omg.CORBA.Any[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.AnySeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.AnySeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.AnySeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/BAD_CONTEXT.java 2018-01-30 20:26:28.000000000 -0500 +++ /dev/null 2018-01-30 20:26:28.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown when an operation is invoked by a client but the passed - * context does not contain the context values required by the operation.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class BAD_CONTEXT extends SystemException { - - /** - * Constructs a BAD_CONTEXT exception - * with a default minor code - * of 0 and a completion state of COMPLETED_NO. - */ - public BAD_CONTEXT() { - this(""); - } - - /** - * Constructs a BAD_CONTEXT exception - * with the specified detail message, a minor code - * of 0 and a completion state of COMPLETED_NO. - * @param s a String object containing a detail message - */ - public BAD_CONTEXT(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a BAD_CONTEXT exception - * with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed an instance of CompletionStatus indicating - * the completion status - */ - public BAD_CONTEXT(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a BAD_CONTEXT exception - * with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed an instance of CompletionStatus indicating - * the completion status - */ - public BAD_CONTEXT(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/BAD_INV_ORDER.java 2018-01-30 20:26:29.000000000 -0500 +++ /dev/null 2018-01-30 20:26:29.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception indicates that the caller has invoked operations in - * the wrong order. For example, it can be raised by an ORB if an - * application makes an ORB-related call without having correctly - * initialized the ORB first.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class BAD_INV_ORDER extends SystemException { - - /** - * Constructs a BAD_INV_ORDER exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public BAD_INV_ORDER() { - this(""); - } - - /** - * Constructs a BAD_INV_ORDER exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * - * @param s the String containing a detail message - */ - public BAD_INV_ORDER(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a BAD_INV_ORDER exceptionBAD_INV_ORDER with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed an instance of CompletionStatus indicating - * the completion status - */ - public BAD_INV_ORDER(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a BAD_INV_ORDER exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed the completion status - */ - public BAD_INV_ORDER(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/BAD_OPERATION.java 2018-01-30 20:26:30.000000000 -0500 +++ /dev/null 2018-01-30 20:26:30.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown when an object reference denotes an existing object, - * but that the object does not support the operation that was invoked.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class BAD_OPERATION extends SystemException { - - /** - * Constructs a BAD_OPERATION exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public BAD_OPERATION() { - this(""); - } - - /** - * Constructs a BAD_OPERATION exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public BAD_OPERATION(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a BAD_OPERATION exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed an instance of CompletionStatus indicating - * the completion status - */ - public BAD_OPERATION(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a BAD_OPERATION exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed an instance of CompletionStatus indicating - * the completion status - */ - public BAD_OPERATION(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/BAD_PARAM.java 2018-01-30 20:26:30.000000000 -0500 +++ /dev/null 2018-01-30 20:26:30.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown - * when a parameter passed to a call is out of range or - * otherwise considered illegal. An ORB may raise this exception - * if null values or null pointers are passed to an operation (for - * language mappings where the concept of a null pointers or null - * values applies). BAD_PARAM can also be raised as a result of a - * client generating requests with incorrect parameters using the DII.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}, - * {@extLink jidlexception_minorcodes meaning of minor codes} - *

- * @since JDK1.2 - */ - -public final class BAD_PARAM extends SystemException { - - /** - * Constructs a BAD_PARAM exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public BAD_PARAM() { - this(""); - } - - /** - * Constructs a BAD_PARAM exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * - * @param s the String containing a detail message describing this - * exception - */ - public BAD_PARAM(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a BAD_PARAM exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public BAD_PARAM(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a BAD_PARAM exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes - * this particular exception. - * - * @param s the String containing a detail message - * @param minor the minor code - * @param completed the completion status - */ - public BAD_PARAM(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY.java 2018-01-30 20:26:31.000000000 -0500 +++ /dev/null 2018-01-30 20:26:31.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; -/** - * A {@code PolicyErrorCode} which would be filled in - * the {@code PolicyError} exception. - * - * @author rip-dev - */ - -public interface BAD_POLICY { - /** - * The Error code in PolicyError exception. - */ - final short value = (short) (0L); -}; --- old/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_TYPE.java 2018-01-30 20:26:32.000000000 -0500 +++ /dev/null 2018-01-30 20:26:32.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - -/** - * A {@code PolicyErrorCode} which would be filled in - * the {@code PolicyError} exception. - * - * @author rip-dev - */ -public interface BAD_POLICY_TYPE { - /** - * The Error code in PolicyError exception. - */ - final short value = (short) (2L); -}; --- old/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_VALUE.java 2018-01-30 20:26:33.000000000 -0500 +++ /dev/null 2018-01-30 20:26:33.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - -/** -* Contains the value used to indicate a policy value that is -* incorrect for a valid policy type in a call to the -* create_policy method defined in the ORB class. -* -*/ -public interface BAD_POLICY_VALUE { - /** - * The value used to represent a bad policy value error - * in a PolicyError exception. - * @see org.omg.CORBA.PolicyError - */ - final short value = (short) (3L); -}; --- old/src/java.corba/share/classes/org/omg/CORBA/BAD_QOS.java 2018-01-30 20:26:33.000000000 -0500 +++ /dev/null 2018-01-30 20:26:33.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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 org.omg.CORBA; - -/** - * The BAD_QOS exception is raised whenever an object cannot - * support the quality of service required by an invocation parameter that - * has a quality of service semantics associated with it. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since J2SE 1.5 - */ - -public final class BAD_QOS extends SystemException { - - /** - * Constructs an BAD_QOS exception with - * minor code set to 0 and CompletionStatus set to COMPLETED_NO. - */ - public BAD_QOS() { - this(""); - } - - /** - * Constructs an BAD_QOS exception with the - * specified message. - * - * @param detailMessage string containing a detailed message. - */ - public BAD_QOS(String detailMessage) { - this(detailMessage, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an BAD_QOS exception with the - * specified minor code and completion status. - * - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public BAD_QOS(int minorCode, - CompletionStatus completionStatus) { - this("", minorCode, completionStatus); - } - - /** - * Constructs an BAD_QOS exception with the - * specified message, minor code, and completion status. - * - * @param detailMessage string containing a detailed message. - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public BAD_QOS(String detailMessage, - int minorCode, - CompletionStatus completionStatus) { - super(detailMessage, minorCode, completionStatus); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java 2018-01-30 20:26:34.000000000 -0500 +++ /dev/null 2018-01-30 20:26:34.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown when the ORB has encountered a malformed type code - * (for example, a type code with an invalid {@code TCKind} value).

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class BAD_TYPECODE extends SystemException { - - /** - * Constructs a {@code BAD_TYPECODE} exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public BAD_TYPECODE() { - this(""); - } - - /** - * Constructs a {@code BAD_TYPECODE} exception with the specified detail, - * a minor code of 0, and a completion state of COMPLETED_NO. - * - * @param s the String containing a detail message - */ - public BAD_TYPECODE(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a {@code BAD_TYPECODE} exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed an instance of {@code CompletionStatus} indicating - * the completion status - */ - public BAD_TYPECODE(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a {@code BAD_TYPECODE} exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed an instance of {@code CompletionStatus} indicating - * the completion status - */ - public BAD_TYPECODE(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/BooleanHolder.java 2018-01-30 20:26:35.000000000 -0500 +++ /dev/null 2018-01-30 20:26:35.000000000 -0500 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1995, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - - -/** - * The Holder for {@code Boolean}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code boolean} - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code boolean} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code BooleanHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myBooleanHolder} is an instance of {@code BooleanHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myBooleanHolder.value}. - * - * @since JDK1.2 - */ -public final class BooleanHolder implements Streamable { - - /** - * The {@code boolean} value held by this {@code BooleanHolder} - * object. - */ - public boolean value; - - /** - * Constructs a new {@code BooleanHolder} object with its - * {@code value} field initialized to {@code false}. - */ - public BooleanHolder() { - } - - /** - * Constructs a new {@code BooleanHolder} object with its - * {@code value} field initialized with the given {@code boolean}. - * @param initial the {@code boolean} with which to initialize - * the {@code value} field of the newly-created - * {@code BooleanHolder} object - */ - public BooleanHolder(boolean initial) { - value = initial; - } - - /** - * Reads unmarshalled data from {@code input} and assigns it to this - * {@code BooleanHolder} object's {@code value} field. - * - * @param input the {@code InputStream} object containing - * CDR formatted data from the wire - */ - public void _read(InputStream input) { - value = input.read_boolean(); - } - - /** - * Marshals the value in this {@code BooleanHolder} object's - * {@code value} field to the output stream {@code output}. - * - * @param output the OutputStream which will contain the CDR formatted data - */ - public void _write(OutputStream output) { - output.write_boolean(value); - } - - /** - * Retrieves the {@code TypeCode} object that corresponds to the - * value held in this {@code BooleanHolder} object. - * - * @return the {@code TypeCode} for the value held - * in this {@code BooleanHolder} object - */ - public TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_boolean); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHelper.java 2018-01-30 20:26:35.000000000 -0500 +++ /dev/null 2018-01-30 20:26:35.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code BooleanSeq}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/BooleanSeqHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - * - * The class definition has been modified to conform to the following - * OMG specifications : - *

    - *
  • ORB core as defined by CORBA 2.3.1 - * (formal/99-10-07) - *
  • - * - *
  • IDL/Java Language Mapping as defined in - * ptc/00-01-08 - *
  • - *
- */ - -public abstract class BooleanSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/BooleanSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, boolean[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static boolean[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_boolean); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.BooleanSeqHelper.id (), "BooleanSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static boolean[] read (org.omg.CORBA.portable.InputStream istream) - { - boolean value[] = null; - int _len0 = istream.read_long (); - value = new boolean[_len0]; - istream.read_boolean_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, boolean[] value) - { - ostream.write_long (value.length); - ostream.write_boolean_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHolder.java 2018-01-30 20:26:36.000000000 -0500 +++ /dev/null 2018-01-30 20:26:36.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Holder for {@code BooleanSeq}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/BooleanSeqHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - */ - -public final class BooleanSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public boolean value[] = null; - - public BooleanSeqHolder () - { - } - - public BooleanSeqHolder (boolean[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.BooleanSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.BooleanSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.BooleanSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/Bounds.java 2018-01-30 20:26:37.000000000 -0500 +++ /dev/null 2018-01-30 20:26:37.000000000 -0500 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 org.omg.CORBA; - -/** - * A user exception thrown when a parameter is not within - * the legal bounds for the object that a method is trying - * to access. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class Bounds extends org.omg.CORBA.UserException { - - /** - * Constructs an Bounds with no specified detail message. - */ - public Bounds() { - super(); - } - - /** - * Constructs an Bounds with the specified detail message. - * - * @param reason the detail message. - */ - public Bounds(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/BoundsHelper.java 2018-01-30 20:26:37.000000000 -0500 +++ /dev/null 2018-01-30 20:26:37.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2014, 2017, 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 org.omg.CORBA; - - -/** - * This Helper class is used to facilitate the marshalling of {@code Bounds}. - * For more information on Helper files, see - * - * "Generated Files: Helper Files". - */ - -abstract public class BoundsHelper -{ - private static String _id = "IDL:omg.org/CORBA/Bounds:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Bounds that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.Bounds extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [0]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.BoundsHelper.id (), "Bounds", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.Bounds read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.Bounds value = new org.omg.CORBA.Bounds (); - // read and discard the repository ID - istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Bounds value) - { - // write the repository ID - ostream.write_string (id ()); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ByteHolder.java 2018-01-30 20:26:38.000000000 -0500 +++ /dev/null 2018-01-30 20:26:38.000000000 -0500 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1997, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code Byte}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code byte} - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code octet} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code ByteHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myByteHolder} is an instance of {@code ByteHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myByteHolder.value}. - * - * @since JDK1.2 - */ -public final class ByteHolder implements Streamable { - /** - * The {@code byte} value held by this {@code ByteHolder} - * object. - */ - - public byte value; - - /** - * Constructs a new {@code ByteHolder} object with its - * {@code value} field initialized to 0. - */ - public ByteHolder() { - } - - /** - * Constructs a new {@code ByteHolder} object for the given - * {@code byte}. - * @param initial the {@code byte} with which to initialize - * the {@code value} field of the new - * {@code ByteHolder} object - */ - public ByteHolder(byte initial) { - value = initial; - } - - /** - * Reads from {@code input} and initalizes the value in - * this {@code ByteHolder} object - * with the unmarshalled data. - * - * @param input the InputStream containing CDR formatted data from the wire. - */ - public void _read(InputStream input) { - value = input.read_octet(); - } - - /** - * Marshals to {@code output} the value in - * this {@code ByteHolder} object. - * - * @param output the OutputStream which will contain the CDR formatted data. - */ - public void _write(OutputStream output) { - output.write_octet(value); - } - - /** - * Returns the TypeCode corresponding to the value held in - * this {@code ByteHolder} object. - * - * @return the TypeCode of the value held in - * this {@code ByteHolder} object - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_octet); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/CODESET_INCOMPATIBLE.java 2018-01-30 20:26:39.000000000 -0500 +++ /dev/null 2018-01-30 20:26:39.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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 org.omg.CORBA; - -/** - * This exception is raised whenever meaningful communication is not possible - * between client and server native code sets. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since J2SE 1.5 - */ - -public final class CODESET_INCOMPATIBLE extends SystemException { - - /** - * Constructs an CODESET_INCOMPATIBLE exception with - * minor code set to 0 and CompletionStatus set to COMPLETED_NO. - */ - public CODESET_INCOMPATIBLE() { - this(""); - } - - /** - * Constructs an CODESET_INCOMPATIBLE exception with the - * specified message. - * - * @param detailMessage string containing a detailed message. - */ - public CODESET_INCOMPATIBLE(String detailMessage) { - this(detailMessage, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an CODESET_INCOMPATIBLE exception with the - * specified minor code and completion status. - * - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public CODESET_INCOMPATIBLE(int minorCode, - CompletionStatus completionStatus) { - this("", minorCode, completionStatus); - } - - /** - * Constructs an CODESET_INCOMPATIBLE exception with the - * specified message, minor code, and completion status. - * - * @param detailMessage string containing a detailed message. - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public CODESET_INCOMPATIBLE(String detailMessage, - int minorCode, - CompletionStatus completionStatus) { - super(detailMessage, minorCode, completionStatus); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/COMM_FAILURE.java 2018-01-30 20:26:40.000000000 -0500 +++ /dev/null 2018-01-30 20:26:40.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception is raised if communication is lost while an operation - * is in progress, after the request was sent by the client, but before - * the reply from the server has been returned to the client.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - *

- * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} - * to see the minor codes for this exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class COMM_FAILURE extends SystemException { - - /** - * Constructs a COMM_FAILURE exception with - * a default minor code of 0 and a completion state of COMPLETED_NO. - */ - public COMM_FAILURE() { - this(""); - } - - /** - * Constructs a COMM_FAILURE exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * - * @param s the String containing a detail message describing - * this exception - */ - public COMM_FAILURE(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a COMM_FAILURE exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status, which must be one of - * COMPLETED_YES, COMPLETED_NO, or - * COMPLETED_MAYBE. - */ - public COMM_FAILURE(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a COMM_FAILURE exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed the completion status, which must be one of - * COMPLETED_YES, COMPLETED_NO, or - * COMPLETED_MAYBE. - */ - public COMM_FAILURE(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/CTX_RESTRICT_SCOPE.java 2018-01-30 20:26:40.000000000 -0500 +++ /dev/null 2018-01-30 20:26:40.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1997, 1999, 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 org.omg.CORBA; - -/** - * A flag that can be used as the second parameter to the method - * Context.get_values to restrict the search scope. - * When this flag is used, it restricts the search for - * context values to this particular Context object - * or to the scope specified in the first parameter to - * Context.get_values. - *

- * Usage: - *

- *     NVList props = myContext.get_values("_USER",
- *                     CTX_RESTRICT_SCOPE.value, "id*");
- * 
- * - * @see org.omg.CORBA.Context#get_values(String, int, String) - * @since JDK1.2 - */ -public interface CTX_RESTRICT_SCOPE { - -/** - * The field containing the int value of a - * CTX_RESTRICT_SCOPE flag. - */ - int value = 15; -} --- old/src/java.corba/share/classes/org/omg/CORBA/CharHolder.java 2018-01-30 20:26:41.000000000 -0500 +++ /dev/null 2018-01-30 20:26:41.000000000 -0500 @@ -1,111 +0,0 @@ -/* - * Copyright (c) 1995, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code Char}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code char} - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code char} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code CharHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myCharHolder} is an instance of {@code CharHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myCharHolder.value}. - * - * @since JDK1.2 - */ -public final class CharHolder implements Streamable { - - /** - * The {@code char} value held by this {@code CharHolder} - * object. - */ - public char value; - - /** - * Constructs a new {@code CharHolder} object with its - * {@code value} field initialized to {@code 0}. - */ - public CharHolder() { - } - - /** - * Constructs a new {@code CharHolder} object for the given - * {@code char}. - * @param initial the {@code char} with which to initialize - * the {@code value} field of the new - * {@code CharHolder} object - */ - public CharHolder(char initial) { - value = initial; - } - - /** - * Reads from {@code input} and initalizes the value in - * this {@code CharHolder} object - * with the unmarshalled data. - * - * @param input the InputStream containing CDR formatted data from the wire - */ - public void _read(InputStream input) { - value = input.read_char(); - } - - /** - * Marshals to {@code output} the value in - * this {@code CharHolder} object. - * - * @param output the OutputStream which will contain the CDR formatted data - */ - public void _write(OutputStream output) { - output.write_char(value); - } - - /** - * Returns the {@code TypeCode} object corresponding - * to the value held in - * this {@code CharHolder} object. - * - * @return the TypeCode of the value held in - * this {@code CharHolder} object - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_char); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/CharSeqHelper.java 2018-01-30 20:26:42.000000000 -0500 +++ /dev/null 2018-01-30 20:26:42.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code CharSeq}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/CharSeqHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - * - * The class definition has been modified to conform to the following - * OMG specifications : - *

    - *
  • ORB core as defined by CORBA 2.3.1 - * (formal/99-10-07) - *
  • - * - *
  • IDL/Java Language Mapping as defined in - * ptc/00-01-08 - *
  • - *
- */ - -public abstract class CharSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/CharSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, char[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static char[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_char); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.CharSeqHelper.id (), "CharSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static char[] read (org.omg.CORBA.portable.InputStream istream) - { - char value[] = null; - int _len0 = istream.read_long (); - value = new char[_len0]; - istream.read_char_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, char[] value) - { - ostream.write_long (value.length); - ostream.write_char_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/CharSeqHolder.java 2018-01-30 20:26:42.000000000 -0500 +++ /dev/null 2018-01-30 20:26:43.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Holder for {@code CharSeq}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/CharSeqHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - */ - -public final class CharSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public char value[] = null; - - public CharSeqHolder () - { - } - - public CharSeqHolder (char[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.CharSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.CharSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.CharSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/CompletionStatus.java 2018-01-30 20:26:43.000000000 -0500 +++ /dev/null 2018-01-30 20:26:43.000000000 -0500 @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1996, 2015, 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 org.omg.CORBA; - -/** - * An object that indicates whether a method had completed running - * when a SystemException was thrown. - *

- * The class CompletionStatus - * contains three CompletionStatus instances, which are constants - * representing each - * possible completion status: COMPLETED_MAYBE, - * COMPLETED_NO, and COMPLETED_YES. - * It also contains - * three int members, each a constant corresponding to one of - * the CompletionStatus instances. These int - * members make it possible to use a switch statement. - *

- * The class also contains two methods: - *

    - *
  • public int value() -- which accesses the - * value field of a CompletionStatus object - *
  • public static CompletionStatus - * from_int(int i) -- - * for creating an instance from one of the int members - *
- * @see org.omg.CORBA.SystemException - * @since JDK1.2 - */ - -public final class CompletionStatus implements org.omg.CORBA.portable.IDLEntity -{ -/** - * The constant indicating that a method completed running - * before a SystemException was thrown. - */ - public static final int _COMPLETED_YES = 0, - -/** - * The constant indicating that a method had not completed running - * when a SystemException was thrown. - */ - _COMPLETED_NO = 1, - -/** - * The constant indicating that it is unknown whether a method had - * completed running when a SystemException was thrown. - */ - _COMPLETED_MAYBE = 2; - - -/** - * An instance of CompletionStatus initialized with - * the constant _COMPLETED_YES. - */ - public static final CompletionStatus COMPLETED_YES = new CompletionStatus(_COMPLETED_YES); - -/** - * An instance of CompletionStatus initialized with - * the constant _COMPLETED_NO. - */ - public static final CompletionStatus COMPLETED_NO = new CompletionStatus(_COMPLETED_NO); - - /** - * An instance of CompletionStatus initialized with - * the constant _COMPLETED_MAYBE. - */ - public static final CompletionStatus COMPLETED_MAYBE = new CompletionStatus(_COMPLETED_MAYBE); - - /** - * Retrieves the value of this CompletionStatus object. - * - * @return one of the possible CompletionStatus values: - * _COMPLETED_YES, _COMPLETED_NO, or - * _COMPLETED_MAYBE - * - */ - public int value() { return _value; } - -/** - * Creates a CompletionStatus object from the given int. - * - * @param i one of _COMPLETED_YES, _COMPLETED_NO, or - * _COMPLETED_MAYBE - * - * @return one of the possible CompletionStatus objects - * with values: - * _COMPLETED_YES, _COMPLETED_NO, or - * _COMPLETED_MAYBE - * - * @exception org.omg.CORBA.BAD_PARAM if the argument given is not one of the - * int constants defined in CompletionStatus - */ - public static CompletionStatus from_int(int i) { - switch (i) { - case _COMPLETED_YES: - return COMPLETED_YES; - case _COMPLETED_NO: - return COMPLETED_NO; - case _COMPLETED_MAYBE: - return COMPLETED_MAYBE; - default: - throw new org.omg.CORBA.BAD_PARAM(); - } - } - - -/** - * Creates a CompletionStatus object from the given int. - * - * @param _value one of _COMPLETED_YES, _COMPLETED_NO, or - * _COMPLETED_MAYBE - * - */ - private CompletionStatus(int _value) { - this._value = _value; - } - - private int _value; -} --- old/src/java.corba/share/classes/org/omg/CORBA/CompletionStatusHelper.java 2018-01-30 20:26:44.000000000 -0500 +++ /dev/null 2018-01-30 20:26:44.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code CompletionStatus}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/CompletionStatusHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * 03 June 1999 11:52:03 o'clock GMT+00:00 - */ - -abstract public class CompletionStatusHelper -{ - private static String _id = "IDL:omg.org/CORBA/CompletionStatus:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.CompletionStatus that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.CompletionStatus extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (org.omg.CORBA.CompletionStatusHelper.id (), "CompletionStatus", new String[] { "COMPLETED_YES", "COMPLETED_NO", "COMPLETED_MAYBE"} ); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.CompletionStatus read (org.omg.CORBA.portable.InputStream istream) - { - return org.omg.CORBA.CompletionStatus.from_int (istream.read_long ()); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.CompletionStatus value) - { - ostream.write_long (value.value ()); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/Context.java 2018-01-30 20:26:45.000000000 -0500 +++ /dev/null 2018-01-30 20:26:45.000000000 -0500 @@ -1,244 +0,0 @@ -/* - * Copyright (c) 1996, 2000, 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 org.omg.CORBA; - -/** - * An object used in Request operations - * to specify the context object in which context strings - * must be resolved before being sent along with the request invocation. - * A Context object - * contains a list of properties in the form of NamedValue - * objects. These properties represent information - * about the client, the environment, or the circumstances of a request - * and generally are properties that might be inconvenient - * to pass as parameters. - *

- * A Context object is created by first calling the - * ORB method get_default_context - * and then calling the method create_child on the - * default context. - *

- * Each property in a Context object is represented by - * a NamedValue object. The property name is contained - * in the NamedValue object's name field, and - * the value associated with the name is contained in the Any - * object that was assigned to the NamedValue object's - * value field. - *

- * Context properties can represent a portion of a client's - * or application's environment that is meant to be propagated to - * (and made implicitly part of) a server's environment. - * (Examples might be a window identifier or user preference information). - * Once a server has been invoked (that is, after the properties are - * propagated), the server may query its Context object - * for these properties using the method get_values. - * - *

- * When an operation declaration includes a context clause, - * the stubs and skeletons will have an additional argument - * added for the context. When an operation invocation occurs, - * the ORB causes the properties that were named in the operation - * definition in IDL and - * that are present in the client's Context object - * to be provided in the Context object parameter to - * the invoked method. - *

- * Context property names (which are strings) - * typically have the form of an OMG IDL identifier or - * a series of OMG IDL identifiers separated by periods. - * A context property name pattern is either a property name - * or a property name followed by a single "*". A property - * name pattern without a trailing "*" is said to match only - * itself. A property name pattern of the form "<name>*" matches any - * property name that starts with <name> and continues with zero - * or more additional characters. - *

- * Property name patterns are used in the context clause of - * an operation definition and as a parameter for the - * method Context.get_values. - *

- * Context objects may be "chained" together to achieve a - * particular defaulting behavior. A Context - * object created with the method create_child will - * be chained to its parent (the Context object - * that created it), and that means that the parent will be searched - * after the child in a search for property names. - *

- * Properties defined in a particular Context object - * effectively override those properties in the next higher level. - * The scope used in a search for properties may be restricted by specifying a - * starting scope and by using the flag CTX_RESTRICT_SCOPE - * when invoking the method get_values. - *

- * A Context object may be named for purposes of specifying - * a starting search scope. - * - * @since JDK1.2 - */ - -public abstract class Context { - - /** - * Retrieves the name of this Context object. - * - * @return the name of this Context object - */ - - public abstract String context_name(); - - - /** - * Retrieves the parent of this Context object. - * - * @return the Context object that is the - * parent of this Context object - */ - - public abstract Context parent(); - - /** - * Creates a Context object with the given string as its - * name and with this Context object set as its parent. - *

- * The new Context object is chained into its parent - * Context object. This means that in a search for - * matching property names, if a match is not found in this context, - * the search will continue in the parent. If that is not successful, - * the search will continue in the grandparent, if there is one, and - * so on. - * - * - * @param child_ctx_name the String object to be set as - * the name of the new Context object - * @return the newly-created child Context object - * initialized with the specified name - */ - - public abstract Context create_child(String child_ctx_name); - - /** - * Creates a NamedValue object and adds it to this - * Context object. The name field of the - * new NamedValue object is set to the given string, - * the value field is set to the given Any - * object, and the flags field is set to zero. - * - * @param propname the name of the property to be set - * @param propvalue the Any object to which the - * value of the property will be set. The - * Any object's value - * field contains the value to be associated - * with the given propname; the - * kind field must be set to - * TCKind.tk_string. - */ - - public abstract void set_one_value(String propname, Any propvalue); - - /** - I Sets one or more property values in this Context - * object. The NVList supplied to this method - * contains one or more NamedValue objects. - * In each NamedValue object, - * the name field holds the name of the property, and - * the flags field must be set to zero. - * The NamedValue object's value field - * contains an Any object, which, in turn, contains the value - * for the property. Since the value is always a string, - * the Any object must have the kind - * field of its TypeCode set to TCKind.tk_string. - * - * @param values an NVList containing the property - * names and associated values to be set - * - * @see #get_values - * @see org.omg.CORBA.NamedValue - * @see org.omg.CORBA.Any - */ - - public abstract void set_values(NVList values); - - /** - * Deletes from this Context object the - * NamedValue object(s) whose - * name field matches the given property name. - * If the String object supplied for - * propname has a - * trailing wildcard character ("*"), then - * all NamedValue objects whose name - * fields match will be deleted. The search scope is always - * limited to this Context object. - *

- * If no matching property is found, an exception is returned. - * - * @param propname name of the property to be deleted - */ - - public abstract void delete_values(String propname); - - /** - * Retrieves the NamedValue objects whose - * name field matches the given name or name - * pattern. This method allows for wildcard searches, - * which means that there can be multiple matches and - * therefore multiple values returned. If the - * property is not found at the indicated level, the search - * continues up the context object tree until a match is found or - * all Context objects in the chain have been exhausted. - *

- * If no match is found, an error is returned and no property list - * is returned. - * - * @param start_scope a String object indicating the - * context object level at which to initiate the - * search for the specified properties - * (for example, "_USER", "_GROUP", "_SYSTEM"). Valid scope - * names are implementation-specific. If a - * scope name is omitted, the search - * begins with the specified context - * object. If the specified scope name is - * not found, an exception is returned. - * @param op_flags an operation flag. The one flag - * that may be specified is CTX_RESTRICT_SCOPE. - * If this flag is specified, searching is limited to the - * specified start_scope or this - * Context object. - * @param pattern the property name whose values are to - * be retrieved. pattern may be a - * name or a name with a - * trailing wildcard character ("*"). - * - * @return an NVList containing all the property values - * (in the form of NamedValue objects) - * whose associated property name matches the given name or - * name pattern - * @see #set_values - * @see org.omg.CORBA.NamedValue - */ - - abstract public NVList get_values(String start_scope, int op_flags, - String pattern); -}; --- old/src/java.corba/share/classes/org/omg/CORBA/ContextList.java 2018-01-30 20:26:45.000000000 -0500 +++ /dev/null 2018-01-30 20:26:45.000000000 -0500 @@ -1,106 +0,0 @@ -/* - * Copyright (c) 1996, 1999, 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 org.omg.CORBA; - -/** - * An object containing a modifiable list of String objects - * that represent property names. - * This class is used in Request operations to - * describe the contexts that need to be resolved and sent with the - * invocation. (A context is resolved by giving a property name - * and getting back the value associated with it.) This is done - * by calling the Context method - * get_values and supplying a string from a - * ContextList object as the third parameter. - * The method get_values returns an NVList - * object containing the NamedValue objects that hold - * the value(s) identified by the given string. - *

- * A ContextList object is created by the ORB, as - * illustrated here: - *

- *   ORB orb = ORB.init(args, null);
- *   org.omg.CORBA.ContextList ctxList = orb.create_context_list();
- * 
- * The variable ctxList represents an empty - * ContextList object. Strings are added to - * the list with the method add, accessed - * with the method item, and removed with the - * method remove. - * - * @see Context - * @since JDK1.2 - */ - -public abstract class ContextList { - - /** - * Returns the number of String objects in this - * ContextList object. - * - * @return an int representing the number of - * Strings in this ContextList object - */ - - public abstract int count(); - - /** - * Adds a String object to this ContextList - * object. - * - * @param ctx the String object to be added - */ - - public abstract void add(String ctx); - - /** - * Returns the String object at the given index. - * - * @param index the index of the string desired, with 0 being the - index of the first string - * @return the string at the given index - * @exception org.omg.CORBA.Bounds if the index is greater than - * or equal to the number of strings in this - * ContextList object - */ - - public abstract String item(int index) throws org.omg.CORBA.Bounds; - - /** - * Removes the String object at the given index. Note that - * the indices of all strings following the one removed are - * shifted down by one. - * - * @param index the index of the String object to be removed, - * with 0 designating the first string - * @exception org.omg.CORBA.Bounds if the index is greater than - * or equal to the number of String objects in - * this ContextList object - */ - - public abstract void remove(int index) throws org.omg.CORBA.Bounds; - -} --- old/src/java.corba/share/classes/org/omg/CORBA/Current.java 2018-01-30 20:26:46.000000000 -0500 +++ /dev/null 2018-01-30 20:26:46.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1997, 2001, 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 org.omg.CORBA; - - -/** -* Interfaces derived from the {@code Current} interface enable ORB and CORBA -* services to provide access to information (context) associated with -* the thread of execution in which they are running. This information -* is accessed in a structured manner using interfaces derived from the -* {@code Current} interface defined in the CORBA module. -* -*

Each ORB or CORBA service that needs its own context derives an -* interface from the CORBA module's {@code Current}. Users of the -* service can obtain an instance of the appropriate {@code Current} -* interface by invoking {@code ORB::resolve_initial_references}.

-* -* org/omg/CORBA/Current.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl -* Saturday, July 17, 1999 12:26:21 AM PDT. -*/ - -public interface Current extends CurrentOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity -{ -} // interface Current --- old/src/java.corba/share/classes/org/omg/CORBA/CurrentHelper.java 2018-01-30 20:26:47.000000000 -0500 +++ /dev/null 2018-01-30 20:26:47.000000000 -0500 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code Current}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/CurrentHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:21 AM PDT - */ - -abstract public class CurrentHelper -{ - private static String _id = "IDL:omg.org/CORBA/Current:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Current that) - { - throw new org.omg.CORBA.MARSHAL() ; - } - - public static org.omg.CORBA.Current extract (org.omg.CORBA.Any a) - { - throw new org.omg.CORBA.MARSHAL() ; - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.CORBA.CurrentHelper.id (), "Current"); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.Current read (org.omg.CORBA.portable.InputStream istream) - { - throw new org.omg.CORBA.MARSHAL() ; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Current value) - { - throw new org.omg.CORBA.MARSHAL() ; - } - - public static org.omg.CORBA.Current narrow (org.omg.CORBA.Object obj) - { - if (obj == null) - return null; - else if (obj instanceof org.omg.CORBA.Current) - return (org.omg.CORBA.Current)obj; - else - throw new org.omg.CORBA.BAD_PARAM (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/CurrentHolder.java 2018-01-30 20:26:47.000000000 -0500 +++ /dev/null 2018-01-30 20:26:47.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - -/** - * The Holder for {@code Current}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/CurrentHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:21 AM PDT - */ - -public final class CurrentHolder implements org.omg.CORBA.portable.Streamable -{ - public org.omg.CORBA.Current value = null; - - public CurrentHolder () - { - } - - public CurrentHolder (org.omg.CORBA.Current initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.CurrentHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.CurrentHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.CurrentHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/CurrentOperations.java 2018-01-30 20:26:48.000000000 -0500 +++ /dev/null 2018-01-30 20:26:48.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The interface for {@code Current}. For more information on - * Operations interfaces, see - * "Generated Files". - * - * org/omg/CORBA/CurrentOperations.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:21 AM PDT. - */ - -public interface CurrentOperations -{ -} // interface CurrentOperations --- old/src/java.corba/share/classes/org/omg/CORBA/CustomMarshal.java 2018-01-30 20:26:48.000000000 -0500 +++ /dev/null 2018-01-30 20:26:49.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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 org.omg.CORBA; - -import org.omg.CORBA.DataOutputStream; -import org.omg.CORBA.DataInputStream; - -/** - * An abstract value type that is meant to - * be used by the ORB, not the user. Semantically it is treated - * as a custom value type's implicit base class, although the custom - * valuetype does not actually inherit it in IDL. The implementer - * of a custom value type shall provide an implementation of the - * {@code CustomMarshal} operations. The manner in which this is done is - * specified in the IDL to Java langauge mapping. Each custom - * marshaled value type shall have its own implementation. - * @see DataInputStream - */ -public interface CustomMarshal { - /** - * Marshal method has to be implemented by the Customized Marshal class. - * This is the method invoked for Marshalling. - * - * @param os a DataOutputStream - */ - void marshal(DataOutputStream os); - /** - * Unmarshal method has to be implemented by the Customized Marshal class. - * This is the method invoked for Unmarshalling. - * - * @param is a DataInputStream - */ - void unmarshal(DataInputStream is); -} --- old/src/java.corba/share/classes/org/omg/CORBA/DATA_CONVERSION.java 2018-01-30 20:26:49.000000000 -0500 +++ /dev/null 2018-01-30 20:26:49.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception is raised if an ORB cannot convert the representation - * of data as marshaled into its native representation or vice-versa. - * For example, DATA_CONVERSION can be raised if wide character codeset - * conversion fails, or if an ORB cannot convert floating point values - * between different representations.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - *

- * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} - * to see the minor codes for this exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class DATA_CONVERSION extends SystemException { - - /** - * Constructs a DATA_CONVERSION exception with a default minor code - * of 0 and a completion state of COMPLETED_NO. - */ - public DATA_CONVERSION() { - this(""); - } - - /** - * Constructs a DATA_CONVERSION exception with the specified detail. - * @param s the String containing a detail message - */ - public DATA_CONVERSION(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a DATA_CONVERSION exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public DATA_CONVERSION(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a DATA_CONVERSION exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed the completion status - */ - public DATA_CONVERSION(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/DataInputStream.java 2018-01-30 20:26:50.000000000 -0500 +++ /dev/null 2018-01-30 20:26:50.000000000 -0500 @@ -1,344 +0,0 @@ -/* - * Copyright (c) 1998, 2015, 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 org.omg.CORBA; - -/** Defines the methods used to read primitive data types from input streams -* for unmarshaling custom value types. This interface is used by user -* written custom unmarshaling code for custom value types. -* @see org.omg.CORBA.DataOutputStream -* @see org.omg.CORBA.CustomMarshal -*/ -public interface DataInputStream extends org.omg.CORBA.portable.ValueBase -{ - /** Reads an IDL Any value from the input stream. - * @return the Any read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - org.omg.CORBA.Any read_any (); - - /** Reads an IDL boolean value from the input stream. - * @return the boolean read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - boolean read_boolean (); - - /** Reads an IDL character value from the input stream. - * @return the character read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - char read_char (); - - /** Reads an IDL wide character value from the input stream. - * @return the wide character read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - char read_wchar (); - - /** Reads an IDL octet value from the input stream. - * @return the octet value read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - byte read_octet (); - - /** Reads an IDL short from the input stream. - * @return the short read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - short read_short (); - - /** Reads an IDL unsigned short from the input stream. - * @return the unsigned short read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - short read_ushort (); - - /** Reads an IDL long from the input stream. - * @return the long read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - int read_long (); - - /** Reads an IDL unsigned long from the input stream. - * @return the unsigned long read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - int read_ulong (); - - /** Reads an IDL long long from the input stream. - * @return the long long read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - long read_longlong (); - - /** Reads an unsigned IDL long long from the input stream. - * @return the unsigned long long read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - long read_ulonglong (); - - /** Reads an IDL float from the input stream. - * @return the float read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - float read_float (); - - /** Reads an IDL double from the input stream. - * @return the double read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - double read_double (); - // read_longdouble not supported by IDL/Java mapping - - /** Reads an IDL string from the input stream. - * @return the string read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - String read_string (); - - /** Reads an IDL wide string from the input stream. - * @return the wide string read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - String read_wstring (); - - /** Reads an IDL CORBA::Object from the input stream. - * @return the CORBA::Object read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - org.omg.CORBA.Object read_Object (); - - /** Reads an IDL Abstract interface from the input stream. - * @return the Abstract interface read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - java.lang.Object read_Abstract (); - - /** Reads an IDL value type from the input stream. - * @return the value type read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - java.io.Serializable read_Value (); - - /** Reads an IDL typecode from the input stream. - * @return the typecode read. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - org.omg.CORBA.TypeCode read_TypeCode (); - - /** Reads array of IDL Anys from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length); - - /** Reads array of IDL booleans from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length); - - /** Reads array of IDL characters from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length); - - /** Reads array of IDL wide characters from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length); - - /** Reads array of IDL octets from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length); - - /** Reads array of IDL shorts from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length); - - /** Reads array of IDL unsigned shorts from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length); - - /** Reads array of IDL longs from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length); - - /** Reads array of IDL unsigned longs from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length); - - /** Reads array of IDL unsigned long longs from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length); - - /** Reads array of IDL long longs from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length); - - /** Reads array of IDL floats from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length); - - /** Reads array of IDL doubles from offset for length elements from the - * input stream. - * @param seq The out parameter holder for the array to be read. - * @param offset The index into seq of the first element to read from the - * input stream. - * @param length The number of elements to read from the input stream. - * @throws org.omg.CORBA.MARSHAL - * If an inconsistency is detected, including not having registered - * a streaming policy, then the standard system exception MARSHAL is raised. - */ - void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length); -} // interface DataInputStream --- old/src/java.corba/share/classes/org/omg/CORBA/DataOutputStream.java 2018-01-30 20:26:50.000000000 -0500 +++ /dev/null 2018-01-30 20:26:51.000000000 -0500 @@ -1,283 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA; - -/** Defines the methods used to write primitive data types to output streams -* for marshalling custom value types. This interface is used by user -* written custom marshalling code for custom value types. -* @see org.omg.CORBA.DataInputStream -* @see org.omg.CORBA.CustomMarshal -*/ -public interface DataOutputStream extends org.omg.CORBA.portable.ValueBase -{ - /** - * Writes the Any value to the output stream. - * @param value The value to be written. - */ - void write_any (org.omg.CORBA.Any value); - - /** - * Writes the boolean value to the output stream. - * @param value The value to be written. - */ - void write_boolean (boolean value); - - /** - * Writes the IDL character value to the output stream. - * @param value The value to be written. - */ - void write_char (char value); - - /** - * Writes the IDL wide character value to the output stream. - * @param value The value to be written. - */ - void write_wchar (char value); - - /** - * Writes the IDL octet value (represented as a Java byte) to the output stream. - * @param value The value to be written. - */ - void write_octet (byte value); - - /** - * Writes the IDL short value to the output stream. - * @param value The value to be written. - */ - void write_short (short value); - - /** - * Writes the IDL unsigned short value (represented as a Java short - * value) to the output stream. - * @param value The value to be written. - */ - void write_ushort (short value); - - /** - * Writes the IDL long value (represented as a Java int) to the output stream. - * @param value The value to be written. - */ - void write_long (int value); - - /** - * Writes the IDL unsigned long value (represented as a Java int) to the output stream. - * @param value The value to be written. - */ - void write_ulong (int value); - - /** - * Writes the IDL long long value (represented as a Java long) to the output stream. - * @param value The value to be written. - */ - void write_longlong (long value); - - /** - * Writes the IDL unsigned long long value (represented as a Java long) - * to the output stream. - * @param value The value to be written. - */ - void write_ulonglong (long value); - - /** - * Writes the IDL float value to the output stream. - * @param value The value to be written. - */ - void write_float (float value); - - /** - * Writes the IDL double value to the output stream. - * @param value The value to be written. - */ - void write_double (double value); - - // write_longdouble not supported by IDL/Java mapping - - /** - * Writes the IDL string value to the output stream. - * @param value The value to be written. - */ - void write_string (String value); - - /** - * Writes the IDL wide string value (represented as a Java String) to the output stream. - * @param value The value to be written. - */ - void write_wstring (String value); - - /** - * Writes the IDL CORBA::Object value to the output stream. - * @param value The value to be written. - */ - void write_Object (org.omg.CORBA.Object value); - - /** - * Writes the IDL Abstract interface type to the output stream. - * @param value The value to be written. - */ - void write_Abstract (java.lang.Object value); - - /** - * Writes the IDL value type value to the output stream. - * @param value The value to be written. - */ - void write_Value (java.io.Serializable value); - - /** - * Writes the typecode to the output stream. - * @param value The value to be written. - */ - void write_TypeCode (org.omg.CORBA.TypeCode value); - - /** - * Writes the array of IDL Anys from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_any_array (org.omg.CORBA.Any[] seq, int offset, int length); - - /** - * Writes the array of IDL booleans from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_boolean_array (boolean[] seq, int offset, int length); - - /** - * Writes the array of IDL characters from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_char_array (char[] seq, int offset, int length); - - /** - * Writes the array of IDL wide characters from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_wchar_array (char[] seq, int offset, int length); - - /** - * Writes the array of IDL octets from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_octet_array (byte[] seq, int offset, int length); - - /** - * Writes the array of IDL shorts from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_short_array (short[] seq, int offset, int length); - - /** - * Writes the array of IDL unsigned shorts (represented as Java shorts) - * from offset for length elements to the output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_ushort_array (short[] seq, int offset, int length); - - /** - * Writes the array of IDL longs from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_long_array (int[] seq, int offset, int length); - - /** - * Writes the array of IDL unsigned longs (represented as Java ints) - * from offset for length elements to the output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_ulong_array (int[] seq, int offset, int length); - - /** - * Writes the array of IDL unsigned long longs (represented as Java longs) - * from offset for length elements to the output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_ulonglong_array (long[] seq, int offset, int length); - - /** - * Writes the array of IDL long longs from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_longlong_array (long[] seq, int offset, int length); - - /** - * Writes the array of IDL floats from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_float_array (float[] seq, int offset, int length); - - /** - * Writes the array of IDL doubles from offset for length elements to the - * output stream. - * @param seq The array to be written. - * @param offset The index into seq of the first element to write to the - * output stream. - * @param length The number of elements to write to the output stream. - */ - void write_double_array (double[] seq, int offset, int length); -} // interface DataOutputStream --- old/src/java.corba/share/classes/org/omg/CORBA/DefinitionKind.java 2018-01-30 20:26:51.000000000 -0500 +++ /dev/null 2018-01-30 20:26:51.000000000 -0500 @@ -1,501 +0,0 @@ -/* - * Copyright (c) 1997, 2001, 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. - */ - -/* - * File: ./org/omg/CORBA/DefinitionKind.java - * From: ./ir.idl - * Date: Fri Aug 28 16:03:31 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - */ - -package org.omg.CORBA; - -/** -* The class that provides the constants used to identify the type of an -* Interface Repository object. This class contains two kinds of constants, -* those that are an int and those that are an instance of the class -* DefinitionKind. This class provides the method -* from_int, which given one -* of the int constants, creates the corresponding -* DefinitionKind instance. It also provides the method -* value, which returns the int constant that -* is the value for a DefinitionKind instance. -* -* @see IRObject -*/ - -public class DefinitionKind implements org.omg.CORBA.portable.IDLEntity { - -/** - * The constant that indicates that an Interface Repository object - * does not have a definition kind. - */ - public static final int _dk_none = 0, - -/** - * The constant that indicates that the type of an Interface Repository object - * may be any type. - */ - _dk_all = 1, - -/** - * The constant that indicates that an Interface Repository object is an - * attribute. - */ - _dk_Attribute = 2, - -/** - * The constant that indicates that an Interface Repository object is a - * constant. - */ - _dk_Constant = 3, - -/** - * The constant that indicates that an Interface Repository object is an - * exception. - */ - - _dk_Exception = 4, - -/** - * The constant that indicates that an Interface Repository object is an - * interface. - */ - - _dk_Interface = 5, - -/** - * The constant that indicates that an Interface Repository object is a - * module. - */ - - _dk_Module = 6, - -/** - * The constant that indicates that an Interface Repository object is an - * operation. - */ - - _dk_Operation = 7, - -/** - * The constant that indicates that an Interface Repository object is a - * Typedef. - */ - - _dk_Typedef = 8, - -/** - * The constant that indicates that an Interface Repository object is an - * Alias. - */ - - _dk_Alias = 9, - -/** - * The constant that indicates that an Interface Repository object is a - * Struct. - */ - - _dk_Struct = 10, - -/** - * The constant that indicates that an Interface Repository object is a - * Union. - */ - - _dk_Union = 11, - -/** - * The constant that indicates that an Interface Repository object is an - * Enum. - */ - - _dk_Enum = 12, - -/** - * The constant that indicates that an Interface Repository object is a - * Primitive. - */ - - _dk_Primitive = 13, - -/** - * The constant that indicates that an Interface Repository object is a - * String. - */ - - _dk_String = 14, - -/** - * The constant that indicates that an Interface Repository object is a - * Sequence. - */ - - _dk_Sequence = 15, - -/** - * The constant that indicates that an Interface Repository object is an - * Array. - */ - - _dk_Array = 16, - -/** - * The constant that indicates that an Interface Repository object is a - * Repository. - */ - - _dk_Repository = 17, - -/** - * The constant that indicates that an Interface Repository object is a - * Wstring. - */ - - _dk_Wstring = 18, - -/** - * The constant that indicates that an Interface Repository object is of type - * Fixed. - */ - - _dk_Fixed = 19, - -/** - * The constant that indicates that an Interface Repository object is a - * Value. - */ - - _dk_Value = 20, - -/** - * The constant that indicates that an Interface Repository object is a - * ValueBox. - */ - - _dk_ValueBox = 21, - -/** - * The constant that indicates that an Interface Repository object is a - * ValueMember. - */ - - _dk_ValueMember = 22, - -/** - * The constant that indicates that an Interface Repository object is of type - * Native. - */ - - _dk_Native = 23, - -/** - * The constant that indicates that an Interface Repository object - * is representing an abstract interface. - */ - _dk_AbstractInterface = 24; - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object has no definition kind. - */ - - public static final DefinitionKind dk_none = new DefinitionKind(_dk_none); - - /** - * The wildcard DefinitionKind constant, useful - * in all occasions where any - * DefinitionKind is appropriate. The Container's - * contents method - * makes use of this constant to return all contained definitions of any kind. - */ - - public static final DefinitionKind dk_all = new DefinitionKind(_dk_all); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is an Attribute. - */ - - public static final DefinitionKind dk_Attribute = new DefinitionKind(_dk_Attribute); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a constant. - */ - - public static final DefinitionKind dk_Constant = new DefinitionKind(_dk_Constant); - - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is an Exception. - */ - - public static final DefinitionKind dk_Exception = new DefinitionKind(_dk_Exception); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is an Interface. - */ - - public static final DefinitionKind dk_Interface = new DefinitionKind(_dk_Interface); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Module. - */ - - public static final DefinitionKind dk_Module = new DefinitionKind(_dk_Module); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is an Operation. - */ - - public static final DefinitionKind dk_Operation = new DefinitionKind(_dk_Operation); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Typedef. - */ - - public static final DefinitionKind dk_Typedef = new DefinitionKind(_dk_Typedef); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is an Alias. - */ - - public static final DefinitionKind dk_Alias = new DefinitionKind(_dk_Alias); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Struct. - */ - - public static final DefinitionKind dk_Struct = new DefinitionKind(_dk_Struct); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Union. - */ - - public static final DefinitionKind dk_Union = new DefinitionKind(_dk_Union); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is an Enum. - */ - - public static final DefinitionKind dk_Enum = new DefinitionKind(_dk_Enum); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Primitive. - */ - - public static final DefinitionKind dk_Primitive = new DefinitionKind(_dk_Primitive); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a String. - */ - - public static final DefinitionKind dk_String = new DefinitionKind(_dk_String); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Sequence. - */ - - public static final DefinitionKind dk_Sequence = new DefinitionKind(_dk_Sequence); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is an Array. - */ - - public static final DefinitionKind dk_Array = new DefinitionKind(_dk_Array); - - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Repository. - */ - - public static final DefinitionKind dk_Repository = new DefinitionKind(_dk_Repository); - - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Wstring. - */ - - public static final DefinitionKind dk_Wstring = new DefinitionKind(_dk_Wstring); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Fixed value. - */ - - public static final DefinitionKind dk_Fixed = new DefinitionKind(_dk_Fixed); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Value. - */ - - public static final DefinitionKind dk_Value = new DefinitionKind(_dk_Value); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a ValueBox. - */ - - public static final DefinitionKind dk_ValueBox = new DefinitionKind(_dk_ValueBox); - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a ValueMember. - */ - - public static final DefinitionKind dk_ValueMember = new DefinitionKind(_dk_ValueMember); - - -/** - * The static instance of DefinitionKind indicating that an - * Interface Repository object is a Native value. - */ - - public static final DefinitionKind dk_Native = new DefinitionKind(_dk_Native); - - -/** -* The static instance of DefinitionKind indicating that an -* Interface Repository object represents an abstract interface. -*/ - public static final DefinitionKind dk_AbstractInterface = new DefinitionKind(_dk_AbstractInterface); - - - /** - * Returns the int constant identifying the type of an IR object. - * @return the int constant from the class - * DefinitionKind that is the value of this - * DefinitionKind instance - */ - - public int value() { - return _value; - } - - - /** - * Creates a DefinitionKind instance corresponding to the given code -. - * @param i one of the int constants from the class - * DefinitionKind - * @return the DefinitionKind instance corresponding - * to the given code - * @throws org.omg.CORBA.BAD_PARAM if the given parameter is not - one - * of the int constants from the class - * DefinitionKind - */ - - public static DefinitionKind from_int(int i) { - switch (i) { - case _dk_none: - return dk_none; - case _dk_all: - return dk_all; - case _dk_Attribute: - return dk_Attribute; - case _dk_Constant: - return dk_Constant; - case _dk_Exception: - return dk_Exception; - case _dk_Interface: - return dk_Interface; - case _dk_Module: - return dk_Module; - case _dk_Operation: - return dk_Operation; - case _dk_Typedef: - return dk_Typedef; - case _dk_Alias: - return dk_Alias; - case _dk_Struct: - return dk_Struct; - case _dk_Union: - return dk_Union; - case _dk_Enum: - return dk_Enum; - case _dk_Primitive: - return dk_Primitive; - case _dk_String: - return dk_String; - case _dk_Sequence: - return dk_Sequence; - case _dk_Array: - return dk_Array; - case _dk_Repository: - return dk_Repository; - case _dk_Wstring: - return dk_Wstring; - case _dk_Fixed: - return dk_Fixed; - case _dk_Value: - return dk_Value; - case _dk_ValueBox: - return dk_ValueBox; - case _dk_ValueMember: - return dk_ValueMember; - case _dk_Native: - return dk_Native; - default: - throw new org.omg.CORBA.BAD_PARAM(); - } - } - - /** - * Constructs a DefinitionKind object with its _value - * field initialized with the given value. - * @param _value one of the int constants defined in the - * class DefinitionKind - */ - - protected DefinitionKind(int _value){ - this._value = _value; - } - - /** - * The field that holds a value for a DefinitionKind object. - * @serial - */ - - private int _value; -} --- old/src/java.corba/share/classes/org/omg/CORBA/DefinitionKindHelper.java 2018-01-30 20:26:52.000000000 -0500 +++ /dev/null 2018-01-30 20:26:52.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code DefinitionKind}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/DefinitionKindHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ir.idl - * 03 June 1999 11:33:43 o'clock GMT+00:00 - */ - -abstract public class DefinitionKindHelper -{ - private static String _id = "IDL:omg.org/CORBA/DefinitionKind:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.DefinitionKind that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.DefinitionKind extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (org.omg.CORBA.DefinitionKindHelper.id (), "DefinitionKind", new String[] { "dk_none", "dk_all", "dk_Attribute", "dk_Constant", "dk_Exception", "dk_Interface", "dk_Module", "dk_Operation", "dk_Typedef", "dk_Alias", "dk_Struct", "dk_Union", "dk_Enum", "dk_Primitive", "dk_String", "dk_Sequence", "dk_Array", "dk_Repository", "dk_Wstring", "dk_Fixed", "dk_Value", "dk_ValueBox", "dk_ValueMember", "dk_Native"} ); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.DefinitionKind read (org.omg.CORBA.portable.InputStream istream) - { - return org.omg.CORBA.DefinitionKind.from_int (istream.read_long ()); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.DefinitionKind value) - { - ostream.write_long (value.value ()); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/DomainManager.java 2018-01-30 20:26:53.000000000 -0500 +++ /dev/null 2018-01-30 20:26:53.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - -/** - * Provides mechanisms for establishing and navigating relationships to - * superior and subordinate domains, as well as for creating and accessing - * policies. The {@code DomainManager} has associated with it the policy - * objects for a particular domain. - * The domain manager also records the membership of - * the domain and provides the means to add and remove members. The domain - * manager is itself a member of a domain, possibly the domain it manages. - * The domain manager provides mechanisms for establishing and navigating - * relationships to superior and subordinate domains and - * creating and accessing policies. - */ - -public interface DomainManager extends DomainManagerOperations, - org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity -{ -} --- old/src/java.corba/share/classes/org/omg/CORBA/DomainManagerOperations.java 2018-01-30 20:26:53.000000000 -0500 +++ /dev/null 2018-01-30 20:26:54.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - -/** - * Provides the {@code DomainManager} with the means to access policies. - *

- * The {@code DomainManager} has associated with it the policy objects for a - * particular domain. The domain manager also records the membership of - * the domain and provides the means to add and remove members. The domain - * manager is itself a member of a domain, possibly the domain it manages. - * The domain manager provides mechanisms for establishing and navigating - * relationships to superior and subordinate domains and - * creating and accessing policies. - */ - -public interface DomainManagerOperations -{ - /** - * This returns the policy of the specified type for objects in - * this domain. The types of policies available are domain specific. - * See the CORBA specification for a list of standard ORB policies. - * - * @param policy_type Type of policy to request - */ - public org.omg.CORBA.Policy get_domain_policy(int policy_type); -} --- old/src/java.corba/share/classes/org/omg/CORBA/DoubleHolder.java 2018-01-30 20:26:54.000000000 -0500 +++ /dev/null 2018-01-30 20:26:54.000000000 -0500 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1995, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code Double}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code double} - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code double} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code DoubleHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myDoubleHolder} is an instance of {@code DoubleHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myDoubleHolder.value}. - * - * @since JDK1.2 - */ -public final class DoubleHolder implements Streamable { - - /** - * The {@code double} value held by this {@code DoubleHolder} - * object. - */ - - public double value; - - /** - * Constructs a new {@code DoubleHolder} object with its - * {@code value} field initialized to 0.0. - */ - public DoubleHolder() { - } - - /** - * Constructs a new {@code DoubleHolder} object for the given - * {@code double}. - * @param initial the {@code double} with which to initialize - * the {@code value} field of the new - * {@code DoubleHolder} object - */ - public DoubleHolder(double initial) { - value = initial; - } - - /** - * Read a double value from the input stream and store it in the - * value member. - * - * @param input the {@code InputStream} to read from. - */ - public void _read(InputStream input) { - value = input.read_double(); - } - - /** - * Write the double value stored in this holder to an - * {@code OutputStream}. - * - * @param output the {@code OutputStream} to write into. - */ - public void _write(OutputStream output) { - output.write_double(value); - } - - /** - * Return the {@code TypeCode} of this holder object. - * - * @return the {@code TypeCode} object. - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_double); - } - - -} --- old/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHelper.java 2018-01-30 20:26:55.000000000 -0500 +++ /dev/null 2018-01-30 20:26:55.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code DoubleSeq}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/DoubleSeqHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:37 o'clock GMT+00:00 - * - * The class definition has been modified to conform to the following - * OMG specifications : - *

    - *
  • ORB core as defined by CORBA 2.3.1 - * (formal/99-10-07) - *
  • - * - *
  • IDL/Java Language Mapping as defined in - * ptc/00-01-08 - *
  • - *
- */ - -public abstract class DoubleSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/DoubleSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, double[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static double[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_double); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.DoubleSeqHelper.id (), "DoubleSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static double[] read (org.omg.CORBA.portable.InputStream istream) - { - double value[] = null; - int _len0 = istream.read_long (); - value = new double[_len0]; - istream.read_double_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, double[] value) - { - ostream.write_long (value.length); - ostream.write_double_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHolder.java 2018-01-30 20:26:56.000000000 -0500 +++ /dev/null 2018-01-30 20:26:56.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Holder for {@code DoubleSeq}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/DoubleSeqHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:37 o'clock GMT+00:00 - */ - -public final class DoubleSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public double value[] = null; - - public DoubleSeqHolder () - { - } - - public DoubleSeqHolder (double[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.DoubleSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.DoubleSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.DoubleSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynAny.java 2018-01-30 20:26:56.000000000 -0500 +++ /dev/null 2018-01-30 20:26:56.000000000 -0500 @@ -1,732 +0,0 @@ -/* - * Copyright (c) 1998, 2015, 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 org.omg.CORBA; - - -/** - * Enables {@code org.omg.CORBA.Any} values to be dynamically - * interpreted (traversed) and - * constructed. A {@code DynAny} object is associated with a data value - * which may correspond to a copy of the value inserted into an {@code Any}. - * The {@code DynAny} APIs enable traversal of the data value associated with an - * Any at runtime and extraction of the primitive constituents of the - * data value. - * @deprecated Use the new DynAny instead - */ -@Deprecated -public interface DynAny extends org.omg.CORBA.Object -{ - /** - * Returns the {@code TypeCode} of the object inserted into - * this {@code DynAny}. - * - * @return the {@code TypeCode} object. - */ - public org.omg.CORBA.TypeCode type() ; - - /** - * Copy the contents from one Dynamic Any into another. - * - * @param dyn_any the {@code DynAny} object whose contents - * are assigned to this {@code DynAny}. - * @throws org.omg.CORBA.DynAnyPackage.Invalid if the source - * {@code DynAny} is invalid - */ - public void assign(org.omg.CORBA.DynAny dyn_any) - throws org.omg.CORBA.DynAnyPackage.Invalid; - - /** - * Make a {@code DynAny} object from an {@code Any} - * object. - * - * @param value the {@code Any} object. - * @throws org.omg.CORBA.DynAnyPackage.Invalid if the source - * {@code Any} object is empty or bad - */ - public void from_any(org.omg.CORBA.Any value) - throws org.omg.CORBA.DynAnyPackage.Invalid; - - /** - * Convert a {@code DynAny} object to an {@code Any} - * object. - * - * @return the {@code Any} object. - * @throws org.omg.CORBA.DynAnyPackage.Invalid if this - * {@code DynAny} is empty or bad. - * created or does not contain a meaningful value - */ - public org.omg.CORBA.Any to_any() - throws org.omg.CORBA.DynAnyPackage.Invalid; - - /** - * Destroys this {@code DynAny} object and frees any resources - * used to represent the data value associated with it. This method - * also destroys all {@code DynAny} objects obtained from it. - *

- * Destruction of {@code DynAny} objects should be handled with - * care, taking into account issues dealing with the representation of - * data values associated with {@code DynAny} objects. A programmer - * who wants to destroy a {@code DynAny} object but still be able - * to manipulate some component of the data value associated with it, - * should first create a {@code DynAny} object for the component - * and then make a copy of the created {@code DynAny} object. - */ - public void destroy() ; - - /** - * Clones this {@code DynAny} object. - * - * @return a copy of this {@code DynAny} object - */ - public org.omg.CORBA.DynAny copy() ; - - /** - * Inserts the given {@code boolean} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code boolean} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_boolean(boolean value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code byte} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code byte} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_octet(byte value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code char} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code char} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_char(char value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code short} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code short} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_short(short value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code short} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code short} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_ushort(short value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code int} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code int} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_long(int value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code int} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code int} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_ulong(int value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code float} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code float} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_float(float value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code double} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code double} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_double(double value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code String} object as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code String} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_string(String value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code org.omg.CORBA.Object} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code org.omg.CORBA.Object} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_reference(org.omg.CORBA.Object value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code org.omg.CORBA.TypeCode} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code org.omg.CORBA.TypeCode} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_typecode(org.omg.CORBA.TypeCode value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code long} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code long} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_longlong(long value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code long} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code long} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_ulonglong(long value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code char} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code char} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_wchar(char value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code String} as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code String} to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_wstring(String value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Inserts the given {@code org.omg.CORBA.Any} object as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code org.omg.CORBA.Any} object to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_any(org.omg.CORBA.Any value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - // orbos 98-01-18: Objects By Value -- begin - - /** - * Inserts the given {@code java.io.Serializable} object as the value for this - * {@code DynAny} object. - * - *

If this method is called on a constructed {@code DynAny} - * object, it initializes the next component of the constructed data - * value associated with this {@code DynAny} object. - * - * @param value the {@code java.io.Serializable} object to insert into this - * {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue - * if the value inserted is not consistent with the type - * of the accessed component in this {@code DynAny} object - */ - public void insert_val(java.io.Serializable value) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; - - /** - * Retrieves the {@code java.io.Serializable} object contained - * in this {@code DynAny} object. - * - * @return the {@code java.io.Serializable} object that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code java.io.Serializable} object - */ - public java.io.Serializable get_val() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - // orbos 98-01-18: Objects By Value -- end - - /** - * Retrieves the {@code boolean} contained - * in this {@code DynAny} object. - * - * @return the {@code boolean} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code boolean} - */ - public boolean get_boolean() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code byte} contained - * in this {@code DynAny} object. - * - * @return the {@code byte} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code byte} - */ - public byte get_octet() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - /** - * Retrieves the {@code char} contained - * in this {@code DynAny} object. - * - * @return the {@code char} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code char} - */ - public char get_char() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code short} contained - * in this {@code DynAny} object. - * - * @return the {@code short} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code short} - */ - public short get_short() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code short} contained - * in this {@code DynAny} object. - * - * @return the {@code short} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code short} - */ - public short get_ushort() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code int} contained - * in this {@code DynAny} object. - * - * @return the {@code int} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code int} - */ - public int get_long() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code int} contained - * in this {@code DynAny} object. - * - * @return the {@code int} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code int} - */ - public int get_ulong() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code float} contained - * in this {@code DynAny} object. - * - * @return the {@code float} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code float} - */ - public float get_float() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code double} contained - * in this {@code DynAny} object. - * - * @return the {@code double} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code double} - */ - public double get_double() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code String} contained - * in this {@code DynAny} object. - * - * @return the {@code String} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code String} - */ - public String get_string() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code org.omg.CORBA.Other} contained - * in this {@code DynAny} object. - * - * @return the {@code org.omg.CORBA.Other} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for an {@code org.omg.CORBA.Other} - */ - public org.omg.CORBA.Object get_reference() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code org.omg.CORBA.TypeCode} contained - * in this {@code DynAny} object. - * - * @return the {@code org.omg.CORBA.TypeCode} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code org.omg.CORBA.TypeCode} - */ - public org.omg.CORBA.TypeCode get_typecode() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code long} contained - * in this {@code DynAny} object. - * - * @return the {@code long} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code long} - */ - public long get_longlong() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code long} contained - * in this {@code DynAny} object. - * - * @return the {@code long} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code long} - */ - public long get_ulonglong() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code char} contained - * in this {@code DynAny} object. - * - * @return the {@code char} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code char} - */ - public char get_wchar() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code String} contained - * in this {@code DynAny} object. - * - * @return the {@code String} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for a {@code String} - */ - public String get_wstring() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - - /** - * Retrieves the {@code org.omg.CORBA.Any} contained - * in this {@code DynAny} object. - * - * @return the {@code org.omg.CORBA.Any} that is the - * value for this {@code DynAny} object - * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch - * if the type code of the accessed component in this - * {@code DynAny} object is not equivalent to - * the type code for an {@code org.omg.CORBA.Any} - */ - public org.omg.CORBA.Any get_any() - throws org.omg.CORBA.DynAnyPackage.TypeMismatch; - - /** - * Returns a {@code DynAny} object reference that can - * be used to get/set the value of the component currently accessed. - * The appropriate {@code insert} method - * can be called on the resulting {@code DynAny} object - * to initialize the component. - * The appropriate {@code get} method - * can be called on the resulting {@code DynAny} object - * to extract the value of the component. - * - * @return a {@code DynAny} object reference that can be - * used to retrieve or set the value of the component currently - * accessed - */ - public org.omg.CORBA.DynAny current_component() ; - - /** - * Moves to the next component of this {@code DynAny} object. - * This method is used for iterating through the components of - * a constructed type, effectively moving a pointer from one - * component to the next. The pointer starts out on the first - * component when a {@code DynAny} object is created. - * - * @return {@code true} if the pointer points to a component; - * {@code false} if there are no more components or this - * {@code DynAny} is associated with a basic type rather than - * a constructed type - */ - public boolean next() ; - - /** - * Moves the internal pointer to the given index. Logically, this method - * sets a new offset for this pointer. - * - * @param index an {@code int} indicating the position to which - * the pointer should move. The first position is 0. - * @return {@code true} if the pointer points to a component; - * {@code false} if there is no component at the designated - * index. If this {@code DynAny} object is associated with a - * basic type, this method returns {@code false} for any index - * other than 0. - */ - public boolean seek(int index) ; - - /** - * Moves the internal pointer to the first component. - */ - public void rewind() ; -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/Invalid.java 2018-01-30 20:26:57.000000000 -0500 +++ /dev/null 2018-01-30 20:26:57.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA.DynAnyPackage; - -/** - * Invalid is thrown by dynamic any operations when a bad - * DynAny or Any is passed as a parameter. - */ -public final class Invalid - extends org.omg.CORBA.UserException { - - /** - * Constructs an Invalid object. - */ - public Invalid() { - super(); - } - - /** - * Constructs an Invalid object. - * @param reason a String giving more information - * regarding the bad parameter passed to a dynamic any operation. - */ - public Invalid(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidSeq.java 2018-01-30 20:26:58.000000000 -0500 +++ /dev/null 2018-01-30 20:26:58.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA.DynAnyPackage; - -/** - * The InvalidSeq exception is thrown by all operations on dynamic - * anys that take a sequence (Java array) as an argument, when that - * sequence is invalid. - */ -public final class InvalidSeq - extends org.omg.CORBA.UserException { - - /** - * Constructs an InvalidSeq object. - */ - public InvalidSeq() { - super(); - } - - /** - * Constructs an InvalidSeq object. - * @param reason a String giving more information - * regarding the exception. - */ - public InvalidSeq(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidValue.java 2018-01-30 20:26:58.000000000 -0500 +++ /dev/null 2018-01-30 20:26:58.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1998, 2000, 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 org.omg.CORBA.DynAnyPackage; - -/** - * @author unattributed - * - * Dynamic Any insert operations raise the InvalidValue - * exception if the value inserted is not consistent with the type - * of the accessed component in the DynAny object. - */ -public final class InvalidValue - extends org.omg.CORBA.UserException { - - /** - * Constructs an InvalidValue object. - */ - public InvalidValue() { - super(); - } - - /** - * Constructs an InvalidValue object. - * @param reason a String giving more information - * regarding the exception. - */ - public InvalidValue(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/TypeMismatch.java 2018-01-30 20:26:59.000000000 -0500 +++ /dev/null 2018-01-30 20:26:59.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA.DynAnyPackage; - -/** - * TypeMismatch is thrown by dynamic any accessor methods when - * type of the actual contents do not match what is trying to be - * accessed. - */ -public final class TypeMismatch - extends org.omg.CORBA.UserException { - - /** - * Constructs a TypeMismatch object. - */ - public TypeMismatch() { - super(); - } - - /** - * Constructs a TypeMismatch object. - * @param reason a String giving more information - * regarding the exception. - */ - public TypeMismatch(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/package.html 2018-01-30 20:27:00.000000000 -0500 +++ /dev/null 2018-01-30 20:27:00.000000000 -0500 @@ -1,42 +0,0 @@ - - - - - - - - -Provides the exceptions used with the DynAny interface -(InvalidValue, -Invalid, InvalidSeq, and -TypeMismatch). - - - -@since JDK1.2 -@serial exclude - - --- old/src/java.corba/share/classes/org/omg/CORBA/DynArray.java 2018-01-30 20:27:00.000000000 -0500 +++ /dev/null 2018-01-30 20:27:00.000000000 -0500 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1998, 2015, 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 org.omg.CORBA; - - -/** - * Represents a {@code DynAny} object associated with an array. - * - * @deprecated Use the new DynArray instead - */ -@Deprecated -public interface DynArray extends org.omg.CORBA.Object, org.omg.CORBA.DynAny -{ - /** - * Returns the value of all the elements of this array. - * - * @return the array of Any objects that is the value - * for this DynArray object - * @see #set_elements - */ - public org.omg.CORBA.Any[] get_elements(); - - /** - * Sets the value of this - * DynArray object to the given array. - * - * @param value the array of Any objects - * @exception org.omg.CORBA.DynAnyPackage.InvalidSeq if the - * sequence is bad - * @see #get_elements - */ - public void set_elements(org.omg.CORBA.Any[] value) - throws org.omg.CORBA.DynAnyPackage.InvalidSeq; -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynEnum.java 2018-01-30 20:27:01.000000000 -0500 +++ /dev/null 2018-01-30 20:27:01.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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 org.omg.CORBA; - -/** - * Represents a {@code DynAny} object associated with an IDL enum. - * - * @deprecated Use the new DynEnum instead - */ -@Deprecated -public interface DynEnum extends org.omg.CORBA.Object, org.omg.CORBA.DynAny -{ - /** - * Return the value of the IDL enum stored in this - * {@code DynEnum} as a string. - * - * @return the stringified value. - */ - public String value_as_string(); - - /** - * Set a particular enum in this {@code DynEnum}. - * - * @param arg the string corresponding to the value. - */ - public void value_as_string(String arg); - - /** - * Return the value of the IDL enum as a Java int. - * - * @return the integer value. - */ - public int value_as_ulong(); - - /** - * Set the value of the IDL enum. - * - * @param arg the int value of the enum. - */ - public void value_as_ulong(int arg); -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynFixed.java 2018-01-30 20:27:02.000000000 -0500 +++ /dev/null 2018-01-30 20:27:02.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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 org.omg.CORBA; - -/** - * Represents a DynAny object that is associated - * with an IDL fixed type. - * @deprecated Use the new DynFixed instead - */ -@Deprecated -public interface DynFixed extends org.omg.CORBA.Object, org.omg.CORBA.DynAny -{ - /** - * Returns the value of the fixed type represented in this - * DynFixed object. - * - * @return the value as a byte array - * @see #set_value - */ - public byte[] get_value(); - - /** - * Sets the given fixed type instance as the value for this - * DynFixed object. - * - * @param val the value of the fixed type as a byte array - * @throws org.omg.CORBA.DynAnyPackage.InvalidValue if the given - * argument is bad - * @see #get_value - */ - public void set_value(byte[] val) - throws org.omg.CORBA.DynAnyPackage.InvalidValue; -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynSequence.java 2018-01-30 20:27:02.000000000 -0500 +++ /dev/null 2018-01-30 20:27:02.000000000 -0500 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 1998, 2015, 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 org.omg.CORBA; - -/** - * The representation of a DynAny object that is associated - * with an IDL sequence. - * @deprecated Use the new DynSequence instead - */ -@Deprecated -public interface DynSequence extends org.omg.CORBA.Object, org.omg.CORBA.DynAny -{ - - /** - * Returns the length of the sequence represented by this - * DynFixed object. - * - * @return the length of the sequence - */ - public int length(); - - /** - * Sets the length of the sequence represented by this - * DynFixed object to the given argument. - * - * @param arg the length of the sequence - */ - public void length(int arg); - - /** - * Returns the value of every element in this sequence. - * - * @return an array of Any objects containing the values in - * the sequence - * @see #set_elements - */ - public org.omg.CORBA.Any[] get_elements(); - - /** - * Sets the values of all elements in this sequence with the given - * array. - * - * @param value the array of Any objects to be set - * @exception org.omg.CORBA.DynAnyPackage.InvalidSeq if the array - * of values is bad - * @see #get_elements - */ - public void set_elements(org.omg.CORBA.Any[] value) - throws org.omg.CORBA.DynAnyPackage.InvalidSeq; -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynStruct.java 2018-01-30 20:27:03.000000000 -0500 +++ /dev/null 2018-01-30 20:27:03.000000000 -0500 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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 org.omg.CORBA; - -/** - * The representation of a DynAny object that is associated - * with an IDL struct. - * @deprecated Use the new DynStruct instead - */ -@Deprecated -public interface DynStruct extends org.omg.CORBA.Object, org.omg.CORBA.DynAny -{ - /** - * During a traversal, returns the name of the current member. - * - * @return the string name of the current member - */ - public String current_member_name(); - - /** - * Returns the TCKind object that describes the kind of - * the current member. - * - * @return the TCKind object that describes the current member - */ - public org.omg.CORBA.TCKind current_member_kind(); - - /** - * Returns an array containing all the members of the stored struct. - * - * @return the array of name-value pairs - * @see #set_members - */ - public org.omg.CORBA.NameValuePair[] get_members(); - - /** - * Set the members of the struct. - * - * @param value the array of name-value pairs. - * @throws org.omg.CORBA.DynAnyPackage.InvalidSeq if the given argument - * is invalid - * @see #get_members - */ - public void set_members(org.omg.CORBA.NameValuePair[] value) - throws org.omg.CORBA.DynAnyPackage.InvalidSeq; -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynUnion.java 2018-01-30 20:27:04.000000000 -0500 +++ /dev/null 2018-01-30 20:27:04.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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 org.omg.CORBA; - -/** - * The DynUnion interface represents a DynAny object - * that is associated with an IDL union. - * Union values can be traversed using the operations defined in DynAny. - * The first component in the union corresponds to the discriminator; - * the second corresponds to the actual value of the union. - * Calling the method next() twice allows you to access both components. - * @deprecated Use the new DynUnion instead - */ -@Deprecated -public interface DynUnion extends org.omg.CORBA.Object, org.omg.CORBA.DynAny -{ - /** - * Determines whether the discriminator associated with this union has been assigned - * a valid default value. - * @return true if the discriminator has a default value; - * false otherwise - */ - public boolean set_as_default(); - - /** - * Determines whether the discriminator associated with this union gets assigned - * a valid default value. - * @param arg true if the discriminator gets assigned a default value - */ - public void set_as_default(boolean arg); - - /** - * Returns a DynAny object reference that must be narrowed to the type - * of the discriminator in order to insert/get the discriminator value. - * @return a DynAny object reference representing the discriminator value - */ - public org.omg.CORBA.DynAny discriminator(); - - /** - * Returns the TCKind object associated with the discriminator of this union. - * @return the TCKind object associated with the discriminator of this union - */ - public org.omg.CORBA.TCKind discriminator_kind(); - - /** - * Returns a DynAny object reference that is used in order to insert/get - * a member of this union. - * @return the DynAny object representing a member of this union - */ - public org.omg.CORBA.DynAny member(); - - /** - * Allows for the inspection of the name of this union member - * without checking the value of the discriminator. - * @return the name of this union member - */ - public String member_name(); - - /** - * Allows for the assignment of the name of this union member. - * @param arg the new name of this union member - */ - public void member_name(String arg); - - /** - * Returns the TCKind associated with the member of this union. - * @return the TCKind object associated with the member of this union - */ - public org.omg.CORBA.TCKind member_kind(); -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynValue.java 2018-01-30 20:27:05.000000000 -0500 +++ /dev/null 2018-01-30 20:27:05.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1998, 2004, 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 org.omg.CORBA; - -/** - * The representation of a DynAny object that is associated - * with an IDL value type. - * @deprecated Use the new DynValue instead - */ -@Deprecated -public interface DynValue extends org.omg.CORBA.Object, org.omg.CORBA.DynAny { - - /** - * Returns the name of the current member while traversing a - * DynAny object that represents a Value object. - * - * @return the name of the current member - */ - String current_member_name(); - - /** - * Returns the TCKind object that describes the current member. - * - * @return the TCKind object corresponding to the current - * member - */ - TCKind current_member_kind(); - - /** - * Returns an array containing all the members of the value object - * stored in this DynValue. - * - * @return an array of name-value pairs. - * @see #set_members - */ - org.omg.CORBA.NameValuePair[] get_members(); - - /** - * Sets the members of the value object this DynValue - * object represents to the given array of NameValuePair - * objects. - * - * @param value the array of name-value pairs to be set - * @throws org.omg.CORBA.DynAnyPackage.InvalidSeq - * if an inconsistent value is part of the given array - * @see #get_members - */ - void set_members(NameValuePair[] value) - throws org.omg.CORBA.DynAnyPackage.InvalidSeq; -} --- old/src/java.corba/share/classes/org/omg/CORBA/DynamicImplementation.java 2018-01-30 20:27:05.000000000 -0500 +++ /dev/null 2018-01-30 20:27:05.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1997, 2004, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.ObjectImpl; - -/** - * @deprecated org.omg.CORBA.DynamicImplementation - */ -@Deprecated -public class DynamicImplementation extends org.omg.CORBA.portable.ObjectImpl { - - /** - * @deprecated Deprecated by Portable Object Adapter - */ - @Deprecated - public void invoke(ServerRequest request) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - public String[] _ids() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/Environment.java 2018-01-30 20:27:06.000000000 -0500 +++ /dev/null 2018-01-30 20:27:06.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1996, 1999, 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 org.omg.CORBA; - -/** - * A container (holder) for an exception that is used in Request - * operations to make exceptions available to the client. An - * Environment object is created with the ORB - * method create_environment. - * - * @since JDK1.2 - */ - -public abstract class Environment { - - /** - * Retrieves the exception in this Environment object. - * - * @return the exception in this Environment object - */ - - public abstract java.lang.Exception exception(); - - /** - * Inserts the given exception into this Environment object. - * - * @param except the exception to be set - */ - - public abstract void exception(java.lang.Exception except); - - /** - * Clears this Environment object of its exception. - */ - - public abstract void clear(); - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ExceptionList.java 2018-01-30 20:27:07.000000000 -0500 +++ /dev/null 2018-01-30 20:27:07.000000000 -0500 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1996, 1999, 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 org.omg.CORBA; - -/** - * An object used in Request operations to - * describe the exceptions that can be thrown by a method. It maintains a - * modifiable list of TypeCodes of the exceptions. - *

- * The following code fragment demonstrates creating - * an ExceptionList object: - *

- *    ORB orb = ORB.init(args, null);
- *    org.omg.CORBA.ExceptionList excList = orb.create_exception_list();
- * 
- * The variable excList represents an ExceptionList - * object with no TypeCode objects in it. - *

- * To add items to the list, you first create a TypeCode object - * for the exception you want to include, using the ORB method - * create_exception_tc. Then you use the ExceptionList - * method add to add it to the list. - * The class ExceptionList has a method for getting - * the number of TypeCode objects in the list, and after - * items have been added, it is possible to call methods for accessing - * or deleting an item at a designated index. - * - * @since JDK1.2 - */ - -public abstract class ExceptionList { - - /** - * Retrieves the number of TypeCode objects in this - * ExceptionList object. - * - * @return the number of TypeCode objects in this - * ExceptionList object - */ - - public abstract int count(); - - /** - * Adds a TypeCode object describing an exception - * to this ExceptionList object. - * - * @param exc the TypeCode object to be added - */ - - public abstract void add(TypeCode exc); - - /** - * Returns the TypeCode object at the given index. The first - * item is at index 0. - * - * @param index the index of the TypeCode object desired. - * This must be an int between 0 and the - * number of TypeCode objects - * minus one, inclusive. - * @return the TypeCode object at the given index - * @exception org.omg.CORBA.Bounds if the index given is greater than - * or equal to the number of TypeCode objects - * in this ExceptionList object - */ - - public abstract TypeCode item(int index) - throws org.omg.CORBA.Bounds; - - /** - * Removes the TypeCode object at the given index. - * Note that the indices of all the TypeCoded objects - * following the one deleted are shifted down by one. - * - * @param index the index of the TypeCode object to be - * removed. - * This must be an int between 0 and the - * number of TypeCode objects - * minus one, inclusive. - * - * @exception org.omg.CORBA.Bounds if the index is greater than - * or equal to the number of TypeCode objects - * in this ExceptionList object - */ - - public abstract void remove(int index) - throws org.omg.CORBA.Bounds; -} --- old/src/java.corba/share/classes/org/omg/CORBA/FREE_MEM.java 2018-01-30 20:27:07.000000000 -0500 +++ /dev/null 2018-01-30 20:27:07.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown - * when the ORB failed in an attempt to free dynamic memory, for example - * because of heap corruption or memory segments being locked.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class FREE_MEM extends SystemException { - /** - * Constructs a FREE_MEM exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public FREE_MEM() { - this(""); - } - - /** - * Constructs a FREE_MEM exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * - * @param s the String containing a detail message - */ - public FREE_MEM(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a FREE_MEM exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public FREE_MEM(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a FREE_MEM exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed the completion status - */ - public FREE_MEM(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/FieldNameHelper.java 2018-01-30 20:27:08.000000000 -0500 +++ /dev/null 2018-01-30 20:27:08.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code FieldName}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/FieldNameHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * 03 June 1999 11:52:03 o'clock GMT+00:00 - */ - -abstract public class FieldNameHelper -{ - private static String _id = "IDL:omg.org/CORBA/FieldName:1.0"; - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.FieldNameHelper.id (), "FieldName", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/FixedHolder.java 2018-01-30 20:27:09.000000000 -0500 +++ /dev/null 2018-01-30 20:27:09.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - - -/** - * The Holder for {@code Fixed}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * FixedHolder is a container class for values of IDL type "fixed", - * which is mapped to the Java class java.math.BigDecimal. - * It is usually used to store "out" and "inout" IDL method parameters. - * If an IDL method signature has a fixed as an "out" or "inout" parameter, - * the programmer must pass an instance of FixedHolder as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the contained - * value corresponding to the "out" value returned from the server. - * - */ -public final class FixedHolder implements Streamable { - /** - * The value held by the FixedHolder - */ - public java.math.BigDecimal value; - - /** - * Construct the FixedHolder without initializing the contained value. - */ - public FixedHolder() { - } - - /** - * Construct the FixedHolder and initialize it with the given value. - * @param initial the value used to initialize the FixedHolder - */ - public FixedHolder(java.math.BigDecimal initial) { - value = initial; - } - - /** - * Read a fixed point value from the input stream and store it in - * the value member. - * - * @param input the {@code InputStream} to read from. - */ - public void _read(InputStream input) { - value = input.read_fixed(); - } - - /** - * Write the fixed point value stored in this holder to an - * {@code OutputStream}. - * - * @param output the {@code OutputStream} to write into. - */ - public void _write(OutputStream output) { - output.write_fixed(value); - } - - - /** - * Return the {@code TypeCode} of this holder object. - * - * @return the {@code TypeCode} object. - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_fixed); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/FloatHolder.java 2018-01-30 20:27:09.000000000 -0500 +++ /dev/null 2018-01-30 20:27:09.000000000 -0500 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 1995, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - - -/** - * The Holder for {@code Float}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code float} - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code float} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code FloatHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myFloatHolder} is an instance of {@code FloatHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myFloatHolder.value}. - * - * @since JDK1.2 - */ -public final class FloatHolder implements Streamable { - /** - * The {@code float} value held by this {@code FloatHolder} - * object. - */ - public float value; - - /** - * Constructs a new {@code FloatHolder} object with its - * {@code value} field initialized to 0.0. - */ - public FloatHolder() { - } - - /** - * Constructs a new {@code FloatHolder} object for the given - * {@code float}. - * @param initial the {@code float} with which to initialize - * the {@code value} field of the new - * {@code FloatHolder} object - */ - public FloatHolder(float initial) { - value = initial; - } - - /** - * Read a float from an input stream and initialize the value - * member with the float value. - * - * @param input the {@code InputStream} to read from. - */ - public void _read(InputStream input) { - value = input.read_float(); - } - - /** - * Write the float value into an output stream. - * - * @param output the {@code OutputStream} to write into. - */ - public void _write(OutputStream output) { - output.write_float(value); - } - - /** - * Return the {@code TypeCode} of this Streamable. - * - * @return the {@code TypeCode} object. - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_float); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHelper.java 2018-01-30 20:27:10.000000000 -0500 +++ /dev/null 2018-01-30 20:27:10.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code FloatSeq}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/FloatSeqHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:37 o'clock GMT+00:00 - * - * The class definition has been modified to conform to the following - * OMG specifications : - *

    - *
  • ORB core as defined by CORBA 2.3.1 - * (formal/99-10-07) - *
  • - * - *
  • IDL/Java Language Mapping as defined in - * ptc/00-01-08 - *
  • - *
- */ - -public abstract class FloatSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/FloatSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, float[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static float[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_float); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.FloatSeqHelper.id (), "FloatSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static float[] read (org.omg.CORBA.portable.InputStream istream) - { - float value[] = null; - int _len0 = istream.read_long (); - value = new float[_len0]; - istream.read_float_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, float[] value) - { - ostream.write_long (value.length); - ostream.write_float_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHolder.java 2018-01-30 20:27:11.000000000 -0500 +++ /dev/null 2018-01-30 20:27:11.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Holder for {@code FloatSeq}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/FloatSeqHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:37 o'clock GMT+00:00 - */ - -public final class FloatSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public float value[] = null; - - public FloatSeqHolder () - { - } - - public FloatSeqHolder (float[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.FloatSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.FloatSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.FloatSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/IDLType.java 2018-01-30 20:27:11.000000000 -0500 +++ /dev/null 2018-01-30 20:27:11.000000000 -0500 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 1997, 1999, 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. - */ -/* - * File: ./org/omg/CORBA/IDLType.java - * From: ./ir.idl - * Date: Fri Aug 28 16:03:31 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - */ - -package org.omg.CORBA; -/** -* tempout/org/omg/CORBA/IDLType.java -* Generated by the IBM IDL-to-Java compiler, version 1.0 -* from ../../Lib/ir.idl -* Thursday, February 25, 1999 2:11:23 o'clock PM PST -*/ - -/** - * An abstract interface inherited by all Interface Repository - * (IR) objects that represent OMG IDL types. It provides access - * to the TypeCode object describing the type and is used in defining the - * other interfaces wherever definitions of IDLType must be referenced. - */ - -public interface IDLType extends IDLTypeOperations, org.omg.CORBA.IRObject, org.omg.CORBA.portable.IDLEntity -{ -} // interface IDLType --- old/src/java.corba/share/classes/org/omg/CORBA/IDLTypeHelper.java 2018-01-30 20:27:12.000000000 -0500 +++ /dev/null 2018-01-30 20:27:12.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code IDLType}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/IDLTypeHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ir.idl - * 03 June 1999 11:33:44 o'clock GMT+00:00 - */ - -abstract public class IDLTypeHelper -{ - private static String _id = "IDL:omg.org/CORBA/IDLType:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.IDLType that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.IDLType extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.CORBA.IDLTypeHelper.id (), "IDLType"); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.IDLType read (org.omg.CORBA.portable.InputStream istream) - { - return narrow (istream.read_Object (_IDLTypeStub.class)); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.IDLType value) - { - ostream.write_Object ((org.omg.CORBA.Object) value); - } - - public static org.omg.CORBA.IDLType narrow (org.omg.CORBA.Object obj) - { - if (obj == null) - return null; - else if (obj instanceof org.omg.CORBA.IDLType) - return (org.omg.CORBA.IDLType)obj; - else if (!obj._is_a (id ())) - throw new org.omg.CORBA.BAD_PARAM (); - else - { - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); - return new org.omg.CORBA._IDLTypeStub (delegate); - } - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/IDLTypeOperations.java 2018-01-30 20:27:13.000000000 -0500 +++ /dev/null 2018-01-30 20:27:13.000000000 -0500 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - -/** - * The interface for {@code IDLType}. For more information on - * Operations interfaces, see - * "Generated Files: Operations files". - */ - -/* - tempout/org/omg/CORBA/IDLTypeOperations.java - Generated by the IBM IDL-to-Java compiler, version 1.0 - from ../../Lib/ir.idl - Thursday, February 25, 1999 2:11:23 o'clock PM PST -*/ - -/** - * This interface must be implemented by all IDLType objects. - * The IDLType is inherited by all IR objects that - * represent IDL types, including interfaces, typedefs, and - * anonymous types. - * @see IDLType - * @see IRObject - * @see IRObjectOperations - */ - -public interface IDLTypeOperations extends org.omg.CORBA.IRObjectOperations -{ - /** - * The type attribute describes the type defined by an object - * derived from {@code IDLType}. - * @return the {@code TypeCode} defined by this object. - */ - org.omg.CORBA.TypeCode type (); -} // interface IDLTypeOperations --- old/src/java.corba/share/classes/org/omg/CORBA/IMP_LIMIT.java 2018-01-30 20:27:13.000000000 -0500 +++ /dev/null 2018-01-30 20:27:14.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception indicates that an implementation limit was - * exceeded in the ORB run time. For example, an ORB may reach - * the maximum number of references it can hold simultaneously - * in an address space, the size of a parameter may have - * exceeded the allowed maximum, or an ORB may impose a maximum - * on the number of clients or servers that can run simultaneously.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - - -public final class IMP_LIMIT extends SystemException { - /** - * Constructs an IMP_LIMIT exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public IMP_LIMIT() { - this(""); - } - - /** - * Constructs an IMP_LIMIT exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * - * @param s the String containing a detail message - */ - public IMP_LIMIT(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an IMP_LIMIT exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public IMP_LIMIT(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an IMP_LIMIT exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed the completion status - */ - public IMP_LIMIT(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/INITIALIZE.java 2018-01-30 20:27:14.000000000 -0500 +++ /dev/null 2018-01-30 20:27:14.000000000 -0500 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown - * when an ORB has encountered a failure during its initialization, - * such as failure to acquire networking resources or detecting a - * configuration error.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class INITIALIZE extends SystemException { - /** - * Constructs an INITIALIZE exception with a default - * minor code of 0 and a completion state of - * CompletionStatus.COMPLETED_NO. - */ - public INITIALIZE() { - this(""); - } - - /** - * Constructs an INITIALIZE exception with the specified detail - * message, a minor code of 0, and a completion state of - * CompletionStatus.COMPLETED_NO. - * @param s the String containing a detail message - */ - public INITIALIZE(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an INITIALIZE exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed an instance of CompletionStatus - * indicating the completion status of the method - * that threw this exception - */ - public INITIALIZE(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an INITIALIZE exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed an instance of CompletionStatus - * indicating the completion status of the method - * that threw this exception - */ - public INITIALIZE(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/INTERNAL.java 2018-01-30 20:27:15.000000000 -0500 +++ /dev/null 2018-01-30 20:27:15.000000000 -0500 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception indicates an internal failure in an ORB, for - * example, if an ORB has detected corruption of its internal - * data structures.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - *

- * See the section {@extLink jidlexception_minorcodes meaning of minor codes} - * to see the minor codes for this exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class INTERNAL extends SystemException { - /** - * Constructs an INTERNAL exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public INTERNAL() { - this(""); - } - - /** - * Constructs an INTERNAL exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public INTERNAL(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an INTERNAL exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed an instance of CompletionStatus - * that indicates the completion status of the method - * that threw this exception - */ - public INTERNAL(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an INTERNAL exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed an instance of CompletionStatus - * that indicates the completion status of the method - * that threw this exception - */ - public INTERNAL(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/INTF_REPOS.java 2018-01-30 20:27:16.000000000 -0500 +++ /dev/null 2018-01-30 20:27:16.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception raised - * when an ORB cannot reach the interface - * repository, or some other failure relating to the interface repository - * is detected.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class INTF_REPOS extends SystemException { - /** - * Constructs an INTF_REPOS exception with a default minor code - * of 0 and a completion state of COMPLETED_NO. - */ - public INTF_REPOS() { - this(""); - } - - /** - * Constructs an INTF_REPOS exception with the specified detail. - * @param s the String containing a detail message - */ - public INTF_REPOS(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an INTF_REPOS exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public INTF_REPOS(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an INTF_REPOS exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed the completion status - */ - public INTF_REPOS(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/INVALID_ACTIVITY.java 2018-01-30 20:27:16.000000000 -0500 +++ /dev/null 2018-01-30 20:27:16.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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 org.omg.CORBA; - -/** - * The INVALID_ACTIVITY system exception may be raised on the - * Activity or Transaction services' resume methods if a transaction or - * Activity is resumed in a context different to that from which it was - * suspended. It is also raised when an attempted invocation is made that - * is incompatible with the Activity's current state. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since J2SE 1.5 - */ - -public final class INVALID_ACTIVITY extends SystemException { - - /** - * Constructs an INVALID_ACTIVITY exception with - * minor code set to 0 and CompletionStatus set to COMPLETED_NO. - */ - public INVALID_ACTIVITY() { - this(""); - } - - /** - * Constructs an INVALID_ACTIVITY exception with the - * specified message. - * - * @param detailMessage string containing a detailed message. - */ - public INVALID_ACTIVITY(String detailMessage) { - this(detailMessage, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an INVALID_ACTIVITY exception with the - * specified minor code and completion status. - * - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public INVALID_ACTIVITY(int minorCode, - CompletionStatus completionStatus) { - this("", minorCode, completionStatus); - } - - /** - * Constructs an INVALID_ACTIVITY exception with the - * specified message, minor code, and completion status. - * - * @param detailMessage string containing a detailed message. - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public INVALID_ACTIVITY(String detailMessage, - int minorCode, - CompletionStatus completionStatus) { - super(detailMessage, minorCode, completionStatus); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/INVALID_TRANSACTION.java 2018-01-30 20:27:17.000000000 -0500 +++ /dev/null 2018-01-30 20:27:17.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown - * when the request carried an invalid transaction context. - * For example, this exception could be raised if an error - * occurred when trying to register a resource.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - * - */ - -public final class INVALID_TRANSACTION extends SystemException { - /** - * Constructs an INVALID_TRANSACTION exception with a default minor code - * of 0 and a completion state of COMPLETED_NO. - */ - public INVALID_TRANSACTION() { - this(""); - } - - /** - * Constructs an INVALID_TRANSACTION exception - * with the specified detail message. - * @param s the String containing a detail message - */ - public INVALID_TRANSACTION(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an INVALID_TRANSACTION exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public INVALID_TRANSACTION(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an INVALID_TRANSACTION exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed the completion status - */ - public INVALID_TRANSACTION(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/INV_FLAG.java 2018-01-30 20:27:18.000000000 -0500 +++ /dev/null 2018-01-30 20:27:18.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown - * when an invalid flag was passed to an operation (for example, when - * creating a DII request).

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class INV_FLAG extends SystemException { - /** - * Constructs an INV_FLAG exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public INV_FLAG() { - this(""); - } - - /** - * Constructs an INV_FLAG exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public INV_FLAG(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an INV_FLAG exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed an instance of CompletionStatus - * indicating the completion status - */ - public INV_FLAG(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an INV_FLAG exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed an instance of CompletionStatus - * indicating the completion status - */ - public INV_FLAG(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/INV_IDENT.java 2018-01-30 20:27:18.000000000 -0500 +++ /dev/null 2018-01-30 20:27:19.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception indicates that an IDL identifier is syntactically - * invalid. It may be raised if, for example, an identifier passed - * to the interface repository does not conform to IDL identifier - * syntax, or if an illegal operation name is used with the DII.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class INV_IDENT extends SystemException { - /** - * Constructs an INV_IDENT exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public INV_IDENT() { - this(""); - } - - /** - * Constructs an INV_IDENT exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public INV_IDENT(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an INV_IDENT exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed a CompletionStatus object indicating - * the completion status - */ - public INV_IDENT(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an INV_IDENT exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed a CompletionStatus object indicating - * the completion status - */ - public INV_IDENT(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java 2018-01-30 20:27:19.000000000 -0500 +++ /dev/null 2018-01-30 20:27:19.000000000 -0500 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception indicates that an object reference is internally - * malformed. For example, the repository ID may have incorrect - * syntax or the addressing information may be invalid. This - * exception is raised by ORB::string_to_object if the passed - * string does not decode correctly. An ORB may choose to detect - * calls via nil references (but is not obliged to do detect them). - * {@code INV_OBJREF} is used to indicate this.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - *

- * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} - * to see the minor codes for this exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class INV_OBJREF extends SystemException { - /** - * Constructs an {@code INV_OBJREF} exception with a default - * minor code of 0 and a completion state of COMPLETED_NO. - */ - public INV_OBJREF() { - this(""); - } - - /** - * Constructs an {@code INV_OBJREF} exception with the specified detail - * message, a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public INV_OBJREF(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an {@code INV_OBJREF} exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed a {@code CompletionStatus} instance indicating - * the completion status - */ - public INV_OBJREF(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an {@code INV_OBJREF} exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param s the String containing a detail message - * @param minor the minor code - * @param completed a {@code CompletionStatus} instance indicating - * the completion status - */ - public INV_OBJREF(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java 2018-01-30 20:27:20.000000000 -0500 +++ /dev/null 2018-01-30 20:27:20.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1998, 2017, 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 org.omg.CORBA; - -/** - * Standard exception thrown - * when an invocation cannot be made because of an incompatibility between - * {@code Policy} overrides that apply to the particular invocation. - * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class INV_POLICY extends SystemException { - /** - * Constructs a {@code INV_POLICY} exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public INV_POLICY() { - this(""); - } - - /** - * Constructs a {@code INV_POLICY} exception with the - * specified description message, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public INV_POLICY(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a {@code INV_POLICY} exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public INV_POLICY(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a {@code INV_POLICY} exception with the - * specified description message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public INV_POLICY(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/IRObject.java 2018-01-30 20:27:21.000000000 -0500 +++ /dev/null 2018-01-30 20:27:21.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1997, 1999, 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. - */ -/* - * File: ./org/omg/CORBA/IRObject.java - * From: ./ir.idl - * Date: Fri Aug 28 16:03:31 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - */ - -package org.omg.CORBA; -/** -An IRObject IDL interface represents the most generic interface -from which all other Interface Repository interfaces are derived, -even the Repository itself. -*/ - -public interface IRObject extends IRObjectOperations, org.omg.CORBA.Object, - org.omg.CORBA.portable.IDLEntity -{ -} --- old/src/java.corba/share/classes/org/omg/CORBA/IRObjectOperations.java 2018-01-30 20:27:21.000000000 -0500 +++ /dev/null 2018-01-30 20:27:21.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The interface for {@code IRObject}. For more information on - * Operations interfaces, see - * "Generated Files: Operations files". - */ - -/* - tempout/org/omg/CORBA/IRObjectOperations.java - Generated by the IBM IDL-to-Java compiler, version 1.0 - from ../../Lib/ir.idl - Thursday, February 25, 1999 2:11:21 o'clock PM PST -*/ - -/** - * This is the Operations interface for the mapping from {@code IRObject}. - * Several interfaces are used as base interfaces for objects in - * the Interface Repository (IR). These base interfaces are not instantiable. - * A common set of operations is used to locate objects within the - * Interface Repository. Some of these operations are defined in - * the IRObject. All IR objects inherit from the IRObject interface, - * which provides an operation for identifying the actual type of - * the object. (The IDL base interface IRObject represents the most - * generic interface from which all other Interface Repository interfaces - * are derived, even the Repository itself.) All java implementations of - * IR objects must implement the IRObjectOperations interface. - * @see IDLTypeOperations - * @see IDLType - * @see IRObject - */ -public interface IRObjectOperations -{ - - // read interface - /** - * Returns the {@code DefinitionKind} corresponding to this Interface Repository object. - * @return the {@code DefinitionKind} corresponding to this Interface Repository object. - */ - org.omg.CORBA.DefinitionKind def_kind (); - - // write interface - /** - * Destroys this object. If the object is a Container, - * this method is applied to all its contents. If the object contains an IDLType - * attribute for an anonymous type, that IDLType is destroyed. - * If the object is currently contained in some other object, it is removed. - * If the method is invoked on a {@code Repository} or on a {@code PrimitiveDef} - * then the {@code BAD_INV_ORDER} exception is raised with minor value 2. - * An attempt to destroy an object that would leave the repository in an - * incoherent state causes {@code BAD_INV_ORDER} exception to be raised - * with the minor code 1. - * @exception BAD_INV_ORDER if this method is invoked on a repository or - * {@code PrimitiveDef}, or if an attempt to destroy an - * object would leave the repository in an incoherent state - */ - void destroy (); -} // interface IRObjectOperations --- old/src/java.corba/share/classes/org/omg/CORBA/IdentifierHelper.java 2018-01-30 20:27:22.000000000 -0500 +++ /dev/null 2018-01-30 20:27:22.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code Identifier}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/IdentifierHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ir.idl - * 03 June 1999 11:33:42 o'clock GMT+00:00 - */ - -abstract public class IdentifierHelper -{ - private static String _id = "IDL:omg.org/CORBA/Identifier:1.0"; - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.IdentifierHelper.id (), "Identifier", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/IntHolder.java 2018-01-30 20:27:23.000000000 -0500 +++ /dev/null 2018-01-30 20:27:23.000000000 -0500 @@ -1,112 +0,0 @@ -/* - * Copyright (c) 1997, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code Int}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for an {@code int} - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code long} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code IntHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myIntHolder} is an instance of {@code IntHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myIntHolder.value}. - * - * @since JDK1.2 - */ -public final class IntHolder implements Streamable { - - /** - * The {@code int} value held by this {@code IntHolder} - * object in its {@code value} field. - */ - public int value; - - /** - * Constructs a new {@code IntHolder} object with its - * {@code value} field initialized to {@code 0}. - */ - public IntHolder() { - } - - /** - * Constructs a new {@code IntHolder} object with its - * {@code value} field initialized to the given - * {@code int}. - * @param initial the {@code int} with which to initialize - * the {@code value} field of the newly-created - * {@code IntHolder} object - */ - public IntHolder(int initial) { - value = initial; - } - - /** - * Reads unmarshalled data from {@code input} and assigns it to - * the {@code value} field in this {@code IntHolder} object. - * - * @param input the {@code InputStream} object containing CDR - * formatted data from the wire - */ - public void _read(InputStream input) { - value = input.read_long(); - } - - /** - * Marshals the value in this {@code IntHolder} object's - * {@code value} field to the output stream {@code output}. - * - * @param output the {@code OutputStream} object that will contain - * the CDR formatted data - */ - public void _write(OutputStream output) { - output.write_long(value); - } - - /** - * Retrieves the {@code TypeCode} object that corresponds - * to the value held in this {@code IntHolder} object's - * {@code value} field. - * - * @return the type code for the value held in this {@code IntHolder} - * object - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_long); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java 2018-01-30 20:27:23.000000000 -0500 +++ /dev/null 2018-01-30 20:27:23.000000000 -0500 @@ -1,514 +0,0 @@ -/* - * Copyright (c) 2000, 2015, 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 org.omg.CORBA; -import org.omg.CORBA.portable.*; - - -/** - * Used as a base class for implementation of a local IDL interface in the - * Java language mapping. It is a class which implements all the operations - * in the {@code org.omg.CORBA.Object} interface. - *

Local interfaces are implemented by using CORBA::LocalObject - * to provide implementations of {@code Object} pseudo - * operations and any other ORB-specific support mechanisms that are - * appropriate for such objects. Object implementation techniques are - * inherently language-mapping specific. Therefore, the - * {@code LocalObject} type is not defined in IDL, but is specified - * in each language mapping. - *

Methods that do not apply to local objects throw - * an {@code org.omg.CORBA.NO_IMPLEMENT} exception with the message, - * "This is a locally contrained object." Attempting to use a - * {@code LocalObject} to create a DII request results in NO_IMPLEMENT - * system exception. Attempting to marshal or stringify a - * {@code LocalObject} results in a MARSHAL system exception. Narrowing - * and widening references to {@code LocalObjects} must work as for regular - * object references. - *

{@code LocalObject} is to be used as the base class of locally - * constrained objects, such as those in the PortableServer module. - * The specification here is based on the CORBA Components - * Volume I - orbos/99-07-01 - * - * @see CORBA package - * comments for unimplemented features - */ - -public class LocalObject implements org.omg.CORBA.Object -{ - private static String reason = "This is a locally constrained object."; - - /** - * Constructs a default {@code LocalObject} instance. - */ - public LocalObject() {} - - /** - * Determines whether the two object references are equivalent, - * so far as the ORB can easily determine. Two object references are equivalent - * if they are identical. Two distinct object references which in fact refer to - * the same object are also equivalent. However, ORBs are not required - * to attempt determination of whether two distinct object references - * refer to the same object, since such determination could be impractically - * expensive. - *

Default implementation of the org.omg.CORBA.Object method. - * - * @param that the object reference with which to check for equivalence - * @return {@code true} if this object reference is known to be - * equivalent to the given object reference. - * Note that {@code false} indicates only that the two - * object references are distinct, not necessarily that - * they reference distinct objects. - */ - public boolean _is_equivalent(org.omg.CORBA.Object that) { - return equals(that) ; - } - - /** - * Always returns {@code false}. - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @return {@code false} - */ - public boolean _non_existent() { - return false; - } - - /** - * Returns a hash value that is consistent for the - * lifetime of the object, using the given number as the maximum. - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @param maximum an {@code int} identifying maximum value of - * the hashcode - * @return this instance's hashcode - */ - public int _hash(int maximum) { - return hashCode() ; - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." This method - * does not apply to local objects and is therefore not implemented. - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @param repository_id a {@code String} - * @return NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @exception NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @see CORBA package - * comments for unimplemented features - */ - public boolean _is_a(String repository_id) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @return a duplicate of this {@code LocalObject} instance. - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public org.omg.CORBA.Object _duplicate() { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public void _release() { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @param operation a {@code String} giving the name of an operation - * to be performed by the request that is returned - * @return a {@code Request} object with the given operation - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public Request _request(String operation) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @param ctx a {@code Context} object containing - * a list of properties - * @param operation the {@code String} representing the name of the - * method to be invoked - * @param arg_list an {@code NVList} containing the actual arguments - * to the method being invoked - * @param result a {@code NamedValue} object to serve as a - * container for the method's return value - * @return a new {@code Request} object initialized with the given - * arguments - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public Request _create_request(Context ctx, - String operation, - NVList arg_list, - NamedValue result) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @param ctx a {@code Context} object containing - * a list of properties - * @param operation the name of the method to be invoked - * @param arg_list an {@code NVList} containing the actual arguments - * to the method being invoked - * @param result a {@code NamedValue} object to serve as a - * container for the method's return value - * @param exceptions an {@code ExceptionList} object containing a - * list of possible exceptions the method can throw - * @param contexts a {@code ContextList} object containing a list of - * context strings that need to be resolved and sent - * with the - * {@code Request} instance - * @return the new {@code Request} object initialized with the given - * arguments - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public Request _create_request(Context ctx, - String operation, - NVList arg_list, - NamedValue result, - ExceptionList exceptions, - ContextList contexts) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." This method - * does not apply to local objects and is therefore not implemented. - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @return NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @exception NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @see CORBA package - * comments for unimplemented features - */ - public org.omg.CORBA.Object _get_interface() - { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public org.omg.CORBA.Object _get_interface_def() - { - // First try to call the delegate implementation class's - // "Object get_interface_def(..)" method (will work for JDK1.2 - // ORBs). - // Else call the delegate implementation class's - // "InterfaceDef get_interface(..)" method using reflection - // (will work for pre-JDK1.2 ORBs). - - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * @return the ORB instance that created the Delegate contained in this - * {@code ObjectImpl} - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public org.omg.CORBA.ORB _orb() { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." This method - * does not apply to local objects and is therefore not implemented. - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @param policy_type an {@code int} - * @return NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @exception NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @see CORBA package - * comments for unimplemented features - */ - public org.omg.CORBA.Policy _get_policy(int policy_type) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." This method - * does not apply to local objects and is therefore not implemented. - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public org.omg.CORBA.DomainManager[] _get_domain_managers() { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." This method - * does not apply to local objects and is therefore not implemented. - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @param policies an array - * @param set_add a flag - * @return NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @exception NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @see CORBA package - * comments for unimplemented features - */ - public org.omg.CORBA.Object - _set_policy_override(org.omg.CORBA.Policy[] policies, - org.omg.CORBA.SetOverrideType set_add) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method.

- * Returns {@code true} for this {@code LocalObject} instance. - * - * @return {@code true} always - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public boolean _is_local() { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @param operation a {@code String} indicating which operation - * to preinvoke - * @param expectedType the class of the type of operation mentioned above - * @return NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @exception NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local object - * @see CORBA package - * comments for unimplemented features - */ - public ServantObject _servant_preinvoke(String operation, - Class expectedType) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @param servant the servant object on which to post-invoke - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public void _servant_postinvoke(ServantObject servant) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /* - * The following methods were added by orbos/98-04-03: Java to IDL - * Mapping. These are used by RMI over IIOP. - */ - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - *

Called by a stub to obtain an OutputStream for - * marshaling arguments. The stub must supply the operation name, - * and indicate if a response is expected (i.e is this a oneway call). - * - * @param operation the name of the operation being requested - * @param responseExpected {@code true} if a response is expected, - * {@code false} if it is a one-way call - * @return NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @exception NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @see CORBA package - * comments for unimplemented features - */ - public OutputStream _request(String operation, - boolean responseExpected) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - *

Called to invoke an operation. The stub provides an - * {@code OutputStream} that was previously returned by a - * {@code _request()} - * call. {@code _invoke} returns an {@code InputStream} which - * contains the - * marshaled reply. If an exception occurs, {@code _invoke} may throw an - * {@code ApplicationException} object which contains an - * {@code InputStream} from - * which the user exception state may be unmarshaled. - * - * @param output the {@code OutputStream} to invoke - * @return NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @throws ApplicationException If an exception occurs, - * {@code _invoke} may throw an - * {@code ApplicationException} object which contains - * an {@code InputStream} from - * which the user exception state may be unmarshaled. - * @throws RemarshalException If an exception occurs, - * {@code _invoke} may throw an - * {@code ApplicationException} object which contains - * an {@code InputStream} from - * which the user exception state may be unmarshaled. - * @exception NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @see CORBA package - * comments for unimplemented features - */ - public InputStream _invoke(OutputStream output) - throws ApplicationException, RemarshalException - { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - *

May optionally be called by a stub to release a - * reply stream back to the ORB when the unmarshaling has - * completed. The stub passes the {@code InputStream} returned by - * {@code _invoke()} or - * {@code ApplicationException.getInputStream()}. - * A null - * value may also be passed to {@code _releaseReply}, in which case the - * method is a no-op. - * - * @param input the reply stream back to the ORB or null - * @exception NO_IMPLEMENT - * @see CORBA package - * comments for unimplemented features - */ - public void _releaseReply(InputStream input) { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } - - /** - * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with - * the message "This is a locally constrained object." This method - * does not apply to local objects and is therefore not implemented. - * This method is the default implementation of the - * {@code org.omg.CORBA.Object} method. - * - * @return NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @exception NO_IMPLEMENT because this is a locally constrained object - * and this method does not apply to local objects - * @see CORBA package - * comments for unimplemented features - */ - - public boolean validate_connection() { - throw new org.omg.CORBA.NO_IMPLEMENT(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/LongHolder.java 2018-01-30 20:27:24.000000000 -0500 +++ /dev/null 2018-01-30 20:27:24.000000000 -0500 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1995, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code Long}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code long} - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code long long} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code LongHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myLongHolder} is an instance of {@code LongHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myLongHolder.value}. - * - * @since JDK1.2 - */ -public final class LongHolder implements Streamable { - - /** - * The {@code long} value held by this {@code LongHolder} - * object. - */ - public long value; - - /** - * Constructs a new {@code LongHolder} object with its - * {@code value} field initialized to {@code 0}. - */ - public LongHolder() { - } - - /** - * Constructs a new {@code LongHolder} object with its - * {@code value} field initialized to the given - * {@code long}. - * @param initial the {@code long} with which to initialize - * the {@code value} field of the newly-created - * {@code LongHolder} object - */ - public LongHolder(long initial) { - value = initial; - } - - /** - * Reads from {@code input} and initalizes the value in the Holder - * with the unmarshalled data. - * - * @param input the InputStream containing CDR formatted data from the wire - */ - public void _read(InputStream input) { - value = input.read_longlong(); - } - - /** - * Marshals to {@code output} the value in the Holder. - * - * @param output the OutputStream which will contain the CDR formatted data - */ - public void _write(OutputStream output) { - output.write_longlong(value); - } - - /** - * Returns the {@code TypeCode} object - * corresponding to the value held in the Holder. - * - * @return the TypeCode of the value held in the holder - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_longlong); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHelper.java 2018-01-30 20:27:25.000000000 -0500 +++ /dev/null 2018-01-30 20:27:25.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code LongLongSeq}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/LongLongSeqHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:37 o'clock GMT+00:00 - * - * The class definition has been modified to conform to the following - * OMG specifications : - *

    - *
  • ORB core as defined by CORBA 2.3.1 - * (formal/99-10-07) - *
  • - * - *
  • IDL/Java Language Mapping as defined in - * ptc/00-01-08 - *
  • - *
- */ - -public abstract class LongLongSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/LongLongSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, long[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static long[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.LongLongSeqHelper.id (), "LongLongSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static long[] read (org.omg.CORBA.portable.InputStream istream) - { - long value[] = null; - int _len0 = istream.read_long (); - value = new long[_len0]; - istream.read_longlong_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, long[] value) - { - ostream.write_long (value.length); - ostream.write_longlong_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHolder.java 2018-01-30 20:27:26.000000000 -0500 +++ /dev/null 2018-01-30 20:27:26.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Holder for {@code LongLongSeq}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/LongLongSeqHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - */ - -public final class LongLongSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public long value[] = null; - - public LongLongSeqHolder () - { - } - - public LongLongSeqHolder (long[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.LongLongSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.LongLongSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.LongLongSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/LongSeqHelper.java 2018-01-30 20:27:26.000000000 -0500 +++ /dev/null 2018-01-30 20:27:26.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code LongSeqHelper}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/LongSeqHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - * - * The class definition has been modified to conform to the following - * OMG specifications : - *

    - *
  • ORB core as defined by CORBA 2.3.1 - * (formal/99-10-07) - *
  • - * - *
  • IDL/Java Language Mapping as defined in - * ptc/00-01-08 - *
  • - *
- */ - -public abstract class LongSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/LongSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, int[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static int[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_long); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.LongSeqHelper.id (), "LongSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static int[] read (org.omg.CORBA.portable.InputStream istream) - { - int value[] = null; - int _len0 = istream.read_long (); - value = new int[_len0]; - istream.read_long_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, int[] value) - { - ostream.write_long (value.length); - ostream.write_long_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/LongSeqHolder.java 2018-01-30 20:27:27.000000000 -0500 +++ /dev/null 2018-01-30 20:27:27.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Holder for {@code LongSeq}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/LongSeqHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - */ - -public final class LongSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public int value[] = null; - - public LongSeqHolder () - { - } - - public LongSeqHolder (int[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.LongSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.LongSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.LongSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java 2018-01-30 20:27:28.000000000 -0500 +++ /dev/null 2018-01-30 20:27:28.000000000 -0500 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * A request or reply from the network is structurally invalid. - * This error typically indicates a bug in either the client-side - * or server-side run time. For example, if a reply from the server - * indicates that the message contains 1000 bytes, but the actual - * message is shorter or longer than 1000 bytes, the ORB raises - * this exception. {@code MARSHAL} can also be caused by using - * the DII or DSI incorrectly, for example, if the type of the - * actual parameters sent does not agree with IDL signature of an - * operation.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - *

- * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} - * to see the minor codes for this exception. - * - * @since JDK1.2 - */ - -public final class MARSHAL extends SystemException { - /** - * Constructs a {@code MARSHAL} exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public MARSHAL() { - this(""); - } - - /** - * Constructs a {@code MARSHAL} exception with the specified description message, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a description of the exception - */ - public MARSHAL(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a {@code MARSHAL} exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public MARSHAL(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a {@code MARSHAL} exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public MARSHAL(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java 2018-01-30 20:27:28.000000000 -0500 +++ /dev/null 2018-01-30 20:27:28.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1995, 2006, 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 org.omg.CORBA; - -/** - * This exception indicates that even though the operation that - * was invoked exists (it has an IDL definition), no implementation - * for that operation exists. {@code NO_IMPLEMENT} can, for - * example, be raised by an ORB if a client asks for an object's - * type definition from the interface repository, but no interface - * repository is provided by the ORB.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - *

- * See the section {extLink jidlexception_minorcodes Minor Code Meanings} - * to see the minor codes for this exception. - * - * @since JDK1.2 - */ - -public final class NO_IMPLEMENT extends SystemException { - /** - * Constructs a {@code NO_IMPLEMENT} exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public NO_IMPLEMENT() { - this(""); - } - - /** - * Constructs a {@code NO_IMPLEMENT} exception with the specified description message, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a description of the exception - */ - public NO_IMPLEMENT(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a {@code NO_IMPLEMENT} exception with the specified - * minor code and completion status. - * @param minor an {@code int} specifying the minor code - * @param completed a {@code CompletionStatus} instance indicating - * the completion status - */ - public NO_IMPLEMENT(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a {@code NO_IMPLEMENT} exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor an {@code int} specifying the minor code - * @param completed a {@code CompletionStatus} instance indicating - * the completion status - */ - public NO_IMPLEMENT(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/NO_MEMORY.java 2018-01-30 20:27:29.000000000 -0500 +++ /dev/null 2018-01-30 20:27:29.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown when the ORB run time has run out of memory. - *

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class NO_MEMORY extends SystemException { - /** - * Constructs a NO_MEMORY exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public NO_MEMORY() { - this(""); - } - - /** - * Constructs a NO_MEMORY exception with the specified description message, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a description message - */ - public NO_MEMORY(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a NO_MEMORY exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public NO_MEMORY(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a NO_MEMORY exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public NO_MEMORY(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/NO_PERMISSION.java 2018-01-30 20:27:30.000000000 -0500 +++ /dev/null 2018-01-30 20:27:30.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown when an invocation failed because the caller - * has insufficient privileges.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class NO_PERMISSION extends SystemException { - /** - * Constructs a NO_PERMISSION exception with a default minor code - * of 0 and a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public NO_PERMISSION() { - this(""); - } - - /** - * Constructs a NO_PERMISSION exception with the specified description, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a description message - */ - public NO_PERMISSION(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a NO_PERMISSION exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public NO_PERMISSION(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a NO_PERMISSION exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public NO_PERMISSION(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/NO_RESOURCES.java 2018-01-30 20:27:30.000000000 -0500 +++ /dev/null 2018-01-30 20:27:30.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown when the ORB has encountered some general resource - * limitation. For example, the run time may have reached the maximum - * permissible number of open connections.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class NO_RESOURCES extends SystemException { - /** - * Constructs a NO_RESOURCES exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public NO_RESOURCES() { - this(""); - } - - /** - * Constructs a NO_RESOURCES exception with the specified description, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a description message - */ - public NO_RESOURCES(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a NO_RESOURCES exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public NO_RESOURCES(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a NO_RESOURCES exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public NO_RESOURCES(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/NO_RESPONSE.java 2018-01-30 20:27:31.000000000 -0500 +++ /dev/null 2018-01-30 20:27:31.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception is raised if a client attempts to retrieve the result - * of a deferred synchronous call, but the response for the request is - * not yet available.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class NO_RESPONSE extends SystemException { - /** - * Constructs a NO_RESPONSE exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public NO_RESPONSE() { - this(""); - } - - /** - * Constructs a NO_RESPONSE exception with the specified description message, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a description message - */ - public NO_RESPONSE(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a NO_RESPONSE exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public NO_RESPONSE(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a NO_RESPONSE exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public NO_RESPONSE(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/NVList.java 2018-01-30 20:27:32.000000000 -0500 +++ /dev/null 2018-01-30 20:27:32.000000000 -0500 @@ -1,177 +0,0 @@ -/* - * Copyright (c) 1996, 2015, 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 org.omg.CORBA; - -/** - * A modifiable list containing NamedValue objects. - *

- * The class NVList is used as follows: - *

    - *
  • to describe arguments for a Request object - * in the Dynamic Invocation Interface and - * the Dynamic Skeleton Interface - *
  • to describe context values in a Context object - *
- *

- * Each NamedValue object consists of the following: - *

    - *
  • a name, which is a String object - *
  • a value, as an Any object - *
  • an argument mode flag - *
- *

- * An NVList object - * may be created using one of the following - * ORB methods: - *

    - *
  1. org.omg.CORBA.ORB.create_list - *
    - *    org.omg.CORBA.NVList nv = orb.create_list(3);
    - * 
    - * The variable nv represents a newly-created - * NVList object. The argument is a memory-management - * hint to the orb and does not imply the actual length of the list. - * If, for example, you want to use an NVList object - * in a request, and the method being invoked takes three parameters, - * you might optimize by supplying 3 to the method - * create_list. Note that the new NVList - * will not necessarily have a length of 3; it - * could have a length of 2 or 4, for instance. - * Note also that you can add any number of - * NamedValue objects to this list regardless of - * its original length. - *
  2. org.omg.CORBA.ORB.create_operation_list - *
    - *    org.omg.CORBA.NVList nv = orb.create_operation_list(myOperationDef);
    - * 
    - * The variable nv represents a newly-created - * NVList object that contains descriptions of the - * arguments to the method described in the given - * OperationDef object. - *
- *

- * The methods in the class NVList all deal with - * the NamedValue objects in the list. - * There are three methods for adding a NamedValue object, - * a method for getting the count of NamedValue objects in - * the list, a method for retrieving a NamedValue object - * at a given index, and a method for removing a NamedValue object - * at a given index. - * - * @see org.omg.CORBA.Request - * @see org.omg.CORBA.ServerRequest - * @see org.omg.CORBA.NamedValue - * @see org.omg.CORBA.Context - * - * @since JDK1.2 - */ - -public abstract class NVList { - - /** - * Returns the number of NamedValue objects that have - * been added to this NVList object. - * - * @return an int indicating the number of - * NamedValue objects in this NVList. - */ - - public abstract int count(); - - /** - * Creates a new NamedValue object initialized with the given flag - * and adds it to the end of this NVList object. - * The flag can be any one of the argument passing modes: - * ARG_IN.value, ARG_OUT.value, or - * ARG_INOUT.value. - * - * @param flags one of the argument mode flags - * @return the newly-created NamedValue object - */ - - public abstract NamedValue add(int flags); - - /** - * Creates a new NamedValue object initialized with the - * given name and flag, - * and adds it to the end of this NVList object. - * The flag can be any one of the argument passing modes: - * ARG_IN.value, ARG_OUT.value, or - * ARG_INOUT.value. - * - * @param item_name the name for the new NamedValue object - * @param flags one of the argument mode flags - * @return the newly-created NamedValue object - */ - - public abstract NamedValue add_item(String item_name, int flags); - - /** - * Creates a new NamedValue object initialized with the - * given name, value, and flag, - * and adds it to the end of this NVList object. - * - * @param item_name the name for the new NamedValue object - * @param val an Any object containing the value - * for the new NamedValue object - * @param flags one of the following argument passing modes: - * ARG_IN.value, ARG_OUT.value, or - * ARG_INOUT.value - * @return the newly created NamedValue object - */ - - public abstract NamedValue add_value(String item_name, Any val, int flags); - - /** - * Retrieves the NamedValue object at the given index. - * - * @param index the index of the desired NamedValue object, - * which must be between zero and the length of the list - * minus one, inclusive. The first item is at index zero. - * @return the NamedValue object at the given index - * @exception org.omg.CORBA.Bounds if the index is greater than - * or equal to number of NamedValue objects - */ - - public abstract NamedValue item(int index) throws org.omg.CORBA.Bounds; - - /** - * Removes the NamedValue object at the given index. - * Note that the indices of all NamedValue objects following - * the one removed are shifted down by one. - * - * @param index the index of the NamedValue object to be - * removed, which must be between zero and the length - * of the list minus one, inclusive. - * The first item is at index zero. - * @exception org.omg.CORBA.Bounds if the index is greater than - * or equal to number of NamedValue objects in - * the list - */ - - public abstract void remove(int index) throws org.omg.CORBA.Bounds; - -} --- old/src/java.corba/share/classes/org/omg/CORBA/NameValuePair.java 2018-01-30 20:27:33.000000000 -0500 +++ /dev/null 2018-01-30 20:27:33.000000000 -0500 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - -/** - * Associates a name with a value that is an - * attribute of an IDL struct, and is used in the {@code DynStruct} APIs. - */ - -public final class NameValuePair implements org.omg.CORBA.portable.IDLEntity { - - /** - * The name to be associated with a value by this {@code NameValuePair} object. - */ - public String id; - - /** - * The value to be associated with a name by this {@code NameValuePair} object. - */ - public org.omg.CORBA.Any value; - - /** - * Constructs an empty {@code NameValuePair} object. - * To associate a name with a value after using this constructor, the fields - * of this object have to be accessed individually. - */ - public NameValuePair() { } - - /** - * Constructs a {@code NameValuePair} object that associates - * the given name with the given {@code org.omg.CORBA.Any} object. - * @param __id the name to be associated with the given {@code Any} object - * @param __value the {@code Any} object to be associated with the given name - */ - public NameValuePair(String __id, org.omg.CORBA.Any __value) { - id = __id; - value = __value; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/NameValuePairHelper.java 2018-01-30 20:27:33.000000000 -0500 +++ /dev/null 2018-01-30 20:27:33.000000000 -0500 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code NameValuePair}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/NameValuePairHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * 03 June 1999 11:52:03 o'clock GMT+00:00 - */ - -abstract public class NameValuePairHelper -{ - private static String _id = "IDL:omg.org/CORBA/NameValuePair:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.NameValuePair that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.NameValuePair extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [2]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.FieldNameHelper.id (), "FieldName", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any); - _members0[1] = new org.omg.CORBA.StructMember ( - "value", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.CORBA.NameValuePairHelper.id (), "NameValuePair", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.NameValuePair read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.NameValuePair value = new org.omg.CORBA.NameValuePair (); - value.id = istream.read_string (); - value.value = istream.read_any (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.NameValuePair value) - { - ostream.write_string (value.id); - ostream.write_any (value.value); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/NamedValue.java 2018-01-30 20:27:34.000000000 -0500 +++ /dev/null 2018-01-30 20:27:34.000000000 -0500 @@ -1,125 +0,0 @@ -/* - * Copyright (c) 1996, 1999, 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 org.omg.CORBA; - -/** - * An object used in the DII and DSI to describe - * arguments and return values. NamedValue objects - * are also used in the Context - * object routines to pass lists of property names and values. - *

- * A NamedValue object contains: - *

    - *
  • a name -- If the NamedValue object is used to - * describe arguments to a request, the name will be an argument - * identifier specified in the OMG IDL interface definition - * for the operation being described. - *
  • a value -- an Any object - *
  • an argument mode flag -- one of the following: - *
      - *
    • ARG_IN.value - *
    • ARG_OUT.value - *
    • ARG_INOUT.value - *
    • zero -- if this NamedValue object represents a property - * in a Context object rather than a parameter or - * return value - *
    - *
- *

- * The class NamedValue has three methods, which - * access its fields. The following code fragment demonstrates - * creating a NamedValue object and then accessing - * its fields: - *

- *    ORB orb = ORB.init(args, null);
- *    String s = "argument_1";
- *    org.omg.CORBA.Any myAny = orb.create_any();
- *    myAny.insert_long(12345);
- *    int in = org.omg.CORBA.ARG_IN.value;
-
- *    org.omg.CORBA.NamedValue nv = orb.create_named_value(
- *        s, myAny, in);
- *    System.out.println("This nv name is " + nv.name());
- *    try {
- *        System.out.println("This nv value is " + nv.value().extract_long());
- *        System.out.println("This nv flag is " + nv.flags());
- *    } catch (org.omg.CORBA.BAD_OPERATION b) {
- *      System.out.println("extract failed");
- *    }
- * 
- * - *

- * If this code fragment were put into a main method, - * the output would be something like the following: - *

- *    This nv name is argument_1
- *    This nv value is 12345
- *    This nv flag is 1
- * 
- *

- * Note that the method value returns an Any - * object. In order to access the long contained in the - * Any object, - * we used the method extract_long. - * - * @see Any - * @see ARG_IN - * @see ARG_INOUT - * @see ARG_OUT - * - * @since JDK1.2 - */ - -public abstract class NamedValue { - - /** - * Retrieves the name for this NamedValue object. - * - * @return a String object representing - * the name of this NamedValue object - */ - - public abstract String name(); - - /** - * Retrieves the value for this NamedValue object. - * - * @return an Any object containing - * the value of this NamedValue object - */ - - public abstract Any value(); - - /** - * Retrieves the argument mode flag for this NamedValue object. - * - * @return an int representing the argument - * mode for this NamedValue object - */ - - public abstract int flags(); - -} --- old/src/java.corba/share/classes/org/omg/CORBA/OBJECT_NOT_EXIST.java 2018-01-30 20:27:35.000000000 -0500 +++ /dev/null 2018-01-30 20:27:35.000000000 -0500 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception raised whenever an invocation on a deleted object was - * performed. It is an authoritative "hard" fault report. Anyone - * receiving it is allowed (even expected) to delete all copies of - * this object reference and to perform other appropriate "final - * recovery" style procedures. Bridges forward this exception to - * clients, also destroying any records they may hold (for example, - * proxy objects used in reference translation). The clients could - * in turn purge any of their own data structures. - *

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - *

- * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} - * to see the minor codes for this exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class OBJECT_NOT_EXIST extends SystemException { - /** - * Constructs an OBJECT_NOT_EXIST exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public OBJECT_NOT_EXIST() { - this(""); - } - - /** - * Constructs an OBJECT_NOT_EXIST exception with the specified description, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a description message - */ - public OBJECT_NOT_EXIST(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an OBJECT_NOT_EXIST exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public OBJECT_NOT_EXIST(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an OBJECT_NOT_EXIST exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public OBJECT_NOT_EXIST(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/OBJ_ADAPTER.java 2018-01-30 20:27:35.000000000 -0500 +++ /dev/null 2018-01-30 20:27:35.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception typically indicates an administrative mismatch, for - * example, a server may have made an attempt to register itself with - * an implementation repository under a name that is already in use, - * or is unknown to the repository.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - *

- * See the section {@extLink jidlexception_minorcodes Minor Code Meanings} - * to see the minor codes for this exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since JDK1.2 - */ - -public final class OBJ_ADAPTER extends SystemException { - /** - * Constructs an OBJ_ADAPTER exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public OBJ_ADAPTER() { - this(""); - } - - /** - * Constructs an OBJ_ADAPTER exception with the specified description, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a description message - */ - public OBJ_ADAPTER(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an OBJ_ADAPTER exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public OBJ_ADAPTER(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an OBJ_ADAPTER exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public OBJ_ADAPTER(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/OMGVMCID.java 2018-01-30 20:27:36.000000000 -0500 +++ /dev/null 2018-01-30 20:27:36.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 1999, 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 org.omg.CORBA; - -/** - * The vendor minor code ID reserved for OMG. Minor codes for the standard - * exceptions are prefaced by the VMCID assigned to OMG, defined as the - * constant OMGVMCID, which, like all VMCIDs, occupies the high order 20 bits. - */ - -public interface OMGVMCID { - - /** - * The vendor minor code ID reserved for OMG. This value is or'd with - * the high order 20 bits of the minor code to produce the minor value - * in a system exception. - */ - static final int value = 0x4f4d0000; -} --- old/src/java.corba/share/classes/org/omg/CORBA/ORB.java 2018-01-30 20:27:37.000000000 -0500 +++ /dev/null 2018-01-30 20:27:37.000000000 -0500 @@ -1,1406 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.*; -import org.omg.CORBA.ORBPackage.InvalidName; - -import java.util.Properties; -import java.applet.Applet; -import java.io.File; -import java.io.FileInputStream; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -/** - * A class providing APIs for the CORBA Object Request Broker - * features. The {@code ORB} class also provides - * "pluggable ORB implementation" APIs that allow another vendor's ORB - * implementation to be used. - *

- * An ORB makes it possible for CORBA objects to communicate - * with each other by connecting objects making requests (clients) with - * objects servicing requests (servers). - *

- * - * The {@code ORB} class, which - * encapsulates generic CORBA functionality, does the following: - * (Note that items 5 and 6, which include most of the methods in - * the class {@code ORB}, are typically used with the - * {@code Dynamic Invocation Interface} (DII) and - * the {@code Dynamic Skeleton Interface} (DSI). - * These interfaces may be used by a developer directly, but - * most commonly they are used by the ORB internally and are - * not seen by the general programmer.) - *

    - *
  1. initializes the ORB implementation by supplying values for - * predefined properties and environmental parameters - *
  2. obtains initial object references to services such as - * the NameService using the method {@code resolve_initial_references} - *
  3. converts object references to strings and back - *
  4. connects the ORB to a servant (an instance of a CORBA object - * implementation) and disconnects the ORB from a servant - *
  5. creates objects such as - *
      - *
    • {@code TypeCode} - *
    • {@code Any} - *
    • {@code NamedValue} - *
    • {@code Context} - *
    • {@code Environment} - *
    • lists (such as {@code NVList}) containing these objects - *
    - *
  6. sends multiple messages in the DII - *
- * - *

- * The {@code ORB} class can be used to obtain references to objects - * implemented anywhere on the network. - *

- * An application or applet gains access to the CORBA environment - * by initializing itself into an {@code ORB} using one of - * three {@code init} methods. Two of the three methods use the properties - * (associations of a name with a value) shown in the - * table below.
- * - * - * - * - * - * - * - * - * - * - * - *
Standard Java CORBA Properties
Property Name Property Value
org.omg.CORBA.ORBClassclass name of an ORB implementation
org.omg.CORBA.ORBSingletonClassclass name of the ORB returned by {@code init()}
- *

- * These properties allow a different vendor's {@code ORB} - * implementation to be "plugged in." - *

- * When an ORB instance is being created, the class name of the ORB - * implementation is located using - * the following standard search order: - * - *

    - *
  1. check in Applet parameter or application string array, if any - * - *
  2. check in properties parameter, if any - * - *
  3. check in the System properties, if any - * - *
  4. check in the orb.properties file located in the user.home - * directory, if any - * - *
  5. check in the orb.properties file located in the run-time image, - * if any - * - *
  6. fall back on a hardcoded default behavior (use the Java IDL - * implementation) - *
- *

- * Note that Java IDL provides a default implementation for the - * fully-functional ORB and for the Singleton ORB. When the method - * {@code init} is given no parameters, the default Singleton - * ORB is returned. When the method {@code init} is given parameters - * but no ORB class is specified, the Java IDL ORB implementation - * is returned. - *

- * The following code fragment creates an {@code ORB} object - * initialized with the default ORB Singleton. - * This ORB has a - * restricted implementation to prevent malicious applets from doing - * anything beyond creating typecodes. - * It is called a singleton - * because there is only one instance for an entire virtual machine. - *

- *    ORB orb = ORB.init();
- * 
- *

- * The following code fragment creates an {@code ORB} object - * for an application. The parameter {@code args} - * represents the arguments supplied to the application's {@code main} - * method. Since the property specifies the ORB class to be - * "SomeORBImplementation", the new ORB will be initialized with - * that ORB implementation. If p had been null, - * and the arguments had not specified an ORB class, - * the new ORB would have been - * initialized with the default Java IDL implementation. - *

- *    Properties p = new Properties();
- *    p.put("org.omg.CORBA.ORBClass", "SomeORBImplementation");
- *    ORB orb = ORB.init(args, p);
- * 
- *

- * The following code fragment creates an {@code ORB} object - * for the applet supplied as the first parameter. If the given - * applet does not specify an ORB class, the new ORB will be - * initialized with the default Java IDL implementation. - *

- *    ORB orb = ORB.init(myApplet, null);
- * 
- *

- * An application or applet can be initialized in one or more ORBs. - * ORB initialization is a bootstrap call into the CORBA world. - * - * - * @implNote - * When a singleton ORB is configured via the system property, - * or orb.properties, it will be - * located, and loaded via the system class loader. - * Thus, where appropriate, it is necessary that - * the classes for this alternative ORBSingleton are available on the application's class path. - * It should be noted that the singleton ORB is system wide. - *

- * When a per-application ORB is created via the 2-arg init methods, - * then it will be located using the thread context class loader. - *

- * The IDL to Java Language OMG specification documents the ${java.home}/lib directory as the location, - * in the Java run-time image, to search for orb.properties. - * This location is not intended for user editable configuration files. - * Therefore, the implementation first checks the ${java.home}/conf directory for orb.properties, - * and thereafter the ${java.home}/lib directory. - * - *

See also {@extLink idl_guides IDL developer's guide}.

- * - * @since JDK1.2 - */ -abstract public class ORB { - - // - // This is the ORB implementation used when nothing else is specified. - // Whoever provides this class customizes this string to - // point at their ORB implementation. - // - private static final String ORBClassKey = "org.omg.CORBA.ORBClass"; - private static final String ORBSingletonClassKey = "org.omg.CORBA.ORBSingletonClass"; - - // check that access to the class is not restricted by the security manager. - private static void checkPackageAccess(String name) { - SecurityManager s = System.getSecurityManager(); - if (s != null) { - String cname = name.replace('/', '.'); - if (cname.startsWith("[")) { - int b = cname.lastIndexOf('[') + 2; - if (b > 1 && b < cname.length()) { - cname = cname.substring(b); - } - } - int i = cname.lastIndexOf('.'); - if (i != -1) { - s.checkPackageAccess(cname.substring(0, i)); - } - } - } - - // - // The global instance of the singleton ORB implementation which - // acts as a factory for typecodes for generated Helper classes. - // TypeCodes should be immutable since they may be shared across - // different security contexts (applets). There should be no way to - // use a TypeCode as a storage depot for illicitly passing - // information or Java objects between different security contexts. - // - static private ORB singleton; - - // Get System property - private static String getSystemProperty(final String name) { - - // This will not throw a SecurityException because this - // class was loaded from rt.jar using the bootstrap classloader. - String propValue = (String) AccessController.doPrivileged( - new PrivilegedAction() { - public java.lang.Object run() { - return System.getProperty(name); - } - } - ); - - return propValue; - } - - // Get property from orb.properties in either or /lib - // directories. - private static String getPropertyFromFile(final String name) { - // This will not throw a SecurityException because this - // class was loaded from rt.jar using the bootstrap classloader. - - String propValue = (String) AccessController.doPrivileged( - new PrivilegedAction() { - private Properties getFileProperties( String fileName ) { - try { - File propFile = new File( fileName ) ; - if (!propFile.exists()) - return null ; - - Properties props = new Properties() ; - FileInputStream fis = new FileInputStream(propFile); - try { - props.load( fis ); - } finally { - fis.close() ; - } - - return props ; - } catch (Exception exc) { - return null ; - } - } - - public java.lang.Object run() { - String userHome = System.getProperty("user.home"); - String fileName = userHome + File.separator + - "orb.properties" ; - Properties props = getFileProperties( fileName ) ; - - if (props != null) { - String value = props.getProperty( name ) ; - if (value != null) - return value ; - } - - String javaHome = System.getProperty("java.home"); - - fileName = javaHome + File.separator + "conf" - + File.separator + "orb.properties"; - props = getFileProperties(fileName); - - if (props != null) { - String value = props.getProperty(name); - if (value != null) - return value; - } - - fileName = javaHome + File.separator + "lib" - + File.separator + "orb.properties"; - props = getFileProperties(fileName); - - if (props == null) - return null; - else - return props.getProperty(name); - } - } - ); - - return propValue; - } - - /** - * Returns the {@code ORB} singleton object. This method always returns the - * same ORB instance, which is an instance of the class described by the - * {@code org.omg.CORBA.ORBSingletonClass} system property. - *

- * This no-argument version of the method {@code init} is used primarily - * as a factory for {@code TypeCode} objects, which are used by - * {@code Helper} classes to implement the method {@code type}. - * It is also used to create {@code Any} objects that are used to - * describe {@code union} labels (as part of creating a - * {@code TypeCode} object for a {@code union}). - *

- * This method is not intended to be used by applets, and in the event - * that it is called in an applet environment, the ORB it returns - * is restricted so that it can be used only as a factory for - * {@code TypeCode} objects. Any {@code TypeCode} objects - * it produces can be safely shared among untrusted applets. - *

- * If an ORB is created using this method from an applet, - * a system exception will be thrown if - * methods other than those for - * creating {@code TypeCode} objects are invoked. - * - * @return the singleton ORB - * - * @implNote - * When configured via the system property, or orb.properties, - * the system-wide singleton ORB is located via the - * system class loader. - */ - public static synchronized ORB init() { - if (singleton == null) { - String className = getSystemProperty(ORBSingletonClassKey); - if (className == null) - className = getPropertyFromFile(ORBSingletonClassKey); - if ((className == null) || - (className.equals("com.sun.corba.se.impl.orb.ORBSingleton"))) { - singleton = new com.sun.corba.se.impl.orb.ORBSingleton(); - } else { - singleton = create_impl_with_systemclassloader(className); - } - } - return singleton; - } - - private static ORB create_impl_with_systemclassloader(String className) { - - try { - checkPackageAccess(className); - ClassLoader cl = ClassLoader.getSystemClassLoader(); - Class orbBaseClass = org.omg.CORBA.ORB.class; - Class singletonOrbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass); - return (ORB)singletonOrbClass.newInstance(); - } catch (Throwable ex) { - SystemException systemException = new INITIALIZE( - "can't instantiate default ORB implementation " + className); - systemException.initCause(ex); - throw systemException; - } - } - - private static ORB create_impl(String className) { - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if (cl == null) - cl = ClassLoader.getSystemClassLoader(); - - try { - checkPackageAccess(className); - Class orbBaseClass = org.omg.CORBA.ORB.class; - Class orbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass); - return (ORB)orbClass.newInstance(); - } catch (Throwable ex) { - SystemException systemException = new INITIALIZE( - "can't instantiate default ORB implementation " + className); - systemException.initCause(ex); - throw systemException; - } - } - - /** - * Creates a new {@code ORB} instance for a standalone - * application. This method may be called from applications - * only and returns a new fully functional {@code ORB} object - * each time it is called. - * @param args command-line arguments for the application's {@code main} - * method; may be {@code null} - * @param props application-specific properties; may be {@code null} - * @return the newly-created ORB instance - * - * @implNote - * When configured via the system property, or orb.properties, - * the ORB is located via the thread context class loader. - */ - public static ORB init(String[] args, Properties props) { - // - // Note that there is no standard command-line argument for - // specifying the default ORB implementation. For an - // application you can choose an implementation either by - // setting the CLASSPATH to pick a different org.omg.CORBA - // and it's baked-in ORB implementation default or by - // setting an entry in the properties object or in the - // system properties. - // - String className = null; - ORB orb; - - if (props != null) - className = props.getProperty(ORBClassKey); - if (className == null) - className = getSystemProperty(ORBClassKey); - if (className == null) - className = getPropertyFromFile(ORBClassKey); - if ((className == null) || - (className.equals("com.sun.corba.se.impl.orb.ORBImpl"))) { - orb = new com.sun.corba.se.impl.orb.ORBImpl(); - } else { - orb = create_impl(className); - } - orb.set_parameters(args, props); - return orb; - } - - - /** - * Creates a new {@code ORB} instance for an applet. This - * method may be called from applets only and returns a new - * fully-functional {@code ORB} object each time it is called. - * @param app the applet; may be {@code null} - * @param props applet-specific properties; may be {@code null} - * @return the newly-created ORB instance - * - * @implNote - * When configured via the system property, or orb.properties, - * the ORB is located via the thread context class loader. - */ - public static ORB init(Applet app, Properties props) { - String className; - ORB orb; - - className = app.getParameter(ORBClassKey); - if (className == null && props != null) - className = props.getProperty(ORBClassKey); - if (className == null) - className = getSystemProperty(ORBClassKey); - if (className == null) - className = getPropertyFromFile(ORBClassKey); - if ((className == null) || - (className.equals("com.sun.corba.se.impl.orb.ORBImpl"))) { - orb = new com.sun.corba.se.impl.orb.ORBImpl(); - } else { - orb = create_impl(className); - } - orb.set_parameters(app, props); - return orb; - } - - /** - * Allows the ORB implementation to be initialized with the given - * parameters and properties. This method, used in applications only, - * is implemented by subclass ORB implementations and called - * by the appropriate {@code init} method to pass in its parameters. - * - * @param args command-line arguments for the application's {@code main} - * method; may be {@code null} - * @param props application-specific properties; may be {@code null} - */ - abstract protected void set_parameters(String[] args, Properties props); - - /** - * Allows the ORB implementation to be initialized with the given - * applet and parameters. This method, used in applets only, - * is implemented by subclass ORB implementations and called - * by the appropriate {@code init} method to pass in its parameters. - * - * @param app the applet; may be {@code null} - * @param props applet-specific properties; may be {@code null} - */ - abstract protected void set_parameters(Applet app, Properties props); - - /** - * Connects the given servant object (a Java object that is - * an instance of the server implementation class) - * to the ORB. The servant class must - * extend the {@code ImplBase} class corresponding to the interface that is - * supported by the server. The servant must thus be a CORBA object - * reference, and inherit from {@code org.omg.CORBA.Object}. - * Servants created by the user can start receiving remote invocations - * after the method {@code connect} has been called. A servant may also be - * automatically and implicitly connected to the ORB if it is passed as - * an IDL parameter in an IDL method invocation on a non-local object, - * that is, if the servant object has to be marshalled and sent outside of the - * process address space. - *

- * Calling the method {@code connect} has no effect - * when the servant object is already connected to the ORB. - *

- * Deprecated by the OMG in favor of the Portable Object Adapter APIs. - * - * @param obj The servant object reference - */ - public void connect(org.omg.CORBA.Object obj) { - throw new NO_IMPLEMENT(); - } - - /** - * Destroys the ORB so that its resources can be reclaimed. - * Any operation invoked on a destroyed ORB reference will throw the - * {@code OBJECT_NOT_EXIST} exception. - * Once an ORB has been destroyed, another call to {@code init} - * with the same ORBid will return a reference to a newly constructed ORB.

- * If {@code destroy} is called on an ORB that has not been shut down, - * it will start the shut down process and block until the ORB has shut down - * before it destroys the ORB.
- * If an application calls {@code destroy} in a thread that is currently servicing - * an invocation, the {@code BAD_INV_ORDER} system exception will be thrown - * with the OMG minor code 3, since blocking would result in a deadlock.

- * For maximum portability and to avoid resource leaks, an application should - * always call {@code shutdown} and {@code destroy} - * on all ORB instances before exiting. - * - * @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing an invocation - */ - public void destroy( ) { - throw new NO_IMPLEMENT(); - } - - /** - * Disconnects the given servant object from the ORB. After this method returns, - * the ORB will reject incoming remote requests for the disconnected - * servant and will send the exception - * {@code org.omg.CORBA.OBJECT_NOT_EXIST} back to the - * remote client. Thus the object appears to be destroyed from the - * point of view of remote clients. Note, however, that local requests issued - * using the servant directly do not - * pass through the ORB; hence, they will continue to be processed by the - * servant. - *

- * Calling the method {@code disconnect} has no effect - * if the servant is not connected to the ORB. - *

- * Deprecated by the OMG in favor of the Portable Object Adapter APIs. - * - * @param obj The servant object to be disconnected from the ORB - */ - public void disconnect(org.omg.CORBA.Object obj) { - throw new NO_IMPLEMENT(); - } - - // - // ORB method implementations. - // - // We are trying to accomplish 2 things at once in this class. - // It can act as a default ORB implementation front-end, - // creating an actual ORB implementation object which is a - // subclass of this ORB class and then delegating the method - // implementations. - // - // To accomplish the delegation model, the 'delegate' private instance - // variable is set if an instance of this class is created directly. - // - - /** - * Returns a list of the initially available CORBA object references, - * such as "NameService" and "InterfaceRepository". - * - * @return an array of {@code String} objects that represent - * the object references for CORBA services - * that are initially available with this ORB - */ - abstract public String[] list_initial_services(); - - /** - * Resolves a specific object reference from the set of available - * initial service names. - * - * @param object_name the name of the initial service as a string - * @return the object reference associated with the given name - * @exception InvalidName if the given name is not associated with a - * known service - */ - abstract public org.omg.CORBA.Object resolve_initial_references(String object_name) - throws InvalidName; - - /** - * Converts the given CORBA object reference to a string. - * Note that the format of this string is predefined by IIOP, allowing - * strings generated by a different ORB to be converted back into an object - * reference. - *

- * The resulting {@code String} object may be stored or communicated - * in any way that a {@code String} object can be manipulated. - * - * @param obj the object reference to stringify - * @return the string representing the object reference - */ - abstract public String object_to_string(org.omg.CORBA.Object obj); - - /** - * Converts a string produced by the method {@code object_to_string} - * back to a CORBA object reference. - * - * @param str the string to be converted back to an object reference. It must - * be the result of converting an object reference to a string using the - * method {@code object_to_string}. - * @return the object reference - */ - abstract public org.omg.CORBA.Object string_to_object(String str); - - /** - * Allocates an {@code NVList} with (probably) enough - * space for the specified number of {@code NamedValue} objects. - * Note that the specified size is only a hint to help with - * storage allocation and does not imply the maximum size of the list. - * - * @param count suggested number of {@code NamedValue} objects for - * which to allocate space - * @return the newly-created {@code NVList} - * - * @see NVList - */ - abstract public NVList create_list(int count); - - /** - * Creates an {@code NVList} initialized with argument - * descriptions for the operation described in the given - * {@code OperationDef} object. This {@code OperationDef} object - * is obtained from an Interface Repository. The arguments in the - * returned {@code NVList} object are in the same order as in the - * original IDL operation definition, which makes it possible for the list - * to be used in dynamic invocation requests. - * - * @param oper the {@code OperationDef} object to use to create the list - * @return a newly-created {@code NVList} object containing - * descriptions of the arguments to the method described in the given - * {@code OperationDef} object - * - * @see NVList - */ - public NVList create_operation_list(org.omg.CORBA.Object oper) - { - // If we came here, it means that the actual ORB implementation - // did not have a create_operation_list(...CORBA.Object oper) method, - // so lets check if it has a create_operation_list(OperationDef oper) - // method. - try { - // First try to load the OperationDef class - String opDefClassName = "org.omg.CORBA.OperationDef"; - Class opDefClass = null; - - ClassLoader cl = Thread.currentThread().getContextClassLoader(); - if ( cl == null ) - cl = ClassLoader.getSystemClassLoader(); - // if this throws a ClassNotFoundException, it will be caught below. - opDefClass = Class.forName(opDefClassName, true, cl); - - // OK, we loaded OperationDef. Now try to get the - // create_operation_list(OperationDef oper) method. - Class[] argc = { opDefClass }; - java.lang.reflect.Method meth = - this.getClass().getMethod("create_operation_list", argc); - - // OK, the method exists, so invoke it and be happy. - java.lang.Object[] argx = { oper }; - return (org.omg.CORBA.NVList)meth.invoke(this, argx); - } - catch( java.lang.reflect.InvocationTargetException exs ) { - Throwable t = exs.getTargetException(); - if (t instanceof Error) { - throw (Error) t; - } - else if (t instanceof RuntimeException) { - throw (RuntimeException) t; - } - else { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - } - catch( RuntimeException ex ) { - throw ex; - } - catch( Exception exr ) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - } - - - /** - * Creates a {@code NamedValue} object - * using the given name, value, and argument mode flags. - *

- * A {@code NamedValue} object serves as (1) a parameter or return - * value or (2) a context property. - * It may be used by itself or - * as an element in an {@code NVList} object. - * - * @param s the name of the {@code NamedValue} object - * @param any the {@code Any} value to be inserted into the - * {@code NamedValue} object - * @param flags the argument mode flags for the {@code NamedValue}: one of - * {@code ARG_IN.value}, {@code ARG_OUT.value}, - * or {@code ARG_INOUT.value}. - * - * @return the newly-created {@code NamedValue} object - * @see NamedValue - */ - abstract public NamedValue create_named_value(String s, Any any, int flags); - - /** - * Creates an empty {@code ExceptionList} object. - * - * @return the newly-created {@code ExceptionList} object - */ - abstract public ExceptionList create_exception_list(); - - /** - * Creates an empty {@code ContextList} object. - * - * @return the newly-created {@code ContextList} object - * @see ContextList - * @see Context - */ - abstract public ContextList create_context_list(); - - /** - * Gets the default {@code Context} object. - * - * @return the default {@code Context} object - * @see Context - */ - abstract public Context get_default_context(); - - /** - * Creates an {@code Environment} object. - * - * @return the newly-created {@code Environment} object - * @see Environment - */ - abstract public Environment create_environment(); - - /** - * Creates a new {@code org.omg.CORBA.portable.OutputStream} into which - * IDL method parameters can be marshalled during method invocation. - * @return the newly-created - * {@code org.omg.CORBA.portable.OutputStream} object - */ - abstract public org.omg.CORBA.portable.OutputStream create_output_stream(); - - /** - * Sends multiple dynamic (DII) requests asynchronously without expecting - * any responses. Note that oneway invocations are not guaranteed to - * reach the server. - * - * @param req an array of request objects - */ - abstract public void send_multiple_requests_oneway(Request[] req); - - /** - * Sends multiple dynamic (DII) requests asynchronously. - * - * @param req an array of {@code Request} objects - */ - abstract public void send_multiple_requests_deferred(Request[] req); - - /** - * Finds out if any of the deferred (asynchronous) invocations have - * a response yet. - * @return {@code true} if there is a response available; - * {@code false} otherwise - */ - abstract public boolean poll_next_response(); - - /** - * Gets the next {@code Request} instance for which a response - * has been received. - * - * @return the next {@code Request} object ready with a response - * @exception WrongTransaction if the method {@code get_next_response} - * is called from a transaction scope different - * from the one from which the original request was sent. See the - * OMG Transaction Service specification for details. - */ - abstract public Request get_next_response() throws WrongTransaction; - - /** - * Retrieves the {@code TypeCode} object that represents - * the given primitive IDL type. - * - * @param tcKind the {@code TCKind} instance corresponding to the - * desired primitive type - * @return the requested {@code TypeCode} object - */ - abstract public TypeCode get_primitive_tc(TCKind tcKind); - - /** - * Creates a {@code TypeCode} object representing an IDL {@code struct}. - * The {@code TypeCode} object is initialized with the given id, - * name, and members. - * - * @param id the repository id for the {@code struct} - * @param name the name of the {@code struct} - * @param members an array describing the members of the {@code struct} - * @return a newly-created {@code TypeCode} object describing - * an IDL {@code struct} - */ - abstract public TypeCode create_struct_tc(String id, String name, - StructMember[] members); - - /** - * Creates a {@code TypeCode} object representing an IDL {@code union}. - * The {@code TypeCode} object is initialized with the given id, - * name, discriminator type, and members. - * - * @param id the repository id of the {@code union} - * @param name the name of the {@code union} - * @param discriminator_type the type of the {@code union} discriminator - * @param members an array describing the members of the {@code union} - * @return a newly-created {@code TypeCode} object describing - * an IDL {@code union} - */ - abstract public TypeCode create_union_tc(String id, String name, - TypeCode discriminator_type, - UnionMember[] members); - - /** - * Creates a {@code TypeCode} object representing an IDL {@code enum}. - * The {@code TypeCode} object is initialized with the given id, - * name, and members. - * - * @param id the repository id for the {@code enum} - * @param name the name for the {@code enum} - * @param members an array describing the members of the {@code enum} - * @return a newly-created {@code TypeCode} object describing - * an IDL {@code enum} - */ - abstract public TypeCode create_enum_tc(String id, String name, String[] members); - - /** - * Creates a {@code TypeCode} object representing an IDL {@code alias} - * ({@code typedef}). - * The {@code TypeCode} object is initialized with the given id, - * name, and original type. - * - * @param id the repository id for the alias - * @param name the name for the alias - * @param original_type - * the {@code TypeCode} object describing the original type - * for which this is an alias - * @return a newly-created {@code TypeCode} object describing - * an IDL {@code alias} - */ - abstract public TypeCode create_alias_tc(String id, String name, - TypeCode original_type); - - /** - * Creates a {@code TypeCode} object representing an IDL {@code exception}. - * The {@code TypeCode} object is initialized with the given id, - * name, and members. - * - * @param id the repository id for the {@code exception} - * @param name the name for the {@code exception} - * @param members an array describing the members of the {@code exception} - * @return a newly-created {@code TypeCode} object describing - * an IDL {@code exception} - */ - abstract public TypeCode create_exception_tc(String id, String name, - StructMember[] members); - - /** - * Creates a {@code TypeCode} object representing an IDL {@code interface}. - * The {@code TypeCode} object is initialized with the given id - * and name. - * - * @param id the repository id for the interface - * @param name the name for the interface - * @return a newly-created {@code TypeCode} object describing - * an IDL {@code interface} - */ - - abstract public TypeCode create_interface_tc(String id, String name); - - /** - * Creates a {@code TypeCode} object representing a bounded IDL - * {@code string}. - * The {@code TypeCode} object is initialized with the given bound, - * which represents the maximum length of the string. Zero indicates - * that the string described by this type code is unbounded. - * - * @param bound the bound for the {@code string}; cannot be negative - * @return a newly-created {@code TypeCode} object describing - * a bounded IDL {@code string} - * @exception BAD_PARAM if bound is a negative value - */ - - abstract public TypeCode create_string_tc(int bound); - - /** - * Creates a {@code TypeCode} object representing a bounded IDL - * {@code wstring} (wide string). - * The {@code TypeCode} object is initialized with the given bound, - * which represents the maximum length of the wide string. Zero indicates - * that the string described by this type code is unbounded. - * - * @param bound the bound for the {@code wstring}; cannot be negative - * @return a newly-created {@code TypeCode} object describing - * a bounded IDL {@code wstring} - * @exception BAD_PARAM if bound is a negative value - */ - abstract public TypeCode create_wstring_tc(int bound); - - /** - * Creates a {@code TypeCode} object representing an IDL {@code sequence}. - * The {@code TypeCode} object is initialized with the given bound and - * element type. - * - * @param bound the bound for the {@code sequence}, 0 if unbounded - * @param element_type the {@code TypeCode} object describing - * the elements contained in the {@code sequence} - * - * @return a newly-created {@code TypeCode} object describing - * an IDL {@code sequence} - */ - abstract public TypeCode create_sequence_tc(int bound, TypeCode element_type); - - /** - * Creates a {@code TypeCode} object representing a - * a recursive IDL {@code sequence}. - *

- * For the IDL {@code struct} Node in following code fragment, - * the offset parameter for creating its sequence would be 1: - *

-     *    Struct Node {
-     *        long value;
-     *        Sequence <Node> subnodes;
-     *    };
-     * 
- * - * @param bound the bound for the sequence, 0 if unbounded - * @param offset the index to the enclosing {@code TypeCode} object - * that describes the elements of this sequence - * @return a newly-created {@code TypeCode} object describing - * a recursive sequence - * @deprecated Use a combination of create_recursive_tc and create_sequence_tc instead - * @see #create_recursive_tc(String) create_recursive_tc - * @see #create_sequence_tc(int, TypeCode) create_sequence_tc - */ - @Deprecated - abstract public TypeCode create_recursive_sequence_tc(int bound, int offset); - - /** - * Creates a {@code TypeCode} object representing an IDL {@code array}. - * The {@code TypeCode} object is initialized with the given length and - * element type. - * - * @param length the length of the {@code array} - * @param element_type a {@code TypeCode} object describing the type - * of element contained in the {@code array} - * @return a newly-created {@code TypeCode} object describing - * an IDL {@code array} - */ - abstract public TypeCode create_array_tc(int length, TypeCode element_type); - - /** - * Create a {@code TypeCode} object for an IDL native type. - * - * @param id the logical id for the native type. - * @param name the name of the native type. - * @return the requested TypeCode. - */ - public org.omg.CORBA.TypeCode create_native_tc(String id, - String name) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Create a {@code TypeCode} object for an IDL abstract interface. - * - * @param id the logical id for the abstract interface type. - * @param name the name of the abstract interface type. - * @return the requested TypeCode. - */ - public org.omg.CORBA.TypeCode create_abstract_interface_tc( - String id, - String name) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - /** - * Create a {@code TypeCode} object for an IDL fixed type. - * - * @param digits specifies the total number of decimal digits in the number - * and must be from 1 to 31 inclusive. - * @param scale specifies the position of the decimal point. - * @return the requested TypeCode. - */ - public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - // orbos 98-01-18: Objects By Value -- begin - - - /** - * Create a {@code TypeCode} object for an IDL value type. - * The concrete_base parameter is the TypeCode for the immediate - * concrete valuetype base of the valuetype for which the TypeCode - * is being created. - * It may be null if the valuetype does not have a concrete base. - * - * @param id the logical id for the value type. - * @param name the name of the value type. - * @param type_modifier one of the value type modifier constants: - * VM_NONE, VM_CUSTOM, VM_ABSTRACT or VM_TRUNCATABLE - * @param concrete_base a {@code TypeCode} object - * describing the concrete valuetype base - * @param members an array containing the members of the value type - * @return the requested TypeCode - */ - public org.omg.CORBA.TypeCode create_value_tc(String id, - String name, - short type_modifier, - TypeCode concrete_base, - ValueMember[] members) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Create a recursive {@code TypeCode} object which - * serves as a placeholder for a concrete TypeCode during the process of creating - * TypeCodes which contain recursion. The id parameter specifies the repository id of - * the type for which the recursive TypeCode is serving as a placeholder. Once the - * recursive TypeCode has been properly embedded in the enclosing TypeCode which - * corresponds to the specified repository id, it will function as a normal TypeCode. - * Invoking operations on the recursive TypeCode before it has been embedded in the - * enclosing TypeCode will result in a {@code BAD_TYPECODE} exception. - *

- * For example, the following IDL type declaration contains recursion: - *

-     *    Struct Node {
-     *        Sequence<Node> subnodes;
-     *    };
-     * 
- *

- * To create a TypeCode for struct Node, you would invoke the TypeCode creation - * operations as shown below: - *

-     * String nodeID = "IDL:Node:1.0";
-     * TypeCode recursiveSeqTC = orb.create_sequence_tc(0, orb.create_recursive_tc(nodeID));
-     * StructMember[] members = { new StructMember("subnodes", recursiveSeqTC, null) };
-     * TypeCode structNodeTC = orb.create_struct_tc(nodeID, "Node", members);
-     * 
- *

- * Also note that the following is an illegal IDL type declaration: - *

-     *    Struct Node {
-     *        Node next;
-     *    };
-     * 
- *

- * Recursive types can only appear within sequences which can be empty. - * That way marshaling problems, when transmitting the struct in an Any, are avoided. - * - * @param id the logical id of the referenced type - * @return the requested TypeCode - */ - public org.omg.CORBA.TypeCode create_recursive_tc(String id) { - // implemented in subclass - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Creates a {@code TypeCode} object for an IDL value box. - * - * @param id the logical id for the value type - * @param name the name of the value type - * @param boxed_type the TypeCode for the type - * @return the requested TypeCode - */ - public org.omg.CORBA.TypeCode create_value_box_tc(String id, - String name, - TypeCode boxed_type) - { - // implemented in subclass - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - // orbos 98-01-18: Objects By Value -- end - - /** - * Creates an IDL {@code Any} object initialized to - * contain a {@code Typecode} object whose {@code kind} field - * is set to {@code TCKind.tc_null}. - * - * @return a newly-created {@code Any} object - */ - abstract public Any create_any(); - - - - - /** - * Retrieves a {@code Current} object. - * The {@code Current} interface is used to manage thread-specific - * information for use by services such as transactions and security. - * - * @see CORBA package - * comments for unimplemented features - * - * @return a newly-created {@code Current} object - * @deprecated use {@code resolve_initial_references}. - */ - @Deprecated - public org.omg.CORBA.Current get_current() - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * This operation blocks the current thread until the ORB has - * completed the shutdown process, initiated when some thread calls - * {@code shutdown}. It may be used by multiple threads which - * get all notified when the ORB shuts down. - * - */ - public void run() - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Instructs the ORB to shut down, which causes all - * object adapters to shut down, in preparation for destruction.
- * If the {@code wait_for_completion} parameter - * is true, this operation blocks until all ORB processing (including - * processing of currently executing requests, object deactivation, - * and other object adapter operations) has completed. - * If an application does this in a thread that is currently servicing - * an invocation, the {@code BAD_INV_ORDER} system exception - * will be thrown with the OMG minor code 3, - * since blocking would result in a deadlock.
- * If the {@code wait_for_completion} parameter is {@code FALSE}, - * then shutdown may not have completed upon return.

- * While the ORB is in the process of shutting down, the ORB operates as normal, - * servicing incoming and outgoing requests until all requests have been completed. - * Once an ORB has shutdown, only object reference management operations - * may be invoked on the ORB or any object reference obtained from it. - * An application may also invoke the {@code destroy} operation on the ORB itself. - * Invoking any other operation will throw the {@code BAD_INV_ORDER} - * system exception with the OMG minor code 4.

- * The {@code ORB.run} method will return after - * {@code shutdown} has been called. - * - * @param wait_for_completion {@code true} if the call - * should block until the shutdown is complete; - * {@code false} if it should return immediately - * @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing - * an invocation - */ - public void shutdown(boolean wait_for_completion) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Returns {@code true} if the ORB needs the main thread to - * perform some work, and {@code false} if the ORB does not - * need the main thread. - * - * @return {@code true} if there is work pending, meaning that the ORB - * needs the main thread to perform some work; {@code false} - * if there is no work pending and thus the ORB does not need the - * main thread - * - */ - public boolean work_pending() - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Performs an implementation-dependent unit of work if called - * by the main thread. Otherwise it does nothing. - * The methods {@code work_pending} and {@code perform_work} - * can be used in - * conjunction to implement a simple polling loop that multiplexes - * the main thread among the ORB and other activities. - * - */ - public void perform_work() - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Used to obtain information about CORBA facilities and services - * that are supported by this ORB. The service type for which - * information is being requested is passed in as the in - * parameter {@code service_type}, the values defined by - * constants in the CORBA module. If service information is - * available for that type, that is returned in the out parameter - * {@code service_info}, and the operation returns the - * value {@code true}. If no information for the requested - * services type is available, the operation returns {@code false} - * (i.e., the service is not supported by this ORB). - * - * @param service_type a {@code short} indicating the - * service type for which information is being requested - * @param service_info a {@code ServiceInformationHolder} object - * that will hold the {@code ServiceInformation} object - * produced by this method - * @return {@code true} if service information is available - * for the {@code service_type}; - * {@code false} if no information for the - * requested services type is available - * @see CORBA package - * comments for unimplemented features - */ - public boolean get_service_information(short service_type, - ServiceInformationHolder service_info) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - // orbos 98-01-18: Objects By Value -- begin - - /** - * Creates a new {@code DynAny} object from the given - * {@code Any} object. - * - * @param value the {@code Any} object from which to create a new - * {@code DynAny} object - * @return the new {@code DynAny} object created from the given - * {@code Any} object - * @see CORBA package - * comments for unimplemented features - * @deprecated Use the new DynAnyFactory API instead - */ - @Deprecated - public org.omg.CORBA.DynAny create_dyn_any(org.omg.CORBA.Any value) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Creates a basic {@code DynAny} object from the given - * {@code TypeCode} object. - * - * @param type the {@code TypeCode} object from which to create a new - * {@code DynAny} object - * @return the new {@code DynAny} object created from the given - * {@code TypeCode} object - * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given - * {@code TypeCode} object is not consistent with the operation. - * @see CORBA package - * comments for unimplemented features - * @deprecated Use the new DynAnyFactory API instead - */ - @Deprecated - public org.omg.CORBA.DynAny create_basic_dyn_any(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Creates a new {@code DynStruct} object from the given - * {@code TypeCode} object. - * - * @param type the {@code TypeCode} object from which to create a new - * {@code DynStruct} object - * @return the new {@code DynStruct} object created from the given - * {@code TypeCode} object - * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given - * {@code TypeCode} object is not consistent with the operation. - * @see CORBA package - * comments for unimplemented features - * @deprecated Use the new DynAnyFactory API instead - */ - @Deprecated - public org.omg.CORBA.DynStruct create_dyn_struct(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Creates a new {@code DynSequence} object from the given - * {@code TypeCode} object. - * - * @param type the {@code TypeCode} object from which to create a new - * {@code DynSequence} object - * @return the new {@code DynSequence} object created from the given - * {@code TypeCode} object - * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given - * {@code TypeCode} object is not consistent with the operation. - * @see CORBA package - * comments for unimplemented features - * @deprecated Use the new DynAnyFactory API instead - */ - @Deprecated - public org.omg.CORBA.DynSequence create_dyn_sequence(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - /** - * Creates a new {@code DynArray} object from the given - * {@code TypeCode} object. - * - * @param type the {@code TypeCode} object from which to create a new - * {@code DynArray} object - * @return the new {@code DynArray} object created from the given - * {@code TypeCode} object - * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given - * {@code TypeCode} object is not consistent with the operation. - * @see CORBA package - * comments for unimplemented features - * @deprecated Use the new DynAnyFactory API instead - */ - @Deprecated - public org.omg.CORBA.DynArray create_dyn_array(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Creates a new {@code DynUnion} object from the given - * {@code TypeCode} object. - * - * @param type the {@code TypeCode} object from which to create a new - * {@code DynUnion} object - * @return the new {@code DynUnion} object created from the given - * {@code TypeCode} object - * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given - * {@code TypeCode} object is not consistent with the operation. - * @see CORBA package - * comments for unimplemented features - * @deprecated Use the new DynAnyFactory API instead - */ - @Deprecated - public org.omg.CORBA.DynUnion create_dyn_union(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Creates a new {@code DynEnum} object from the given - * {@code TypeCode} object. - * - * @param type the {@code TypeCode} object from which to create a new - * {@code DynEnum} object - * @return the new {@code DynEnum} object created from the given - * {@code TypeCode} object - * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given - * {@code TypeCode} object is not consistent with the operation. - * @see CORBA package - * comments for unimplemented features - * @deprecated Use the new DynAnyFactory API instead - */ - @Deprecated - public org.omg.CORBA.DynEnum create_dyn_enum(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Can be invoked to create new instances of policy objects - * of a specific type with specified initial state. If - * {@code create_policy} fails to instantiate a new Policy - * object due to its inability to interpret the requested type - * and content of the policy, it raises the {@code PolicyError} - * exception with the appropriate reason. - * @param type the {@code PolicyType} of the policy object to - * be created - * @param val the value that will be used to set the initial - * state of the {@code Policy} object that is created - * @return Reference to a newly created {@code Policy} object - * of type specified by the {@code type} parameter and - * initialized to a state specified by the {@code val} - * parameter - * @throws org.omg.CORBA.PolicyError when the requested - * policy is not supported or a requested initial state - * for the policy is not supported. - */ - public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) - throws org.omg.CORBA.PolicyError - { - // Currently not implemented until PIORB. - throw new org.omg.CORBA.NO_IMPLEMENT(); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InconsistentTypeCode.java 2018-01-30 20:27:38.000000000 -0500 +++ /dev/null 2018-01-30 20:27:38.000000000 -0500 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA.ORBPackage; - -/** - * InconsistentTypeCode is thrown when an attempt is made to create a - * dynamic any with a type code that does not match the particular - * subclass of DynAny. - */ -public final class InconsistentTypeCode - extends org.omg.CORBA.UserException { - /** - * Constructs an InconsistentTypeCode user exception - * with no reason message. - */ - public InconsistentTypeCode() { - super(); - } - - /** - * Constructs an InconsistentTypeCode user exception - * with the specified reason message. - * @param reason The String containing a reason message - */ - public InconsistentTypeCode(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidName.java 2018-01-30 20:27:38.000000000 -0500 +++ /dev/null 2018-01-30 20:27:39.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1997, 2000, 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 org.omg.CORBA.ORBPackage; - -/** - * The InvalidName exception is raised when - * ORB.resolve_initial_references is passed a name - * for which there is no initial reference. - * - * @see org.omg.CORBA.ORB#resolve_initial_references(String) - * @since JDK1.2 - */ - -final public class InvalidName extends org.omg.CORBA.UserException { - /** - * Constructs an InvalidName exception with no reason message. - */ - public InvalidName() { - super(); - } - - /** - * Constructs an InvalidName exception with the specified - * reason message. - * @param reason the String containing a reason message - */ - public InvalidName(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidNameHelper.java 2018-01-30 20:27:39.000000000 -0500 +++ /dev/null 2018-01-30 20:27:39.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2014, 2017, 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 org.omg.CORBA.ORBPackage; - - -/** - * This Helper class is used to facilitate the marshalling of - * {@code ORBPackage/InvalidName}. - * For more information on Helper files, see - * - * "Generated Files: Helper Files". - */ - -abstract public class InvalidNameHelper -{ - private static String _id = "IDL:omg.org.CORBA/ORB/InvalidName:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.ORBPackage.InvalidName that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.ORBPackage.InvalidName extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [0]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.ORBPackage.InvalidNameHelper.id (), "InvalidName", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.ORBPackage.InvalidName read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.ORBPackage.InvalidName value = new org.omg.CORBA.ORBPackage.InvalidName (); - // read and discard the repository ID - istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.ORBPackage.InvalidName value) - { - // write the repository ID - ostream.write_string (id ()); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/package.html 2018-01-30 20:27:40.000000000 -0500 +++ /dev/null 2018-01-30 20:27:40.000000000 -0500 @@ -1,50 +0,0 @@ - - - - - - - -Provides the exception InvalidName, which is thrown -by the method ORB.resolve_initial_references -and the exception InconsistentTypeCode, which is thrown -by the Dynamic Any creation methods in the ORB class. - - -

Related Documentation

- -For an overview, please see: - - - -@since JDK1.2 -@serial exclude - - --- old/src/java.corba/share/classes/org/omg/CORBA/Object.java 2018-01-30 20:27:40.000000000 -0500 +++ /dev/null 2018-01-30 20:27:41.000000000 -0500 @@ -1,282 +0,0 @@ -/* - * Copyright (c) 1995, 2015, 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 org.omg.CORBA; - -/** - * The definition for a CORBA object reference. - *

- * A CORBA object reference is a handle for a particular - * CORBA object implemented by a server. A CORBA object reference - * identifies the same CORBA object each time the reference is used to invoke - * a method on the object. - * A CORBA object may have multiple, distinct object references. - *

- * The org.omg.CORBA.Object interface is the root of - * the inheritance hierarchy for all CORBA object references in the Java - * programming language, analogous to java.rmi.Remote - * for RMI remote objects. - *

- * A CORBA object may be either local or remote. - * If it is a local object (that is, running in the same - * VM as the client), invocations may be directly serviced by - * the object instance, and the object reference could point to the actual - * instance of the object implementation class. - * If a CORBA object is a remote object (that is, running in a different - * VM from the client), the object reference points to a stub (proxy) which uses the - * ORB machinery to make a remote invocation on the server where the object - * implementation resides. - *

- * Default implementations of the methods in the interface - * org.omg.CORBA.Object - * are provided in the class org.omg.CORBA.portable.ObjectImpl, - * which is the base class for stubs and object implementations. - * - * @see org.omg.CORBA.portable.ObjectImpl - */ - -public interface Object { - - /** - * Checks whether this object is an instance of a class that - * implements the given interface. - * - * @param repositoryIdentifier the interface to check against - * @return true if this object reference is an instance - * of a class that implements the interface; - * false otherwise - */ - boolean _is_a(String repositoryIdentifier); - - - /** - * Determines whether the two object references are equivalent, - * so far as the ORB can easily determine. Two object references are equivalent - * if they are identical. Two distinct object references which in fact refer to - * the same object are also equivalent. However, ORBs are not required - * to attempt determination of whether two distinct object references - * refer to the same object, since such determination could be impractically - * expensive. - * @param other the other object reference with which to check for equivalence - * @return true if this object reference is known to be - * equivalent to the given object reference. - * Note that false indicates only that the two - * object references are distinct, not necessarily that - * they reference distinct objects. - */ - boolean _is_equivalent(org.omg.CORBA.Object other); - - - /** - * Determines whether the server object for this object reference has been - * destroyed. - * @return true if the ORB knows authoritatively that the - * server object does not exist; false otherwise - */ - boolean _non_existent(); - - - /** - * Returns an ORB-internal identifier for this object reference. - * This is a hash identifier, which does - * not change during the lifetime of the object reference, and so - * neither will any hash function of that identifier change. The value returned - * is not guaranteed to be unique; in other words, another object - * reference may have the same hash value. - * If two object references hash differently, - * then they are distinct object references; however, both may still refer - * to the same CORBA object. - * - * @param maximum the upper bound on the hash value returned by the ORB - * @return the ORB-internal hash identifier for this object reference - */ - int _hash(int maximum); - - - /** - * Returns a duplicate of this CORBA object reference. - * The server object implementation is not involved in creating - * the duplicate, and the implementation cannot distinguish whether - * the original object reference or a duplicate was used to make a request. - *

- * Note that this method is not very useful in the Java platform, - * since memory management is handled by the VM. - * It is included for compliance with the CORBA APIs. - *

- * The method _duplicate may return this object reference itself. - * - * @return a duplicate of this object reference or this object reference - * itself - */ - org.omg.CORBA.Object _duplicate(); - - - /** - * Signals that the caller is done using this object reference, so - * internal ORB resources associated with this object reference can be - * released. Note that the object implementation is not involved in - * this operation, and other references to the same object are not affected. - */ - void _release(); - - - /** - * Obtains an InterfaceDef for the object implementation - * referenced by this object reference. - * The InterfaceDef object - * may be used to introspect on the methods, attributes, and other - * type information for the object referred to by this object reference. - * - * @return the InterfaceDef object in the Interface Repository - * which provides type information about the object referred to by - * this object reference - */ - org.omg.CORBA.Object _get_interface_def(); - - - - /** - * Creates a Request instance for use in the - * Dynamic Invocation Interface. - * - * @param operation the name of the method to be invoked using the - * Request instance - * @return the newly-created Request instance - */ - Request _request(String operation); - - - - /** - * Creates a Request instance initialized with the - * given context, method name, list of arguments, and container - * for the method's return value. - * - * @param ctx a Context object containing - * a list of properties - * @param operation the name of the method to be invoked - * @param arg_list an NVList containing the actual arguments - * to the method being invoked - * @param result a NamedValue object to serve as a - * container for the method's return value - * @return the newly-created Request object - * - * @see Request - * @see NVList - * @see NamedValue - */ - - Request _create_request(Context ctx, - String operation, - NVList arg_list, - NamedValue result); - - /** - * Creates a Request instance initialized with the - * given context, method name, list of arguments, container - * for the method's return value, list of possible exceptions, - * and list of context strings needing to be resolved. - * - * @param ctx a Context object containing - * a list of properties - * @param operation the name of the method to be invoked - * @param arg_list an NVList containing the actual arguments - * to the method being invoked - * @param result a NamedValue object to serve as a - * container for the method's return value - * @param exclist an ExceptionList object containing a - * list of possible exceptions the method can throw - * @param ctxlist a ContextList object containing a list of - * context strings that need to be resolved and sent with the - * Request instance - * @return the newly-created Request object - * - * @see Request - * @see NVList - * @see NamedValue - * @see ExceptionList - * @see ContextList - */ - - Request _create_request(Context ctx, - String operation, - NVList arg_list, - NamedValue result, - ExceptionList exclist, - ContextList ctxlist); - - - - - /** - * Returns the Policy object of the specified type - * which applies to this object. - * - * @param policy_type the type of policy to be obtained - * @return A Policy object of the type specified by - * the policy_type parameter - * @exception org.omg.CORBA.BAD_PARAM when the value of policy type - * is not valid either because the specified type is not supported by this - * ORB or because a policy object of that type is not associated with this - * Object - */ - Policy _get_policy(int policy_type); - - - /** - * Retrieves the DomainManagers of this object. - * This allows administration services (and applications) to retrieve the - * domain managers, and hence the security and other policies applicable - * to individual objects that are members of the domain. - * - * @return the list of immediately enclosing domain managers of this object. - * At least one domain manager is always returned in the list since by - * default each object is associated with at least one domain manager at - * creation. - */ - DomainManager[] _get_domain_managers(); - - - /** - * Returns a new Object with the given policies - * either replacing any existing policies in this - * Object or with the given policies added - * to the existing ones, depending on the value of the - * given SetOverrideType object. - * - * @param policies an array of Policy objects containing - * the policies to be added or to be used as replacements - * @param set_add either SetOverrideType.SET_OVERRIDE, indicating - * that the given policies will replace any existing ones, or - * SetOverrideType.ADD_OVERRIDE, indicating that - * the given policies should be added to any existing ones - * @return a new Object with the given policies replacing - * or added to those in this Object - */ - org.omg.CORBA.Object _set_policy_override(Policy[] policies, - SetOverrideType set_add); - - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ObjectHelper.java 2018-01-30 20:27:41.000000000 -0500 +++ /dev/null 2018-01-30 20:27:41.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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. - */ - -/** - * The Helper for {@code Object}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- */ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA; - -abstract public class ObjectHelper -{ - private static String _id = ""; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Object that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.Object extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (TCKind.tk_objref); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.Object read (org.omg.CORBA.portable.InputStream istream) - { - return istream.read_Object (); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Object value) - { - ostream.write_Object (value); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ObjectHolder.java 2018-01-30 20:27:42.000000000 -0500 +++ /dev/null 2018-01-30 20:27:42.000000000 -0500 @@ -1,111 +0,0 @@ -/* - * Copyright (c) 1996, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - - -/** - * The Holder for {@code Object}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a CORBA object reference (a value of type - * {@code org.omg.CORBA.Object}). It is usually - * used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has a CORBA Object reference as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code ObjectHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myObjectHolder} is an instance of {@code ObjectHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myObjectHolder.value}. - * - * @since JDK1.2 - */ -public final class ObjectHolder implements Streamable { - /** - * The {@code Object} value held by this {@code ObjectHolder} - * object. - */ - public Object value; - - /** - * Constructs a new {@code ObjectHolder} object with its - * {@code value} field initialized to {@code null}. - */ - public ObjectHolder() { - } - - /** - * Constructs a new {@code ObjectHolder} object with its - * {@code value} field initialized to the given - * {@code Object}. - * @param initial the {@code Object} with which to initialize - * the {@code value} field of the newly-created - * {@code ObjectHolder} object - */ - public ObjectHolder(Object initial) { - value = initial; - } - - /** - * Reads from {@code input} and initalizes the value in - * this {@code ObjectHolder} object - * with the unmarshalled data. - * - * @param input the InputStream containing CDR formatted data from the wire. - */ - public void _read(InputStream input) { - value = input.read_Object(); - } - - /** - * Marshals to {@code output} the value in - * this {@code ObjectHolder} object. - * - * @param output the OutputStream which will contain the CDR formatted data. - */ - public void _write(OutputStream output) { - output.write_Object(value); - } - - /** - * Returns the TypeCode corresponding to the value held in - * this {@code ObjectHolder} object - * - * @return the TypeCode of the value held in - * this {@code ObjectHolder} object - */ - public org.omg.CORBA.TypeCode _type() { - return org.omg.CORBA.ORB.init().get_primitive_tc(TCKind.tk_objref); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHelper.java 2018-01-30 20:27:43.000000000 -0500 +++ /dev/null 2018-01-30 20:27:43.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code OctetSeq}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/OctetSeqHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - * - * The class definition has been modified to conform to the following - * OMG specifications : - *

    - *
  • ORB core as defined by CORBA 2.3.1 - * (formal/99-10-07) - *
  • - * - *
  • IDL/Java Language Mapping as defined in - * ptc/00-01-08 - *
  • - *
- */ - -public abstract class OctetSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/OctetSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, byte[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static byte[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_octet); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.OctetSeqHelper.id (), "OctetSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static byte[] read (org.omg.CORBA.portable.InputStream istream) - { - byte value[] = null; - int _len0 = istream.read_long (); - value = new byte[_len0]; - istream.read_octet_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, byte[] value) - { - ostream.write_long (value.length); - ostream.write_octet_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHolder.java 2018-01-30 20:27:43.000000000 -0500 +++ /dev/null 2018-01-30 20:27:43.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Holder for {@code OctetSeq}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/OctetSeqHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from streams.idl - * 13 May 1999 22:41:36 o'clock GMT+00:00 - */ - -public final class OctetSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public byte value[] = null; - - public OctetSeqHolder () - { - } - - public OctetSeqHolder (byte[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.OctetSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.OctetSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.OctetSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/PERSIST_STORE.java 2018-01-30 20:27:44.000000000 -0500 +++ /dev/null 2018-01-30 20:27:44.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception indicates a persistent storage failure, for example, - * failure to establish a database connection or corruption of a - * database.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class PERSIST_STORE extends SystemException { - /** - * Constructs a PERSIST_STORE exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public PERSIST_STORE() { - this(""); - } - - /** - * Constructs a PERSIST_STORE exception with the specified description message, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public PERSIST_STORE(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a PERSIST_STORE exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public PERSIST_STORE(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a PERSIST_STORE exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public PERSIST_STORE(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/PRIVATE_MEMBER.java 2018-01-30 20:27:45.000000000 -0500 +++ /dev/null 2018-01-30 20:27:45.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1998, 2000, 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. - */ -/* - * File: ./org/omg/CORBA/PRIVATE_MEMBER.java - * From: ./ir.idl - * Date: Fri Aug 28 16:03:31 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - */ - -package org.omg.CORBA; - -/** - * Constant to define a private member in the ValueMember class. - *

- * PRIVATE_MEMBER is one of the two constants of typedef - * Visibility used in the interface repository - * to identify visibility of a ValueMember type. - * The other constant is PUBLIC_MEMBER. - * - * @author unattributed - */ -public interface PRIVATE_MEMBER { - final short value = (short) (0L); -}; --- old/src/java.corba/share/classes/org/omg/CORBA/PUBLIC_MEMBER.java 2018-01-30 20:27:45.000000000 -0500 +++ /dev/null 2018-01-30 20:27:45.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1998, 2000, 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. - */ -/* - * File: ./org/omg/CORBA/PUBLIC_MEMBER.java - * From: ./ir.idl - * Date: Fri Aug 28 16:03:31 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - */ - -package org.omg.CORBA; - -/** - * Constant to define a public member in the ValueMember - * class. - *

- * PUBLIC_MEMBER is one of the two constants of typedef - * Visibility used in the interface repository - * to identify visibility of a ValueMember type. - * The other constant is PRIVATE_MEMBER. - * - * @author unattributed - */ -public interface PUBLIC_MEMBER { - final short value = (short) (1L); -}; --- old/src/java.corba/share/classes/org/omg/CORBA/Policy.java 2018-01-30 20:27:46.000000000 -0500 +++ /dev/null 2018-01-30 20:27:46.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - - -/** - * Interfaces derived from the {@code Policy} interface allow an - * ORB or CORBA service access to certain choices that affect - * its operation. This information is accessed in a structured - * manner using interfaces derived from the {@code Policy} - * interface defined in the CORBA module. A CORBA service does not - * have to use this method of accessing operating options, but - * may choose to do so. The Security Service in particular uses - * this technique for associating Security Policy with objects - * in the system. - * An interface generated by the IDL-to-Java compiler. - * org/omg/CORBA/Policy.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:20 AM PDT - */ - -public interface Policy extends PolicyOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity -{ -} // interface Policy --- old/src/java.corba/share/classes/org/omg/CORBA/PolicyError.java 2018-01-30 20:27:47.000000000 -0500 +++ /dev/null 2018-01-30 20:27:47.000000000 -0500 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 1998, 2000, 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 org.omg.CORBA; - -/** -* A user exception thrown when a policy error occurs. A PolicyError -* exception may include one of the following policy error reason codes -* defined in the org.omg.CORBA package: BAD_POLICY, BAD_POLICY_TYPE, -* BAD_POLICY_VALUE, UNSUPPORTED_POLICY, UNSUPPORTED_POLICY_VALUE. -*/ - -public final class PolicyError extends org.omg.CORBA.UserException { - - /** - * The reason for the PolicyError exception being thrown. - * @serial - */ - public short reason; - - /** - * Constructs a default PolicyError user exception - * with no reason code and an empty reason detail message. - */ - public PolicyError() { - super(); - } - - /** - * Constructs a PolicyError user exception - * initialized with the given reason code and an empty reason detail message. - * @param __reason the reason code. - */ - public PolicyError(short __reason) { - super(); - reason = __reason; - } - - /** - * Constructs a PolicyError user exception - * initialized with the given reason detail message and reason code. - * @param reason_string the reason detail message. - * @param __reason the reason code. - */ - public PolicyError(String reason_string, short __reason) { - super(reason_string); - reason = __reason; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/PolicyHelper.java 2018-01-30 20:27:48.000000000 -0500 +++ /dev/null 2018-01-30 20:27:48.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code Policy}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/PolicyHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:20 AM PDT - */ - -abstract public class PolicyHelper -{ - private static String _id = "IDL:omg.org/CORBA/Policy:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Policy that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.Policy extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.CORBA.PolicyHelper.id (), "Policy"); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.Policy read (org.omg.CORBA.portable.InputStream istream) - { - return narrow (istream.read_Object (_PolicyStub.class)); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Policy value) - { - ostream.write_Object ((org.omg.CORBA.Object) value); - } - - public static org.omg.CORBA.Policy narrow (org.omg.CORBA.Object obj) - { - if (obj == null) - return null; - else if (obj instanceof org.omg.CORBA.Policy) - return (org.omg.CORBA.Policy)obj; - else if (!obj._is_a (id ())) - throw new org.omg.CORBA.BAD_PARAM (); - else - { - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate (); - return new org.omg.CORBA._PolicyStub (delegate); - } - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/PolicyHolder.java 2018-01-30 20:27:48.000000000 -0500 +++ /dev/null 2018-01-30 20:27:48.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - -/** - * The Holder for {@code Policy}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/PolicyHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:20 AM PDT - */ - -public final class PolicyHolder implements org.omg.CORBA.portable.Streamable -{ - public org.omg.CORBA.Policy value = null; - - public PolicyHolder () - { - } - - public PolicyHolder (org.omg.CORBA.Policy initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.PolicyHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.PolicyHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.PolicyHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/PolicyListHelper.java 2018-01-30 20:27:49.000000000 -0500 +++ /dev/null 2018-01-30 20:27:49.000000000 -0500 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code PolicyList}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/PolicyListHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:21 AM PDT - */ - -abstract public class PolicyListHelper -{ - private static String _id = "IDL:omg.org/CORBA/PolicyList:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Policy[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.Policy[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.PolicyHelper.type (); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.PolicyListHelper.id (), "PolicyList", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.Policy[] read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.Policy value[] = null; - int _len0 = istream.read_long (); - value = new org.omg.CORBA.Policy[_len0]; - for (int _o1 = 0;_o1 < value.length; ++_o1) - value[_o1] = org.omg.CORBA.PolicyHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Policy[] value) - { - ostream.write_long (value.length); - for (int _i0 = 0;_i0 < value.length; ++_i0) - org.omg.CORBA.PolicyHelper.write (ostream, value[_i0]); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/PolicyListHolder.java 2018-01-30 20:27:50.000000000 -0500 +++ /dev/null 2018-01-30 20:27:50.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Holder for {@code PolicyList}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * org/omg/CORBA/PolicyListHolder.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:21 AM PDT - */ - -public final class PolicyListHolder implements org.omg.CORBA.portable.Streamable -{ - public org.omg.CORBA.Policy value[] = null; - - public PolicyListHolder () - { - } - - public PolicyListHolder (org.omg.CORBA.Policy[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.PolicyListHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.PolicyListHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.PolicyListHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/PolicyOperations.java 2018-01-30 20:27:51.000000000 -0500 +++ /dev/null 2018-01-30 20:27:51.000000000 -0500 @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The interface for {@code Policy}. For more information on - * Operations interfaces, see - * "Generated Files: Operations files". - *

- * org/omg/CORBA/PolicyOperations.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:20 AM PDT - */ - -/** - * Provides the operations for a {@code Policy} object. - */ -public interface PolicyOperations -{ - - /** - * Returns the constant value that corresponds to the - * type of the policy object. The values of - * the policy objects are allocated by the OMG. - * New values for PolicyType should be obtained from the OMG by - * sending mail to request@omg.org. In general the constant - * values that are allocated are defined in conjunction with - * the definition of the corresponding policy object. - * - * @return the constant value that corresponds to the type of - * the policy object - */ - int policy_type (); - - /** - * Returns a copy of the {@code Policy} object. The copy does not retain - * any relationships that the policy had with any domain or object. - * - * @return a copy of the {@code Policy} object - */ - org.omg.CORBA.Policy copy (); - - /** - * Destroys the {@code Policy} object. It is the responsibility of - * the {@code Policy} object to determine whether it can be destroyed. - */ - void destroy (); -} // interface PolicyOperations --- old/src/java.corba/share/classes/org/omg/CORBA/PolicyTypeHelper.java 2018-01-30 20:27:51.000000000 -0500 +++ /dev/null 2018-01-30 20:27:51.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code PolicyType}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * org/omg/CORBA/PolicyTypeHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl - * Saturday, July 17, 1999 12:26:20 AM PDT - */ - - -// basic Policy definition -abstract public class PolicyTypeHelper -{ - private static String _id = "IDL:omg.org/CORBA/PolicyType:1.0"; - - public static void insert (org.omg.CORBA.Any a, int that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static int extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.PolicyTypeHelper.id (), "PolicyType", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static int read (org.omg.CORBA.portable.InputStream istream) - { - int value = (int)0; - value = istream.read_ulong (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, int value) - { - ostream.write_ulong (value); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/Principal.java 2018-01-30 20:27:52.000000000 -0500 +++ /dev/null 2018-01-30 20:27:52.000000000 -0500 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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 org.omg.CORBA; - - -/** - * A class that contains information about the identity of - * the client, for access control - * and other purposes. It contains a single attribute, the name of the - * Principal, encoded as a sequence of bytes. - * - * @deprecated Deprecated by CORBA 2.2. - */ -@Deprecated -public class Principal { - /** - * Sets the name of this Principal object to the given value. - * @param value the value to be set in the Principal - * @deprecated Deprecated by CORBA 2.2. - */ - @Deprecated - public void name(byte[] value) { - throw new org.omg.CORBA.NO_IMPLEMENT() ; - } - - /** - * Gets the name of this Principal object. - * @return the name of this Principal object - * @deprecated Deprecated by CORBA 2.2. - */ - @Deprecated - public byte[] name() { - throw new org.omg.CORBA.NO_IMPLEMENT() ; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/PrincipalHolder.java 2018-01-30 20:27:53.000000000 -0500 +++ /dev/null 2018-01-30 20:27:53.000000000 -0500 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1996, 2004, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - - -/** - * The Holder for {@code Principal}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A container class for values of type {@code Principal} - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code Principal} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code PrincipalHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myPrincipalHolder} is an instance of {@code PrincipalHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myPrincipalHolder.value}. - * - * @since JDK1.2 - * @deprecated Deprecated by CORBA 2.2. - */ -@Deprecated -public final class PrincipalHolder implements Streamable { - /** - * The {@code Principal} value held by this {@code PrincipalHolder} - * object. - */ - public Principal value; - - /** - * Constructs a new {@code PrincipalHolder} object with its - * {@code value} field initialized to {@code null}. - */ - public PrincipalHolder() { - } - - /** - * Constructs a new {@code PrincipalHolder} object with its - * {@code value} field initialized to the given - * {@code Principal} object. - * @param initial the {@code Principal} with which to initialize - * the {@code value} field of the newly-created - * {@code PrincipalHolder} object - */ - public PrincipalHolder(Principal initial) { - value = initial; - } - - public void _read(InputStream input) { - value = input.read_Principal(); - } - - public void _write(OutputStream output) { - output.write_Principal(value); - } - - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_Principal); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/REBIND.java 2018-01-30 20:27:54.000000000 -0500 +++ /dev/null 2018-01-30 20:27:54.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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 org.omg.CORBA; - -/** - * REBIND is raised when the current effective RebindPolicy, - * has a value of NO_REBIND or NO_RECONNECT and an invocation on a bound - * object reference results in a LocateReply message with status - * OBJECT_FORWARD or a Reply message with status LOCATION_FORWARD. - * This exception is also raised if the current effective RebindPolicy has - * a value of NO_RECONNECT and a connection must be reopened. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since J2SE 1.5 - */ - -public final class REBIND extends SystemException { - - /** - * Constructs an REBIND exception with - * minor code set to 0 and CompletionStatus set to COMPLETED_NO. - */ - public REBIND() { - this(""); - } - - /** - * Constructs an REBIND exception with the - * specified message. - * - * @param detailMessage string containing a detailed message. - */ - public REBIND(String detailMessage) { - this(detailMessage, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an REBIND exception with the - * specified minor code and completion status. - * - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public REBIND(int minorCode, - CompletionStatus completionStatus) { - this("", minorCode, completionStatus); - } - - /** - * Constructs an REBIND exception with the - * specified message, minor code, and completion status. - * - * @param detailMessage string containing a detailed message. - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public REBIND(String detailMessage, - int minorCode, - CompletionStatus completionStatus) { - super(detailMessage, minorCode, completionStatus); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/RepositoryIdHelper.java 2018-01-30 20:27:54.000000000 -0500 +++ /dev/null 2018-01-30 20:27:54.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** - * The Helper for {@code RepositoryId}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- * - * org/omg/CORBA/RepositoryIdHelper.java - * Generated by the IDL-to-Java compiler (portable), version "3.0" - * from ir.idl - * 03 June 1999 11:33:43 o'clock GMT+00:00 - */ - -abstract public class RepositoryIdHelper -{ - private static String _id = "IDL:omg.org/CORBA/RepositoryId:1.0"; - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/Request.java 2018-01-30 20:27:55.000000000 -0500 +++ /dev/null 2018-01-30 20:27:55.000000000 -0500 @@ -1,301 +0,0 @@ -/* - * Copyright (c) 1996, 1999, 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 org.omg.CORBA; - -/** - * An object containing the information necessary for - * invoking a method. This class is - * the cornerstone of the ORB Dynamic - * Invocation Interface (DII), which allows dynamic creation and - * invocation of requests. - * A server cannot tell the difference between a client - * invocation using a client stub and a request using the DII. - *

- * A Request object consists of: - *

    - *
  • the name of the operation to be invoked - *
  • an NVList containing arguments for the operation.
    - * Each item in the list is a NamedValue object, which has three - * parts: - *
      - *
    1. the name of the argument - *
    2. the value of the argument (as an Any object) - *
    3. the argument mode flag indicating whether the argument is - * for input, output, or both - *
    - *
- *

- * Request objects may also contain additional information, - * depending on how an operation was defined in the original IDL - * interface definition. For example, where appropriate, they may contain - * a NamedValue object to hold the return value or exception, - * a context, a list of possible exceptions, and a list of - * context strings that need to be resolved. - *

- * New Request objects are created using one of the - * create_request methods in the Object class. - * In other words, a create_request method is performed on the - * object which is to be invoked. - * - * @see org.omg.CORBA.NamedValue - * - */ - -public abstract class Request { - - /** - * Retrieves the the target object reference. - * - * @return the object reference that points to the - * object implementation for the method - * to be invoked - */ - - public abstract org.omg.CORBA.Object target(); - - /** - * Retrieves the name of the method to be invoked. - * - * @return the name of the method to be invoked - */ - - public abstract String operation(); - - /** - * Retrieves the NVList object containing the arguments - * to the method being invoked. The elements in the list are - * NamedValue objects, with each one describing an argument - * to the method. - * - * @return the NVList object containing the arguments - * for the method - * - */ - - public abstract NVList arguments(); - - /** - * Retrieves the NamedValue object containing the return - * value for the method. - * - * @return the NamedValue object containing the result - * of the method - */ - - public abstract NamedValue result(); - - /** - * Retrieves the Environment object for this request. - * It contains the exception that the method being invoked has - * thrown (after the invocation returns). - * - * - * @return the Environment object for this request - */ - - public abstract Environment env(); - - /** - * Retrieves the ExceptionList object for this request. - * This list contains TypeCode objects describing the - * exceptions that may be thrown by the method being invoked. - * - * @return the ExceptionList object describing the exceptions - * that may be thrown by the method being invoked - */ - - public abstract ExceptionList exceptions(); - - /** - * Retrieves the ContextList object for this request. - * This list contains context Strings that need to - * be resolved and sent with the invocation. - * - * - * @return the list of context strings whose values - * need to be resolved and sent with the - * invocation. - */ - - public abstract ContextList contexts(); - - /** - * Retrieves the Context object for this request. - * This is a list of properties giving information about the - * client, the environment, or the circumstances of this request. - * - * @return the Context object that is to be used - * to resolve any context strings whose - * values need to be sent with the invocation - */ - - public abstract Context ctx(); - - /** - * Sets this request's Context object to the one given. - * - * @param c the new Context object to be used for - * resolving context strings - */ - - public abstract void ctx(Context c); - - - /** - * Creates an input argument and adds it to this Request - * object. - * - * @return an Any object that contains the - * value and typecode for the input argument added - */ - - public abstract Any add_in_arg(); - - /** - * Creates an input argument with the given name and adds it to - * this Request object. - * - * @param name the name of the argument being added - * @return an Any object that contains the - * value and typecode for the input argument added - */ - - public abstract Any add_named_in_arg(String name); - - /** - * Adds an input/output argument to this Request object. - * - * @return an Any object that contains the - * value and typecode for the input/output argument added - */ - - public abstract Any add_inout_arg(); - - /** - * Adds an input/output argument with the given name to this - * Request object. - * - * @param name the name of the argument being added - * @return an Any object that contains the - * value and typecode for the input/output argument added - */ - - public abstract Any add_named_inout_arg(String name); - - - /** - * Adds an output argument to this Request object. - * - * @return an Any object that contains the - * value and typecode for the output argument added - */ - - public abstract Any add_out_arg(); - - /** - * Adds an output argument with the given name to this - * Request object. - * - * @param name the name of the argument being added - * @return an Any object that contains the - * value and typecode for the output argument added - */ - - public abstract Any add_named_out_arg(String name); - - /** - * Sets the typecode for the return - * value of the method. - * - * @param tc the TypeCode object containing type information - * for the return value - */ - - public abstract void set_return_type(TypeCode tc); - - /** - * Returns the Any object that contains the value for the - * result of the method. - * - * @return an Any object containing the value and - * typecode for the return value - */ - - public abstract Any return_value(); - - /** - * Makes a synchronous invocation using the - * information in the Request object. Exception information is - * placed into the Request object's environment object. - */ - - public abstract void invoke(); - - /** - * Makes a oneway invocation on the - * request. In other words, it does not expect or wait for a - * response. Note that this can be used even if the operation was - * not declared as oneway in the IDL declaration. No response or - * exception information is returned. - */ - - public abstract void send_oneway(); - - /** - * Makes an asynchronous invocation on - * the request. In other words, it does not wait for a response before it - * returns to the user. The user can then later use the methods - * poll_response and get_response to get - * the result or exception information for the invocation. - */ - - public abstract void send_deferred(); - - /** - * Allows the user to determine - * whether a response has been received for the invocation triggered - * earlier with the send_deferred method. - * - * @return true if the method response has - * been received; false otherwise - */ - - public abstract boolean poll_response(); - - /** - * Allows the user to access the - * response for the invocation triggered earlier with the - * send_deferred method. - * - * @exception WrongTransaction if the method get_response was invoked - * from a different transaction's scope than the one from which the - * request was originally sent. See the OMG Transaction Service specification - * for details. - */ - - public abstract void get_response() throws WrongTransaction; - -}; --- old/src/java.corba/share/classes/org/omg/CORBA/ServerRequest.java 2018-01-30 20:27:56.000000000 -0500 +++ /dev/null 2018-01-30 20:27:56.000000000 -0500 @@ -1,314 +0,0 @@ -/* - * Copyright (c) 1996, 2015, 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 org.omg.CORBA; - -/** - * An object that captures the explicit state of a request - * for the Dynamic Skeleton Interface (DSI). This class, the - * cornerstone of the DSI, is analogous to the Request - * object in the DII. - *

- * The ORB is responsible for creating this embodiment of a request, - * and delivering it to a Dynamic Implementation Routine (DIR). - * A dynamic servant (a DIR) is created by implementing the - * DynamicImplementation class, - * which has a single invoke method. This method accepts a - * ServerRequest object. - * - * The abstract class ServerRequest defines - * methods for accessing the - * method name, the arguments and the context of the request, as - * well as methods for setting the result of the request either as a - * return value or an exception.

- * - * A subtlety with accessing the arguments of the request is that the - * DIR needs to provide type information about the - * expected arguments, since there is no compiled information about - * these. This information is provided through an NVList, - * which is a list of NamedValue objects. - * Each NamedValue object - * contains an Any object, which in turn - * has a TypeCode object representing the type - * of the argument.

- * - * Similarly, type information needs to be provided for the response, - * for either the expected result or for an exception, so the methods - * result and except take an Any - * object as a parameter. - * - * @see org.omg.CORBA.DynamicImplementation - * @see org.omg.CORBA.NVList - * @see org.omg.CORBA.NamedValue - * - */ - -public abstract class ServerRequest { - - /** - * Retrieves the name of the operation being - * invoked. According to OMG IDL's rules, these names must be unique - * among all operations supported by this object's "most-derived" - * interface. Note that the operation names for getting and setting - * attributes are _get_<attribute_name> - * and _set_<attribute_name>, - * respectively. - * - * @return the name of the operation to be invoked - * @deprecated use operation() - */ - @Deprecated - public String op_name() - { - return operation(); - } - - - /** - * Throws an org.omg.CORBA.NO_IMPLEMENT exception. - *

- * Retrieves the name of the operation being - * invoked. According to OMG IDL's rules, these names must be unique - * among all operations supported by this object's "most-derived" - * interface. Note that the operation names for getting and setting - * attributes are _get_<attribute_name> - * and _set_<attribute_name>, - * respectively. - * - * @return the name of the operation to be invoked - * @see CORBA - * package comments for unimplemented features - */ - public String operation() - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - /** - * Specifies method parameter types and retrieves "in" and "inout" - * argument values. - *

- * Note that this method is deprecated; use the method - * arguments in its place. - *

- * Unless it calls the method set_exception, - * the DIR must call this method exactly once, even if the - * method signature contains no parameters. Once the method - * arguments or set_exception - * has been called, calling arguments on the same - * ServerRequest object - * will result in a BAD_INV_ORDER system exception. - * The DIR must pass in to the method arguments - * an NVList initialized with TypeCodes and Flags - * describing the parameter types for the operation, in the order in which - * they appear in the IDL specification (left to right). A - * potentially-different NVList will be returned from - * arguments, with the - * "in" and "inout" argument values supplied. If it does not call - * the method set_exception, - * the DIR must supply the returned NVList with return - * values for any "out" arguments before returning, and may also change - * the return values for any "inout" arguments. - * - * @param params the arguments of the method, in the - * form of an NVList object - * @deprecated use the method arguments - */ - @Deprecated - public void params(NVList params) - { - arguments(params); - } - - /** - * Specifies method parameter types and retrieves "in" and "inout" - * argument values. - * Unless it calls the method set_exception, - * the DIR must call this method exactly once, even if the - * method signature contains no parameters. Once the method - * arguments or set_exception - * has been called, calling arguments on the same - * ServerRequest object - * will result in a BAD_INV_ORDER system exception. - * The DIR must pass in to the method arguments - * an NVList initialized with TypeCodes and Flags - * describing the parameter types for the operation, in the order in which - * they appear in the IDL specification (left to right). A - * potentially-different NVList will be returned from - * arguments, with the - * "in" and "inout" argument values supplied. If it does not call - * the method set_exception, - * the DIR must supply the returned NVList with return - * values for any "out" arguments before returning, and it may also change - * the return values for any "inout" arguments. - * - * @param args the arguments of the method, in the - * form of an NVList - * @see CORBA - * package comments for unimplemented features - */ - public void arguments(org.omg.CORBA.NVList args) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - - /** - * Specifies any return value for the call. - *

- * Note that this method is deprecated; use the method - * set_result in its place. - *

- * Unless the method - * set_exception is called, if the invoked method - * has a non-void result type, the method set_result - * must be called exactly once before the DIR returns. - * If the operation has a void result type, the method - * set_result may optionally be - * called once with an Any object whose type is - * tk_void. Calling the method set_result before - * the method arguments has been called or after - * the method set_result or set_exception has been - * called will result in a BAD_INV_ORDER exception. Calling the method - * set_result without having previously called - * the method ctx when the IDL operation contains a - * context expression, or when the NVList passed to arguments did not - * describe all parameters passed by the client, may result in a MARSHAL - * system exception. - * - * @param any an Any object containing the return value to be set - * @deprecated use the method set_result - */ - @Deprecated - public void result(Any any) - { - set_result(any); - } - - - /** - * Throws an org.omg.CORBA.NO_IMPLEMENT exception. - *

- * Specifies any return value for the call. Unless the method - * set_exception is called, if the invoked method - * has a non-void result type, the method set_result - * must be called exactly once before the DIR returns. - * If the operation has a void result type, the method - * set_result may optionally be - * called once with an Any object whose type is - * tk_void. Calling the method set_result before - * the method arguments has been called or after - * the method set_result or set_exception has been - * called will result in a BAD_INV_ORDER exception. Calling the method - * set_result without having previously called - * the method ctx when the IDL operation contains a - * context expression, or when the NVList passed to arguments did not - * describe all parameters passed by the client, may result in a MARSHAL - * system exception. - * - * @param any an Any object containing the return value to be set - * @see CORBA - * package comments for unimplemented features - */ - public void set_result(org.omg.CORBA.Any any) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - /** - * The DIR may call set_exception at any time to return an exception to the - * client. The Any passed to set_exception must contain either a system - * exception or a user exception specified in the raises expression - * of the invoked operation's IDL definition. Passing in an Any that does - * not - * contain an exception will result in a BAD_PARAM system exception. Passing - * in an unlisted user exception will result in either the DIR receiving a - * BAD_PARAM system exception or in the client receiving an - * UNKNOWN system exception. - * - * @param any the Any object containing the exception - * @deprecated use set_exception() - */ - @Deprecated - public void except(Any any) - { - set_exception(any); - } - - /** - * Throws an org.omg.CORBA.NO_IMPLEMENT exception. - *

- * Returns the given exception to the client. This method - * is invoked by the DIR, which may call it at any time. - * The Any object passed to this method must - * contain either a system - * exception or one of the user exceptions specified in the - * invoked operation's IDL definition. Passing in an - * Any object that does not contain an exception - * will cause a BAD_PARAM system exception to be thrown. Passing - * in an unlisted user exception will result in either the DIR receiving a - * BAD_PARAM system exception or in the client receiving an - * UNKNOWN system exception. - * - * @param any the Any object containing the exception - * @exception BAD_PARAM if the given Any object does not - * contain an exception or the exception is an - * unlisted user exception - * @exception UNKNOWN if the given exception is an unlisted - * user exception and the DIR did not - * receive a BAD_PARAM exception - * @see CORBA - * package comments for unimplemented features - */ - public void set_exception(Any any) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Returns the context information specified in IDL for the operation - * when the operation is not an attribute access and the operation's IDL - * definition contains a context expression; otherwise it returns - * a nil Context reference. Calling the method - * ctx before the method arguments has - * been called or after the method ctx, - * set_result, or set_exception - * has been called will result in a - * BAD_INV_ORDER system exception. - * - * @return the context object that is to be used - * to resolve any context strings whose - * values need to be sent with the invocation. - * @exception BAD_INV_ORDER if (1) the method ctx is called - * before the method arguments or - * (2) the method ctx is called - * after calling set_result or - * set_exception - */ - public abstract Context ctx(); - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ServiceDetail.java 2018-01-30 20:27:56.000000000 -0500 +++ /dev/null 2018-01-30 20:27:56.000000000 -0500 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - -/** - * An object that represents an ORB service: its service_detail_type - * field contains the type of the ORB service, and its service_detail - * field contains a description of the ORB service. - - * - * @author RIP Team - */ -public final class ServiceDetail implements org.omg.CORBA.portable.IDLEntity -{ - /** - * The type of the ORB service that this ServiceDetail - * object represents. - */ - public int service_detail_type; - - /** - * The data describing the ORB service that this ServiceDetail - * object represents. - */ - public byte[] service_detail; - - /** - * Constructs a ServiceDetail object with 0 for the type of - * ORB service and an empty description. - */ - public ServiceDetail() { } - - /** - * Constructs a ServiceDetail object with the given - * ORB service type and the given description. - * - * @param service_detail_type an int specifying the type of - * ORB service - * @param service_detail a byte array describing the ORB service - */ - public ServiceDetail(int service_detail_type, byte[] service_detail) { - this.service_detail_type = service_detail_type; - this.service_detail = service_detail; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ServiceDetailHelper.java 2018-01-30 20:27:57.000000000 -0500 +++ /dev/null 2018-01-30 20:27:57.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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. - */ - - /** - * The Helper for {@code ServiceDetail}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- */ - -package org.omg.CORBA; - - -public abstract class ServiceDetailHelper { - - public static void write(org.omg.CORBA.portable.OutputStream out, org.omg.CORBA.ServiceDetail that) { - out.write_ulong(that.service_detail_type); - { - out.write_long(that.service_detail.length); - out.write_octet_array(that.service_detail, 0, that.service_detail.length); - } - } - public static org.omg.CORBA.ServiceDetail read(org.omg.CORBA.portable.InputStream in) { - org.omg.CORBA.ServiceDetail that = new org.omg.CORBA.ServiceDetail(); - that.service_detail_type = in.read_ulong(); - { - int __length = in.read_long(); - that.service_detail = new byte[__length]; - in.read_octet_array(that.service_detail, 0, that.service_detail.length); - } - return that; - } - public static org.omg.CORBA.ServiceDetail extract(org.omg.CORBA.Any a) { - org.omg.CORBA.portable.InputStream in = a.create_input_stream(); - return read(in); - } - public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.ServiceDetail that) { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); - write(out, that); - a.read_value(out.create_input_stream(), type()); - } - private static org.omg.CORBA.TypeCode _tc; - synchronized public static org.omg.CORBA.TypeCode type() { - int _memberCount = 2; - org.omg.CORBA.StructMember[] _members = null; - if (_tc == null) { - _members= new org.omg.CORBA.StructMember[2]; - _members[0] = new org.omg.CORBA.StructMember( - "service_detail_type", - org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong), - null); - - _members[1] = new org.omg.CORBA.StructMember( - "service_detail", - org.omg.CORBA.ORB.init().create_sequence_tc(0, org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_octet)), - null); - _tc = org.omg.CORBA.ORB.init().create_struct_tc(id(), "ServiceDetail", _members); - } - return _tc; - } - public static String id() { - return "IDL:omg.org/CORBA/ServiceDetail:1.0"; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ServiceInformation.java 2018-01-30 20:27:57.000000000 -0500 +++ /dev/null 2018-01-30 20:27:58.000000000 -0500 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - - -/** - * An IDL struct in the CORBA module that - * stores information about a CORBA service available in the - * ORB implementation and is obtained from the {@code ORB.get_service_information} - * method. - */ -public final class ServiceInformation implements org.omg.CORBA.portable.IDLEntity -{ - /** Array of ints representing service options. - */ - public int[] service_options; - - /** Array of ServiceDetails giving more details about the service. - */ - public org.omg.CORBA.ServiceDetail[] service_details; - - /** Constructs a ServiceInformation object with empty service_options - * and service_details. - */ - public ServiceInformation() { } - - /** Constructs a ServiceInformation object with the given service_options - * and service_details. - * @param __service_options An array of ints describing the service options. - * @param __service_details An array of ServiceDetails describing the service - * details. - */ - public ServiceInformation(int[] __service_options, - org.omg.CORBA.ServiceDetail[] __service_details) - { - service_options = __service_options; - service_details = __service_details; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHelper.java 2018-01-30 20:27:58.000000000 -0500 +++ /dev/null 2018-01-30 20:27:58.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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. - */ - - /** - * The Helper for {@code ServiceInformation}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- */ - -package org.omg.CORBA; - - -public abstract class ServiceInformationHelper { - - public static void write(org.omg.CORBA.portable.OutputStream out, org.omg.CORBA.ServiceInformation that) - { - out.write_long(that.service_options.length); - out.write_ulong_array(that.service_options, 0, that.service_options.length); - out.write_long(that.service_details.length); - for (int i = 0 ; i < that.service_details.length ; i += 1) { - org.omg.CORBA.ServiceDetailHelper.write(out, that.service_details[i]); - } - } - - public static org.omg.CORBA.ServiceInformation read(org.omg.CORBA.portable.InputStream in) { - org.omg.CORBA.ServiceInformation that = new org.omg.CORBA.ServiceInformation(); - { - int __length = in.read_long(); - that.service_options = new int[__length]; - in.read_ulong_array(that.service_options, 0, that.service_options.length); - } - { - int __length = in.read_long(); - that.service_details = new org.omg.CORBA.ServiceDetail[__length]; - for (int __index = 0 ; __index < that.service_details.length ; __index += 1) { - that.service_details[__index] = org.omg.CORBA.ServiceDetailHelper.read(in); - } - } - return that; - } - public static org.omg.CORBA.ServiceInformation extract(org.omg.CORBA.Any a) { - org.omg.CORBA.portable.InputStream in = a.create_input_stream(); - return read(in); - } - public static void insert(org.omg.CORBA.Any a, org.omg.CORBA.ServiceInformation that) { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream(); - write(out, that); - a.read_value(out.create_input_stream(), type()); - } - private static org.omg.CORBA.TypeCode _tc; - synchronized public static org.omg.CORBA.TypeCode type() { - int _memberCount = 2; - org.omg.CORBA.StructMember[] _members = null; - if (_tc == null) { - _members= new org.omg.CORBA.StructMember[2]; - _members[0] = new org.omg.CORBA.StructMember( - "service_options", - org.omg.CORBA.ORB.init().create_sequence_tc(0, org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong)), - null); - - _members[1] = new org.omg.CORBA.StructMember( - "service_details", - org.omg.CORBA.ORB.init().create_sequence_tc(0, org.omg.CORBA.ServiceDetailHelper.type()), - null); - _tc = org.omg.CORBA.ORB.init().create_struct_tc(id(), "ServiceInformation", _members); - } - return _tc; - } - public static String id() { - return "IDL:omg.org/CORBA/ServiceInformation:1.0"; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHolder.java 2018-01-30 20:27:59.000000000 -0500 +++ /dev/null 2018-01-30 20:27:59.000000000 -0500 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - -/** - * The Holder for {@code ServiceInformation}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code ServiceInformation} object - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code xxx} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code ServiceInformationHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myServiceInformationHolder} is an instance of {@code ServiceInformationHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myServiceInformationHolder.value}. - */ -public final class ServiceInformationHolder - implements org.omg.CORBA.portable.Streamable { - - /** - * The {@code ServiceInformation} value held by this - * {@code ServiceInformationHolder} object in its {@code value} field. - */ - public ServiceInformation value; - - /** - * Constructs a new {@code ServiceInformationHolder} object with its - * {@code value} field initialized to null. - */ - public ServiceInformationHolder() { - this(null); - } - - /** - * Constructs a new {@code ServiceInformationHolder} object with its - * {@code value} field initialized to the given - * {@code ServiceInformation} object. - * - * @param arg the {@code ServiceInformation} object with which to initialize - * the {@code value} field of the newly-created - * {@code ServiceInformationHolder} object - */ - public ServiceInformationHolder(org.omg.CORBA.ServiceInformation arg) { - value = arg; - } - - - /** - * Marshals the value in this {@code ServiceInformationHolder} object's - * {@code value} field to the output stream {@code out}. - * - * @param out the {@code OutputStream} object that will contain - * the CDR formatted data - */ - public void _write(org.omg.CORBA.portable.OutputStream out) { - org.omg.CORBA.ServiceInformationHelper.write(out, value); - } - - /** - * Reads unmarshalled data from the input stream {@code in} and assigns it to - * the {@code value} field in this {@code ServiceInformationHolder} object. - * - * @param in the {@code InputStream} object containing CDR - * formatted data from the wire - */ - public void _read(org.omg.CORBA.portable.InputStream in) { - value = org.omg.CORBA.ServiceInformationHelper.read(in); - } - - /** - * Retrieves the {@code TypeCode} object that corresponds - * to the value held in this {@code ServiceInformationHolder} object's - * {@code value} field. - * - * @return the type code for the value held in this {@code ServiceInformationHolder} - * object - */ - public org.omg.CORBA.TypeCode _type() { - return org.omg.CORBA.ServiceInformationHelper.type(); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/SetOverrideType.java 2018-01-30 20:28:00.000000000 -0500 +++ /dev/null 2018-01-30 20:28:00.000000000 -0500 @@ -1,122 +0,0 @@ -/* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package org.omg.CORBA; - -/** - * The mapping of a CORBA enum tagging - * SET_OVERRIDE and ADD_OVERRIDE, which - * indicate whether policies should replace the - * existing policies of an Object or be added to them. - *

- * The method {@link org.omg.CORBA.Object#_set_policy_override} takes - * either SetOverrideType.SET_OVERRIDE or - * SetOverrideType.ADD_OVERRIDE as its second argument. - * The method _set_policy_override - * creates a new Object initialized with the - * Policy objects supplied as the first argument. If the - * second argument is ADD_OVERRIDE, the new policies - * are added to those of the Object instance that is - * calling the _set_policy_override method. If - * SET_OVERRIDE is given instead, the existing policies - * are replaced with the given ones. - * - * @author OMG - * @since JDK1.2 - */ - -public class SetOverrideType implements org.omg.CORBA.portable.IDLEntity { - - /** - * The int constant for the enum value SET_OVERRIDE. - */ - public static final int _SET_OVERRIDE = 0; - - /** - * The int constant for the enum value ADD_OVERRIDE. - */ - public static final int _ADD_OVERRIDE = 1; - - /** - * The SetOverrideType constant for the enum value SET_OVERRIDE. - */ - public static final SetOverrideType SET_OVERRIDE = new SetOverrideType(_SET_OVERRIDE); - - /** - * The SetOverrideType constant for the enum value ADD_OVERRIDE. - */ - public static final SetOverrideType ADD_OVERRIDE = new SetOverrideType(_ADD_OVERRIDE); - - /** - * Retrieves the value of this SetOverrideType instance. - * - * @return the int for this SetOverrideType instance. - */ - public int value() { - return _value; - } - - /** - * Converts the given int to the corresponding - * SetOverrideType instance. - * - * @param i the int to convert; must be either - * SetOverrideType._SET_OVERRIDE or - * SetOverrideType._ADD_OVERRIDE - * @return the SetOverrideType instance whose value - * matches the given int - * @exception BAD_PARAM if the given int does not - * match the value of - * any SetOverrideType instance - */ - public static SetOverrideType from_int(int i) - { - switch (i) { - case _SET_OVERRIDE: - return SET_OVERRIDE; - case _ADD_OVERRIDE: - return ADD_OVERRIDE; - default: - throw new org.omg.CORBA.BAD_PARAM(); - } - } - - /** - * Constructs a SetOverrideType instance from an - * int. - * @param _value must be either SET_OVERRIDE or - * ADD_OVERRIDE - */ - protected SetOverrideType(int _value){ - this._value = _value; - } - - /** - * The field containing the value for this SetOverrideType - * object. - * - */ - private int _value; -} --- old/src/java.corba/share/classes/org/omg/CORBA/SetOverrideTypeHelper.java 2018-01-30 20:28:00.000000000 -0500 +++ /dev/null 2018-01-30 20:28:00.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code SetOverrideType}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/SetOverrideTypeHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* 03 June 1999 11:52:03 o'clock GMT+00:00 -*/ - -abstract public class SetOverrideTypeHelper -{ - private static String _id = "IDL:omg.org/CORBA/SetOverrideType:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.SetOverrideType that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.SetOverrideType extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_enum_tc (org.omg.CORBA.SetOverrideTypeHelper.id (), "SetOverrideType", new String[] { "SET_OVERRIDE", "ADD_OVERRIDE"} ); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.SetOverrideType read (org.omg.CORBA.portable.InputStream istream) - { - return org.omg.CORBA.SetOverrideType.from_int (istream.read_long ()); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.SetOverrideType value) - { - ostream.write_long (value.value ()); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java 2018-01-30 20:28:01.000000000 -0500 +++ /dev/null 2018-01-30 20:28:01.000000000 -0500 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1995, 2015, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code Short}. For more information on - * Holder files, see - * "Generated Files: Holder Files". - *

A Holder class for a {@code short} - * that is used to store "out" and "inout" parameters in IDL operations. - * If an IDL operation signature has an IDL {@code short} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code ShortHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myShortHolder} is an instance of {@code ShortHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myShortHolder.value}. - * - * @since JDK1.2 - */ -public final class ShortHolder implements Streamable { - - /** - * The {@code short} value held by this {@code ShortHolder} - * object. - */ - public short value; - - /** - * Constructs a new {@code ShortHolder} object with its - * {@code value} field initialized to {@code 0}. - */ - public ShortHolder() { - } - - /** - * Constructs a new {@code ShortHolder} object with its - * {@code value} field initialized to the given - * {@code short}. - * @param initial the {@code short} with which to initialize - * the {@code value} field of the newly-created - * {@code ShortHolder} object - */ - public ShortHolder(short initial) { - value = initial; - } - - /** - * Reads from {@code input} and initalizes the value in - * this {@code ShortHolder} object - * with the unmarshalled data. - * - * @param input the InputStream containing CDR formatted data from the wire. - */ - public void _read(InputStream input) { - value = input.read_short(); - } - - /** - * Marshals to {@code output} the value in - * this {@code ShortHolder} object. - * - * @param output the OutputStream which will contain the CDR formatted data. - */ - public void _write(OutputStream output) { - output.write_short(value); - } - - /** - * Returns the TypeCode corresponding to the value held in - * this {@code ShortHolder} object. - * - * @return the TypeCode of the value held in - * this {@code ShortHolder} object - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_short); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHelper.java 2018-01-30 20:28:02.000000000 -0500 +++ /dev/null 2018-01-30 20:28:02.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code ShortSeqHelper}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/ShortSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:36 o'clock GMT+00:00 -* -* The class definition has been modified to conform to the following -* OMG specifications : -*

-*/ - -public abstract class ShortSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ShortSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, short[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static short[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.ShortSeqHelper.id (), "ShortSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static short[] read (org.omg.CORBA.portable.InputStream istream) - { - short value[] = null; - int _len0 = istream.read_long (); - value = new short[_len0]; - istream.read_short_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, short[] value) - { - ostream.write_long (value.length); - ostream.write_short_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHolder.java 2018-01-30 20:28:02.000000000 -0500 +++ /dev/null 2018-01-30 20:28:02.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Holder for {@code ShortSeq}. For more information on -* Holder files, see -* "Generated Files: Holder Files".

-* org/omg/CORBA/ShortSeqHolder.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:36 o'clock GMT+00:00 -*/ - -public final class ShortSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public short value[] = null; - - public ShortSeqHolder () - { - } - - public ShortSeqHolder (short[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.ShortSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.ShortSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.ShortSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/StringHolder.java 2018-01-30 20:28:03.000000000 -0500 +++ /dev/null 2018-01-30 20:28:03.000000000 -0500 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 1995, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code String}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code String} - * that is used to store "out" and "inout" parameters in IDL operations. - * If an IDL operation signature has an IDL {@code string} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code StringHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myStringHolder} is an instance of {@code StringHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myStringHolder.value}. - * - * @since JDK1.2 - */ -public final class StringHolder implements Streamable { - - /** - * The {@code String} value held by this {@code StringHolder} - * object. - */ - public String value; - - /** - * Constructs a new {@code StringHolder} object with its - * {@code value} field initialized to {@code null}. - */ - public StringHolder() { - } - - /** - * Constructs a new {@code StringHolder} object with its - * {@code value} field initialized to the given - * {@code String}. - * @param initial the {@code String} with which to initialize - * the {@code value} field of the newly-created - * {@code StringHolder} object - */ - public StringHolder(String initial) { - value = initial; - } - - /** - * Reads the unmarshalled data from {@code input} and assigns it to - * the {@code value} field of this {@code StringHolder} object. - * - * @param input the InputStream containing CDR formatted data from the wire. - */ - public void _read(InputStream input) { - value = input.read_string(); - } - - /** - * Marshals the value held by this {@code StringHolder} object - * to the output stream {@code output}. - * - * @param output the OutputStream which will contain the CDR formatted data. - */ - public void _write(OutputStream output) { - output.write_string(value); - } - - /** - * Retrieves the {@code TypeCode} object that corresponds to - * the value held in this {@code StringHolder} object. - * - * @return the type code of the value held in this {@code StringHolder} - * object - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_string); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/StringValueHelper.java 2018-01-30 20:28:04.000000000 -0500 +++ /dev/null 2018-01-30 20:28:04.000000000 -0500 @@ -1,138 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA; - -/** -* The Helper for {@code StringValue}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/StringValueHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from orb.idl -* 31 May 1999 22:27:30 o'clock GMT+00:00 -* -* The class definition has been modified to conform to the following -* OMG specifications : -*

-*/ - -public class StringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper -{ - private static String _id = "IDL:omg.org/CORBA/StringValue:1.0"; - - private static StringValueHelper _instance = new StringValueHelper (); - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "StringValue", __typeCode); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) { - throw new org.omg.CORBA.BAD_PARAM(); } - return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance); - } - - public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream) - { - String tmp; - tmp = istream.read_string (); - return (java.io.Serializable) tmp; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) { - throw new org.omg.CORBA.BAD_PARAM(); } - ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance); - } - - public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value) - { - if (!(value instanceof String)) { - throw new org.omg.CORBA.MARSHAL(); } - String valueType = (String) value; - ostream.write_string (valueType); - } - - public String get_id () - { - return _id; - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/StructMember.java 2018-01-30 20:28:04.000000000 -0500 +++ /dev/null 2018-01-30 20:28:04.000000000 -0500 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 1997, 2001, 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. - */ -/* - * File: ./org/omg/CORBA/StructMember.java - * From: ./ir.idl - * Date: Fri Aug 28 16:03:31 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - */ - -package org.omg.CORBA; - -/** - * Describes a member of an IDL struct in the - * Interface Repository, including - * the name of the struct member, the type of - * the struct member, and - * the typedef that represents the IDL type of the - * struct member - * described the struct member object. - */ -public final class StructMember implements org.omg.CORBA.portable.IDLEntity { - - // instance variables - - /** - * The name of the struct member described by - * this StructMember object. - * @serial - */ - public String name; - - /** - * The type of the struct member described by - * this StructMember object. - * @serial - */ - public org.omg.CORBA.TypeCode type; - - /** - * The typedef that represents the IDL type of the struct member described by - * this StructMember object. - * @serial - */ - public org.omg.CORBA.IDLType type_def; - // constructors - - /** - * Constructs a default StructMember object. - */ - public StructMember() { } - - /** - * Constructs a StructMember object initialized with the - * given values. - * @param __name a String object with the name of the struct - * member - * @param __type a TypeCode object describing the type of the struct - * member - * @param __type_def an IDLType object representing the IDL type - * of the struct member - */ - public StructMember(String __name, org.omg.CORBA.TypeCode __type, org.omg.CORBA.IDLType __type_def) { - name = __name; - type = __type; - type_def = __type_def; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/StructMemberHelper.java 2018-01-30 20:28:05.000000000 -0500 +++ /dev/null 2018-01-30 20:28:05.000000000 -0500 @@ -1,117 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code StructMember}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/StructMemberHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* 03 June 1999 11:33:43 o'clock GMT+00:00 -*/ - -abstract public class StructMemberHelper -{ - private static String _id = "IDL:omg.org/CORBA/StructMember:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.StructMember that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.StructMember extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [3]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[1] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.IDLTypeHelper.type (); - _members0[2] = new org.omg.CORBA.StructMember ( - "type_def", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.CORBA.StructMemberHelper.id (), "StructMember", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.StructMember read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.StructMember value = new org.omg.CORBA.StructMember (); - value.name = istream.read_string (); - value.type = istream.read_TypeCode (); - value.type_def = org.omg.CORBA.IDLTypeHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.StructMember value) - { - ostream.write_string (value.name); - ostream.write_TypeCode (value.type); - org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/SystemException.java 2018-01-30 20:28:06.000000000 -0500 +++ /dev/null 2018-01-30 20:28:06.000000000 -0500 @@ -1,119 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; -import java.util.*; -import org.omg.CORBA.OMGVMCID; -import com.sun.corba.se.impl.util.SUNVMCID; - -/** - * The root class for all CORBA standard exceptions. These exceptions - * may be thrown as a result of any CORBA operation invocation and may - * also be returned by many standard CORBA API methods. The standard - * exceptions contain a minor code, allowing more detailed specification, and a - * completion status. This class is subclassed to - * generate each one of the set of standard ORB exceptions. - * SystemException extends - * java.lang.RuntimeException; thus none of the - * SystemException exceptions need to be - * declared in signatures of the Java methods mapped from operations in - * IDL interfaces. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public abstract class SystemException extends java.lang.RuntimeException { - - /** - * The CORBA Exception minor code. - * @serial - */ - public int minor; - - /** - * The status of the operation that threw this exception. - * @serial - */ - public CompletionStatus completed; - - /** - * Constructs a SystemException exception with the specified detail - * message, minor code, and completion status. - * A detail message is a String that describes this particular exception. - * @param reason the String containing a detail message - * @param minor the minor code - * @param completed the completion status - */ - protected SystemException(String reason, int minor, CompletionStatus completed) { - super(reason); - this.minor = minor; - this.completed = completed; - } - - /** - * Converts this exception to a representative string. - */ - public String toString() { - // The fully qualified exception class name - String result = super.toString(); - - // The vmcid part - int vmcid = minor & 0xFFFFF000; - switch (vmcid) { - case OMGVMCID.value: - result += " vmcid: OMG"; - break; - case SUNVMCID.value: - result += " vmcid: SUN"; - break; - default: - result += " vmcid: 0x" + Integer.toHexString(vmcid); - break; - } - - // The minor code part - int mc = minor & 0x00000FFF; - result += " minor code: " + mc; - - // The completion status part - switch (completed.value()) { - case CompletionStatus._COMPLETED_YES: - result += " completed: Yes"; - break; - case CompletionStatus._COMPLETED_NO: - result += " completed: No"; - break; - case CompletionStatus._COMPLETED_MAYBE: - default: - result += " completed: Maybe"; - break; - } - return result; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TCKind.java 2018-01-30 20:28:07.000000000 -0500 +++ /dev/null 2018-01-30 20:28:07.000000000 -0500 @@ -1,554 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 org.omg.CORBA; - - -/** - * The Java mapping of the IDL enum TCKind, which - * specifies the kind of a TypeCode object. There is - * one kind for each primitive and essential IDL data type. - *

- * The class TCKind consists of: - *

    - *
  • a set of int constants, one for each - * kind of IDL data type. These int constants - * make it possible to use a switch statement. - *
  • a set of TCKind constants, one for each - * kind of IDL data type. The value field for - * each TCKind instance is initialized with - * the int constant that corresponds with - * the IDL data type that the instance represents. - *
  • the method from_intfor converting - * an int to its - * corresponding TCKind instance - *

    Example: - *

    - *      org.omg.CORBA.TCKind k = org.omg.CORBA.TCKind.from_int(
    - *                         org.omg.CORBA.TCKind._tk_string);
    - * 
    - * The variable k represents the TCKind - * instance for the IDL type string, which is - * tk_string. - * - *
  • the method value for accessing the - * _value field of a TCKind constant - *

    Example: - *

    - *   int i = org.omg.CORBA.TCKind.tk_char.value();
    - * 
    - * The variable i represents 9, the value for the - * IDL data type char. - *
- *

The value field of a TCKind instance - * is the CDR encoding used for a TypeCode object in - * an IIOP message. - */ - -public class TCKind { - - /** - * The int constant for a null IDL data type. - */ - public static final int _tk_null = 0; - - /** - * The int constant for the IDL data type void. - */ - public static final int _tk_void = 1; - - /** - * The int constant for the IDL data type short. - */ - public static final int _tk_short = 2; - - /** - * The int constant for the IDL data type long. - */ - public static final int _tk_long = 3; - - /** - * The int constant for the IDL data type ushort. - */ - public static final int _tk_ushort = 4; - - /** - * The int constant for the IDL data type ulong. - */ - public static final int _tk_ulong = 5; - - /** - * The int constant for the IDL data type float. - */ - public static final int _tk_float = 6; - - /** - * The int constant for the IDL data type double. - */ - public static final int _tk_double = 7; - - /** - * The int constant for the IDL data type boolean. - */ - public static final int _tk_boolean = 8; - - /** - * The int constant for the IDL data type char. - */ - public static final int _tk_char = 9; - - /** - * The int constant for the IDL data type octet. - */ - public static final int _tk_octet = 10; - - /** - * The int constant for the IDL data type any. - */ - public static final int _tk_any = 11; - - /** - * The int constant for the IDL data type TypeCode. - */ - public static final int _tk_TypeCode = 12; - - /** - * The int constant for the IDL data type Principal. - */ - public static final int _tk_Principal = 13; - - /** - * The int constant for the IDL data type objref. - */ - public static final int _tk_objref = 14; - - /** - * The int constant for the IDL data type struct. - */ - public static final int _tk_struct = 15; - - /** - * The int constant for the IDL data type union. - */ - public static final int _tk_union = 16; - - /** - * The int constant for the IDL data type enum. - */ - public static final int _tk_enum = 17; - - /** - * The int constant for the IDL data type string. - */ - public static final int _tk_string = 18; - - /** - * The int constant for the IDL data type sequence. - */ - public static final int _tk_sequence = 19; - - /** - * The int constant for the IDL data type array. - */ - public static final int _tk_array = 20; - - /** - * The int constant for the IDL data type alias. - */ - public static final int _tk_alias = 21; - - /** - * The int constant for the IDL data type except. - */ - public static final int _tk_except = 22; - - /** - * The int constant for the IDL data type longlong. - */ - public static final int _tk_longlong = 23; - - /** - * The int constant for the IDL data type ulonglong. - */ - public static final int _tk_ulonglong = 24; - - /** - * The int constant for the IDL data type longdouble. - */ - public static final int _tk_longdouble = 25; - - /** - * The int constant for the IDL data type wchar. - */ - public static final int _tk_wchar = 26; - - /** - * The int constant for the IDL data type wstring. - */ - public static final int _tk_wstring = 27; - - /** - * The int constant for the IDL data type fixed. - */ - public static final int _tk_fixed = 28; - - /** - * The int constant for the IDL data type value. - */ - public static final int _tk_value = 29; // orbos 98-01-18: Objects By Value - - /** - * The int constant for the IDL data type value_box. - */ - public static final int _tk_value_box = 30; // orbos 98-01-18: Objects By Value - - /** - * The int constant for the IDL data type native. - */ - public static final int _tk_native = 31; // Verify - - /** - * The int constant for the IDL data type abstract interface. - */ - public static final int _tk_abstract_interface = 32; - - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_null}. - */ - public static final TCKind tk_null = new TCKind(_tk_null); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_void}. - */ - public static final TCKind tk_void = new TCKind(_tk_void); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_short}. - */ - public static final TCKind tk_short = new TCKind(_tk_short); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_long}. - */ - public static final TCKind tk_long = new TCKind(_tk_long); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_ushort}. - */ - public static final TCKind tk_ushort = new TCKind(_tk_ushort); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_ulong}. - */ - public static final TCKind tk_ulong = new TCKind(_tk_ulong); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_float}. - */ - public static final TCKind tk_float = new TCKind(_tk_float); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_double}. - */ - public static final TCKind tk_double = new TCKind(_tk_double); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_boolean}. - */ - public static final TCKind tk_boolean = new TCKind(_tk_boolean); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_char}. - */ - public static final TCKind tk_char = new TCKind(_tk_char); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_octet}. - */ - public static final TCKind tk_octet = new TCKind(_tk_octet); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_any}. - */ - public static final TCKind tk_any = new TCKind(_tk_any); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_TypeCode}. - */ - public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_Principal}. - */ - public static final TCKind tk_Principal = new TCKind(_tk_Principal); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_objref}. - */ - public static final TCKind tk_objref = new TCKind(_tk_objref); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_struct}. - */ - public static final TCKind tk_struct = new TCKind(_tk_struct); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_union}. - */ - public static final TCKind tk_union = new TCKind(_tk_union); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_enum}. - */ - public static final TCKind tk_enum = new TCKind(_tk_enum); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_string}. - */ - public static final TCKind tk_string = new TCKind(_tk_string); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_sequence}. - */ - public static final TCKind tk_sequence = new TCKind(_tk_sequence); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_array}. - */ - public static final TCKind tk_array = new TCKind(_tk_array); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_alias}. - */ - public static final TCKind tk_alias = new TCKind(_tk_alias); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_except}. - */ - public static final TCKind tk_except = new TCKind(_tk_except); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_longlong}. - */ - public static final TCKind tk_longlong = new TCKind(_tk_longlong); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_ulonglong}. - */ - public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_longdouble}. - */ - public static final TCKind tk_longdouble = new TCKind(_tk_longdouble); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_wchar}. - */ - public static final TCKind tk_wchar = new TCKind(_tk_wchar); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_wstring}. - */ - public static final TCKind tk_wstring = new TCKind(_tk_wstring); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_fixed}. - */ - public static final TCKind tk_fixed = new TCKind(_tk_fixed); - - // orbos 98-01-18: Objects By Value -- begin - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_value}. - */ - public static final TCKind tk_value = new TCKind(_tk_value); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_value_box}. - */ - public static final TCKind tk_value_box = new TCKind(_tk_value_box); - // orbos 98-01-18: Objects By Value -- end - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_native}. - */ - public static final TCKind tk_native = new TCKind(_tk_native); - - /** - * The TCKind constant whose value field is - * initialized with {@code TCKind._tk_abstract_interface}. - */ - public static final TCKind tk_abstract_interface = new TCKind(_tk_abstract_interface); - - - - - /** - * Retrieves the value of this TCKind instance. - * - * @return the int that represents the kind of - * IDL data type for this TCKind instance - */ - public int value() { - return _value; - } - - /** - * Converts the given int to the corresponding - * TCKind instance. - * - * @param i the int to convert. It must be one of - * the int constants in the class - * TCKind. - * @return the TCKind instance whose value - * field matches the given int - * @exception BAD_PARAM if the given int does not - * match the _value field of - * any TCKind instance - */ - public static TCKind from_int(int i) { - switch (i) { - case _tk_null: - return tk_null; - case _tk_void: - return tk_void; - case _tk_short: - return tk_short; - case _tk_long: - return tk_long; - case _tk_ushort: - return tk_ushort; - case _tk_ulong: - return tk_ulong; - case _tk_float: - return tk_float; - case _tk_double: - return tk_double; - case _tk_boolean: - return tk_boolean; - case _tk_char: - return tk_char; - case _tk_octet: - return tk_octet; - case _tk_any: - return tk_any; - case _tk_TypeCode: - return tk_TypeCode; - case _tk_Principal: - return tk_Principal; - case _tk_objref: - return tk_objref; - case _tk_struct: - return tk_struct; - case _tk_union: - return tk_union; - case _tk_enum: - return tk_enum; - case _tk_string: - return tk_string; - case _tk_sequence: - return tk_sequence; - case _tk_array: - return tk_array; - case _tk_alias: - return tk_alias; - case _tk_except: - return tk_except; - case _tk_longlong: - return tk_longlong; - case _tk_ulonglong: - return tk_ulonglong; - case _tk_longdouble: - return tk_longdouble; - case _tk_wchar: - return tk_wchar; - case _tk_wstring: - return tk_wstring; - case _tk_fixed: - return tk_fixed; - case _tk_value: // orbos 98-01-18: Objects By Value - return tk_value; - case _tk_value_box: // orbos 98-01-18: Objects By Value - return tk_value_box; - case _tk_native: - return tk_native; - case _tk_abstract_interface: - return tk_abstract_interface; - default: - throw new org.omg.CORBA.BAD_PARAM(); - } - } - - - /** - * Creates a new TCKind instance initialized with the given - * int. - * @deprecated Do not use this constructor as this method should be private - * according to the OMG specification. Use {@link #from_int(int)} instead. - * - * @param _value the int to convert. It must be one of - * the int constants in the class - * TCKind. - */ - @Deprecated - protected TCKind(int _value){ - this._value = _value; - } - private int _value; -} --- old/src/java.corba/share/classes/org/omg/CORBA/TIMEOUT.java 2018-01-30 20:28:07.000000000 -0500 +++ /dev/null 2018-01-30 20:28:08.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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 org.omg.CORBA; - -/** - * TIMEOUT is raised when no delivery has been made and the - * specified time-to-live period has been exceeded. It is a standard system - * exception because time-to-live QoS can be applied to any invocation. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @since J2SE 1.5 - */ - -public final class TIMEOUT extends SystemException { - - /** - * Constructs an TIMEOUT exception with - * minor code set to 0 and CompletionStatus set to COMPLETED_NO. - */ - public TIMEOUT() { - this(""); - } - - /** - * Constructs an TIMEOUT exception with the - * specified message. - * - * @param detailMessage string containing a detailed message. - */ - public TIMEOUT(String detailMessage) { - this(detailMessage, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an TIMEOUT exception with the - * specified minor code and completion status. - * - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public TIMEOUT(int minorCode, - CompletionStatus completionStatus) { - this("", minorCode, completionStatus); - } - - /** - * Constructs an TIMEOUT exception with the - * specified message, minor code, and completion status. - * - * @param detailMessage string containing a detailed message. - * @param minorCode minor code. - * @param completionStatus completion status. - */ - public TIMEOUT(String detailMessage, - int minorCode, - CompletionStatus completionStatus) { - super(detailMessage, minorCode, completionStatus); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_MODE.java 2018-01-30 20:28:08.000000000 -0500 +++ /dev/null 2018-01-30 20:28:08.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2000, 2017, 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 org.omg.CORBA; - -/** - * The CORBA TRANSACTION_MODE exception is thrown - * by the client ORB if it detects a mismatch between the - * InvocationPolicy in the IOR and the chosen invocation path - * (i.e, direct or routed invocation). - * It contains a minor code, which gives information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * The OMG CORBA core 2.4 specification has details. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class TRANSACTION_MODE extends SystemException { - /** - * Constructs a TRANSACTION_MODE exception with a default - * minor code of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public TRANSACTION_MODE() { - this(""); - } - - /** - * Constructs a TRANSACTION_MODE exception with the specified - * description message, a minor code of 0, and a completion state of - * COMPLETED_NO. - * @param s the String containing a detail message - */ - public TRANSACTION_MODE(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a TRANSACTION_MODE exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public TRANSACTION_MODE(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a TRANSACTION_MODE exception with the specified - * description message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public TRANSACTION_MODE(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_REQUIRED.java 2018-01-30 20:28:09.000000000 -0500 +++ /dev/null 2018-01-30 20:28:09.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 org.omg.CORBA; - -/** - * Exception indicates that the request carried a null transaction context, - * but an active transaction is required.

- * It contains a minor code, which gives information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * The OMG Transaction Service specfication has details. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class TRANSACTION_REQUIRED extends SystemException { - /** - * Constructs a TRANSACTION_REQUIRED exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public TRANSACTION_REQUIRED() { - this(""); - } - - /** - * Constructs a TRANSACTION_REQUIRED exception with the specified - * description message, a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public TRANSACTION_REQUIRED(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a TRANSACTION_REQUIRED exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public TRANSACTION_REQUIRED(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a TRANSACTION_REQUIRED exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public TRANSACTION_REQUIRED(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java 2018-01-30 20:28:10.000000000 -0500 +++ /dev/null 2018-01-30 20:28:10.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown when the transaction associated with the request has - * already been rolled back or marked to roll back. Thus, the requested - * operation either could not be performed or was not performed because - * further computation on behalf of the transaction would be fruitless.

- * See the OMG Transaction - * Service specification for details. - * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class TRANSACTION_ROLLEDBACK extends SystemException { - /** - * Constructs a TRANSACTION_ROLLEDBACK exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public TRANSACTION_ROLLEDBACK() { - this(""); - } - - /** - * Constructs a TRANSACTION_ROLLEDBACK exception with the - * specified description message, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public TRANSACTION_ROLLEDBACK(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a TRANSACTION_ROLLEDBACK exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public TRANSACTION_ROLLEDBACK(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a TRANSACTION_ROLLEDBACK exception with the - * specified description message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public TRANSACTION_ROLLEDBACK(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java 2018-01-30 20:28:11.000000000 -0500 +++ /dev/null 2018-01-30 20:28:11.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2000, 2017, 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 org.omg.CORBA; - -/** - * The CORBA TRANSACTION_UNAVAILABLE exception is thrown - * by the ORB when it cannot process a transaction service context because - * its connection to the Transaction Service has been abnormally terminated. - * - * It contains a minor code, which gives information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * The OMG CORBA core 2.4 specification has details. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class TRANSACTION_UNAVAILABLE extends SystemException { - /** - * Constructs a TRANSACTION_UNAVAILABLE exception - * with a default minor code of 0, a completion state of - * CompletionStatus.COMPLETED_NO, and a null description. - */ - public TRANSACTION_UNAVAILABLE() { - this(""); - } - - /** - * Constructs a TRANSACTION_UNAVAILABLE exception with the - * specifieddescription message, a minor code of 0, and a completion state - * of COMPLETED_NO. - * @param s the String containing a detail message - */ - public TRANSACTION_UNAVAILABLE(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a TRANSACTION_UNAVAILABLE exception with the - * specified minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public TRANSACTION_UNAVAILABLE(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a TRANSACTION_UNAVAILABLE exception with the - * specified description message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public TRANSACTION_UNAVAILABLE(String s, int minor, - CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TRANSIENT.java 2018-01-30 20:28:11.000000000 -0500 +++ /dev/null 2018-01-30 20:28:11.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * Exception thrown when the ORB attempted to reach an object and failed. - * It is not an indication that an object does not exist. Instead, it simply - * means that no further determination of an object's status was possible - * because it could not be reached. This exception is raised if an attempt - * to establish a connection fails, for example, because the server or the - * implementation repository is down.

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class TRANSIENT extends SystemException { - /** - * Constructs a TRANSIENT exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public TRANSIENT() { - this(""); - } - - /** - * Constructs a TRANSIENT exception with the specified description message, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public TRANSIENT(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs a TRANSIENT exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public TRANSIENT(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs a TRANSIENT exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public TRANSIENT(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java 2018-01-30 20:28:12.000000000 -0500 +++ /dev/null 2018-01-30 20:28:12.000000000 -0500 @@ -1,516 +0,0 @@ -/* - * Copyright (c) 1996, 2015, 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 org.omg.CORBA; - -import org.omg.CORBA.TypeCodePackage.*; -import org.omg.CORBA.portable.IDLEntity; - -/** - * A container for information about a specific CORBA data - * type. - *

- * TypeCode objects are used: - *

    - *
  • in the Dynamic Invocation Interface -- to indicate the types - * of the actual arguments or the type of the return value.
    - * NamedValue objects are used to represent arguments and - * return values. One of their components is an Any - * object, which in turn has as one of its components a - * TypeCode object. - *
  • by an Interface Repository to represent the type specifications - * that are part of many OMG IDL declarations - *
- *

- * The representation of a TypeCode object is opaque, - * but abstractly, a TypeCode object consists of: - *

    - *
  • a kind field, which is set to an instance - * of the class TCKind - *
  • zero or more additional fields appropriate - * for the particular kind. For example, the - * TypeCode object - * describing the OMG IDL type 1ong has kind - * TCKind.tk_long and no additional fields. - * The TypeCode describing OMG IDL type - * sequence<boolean, 10> has a kind field - * with the value - * TCKind.tk_sequence and also fields with the values - * boolean and 10 for the - * type of sequence elements and the length of the sequence. - *
- * - * TypeCode objects can be obtained in various ways: - *
    - *
  1. from a call to the method Any.insert_X, where X is - * a basic IDL type. This method creates a TypeCode object - * for type X and assigns it to the Any object's - * type field. - *
  2. from invocations of methods in the ORB class - *

    For example, the following creates a TypeCode - * object for a string with a maximum of 30 characters: - *

    - *   org.omg.CORBA.TypeCode tcString = orb.create_string_tc(30);
    - * 
    - *

    The following creates a TypeCode - * object for an array of five strings: - *

    - *   org.omg.CORBA.TypeCode tcArray = orb.create_array_tc(
    - *                                       5, TCKind.tk_string);
    - * 
    - *

    The following creates a TypeCode - * object for an interface named "Account": - *

    - *   org.omg.CORBA.TypeCode tcInterface = orb.create_interface_tc(
    - *                                                 "thisId", "Account");
    - * 
    - *
  3. as the return value from the _type method - * in Holder classes for user-defined - * IDL types. These Holder classes are generated - * by the idltojava compiler. - *
  4. from a CORBA Interface Repository - *
- *

- * Most of the methods in the class TypeCode - * are accessors, and the information contained in a TypeCode - * object is specific to a particular type. Therefore, methods - * must be invoked - * only on the kind of type codes to which they apply. If an - * accessor method - * tries to access information from an inappropriate kind of - * type code, it will throw - * the exception TypeCodePackage.BadKind. For example, - * if the method discriminator_type is called on anything - * other than a union, it will throw BadKind - * because only unions have a discriminator. - * The following list shows which methods apply to which kinds of - * type codes: - *

- * These methods may be invoked on all TypeCode kinds: - *

    - *
  • equal - *
  • kind - *
- *

- * These methods may be invoked on objref, struct, - * union, enum, - * alias, exception, value, - * value_box, native, - * and abstract_interface: - *

    - *
  • id - *
  • name - *
- *

- * These methods may be invoked on struct, - * union, enum, - * and exception: - *

    - *
  • member_count - *
  • member_name - *
- *

- * These methods may be invoked on struct, - * union, and exception: - *

    - *
  • member_type(int index) - *
- *

- * These methods may be invoked on union: - *

    - *
  • member_label - *
  • discriminator_type - *
  • default_index - *
- *

- * These methods may be invoked on string, - * sequence, and array: - *

    - *
  • length - *
- *

- * These methods may be invoked on alias, - * sequence, array, and value_box: - *

    - *
  • content_type - *
- *

- * Unlike other CORBA pseudo-objects, TypeCode - * objects can be passed as general IDL parameters.

- * The methods parameter and param_count, - * which are deprecated, are not mapped.

- * - * Java IDL extends the CORBA specification to allow all operations permitted - * on a struct TypeCode to be permitted - * on an exception TypeCode as well. - */ -public abstract class TypeCode implements IDLEntity { - - /** - * Compares this TypeCode object with the given one, - * testing for equality. TypeCode objects are equal if - * they are interchangeable and give identical results when - * TypeCode operations are applied to them. - * - * @param tc the TypeCode object to compare against - * @return true if the type codes are equal; - * false otherwise - */ - public abstract boolean equal(TypeCode tc); - - /** - * Tests to see if the given TypeCode object is - * equivalent to this TypeCode object. - * - * - * @param tc the typecode to compare with this typecode - * - * @return true if the given typecode is equivalent to - * this typecode; false otherwise - * - */ - public abstract boolean equivalent(TypeCode tc); - - /** - * Strips out all optional name and member name fields, - * but leaves all alias typecodes intact. - * @return a TypeCode object with optional name and - * member name fields stripped out, except for alias typecodes, - * which are left intact - * @see CORBA package - * comments for unimplemented features - */ - public abstract TypeCode get_compact_typecode(); - - - /** - * Retrieves the kind of this TypeCode object. - * The kind of a type code determines which TypeCode - * methods may legally be invoked on it. - *

- * The method kind may be invoked on any - * TypeCode object. - * - * @return the TCKind instance indicating the - * value of the kind field of this - * TypeCode object - */ - public abstract TCKind kind(); - - /** - * Retrieves the RepositoryId globally identifying the type - * of this TypeCode object. - *

- * The method id can be invoked on object reference, - * structure, union, enumeration, alias, exception, valuetype, - * boxed valuetype, native, and abstract interface type codes. - * Object reference, exception, valuetype, boxed valuetype, - * native, and abstract interface TypeCode objects - * always have a RepositoryId. - * Structure, union, enumeration, and alias TypeCode objects - * obtained from the Interface Repository or the method - * ORB.create_operation_list - * also always have a RepositoryId. If there is no RepositoryId, the - * method can return an empty string. - * - * @return the RepositoryId for this TypeCode object - * or an empty string if there is no RepositoryID - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on an inappropriate kind ofTypeCode - * object - */ - public abstract String id() throws BadKind; - - /** - * Retrieves the simple name identifying this TypeCode - * object within its - * enclosing scope. Since names are local to a Repository, the - * name returned from a TypeCode object - * may not match the name of the - * type in any particular Repository, and may even be an empty - * string. - *

- * The method name can be invoked on object reference, - * structure, union, enumeration, alias, exception, valuetype, - * boxed valuetype, native, and abstract interface - * TypeCode objects. - * - * @return the name identifying this TypeCode object - * or an empty string - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on an inappropriate kind ofTypeCode - * object - */ - public abstract String name() throws BadKind; - - /** - * Retrieves the number of members in the type described by - * this TypeCode object. - *

- * The method member_count can be invoked on - * structure, union, and enumeration TypeCode objects. - * Java IDL extends the CORBA specification to allow this method to - * operate on exceptions as well. - * - * @return the number of members constituting the type described - * by this TypeCode object - * - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on an inappropriate kind of TypeCode - * object - */ - public abstract int member_count() throws BadKind; - - /** - * Retrieves the simple name of the member identified by - * the given index. Since names are local to a - * Repository, the name returned from a TypeCode object - * may not match the name of the member in any particular - * Repository, and may even be an empty string. - *

- * The method member_name can be invoked on structure, union, - * and enumeration TypeCode objects. - * Java IDL extends the CORBA specification to allow this method to - * operate on exceptions as well. - * - * @param index index of the member for which a name is being reqested - * @return simple name of the member identified by the - * index or an empty string - * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is equal - * to or greater than - * the number of members constituting the type - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on an inappropriate kind of TypeCode - * object - */ - public abstract String member_name(int index) - throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; - - /** - * Retrieves the TypeCode object describing the type - * of the member identified by the given index. - *

- * The method member_type can be invoked on structure - * and union TypeCode objects. - * Java IDL extends the CORBA specification to allow this method to - * operate on exceptions as well. - * - * @param index index of the member for which type information - * is begin requested - * @return the TypeCode object describing the - * member at the given index - * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is - * equal to or greater than - * the number of members constituting the type - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on an inappropriate kind of TypeCode - * object - */ - public abstract TypeCode member_type(int index) - throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; - - /** - * Retrieves the label of the union member - * identified by the given index. For the default member, - * the label is the zero octet. - *

- * The method member_label can only be invoked on union - * TypeCode objects. - * - * @param index index of the union member for which the - * label is being requested - * @return an Any object describing the label of - * the requested union member or the zero octet for - * the default member - * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is - * equal to or greater than - * the number of members constituting the union - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on a non-union TypeCode - * object - */ - public abstract Any member_label(int index) - throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds; - - /** - * Returns a TypeCode object describing - * all non-default member labels. - * The method discriminator_type can be invoked only - * on union TypeCode objects. - * - * @return the TypeCode object describing - * the non-default member labels - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on a non-union TypeCode - * object - */ - public abstract TypeCode discriminator_type() - throws BadKind; - - /** - * Returns the index of the - * default member, or -1 if there is no default member. - *

- * The method default_index can be invoked only on union - * TypeCode objects. - * - * @return the index of the default member, or -1 if - * there is no default member - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on a non-union TypeCode - * object - */ - public abstract int default_index() throws BadKind; - - /** - * Returns the number of elements in the type described by - * this TypeCode object. - * For strings and sequences, it returns the - * bound, with zero indicating an unbounded string or sequence. - * For arrays, it returns the number of elements in the array. - *

- * The method length can be invoked on string, sequence, and - * array TypeCode objects. - * - * @return the bound for strings and sequences, or the - * number of elements for arrays - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on an inappropriate kind of TypeCode - * object - */ - public abstract int length() throws BadKind; - - /** - * Returns the TypeCode object representing the - * IDL type for the members of the object described by this - * TypeCode object. - * For sequences and arrays, it returns the - * element type. For aliases, it returns the original type. Note - * that multidimensional arrays are represented by nesting - * TypeCode objects, one per dimension. - * For boxed valuetypes, it returns the boxed type. - *

- * The method content_type can be invoked on sequence, array, - * alias, and boxed valuetype TypeCode objects. - * - * @return a TypeCode object representing - * the element type for sequences and arrays, the - * original type for aliases, or the - * boxed type for boxed valuetypes. - * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method - * is invoked on an inappropriate kind of TypeCode - * object - */ - public abstract TypeCode content_type() throws BadKind; - - - /** - * Returns the number of digits in the fixed type described by this - * TypeCode object. For example, the typecode for - * the number 3000.275d could be fixed<7,3>, where - * 7 is the precision and 3 is the scale. - * - * @return the total number of digits - * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method - * is invoked on an inappropriate kind of TypeCode - * object - * - */ - public abstract short fixed_digits() throws BadKind ; - - /** - * Returns the scale of the fixed type described by this - * TypeCode object. A positive number indicates the - * number of digits to the right of the decimal point. - * For example, the number 3000d could have the - * typecode fixed<4,0>, where the first number is - * the precision and the second number is the scale. - * A negative number is also possible and adds zeroes to the - * left of the decimal point. In this case, fixed<1,-3>, - * could be the typecode for the number 3000d. - * - * @return the scale of the fixed type that this - * TypeCode object describes - * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method - * is invoked on an inappropriate kind of TypeCode - * object - */ - public abstract short fixed_scale() throws BadKind ; - - /** - * Returns the constant that indicates the visibility of the member - * at the given index. - * - * This operation can only be invoked on non-boxed value - * TypeCode objects. - * - * @param index an int indicating the index into the - * value - * @return either PRIVATE_MEMBER.value or - * PUBLIC_MEMBER.value - * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method - * is invoked on a non-value type TypeCode - * object - * @throws org.omg.CORBA.TypeCodePackage.Bounds - * if the given index is out of bounds - * @see CORBA package - * comments for unimplemented features - */ - abstract public short member_visibility(int index) - throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds ; - - /** - * Returns a constant indicating the modifier of the value type - * that this TypeCode object describes. The constant - * returned must be one of the following: VM_NONE.value, - * VM_ABSTRACT.value, VM_CUSTOM.value, - * or VM_TRUNCATABLE.value, - * - * @return a constant describing the value type - * that this TypeCode object describes - * @throws org.omg.CORBA.TypeCodePackage.BadKind - * if this method - * is invoked on a non-value type TypeCode - * object - * @see CORBA package - * comments for unimplemented features - */ - abstract public short type_modifier() throws BadKind ; - - /** - * Returns the TypeCode object that describes the concrete base type - * of the value type that this TypeCode object describes. - * Returns null if it doesn't have a concrete base type. - * - * @return the TypeCode object that describes the - * concrete base type of the value type - * that this TypeCode object describes - * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method - * is invoked on a non-boxed value type TypeCode object - * @see CORBA package - * comments for unimplemented features - */ - abstract public TypeCode concrete_base_type() throws BadKind ; -} --- old/src/java.corba/share/classes/org/omg/CORBA/TypeCodeHolder.java 2018-01-30 20:28:13.000000000 -0500 +++ /dev/null 2018-01-30 20:28:13.000000000 -0500 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 1996, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code TypeCode}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code TypeCode} object - * that is used to store "out" and "inout" parameters in IDL operations. - * If an IDL operation signature has an IDL {@code TypeCode} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code TypeCodeHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myTypeCodeHolder} is an instance of {@code TypeCodeHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myTypeCodeHolder.value}. - * - * @since JDK1.2 - */ -public final class TypeCodeHolder implements Streamable { - - /** - * The {@code TypeCode} value held by - * this {@code TypeCodeHolder} object. - */ - public TypeCode value; - - /** - * Constructs a new {@code TypeCodeHolder} object with its - * {@code value} field initialized to {@code null}. - */ - public TypeCodeHolder() { - } - - /** - * Constructs a new {@code TypeCodeHolder} object with its - * {@code value} field initialized to the given - * {@code TypeCode} object. - * @param initial the {@code TypeCode} object with which to initialize - * the {@code value} field of the newly-created - * {@code TypeCodeHolder} object - */ - public TypeCodeHolder(TypeCode initial) { - value = initial; - } - - /** - * Reads from {@code input} and initalizes the value in - * this {@code TypeCodeHolder} object - * with the unmarshalled data. - * - * @param input the InputStream containing CDR formatted data from the wire - */ - public void _read(InputStream input) { - value = input.read_TypeCode(); - } - - /** - * Marshals to {@code output} the value in - * this {@code TypeCodeHolder} object. - * - * @param output the OutputStream which will contain the CDR formatted data - */ - public void _write(OutputStream output) { - output.write_TypeCode(value); - } - - /** - * Returns the TypeCode corresponding to the value held in - * this {@code TypeCodeHolder} object. - * - * @return the TypeCode of the value held in - * this {@code TypeCodeHolder} object - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_TypeCode); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKind.java 2018-01-30 20:28:14.000000000 -0500 +++ /dev/null 2018-01-30 20:28:14.000000000 -0500 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1997, 1999, 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 org.omg.CORBA.TypeCodePackage; - -/** - * The exception BadKind is thrown when - * an inappropriate operation is invoked on a TypeCode object. For example, - * invoking the method discriminator_type() on an instance of - * TypeCode that does not represent an IDL union will cause the - * exception BadKind to be thrown. - * - * @see org.omg.CORBA.TypeCode - * @since JDK1.2 - */ - -public final class BadKind extends org.omg.CORBA.UserException { - /** - * Constructs a BadKind exception with no reason message. - */ - public BadKind() { - super(); - } - - /** - * Constructs a BadKind exception with the specified - * reason message. - * @param reason the String containing a reason message - */ - public BadKind(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKindHelper.java 2018-01-30 20:28:14.000000000 -0500 +++ /dev/null 2018-01-30 20:28:14.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2014, 2017, 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 org.omg.CORBA.TypeCodePackage; - - -/** - * This Helper class is used to facilitate the marshalling of - * {@code TypeCodePackage/BadKind}. - * For more information on Helper files, see - * - * "Generated Files: Helper Files". - */ - -abstract public class BadKindHelper -{ - private static String _id = "IDL:omg.org.CORBA/TypeCode/BadKind:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.TypeCodePackage.BadKind that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.TypeCodePackage.BadKind extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [0]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.TypeCodePackage.BadKindHelper.id (), "BadKind", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.TypeCodePackage.BadKind read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.TypeCodePackage.BadKind value = new org.omg.CORBA.TypeCodePackage.BadKind (); - // read and discard the repository ID - istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.TypeCodePackage.BadKind value) - { - // write the repository ID - ostream.write_string (id ()); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/Bounds.java 2018-01-30 20:28:15.000000000 -0500 +++ /dev/null 2018-01-30 20:28:15.000000000 -0500 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1997, 1999, 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 org.omg.CORBA.TypeCodePackage; - -/** - * Provides the TypeCode operations member_name(), - * member_type(), and member_label. - * These methods - * raise Bounds when the index parameter is greater than or equal - * to the number of members constituting the type. - * - * @since JDK1.2 - */ - -public final class Bounds extends org.omg.CORBA.UserException { - - /** - * Constructs a Bounds exception with no reason message. - */ - public Bounds() { - super(); - } - - /** - * Constructs a Bounds exception with the specified - * reason message. - * @param reason the String containing a reason message - */ - public Bounds(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BoundsHelper.java 2018-01-30 20:28:16.000000000 -0500 +++ /dev/null 2018-01-30 20:28:16.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2014, 2017, 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 org.omg.CORBA.TypeCodePackage; - - -/** - * This Helper class is used to facilitate the marshalling of - * {@code TypeCodePackage/Bounds}. - * For more information on Helper files, see - * - * "Generated Files: Helper Files". - */ - -abstract public class BoundsHelper -{ - private static String _id = "IDL:omg.org.CORBA/TypeCode/Bounds:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.TypeCodePackage.Bounds that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.TypeCodePackage.Bounds extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [0]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.TypeCodePackage.BoundsHelper.id (), "Bounds", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.TypeCodePackage.Bounds read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.TypeCodePackage.Bounds value = new org.omg.CORBA.TypeCodePackage.Bounds (); - // read and discard the repository ID - istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.TypeCodePackage.Bounds value) - { - // write the repository ID - ostream.write_string (id ()); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/package.html 2018-01-30 20:28:17.000000000 -0500 +++ /dev/null 2018-01-30 20:28:17.000000000 -0500 @@ -1,52 +0,0 @@ - - - - - - - -Provides the user-defined exceptions BadKind -and Bounds, which are thrown by methods in -in the class TypeCode. - - -

Related Documentation

- -For an overview, please see: - - - -@since JDK1.2 -@serial exclude - - --- old/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHelper.java 2018-01-30 20:28:17.000000000 -0500 +++ /dev/null 2018-01-30 20:28:17.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code ULongLongSeq}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/ULongLongSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:37 o'clock GMT+00:00 -* -* The class definition has been modified to conform to the following -* OMG specifications : -*

-*/ - -public abstract class ULongLongSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ULongLongSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, long[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static long[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.ULongLongSeqHelper.id (), "ULongLongSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static long[] read (org.omg.CORBA.portable.InputStream istream) - { - long value[] = null; - int _len0 = istream.read_long (); - value = new long[_len0]; - istream.read_ulonglong_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, long[] value) - { - ostream.write_long (value.length); - ostream.write_ulonglong_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHolder.java 2018-01-30 20:28:18.000000000 -0500 +++ /dev/null 2018-01-30 20:28:18.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Holder for {@code ULongLongSeq}. For more information on -* Holder files, see -* "Generated Files: Holder Files".

-* org/omg/CORBA/ULongLongSeqHolder.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:37 o'clock GMT+00:00 -*/ - -public final class ULongLongSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public long value[] = null; - - public ULongLongSeqHolder () - { - } - - public ULongLongSeqHolder (long[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.ULongLongSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.ULongLongSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.ULongLongSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHelper.java 2018-01-30 20:28:19.000000000 -0500 +++ /dev/null 2018-01-30 20:28:19.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code ULongSeq}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/ULongSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:36 o'clock GMT+00:00 -* -* The class definition has been modified to conform to the following -* OMG specifications : -*

-*/ - -public abstract class ULongSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/ULongSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, int[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static int[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.ULongSeqHelper.id (), "ULongSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static int[] read (org.omg.CORBA.portable.InputStream istream) - { - int value[] = null; - int _len0 = istream.read_long (); - value = new int[_len0]; - istream.read_ulong_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, int[] value) - { - ostream.write_long (value.length); - ostream.write_ulong_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHolder.java 2018-01-30 20:28:20.000000000 -0500 +++ /dev/null 2018-01-30 20:28:20.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Holder for {@code ULongSeq}. For more information on -* Holder files, see -* "Generated Files: Holder Files".

-* org/omg/CORBA/ULongSeqHolder.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:36 o'clock GMT+00:00 -*/ - -public final class ULongSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public int value[] = null; - - public ULongSeqHolder () - { - } - - public ULongSeqHolder (int[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.ULongSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.ULongSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.ULongSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/UNKNOWN.java 2018-01-30 20:28:20.000000000 -0500 +++ /dev/null 2018-01-30 20:28:20.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * This exception is raised if an operation implementation - * throws a non-CORBA exception (such as an exception - * specific to the implementation's programming language), - * or if an operation raises a user exception that does not - * appear in the operation's raises expression. UNKNOWN is - * also raised if the server returns a system exception that - * is unknown to the client. (This can happen if the server - * uses a later version of CORBA than the client and new system - * exceptions have been added to the later version.)

- * It contains a minor code, which gives more detailed information about - * what caused the exception, and a completion status. It may also contain - * a string describing the exception. - *

- * See the section {@extLink jidlexception_minorcodes Minor Code Meaning} - * to see the minor codes for this exception. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class UNKNOWN extends SystemException { - /** - * Constructs an UNKNOWN exception with a default minor code - * of 0, a completion state of CompletionStatus.COMPLETED_NO, - * and a null description. - */ - public UNKNOWN() { - this(""); - } - - /** - * Constructs an UNKNOWN exception with the specified description message, - * a minor code of 0, and a completion state of COMPLETED_NO. - * @param s the String containing a detail message - */ - public UNKNOWN(String s) { - this(s, 0, CompletionStatus.COMPLETED_NO); - } - - /** - * Constructs an UNKNOWN exception with the specified - * minor code and completion status. - * @param minor the minor code - * @param completed the completion status - */ - public UNKNOWN(int minor, CompletionStatus completed) { - this("", minor, completed); - } - - /** - * Constructs an UNKNOWN exception with the specified description - * message, minor code, and completion status. - * @param s the String containing a description message - * @param minor the minor code - * @param completed the completion status - */ - public UNKNOWN(String s, int minor, CompletionStatus completed) { - super(s, minor, completed); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY.java 2018-01-30 20:28:21.000000000 -0500 +++ /dev/null 2018-01-30 20:28:21.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - -/** - * One of the {@code PolicyErrorCode}s which would be filled if - * the requested {@code Policy} is understood to be valid by the - * ORB, but is not currently supported. - * - * @author rip-dev - */ -public interface UNSUPPORTED_POLICY { - /** - * The Error code for PolicyError exception. - */ - final short value = (short) (1L); -}; --- old/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java 2018-01-30 20:28:22.000000000 -0500 +++ /dev/null 2018-01-30 20:28:22.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1998, 2001, 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 org.omg.CORBA; - -/** - * A {@code PolicyErrorCode} which would be filled if the value - * requested for the {@code Policy} is of a - * valid type and within the valid range for that type, but this valid value - * is not currently supported. - * - * @author rip-dev - */ -public interface UNSUPPORTED_POLICY_VALUE { - /** - * The Error code for PolicyError exception. - */ - final short value = (short) (4L); -}; --- old/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHelper.java 2018-01-30 20:28:23.000000000 -0500 +++ /dev/null 2018-01-30 20:28:23.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code UShortSeq}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/UShortSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:36 o'clock GMT+00:00 -* -* The class definition has been modified to conform to the following -* OMG specifications : -*

-*/ - -public abstract class UShortSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/UShortSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, short[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static short[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.UShortSeqHelper.id (), "UShortSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static short[] read (org.omg.CORBA.portable.InputStream istream) - { - short value[] = null; - int _len0 = istream.read_long (); - value = new short[_len0]; - istream.read_ushort_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, short[] value) - { - ostream.write_long (value.length); - ostream.write_ushort_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHolder.java 2018-01-30 20:28:23.000000000 -0500 +++ /dev/null 2018-01-30 20:28:23.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Holder for {@code UShortSeq}. For more information on -* Holder files, see -* "Generated Files: Holder Files".

-* org/omg/CORBA/UShortSeqHolder.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:36 o'clock GMT+00:00 -*/ - -public final class UShortSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public short value[] = null; - - public UShortSeqHolder () - { - } - - public UShortSeqHolder (short[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.UShortSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.UShortSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.UShortSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/UnionMember.java 2018-01-30 20:28:24.000000000 -0500 +++ /dev/null 2018-01-30 20:28:24.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 1997, 2000, 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. - */ -/* - * File: ./org/omg/CORBA/UnionMember.java - * From: ./ir.idl - * Date: Fri Aug 28 16:03:31 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - */ - -package org.omg.CORBA; - -/** - * A description in the Interface Repository of a member of an IDL union. - */ -public final class UnionMember implements org.omg.CORBA.portable.IDLEntity { - // instance variables - - /** - * The name of the union member described by this - * UnionMember object. - * @serial - */ - public String name; - - /** - * The label of the union member described by this - * UnionMember object. - * @serial - */ - public org.omg.CORBA.Any label; - - /** - * The type of the union member described by this - * UnionMember object. - * @serial - */ - public org.omg.CORBA.TypeCode type; - - /** - * The typedef that represents the IDL type of the union member described by this - * UnionMember object. - * @serial - */ - public org.omg.CORBA.IDLType type_def; - - // constructors - - /** - * Constructs a new UnionMember object with its fields initialized - * to null. - */ - public UnionMember() { } - - /** - * Constructs a new UnionMember object with its fields initialized - * to the given values. - * - * @param __name a String object with the name of this - * UnionMember object - * @param __label an Any object with the label of this - * UnionMember object - * @param __type a TypeCode object describing the type of this - * UnionMember object - * @param __type_def an IDLType object that represents the - * IDL type of this UnionMember object - */ - public UnionMember(String __name, org.omg.CORBA.Any __label, org.omg.CORBA.TypeCode __type, org.omg.CORBA.IDLType __type_def) { - name = __name; - label = __label; - type = __type; - type_def = __type_def; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/UnionMemberHelper.java 2018-01-30 20:28:25.000000000 -0500 +++ /dev/null 2018-01-30 20:28:25.000000000 -0500 @@ -1,124 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code UnionMember}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/UnionMemberHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* 03 June 1999 11:33:43 o'clock GMT+00:00 -*/ - -abstract public class UnionMemberHelper -{ - private static String _id = "IDL:omg.org/CORBA/UnionMember:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.UnionMember that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.UnionMember extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [4]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any); - _members0[1] = new org.omg.CORBA.StructMember ( - "label", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[2] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.IDLTypeHelper.type (); - _members0[3] = new org.omg.CORBA.StructMember ( - "type_def", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.CORBA.UnionMemberHelper.id (), "UnionMember", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.UnionMember read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.UnionMember value = new org.omg.CORBA.UnionMember (); - value.name = istream.read_string (); - value.label = istream.read_any (); - value.type = istream.read_TypeCode (); - value.type_def = org.omg.CORBA.IDLTypeHelper.read (istream); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.UnionMember value) - { - ostream.write_string (value.name); - ostream.write_any (value.label); - ostream.write_TypeCode (value.type); - org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/UnknownUserException.java 2018-01-30 20:28:26.000000000 -0500 +++ /dev/null 2018-01-30 20:28:26.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 org.omg.CORBA; - -/** - * A class that contains user exceptions returned by the server. - * When the client uses the DII to make an invocation, any user exception - * returned from the server is enclosed in an Any object contained in the - * UnknownUserException object. This is available from the - * Environment object returned by the method Request.env. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- * @see Request - */ - -public final class UnknownUserException extends UserException { - - /** The Any instance that contains the actual user exception thrown - * by the server. - * @serial - */ - public Any except; - - /** - * Constructs an UnknownUserException object. - */ - public UnknownUserException() { - super(); - } - - /** - * Constructs an UnknownUserException object that contains the given - * Any object. - * - * @param a an Any object that contains a user exception returned - * by the server - */ - public UnknownUserException(Any a) { - super(); - except = a; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHelper.java 2018-01-30 20:28:26.000000000 -0500 +++ /dev/null 2018-01-30 20:28:26.000000000 -0500 @@ -1,106 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code UnknownUserException}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/UnknownUserExceptionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from CORBA.idl -* Thursday, August 24, 2000 5:52:22 PM PDT -*/ - -abstract public class UnknownUserExceptionHelper -{ - private static String _id = "IDL:omg.org/CORBA/UnknownUserException:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.UnknownUserException that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.UnknownUserException extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [1]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any); - _members0[0] = new org.omg.CORBA.StructMember ( - "except", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.UnknownUserExceptionHelper.id (), "UnknownUserException", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.UnknownUserException read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.UnknownUserException value = new org.omg.CORBA.UnknownUserException (); - // read and discard the repository ID - istream.read_string (); - value.except = istream.read_any (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.UnknownUserException value) - { - // write the repository ID - ostream.write_string (id ()); - ostream.write_any (value.except); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHolder.java 2018-01-30 20:28:27.000000000 -0500 +++ /dev/null 2018-01-30 20:28:27.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 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 org.omg.CORBA; - -/** -* The Holder for {@code UnknownUserException}. For more information on -* Holder files, see -* "Generated Files: Holder Files".

-* org/omg/CORBA/UnknownUserExceptionHolder.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from CORBA.idl -* Thursday, August 24, 2000 5:52:22 PM PDT -*/ - -public final class UnknownUserExceptionHolder implements org.omg.CORBA.portable.Streamable -{ - public org.omg.CORBA.UnknownUserException value = null; - - public UnknownUserExceptionHolder () - { - } - - public UnknownUserExceptionHolder (org.omg.CORBA.UnknownUserException initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.UnknownUserExceptionHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.UnknownUserExceptionHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.UnknownUserExceptionHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/UserException.java 2018-01-30 20:28:28.000000000 -0500 +++ /dev/null 2018-01-30 20:28:28.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1995, 2017, 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 org.omg.CORBA; - -/** - * The root class for CORBA IDL-defined user exceptions. - * All CORBA user exceptions are checked exceptions, which - * means that they need to - * be declared in method signatures. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ -public abstract class UserException extends java.lang.Exception implements org.omg.CORBA.portable.IDLEntity { - - /** - * Constructs a UserException object. - * This method is called only by subclasses. - */ - protected UserException() { - super(); - } - - /** - * Constructs a UserException object with a - * detail message. This method is called only by subclasses. - * - * @param reason a String object giving the reason for this - * exception - */ - protected UserException(String reason) { - super(reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/VM_ABSTRACT.java 2018-01-30 20:28:29.000000000 -0500 +++ /dev/null 2018-01-30 20:28:29.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA; - -/** Defines the code used to represent an Abstract interface in -* a typecode. -* This is one of the possible results of the type_modified -* method on the TypeCode interface. -* @see org.omg.CORBA.TypeCode -*/ -public interface VM_ABSTRACT { - /** The value representing an abstract interface value type in - * a typecode. - */ - final short value = (short) (2L); -} --- old/src/java.corba/share/classes/org/omg/CORBA/VM_CUSTOM.java 2018-01-30 20:28:29.000000000 -0500 +++ /dev/null 2018-01-30 20:28:29.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA; - -/** Defines the code used to represent a custom marshalled value type in -* a typecode. -* This is one of the possible results of the type_modifier -* method on the TypeCode interface. -* @see org.omg.CORBA.TypeCode -*/ -public interface VM_CUSTOM { - /** The value representing a custom marshalled value type in - * a typecode. - */ - final short value = (short) (1L); -} --- old/src/java.corba/share/classes/org/omg/CORBA/VM_NONE.java 2018-01-30 20:28:30.000000000 -0500 +++ /dev/null 2018-01-30 20:28:30.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA; - -/** - * Defines the code used to represent the one of the values of a value type - * in a typecode. - * - * @author OMG - * @see org.omg.CORBA.TypeCode - * @since JDK1.2 - */ - - -public interface VM_NONE { - /** - * The value representing the value type in a typecode as per - * CORBA 2.3 spec. - */ - final short value = (short) (0L); -} --- old/src/java.corba/share/classes/org/omg/CORBA/VM_TRUNCATABLE.java 2018-01-30 20:28:31.000000000 -0500 +++ /dev/null 2018-01-30 20:28:31.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA; - -/** Defines the code used to represent a truncatable value type in -* a typecode. A value type is truncatable if it inherits "safely" -* from another value type, which means it can be cast to a more -* general inherited type. -* This is one of the possible results of the type_modifier -* method on the TypeCode interface. -* @see org.omg.CORBA.TypeCode -*/ -public interface VM_TRUNCATABLE { - /** The value representing a truncatable value type in - * a typecode. - */ - final short value = (short) (3L); -} --- old/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHelper.java 2018-01-30 20:28:32.000000000 -0500 +++ /dev/null 2018-01-30 20:28:32.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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. - */ - - /** - * The Helper for {@code ValueBase}. For more information on - * Helper files, see - * "Generated Files: Helper Files".

- */ - -/* - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA; - -abstract public class ValueBaseHelper -{ - private static String _id = "IDL:omg.org/CORBA/ValueBase:1.0"; - - public static void insert (org.omg.CORBA.Any a, java.io.Serializable that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static java.io.Serializable extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (TCKind.tk_value); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static java.io.Serializable read (org.omg.CORBA.portable.InputStream istream) - { - return ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value) - { - ((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value (value); - } - - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHolder.java 2018-01-30 20:28:32.000000000 -0500 +++ /dev/null 2018-01-30 20:28:32.000000000 -0500 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - -import org.omg.CORBA.portable.Streamable; -import org.omg.CORBA.portable.InputStream; -import org.omg.CORBA.portable.OutputStream; - -/** - * The Holder for {@code ValueBase}. For more information on - * Holder files, see - * "Generated Files: Holder Files".

- * A Holder class for a {@code java.io.Serializable} - * that is used to store "out" and "inout" parameters in IDL methods. - * If an IDL method signature has an IDL {@code ValueBase} as an "out" - * or "inout" parameter, the programmer must pass an instance of - * {@code ValueBaseHolder} as the corresponding - * parameter in the method invocation; for "inout" parameters, the programmer - * must also fill the "in" value to be sent to the server. - * Before the method invocation returns, the ORB will fill in the - * value corresponding to the "out" value returned from the server. - *

- * If {@code myValueBaseHolder} is an instance of {@code ValueBaseHolder}, - * the value stored in its {@code value} field can be accessed with - * {@code myValueBaseHolder.value}. - * - */ -public final class ValueBaseHolder implements Streamable { - - /** - * The {@code java.io.Serializable} value held by this - * {@code ValueBaseHolder} object. - */ - public java.io.Serializable value; - - /** - * Constructs a new {@code ValueBaseHolder} object with its - * {@code value} field initialized to {@code 0}. - */ - public ValueBaseHolder() { - } - - /** - * Constructs a new {@code ValueBaseHolder} object with its - * {@code value} field initialized to the given - * {@code java.io.Serializable}. - * @param initial the {@code java.io.Serializable} with which to initialize - * the {@code value} field of the newly-created - * {@code ValueBaseHolder} object - */ - public ValueBaseHolder(java.io.Serializable initial) { - value = initial; - } - - /** - * Reads from {@code input} and initalizes the value in the Holder - * with the unmarshalled data. - * - * @param input the InputStream containing CDR formatted data from the wire - */ - public void _read(InputStream input) { - value = ((org.omg.CORBA_2_3.portable.InputStream)input).read_value(); - } - - /** - * Marshals to {@code output} the value in the Holder. - * - * @param output the OutputStream which will contain the CDR formatted data - */ - public void _write(OutputStream output) { - ((org.omg.CORBA_2_3.portable.OutputStream)output).write_value(value); - } - - /** - * Returns the {@code TypeCode} object - * corresponding to the value held in the Holder. - * - * @return the TypeCode of the value held in the holder - */ - public org.omg.CORBA.TypeCode _type() { - return ORB.init().get_primitive_tc(TCKind.tk_value); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/ValueMember.java 2018-01-30 20:28:33.000000000 -0500 +++ /dev/null 2018-01-30 20:28:33.000000000 -0500 @@ -1,121 +0,0 @@ -/* - * Copyright (c) 1998, 2000, 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. - */ -/* - * File: ./org/omg/CORBA/ValueMember.java - * From: ./ir.idl - * Date: Fri Aug 28 16:03:31 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - */ - -package org.omg.CORBA; - -/** - * A description in the Interface Repository of - * a member of a value object. - */ -public final class ValueMember implements org.omg.CORBA.portable.IDLEntity { - - // instance variables - - /** - * The name of the value member described by this - * ValueMember object. - * @serial - */ - public String name; - - /** - * The repository ID of the value member described by - * this ValueMember object; - * @serial - */ - public String id; - - /** - * The repository ID of the value in which this member - * is defined. - * @serial - */ - public String defined_in; - - /** - * The version of the value in which this member is defined. - * @serial - */ - public String version; - - /** - * The type of of this value member. - * @serial - */ - public org.omg.CORBA.TypeCode type; - - /** - * The typedef that represents the IDL type of the value - * member described by this ValueMember object. - * @serial - */ - public org.omg.CORBA.IDLType type_def; - - /** - * The type of access (public, private) for the value - * member described by this ValueMember object. - * @serial - */ - public short access; - // constructors - - /** - * Constructs a default ValueMember object. - */ - public ValueMember() { } - - /** - * Constructs a ValueMember object initialized with - * the given values. - * - *@param __name The name of the value member described by this - * ValueMember object. - *@param __id The repository ID of the value member described by - * this ValueMember object; - *@param __defined_in The repository ID of the value in which this member - * is defined. - *@param __version The version of the value in which this member is defined. - *@param __type The type of of this value member. - *@param __type_def The typedef that represents the IDL type of the value - * member described by this ValueMember object. - *@param __access The type of access (public, private) for the value - * member described by this ValueMember object. - */ - public ValueMember(String __name, String __id, String __defined_in, String __version, org.omg.CORBA.TypeCode __type, org.omg.CORBA.IDLType __type_def, short __access) { - name = __name; - id = __id; - defined_in = __defined_in; - version = __version; - type = __type; - type_def = __type_def; - access = __access; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/ValueMemberHelper.java 2018-01-30 20:28:34.000000000 -0500 +++ /dev/null 2018-01-30 20:28:34.000000000 -0500 @@ -1,149 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code ValueMember}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/ValueMemberHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* 03 June 1999 11:33:44 o'clock GMT+00:00 -*/ - -abstract public class ValueMemberHelper -{ - private static String _id = "IDL:omg.org/CORBA/ValueMember:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.ValueMember that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.ValueMember extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [7]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.IdentifierHelper.id (), "Identifier", _tcOf_members0); - _members0[0] = new org.omg.CORBA.StructMember ( - "name", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[1] = new org.omg.CORBA.StructMember ( - "id", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", _tcOf_members0); - _members0[2] = new org.omg.CORBA.StructMember ( - "defined_in", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_string_tc (0); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", _tcOf_members0); - _members0[3] = new org.omg.CORBA.StructMember ( - "version", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode); - _members0[4] = new org.omg.CORBA.StructMember ( - "type", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.IDLTypeHelper.type (); - _members0[5] = new org.omg.CORBA.StructMember ( - "type_def", - _tcOf_members0, - null); - _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.VisibilityHelper.id (), "Visibility", _tcOf_members0); - _members0[6] = new org.omg.CORBA.StructMember ( - "access", - _tcOf_members0, - null); - __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.CORBA.ValueMemberHelper.id (), "ValueMember", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.ValueMember read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.ValueMember value = new org.omg.CORBA.ValueMember (); - value.name = istream.read_string (); - value.id = istream.read_string (); - value.defined_in = istream.read_string (); - value.version = istream.read_string (); - value.type = istream.read_TypeCode (); - value.type_def = org.omg.CORBA.IDLTypeHelper.read (istream); - value.access = istream.read_short (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.ValueMember value) - { - ostream.write_string (value.name); - ostream.write_string (value.id); - ostream.write_string (value.defined_in); - ostream.write_string (value.version); - ostream.write_TypeCode (value.type); - org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def); - ostream.write_short (value.access); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/VersionSpecHelper.java 2018-01-30 20:28:35.000000000 -0500 +++ /dev/null 2018-01-30 20:28:35.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code VersionSpec}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/VersionSpecHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* 03 June 1999 11:33:43 o'clock GMT+00:00 -*/ - -abstract public class VersionSpecHelper -{ - private static String _id = "IDL:omg.org/CORBA/VersionSpec:1.0"; - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - String value = null; - value = istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - ostream.write_string (value); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/VisibilityHelper.java 2018-01-30 20:28:35.000000000 -0500 +++ /dev/null 2018-01-30 20:28:35.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code Visibility}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/VisibilityHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl -* 03 June 1999 11:33:44 o'clock GMT+00:00 -*/ - - -// orbos 98-01-18: Objects By Value -- begin -abstract public class VisibilityHelper -{ - private static String _id = "IDL:omg.org/CORBA/Visibility:1.0"; - - public static void insert (org.omg.CORBA.Any a, short that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static short extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_short); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.VisibilityHelper.id (), "Visibility", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static short read (org.omg.CORBA.portable.InputStream istream) - { - short value = (short)0; - value = istream.read_short (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, short value) - { - ostream.write_short (value); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHelper.java 2018-01-30 20:28:36.000000000 -0500 +++ /dev/null 2018-01-30 20:28:36.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Helper for {@code WCharSeq}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/WCharSeqHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:36 o'clock GMT+00:00 -* -* The class definition has been modified to conform to the following -* OMG specifications : -*

-*/ - -public abstract class WCharSeqHelper -{ - private static String _id = "IDL:omg.org/CORBA/WCharSeq:1.0"; - - public static void insert (org.omg.CORBA.Any a, char[] that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static char[] extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_wchar); - __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode); - __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.WCharSeqHelper.id (), "WCharSeq", __typeCode); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static char[] read (org.omg.CORBA.portable.InputStream istream) - { - char value[] = null; - int _len0 = istream.read_long (); - value = new char[_len0]; - istream.read_wchar_array (value, 0, _len0); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, char[] value) - { - ostream.write_long (value.length); - ostream.write_wchar_array (value, 0, value.length); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHolder.java 2018-01-30 20:28:37.000000000 -0500 +++ /dev/null 2018-01-30 20:28:37.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Holder for {@code WCharSeq}. For more information on -* Holder files, see -* "Generated Files: Holder Files".

-* org/omg/CORBA/WCharSeqHolder.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from streams.idl -* 13 May 1999 22:41:36 o'clock GMT+00:00 -*/ - -public final class WCharSeqHolder implements org.omg.CORBA.portable.Streamable -{ - public char value[] = null; - - public WCharSeqHolder () - { - } - - public WCharSeqHolder (char[] initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.WCharSeqHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.WCharSeqHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.WCharSeqHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/WStringValueHelper.java 2018-01-30 20:28:38.000000000 -0500 +++ /dev/null 2018-01-30 20:28:38.000000000 -0500 @@ -1,142 +0,0 @@ -/* - * Copyright (c) 1998, 2002, 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. - */ - -/** -* The Helper for {@code WStringValue}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-*/ - -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA; - -/** -* org/omg/CORBA/WStringValueHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from orb.idl -* 31 May 1999 22:27:30 o'clock GMT+00:00 -* -* The class definition has been modified to conform to the following -* OMG specifications : -*

-*/ - -public class WStringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper -{ - private static String _id = "IDL:omg.org/CORBA/WStringValue:1.0"; - - private static WStringValueHelper _instance = new WStringValueHelper (); - - public static void insert (org.omg.CORBA.Any a, String that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static String extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - __typeCode = org.omg.CORBA.ORB.init ().create_wstring_tc (0); - __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "WStringValue", __typeCode); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static String read (org.omg.CORBA.portable.InputStream istream) - { - if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) { - throw new org.omg.CORBA.BAD_PARAM(); } - return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance); - } - - public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream) - { - String tmp; - tmp = istream.read_wstring (); - return (java.io.Serializable) tmp; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, String value) - { - if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) { - throw new org.omg.CORBA.BAD_PARAM(); } - ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance); - } - - public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value) - { - if (!(value instanceof String)) { - throw new org.omg.CORBA.MARSHAL(); } - String valueType = (String) value; - ostream.write_wstring (valueType); - } - - public String get_id () - { - return _id; - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/WrongTransaction.java 2018-01-30 20:28:38.000000000 -0500 +++ /dev/null 2018-01-30 20:28:39.000000000 -0500 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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 org.omg.CORBA; - -/** - * The CORBA WrongTransaction user-defined exception. - * This exception is thrown only by the methods - * Request.get_response - * and ORB.get_next_response when they are invoked - * from a transaction scope that is different from the one in - * which the client originally sent the request. - * See the OMG Transaction Service Specification for details. - * - *

See also {@extLink jidlexception documentation on Java IDL exceptions}. - *

- */ - -public final class WrongTransaction extends UserException { - /** - * Constructs a WrongTransaction object with an empty detail message. - */ - public WrongTransaction() { - super(WrongTransactionHelper.id()); - } - - /** - * Constructs a WrongTransaction object with the given detail message. - * @param reason The detail message explaining what caused this exception to be thrown. - */ - public WrongTransaction(String reason) { - super(WrongTransactionHelper.id() + " " + reason); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHelper.java 2018-01-30 20:28:39.000000000 -0500 +++ /dev/null 2018-01-30 20:28:39.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 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 org.omg.CORBA; - -/** -* The Helper for {@code WrongTransaction}. For more information on -* Helper files, see -* "Generated Files: Helper Files".

-* org/omg/CORBA/WrongTransactionHelper.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from CORBA.idl -* Thursday, August 24, 2000 5:32:50 PM PDT -*/ - -abstract public class WrongTransactionHelper -{ - private static String _id = "IDL:omg.org/CORBA/WrongTransaction:1.0"; - - public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.WrongTransaction that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.CORBA.WrongTransaction extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - private static boolean __active = false; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - synchronized (org.omg.CORBA.TypeCode.class) - { - if (__typeCode == null) - { - if (__active) - { - return org.omg.CORBA.ORB.init().create_recursive_tc ( _id ); - } - __active = true; - org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [0]; - org.omg.CORBA.TypeCode _tcOf_members0 = null; - __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.WrongTransactionHelper.id (), "WrongTransaction", _members0); - __active = false; - } - } - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.CORBA.WrongTransaction read (org.omg.CORBA.portable.InputStream istream) - { - org.omg.CORBA.WrongTransaction value = new org.omg.CORBA.WrongTransaction (); - // read and discard the repository ID - istream.read_string (); - return value; - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.WrongTransaction value) - { - // write the repository ID - ostream.write_string (id ()); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHolder.java 2018-01-30 20:28:40.000000000 -0500 +++ /dev/null 2018-01-30 20:28:40.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 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 org.omg.CORBA; - -/** -* The Holder for {@code WrongTransaction}. For more information on -* Holder files, see -* "Generated Files: Holder Files".

-* org/omg/CORBA/WrongTransactionHolder.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from CORBA.idl -* Thursday, August 24, 2000 5:32:50 PM PDT -*/ - -public final class WrongTransactionHolder implements org.omg.CORBA.portable.Streamable -{ - public org.omg.CORBA.WrongTransaction value = null; - - public WrongTransactionHolder () - { - } - - public WrongTransactionHolder (org.omg.CORBA.WrongTransaction initialValue) - { - value = initialValue; - } - - public void _read (org.omg.CORBA.portable.InputStream i) - { - value = org.omg.CORBA.WrongTransactionHelper.read (i); - } - - public void _write (org.omg.CORBA.portable.OutputStream o) - { - org.omg.CORBA.WrongTransactionHelper.write (o, value); - } - - public org.omg.CORBA.TypeCode _type () - { - return org.omg.CORBA.WrongTransactionHelper.type (); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA/_IDLTypeStub.java 2018-01-30 20:28:41.000000000 -0500 +++ /dev/null 2018-01-30 20:28:41.000000000 -0500 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Stub for {@code IDLType}. For more information on -* Stub files, see -* "Generated Files: Stubs".

-* org/omg/CORBA/_IDLTypeStub.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ir.idl. -* 03 June 1999 11:33:44 o'clock GMT+00:00 -*/ - -public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.IDLType -{ - /** - * Constructs a default {@code _IDLTypeStub} object. - * NOTE: If the default constructor is used, the - * object is useless until the method {@code _set_delegate} - * has been called. - */ - // NOTE: This constructor is not required according to the spec. Only JCK expects it now. - public _IDLTypeStub () - { - super (); - } - - /** - * Constructs an {@code _IDLTypeStub} object initialized - * with the given {@code Delegate} object. - * - * @param delegate a Delegate object - */ - // NOTE: This constructor is not required according to the spec. We keep it as a convenience method. - public _IDLTypeStub (org.omg.CORBA.portable.Delegate delegate) - { - super (); - _set_delegate (delegate); - } - - public org.omg.CORBA.TypeCode type () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("_get_type", true); - _in = _invoke (_out); - org.omg.CORBA.TypeCode __result = _in.read_TypeCode (); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return type (); - } finally { - _releaseReply (_in); - } - } // type - - - // read interface - public org.omg.CORBA.DefinitionKind def_kind () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("_get_def_kind", true); - _in = _invoke (_out); - org.omg.CORBA.DefinitionKind __result = org.omg.CORBA.DefinitionKindHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return def_kind (); - } finally { - _releaseReply (_in); - } - } // def_kind - - - // write interface - public void destroy () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("destroy", true); - _in = _invoke (_out); - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - destroy (); - } finally { - _releaseReply (_in); - } - } // destroy - - // Type-specific CORBA::Object operations - private static String[] __ids = { - "IDL:omg.org/CORBA/IDLType:1.0", - "IDL:omg.org/CORBA/IRObject:1.0"}; - - public String[] _ids () - { - return (String[])__ids.clone (); - } - - private void readObject (java.io.ObjectInputStream s) - { - try - { - String str = s.readUTF (); - org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str); - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); - _set_delegate (delegate); - } catch (java.io.IOException e) {} - } - - private void writeObject (java.io.ObjectOutputStream s) - { - try - { - String str = org.omg.CORBA.ORB.init ().object_to_string (this); - s.writeUTF (str); - } catch (java.io.IOException e) {} - } -} // class _IDLTypeStub --- old/src/java.corba/share/classes/org/omg/CORBA/_PolicyStub.java 2018-01-30 20:28:41.000000000 -0500 +++ /dev/null 2018-01-30 20:28:41.000000000 -0500 @@ -1,164 +0,0 @@ -/* - * Copyright (c) 1999, 2001, 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 org.omg.CORBA; - - -/** -* The Stub for {@code Policy}. For more information on -* Stub files, see -* "Generated Files: Stubs".

-* org/omg/CORBA/_PolicyStub.java -* Generated by the IDL-to-Java compiler (portable), version "3.0" -* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl. -* Saturday, July 17, 1999 12:26:20 AM PDT -*/ - -public class _PolicyStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.Policy -{ - /** Constructors - * NOTE: If the default constructor is used, the - * object is useless until _set_delegate (...) - * is called. - */ - public _PolicyStub () - { - super (); - } - - /** Constructs a {@code _PolicyStub} object initialized - * with the given {@code Delegate} object. - * - * @param delegate a Delegate Object - */ - public _PolicyStub (org.omg.CORBA.portable.Delegate delegate) - { - super (); - _set_delegate (delegate); - } - - - /** Returns the constant value that corresponds to the - * type of the policy object. The values of - * the polivy objectys are allocated by the OMG. - * New values for PolicyType should be obtained from the OMG by - * sending mail to request@omg.org. In general the constant - * values that are allocated are defined in conjunction with - * the definition of the corresponding policy object. - * @return the constant value that corresponds to the type of - * the policy object. - */ - public int policy_type () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("_get_policy_type", true); - _in = _invoke (_out); - int __result = org.omg.CORBA.PolicyTypeHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return policy_type (); - } finally { - _releaseReply (_in); - } - } // policy_type - - - /** Copies the policy object. The copy does not retain any - * relationships that the policy had with any domain or object. - * @return the copy of the policy object. - */ - public org.omg.CORBA.Policy copy () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("copy", true); - _in = _invoke (_out); - org.omg.CORBA.Policy __result = org.omg.CORBA.PolicyHelper.read (_in); - return __result; - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - return copy (); - } finally { - _releaseReply (_in); - } - } // copy - - - /** Destroys the policy object. It is the responsibility of - * the policy object to determine whether it can be destroyed. - */ - public void destroy () - { - org.omg.CORBA.portable.InputStream _in = null; - try { - org.omg.CORBA.portable.OutputStream _out = _request ("destroy", true); - _in = _invoke (_out); - } catch (org.omg.CORBA.portable.ApplicationException _ex) { - _in = _ex.getInputStream (); - String _id = _ex.getId (); - throw new org.omg.CORBA.MARSHAL (_id); - } catch (org.omg.CORBA.portable.RemarshalException _rm) { - destroy (); - } finally { - _releaseReply (_in); - } - } // destroy - - // Type-specific CORBA::Object operations - private static String[] __ids = { - "IDL:omg.org/CORBA/Policy:1.0"}; - - public String[] _ids () - { - return (String[])__ids.clone (); - } - - private void readObject (java.io.ObjectInputStream s) - { - try - { - String str = s.readUTF (); - org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init ().string_to_object (str); - org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate (); - _set_delegate (delegate); - } catch (java.io.IOException e) {} - } - - private void writeObject (java.io.ObjectOutputStream s) - { - try - { - String str = org.omg.CORBA.ORB.init ().object_to_string (this); - s.writeUTF (str); - } catch (java.io.IOException e) {} - } -} // class _PolicyStub --- old/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html 2018-01-30 20:28:42.000000000 -0500 +++ /dev/null 2018-01-30 20:28:42.000000000 -0500 @@ -1,143 +0,0 @@ - - - - - Official Specifications for CORBA support in Java[tm] SE 6 - - - -

-Official Specifications for CORBA support in Java[tm] SE 6

- -

-Specification References

-The specifications with which the Java[tm] Platform, Standard Edition (Java SE) v.1.6.0 - ORB complies are as follows. If these links do not take you to the referenced - specification, the OMG may have changed the URL, and you can link to www.omg.org to search for the correct specification. - -These are the only specifications referenced by this document. - - -

-Supported Specification Details

-Not all of the above specifications are currently implemented in the ORB -in Java[tm] SE 6. The precise list of supported sections is as follows: -
    -
  • -CORBA 2.3.1 chapters 1-3 and 6-9
  • - -
  • Revised IDL to Java language mapping, section 1.21.8.2, the orb.properties -file.
  • - -
  • -CORBA 2.3.1 chapter 4 with the following replacements from the Portable -Interceptors specification: -
      -
    • section 4.2.3.5 destroy
    • -
    • section 4.5.2 CodeFactory and PICurrent are required
    • -
    • Section 4.5.3.4 as updated for register_initial_reference
    • -
    -
  • - -
  • -CORBA 2.3.1 chapter 5 with the following update from the Portable Interceptors -specification: -
      -
    • - 5.5.2 StringSeq and WStringSeq are required. - This adds the following classes to org.omg.CORBA: -
        -
      • StringSeqHolder
      • -
      • StringSeqHelper
      • -
      • WStringSeqHolder
      • -
      • WStringSeqHelper
      • -
      -
    • -
    -
  • - -
  • -CORBA 2.3.1 sections 10.6.1 and 10.6.2 are supported for repository IDs.
  • - -
  • -CORBA 2.3.1 section 10.7 for TypeCode APIs.
  • - -
  • -CORBA 2.3.1 chapter 11, Portable Object Adapter (POA), -with the following updates from the Portable Interceptors specification: -
      -
    • Section 11.3.7 POAs must preserve all policies
    • -
    • Section 11.3.8.2 again states that POAs must preserve all policies
    • -
    • Section 11.3.8.26 POA::id is required.
    • -
    -
  • - -
  • -CORBA 2.3.1 chapters 13 and 15 define GIOP 1.0, 1.1, and 1.2. The Java SE 6 -ORB fully supports all versions of GIOP, with the exception that the bi-directional -GIOP feature defined in sections 15.8 and 15.9 is not supported.
  • - -
  • -All of the Interoperable Naming Service is supported.
  • - -
  • -Portable Interceptors section 13.8 (the new -Coder/Decoder interfaces) -and all of chapter 21 (the interceptor specification).
  • - -
  • Section 1.21.8 of the Revised IDL to Java Language -Mapping Specification (ptc/00-11-03) -has been changed from the version in the -IDL to Java Language Mapping Specification (ptc/00-01-08).
  • -
- -

-Tools

- -
    -
  • The IDL to Java compiler (idlj) complies with: -
      -
    • CORBA 2.3.1 chapter 3 (IDL definition)
    • -
    • CORBA 2.3.1 chapters 5 and 6 (semantics of Value types)
    • -
    • CORBA 2.3.1 section 10.6.5 (pragmas)
    • -
    • The IDL to Java mapping specification
    • -
    • The Revised IDL to Java language mapping specification section 1.12.1 "local interfaces"
    • -
    -
  • - -
  • The Java to IDL compiler (the IIOP backend for rmic) complies with: -
      -
    • CORBA 2.3.1 chapters 5 and 6 (value types)
    • -
    • The Java to IDL language mapping. Note that this implicitly references - section 1.21 of the IDL to Java language mapping
    • -
    • IDL generated by the -idl flag complies with CORBA 2.3.1 chapter 3.
    • -
    -
  • -
- - - --- old/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html 2018-01-30 20:28:43.000000000 -0500 +++ /dev/null 2018-01-30 20:28:43.000000000 -0500 @@ -1,118 +0,0 @@ - - - - - IDL-to-Java Generated Files - - - -

IDL-to-Java Generated Files

- -

The files that are generated by the IDL-to-Java compiler, in accordance with -the -IDL-to-Java Language Mapping Specification, -which is implemented in Java™ SE 6 -according the compliance document. - - -

In general IDL names and identifiers are mapped to Java names -and identifiers with no change. Because of the nature of the Java language, -a single IDL construct may be mapped to several (differently named) Java constructs. -The additional names are constructed by appending a descriptive suffix. -For example, the IDL interface foo is mapped to the Java -interfaces foo and fooOperations, and additional -Java classes fooHelper, fooHolder, fooPOA, -and optionally fooPOATie. - - - -

The mapping in effect reserves the use of several names for its own purposes. These are: -

    -
  • The Java class <type>Helper, -where <type> is the name of an IDL defined type. -
  • The Java class <type>Holder, -where <type> -is the name of an IDL defined type (with certain exceptions such as typedef aliases). -
  • The Java classes <basicJavaType>Holder, where <basicJavaType> -is one of the Java primitive datatypes that is used by one of the IDL basic datatypes. -
  • The Java classes <interface>Operations, <interface>POA, -and <interface>POATie, where <interface> is the name of an IDL interface type. -
  • The nested scope Java package name <interface>Package, where <interface> -is the name of an IDL interface. -
- - -

Helper Files

- -

Helper files supply several static methods needed to manipulate the type. -These include Any insert and extract operations for the type, -getting the repository id, getting the typecode, and reading -and writing the type from and to a stream. - -

The helper class for a mapped IDL interface or abstract interface also -include narrow operation(s). The static narrow method allows an org.omg.CORBA.Object -to be narrowed to the object reference of a more specific type. -The IDL exception CORBA::BAD_PARAM is thrown if the narrow fails because -the object reference does not support the requested type. A different system exception -is raised to indicate other kinds of errors. Trying to narrow -a null will always succeed with a return value of null. - -

Holder Files

- -

Support for out and inout parameter passing modes requires the use of additional holder classes. -These classes are available for all of the basic IDL datatypes in the org.omg.CORBA package -and are generated for all named user defined IDL types except those defined by typedefs. -(Note that in this context user defined includes types that are defined in OMG specifications -such as those for the Interface Repository, and other OMG services.) - -

Each holder class has a constructor from an instance, a default constructor, and has -a public instance member, value which is the typed value. The default constructor -sets the value field to the default value for the type as defined by the Java language: -false for boolean, 0 for numeric and char types, null for strings, null for object references. - -

To support portable stubs and skeletons, holder classes also implement -the org.omg.CORBA.portable.Streamable interface. - - -

Operations Files

- -

A non abstract IDL interface is mapped to two public Java interfaces: -a signature interface and an operations interface. -The signature interface, which extends IDLEntity, has the same -name as the IDL interface name and is used -as the signature type in method declarations -when interfaces of the specified type are used in other interfaces. -The operations interface has the same name as the IDL interface -with the suffix Operations -appended to the end and is used in the server-side mapping and as a mechanism -for providing optimized calls for collocated client and servers. - -

The Java operations interface contains the mapped operation signatures. -The Java signature interface extends the operations interface, -the (mapped) base org.omg.CORBA.Object, -as well as org.omg.portable.IDLEntity. -Methods can be invoked on the signature interface. Interface inheritance -expressed in IDL is reflected in both the Java signature -interface and operations interface hierarchies. - - -

Stubs

- -

For the mapping of a non-object-oriented language, there will be -a programming interface to the stubs for each interface type. Generally, the stubs -will present access to the OMG IDL-defined operations on an object in a way that is easy -for programmers to predict once they are familiar with OMG IDL and the language mapping -for the particular programming language. The stubs make calls on the rest of the ORB -using interfaces that are private to, and presumably optimized for, the particular ORB Core. -If more than one ORB is available, there may be different stubs -corresponding to the different ORBs. In this case, it is necessary for -the ORB and language mapping to cooperate to associate -the correct stubs with the particular object reference. - -

Object-oriented programming languages, such as Java, -C++, and Smalltalk, do not require stub interfaces. - -

- - - --- old/src/java.corba/share/classes/org/omg/CORBA/ir.idl 2018-01-30 20:28:44.000000000 -0500 +++ /dev/null 2018-01-30 20:28:44.000000000 -0500 @@ -1,793 +0,0 @@ -/* - * Copyright (c) 1997, 2009, 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. - */ - -/* - * This file contains OMG IDL from CORBA V2.0, July 1995. - * It also contains the TypeCode creation APIs in CORBA::ORB - **/ - -#pragma prefix "omg.org" -//#pragma javaPackage org.omg - -module CORBA { - typedef string Identifier; - typedef string ScopedName; - typedef string RepositoryId; - - enum DefinitionKind { - dk_none, dk_all, - dk_Attribute, dk_Constant, dk_Exception, dk_Interface, - dk_Module, dk_Operation, dk_Typedef, - dk_Alias, dk_Struct, dk_Union, dk_Enum, - dk_Primitive, dk_String, dk_Sequence, dk_Array, - dk_Repository, - dk_Wstring, dk_Fixed, - dk_Value, dk_ValueBox, dk_ValueMember, // orbos 98-01-18: Objects By Value - dk_Native - }; - - - interface IRObject - /** - An IRObject IDL interface represents the most generic interface - from which all other Interface Repository interfaces are derived, - even the Repository itself. - */ - { - // read interface - readonly attribute DefinitionKind def_kind; - - // write interface - void destroy (); - }; - - - - typedef string VersionSpec; - - interface Contained; - interface Repository; - interface Container; - - interface Contained : IRObject - /** - The Contained Interface is inherited by all Interface Repository - interfaces that are contained by other objects. - */ - { - // read/write interface - - attribute RepositoryId id; - attribute Identifier name; - attribute VersionSpec version; - - // read interface - - readonly attribute Container defined_in; - readonly attribute ScopedName absolute_name; - readonly attribute Repository containing_repository; - - struct Description { - DefinitionKind kind; - any value; - }; - - Description describe (); - - // write interface - - void move ( - in Container new_container, - in Identifier new_name, - in VersionSpec new_version - ); - }; - - - interface ModuleDef; - interface ConstantDef; - interface IDLType; - interface StructDef; - interface UnionDef; - interface EnumDef; - interface AliasDef; - interface InterfaceDef; - interface ExceptionDef; - interface ValueDef; // orbos 98-01-18: Objects By Value - interface ValueMemberDef; // orbos 98-01-18: Objects By Value - interface ValueBoxDef; // orbos 98-01-18: Objects By Value - interface NativeDef; - - - typedef sequence InterfaceDefSeq; - - - typedef sequence ContainedSeq; - - struct StructMember { - Identifier name; - TypeCode type; - IDLType type_def; - }; - typedef sequence StructMemberSeq; - - struct UnionMember { - Identifier name; - any label; - TypeCode type; - IDLType type_def; - }; - typedef sequence UnionMemberSeq; - - - typedef sequence EnumMemberSeq; - - // orbos 98-01-18: Objects By Value -- begin - typedef short Visibility; - const Visibility PRIVATE_MEMBER = 0; - const Visibility PUBLIC_MEMBER = 1; - - struct ValueMember { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - IDLType type_def; - Visibility access; - }; - typedef sequence ValueMemberSeq; - - struct Initializer { - StructMemberSeq members; - }; - typedef sequence InitializerSeq; - - typedef sequence ValueDefSeq; - - // orbos 98-01-18: Objects By Value -- end - - - interface Container : IRObject - /** - The Container interface is used to form a containment hierarchy - in the Interface Repository. A Container can contain any number - of objects derived from the Contained interface. - */ - { - // read interface - - Contained lookup ( in ScopedName search_name); - - ContainedSeq contents ( - in DefinitionKind limit_type, - in boolean exclude_inherited - ); - - ContainedSeq lookup_name ( - in Identifier search_name, - in long levels_to_search, - in DefinitionKind limit_type, - in boolean exclude_inherited - ); - - struct Description { - Contained contained_object; - DefinitionKind kind; - any value; - }; - - typedef sequence DescriptionSeq; - - DescriptionSeq describe_contents ( - in DefinitionKind limit_type, - in boolean exclude_inherited, - in long max_returned_objs - ); - - // write interface - - ModuleDef create_module ( - in RepositoryId id, - in Identifier name, - in VersionSpec version - ); - - ConstantDef create_constant ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type, - in any value - ); - - StructDef create_struct ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in StructMemberSeq members - ); - - UnionDef create_union ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType discriminator_type, - in UnionMemberSeq members - ); - - EnumDef create_enum ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in EnumMemberSeq members - ); - - AliasDef create_alias ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType original_type - ); - - ExceptionDef create_exception ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in StructMemberSeq members - ); - - - InterfaceDef create_interface ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in boolean is_abstract, - in InterfaceDefSeq base_interfaces - ); - - // orbos 98-01-18: Objects By Value - ValueDef create_value( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in boolean is_custom, - in boolean is_abstract, - in octet flags, // must be 0 - in ValueDef base_value, - in boolean has_safe_base, - in ValueDefSeq abstract_base_values, - in InterfaceDefSeq supported_interfaces, - in InitializerSeq initializers - ); - - // orbos 98-01-18: Objects By Value - ValueBoxDef create_value_box( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType original_type_def - ); - - NativeDef create_native( - in RepositoryId id, - in Identifier name, - in VersionSpec version - ); - - }; - - - - interface IDLType : IRObject - /** - The IDLType interface is an abstract interface inherited by all - IR objects that represent the OMG IDL types. It provides access - to the TypeCode describing the type, and is used in defining the - other interfaces wherever definitions of IDLType must be referenced. - */ - { - readonly attribute TypeCode type; - }; - - - - interface PrimitiveDef; - interface StringDef; - interface SequenceDef; - interface ArrayDef; - - enum PrimitiveKind { - pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong, - pk_float, pk_double, pk_boolean, pk_char, pk_octet, - pk_any, pk_TypeCode, pk_Principal, pk_string, pk_objref - }; - - interface Repository : Container - /** - Repository is an interface that provides global access to the - Interface Repository. Repository objects can contain constants, - typedefs, exceptions, interfaces, and modules. - */ - { - // read interface - - Contained lookup_id (in RepositoryId search_id); - - PrimitiveDef get_primitive (in PrimitiveKind kind); - - // write interface - - StringDef create_string (in unsigned long bound); - - SequenceDef create_sequence ( - in unsigned long bound, - in IDLType element_type - ); - - ArrayDef create_array ( - in unsigned long length, - in IDLType element_type - ); - }; - - - interface ModuleDef : Container, Contained - /** - A ModuleDef can contain constants, typedefs, exceptions, interfaces, - and other module objects. - */ - { - }; - - struct ModuleDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - }; - - - interface ConstantDef : Contained - /** - A ConstantDef object defines a named constant. - */ - { - readonly attribute TypeCode type; - attribute IDLType type_def; - attribute any value; - }; - - struct ConstantDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - any value; - }; - - - interface TypedefDef : Contained, IDLType - /** - TypedefDef is an abstract interface used as a base interface for - all named non-object types(structures, unions, enumerations, - aliases). The TypedefDef interface is not inherited by the definition - objects for the primitive or anonymous types. - */ - { - }; - - struct TypeDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - }; - - - interface StructDef : TypedefDef, Container - /** - A StructDef represents an OMG IDL structure definition. - */ - { - attribute StructMemberSeq members; - }; - - - interface UnionDef : TypedefDef, Container - /** - A UnionDef represents an OMG IDL union definition. - */ - { - readonly attribute TypeCode discriminator_type; - attribute IDLType discriminator_type_def; - attribute UnionMemberSeq members; - }; - - - interface EnumDef : TypedefDef - /** - A EnumDef represents an OMG IDL enum definition. - */ - { - attribute EnumMemberSeq members; - }; - - - interface AliasDef : TypedefDef - /** - An AliasDef represents an OMG IDL typedef that aliases other - definition. - */ - { - attribute IDLType original_type_def; - }; - - - interface PrimitiveDef: IDLType - /** - A PrimitiveDef represents one of the IDL primitive types. As - primitive types are unnamed, this interface is not derived from - TypedefDef or Contained. - */ - { - readonly attribute PrimitiveKind kind; - }; - - - interface StringDef : IDLType - /** - A StringDef represents an OMG IDL string type. As string - types are anonymous, this interface is not derived from TypedefDef - or Contained. - */ - { - attribute unsigned long bound; - }; - - - interface SequenceDef : IDLType - /** - A SequenceDef represents an OMG IDL sequence type. As sequence - types are anonymous, this interface is not derived from TypedefDef - or Contained. - */ - { - attribute unsigned long bound; - readonly attribute TypeCode element_type; - attribute IDLType element_type_def; - }; - - interface ArrayDef : IDLType - /** - An ArrayDef represents an OMG IDL array type. As array - types are anonymous, this interface is not derived from TypedefDef - or Contained. - */ - { - attribute unsigned long length; - readonly attribute TypeCode element_type; - attribute IDLType element_type_def; - }; - - - interface ExceptionDef : Contained, Container - /** - An ExceptionDef represents an exception definition. - */ - { - readonly attribute TypeCode type; - attribute StructMemberSeq members; - }; - struct ExceptionDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - }; - - - - enum AttributeMode {ATTR_NORMAL, ATTR_READONLY}; - - interface AttributeDef : Contained - /** - An AttributeDef represents the information that defines an - attribute of an interface. - */ - { - readonly attribute TypeCode type; - attribute IDLType type_def; - attribute AttributeMode mode; - }; - - struct AttributeDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode type; - AttributeMode mode; - }; - - - - enum OperationMode {OP_NORMAL, OP_ONEWAY}; - - enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT}; - struct ParameterDescription { - Identifier name; - TypeCode type; - IDLType type_def; - ParameterMode mode; - }; - typedef sequence ParDescriptionSeq; - - typedef Identifier ContextIdentifier; - typedef sequence ContextIdSeq; - - typedef sequence ExceptionDefSeq; - typedef sequence ExcDescriptionSeq; - - interface OperationDef : Contained - /** - An OperationDef represents the information that defines an - operation of an interface. - */ - { - readonly attribute TypeCode result; - attribute IDLType result_def; - attribute ParDescriptionSeq params; - attribute OperationMode mode; - attribute ContextIdSeq contexts; - attribute ExceptionDefSeq exceptions; - }; - - struct OperationDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - TypeCode result; - OperationMode mode; - ContextIdSeq contexts; - ParDescriptionSeq parameters; - ExcDescriptionSeq exceptions; - }; - - - - typedef sequence RepositoryIdSeq; - typedef sequence OpDescriptionSeq; - typedef sequence AttrDescriptionSeq; - - interface InterfaceDef : Container, Contained, IDLType - /** - An InterfaceDef object represents an interface definition. It can - contains constants, typedefs, exceptions, operations, and - attributes. - */ - { - // read/write interface - - attribute InterfaceDefSeq base_interfaces; - attribute boolean is_abstract; - - // read interface - - boolean is_a (in RepositoryId interface_id); - - struct FullInterfaceDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - boolean is_abstract; - OpDescriptionSeq operations; - AttrDescriptionSeq attributes; - RepositoryIdSeq base_interfaces; - TypeCode type; - }; - - FullInterfaceDescription describe_interface(); - - // write interface - - AttributeDef create_attribute ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type, - in AttributeMode mode - ); - - OperationDef create_operation ( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType result, - in OperationMode mode, - in ParDescriptionSeq params, - in ExceptionDefSeq exceptions, - in ContextIdSeq contexts - ); - }; - - struct InterfaceDescription { - Identifier name; - RepositoryId id; - RepositoryId defined_in; - VersionSpec version; - RepositoryIdSeq base_interfaces; - }; - - - // orbos 98-01-18: Objects By Value -- begin - - interface ValueMemberDef : Contained - - /** A ValueMemberDef object represents the public - and private data member definition of a Value type - */ - - { - readonly attribute TypeCode type; - attribute IDLType type_def; - attribute Visibility access; - }; - - interface ValueDef : Container, Contained, IDLType - /** - A ValueDef object represents the definition of the - Value object used to pass the object state - between hosts - */ - - { - // read/write interface - attribute InterfaceDefSeq supported_interfaces; - attribute InitializerSeq initializers; - attribute ValueDef base_value; - attribute ValueDefSeq abstract_base_values; - attribute boolean is_abstract; - attribute boolean is_custom; - attribute octet flags; // always 0 - attribute boolean has_safe_base; - - // read interface - boolean is_a(in RepositoryId value_id); - - struct FullValueDescription { - Identifier name; - RepositoryId id; - boolean is_abstract; - boolean is_custom; - octet flags; // always 0 - RepositoryId defined_in; - VersionSpec version; - OpDescriptionSeq operations; - AttrDescriptionSeq attributes; - ValueMemberSeq members; - InitializerSeq initializers; - RepositoryIdSeq supported_interfaces; - RepositoryIdSeq abstract_base_values; - boolean has_safe_base; - RepositoryId base_value; - TypeCode type; - }; - - FullValueDescription describe_value(); - - // write interface - - ValueMemberDef create_value_member( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type_def, - in Visibility access - ); - - AttributeDef create_attribute( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType type, - in AttributeMode mode - ); - - OperationDef create_operation( - in RepositoryId id, - in Identifier name, - in VersionSpec version, - in IDLType result, - in OperationMode mode, - in ParDescriptionSeq params, - in ExceptionDefSeq exceptions, - in ContextIdSeq contexts - ); - }; - struct ValueDescription { - Identifier name; - RepositoryId id; - boolean is_abstract; - boolean is_custom; - octet flags; // always 0 - RepositoryId defined_in; - VersionSpec version; - RepositoryIdSeq supported_interfaces; - RepositoryIdSeq abstract_base_values; - boolean has_safe_base; - RepositoryId base_value; - }; - - interface ValueBoxDef : IDLType - - /** ValueBoxDef is an interface that reresents a value type with - a single data member inside its state section and no - inheritance or methods. For example, when transmitting a - string or sequence as an actual parameter on an interface - operation or as a data member of a value type that is an - actual parameter, it may be important to preserve any sharing - of the string or sequence within the object graph being - transmitted. Because current IDL data types do not preserve - referential integrity in this way, this requirement is - conveniently handled by using a value type. Value types also - support the transmission of nulls (as a distinguished value), - whereas IDL data types such as string and sequence (which are - mapped to empty strings and sequences) do not. The Java to IDL - mapping requires both preservation of referential integrity - and transmission of nulls. Because it would be cumbersome to - require the full IDL syntax for a value type for this specific - usage, this shorthand notation is introduced to cover this use - of value types for simple containment of a single data member. - */ - - { - attribute IDLType original_type_def; - }; - - // orbos 98-01-18: Objects By Value -- end - - enum TCKind { - tk_null, tk_void, - tk_short, tk_long, tk_ushort, tk_ulong, - tk_float, tk_double, tk_boolean, tk_char, - tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref, - tk_struct, tk_union, tk_enum, tk_string, - tk_sequence, tk_array, tk_alias, tk_except, - tk_longlong, tk_ulonglong, tk_longdouble, - tk_wchar, tk_wstring, tk_fixed, - tk_value, tk_value_box, - tk_native, - tk_abstract_interface - }; - - interface NativeDef : TypedefDef { - }; -}; --- old/src/java.corba/share/classes/org/omg/CORBA/orb.idl 2018-01-30 20:28:44.000000000 -0500 +++ /dev/null 2018-01-30 20:28:44.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2000, 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. - */ - -// IDL not generated by rmic, do not edit -// These are all in IDL module CORBA -// The Java classes are in the package org.omg.CORBA -// See ValueType Semantics:Standard Value Box Definitions (5.3) in CORBA 2.3 spec - -#ifndef __org_omg_CORBA__ -#define __org_omg_CORBA__ - -#pragma prefix "omg.org" - -module CORBA{ - - valuetype StringValue string; - valuetype WStringValue wstring; - -}; - -#include "ir.idl" - -#pragma prefix "" - -#endif --- old/src/java.corba/share/classes/org/omg/CORBA/package.html 2018-01-30 20:28:45.000000000 -0500 +++ /dev/null 2018-01-30 20:28:45.000000000 -0500 @@ -1,982 +0,0 @@ - - - - - - package - - - -Provides the mapping of the OMG CORBA APIs to the Java™ -programming language, including the class ORB, which is implemented -so that a programmer can use it as a fully-functional Object Request Broker -(ORB). - -

For a precise list of supported sections of official CORBA specifications with which -the Java[TM] Platform, Standard Edition 6 complies, see Official Specifications for CORBA support in -Java[TM] SE 6. - - -

General Information

-The information in this section is information relevant to someone who -compiles Interface Definition Language (IDL) files and uses the -ORB to write clients and servers. - -

The classes and interfaces described in this section can be put into -four groups: ORB classes, Exceptions, Helper classes, -and Holder classes. - -

-The ORB Class

- -

An ORB handles (or brokers) method invocations between a client and -the method's implementation on a server. Because the client and server -may be anywhere on a network, and because the invocation and implementation -may be written in different programming languages, an ORB does a great -deal of work behind the scenes to accomplish this communication. - -

Most of what an ORB does is completely transparent to the user, and a major -portion of the CORBA package consists of classes used by the ORB -behind the scenes. The result is that most programmers will use only a -small part of this package directly. In fact, most programmers will use -only a few methods from the ORB class, some exceptions, and -occasionally, -a holder class. -

-ORB Methods

- -

Before an application can enter the CORBA environment, it must first: -

    -
  • Be initialized into the ORB and possibly the object adapter (POA) environments. -
  • Get references to ORB object (for use in future ORB operations) -and perhaps other objects (including the root POA or some Object Adapter objects). -
-

The following operations are provided to initialize applications and obtain - the appropriate object references: -

    -
  • Operations providing access to the ORB, which are discussed in this - section. -
  • Operations providing access to Object Adapters, Interface Repository, - Naming Service, and other Object Services. These operations are described - in Other Classes. -
-

-When an application requires a CORBA environment it needs a mechanism to -get an ORB object reference and possibly an OA object reference -(such as the root POA). This serves two purposes. First, it initializes -an application into the ORB and OA environments. Second, it returns the -ORB object reference and the OA object reference to the application -for use in future ORB and OA operations. - -

In order to obtain an ORB object reference, applications call -the ORB.init operation. The parameters to the call can comprise an -identifier for the ORB for which the object reference is required, - and an arg_list, which is used to allow environment-specific data to be - passed into the call. - -

These are the ORB methods - that provide access to the ORB: -

    -
  • -init() - -
  • -init(String [] args, Properties props) - -
  • -init(Applet app, Properties props) -
- -

Using the init() method without parameters initiates -a singleton ORB, which can only -give typecode creation anys needed in code generated -in Helper classes by idlj. - -

Applications require a portable means by which to obtain their -initial object references. References are required for the root -POA, POA Current, Interface Repository, and various Object Services -instances. The functionality required by the application is similar - to that provided by the Naming Service. However, the OMG does not - want to mandate that the Naming Service be made available to all - applications in order that they may be portably initialized. - Consequently, the operations shown in this section provide a - simplified, local version of the Naming Service that applications - can use to obtain a small, defined set of object references which - are essential to its operation. Because only a small well-defined - set of objects are expected with this mechanism, the naming context - can be flattened to be a single-level name space. This simplification - results in only two operations being defined to achieve the functionality - required. - -

Initial references are obtained via two operations provided in -the ORB object interface, providing facilities to list and -resolve initial object references. These are: -

    -
  • -resolve_initial_references(String name) -
  • -list_initial_services() -
  • -register_initial_reference(String id, org.omg.CORBA.Object obj) -
- -

An example that uses some of these methods is {@extLink idl_getting_started Getting Started with Java IDL}. - -

-Exceptions

-Exceptions in Java IDL are similar to those in any code written in the -Java programming language. If a method is defined to throw an exception, -then any code using that method must have a try/catch -block and handle that exception when it is thrown. - -

The documentation on {@extLink jidlexception Java IDL exceptions } -has more information and explains the difference between -system exceptions and user-defined exceptions. - -

The following is a list of the system exceptions (which are unchecked -exceptions inheriting through -org.omg.CORBA.SystemException from -java.lang.RuntimeException) that are defined in the package -org.omg.CORBA: -


-        BAD_CONTEXT
-        BAD_INV_ORDER
-        BAD_OPERATION
-        BAD_PARAM
-        BAD_TYPECODE
-        COMM_FAILURE
-        DATA_CONVERSION
-        FREE_MEM
-        IMP_LIMIT
-        INITIALIZE
-        INTERNAL
-        INTF_REPOS
-        INVALID_TRANSACTION
-        INV_FLAG
-        INV_IDENT
-        INV_OBJREF
-        INV_POLICY
-        MARSHAL
-        NO_IMPLEMENT
-        NO_MEMORY
-        NO_PERMISSION
-        NO_RESOURCES
-        NO_RESPONSE
-        OBJECT_NOT_EXIST
-        OBJ_ADAPTER
-        PERSIST_STORE
-        TRANSACTION_REQUIRED
-        TRANSACTION_ROLLEDBACK
-        TRANSIENT
-        UNKNOWN
-
-

-The following is a list of user-defined exceptions defined in the package -org.omg.CORBA. -


-        Bounds
-        UnknownUserException
-        WrongTransaction 
-        PolicyError
-
- -

Subpackages

-There are some packages inside the CORBA package with -"Package" as part of their names. These packages are generally quite small -because all they do is provide exceptions or classes for use by interfaces -and classes in the CORBA package. - -

For example, the package -org.omg.CORBA.TypeCodePackage contains -two exceptions thrown by methods in the class TypeCode. These -exceptions are: -

    -
  • -BadKind - -
  • -Bounds -
-The package -org.omg.CORBA.ORBPackage contains two exceptions: -
    -
  • -InvalidName - -
  • -InconsistentTypeCode -
- -

Another package that is a subpackage of CORBA is the -portable -package. It provides a set of ORB APIs that makes it -possible for code generated by one vendor's IDL compiler to run -on another vendor's ORB. - - - - -

-Holder classes

- - -

Support for out and inout parameter passing modes requires the use of -additional holder -classes. Because the Java programming language does not support out or -inout parameters, holder classes are needed as a means of passing a parameter -that can be modified. To support portable stubs and skeletons, -holder classes also implement the -org.omg.CORBA.portable.Streamable -interface. - -

Holder classes are named by appending "Holder" to the name of the type. - The name of the type refers to its name in the Java programming language. For - example, a holder class for the interface named Account - in the Java programming - language would be named AccountHolder. - - -

Holder classes are available for all of the basic IDL - datatypes in the org.omg.CORBA package. So, for example, - there are already-defined classes for LongHolder, ShortHolder, - FloatHolder, and so on. Classes are also generated for - all named user-defined IDL types except those defined by typedefs. - (Note that in this context user defined includes types that are - defined in OMG specifications such as those for the Interface - Repository, and other OMG services.) - - -

Each holder class has: -

    -
  • a constructor from an instance -
  • a default constructor -
  • a public instance member, value which is the typed value. -
  • a method for reading an input stream and assigning the contents to the -type's value field -
  • a method for writing the value of the value field to an output stream -
  • a method for getting the typecode of the type -
- -

The default constructor sets the value field to the default value for the -type as defined by the Java language: -

    -
  • false for boolean -
  • 0 for numeric and char types -
  • null for strings and object references -
- - - -

-As an example, if the interface Account, defined in OMG IDL, -were mapped to the Java programming language, the following holder class -would be generated: -

-public final class AccountHolder implements
-    org.omg.CORBA.portable.Streamable
-{
-  // field that holds an Account object
-  public Account value = null;
-
-  // default constructor
-  public AccountHolder ()
-  {
-  }
-  
-  // creates a new AccountHolder from initialValue
-  public AccountHolder (Account initialValue)
-  {
-    value = initialValue;
-  }
-  
-  // reads the contents of i and assigns the contents to value
-  public void _read (org.omg.CORBA.portable.InputStream i)
-  {
-    value = AccountHelper.read (i);
-  }
-
-  // writes value to o
-  public void _write (org.omg.CORBA.portable.OutputStream o)
-  {
-    AccountHelper.write (o, value);
-  }
- 
-  // returns the typecode for Account
-  public org.omg.CORBA.TypeCode _type ()
-  {
-    return AccountHelper.type ();
-  }
-
-}
-
- -

For more information on Holder classes, see Chapter 1.4, Mapping for -Basic Types in the -OMG IDL to Java Language Mapping. The Holder classes defined -in the package org.omg.CORBA are: -


-     AnyHolder
-     AnySeqHolder
-     BooleanHolder
-     BooleanSeqHolder
-     ByteHolder
-     CharHolder
-     CharSeqHolder
-     CurrentHolder
-     DoubleHolder
-     DoubleSeqHolder
-     FixedHolder
-     FloatHolder
-     FloatSeqHolder
-     IntHolder
-     LongHolder
-     LongLongSeqHolder
-     LongSeqHolder
-     ObjectHolder
-     OctetSeqHolder
-     ParameterModeHolder
-     PolicyErrorHolder
-     PolicyListHolder
-     PrincipalHolder
-     ServiceInformationHolder
-     ShortHolder
-     ShortSeqHolder
-     StringHolder
-     StringSeqHolder
-     TypeCodeHolder
-     ULongLongSeqHolder
-     ULongSeqHolder
-     UnknownUserExceptionHolder
-     UShortSeqHolder
-     ValueBaseHolder
-     WCharSeqHolder
-     WrongTransactionHolder
-     WStringSeqHolder
-
- -

Helper Classes

-

Helper files supply several static methods needed to manipulate the type. - These include: -

    -
  • Any insert and extract operations for the type -
  • getting the repository id -
  • getting the typecode -
  • reading and writing the type from and to a stream -
  • implement the ValueHelper interface (if it is a user-defined - value type) -
- -

The helper class for a mapped IDL interface or abstract interface -also include narrow operation(s). The static narrow method allows -an org.omg.CORBA.Object to be narrowed to the object reference -of a more specific type. The IDL exception CORBA.BAD_PARAM -is thrown if the narrow fails because the object reference does not -support the requested type. A different system exception is raised -to indicate other kinds of errors. Trying to narrow a null will always -succeed with a return value of null. -Generally, the only helper method an application programmer uses is -the narrow method. The other methods are normally used behind -the scenes and are transparent to the programmer. - -

Helper classes -fall into two broad categories, helpers for value types and -helpers for non value types. Because all of the helper -classes in one category -provide the same methods, one generic explanation of each -category of helper classes is presented here. - -

-When OMG IDL is mapped to the Java programming language, -a "helper" class is generated for each user-defined type. -This generated class will have the name of the user-defined type with -the suffix Helper appended. For example, if the -interface Account is defined in OMG IDL, the -idlj compiler will automatically generate a class named -AccountHelper. The AccountHelper class -will contain the static methods needed for manipulating instances of the type, -in this case, Account objects. - - - -

The narrow Method

-When an object is the return value for a method, it is returned in the -form of a generic object, either an org.omg.CORBA.Object object -or a java.lang.Object object. This object must be cast to its -more specific type before it can be operated on. For example, an -Account object will be returned as a generic object and must -be narrowed to an Account object so that Account -methods may be called on it. -

-The narrow method has two forms, one that takes an -org.omg.CORBA.Object object and one that takes a -java.lang.Object object. Whether the interface is abstract or -not determines which narrow method its helper class will provide. -The helper class for an interface -that is not abstract will have a narrow method that takes a CORBA -object, whereas the narrow method for an interface that is abstract -will take an object in the Java programming language. The helper class for a -non-abstract interface that has at least one abstract base interface will provide -both versions of the narrow method. -

The {@extLink idl_guides Hello World tutorial} -uses a narrow method that looks like this: -

-        // create and initialize the ORB
-        ORB orb = ORB.init(args, null);
-
-        // get the root naming context
-        org.omg.CORBA.Object objRef = 
-            orb.resolve_initial_references("NameService");
-        // Use NamingContextExt instead of NamingContext. This is 
-        // part of latest Inter-Operable naming Service.  
-        NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
- 
-        // resolve the Object Reference in Naming
-        String name = "Hello";
-        helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
-
- - -

Example of a Basic Helper Class

-A basic helper class, for purposes of this explanation, is one with -the methods that are provided by every helper class, plus a narrow -method if the type defined in OMG IDL maps to an interface in the Java -programming language. Types that are not value types will have a basic -helper class generated for them. -

-For example, assuming that the interface Account is not a -value type IDL type and is also not an abstract interface and has no -abstract base interfaces, its AccountHelper class will look -like this: -

-abstract public class AccountHelper
-{
-  private static String  _id = "IDL:Account:1.0";
-
-  // inserts an Account object into an Any object
-  public static void insert (org.omg.CORBA.Any a, Account that)
-  {
-    org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
-    a.type (type ());
-    write (out, that);
-    a.read_value (out.create_input_stream (), type ());
-  }
-
-  // extracts an Account object from an Any object
-  public static Account extract (org.omg.CORBA.Any a)
-  {
-    return read (a.create_input_stream ());
-  }
-
-  
-  private static org.omg.CORBA.TypeCode __typeCode = null;
-  // gets the typecode for this type
-  synchronized public static org.omg.CORBA.TypeCode type ()
-  {
-    if (__typeCode == null)
-    {
-      __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (AccountHelper.id (), "Account");
-    }
-    return __typeCode;
-  }
-
-  // gets the repository id for this type
-  public static String id ()
-  {
-    return _id;
-  }
-
-  // reads an Account object from an input stream
-  public static Account read (org.omg.CORBA.portable.InputStream istream)
-  {
-    return narrow (istream.read_Object (_AccountStub.class));
-  }
-
-  // writes an Account object to an outputstream
-  public static void write (org.omg.CORBA.portable.OutputStream ostream, Account value)
-  {
-    ostream.write_Object ((org.omg.CORBA.Object) value);
-  }
-
-  // converts (narrows) an Object to an Account object
-  public static Account narrow (org.omg.CORBA.Object obj)
-  {
-    if (obj == null)
-      return null;
-    else if (obj instanceof Account)
-      return (Account)obj;
-    else if (!obj._is_a (id ()))
-      throw new org.omg.CORBA.BAD_PARAM ();
-    else
-    {
-      org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();
-      _AccountStub stub = new _AccountStub ();
-      stub._set_delegate(delegate);
-      return stub;
-    }
-  }
-
-}
-
- - -

Value Type Helper Classes

-A helper class for a value type includes different renderings of -the same methods generated for non-value type methods. The main difference - is that value types are types that can be -passed by value as parameters or return values of a method, which means that -they must be serializable. -

Assuming that Address is a value type, the -AddressHelper class will look like this: -

-abstract public class AddressHelper
-{
-  private static String  _id = "IDL:Address:1.0";
-
-  // same as for non-value type
-  public static void insert (org.omg.CORBA.Any a, Address that)
-  {
-    org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
-    a.type (type ());
-    write (out, that);
-    a.read_value (out.create_input_stream (), type ());
-  }
-
-  // same as for non-value type
-  public static Address extract (org.omg.CORBA.Any a)
-  {
-    return read (a.create_input_stream ());
-  }
-
-  private static org.omg.CORBA.TypeCode __typeCode = null;
-  private static boolean __active = false;
-  
-  // getting the typecode for the type
-  synchronized public static org.omg.CORBA.TypeCode type ()
-  {
-    if (__typeCode == null)
-    {
-      synchronized (org.omg.CORBA.TypeCode.class)
-      {
-        if (__typeCode == null)
-        {
-          if (__active)
-          {
-            return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
-          }
-          __active = true;
-          org.omg.CORBA.ValueMember[] _members0 = new org.omg.CORBA.ValueMember[0];
-          org.omg.CORBA.TypeCode _tcOf_members0 = null;
-          __typeCode = org.omg.CORBA.ORB.init ().create_value_tc (_id, "Address", org.omg.CORBA.VM_NONE.value, null, _members0);
-          __active = false;
-        }
-      }
-    }
-    return __typeCode;
-  }
-
-  // same as for non-value type
-  public static String id ()
-  {
-    return _id;
-  }
-
-  // reads a serializable instance of Address from the given input stream
-  public static Address read (org.omg.CORBA.portable.InputStream istream)
-  {
-    return (Address)((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (id ());
-  }
-
-  // writes a serializable instance of Address to the given output stream
-  public static void write (org.omg.CORBA.portable.OutputStream ostream, Address value)
-  {
-    ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, id ());
-  }
-
-
-}
-
- -

The Helper classes defined in the package org.omg.CORBA are: -


-     AnySeqHelper
-     BooleanSeqHelper
-     CharSeqHelper
-     CompletionStatusHelper
-     CurrentHelper
-     DefinitionKindHelper
-     DoubleSeqHelper
-     FieldNameHelper
-     FloatSeqHelper
-     IdentifierHelper
-     IDLTypeHelper
-     LongLongSeqHelper
-     LongSeqHelper
-     NameValuePairHelper
-     ObjectHelper
-     OctetSeqHelper
-     ParameterModeHelper
-     PolicyErrorCodeHelper
-     PolicyErrorHelper
-     PolicyHelper
-     PolicyListHelper
-     PolicyTypeHelper
-     RepositoryIdHelper
-     ServiceDetailHelper
-     ServiceInformationHelper
-     SetOverrideTypeHelper
-     ShortSeqHelper
-     StringSeqHelper
-     StringValueHelper
-     StructMemberHelper
-     ULongLongSeqHelper
-     ULongSeqHelper
-     UnionMemberHelper
-     UnknownUserExceptionHelper
-     UShortSeqHelper
-     ValueBaseHelper
-     ValueMemberHelper
-     VersionSpecHelper
-     VisibilityHelper
-     WCharSeqHelper
-     WrongTransactionHelper
-     WStringSeqHelper
-     WStringValueHelper
-
- -

-Other Classes

-The other classes and interfaces in the CORBA package, which are -used behind the scenes, can be put into four groups. Three of the groups -are used with requests in some capacity, and the fourth group, concerning -the Interface Repository, is a category by itself. -

-Classes Created by an ORB

-The first group contains classes that are created by an ORB and contain -information used in request operations. -
    -
  • -TCKind -- indicates the kind (datatype) for a TypeCode -object - -
  • -TypeCode -- indicates a datatype and possibly other information - -
  • -Any -- contains a value and its typecode - -
  • -NamedValue -- contains a name, an Any object, and an -argument mode flag. NamedValue objects contain information about -method arguments, method return values, or a context. - -
  • -ContextList -- a list of strings that describe the contexts that -need to be resolved and sent with an invocation - -
  • -ExceptionList -- a list of TypeCodes for exceptions that -may be thrown by a method - -
  • -Environment -- a container for the exception thrown during a method -invocation - -
  • -Context -- a list of NamedValue objects used to pass -auxiliary information from client to server - -
  • -NVList -- a list of NamedValue objects, used to pass -arguments or get results -
- -

-Classes That Deal with Requests

-The second group of classes deals with requests: -
    -
  • -Object -- the base class for all CORBA object references - -
  • -Request -- the main class in the DII, which contains methods for -adding arguments to the request, for accessing information about the method -being invoked (the method name, its arguments, exceptions it throws, and -so on), and for making invocations on the request - -
  • -DynamicImplementation -- the base class for server implementations -using the DSI. It has the method invoke, which is used by an -implementation -of this class to determine the state of a ServerRequest object -and to set its result or exception - -
  • -ServerRequest -- captures the explicit state of a request for -the Dynamic Skeleton Interface -
- -

-Interfaces That Serve as Constants

-The third group contains interfaces that serve as constants. The IDL-to-Java -mapping mandates that IDL enums are mapped to a Java class with the enumerated -values represented as public static final fields in that class (e.g. -DefinitionKind). -On the other hand IDL constants defined outside of an IDL interface are -mapped to a Java interface for each constant. - -

This is why several interfaces in the org.omg.CORBA package -consist of a single field, value, which is a short. This -field is a constant used for such things as an error code or value modifier. -For example, the value field of the interface BAD_POLICY -is one of the possible reasons for the exception PolicyError to -be thrown. To specify this error code, you would use BAD_POLICY.value. - -

The exception PolicyError uses the value field of -the following interfaces as its possible error codes. -

    -
  • -BAD_POLICY - -
  • -BAD_POLICY_TYPE - -
  • -BAD_POLICY_VALUE - -
  • -UNSUPPORTED_POLICY - -
  • -UNSUPPORTED_POLICY_VALUE -
-The method TypeCode.type_modifier returns the value field -of one of the following interfaces. The VM in the names of these -interfaces stands for "value modifier." -
    -
  • -VM_NONE - -
  • -VM_ABSTRACT - -
  • -VM_CUSTOM - -
  • -VM_TRUNCATABLE -
-The following constants are returned by a ValueMember object's -access method to denote the visibility of the ValueMember object. -
    -
  • -PRIVATE_MEMBER - -
  • -PUBLIC_MEMBER -
-These flags, used in NamedValue objects or as parameters to methods, -are defined in the following interfaces: -
    -
  • -ARG_IN - -
  • -ARG_INOUT - -
  • -ARG_OUT - -
  • -CTX_RESTRICT_SCOPE -
- -

-Interface Repository Interfaces and Classes

-A fourth group contains the Interface Repository interfaces and classes, -which are generated by the idlj compiler from the OMG IDL -interface ir.idl. The purpose of the Interface Repository is to -identify the interfaces stored in it so that they can be accessed by an -ORB. Each module, type, interface, attribute, operation, parameter, exception, -constant, and so on is described completely by the Interface Repository -API. - -

An ORB does not require that there be an interface repository, and Java -IDL does not include one. Even though this release does not include an -implementation of an interface repository, the following IR classes and -interfaces have been included for the purpose of creating typecodes (see -create_value_tc, create_struct_tc, create_union_tc and create_exception_tc -methods in interface org.omg.CORBA.ORB): -
  -

    -
  • -IRObject - -
  • -IDLType - -
  • -DefinitionKind - -
  • -StructMember - -
  • -UnionMember - -
  • -ValueMember -
- -
-

-Related Documentation

-For overviews, guides, and a tutorial, please see: -
    -
  • {@extLink idl_guides Java IDL tutorial page}.
  • -
  • {@extLink rmi_iiop_guides RMI-IIOP developer's guide}.
  • -
- - - - -

-

-CORBA Features Not Implemented in Java IDL

- -

Some of the API included in org.omg subpackages is provided for -conformance with the current OMG CORBA specification but is not implemented -in Sun's release of the JDK™. This enables -other JDK licensees to provide implementations of this API in standard -extensions and products. - -

-

Features That Throw NO_IMPLEMENT

- -

Some of the API included in org.omg subpackages throw -NO_IMPLEMENT exceptions for various reasons. Among these reasons -are: -

    -
  • In some cases, for example LocalObject, the complete - implementation according to the specification indicates that - these API should throw NO_IMPLEMENT. - -
  • In most cases, for example methods in ORB.java, - methods that throw - NO_IMPLEMENT are actually implemented in subclasses - elsewhere in the ORB code. - -
  • In some cases, for example _get_interface_def() - and _get_interface, API are really not yet implemented. -
- - - - -

-General Summary of Features or API Not Implemented in This Release:

- -
    -
  • -Interface Repository. An Interface Repository is not required for normal -operation of Java IDL. - -
  • -Java IDL does not support long double. - - -
  • -Policies (org.omg.CORBA.Policy) -and methods for getting them are not implemented. - -
  • -Domain managers (org.omg.CORBA.DomainManager) and methods for -getting them are not implemented. - -
  • -Service Information org.omg.CORBA.ServiceInformation -and ORB method -public boolean get_service_information(short service_type, ServiceInformationHolder service_info) -are not implemented. - -
  • ORB methods for supporting single-threading -(perform_work, work_pending) are not implemented. - -
  • IDL contexts. -
- -
-

-Specific List of Unimplemented Features in Package org.omg.CORBA

- - -

-Unimplemented Methods in package org.omg.CORBA:

- -
    -
  • -ORB - -
      -
    • -public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val) - - - -
    • -public void perform_work() - -
    • -public boolean work_pending() - -
    • -public org.omg.CORBA.Current get_current() - -
    • -create_operation_list - -
    • -get_default_context - -
    • -get_service_information - -
    • -obsolete DynAnys (deprecated in favor of DynamicAny package) - - -
    - - - -
-@since JDK1.2 -@serial exclude - - --- old/src/java.corba/share/classes/org/omg/CORBA/portable/ApplicationException.java 2018-01-30 20:28:46.000000000 -0500 +++ /dev/null 2018-01-30 20:28:46.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA.portable; - -/** -This class is used for reporting application level exceptions between ORBs and stubs. -*/ - -public class ApplicationException extends Exception { - /** - * Constructs an ApplicationException from the CORBA repository ID of the exception - * and an input stream from which the exception data can be read as its parameters. - * @param id the repository id of the user exception - * @param ins the stream which contains the user exception data - */ - public ApplicationException(String id, - InputStream ins) { - this.id = id; - this.ins = ins; - } - - /** - * Returns the CORBA repository ID of the exception - * without removing it from the exceptions input stream. - * @return The CORBA repository ID of this exception - */ - public String getId() { - return id; - } - - /** - * Returns the input stream from which the exception data can be read as its parameters. - * @return The stream which contains the user exception data - */ - public InputStream getInputStream() { - return ins; - } - - private String id; - private InputStream ins; -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/BoxedValueHelper.java 2018-01-30 20:28:47.000000000 -0500 +++ /dev/null 2018-01-30 20:28:47.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA.portable; -import java.io.Serializable; - -public interface BoxedValueHelper { - Serializable read_value(InputStream is); - void write_value(OutputStream os, Serializable value); - String get_id(); -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/CustomValue.java 2018-01-30 20:28:48.000000000 -0500 +++ /dev/null 2018-01-30 20:28:48.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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. - */ - -/** - * Defines the base interface for all custom value types - * generated from IDL. - * - * All value types implement ValueBase either directly - * or indirectly by implementing either the StreamableValue - * or CustomValue interface. - * @author OMG - */ - -package org.omg.CORBA.portable; - -import org.omg.CORBA.CustomMarshal; -/** - * An extension of ValueBase that is implemented by custom value - * types. - */ -public interface CustomValue extends ValueBase, CustomMarshal { - -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/Delegate.java 2018-01-30 20:28:48.000000000 -0500 +++ /dev/null 2018-01-30 20:28:48.000000000 -0500 @@ -1,408 +0,0 @@ -/* - * Copyright (c) 1997, 2002, 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 org.omg.CORBA.portable; - -import org.omg.CORBA.Request; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.NVList; -import org.omg.CORBA.Context; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.SystemException; - -/** - * Specifies a portable API for ORB-vendor-specific - * implementation of the org.omg.CORBA.Object methods. - * - * Each stub (proxy) contains a delegate - * object, to which all org.omg.CORBA.Object methods are forwarded. - * This allows a stub generated by one vendor's ORB to work with the delegate - * from another vendor's ORB. - * - * @see org.omg.CORBA.Object - * @author OMG - */ - -public abstract class Delegate { - - /** - * Return an InterfaceDef for the object reference provided. - * @param self The object reference whose InterfaceDef needs to be returned - * @return the InterfaceDef - */ - public abstract org.omg.CORBA.Object get_interface_def( - org.omg.CORBA.Object self); - - /** - * Returns a duplicate of the object reference provided. - * @param obj The object reference whose duplicate needs to be returned - * @return the duplicate object reference - */ - public abstract org.omg.CORBA.Object duplicate(org.omg.CORBA.Object obj); - - /** - * Releases resources associated with the object reference provided. - * @param obj The object reference whose resources need to be released - */ - public abstract void release(org.omg.CORBA.Object obj); - - /** - * Checks if the object reference is an instance of the given interface. - * @param obj The object reference to be checked. - * @param repository_id The repository identifier of the interface - * to check against. - * @return true if the object reference supports the interface - */ - public abstract boolean is_a(org.omg.CORBA.Object obj, String repository_id); - - /** - * Determines whether the server object for the object reference has been - * destroyed. - * @param obj The object reference which delegated to this delegate. - * @return true if the ORB knows authoritatively that the server object does - * not exist, false otherwise - */ - public abstract boolean non_existent(org.omg.CORBA.Object obj); - - /** - * Determines if the two object references are equivalent. - * @param obj The object reference which delegated to this delegate. - * @param other The object reference to check equivalence against. - * @return true if the objects are CORBA-equivalent. - */ - public abstract boolean is_equivalent(org.omg.CORBA.Object obj, - org.omg.CORBA.Object other); - - /** - * Returns an ORB-internal identifier (hashcode) for this object reference. - * @param obj The object reference which delegated to this delegate. - * @param max specifies an upper bound on the hash value returned by - * the ORB. - * @return ORB-internal hash identifier for object reference - */ - public abstract int hash(org.omg.CORBA.Object obj, int max); - - /** - * Creates a Request instance for use in the Dynamic Invocation Interface. - * @param obj The object reference which delegated to this delegate. - * @param operation The name of the operation to be invoked using the - * Request instance. - * @return the created Request instance - */ - public abstract Request request(org.omg.CORBA.Object obj, String operation); - - /** - * Creates a Request instance for use in the Dynamic Invocation Interface. - * - * @param obj The object reference which delegated to this delegate. - * @param ctx The context to be used. - * @param operation The name of the operation to be - * invoked. - * @param arg_list The arguments to the operation in the - * form of an NVList. - * @param result A container for the result as a NamedValue. - * @return The created Request object. - * - */ - public abstract Request create_request(org.omg.CORBA.Object obj, - Context ctx, - String operation, - NVList arg_list, - NamedValue result); - - /** - * Creates a Request instance for use in the Dynamic Invocation Interface. - * - * @param obj The object reference which delegated to this delegate. - * @param ctx The context to be used. - * @param operation The name of the operation to be - * invoked. - * @param arg_list The arguments to the operation in the - * form of an NVList. - * @param result A container for the result as a NamedValue. - * @param exclist A list of possible exceptions the - * operation can throw. - * @param ctxlist A list of context strings that need - * to be resolved and sent with the - * Request. - * @return The created Request object. - */ - public abstract Request create_request(org.omg.CORBA.Object obj, - Context ctx, - String operation, - NVList arg_list, - NamedValue result, - ExceptionList exclist, - ContextList ctxlist); - - /** - * Provides a reference to the orb associated with its parameter. - * - * @param obj the object reference which delegated to this delegate. - * @return the associated orb. - * @see portable - * package comments for unimplemented features - */ - public org.omg.CORBA.ORB orb(org.omg.CORBA.Object obj) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Returns the Policy object of the specified type - * which applies to this object. - * - * @param self The object reference which delegated to this delegate. - * @param policy_type The type of policy to be obtained. - * @return A Policy object of the type specified by - * the policy_type parameter. - * @exception org.omg.CORBA.BAD_PARAM raised when the value of policy type - * is not valid either because the specified type is not supported by this - * ORB or because a policy object of that type is not associated with this - * Object. - * @see portable - * package comments for unimplemented features - */ - public org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self, - int policy_type) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - /** - * Retrieves the DomainManagers of this object. - * This allows administration services (and applications) to retrieve the - * domain managers, and hence the security and other policies applicable - * to individual objects that are members of the domain. - * - * @param self The object reference which delegated to this delegate. - * @return The list of immediately enclosing domain managers of this object. - * At least one domain manager is always returned in the list since by - * default each object is associated with at least one domain manager at - * creation. - * @see portable - * package comments for unimplemented features - */ - public org.omg.CORBA.DomainManager[] get_domain_managers( - org.omg.CORBA.Object - self) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - /** - * Associates the policies passed in - * with a newly created object reference that it returns. Only certain - * policies that pertain to the invocation of an operation at the client - * end can be overridden using this operation. Attempts to override any - * other policy will result in the raising of the CORBA::NO_PERMISSION - * exception. - * - * @param self The object reference which delegated to this delegate. - * @param policies A sequence of references to Policy objects. - * @param set_add Indicates whether these policies should be added - * onto any otheroverrides that already exist (ADD_OVERRIDE) in - * the object reference, or they should be added to a clean - * override free object reference (SET_OVERRIDE). - * @return A new object reference with the new policies associated with it. - * - * @see portable - * package comments for unimplemented features - */ - public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self, - org.omg.CORBA.Policy[] policies, - org.omg.CORBA.SetOverrideType set_add) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - /** - * Returns true if this object is implemented by a local servant. - * - * @param self The object reference which delegated to this delegate. - * @return true only if the servant incarnating this object is located in - * this Java VM. Return false if the servant is not local or the ORB - * does not support local stubs for this particular servant. The default - * behavior of is_local() is to return false. - */ - public boolean is_local(org.omg.CORBA.Object self) { - return false; - } - - /** - * Returns a Java reference to the servant which should be used for this - * request. servant_preinvoke() is invoked by a local stub. - * If a ServantObject object is returned, then its servant field - * has been set to an object of the expected type (Note: the object may - * or may not be the actual servant instance). The local stub may cast - * the servant field to the expected type, and then invoke the operation - * directly. The ServantRequest object is valid for only one invocation, - * and cannot be used for more than one invocation. - * - * @param self The object reference which delegated to this delegate. - * - * @param operation a string containing the operation name. - * The operation name corresponds to the operation name as it would be - * encoded in a GIOP request. - * - * @param expectedType a Class object representing the expected type of the servant. - * The expected type is the Class object associated with the operations - * class of the stub's interface (e.g. A stub for an interface Foo, - * would pass the Class object for the FooOperations interface). - * - * @return a ServantObject object. - * The method may return a null value if it does not wish to support - * this optimization (e.g. due to security, transactions, etc). - * The method must return null if the servant is not of the expected type. - */ - public ServantObject servant_preinvoke(org.omg.CORBA.Object self, - String operation, - Class expectedType) { - return null; - } - - /** - * servant_postinvoke() is invoked by the local stub after the operation - * has been invoked on the local servant. - * This method must be called if servant_preinvoke() returned a non-null - * value, even if an exception was thrown by the servant's method. - * For this reason, the call to servant_postinvoke() should be placed - * in a Java finally clause. - * - * @param self The object reference which delegated to this delegate. - * - * @param servant the instance of the ServantObject returned from - * the servant_preinvoke() method. - */ - public void servant_postinvoke(org.omg.CORBA.Object self, - ServantObject servant) { - } - - /** - * request is called by a stub to obtain an OutputStream for - * marshaling arguments. The stub must supply the operation name, - * and indicate if a response is expected (i.e is this a oneway - * call). - * - * @param self The object reference which delegated to this delegate. - * @param operation a string containing the operation name. - * The operation name corresponds to the operation name as it would be - * encoded in a GIOP request. - * @param responseExpected false if the operation is a one way operation, - * and true otherwise. - * @return OutputStream the OutputStream into which request arguments - * can be marshaled. - * @see portable - * package comments for unimplemented features - */ - public OutputStream request(org.omg.CORBA.Object self, - String operation, - boolean responseExpected) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * invoke is called by a stub to invoke an operation. The stub provides an - * OutputStream that was previously returned by a request() - * call. invoke returns an InputStream which contains the - * marshaled reply. If an exception occurs, invoke may throw an - * ApplicationException object which contains an InputStream from - * which the user exception state may be unmarshaled. - * - * @param self The object reference which delegated to this delegate. - * @param output the OutputStream which contains marshaled arguments - * @return input the InputStream from which reply parameters can be - * unmarshaled. - * @throws ApplicationException thrown when implementation throws - * (upon invocation) an exception defined as part of its remote method - * definition. - * @throws RemarshalException thrown when remarshalling fails. - * @see portable - * package comments for unimplemented features - */ - public InputStream invoke(org.omg.CORBA.Object self, - OutputStream output) - throws ApplicationException, RemarshalException { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * releaseReply may optionally be called by a stub to release a - * reply stream back to the ORB when the unmarshaling has - * completed. The stub passes the InputStream returned by - * invoke() or ApplicationException.getInputStream(). A null - * value may also be passed to releaseReply, in which case the - * method is a noop. - * - * @param self The object reference which delegated to this delegate. - * @param input the InputStream returned from invoke(). - * @see portable - * package comments for unimplemented features - */ - public void releaseReply(org.omg.CORBA.Object self, - InputStream input) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Provides the implementation to override the toString() method - * of the delegating CORBA object. - * - * @param self the object reference that delegated to this delegate - * @return a String object that represents the object - * reference that delegated to this Delegate - * object - */ - - public String toString(org.omg.CORBA.Object self) { - return self.getClass().getName() + ":" + this.toString(); - } - - /** - * Provides the implementation to override the hashCode() method - * of the delegating CORBA object. - * - * @param self the object reference that delegated to this delegate - * @return an int that represents the hashcode for the - * object reference that delegated to this Delegate - * object - */ - public int hashCode(org.omg.CORBA.Object self) { - return System.identityHashCode(self); - } - - /** - * Provides the implementation to override the equals(java.lang.Object obj) - * method of the delegating CORBA object. - * - * @param self the object reference that delegated to this delegate - * @param obj the Object with which to compare - * @return true if obj equals self; - * false otherwise - */ - public boolean equals(org.omg.CORBA.Object self, java.lang.Object obj) { - return (self == obj); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/IDLEntity.java 2018-01-30 20:28:49.000000000 -0500 +++ /dev/null 2018-01-30 20:28:49.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA.portable; - -/** - * An interface with no members whose only purpose is to serve as a marker - * indicating that an implementing class is a - * Java value type from IDL that has a corresponding Helper class. - * RMI IIOP serialization looks for such a marker to perform - * marshalling/unmarshalling. - **/ -public interface IDLEntity extends java.io.Serializable { - -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/IndirectionException.java 2018-01-30 20:28:50.000000000 -0500 +++ /dev/null 2018-01-30 20:28:50.000000000 -0500 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA.portable; - -import org.omg.CORBA.SystemException; -/** - * The Indirection exception is a Java specific system exception. - * It is thrown when the ORB's input stream is called to demarshal - * a value that is encoded as an indirection that is in the process - * of being demarshaled. This can occur when the ORB input stream - * calls the ValueHandler to demarshal an RMI value whose state - * contains a recursive reference to itself. Because the top-level - * ValueHandler.read_value() call has not yet returned a value, - * the ORB input stream's indirection table does not contain an entry - * for an object with the stream offset specified by the indirection - * tag. The stream offset is returned in the exception's offset field. - * @see org.omg.CORBA_2_3.portable.InputStream - * @see org.omg.CORBA_2_3.portable.OutputStream - */ -public class IndirectionException extends SystemException { - - /** - * Points to the stream's offset. - */ - public int offset; - - /** - * Creates an IndirectionException with the right offset value. - * The stream offset is returned in the exception's offset field. - * This exception is constructed and thrown during reading - * recursively defined values off of a stream. - * - * @param offset the stream offset where recursion is detected. - */ - public IndirectionException(int offset){ - super("", 0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - this.offset = offset; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/InputStream.java 2018-01-30 20:28:51.000000000 -0500 +++ /dev/null 2018-01-30 20:28:51.000000000 -0500 @@ -1,320 +0,0 @@ -/* - * Copyright (c) 1997, 2004, 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 org.omg.CORBA.portable; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -/** - * InputStream is the Java API for reading IDL types - * from CDR marshal streams. These methods are used by the ORB to - * unmarshal IDL types as well as to extract IDL types out of Anys. - * The _array versions of the methods can be directly - * used to read sequences and arrays of IDL types. - * - * @since JDK1.2 - */ - -public abstract class InputStream extends java.io.InputStream -{ - /** - * Reads a boolean value from this input stream. - * - * @return the boolean value read from this input stream - */ - public abstract boolean read_boolean(); - /** - * Reads a char value from this input stream. - * - * @return the char value read from this input stream - */ - public abstract char read_char(); - /** - * Reads a wide char value from this input stream. - * - * @return the char value read from this input stream - */ - public abstract char read_wchar(); - /** - * Reads an octet (that is, a byte) value from this input stream. - * - * @return the byte value read from this input stream - */ - public abstract byte read_octet(); - /** - * Reads a short value from this input stream. - * - * @return the short value read from this input stream - */ - public abstract short read_short(); - /** - * Reads a unsigned short value from this input stream. - * - * @return the short value read from this input stream - */ - public abstract short read_ushort(); - /** - * Reads a CORBA long (that is, Java int) value from this input stream. - * - * @return the int value read from this input stream - */ - public abstract int read_long(); - /** - * Reads an unsigned CORBA long (that is, Java int) value from this input -stream. - * - * @return the int value read from this input stream - */ - public abstract int read_ulong(); - /** - * Reads a CORBA longlong (that is, Java long) value from this input stream. - * - * @return the long value read from this input stream - */ - public abstract long read_longlong(); - /** - * Reads a CORBA unsigned longlong (that is, Java long) value from this input -stream. - * - * @return the long value read from this input stream - */ - public abstract long read_ulonglong(); - /** - * Reads a float value from this input stream. - * - * @return the float value read from this input stream - */ - public abstract float read_float(); - /** - * Reads a double value from this input stream. - * - * @return the double value read from this input stream - */ - public abstract double read_double(); - /** - * Reads a string value from this input stream. - * - * @return the String value read from this input stream - */ - public abstract String read_string(); - /** - * Reads a wide string value from this input stream. - * - * @return the String value read from this input stream - */ - public abstract String read_wstring(); - - /** - * Reads an array of booleans from this input stream. - * @param value returned array of booleans. - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_boolean_array(boolean[] value, int offset, int -length); - /** - * Reads an array of chars from this input stream. - * @param value returned array of chars. - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_char_array(char[] value, int offset, int -length); - /** - * Reads an array of wide chars from this input stream. - * @param value returned array of wide chars. - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_wchar_array(char[] value, int offset, int -length); - /** - * Reads an array of octets (that is, bytes) from this input stream. - * @param value returned array of octets (that is, bytes). - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_octet_array(byte[] value, int offset, int -length); - /** - * Reads an array of shorts from this input stream. - * @param value returned array of shorts. - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_short_array(short[] value, int offset, int -length); - /** - * Reads an array of unsigned shorts from this input stream. - * @param value returned array of shorts. - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_ushort_array(short[] value, int offset, int -length); - /** - * Reads an array of CORBA longs (that is, Java ints) from this input stream. - * @param value returned array of CORBA longs (that is, Java ints). - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_long_array(int[] value, int offset, int -length); - /** - * Reads an array of unsigned CORBA longs (that is, Java ints) from this input -stream. - * @param value returned array of CORBA longs (that is, Java ints). - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_ulong_array(int[] value, int offset, int -length); - /** - * Reads an array of CORBA longlongs (that is, Java longs) from this input -stream. - * @param value returned array of CORBA longs (that is, Java longs). - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_longlong_array(long[] value, int offset, int -length); - /** - * Reads an array of unsigned CORBA longlongs (that is, Java longs) from this -input stream. - * @param value returned array of CORBA longs (that is, Java longs). - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_ulonglong_array(long[] value, int offset, int -length); - /** - * Reads an array of floats from this input stream. - * @param value returned array of floats. - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_float_array(float[] value, int offset, int -length); - /** - * Reads an array of doubles from this input stream. - * @param value returned array of doubles. - * @param offset offset on the stream. - * @param length length of buffer to read. - */ - public abstract void read_double_array(double[] value, int offset, int -length); - - /** - * Reads a CORBA object from this input stream. - * - * @return the Object instance read from this input stream. - */ - public abstract org.omg.CORBA.Object read_Object(); - /** - * Reads a TypeCode from this input stream. - * - * @return the TypeCode instance read from this input stream. - */ - public abstract TypeCode read_TypeCode(); - /** - * Reads an Any from this input stream. - * - * @return the Any instance read from this input stream. - */ - public abstract Any read_any(); - - /** - * Returns principal for invocation. - * @return Principal for invocation. - * @deprecated Deprecated by CORBA 2.2. - */ - @Deprecated - public Principal read_Principal() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - - /** - * @see portable - * package comments for unimplemented features - */ - public int read() throws java.io.IOException { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Reads a BigDecimal number. - * @return a java.math.BigDecimal number - */ - public java.math.BigDecimal read_fixed() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Reads a CORBA context from the stream. - * @return a CORBA context - * @see portable - * package comments for unimplemented features - */ - public org.omg.CORBA.Context read_Context() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - /* - * The following methods were added by orbos/98-04-03: Java to IDL - * Mapping. These are used by RMI over IIOP. - */ - - /** - * Unmarshals an object and returns a CORBA Object, - * which is an instance of the class passed as its argument. - * This class is the stub class of the expected type. - * - * @param clz The Class object for the stub class which - * corresponds to the type that is statistically expected, or - * the Class object for the RMI/IDL interface type that - * is statistically expected. - * @return an Object instance of clz read from this stream - * - * @see portable - * package comments for unimplemented features - */ - public org.omg.CORBA.Object read_Object(java.lang.Class - clz) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Returns the ORB that created this InputStream. - * - * @return the ORB object that created this stream - * - * @see portable - * package comments for unimplemented features - */ - public org.omg.CORBA.ORB orb() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/InvokeHandler.java 2018-01-30 20:28:51.000000000 -0500 +++ /dev/null 2018-01-30 20:28:51.000000000 -0500 @@ -1,72 +0,0 @@ -/* - * Copyright (c) 1998, 2015, 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 org.omg.CORBA.portable; - -/** -This interface provides a dispatching mechanism for an incoming call. -It is invoked by the ORB to dispatch a request to a servant. -*/ - -public interface InvokeHandler { - /** - * Invoked by the ORB to dispatch a request to the servant. - * - * ORB passes the method name, an InputStream containing the - * marshalled arguments, and a ResponseHandler which the servant - * uses to construct a proper reply. - * - * Only CORBA SystemException may be thrown by this method. - * - * The method must return an OutputStream created by the - * ResponseHandler which contains the marshalled reply. - * - * A servant must not retain a reference to the ResponseHandler - * beyond the lifetime of a method invocation. - * - * Servant behaviour is defined as follows: - *

1. Determine correct method, and unmarshal parameters from - * InputStream. - *

2. Invoke method implementation. - *

3. If no user exception, create a normal reply using - * ResponseHandler. - *

4. If user exception occurred, create exception reply using - * ResponseHandler. - *

5. Marshal reply into OutputStream returned by - * ResponseHandler. - *

6. Return OutputStream to ORB. - * - * @param method The method name. - * @param input The InputStream containing the marshalled arguments. - * @param handler The ResponseHandler which the servant uses - * to construct a proper reply - * @return The OutputStream created by the - * ResponseHandler which contains the marshalled reply - * @throws SystemException is thrown when invocation fails due to a CORBA system exception. - */ - - OutputStream _invoke(String method, InputStream input, - ResponseHandler handler) - throws org.omg.CORBA.SystemException; -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/ObjectImpl.java 2018-01-30 20:28:52.000000000 -0500 +++ /dev/null 2018-01-30 20:28:52.000000000 -0500 @@ -1,534 +0,0 @@ -/* - * Copyright (c) 1997, 2006, 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 org.omg.CORBA.portable; - -import org.omg.CORBA.Request; -import org.omg.CORBA.NamedValue; -import org.omg.CORBA.NVList; -import org.omg.CORBA.ExceptionList; -import org.omg.CORBA.ContextList; -import org.omg.CORBA.Context; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.BAD_OPERATION; -import org.omg.CORBA.SystemException; - - -/** - * The common base class for all stub classes; provides default implementations - * of the org.omg.CORBA.Object methods. All method implementations are - * forwarded to a Delegate object stored in the ObjectImpl - * instance. ObjectImpl allows for portable stubs because the - * Delegate can be implemented by a different vendor-specific ORB. - */ - -abstract public class ObjectImpl implements org.omg.CORBA.Object -{ - - /** - * The field that stores the Delegate instance for - * this ObjectImpl object. This Delegate - * instance can be implemented by a vendor-specific ORB. Stub classes, - * which are derived from this ObjectImpl class, can be - * portable because they delegate all of the methods called on them to this - * Delegate object. - */ - private transient Delegate __delegate; - - - /** - * Retrieves the reference to the vendor-specific Delegate - * object to which this ObjectImpl object delegates all - * methods invoked on it. - * - * @return the Delegate contained in this ObjectImpl instance - * @throws BAD_OPERATION if the delegate has not been set - * @see #_set_delegate - */ - public Delegate _get_delegate() { - if (__delegate == null) - throw new BAD_OPERATION("The delegate has not been set!"); - return __delegate; - } - - - /** - * Sets the Delegate for this ObjectImpl instance to the given - * Delegate object. All method invocations on this - * ObjectImpl object will be forwarded to this delegate. - * - * @param delegate the Delegate instance to which - * all method calls on this ObjectImpl object - * will be delegated; may be implemented by a third-party ORB - * @see #_get_delegate - */ - public void _set_delegate(Delegate delegate) { - __delegate = delegate; - } - - /** - * Retrieves a string array containing the repository identifiers - * supported by this ObjectImpl object. For example, - * for a stub, this method returns information about all the - * interfaces supported by the stub. - * - * @return the array of all repository identifiers supported by this - * ObjectImpl instance - */ - public abstract String[] _ids(); - - - /** - * Returns a duplicate of this ObjectImpl object. - * - * @return an orb.omg.CORBA.Object object that is - * a duplicate of this object - */ - public org.omg.CORBA.Object _duplicate() { - return _get_delegate().duplicate(this); - } - - /** - * Releases the resources associated with this ObjectImpl object. - */ - public void _release() { - _get_delegate().release(this); - } - - /** - * Checks whether the object identified by the given repository - * identifier is an ObjectImpl object. - * - * @param repository_id a String object with the repository - * identifier to check - * @return true if the object identified by the given - * repository id is an instance of ObjectImpl; - * false otherwise - */ - public boolean _is_a(String repository_id) { - return _get_delegate().is_a(this, repository_id); - } - - /** - * Checks whether the the given ObjectImpl object is - * equivalent to this ObjectImpl object. - * - * @param that an instance of ObjectImpl to compare with - * this ObjectImpl object - * @return true if the given object is equivalent - * to this ObjectImpl object; - * false otherwise - */ - public boolean _is_equivalent(org.omg.CORBA.Object that) { - return _get_delegate().is_equivalent(this, that); - } - - /** - * Checks whether the server object for this ObjectImpl - * object has been destroyed. - * - * @return true if the ORB knows authoritatively that the - * server object does not exist; false otherwise - */ - public boolean _non_existent() { - return _get_delegate().non_existent(this); - } - - /** - * Retrieves the hash code that serves as an ORB-internal identifier for - * this ObjectImpl object. - * - * @param maximum an int indicating the upper bound on the hash - * value returned by the ORB - * @return an int representing the hash code for this - * ObjectImpl object - */ - public int _hash(int maximum) { - return _get_delegate().hash(this, maximum); - } - - /** - * Creates a Request object containing the given method - * that can be used with the Dynamic Invocation Interface. - * - * @param operation the method to be invoked by the new Request - * object - * @return a new Request object initialized with the - * given method - */ - public Request _request(String operation) { - return _get_delegate().request(this, operation); - } - - /** - * Creates a Request object that contains the given context, - * method, argument list, and container for the result. - * - * @param ctx the Context for the request - * @param operation the method that the new Request - * object will invoke - * @param arg_list the arguments for the method; an NVList - * in which each argument is a NamedValue object - * @param result a NamedValue object to be used for - * returning the result of executing the request's method - * @return a new Request object initialized with the - * given context, method, argument list, and container for the - * return value - */ - public Request _create_request(Context ctx, - String operation, - NVList arg_list, - NamedValue result) { - return _get_delegate().create_request(this, - ctx, - operation, - arg_list, - result); - } - - /** - * Creates a Request object that contains the given context, - * method, argument list, container for the result, exceptions, and - * list of property names to be used in resolving the context strings. - * This Request object is for use in the Dynamic - * Invocation Interface. - * - * @param ctx the Context object that contains the - * context strings that must be resolved before they are - * sent along with the request - * @param operation the method that the new Request - * object will invoke - * @param arg_list the arguments for the method; an NVList - * in which each argument is a NamedValue object - * @param result a NamedValue object to be used for - * returning the result of executing the request's method - * @param exceptions a list of the exceptions that the given method - * throws - * @param contexts a list of the properties that are needed to - * resolve the contexts in ctx; the strings in - * contexts are used as arguments to the method - * Context.get_values, - * which returns the value associated with the given property - * @return a new Request object initialized with the - * given context strings to resolve, method, argument list, - * container for the result, exceptions, and list of property - * names to be used in resolving the context strings - */ - public Request _create_request(Context ctx, - String operation, - NVList arg_list, - NamedValue result, - ExceptionList exceptions, - ContextList contexts) { - return _get_delegate().create_request(this, - ctx, - operation, - arg_list, - result, - exceptions, - contexts); - } - - /** - * Retrieves the interface definition for this ObjectImpl - * object. - * - * @return the org.omg.CORBA.Object instance that is the - * interface definition for this ObjectImpl object - */ - public org.omg.CORBA.Object _get_interface_def() - { - // First try to call the delegate implementation class's - // "Object get_interface_def(..)" method (will work for JDK1.2 ORBs). - // Else call the delegate implementation class's - // "InterfaceDef get_interface(..)" method using reflection - // (will work for pre-JDK1.2 ORBs). - - org.omg.CORBA.portable.Delegate delegate = _get_delegate(); - try { - // If the ORB's delegate class does not implement - // "Object get_interface_def(..)", this will call - // get_interface_def(..) on portable.Delegate. - return delegate.get_interface_def(this); - } - catch( org.omg.CORBA.NO_IMPLEMENT ex ) { - // Call "InterfaceDef get_interface(..)" method using reflection. - try { - Class[] argc = { org.omg.CORBA.Object.class }; - java.lang.reflect.Method meth = - delegate.getClass().getMethod("get_interface", argc); - Object[] argx = { this }; - return (org.omg.CORBA.Object)meth.invoke(delegate, argx); - } - catch( java.lang.reflect.InvocationTargetException exs ) { - Throwable t = exs.getTargetException(); - if (t instanceof Error) { - throw (Error) t; - } - else if (t instanceof RuntimeException) { - throw (RuntimeException) t; - } - else { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - } catch( RuntimeException rex ) { - throw rex; - } catch( Exception exr ) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - } - } - - /** - * Returns a reference to the ORB associated with this object and - * its delegate. This is the ORB object that created - * the delegate. - * - * @return the ORB instance that created the - * Delegate object contained in this - * ObjectImpl object - */ - public org.omg.CORBA.ORB _orb() { - return _get_delegate().orb(this); - } - - - /** - * Retrieves the Policy object for this - * ObjectImpl object that has the given - * policy type. - * - * @param policy_type an int indicating the policy type - * @return the Policy object that is the specified policy type - * and that applies to this ObjectImpl object - * @see org.omg.CORBA.PolicyOperations#policy_type - */ - public org.omg.CORBA.Policy _get_policy(int policy_type) { - return _get_delegate().get_policy(this, policy_type); - } - - /** - * Retrieves a list of the domain managers for this - * ObjectImpl object. - * - * @return an array containing the DomainManager - * objects for this instance of ObjectImpl - */ - public org.omg.CORBA.DomainManager[] _get_domain_managers() { - return _get_delegate().get_domain_managers(this); - } - - /** - * Sets this ObjectImpl object's override type for - * the given policies to the given instance of - * SetOverrideType. - * - * @param policies an array of Policy objects with the - * policies that will replace the current policies or be - * added to the current policies - * @param set_add either SetOverrideType.SET_OVERRIDE, - * indicating that the given policies will replace any existing - * ones, or SetOverrideType.ADD_OVERRIDE, indicating - * that the given policies should be added to any existing ones - * @return an Object with the given policies replacing or - * added to its previous policies - */ - public org.omg.CORBA.Object - _set_policy_override(org.omg.CORBA.Policy[] policies, - org.omg.CORBA.SetOverrideType set_add) { - return _get_delegate().set_policy_override(this, policies, - set_add); - } - - /** - * Checks whether this ObjectImpl object is implemented - * by a local servant. If so, local invocation API's may be used. - * - * @return true if this object is implemented by a local - * servant; false otherwise - */ - public boolean _is_local() { - return _get_delegate().is_local(this); - } - - /** - * Returns a Java reference to the local servant that should be used for sending - * a request for the method specified. If this ObjectImpl - * object is a local stub, it will invoke the _servant_preinvoke - * method before sending a request in order to obtain the - * ServantObject instance to use. - *

- * If a ServantObject object is returned, its servant - * field has been set to an object of the expected type (Note: the object may - * or may not be the actual servant instance). The local stub may cast - * the servant field to the expected type, and then invoke the operation - * directly. The ServantRequest object is valid for only one - * invocation and cannot be used for more than one invocation. - * - * @param operation a String containing the name of the method - * to be invoked. This name should correspond to the method name as - * it would be encoded in a GIOP request. - * - * @param expectedType a Class object representing the - * expected type of the servant that is returned. This expected - * type is the Class object associated with the - * operations class for the stub's interface. For example, a - * stub for an interface Foo would pass the - * Class object for the FooOperations - * interface. - * - * @return (1) a ServantObject object, which may or may - * not be the actual servant instance, or (2) null if - * (a) the servant is not local or (b) the servant has ceased to - * be local due to a ForwardRequest from a POA ServantManager - * @throws org.omg.CORBA.BAD_PARAM if the servant is not the expected type - */ - public ServantObject _servant_preinvoke(String operation, - Class expectedType) { - return _get_delegate().servant_preinvoke(this, operation, - expectedType); - } - - /** - * Is called by the local stub after it has invoked an operation - * on the local servant that was previously retrieved from a - * call to the method _servant_preinvoke. - * The _servant_postinvoke method must be called - * if the _servant_preinvoke - * method returned a non-null value, even if an exception was thrown - * by the method invoked by the servant. For this reason, the call - * to the method _servant_postinvoke should be placed - * in a Java finally clause. - * - * @param servant the instance of the ServantObject - * returned by the _servant_preinvoke method - */ - public void _servant_postinvoke(ServantObject servant) { - _get_delegate().servant_postinvoke(this, servant); - } - - /* - * The following methods were added by orbos/98-04-03: Java to IDL - * Mapping. These are used by RMI over IIOP. - */ - - /** - * Returns an OutputStream object to use for marshalling - * the arguments of the given method. This method is called by a stub, - * which must indicate if a response is expected, that is, whether or not - * the call is oneway. - * - * @param operation a String giving the name of the method. - * @param responseExpected a boolean -- true if the - * request is not one way, that is, a response is expected - * @return an OutputStream object for dispatching the request - */ - public OutputStream _request(String operation, - boolean responseExpected) { - return _get_delegate().request(this, operation, responseExpected); - } - - /** - * Invokes an operation and returns an InputStream - * object for reading the response. The stub provides the - * OutputStream object that was previously returned by a - * call to the _request method. The method specified - * as an argument to _request when it was - * called previously is the method that this method invokes. - *

- * If an exception occurs, the _invoke method may throw an - * ApplicationException object that contains an InputStream from - * which the user exception state may be unmarshalled. - * - * @param output an OutputStream object for dispatching the request - * @return an InputStream object containing the marshalled - * response to the method invoked - * @throws ApplicationException if the invocation - * meets application-defined exception - * @throws RemarshalException if the invocation leads - * to a remarshalling error - * @see #_request - */ - public InputStream _invoke(OutputStream output) - throws ApplicationException, RemarshalException { - return _get_delegate().invoke(this, output); - } - - /** - * Releases the given - * reply stream back to the ORB when unmarshalling has - * completed after a call to the method _invoke. - * Calling this method is optional for the stub. - * - * @param input the InputStream object that was returned - * by the _invoke method or the - * ApplicationException.getInputStream method; - * may be null, in which case this method does - * nothing - * @see #_invoke - */ - public void _releaseReply(InputStream input) { - _get_delegate().releaseReply(this, input); - } - - /** - * Returns a String object that represents this - * ObjectImpl object. - * - * @return the String representation of this object - */ - public String toString() { - if ( __delegate != null ) - return __delegate.toString(this); - else - return getClass().getName() + ": no delegate set"; - } - - /** - * Returns the hash code for this ObjectImpl object. - * - * @return the hash code for this object - */ - public int hashCode() { - if ( __delegate != null ) - return __delegate.hashCode(this); - else - return super.hashCode(); - } - - /** - * Compares this ObjectImpl object with the given one - * for equality. - * - *@param obj the object with which to compare this object - *@return true if the two objects are equal; - * false otherwise - */ - public boolean equals(java.lang.Object obj) { - if ( __delegate != null ) - return __delegate.equals(this, obj); - else - return (this==obj); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/OutputStream.java 2018-01-30 20:28:53.000000000 -0500 +++ /dev/null 2018-01-30 20:28:53.000000000 -0500 @@ -1,287 +0,0 @@ -/* - * Copyright (c) 1997, 2004, 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 org.omg.CORBA.portable; - -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.Principal; -import org.omg.CORBA.Any; - -/** - * OuputStream is the Java API for writing IDL types - * to CDR marshal streams. These methods are used by the ORB to - * marshal IDL types as well as to insert IDL types into Anys. - * The _array versions of the methods can be directly - * used to write sequences and arrays of IDL types. - * - * @since JDK1.2 - */ - - -public abstract class OutputStream extends java.io.OutputStream -{ - /** - * Returns an input stream with the same buffer. - *@return an input stream with the same buffer. - */ - public abstract InputStream create_input_stream(); - - /** - * Writes a boolean value to this stream. - * @param value the value to be written. - */ - public abstract void write_boolean(boolean value); - /** - * Writes a char value to this stream. - * @param value the value to be written. - */ - public abstract void write_char(char value); - /** - * Writes a wide char value to this stream. - * @param value the value to be written. - */ - public abstract void write_wchar(char value); - /** - * Writes a CORBA octet (i.e. byte) value to this stream. - * @param value the value to be written. - */ - public abstract void write_octet(byte value); - /** - * Writes a short value to this stream. - * @param value the value to be written. - */ - public abstract void write_short(short value); - /** - * Writes an unsigned short value to this stream. - * @param value the value to be written. - */ - public abstract void write_ushort(short value); - /** - * Writes a CORBA long (i.e. Java int) value to this stream. - * @param value the value to be written. - */ - public abstract void write_long(int value); - /** - * Writes an unsigned CORBA long (i.e. Java int) value to this stream. - * @param value the value to be written. - */ - public abstract void write_ulong(int value); - /** - * Writes a CORBA longlong (i.e. Java long) value to this stream. - * @param value the value to be written. - */ - public abstract void write_longlong(long value); - /** - * Writes an unsigned CORBA longlong (i.e. Java long) value to this stream. - * @param value the value to be written. - */ - public abstract void write_ulonglong(long value); - /** - * Writes a float value to this stream. - * @param value the value to be written. - */ - public abstract void write_float(float value); - /** - * Writes a double value to this stream. - * @param value the value to be written. - */ - public abstract void write_double(double value); - /** - * Writes a string value to this stream. - * @param value the value to be written. - */ - public abstract void write_string(String value); - /** - * Writes a wide string value to this stream. - * @param value the value to be written. - */ - public abstract void write_wstring(String value); - - /** - * Writes an array of booleans on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_boolean_array(boolean[] value, int offset, - int length); - /** - * Writes an array of chars on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_char_array(char[] value, int offset, - int length); - /** - * Writes an array of wide chars on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_wchar_array(char[] value, int offset, - int length); - /** - * Writes an array of CORBA octets (bytes) on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_octet_array(byte[] value, int offset, - int length); - /** - * Writes an array of shorts on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_short_array(short[] value, int offset, - int length); - /** - * Writes an array of unsigned shorts on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_ushort_array(short[] value, int offset, - int length); - /** - * Writes an array of CORBA longs (i.e. Java ints) on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_long_array(int[] value, int offset, - int length); - /** - * Writes an array of unsigned CORBA longs (i.e. Java ints) on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_ulong_array(int[] value, int offset, - int length); - /** - * Writes an array of CORBA longlongs (i.e. Java longs) on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_longlong_array(long[] value, int offset, - int length); - /** - * Writes an array of unsigned CORBA longlongs (i.e. Java ints) on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_ulonglong_array(long[] value, int offset, - int length); - /** - * Writes an array of floats on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_float_array(float[] value, int offset, - int length); - /** - * Writes an array of doubles on this output stream. - * @param value the array to be written. - * @param offset offset on the stream. - * @param length length of buffer to write. - */ - public abstract void write_double_array(double[] value, int offset, - int length); - /** - * Writes a CORBA Object on this output stream. - * @param value the value to be written. - */ - public abstract void write_Object(org.omg.CORBA.Object value); - /** - * Writes a TypeCode on this output stream. - * @param value the value to be written. - */ - public abstract void write_TypeCode(TypeCode value); - /** - * Writes an Any on this output stream. - * @param value the value to be written. - */ - public abstract void write_any(Any value); - - /** - * Writes a Principle on this output stream. - * @param value the value to be written. - * @deprecated Deprecated by CORBA 2.2. - */ - @Deprecated - public void write_Principal(Principal value) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Writes an integer (length of arrays) onto this stream. - * @param b the value to be written. - * @throws java.io.IOException if there is an input/output error - * @see portable - * package comments for unimplemented features - */ - public void write(int b) throws java.io.IOException { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Writes a BigDecimal number. - * @param value a BidDecimal--value to be written. - */ - public void write_fixed(java.math.BigDecimal value) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Writes a CORBA context on this stream. The - * Context is marshaled as a sequence of strings. - * Only those Context values specified in the contexts - * parameter are actually written. - * @param ctx a CORBA context - * @param contexts a ContextList object containing the list of contexts - * to be written - * @see portable - * package comments for unimplemented features - */ - public void write_Context(org.omg.CORBA.Context ctx, - org.omg.CORBA.ContextList contexts) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Returns the ORB that created this OutputStream. - * @return the ORB that created this OutputStream - * @see portable - * package comments for unimplemented features - */ - public org.omg.CORBA.ORB orb() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/RemarshalException.java 2018-01-30 20:28:53.000000000 -0500 +++ /dev/null 2018-01-30 20:28:53.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA.portable; - -/** -This class is used for reporting locate forward exceptions and object forward -GIOP messages back to the ORB. In this case the ORB must remarshal the request -before trying again. -Stubs which use the stream-based model shall catch the RemarshalException -which is potentially thrown from the _invoke() method of ObjectImpl. -Upon catching the exception, the stub shall immediately remarshal the request by calling -_request(), marshalling the arguments (if any), and then calling -_invoke(). The stub shall repeat this process until _invoke() -returns normally or raises some exception other than RemarshalException. -*/ - -public final class RemarshalException extends Exception { - /** - * Constructs a RemarshalException. - */ - public RemarshalException() { - super(); - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/ResponseHandler.java 2018-01-30 20:28:54.000000000 -0500 +++ /dev/null 2018-01-30 20:28:54.000000000 -0500 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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 org.omg.CORBA.portable; - -/** -This interface is supplied by an ORB to a servant at invocation time and allows -the servant to later retrieve an OutputStream for returning the invocation results. -*/ - -public interface ResponseHandler { - /** - * Called by the servant during a method invocation. The servant - * should call this method to create a reply marshal buffer if no - * exception occurred. - * - * @return an OutputStream suitable for marshalling the reply. - * - * @see portable - * package comments for unimplemented features - */ - OutputStream createReply(); - - /** - * Called by the servant during a method invocation. The servant - * should call this method to create a reply marshal buffer if a - * user exception occurred. - * - * @return an OutputStream suitable for marshalling the exception - * ID and the user exception body. - */ - OutputStream createExceptionReply(); -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/ServantObject.java 2018-01-30 20:28:55.000000000 -0500 +++ /dev/null 2018-01-30 20:28:55.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - - -package org.omg.CORBA.portable; - -/** - This class is part of the local stub API, the purpose of which is to provide - high performance calls for collocated clients and servers - (i.e. clients and servers residing in the same Java VM). - The local stub API is supported via three additional methods on - ObjectImpl and Delegate. - ORB vendors may subclass this class to return additional - request state that may be required by their implementations. - @see ObjectImpl - @see Delegate -*/ - -public class ServantObject -{ - /** The real servant. The local stub may cast this field to the expected type, and then - * invoke the operation directly. Note, the object may or may not be the actual servant - * instance. - */ - public java.lang.Object servant; -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/Streamable.java 2018-01-30 20:28:56.000000000 -0500 +++ /dev/null 2018-01-30 20:28:56.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1997, 1999, 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 org.omg.CORBA.portable; - -import org.omg.CORBA.TypeCode; - -/** - * The base class for the Holder classess of all complex - * IDL types. The ORB treats all generated Holders as Streamable to invoke - * the methods for marshalling and unmarshalling. - * - * @since JDK1.2 - */ - -public interface Streamable { - /** - * Reads data from istream and initalizes the - * value field of the Holder with the unmarshalled data. - * - * @param istream the InputStream that represents the CDR data from the wire. - */ - void _read(InputStream istream); - /** - * Marshals to ostream the value in the - * value field of the Holder. - * - * @param ostream the CDR OutputStream - */ - void _write(OutputStream ostream); - - /** - * Retrieves the TypeCode object corresponding to the value - * in the value field of the Holder. - * - * @return the TypeCode object for the value held in the holder - */ - TypeCode _type(); -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/StreamableValue.java 2018-01-30 20:28:56.000000000 -0500 +++ /dev/null 2018-01-30 20:28:56.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 1999, 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 org.omg.CORBA.portable; - -/** - * Defines the base type for all non-boxed IDL valuetypes - * that are not custom marshaled. - * - * All value types implement ValueBase either directly or - * indirectly by implementing either the - * StreamableValue or CustomValue interface. - * - * @author OMG - */ -public interface StreamableValue extends Streamable, ValueBase { - -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/UnknownException.java 2018-01-30 20:28:57.000000000 -0500 +++ /dev/null 2018-01-30 20:28:57.000000000 -0500 @@ -1,58 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA.portable; -/** - * The org.omg.CORBA.portable.UnknownException is used for reporting - * unknown exceptions between ties and ORBs and between ORBs and stubs. - * It provides a Java representation of an UNKNOWN system exception - * that has an UnknownExceptionInfo service context. - * If the CORBA system exception org.omg.CORBA.portable.UnknownException - * is thrown, then the stub does one of the following: - * (1) Translates it to org.omg.CORBA.UNKNOWN. - * (2) Translates it to the nested exception that the UnknownException contains. - * (3) Passes it on directly to the user. - */ -public class UnknownException extends org.omg.CORBA.SystemException { - /** - * A throwable--the original exception that was wrapped in a CORBA - * UnknownException. - */ - public Throwable originalEx; - /** - * Constructs an UnknownException object. - * @param ex a Throwable object--to be wrapped in this exception. - */ - public UnknownException(Throwable ex) { - super("", 0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - originalEx = ex; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/ValueBase.java 2018-01-30 20:28:58.000000000 -0500 +++ /dev/null 2018-01-30 20:28:58.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA.portable; -/** - * The generated Java classes corresponding to valuetype IDL types - * implement this interface. In other words, the Java mapping of - * valuetype objects implement the ValueBase interface. The generated - * Java class for valuetype's shall provide an implementation of the - * ValueBase interface for the corresponding value type. - * For value types that are streamable (i.e. non-custom), - * the generated Java class shall also provide an implementation - * for the org.omg.CORBA.portable.Streamable interface. - * (CORBA::ValueBase is mapped to java.io.Serializable.) - */ -public interface ValueBase extends IDLEntity { - /** - * Provides truncatable repository ids. - * @return a String array--list of truncatable repository ids. - */ - String[] _truncatable_ids(); -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/ValueFactory.java 2018-01-30 20:28:58.000000000 -0500 +++ /dev/null 2018-01-30 20:28:59.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA.portable; -import java.io.Serializable; - -/** - * The ValueFactory interface is the native mapping for the IDL - * type CORBA::ValueFactory. The read_value() method is called by - * the ORB runtime while in the process of unmarshaling a value type. - * A user shall implement this method as part of implementing a type - * specific value factory. In the implementation, the user shall call - * is.read_value(java.io.Serializable) with a uninitialized valuetype - * to use for unmarshaling. The value returned by the stream is - * the same value passed in, with all the data unmarshaled. - * @see org.omg.CORBA_2_3.ORB - */ - -public interface ValueFactory { - /** - * Is called by - * the ORB runtime while in the process of unmarshaling a value type. - * A user shall implement this method as part of implementing a type - * specific value factory. - * @param is an InputStream object--from which the value will be read. - * @return a Serializable object--the value read off of "is" Input stream. - */ - Serializable read_value(org.omg.CORBA_2_3.portable.InputStream is); -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/ValueInputStream.java 2018-01-30 20:28:59.000000000 -0500 +++ /dev/null 2018-01-30 20:28:59.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2002, 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 org.omg.CORBA.portable; - -/** - * Java to IDL ptc 02-01-12 1.5.1.4 - * - * ValueInputStream is used for implementing RMI-IIOP - * stream format version 2. - */ -public interface ValueInputStream { - - /** - * The start_value method reads a valuetype - * header for a nested custom valuetype and - * increments the valuetype nesting depth. - */ - void start_value(); - - /** - * The end_value method reads the end tag - * for the nested custom valuetype (after - * skipping any data that precedes the end - * tag) and decrements the valuetype nesting - * depth. - */ - void end_value(); -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/ValueOutputStream.java 2018-01-30 20:29:00.000000000 -0500 +++ /dev/null 2018-01-30 20:29:00.000000000 -0500 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2002, 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 org.omg.CORBA.portable; - -/** - * Java to IDL ptc 02-01-12 1.5.1.3 - * - * ValueOutputStream is used for implementing RMI-IIOP - * stream format version 2. - */ -public interface ValueOutputStream { - /** - * The start_value method ends any currently open chunk, - * writes a valuetype header for a nested custom valuetype - * (with a null codebase and the specified repository ID), - * and increments the valuetype nesting depth. - */ - void start_value(java.lang.String rep_id); - - /** - * The end_value method ends any currently open chunk, - * writes the end tag for the nested custom valuetype, - * and decrements the valuetype nesting depth. - */ - void end_value(); -} --- old/src/java.corba/share/classes/org/omg/CORBA/portable/package.html 2018-01-30 20:29:01.000000000 -0500 +++ /dev/null 2018-01-30 20:29:01.000000000 -0500 @@ -1,96 +0,0 @@ - - - - - - - -Provides a portability layer, that is, a set of ORB APIs -that makes it possible for code generated -by one vendor to run on another vendor's ORB. -Stubs and other code, generated either from IDL or -interfaces written in the Java programming language, -can call into these ORB APIs. - - - -

- -


-

CORBA Features Throwing NO_IMPLEMENT() Exceptions

-
-Some methods throw NO_IMPLEMENT() exceptions by default, but ORB vendors -can override them to provide real implementations. The ORB included in -Sun's release of the Java[tm] Platform, Standard Edition 6, includes -implementations for the following methods. - -

List of Unimplemented Features in Package -org.omg.CORBA.portable

- -

Unimplemented Interfaces in package org.omg.CORBA.portable

-
    -
  • InvokeHandler -
  • ResponseHandler -
- -

Unimplemented Methods in package org.omg.CORBA.portable

-
    -
  • InputStream -
      -
    • public int read() -
    • public.math.BigDecimal read_fixed() -
    • public org.omg.CORBA.Context read_Context() -
    • public org.omg.CORBA.Object read_Object(java.lang.Class clz) -
    • public org.omg.CORBA.ORB orb() -
    -
  • OutputStream -
      -
    • public org.omg.CORBA.ORB orb() -
    • public void write_Context(org.omg.CORBA.Context ctx, - org.omg.CORBA.ContextList contexts) -
    • public void write_fixed(java.math.BigDecimal value) -
    • public void write(int b) -
    -
  • Delegate -
      -
    • public void releaseReply(org.omg.CORBA.Object self, InputStream input) -
    • public InputStream invoke(org.omgl.CORBA.Object self, OutputStream output) -
    • public OutputStream request(org.omg.CORBA.Object self, String operation, - boolean responseExpected) -
    • public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self, - org.omg.CORBA.Policy[] policies, - org.omg.CORBA.SetOverrideType set_add) -
    • public org.omg.CORBA.DomainManager[] get_domain_managers( - org.omg.CORBA.Objectself) -
    • public org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self, - int policy_type) -
    -
- -@since JDK1.2 -@serial exclude - - --- old/src/java.corba/share/classes/org/omg/CORBA_2_3/ORB.java 2018-01-30 20:29:01.000000000 -0500 +++ /dev/null 2018-01-30 20:29:01.000000000 -0500 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 1998, 2003, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA_2_3; - -/** - * A class extending org.omg.CORBA.ORB to make the ORB - * portable under the OMG CORBA version 2.3 specification. - */ -public abstract class ORB extends org.omg.CORBA.ORB { - -/** - * - */ - public org.omg.CORBA.portable.ValueFactory register_value_factory(String id, - org.omg.CORBA.portable.ValueFactory factory) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - -/** - * - */ - public void unregister_value_factory(String id) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - -/** - * - */ - public org.omg.CORBA.portable.ValueFactory lookup_value_factory(String id) - { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - -/** - * @see CORBA_2_3 package - * comments for unimplemented features - */ - // always return a ValueDef or throw BAD_PARAM if - // repid does not represent a valuetype - public org.omg.CORBA.Object get_value_def(String repid) - throws org.omg.CORBA.BAD_PARAM { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - -/** - * @see CORBA_2_3 package - * comments for unimplemented features - */ - public void set_delegate(java.lang.Object wrapper) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - -} --- old/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html 2018-01-30 20:29:02.000000000 -0500 +++ /dev/null 2018-01-30 20:29:02.000000000 -0500 @@ -1,67 +0,0 @@ - - - - - - package - - - -The CORBA_2_3 package defines additions to existing CORBA interfaces -in the Java[tm] Standard Edition 6.   These changes occurred in recent -revisions to the CORBA API defined by the OMG.  The new methods were -added to  interfaces derived from the corresponding interfaces in -the CORBA package.  This provides backward compatibility and avoids -breaking the JCK tests. - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6, ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. -

- -The following methods in the abstract class -org.omg.CORBA_2_3.ORB are unimplemented: -

    -
  • public org.omg.CORBA.portable.ValueFactory - register_value_factory(String id, org.omg.CORBA.portable.ValueFactory - factory) -
  • public void unregister_value_factory(String id) -
  • public org.omg.CORBA.portable.ValueFactory - lookup_value_factory(String id) -
  • public org.omg.CORBA.Object get_value_def(String repid) -
  • public void set_delegate(java.lang.Object wrapper) -
-@since JDK 1.3 -
-@serial exclude - - - --- old/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/Delegate.java 2018-01-30 20:29:03.000000000 -0500 +++ /dev/null 2018-01-30 20:29:03.000000000 -0500 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA_2_3.portable; - -/** - * Delegate class provides the ORB vendor specific implementation - * of CORBA object. It extends org.omg.CORBA.portable.Delegate and - * provides new methods that were defined by CORBA 2.3. - * - * @see org.omg.CORBA.portable.Delegate - * @author OMG - * @since JDK1.2 - */ - -public abstract class Delegate extends org.omg.CORBA.portable.Delegate { - - /** Returns the codebase for object reference provided. - * @param self the object reference whose codebase needs to be returned. - * @return the codebase as a space delimited list of url strings or - * null if none. - */ - public java.lang.String get_codebase(org.omg.CORBA.Object self) { - return null; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java 2018-01-30 20:29:04.000000000 -0500 +++ /dev/null 2018-01-30 20:29:04.000000000 -0500 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 1998, 2017, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA_2_3.portable; - -import java.io.SerializablePermission; -import java.security.AccessController; -import java.security.PrivilegedAction; - -/** - * InputStream provides for the reading of all of the mapped IDL types - * from the stream. It extends org.omg.CORBA.portable.InputStream. This - * class defines new methods that were added for CORBA 2.3. - * - * @see org.omg.CORBA.portable.InputStream - * @author OMG - * @since JDK1.2 - */ - -public abstract class InputStream extends org.omg.CORBA.portable.InputStream { - - - private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowInputStreamSubclass"; - - private static final boolean allowSubclass = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Boolean run() { - String prop = System.getProperty(ALLOW_SUBCLASS_PROP); - return prop == null ? false : - (prop.equalsIgnoreCase("false") ? false : true); - } - }); - - private static Void checkPermission() { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - if (!allowSubclass) - sm.checkPermission(new - SerializablePermission("enableSubclassImplementation")); - } - return null; - } - - private InputStream(Void ignore) { } - - /** - * Create a new instance of this class. - * - * @implNote - * Throws SecurityException if SecurityManager is installed and - * enableSubclassImplementation SerializablePermission - * is not granted or jdk.corba.allowInputStreamSubclass system - * property is either not set or is set to 'false'. - */ - public InputStream() { - this(checkPermission()); - } - - /** - * Unmarshalls a value type from the input stream. - * @return the value type unmarshalled from the input stream - */ - public java.io.Serializable read_value() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Unmarshalls a value type from the input stream. - * @param clz is the declared type of the value to be unmarshalled - * @return the value unmarshalled from the input stream - */ - public java.io.Serializable read_value(java.lang.Class clz) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Unmarshalls a value type from the input stream. - * @param factory is the instance fo the helper to be used for - * unmarshalling the value type - * @return the value unmarshalled from the input stream - */ - public java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Unmarshalls a value type from the input stream. - * @param rep_id identifies the type of the value to be unmarshalled - * @return value type unmarshalled from the input stream - */ - public java.io.Serializable read_value(java.lang.String rep_id) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Unmarshalls a value type from the input stream. - * @param value is an uninitialized value which is added to the orb's - * indirection table before calling Streamable._read() or - * CustomMarshal.unmarshal() to unmarshal the value. - * @return value type unmarshalled from the input stream - */ - public java.io.Serializable read_value(java.io.Serializable value) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Unmarshal the value object or a suitable stub object. - * @return ORB runtime returns the value object or a suitable stub object. - */ - public java.lang.Object read_abstract_interface() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Unmarshal the class object or the stub class corresponding to the passed type. - * @param clz is the Class object for the stub class which corresponds to - * the type that is statically expected. - * @return ORB runtime returns the value object or a suitable stub object. - */ - public java.lang.Object read_abstract_interface(java.lang.Class clz) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/ObjectImpl.java 2018-01-30 20:29:04.000000000 -0500 +++ /dev/null 2018-01-30 20:29:04.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA_2_3.portable; - -import org.omg.CORBA_2_3.portable.Delegate; - -/** - * ObjectImpl class is the base class for all stubs. It provides the - * basic delegation mechanism. It extends org.omg.CORBA.portable.ObjectImpl - * and provides new methods defined by CORBA 2.3. - * - * @see org.omg.CORBA.portable.ObjectImpl - * @author OMG - * @since JDK1.2 - */ - - -public abstract class ObjectImpl extends org.omg.CORBA.portable.ObjectImpl { - - /** Returns the codebase for this object reference. - * @return the codebase as a space delimited list of url strings or - * null if none. - */ - public java.lang.String _get_codebase() { - org.omg.CORBA.portable.Delegate delegate = _get_delegate(); - if (delegate instanceof Delegate) - return ((Delegate) delegate).get_codebase(this); - return null; - } -} --- old/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java 2018-01-30 20:29:05.000000000 -0500 +++ /dev/null 2018-01-30 20:29:05.000000000 -0500 @@ -1,130 +0,0 @@ -/* - * Copyright (c) 1998, 2017, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.CORBA_2_3.portable; - -import java.io.SerializablePermission; -import java.security.AccessController; -import java.security.PrivilegedAction; - -/** - * OutputStream provides interface for writing of all of the mapped IDL type - * to the stream. It extends org.omg.CORBA.portable.OutputStream, and defines - * new methods defined by CORBA 2.3. - * - * @see org.omg.CORBA.portable.OutputStream - * @author OMG - * @since JDK1.2 - */ - -public abstract class OutputStream extends org.omg.CORBA.portable.OutputStream { - - private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowOutputStreamSubclass"; - private static final boolean allowSubclass = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Boolean run() { - String prop = System.getProperty(ALLOW_SUBCLASS_PROP); - return prop == null ? false : - (prop.equalsIgnoreCase("false") ? false : true); - } - }); - - private static Void checkPermission() { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) { - if (!allowSubclass) - sm.checkPermission(new - SerializablePermission("enableSubclassImplementation")); - } - return null; - } - private OutputStream(Void ignore) { } - - /** - * Create a new instance of this class. - * - * @implNote - * Throws SecurityException if SecurityManager is installed and - * enableSubclassImplementation SerializablePermission - * is not granted or jdk.corba.allowOutputStreamSubclass system - * property is either not set or is set to 'false'. - */ - public OutputStream() { - this(checkPermission()); - } - - /** - * Marshals a value type to the output stream. - * @param value is the acutal value to write - */ - public void write_value(java.io.Serializable value) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Marshals a value type to the output stream. - * @param value is the acutal value to write - * @param clz is the declared type of the value to be marshaled - */ - public void write_value(java.io.Serializable value, java.lang.Class clz) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Marshals a value type to the output stream. - * @param value is the acutal value to write - * @param repository_id identifies the type of the value type to - * be marshaled - */ - public void write_value(java.io.Serializable value, String repository_id) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Marshals a value type to the output stream. - * @param value is the acutal value to write - * @param factory is the instance of the helper to be used for marshaling - * the boxed value - */ - public void write_value(java.io.Serializable value, org.omg.CORBA.portable.BoxedValueHelper factory) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - /** - * Marshals a value object or a stub object. - * @param obj the actual value object to marshal or the stub to be marshalled - */ - public void write_abstract_interface(java.lang.Object obj) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - -} --- old/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/package.html 2018-01-30 20:29:06.000000000 -0500 +++ /dev/null 2018-01-30 20:29:06.000000000 -0500 @@ -1,40 +0,0 @@ - - - - - - - - - Provides methods for the input and output of value types, and contains - other updates to the org/omg/CORBA/portable package. - -@since 1.3 -@serial exclude - - --- old/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html 2018-01-30 20:29:06.000000000 -0500 +++ /dev/null 2018-01-30 20:29:07.000000000 -0500 @@ -1,53 +0,0 @@ - - - - - - - -

This package contains the following classes, which are used in -org.omg.CosNaming.NamingContextExt: -

    -
  • AddressHelper -
  • StringNameHelper -
  • URLStringHelper -
  • InvalidAddress -
- -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html 2018-01-30 20:29:07.000000000 -0500 +++ /dev/null 2018-01-30 20:29:07.000000000 -0500 @@ -1,56 +0,0 @@ - - - - - - - -

This package contains Exception classes for the org.omg.CosNaming - package. The list of exception classes are: -

    -
  • AlreadyBound -
  • CannotProceed -
  • InvalidName -
  • NotEmpty -
  • NotFound -
  • NotFoundReason -
- - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/CosNaming/_BindingIteratorImplBase.java 2018-01-30 20:29:08.000000000 -0500 +++ /dev/null 2018-01-30 20:29:08.000000000 -0500 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 1997, 2000, 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. - */ -/* - * File: ./org/omg/CosNaming/_BindingIteratorImplBase.java - * From: nameservice.idl - * Date: Tue Aug 11 03:12:09 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - * @deprecated Deprecated in JDK 1.4. - */ - -package org.omg.CosNaming; -public abstract class _BindingIteratorImplBase extends org.omg.CORBA.DynamicImplementation implements org.omg.CosNaming.BindingIterator { - // Constructor - public _BindingIteratorImplBase() { - super(); - } - // Type strings for this class and its superclases - private static final String _type_ids[] = { - "IDL:omg.org/CosNaming/BindingIterator:1.0" - }; - - public String[] _ids() { return (String[]) _type_ids.clone(); } - - private static java.util.Dictionary _methods = new java.util.Hashtable(); - static { - _methods.put("next_one", new java.lang.Integer(0)); - _methods.put("next_n", new java.lang.Integer(1)); - _methods.put("destroy", new java.lang.Integer(2)); - } - // DSI Dispatch call - public void invoke(org.omg.CORBA.ServerRequest r) { - switch (((java.lang.Integer) _methods.get(r.op_name())).intValue()) { - case 0: // org.omg.CosNaming.BindingIterator.next_one - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _b = _orb().create_any(); - _b.type(org.omg.CosNaming.BindingHelper.type()); - _list.add_value("b", _b, org.omg.CORBA.ARG_OUT.value); - r.params(_list); - org.omg.CosNaming.BindingHolder b; - b = new org.omg.CosNaming.BindingHolder(); - boolean ___result; - ___result = this.next_one(b); - org.omg.CosNaming.BindingHelper.insert(_b, b.value); - org.omg.CORBA.Any __result = _orb().create_any(); - __result.insert_boolean(___result); - r.result(__result); - } - break; - case 1: // org.omg.CosNaming.BindingIterator.next_n - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _how_many = _orb().create_any(); - _how_many.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong)); - _list.add_value("how_many", _how_many, org.omg.CORBA.ARG_IN.value); - org.omg.CORBA.Any _bl = _orb().create_any(); - _bl.type(org.omg.CosNaming.BindingListHelper.type()); - _list.add_value("bl", _bl, org.omg.CORBA.ARG_OUT.value); - r.params(_list); - int how_many; - how_many = _how_many.extract_ulong(); - org.omg.CosNaming.BindingListHolder bl; - bl = new org.omg.CosNaming.BindingListHolder(); - boolean ___result; - ___result = this.next_n(how_many, bl); - org.omg.CosNaming.BindingListHelper.insert(_bl, bl.value); - org.omg.CORBA.Any __result = _orb().create_any(); - __result.insert_boolean(___result); - r.result(__result); - } - break; - case 2: // org.omg.CosNaming.BindingIterator.destroy - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - r.params(_list); - this.destroy(); - org.omg.CORBA.Any __return = _orb().create_any(); - __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void)); - r.result(__return); - } - break; - default: - throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - } - } -} --- old/src/java.corba/share/classes/org/omg/CosNaming/_NamingContextImplBase.java 2018-01-30 20:29:09.000000000 -0500 +++ /dev/null 2018-01-30 20:29:09.000000000 -0500 @@ -1,407 +0,0 @@ -/* - * Copyright (c) 1997, 2000, 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. - */ -/* - * File: ./org/omg/CosNaming/_NamingContextImplBase.java - * From: nameservice.idl - * Date: Tue Aug 11 03:12:09 1998 - * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18 - * @deprecated Deprecated in JDK 1.4. - */ - -package org.omg.CosNaming; -public abstract class _NamingContextImplBase extends org.omg.CORBA.DynamicImplementation implements org.omg.CosNaming.NamingContext { - // Constructor - public _NamingContextImplBase() { - super(); - } - // Type strings for this class and its superclases - private static final String _type_ids[] = { - "IDL:omg.org/CosNaming/NamingContext:1.0" - }; - - public String[] _ids() { return (String[]) _type_ids.clone(); } - - private static java.util.Dictionary _methods = new java.util.Hashtable(); - static { - _methods.put("bind", new java.lang.Integer(0)); - _methods.put("bind_context", new java.lang.Integer(1)); - _methods.put("rebind", new java.lang.Integer(2)); - _methods.put("rebind_context", new java.lang.Integer(3)); - _methods.put("resolve", new java.lang.Integer(4)); - _methods.put("unbind", new java.lang.Integer(5)); - _methods.put("list", new java.lang.Integer(6)); - _methods.put("new_context", new java.lang.Integer(7)); - _methods.put("bind_new_context", new java.lang.Integer(8)); - _methods.put("destroy", new java.lang.Integer(9)); - } - // DSI Dispatch call - public void invoke(org.omg.CORBA.ServerRequest r) { - switch (((java.lang.Integer) _methods.get(r.op_name())).intValue()) { - case 0: // org.omg.CosNaming.NamingContext.bind - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _n = _orb().create_any(); - _n.type(org.omg.CosNaming.NameHelper.type()); - _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value); - org.omg.CORBA.Any _obj = _orb().create_any(); - _obj.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_objref)); - _list.add_value("obj", _obj, org.omg.CORBA.ARG_IN.value); - r.params(_list); - org.omg.CosNaming.NameComponent[] n; - n = org.omg.CosNaming.NameHelper.extract(_n); - org.omg.CORBA.Object obj; - obj = _obj.extract_Object(); - try { - this.bind(n, obj); - } - catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e3) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.insert(_except, e3); - r.except(_except); - return; - } - org.omg.CORBA.Any __return = _orb().create_any(); - __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void)); - r.result(__return); - } - break; - case 1: // org.omg.CosNaming.NamingContext.bind_context - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _n = _orb().create_any(); - _n.type(org.omg.CosNaming.NameHelper.type()); - _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value); - org.omg.CORBA.Any _nc = _orb().create_any(); - _nc.type(org.omg.CosNaming.NamingContextHelper.type()); - _list.add_value("nc", _nc, org.omg.CORBA.ARG_IN.value); - r.params(_list); - org.omg.CosNaming.NameComponent[] n; - n = org.omg.CosNaming.NameHelper.extract(_n); - org.omg.CosNaming.NamingContext nc; - nc = org.omg.CosNaming.NamingContextHelper.extract(_nc); - try { - this.bind_context(n, nc); - } - catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e3) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.insert(_except, e3); - r.except(_except); - return; - } - org.omg.CORBA.Any __return = _orb().create_any(); - __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void)); - r.result(__return); - } - break; - case 2: // org.omg.CosNaming.NamingContext.rebind - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _n = _orb().create_any(); - _n.type(org.omg.CosNaming.NameHelper.type()); - _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value); - org.omg.CORBA.Any _obj = _orb().create_any(); - _obj.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_objref)); - _list.add_value("obj", _obj, org.omg.CORBA.ARG_IN.value); - r.params(_list); - org.omg.CosNaming.NameComponent[] n; - n = org.omg.CosNaming.NameHelper.extract(_n); - org.omg.CORBA.Object obj; - obj = _obj.extract_Object(); - try { - this.rebind(n, obj); - } - catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2); - r.except(_except); - return; - } - org.omg.CORBA.Any __return = _orb().create_any(); - __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void)); - r.result(__return); - } - break; - case 3: // org.omg.CosNaming.NamingContext.rebind_context - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _n = _orb().create_any(); - _n.type(org.omg.CosNaming.NameHelper.type()); - _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value); - org.omg.CORBA.Any _nc = _orb().create_any(); - _nc.type(org.omg.CosNaming.NamingContextHelper.type()); - _list.add_value("nc", _nc, org.omg.CORBA.ARG_IN.value); - r.params(_list); - org.omg.CosNaming.NameComponent[] n; - n = org.omg.CosNaming.NameHelper.extract(_n); - org.omg.CosNaming.NamingContext nc; - nc = org.omg.CosNaming.NamingContextHelper.extract(_nc); - try { - this.rebind_context(n, nc); - } - catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2); - r.except(_except); - return; - } - org.omg.CORBA.Any __return = _orb().create_any(); - __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void)); - r.result(__return); - } - break; - case 4: // org.omg.CosNaming.NamingContext.resolve - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _n = _orb().create_any(); - _n.type(org.omg.CosNaming.NameHelper.type()); - _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value); - r.params(_list); - org.omg.CosNaming.NameComponent[] n; - n = org.omg.CosNaming.NameHelper.extract(_n); - org.omg.CORBA.Object ___result; - try { - ___result = this.resolve(n); - } - catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2); - r.except(_except); - return; - } - org.omg.CORBA.Any __result = _orb().create_any(); - __result.insert_Object(___result); - r.result(__result); - } - break; - case 5: // org.omg.CosNaming.NamingContext.unbind - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _n = _orb().create_any(); - _n.type(org.omg.CosNaming.NameHelper.type()); - _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value); - r.params(_list); - org.omg.CosNaming.NameComponent[] n; - n = org.omg.CosNaming.NameHelper.extract(_n); - try { - this.unbind(n); - } - catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2); - r.except(_except); - return; - } - org.omg.CORBA.Any __return = _orb().create_any(); - __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void)); - r.result(__return); - } - break; - case 6: // org.omg.CosNaming.NamingContext.list - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _how_many = _orb().create_any(); - _how_many.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong)); - _list.add_value("how_many", _how_many, org.omg.CORBA.ARG_IN.value); - org.omg.CORBA.Any _bl = _orb().create_any(); - _bl.type(org.omg.CosNaming.BindingListHelper.type()); - _list.add_value("bl", _bl, org.omg.CORBA.ARG_OUT.value); - org.omg.CORBA.Any _bi = _orb().create_any(); - _bi.type(org.omg.CosNaming.BindingIteratorHelper.type()); - _list.add_value("bi", _bi, org.omg.CORBA.ARG_OUT.value); - r.params(_list); - int how_many; - how_many = _how_many.extract_ulong(); - org.omg.CosNaming.BindingListHolder bl; - bl = new org.omg.CosNaming.BindingListHolder(); - org.omg.CosNaming.BindingIteratorHolder bi; - bi = new org.omg.CosNaming.BindingIteratorHolder(); - this.list(how_many, bl, bi); - org.omg.CosNaming.BindingListHelper.insert(_bl, bl.value); - org.omg.CosNaming.BindingIteratorHelper.insert(_bi, bi.value); - org.omg.CORBA.Any __return = _orb().create_any(); - __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void)); - r.result(__return); - } - break; - case 7: // org.omg.CosNaming.NamingContext.new_context - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - r.params(_list); - org.omg.CosNaming.NamingContext ___result; - ___result = this.new_context(); - org.omg.CORBA.Any __result = _orb().create_any(); - org.omg.CosNaming.NamingContextHelper.insert(__result, ___result); - r.result(__result); - } - break; - case 8: // org.omg.CosNaming.NamingContext.bind_new_context - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - org.omg.CORBA.Any _n = _orb().create_any(); - _n.type(org.omg.CosNaming.NameHelper.type()); - _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value); - r.params(_list); - org.omg.CosNaming.NameComponent[] n; - n = org.omg.CosNaming.NameHelper.extract(_n); - org.omg.CosNaming.NamingContext ___result; - try { - ___result = this.bind_new_context(n); - } - catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e1) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.insert(_except, e1); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e2) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e2); - r.except(_except); - return; - } - catch (org.omg.CosNaming.NamingContextPackage.InvalidName e3) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e3); - r.except(_except); - return; - } - org.omg.CORBA.Any __result = _orb().create_any(); - org.omg.CosNaming.NamingContextHelper.insert(__result, ___result); - r.result(__result); - } - break; - case 9: // org.omg.CosNaming.NamingContext.destroy - { - org.omg.CORBA.NVList _list = _orb().create_list(0); - r.params(_list); - try { - this.destroy(); - } - catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e0) { - org.omg.CORBA.Any _except = _orb().create_any(); - org.omg.CosNaming.NamingContextPackage.NotEmptyHelper.insert(_except, e0); - r.except(_except); - return; - } - org.omg.CORBA.Any __return = _orb().create_any(); - __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void)); - r.result(__return); - } - break; - default: - throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE); - } - } -} --- old/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl 2018-01-30 20:29:09.000000000 -0500 +++ /dev/null 2018-01-30 20:29:09.000000000 -0500 @@ -1,509 +0,0 @@ -/* - * Copyright (c) 1996, 2015, 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. - */ - -// name.idl - Naming service interface -#pragma prefix "omg.org" - - -/** - * The CORBA COS Naming Service provides the ability to bind a name - * to an object relative to a naming context. A naming context is an - * object that contains a set of name bindings in which each name is unique. - * To resolve a name is to determine the object associated with the name in - * a given context.

- * - * See http://www.omg.org/technology/documents/formal/naming_service.htm - * for the complete CORBA - * COS Naming Specification.

- */ -module CosNaming -{ - typedef string Istring; - - /** - * Many of the operations defined on a naming context take names as - * parameters. Names have structure. A name is an ordered sequence of - * components.

- * - * A name with a single component is called a simple name; a name with - * multiple components is called a compound name. Each component except - * the last is used to name a context; the last component denotes the - * bound object.

- * - * A name component consists of two attributes: the identifier - * attribute and the kind attribute. Both the identifier attribute and the - * kind attribute are represented as IDL strings. The kind attribute adds - * descriptive power to names in a syntax-independent way. Examples of the - * value of the kind attribute include c_source, object_code, executable, - * postscript, or " ". - */ - struct NameComponent - { - Istring id; - Istring kind; - }; - - /** - * A name is a sequence of name components. - */ - typedef sequence Name; - - /** - * Specifies whether the given binding is for a object (that is not a - * naming context) or for a naming context. - */ - enum BindingType - { - nobject, // name is bound to an object - ncontext // name is bound to a naming context - }; - - /** - * A name-to-object association is called a Binding. - */ - struct Binding - { - Name binding_name; // name - BindingType binding_type; // whether name is bound to an object - // or a naming context - }; - - /** - * List of Bindings. - */ - typedef sequence BindingList; - - /** - * The BindingIterator interface allows a client to iterate through - * the bindings using the next_one or next_n operations. - * - * The bindings iterator is obtained by using the list - * method on the NamingContext. - * @see org.omg.CosNaming.NamingContext#list - */ - interface BindingIterator - { - /** - * This operation returns the next binding. If there are no more - * bindings, false is returned. - * - * @param b the returned binding - */ - boolean next_one(out Binding b); - - /** - * This operation returns at most the requested number of bindings. - * - * @param how_many the maximum number of bindings to return - * - * @param bl the returned bindings - */ - boolean next_n(in unsigned long how_many, - out BindingList bl); - - // Destroy binding iterator - /** - * This operation destroys the iterator. - */ - void destroy(); - }; - -/** - * A naming context is an object that contains a set of name bindings in - * which each name is unique. Different names can be bound to an object - * in the same or different contexts at the same time.

- * - * See - * CORBA COS - * Naming Specification. - */ - interface NamingContext - { - // Declare exceptions - /** - * Indicates the reason for not able to resolve. - */ - enum NotFoundReason - { - missing_node, - not_context, - not_object - }; - -/** - * Indicates the name does not identify a binding. - */ - exception NotFound - { - NotFoundReason why; - Name rest_of_name; - }; - -/** - * Indicates that the implementation has given up for some reason. - * The client, however, may be able to continue the operation at the - * returned naming context. - */ - exception CannotProceed - { - NamingContext cxt; - Name rest_of_name; - }; - -/** - * Indicates the name is invalid. - */ - exception InvalidName - {}; - -/** - * Indicates an object is already bound to the specified name. Only - * one object can be bound to a particular name in a context. - */ - exception AlreadyBound - {}; - -/** - * Indicates that the Naming Context contains bindings. - */ - exception NotEmpty - {}; - -/** - * Creates a binding of a name and an object in the naming context. - * Naming contexts that are bound using bind do not participate in name - * resolution when compound names are passed to be resolved. - * - * @param n Name of the object. - * - * @param obj The Object to bind with the given name. - * - * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates - * the name does not identify a binding. - * - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed - * Indicates that the implementation has given up for some reason. - * The client, however, may be able to continue the operation - * at the returned naming context. - * - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName - * Indicates that the name is invalid. - * - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound - * Indicates an object is already bound to the specified name. - */ - void bind(in Name n, - in Object obj) - raises(NotFound, - CannotProceed, - InvalidName, - AlreadyBound); - -/** - * Names an object that is a naming context. Naming contexts that - * are bound using bind_context() participate in name resolution - * when compound names are passed to be resolved. - * - * @param n Name of the object. - * - * @param nc NamingContect object to bind with the given name. - * - * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding. - * - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has - * given up for some reason. The client, however, may be able to - * continue the operation at the returned naming context. - * - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. - * - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates an object is already - * bound to the specified name. - */ - void bind_context(in Name n, - in NamingContext nc) - raises(NotFound, - CannotProceed, - InvalidName, - AlreadyBound); - -/** - * Creates a binding of a name and an object in the naming context - * even if the name is already bound in the context. Naming contexts - * that are bound using rebind do not participate in name resolution - * when compound names are passed to be resolved. - * - * @param n Name of the object. - * - * @param obj The Object to rebind with the given name. - * - * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding. - * - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has - * given up for some reason. The client, however, may be able to - * continue the operation at the returned naming context. - * - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. - */ - void rebind(in Name n, - in Object obj) - raises(NotFound, - CannotProceed, - InvalidName); - -/** - * Creates a binding of a name and a naming context in the naming - * context even if the name is already bound in the context. Naming - * contexts that are bound using rebind_context() participate in name - * resolution when compound names are passed to be resolved. - * - * @param n Name of the object. - * - * @param nc NamingContect object to rebind with the given name. - * - * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding. - * - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has - * given up for some reason. The client, however, may be able to - * continue the operation at the returned naming context. - * - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. - */ - void rebind_context(in Name n, - in NamingContext nc) - raises(NotFound, - CannotProceed, - InvalidName); - -/** - * The resolve operation is the process of retrieving an object - * bound to a name in a given context. The given name must exactly - * match the bound name. The naming service does not return the type - * of the object. Clients are responsible for "narrowing" the object - * to the appropriate type. That is, clients typically cast the returned - * object from Object to a more specialized interface. - * - * @param n Name of the object. - * - * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding. - * - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has - * given up for some reason. The client, however, may be able to - * continue the operation at the returned naming context. - * - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. - */ - Object resolve(in Name n) - raises(NotFound, - CannotProceed, - InvalidName); - -/** - * The unbind operation removes a name binding from a context. - * - * @param n Name of the object. - * - * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding. - * - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has - * given up for some reason. The client, however, may be able to - * continue the operation at the returned naming context. - * - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. - */ - void unbind(in Name n) - raises(NotFound, - CannotProceed, - InvalidName); - -/** - * The list operation allows a client to iterate through a set of - * bindings in a naming context.

- * - * The list operation returns at most the requested number of - * bindings in BindingList bl. - *

    - *
  • If the naming context contains additional - * bindings, the list operation returns a BindingIterator with the - * additional bindings. - *
  • If the naming context does not contain additional - * bindings, the binding iterator is a nil object reference. - *
- * - * @param how_many the maximum number of bindings to return. - * - * @param bl the returned list of bindings. - * - * @param bi the returned binding iterator. - */ - void list(in unsigned long how_many, - out BindingList bl, - out BindingIterator bi); - -/** - * This operation returns a naming context implemented by the same - * naming server as the context on which the operation was invoked. - * The new context is not bound to any name. - */ - NamingContext new_context(); - -/** - * This operation creates a new context and binds it to the name - * supplied as an argument. The newly-created context is implemented - * by the same naming server as the context in which it was bound (that - * is, the naming server that implements the context denoted by the - * name argument excluding the last component). - * - * @param n Name of the object. - * - * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding. - * - * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates an object is already - * bound to the specified name. - * - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has - * given up for some reason. The client, however, may be able to - * continue the operation at the returned naming context. - * - * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid. - */ - NamingContext bind_new_context(in Name n) - raises(NotFound, - AlreadyBound, - CannotProceed, - InvalidName); - -/** - * The destroy operation deletes a naming context. If the naming - * context contains bindings, the NotEmpty exception is raised. - * - * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty Indicates that the Naming Context contains bindings. - */ - void destroy() - raises(NotEmpty); - - }; - - -/** - * NamingContextExt is the extension of NamingContext - * which - * contains a set of name bindings in which each name is unique and is - * part of Interoperable Naming Service. - * Different names can be bound to an object in the same or different - * contexts at the same time. Using NamingContextExt, you can use - * URL-based names to bind and resolve. - * - * See - * CORBA COS - * Naming Specification. - */ - interface NamingContextExt: NamingContext - { -/** - * StringName is the Stringified Name, Array of Name Components - * represented as a String. - */ - typedef string StringName; - -/** - * Address is the Host and Port information represented as a String. - */ - typedef string Address; - -/** - * URLString is the URL address (corbaloc: or corbaname:) represented as - * a String. - */ - typedef string URLString; - -/** - * This operation creates a stringified name from the array of Name - * components. - * - * @param n Name of the object. - * - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - * - */ - StringName to_string( in Name n ) raises (InvalidName); - -/** - * This operation converts a Stringified Name into an equivalent array - * of Name Components. - * - * @param sn Stringified Name of the object. - * - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - * - */ - Name to_name( in StringName sn ) raises (InvalidName); - - -/** - * Indicates the invalid Stringified name for the object, The - * reason could be invalid syntax. - */ - exception InvalidAddress - { }; - -/** - * This operation creates a URL based "iiopname://" format name - * from the Stringified Name of the object. - * - * @param addr internet based address of the host machine where Name Service is running. - * @param sn Stringified Name of the object. - * - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress - * Indicates the internet based address of the host machine is incorrect - */ - URLString to_url( in Address addr, in StringName sn ) - raises( InvalidAddress, InvalidName ); - - -/** - * This operation resolves the Stringified name into the object - * reference. - * - * @param sn Stringified Name of the object. - * - * @exception org.omg.CosNaming.NamingContextPackage.NotFound - * Indicates there is no object reference for the given name. - * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed - * Indicates that the given compound name is incorrect. - * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName - * Indicates the name does not identify a binding. - * - */ - Object resolve_str( in StringName sn) - raises( NotFound, CannotProceed, - InvalidName); - - }; - -}; --- old/src/java.corba/share/classes/org/omg/CosNaming/package.html 2018-01-30 20:29:10.000000000 -0500 +++ /dev/null 2018-01-30 20:29:10.000000000 -0500 @@ -1,351 +0,0 @@ - - - - - - - - Provides a naming service for Java IDL. The Object Request Broker Daemon - (ORBD) also includes both a transient and persistent naming service. - - -

- The package and all its classes and interfaces - were generated by running the tool idlj on the file - nameservice.idl, which is a module written in OMG IDL. - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6, ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -

Interfaces

- The package org.omg.CosNaming contains two public interfaces - and several auxiliary classes. -

- The interfaces are: -

    -
  • NamingContext -
  • BindingIterator -
-

- These two interfaces provide the means to bind/unbind names and object - references, to retrieve bound object references, and - to iterate through a list of bindings. The NamingContext - interface supplies the main functionality for the naming service, and - BindingIterator provides a means of iterating through a list - of name/object reference bindings. - -

Auxiliary Classes

- In order to map an OMG IDL interface to the Java programming language, - the idlj compiler creates Java classes that can be thought of - as auxiliary classes. - Comments for the generated auxiliary classes - used by the interfaces NamingContext and - BindingIterator are included here. - -

Classes Used by NamingContext and - BindingIterator

- The following are classes used by - the naming service. (Helper and holder classes, which are - generated for each of the classes listed here, are discussed below.) - -
    -
  • public final class NameComponent -- - a building block for names. (Names are bound to object references - in a naming context.) -

    A name is an array of one or more NameComponent objects. - A name with a single NameComponent is called - a simple name; a name with multiple NameComponent - objects is called a compound name. -

    - A NameComponent object consists of two fields: -

      -
    1. id -- a String used as an identifier -
    2. kind -- a String that can be used for any - descriptive purpose. Its importance is that it - can be used to describe an object without affecting syntax. - The C programming language, for example, uses the the syntactic convention - of appending the extension ".c" to a file name to indicate that it is - a source code file. In a NameComponent object, - the kind field can be used to describe the type of object - rather than a file extension or some other syntactic convention. - Examples of the value of the kind field include the strings - "c_source", "object_code", - "executable", - "postscript", and "". It is not unusual - for the kind field to be the empty string. -
    -

    - In a name, each NameComponent object except the last denotes - a NamingContext object; the last NameComponent - object denotes the bound object reference. - This is similar to a path name, in which the last name is the - file name, and all names before it are directory names. - -

  • public final class Binding -- - an object that associates a name with an object reference or a - naming context. - A Binding object has two fields: -
      -
    1. binding_name - an array of one or more - NameComponent objects that represents the bound name -
    2. binding_type - a BindingType object - indicating whether the binding is between a name and an object - reference or between a name and a naming context -
    -

    - The interface NamingContext has methods for - binding/unbinding names with object references or naming contexts, - for listing bindings, - and for resolving bindings (given a name, the method - resolve returns the object reference bound to it). - -

  • public final class BindingType -- - an object that specifies whether the given Binding - object is a binding between a name and an object reference (that is, - not a naming context) or between a name and a naming context. -

    - The classBindingType consists of two methods and - four constants. Two of these constants are - BindingType objects, and two are ints. -

    - The BindingType objects - can be passed to the constructor for the class - Binding or used as parameters or return values. These - BindingType objects are: -

      -
    • public static final BindingType nobject -- - to indicate that the binding is with an object reference -
    • public static final BindingType ncontext -- - to indicate that the binding is with a naming context -
    -

    - The int constants can be supplied to the method - from_int to create BindingType objects, - or they can be return values for the method value. - These constants are: -

      -
    • public static final int _nobject -
    • public static final int _ncontext -
    - If the method from_int is supplied with anything other - than _nobject - or _ncontext, it will throw - the exception org.omg.CORBA.BAD_PARAM. -

    Usage is as follows: -

    -       BindingType btObject = from_int(_nobject);
    -       BindingType btContext = from_int(_ncontext);
    -    
    - The variable btObject refers to a BindingType - object initialized to represent a binding with an object reference. - The variable btContext refers to a BindingType - object initialized to represent a binding with a - NamingContex object. -

    - The method value returns either - _nobject or _ncontext, so - in the following line of code, the variable bt - will contain _nobject or _ncontext: -

    -       int bt = BindingType.value();
    -    
    -
- -

Holder Classes

- - OMG IDL uses OUT and INOUT parameters for returning values from operations. - The mapping to the Java programming language, which does not have OUT - and INOUT parameters, creates a special class for each type, called - a holder class. - An instance of a holder class can be passed to a - Java method as a parameter, and - a value can be assigned to its value field. This allows - it to perform the function of an OUT or INOUT parameter. -

The following holder classes are generated for the package - org.omg.CosNaming: -

    -
  • NamingContextHolder -
  • BindingIteratorHolder -
  • BindingHolder -
  • BindingListHolder -
  • BindingTypeHolder -
  • NameComponentHolder -
  • NameHolder -
-

- Note that in the org.omg.CORBA package, - there is a holder class for each of the basic Java types: - IntHolder, ShortHolder, - StringHolder, and so on. -

- Note also that there is a NameHolder class even though - there is no Name class; similarly, there is a - BindingListHolder class even though there is no - BindingList class. This is true because in the OMG IDL - interface, Name and BindingList are - typedefs. There is no mapping from an IDL - typedef to a Java construct, but holder classes - are generated if the typedef is for a sequence or - an array. As mapped to the - Java programming language, Name is an array of - NameComponent objects, and a BindingList - is an array of Binding objects. - - All holder classes have at least two constructors and one field: -

    -
  • value field -- an instance of the type being used as - an OUT or INOUT parameter. For example, the value field of a - NamingContextHolder will be a NamingContext - object. -
  • default constructor -- a constructor that creates a new holder object - initialized with the default value for the type. For example, a new - BindingHolder object created with the default constructor - will have its value field set to null because - that is the default value for an object. Other defaults are - false for boolean, - 0 for numeric and char types, and - null for object references. -
  • constructor from an instance -- a constructor that creates a new - holder object whose value field is - initialized with the instance supplied -
-

- A holder class for a user-defined type (a Java class) has three more - methods, but application developers do not use them directly. - -

Helper Classes

- Helper classes, which are generated for all user-defined types - in an OMG IDL interface, supply static methods needed to manipulate - those types. -

- There is only one method in a helper class that an - application programmer uses: the - method narrow. Only Java interfaces mapped from IDL - interfaces will have a helper class that includes a narrow - method, so in the CosNaming package, only the classes - NamingContextHelper and BindingIteratorHelper - have a narrow method. -

    -
  • public static NamingContext - narrow(org.omg.CORBA.Object obj) -- converts the given - CORBA object to a NamingContext object -
  • public static BindingIterator - narrow(org.omg.CORBA.Object obj) -- converts the given - CORBA object to a BindingIterator object -
-

Package org.omg.CosNaming.NamingContextPackage

-This package supplies Helper and Holder classes for the exceptions used -in the package org.omg.CosNaming and also for the class -NotFoundReason, which supplies a reason for the exception -NotFound. -

-There are Helper and Holder classes for the following exceptions: -

    -
  • AlreadyBound -
  • CannotProceed -
  • InvalidName -
  • NotEmpty -
  • NotFound -
- -

Naming Service Compatibility

- -Sun's implementation of the CosNaming package complies -with the OMG COSNaming specification. In other words, -the APIs in Sun's naming service are implemented according to the -guidelines for a naming service provided by OMG. Therefore, if a -third-party vendor has implemented a naming service that is OMG -compliant, it is possible to switch between Sun's implementation of -CosNaming and the third-party vendor's implementation. -However, it is important to understand that there can be minor -variations in the way different vendors implement the naming service, -such as differences in the exception strings. - -

Instructions for Using a Third Party's Naming Service

-Although we encourage using an ORB and ORB services that are both -from one vendor, it is possible to plug in a third party's -COSNaming implementation with Sun's RMI-IIOP ORB. -Here are the steps to follow: -
    -
  1. Create a properties file for the Bootstrap server and give it - two entries. For example, you could call this properties file - /tmp/services and put the following in it: - NameService, <Stringified IOR of the Root Naming Context>. -

    - This associates NameService with the Root Naming - Context of the CosNaming implementation that you - want to use. -

  2. Start the standalone Bootstrap server using the following command: -
    -      
    -      java -classpath $(CLASSPATH)
    -      com.sun.corba.ee.internal.CosNaming.BootstrapServer -InitialServicesFile
    -      "/tmp/services" [-ORBInitialPort port]
    -      
    -  
    -

    - Note that the square brackets at the end of the command indicate that - specifying a port number is optional. -

-

-Now when an application calls the method -org.omg.CORBA.ORB.resolve_initial_references, CORBA -processes will contact the Bootstrap Server to get the Root Naming -Context. - -

Package Specification

- - - -

Related Documentation

- -For an overview and examples of how to use the -CosNaming API, please see: -
    -
  • {@extLink tnameserv NamingService} -
-

-For an overview of Java IDL, please see: -

    -
  • {@extLink idl_guides Java IDL developer's home page} -
- -@since JDK1.3 - - - - - - --- old/src/java.corba/share/classes/org/omg/Dynamic/package.html 2018-01-30 20:29:11.000000000 -0500 +++ /dev/null 2018-01-30 20:29:11.000000000 -0500 @@ -1,53 +0,0 @@ - - - - - - - -

This package contains the Dynamic module specified in the OMG Portable -Interceptor specification, - -ptc/2000-08-06, section 21.9. Please -refer to that OMG specification for further details. - - - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html 2018-01-30 20:29:11.000000000 -0500 +++ /dev/null 2018-01-30 20:29:11.000000000 -0500 @@ -1,56 +0,0 @@ - - - - - - - -

- -This package contains classes and exceptions from the DynAnyFactory -interface of the -DynamicAny module -specified in the OMG The Common Object Request Broker: Architecture and -Specification, - -formal/99-10-07, section 9.2.2. Please -refer to that OMG specification for further details. - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html 2018-01-30 20:29:12.000000000 -0500 +++ /dev/null 2018-01-30 20:29:12.000000000 -0500 @@ -1,54 +0,0 @@ - - - - - - - -

This package contains classes and exceptions from the DynAny - interface of the DynamicAny module -specified in the OMG The Common Object Request Broker: Architecture and -Specification, - -formal/99-10-07, section 9.2. Please -refer to that OMG specification for further details. - - - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/DynamicAny/DynamicAny.idl 2018-01-30 20:29:13.000000000 -0500 +++ /dev/null 2018-01-30 20:29:13.000000000 -0500 @@ -1,1280 +0,0 @@ -/* - * Copyright (c) 2000, 2009, 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. - */ - -// IDL -// File: DynamicAny.idl - -#ifndef _DYNAMIC_ANY_IDL_ -#define _DYNAMIC_ANY_IDL_ - -#pragma prefix "omg.org" -#include - -/** -* An any can be passed to a program that doesn't have any static information for the -type of the any (code generated for the type by an IDL compiler has not been -compiled with the object implementation). As a result, the object receiving the any -does not have a portable method of using it. -

DynAnys enable traversal of the data value associated with an any at -runtime and extraction of the primitive constituents of the data value. This is especially -helpful for writing powerful generic servers (bridges, event channels supporting -filtering). -

Similarly, this facility enables the construction of an any at runtime, without having -static knowledge of its type. This is especially helpful for writing generic clients -(bridges, browsers, debuggers, user interface tools). -*/ -module DynamicAny { - /** - * Any values can be dynamically interpreted (traversed) and constructed through DynAny objects. - * A DynAny object is associated with a data value which corresponds to a copy of the value - * inserted into an any. - *

A DynAny object may be viewed as an ordered collection of component DynAnys. - * For DynAnys representing a basic type, such as long, or a type without components, - * such as an empty exception, the ordered collection of components is empty. - * Each DynAny object maintains the notion of a current position into its collection - * of component DynAnys. The current position is identified by an index value that runs - * from 0 to n-1, where n is the number of components. - * The special index value -1 indicates a current position that points nowhere. - * For values that cannot have a current position (such as an empty exception), - * the index value is fixed at -1. - * If a DynAny is initialized with a value that has components, the index is initialized to 0. - * After creation of an uninitialized DynAny (that is, a DynAny that has no value but a TypeCode - * that permits components), the current position depends on the type of value represented by - * the DynAny. (The current position is set to 0 or -1, depending on whether the new DynAny - * gets default values for its components.) - *

The iteration operations rewind, seek, and next can be used to change the current position - * and the current_component operation returns the component at the current position. - * The component_count operation returns the number of components of a DynAny. - * Collectively, these operations enable iteration over the components of a DynAny, for example, - * to (recursively) examine its contents. - *

A constructed DynAny object is a DynAny object associated with a constructed type. - * There is a different interface, inheriting from the DynAny interface, associated with - * each kind of constructed type in IDL (fixed, enum, struct, sequence, union, array, - * exception, and value type). - *

A constructed DynAny object exports operations that enable the creation of new DynAny objects, - * each of them associated with a component of the constructed data value. - * As an example, a DynStruct is associated with a struct value. This means that the DynStruct - * may be seen as owning an ordered collection of components, one for each structure member. - * The DynStruct object exports operations that enable the creation of new DynAny objects, - * each of them associated with a member of the struct. - *

If a DynAny object has been obtained from another (constructed) DynAny object, - * such as a DynAny representing a structure member that was created from a DynStruct, - * the member DynAny is logically contained in the DynStruct. - * Calling an insert or get operation leaves the current position unchanged. - * Destroying a top-level DynAny object (one that was not obtained as a component of another DynAny) - * also destroys any component DynAny objects obtained from it. - * Destroying a non-top level DynAny object does nothing. - * Invoking operations on a destroyed top-level DynAny or any of its descendants raises OBJECT_NOT_EXIST. - * If the programmer wants to destroy a DynAny object but still wants to manipulate some component - * of the data value associated with it, then he or she should first create a DynAny for the component - * and, after that, make a copy of the created DynAny object. - *

The behavior of DynAny objects has been defined in order to enable efficient implementations - * in terms of allocated memory space and speed of access. DynAny objects are intended to be used - * for traversing values extracted from anys or constructing values of anys at runtime. - * Their use for other purposes is not recommended. - *

Insert and get operations are necessary to handle basic DynAny objects - * but are also helpful to handle constructed DynAny objects. - * Inserting a basic data type value into a constructed DynAny object - * implies initializing the current component of the constructed data value - * associated with the DynAny object. For example, invoking insert_boolean on a - * DynStruct implies inserting a boolean data value at the current position - * of the associated struct data value. - * A type is consistent for inserting or extracting a value if its TypeCode is equivalent to - * the TypeCode contained in the DynAny or, if the DynAny has components, is equivalent to the TypeCode - * of the DynAny at the current position. - *

DynAny and DynAnyFactory objects are intended to be local to the process in which they are - * created and used. This means that references to DynAny and DynAnyFactory objects cannot be exported - * to other processes, or externalized with ORB.object_to_string(). - * If any attempt is made to do so, the offending operation will raise a MARSHAL system exception. - * Since their interfaces are specified in IDL, DynAny objects export operations defined in the standard - * org.omg.CORBA.Object interface. However, any attempt to invoke operations exported through the Object - * interface may raise the standard NO_IMPLEMENT exception. - * An attempt to use a DynAny object with the DII may raise the NO_IMPLEMENT exception. - */ - interface DynAny { - #pragma sun_localservant DynAny "" - exception InvalidValue {}; - exception TypeMismatch {}; - - /** - * Returns the TypeCode associated with this DynAny object. - * A DynAny object is created with a TypeCode value assigned to it. - * This TypeCode value determines the type of the value handled through the DynAny object. - * Note that the TypeCode associated with a DynAny object is initialized at the time the - * DynAny is created and cannot be changed during lifetime of the DynAny object. - * - * @return The TypeCode associated with this DynAny object - */ - CORBA::TypeCode type(); - - /** - * Initializes the value associated with a DynAny object with the value - * associated with another DynAny object. - * The current position of the target DynAny is set to zero for values that have components - * and to -1 for values that do not have components. - * - * @param dyn_any - * @exception TypeMismatch if the type of the passed DynAny is not equivalent to the type of target DynAny - */ - void assign(in DynAny dyn_any) - raises(TypeMismatch); - - /** - * Initializes the value associated with a DynAny object with the value contained in an any. - * The current position of the target DynAny is set to zero for values that have components - * and to -1 for values that do not have components. - * - * @exception TypeMismatch if the type of the passed Any is not equivalent to the type of target DynAny - * @exception InvalidValue if the passed Any does not contain a legal value (such as a null string) - */ - void from_any(in any value) - raises(TypeMismatch, InvalidValue); - - /** - * Creates an any value from a DynAny object. - * A copy of the TypeCode associated with the DynAny object is assigned to the resulting any. - * The value associated with the DynAny object is copied into the any. - * - * @return a new Any object with the same value and TypeCode - */ - any to_any(); - - /** - * Compares two DynAny values for equality. - * Two DynAny values are equal if their TypeCodes are equivalent and, recursively, all component DynAnys - * have equal values. - * The current position of the two DynAnys being compared has no effect on the result of equal. - * - * @return true of the DynAnys are equal, false otherwise - */ - boolean equal(in DynAny dyn_any); - - /** - * Destroys a DynAny object. - * This operation frees any resources used to represent the data value associated with a DynAny object. - * It must be invoked on references obtained from one of the creation operations on the ORB interface - * or on a reference returned by DynAny.copy() to avoid resource leaks. - * Invoking destroy on component DynAny objects (for example, on objects returned by the - * current_component operation) does nothing. - * Destruction of a DynAny object implies destruction of all DynAny objects obtained from it. - * That is, references to components of a destroyed DynAny become invalid. - * Invocations on such references raise OBJECT_NOT_EXIST. - * It is possible to manipulate a component of a DynAny beyond the life time of the DynAny - * from which the component was obtained by making a copy of the component with the copy operation - * before destroying the DynAny from which the component was obtained. - */ - void destroy(); - - /** - * Creates a new DynAny object whose value is a deep copy of the DynAny on which it is invoked. - * The operation is polymorphic, that is, invoking it on one of the types derived from DynAny, - * such as DynStruct, creates the derived type but returns its reference as the DynAny base type. - * - * @return a deep copy of the DynAny object - */ - DynAny copy(); - - /** - * Inserts a boolean value into the DynAny. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_boolean(in boolean value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a byte value into the DynAny. The IDL octet data type is mapped to the Java byte data type. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_octet(in octet value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a char value into the DynAny. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_char(in char value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a short value into the DynAny. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_short(in short value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a short value into the DynAny. The IDL ushort data type is mapped to the Java short data type. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_ushort(in unsigned short value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts an integer value into the DynAny. The IDL long data type is mapped to the Java int data type. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_long(in long value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts an integer value into the DynAny. The IDL ulong data type is mapped to the Java int data type. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_ulong(in unsigned long value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a float value into the DynAny. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_float(in float value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a double value into the DynAny. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_double(in double value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a string value into the DynAny. - * Both bounded and unbounded strings are inserted using this method. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception InvalidValue if the string inserted is longer than the bound of a bounded string - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_string(in string value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a reference to a CORBA object into the DynAny. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_reference(in Object value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a TypeCode object into the DynAny. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_typecode(in CORBA::TypeCode value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a long value into the DynAny. The IDL long long data type is mapped to the Java long data type. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_longlong(in long long value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a long value into the DynAny. - * The IDL unsigned long long data type is mapped to the Java long data type. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_ulonglong(in unsigned long long value) - raises(TypeMismatch, InvalidValue); - -// void insert_longdouble(in long double value) -// raises(TypeMismatch, InvalidValue); - - /** - * Inserts a char value into the DynAny. The IDL wchar data type is mapped to the Java char data type. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_wchar(in wchar value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a string value into the DynAny. - * Both bounded and unbounded strings are inserted using this method. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception InvalidValue if the string inserted is longer than the bound of a bounded string - */ - void insert_wstring(in wstring value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts an Any value into the Any represented by this DynAny. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_any(in any value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts the Any value contained in the parameter DynAny into the Any represented by this DynAny. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_dyn_any(in DynAny value) - raises(TypeMismatch, InvalidValue); - - /** - * Inserts a reference to a Serializable object into this DynAny. - * The IDL ValueBase type is mapped to the Java Serializable type. - * - * @exception InvalidValue if this DynAny has components but has a current position of -1 - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - void insert_val(in ValueBase value) - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the boolean value from this DynAny. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - boolean get_boolean() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the byte value from this DynAny. The IDL octet data type is mapped to the Java byte data type. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - octet get_octet() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the char value from this DynAny. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - char get_char() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the short value from this DynAny. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - short get_short() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the short value from this DynAny. The IDL ushort data type is mapped to the Java short data type. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - unsigned short get_ushort() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the integer value from this DynAny. The IDL long data type is mapped to the Java int data type. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - long get_long() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the integer value from this DynAny. The IDL ulong data type is mapped to the Java int data type. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - unsigned long get_ulong() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the float value from this DynAny. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - float get_float() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the double value from this DynAny. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - double get_double() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the string value from this DynAny. - * Both bounded and unbounded strings are extracted using this method. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - string get_string() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the reference to a CORBA Object from this DynAny. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - Object get_reference() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the TypeCode object from this DynAny. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - CORBA::TypeCode get_typecode() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the long value from this DynAny. The IDL long long data type is mapped to the Java long data type. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - long long get_longlong() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the long value from this DynAny. - * The IDL unsigned long long data type is mapped to the Java long data type. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - unsigned long long get_ulonglong() - raises(TypeMismatch, InvalidValue); -// long double get_longdouble() -// raises(TypeMismatch, InvalidValue); - - /** - * Extracts the long value from this DynAny. The IDL wchar data type is mapped to the Java char data type. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - wchar get_wchar() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the string value from this DynAny. - * Both bounded and unbounded strings are extracted using this method. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - */ - wstring get_wstring() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts an Any value contained in the Any represented by this DynAny. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - any get_any() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts the Any value contained in the Any represented by this DynAny and returns it wrapped - * into a new DynAny. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - DynAny get_dyn_any() - raises(TypeMismatch, InvalidValue); - - /** - * Extracts a Serializable object from this DynAny. - * The IDL ValueBase type is mapped to the Java Serializable type. - * - * @exception TypeMismatch if the accessed component in the DynAny is of a type - * that is not equivalent to the requested type. - * @exception TypeMismatch if called on a DynAny whose current component itself has components - * @exception InvalidValue if this DynAny has components but has a current position of -1 - */ - ValueBase get_val() - raises(TypeMismatch, InvalidValue); - - /** - * Sets the current position to index. The current position is indexed 0 to n-1, that is, - * index zero corresponds to the first component. The operation returns true if the resulting - * current position indicates a component of the DynAny and false if index indicates - * a position that does not correspond to a component. - * Calling seek with a negative index is legal. It sets the current position to -1 to indicate - * no component and returns false. Passing a non-negative index value for a DynAny that does not - * have a component at the corresponding position sets the current position to -1 and returns false. - */ - boolean seek(in long index); - - /** - * Is equivalent to seek(0). - */ - void rewind(); - - /** - * Advances the current position to the next component. - * The operation returns true while the resulting current position indicates a component, false otherwise. - * A false return value leaves the current position at -1. - * Invoking next on a DynAny without components leaves the current position at -1 and returns false. - */ - boolean next(); - - /** - * Returns the number of components of a DynAny. - * For a DynAny without components, it returns zero. - * The operation only counts the components at the top level. - * For example, if component_count is invoked on a DynStruct with a single member, - * the return value is 1, irrespective of the type of the member. - *

    - *
  • For sequences, the operation returns the current number of elements. - *
  • For structures, exceptions, and value types, the operation returns the number of members. - *
  • For arrays, the operation returns the number of elements. - *
  • For unions, the operation returns 2 if the discriminator indicates that a named member is active, - * otherwise, it returns 1. - *
  • For DynFixed and DynEnum, the operation returns zero. - *
- */ - unsigned long component_count(); - - /** - * Returns the DynAny for the component at the current position. - * It does not advance the current position, so repeated calls to current_component - * without an intervening call to rewind, next, or seek return the same component. - * The returned DynAny object reference can be used to get/set the value of the current component. - * If the current component represents a complex type, the returned reference can be narrowed - * based on the TypeCode to get the interface corresponding to the to the complex type. - * Calling current_component on a DynAny that cannot have components, - * such as a DynEnum or an empty exception, raises TypeMismatch. - * Calling current_component on a DynAny whose current position is -1 returns a nil reference. - * The iteration operations, together with current_component, can be used - * to dynamically compose an any value. After creating a dynamic any, such as a DynStruct, - * current_component and next can be used to initialize all the components of the value. - * Once the dynamic value is completely initialized, to_any creates the corresponding any value. - * - * @exception TypeMismatch If called on a DynAny that cannot have components, - * such as a DynEnum or an empty exception - */ - DynAny current_component() - raises(TypeMismatch); - }; - - /** - * DynFixed objects support the manipulation of IDL fixed values. - * Because IDL does not have a generic type that can represent fixed types with arbitrary - * number of digits and arbitrary scale, the operations use the IDL string type. - */ - interface DynFixed : DynAny { - #pragma sun_localservant DynFixed "" - - /** - * Returns the value of a DynFixed. - */ - string get_value(); - - /** - * Sets the value of the DynFixed. - * The val string must contain a fixed string constant in the same format as used for IDL fixed-point literals. - * However, the trailing d or D is optional. The return value is true if val can be represented as the DynFixed - * without loss of precision. If val has more fractional digits than can be represented in the DynFixed, - * fractional digits are truncated and the return value is false. - * - * @exception TypeMismatch If val does not contain a valid fixed-point literal or contains extraneous - * characters other than leading or trailing white space - * @exception InvalidValue If val contains a value whose scale exceeds that of the DynFixed - * or is not initialized - */ - boolean set_value(in string val) - raises(TypeMismatch, InvalidValue); - }; - - /** - * DynEnum objects support the manipulation of IDL enumerated values. - * The current position of a DynEnum is always -1. - */ - interface DynEnum : DynAny { - #pragma sun_localservant DynEnum "" - - /** - * Returns the value of the DynEnum as an IDL identifier. - */ - string get_as_string(); - - /** - * Sets the value of the DynEnum to the enumerated value whose IDL identifier is passed in the value parameter. - * - * @exception InvalidValue If value contains a string that is not a valid IDL identifier - * for the corresponding enumerated type - */ - void set_as_string(in string value) - raises(InvalidValue); - - /** - * Returns the value of the DynEnum as the enumerated value's ordinal value. - * Enumerators have ordinal values 0 to n-1, as they appear from left to right - * in the corresponding IDL definition. - */ - unsigned long get_as_ulong(); - - /** - * Sets the value of the DynEnum as the enumerated value's ordinal value. - * - * @exception InvalidValue If value contains a value that is outside the range of ordinal values - * for the corresponding enumerated type - */ - void set_as_ulong(in unsigned long value) - raises(InvalidValue); - }; - - typedef string FieldName; - - /** - * NameValuePairs associate a name with an Any object. - */ - struct NameValuePair { - /** - * The name associated with the Any. - */ - FieldName id; - /** - * The Any value associated with the name. - */ - any value; - }; - typedef sequence NameValuePairSeq; - - /** - * NameDynAnyPairs associate a name with an DynAny object. - */ - struct NameDynAnyPair { - /** - * The name associated with the DynAny. - */ - FieldName id; - /** - * The DynAny value associated with the name. - */ - DynAny value; - }; - typedef sequence NameDynAnyPairSeq; - - /** - * DynStruct objects support the manipulation of IDL struct and exception values. - * Members of the exceptions are handled in the same way as members of a struct. - */ - interface DynStruct : DynAny { - #pragma sun_localservant DynStruct "" - - /** - * Returns the name of the member at the current position. - * This operation may return an empty string since the TypeCode of the value being - * manipulated may not contain the names of members. - * - * @exception TypeMismatch if the DynStruct represents an empty exception. - * @exception InvalidValue if the current position does not indicate a member - */ - FieldName current_member_name() - raises(TypeMismatch, InvalidValue); - - /** - * Returns the TCKind associated with the member at the current position. - * - * @exception TypeMismatch if the DynStruct represents an empty exception. - * @exception InvalidValue if the current position does not indicate a member - */ - CORBA::TCKind current_member_kind() - raises(TypeMismatch, InvalidValue); - - /** - * Returns a sequence of NameValuePairs describing the name and the value of each member - * in the struct associated with a DynStruct object. - * The sequence contains members in the same order as the declaration order of members - * as indicated by the DynStruct's TypeCode. The current position is not affected. - * The member names in the returned sequence will be empty strings if the DynStruct's TypeCode - * does not contain member names. - */ - NameValuePairSeq get_members(); - - /** - * Initializes the struct data value associated with a DynStruct object from a sequence of NameValuePairs. - * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise, - * if an empty sequence is passed, the current position is set to -1. - *

Members must appear in the NameValuePairs in the order in which they appear in the IDL specification - * of the struct as indicated by the DynStruct's TypeCode or they must be empty strings. - * The operation makes no attempt to assign member values based on member names. - * - * @exception TypeMismatch if the member names supplied in the passed sequence do not match the - * corresponding member name in the DynStruct's TypeCode and they are not empty strings - * @exception InvalidValue if the passed sequence has a number of elements that disagrees - * with the number of members as indicated by the DynStruct's TypeCode - */ - void set_members(in NameValuePairSeq value) - raises(TypeMismatch, InvalidValue); - - /** - * Returns a sequence of NameDynAnyPairs describing the name and the value of each member - * in the struct associated with a DynStruct object. - * The sequence contains members in the same order as the declaration order of members - * as indicated by the DynStruct's TypeCode. The current position is not affected. - * The member names in the returned sequence will be empty strings if the DynStruct's TypeCode - * does not contain member names. - */ - NameDynAnyPairSeq get_members_as_dyn_any(); - - /** - * Initializes the struct data value associated with a DynStruct object from a sequence of NameDynAnyPairs. - * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise, - * if an empty sequence is passed, the current position is set to -1. - *

Members must appear in the NameDynAnyPairs in the order in which they appear in the IDL specification - * of the struct as indicated by the DynStruct's TypeCode or they must be empty strings. - * The operation makes no attempt to assign member values based on member names. - * - * @exception TypeMismatch if the member names supplied in the passed sequence do not match the - * corresponding member name in the DynStruct's TypeCode and they are not empty strings - * @exception InvalidValue if the passed sequence has a number of elements that disagrees - * with the number of members as indicated by the DynStruct's TypeCode - */ - void set_members_as_dyn_any(in NameDynAnyPairSeq value) - raises(TypeMismatch, InvalidValue); - }; - - /** - * DynUnion objects support the manipulation of IDL unions. - * A union can have only two valid current positions: - *

    - *
  • zero, which denotes the discriminator - *
  • one, which denotes the active member - *
- * The component_count value for a union depends on the current discriminator: - * it is 2 for a union whose discriminator indicates a named member, and 1 otherwise. - */ - interface DynUnion : DynAny { - #pragma sun_localservant DynUnion "" - - /** - * Returns the current discriminator value. - */ - DynAny get_discriminator(); - - /** - * Sets the discriminator of the DynUnion to the specified value. - * Setting the discriminator to a value that is consistent with the currently active union member - * does not affect the currently active member. Setting the discriminator to a value that is inconsistent - * with the currently active member deactivates the member and activates the member that is consistent - * with the new discriminator value (if there is a member for that value) by initializing the member - * to its default value. - * Setting the discriminator of a union sets the current position to 0 if the discriminator value - * indicates a non-existent union member (has_no_active_member returns true in this case). - * Otherwise, if the discriminator value indicates a named union member, the current position is set to 1 - * (has_no_active_member returns false and component_count returns 2 in this case). - * - * @exception TypeMismatch if the TypeCode of the parameter is not equivalent to the TypeCode - * of the union's discriminator - */ - void set_discriminator(in DynAny d) - raises(TypeMismatch); - - /** - * Sets the discriminator to a value that is consistent with the value of the default case of a union. - * It sets the current position to zero and causes component_count to return 2. - * - * @exception TypeMismatch if the union does not have an explicit default case - */ - void set_to_default_member() - raises(TypeMismatch); - - /** - * Sets the discriminator to a value that does not correspond to any of the unions case labels. - * It sets the current position to zero and causes component_count to return 1. - * - * @exception TypeMismatch if the union has an explicit default case or if it uses the entire range - * of discriminator values for explicit case labels - */ - void set_to_no_active_member() - raises(TypeMismatch); - - /** - * Returns true if the union has no active member, that is, the unions value consists solely - * of its discriminator because the discriminator has a value that is not listed as an explicit case label. - * Calling this operation on a union that has a default case returns false. - * Calling this operation on a union that uses the entire range of discriminator values - * for explicit case labels returns false. - */ - boolean has_no_active_member(); - - /** - * Returns the TCKind value of the discriminators TypeCode. - */ - CORBA::TCKind discriminator_kind(); - - /** - * Returns the TCKind value of the currently active members TypeCode. - * - * @exception InvalidValue if the union does not have a currently active member - */ - CORBA::TCKind member_kind() - raises(InvalidValue); - - /** - * Returns the currently active member. Note that the returned reference remains valid only - * for as long as the currently active member does not change. Using the returned reference - * beyond the life time of the currently active member raises OBJECT_NOT_EXIST. - * - * @exception InvalidValue if the union has no active member - */ - DynAny member() - raises(InvalidValue); - - /** - * Returns the name of the currently active member. If the unions TypeCode does not contain - * a member name for the currently active member, the operation returns an empty string. - * - * @exception InvalidValue if the union has no active member - */ - FieldName member_name() - raises(InvalidValue); - }; - - typedef sequence AnySeq; - typedef sequence DynAnySeq; - - /** - * DynSequence objects support the manipulation of IDL sequences. - */ - interface DynSequence : DynAny { - #pragma sun_localservant DynSequence "" - - /** - * Returns the current length of the sequence. - */ - unsigned long get_length(); - - /** - * Sets the length of the sequence. - * Increasing the length of a sequence adds new elements at the tail without affecting the values - * of already existing elements. Newly added elements are default-initialized. - * Increasing the length of a sequence sets the current position to the first newly-added element - * if the previous current position was -1. Otherwise, if the previous current position was not -1, - * the current position is not affected. - * Decreasing the length of a sequence removes elements from the tail without affecting the value - * of those elements that remain. The new current position after decreasing the length of a sequence - * is determined as follows: - *
    - *
  • If the length of the sequence is set to zero, the current position is set to -1. - *
  • If the current position is -1 before decreasing the length, it remains at -1. - *
  • If the current position indicates a valid element and that element is not removed when the length - * is decreased, the current position remains unaffected. - *
  • If the current position indicates a valid element and that element is removed, - * the current position is set to -1. - *
- * - * @exception InvalidValue if this is a bounded sequence and len is larger than the bound - */ - void set_length(in unsigned long len) - raises(InvalidValue); - - /** - * Returns the elements of the sequence. - */ - AnySeq get_elements(); - - /** - * Sets the elements of a sequence. - * The length of the DynSequence is set to the length of value. The current position is set to zero - * if value has non-zero length and to -1 if value is a zero-length sequence. - * - * @exception TypeMismatch if value contains one or more elements whose TypeCode is not equivalent - * to the element TypeCode of the DynSequence - * @exception InvalidValue if the length of value exceeds the bound of a bounded sequence - */ - void set_elements(in AnySeq value) - raises(TypeMismatch, InvalidValue); - - /** - * Returns the DynAnys representing the elements of the sequence. - */ - DynAnySeq get_elements_as_dyn_any(); - - /** - * Sets the elements of a sequence using DynAnys. - * The length of the DynSequence is set to the length of value. The current position is set to zero - * if value has non-zero length and to -1 if value is a zero-length sequence. - * - * @exception TypeMismatch if value contains one or more elements whose TypeCode is not equivalent - * to the element TypeCode of the DynSequence - * @exception InvalidValue if the length of value exceeds the bound of a bounded sequence - */ - void set_elements_as_dyn_any(in DynAnySeq value) - raises(TypeMismatch, InvalidValue); - }; - - /** - * DynArray objects support the manipulation of IDL arrays. - * Note that the dimension of the array is contained in the TypeCode which is accessible - * through the type attribute. It can also be obtained by calling the component_count operation. - */ - interface DynArray : DynAny { - #pragma sun_localservant DynArray "" - - /** - * Returns the elements of the DynArray. - */ - AnySeq get_elements(); - - /** - * Sets the DynArray to contain the passed elements. - * - * @exception TypeMismatch if one or more elements have a type that is inconsistent with the DynArrays TypeCode - * @exception InvalidValue if the sequence does not contain the same number of elements as the array dimension - */ - void set_elements(in AnySeq value) - raises(TypeMismatch, InvalidValue); - - /** - * Returns the elements of the DynArray as DynAnys. - */ - DynAnySeq get_elements_as_dyn_any(); - - /** - * Sets the DynArray to contain the passed elements. - * - * @exception TypeMismatch if one or more elements have a type that is inconsistent with the DynArrays TypeCode - * @exception InvalidValue if the sequence does not contain the same number of elements as the array dimension - */ - void set_elements_as_dyn_any(in DynAnySeq value) - raises(TypeMismatch, InvalidValue); - }; - - /** - * DynValueCommon provides operations supported by both the DynValue and DynValueBox interfaces. - */ - interface DynValueCommon : DynAny { - /** - * Returns true if the DynValueCommon represents a null value type. - */ - boolean is_null(); - - /** - * Changes the representation of a DynValueCommon to a null value type. - */ - void set_to_null(); - - /** - * Replaces a null value type with a newly constructed value. Its components are initialized - * to default values as in DynAnyFactory.create_dyn_any_from_type_code. - * If the DynValueCommon represents a non-null value type, then this operation has no effect. - */ - void set_to_value(); - }; - - /** - * DynValue objects support the manipulation of IDL non-boxed value types. - * The DynValue interface can represent both null and non-null value types. - * For a DynValue representing a non-null value type, the DynValue's components comprise - * the public and private members of the value type, including those inherited from concrete base value types, - * in the order of definition. A DynValue representing a null value type has no components - * and a current position of -1. - *

Warning: Indiscriminantly changing the contents of private value type members can cause the value type - * implementation to break by violating internal constraints. Access to private members is provided to support - * such activities as ORB bridging and debugging and should not be used to arbitrarily violate - * the encapsulation of the value type. - */ - interface DynValue : DynValueCommon { - #pragma sun_localservant DynValue "" - - /** - * Returns the name of the member at the current position. - * This operation may return an empty string since the TypeCode of the value being - * manipulated may not contain the names of members. - * - * @exception TypeMismatch if the DynValue represents a null value type. - * @exception InvalidValue if the current position does not indicate a member - */ - FieldName current_member_name() - raises(TypeMismatch, InvalidValue); - - /** - * Returns the TCKind associated with the member at the current position. - * - * @exception TypeMismatch if the DynValue represents a null value type. - * @exception InvalidValue if the current position does not indicate a member - */ - CORBA::TCKind current_member_kind() - raises(TypeMismatch, InvalidValue); - - /** - * Returns a sequence of NameValuePairs describing the name and the value of each member - * in the value type. - * The sequence contains members in the same order as the declaration order of members - * as indicated by the DynValue's TypeCode. The current position is not affected. - * The member names in the returned sequence will be empty strings if the DynValue's TypeCode - * does not contain member names. - * - * @exception InvalidValue if this object represents a null value type - */ - NameValuePairSeq get_members() - raises(InvalidValue); - - /** - * Initializes the value type's members from a sequence of NameValuePairs. - * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise, - * if an empty sequence is passed, the current position is set to -1. - * A null value type can be initialized to a non-null value type using this method. - *

Members must appear in the NameValuePairs in the order in which they appear in the IDL specification - * of the value type as indicated by the DynValue's TypeCode or they must be empty strings. - * The operation makes no attempt to assign member values based on member names. - * - * @exception TypeMismatch if the member names supplied in the passed sequence do not match the - * corresponding member name in the DynValue's TypeCode and they are not empty strings - * @exception InvalidValue if the passed sequence has a number of elements that disagrees - * with the number of members as indicated by the DynValue's TypeCode - */ - void set_members(in NameValuePairSeq value) - raises(TypeMismatch, InvalidValue); - - /** - * Returns a sequence of NameDynAnyPairs describing the name and the value of each member - * in the value type. - * The sequence contains members in the same order as the declaration order of members - * as indicated by the DynValue's TypeCode. The current position is not affected. - * The member names in the returned sequence will be empty strings if the DynValue's TypeCode - * does not contain member names. - * - * @exception InvalidValue if this object represents a null value type - */ - NameDynAnyPairSeq get_members_as_dyn_any() - raises(InvalidValue); - - /** - * Initializes the value type's members from a sequence of NameDynAnyPairs. - * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise, - * if an empty sequence is passed, the current position is set to -1. - * A null value type can be initialized to a non-null value type using this method. - *

Members must appear in the NameDynAnyPairs in the order in which they appear in the IDL specification - * of the value type as indicated by the DynValue's TypeCode or they must be empty strings. - * The operation makes no attempt to assign member values based on member names. - * - * @exception TypeMismatch if the member names supplied in the passed sequence do not match the - * corresponding member name in the DynValue's TypeCode and they are not empty strings - * @exception InvalidValue if the passed sequence has a number of elements that disagrees - * with the number of members as indicated by the DynValue's TypeCode - */ - void set_members_as_dyn_any(in NameDynAnyPairSeq value) - raises(TypeMismatch, InvalidValue); - }; - - /** - * DynValueBox objects support the manipulation of IDL boxed value types. - * The DynValueBox interface can represent both null and non-null value types. - * For a DynValueBox representing a non-null value type, the DynValueBox has a single component - * of the boxed type. A DynValueBox representing a null value type has no components - * and a current position of -1. - */ - interface DynValueBox : DynValueCommon { - - /** - * Returns the boxed value as an Any. - * - * @exception InvalidValue if this object represents a null value box type - */ - any get_boxed_value() - raises(InvalidValue); - - /** - * Replaces the boxed value with the specified value. - * If the DynBoxedValue represents a null valuetype, it is converted to a non-null value. - * - * @exception TypeMismatch if this object represents a non-null value box type and the type - * of the parameter is not matching the current boxed value type. - */ - void set_boxed_value(in any boxed) - raises(TypeMismatch); - - /** - * Returns the boxed value as a DynAny. - * - * @exception InvalidValue if this object represents a null value box type - */ - DynAny get_boxed_value_as_dyn_any() - raises(InvalidValue); - - /** - * Replaces the boxed value with the value contained in the parameter. - * If the DynBoxedValue represents a null valuetype, it is converted to a non-null value. - * - * @exception TypeMismatch if this object represents a non-null value box type and the type - * of the parameter is not matching the current boxed value type. - */ - void set_boxed_value_as_dyn_any(in DynAny boxed) - raises(TypeMismatch); - }; - - /** - * DynAny objects can be created by invoking operations on the DynAnyFactory object. - * Generally there are only two ways to create a DynAny object: - *

    - *
  • invoking an operation on an existing DynAny object - *
  • invoking an operation on a DynAnyFactory object - *
- * A constructed DynAny object supports operations that enable the creation of new DynAny - * objects encapsulating access to the value of some constituent. - * DynAny objects also support the copy operation for creating new DynAny objects. - * A reference to the DynAnyFactory object is obtained by calling ORB.resolve_initial_references() - * with the identifier parameter set to the string constant "DynAnyFactory". - *

Dynamic interpretation of an any usually involves creating a DynAny object using create_dyn_any() - * as the first step. Depending on the type of the any, the resulting DynAny object reference can be narrowed - * to a DynFixed, DynStruct, DynSequence, DynArray, DynUnion, DynEnum, or DynValue object reference. - *

Dynamic creation of an any involves creating a DynAny object using create_dyn_any_from_type_code(), - * passing the TypeCode associated with the value to be created. The returned reference is narrowed to one of - * the complex types, such as DynStruct, if appropriate. Then, the value can be initialized by means of - * invoking operations on the resulting object. Finally, the to_any operation can be invoked - * to create an any value from the constructed DynAny. - */ - interface DynAnyFactory { - #pragma sun_localservant DynAnyFactory "" - exception InconsistentTypeCode {}; - - /** - * Creates a new DynAny object from an any value. - * A copy of the TypeCode associated with the any value is assigned to the resulting DynAny object. - * The value associated with the DynAny object is a copy of the value in the original any. - * The current position of the created DynAny is set to zero if the passed value has components, - * to -1 otherwise - * - * @exception InconsistentTypeCode if value has a TypeCode with a TCKind of tk_Principal, - * tk_native, or tk_abstract_interface - */ - DynAny create_dyn_any(in any value) - raises(InconsistentTypeCode); - - /** - * Creates a DynAny from a TypeCode. Depending on the TypeCode, the created object may be of type DynAny, - * or one of its derived types, such as DynStruct. The returned reference can be narrowed to the derived type. - * In all cases, a DynAny constructed from a TypeCode has an initial default value. - * The default values of basic types are: - *

    - *
  • false for boolean - *
  • zero for numeric types - *
  • zero for types octet, char, and wchar - *
  • the empty string for string and wstring - *
  • null for object references - *
  • a type code with a TCKind value of tk_null for type codes - *
  • for any values, an any containing a type code with a TCKind value of tk_null type and no value - *
- * For complex types, creation of the corresponding DynAny assigns a default value as follows: - *
    - *
  • For DynSequence it sets the current position to -1 and creates an empty sequence. - *
  • For DynEnum it sets the current position to -1 and sets the value of the enumerator - * to the first enumerator value indicated by the TypeCode. - *
  • For DynFixed it sets the current position to -1 and sets the value zero. - *
  • For DynStruct it sets the current position to -1 for empty exceptions - * and to zero for all other TypeCodes. The members (if any) are (recursively) initialized - * to their default values. - *
  • For DynArray sets the current position to zero and (recursively) initializes elements - * to their default value. - *
  • For DynUnion sets the current position to zero. The discriminator value is set - * to a value consistent with the first named member of the union. That member is activated and (recursively) - * initialized to its default value. - *
  • For DynValue and DynValueBox it initializes to a null value. - *
- */ - DynAny create_dyn_any_from_type_code(in CORBA::TypeCode type) - raises(InconsistentTypeCode); - }; -}; // module DynamicAny - -#endif // _DYNAMIC_ANY_IDL_ --- old/src/java.corba/share/classes/org/omg/DynamicAny/package.html 2018-01-30 20:29:14.000000000 -0500 +++ /dev/null 2018-01-30 20:29:14.000000000 -0500 @@ -1,211 +0,0 @@ - - - - - - - -

Provides classes and interfaces that enable traversal of the data value - associated with an any at -runtime, and extraction of the primitive constituents of the data value. - - -

An any can be passed to a program that doesn't have any static information -for the type of the any (code generated for the type by an IDL compiler has not -been compiled with the object implementation). As a result, the object receiving the -any does not have a portable method of using it. - -

DynAnys enable traversal of the data value associated with an -any at runtime, and extraction of the primitive constituents of the data value. -This is especially helpful for writing powerful generic servers (bridges, event channels -supporting filtering). Similarly, this facility enables the construction of an -any at runtime, without having static knowledge of its type. This is especially -helpful for writing generic clients (bridges, browsers, debuggers, user interface tools). - -

Any values can be dynamically interpreted (traversed) and constructed through -DynAny objects. A DynAny object is associated with a data -value which corresponds to a copy of the value inserted into an Any. A -DynAny object may be viewed as an ordered collection of component -DynAnys. For DynAnys representing a basic type, such as long, -or a type without components, such as an empty exception, the ordered collection of -components is empty. - -

Each DynAny object maintains the notion of a current position into its collection -of component DynAnys. The current position is identified by an index value that runs -from 0 to n-1, where n is the number of components. The special index value -1 -indicates a current position that points nowhere. - For values that cannot have a current position (such as an empty exception), - the index value is fixed at -1. - If a DynAny is initialized with a value that has components, the index is -initialized to 0. - After creation of an uninitialized DynAny (that is, a DynAny that -has no value but a TypeCode - that permits components), the current position depends on the type of value represented by - the DynAny. (The current position is set to 0 or -1, depending on whether the -new DynAny - gets default values for its components.) - - -

The iteration operations rewind, seek, and next -can be used to change the current position - and the current_component operation returns the component at the current -position. - The component_count operation returns the number of components of a -DynAny. - Collectively, these operations enable iteration over the components of a -DynAny, for example, - to (recursively) examine its contents. - - -

A constructed DynAny object is a DynAny object associated with -a constructed type. - There is a different interface, inheriting from the DynAny interface, -associated with - each kind of constructed type in IDL (fixed, enum, struct, sequence, union, array, - exception, and value type). A constructed DynAny object exports operations -that enable the creation of new DynAny objects, - each of them associated with a component of the constructed data value. - As an example, a DynStruct is associated with a struct value. This -means that the DynStruct - may be seen as owning an ordered collection of components, one for each structure member. - The DynStruct object exports operations that enable the creation of new -DynAny objects, - each of them associated with a member of the struct. - - -

If a DynAny object has been obtained from another (constructed) -DynAny object, - such as a DynAny representing a structure member that was created from a -DynStruct, - the member DynAny is logically contained in the DynStruct. - Calling an insert or get operation leaves the current position -unchanged. - Destroying a top-level DynAny object (one that was not obtained as a component -of another DynAny) - also destroys any component DynAny objects obtained from it. - Destroying a non-top level DynAny object does nothing. - Invoking operations on a destroyed top-level DynAny or any of its descendants -raises OBJECT_NOT_EXIST. - If the programmer wants to destroy a DynAny object but still wants to -manipulate some component - of the data value associated with it, then he or she should first create a -DynAny for the component - and, after that, make a copy of the created DynAny object. - - -

The behavior of DynAny objects has been defined in order to enable efficient -implementations -in terms of allocated memory space and speed of access. DynAny objects are -intended to be used -for traversing values extracted from anys or constructing values of -anys at runtime. -Their use for other purposes is not recommended. - - - -

Handling DynAny objects

- -

Insert and get operations are necessary to handle basic -DynAny objects - but are also helpful to handle constructed DynAny objects. - Inserting a basic data type value into a constructed DynAny object - implies initializing the current component of the constructed data value - associated with the DynAny object. For example, invoking -insert_boolean on a - DynStruct implies inserting a boolean data value at the current -position - of the associated struct data value. - A type is consistent for inserting or extracting a value if its TypeCode is -equivalent to - the TypeCode contained in the DynAny or, if the -DynAny has components, is equivalent to the TypeCode - of the DynAny at the current position. - -

Basic operations include: -

    -
  • insert_boolean, get_boolean -
  • insert_char, get_char -
  • insert_short, get_short -
  • insert_ushort, get_ushort -
  • insert_long, get_long -
  • insert_ulong, get_ulong -
  • insert_double, get_double -
  • insert_string, get_string -
  • insert_reference, get_reference -
  • insert_typecode, get_typecode -
  • insert_longlong, get_longlong -
  • insert_ulonglong, get_ulonglong -
  • insert_longdouble, get_longdouble -
  • insert_wchar, get_wchar -
  • insert_wstring, get_wstring -
  • insert_any, get_any -
  • insert_dyn_any, get_dyn_any -
  • insert_val, get_val -
  • insert_octet, get_octet -
  • insert_float, get_float -
  • get_value -
  • get_as_string -
  • get_as_ulong -
  • get_members -
  • get_members_as_dyn_any -
  • get_discriminator -
  • get_length -
  • get_elements -
  • get_elements_as_dyn_any -
  • get_boxed_value -
  • get_boxed_value_as_dyn_any -
- - -

DynAny and DynAnyFactory objects are intended to be local to -the process in which they are - created and used. This means that references to DynAny and -DynAnyFactory objects cannot be exported - to other processes, or externalized with ORB.object_to_string(). - If any attempt is made to do so, the offending operation will raise a MARSHAL system -exception. - Since their interfaces are specified in IDL, DynAny objects export operations -defined in the standard - org.omg.CORBA.Object interface. However, any attempt to invoke operations -exported through the Object - interface may raise the standard NO_IMPLEMENT exception. - An attempt to use a DynAny object with the DII may raise the NO_IMPLEMENT -exception. - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/IOP/CodecFactoryPackage/package.html 2018-01-30 20:29:14.000000000 -0500 +++ /dev/null 2018-01-30 20:29:14.000000000 -0500 @@ -1,50 +0,0 @@ - - - - - - - -

This package contains the exceptions -specified in the IOP::CodeFactory interface (as part of the Portable - Interceptors spec). - - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/IOP/CodecPackage/package.html 2018-01-30 20:29:15.000000000 -0500 +++ /dev/null 2018-01-30 20:29:15.000000000 -0500 @@ -1,53 +0,0 @@ - - - - - - - -

This package is generated from the IOP::Codec IDL interface -definition. It contains the Java representations of the IDL exceptions -specified in IOP::Codec (as part of the Portable Interceptors -specification). - Please -refer to that OMG specification for further details. - - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/IOP/package.html 2018-01-30 20:29:16.000000000 -0500 +++ /dev/null 2018-01-30 20:29:16.000000000 -0500 @@ -1,60 +0,0 @@ - - - - - - - -

This package contains the IOP module specified in the OMG document -The Common -Object Request Broker: Architecture and Specification, - -formal/99-10-07, section 13.6. Please -refer to that OMG specification for further details. - -

Please note that we do not provide all parts of the IOP module from -the specification. We only provide those parts that are referenced as -return values or parameter types in public APIs, most notably, -Portable Interceptors. - - - - - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/Messaging/package.html 2018-01-30 20:29:17.000000000 -0500 +++ /dev/null 2018-01-30 20:29:17.000000000 -0500 @@ -1,55 +0,0 @@ - - - - - - - -

This package contains the Messaging module specified in the OMG CORBA -Messaging specification, - -formal/99-10-07. Please refer to that OMG -specification for further details. - -

Please note that we do not provide all parts of the Messaging module from -the specification. We only provide those parts that are referenced as -return values or parameter types in public APIs, most notably, -Portable Interceptors. - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/PortableInterceptor/CORBAX.idl 2018-01-30 20:29:18.000000000 -0500 +++ /dev/null 2018-01-30 20:29:18.000000000 -0500 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 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. - */ - -#ifndef _CORBAX_IDL_ -#define _CORBAX_IDL_ - -#pragma prefix "omg.org" - -module CORBA { - /** - * Enumeration of parameter modes for Parameter. Possible vaues: - *

    - *
  • PARAM_IN - Represents an "in" parameter.
  • - *
  • PARAM_OUT - Represents an "out" parameter.
  • - *
  • PARAM_INOUT - Represents an "inout" parameter.
  • - *
- */ - enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT}; - - /** An array of Strings */ - typedef sequence StringSeq; - - /** An array of WStrings */ - typedef sequence WStringSeq; - - /** A byte array */ - typedef sequence OctetSeq; - - /** Repository ID, represented as a String */ - typedef string RepositoryId; - - /** - * Encapsulates a reason a Policy may be invalid. - * - * @see PolicyError - */ - typedef short PolicyErrorCode; - - /** - * Thrown to indicate problems with parameter values passed to the - * ORB.create_policy operation. - */ - exception PolicyError { PolicyErrorCode reason; }; -}; - - -#endif // _CORBAX_IDL_ --- old/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl 2018-01-30 20:29:18.000000000 -0500 +++ /dev/null 2018-01-30 20:29:18.000000000 -0500 @@ -1,617 +0,0 @@ -/* - * Copyright (c) 2000, 2017, 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. - */ - -#ifndef _IOP_IDL_ -#define _IOP_IDL_ - -#include "CORBAX.idl" - -#pragma prefix "omg.org" - -#ifndef CORBA3 -#define local -#endif - -module IOP { - // - // Standard Protocol Profile tag values - // - /** Profile ID */ - typedef unsigned long ProfileId; - - /** - * Identifies profiles that - * support the Internet Inter-ORB Protocol. The ProfileBody - * of this profile contains a CDR encapsulation of a structure - * containing addressing and object identification information used by - * IIOP. Version 1.1 of the TAG_INTERNET_IOP profile - * also includes an array of TaggedComponent objects that can - * contain additional information supporting optional IIOP features, - * ORB services such as security, and future protocol extensions. - *

- * Protocols other than IIOP (such as ESIOPs and other GIOPs) can share - * profile information (such as object identity or security - * information) with IIOP by encoding their additional profile information - * as components in the TAG_INTERNET_IOP profile. All - * TAG_INTERNET_IOP profiles support IIOP, regardless of - * whether they also support additional protocols. Interoperable - * ORBs are not required to create or understand any other profile, - * nor are they required to create or understand any of the components - * defined for other protocols that might share the - * TAG_INTERNET_IOP profile with IIOP. - *

- * The profile_data for the TAG_INTERNET_IOP - * profile is a CDR encapsulation of the IIOP.ProfileBody_1_1 - * type. - */ - const ProfileId TAG_INTERNET_IOP = 0; - - /** - * Indicates that the value encapsulated is of type - * MultipleComponentProfile. In this case, the profile - * consists of a list of protocol components, the use of which must - * be specified by the protocol using this profile. This profile may - * be used to carry IOR components. - *

- * The profile_data for the - * TAG_MULTIPLE_COMPONENTS profile is a CDR encapsulation - * of the MultipleComponentProfile type shown above. - */ - const ProfileId TAG_MULTIPLE_COMPONENTS = 1; - - /** - * Object references have at least one tagged profile. Each profile - * supports one or more protocols and encapsulates all the basic - * information the protocols it supports need to identify an object. - * Any single profile holds enough information to drive a complete - * invocation using any of the protocols it supports; the content - * and structure of those profile entries are wholly specified by - * these protocols. - */ - struct TaggedProfile { - /** The tag, represented as a profile id. */ - ProfileId tag; - - /** The associated profile data. */ - sequence profile_data; - }; - - /** - * Captures information about a object references, such as whether the - * object is null, what type it is, what protocols are supported, and what - * ORB services are available. - *

- * This data structure need not be used internally to any given ORB, - * and is not intended to be visible to application-level ORB programmers. - * It should be used only when crossing object reference domain - * boundaries, within bridges. - *

- * This data structure is designed to be efficient in typical - * single-protocol configurations, while not penalizing multiprotocol ones. - *

- * Object references have at least one tagged profile. Each profile - * supports one or more protocols and encapsulates all the basic - * information the protocols it supports need to identify an object. - * Any single profile holds enough information to drive a complete - * invocation using any of the protocols it supports; the content - * and structure of those profile entries are wholly specified by - * these protocols. A bridge between two domains may need to know the - * detailed content of the profile for those domains' profiles, - * depending on the technique it uses to bridge the domains. - *

- * Each profile has a unique numeric tag, assigned by the OMG. - * Profile tags in the range 0x80000000 through 0xffffffff are reserved - * for future use, and are not currently available for assignment. - *

- * Null object references are indicated by an empty set of profiles, - * and by a "Null" type ID (a string which contains only a single - * terminating character). A Null TypeID is the only - * mechanism that can be used to represent the type - * CORBA.Object. Type IDs may only be "Null" in any message, - * requiring the client to use existing knowledge or to consult the - * object, to determine interface types supported. The type ID - * is a Repository ID identifying the interface type, and is provided - * to allow ORBs to preserve strong typing. This identifier is agreed - * on within the bridge and, for reasons outside the scope of the - * interoperability specification, needs to have a much broader scope to - * address various problems in system evolution and maintenance. - * Type IDs support detection of type equivalence, and in conjunction - * with an Interface Repository, allow processes to reason about the - * relationship of the type of the object referred to and any other type. - *

- * The type ID, if provided by the server, indicates the most derived - * type that the server wishes to publish, at the time the reference - * is generated. The object's actual most derived type may later change - * to a more derived type. Therefore, the type ID in the IOR can only - * be interpreted by the client as a hint that the object supports at - * least the indicated interface. The client can succeed in narrowing - * the reference to the indicated interface, or to one of its base - * interfaces, based solely on the type ID in the IOR, but must not fail - * to narrow the reference without consulting the object via the - * "_is_a" or "_get_interface" pseudo-operations. - */ - struct IOR { - /** The type id, represented as a String. */ - string type_id; - - /** - * An array of tagged profiles associated with this - * object reference. - */ - sequence profiles; - }; - - /** - * Standard way of representing multicomponent profiles. - * This would be encapsulated in a TaggedProfile. - */ - typedef unsigned long ComponentId; - - /** - * TaggedComponents contained in - * TAG_INTERNET_IOP and - * TAG_MULTIPLE_COMPONENTS profiles are identified by - * unique numeric tags using a namespace distinct form that is used for - * profile tags. Component tags are assigned by the OMG. - *

- * Specifications of components must include the following information: - *

    - *
  • Component ID: The compound tag that is obtained - * from OMG.
  • - *
  • Structure and encoding: The syntax of the component - * data and the encoding rules. If the component value is - * encoded as a CDR encapsulation, the IDL type that is - * encapsulated and the GIOP version which is used for encoding - * the value, if different than GIOP 1.0, must be specified as - * part of the component definition.
  • - *
  • Semantics: How the component data is intended to be - * used.
  • - *
  • Protocols: The protocol for which the component is - * defined, and whether it is intended that the component be - * usable by other protocols.
  • - *
  • At most once: whether more than one instance of this - * component can be included in a profile.
  • - *
- * Specification of protocols must describe how the components affect - * the protocol. The following should be specified in any protocol - * definition for each TaggedComponent that the protocol uses: - *
    - *
  • Mandatory presence: Whether inclusion of the component - * in profiles supporting the protocol is required (MANDATORY - * PRESENCE) or not required (OPTIONAL PRESENCE).
  • - *
  • Droppable: For optional presence component, whether - * component, if present, must be retained or may be dropped.
  • - *
- */ - struct TaggedComponent { - /** The tag, represented as a component id. */ - ComponentId tag; - - /** The component data associated with the component id. */ - sequence component_data; - }; - - /** - * It is often useful in the real world to be able to identify the - * particular kind of ORB an object reference is coming from, to work - * around problems with that particular ORB, or exploit shared - * efficiencies. - *

- * The TAG_ORB_TYPE component has an associated value of - * type unsigned long (Java long), encoded as a CDR encapsulation, - * designating an ORB type ID allocated by the OMG for the ORB type of the - * originating ORB. Anyone may register any ORB types by submitting - * a short (one-paragraph) description of the ORB type to the OMG, - * and will receive a new ORB type ID in return. A list of ORB type - * descriptions and values will be made available on the OMG web server. - *

- * The TAG_ORB_TYPE component can appear at most once in - * any IOR profile. For profiles supporting IIOP 1.1 or greater, it - * is optionally present. - */ - const ComponentId TAG_ORB_TYPE = 0 ; - - /** - * The code set component of the IOR multi-component profile structure - * contains: - *

    - *
  • server's native char code set and conversion code sets, and
  • - *
  • server's native wchar code set and conversion code sets.
  • - *
- * Both char and wchar conversion code sets are listed in order of - * preference. - */ - const ComponentId TAG_CODE_SETS = 1 ; - - /** - * A profile component containing the sequence of QoS policies exported - * with the object reference by an object adapter. - */ - const ComponentId TAG_POLICIES = 2 ; - - /** - * In cases where the same object key is used for more than one - * internet location, the following standard IOR Component is defined - * for support in IIOP version 1.2. - *

- * The TAG_ALTERNATE_IIOP_ADDRESS component has an - * associated value of type: - *

-     *   
-     *     struct { 
-     *         string HostID, 
-     *         short Port 
-     *     };
-     *   
-     * 
- * encoded as a CDR encapsulation. - *

- * Zero or more instances of the TAG_ALTERNATE_IIOP_ADDRESS - * component type may be included in a version 1.2 - * TAG_INTERNET_IOP Profile. Each of these alternative - * addresses may be used by the client orb, in addition to the host - * and port address expressed in the body of the Profile. In cases - * where one or more TAG_ALTERNATE_IIOP_ADDRESS components - * are present in a TAG_INTERNET_IOP Profile, no order of - * use is prescribed by Version 1.2 of IIOP. - */ - const ComponentId TAG_ALTERNATE_IIOP_ADDRESS = 3 ; - - /** - * Class downloading is supported for stubs, ties, values, and - * value helpers. The specification allows transmission of codebase - * information on the wire for stubs and ties, and enables usage of - * pre-existing ClassLoaders when relevant. - *

- * For values and value helpers, the codebase is transmitted after the - * value tag. For stubs and ties, the codebase is transmitted as - * the TaggedComponent TAG_JAVA_CODEBASE in the IOR - * profile, where the component_data is a CDR encapsulation - * of the codebase written as an IDL string. The codebase is a - * space-separated list of one or more URLs. - */ - const ComponentId TAG_JAVA_CODEBASE = 25 ; - - /** - * RMI-IIOP has multiple stream format versions. A server - * can specify its maximum version by including the - * TAG_RMI_CUSTOM_MAX_STREAM_FORMAT tagged component or - * rely on the default of version 1 for GIOP 1.2 and less - * and version 2 for GIOP 1.3 and higher. - * - * See Java to IDL ptc/02-01-12 1.4.11. - */ - const ComponentId TAG_RMI_CUSTOM_MAX_STREAM_FORMAT = 38 ; - - /** An array of tagged components, forming a multiple component profile. */ - typedef sequence MultipleComponentProfile; - - /** A service id, represented as an int */ - typedef unsigned long ServiceId; - - /** - * Service-specific information to be passed implicitly with requests - * and replies. Service contexts are composed of service ids and - * associated data. - */ - struct ServiceContext { - /** The service context id */ - ServiceId context_id; - - /** The data associated with this service context */ - sequence context_data; - }; - - /** An array of service contexts, forming a service context list. */ - typedef sequence ServiceContextList; - - /** - * Identifies a CDR encapsulation of the - * CosTSInteroperation.PropogationContext defined in - * CORBAservices: Common Object Services Specifications. - */ - const ServiceId TransactionService = 0; - - /** - * Identifies a CDR encapsulation of the - * CONV_FRAME.CodeSetContext defined in - * Section 13.10.2.5, "GIOP Code Set Service Context," on page 13-43. - */ - const ServiceId CodeSets = 1; - - /** - * Identifies a CDR encapsulation of the RMICustomMaxStreamFormat - * service context which contains a single byte specifying - * the client's maximum RMI-IIOP stream format version. - * - * See Java to IDL ptc/02-01-12 1.4.12. - */ - const ServiceId RMICustomMaxStreamFormat = 17 ; - - /** - * DCOM-CORBA Interworking uses three service contexts as defined in - * "DCOM-CORBA Interworking" in the "Interoperability with non-CORBA - * Systems" chapter. - *

- * ChainBypassCheck carries a CDR encapsulation of the - * struct CosBridging.ChainBypassCheck. This is carried - * only in a Request message as described in Section 20.9.1, "CORBA - * Chain Bypass," on page 20-19. - */ - const ServiceId ChainBypassCheck = 2; - - /** - * DCOM-CORBA Interworking uses three service contexts as defined in - * "DCOM-CORBA Interworking" in the "Interoperability with non-CORBA - * Systems" chapter. - *

- * ChainBypassInfo carries a CDR encapsulation of the - * struct CosBridging.ChainBypassInfo. This is carried - * only in a Reply message as described in Section 20.9.1, "CORBA Chain - * Bypass," on page 20-19. - */ - const ServiceId ChainBypassInfo = 3; - - /** - * DCOM-CORBA Interworking uses three service contexts as defined in - * "DCOM-CORBA Interworking" in the "Interoperability with non-CORBA - * Systems" chapter. - *

- * LogicalThreadId, carries a CDR encapsulation of - * the struct CosBridging.LogicalThreadId as described - * in Section 20.10, "Thread Identification," on page 20-21. - */ - const ServiceId LogicalThreadId = 4; - - /** - * Identifies a CDR encapsulation of the - * IIOP.BiDirIIOPServiceContext defined in Section 15.8, - * "Bi-Directional GIOP," on page 15-55. - */ - const ServiceId BI_DIR_IIOP = 5; - - /** - * Identifies a CDR encapsulation of the IOR of the - * SendingContext.RunTime object (see Section 5.6, "Access - * to the Sending Context Run Time," on page 5-15). - */ - const ServiceId SendingContextRunTime = 6; - - /** - * For information on INVOCATION_POLICIES refer to the - * Asynchronous Messaging specification - orbos/98-05-05. - */ - const ServiceId INVOCATION_POLICIES = 7; - - /** - * For information on FORWARDED_IDENTITY refer to the - * Firewall specification - orbos/98-05-04. - */ - const ServiceId FORWARDED_IDENTITY = 8; - - /** - * Identifies a CDR encapsulation of a marshaled instance of a - * java.lang.Throwable or one of its subclasses as described in Java - * to IDL Language Mapping, Section 1.4.8.1, "Mapping of - * UnknownExceptionInfo Service Context," on page 1-32. - */ - const ServiceId UnknownExceptionInfo = 9; - - /** - * CORBA formal/02-06-01: 13.7.1: - * ExceptionDetailMessage identifies a CDR encapsulation of a wstring, - * encoded using GIOP 1.2 with a TCS-W of UTF-16. This service context - * may be sent on Reply messages with a reply_status of SYSTEM_EXCEPTION - * or USER_EXCEPTION. The usage of this service context is defined - * by language mappings.

- * - * IDL/Java: ptc/02-01-22: 1.15.2: - * When a System Exception is marshaled, its GIOP Reply message shall - * include an associated ExceptionDetailMessage service context. The - * callee's stack trace is often very valuable debugging information but - * may contain sensitive or unwanted information. The wstring within the - * service context will therefore contain additional information relating - * to the exception, for example the result of calling either - * printStackTrace(PrintWriter) or getMessage() on the exception. When - * unmarshaling a System Exception on the client side, the wstring from - * any ExceptionDetailMessage service context shall become the Java error - * message in the unmarshaled exception object. - */ - const ServiceId ExceptionDetailMessage = 14; - - - // BEGIN part which lived in Interceptors.idl. - - /** - * An array of TaggedComponent objects. - */ - typedef sequence TaggedComponentSeq; - - /** - * The formats of IOR components and service context data used by ORB - * services are often defined as CDR encapsulations encoding instances - * of IDL defined data types. The Codec provides a mechanism - * to transfer these components between their IDL data types and their CDR - * encapsulation representations. - *

- * A Codec is obtained from the CodecFactory. - * The CodecFactory is obtained through a call to - * ORB.resolve_initial_references( "CodecFactory" ). - */ - local interface Codec { - - /** - * This exception is thrown by Codec.encode or - * Codec.encode_value when the type is invalid for the - * encoding. For example, this exception is thrown if the encoding is - * ENCODING_CDR_ENCAPS version 1.0 and a type - * that does not exist in that version, such as wstring, - * is passed to the operation. - */ - exception InvalidTypeForEncoding {}; - - /** - * This exception is thrown by Codec.decode or - * Codec.decode_value when the data in the byte array - * cannot be decoded into an Any. - */ - exception FormatMismatch {}; - - /** - * This exception is thrown by decode_value when the given - * TypeCode does not match the given byte array. - */ - exception TypeMismatch {}; - - /** - * Converts the given any into a byte array based on the encoding - * format effective for this Codec. - * - * @param data The data, in the form of an any, to be encoded into - * a byte array. - * @return A byte array containing the encoded Any. This byte array - * contains both the TypeCode and the data of the type. - * @exception InvalidTypeForEncoding thrown if the type is not valid for - * the encoding format effective for this Codec. - */ - CORBA::OctetSeq encode (in any data) - raises (InvalidTypeForEncoding); - - /** - * Decodes the given byte array into an Any based on the encoding - * format effective for this Codec. - * - * @param data The data, in the form of a byte array, to be decoded into - * an Any. - * @return An Any containing the data from the decoded byte array. - * @exception FormatMismatch is thrown if the byte array cannot be - * decoded into an Any. - */ - any decode (in CORBA::OctetSeq data) raises (FormatMismatch); - - /** - * Converts the given any into a byte array based on the encoding - * format effective for this Codec. Only the data from the Any is - * encoded, not the TypeCode. - * - * @param data The data, in the form of an Any, to be encoded into - * a byte array. - * @return A byte array containing the data from the encoded any. - * @exception InvalidTypeForEncoding thrown if the type is not valid for - * the encoding format effective for this Codec. - */ - CORBA::OctetSeq encode_value (in any data) - raises (InvalidTypeForEncoding); - - /** - * Decodes the given byte array into an Any based on the given - * TypeCode and the encoding format effective for - * this Codec. - * - * @param data The data, in the form of a byte array, to be decoded - * into an Any. - * @param tc The TypeCode to be used to decode the data. - * @return An Any containing the data from the decoded byte array. - * @exception FormatMismatch thrown if the byte array cannot be - * decoded into an Any. - */ - any decode_value (in CORBA::OctetSeq data, in CORBA::TypeCode tc) - raises (FormatMismatch, TypeMismatch); - }; - - /** - * Defines an encoding format of a Codec, such as - * CDR Encapsulation (ENCODING_CDR_ENCAPS). - */ - typedef short EncodingFormat; - - /** - * The CDR Encapsulation encoding. - * @see CodecFactory - */ - const EncodingFormat ENCODING_CDR_ENCAPS = 0; - - /** - * Defines the encoding format of a Codec. This class - * details the encoding format, such as CDR Encapsulation encoding, and - * the major and minor versions of that format. - *

- * The encodings currently supported are: - *

    - *
  • ENCODING_CDR_ENCAPS, version 1.0;
  • - *
  • ENCODING_CDR_ENCAPS, version 1.1;
  • - *
  • ENCODING_CDR_ENCAPS, version 1.2;
  • - *
  • ENCODING_CDR_ENCAPS for all future versions of GIOP as - * they arise.
  • - *
- * Vendors are free to support additional encodings. - * - * @see ENCODING_CDR_ENCAPS - */ - struct Encoding { - /** - * The encoding format. - */ - EncodingFormat format; - - /** - * The major version of this Encoding format. - */ - octet major_version; - - /** - * The minor version of this Encoding format. - */ - octet minor_version; - }; - - /** - * Codecs are obtained from the CodecFactory. - * The CodecFactory is obtained through a call to - * ORB.resolve_initial_references( "CodecFactory" ). - */ - local interface CodecFactory { - /** - * This exception is thrown by CodecFactory.create_codec when - * the factory cannot create a Codec for a given encoding. - */ - exception UnknownEncoding {}; - - /** - * Create a Codec of the given encoding. - * - * @param enc The encoding for which to create a Codec. - * @return A Codec obtained with the given encoding. - * @exception UnknownEncoding thrown if this factory cannot create a - * Codec of the given encoding. - */ - Codec create_codec (in Encoding enc) raises (UnknownEncoding); - }; - - // END part which lived in Interceptors.idl. - -}; - -#endif // _IOP_IDL_ --- old/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl 2018-01-30 20:29:19.000000000 -0500 +++ /dev/null 2018-01-30 20:29:19.000000000 -0500 @@ -1,2231 +0,0 @@ -/* - * Copyright (c) 2000, 2017, 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. - */ - -/* - * Differences from original: - * - * - do not include orb.idl - * - include IOP.idl, Messaging.idl and CORBAX.idl - * - renamed component parameter names to tagged_component (so that they - * do not conflict with the CORBA 3.0 "component" keyword). - * - javadocs added (synchronized with orbos/00-08-06) - * - * NOTE: After compilation of this IDL file, all Helper and Holder classes - * that are not needed are removed. - */ -#include "IOP.idl" -#include "Messaging.idl" -#include "CORBAX.idl" -#include "corba.idl" - -#pragma prefix "omg.org" - -#ifndef CORBA3 -#define local -#endif - -module Dynamic { - - /** - * NVList PIDL represented by ParameterList IDL. - * This exists in order to keep the Portable Interceptor IDL from becoming - * PIDL. - */ - struct Parameter { - any argument; - CORBA::ParameterMode mode; - }; - - /** - * NVList PIDL represented by ParameterList IDL. - * This exists in order to keep the Portable Interceptor IDL from becoming - * PIDL. - */ - typedef sequence ParameterList; - - /** - * ContextList PIDL represented by ContextList - * IDL. This exists in order to keep the Portable Interceptor IDL from - * becoming PIDL. - */ - typedef CORBA::StringSeq ContextList; - - /** - * ExceptionList PIDL represented by ExceptionList - * IDL. This exists in order to keep the Portable Interceptor IDL from - * becoming PIDL. - */ - typedef sequence ExceptionList; - - /** - * Context PIDL represented by RequestContext - * IDL. This exists in order to keep the Portable Interceptor IDL from o - * becoming PIDL. - *

- * Context objects are encoded as String[]. The - * Strings occur in pairs. The first String in - * each pair is the context property name and the second String - * in each pair is the associated value. - */ - typedef CORBA::StringSeq RequestContext; -}; - -module PortableInterceptor { - /** - * All Portable Interceptors implement Interceptor. - */ - local interface Interceptor { - /** - * Returns the name of the interceptor. - *

- * Each Interceptor may have a name that may be used administratively - * to order the lists of Interceptors. Only one Interceptor of a given - * name can be registered with the ORB for each Interceptor type. An - * Interceptor may be anonymous, i.e., have an empty string as the name - * attribute. Any number of anonymous Interceptors may be registered with - * the ORB. - * - * @return the name of the interceptor. - */ - readonly attribute string name; - - // Added in ptc/00-08-06 - /** - * Provides an opportunity to destroy this interceptor. - * The destroy method is called during ORB.destroy. When an - * application calls ORB.destroy, the ORB: - *

    - *
  1. waits for all requests in progress to complete
  2. - *
  3. calls the Interceptor.destroy operation for each - * interceptor
  4. - *
  5. completes destruction of the ORB
  6. - *
- * Method invocations from within Interceptor.destroy on - * object references for objects implemented on the ORB being destroyed - * result in undefined behavior. However, method invocations on objects - * implemented on an ORB other than the one being destroyed are - * permitted. (This means that the ORB being destroyed is still capable - * of acting as a client, but not as a server.) - */ - void destroy(); - }; - - - /** - * The ForwardRequest exception is the means by which an - * Interceptor can indicate to the ORB that a retry of the request should - * occur with the new object given in the exception. This behavior of - * causing a retry only occurs if the ORB receives a ForwardRequest from - * an interceptor. If ForwardRequest is thrown anywhere else - * it is passed through the ORB as is normal for a user exception. - *

- * If an Interceptor throws a ForwardRequest exception in - * response to a call of an interceptor, no other Interceptors are called - * for that interception point. The remaining Interceptors in the Flow Stack - * shall have their appropriate ending interception point called: - * receive_other on the client, or send_other on - * the server. The reply_status in the - * receive_other or send_other would be - * LOCATION_FORWARD. - */ - exception ForwardRequest { - /** - * The new object to forward the request to. - */ - Object forward; -// Change in ptc/00-08-06 -// boolean permanent; - }; - - /** Reply status, represented as an int */ - typedef short ReplyStatus; - - // Valid reply_status values: - - /** - * Indicates a successful Reply Status. One possible value for - * RequestInfo.reply_status. - * @see RequestInfo#reply_status - * @see SYSTEM_EXCEPTION - * @see USER_EXCEPTION - * @see LOCATION_FORWARD - * @see TRANSPORT_RETRY - */ - const ReplyStatus SUCCESSFUL = 0; - - /** - * Indicates a SystemException reply status. One possible value for - * RequestInfo.reply_status. - * @see RequestInfo#reply_status - * @see SUCCESSFUL - * @see USER_EXCEPTION - * @see LOCATION_FORWARD - * @see TRANSPORT_RETRY - */ - const ReplyStatus SYSTEM_EXCEPTION = 1; - - /** - * Indicates a UserException reply status. One possible value for - * RequestInfo.reply_status. - * @see RequestInfo#reply_status - * @see SUCCESSFUL - * @see SYSTEM_EXCEPTION - * @see LOCATION_FORWARD - * @see TRANSPORT_RETRY - */ - const ReplyStatus USER_EXCEPTION = 2; - - /** - * Indicates a LocationForward reply status. One possible value for - * RequestInfo.reply_status. - * @see RequestInfo#reply_status - * @see SUCCESSFUL - * @see SYSTEM_EXCEPTION - * @see USER_EXCEPTION - * @see TRANSPORT_RETRY - */ - const ReplyStatus LOCATION_FORWARD = 3; - -// Changes in ptc/00-08-06 -// const ReplyStatus LOCATION_FORWARD_PERMANENT = 4; - - /** - * Indicates a Transport Retry reply status. One possible value for - * RequestInfo.reply_status. - * @see RequestInfo#reply_status - * @see SUCCESSFUL - * @see SYSTEM_EXCEPTION - * @see USER_EXCEPTION - * @see LOCATION_FORWARD - */ - const ReplyStatus TRANSPORT_RETRY = 4; - - /** - * XXX - */ - const ReplyStatus UNKNOWN = 5; - - /** Slot id, represented as an int */ - typedef unsigned long SlotId; - - /** - * This exception is thrown when get_slot or - * set_slot is called on a slot that has not been allocated. - */ - exception InvalidSlot {}; - - /** - * Portable Interceptors Current (also known as PICurrent) - * is merely a slot table, the slots of which are used by each service to - * transfer their context data between their context and the request's or - * reply's service context. Each service which wishes to use PICurrent - * reserves a slot or slots at initialization time and uses those slots - * during the processing of requests and replies. - *

- * Before an invocation is made, PICurrent is obtained via a call to - * ORB.resolve_initial_references( "PICurrent" ). From within - * the interception points, the data on PICurrent that has moved from the - * thread scope to the request scope is available via the - * get_slot operation on the RequestInfo object. - * A PICurrent can still be obtained via - * resolve_initial_references, but that is the Interceptor's - * thread scope PICurrent. - */ - local interface Current : CORBA::Current { - - /** - * Retrieves the slot data the application set in PICurrent via - * get_slot. The data is in the form of an Any. - *

- * If the given slot has not been set, an Any containing a type code - * with a TCKind value of tk_null and no value - * is returned. - * - * @param id The SlotId of the slot from which the data will - * be returned. - * @return The data, in the form of an Any, of the given slot identifier. - * @exception InvalidSlot thrown if get_slot is called on a slot that - * has not been allocated. - * @exception BAD_INV_ORDER thrown if get_slot is called - * from within an ORB initializer - */ - any get_slot (in SlotId id) raises (InvalidSlot); - - /** - * Sets data in a slot. The data is in the form of an Any. If data - * already exists in that slot, it is overridden. - * - * @param id The SlotId of the slot to which the data will - * be set. - * @param data The data, in the form of an Any, which will be set - * to the identified slot. - * @exception InvalidSlot thrown if set_slot is called on - * a slot that has not been allocated. - * @exception BAD_INV_ORDER thrown if set_slot is called - * from within an ORB initializer. - */ - void set_slot (in SlotId id, in any data) raises (InvalidSlot); - }; - - /** - * Request Information, accessible to Interceptors. - *

- * Each interception point is given an object through which the - * Interceptor can access request information. Client-side and server-side - * interception points are concerned with different information, so there - * are two information objects: ClientRequestInfo is passed - * to the client-side interception points and ServerRequestInfo - * is passed to the server-side interception points. But there is - * information that is common to both, so they both inherit from a common - * interface: RequestInfo. - * - * @see ClientRequestInfo - * @see ServerRequestInfo - */ - local interface RequestInfo { - /** - * Returns an id that uniquely identifies an active request/reply - * sequence. Once a request/reply sequence is concluded this ID may be - * reused. Note that this id is not the same as the GIOP - * request_id. If GIOP is the transport mechanism used, - * then these IDs may very well be the same, but this is not guaranteed - * nor required. - */ - readonly attribute unsigned long request_id; - - /** - * Returns the name of the operation being invoked. - */ - readonly attribute string operation; - - /** - * Returns an array of Parameter objects, containing the - * arguments on the operation being invoked. If there are no arguments, - * this attribute will be a zero length array. - *

- * Not all environments provide access to the arguments. With the Java - * portable bindings, for example, the arguments are not available. - * In these environments, when this attribute is accessed, - * NO_RESOURCES will be thrown with a standard minor code - * of 1. - *

- * Note: Arguments are available for DSI/DII calls. - * - * @exception NO_RESOURCES thrown if arguments are not available. - * @see - * PortableInterceptor package comments for - * limitations / unimplemented features - */ - readonly attribute Dynamic::ParameterList arguments; - - /** - * Returns an array of TypeCode objects describing the - * TypeCodes of the user exceptions that this operation - * invocation may throw. If there are no user exceptions, this - * will return a zero length array. - *

- * Not all environments provide access to the exception list. With - * the Java portable bindings, for example, the exception list is - * not available. In these environments, when this attribute is - * accessed, NO_RESOURCES will be thrown with a - * standard minor code of 1. - *

- * Note: Exceptions are available for DSI/DII calls. - * - * @exception NO_RESOURCES thrown if exceptions are not available. - * @see - * PortableInterceptor package comments for - * limitations / unimplemented features - */ - readonly attribute Dynamic::ExceptionList exceptions; - - /** - * Returns an array of String objects describing the - * contexts that may be passed on this operation invocation. If there - * are no contexts, this will return a zero length array. - *

- * Not all environments provide access to the context list. With the - * Java portable bindings, for example, the context list is not - * available. In these environments, when this attribute is accessed, - * NO_RESOURCES will be thrown with a standard minor code - * of 1. - *

- * Note: Contexts are available for DSI/DII calls. - * - * @exception NO_RESOURCES thrown if contexts are not available. - * @see - * PortableInterceptor package comments for - * limitations / unimplemented features - */ - readonly attribute Dynamic::ContextList contexts; - - /** - * Returns an array of String objects containing the - * contexts being sent on the request. - *

- * Not all environments provide access to the context. With the Java - * portable bindings, for example, the context is not available. In - * these environments, when this attribute is accessed, NO_RESOURCES will - * be thrown with standard minor code of 1. - *

- * Note: operation_context is available for - * DSI/DII calls. - * - * @exception NO_RESOURCES thrown if operation context is not available. - * @see - * PortableInterceptor package comments for - * limitations / unimplemented features - */ - readonly attribute Dynamic::RequestContext operation_context; - - /** - * Returns an any containing the result of the operation invocation. - * If the operation return type is void, this attribute will be an any - * containing a type code with a TCKind value of - * tk_void and no value. - *

- * Not all environments provide access to the result. With the Java - * portable bindings, for example, the result is not available. In - * these environments, when this attribute is accessed, - * NO_RESOURCES will be thrown with a standard minor code of - * 1. - *

- * Note: Result is available for DSI/DII calls. - * - * @exception NO_RESOURCES thrown if result is not available. - * @see - * PortableInterceptor package comments for - * limitations / unimplemented features - */ - readonly attribute any result; - - /** - * Indicates whether a response is expected. - *

- * On the client, a reply is not returned when - * response_expected is false, so receive_reply - * cannot be called. receive_other is called unless an - * exception occurs, in which case receive_exception is - * called. - *

- * On the client, within send_poll, this attribute is true. - */ - readonly attribute boolean response_expected; - - /** - * Defines how far the request shall progress before control is returned - * to the client. This is defined in the Messaging specification, and - * is pertinent only when response_expected is false. If - * response_expected is true, the value of - * sync_scope is undefined. This attribute may have one of - * the following values: - *

    - *
  • Messaging.SYNC_NONE
  • - *
  • Messaging.SYNC_WITH_TRANSPORT
  • - *
  • Messaging.SYNC_WITH_SERVER
  • - *
  • Messaging.SYNC_WITH_TARGET
  • - *
- * On the server, for all scopes, a reply will be created from the - * return of the target operation call, but the reply will not return - * to the client. Although it does not return to the client, it does - * occur, so the normal server-side interception points are - * followed (i.e., receive_request_service_contexts, - * receive_request, send_reply or - * send_exception). - *

- * For SYNC_WITH_SERVER and SYNC_WITH_TARGET, - * the server does send an empty reply back to the client before the - * target is invoked. This reply is not intercepted by server-side - * Interceptors. - * - * @see - * PortableInterceptor package comments for - * limitations / unimplemented features - */ - readonly attribute Messaging::SyncScope sync_scope; - - /** - * Describes the state of the result of the operation invocation. The - * return value can be one of the following: - *

    - *
  • PortableInterceptor.SUCCESSFUL
  • - *
  • PortableInterceptor.SYSTEM_EXCEPTION
  • - *
  • PortableInterceptor.USER_EXCEPTION
  • - *
  • PortableInterceptor.LOCATION_FORWARD
  • - *
  • PortableInterceptor.TRANSPORT_RETRY
  • - *
- * On the client: - *
    - *
  • Within the receive_reply interception point, this - * will only return SUCCESSFUL.
  • - *
  • Within the receive_exception interception point, - * this will be either SYSTEM_EXCEPTION or - * USER_EXCEPTION.
  • - *
  • Within the receive_other interception point, this - * will be any of: SUCCESSFUL, - * LOCATION_FORWARD, or TRANSPORT_RETRY. - * SUCCESSFUL means an asynchronous request returned - * successfully. LOCATION_FORWARD means that a reply - * came back with LOCATION_FORWARD as its status. - * TRANSPORT_RETRY means that the transport - * mechanism indicated a retry - a GIOP reply with a status of - * NEEDS_ADDRESSING_MODE, for instance.
  • - *
- * On the server: - *
    - *
  • Within the send_reply interception point, this - * will only be SUCCESSFUL.
  • - *
  • Within the send_exception interception point, - * this will be either SYSTEM_EXCEPTION or - * USER_EXCEPTION.
  • - *
  • Within the send_other interception point, this - * attribute will be any of: SUCCESSFUL, or - * LOCATION_FORWARD. SUCCESSFUL means - * an asynchronous request returned successfully. - * LOCATION_FORWARD means that a reply came back - * with LOCATION_FORWARD as its status.
  • - *
- * - * @see SUCCESSFUL - * @see SYSTEM_EXCEPTION - * @see USER_EXCEPTION - * @see LOCATION_FORWARD - * @see TRANSPORT_RETRY - */ - readonly attribute ReplyStatus reply_status; - - /** - * Contains the object to which the request will be forwarded, if the - * reply_status attribute is LOCATION_FORWARD. - * It is indeterminate whether a forwarded request will actually occur. - */ - readonly attribute Object forward_reference; - - /** - * Returns the data from the given slot of the - * PortableInterceptor.Current that is in the scope of - * the request. - *

- * If the given slot has not been set, then an any containing a - * type code with a TCKind value of tk_null is - * returned. - * - * @param id The SlotId of the slot which is to be - * returned. - * @return The slot data, in the form of an any, obtained with the - * given identifier. - * @exception InvalidSlot thrown if the ID does not define an - * allocated slot. - * @see Current - */ - any get_slot (in SlotId id) raises (InvalidSlot); - - /** - * Returns a copy of the service context with the given ID that - * is associated with the request. - * - * @param id The IOP.ServiceId of the service context - * which is to be returned. - * @return The IOP.ServiceContext obtained with the - * given identifier. - * @exception BAD_PARAM thrown with a standard minor code of 26, if the - * request's service context does not contain an entry for that ID. - */ - IOP::ServiceContext get_request_service_context - (in IOP::ServiceId id); - - /** - * Returns a copy of the service context with the given ID that - * is associated with the reply. - * - * @param id The IOP.ServiceId of the service context - * which is to be returned. - * @return The IOP.ServiceContext obtained with the given - * identifier. - * @exception BAD_PARAM thrown with a standard minor code of 26 if the - * request's service context does not contain an entry for that ID. - */ - IOP::ServiceContext get_reply_service_context - (in IOP::ServiceId id); - }; - - /** - * Request Information, accessible to client-side request interceptors. - *

- * Some attributes and operations on ClientRequestInfo are - * not valid at all interception points. The following table shows the - * validity of each attribute or operation. If it is not valid, attempting - * to access it will result in a BAD_INV_ORDER being thrown - * with a standard minor code of 14. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Shows the validity of each attribute or operation
send_requestsend_pollreceive_replyreceive_exceptionreceive_other
Inherited from RequestInfo:
request_idyesyesyesyesyes
operationyesyesyesyesyes
argumentsyes1no yesno no
exceptionsyesno yesyesyes
contextsyesno yesyesyes
operation_contextyesno yesyesyes
resultno no yesno no
response_expectedyesyesyesyesyes
sync_scopeyesno yesyesyes
reply_statusno no yesyesyes
forward_referenceno no no no yes2
get_slotyesyesyesyesyes
get_request_service_contextyesno yesyesyes
get_reply_service_contextno no yesyesyes
ClientRequestInfo-specific:
targetyesyesyesyesyes
effective_targetyesyesyesyesyes
effective_profileyesyesyesyesyes
received_exceptionno no no yesno
received_exception_idno no no yesno
get_effective_componentyesno yesyesyes
get_effective_componentsyesno yesyesyes
get_request_policyyesno yesyesyes
add_request_service_contextyesno no no no
- * - *

    - *
  1. When ClientRequestInfo is passed to - * send_request, there is an entry in the list for every - * argument, whether in, inout, or out. But only the in and inout - * arguments will be available.
  2. - *
  3. If the reply_status atribute is not - * LOCATION_FORWARD, accessing this attribute will - * throw BAD_INV_ORDER with a standard minor code of - * 14.
  4. - *
- * - * @see ClientRequestInterceptor - */ - local interface ClientRequestInfo : RequestInfo { - - /** - * Returns the object which the client called to perform the - * operation. - * - * @see #effective_target - */ - readonly attribute Object target; - - /** - * Returns the actual object on which the operation will be invoked. - * If the reply_status is LOCATION_FORWARD, - * then on subsequent requests, effective_target will - * contain the forwarded IOR while target will remain unchanged. - * - * @see #target - */ - readonly attribute Object effective_target; - - /** - * Returns the profile that will be used to send the request. If a - * location forward has occurred for this operation's object and - * that object's profile changed accordingly, then this profile will - * be that located profile. - */ - readonly attribute IOP::TaggedProfile effective_profile; - - /** - * Returns an any which contains the exception to be returned to - * the client. - *

- * If the exception is a user exception which cannot be inserted - * into an any (e.g., it is unknown or the bindings don t provide - * the TypeCode), then this attribute will be an any - * containing the system exception UNKNOWN with a - * standard minor code of 1. However, the repository id of - * the exception is available in the received_exception_id - * attribute. - * - * @see #received_exception_id - */ - readonly attribute any received_exception; - - /** - * Returns the repository id of the exception to be returned to - * the client. - * - * @see #received_exception - * @see - * PortableInterceptor package comments for - * limitations / unimplemented features - */ - readonly attribute CORBA::RepositoryId received_exception_id; - - /** - * Returns the IOP.TaggedComponent with the given ID from - * the profile selected for this request. - *

- * If there is more than one component for a given component ID, it - * is undefined which component this operation returns. If there is - * more than one component for a given component ID, - * get_effective_components should be called instead. - * - * @param id The component id of the component which - * is to be returned. - * @return The IOP.TaggedComponent obtained with the - * given identifier. - * @exception BAD_PARAM thrown, with a standard minor code of 28, if - * no component exists for the given component ID. - * @see #get_effective_components - */ - IOP::TaggedComponent get_effective_component - (in IOP::ComponentId id); - - /** - * Returns an array of all tagged components with the given ID from the - * profile selected for this request. - * - * @param id The component id of the components which are to be returned. - * @return An array of TaggedComponent objects, each of - * which contains the given identifier. - * @exception BAD_PARAM thrown, with a standard minor code of 28, if - * no component exists for the given component ID. - * @see #get_effective_component - */ - IOP::TaggedComponentSeq get_effective_components - (in IOP::ComponentId id); - - /** - * Returns the given policy in effect for this operation. - * - * @exception INV_POLICY thrown, with a standard minor code of 1, if the - * policy type is not valid either because the specified type is - * not supported by this ORB or because a policy object of that type - * is not associated with this Object - * @param type The policy type which specifies the policy to be - * returned. - * @return The CORBA.Policy obtained with the given type. - * @see - * PortableInterceptor package comments for - * limitations / unimplemented features - */ - CORBA::Policy get_request_policy - (in CORBA::PolicyType type); - - /** - * Allows Interceptors to add service contexts to the request. - *

- * There is no declaration of the order of the service contexts. - * They may or may not appear in the order that they are added. - * - * @param service_context The IOP.ServiceContext to be - * added to the request. - * @param replace Indicates the behavior of this operation when a - * service context already exists with the given ID. If false, - * then BAD_INV_ORDER with a standard minor code of 15 - * is thrown. If true, then the existing service context is - * replaced by the new one. - */ - void add_request_service_context ( - in IOP::ServiceContext service_context, - in boolean replace); - }; - - // Should be type string - typedef string ServerId ; - - // This should actually be the CORBA::ORBid type once that is available - typedef string ORBId ; - - /** The name of an object adapter. This is unique only within - * the scope of the ORB that created the object adapter. - */ - typedef org::omg::CORBA::StringSeq AdapterName ; - - /** Type of an object id. This provides the identity of a particular - * object that was created by an object adapter. - */ - typedef org::omg::CORBA::OctetSeq ObjectId ; - - /** - * Request Information, accessible to server-side request interceptors. - *

- * Some attributes and operations on ServerRequestInfo are not - * valid at all interception points. The following table shows the validity - * of each attribute or operation. If it is not valid, attempting to access - * it will result in a BAD_INV_ORDER being thrown with a - * standard minor code of 14. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Shows the validity of each attribute or operation
receive_request_
service_contexts
receive_requestsend_replysend_exceptionsend_other
Inherited from RequestInfo:
request_idyesyesyesyesyes
operationyesyesyesyesyes
argumentsno yes1yesno2no2 - *
exceptionsno yesyesyesyes
contextsno yesyesyesyes
operation_contextno yesyesno no
resultno no yesno no
response_expectedyesyesyesyesyes
sync_scopeyesyesyesyesyes
reply_statusno no yesyesyes
forward_referenceno no no no yes2
get_slotyesyesyesyesyes
get_request_service_contextyesno yesyesyes
get_reply_service_contextno no yesyesyes
ServerRequestInfo-specific:
sending_exceptionno no no yesno
object_idno yesyesyes3yes3
adapter_idno yesyesyes3yes3
server_idno yesyesyesyes
orb_idno yesyesyesyes
adapter_nameno yesyesyesyes
target_most_derived_interfaceno yesno4no4no4
get_server_policyyesyesyesyesyes
set_slotyesyesyesyesyes
target_is_ano yesno4no4no4
add_reply_service_contextyesyesyesyesyes
- * - *

    - *
  1. When ServerRequestInfo is passed to - * receive_request, there is an entry in the list for - * every argument, whether in, inout, or out. But only the in and - * inout arguments will be available.
  2. - *
  3. If the reply_status attribute is not - * LOCATION_FORWARD, accessing this attribute will throw - * BAD_INV_ORDER with a standard minor code of 14.
  4. - *
  5. If the servant locator caused a location forward, or thrown an - * exception, this attribute/operation may not be available in this - * interception point. NO_RESOURCES with a standard minor - * code of 1 will be thrown if it is not available.
  6. - *
  7. The operation is not available in this interception point because - * the necessary information requires access to the target object's - * servant, which may no longer be available to the ORB. For example, - * if the object's adapter is a POA that uses a - * ServantLocator, then the ORB invokes the interception - * point after it calls ServantLocator.postinvoke().
  8. - *
- * - * @see ServerRequestInterceptor - */ - local interface ServerRequestInfo : RequestInfo { - - /** - * Returns an any which contains the exception to be returned to - * the client. - *

- * If the exception is a user exception which cannot be inserted into - * an any (e.g., it is unknown or the bindings don't provide the - * TypeCode), then this attribute will be an any - * containing the system exception UNKNOWN with a - * standard minor code of 1. - * - * @see - * PortableInterceptor package comments for - * limitations / unimplemented features - */ - readonly attribute any sending_exception; - - /** - * Returns the opaque object_id describing the target of - * the operation invocation. - */ - readonly attribute ObjectId object_id; - - /** - * Returns the opaque identifier for the object adapter. - */ - readonly attribute CORBA::OctetSeq adapter_id; - - /** - * Returns the server ID that was specified on ORB::init using the -ORBServerId - * argument. - */ - readonly attribute ServerId server_id ; - - /** - * Returns the ID that was used to create the ORB. - */ - readonly attribute ORBId orb_id ; - - /** - * Returns the sequence of strings that identifies the object - * adapter instance that is handling this request. - */ - readonly attribute AdapterName adapter_name ; - - /** - * Returns the repository id for the most derived interface of the - * servant. - */ - readonly attribute CORBA::RepositoryId - target_most_derived_interface; - - /** - * Returns the policy in effect for this operation for the given - * policy type. The returned CORBA.Policy object shall - * only be a policy whose type was registered via - * register_policy_factory. - * - * @param type The CORBA.PolicyType which specifies the - * policy to be returned. - * @return The CORBA.Policy obtained with the given - * policy type. - * @exception INV_POLICY thrown, with a standard minor code of 2, if - * a policy for the given type was not registered via - * register_policy_factory. - * @see ORBInitInfo#register_policy_factory - */ - CORBA::Policy get_server_policy - (in CORBA::PolicyType type); - - /** - * Allows an Interceptor to set a slot in the - * PortableInterceptor.Current that is in the scope of - * the request. If data already exists in that slot, it will be - * overwritten. - * - * @param id The id of the slot. - * @param data The data, in the form of an any, to store in that slot. - * @exception InvalidSlot thrown if the ID does not define an allocated - * slot. - * @see Current - */ - void set_slot (in SlotId id, in any data) raises (InvalidSlot); - - /** - * Returns true if the servant is the given repository id, - * false if it is not. - * - * @param id The caller wants to know if the servant is this - * repository id. - * @return Is the servant the given RepositoryId? - */ - boolean target_is_a (in CORBA::RepositoryId id); - - /** - * Allows Interceptors to add service contexts to the request. - *

- * There is no declaration of the order of the service contexts. - * They may or may not appear in the order that they are added. - * - * @param service_context The IOP.ServiceContext to add to - * the reply. - * @param replace Indicates the behavior of this operation when a - * service context already exists with the given ID. If false, - * then BAD_INV_ORDER with a standard minor code of 15 - * is thrown. If true, then the existing service context is - * replaced by the new one. - * @exception BAD_INV_ORDER thrown, with a standard minor code of 15, if - * replace is false and a service context already exists with the - * given ID. - */ - void add_reply_service_context ( - in IOP::ServiceContext service_context, - in boolean replace); - }; - - /** - * Client-side request interceptor. - *

- * A request Interceptor is designed to intercept the flow of a - * request/reply sequence through the ORB at specific points so that - * services can query the request information and manipulate the service - * contexts which are propagated between clients and servers. The primary - * use of request Interceptors is to enable ORB services to transfer - * context information between clients and servers. There are two types - * of request Interceptors: client-side and server-side. - *

- * To write a client-side Interceptor, implement the - * ClientRequestInterceptor interface. - * - * @see ClientRequestInfo - */ - local interface ClientRequestInterceptor : Interceptor { - /** - * Allows an Interceptor to query request information and modify the - * service context before the request is sent to the server. - *

- * This interception point may throw a system exception. If it does, - * no other Interceptors' send_request operations are called. - * Those Interceptors on the Flow Stack are popped and their - * receive_exception interception points are called. This - * interception point may also throw a ForwardRequest - * exception. If an Interceptor throws this exception, no other - * Interceptors' send_request operations are - * called. Those Interceptors on the Flow Stack are popped and their - * receive_other interception points are called. - *

- * Compliant Interceptors shall properly follow completion_status - * semantics if they throw a system exception from this interception - * point. The completion_status shall be - * COMPLETED_NO. - * - * @param ri Information about the current request being intercepted. - * @exception ForwardRequest If thrown, indicates to the ORB that a - * retry of the request should occur with the new object given in - * the exception. - */ - void send_request (in ClientRequestInfo ri) raises (ForwardRequest); - - /** - * Allows an Interceptor to query information during a Time-Independent - * Invocation (TII) polling get reply sequence. - *

- * With TII, an application may poll for a response to a request sent - * previously by the polling client or some other client. This poll is - * reported to Interceptors through the send_poll - * interception point and the response is returned through the - * receive_reply or receive_exception - * interception points. If the response is not available before the - * poll time-out expires, the system exception TIMEOUT is - * thrown and receive_exception is called with this - * exception. - *

- * This interception point may throw a system exception. If it does, - * no other Interceptors' send_poll operations are - * called. Those Interceptors on the Flow Stack are popped and their - * receive_exception interception points are called. - *

- * Compliant Interceptors shall properly follow - * completion_status semantics if they throw a system - * exception from this interception point. The completion_status shall be - * COMPLETED_NO. - * - * @param ri Information about the current request being intercepted. - * @exception TIMEOUT thrown if the response is not available before - * the poll time-out expires - */ - void send_poll (in ClientRequestInfo ri); - - /** - * Allows an Interceptor to query the information on a reply after it - * is returned from the server and before control is returned to the - * client. - *

- * This interception point may throw a system exception. If it does, - * no other Interceptors' receive_reply operations are - * called. The remaining Interceptors in the Flow Stack shall have - * their receive_exception interception point called. - *

- * Compliant Interceptors shall properly follow - * completion_status semantics if they throw a system - * exception from this interception point. The - * completion_status shall be COMPLETED_YES. - * - * @param ri Information about the current request being intercepted. - */ - void receive_reply (in ClientRequestInfo ri); - - /** - * Indicates to the interceptor that an exception occurred. Allows - * an Interceptor to query the exception's information before it is - * thrown to the client. - *

- * This interception point may throw a system exception. This has the - * effect of changing the exception which successive Interceptors - * popped from the Flow Stack receive on their calls to - * receive_exception. The exception thrown to the client - * will be the last exception thrown by an Interceptor, or the original - * exception if no Interceptor changes the exception. - *

- * This interception point may also throw a ForwardRequest - * exception. If an Interceptor throws this exception, no other - * Interceptors' receive_exception operations are called. - * The remaining Interceptors in the Flow Stack are popped and have their - * receive_other interception point called. - *

- * If the completion_status of the exception is not - * COMPLETED_NO, then it is inappropriate for this - * interception point to throw a ForwardRequest exception. - * The request s at-most-once semantics would be lost. - *

- * Compliant Interceptors shall properly follow - * completion_status semantics if they throw a system - * exception from this interception point. If the original exception is - * a system exception, the completion_status of the new - * exception shall be the same as on the original. If the original - * exception is a user exception, then the completion_status - * of the new exception shall be COMPLETED_YES. - *

- * Under some conditions, depending on what policies are in effect, an - * exception (such as COMM_FAILURE) may result in a retry - * of the request. While this retry is a new request with respect to - * Interceptors, there is one point of correlation between the original - * request and the retry: because control has not returned to the - * client, the PortableInterceptor.Current for both the - * original request and the retrying request is the same. - * - * @param ri Information about the current request being intercepted. - * @exception ForwardRequest If thrown, indicates to the ORB that a - * retry of the request should occur with the new object given in - * the exception. - */ - void receive_exception (in ClientRequestInfo ri) raises (ForwardRequest); - - /** - * Allows an Interceptor to query the information available when a - * request results in something other than a normal reply or an - * exception. For example, a request could result in a retry - * (e.g., a GIOP Reply with a LOCATION_FORWARD status was - * received); or on asynchronous calls, the reply does not immediately - * follow the request, but control shall return to the client and an - * ending interception point shall be called. - *

- * For retries, depending on the policies in effect, a new request may or - * may not follow when a retry has been indicated. If a new request does - * follow, while this request is a new request, with respect to - * Interceptors, there is one point of correlation between the original - * request and the retry: because control has not returned to the client, - * the request scoped PortableInterceptor.Current for both - * the original request and the retrying request is the same. - *

- * This interception point may throw a system exception. If it does, no - * other Interceptors' receive_other operations are called. - * The remaining Interceptors in the Flow Stack are popped and have - * their receive_exception interception point called. - *

- * This interception point may also throw a ForwardRequest - * exception. If an Interceptor throws this exception, successive - * Interceptors' receive_other operations are called with - * the new information provided by the ForwardRequest - * exception. - *

- * Compliant Interceptors shall properly follow - * completion_status semantics if they throw a system - * exception from this interception point. The - * completion_status shall be COMPLETED_NO. - * If the target invocation had completed, this interception point - * would not be called. - * - * @param ri Information about the current request being intercepted. - * @exception ForwardRequest If thrown, indicates to the ORB that a - * retry of the request should occur with the new object given in - * the exception. - */ - void receive_other (in ClientRequestInfo ri) raises (ForwardRequest); - }; - - /** - * Server-side request interceptor. - *

- * A request Interceptor is designed to intercept the flow of a - * request/reply sequence through the ORB at specific points so that - * services can query the request information and manipulate the service - * contexts which are propagated between clients and servers. The primary - * use of request Interceptors is to enable ORB services to transfer - * context information between clients and servers. There are two types - * of request Interceptors: client-side and server-side. - *

- * To write a server-side Interceptor, implement the - * ServerRequestInterceptor interface. - * - * @see ServerRequestInfo - */ - local interface ServerRequestInterceptor : Interceptor { - /** - * Allows the interceptor to process service context information. - *

- * At this interception point, Interceptors must get their service - * context information from the incoming request transfer it to - * PortableInterceptor.Current's slots. - *

- * This interception point is called before the servant manager is called. - * Operation parameters are not yet available at this point. This - * interception point may or may not execute in the same thread as - * the target invocation. - *

- * This interception point may throw a system exception. If it does, - * no other Interceptors' receive_request_service_contexts - * operations are called. Those Interceptors on the Flow Stack are - * popped and their send_exception interception points are - * called. - *

- * This interception point may also throw a ForwardRequest - * exception. If an Interceptor throws this exception, no other - * Interceptors' receive_request_service_contexts operations - * are called. Those Interceptors on the Flow Stack are popped and - * their send_other interception points are called. - *

- * Compliant Interceptors shall properly follow - * completion_status semantics if they throw a system - * exception from this interception point. The - * completion_status shall be COMPLETED_NO. - * - * @param ri Information about the current request being intercepted. - * @exception ForwardRequest If thrown, indicates to the ORB that a - * retry of the request should occur with the new object given in - * the exception. - */ - void receive_request_service_contexts (in ServerRequestInfo ri) - raises (ForwardRequest); - - /** - * Allows an Interceptor to query request information after all the - * information, including operation parameters, are available. This - * interception point shall execute in the same thread as the target - * invocation. - *

- * In the DSI model, since the parameters are first available when - * the user code calls arguments, receive_request - * is called from within arguments. It is possible that - * arguments is not called in the DSI model. The target - * may call set_exception before calling - * arguments. The ORB shall guarantee that - * receive_request is called once, either through - * arguments or through set_exception. If it - * is called through set_exception, requesting the - * arguments will result in NO_RESOURCES being thrown with - * a standard minor code of 1. - *

- * This interception point may throw a system exception. If it does, no - * other Interceptors' receive_request operations are - * called. Those Interceptors on the Flow Stack are popped and their - * send_exception interception points are called. - *

- * This interception point may also throw a ForwardRequest - * exception. If an Interceptor throws this exception, no other - * Interceptors' receive_request operations are called. - * Those Interceptors on the Flow Stack are popped and their - * send_other interception points are called. - *

- * Compliant Interceptors shall properly follow - * completion_status semantics if they throw a system - * exception from this interception point. The - * completion_status shall be COMPLETED_NO. - * - * @param ri Information about the current request being intercepted. - * @exception ForwardRequest If thrown, indicates to the ORB that a - * retry of the request should occur with the new object given in - * the exception. - */ - void receive_request (in ServerRequestInfo ri) raises (ForwardRequest); - - /** - * Allows an Interceptor to query reply information and modify the - * reply service context after the target operation has been invoked - * and before the reply is returned to the client. This interception - * point shall execute in the same thread as the target invocation. - *

- * This interception point may throw a system exception. If it does, - * no other Interceptors' send_reply operations are called. - * The remaining Interceptors in the Flow Stack shall have their - * send_exception interception point called. - *

- * Compliant Interceptors shall properly follow - * completion_status semantics if they throw a - * system exception from this interception point. The - * completion_status shall be COMPLETED_YES. - * - * @param ri Information about the current request being intercepted. - */ - void send_reply (in ServerRequestInfo ri); - - /** - * Allows an Interceptor to query the exception information and modify - * the reply service context before the exception is thrown to the client. - * When an exception occurs, this interception point is called. This - * interception point shall execute in the same thread as the target - * invocation. - *

- * This interception point may throw a system exception. This has the - * effect of changing the exception which successive Interceptors - * popped from the Flow Stack receive on their calls to - * send_exception. The exception thrown to the client will - * be the last exception thrown by an Interceptor, or the original - * exception if no Interceptor changes the exception. - *

- * This interception point may also throw a ForwardRequest - * exception. If an Interceptor throws this exception, no other - * Interceptors' send_exception operations are called. The - * remaining Interceptors in the Flow Stack shall have their - * send_other interception points called. - *

- * If the completion_status of the exception is not - * COMPLETED_NO, then it is inappropriate for this - * interception point to throw a ForwardRequest exception. - * The request's at-most-once semantics would be lost. - *

- * Compliant Interceptors shall properly follow - * completion_status semantics if they throw a system - * exception from this interception point. If the original exception - * is a system exception, the completion_status of the new - * exception shall be the same as on the original. If the original - * exception is a user exception, then the completion_status - * of the new exception shall be COMPLETED_YES. - * - * @param ri Information about the current request being intercepted. - * @exception ForwardRequest If thrown, indicates to the ORB that a - * retry of the request should occur with the new object given in - * the exception. - */ - void send_exception (in ServerRequestInfo ri) raises (ForwardRequest); - - /** - * Allows an Interceptor to query the information available when a - * request results in something other than a normal reply or an - * exception. For example, a request could result in a retry - * (e.g., a GIOP Reply with a LOCATION_FORWARD status was - * received). This interception point shall execute in the same thread - * as the target invocation. - *

- * This interception point may throw a system exception. If it does, - * no other Interceptors' send_other operations are called. - * The remaining Interceptors in the Flow Stack shall have their - * send_exception interception points called. - *

- * This interception point may also throw a ForwardRequest - * exception. If an Interceptor throws this exception, successive - * Interceptors' send_other operations are called with - * the new information provided by the ForwardRequest - * exception. - *

- * Compliant Interceptors shall properly follow - * completion_status semantics if they throw a system - * exception from this interception point. The - * completion_status shall be COMPLETED_NO. - * - * @param ri Information about the current request being intercepted. - * @exception ForwardRequest If thrown, indicates to the ORB that a - * retry of the request should occur with the new object given in - * the exception. - */ - void send_other (in ServerRequestInfo ri) raises (ForwardRequest); - }; - - /** The object reference factory. This provides the capability of - * creating an object reference. - */ - abstract valuetype ObjectReferenceFactory { - /** make_object creates a CORBA object reference according - * to the data in this template, with the given repository ID and - * object ID. - */ - Object make_object( in string repositoryId, in ObjectId object_id ) ; - } ; - - /** The object reference template. An instance of this must - * exist for each object adapter created in an ORB. The server_id, - * orb_id, and adapter_name attributes uniquely identify this template - * within the scope of an IMR. Note that adapter_id is similarly unique - * within the same scope, but it is opaque, and less useful in many - * cases. - */ - abstract valuetype ObjectReferenceTemplate : ObjectReferenceFactory { - - readonly attribute ServerId server_id ; - - readonly attribute ORBId orb_id ; - - readonly attribute AdapterName adapter_name ; - } ; - - /** Sequence of object reference templates is used for reporting state - * changes that do not occur on the adapter manager. - */ - typedef sequence ObjectReferenceTemplateSeq ; - - /** Adapter manager identifier. Every object adapter has an adapter manager, - * indicated in this API only through the ID. A group of object adapter - * instances may share the same adapter manager, in which case state transitions - * reported for the adapter manager are observed by all object adapters with the - * same adapter manager ID. - */ - typedef long AdapterManagerId ; - - /** Type of object adapter state. State changes are reported either to - * the object adapter or to the adapter manager. - */ - typedef short AdapterState ; - - /** Object adapter state that holds requests temporarily until the - * state is changed. - */ - const AdapterState HOLDING = 0 ; - - /** Object adapter state that indicates normal request processing. - */ - const AdapterState ACTIVE = 1 ; - - /** Object adapter state that causes all requests to be discarded. - */ - const AdapterState DISCARDING = 2 ; - - /** Object adapter state that causes all requests to be discarded. - * This state indicates that the adapter is shutting down. - */ - const AdapterState INACTIVE = 3 ; - - /** Object adapter state indicating that the adapter has been destroyed. - */ - const AdapterState NON_EXISTENT = 4 ; - - /** - * Provides the server-side ORB service with access to the applicable - * policies during IOR construction and the ability to add components. - * The ORB passes an instance of its implementation of this interface as - * a parameter to IORInterceptor.establish_components. - * - * @see IORInterceptor - */ - local interface IORInfo { - - /** - * Allows an ORB service implementation to determine what server side - * policy of a particular type is in effect for an IOR being - * constructed. When the IOR being constructed is for an object - * implemented using a POA, all Policy objects passed to the - * PortableServer.POA.create_POA call that created that - * POA are accessable via get_effective_policy. - *

- * If a policy for the given type is not known to the ORB, then this - * operation will throw INV_POLICY with a standard minor - * code of 2. - * - * @param type an int specifying the type of policy to return. - * @return The effective CORBA.Policy object of the - * requested type. If the given policy type is known, but no policy - * of that type is in effect, then this operation will return a - * nil object reference. - */ - CORBA::Policy get_effective_policy - (in CORBA::PolicyType type); - - /** - * A portable ORB service implementation calls - * add_ior_component from its implementation of - * establish_components to add a tagged component to the - * set which will be included when constructing IORs. The components in - * this set will be included in all profiles. - *

- * Any number of components may exist with the same component ID. - * - * @param tagged_component The IOP.TaggedComponent to add. - */ - void add_ior_component - (in IOP::TaggedComponent tagged_component); - - /** - * A portable ORB service implementation calls - * add_ior_component_to_profile from its implementation of - * establish_components to add a tagged component to the - * set which will be included when constructing IORs. The components in - * this set will be included in the specified profile. - *

- * Any number of components may exist with the same component ID. - * - * @param tagged_component The IOP.TaggedComponent to add. - * @param profile_id The profile id of the profile to - * which this component will be added. - * @exception BAD_PARAM thrown, with a standard minor code of 29, if the - * given profile ID does not define a known profile or it is - * impossible to add components to that profile. - */ - void add_ior_component_to_profile ( - in IOP::TaggedComponent tagged_component, - in IOP::ProfileId profile_id); - - /** Return the adapter manager id of the object adapter - * that was just created and is running IOR interceptors. - */ - readonly attribute AdapterManagerId manager_id ; - - /** Return the adapter state of the object adapter - * that was just created and is running IOR interceptors. - */ - readonly attribute AdapterState state ; - - /** Return the object reference template of the object adapter - * that was just created and is running IOR interceptors. - */ - readonly attribute ObjectReferenceTemplate adapter_template ; - - /** On read, returns the current factory that will be used to create - * object references for the object adapter that was just created - * and is running IOR interceptors. By default, this factory is the same - * as the value of the adapter_template attribute. The current_factory - * may also be set to another object reference template inside an - * IORInterceptor_3_0. - */ - attribute ObjectReferenceFactory current_factory ; - }; - - /** - * Interceptor used to establish tagged components in the profiles within - * an IOR. - *

- * In some cases, a portable ORB service implementation may need to add - * information describing the server's or object's ORB service related - * capabilities to object references in order to enable the ORB service - * implementation in the client to function properly. - *

- * This is supported through the IORInterceptor and - * IORInfo interfaces. - * - * @see IORInfo - */ - local interface IORInterceptor : Interceptor { - /** - * A server side ORB calls the establish_components - * operation on all registered IORInterceptor instances - * when it is assembling the list of components that will be included - * in the profile or profiles of an object reference. This operation - * is not necessarily called for each individual object reference. - * In the case of the POA, this operation is called each time POA::create_POA - * is called. In any case, establish_components is - * guaranteed to be called at least once for each distinct set of - * server policies. - *

- * An implementation of establish_components must not - * throw exceptions. If it does, the ORB shall ignore the exception - * and proceed to call the next IOR Interceptor's - * establish_components operation. - * - * @param info The IORInfo instance used by the ORB - * service to query applicable policies and add components to be - * included in the generated IORs. - */ - void establish_components (in IORInfo info); - }; - - local interface IORInterceptor_3_0 : IORInterceptor { - /** The components_established method is invoked on all registered - * IORInterceptor_3_0 instances after establish_components - * has been invoked on all registered IORInterceptor instances. - * The adapter_template is available in info during this call. - * The current_factory may be get or set in info during this call. - *

- * Any exception thrown from this method is handled by the Object - * Adapter that called this interceptor. In the case of the POA, - * an exception results in a OBJ_ADAPTER exception with an OMG - * standard minor code of 6. - * @param info The IORInfo for the object adapter being created. - */ - void components_established( in IORInfo info ) ; - - /** Called whenever the state of an adapter manager changes. - * For the POA, that is the POAManager. If the state change - * is reported through adapter_manager_state_changed, - * it is not reported through adapter_state_changed. - * @param id the adapter manager id of the adapter manager that - * changed state - * @param state the new state of the adapter manager - */ - void adapter_manager_state_changed( in AdapterManagerId id, - in AdapterState state ) ; - - /** Called whenever the state of an object adapter changes, and - * the state change is not caused by an adapter manager. Such - * changes are reported to all registered IORInterceptor_3_0 - * instances. - * @param templates the sequence of ObjectReferenceTemplate instances - * on which this state change occurred. - * @param state the new AdapterState shared by all of the templates. - */ - void adapter_state_changed( in ObjectReferenceTemplateSeq templates, - in AdapterState state ) ; - }; - - /** - * Enables policy types to be constructed using - * CORBA.ORB.create_policy. - *

- * A portable ORB service implementation registers an instance of the - * PolicyFactory interface during ORB initialization in order - * to enable its policy types to be constructed using - * CORBA.ORB.create_policy. The POA is required to preserve - * any policy which is registered with ORBInitInfo in this - * manner. - * - * @see ORBInitInfo#register_policy_factory - */ - local interface PolicyFactory - { - /** - * Returns an instance of the appropriate interface derived from - * CORBA.Policy whose value corresponds to the - * specified any. - *

- * The ORB calls create_policy on a registered - * PolicyFactory instance when - * CORBA.ORB.create_policy is called for the - * PolicyType under which the PolicyFactory has - * been registered. The create_policy operation then - * returns an instance of the appropriate interface derived from - * CORBA.Policy whose value corresponds to the specified - * any. If it cannot, it shall throw an exception as described for - * CORBA.ORB.create_policy. - * - * @param type An int specifying the type of policy being created. - * @param value An any containing data with which to construct the - * CORBA.Policy. - * @return A CORBA.Policy object of the specified type and - * value. - */ - CORBA::Policy create_policy - (in CORBA::PolicyType type, in any value) - raises (CORBA::PolicyError); - }; - - /** - * Passed to each ORBInitializer, allowing it to - * to register interceptors and perform other duties while the ORB is - * initializing. - *

- * The ORBInitInfo object is only valid during - * ORB.init. If a service keeps a reference to its - * ORBInitInfo object and tries to use it after - * ORB.init returns, the object no longer exists and an - * OBJECT_NOT_EXIST exception shall be thrown. - * - * @see ORBInitializer - */ - local interface ORBInitInfo { - - /** Object id, represented as a String */ - typedef string ObjectId; - - /** - * Only one Interceptor of a given name can be registered with the - * ORB for each Interceptor type. If an attempt is made to register a - * second Interceptor with the same name, DuplicateName is thrown. - *

- * An Interceptor may be anonymous, i.e., have an empty string as the - * name attribute. Any number of anonymous Interceptors may be - * registered with the ORB so, if the Interceptor being registered - * is anonymous, the registration operation will not throw - * DuplicateName. - */ - exception DuplicateName { - /** - * The name for which there was already an interceptor registered. - */ - string name; - }; - - /** - * This exception is thrown by - * register_initial_reference and - * resolve_initial_references. - * register_initial_reference throws InvalidName - * if: - *

    - *
  • this operation is called with an empty string id; or
  • - *
  • this operation is called with an id that is already registered, - * including the default names defined by OMG.
  • - *
- * resolve_initial_references throws - * InvalidName if the name to be resolved is invalid. - */ - exception InvalidName {}; - - /** - * Returns the arguments passed to ORB.init. They may or - * may not contain the ORB's arguments. - */ - readonly attribute CORBA::StringSeq arguments; - - /** - * Returns the ID of the ORB being initialized. - */ - readonly attribute string orb_id; - - /** - * Returns the IOP.CodecFactory. The - * CodecFactory is normally obtained via a call to - * ORB.resolve_initial_references( "CodecFactory" ), but - * since the ORB is not yet available and Interceptors, particularly when - * processing service contexts, will require a Codec, a - * means of obtaining a Codec is necessary during ORB - * initialization. - */ - readonly attribute IOP::CodecFactory codec_factory; - - /** - * Identical to ORB.register_initial_reference. This same - * functionality exists here because the ORB, not yet fully initialized, - * is not yet available but initial references may need to be - * registered as part of Interceptor registration. The only difference - * is that the version of this operation on the ORB uses PIDL - * (CORBA.ORB.ObjectId) and - * (CORBA.ORB.InvalidName) whereas the version in this - * interface uses IDL defined in this interface; the semantics are - * identical. - */ - void register_initial_reference (in ObjectId id, in Object obj) - raises (InvalidName); - - // This was incorrectly returning void in orbos/99-12-02, correction - // from errata in orbos/00-01-01 - /** - * Identical to ORB.resolve_initial_references. This same - * functionality exists here because the ORB, not yet fully initialized, - * is not yet available but initial references may be required from the - * ORB as part of Interceptor registration. The only difference is that - * the version of this operation on the ORB uses PIDL - * (CORBA::ORB::ObjectId and - * CORBA::ORB::InvalidName) whereas the version in this - * interface uses IDL defined in this interface; the semantics - * are identical. - *

- * This operation is only valid during post_init. - */ - Object resolve_initial_references (in ObjectId id) raises (InvalidName); - - /** - * Used to add a client-side request Interceptor to the list of - * client-side request Interceptors. - * - * @param interceptor The ClientRequestInterceptor to be - * added. - * @exception DuplicateName thrown if a client-side request Interceptor - * has already been registered with this Interceptor's name. - */ - void add_client_request_interceptor - (in ClientRequestInterceptor interceptor) - raises (DuplicateName); - - /** - * Used to add a server-side request Interceptor to the list of - * server-side request Interceptors. - * - * @param interceptor The ServerRequestInterceptor to be added. - * @exception DuplicateName thrown if a server-side request Interceptor - * has already been registered with this Interceptor's name - */ - void add_server_request_interceptor ( - in ServerRequestInterceptor interceptor) - raises (DuplicateName); - - /** - * Used to add an IOR Interceptor to the list of IOR Interceptors. - * - * @param interceptor The IORInterceptor to be added. - * @exception DuplicateName thrown if an IOR Interceptor has already - * been registered with this Interceptor's name. - */ - void add_ior_interceptor (in IORInterceptor interceptor) - raises (DuplicateName); - - /** - * Called to allocate a slot on PortableInterceptor.Current. - *

- * Note that while slot id's can be allocated within an ORB initializer, - * the slots themselves cannot be initialized. - * - * @return The index to the slot which has been allocated. - * @exception BAD_INV_ORDER thrown, with a standard minor code of 14, if - * set_slot or get_slot is called on the - * PICurrent within an ORB initializer. - * @see Current - */ - SlotId allocate_slot_id (); - - /** - * Registers a PolicyFactory for the given - * PolicyType. - * - * @param type The policy type that the given PolicyFactory - * serves. - * @param policy_factory The factory for the given policy type. - * @exception BAD_INV_ORDER thrown, with a standard minor code of 16, if - * a PolicyFactory already exists for the given - * PolicyType. - */ - void register_policy_factory ( - in CORBA::PolicyType type, - in PolicyFactory policy_factory); - }; - - /** - * Facilitates interceptor registration and ORB initialization. - *

- * Interceptors are intended to be a means by which ORB services gain - * access to ORB processing, effectively becoming part of the ORB. - * Since Interceptors are part of the ORB, when ORB.init - * returns an ORB, the Interceptors shall have been registered. - * Interceptors cannot be registered on an ORB after it has been - * returned by a call to ORB.init. - *

- * An Interceptor is registered by registering an associated - * ORBInitializer object which implements the - * ORBInitializer interface. When an ORB is initializing, - * it shall call each registered ORBInitializer, passing it - * an ORBInitInfo object which is used to register its - * Interceptor. - *

- * Registering ORB Initializers in Java - *

- * ORBInitializers are registered via Java ORB properties. - *

- * The property names are of the form: - *

- * org.omg.PortableInterceptor.ORBInitializerClass.<Service> - *
- * where <Service> is the string name of a class - * which implements - *
- * org.omg.PortableInterceptor.ORBInitializer - *
- * To avoid name collisions, the reverse DNS name convention should be - * used. For example, if company X has three initializers, it could define - * the following properties: - *
    - *
  • - * org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init1 - *
  • - *
  • - * org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init2 - *
  • - *
  • - * org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init3 - *
  • - *
- * During ORB.init, these ORB properties which begin with - * org.omg.PortableInterceptor.ORBInitializerClass shall be - * collected, the <Service> portion of each property - * shall be extracted, an object shall be instantiated with the - * <Service> string as its class name, and the - * pre_init and post_init methods shall be - * called on that object. If there are any exceptions, the ORB shall - * ignore them and proceed. - *

- * Example - *

- * A client-side logging service written by company X, for example, may - * have the following ORBInitializer implementation: - *


-   * package com.x.logging;
-   * 
-   * import org.omg.PortableInterceptor.Interceptor; 
-   * import org.omg.PortableInterceptor.ORBInitializer; 
-   * import org.omg.PortableInterceptor.ORBInitInfo; 
-   * 
-   * public class LoggingService implements ORBInitializer { 
-   *     void pre_init( ORBInitInfo info ) { 
-   *         // Instantiate the Logging Service s Interceptor. 
-   *         Interceptor interceptor = new LoggingInterceptor(); 
-   *
-   *         // Register the Logging Service s Interceptor. 
-   *         info.add_client_request_interceptor( interceptor ); 
-   *     } 
-   * 
-   *     void post_init( ORBInitInfo info ) { 
-   *         // This service does not need two init points. 
-   *     } 
-   * } 
-   * 
- * To run a program called MyApp using this logging - * service, the user could type: - *
- * java - *-Dorg.omg.PortableInterceptor.ORBInitializerClass.com.x.Logging.LoggingService - * MyApp - *
- *

- * Notes about Registering Interceptors - *

- * Request Interceptors are registered on a per-ORB basis. - *

- * To achieve virtual per-object Interceptors, query the policies on the - * target from within the interception points to determine whether they - * should do any work. - *

- * To achieve virtual per-POA Interceptors, instantiate each POA with a - * different ORB. While Interceptors may be ordered administratively, - * there is no concept of order with respect to the registration of - * Interceptors. Request Interceptors are concerned with service contexts. - * Service contexts have no order, so there is no purpose for request - * Interceptors to have an order. IOR Interceptors are concerned with - * tagged components. Tagged components also have no order, so there - * is no purpose for IOR Interceptors to have an order. - *

- * Registration code should avoid using the ORB (i.e., calling - * ORB.init with the provided orb_id). Since - * registration occurs during ORB initialization, results of invocations - * on this ORB while it is in this state are undefined. - * - * @see ORBInitInfo - */ - local interface ORBInitializer { - - /** - * Called during ORB initialization. If it is expected that initial - * services registered by an interceptor will be used by other - * interceptors, then those initial services shall be registered at - * this point via calls to - * ORBInitInfo.register_initial_reference. - * - * @param info provides initialization attributes and operations by - * which Interceptors can be registered. - */ - void pre_init (in ORBInitInfo info); - - /** - * Called during ORB initialization. If a service must resolve initial - * references as part of its initialization, it can assume that all - * initial references will be available at this point. - *

- * Calling the post_init operations is not the final - * task of ORB initialization. The final task, following the - * post_init calls, is attaching the lists of registered - * interceptors to the ORB. Therefore, the ORB does not contain the - * interceptors during calls to post_init. If an - * ORB-mediated call is made from within post_init, no - * request interceptors will be invoked on that call. - * Likewise, if an operation is performed which causes an IOR to be - * created, no IOR interceptors will be invoked. - * - * @param info provides initialization attributes and - * operations by which Interceptors can be registered. - */ - void post_init (in ORBInitInfo info); - }; -}; --- old/src/java.corba/share/classes/org/omg/PortableInterceptor/Messaging.idl 2018-01-30 20:29:20.000000000 -0500 +++ /dev/null 2018-01-30 20:29:20.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2000, 2001, 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. - */ - -#ifndef _MESSAGING_IDL_ -#define _MESSAGING_IDL_ - -#pragma prefix "omg.org" - -module Messaging { - - /** Synchronization scope */ - typedef short SyncScope; - - /** - * Constant, defined in the Messaging spec, to define how far the - * request shall progress before control is returned to the client. - */ - const SyncScope SYNC_WITH_TRANSPORT = 1; -}; - -#endif // _MESSAGING_IDL_ - --- old/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html 2018-01-30 20:29:21.000000000 -0500 +++ /dev/null 2018-01-30 20:29:21.000000000 -0500 @@ -1,52 +0,0 @@ - - - - - - - -

This package contains the exceptions and typedefs from the ORBInitInfo -local interface of the PortableInterceptor module specified in the OMG -Portable Interceptor specification, - -ptc/2000-08-06, section 21.7.2. Please -refer to that OMG specification for further details. - - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html 2018-01-30 20:29:21.000000000 -0500 +++ /dev/null 2018-01-30 20:29:22.000000000 -0500 @@ -1,103 +0,0 @@ - - - - - - - - -Provides a mechanism to register ORB hooks through which ORB services -can intercept the normal flow of execution of the ORB. - -

Interceptor Types

-There are currently three types of interceptors that can be registered: -
    -
  • {@link org.omg.PortableInterceptor.IORInterceptor IORInterceptor} - - Used to establish tagged components in the profiles within an IOR.
  • -
  • {@link org.omg.PortableInterceptor.ClientRequestInterceptor -ClientRequestInterceptor} - - Intercepts the flow of a request/reply sequence through the ORB on - the client side.
  • -
  • {@link org.omg.PortableInterceptor.ServerRequestInterceptor -ServerRequestInterceptor} - - Intercepts the flow of a request/reply sequence through the ORB on - the server side.
  • -
-See the javadocs for class -{@link org.omg.PortableInterceptor.ORBInitializer ORBInitializer} -for how to go about registering interceptors. - - -

Known limitations / unimplemented methods in package -org.omg.PortableInterceptor

- -
    -
  • - RequestInfo -
      -
    • sync_scope(): Always returns SYNC_WITH_TRANSPORT
    • -
    • arguments(): Only supported for DII/DSI calls
    • -
    • exceptions(): Only supported for DII calls on client side. - Not supported on server-side.
    • -
    • contexts(): Only supported for DII calls on client side. - Not supported on server-side since our ORB does not send contexts. -
    • -
    • operation_context(): Only supported for DII calls - on client side. Not supported on server-side since ORB - does not send contexts.
    • -
    • result(): Only supported for DII/DSI calls
    • -
    -
  • -
  • - ClientRequestInfo -
      -
    • received_exception_id(): Always returns null in the - DII case
    • -
    • get_request_policy(int type): Not implemented.
    • -
    -
  • -
  • - ServerRequestInfo -
      -
    • sending_exception(): Does not support user exceptions on - the server side in non-DSI case.
    • -
    -
  • -
- -

Package Specification

-

For a precise list of supported sections of official OMG specifications with which -the Java[tm] Platform, Standard Edition 6 complies, see Official Specifications for CORBA -support in Java SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/PortableServer/CurrentHelper.java 2018-01-30 20:29:22.000000000 -0500 +++ /dev/null 2018-01-30 20:29:22.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2001, 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 org.omg.PortableServer; - - -/** -* org/omg/PortableServer/CurrentHelper.java . -* Generated by the IDL-to-Java compiler (portable), version "3.1" -* from ../../../../src/share/classes/org/omg/PortableServer/poa.idl -* Tuesday, October 23, 2001 1:17:01 PM PDT -*/ - - -/** - * The PortableServer::Current interface, derived from - * CORBA::Current, provides method implementations with - * access to the identity of the object on which the - * method was invoked. The Current interface is provided - * to support servants that implement multiple objects, - * but can be used within the context of POA-dispatched - * method invocations on any servant. To provide location - * transparency, ORBs are required to support use of - * Current in the context of both locally and remotely - * invoked operations. An instance of Current can be - * obtained by the application by issuing the - * CORBA::ORB::resolve_initial_references("POACurrent") - * operation. Thereafter, it can be used within the - * context of a method dispatched by the POA to obtain - * the POA and ObjectId that identify the object on - * which that operation was invoked. - */ -abstract public class CurrentHelper -{ - private static String _id = "IDL:omg.org/PortableServer/Current:2.3"; - - public static void insert (org.omg.CORBA.Any a, - org.omg.PortableServer.Current that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.PortableServer.Current extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc ( - org.omg.PortableServer.CurrentHelper.id (), "Current"); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.PortableServer.Current read ( - org.omg.CORBA.portable.InputStream istream) - { - throw new org.omg.CORBA.MARSHAL (); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, - org.omg.PortableServer.Current value) - { - throw new org.omg.CORBA.MARSHAL (); - } - - public static org.omg.PortableServer.Current narrow ( - org.omg.CORBA.Object obj) - { - if (obj == null) - return null; - else if (obj instanceof org.omg.PortableServer.Current) - return (org.omg.PortableServer.Current)obj; - else if (!obj._is_a (id ())) - throw new org.omg.CORBA.BAD_PARAM (); - return null; - } - -} --- old/src/java.corba/share/classes/org/omg/PortableServer/CurrentPackage/package.html 2018-01-30 20:29:23.000000000 -0500 +++ /dev/null 2018-01-30 20:29:23.000000000 -0500 @@ -1,61 +0,0 @@ - - - - - - - -

Provides method implementations with - access to the identity of the object on which the - method was invoked. The Current package - supports servants that implement multiple objects, - but can be used within the context of POA-dispatched - method invocations on any servant. To provide location - transparency, ORBs are required to support use of - Current in the context of both locally and remotely - invoked operations. An instance of Current can be - obtained by the application by issuing the - CORBA::ORB::resolve_initial_references("POACurrent") - operation. Thereafter, it can be used within the - context of a method dispatched by the POA to obtain - the POA and ObjectId that identify the object on - which that operation was invoked. - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/PortableServer/DynamicImplementation.java 2018-01-30 20:29:24.000000000 -0500 +++ /dev/null 2018-01-30 20:29:24.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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 org.omg.PortableServer; - -/** - * Allows dynamic handling of object invocations. POA-based DSI - * servants inherit from the - * standard DynamicImplementation class, this class inherits - * from the Servant class. Based on IDL to Java spec. - * CORBA V 2.3.1 ptc/00-01-08.pdf. - */ -abstract public class DynamicImplementation extends Servant { - -/** - * Receives requests issued to any CORBA object - * incarnated by the DSI servant and performs the processing - * necessary to execute the request. - * @param request the request issued to the CORBA object. - */ - abstract public void invoke(org.omg.CORBA.ServerRequest request); -} --- old/src/java.corba/share/classes/org/omg/PortableServer/POAHelper.java 2018-01-30 20:29:24.000000000 -0500 +++ /dev/null 2018-01-30 20:29:24.000000000 -0500 @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2001, 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 org.omg.PortableServer; - -/** -* org/omg/PortableServer/POAHelper.java . -* Generated by the IDL-to-Java compiler (portable), version "3.1" -* from ../../../../src/share/classes/org/omg/PortableServer/poa.idl -* Tuesday, October 23, 2001 1:16:58 PM PDT -*/ - - -/** - * A POA object manages the implementation of a - * collection of objects. The POA supports a name space - * for the objects, which are identified by Object Ids. - * A POA also provides a name space for POAs. A POA is - * created as a child of an existing POA, which forms a - * hierarchy starting with the root POA. A POA object - * must not be exported to other processes, or - * externalized with ORB::object_to_string. - */ -abstract public class POAHelper -{ - private static String _id = "IDL:omg.org/PortableServer/POA:2.3"; - - public static void insert (org.omg.CORBA.Any a, - org.omg.PortableServer.POA that) - { - org.omg.CORBA.portable.OutputStream out = a.create_output_stream (); - a.type (type ()); - write (out, that); - a.read_value (out.create_input_stream (), type ()); - } - - public static org.omg.PortableServer.POA extract (org.omg.CORBA.Any a) - { - return read (a.create_input_stream ()); - } - - private static org.omg.CORBA.TypeCode __typeCode = null; - synchronized public static org.omg.CORBA.TypeCode type () - { - if (__typeCode == null) - { - __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (org.omg.PortableServer.POAHelper.id (), "POA"); - } - return __typeCode; - } - - public static String id () - { - return _id; - } - - public static org.omg.PortableServer.POA read ( - org.omg.CORBA.portable.InputStream istream) - { - throw new org.omg.CORBA.MARSHAL (); - } - - public static void write (org.omg.CORBA.portable.OutputStream ostream, - org.omg.PortableServer.POA value) - { - throw new org.omg.CORBA.MARSHAL (); - } - - public static org.omg.PortableServer.POA narrow (org.omg.CORBA.Object obj) - { - if (obj == null) - return null; - else if (obj instanceof org.omg.PortableServer.POA) - return (org.omg.PortableServer.POA)obj; - else if (!obj._is_a (id ())) - throw new org.omg.CORBA.BAD_PARAM (); - return null; - } -} --- old/src/java.corba/share/classes/org/omg/PortableServer/POAManagerPackage/package.html 2018-01-30 20:29:25.000000000 -0500 +++ /dev/null 2018-01-30 20:29:25.000000000 -0500 @@ -1,51 +0,0 @@ - - - - - - - -

-Encapsulates the processing - state of the POAs it is associated with. Each POA object has an associated POAManager object. A POA manager may be associated with one or more - POA objects. - - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html 2018-01-30 20:29:26.000000000 -0500 +++ /dev/null 2018-01-30 20:29:26.000000000 -0500 @@ -1,82 +0,0 @@ - - - - - - - - -

Allows programmers to construct object implementations that are portable -between different ORB products. - -

The Portable Object Adaptor (POA) is designed to meet the following goals: -

    -
  • Allow programmers to construct object implementations that are portable between different ORB products. -
  • Provide support for objects with persistent identities. -
  • Provide support for transparent activation of objects. -
  • Allow a single servant to support multiple object identities simultaneously. -
- - - -

Given an interface My defined in My.idl, the file MyPOA.java -is generated by the idlj compiler. You must provide -the implementation for My and it must inherit from MyPOA. - -

MyPOA.java is a stream-based skeleton that extends -org.omg.PortableServer.Servant and implements the InvokeHandler -interface and the operations interface associated with the IDL interface the skeleton implements. - -

The PortableServer module for the Portable Object Adapter (POA) -defines the native Servant type. In the Java programming language, -the Servant type is mapped to the Java org.omg.PortableServer.Servant class. -It serves as the base class for all POA servant implementations -and provides a number of methods that may be invoked by the application programmer, -as well as methods which are invoked by the POA itself -and may be overridden by the user to control aspects of servant behavior. - - - -

All Mapping corresponds to the Chapter 11 of - CORBA V2.3.1 specified by OMG document formal/99-10-07.pdf. - The exception to this is the id attribute, which is added in ptc/00-08-06, - section 11.3.8.26. - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6, ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/PortableServer/Servant.java 2018-01-30 20:29:27.000000000 -0500 +++ /dev/null 2018-01-30 20:29:27.000000000 -0500 @@ -1,266 +0,0 @@ -/* - * Copyright (c) 1997, 2003, 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 org.omg.PortableServer; - -import org.omg.CORBA.ORB; -import org.omg.PortableServer.portable.Delegate; - -/** - * Defines the native Servant type. In Java, the - * Servant type is mapped to the Java - * org.omg.PortableServer.Servant class. - * It serves as the base class for all POA servant - * implementations and provides a number of methods that may - * be invoked by the application programmer, as well as methods - * which are invoked by the POA itself and may be overridden by - * the user to control aspects of servant behavior. - * Based on IDL to Java spec. (CORBA V2.3.1) ptc/00-01-08.pdf. - */ - -abstract public class Servant { - - private transient Delegate _delegate = null; - /** - * Gets the ORB vendor-specific implementation of - * PortableServer::Servant. - * @return _delegate the ORB vendor-specific - * implementation of PortableServer::Servant. - */ - final public Delegate _get_delegate() { - if (_delegate == null) { - throw - new - org.omg.CORBA.BAD_INV_ORDER - ("The Servant has not been associated with an ORB instance"); - } - return _delegate; - } - - /** - * Supports the Java ORB portability - * interfaces by providing a method for classes that support - * ORB portability through delegation to set their delegate. - * @param delegate ORB vendor-specific implementation of - * the PortableServer::Servant. - */ - final public void _set_delegate(Delegate delegate) { - _delegate = delegate; - } - - /** - * Allows the servant to obtain the object reference for - * the target CORBA object it is incarnating for that request. - * @return this_object Object reference - * associated with the request. - */ - final public org.omg.CORBA.Object _this_object() { - return _get_delegate().this_object(this); - } - - /** - * Allows the servant to obtain the object reference for - * the target CORBA Object it is incarnating for that request. - * @param orb ORB with which the servant is associated. - * @return _this_object reference associated with the request. - */ - final public org.omg.CORBA.Object _this_object(ORB orb) { - try { - ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this); - } - catch(ClassCastException e) { - throw - new - org.omg.CORBA.BAD_PARAM - ("POA Servant requires an instance of org.omg.CORBA_2_3.ORB"); - } - return _this_object(); - } - - /** - * Returns the instance of the ORB - * currently associated with the Servant (convenience method). - * @return orb the instance of the ORB currently - * associated with the Servant. - */ - final public ORB _orb() { - return _get_delegate().orb(this); - } - - /** - * Allows easy execution of common methods, equivalent to - * PortableServer::Current:get_POA. - * @return poa POA associated with the servant. - */ - final public POA _poa() { - return _get_delegate().poa(this); - } - - /** - * Allows easy execution of - * common methods, equivalent - * to calling PortableServer::Current::get_object_id. - * @return object_id the Object ID associated - * with this servant. - */ - final public byte[] _object_id() { - return _get_delegate().object_id(this); - } - - /** - * Returns the - * root POA from the ORB instance associated with the servant. - * Subclasses may override this method to return a different POA. - * @return default_POA the POA associated with the - * Servant. - */ - public POA _default_POA() { - return _get_delegate().default_POA(this); - } - - /** - * Checks to see if the specified repository_id is present - * on the list returned by _all_interfaces() or is the - * repository_id for the generic CORBA Object. - * @param repository_id the repository_id - * to be checked in the repository list or against the id - * of generic CORBA objects. - * @return is_a boolean indicating whether the specified - * repository_id is - * in the repository list or is same as a generic CORBA - * object. - */ - public boolean _is_a(String repository_id) { - return _get_delegate().is_a(this, repository_id); - } - - /** - * Checks for the existence of an - * Object. - * The Servant provides a default implementation of - * _non_existent() that can be overridden by derived servants. - * @return non_existent true if that object does - * not exist, false otherwise. - */ - public boolean _non_existent() { - return _get_delegate().non_existent(this); - } - - // Ken and Simon will ask about editorial changes - // needed in IDL to Java mapping to the following - // signature. - /** - * Returns an object in the Interface Repository - * which provides type information that may be useful to a program. - * Servant provides a default implementation of - * _get_interface() - * that can be overridden by derived servants if the default - * behavior is not adequate. - * @return get_interface type information that corresponds to this servant. - */ - /* - public org.omg.CORBA.Object _get_interface() { - return _get_delegate().get_interface(this); - } - */ - - // _get_interface_def() replaces the _get_interface() method - - /** - * Returns an InterfaceDef object as a - * CORBA::Object that defines the runtime type of the - * CORBA::Object implemented by the Servant. - * The invoker of _get_interface_def - * must narrow the result to an InterfaceDef in order - * to use it. - *

This default implementation of _get_interface_def() - * can be overridden - * by derived servants if the default behavior is not adequate. - * As defined in the CORBA 2.3.1 specification, section 11.3.1, the - * default behavior of _get_interface_def() is to use - * the most derived - * interface of a static servant or the most derived interface retrieved - * from a dynamic servant to obtain the InterfaceDef. - * This behavior must - * be supported by the Delegate that implements the - * Servant. - * @return get_interface_def an InterfaceDef - * object as a - * CORBA::Object that defines the runtime type of the - * CORBA::Object implemented by the Servant. - */ - public org.omg.CORBA.Object _get_interface_def() - { - // First try to call the delegate implementation class's - // "Object get_interface_def(..)" method (will work for ORBs - // whose delegates implement this method). - // Else call the delegate implementation class's - // "InterfaceDef get_interface(..)" method using reflection - // (will work for ORBs that were built using an older version - // of the Delegate interface with a get_interface method - // but not a get_interface_def method). - - org.omg.PortableServer.portable.Delegate delegate = _get_delegate(); - try { - // If the ORB's delegate class does not implement - // "Object get_interface_def(..)", this will throw - // an AbstractMethodError. - return delegate.get_interface_def(this); - } catch( AbstractMethodError aex ) { - // Call "InterfaceDef get_interface(..)" method using reflection. - try { - Class[] argc = { org.omg.PortableServer.Servant.class }; - java.lang.reflect.Method meth = - delegate.getClass().getMethod("get_interface", argc); - Object[] argx = { this }; - return (org.omg.CORBA.Object)meth.invoke(delegate, argx); - } catch( java.lang.reflect.InvocationTargetException exs ) { - Throwable t = exs.getTargetException(); - if (t instanceof Error) { - throw (Error) t; - } else if (t instanceof RuntimeException) { - throw (RuntimeException) t; - } else { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - } catch( RuntimeException rex ) { - throw rex; - } catch( Exception exr ) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - } - } - - // methods for which the user must provide an - // implementation - /** - * Used by the ORB to obtain complete type - * information from the servant. - * @param poa POA with which the servant is associated. - * @param objectId is the id corresponding to the object - * associated with this servant. - * @return list of type information for the object. - */ - abstract public String[] _all_interfaces( POA poa, byte[] objectId); -} --- old/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java 2018-01-30 20:29:27.000000000 -0500 +++ /dev/null 2018-01-30 20:29:27.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 1998, 2000, 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 org.omg.PortableServer.ServantLocatorPackage; - -/** - * The native type PortableServer::ServantLocator::Cookie is mapped - * to java.lang.Object. A CookieHolder class is provided for passing - * the Cookie type as an out parameter. The CookieHolder class - * follows exactly the same pattern as the other holder classes - * for basic types. - */ - -final public class CookieHolder implements org.omg.CORBA.portable.Streamable -{ - public java.lang.Object value; - - public CookieHolder() { } - - public CookieHolder(java.lang.Object initial) { - value = initial; - } - - public void _read( org.omg.CORBA.portable.InputStream is) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - public void _write( org.omg.CORBA.portable.OutputStream os) { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } - - public org.omg.CORBA.TypeCode _type() { - throw new org.omg.CORBA.NO_IMPLEMENT(); - } -} --- old/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html 2018-01-30 20:29:28.000000000 -0500 +++ /dev/null 2018-01-30 20:29:28.000000000 -0500 @@ -1,51 +0,0 @@ - - - - - - - -Provides classes and interfaces for locating the servant. - -

This package supplies a CookieHolder class for passing -the Cookie type as an out parameter. The CookieHolder class -follows exactly the same pattern as the other holder classes for basic types. - -

Package Specification

- -

For a precise list of supported sections of official OMG specifications with which -the Java[tm] Platform, Standard Edition 6 complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/PortableServer/corba.idl 2018-01-30 20:29:29.000000000 -0500 +++ /dev/null 2018-01-30 20:29:29.000000000 -0500 @@ -1,101 +0,0 @@ -/* - * Copyright (c) 1997, 2000, 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. - */ - - -// minimal definitions to keep idltojava happy while compiling poa.idl -#pragma prefix "omg.org" - -module CORBA { - - typedef string Identifier; - typedef string RepositoryId; - - // basic Policy definition - typedef unsigned long PolicyType ; - - /** The Policy interface provides a mechanism for ORBs and Object - * Services to allow access to certain choices that affect their - * operation. This information is accessed in a structured manner - * using interfaces derived from the org.omg.CORBA.Policy interface. - */ - interface Policy { - /** Return the constant value that corresponds to the - * type of the policy object. The values of - * the polivy objectys are allocated by the OMG. - * New values for PolicyType should be obtained from the OMG by - * sending mail to request@omg.org. In general the constant - * values that are allocated are defined in conjunction with - * the definition of the corresponding policy object. - * @return the constant value that corresponds to the type of - * the policy object. - */ - readonly attribute PolicyType policy_type; - - /** Copies the policy object. The copy does not retain any - * relationships that the policy had with any domain or object. - * @return the copy of the policy object. - */ - Policy copy( ); - - /** Destroys the policy object. It is the responsibility of - * the policy object to determine whether it can be destroyed. - */ - void destroy( ); - }; - - typedef sequence PolicyList; - - /** - * An interface that makes it possible to access information - * associated with a particular thread of execution, such as - * security information or a transaction identifier. - *

- * An ORB or CORBA service that needs its own thread-specific - * state extends the CORBA package's Current. - * Users of the service can obtain an instance of the appropriate - * Current interface by invoking - * ORB.resolve_initial_references. - * For example, the Security service obtains the Current - * relevant to it by invoking - *

-	 *    ORB.resolve_initial_references("SecurityCurrent");
-	 * 
- *

- * A CORBA service does not have to use this method of keeping context - * but may choose to do so. - *

- * Methods on classes that implement from Current access state - * associated with the thread in which they are invoked, not state associated - * with the thread from which the Current was obtained. - * Current objects must not be exported to other processes, or externalized - * with ORB.object_to_string. If any attempt is made to do so, the offending - * operation will raise a MARSHAL system exception. - * @see portable - * package comments for unimplemented features - */ - interface Current { }; -}; - - --- old/src/java.corba/share/classes/org/omg/PortableServer/package.html 2018-01-30 20:29:30.000000000 -0500 +++ /dev/null 2018-01-30 20:29:30.000000000 -0500 @@ -1,230 +0,0 @@ - - - - - - - -Provides classes and interfaces for making the server side of your applications -portable across multivendor ORBs. - -

In Java, Portable Object Adaptor (POA)-based Dynamic Skeleton Interface (DSI) -servants inherit from the standard DynamicImplementation class, which -inherits from the Servant class. The native Servant type is -defined by the PortableServer module for the POA. In Java, the - Servant type is mapped to the Java - org.omg.PortableServer.Servant class. - It serves as the base class for all POA servant - implementations and provides a number of methods that may - be invoked by the application programmer, as well as methods - which are invoked by the POA itself and may be overridden by - the user to control aspects of servant behavior. - -

Package Specification

- -

For a precise list of supported sections of official OMG specifications with which -the Java[tm] Platform, Standard Edition 6 complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -

POA-related Interfaces

- -

The PortableServer module defines the following POA-related interfaces: -

    -
  • POA -
  • POAManager -
  • ServantManager -
  • ServantActivator -
  • ServantLocator -
  • AdapterActivator -
  • ThreadPolicy -
  • LifespanPolicy -
  • IdUniquenessPolicy -
  • IdAssignmentPolicy -
  • ImplicitActivationPolicy -
  • ServantRetentionPolicy -
  • RequestProcessingPolicy -
  • Current -
- -

In addition, the POA defines the Servant native type. - -

Operations classes

- -

Each of the interfaces listed above has an associated Operations interface. -The Operations interface is generated by the idlj compiler and -contains the method signatures for methods defined in its associated interface. -The Operations interface can be accessed by both the client and the server, -while its associated interface can only be called by the client. - -

Value Classes

- -Classes ending in the suffix PolicyValue provide the values used -for the create_POA call, which sets the policy for the POA. See -the sample code below for a demonstration. -PolicyValue files include the following: -
    -
  • IdAssignmentPolicyValue -
  • IdUniquenessPolicyValue -
  • ImplicitActivationPolicyValue -
  • LifespanPolicyValue -
  • RequestProcessingPolicyValue -
  • ServantRetentionPolicyValue -
  • ThreadPolicyValue -
- -

Helper Classes

- -

Helper classes, which are generated for all user-defined types in an OMG IDL -interface, supply static methods needed to manipulate those types. -There is only one method in a helper class that an application programmer uses: -the narrow method. Only Java interfaces mapped from IDL interfaces -will have a helper class that includes a narrow method, so in -the PortableServer package, only the following classes have a narrow method: -

    -
  • ForwardRequestHelper -
  • ServantActivatorHelper -
  • ServantLocatorHelper -
- -

POA Classes

- -

POA classes are used to implement the ServantActivator or ServantLocator. - -

Exceptions

- -

The ForwardRequest exception indicates to the ORB -that it is responsible for delivering the current request and -subsequent ForwardRequest requests to the object denoted in the -forward_reference member of the exception. - -

Interfaces Implemented by the Application Programmer

- -

Most of what PortableServer does is transparent to the user. -The result is that programmers will use only a few of the interfaces mentioned above. -The remaining interfaces will be provided by the ORB implementation. -The interfaces of interest to application programmers are the following: -

    -
  • AdapterActivator -

    Adapter activators are associated with POAs. - An adapter activator supplies a POA with the ability to create child POAs on demand, - as a side-effect of receiving a request that names the child POA (or one of its children), - or when find_POA is called with an activate parameter value of TRUE. - An application server that creates all its needed POAs at the beginning of execution - does not need to use or provide an adapter activator; it is necessary - only for the case in which POAs need to be created during request processing. -

  • ServantLocator -

    When the POA has the NON_RETAIN policy, - it uses servant managers that are ServantLocators. -

  • ServantActivator -

    When the POA has the RETAIN policy, - it uses servant managers that are ServantActivators. -

- - -

Package org.omg.PortableServer.ServantLocatorPackage

- -

This package supplies a CookieHolder class for passing -the Cookie type as an out parameter. The CookieHolder class -follows exactly the same pattern as the other holder classes for basic types. - -

Related Documentation

- -

For an overview of Java IDL, please see: -{@extLink idl_guides Java IDL home page}. - -

Example Code

- -

Example Server Code

-
-import javax.naming.InitialContext;
-import javax.naming.Context;
-import javax.rmi.PortableRemoteObject ;
-import com.sun.corba.se.impl.poa.POAORB;
-import org.omg.PortableServer.*;
-import java.util.*;
-import org.omg.CORBA.*;
-import javax.rmi.CORBA.Stub;
-import javax.rmi.CORBA.Util;
-
-
-
-public class HelloServer {
-    public HelloServer(String[] args) {
-        try {
-            Properties p = System.getProperties();
-         //   p.put("org.omg.CORBA.ORBClass", "com.sun.corba.ee.internal.POA.POAORB");
-            ORB orb = ORB.init( args, p );
-
-            POA rootPOA = (POA)orb.resolve_initial_references("RootPOA");
-
-            Policy[] tpolicy = new Policy[3];
-            tpolicy[0] = rootPOA.create_lifespan_policy(
-                LifespanPolicyValue.TRANSIENT );
-            tpolicy[1] = rootPOA.create_request_processing_policy(
-                RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY );
-            tpolicy[2] = rootPOA.create_servant_retention_policy(
-                ServantRetentionPolicyValue.RETAIN);
-            POA tpoa = rootPOA.create_POA("MyTransientPOA", null, tpolicy);
-
-
-            String  ObjectId = "MyObjectId";
-            byte[] oid = ObjectId.getBytes();
-
-            org.omg.CORBA.Object obj = tpoa.create_reference_with_id(oid,
-                new _HelloImpl_Tie()._all_interfaces(tpoa, oid)[0]);
-            HelloInterface helloRef = (HelloInterface)PortableRemoteObject.narrow(
-                obj, HelloInterface.class );
-
-            Context initialNamingContext = new InitialContext();
-            initialNamingContext.rebind("HelloService", helloRef);
-            System.out.println("Hello Server: Ready...");
-            orb.run();
-         } catch (Exception e) {
-            System.out.println("Trouble: " + e);
-            e.printStackTrace();
-         } 
-     }
-
-
-     public static void main(String args[]) {
-         new HelloServer( args );
-     }
-}
-
-
-
- - - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/PortableServer/poa.idl 2018-01-30 20:29:30.000000000 -0500 +++ /dev/null 2018-01-30 20:29:30.000000000 -0500 @@ -1,1191 +0,0 @@ -/* - * Copyright (c) 1997, 2001, 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. - */ - -#include "corba.idl" -#include "CORBAX.idl" - -#pragma prefix "omg.org" -/** - * All Mapping corresponds to the Chapter 11 of - * CORBA V2.3.1 specified by OMG document formal/99-10-07.pdf. - * The exception to this is the id attribute, which is added in ptc/00-08-06, - * section 11.3.8.26. - */ -module PortableServer { - - #pragma version PortableServer 2.3 - - // forward reference - interface POA; - - /** - * List of POAs - */ - typedef sequence POAList; - - /** - * Values of type Servant support a language specific - * programming interface that can be used by the ORB to - * obtain a default POA for that servant. - * Some language mappings may allow Servant values to - * be implicitly converted to object references under - * appropriate conditions. - */ - native Servant; - - /** - * ObjectId value associated with the object reference. - */ - typedef sequence ObjectId; - - /** - * ForwardRequest to indicate to the ORB - * that it is responsible for delivering - * the current request and subsequent - * requests to the object denoted in the - * forward_reference member of the exception. - */ - exception ForwardRequest { Object forward_reference; }; - - // ********************************************** - // - // Policy interfaces - // - // ********************************************** - - /** - * The value representing THREAD_POLICY_ID. - */ - const CORBA::PolicyType THREAD_POLICY_ID = 16; - /** - * The value representing LIFESPAN_POLICY_ID. - */ - const CORBA::PolicyType LIFESPAN_POLICY_ID = 17; - /** - * The value representing ID_UNIQUENESS_POLICY_ID. - */ - const CORBA::PolicyType ID_UNIQUENESS_POLICY_ID = 18; - /** - * The value representing ID_ASSIGNMENT_POLICY_ID. - */ - const CORBA::PolicyType ID_ASSIGNMENT_POLICY_ID = 19; - /** - * The value representing IMPLICIT_ACTIVATION_POLICY_ID. - */ - const CORBA::PolicyType IMPLICIT_ACTIVATION_POLICY_ID = 20; - /** - * The value representing SERVANT_RETENTION_POLICY_ID. - */ - const CORBA::PolicyType SERVANT_RETENTION_POLICY_ID = 21; - /** - * The value representing REQUEST_PROCESSING_POLICY_ID. - */ - const CORBA::PolicyType REQUEST_PROCESSING_POLICY_ID = 22; - - /** - * The ThreadPolicyValue can have the following values. - * ORB_CTRL_MODEL - The ORB is responsible for assigning - * requests for an ORB- controlled POA to threads. - * SINGLE_THREAD_MODEL - Requests for a single-threaded - * POA are processed sequentially. - */ - enum ThreadPolicyValue { ORB_CTRL_MODEL, SINGLE_THREAD_MODEL }; - - /** - * The ThreadPolicy specifies the threading model - * used with the created POA. The default is - * ORB_CTRL_MODEL. - */ - interface ThreadPolicy : CORBA::Policy { - #pragma sun_local ThreadPolicy "" - /** - * specifies the policy value - */ - readonly attribute ThreadPolicyValue value; - }; - - /** - * The LifespanPolicyValue can have the following values. - * TRANSIENT - The objects implemented in the POA - * cannot outlive the POA instance in which they are - * first created. - * PERSISTENT - The objects implemented in the POA can - * outlive the process in which they are first created. - */ - enum LifespanPolicyValue { TRANSIENT, PERSISTENT }; - - /** - * The LifespanPolicy specifies the lifespan of the - * objects implemented in the created POA. The default - * is TRANSIENT. - */ - interface LifespanPolicy : CORBA::Policy { - #pragma sun_local LifespanPolicy "" - /** - * specifies the policy value - */ - readonly attribute LifespanPolicyValue value; - }; - - /** - * IdUniquenessPolicyValue can have the following values. - * UNIQUE_ID - Servants activated with that POA support - * exactly one Object Id. MULTIPLE_ID - a servant - * activated with that POA may support one or more - * Object Ids. - */ - enum IdUniquenessPolicyValue { UNIQUE_ID, MULTIPLE_ID }; - - /** - * The IdUniquenessPolicy specifies whether the servants - * activated in the created POA must have unique object i - * identities. The default is UNIQUE_ID. - */ - interface IdUniquenessPolicy : CORBA::Policy { - #pragma sun_local IdUniquenessPolicy "" - /** - * specifies the policy value - */ - readonly attribute IdUniquenessPolicyValue value; - }; - - /** - * The IdAssignmentPolicyValue can have the following - * values. USER_ID - Objects created with that POA are - * assigned Object Ids only by the application. - * SYSTEM_ID - Objects created with that POA are - * assigned Object Ids only by the POA. If the POA also - * has the PERSISTENT policy, assigned Object Ids must - * be unique across all instantiations of the same POA. - */ - enum IdAssignmentPolicyValue { USER_ID, SYSTEM_ID }; - - /** - * IdAssignmentPolicy specifies whether Object Ids in - * the created POA are generated by the application or - * by the ORB. The default is SYSTEM_ID. - */ - interface IdAssignmentPolicy : CORBA::Policy { - #pragma sun_local IdAssignmentPolicy "" - /** - * specifies the policy value - */ - readonly attribute IdAssignmentPolicyValue value; - }; - - /** - * ImplicitActivationPolicyValue has the following - * semantics. - * IMPLICIT_ACTIVATION to indicate implicit activation - * of servants. This requires SYSTEM_ID and RETAIN - * policies to be set. - * NO_IMPLICIT_ACTIVATION to indicate no implicit - * servant activation. - */ - enum ImplicitActivationPolicyValue { - IMPLICIT_ACTIVATION, NO_IMPLICIT_ACTIVATION - }; - - /** - * This policy specifies whether implicit activation - * of servants is supported in the created POA. - */ - interface ImplicitActivationPolicy : CORBA::Policy { - #pragma sun_local ImplicitActivationPolicy "" - /** - * specifies the policy value - */ - readonly attribute ImplicitActivationPolicyValue value; - }; - - /** - * ServantRetentionPolicyValue can have the following - * values. RETAIN - to indicate that the POA will retain - * active servants in its Active Object Map. - * NON_RETAIN - to indicate Servants are not retained by - * the POA. If no ServantRetentionPolicy is specified at - * POA creation, the default is RETAIN. - */ - enum ServantRetentionPolicyValue { RETAIN, NON_RETAIN }; - - /** - * This policy specifies whether the created POA retains - * active servants in an Active Object Map. - */ - interface ServantRetentionPolicy : CORBA::Policy { - #pragma sun_local ServantRetentionPolicy "" - /** - * specifies the policy value - */ - readonly attribute ServantRetentionPolicyValue value; - }; - - /** - * The RequestProcessingPolicyValue can have the following - * values. USE_ACTIVE_OBJECT_MAP_ONLY - If the Object Id - * is not found in the Active Object Map, - * an OBJECT_NOT_EXIST exception is returned to the - * client. The RETAIN policy is also required. - * USE_DEFAULT_SERVANT - If the Object Id is not found in - * the Active Object Map or the NON_RETAIN policy is - * present, and a default servant has been registered - * with the POA using the set_servant operation, - * the request is dispatched to the default servant. - * USE_SERVANT_MANAGER - If the Object Id is not found - * in the Active Object Map or the NON_RETAIN policy - * is present, and a servant manager has been registered - * with the POA using the set_servant_manager operation, - * the servant manager is given the opportunity to - * locate a servant or raise an exception. - */ - enum RequestProcessingPolicyValue { - USE_ACTIVE_OBJECT_MAP_ONLY, USE_DEFAULT_SERVANT, USE_SERVANT_MANAGER - }; - - /** - * This policy specifies how requests are processed by - * the created POA. The default is - * USE_ACTIVE_OBJECT_MAP_ONLY. - */ - interface RequestProcessingPolicy : CORBA::Policy { - #pragma sun_local RequestProcessingPolicy "" - /** - * specifies the policy value - */ - readonly attribute RequestProcessingPolicyValue value; - }; - - - // ************************************************** - // - // POAManager interface - // - // ********************************** - /** - * Each POA object has an associated POAManager object. - * A POA manager may be associated with one or more - * POA objects. A POA manager encapsulates the processing - * state of the POAs it is associated with. - */ - interface POAManager { - #pragma sun_local POAManager "" - exception AdapterInactive{ }; - /** - * Specifies the states for the POAManager - */ - enum State {HOLDING, ACTIVE, DISCARDING, INACTIVE}; - - /** - * This operation changes the state of the POA manager - * to active, causing associated POAs to start processing - * requests. - * @exception AdapterInactive is raised if the operation is - * invoked on the POAManager in inactive state. - */ - void activate() - raises(AdapterInactive); - /** - * This operation changes the state of the POA manager - * to holding, causing associated POAs to queue incoming - * requests. - * @param wait_for_completion if FALSE, the operation - * returns immediately after changing state. - * If TRUE, it waits for all active requests - * to complete. - * @exception AdapterInactive is raised if the operation is - * invoked on the POAManager in inactive state. - */ - void hold_requests(in boolean wait_for_completion) - raises(AdapterInactive); - /** - * This operation changes the state of the POA manager - * to discarding. This causes associated POAs to discard - * incoming requests. - * @param wait_for_completion if FALSE, the operation - * returns immediately after changing state. - * If TRUE, it waits for all active requests - * to complete. - * @exception AdapterInactive is raised if the operation is - * invoked on the POAManager in inactive state. - */ - void discard_requests(in boolean wait_for_completion) - raises(AdapterInactive); - - /** - * This operation changes the state of the POA manager - * to inactive, causing associated POAs to reject the - * requests that have not begun executing as well as - * as any new requests. - * @param etherealize_objects a flag to indicate whether - * to invoke the etherealize operation of the - * associated servant manager for all active - * objects. - * @param wait_for_completion if FALSE, the operation - * returns immediately after changing state. - * If TRUE, it waits for all active requests - * to complete. - * @exception AdapterInactive is raised if the operation is - * invoked on the POAManager in inactive state. - */ - void deactivate(in boolean etherealize_objects, - in boolean wait_for_completion) - raises(AdapterInactive); - /** - * This operation returns the state of the POA manager. - */ - State get_state(); - }; - - - // ************************************************** - // - // AdapterActivator interface - // - // **************************** - - /** - * An adapter activator supplies a POA with the ability - * to create child POAs on demand, as a side-effect of - * receiving a request that names the child POA - * (or one of its children), or when find_POA is called - * with an activate parameter value of TRUE. - */ - - interface AdapterActivator { - #pragma sun_local AdapterActivator "" - #pragma version AdapterActivator 2.3 - /** - * This operation is invoked when the ORB receives - * a request for an object reference that identifies - * a target POA that does not exist. The ORB invokes - * this operation once for each POA that must be - * created in order for the target POA to exist. - * @param parent indicates the parent POA for the POA - * that needs to be created. - * @param name identifies the name of the POA relative to - * the parent. - * @return returns TRUE if the POA was created or FALSE - * otherwise. - */ - boolean unknown_adapter(in POA parent, in string name); - }; - - - // ************************************************** - // - // ServantManager interface - // - // ****************************** - - /** - * A servant manager supplies a POA with the ability - * to activate objects on demand when the POA receives - * a request targeted at an inactive object. A servant - * manager is registered with a POA as a callback object, - * to be invoked by the POA when necessary. - * ServantManagers can either be ServantActivators or - * ServantLocators. A ServantManager object must be - * local to the process containing the POA objects - * it is registered with. - */ - - interface ServantManager - { #pragma sun_local ServantManager "" }; - - - /** - * When the POA has the RETAIN policy it uses servant - * managers that are ServantActivators. - */ - interface ServantActivator : ServantManager { - #pragma version ServantActivator 2.3 - #pragma sun_localservant ServantActivator "" - /** - * This operation is invoked by the POA whenever the - * POA receives a request for an object that is not - * currently active, assuming the POA has the - * USE_SERVANT_MANAGER and RETAIN policies. - * @param oid object Id associated with the object on - * the request was made. - * @param adapter object reference for the POA in which - * the object is being activated. - * @return Servant corresponding to oid is created or - * located by the user supplied servant manager. - * @exception ForwardRequest to indicate to the ORB - * that it is responsible for delivering - * the current request and subsequent - * requests to the object denoted in the - * forward_reference member of the exception. - */ - Servant incarnate ( in ObjectId oid, in POA adapter ) - raises (ForwardRequest); - /** - * This operation is invoked whenever a servant for - * an object is deactivated, assuming the POA has - * the USE_SERVANT_MANAGER and RETAIN policies. - * @param oid object Id associated with the object - * being deactivated. - * @param adapter object reference for the POA in which - * the object was active. - * @param serv contains reference to the servant - * associated with the object being deactivated. - * @param cleanup_in_progress if TRUE indicates that - * destroy or deactivate is called with - * etherealize_objects param of TRUE. FALSE - * indicates that etherealize was called due to - * other reasons. - * @param remaining_activations indicates whether the - * Servant Manager can destroy a servant. If - * set to TRUE, the Servant Manager should wait - * until all invocations in progress have - * completed. - */ - void etherealize ( in ObjectId oid, - in POA adapter, - in Servant serv, - in boolean cleanup_in_progress, - in boolean remaining_activations); - }; - - - /** - * When the POA has the NON_RETAIN policy it uses servant - * managers that are ServantLocators. Because the POA - * knows that the servant returned by this servant - * manager will be used only for a single request, - * it can supply extra information to the servant - * manager's operations and the servant manager's pair - * of operations may be able to cooperate to do - * something different than a ServantActivator. - * When the POA uses the ServantLocator interface, - * immediately after performing the operation invocation - * on the servant returned by preinvoke, the POA will - * invoke postinvoke on the servant manager, passing the - * ObjectId value and the Servant value as parameters - * (among others). This feature may be used to force - * every request for objects associated with a POA to - * be mediated by the servant manager. - */ - interface ServantLocator : ServantManager { - #pragma sun_localservant ServantLocator "" - /** - * Opaque data used to pass the information from - * preinvoke to postinvoke hooks. This specific - * by the language mapping, that is why it is - * specified as native. - */ - native Cookie; - /** - * This operations is used to get a servant that will be - * used to process the request that caused preinvoke to - * be called. - * @param oid the object id associated with object on - * which the request was made. - * @param adapter the reference for POA in which the - * object is being activated. - * @param operation the operation name. - * @param the_cookie an opaque value that can be set - * by the servant manager to be used - * during postinvoke. - * @return Servant used to process incoming request. - * @exception ForwardRequest to indicate to the ORB - * that it is responsible for delivering - * the current request and subsequent - * requests to the object denoted in the - * forward_reference member of the exception. - */ - Servant preinvoke( in ObjectId oid, in POA adapter, - in CORBA::Identifier operation, - out Cookie the_cookie ) - raises (ForwardRequest); - /** - * This operation is invoked whenener a servant completes - * a request. - * @param oid the object id ssociated with object on which - * the request was made. - * @param adapter the reference for POA in which the - * object was active. - * @param the_cookie an opaque value that contains - * the data set by preinvoke. - * @param the_servant reference to the servant that is - * associated with the object. - */ - void postinvoke( in ObjectId oid, in POA adapter, - in CORBA::Identifier operation, - in Cookie the_cookie, - in Servant the_servant); - }; - - - // ************************************************** - // - // POA interface - // - // ***************************************** - - /** - * A POA object manages the implementation of a - * collection of objects. The POA supports a name space - * for the objects, which are identified by Object Ids. - * A POA also provides a name space for POAs. A POA is - * created as a child of an existing POA, which forms a - * hierarchy starting with the root POA. A POA object - * must not be exported to other processes, or - * externalized with ORB::object_to_string. - */ - interface POA { - #pragma sun_local POA "" - #pragma version POA 2.3 - /** - * specifies that an child POA with the specified - * name already exists. - */ - exception AdapterAlreadyExists { }; - - /** - * This is raised if the POA with a specified Name cannot - * be found. - */ - exception AdapterNonExistent { }; - - /** - * This is raised if any of the policy objects are - * not valid for the ORB - */ - exception InvalidPolicy { - unsigned short index; - }; - - /** - * This is raised if no default servant is associated - * with the POA. - */ - exception NoServant { }; - - /** - * specifies that an object is already active or - * exists in the Active Object Map. - */ - exception ObjectAlreadyActive { }; - /** - * specifies that the object is not active or its - * mapping does not exist in the Active Object Map. - */ - - exception ObjectNotActive { }; - - /** - * This is raised when an attempt is made to activate - * a servant that is already active or has a mapping in - * the Active Object Map. - */ - exception ServantAlreadyActive { }; - - /** - * This is raised when an attempt is made to access a - * servant that is not active or is not registered in - * the Active Object Map. - */ - exception ServantNotActive { }; - - /** - * This is raised if the reference was not created by - * the POA - * specified in the reference. - */ - exception WrongAdapter { }; - - /** - * WrongPolicy is specified when the POA does not - * specify the policy appropriate for its operations. - */ - exception WrongPolicy { }; - - - //---------------------------------------- - // - // POA creation and destruction - // - //------------------------------- - - /** - * This operation creates a new POA as a child of the - * target POA. - * @param adapter_name identifies the new POA with - * respect to other POAs with the same parent POA. - * @param a_POAManager specifies the POA Manager to be - * associated with the new POA. - * @param policies specifies policy objects to be - * associated with the POA to control its behavior. - * @exception AdapterAlreadyExists specifies that the - * target POA already has a child POA with - * the specified name. - * @exception InvalidPolicy is raised if any of the - * policy objects are not valid for the ORB, - * or are in conflict, or require an - * administrative action that has not been - * performed. - */ - POA create_POA(in string adapter_name, - in POAManager a_POAManager, - in CORBA::PolicyList policies) - raises (AdapterAlreadyExists, InvalidPolicy); - - /** - * If the target POA is the parent of a child POA with - * the specified name (relative to the target POA), that - * child POA is returned. - * @param adapter_name POA name to be found. - * @param activate_it if a POA with the specified - * name does not exist and the value of - * the activate_it parameter is TRUE, the target - * POA's AdapterActivator, if one exists, - * is invoked. - * @return POA if one exists or is activated by the - * AdapterActivator. - * @return AdapterNonExistent is raised if POA with - * a specified name cannot be found or - * activated using AdapaterActivator. - */ - POA find_POA(in string adapter_name, - in boolean activate_it) - raises (AdapterNonExistent); - - /** - * This operation destroys the POA and all descendant - * POAs. All descendant POAs are destroyed (recursively) - * before the destruction of the containing POA. The POA - * so destroyed (that is, the POA with its name) may be - * re-created later in the same process. - * @param etherealize_objects flag to indicate whether - * etherealize operation on servant manager needs - * to be called. - * @param wait_for_completion flag to indicate whether - * POA and its children need to wait for active - * requests and the etherealization to complete. - * - */ - void destroy( in boolean etherealize_objects, - in boolean wait_for_completion); - - // ************************************************** - // - // Factories for Policy objects - // - // ************ - /** - * These operations each return a reference to a policy - * object with the specified value. - * @param value policy type - * @return ThreadPolcy Object - */ - ThreadPolicy create_thread_policy( - in ThreadPolicyValue value); - /** - * These operations each return a reference to a policy - * object with the specified value. - * @param value policy type - * @return LifespanPolicy Object. - */ - LifespanPolicy create_lifespan_policy( - in LifespanPolicyValue value); - /** - * These operations each return a reference to a policy - * object with the specified value. - * @param value policy type - * @return IdUniquenessPolicy Object. - */ - IdUniquenessPolicy create_id_uniqueness_policy( - in IdUniquenessPolicyValue value); - /** - * These operations each return a reference to a policy - * object with the specified value. - * @param value policy type - * @return IdAssignmentPolicy Object. - */ - IdAssignmentPolicy create_id_assignment_policy( - in IdAssignmentPolicyValue value); - /** - * These operations each return a reference to a policy - * object with the specified value. - * @param value policy type - * @return ImplicitActivationPolicy Object. - */ - ImplicitActivationPolicy create_implicit_activation_policy( - in ImplicitActivationPolicyValue value); - /** - * These operations each return a reference to a policy - * object with the specified value. - * @param value policy type - * @return ServantRetentionPolicy Object. - */ - ServantRetentionPolicy create_servant_retention_policy( - in ServantRetentionPolicyValue value); - /** - * These operations each return a reference to a policy - * object with the specified value. - * @param value policy type - * @return RequestProcessingPolicy Object. - */ - - RequestProcessingPolicy create_request_processing_policy( - in RequestProcessingPolicyValue value); - - //-------------------------------------------------- - // - // POA attributes - // - //----------------------------------- - /** - * This attribute identifies the POA relative to its - * parent. This name is assigned when the POA is created. - */ - readonly attribute string the_name; - /** - * This attribute identifies the parent of the POA. - * The parent of the root POA is null. - */ - readonly attribute POA the_parent; - /** - * This attribute identifies the current set of all - * child POAs of the POA. The set of child POAs - * includes only the POA's immediate children, and - * not their descendants. - */ - readonly attribute POAList the_children; - /** - * This attribute identifies the POA manager - * associated with the POA. - */ - readonly attribute POAManager the_POAManager; - - /** - * This attribute identifies the adapter activator - * associated with the POA. - */ - attribute AdapterActivator the_activator; - - //-------------------------------------------------- - // - // Servant Manager registration: - // - //-------------------------------------------------- - /** - * - * If the ServantRetentionPolicy of the POA is RETAIN, - * then the ServantManager argument (imgr) shall support - * the ServantActivator interface. For a NON_RETAIN policy, - * the ServantManager shall support the ServantLocator - * interface. If the argument is nil, or does not support - * the required interface, then the OBJ_ADAPTER - * exception is raised. - * @return ServantManager associated with a POA or null if - * none exists. - * @exception WrongPolicy raised if the - * USE_SERVANT_MANAGER policy is not specified. - */ - ServantManager get_servant_manager() - raises (WrongPolicy); - /** - * - * This operation sets the default servant manager - * associated with the POA. This operation may only be - * invoked once after a POA has been created. Attempting - * to set the servant manager after one has already - * been set will result in the BAD_INV_ORDER exception - * being raised. - * @param imgr servant manager to be used as a default. - * @exception WrongPolicy raised if the - * USE_SERVANT_MANAGER policy is not specified. - */ - void set_servant_manager( in ServantManager imgr) - raises (WrongPolicy); - - //-------------------------------------------------- - // - // operations for the USE_DEFAULT_SERVANT policy - // - //---------- - /** - * This operation returns the default servant associated - * with the POA. - * @return p_servant default servant associated with a POA. - * @exception NoServant raised if no default servant is - * associated with the POA. - * @exception WrongPolicy raised if the - * USE_DEFAULT_SERVANT policy is not specified. - */ - Servant get_servant() - raises (NoServant, WrongPolicy); - - /** - * - * This operation registers the specified servant with - * the POA as the default servant. This servant will - * be used for all requests for which no servant is - * found in the Active Object Map. - * @param p_servant servant to be used as a default. - * @exception WrongPolicy raised if the - * USE_DEFAULT_SERVANT policy is not specified. - */ - void set_servant(in Servant p_servant) - raises (WrongPolicy); - - // ************************************************** - // - // object activation and deactivation - // - // ************ - - /** - * - * This operation generates an Object Id and enters - * the Object Id and the specified servant in the - * Active Object Map. - * @param p_servant servant to be associated with an - * object to be activated. - * @return POA generated object id. - * @exception ServantAlreadyActive is raised if the - * POA has UNIQUE_ID policy and servant is - * is already in the Active Object Map. - * @exception WrongPolicy raised if the SYSTEM_ID and - * RETAIN policies are not specified. - */ - ObjectId activate_object( in Servant p_servant ) - raises (ServantAlreadyActive, WrongPolicy); - /** - * This operation enters an association between the - * specified Object Id and the specified servant in the - * Active Object Map. - * @param id object id for the object to be activated. - * @param p_servant servant to be associated with the - * object. - * @exception ServantAlreadyActive raised if the POA - * has the UNIQUE_ID policy and the servant - * is already in the Active Object Map. - * @exception ObjectAlreadyActive raised if the object is - * already active in the POA. - * @exception WrongPolicy raised if the RETAIN policy is - * is not specified. - */ - - void activate_object_with_id( in ObjectId id, - in Servant p_servant) - raises ( ServantAlreadyActive, ObjectAlreadyActive, - WrongPolicy); - /** - * - * This operation causes the ObjectId specified in the - * oid parameter to be deactivated. An ObjectId which - * has been deactivated continues to process requests - * until there are no active requests for that ObjectId. - * A deactivated ObjectId is removed from the Active - * Object Map when all requests executing for that - * ObjectId have completed. - * @param oid Object Id for the object to be deactivated. - * @exception ObjectNotActive if the object with the - * specified oid is not in the Active Object - * Map. - * @exception WrongPolicy raised if the RETAIN policy is - * is not specified. - */ - void deactivate_object(in ObjectId oid) - raises (ObjectNotActive, WrongPolicy); - - // ************************************************** - // - // reference creation operations - // - // ***************** - /** - * This operation creates an object reference that - * encapsulates a POA-generated Object Id value and - * the specified interface repository id. - * - * @param intf rep id for creating an object reference. - * @return object reference created using intf. - * @exception WrongPolicy if SYSTEM_ID policy is not - * specified. - */ - Object create_reference ( in CORBA::RepositoryId intf ) - raises (WrongPolicy); - - /** - * This operation creates an object reference that - * encapsulates the specified Object Id and interface - * repository Id values. It does not cause an activation - * to take place. The resulting reference may be passed - * to clients, so that subsequent requests on those - * references will cause the object to be activated - * if necessary, or the default servant used, depending - * on the applicable policies. - * @param oid object id for creating an objref - * @param intf rep id for creating an objref - * @return object reference created using oid and intf - * @exception BAD_PARAM is raised if the POA has the - * SYSTEM_ID policy and it detects that the - * Object Id value was not generated by the - * system or for this POA. - */ - Object create_reference_with_id ( in ObjectId oid, - in CORBA::RepositoryId intf ); - // not specified in 11.3.8.19 raises (WrongPolicy); - - //-------------------------------------------------- - // - // Identity mapping operations: - // - //-------------------------------------------------- - /** - * This operation has four possible behaviors. - * 1. If the POA has the UNIQUE_ID policy and the - * specified servant is active, the Object Id associated - * with that servant is returned. - * 2. If the POA has the IMPLICIT_ACTIVATION policy and - * either the POA has the MULTIPLE_ID policy or the - * specified servant is not active, the servant is - * activated using a POA-generated Object Id and the - * Interface Id associated with the servant, and that - * Object Id is returned. - * 3. If the POA has the USE_DEFAULT_SERVANT policy, - * the servant specified is the default servant, and the - * operation is being invoked in the context of executing - * a request on the default servant, then the ObjectId - * associated with the current invocation is returned. - * 4. Otherwise, the ServantNotActive exception is raised. - * - * @param p_servant servant for which the object disi returned. - * @return object id associated with the servant. - * @exception ServantNotActive if the above rules and - * policy combination is not met. - * @exception WrongPolicy if the USE_DEFAULT_SERVANT policy - * or a combination of the RETAIN policy and - * either the UNIQUE_ID or IMPLICIT_ACTIVATION - * policies are not present. - */ - ObjectId servant_to_id(in Servant p_servant) - raises (ServantNotActive, WrongPolicy); - - /** - * This operation requires the RETAIN policy and either - * the UNIQUE_ID or IMPLICIT_ACTIVATION policies if - * invoked outside the context of an operation dispatched - * by this POA. It has four possible behaviors. - * 1. If the POA has both the RETAIN and the - * UNIQUE_ID policy and the specified servant is active, - * an object reference encapsulating the information used - * to activate the servant is returned. - * 2. If the POA has both the RETAIN and the - * IMPLICIT_ACTIVATION policy and either the POA has the - * MULTIPLE_ID policy or the specified servant is not - * active, the servant is activated using a POA-generated - * Object Id and the Interface Id associated with the - * servant, and a corresponding object reference is - * returned. - * 3. If the operation was invoked in the context of - * executing a request on the specified servant, the - * reference associated with the current invocation - * is returned. - * 4. Otherwise, the ServantNotActive exception is raised. - * - * @param p_servant servant for which the object reference - * needs to be obtained. - * @return object reference associated with the servant. - * @exception WrongPolicy if the operation is not invoked - * in the context of executing a request on - * the specified servant and the required - * policies are not present. - * @exception ServantNotActive if the above specified - * policies and rules are not met. - */ - Object servant_to_reference(in Servant p_servant) - raises (ServantNotActive, WrongPolicy); - - /** - * If the POA has the RETAIN policy and the specified - * object is present in the Active Object Map, this - * operation returns the servant associated with that - * object in the Active Object Map. Otherwise, if the - * POA has the USE_DEFAULT_SERVANT policy and a default - * servant has been registered with the POA, this - * operation returns the default servant. If the object - * reference was not created by this POA, - * the WrongAdapter exception is raised. (OMG Issue - * on inconsistency with the POA.IDL. - * - * @param reference object reference for which the - * servant is returned. - * @return servant associated with the reference. - * @exception WrongPolicy if neither the RETAIN policy or - * the USE_DEFAULT_SERVANT policy is present. - * @exception ObjectNotActive if the servant is not - * present in the Active Object Map (for RETAIN) - * or no default servant is registered (for - * USE_DEFAULT_POLICY). - * @exception WrongAdapter if reference was not created by - * this POA instance. - */ - Servant reference_to_servant(in Object reference) - raises (ObjectNotActive, WrongPolicy, WrongAdapter); - - /** - * This operation returns the Object Id value - * encapsulated by the specified reference. This - * operation is valid only if the reference was created - * by the POA on which the operation is being performed. - * The object denoted by the reference does not have - * to be active for this operation to succeed. - * - * @param reference the object reference from which the - * object id needs to be returned. - * @return object id encapsulated in the reference. - * @exception WrongAdapter if the reference was not - * created by the POA specified in the - * reference. - * @exception WrongPolicy declared to allow future - * extensions. - * - */ - ObjectId reference_to_id(in Object reference) - raises (WrongAdapter, WrongPolicy); - - /** - * If the POA has the RETAIN policy and the specified - * ObjectId is in the Active Object Map, this operation - * returns the servant associated with that object in - * the Active Object Map. Otherwise, if the POA has - * the USE_DEFAULT_SERVANT policy and a default servant - * has been registered with the POA, this operation - * returns the default servant. - * - * @param oid object id for the which the servant is - * returned. - * @return servant associated with oid. - * @exception ObjectNotActive is raised if ObjectId is - * is not in the Active Object Map (for RETAIN - * policy), or no default servant is registered - * (for USE_DEFAULT_SERVANT policy). - * - * @exception WrongPolicy is raised if the RETAIN policy - * or the USE_DEFAULT_SERVANT - * policy is not present. - */ - Servant id_to_servant(in ObjectId oid) - raises (ObjectNotActive, WrongPolicy); - - /** - * If an object with the specified Object Id value is - * currently active, a reference encapsulating the - * information used to activate the object is returned. - * - * @param oid id of the object for which the - * reference is returned. - * @return the object reference - * - * @exception ObjectNotActive if the Object Id value - * is not active in the POA. - * @exception WrongPolicy if the RETAIN policy is not - * present. - */ - Object id_to_reference(in ObjectId oid) - raises (ObjectNotActive, WrongPolicy); - - /** - * This returns the unique id of the POA in the process in which it - * is created. It is for use by portable interceptors. - *

- * This id is guaranteed unique for the life span of the POA in the - * process. For persistent POAs, this means that if a POA is created - * in the same path with the same name as another POA, these POAs - * are identical and, therefore, have the same id. For transient - * POAs, each POA is unique. - */ - readonly attribute ::org::omg::CORBA::OctetSeq id; - - }; - - // ***************************************************** - // - // Current interface: - // - // ***************************************************** - - /** - * The PortableServer::Current interface, derived from - * CORBA::Current, provides method implementations with - * access to the identity of the object on which the - * method was invoked. The Current interface is provided - * to support servants that implement multiple objects, - * but can be used within the context of POA-dispatched - * method invocations on any servant. To provide location - * transparency, ORBs are required to support use of - * Current in the context of both locally and remotely - * invoked operations. An instance of Current can be - * obtained by the application by issuing the - * CORBA::ORB::resolve_initial_references("POACurrent") - * operation. Thereafter, it can be used within the - * context of a method dispatched by the POA to obtain - * the POA and ObjectId that identify the object on - * which that operation was invoked. - */ - interface Current : CORBA::Current { - #pragma sun_local Current "" - #pragma version Current 2.3 - /** - * The exception that is used to indicate that the - * operation is invoked outside the context of the - * POA-dispatched operation. - */ - - exception NoContext { }; - - /** - * Returns reference to the POA implementing the - * object in whose context it is called. - * - * @return The poa implementing the object - * - * @exception NoContext is raised when the operation is - * outside the context of a POA-dispatched - * operation - */ - POA get_POA() - raises (NoContext); - - /** - * Returns the ObjectId identifying the object in - * whose context it is called. - * - * @return the ObjectId of the object - * - * @exception NoContext is raised when the operation - * is called outside the context of a POA-dispatched - * operation. - */ - - ObjectId get_object_id() - raises (NoContext); - }; -}; --- old/src/java.corba/share/classes/org/omg/PortableServer/portable/Delegate.java 2018-01-30 20:29:31.000000000 -0500 +++ /dev/null 2018-01-30 20:29:31.000000000 -0500 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 1999, 2003, 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 org.omg.PortableServer.portable; - -import org.omg.PortableServer.Servant; -import org.omg.PortableServer.POA; - -/** - * The portability package contains interfaces and classes - * that are designed for and intended to be used by ORB - * implementor. It exposes the publicly defined APIs that - * are used to connect stubs and skeletons to the ORB. - * The Delegate interface provides the ORB vendor specific - * implementation of PortableServer::Servant. - * Conformant to spec CORBA V2.3.1, ptc/00-01-08.pdf - */ -public interface Delegate { -/** - * Convenience method that returns the instance of the ORB - * currently associated with the Servant. - * @param Self the servant. - * @return ORB associated with the Servant. - */ - org.omg.CORBA.ORB orb(Servant Self); - -/** - * This allows the servant to obtain the object reference for - * the target CORBA Object it is incarnating for that request. - * @param Self the servant. - * @return Object reference associated with the request. - */ - org.omg.CORBA.Object this_object(Servant Self); - -/** - * The method _poa() is equivalent to - * calling PortableServer::Current:get_POA. - * @param Self the servant. - * @return POA associated with the servant. - */ - POA poa(Servant Self); - -/** - * The method _object_id() is equivalent - * to calling PortableServer::Current::get_object_id. - * @param Self the servant. - * @return ObjectId associated with this servant. - */ - byte[] object_id(Servant Self); - -/** - * The default behavior of this function is to return the - * root POA from the ORB instance associated with the servant. - * @param Self the servant. - * @return POA associated with the servant class. - */ - POA default_POA(Servant Self); - -/** - * This method checks to see if the specified repid is present - * on the list returned by _all_interfaces() or is the - * repository id for the generic CORBA Object. - * @param Self the servant. - * @param Repository_Id the repository_id to be checked in the - * repository list or against the id of generic CORBA - * object. - * @return boolean indicating whether the specified repid is - * in the list or is same as that got generic CORBA - * object. - */ - boolean is_a(Servant Self, String Repository_Id); - -/** - * This operation is used to check for the existence of the - * Object. - * @param Self the servant. - * @return boolean true to indicate that object does not exist, - * and false otherwise. - */ - boolean non_existent(Servant Self); - //Simon And Ken Will Ask About Editorial Changes - //In Idl To Java For The Following Signature. - -/** - * This operation returns an object in the Interface Repository - * which provides type information that may be useful to a program. - * @param self the servant. - * @return type information corresponding to the object. - */ - // The get_interface() method has been replaced by get_interface_def() - //org.omg.CORBA.Object get_interface(Servant Self); - - org.omg.CORBA.Object get_interface_def(Servant self); -} --- old/src/java.corba/share/classes/org/omg/PortableServer/portable/package.html 2018-01-30 20:29:32.000000000 -0500 +++ /dev/null 2018-01-30 20:29:32.000000000 -0500 @@ -1,49 +0,0 @@ - - - - - - - -Provides classes and interfaces for making the server side of your applications -portable across multivendor ORBs. - -

The portable package contains interfaces and classes - that are designed for and intended to be used by an ORB -implementor. It exposes the publicly defined APIs that - are used to connect stubs and skeletons to the ORB. - The Delegate interface provides the ORB-vendor-specific - implementation of PortableServer::Servant. - This package conforms CORBA Specification V2.3.1, ptc/00-01-08. - -@since 1.4 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/SendingContext/RunTime.java 2018-01-30 20:29:33.000000000 -0500 +++ /dev/null 2018-01-30 20:29:33.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1998, 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.SendingContext; - -/** Defines the base class that represents the Sending Context of a -* request. The sending context provides access to information about -* the runtime environment of the originator of a GIOP message. For example, -* when a value type is marshalled on a GIOP Request message, the receiver -* of the value type may need to ask the sender about the CodeBase for the -* implementation of the value type. -*/ -public interface RunTime extends RunTimeOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity -{ -} --- old/src/java.corba/share/classes/org/omg/SendingContext/RunTimeOperations.java 2018-01-30 20:29:34.000000000 -0500 +++ /dev/null 2018-01-30 20:29:34.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 1999, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package org.omg.SendingContext; - -/** Defines operations on the base class that represents the Sending Context of a -* request. The sending context provides access to information about -* the runtime environment of the originator of a GIOP message. For example, -* when a value type is marshalled on a GIOP Request message, the receiver -* of the value type may need to ask the sender about the CodeBase for the -* implementation of the value type. -*/ -public interface RunTimeOperations -{ -} --- old/src/java.corba/share/classes/org/omg/SendingContext/package.html 2018-01-30 20:29:35.000000000 -0500 +++ /dev/null 2018-01-30 20:29:35.000000000 -0500 @@ -1,76 +0,0 @@ - - - - - - - - Provides support for the marshalling of value types. Value type - marshalling may require access to an implementation of the value type or - to meta information about the value type. This information is passed - between the sending context and the receiving context using a particular - service context containing an instance of the - SendingContext.RunTime interface. -

- A sending context may be either the client side or the server side of - an invocation, depending on which contains a value type. - The sending context is the client side of an - invocation if the request contains a value type. It is the server side - if the reply contains a value type. The other party in the communication - is the receiving context. -

- The service context marshalled for SendingContext - consists of an encapsulated IOR for the SendingContext.RunTime - interface. RunTime is just a marker - interface defined to allow extensibility in the future. There is - currently only one subinterface of RunTime defined: - the SendingContext.CodeBase interface. - The interface CodeBase defines operations to obtain code URLs - and meta-information about a value type received from the sending - context. -

- Note that these classes are currently defined in the - com.sun.org.omg.SendingContext - package rather than in the package org.omg.SendingContext. - This has been done to avoid including large parts of the interface - repository in the JDK core, since the interface repository is still - evolving in response to the needs of the CORBA Components work. - -

Package Specification

- -

For a precise list of supported sections of official specifications with which -the Java[tm] Platform, Standard Edition 6 ORB complies, see Official Specifications for CORBA -support in Java[tm] SE 6. - -@since 1.3 -
-@serial exclude - - --- old/src/java.corba/share/classes/org/omg/stub/java/rmi/_Remote_Stub.java 2018-01-30 20:29:35.000000000 -0500 +++ /dev/null 2018-01-30 20:29:35.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1999, 2000, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -// Stub class generated by rmic, do not edit. -// Contents subject to change without notice. - -package org.omg.stub.java.rmi; - -import java.rmi.Remote; -import javax.rmi.CORBA.Stub; - -/** - * This class provides the Stub for the Remote Type. The class is generated - * by the rmic compiler, and is still under works at OMG. It's contents are - * subject to change without notice as the specification evolves. - */ -public final class _Remote_Stub extends Stub implements Remote { - - private static final String _type_ids[] = { - "" - }; - - /** - * Returns an array of repository ids that an object implements. - * The string at index zero represents the most derived interface. The last id, - * for the generic CORBA object is (i.e., IDL:omg.org/CORBA/Object:1.0") is - * implied and not present. - * @return an array of repository ids that an object implements. - */ - public String[] _ids() { - return (String[]) _type_ids.clone(); - } -} --- old/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html 2018-01-30 20:29:36.000000000 -0500 +++ /dev/null 2018-01-30 20:29:36.000000000 -0500 @@ -1,40 +0,0 @@ - - -org.omg.stub.java.rmi package - - - - Contains RMI-IIOP Stubs for the Remote types that occur in the - java.rmi package. - -@since 1.3 -
-@serial exclude - - --- old/src/java.corba/share/classes/sun/corba/Bridge.java 2018-01-30 20:29:37.000000000 -0500 +++ /dev/null 2018-01-30 20:29:37.000000000 -0500 @@ -1,411 +0,0 @@ -/* - * Copyright (c) 2004, 2016, 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 sun.corba ; - -import java.io.OptionalDataException; -import java.lang.invoke.MethodHandle; -import java.lang.reflect.Field; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.StackWalker; -import java.lang.StackWalker.StackFrame; -import java.util.Optional; -import java.util.stream.Stream; - -import java.security.AccessController; -import java.security.Permission; -import java.security.PrivilegedAction; -import java.security.ProtectionDomain; - -import sun.misc.Unsafe; -import sun.reflect.ReflectionFactory; - -/** This class provides the methods for fundamental JVM operations - * needed in the ORB that are not part of the public Java API. This includes: - *

    - *
  • throwException, which can throw undeclared checked exceptions. - * This is needed to handle throwing arbitrary exceptions across a standardized - * OMG interface that (incorrectly) does not specify appropriate exceptions.
  • - *
  • putXXX/getXXX methods that allow unchecked access to fields of objects. - * This is used for setting uninitialzed non-static final fields (which is - * impossible with reflection) and for speed.
  • - *
  • objectFieldOffset to obtain the field offsets for use in the putXXX/getXXX methods
  • - *
  • newConstructorForSerialization to get the special constructor required for a - * Serializable class
  • - *
  • latestUserDefinedLoader to get the latest user defined class loader from - * the call stack as required by the RMI-IIOP specification (really from the - * JDK 1.1 days)
  • - *
- * The code that calls Bridge.get() must have the following Permissions: - *
    - *
  • BridgePermission "getBridge"
  • - *
  • ReflectPermission "suppressAccessChecks"
  • - *
  • RuntimePermission "getStackWalkerWithClassReference"
  • - *
  • RuntimePermission "reflectionFactoryAccess"
  • - *
- *

- * All of these permissions are required to obtain and correctly initialize - * the instance of Bridge. No security checks are performed on calls - * made to Bridge instance methods, so access to the Bridge instance - * must be protected. - *

- * This class is a singleton (per ClassLoader of course). Access to the - * instance is obtained through the Bridge.get() method. - */ -public final class Bridge -{ - private static final Permission getBridgePermission = - new BridgePermission("getBridge"); - private static Bridge bridge = null ; - - /** Access to Unsafe to read/write fields. */ - private static final Unsafe unsafe = AccessController.doPrivileged( - (PrivilegedAction)() -> { - try { - Field field = Unsafe.class.getDeclaredField("theUnsafe"); - field.setAccessible(true); - return (Unsafe)field.get(null); - - } catch (NoSuchFieldException |IllegalAccessException ex) { - throw new InternalError("Unsafe.theUnsafe field not available", ex); - } - } - ) ; - - private final ReflectionFactory reflectionFactory ; - private final StackWalker stackWalker; - - private Bridge() { - reflectionFactory = ReflectionFactory.getReflectionFactory(); - stackWalker = StackWalker.getInstance( - StackWalker.Option.RETAIN_CLASS_REFERENCE); - } - - /** Fetch the Bridge singleton. This requires the following - * permissions: - *

    - *
  • BridgePermission "getBridge"
  • - *
  • ReflectPermission "suppressAccessChecks"
  • - *
  • RuntimePermission "getStackWalkerWithClassReference"
  • - *
  • RuntimePermission "reflectionFactoryAccess"
  • - *
- * @return The singleton instance of the Bridge class - * @throws SecurityException if the caller does not have the - * required permissions and the caller has a non-null security manager. - */ - public static final synchronized Bridge get() - { - SecurityManager sman = System.getSecurityManager() ; - if (sman != null) - sman.checkPermission( getBridgePermission ) ; - - if (bridge == null) { - bridge = new Bridge() ; - } - - return bridge ; - } - - /** Returns true if the loader that loaded the frame's declaring class - * is a user loader (if it is not the platform class loader or one of - * its ancestor). - */ - private boolean isUserLoader(StackFrame sf) { - ClassLoader cl = sf.getDeclaringClass().getClassLoader(); - if (cl == null) return false; - ClassLoader p = ClassLoader.getPlatformClassLoader(); - while (cl != p && p != null) p = p.getParent(); - return cl != p; - } - - private Optional getLatestUserDefinedLoaderFrame(Stream stream) { - return stream.filter(this::isUserLoader).findFirst(); - } - - - /** Obtain the latest user defined ClassLoader from the call stack. - * This is required by the RMI-IIOP specification. - */ - public final ClassLoader getLatestUserDefinedLoader() { - // requires getClassLoader permission => needs doPrivileged. - PrivilegedAction pa = () -> - stackWalker.walk(this::getLatestUserDefinedLoaderFrame) - .map(sf -> sf.getDeclaringClass().getClassLoader()) - .orElseGet(() -> ClassLoader.getPlatformClassLoader()); - return AccessController.doPrivileged(pa); - } - - /** - * Fetches a field element within the given - * object o at the given offset. - * The result is undefined unless the offset was obtained from - * {@link #objectFieldOffset} on the {@link java.lang.reflect.Field} - * of some Java field and the object referred to by o - * is of a class compatible with that field's class. - * @param o Java heap object in which the field from which the offset - * was obtained resides - * @param offset indication of where the field resides in a Java heap - * object - * @return the value fetched from the indicated Java field - * @throws RuntimeException No defined exceptions are thrown, not even - * {@link NullPointerException} - */ - public final int getInt(Object o, long offset) - { - return unsafe.getInt( o, offset ) ; - } - - /** - * Stores a value into a given Java field. - *

- * The first two parameters are interpreted exactly as with - * {@link #getInt(Object, long)} to refer to a specific - * Java field. The given value is stored into that field. - *

- * The field must be of the same type as the method - * parameter x. - * - * @param o Java heap object in which the field resides, if any, else - * null - * @param offset indication of where the field resides in a Java heap - * object. - * @param x the value to store into the indicated Java field - * @throws RuntimeException No defined exceptions are thrown, not even - * {@link NullPointerException} - */ - public final void putInt(Object o, long offset, int x) - { - unsafe.putInt( o, offset, x ) ; - } - - /** - * @see #getInt(Object, long) - */ - public final Object getObject(Object o, long offset) - { - return unsafe.getObject( o, offset ) ; - } - - /** - * @see #putInt(Object, long, int) - */ - public final void putObject(Object o, long offset, Object x) - { - unsafe.putObject( o, offset, x ) ; - } - - /** @see #getInt(Object, long) */ - public final boolean getBoolean(Object o, long offset) - { - return unsafe.getBoolean( o, offset ) ; - } - /** @see #putInt(Object, long, int) */ - public final void putBoolean(Object o, long offset, boolean x) - { - unsafe.putBoolean( o, offset, x ) ; - } - /** @see #getInt(Object, long) */ - public final byte getByte(Object o, long offset) - { - return unsafe.getByte( o, offset ) ; - } - /** @see #putInt(Object, long, int) */ - public final void putByte(Object o, long offset, byte x) - { - unsafe.putByte( o, offset, x ) ; - } - /** @see #getInt(Object, long) */ - public final short getShort(Object o, long offset) - { - return unsafe.getShort( o, offset ) ; - } - /** @see #putInt(Object, long, int) */ - public final void putShort(Object o, long offset, short x) - { - unsafe.putShort( o, offset, x ) ; - } - /** @see #getInt(Object, long) */ - public final char getChar(Object o, long offset) - { - return unsafe.getChar( o, offset ) ; - } - /** @see #putInt(Object, long, int) */ - public final void putChar(Object o, long offset, char x) - { - unsafe.putChar( o, offset, x ) ; - } - /** @see #getInt(Object, long) */ - public final long getLong(Object o, long offset) - { - return unsafe.getLong( o, offset ) ; - } - /** @see #putInt(Object, long, int) */ - public final void putLong(Object o, long offset, long x) - { - unsafe.putLong( o, offset, x ) ; - } - /** @see #getInt(Object, long) */ - public final float getFloat(Object o, long offset) - { - return unsafe.getFloat( o, offset ) ; - } - /** @see #putInt(Object, long, int) */ - public final void putFloat(Object o, long offset, float x) - { - unsafe.putFloat( o, offset, x ) ; - } - /** @see #getInt(Object, long) */ - public final double getDouble(Object o, long offset) - { - return unsafe.getDouble( o, offset ) ; - } - /** @see #putInt(Object, long, int) */ - public final void putDouble(Object o, long offset, double x) - { - unsafe.putDouble( o, offset, x ) ; - } - - /** - * This constant differs from all results that will ever be returned from - * {@link #objectFieldOffset}. - */ - public static final long INVALID_FIELD_OFFSET = -1; - - /** - * Returns the offset of a non-static field. - */ - public final long objectFieldOffset(Field f) - { - return unsafe.objectFieldOffset( f ) ; - } - - /** - * Returns the offset of a static field. - */ - public final long staticFieldOffset(Field f) - { - return unsafe.staticFieldOffset( f ) ; - } - - /** - * Ensure that the class has been initalized. - * @param cl the class to ensure is initialized - */ - public final void ensureClassInitialized(Class cl) { - unsafe.ensureClassInitialized(cl); - } - - - /** Throw the exception. - * The exception may be an undeclared checked exception. - */ - public final void throwException(Throwable ee) - { - unsafe.throwException( ee ) ; - } - - /** - * Obtain a constructor for Class cl. - * This is used to create a constructor for Serializable classes that - * construct an instance of the Serializable class using the - * no args constructor of the first non-Serializable superclass - * of the Serializable class. - */ - public final Constructor newConstructorForSerialization( Class cl ) { - return reflectionFactory.newConstructorForSerialization( cl ) ; - } - - public final Constructor newConstructorForExternalization(Class cl) { - return reflectionFactory.newConstructorForExternalization( cl ) ; - } - - /** - * Invokes the supplied constructor, adding the provided protection domains - * to the invocation stack before invoking {@code Constructor::newInstance}. - * - * This is equivalent to calling - * {@code ReflectionFactory.newInstanceForSerialization(cons,domains)}. - * - * @param cons A constructor obtained from {@code - * newConstructorForSerialization} or {@code - * newConstructorForExternalization}. - * - * @param domains An array of protection domains that limit the privileges - * with which the constructor is invoked. Can be {@code null} - * or empty, in which case privileges are only limited by the - * {@linkplain AccessController#getContext() current context}. - * - * @return A new object built from the provided constructor. - * - * @throws NullPointerException if {@code cons} is {@code null}. - * @throws InstantiationException if thrown by {@code cons.newInstance()}. - * @throws InvocationTargetException if thrown by {@code cons.newInstance()}. - * @throws IllegalAccessException if thrown by {@code cons.newInstance()}. - */ - public final Object newInstanceForSerialization(Constructor cons, - ProtectionDomain[] domains) - throws InstantiationException, InvocationTargetException, IllegalAccessException - { - return reflectionFactory.newInstanceForSerialization(cons, domains); - } - - /** - * Returns true if the given class defines a static initializer method, - * false otherwise. - */ - public final boolean hasStaticInitializerForSerialization(Class cl) { - return reflectionFactory.hasStaticInitializerForSerialization(cl); - } - - public final MethodHandle writeObjectForSerialization(Class cl) { - return reflectionFactory.writeObjectForSerialization(cl); - } - - public final MethodHandle readObjectForSerialization(Class cl) { - return reflectionFactory.readObjectForSerialization(cl); - } - - public final MethodHandle readObjectNoDataForSerialization(Class cl) { - return reflectionFactory.readObjectNoDataForSerialization(cl); - } - - public final MethodHandle readResolveForSerialization(Class cl) { - return reflectionFactory.readResolveForSerialization(cl); - } - - public final MethodHandle writeReplaceForSerialization(Class cl) { - return reflectionFactory.writeReplaceForSerialization(cl); - } - - /** - * Return a new OptionalDataException instance. - * @return a new OptionalDataException instance - */ - public final OptionalDataException newOptionalDataExceptionForSerialization(boolean bool) { - return reflectionFactory.newOptionalDataExceptionForSerialization(bool); - } - -} --- old/src/java.corba/share/classes/sun/corba/BridgePermission.java 2018-01-30 20:29:37.000000000 -0500 +++ /dev/null 2018-01-30 20:29:38.000000000 -0500 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2004, 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 sun.corba ; - -import java.security.BasicPermission ; - -/** Permission class used to protect access to the sun.corba.Bridge - * object. The only name valid here is "getBridge". The - * BridgePermission("getBridge") permission must be held by the - * caller of sun.corba.Bridge.get(). - */ -public final class BridgePermission extends BasicPermission -{ - /** - * Creates a new BridgePermission with the specified name. - * The name is the symbolic name of the BridgePermission. - * The only valid name here is "getBridge". - * - * @param name the name of the BridgePermission. - */ - public BridgePermission(String name) - { - super(name); - } - - /** - * Creates a new BridgePermission object with the specified name. - * The name is the symbolic name of the BridgePermission, and the - * actions String is currently unused and should be null. - * The only valid name here is "getBridge". - * - * @param name the name of the BridgePermission. - * @param actions should be null. - */ - - public BridgePermission(String name, String actions) - { - super(name, actions); - } -} --- old/src/java.corba/share/classes/sun/corba/EncapsInputStreamFactory.java 2018-01-30 20:29:38.000000000 -0500 +++ /dev/null 2018-01-30 20:29:38.000000000 -0500 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 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 sun.corba; - -import java.nio.ByteBuffer; -import java.security.AccessController; -import java.security.PrivilegedAction; - - -import com.sun.corba.se.impl.encoding.EncapsInputStream; -import com.sun.corba.se.impl.encoding.TypeCodeInputStream; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; -import com.sun.corba.se.pept.protocol.MessageMediator; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.orb.ORB; -import com.sun.org.omg.SendingContext.CodeBase; - -public class EncapsInputStreamFactory { - - public static EncapsInputStream newEncapsInputStream( - final org.omg.CORBA.ORB orb, final byte[] buf, final int size, - final boolean littleEndian, final GIOPVersion version) { - return AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, buf, size, - littleEndian, version); - } - }); - } - - public static EncapsInputStream newEncapsInputStream( - final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer, - final int size, final boolean littleEndian, - final GIOPVersion version) { - return AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, byteBuffer, size, - littleEndian, version); - } - }); - } - - public static EncapsInputStream newEncapsInputStream( - final org.omg.CORBA.ORB orb, final byte[] data, final int size) { - return AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, data, size); - } - }); - } - - public static EncapsInputStream newEncapsInputStream( - final EncapsInputStream eis) { - return AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public EncapsInputStream run() { - return new EncapsInputStream(eis); - } - }); - } - - public static EncapsInputStream newEncapsInputStream( - final org.omg.CORBA.ORB orb, final byte[] data, final int size, - final GIOPVersion version) { - return AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, data, size, version); - } - }); - } - - public static EncapsInputStream newEncapsInputStream( - final org.omg.CORBA.ORB orb, final byte[] data, final int size, - final GIOPVersion version, final CodeBase codeBase) { - return AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public EncapsInputStream run() { - return new EncapsInputStream(orb, data, size, version, - codeBase); - } - }); - } - - public static TypeCodeInputStream newTypeCodeInputStream( - final org.omg.CORBA.ORB orb, final byte[] buf, final int size, - final boolean littleEndian, final GIOPVersion version) { - return AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public TypeCodeInputStream run() { - return new TypeCodeInputStream(orb, buf, size, - littleEndian, version); - } - }); - } - - public static TypeCodeInputStream newTypeCodeInputStream( - final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer, - final int size, final boolean littleEndian, - final GIOPVersion version) { - return AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public TypeCodeInputStream run() { - return new TypeCodeInputStream(orb, byteBuffer, size, - littleEndian, version); - } - }); - } - - public static TypeCodeInputStream newTypeCodeInputStream( - final org.omg.CORBA.ORB orb, final byte[] data, final int size) { - return AccessController - .doPrivileged(new PrivilegedAction() { - @Override - public TypeCodeInputStream run() { - return new TypeCodeInputStream(orb, data, size); - } - }); - } -} --- old/src/java.corba/share/classes/sun/corba/JavaCorbaAccess.java 2018-01-30 20:29:39.000000000 -0500 +++ /dev/null 2018-01-30 20:29:39.000000000 -0500 @@ -1,33 +0,0 @@ -/* - * Copyright (c) 2012, 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 sun.corba; - -import com.sun.corba.se.impl.io.ValueHandlerImpl; - -public interface JavaCorbaAccess { - public ValueHandlerImpl newValueHandlerImpl(); - public Class loadClass(String className) throws ClassNotFoundException; -} --- old/src/java.corba/share/classes/sun/corba/OutputStreamFactory.java 2018-01-30 20:29:40.000000000 -0500 +++ /dev/null 2018-01-30 20:29:40.000000000 -0500 @@ -1,149 +0,0 @@ -/* - * Copyright (c) 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 sun.corba; - -import com.sun.corba.se.impl.corba.AnyImpl; -import com.sun.corba.se.impl.encoding.BufferManagerWrite; -import com.sun.corba.se.impl.encoding.CDROutputObject; -import com.sun.corba.se.impl.encoding.EncapsOutputStream; -import com.sun.corba.se.impl.encoding.TypeCodeOutputStream; -import com.sun.corba.se.impl.protocol.giopmsgheaders.Message; - -import com.sun.corba.se.pept.protocol.MessageMediator; - -import com.sun.corba.se.spi.orb.ORB; -import com.sun.corba.se.spi.transport.CorbaConnection; -import com.sun.corba.se.spi.ior.iiop.GIOPVersion; -import com.sun.corba.se.spi.protocol.CorbaMessageMediator; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -public final class OutputStreamFactory { - - private OutputStreamFactory() { - } - - public static TypeCodeOutputStream newTypeCodeOutputStream( - final ORB orb) { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public TypeCodeOutputStream run() { - return new TypeCodeOutputStream(orb); - } - }); - } - - public static TypeCodeOutputStream newTypeCodeOutputStream( - final ORB orb, final boolean littleEndian) { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public TypeCodeOutputStream run() { - return new TypeCodeOutputStream(orb, littleEndian); - } - }); - } - - public static EncapsOutputStream newEncapsOutputStream( - final ORB orb) { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public EncapsOutputStream run() { - return new EncapsOutputStream( - (com.sun.corba.se.spi.orb.ORB)orb); - } - }); - } - - public static EncapsOutputStream newEncapsOutputStream( - final ORB orb, final GIOPVersion giopVersion) { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public EncapsOutputStream run() { - return new EncapsOutputStream( - (com.sun.corba.se.spi.orb.ORB)orb, giopVersion); - } - }); - } - - public static EncapsOutputStream newEncapsOutputStream( - final ORB orb, final boolean isLittleEndian) { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public EncapsOutputStream run() { - return new EncapsOutputStream( - (com.sun.corba.se.spi.orb.ORB)orb, isLittleEndian); - } - }); - } - - public static CDROutputObject newCDROutputObject( - final ORB orb, final MessageMediator messageMediator, - final Message header, final byte streamFormatVersion) { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public CDROutputObject run() { - return new CDROutputObject(orb, messageMediator, - header, streamFormatVersion); - } - }); - } - - public static CDROutputObject newCDROutputObject( - final ORB orb, final MessageMediator messageMediator, - final Message header, final byte streamFormatVersion, - final int strategy) { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public CDROutputObject run() { - return new CDROutputObject(orb, messageMediator, - header, streamFormatVersion, strategy); - } - }); - } - - public static CDROutputObject newCDROutputObject( - final ORB orb, final CorbaMessageMediator mediator, - final GIOPVersion giopVersion, final CorbaConnection connection, - final Message header, final byte streamFormatVersion) { - return AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public CDROutputObject run() { - return new CDROutputObject(orb, mediator, - giopVersion, connection, header, streamFormatVersion); - } - }); - } - -} --- old/src/java.corba/share/classes/sun/corba/SharedSecrets.java 2018-01-30 20:29:41.000000000 -0500 +++ /dev/null 2018-01-30 20:29:41.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 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 sun.corba; - -import java.lang.reflect.Field; -import java.security.AccessController; -import java.security.PrivilegedAction; - -import com.sun.corba.se.impl.io.ValueUtility; -import sun.misc.Unsafe; - -/** A repository of "shared secrets", which are a mechanism for - calling implementation-private methods in another package without - using reflection. A package-private class implements a public - interface and provides the ability to call package-private methods - within that package; the object implementing that interface is - provided through a third package to which access is restricted. - This framework avoids the primary disadvantage of using reflection - for this purpose, namely the loss of compile-time checking. */ - -// SharedSecrets cloned in corba repo to avoid build issues -public class SharedSecrets { - - /** Access to Unsafe to read/write fields. */ - private static final Unsafe unsafe = AccessController.doPrivileged( - (PrivilegedAction)() -> { - try { - Field field = Unsafe.class.getDeclaredField("theUnsafe"); - field.setAccessible(true); - return (Unsafe)field.get(null); - - } catch (NoSuchFieldException |IllegalAccessException ex) { - throw new InternalError("Unsafe.theUnsafe field not available", ex); - } - } - ); - - private static JavaCorbaAccess javaCorbaAccess; - - public static JavaCorbaAccess getJavaCorbaAccess() { - if (javaCorbaAccess == null) { - // Ensure ValueUtility is initialized; we know that that class - // provides the shared secret - unsafe.ensureClassInitialized(ValueUtility.class); - } - return javaCorbaAccess; - } - - public static void setJavaCorbaAccess(JavaCorbaAccess access) { - javaCorbaAccess = access; - } - -} --- old/src/java.corba/share/classes/sun/corba/package.html 2018-01-30 20:29:41.000000000 -0500 +++ /dev/null 2018-01-30 20:29:41.000000000 -0500 @@ -1,37 +0,0 @@ - - - - package - - - -Provides an internal API that the Sun ORB implementation uses to -access JVM functions that have no standard APIs. - - --- old/src/java.se.ee/share/classes/module-info.java 2018-01-30 20:29:42.000000000 -0500 +++ /dev/null 2018-01-30 20:29:42.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2016, 2017, 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. - */ - -/** - * Defines the full API of the Java SE Platform. - *

- * This module requires the {@code java.se} - * module and supplements it with modules that define the CORBA and Java EE - * APIs. These modules are upgradeable. - * - * @moduleGraph - * @since 9 - */ -// suppress warning for java.corba and other modules -@SuppressWarnings({"deprecation", "removal"}) -@Deprecated(since="9", forRemoval=true) -module java.se.ee { - - requires transitive java.se; - - // Upgradeable modules for Java EE technologies - requires transitive java.activation; - requires transitive java.corba; - requires transitive java.transaction; - requires transitive java.xml.bind; - requires transitive java.xml.ws; - requires transitive java.xml.ws.annotation; - -} --- old/src/java.transaction/share/classes/javax/transaction/InvalidTransactionException.java 2018-01-30 20:29:43.000000000 -0500 +++ /dev/null 2018-01-30 20:29:43.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1998, 2015, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.transaction; - -/** - * This exception indicates that the request carried an invalid transaction - * context. For example, this exception could be raised if an error - * occured when trying to register a resource. - */ -@SuppressWarnings("serial") // serialVersionUID intentionally omitted -public class InvalidTransactionException extends java.rmi.RemoteException { - - /** - * Specify serialVersionUID for backward compatibility - */ - private static final long serialVersionUID = 3597320220337691496L; - - /** - * Constructs an {@code InvalidTransactionException}. - */ - public InvalidTransactionException() { - super(); - } - - /** - * Constructs an {@code InvalidTransactionException}. - * @param msg the detail message - */ - public InvalidTransactionException(String msg) { - super(msg); - } -} --- old/src/java.transaction/share/classes/javax/transaction/TransactionRequiredException.java 2018-01-30 20:29:43.000000000 -0500 +++ /dev/null 2018-01-30 20:29:43.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1998, 2015, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.transaction; - -/** - * This exception indicates that a request carried a null transaction context, - * but the target object requires an activate transaction. - */ -@SuppressWarnings("serial") // serialVersionUID intentionally omitted -public class TransactionRequiredException extends java.rmi.RemoteException { - - /** - * Specify serialVersionUID for backward compatibility - */ - private static final long serialVersionUID = -1898806419937446439L; - - /** - * Constructs a {@code TransactionRequiredException}. - */ - public TransactionRequiredException() { - super(); - } - - /** - * Constructs a {@code TransactionRequiredException}. - * @param msg the detail message - */ - public TransactionRequiredException(String msg) { - super(msg); - } -} --- old/src/java.transaction/share/classes/javax/transaction/TransactionRolledbackException.java 2018-01-30 20:29:44.000000000 -0500 +++ /dev/null 2018-01-30 20:29:44.000000000 -0500 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1998, 2015, 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. - */ -/* - * Licensed Materials - Property of IBM - * RMI-IIOP v1.0 - * Copyright IBM Corp. 1998 1999 All Rights Reserved - * - */ - -package javax.transaction; - -/** - * This exception indicates that the transaction associated with processing - * of the request has been rolled back, or marked to roll back. Thus the - * requested operation either could not be performed or was not performed - * because further computation on behalf of the transaction would be - * fruitless - */ -@SuppressWarnings("serial") // serialVersionUID intentionally omitted -public class TransactionRolledbackException extends java.rmi.RemoteException { - - /** - * Specify serialVersionUID for backward compatibility - */ - private static final long serialVersionUID = -3142798139623020577L; - - /** - * Constructs a {@code TransactionRolledbackException}. - */ - public TransactionRolledbackException() { - super(); - } - - /** - * Constructs a {@code TransactionRolledbackException}. - * @param msg the detail message - */ - public TransactionRolledbackException(String msg) { - super(msg); - } -} --- old/src/java.transaction/share/classes/javax/transaction/package.html 2018-01-30 20:29:45.000000000 -0500 +++ /dev/null 2018-01-30 20:29:45.000000000 -0500 @@ -1,36 +0,0 @@ - - - - - - - - -Contains three exceptions thrown by the ORB machinery during unmarshalling. - -@since 1.3 - - --- old/src/java.transaction/share/classes/module-info.java 2018-01-30 20:29:45.000000000 -0500 +++ /dev/null 2018-01-30 20:29:45.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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. - */ - -/** - * Defines a subset of the Java Transaction API (JTA) to support CORBA interoperation. - *

- * The subset consists of RMI exception types which are mapped to CORBA system - * exceptions by the Java Language to IDL Mapping Specification. - * - * @moduleGraph - * @since 9 - */ -@Deprecated(since="9", forRemoval=true) -module java.transaction { - requires transitive java.rmi; - - exports javax.transaction; -} - --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/Builder.java 2018-01-30 20:29:46.000000000 -0500 +++ /dev/null 2018-01-30 20:29:46.000000000 -0500 @@ -1,34 +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.istack.internal; - -/** - * - * @author Martin Grebac - */ -public interface Builder { - T build(); -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/ByteArrayDataSource.java 2018-01-30 20:29:47.000000000 -0500 +++ /dev/null 2018-01-30 20:29:47.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * 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.istack.internal; - -import javax.activation.DataSource; -import java.io.InputStream; -import java.io.ByteArrayInputStream; -import java.io.OutputStream; - -/** - * {@link DataSource} backed by a byte buffer. - * - * @author Kohsuke Kawaguchi - */ -public final class ByteArrayDataSource implements DataSource { - - private final String contentType; - private final byte[] buf; - private final int len; - - /** - * @param buf input buffer - the byte array isn't being copied; used directly - * @param contentType - */ - public ByteArrayDataSource(byte[] buf, String contentType) { - this(buf,buf.length,contentType); - } - - /** - * @param buf input buffer - the byte array isn't being copied; used directly - * @param length - * @param contentType - */ - public ByteArrayDataSource(byte[] buf, int length, String contentType) { - this.buf = buf; - this.len = length; - this.contentType = contentType; - } - - public String getContentType() { - if(contentType==null) - return "application/octet-stream"; - return contentType; - } - - public InputStream getInputStream() { - return new ByteArrayInputStream(buf,0,len); - } - - public String getName() { - return null; - } - - public OutputStream getOutputStream() { - throw new UnsupportedOperationException(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/FinalArrayList.java 2018-01-30 20:29:47.000000000 -0500 +++ /dev/null 2018-01-30 20:29:48.000000000 -0500 @@ -1,50 +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.istack.internal; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * {@link ArrayList} with the final keyword. - * - *

- * This gives HotSpot a better hint that all methods can be inlined. - * - * @author Kohsuke Kawaguchi - */ -public final class FinalArrayList extends ArrayList { - public FinalArrayList(int initialCapacity) { - super(initialCapacity); - } - - public FinalArrayList() { - } - - public FinalArrayList(Collection ts) { - super(ts); - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/FragmentContentHandler.java 2018-01-30 20:29:48.000000000 -0500 +++ /dev/null 2018-01-30 20:29:48.000000000 -0500 @@ -1,57 +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.istack.internal; - -import org.xml.sax.helpers.XMLFilterImpl; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.ContentHandler; - -/** - * {@link XMLFilterImpl} that masks start/end document SAX events. - * @author Kohsuke Kawaguchi - */ -public class FragmentContentHandler extends XMLFilterImpl { - public FragmentContentHandler() { - } - - public FragmentContentHandler(XMLReader parent) { - super(parent); - } - - public FragmentContentHandler(ContentHandler handler) { - super(); - setContentHandler(handler); - } - - public void startDocument() throws SAXException { - // noop - } - - public void endDocument() throws SAXException { - // noop - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/Interned.java 2018-01-30 20:29:49.000000000 -0500 +++ /dev/null 2018-01-30 20:29:49.000000000 -0500 @@ -1,55 +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.istack.internal; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.annotation.ElementType; - -/** - * Designates that a field, return value, argument, or a variable is supposed - * to be an {@link String#intern() interned} string. - * - *

- * In many places in the istack, we assume Strings to be interned for - * the performance reason. Similarly, In many other places, we don't - * make such an assumption for the performance reason (because intern - * isn't free.) - * - *

- * Therefore, distinguishing which part is supposed to be interned and - * which part is supposed to be not is important. This annotation - * allows us to capture that in the code. - * - * @author Kohsuke Kawaguchi - */ -@Documented -@Retention(RetentionPolicy.CLASS) -@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE}) -public @interface Interned { -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/NotNull.java 2018-01-30 20:29:49.000000000 -0500 +++ /dev/null 2018-01-30 20:29:50.000000000 -0500 @@ -1,43 +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.istack.internal; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.annotation.ElementType; - -/** - * Designates that a field, return value, argument, or a variable is guaranteed to be non-null. - * - * @author Kohsuke Kawaguchi - */ -@Documented -@Retention(RetentionPolicy.CLASS) -@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE}) -public @interface NotNull { -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/Nullable.java 2018-01-30 20:29:50.000000000 -0500 +++ /dev/null 2018-01-30 20:29:50.000000000 -0500 @@ -1,43 +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.istack.internal; - -import java.lang.annotation.Documented; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.lang.annotation.ElementType; - -/** - * Designates that a field, return value, argument, or a variable may be null. - * - * @author Kohsuke Kawaguchi - */ -@Documented -@Retention(RetentionPolicy.CLASS) -@Target({ElementType.FIELD,ElementType.METHOD,ElementType.PARAMETER,ElementType.LOCAL_VARIABLE}) -public @interface Nullable { -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/Pool.java 2018-01-30 20:29:51.000000000 -0500 +++ /dev/null 2018-01-30 20:29:51.000000000 -0500 @@ -1,116 +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.istack.internal; - -import java.util.concurrent.ConcurrentLinkedQueue; -import java.lang.ref.WeakReference; - -/** - * Pool of reusable objects that are indistinguishable from each other, - * such as JAXB marshallers. - * - * @author Kohsuke Kawaguchi - */ -public interface Pool { - - /** - * Gets a new object from the pool. - * - *

- * If no object is available in the pool, this method creates a new one. - */ - @NotNull T take(); - - /** - * Returns an object back to the pool. - */ - void recycle(@NotNull T t); - - /** - * Default implementation that uses {@link ConcurrentLinkedQueue} - * as the data store. - * - *

Note for Implementors

- *

- * Don't rely on the fact that this class extends from {@link ConcurrentLinkedQueue}. - */ - public abstract class Impl implements Pool { - - private volatile WeakReference> queue; - - /** - * Gets a new object from the pool. - * - *

- * If no object is available in the pool, this method creates a new one. - * - * @return - * always non-null. - */ - public final @NotNull T take() { - T t = getQueue().poll(); - if(t==null) { - return create(); - } - return t; - } - - /** - * Returns an object back to the pool. - */ - public final void recycle(T t) { - getQueue().offer(t); - } - - private ConcurrentLinkedQueue getQueue() { - WeakReference> q = queue; - if (q != null) { - ConcurrentLinkedQueue d = q.get(); - if (d != null) { - return d; - } - } - // overwrite the queue - ConcurrentLinkedQueue d = new ConcurrentLinkedQueue(); - queue = new WeakReference>(d); - - return d; - } - - /** - * Creates a new instance of object. - * - *

- * This method is used when someone wants to - * {@link #take() take} an object from an empty pool. - * - *

- * Also note that multiple threads may call this method - * concurrently. - */ - protected abstract @NotNull T create(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/SAXException2.java 2018-01-30 20:29:52.000000000 -0500 +++ /dev/null 2018-01-30 20:29:52.000000000 -0500 @@ -1,52 +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.istack.internal; - -import org.xml.sax.SAXException; - -/** - * {@link SAXException} that handles exception chaining correctly. - * - * @author Kohsuke Kawaguchi - * @since 2.0 FCS - */ -public class SAXException2 extends SAXException { - public SAXException2(String message) { - super(message); - } - - public SAXException2(Exception e) { - super(e); - } - - public SAXException2(String message, Exception e) { - super(message, e); - } - - public Throwable getCause() { - return getException(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/SAXParseException2.java 2018-01-30 20:29:53.000000000 -0500 +++ /dev/null 2018-01-30 20:29:53.000000000 -0500 @@ -1,57 +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.istack.internal; - -import org.xml.sax.SAXParseException; -import org.xml.sax.Locator; - -/** - * {@link SAXParseException} that handles exception chaining correctly. - * - * @author Kohsuke Kawaguchi - * @since 2.0 FCS - */ -public class SAXParseException2 extends SAXParseException { - public SAXParseException2(String message, Locator locator) { - super(message, locator); - } - - public SAXParseException2(String message, Locator locator, Exception e) { - super(message, locator, e); - } - - public SAXParseException2(String message, String publicId, String systemId, int lineNumber, int columnNumber) { - super(message, publicId, systemId, lineNumber, columnNumber); - } - - public SAXParseException2(String message, String publicId, String systemId, int lineNumber, int columnNumber, Exception e) { - super(message, publicId, systemId, lineNumber, columnNumber, e); - } - - public Throwable getCause() { - return getException(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/XMLStreamException2.java 2018-01-30 20:29:53.000000000 -0500 +++ /dev/null 2018-01-30 20:29:53.000000000 -0500 @@ -1,63 +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.istack.internal; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.Location; - -/** - * {@link XMLStreamException} that properly handles exception chaining. - * - * @author Kohsuke Kawaguchi - */ -public class XMLStreamException2 extends XMLStreamException { - public XMLStreamException2(String msg) { - super(msg); - } - - public XMLStreamException2(Throwable th) { - super(th); - } - - public XMLStreamException2(String msg, Throwable th) { - super(msg, th); - } - - public XMLStreamException2(String msg, Location location) { - super(msg, location); - } - - public XMLStreamException2(String msg, Location location, Throwable th) { - super(msg, location, th); - } - - /** - * {@link XMLStreamException} doesn't return the correct cause. - */ - public Throwable getCause() { - return getNestedException(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/XMLStreamReaderToContentHandler.java 2018-01-30 20:29:54.000000000 -0500 +++ /dev/null 2018-01-30 20:29:54.000000000 -0500 @@ -1,388 +0,0 @@ -/* - * 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.istack.internal; - -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.Locator; -import org.xml.sax.Attributes; -import org.xml.sax.helpers.AttributesImpl; - -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.namespace.QName; - -/** - * This is a simple utility class that adapts StAX events from an - * {@link XMLStreamReader} to SAX events on a - * {@link ContentHandler}, bridging between the two - * parser technologies. - * - * @author Ryan.Shoemaker@Sun.COM - * @version 1.0 - */ -public class XMLStreamReaderToContentHandler { - - // StAX event source - private final XMLStreamReader staxStreamReader; - - // SAX event sink - private final ContentHandler saxHandler; - - // if true, when the conversion is completed, leave the cursor to the last - // event that was fired (such as end element) - private final boolean eagerQuit; - - /** - * If true, not start/endDocument event. - */ - private final boolean fragment; - - // array of the even length of the form { prefix0, uri0, prefix1, uri1, ... } - private final String[] inscopeNamespaces; - - /** - * @see #XMLStreamReaderToContentHandler(XMLStreamReader, ContentHandler, boolean, boolean, String[]) - */ - public XMLStreamReaderToContentHandler(XMLStreamReader staxCore, ContentHandler saxCore, boolean eagerQuit, boolean fragment) { - this(staxCore, saxCore, eagerQuit, fragment, new String[0]); - } - - /** - * Construct a new StAX to SAX adapter that will convert a StAX event - * stream into a SAX event stream. - * - * @param staxCore - * StAX event source - * @param saxCore - * SAXevent sink - * @param eagerQuit - * @param fragment - * @param inscopeNamespaces - * array of the even length of the form { prefix0, uri0, prefix1, uri1, ... } - */ - public XMLStreamReaderToContentHandler(XMLStreamReader staxCore, ContentHandler saxCore, - boolean eagerQuit, boolean fragment, String[] inscopeNamespaces) { - this.staxStreamReader = staxCore; - this.saxHandler = saxCore; - this.eagerQuit = eagerQuit; - this.fragment = fragment; - this.inscopeNamespaces = inscopeNamespaces.clone(); - assert inscopeNamespaces.length%2 == 0; - } - - - /* - * @see StAXReaderToContentHandler#bridge() - */ - public void bridge() throws XMLStreamException { - - try { - // remembers the nest level of elements to know when we are done. - int depth=0; - - // if the parser is at the start tag, proceed to the first element - int event = staxStreamReader.getEventType(); - if(event == XMLStreamConstants.START_DOCUMENT) { - // nextTag doesn't correctly handle DTDs - while( !staxStreamReader.isStartElement() ) - event = staxStreamReader.next(); - } - - - if( event!=XMLStreamConstants.START_ELEMENT) - throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event); - - handleStartDocument(); - - for(int i=0; i < inscopeNamespaces.length; i+=2) { - saxHandler.startPrefixMapping(inscopeNamespaces[i], inscopeNamespaces[i+1]); - } - - OUTER: - 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 : - depth++; - handleStartElement(); - break; - case XMLStreamConstants.END_ELEMENT : - handleEndElement(); - depth--; - if(depth==0 && eagerQuit) - break OUTER; - 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.ATTRIBUTE : - handleAttribute(); - break; - case XMLStreamConstants.NAMESPACE : - handleNamespace(); - break; - case XMLStreamConstants.CDATA : - handleCDATA(); - break; - case XMLStreamConstants.ENTITY_DECLARATION : - handleEntityDecl(); - break; - case XMLStreamConstants.NOTATION_DECLARATION : - handleNotationDecl(); - break; - case XMLStreamConstants.SPACE : - handleSpace(); - break; - default : - throw new InternalError("processing event: " + event); - } - - event=staxStreamReader.next(); - } while (depth!=0); - - for(int i=0; i < inscopeNamespaces.length; i+=2) { - saxHandler.endPrefixMapping(inscopeNamespaces[i]); - } - - handleEndDocument(); - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private void handleEndDocument() throws SAXException { - if(fragment) - return; - - saxHandler.endDocument(); - } - - private void handleStartDocument() throws SAXException { - if(fragment) - return; - - saxHandler.setDocumentLocator(new Locator() { - public int getColumnNumber() { - return staxStreamReader.getLocation().getColumnNumber(); - } - public int getLineNumber() { - return staxStreamReader.getLocation().getLineNumber(); - } - public String getPublicId() { - return staxStreamReader.getLocation().getPublicId(); - } - public String getSystemId() { - return staxStreamReader.getLocation().getSystemId(); - } - }); - saxHandler.startDocument(); - } - - private void handlePI() throws XMLStreamException { - try { - saxHandler.processingInstruction( - staxStreamReader.getPITarget(), - staxStreamReader.getPIData()); - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private void handleCharacters() throws XMLStreamException { - try { - saxHandler.characters( - staxStreamReader.getTextCharacters(), - staxStreamReader.getTextStart(), - staxStreamReader.getTextLength() ); - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private void handleEndElement() throws XMLStreamException { - QName qName = staxStreamReader.getName(); - - try { - String pfix = qName.getPrefix(); - String rawname = (pfix == null || pfix.length() == 0) - ? qName.getLocalPart() - : pfix + ':' + qName.getLocalPart(); - // fire endElement - saxHandler.endElement( - qName.getNamespaceURI(), - qName.getLocalPart(), - rawname); - - // end namespace bindings - int nsCount = staxStreamReader.getNamespaceCount(); - for (int i = nsCount - 1; i >= 0; i--) { - String prefix = staxStreamReader.getNamespacePrefix(i); - if (prefix == null) { // true for default namespace - prefix = ""; - } - saxHandler.endPrefixMapping(prefix); - } - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private void handleStartElement() throws XMLStreamException { - - try { - // start namespace bindings - int nsCount = staxStreamReader.getNamespaceCount(); - for (int i = 0; i < nsCount; i++) { - saxHandler.startPrefixMapping( - fixNull(staxStreamReader.getNamespacePrefix(i)), - fixNull(staxStreamReader.getNamespaceURI(i))); - } - - // fire startElement - QName qName = staxStreamReader.getName(); - String prefix = qName.getPrefix(); - String rawname; - if(prefix==null || prefix.length()==0) - rawname = qName.getLocalPart(); - else - rawname = prefix + ':' + qName.getLocalPart(); - Attributes attrs = getAttributes(); - saxHandler.startElement( - qName.getNamespaceURI(), - qName.getLocalPart(), - rawname, - attrs); - } catch (SAXException e) { - throw new XMLStreamException2(e); - } - } - - private static String fixNull(String s) { - if(s==null) return ""; - else return s; - } - - /** - * Get the attributes associated with the given START_ELEMENT or ATTRIBUTE - * StAXevent. - * - * @return the StAX attributes converted to an org.xml.sax.Attributes - */ - private Attributes getAttributes() { - AttributesImpl attrs = new AttributesImpl(); - - int eventType = staxStreamReader.getEventType(); - if (eventType != XMLStreamConstants.ATTRIBUTE - && eventType != XMLStreamConstants.START_ELEMENT) { - throw new InternalError( - "getAttributes() attempting to process: " + eventType); - } - - // in SAX, namespace declarations are not part of attributes by default. - // (there's a property to control that, but as far as we are concerned - // we don't use it.) So don't add xmlns:* to attributes. - - // gather non-namespace attrs - for (int i = 0; i < staxStreamReader.getAttributeCount(); i++) { - String uri = staxStreamReader.getAttributeNamespace(i); - if(uri==null) uri=""; - String localName = staxStreamReader.getAttributeLocalName(i); - String prefix = staxStreamReader.getAttributePrefix(i); - String qName; - if(prefix==null || prefix.length()==0) - qName = localName; - else - qName = prefix + ':' + localName; - String type = staxStreamReader.getAttributeType(i); - String value = staxStreamReader.getAttributeValue(i); - - attrs.addAttribute(uri, localName, qName, type, value); - } - - return attrs; - } - - private void handleNamespace() { - // no-op ??? - // namespace events don't normally occur outside of a startElement - // or endElement - } - - private void handleAttribute() { - // no-op ??? - // attribute events don't normally occur outside of a startElement - // or endElement - } - - private void handleDTD() { - // no-op ??? - // it seems like we need to pass this info along, but how? - } - - private void handleComment() { - // no-op ??? - } - - private void handleEntityReference() { - // no-op ??? - } - - private void handleSpace() { - // no-op ??? - // this event is listed in the javadoc, but not in the spec. - } - - private void handleNotationDecl() { - // no-op ??? - // this event is listed in the javadoc, but not in the spec. - } - - private void handleEntityDecl() { - // no-op ??? - // this event is listed in the javadoc, but not in the spec. - } - - private void handleCDATA() { - // no-op ??? - // this event is listed in the javadoc, but not in the spec. - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizable.java 2018-01-30 20:29:55.000000000 -0500 +++ /dev/null 2018-01-30 20:29:55.000000000 -0500 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.istack.internal.localization; - -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * Localizable message. - * - * @author WS Development Team - */ -public interface Localizable { - /** - * Gets the key in the resource bundle. - * - * @return - * if this method returns {@link #NOT_LOCALIZABLE}, - * that means the message is not localizable, and - * the first item of {@link #getArguments()} array - * holds a String. - */ - public String getKey(); - - /** - * Returns the arguments for message formatting. - * - * @return - * can be an array of length 0 but never be null. - */ - public Object[] getArguments(); - public String getResourceBundleName(); - - public ResourceBundle getResourceBundle(Locale locale); - - /** - * Special constant that represents a message that - * is not localizable. - * - *

- * Use of "new" is to create an unique instance. - */ - public static final String NOT_LOCALIZABLE = "\u0000"; -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessage.java 2018-01-30 20:29:55.000000000 -0500 +++ /dev/null 2018-01-30 20:29:56.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.istack.internal.localization; - -import com.sun.istack.internal.localization.LocalizableMessageFactory.ResourceBundleSupplier; - -import java.util.Arrays; -import java.util.Locale; -import java.util.ResourceBundle; - - -/** - * @author WS Development Team - */ -public final class LocalizableMessage implements Localizable { - - private final String _bundlename; - private final ResourceBundleSupplier _rbSupplier; - - private final String _key; - private final Object[] _args; - - @Deprecated - public LocalizableMessage(String bundlename, String key, Object... args) { - this(bundlename, null, key, args); - } - - public LocalizableMessage(String bundlename, ResourceBundleSupplier rbSupplier, - String key, Object... args) { - _bundlename = bundlename; - _rbSupplier = rbSupplier; - _key = key; - if(args==null) - args = new Object[0]; - _args = args; - } - - @Override - public String getKey() { - return _key; - } - - @Override - public Object[] getArguments() { - return Arrays.copyOf(_args, _args.length); - } - - @Override - public String getResourceBundleName() { - return _bundlename; - } - - @Override - public ResourceBundle getResourceBundle(Locale locale) { - if (_rbSupplier == null) - return null; - - return _rbSupplier.getResourceBundle(locale); - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/LocalizableMessageFactory.java 2018-01-30 20:29:56.000000000 -0500 +++ /dev/null 2018-01-30 20:29:56.000000000 -0500 @@ -1,63 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.istack.internal.localization; - -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * @author WS Development Team - */ -public class LocalizableMessageFactory { - - private final String _bundlename; - private final ResourceBundleSupplier _rbSupplier; - - @Deprecated - public LocalizableMessageFactory(String bundlename) { - _bundlename = bundlename; - _rbSupplier = null; - } - - public LocalizableMessageFactory(String bundlename, ResourceBundleSupplier rbSupplier) { - _bundlename = bundlename; - _rbSupplier = rbSupplier; - } - - public Localizable getMessage(String key, Object... args) { - return new LocalizableMessage(_bundlename, _rbSupplier, key, args); - } - - public interface ResourceBundleSupplier { - /** - * Gets the ResourceBundle. - * @param locale the requested bundle's locale - * @return ResourceBundle - */ - ResourceBundle getResourceBundle(Locale locale); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/Localizer.java 2018-01-30 20:29:57.000000000 -0500 +++ /dev/null 2018-01-30 20:29:57.000000000 -0500 @@ -1,162 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.istack.internal.localization; - -import java.text.MessageFormat; -import java.util.HashMap; -import java.util.Locale; -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Localizes the {@link Localizable} into a message - * by using a configured {@link Locale}. - * - * @author WS Development Team - */ -public class Localizer { - - private final Locale _locale; - private final HashMap _resourceBundles; - - public Localizer() { - this(Locale.getDefault()); - } - - public Localizer(Locale l) { - _locale = l; - _resourceBundles = new HashMap<>(); - } - - public Locale getLocale() { - return _locale; - } - - public String localize(Localizable l) { - String key = l.getKey(); - if (key == Localizable.NOT_LOCALIZABLE) { - // this message is not localizable - return (String) l.getArguments()[0]; - } - - String bundlename = l.getResourceBundleName(); - - try { - ResourceBundle bundle = - (ResourceBundle) _resourceBundles.get(bundlename); - - if (bundle == null) { - bundle = l.getResourceBundle(_locale); - if (bundle != null) { - _resourceBundles.put(bundlename, bundle); - } - } - - if (bundle == null) { - try { - bundle = ResourceBundle.getBundle(bundlename, _locale); - } catch (MissingResourceException e) { - // work around a bug in the com.sun.enterprise.deployment.WebBundleArchivist: - // all files with an extension different from .class (hence all the .properties files) - // get copied to the top level directory instead of being in the package where they - // are defined - // so, since we can't find the bundle under its proper name, we look for it under - // the top-level package - - int i = bundlename.lastIndexOf('.'); - if (i != -1) { - String alternateBundleName = - bundlename.substring(i + 1); - try { - bundle = - ResourceBundle.getBundle( - alternateBundleName, - _locale); - } catch (MissingResourceException e2) { - //try context classloader - try { - bundle = ResourceBundle.getBundle(bundlename, _locale, Thread.currentThread().getContextClassLoader()); - } catch (MissingResourceException e3) { - // give up - return getDefaultMessage(l); - } - - } - } - } - - _resourceBundles.put(bundlename, bundle); - } - - if (bundle == null) { - return getDefaultMessage(l); - } - - if (key == null) - key = "undefined"; - - String msg; - try { - msg = bundle.getString(key); - } catch (MissingResourceException e) { - // notice that this may throw a MissingResourceException of its own (caught below) - msg = bundle.getString("undefined"); - } - - // localize all arguments to the given localizable object - Object[] args = l.getArguments(); - for (int i = 0; i < args.length; ++i) { - if (args[i] instanceof Localizable) - args[i] = localize((Localizable) args[i]); - } - - String message = MessageFormat.format(msg, args); - return message; - - } catch (MissingResourceException e) { - return getDefaultMessage(l); - } - - } - - private String getDefaultMessage(Localizable l) { - String key = l.getKey(); - Object[] args = l.getArguments(); - StringBuilder sb = new StringBuilder(); - sb.append("[failed to localize] "); - sb.append(key); - if (args != null) { - sb.append('('); - for (int i = 0; i < args.length; ++i) { - if (i != 0) - sb.append(", "); - sb.append(String.valueOf(args[i])); - } - sb.append(')'); - } - return sb.toString(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/localization/NullLocalizable.java 2018-01-30 20:29:58.000000000 -0500 +++ /dev/null 2018-01-30 20:29:58.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.istack.internal.localization; - -import java.util.Locale; -import java.util.ResourceBundle; - -/** - * {@link Localizable} that wraps a non-localizable string. - * - * @author WS Development Team - */ -public final class NullLocalizable implements Localizable { - private final String msg; - - public NullLocalizable(String msg) { - if(msg==null) - throw new IllegalArgumentException(); - this.msg = msg; - } - - @Override - public String getKey() { - return Localizable.NOT_LOCALIZABLE; - } - @Override - public Object[] getArguments() { - return new Object[]{msg}; - } - @Override - public String getResourceBundleName() { - return ""; - } - @Override - public ResourceBundle getResourceBundle(Locale locale) { - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/logging/Logger.java 2018-01-30 20:29:58.000000000 -0500 +++ /dev/null 2018-01-30 20:29:58.000000000 -0500 @@ -1,515 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.istack.internal.logging; - -import com.sun.istack.internal.NotNull; - -import java.util.StringTokenizer; -import java.util.logging.Level; - -/** - * This is a helper class that provides some convenience methods wrapped around the - * standard {@link java.util.logging.Logger} interface. - * - * The class also makes sure that logger names of each Metro subsystem are consistent - * with each other. - * - * @author Marek Potociar - * @author Fabian Ritzmann - */ -public class Logger { - - private static final String WS_LOGGING_SUBSYSTEM_NAME_ROOT = "com.sun.metro"; - private static final String ROOT_WS_PACKAGE = "com.sun.xml.internal.ws."; - // - private static final Level METHOD_CALL_LEVEL_VALUE = Level.FINEST; - // - private final String componentClassName; - private final java.util.logging.Logger logger; - - /** - * Prevents creation of a new instance of this Logger unless used by a subclass. - */ - protected Logger(final String systemLoggerName, final String componentName) { - this.componentClassName = "[" + componentName + "] "; - this.logger = java.util.logging.Logger.getLogger(systemLoggerName); - } - - /** - *

- * The factory method returns preconfigured Logger wrapper for the class. Method calls - * {@link #getSystemLoggerName(java.lang.Class)} to generate default logger name. - *

- *

- * Since there is no caching implemented, it is advised that the method is called only once - * per a class in order to initialize a final static logger variable, which is then used - * through the class to perform actual logging tasks. - *

- * - * @param componentClass class of the component that will use the logger instance. Must not be {@code null}. - * @return logger instance preconfigured for use with the component - * @throws NullPointerException if the componentClass parameter is {@code null}. - */ - public static @NotNull Logger getLogger(final @NotNull Class componentClass) { - return new Logger(getSystemLoggerName(componentClass), componentClass.getName()); - } - - /** - * The factory method returns preconfigured Logger wrapper for the class. Since there is no caching implemented, - * it is advised that the method is called only once per a class in order to initialize a final static logger variable, - * which is then used through the class to perform actual logging tasks. - * - * This method should be only used in a special cases when overriding of a default logger name derived from the - * package of the component class is needed. For all common use cases please use {@link #getLogger(java.lang.Class)} - * method. - * - * @param customLoggerName custom name of the logger. - * @param componentClass class of the component that will use the logger instance. Must not be {@code null}. - * @return logger instance preconfigured for use with the component - * @throws NullPointerException if the componentClass parameter is {@code null}. - * - * @see #getLogger(java.lang.Class) - */ - public static @NotNull Logger getLogger(final @NotNull String customLoggerName, final @NotNull Class componentClass) { - return new Logger(customLoggerName, componentClass.getName()); - } - - /** - * Calculates the subsystem suffix based on the package of the component class - * @param componentClass class of the component that will use the logger instance. Must not be {@code null}. - * @return system logger name for the given {@code componentClass} instance - */ - static final String getSystemLoggerName(@NotNull Class componentClass) { - StringBuilder sb = new StringBuilder(componentClass.getPackage().getName()); - final int lastIndexOfWsPackage = sb.lastIndexOf(ROOT_WS_PACKAGE); - if (lastIndexOfWsPackage > -1) { - sb.replace(0, lastIndexOfWsPackage + ROOT_WS_PACKAGE.length(), ""); - - StringTokenizer st = new StringTokenizer(sb.toString(), "."); - sb = new StringBuilder(WS_LOGGING_SUBSYSTEM_NAME_ROOT).append("."); - if (st.hasMoreTokens()) { - String token = st.nextToken(); - if ("api".equals(token)) { - token = st.nextToken(); - } - sb.append(token); - } - } - - return sb.toString(); - } - - public void log(final Level level, final String message) { - if (!this.logger.isLoggable(level)) { - return; - } - logger.logp(level, componentClassName, getCallerMethodName(), message); - } - - public void log(final Level level, final String message, Object param1) { - if (!this.logger.isLoggable(level)) { - return; - } - logger.logp(level, componentClassName, getCallerMethodName(), message, param1); - } - - public void log(final Level level, final String message, Object[] params) { - if (!this.logger.isLoggable(level)) { - return; - } - logger.logp(level, componentClassName, getCallerMethodName(), message, params); - } - - public void log(final Level level, final String message, final Throwable thrown) { - if (!this.logger.isLoggable(level)) { - return; - } - logger.logp(level, componentClassName, getCallerMethodName(), message, thrown); - } - - public void finest(final String message) { - if (!this.logger.isLoggable(Level.FINEST)) { - return; - } - logger.logp(Level.FINEST, componentClassName, getCallerMethodName(), message); - } - - public void finest(final String message, Object[] params) { - if (!this.logger.isLoggable(Level.FINEST)) { - return; - } - logger.logp(Level.FINEST, componentClassName, getCallerMethodName(), message, params); - } - - public void finest(final String message, final Throwable thrown) { - if (!this.logger.isLoggable(Level.FINEST)) { - return; - } - logger.logp(Level.FINEST, componentClassName, getCallerMethodName(), message, thrown); - } - - public void finer(final String message) { - if (!this.logger.isLoggable(Level.FINER)) { - return; - } - logger.logp(Level.FINER, componentClassName, getCallerMethodName(), message); - } - - public void finer(final String message, Object[] params) { - if (!this.logger.isLoggable(Level.FINER)) { - return; - } - logger.logp(Level.FINER, componentClassName, getCallerMethodName(), message, params); - } - - public void finer(final String message, final Throwable thrown) { - if (!this.logger.isLoggable(Level.FINER)) { - return; - } - logger.logp(Level.FINER, componentClassName, getCallerMethodName(), message, thrown); - } - - public void fine(final String message) { - if (!this.logger.isLoggable(Level.FINE)) { - return; - } - logger.logp(Level.FINE, componentClassName, getCallerMethodName(), message); - } - - public void fine(final String message, final Throwable thrown) { - if (!this.logger.isLoggable(Level.FINE)) { - return; - } - logger.logp(Level.FINE, componentClassName, getCallerMethodName(), message, thrown); - } - - public void info(final String message) { - if (!this.logger.isLoggable(Level.INFO)) { - return; - } - logger.logp(Level.INFO, componentClassName, getCallerMethodName(), message); - } - - public void info(final String message, Object[] params) { - if (!this.logger.isLoggable(Level.INFO)) { - return; - } - logger.logp(Level.INFO, componentClassName, getCallerMethodName(), message, params); - } - - public void info(final String message, final Throwable thrown) { - if (!this.logger.isLoggable(Level.INFO)) { - return; - } - logger.logp(Level.INFO, componentClassName, getCallerMethodName(), message, thrown); - } - - public void config(final String message) { - if (!this.logger.isLoggable(Level.CONFIG)) { - return; - } - logger.logp(Level.CONFIG, componentClassName, getCallerMethodName(), message); - } - - public void config(final String message, Object[] params) { - if (!this.logger.isLoggable(Level.CONFIG)) { - return; - } - logger.logp(Level.CONFIG, componentClassName, getCallerMethodName(), message, params); - } - - public void config(final String message, final Throwable thrown) { - if (!this.logger.isLoggable(Level.CONFIG)) { - return; - } - logger.logp(Level.CONFIG, componentClassName, getCallerMethodName(), message, thrown); - } - - public void warning(final String message) { - if (!this.logger.isLoggable(Level.WARNING)) { - return; - } - logger.logp(Level.WARNING, componentClassName, getCallerMethodName(), message); - } - - public void warning(final String message, Object[] params) { - if (!this.logger.isLoggable(Level.WARNING)) { - return; - } - logger.logp(Level.WARNING, componentClassName, getCallerMethodName(), message, params); - } - - public void warning(final String message, final Throwable thrown) { - if (!this.logger.isLoggable(Level.WARNING)) { - return; - } - logger.logp(Level.WARNING, componentClassName, getCallerMethodName(), message, thrown); - } - - public void severe(final String message) { - if (!this.logger.isLoggable(Level.SEVERE)) { - return; - } - logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), message); - } - - public void severe(final String message, Object[] params) { - if (!this.logger.isLoggable(Level.SEVERE)) { - return; - } - logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), message, params); - } - - public void severe(final String message, final Throwable thrown) { - if (!this.logger.isLoggable(Level.SEVERE)) { - return; - } - logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), message, thrown); - } - - public boolean isMethodCallLoggable() { - return this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE); - } - - public boolean isLoggable(final Level level) { - return this.logger.isLoggable(level); - } - - public void setLevel(final Level level) { - this.logger.setLevel(level); - } - - public void entering() { - if (!this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE)) { - return; - } - - logger.entering(componentClassName, getCallerMethodName()); - } - - public void entering(final Object... parameters) { - if (!this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE)) { - return; - } - - logger.entering(componentClassName, getCallerMethodName(), parameters); - } - - public void exiting() { - if (!this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE)) { - return; - } - logger.exiting(componentClassName, getCallerMethodName()); - } - - public void exiting(final Object result) { - if (!this.logger.isLoggable(METHOD_CALL_LEVEL_VALUE)) { - return; - } - logger.exiting(componentClassName, getCallerMethodName(), result); - } - - /** - * Method logs {@code exception}'s message as a {@code SEVERE} logging level - * message. - *

- * If {@code cause} parameter is not {@code null}, it is logged as well and - * {@code exception} original cause is initialized with instance referenced - * by {@code cause} parameter. - * - * @param exception exception whose message should be logged. Must not be - * {@code null}. - * @param cause initial cause of the exception that should be logged as well - * and set as {@code exception}'s original cause. May be {@code null}. - * @return the same exception instance that was passed in as the {@code exception} - * parameter. - */ - public T logSevereException(final T exception, final Throwable cause) { - if (this.logger.isLoggable(Level.SEVERE)) { - if (cause == null) { - logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage()); - } else { - exception.initCause(cause); - logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage(), cause); - } - } - - return exception; - } - - /** - * Method logs {@code exception}'s message as a {@code SEVERE} logging level - * message. - *

- * If {@code logCause} parameter is {@code true}, {@code exception}'s original - * cause is logged as well (if exists). This may be used in cases when - * {@code exception}'s class provides constructor to initialize the original - * cause. In such case you do not need to use - * {@link #logSevereException(Throwable, Throwable)} - * method version but you might still want to log the original cause as well. - * - * @param exception exception whose message should be logged. Must not be - * {@code null}. - * @param logCause deterimnes whether initial cause of the exception should - * be logged as well - * @return the same exception instance that was passed in as the {@code exception} - * parameter. - */ - public T logSevereException(final T exception, final boolean logCause) { - if (this.logger.isLoggable(Level.SEVERE)) { - if (logCause && exception.getCause() != null) { - logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage(), exception.getCause()); - } else { - logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage()); - } - } - - return exception; - } - - /** - * Same as {@link #logSevereException(Throwable, boolean) logSevereException(exception, true)}. - */ - public T logSevereException(final T exception) { - if (this.logger.isLoggable(Level.SEVERE)) { - if (exception.getCause() == null) { - logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage()); - } else { - logger.logp(Level.SEVERE, componentClassName, getCallerMethodName(), exception.getMessage(), exception.getCause()); - } - } - - return exception; - } - - /** - * Method logs {@code exception}'s message at the logging level specified by the - * {@code level} argument. - *

- * If {@code cause} parameter is not {@code null}, it is logged as well and - * {@code exception} original cause is initialized with instance referenced - * by {@code cause} parameter. - * - * @param exception exception whose message should be logged. Must not be - * {@code null}. - * @param cause initial cause of the exception that should be logged as well - * and set as {@code exception}'s original cause. May be {@code null}. - * @param level loging level which should be used for logging - * @return the same exception instance that was passed in as the {@code exception} - * parameter. - */ - public T logException(final T exception, final Throwable cause, final Level level) { - if (this.logger.isLoggable(level)) { - if (cause == null) { - logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage()); - } else { - exception.initCause(cause); - logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage(), cause); - } - } - - return exception; - } - - /** - * Method logs {@code exception}'s message at the logging level specified by the - * {@code level} argument. - *

- * If {@code logCause} parameter is {@code true}, {@code exception}'s original - * cause is logged as well (if exists). This may be used in cases when - * {@code exception}'s class provides constructor to initialize the original - * cause. In such case you do not need to use - * {@link #logException(Throwable, Throwable, Level) logException(exception, cause, level)} - * method version but you might still want to log the original cause as well. - * - * @param exception exception whose message should be logged. Must not be - * {@code null}. - * @param logCause deterimnes whether initial cause of the exception should - * be logged as well - * @param level loging level which should be used for logging - * @return the same exception instance that was passed in as the {@code exception} - * parameter. - */ - public T logException(final T exception, final boolean logCause, final Level level) { - if (this.logger.isLoggable(level)) { - if (logCause && exception.getCause() != null) { - logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage(), exception.getCause()); - } else { - logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage()); - } - } - - return exception; - } - - /** - * Same as {@link #logException(Throwable, Throwable, Level) - * logException(exception, true, level)}. - */ - public T logException(final T exception, final Level level) { - if (this.logger.isLoggable(level)) { - if (exception.getCause() == null) { - logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage()); - } else { - logger.logp(level, componentClassName, getCallerMethodName(), exception.getMessage(), exception.getCause()); - } - } - - return exception; - } - - /** - * Function returns the name of the caller method for the method executing this - * function. - * - * @return caller method name from the call stack of the current {@link Thread}. - */ - private static String getCallerMethodName() { - return getStackMethodName(5); - } - - /** - * Method returns the name of the method that is on the {@code methodIndexInStack} - * position in the call stack of the current {@link Thread}. - * - * @param methodIndexInStack index to the call stack to get the method name for. - * @return the name of the method that is on the {@code methodIndexInStack} - * position in the call stack of the current {@link Thread}. - */ - private static String getStackMethodName(final int methodIndexInStack) { - final String methodName; - - final StackTraceElement[] stack = Thread.currentThread().getStackTrace(); - if (stack.length > methodIndexInStack + 1) { - methodName = stack[methodIndexInStack].getMethodName(); - } else { - methodName = "UNKNOWN METHOD"; - } - - return methodName; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/istack/internal/package-info.java 2018-01-30 20:29:59.000000000 -0500 +++ /dev/null 2018-01-30 20:29:59.000000000 -0500 @@ -1,29 +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. - */ - -/** - * istack-commons runtime utilities. - */ -package com.sun.istack.internal; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/AccessorFactory.java 2018-01-30 20:30:00.000000000 -0500 +++ /dev/null 2018-01-30 20:30:00.000000000 -0500 @@ -1,63 +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.xml.internal.bind; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import javax.xml.bind.JAXBException; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * A means to allow the user to provide customized Accessor - * to be used by JAXB. - */ -public interface AccessorFactory { - /** - * Access a field of the class. - * - * @param bean the class to be processed. - * @param f the field within the class to be accessed. - * @param readOnly the isStatic value of the field's modifier. - * @return Accessor the accessor for this field - * - * @throws JAXBException reports failures of the method. - */ - Accessor createFieldAccessor(Class bean, Field f, boolean readOnly) throws JAXBException; - - /** - * Access a property of the class. - * - * @param bean the class to be processed - * @param getter the getter method to be accessed. The value can be null. - * @param setter the setter method to be accessed. The value can be null. - * @return Accessor the accessor for these methods - * - * @throws JAXBException reports failures of the method. - */ - Accessor createPropertyAccessor(Class bean, Method getter, Method setter) throws JAXBException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/AccessorFactoryImpl.java 2018-01-30 20:30:00.000000000 -0500 +++ /dev/null 2018-01-30 20:30:00.000000000 -0500 @@ -1,90 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import javax.xml.bind.JAXBException; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -public class AccessorFactoryImpl implements InternalAccessorFactory { - - private static AccessorFactoryImpl instance = new AccessorFactoryImpl(); - private AccessorFactoryImpl(){} - - public static AccessorFactoryImpl getInstance(){ - return instance; - } - - /** - * Access a field of the class. - * - * @param bean the class to be processed. - * @param field the field within the class to be accessed. - * @param readOnly the isStatic value of the field's modifier. - * @return Accessor the accessor for this field - */ - public Accessor createFieldAccessor(Class bean, Field field, boolean readOnly) { - return readOnly - ? new Accessor.ReadOnlyFieldReflection(field) - : new Accessor.FieldReflection(field); - } - - /** - * Access a field of the class. - * - * @param bean the class to be processed. - * @param field the field within the class to be accessed. - * @param readOnly the isStatic value of the field's modifier. - * @param supressWarning supress security warning about accessing fields through reflection - * @return Accessor the accessor for this field - */ - public Accessor createFieldAccessor(Class bean, Field field, boolean readOnly, boolean supressWarning) { - return readOnly - ? new Accessor.ReadOnlyFieldReflection(field, supressWarning) - : new Accessor.FieldReflection(field, supressWarning); - } - - /** - * Access a property of the class. - * - * @param bean the class to be processed - * @param getter the getter method to be accessed. The value can be null. - * @param setter the setter method to be accessed. The value can be null. - * @return Accessor the accessor for these methods - */ - public Accessor createPropertyAccessor(Class bean, Method getter, Method setter) { - if (getter == null) { - return new Accessor.SetterOnlyReflection(setter); - } - if (setter == null) { - return new Accessor.GetterOnlyReflection(getter); - } - return new Accessor.GetterSetterReflection(getter, setter); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/AnyTypeAdapter.java 2018-01-30 20:30:01.000000000 -0500 +++ /dev/null 2018-01-30 20:30:01.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -/** - * {@link XmlAdapter} useful for mapping interfaces. - * - * See The JAXB user's guide - * for more about this adapter class. - * - * @author Kohsuke Kawaguchi - * @since JAXB 2.1 - */ -public final class AnyTypeAdapter extends XmlAdapter { - /** - * Noop. Just returns the object given as the argument. - */ - public Object unmarshal(Object v) { - return v; - } - - /** - * Noop. Just returns the object given as the argument. - */ - public Object marshal(Object v) { - return v; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/CycleRecoverable.java 2018-01-30 20:30:02.000000000 -0500 +++ /dev/null 2018-01-30 20:30:02.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind; - -import javax.xml.bind.Marshaller; - -/** - * Optional interface that can be implemented by JAXB-bound objects - * to handle cycles in the object graph. - * - *

- * As discussed in - * the users' guide, normally a cycle in the object graph causes the marshaller to report an error, - * and when an error is found, the JAXB RI recovers by cutting the cycle arbitrarily. - * This is not always a desired behavior. - * - *

- * Implementing this interface allows user application to change this behavior. - * - * @since JAXB 2.1 EA2 - * @author Kohsuke Kawaguchi - */ -public interface CycleRecoverable { - /** - * Called when a cycle is detected by the JAXB RI marshaller - * to nominate a new object to be marshalled instead. - * - * @param context - * This object is provided by the JAXB RI to inform - * the object about the marshalling process that's going on. - * - * - * @return - * the object to be marshalled instead of {@code this} object. - * Or return null to indicate that the JAXB RI should behave - * just like when your object does not implement {@link CycleRecoverable} - * (IOW, cut the cycle arbitrarily and try to go on.) - */ - Object onCycleDetected(Context context); - - /** - * This interface is implemented by the JAXB RI to provide - * information about the on-going marshalling process. - * - *

- * We may add more methods in the future, so please do not - * implement this interface in your application. - */ - public interface Context { - /** - * Returns the marshaller object that's doing the marshalling. - * - * @return - * always non-null. - */ - Marshaller getMarshaller(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/DatatypeConverterImpl.java 2018-01-30 20:30:02.000000000 -0500 +++ /dev/null 2018-01-30 20:30:02.000000000 -0500 @@ -1,1137 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Calendar; -import java.util.Collections; -import java.util.GregorianCalendar; -import java.util.Map; -import java.util.TimeZone; -import java.util.WeakHashMap; - -import javax.xml.bind.DatatypeConverter; -import javax.xml.bind.DatatypeConverterInterface; -import javax.xml.datatype.DatatypeConfigurationException; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.namespace.NamespaceContext; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -/** - * This class is the JAXB RI's default implementation of the - * {@link DatatypeConverterInterface}. - * - *

- * When client applications specify the use of the static print/parse - * methods in {@link DatatypeConverter}, it will delegate - * to this class. - * - *

- * This class is responsible for whitespace normalization. - * - * @author

  • Ryan Shoemaker, Martin Grebac
- * @since JAXB 1.0 - * @deprecated in JAXB 2.2.4 - use javax.xml.bind.DatatypeConverterImpl instead - * or let us know why you can't - */ -@Deprecated -public final class DatatypeConverterImpl implements DatatypeConverterInterface { - - @Deprecated - public static final DatatypeConverterInterface theInstance = new DatatypeConverterImpl(); - - protected DatatypeConverterImpl() { - // shall not be used - } - - public static BigInteger _parseInteger(CharSequence s) { - return new BigInteger(removeOptionalPlus(WhiteSpaceProcessor.trim(s)).toString()); - } - - public static String _printInteger(BigInteger val) { - return val.toString(); - } - - /** - * Faster but less robust {@code String->int} conversion. - * - * Note that: - *
    - *
  1. XML Schema allows '+', but {@link Integer#valueOf(String)} is not. - *
  2. XML Schema allows leading and trailing (but not in-between) whitespaces. - * {@link Integer#valueOf(String)} doesn't allow any. - *
- */ - public static int _parseInt(CharSequence s) { - int len = s.length(); - int sign = 1; - - int r = 0; - - for (int i = 0; i < len; i++) { - char ch = s.charAt(i); - if (WhiteSpaceProcessor.isWhiteSpace(ch)) { - // skip whitespace - } else if ('0' <= ch && ch <= '9') { - r = r * 10 + (ch - '0'); - } else if (ch == '-') { - sign = -1; - } else if (ch == '+') { - // noop - } else { - throw new NumberFormatException("Not a number: " + s); - } - } - - return r * sign; - } - - public static long _parseLong(CharSequence s) { - return Long.parseLong(removeOptionalPlus(WhiteSpaceProcessor.trim(s)).toString()); - } - - public static short _parseShort(CharSequence s) { - return (short) _parseInt(s); - } - - public static String _printShort(short val) { - return String.valueOf(val); - } - - public static BigDecimal _parseDecimal(CharSequence content) { - content = WhiteSpaceProcessor.trim(content); - - if (content.length() <= 0) { - return null; - } - - return new BigDecimal(content.toString()); - - // from purely XML Schema perspective, - // this implementation has a problem, since - // in xs:decimal "1.0" and "1" is equal whereas the above - // code will return different values for those two forms. - // - // the code was originally using com.sun.msv.datatype.xsd.NumberType.load, - // but a profiling showed that the process of normalizing "1.0" into "1" - // could take non-trivial time. - // - // also, from the user's point of view, one might be surprised if - // 1 (not 1.0) is returned from "1.000" - } - - public static float _parseFloat(CharSequence _val) { - String s = WhiteSpaceProcessor.trim(_val).toString(); - /* Incompatibilities of XML Schema's float "xfloat" and Java's float "jfloat" - - * jfloat.valueOf ignores leading and trailing whitespaces, - whereas this is not allowed in xfloat. - * jfloat.valueOf allows "float type suffix" (f, F) to be - appended after float literal (e.g., 1.52e-2f), whereare - this is not the case of xfloat. - - gray zone - --------- - * jfloat allows ".523". And there is no clear statement that mentions - this case in xfloat. Although probably this is allowed. - * - */ - - if (s.equals("NaN")) { - return Float.NaN; - } - if (s.equals("INF")) { - return Float.POSITIVE_INFINITY; - } - if (s.equals("-INF")) { - return Float.NEGATIVE_INFINITY; - } - - if (s.length() == 0 - || !isDigitOrPeriodOrSign(s.charAt(0)) - || !isDigitOrPeriodOrSign(s.charAt(s.length() - 1))) { - throw new NumberFormatException(); - } - - // these screening process is necessary due to the wobble of Float.valueOf method - return Float.parseFloat(s); - } - - public static String _printFloat(float v) { - if (Float.isNaN(v)) { - return "NaN"; - } - if (v == Float.POSITIVE_INFINITY) { - return "INF"; - } - if (v == Float.NEGATIVE_INFINITY) { - return "-INF"; - } - return String.valueOf(v); - } - - public static double _parseDouble(CharSequence _val) { - String val = WhiteSpaceProcessor.trim(_val).toString(); - - if (val.equals("NaN")) { - return Double.NaN; - } - if (val.equals("INF")) { - return Double.POSITIVE_INFINITY; - } - if (val.equals("-INF")) { - return Double.NEGATIVE_INFINITY; - } - - if (val.length() == 0 - || !isDigitOrPeriodOrSign(val.charAt(0)) - || !isDigitOrPeriodOrSign(val.charAt(val.length() - 1))) { - throw new NumberFormatException(val); - } - - - // these screening process is necessary due to the wobble of Float.valueOf method - return Double.parseDouble(val); - } - - public static Boolean _parseBoolean(CharSequence literal) { - if (literal == null) { - return null; - } - - int i = 0; - int len = literal.length(); - char ch; - boolean value = false; - - if (literal.length() <= 0) { - return null; - } - - do { - ch = literal.charAt(i++); - } while (WhiteSpaceProcessor.isWhiteSpace(ch) && i < len); - - int strIndex = 0; - - switch (ch) { - case '1': - value = true; - break; - case '0': - value = false; - break; - case 't': - String strTrue = "rue"; - do { - ch = literal.charAt(i++); - } while ((strTrue.charAt(strIndex++) == ch) && i < len && strIndex < 3); - - if (strIndex == 3) { - value = true; - } else { - return false; - } -// throw new IllegalArgumentException("String \"" + literal + "\" is not valid boolean value."); - - break; - case 'f': - String strFalse = "alse"; - do { - ch = literal.charAt(i++); - } while ((strFalse.charAt(strIndex++) == ch) && i < len && strIndex < 4); - - - if (strIndex == 4) { - value = false; - } else { - return false; - } -// throw new IllegalArgumentException("String \"" + literal + "\" is not valid boolean value."); - - break; - } - - if (i < len) { - do { - ch = literal.charAt(i++); - } while (WhiteSpaceProcessor.isWhiteSpace(ch) && i < len); - } - - if (i == len) { - return value; - } else { - return null; - } -// throw new IllegalArgumentException("String \"" + literal + "\" is not valid boolean value."); - } - - public static String _printBoolean(boolean val) { - return val ? "true" : "false"; - } - - public static byte _parseByte(CharSequence literal) { - return (byte) _parseInt(literal); - } - - public static String _printByte(byte val) { - return String.valueOf(val); - } - - /** - * @return null if fails to convert. - */ - public static QName _parseQName(CharSequence text, NamespaceContext nsc) { - int length = text.length(); - - // trim whitespace - int start = 0; - while (start < length && WhiteSpaceProcessor.isWhiteSpace(text.charAt(start))) { - start++; - } - - int end = length; - while (end > start && WhiteSpaceProcessor.isWhiteSpace(text.charAt(end - 1))) { - end--; - } - - if (end == start) { - throw new IllegalArgumentException("input is empty"); - } - - - String uri; - String localPart; - String prefix; - - // search ':' - int idx = start + 1; // no point in searching the first char. that's not valid. - while (idx < end && text.charAt(idx) != ':') { - idx++; - } - - if (idx == end) { - uri = nsc.getNamespaceURI(""); - localPart = text.subSequence(start, end).toString(); - prefix = ""; - } else { - // Prefix exists, check everything - prefix = text.subSequence(start, idx).toString(); - localPart = text.subSequence(idx + 1, end).toString(); - uri = nsc.getNamespaceURI(prefix); - // uri can never be null according to javadoc, - // but some users reported that there are implementations that return null. - if (uri == null || uri.length() == 0) // crap. the NamespaceContext interface is broken. - // error: unbound prefix - { - throw new IllegalArgumentException("prefix " + prefix + " is not bound to a namespace"); - } - } - - return new QName(uri, localPart, prefix); - } - - public static GregorianCalendar _parseDateTime(CharSequence s) { - String val = WhiteSpaceProcessor.trim(s).toString(); - return getDatatypeFactory().newXMLGregorianCalendar(val).toGregorianCalendar(); - } - - public static String _printDateTime(Calendar val) { - return CalendarFormatter.doFormat("%Y-%M-%DT%h:%m:%s%z", val); - } - - public static String _printDate(Calendar val) { - return CalendarFormatter.doFormat((new StringBuilder("%Y-%M-%D").append("%z")).toString(),val); - } - - public static String _printInt(int val) { - return String.valueOf(val); - } - - public static String _printLong(long val) { - return String.valueOf(val); - } - - public static String _printDecimal(BigDecimal val) { - return val.toPlainString(); - } - - public static String _printDouble(double v) { - if (Double.isNaN(v)) { - return "NaN"; - } - if (v == Double.POSITIVE_INFINITY) { - return "INF"; - } - if (v == Double.NEGATIVE_INFINITY) { - return "-INF"; - } - return String.valueOf(v); - } - - public static String _printQName(QName val, NamespaceContext nsc) { - // Double-check - String qname; - String prefix = nsc.getPrefix(val.getNamespaceURI()); - String localPart = val.getLocalPart(); - - if (prefix == null || prefix.length() == 0) { // be defensive - qname = localPart; - } else { - qname = prefix + ':' + localPart; - } - - return qname; - } - -// base64 decoder - private static final byte[] decodeMap = initDecodeMap(); - private static final byte PADDING = 127; - - private static byte[] initDecodeMap() { - byte[] map = new byte[128]; - int i; - for (i = 0; i < 128; i++) { - map[i] = -1; - } - - for (i = 'A'; i <= 'Z'; i++) { - map[i] = (byte) (i - 'A'); - } - for (i = 'a'; i <= 'z'; i++) { - map[i] = (byte) (i - 'a' + 26); - } - for (i = '0'; i <= '9'; i++) { - map[i] = (byte) (i - '0' + 52); - } - map['+'] = 62; - map['/'] = 63; - map['='] = PADDING; - - return map; - } - - /** - * computes the length of binary data speculatively. - * - *

- * Our requirement is to create byte[] of the exact length to store the binary data. - * If we do this in a straight-forward way, it takes two passes over the data. - * Experiments show that this is a non-trivial overhead (35% or so is spent on - * the first pass in calculating the length.) - * - *

- * So the approach here is that we compute the length speculatively, without looking - * at the whole contents. The obtained speculative value is never less than the - * actual length of the binary data, but it may be bigger. So if the speculation - * goes wrong, we'll pay the cost of reallocation and buffer copying. - * - *

- * If the base64 text is tightly packed with no indentation nor illegal char - * (like what most web services produce), then the speculation of this method - * will be correct, so we get the performance benefit. - */ - private static int guessLength(String text) { - final int len = text.length(); - - // compute the tail '=' chars - int j = len - 1; - for (; j >= 0; j--) { - byte code = decodeMap[text.charAt(j)]; - if (code == PADDING) { - continue; - } - if (code == -1) // most likely this base64 text is indented. go with the upper bound - { - return text.length() / 4 * 3; - } - break; - } - - j++; // text.charAt(j) is now at some base64 char, so +1 to make it the size - int padSize = len - j; - if (padSize > 2) // something is wrong with base64. be safe and go with the upper bound - { - return text.length() / 4 * 3; - } - - // so far this base64 looks like it's unindented tightly packed base64. - // take a chance and create an array with the expected size - return text.length() / 4 * 3 - padSize; - } - - /** - * @param text - * base64Binary data is likely to be long, and decoding requires - * each character to be accessed twice (once for counting length, another - * for decoding.) - * - * A benchmark showed that taking {@link String} is faster, presumably - * because JIT can inline a lot of string access (with data of 1K chars, it was twice as fast) - */ - public static byte[] _parseBase64Binary(String text) { - final int buflen = guessLength(text); - final byte[] out = new byte[buflen]; - int o = 0; - - final int len = text.length(); - int i; - - final byte[] quadruplet = new byte[4]; - int q = 0; - - // convert each quadruplet to three bytes. - for (i = 0; i < len; i++) { - char ch = text.charAt(i); - byte v = decodeMap[ch]; - - if (v != -1) { - quadruplet[q++] = v; - } - - if (q == 4) { - // quadruplet is now filled. - out[o++] = (byte) ((quadruplet[0] << 2) | (quadruplet[1] >> 4)); - if (quadruplet[2] != PADDING) { - out[o++] = (byte) ((quadruplet[1] << 4) | (quadruplet[2] >> 2)); - } - if (quadruplet[3] != PADDING) { - out[o++] = (byte) ((quadruplet[2] << 6) | (quadruplet[3])); - } - q = 0; - } - } - - if (buflen == o) // speculation worked out to be OK - { - return out; - } - - // we overestimated, so need to create a new buffer - byte[] nb = new byte[o]; - System.arraycopy(out, 0, nb, 0, o); - return nb; - } - private static final char[] encodeMap = initEncodeMap(); - - private static char[] initEncodeMap() { - char[] map = new char[64]; - int i; - for (i = 0; i < 26; i++) { - map[i] = (char) ('A' + i); - } - for (i = 26; i < 52; i++) { - map[i] = (char) ('a' + (i - 26)); - } - for (i = 52; i < 62; i++) { - map[i] = (char) ('0' + (i - 52)); - } - map[62] = '+'; - map[63] = '/'; - - return map; - } - - public static char encode(int i) { - return encodeMap[i & 0x3F]; - } - - public static byte encodeByte(int i) { - return (byte) encodeMap[i & 0x3F]; - } - - public static String _printBase64Binary(byte[] input) { - return _printBase64Binary(input, 0, input.length); - } - - public static String _printBase64Binary(byte[] input, int offset, int len) { - char[] buf = new char[((len + 2) / 3) * 4]; - int ptr = _printBase64Binary(input, offset, len, buf, 0); - assert ptr == buf.length; - return new String(buf); - } - - /** - * Encodes a byte array into a char array by doing base64 encoding. - * - * The caller must supply a big enough buffer. - * - * @return - * the value of {@code ptr+((len+2)/3)*4}, which is the new offset - * in the output buffer where the further bytes should be placed. - */ - public static int _printBase64Binary(byte[] input, int offset, int len, char[] buf, int ptr) { - // encode elements until only 1 or 2 elements are left to encode - int remaining = len; - int i; - for (i = offset;remaining >= 3; remaining -= 3, i += 3) { - buf[ptr++] = encode(input[i] >> 2); - buf[ptr++] = encode( - ((input[i] & 0x3) << 4) - | ((input[i + 1] >> 4) & 0xF)); - buf[ptr++] = encode( - ((input[i + 1] & 0xF) << 2) - | ((input[i + 2] >> 6) & 0x3)); - buf[ptr++] = encode(input[i + 2] & 0x3F); - } - // encode when exactly 1 element (left) to encode - if (remaining == 1) { - buf[ptr++] = encode(input[i] >> 2); - buf[ptr++] = encode(((input[i]) & 0x3) << 4); - buf[ptr++] = '='; - buf[ptr++] = '='; - } - // encode when exactly 2 elements (left) to encode - if (remaining == 2) { - buf[ptr++] = encode(input[i] >> 2); - buf[ptr++] = encode(((input[i] & 0x3) << 4) - | ((input[i + 1] >> 4) & 0xF)); - buf[ptr++] = encode((input[i + 1] & 0xF) << 2); - buf[ptr++] = '='; - } - return ptr; - } - - public static void _printBase64Binary(byte[] input, int offset, int len, XMLStreamWriter output) throws XMLStreamException { - int remaining = len; - int i; - char[] buf = new char[4]; - - for (i = offset; remaining >= 3; remaining -= 3, i += 3) { - buf[0] = encode(input[i] >> 2); - buf[1] = encode( - ((input[i] & 0x3) << 4) - | ((input[i + 1] >> 4) & 0xF)); - buf[2] = encode( - ((input[i + 1] & 0xF) << 2) - | ((input[i + 2] >> 6) & 0x3)); - buf[3] = encode(input[i + 2] & 0x3F); - output.writeCharacters(buf, 0, 4); - } - // encode when exactly 1 element (left) to encode - if (remaining == 1) { - buf[0] = encode(input[i] >> 2); - buf[1] = encode(((input[i]) & 0x3) << 4); - buf[2] = '='; - buf[3] = '='; - output.writeCharacters(buf, 0, 4); - } - // encode when exactly 2 elements (left) to encode - if (remaining == 2) { - buf[0] = encode(input[i] >> 2); - buf[1] = encode(((input[i] & 0x3) << 4) - | ((input[i + 1] >> 4) & 0xF)); - buf[2] = encode((input[i + 1] & 0xF) << 2); - buf[3] = '='; - output.writeCharacters(buf, 0, 4); - } - } - - /** - * Encodes a byte array into another byte array by first doing base64 encoding - * then encoding the result in ASCII. - * - * The caller must supply a big enough buffer. - * - * @return - * the value of {@code ptr+((len+2)/3)*4}, which is the new offset - * in the output buffer where the further bytes should be placed. - */ - public static int _printBase64Binary(byte[] input, int offset, int len, byte[] out, int ptr) { - byte[] buf = out; - int remaining = len; - int i; - for (i=offset; remaining >= 3; remaining -= 3, i += 3 ) { - buf[ptr++] = encodeByte(input[i]>>2); - buf[ptr++] = encodeByte( - ((input[i]&0x3)<<4) | - ((input[i+1]>>4)&0xF)); - buf[ptr++] = encodeByte( - ((input[i+1]&0xF)<<2)| - ((input[i+2]>>6)&0x3)); - buf[ptr++] = encodeByte(input[i+2]&0x3F); - } - // encode when exactly 1 element (left) to encode - if (remaining == 1) { - buf[ptr++] = encodeByte(input[i]>>2); - buf[ptr++] = encodeByte(((input[i])&0x3)<<4); - buf[ptr++] = '='; - buf[ptr++] = '='; - } - // encode when exactly 2 elements (left) to encode - if (remaining == 2) { - buf[ptr++] = encodeByte(input[i]>>2); - buf[ptr++] = encodeByte( - ((input[i]&0x3)<<4) | - ((input[i+1]>>4)&0xF)); - buf[ptr++] = encodeByte((input[i+1]&0xF)<<2); - buf[ptr++] = '='; - } - - return ptr; - } - - private static CharSequence removeOptionalPlus(CharSequence s) { - int len = s.length(); - - if (len <= 1 || s.charAt(0) != '+') { - return s; - } - - s = s.subSequence(1, len); - char ch = s.charAt(0); - if ('0' <= ch && ch <= '9') { - return s; - } - if ('.' == ch) { - return s; - } - - throw new NumberFormatException(); - } - - private static boolean isDigitOrPeriodOrSign(char ch) { - if ('0' <= ch && ch <= '9') { - return true; - } - if (ch == '+' || ch == '-' || ch == '.') { - return true; - } - return false; - } - - private static final Map DF_CACHE = Collections.synchronizedMap(new WeakHashMap()); - - public static DatatypeFactory getDatatypeFactory() { - ClassLoader tccl = AccessController.doPrivileged(new PrivilegedAction() { - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - DatatypeFactory df = DF_CACHE.get(tccl); - if (df == null) { - synchronized (DatatypeConverterImpl.class) { - df = DF_CACHE.get(tccl); - if (df == null) { // to prevent multiple initialization - try { - df = DatatypeFactory.newInstance(); - } catch (DatatypeConfigurationException e) { - throw new Error(Messages.FAILED_TO_INITIALE_DATATYPE_FACTORY.format(),e); - } - DF_CACHE.put(tccl, df); - } - } - } - return df; - } - - private static final class CalendarFormatter { - - public static String doFormat(String format, Calendar cal) throws IllegalArgumentException { - int fidx = 0; - int flen = format.length(); - StringBuilder buf = new StringBuilder(); - - while (fidx < flen) { - char fch = format.charAt(fidx++); - - if (fch != '%') { // not a meta character - buf.append(fch); - continue; - } - - // seen meta character. we don't do error check against the format - switch (format.charAt(fidx++)) { - case 'Y': // year - formatYear(cal, buf); - break; - - case 'M': // month - formatMonth(cal, buf); - break; - - case 'D': // days - formatDays(cal, buf); - break; - - case 'h': // hours - formatHours(cal, buf); - break; - - case 'm': // minutes - formatMinutes(cal, buf); - break; - - case 's': // parse seconds. - formatSeconds(cal, buf); - break; - - case 'z': // time zone - formatTimeZone(cal, buf); - break; - - default: - // illegal meta character. impossible. - throw new InternalError(); - } - } - - return buf.toString(); - } - - private static void formatYear(Calendar cal, StringBuilder buf) { - int year = cal.get(Calendar.YEAR); - - String s; - if (year <= 0) // negative value - { - s = Integer.toString(1 - year); - } else // positive value - { - s = Integer.toString(year); - } - - while (s.length() < 4) { - s = '0' + s; - } - if (year <= 0) { - s = '-' + s; - } - - buf.append(s); - } - - private static void formatMonth(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.MONTH) + 1, buf); - } - - private static void formatDays(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.DAY_OF_MONTH), buf); - } - - private static void formatHours(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.HOUR_OF_DAY), buf); - } - - private static void formatMinutes(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.MINUTE), buf); - } - - private static void formatSeconds(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.SECOND), buf); - if (cal.isSet(Calendar.MILLISECOND)) { // milliseconds - int n = cal.get(Calendar.MILLISECOND); - if (n != 0) { - String ms = Integer.toString(n); - while (ms.length() < 3) { - ms = '0' + ms; // left 0 paddings. - } - buf.append('.'); - buf.append(ms); - } - } - } - - /** formats time zone specifier. */ - private static void formatTimeZone(Calendar cal, StringBuilder buf) { - TimeZone tz = cal.getTimeZone(); - - if (tz == null) { - return; - } - - // otherwise print out normally. - int offset = tz.getOffset(cal.getTime().getTime()); - - if (offset == 0) { - buf.append('Z'); - return; - } - - if (offset >= 0) { - buf.append('+'); - } else { - buf.append('-'); - offset *= -1; - } - - offset /= 60 * 1000; // offset is in milli-seconds - - formatTwoDigits(offset / 60, buf); - buf.append(':'); - formatTwoDigits(offset % 60, buf); - } - - /** formats Integer into two-character-wide string. */ - private static void formatTwoDigits(int n, StringBuilder buf) { - // n is always non-negative. - if (n < 10) { - buf.append('0'); - } - buf.append(n); - } - } - - // DEPRECATED METHODS, KEPT FOR JAXB1 GENERATED CLASSES COMPATIBILITY, WILL BE REMOVED IN FUTURE - - @Deprecated - public String parseString(String lexicalXSDString) { - return lexicalXSDString; - } - - @Deprecated - public BigInteger parseInteger(String lexicalXSDInteger) { - return _parseInteger(lexicalXSDInteger); - } - - @Deprecated - public String printInteger(BigInteger val) { - return _printInteger(val); - } - - @Deprecated - public int parseInt(String s) { - return _parseInt(s); - } - - @Deprecated - public long parseLong(String lexicalXSLong) { - return _parseLong(lexicalXSLong); - } - - @Deprecated - public short parseShort(String lexicalXSDShort) { - return _parseShort(lexicalXSDShort); - } - - @Deprecated - public String printShort(short val) { - return _printShort(val); - } - - @Deprecated - public BigDecimal parseDecimal(String content) { - return _parseDecimal(content); - } - - @Deprecated - public float parseFloat(String lexicalXSDFloat) { - return _parseFloat(lexicalXSDFloat); - } - - @Deprecated - public String printFloat(float v) { - return _printFloat(v); - } - - @Deprecated - public double parseDouble(String lexicalXSDDouble) { - return _parseDouble(lexicalXSDDouble); - } - - @Deprecated - public boolean parseBoolean(String lexicalXSDBoolean) { - Boolean b = _parseBoolean(lexicalXSDBoolean); - return (b == null) ? false : b.booleanValue(); - } - - @Deprecated - public String printBoolean(boolean val) { - return val ? "true" : "false"; - } - - @Deprecated - public byte parseByte(String lexicalXSDByte) { - return _parseByte(lexicalXSDByte); - } - - @Deprecated - public String printByte(byte val) { - return _printByte(val); - } - - @Deprecated - public QName parseQName(String lexicalXSDQName, NamespaceContext nsc) { - return _parseQName(lexicalXSDQName, nsc); - } - - @Deprecated - public Calendar parseDateTime(String lexicalXSDDateTime) { - return _parseDateTime(lexicalXSDDateTime); - } - - @Deprecated - public String printDateTime(Calendar val) { - return _printDateTime(val); - } - - @Deprecated - public byte[] parseBase64Binary(String lexicalXSDBase64Binary) { - return _parseBase64Binary(lexicalXSDBase64Binary); - } - - @Deprecated - public byte[] parseHexBinary(String s) { - final int len = s.length(); - - // "111" is not a valid hex encoding. - if (len % 2 != 0) { - throw new IllegalArgumentException("hexBinary needs to be even-length: " + s); - } - - byte[] out = new byte[len / 2]; - - for (int i = 0; i < len; i += 2) { - int h = hexToBin(s.charAt(i)); - int l = hexToBin(s.charAt(i + 1)); - if (h == -1 || l == -1) { - throw new IllegalArgumentException("contains illegal character for hexBinary: " + s); - } - - out[i / 2] = (byte) (h * 16 + l); - } - - return out; - } - - @Deprecated - private static int hexToBin(char ch) { - if ('0' <= ch && ch <= '9') { - return ch - '0'; - } - if ('A' <= ch && ch <= 'F') { - return ch - 'A' + 10; - } - if ('a' <= ch && ch <= 'f') { - return ch - 'a' + 10; - } - return -1; - } - - @Deprecated - private static final char[] hexCode = "0123456789ABCDEF".toCharArray(); - - @Deprecated - public String printHexBinary(byte[] data) { - StringBuilder r = new StringBuilder(data.length * 2); - for (byte b : data) { - r.append(hexCode[(b >> 4) & 0xF]); - r.append(hexCode[(b & 0xF)]); - } - return r.toString(); - } - - @Deprecated - public long parseUnsignedInt(String lexicalXSDUnsignedInt) { - return _parseLong(lexicalXSDUnsignedInt); - } - - @Deprecated - public String printUnsignedInt(long val) { - return _printLong(val); - } - - @Deprecated - public int parseUnsignedShort(String lexicalXSDUnsignedShort) { - return _parseInt(lexicalXSDUnsignedShort); - } - - @Deprecated - public Calendar parseTime(String lexicalXSDTime) { - return getDatatypeFactory().newXMLGregorianCalendar(lexicalXSDTime).toGregorianCalendar(); - } - - @Deprecated - public String printTime(Calendar val) { - return CalendarFormatter.doFormat("%h:%m:%s%z", val); - } - - @Deprecated - public Calendar parseDate(String lexicalXSDDate) { - return getDatatypeFactory().newXMLGregorianCalendar(lexicalXSDDate).toGregorianCalendar(); - } - - @Deprecated - public String printDate(Calendar val) { - return _printDate(val); - } - - @Deprecated - public String parseAnySimpleType(String lexicalXSDAnySimpleType) { - return lexicalXSDAnySimpleType; - } - - @Deprecated - public String printString(String val) { - return val; - } - - @Deprecated - public String printInt(int val) { - return _printInt(val); - } - - @Deprecated - public String printLong(long val) { - return _printLong(val); - } - - @Deprecated - public String printDecimal(BigDecimal val) { - return _printDecimal(val); - } - - @Deprecated - public String printDouble(double v) { - return _printDouble(v); - } - - @Deprecated - public String printQName(QName val, NamespaceContext nsc) { - return _printQName(val, nsc); - } - - @Deprecated - public String printBase64Binary(byte[] val) { - return _printBase64Binary(val); - } - - @Deprecated - public String printUnsignedShort(int val) { - return String.valueOf(val); - } - - @Deprecated - public String printAnySimpleType(String val) { - return val; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/IDResolver.java 2018-01-30 20:30:03.000000000 -0500 +++ /dev/null 2018-01-30 20:30:03.000000000 -0500 @@ -1,160 +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.xml.internal.bind; - -import java.util.concurrent.Callable; - -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.annotation.XmlIDREF; - -import org.xml.sax.SAXException; - -/** - * Pluggable ID/IDREF handling layer. - * - *

- * THIS INTERFACE IS SUBJECT TO CHANGE WITHOUT NOTICE. - * - *

- * This 'interface' can be implemented by applications and specified to - * {@link Unmarshaller#setProperty(String, Object)} to ovierride the ID/IDREF - * processing of the JAXB RI like this: - * - *

- * unmarshaller.setProperty(IDResolver.class.getName(),new MyIDResolverImpl());
- * 
- * - *

Error Handling

- *

- * This component runs inside the JAXB RI unmarshaller. Therefore, it needs - * to coordinate with the JAXB RI unmarshaller when it comes to reporting - * errors. This makes sure that applications see consistent error handling behaviors. - * - *

- * When the {@link #startDocument(ValidationEventHandler)} method is invoked, - * the unmarshaller passes in a {@link ValidationEventHandler} that can be used - * by this component to report any errors encountered during the ID/IDREF processing. - * - *

- * When an error is detected, the error should be first reported to this - * {@link ValidationEventHandler}. If the error is fatal or the event handler - * decided to abort, the implementation should throw a {@link SAXException}. - * This signals the unmarshaller to abort the processing. - * - * @author Kohsuke Kawaguchi - * @since JAXB 2.0 beta - */ -public abstract class IDResolver { - - /** - * Called when the unmarshalling starts. - * - *

- * Since one {@link Unmarshaller} may be used multiple times - * to unmarshal documents, one {@link IDResolver} may be used multiple times, too. - * - * @param eventHandler - * Any errors found during the unmarshalling should be reported to this object. - */ - public void startDocument(ValidationEventHandler eventHandler) throws SAXException { - - } - - /** - * Called after the unmarshalling completes. - * - *

- * This is a good opporunity to reset any internal state of this object, - * so that it doesn't keep references to other objects unnecessarily. - */ - public void endDocument() throws SAXException { - - } - - /** - * Binds the given object to the specified ID. - * - *

- * While a document is being unmarshalled, every time - * an ID value is found, this method is invoked to - * remember the association between ID and objects. - * This association is supposed to be used later to resolve - * IDREFs. - * - *

- * This method is invoked right away as soon as a new ID value is found. - * - * @param id - * The ID value found in the document being unmarshalled. - * Always non-null. - * @param obj - * The object being unmarshalled which is going to own the ID. - * Always non-null. - */ - public abstract void bind( String id, Object obj ) throws SAXException; - - /** - * Obtains the object to be pointed by the IDREF value. - * - *

- * While a document is being unmarshalled, every time - * an IDREF value is found, this method is invoked immediately to - * obtain the object that the IDREF is pointing to. - * - *

- * This method returns a {@link Callable} to support forward-references. - * When this method returns with a non-null return value, - * the JAXB RI unmarshaller invokes the {@link Callable#call()} method immediately. - * If the implementation can find the target object (in which case - * it was a backward reference), then a non-null object shall be returned, - * and it is used as the target object. - * - *

- * When a forward-reference happens, the {@code call} method - * should return null. In this case the JAXB RI unmarshaller invokes - * the {@code call} method again after all the documents are fully unmarshalled. - * If the {@code call} method still returns null, then the JAXB RI unmarshaller - * treats it as an error. - * - *

- * A {@link Callable} object returned from this method may not throw - * any exception other than a {@link SAXException} (which means a fatal error.) - * - * @param id - * The IDREF value found in the document being unmarshalled. - * Always non-null. - * @param targetType - * The expected type to which ID resolves to. JAXB infers this - * information from the signature of the fields that has {@link XmlIDREF}. - * When a property is a collection, this parameter will be the type - * of the individual item in the collection. - * @return - * null if the implementation is sure that the parameter combination - * will never yield a valid object. Otherwise non-null. - */ - public abstract Callable resolve( String id, Class targetType ) throws SAXException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/InternalAccessorFactory.java 2018-01-30 20:30:04.000000000 -0500 +++ /dev/null 2018-01-30 20:30:04.000000000 -0500 @@ -1,50 +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.bind; - -import java.lang.reflect.Field; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import javax.xml.bind.JAXBException; - -/** - * A means to allow the user to provide customized Accessor - * to be used by JAXB. Adds ability to suppress warnings. - */ -public interface InternalAccessorFactory extends AccessorFactory { - /** - * Access a field of the class. - * - * @param bean the class to be processed. - * @param f the field within the class to be accessed. - * @param readOnly the isStatic value of the field's modifier. - * @param supressWarnings suppress reflection warnings - * @return Accessor the accessor for this field - * - * @throws JAXBException reports failures of the method. - */ - Accessor createFieldAccessor(Class bean, Field f, boolean readOnly, boolean supressWarnings) throws JAXBException; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Locatable.java 2018-01-30 20:30:05.000000000 -0500 +++ /dev/null 2018-01-30 20:30:05.000000000 -0500 @@ -1,53 +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.xml.internal.bind; - -import com.sun.xml.internal.bind.annotation.XmlLocation; - -import org.xml.sax.Locator; - -/** - * Optional interface implemented by JAXB objects to expose - * location information from which an object is unmarshalled. - * - *

- * This is used during JAXB RI 1.0.x. - * In JAXB 2.0, use {@link XmlLocation}. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * - * @since JAXB RI 1.0 - */ -public interface Locatable { - /** - * @return - * null if the location information is unavaiable, - * or otherwise return a immutable valid {@link Locator} - * object. - */ - Locator sourceLocation(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages.java 2018-01-30 20:30:06.000000000 -0500 +++ /dev/null 2018-01-30 20:30:06.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * 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.bind; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Message resources - */ -enum Messages { - FAILED_TO_INITIALE_DATATYPE_FACTORY, // 0 args - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - @Override - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages.properties 2018-01-30 20:30:06.000000000 -0500 +++ /dev/null 2018-01-30 20:30:06.000000000 -0500 @@ -1,27 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = \ - Failed to initialize JAXP 1.3 DatatypeFactory class. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages_de.properties 2018-01-30 20:30:07.000000000 -0500 +++ /dev/null 2018-01-30 20:30:07.000000000 -0500 @@ -1,26 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = JAXP 1.3 DatatypeFactory-Klasse konnte nicht initialisiert werden. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages_es.properties 2018-01-30 20:30:08.000000000 -0500 +++ /dev/null 2018-01-30 20:30:08.000000000 -0500 @@ -1,26 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = Fallo al inicializar la clase DatatypeFactory de JAXP 1.3. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages_fr.properties 2018-01-30 20:30:08.000000000 -0500 +++ /dev/null 2018-01-30 20:30:08.000000000 -0500 @@ -1,26 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = Echec de l'initialisation de la classe JAXP 1.3 DatatypeFactory. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages_it.properties 2018-01-30 20:30:09.000000000 -0500 +++ /dev/null 2018-01-30 20:30:09.000000000 -0500 @@ -1,26 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = Inizializzazione della classe DatatypeFactory di JAXP 1.3 non riuscita. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages_ja.properties 2018-01-30 20:30:10.000000000 -0500 +++ /dev/null 2018-01-30 20:30:10.000000000 -0500 @@ -1,26 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = JAXP 1.3 DatatypeFactory\u30AF\u30E9\u30B9\u306E\u521D\u671F\u5316\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages_ko.properties 2018-01-30 20:30:10.000000000 -0500 +++ /dev/null 2018-01-30 20:30:10.000000000 -0500 @@ -1,26 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = JAXP 1.3 DatatypeFactory \uD074\uB798\uC2A4 \uCD08\uAE30\uD654\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages_pt_BR.properties 2018-01-30 20:30:11.000000000 -0500 +++ /dev/null 2018-01-30 20:30:11.000000000 -0500 @@ -1,26 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = Falha ao inicializar a classe DatatypeFactory de JAXP 1.3. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages_zh_CN.properties 2018-01-30 20:30:12.000000000 -0500 +++ /dev/null 2018-01-30 20:30:12.000000000 -0500 @@ -1,26 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = \u65E0\u6CD5\u521D\u59CB\u5316 JAXP 1.3 DatatypeFactory \u7C7B\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Messages_zh_TW.properties 2018-01-30 20:30:12.000000000 -0500 +++ /dev/null 2018-01-30 20:30:12.000000000 -0500 @@ -1,26 +0,0 @@ -# -# 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. -# - -FAILED_TO_INITIALE_DATATYPE_FACTORY = \u7121\u6CD5\u8D77\u59CB JAXP 1.3 DatatypeFactory \u985E\u5225. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/Util.java 2018-01-30 20:30:13.000000000 -0500 +++ /dev/null 2018-01-30 20:30:13.000000000 -0500 @@ -1,60 +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.bind; - -import java.util.logging.Logger; - -/** - * @author Kohsuke Kawaguchi - */ -public final class Util { - private Util() {} // no instanciation - - /** - * Gets the logger for the caller's class. - * - * @since 2.0 - */ - public static Logger getClassLogger() { - try { - StackTraceElement[] trace = new Exception().getStackTrace(); - return Logger.getLogger(trace[1].getClassName()); - } catch( SecurityException e) { - return Logger.getLogger("com.sun.xml.internal.bind"); // use the default - } - } - - /** - * Reads the system property value and takes care of {@link SecurityException}. - */ - public static String getSystemProperty(String name) { - try { - return System.getProperty(name); - } catch( SecurityException e ) { - return null; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/ValidationEventLocatorEx.java 2018-01-30 20:30:14.000000000 -0500 +++ /dev/null 2018-01-30 20:30:14.000000000 -0500 @@ -1,71 +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.xml.internal.bind; - -import javax.xml.bind.ValidationEventLocator; - -/** - * Defines additional accessor methods for the event source location. - *

- * This interface exposes the location information only available - * in the JAXB RI specific extension. - *

- * DO NOT IMPLEMENT THIS INTERFACE BY YOUR CODE because - * we might add more methods on this interface in the future release - * of the RI. - * - *

Usage

- *

- * If you obtain a reference to {@link javax.xml.bind.ValidationEventLocator}, - * check if you can cast it to {@link ValidationEventLocatorEx} first, like this: - *

- * void foo( ValidationEvent e ) {
- *     ValidationEventLocator loc = e.getLocator();
- *     if( loc instanceof ValidationEventLocatorEx ) {
- *         String fieldName = ((ValidationEventLocatorEx)loc).getFieldName();
- *         if( fieldName!=null ) {
- *             // do something with location.
- *         }
- *     }
- * }
- * 
- * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public interface ValidationEventLocatorEx extends ValidationEventLocator { - /** - * Returns the field name of the object where the error occured. - *

- * This method always returns null when you are doing - * a validation during unmarshalling. - * - * When not null, the field name indicates the field of the object - * designated by the {@link #getObject()} method where the error - * occured. - */ - String getFieldName(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/WhiteSpaceProcessor.java 2018-01-30 20:30:14.000000000 -0500 +++ /dev/null 2018-01-30 20:30:14.000000000 -0500 @@ -1,198 +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.bind; - -/** - * Processes white space normalization. - * - * @since 1.0 - */ -public abstract class WhiteSpaceProcessor { - -// benchmarking (see test/src/ReplaceTest.java in the CVS Attic) -// showed that this code is slower than the current code. -// -// public static String replace(String text) { -// final int len = text.length(); -// StringBuffer result = new StringBuffer(len); -// -// for (int i = 0; i < len; i++) { -// char ch = text.charAt(i); -// if (isWhiteSpace(ch)) -// result.append(' '); -// else -// result.append(ch); -// } -// -// return result.toString(); -// } - - public static String replace(String text) { - return replace( (CharSequence)text ).toString(); - } - - /** - * @since 2.0 - */ - public static CharSequence replace(CharSequence text) { - int i=text.length()-1; - - // look for the first whitespace char. - while( i>=0 && !isWhiteSpaceExceptSpace(text.charAt(i)) ) - i--; - - if( i<0 ) - // no such whitespace. replace(text)==text. - return text; - - // we now know that we need to modify the text. - // allocate a char array to do it. - StringBuilder buf = new StringBuilder(text); - - buf.setCharAt(i--,' '); - for( ; i>=0; i-- ) - if( isWhiteSpaceExceptSpace(buf.charAt(i))) - buf.setCharAt(i,' '); - - return new String(buf); - } - - /** - * Equivalent of {@link String#trim()}. - * @since 2.0 - */ - public static CharSequence trim(CharSequence text) { - int len = text.length(); - int start = 0; - - while( startstart && isWhiteSpace(text.charAt(end)) ) - end--; - - if(start==0 && end==len-1) - return text; // no change - else - return text.subSequence(start,end+1); - } - - public static String collapse(String text) { - return collapse( (CharSequence)text ).toString(); - } - - /** - * This is usually the biggest processing bottleneck. - * - * @since 2.0 - */ - public static CharSequence collapse(CharSequence text) { - int len = text.length(); - - // most of the texts are already in the collapsed form. - // so look for the first whitespace in the hope that we will - // never see it. - int s=0; - while(s 0 && result.charAt(len - 1) == ' ') - result.setLength(len - 1); - // whitespaces are already collapsed, - // so all we have to do is to remove the last one character - // if it's a whitespace. - - return result; - } - - /** - * Returns true if the specified string is all whitespace. - */ - public static boolean isWhiteSpace(CharSequence s) { - for( int i=s.length()-1; i>=0; i-- ) - if(!isWhiteSpace(s.charAt(i))) - return false; - return true; - } - - /** returns true if the specified char is a white space character. */ - public static boolean isWhiteSpace(char ch) { - // most of the characters are non-control characters. - // so check that first to quickly return false for most of the cases. - if( ch>0x20 ) return false; - - // other than we have to do four comparisons. - return ch == 0x9 || ch == 0xA || ch == 0xD || ch == 0x20; - } - - /** - * Returns true if the specified char is a white space character - * but not 0x20. - */ - protected static boolean isWhiteSpaceExceptSpace(char ch) { - // most of the characters are non-control characters. - // so check that first to quickly return false for most of the cases. - if( ch>=0x20 ) return false; - - // other than we have to do four comparisons. - return ch == 0x9 || ch == 0xA || ch == 0xD; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/XmlAccessorFactory.java 2018-01-30 20:30:15.000000000 -0500 +++ /dev/null 2018-01-30 20:30:15.000000000 -0500 @@ -1,44 +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.xml.internal.bind; - -import static java.lang.annotation.ElementType.PACKAGE; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Identifies a user provided customized Accessor - * to be used. - */ - -@Retention(RUNTIME) -@Target({TYPE,PACKAGE}) -public @interface XmlAccessorFactory { - Class value(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/annotation/OverrideAnnotationOf.java 2018-01-30 20:30:16.000000000 -0500 +++ /dev/null 2018-01-30 20:30:16.000000000 -0500 @@ -1,42 +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.xml.internal.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Designates an annotation from base class which shall be overriden by annotation placed together with this. - * - * @author Martin Grebac - */ -@Retention(RUNTIME) -@Target({FIELD}) -public @interface OverrideAnnotationOf { - String value() default "content"; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/annotation/XmlIsSet.java 2018-01-30 20:30:16.000000000 -0500 +++ /dev/null 2018-01-30 20:30:16.000000000 -0500 @@ -1,113 +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.xml.internal.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlValue; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Designates a boolean field/property as a flag to indicate - * whether another property is present or not. - * - *

- * Sometimes you'd want to map a Java primitive type to an - * optional element/attribute. Doing this makes it impossible - * to represent the absence of the property, thus you always - * end up producing the value when you marshal to XML. - * - * For example, - *

- * {@link XmlElement}
- * class Foo {
- *      {@link XmlElement}
- *      int x;
- * }
- *
- * marshaller.marshal(new Foo());
- * 
- * and you get: - *
{@code
- * 0
- * }
- * - *

- * By creating a side boolean field/property that has this annotation, - * you can indicate the absence of the property by setting this boolean - * to false. - *

- * {@link XmlElement}
- * class Foo {
- *      {@link XmlElement}
- *      int x;
- *      {@link XmlIsSet}("x")
- *      boolean xIsPresent;
- * }
- *
- * Foo f = new Foo();
- * f.x = 5;
- * f.xIsPresent = false;
- *
- * marshaller.marshal(f);
- *
- * {@code
- * 
- * }
- *
- * f.xIsPresent = true;
- * {@code
- * 5
- * }
- * 
- * - *

- * A property/field annotated with {@link XmlIsSet} itself will not show up in XML. - * It is an error to use this annotation on the same property/field - * as {@link XmlElement}, {@link XmlAttribute}, {@link XmlValue}, or {@link XmlElementRef}, - * ...TBD. - * - * @deprecated - * this hasn't been implemented in the RI, and this hasn't been speced yet. - * I believe Joe asked for this feature. I'd like to drop this. - * - * @author Kohsuke Kawaguchi - */ -@Retention(RUNTIME) -@Target({FIELD,METHOD}) -public @interface XmlIsSet { - /** - * Specifies the name of the property to attach to. - */ - String value(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/annotation/XmlLocation.java 2018-01-30 20:30:17.000000000 -0500 +++ /dev/null 2018-01-30 20:30:17.000000000 -0500 @@ -1,68 +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.xml.internal.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import org.xml.sax.Locator; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; - -/** - * Marks a property that receives a location from which the object is unmarshalled. - * - *

Usage

- *

- * The @XmlLocation can be specified on: - *

    - *
  • a field whose type is {@link Locator}, or - *
  • a method that takes a {@link Locator} as the sole parameter - *
- * - *

- * When a class that contains such a field/method is unmarshalled by the JAXB RI, - * such a field/method will receive an immutable {@link Locator} object that describes - * the location in the XML document where the object is unmarshalled from. - * - *

- * If the unmarshaller does not know the source location information, the locator - * will not be set. For example, this happens when it is unmarshalling from a DOM tree. - * This also happens if you use JAXB implementations other than the JAXB RI. - * - *

- * This information can be used by applications, for example to provide user-friendly - * error information. - * - * - * @author Kohsuke Kawaguchi - * @since JAXB RI 2.0 EA - */ -@Retention(RUNTIME) @Target({FIELD,METHOD}) -public @interface XmlLocation { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/AccessorException.java 2018-01-30 20:30:18.000000000 -0500 +++ /dev/null 2018-01-30 20:30:18.000000000 -0500 @@ -1,62 +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.xml.internal.bind.api; - - -/** - * Signals an error in {@link RawAccessor}. - * - *

- * This error is not reported to the user handler. Once reported - * the error should be wrapped into another exception. - * - *

- * This exception happens primarily when JAXB accesses the getter/setter - * method and it throws a checked exception. - * - *

- * Subject to change without notice. - * - * @author Kohsuke Kawaguchi - * - * @since 2.0 EA1 - */ -public final class AccessorException extends Exception { - public AccessorException() { - } - - public AccessorException(String message) { - super(message); - } - - public AccessorException(String message, Throwable cause) { - super(message, cause); - } - - public AccessorException(Throwable cause) { - super(cause); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Bridge.java 2018-01-30 20:30:19.000000000 -0500 +++ /dev/null 2018-01-30 20:30:19.000000000 -0500 @@ -1,320 +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.xml.internal.bind.api; - -import java.io.InputStream; -import java.io.OutputStream; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.attachment.AttachmentMarshaller; -import javax.xml.bind.attachment.AttachmentUnmarshaller; -import javax.xml.namespace.NamespaceContext; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.Result; -import javax.xml.transform.Source; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; -import com.sun.xml.internal.bind.v2.runtime.BridgeContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; - -import org.w3c.dom.Node; -import org.xml.sax.ContentHandler; - -/** - * Mini-marshaller/unmarshaller that is specialized for a particular - * element name and a type. - * - *

- * Instances of this class is stateless and multi-thread safe. - * They are reentrant. - * - *

- * All the marshal operation generates fragments. - * - *

- * Subject to change without notice. - * - * @since JAXB 2.0 EA1 - * @author Kohsuke Kawaguchi - */ -public abstract class Bridge { - protected Bridge(JAXBContextImpl context) { - this.context = context; - } - - protected final JAXBContextImpl context; - - /** - * Gets the {@link JAXBRIContext} to which this object belongs. - * - * @since 2.1 - */ - public @NotNull JAXBRIContext getContext() { - return context; - } - - /** - * - * @throws JAXBException - * if there was an error while marshalling. - * - * @since 2.0 EA1 - */ - public final void marshal(T object,XMLStreamWriter output) throws JAXBException { - marshal(object,output,null); - } - public final void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException { - Marshaller m = context.marshallerPool.take(); - m.setAttachmentMarshaller(am); - marshal(m,object,output); - m.setAttachmentMarshaller(null); - context.marshallerPool.recycle(m); - } - - public final void marshal(@NotNull BridgeContext context,T object,XMLStreamWriter output) throws JAXBException { - marshal( ((BridgeContextImpl)context).marshaller, object, output ); - } - - public abstract void marshal(@NotNull Marshaller m,T object,XMLStreamWriter output) throws JAXBException; - - - /** - * Marshals the specified type object with the implicit element name - * associated with this instance of {@link Bridge}. - * - * @param nsContext - * if this marshalling is done to marshal a subelement, this {@link NamespaceContext} - * represents in-scope namespace bindings available for that element. Can be null, - * in which case JAXB assumes no in-scope namespaces. - * @throws JAXBException - * if there was an error while marshalling. - * - * @since 2.0 EA1 - */ - public void marshal(T object,OutputStream output, NamespaceContext nsContext) throws JAXBException { - marshal(object,output,nsContext,null); - } - /** - * @since 2.0.2 - */ - public void marshal(T object,OutputStream output, NamespaceContext nsContext, AttachmentMarshaller am) throws JAXBException { - Marshaller m = context.marshallerPool.take(); - m.setAttachmentMarshaller(am); - marshal(m,object,output,nsContext); - m.setAttachmentMarshaller(null); - context.marshallerPool.recycle(m); - } - - public final void marshal(@NotNull BridgeContext context,T object,OutputStream output, NamespaceContext nsContext) throws JAXBException { - marshal( ((BridgeContextImpl)context).marshaller, object, output, nsContext ); - } - - public abstract void marshal(@NotNull Marshaller m,T object,OutputStream output, NamespaceContext nsContext) throws JAXBException; - - - public final void marshal(T object,Node output) throws JAXBException { - Marshaller m = context.marshallerPool.take(); - marshal(m,object,output); - context.marshallerPool.recycle(m); - } - - public final void marshal(@NotNull BridgeContext context,T object,Node output) throws JAXBException { - marshal( ((BridgeContextImpl)context).marshaller, object, output ); - } - - public abstract void marshal(@NotNull Marshaller m,T object,Node output) throws JAXBException; - - - /** - * @since 2.0 EA4 - */ - public final void marshal(T object, ContentHandler contentHandler) throws JAXBException { - marshal(object,contentHandler,null); - } - /** - * @since 2.0.2 - */ - public final void marshal(T object, ContentHandler contentHandler, AttachmentMarshaller am) throws JAXBException { - Marshaller m = context.marshallerPool.take(); - m.setAttachmentMarshaller(am); - marshal(m,object,contentHandler); - m.setAttachmentMarshaller(null); - context.marshallerPool.recycle(m); - } - public final void marshal(@NotNull BridgeContext context,T object, ContentHandler contentHandler) throws JAXBException { - marshal( ((BridgeContextImpl)context).marshaller, object, contentHandler ); - } - public abstract void marshal(@NotNull Marshaller m,T object, ContentHandler contentHandler) throws JAXBException; - - /** - * @since 2.0 EA4 - */ - public final void marshal(T object, Result result) throws JAXBException { - Marshaller m = context.marshallerPool.take(); - marshal(m,object,result); - context.marshallerPool.recycle(m); - } - public final void marshal(@NotNull BridgeContext context,T object, Result result) throws JAXBException { - marshal( ((BridgeContextImpl)context).marshaller, object, result ); - } - public abstract void marshal(@NotNull Marshaller m,T object, Result result) throws JAXBException; - - - - private T exit(T r, Unmarshaller u) { - u.setAttachmentUnmarshaller(null); - context.unmarshallerPool.recycle(u); - return r; - } - - /** - * Unmarshals the specified type object. - * - * @param in - * the parser must be pointing at a start tag - * that encloses the XML type that this {@link Bridge} is - * instanciated for. - * - * @return - * never null. - * - * @throws JAXBException - * if there was an error while unmarshalling. - * - * @since 2.0 EA1 - */ - public final @NotNull T unmarshal(@NotNull XMLStreamReader in) throws JAXBException { - return unmarshal(in,null); - } - /** - * @since 2.0.3 - */ - public final @NotNull T unmarshal(@NotNull XMLStreamReader in, @Nullable AttachmentUnmarshaller au) throws JAXBException { - Unmarshaller u = context.unmarshallerPool.take(); - u.setAttachmentUnmarshaller(au); - return exit(unmarshal(u,in),u); - } - public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull XMLStreamReader in) throws JAXBException { - return unmarshal( ((BridgeContextImpl)context).unmarshaller, in ); - } - public abstract @NotNull T unmarshal(@NotNull Unmarshaller u, @NotNull XMLStreamReader in) throws JAXBException; - - /** - * Unmarshals the specified type object. - * - * @param in - * the parser must be pointing at a start tag - * that encloses the XML type that this {@link Bridge} is - * instanciated for. - * - * @return - * never null. - * - * @throws JAXBException - * if there was an error while unmarshalling. - * - * @since 2.0 EA1 - */ - public final @NotNull T unmarshal(@NotNull Source in) throws JAXBException { - return unmarshal(in,null); - } - /** - * @since 2.0.3 - */ - public final @NotNull T unmarshal(@NotNull Source in, @Nullable AttachmentUnmarshaller au) throws JAXBException { - Unmarshaller u = context.unmarshallerPool.take(); - u.setAttachmentUnmarshaller(au); - return exit(unmarshal(u,in),u); - } - public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Source in) throws JAXBException { - return unmarshal( ((BridgeContextImpl)context).unmarshaller, in ); - } - public abstract @NotNull T unmarshal(@NotNull Unmarshaller u, @NotNull Source in) throws JAXBException; - - /** - * Unmarshals the specified type object. - * - * @param in - * the parser must be pointing at a start tag - * that encloses the XML type that this {@link Bridge} is - * instanciated for. - * - * @return - * never null. - * - * @throws JAXBException - * if there was an error while unmarshalling. - * - * @since 2.0 EA1 - */ - public final @NotNull T unmarshal(@NotNull InputStream in) throws JAXBException { - Unmarshaller u = context.unmarshallerPool.take(); - return exit(unmarshal(u,in),u); - } - public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull InputStream in) throws JAXBException { - return unmarshal( ((BridgeContextImpl)context).unmarshaller, in ); - } - public abstract @NotNull T unmarshal(@NotNull Unmarshaller u, @NotNull InputStream in) throws JAXBException; - - /** - * Unmarshals the specified type object. - * - * @param n - * Node to be unmarshalled. - * - * @return - * never null. - * - * @throws JAXBException - * if there was an error while unmarshalling. - * - * @since 2.0 FCS - */ - public final @NotNull T unmarshal(@NotNull Node n) throws JAXBException { - return unmarshal(n,null); - } - /** - * @since 2.0.3 - */ - public final @NotNull T unmarshal(@NotNull Node n, @Nullable AttachmentUnmarshaller au) throws JAXBException { - Unmarshaller u = context.unmarshallerPool.take(); - u.setAttachmentUnmarshaller(au); - return exit(unmarshal(u,n),u); - } - public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Node n) throws JAXBException { - return unmarshal( ((BridgeContextImpl)context).unmarshaller, n ); - } - public abstract @NotNull T unmarshal(@NotNull Unmarshaller context, @NotNull Node n) throws JAXBException; - - /** - * Gets the {@link TypeReference} from which this bridge was created. - */ - public abstract TypeReference getTypeReference(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/BridgeContext.java 2018-01-30 20:30:19.000000000 -0500 +++ /dev/null 2018-01-30 20:30:19.000000000 -0500 @@ -1,98 +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.xml.internal.bind.api; - -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.attachment.AttachmentMarshaller; -import javax.xml.bind.attachment.AttachmentUnmarshaller; - -/** - * Holds thread specific state information for {@link Bridge}s, - * to make {@link Bridge} thread-safe. - * - *

- * This object cannot be used concurrently; two threads cannot - * use the same object with {@link Bridge}s at the same time, nor - * a thread can use a {@link BridgeContext} with one {@link Bridge} while - * the same context is in use by another {@link Bridge}. - * - *

- * {@link BridgeContext} is relatively a heavy-weight object, and - * therefore it is expected to be cached by the JAX-RPC RI. - * - *

- * Subject to change without notice. - * - * @author Kohsuke Kawaguchi - * @since 2.0 EA1 - * @see Bridge - * @deprecated - * The caller no longer needs to use this, as {@link Bridge} has - * methods that can work without {@link BridgeContext}. - */ -public abstract class BridgeContext { - protected BridgeContext() {} - - /** - * Registers the error handler that receives unmarshalling/marshalling errors. - * - * @param handler - * can be null, in which case all errors will be considered fatal. - * - * @since 2.0 EA1 - */ - public abstract void setErrorHandler(ValidationEventHandler handler); - - /** - * Sets the {@link AttachmentMarshaller}. - * - * @since 2.0 EA1 - */ - public abstract void setAttachmentMarshaller(AttachmentMarshaller m); - - /** - * Sets the {@link AttachmentUnmarshaller}. - * - * @since 2.0 EA1 - */ - public abstract void setAttachmentUnmarshaller(AttachmentUnmarshaller m); - - /** - * Gets the last {@link AttachmentMarshaller} set through - * {@link AttachmentMarshaller}. - * - * @since 2.0 EA2 - */ - public abstract AttachmentMarshaller getAttachmentMarshaller(); - - /** - * Gets the last {@link AttachmentUnmarshaller} set through - * {@link AttachmentUnmarshaller}. - * - * @since 2.0 EA2 - */ - public abstract AttachmentUnmarshaller getAttachmentUnmarshaller(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/ClassResolver.java 2018-01-30 20:30:20.000000000 -0500 +++ /dev/null 2018-01-30 20:30:20.000000000 -0500 @@ -1,104 +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.xml.internal.bind.api; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.annotation.XmlAnyElement; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; - -/** - * Dynamically locates classes to represent elements discovered during the unmarshalling. - * - *

- * THIS INTERFACE IS SUBJECT TO CHANGE WITHOUT NOTICE. - * - *

Background

- *

- * {@link JAXBContext#newInstance(Class...)} requires that application informs JAXB - * about all the classes that it may see in the instance document. While this allows - * JAXB to take time to optimize the unmarshalling, it is sometimes inconvenient - * for applications. - * - *

- * This is where {@link ClassResolver} comes to resucue. - * - *

- * A {@link ClassResolver} instance can be specified on {@link Unmarshaller} via - * {@link Unmarshaller#setProperty(String, Object)} as follows: - * - *

- * unmarshaller.setProperty( ClassResolver.class.getName(), new MyClassResolverImpl() );
- * 
- * - *

- * When an {@link Unmarshaller} encounters (i) an unknown root element or (ii) unknown - * elements where unmarshaller is trying to unmarshal into {@link XmlAnyElement} with - * {@code lax=true}, unmarshaller calls {@link #resolveElementName(String, String)} - * method to see if the application may be able to supply a class that corresponds - * to that class. - * - *

- * When a {@link Class} is returned, a new {@link JAXBContext} is created with - * all the classes known to it so far, plus a new class returned. This operation - * may fail (for example because of some conflicting annotations.) This failure - * is handled just like {@link Exception}s thrown from - * {@link ClassResolver#resolveElementName(String, String)}. - * - * @author Kohsuke Kawaguchi - * @since 2.1 - */ -public abstract class ClassResolver { - /** - * JAXB calls this method when it sees an unknown element. - * - *

- * See the class javadoc for details. - * - * @param nsUri - * Namespace URI of the unknown element. Can be empty but never null. - * @param localName - * Local name of the unknown element. Never be empty nor null. - * - * @return - * If a non-null class is returned, it will be used to unmarshal this element. - * If null is returned, the resolution is assumed to be failed, and - * the unmarshaller will behave as if there was no {@link ClassResolver} - * to begin with (that is, to report it to {@link ValidationEventHandler}, - * then move on.) - * - * @throws Exception - * Throwing any {@link RuntimeException} causes the unmarshaller to stop - * immediately. The exception will be propagated up the call stack. - * Throwing any other checked {@link Exception} results in the error - * reproted to {@link ValidationEventHandler} (just like any other error - * during the unmarshalling.) - */ - public abstract @Nullable Class resolveElementName(@NotNull String nsUri, @NotNull String localName) throws Exception; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/CompositeStructure.java 2018-01-30 20:30:21.000000000 -0500 +++ /dev/null 2018-01-30 20:30:21.000000000 -0500 @@ -1,51 +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.xml.internal.bind.api; - -/** - * A JAXB Bean that works like a DOM. - * - *

- * This bean is bound to XML as a sequence of elements, where each - * element[i] is from bridges[i] (which defines the tag name and the expected type) - * and values[i] (which defines the actual value.) - * - *

- * This object allows you to treat multiple unrelated JAXB beans as a single tree. - * This in turn allows you to marshal this tree in one marshal method invocation, - * which is faster than multiple invocations of the marshal method. - * - *

- * The binding of this class is always known to {@link JAXBRIContext}, so it can be - * used without passing anything to {@link JAXBRIContext#newInstance}. - * This object can be only used for marshalling, not for unmarshalling. - * - * @author Kohsuke Kawaguchi - */ -public class CompositeStructure { - public Bridge[] bridges; - public Object[] values; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/ErrorListener.java 2018-01-30 20:30:21.000000000 -0500 +++ /dev/null 2018-01-30 20:30:22.000000000 -0500 @@ -1,56 +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.xml.internal.bind.api; - -import org.xml.sax.ErrorHandler; -import org.xml.sax.SAXParseException; - -/** - * Implemented by the driver of the compiler engine to handle - * errors found during the compiliation. - * - *

- * This class implements {@link ErrorHandler} so it can be - * passed to anywhere where {@link ErrorHandler} is expected. - * - *

- * However, to make the error handling easy (and make it work - * with visitor patterns nicely), this interface is not allowed - * to abort the processing. It merely receives errors. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * @since 2.1 EA2 - */ -public interface ErrorListener extends ErrorHandler { - void error(SAXParseException exception); - void fatalError(SAXParseException exception); - void warning(SAXParseException exception); - /** - * Used to report possibly verbose information that - * can be safely ignored. - */ - void info(SAXParseException exception); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/JAXBRIContext.java 2018-01-30 20:30:22.000000000 -0500 +++ /dev/null 2018-01-30 20:30:22.000000000 -0500 @@ -1,546 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.api; - -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.bind.annotation.XmlAttachmentRef; -import javax.xml.namespace.QName; -import javax.xml.transform.Result; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; -import com.sun.xml.internal.bind.api.impl.NameConverter; -import com.sun.xml.internal.bind.v2.ContextFactory; -import com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfoSet; -import java.util.HashMap; - -/** - * {@link JAXBContext} enhanced with JAXB RI specific functionalities. - * - *

- * Subject to change without notice. - * - * @since 2.0 EA1 - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public abstract class JAXBRIContext extends JAXBContext { - - protected JAXBRIContext() {} - - /** - * Creates a new {@link JAXBRIContext}. - * - *

- * {@link JAXBContext#newInstance(Class[]) JAXBContext.newInstance()} methods may - * return other JAXB providers that are not compatible with the JAX-RPC RI. - * This method guarantees that the JAX-WS RI will finds the JAXB RI. - * - * @param classes - * Classes to be bound. See {@link JAXBContext#newInstance(Class[])} for the meaning. - * @param typeRefs - * See {@link #TYPE_REFERENCES} for the meaning of this parameter. - * Can be null. - * @param subclassReplacements - * See {@link #SUBCLASS_REPLACEMENTS} for the meaning of this parameter. - * Can be null. - * @param defaultNamespaceRemap - * See {@link #DEFAULT_NAMESPACE_REMAP} for the meaning of this parameter. - * Can be null (and should be null for ordinary use of JAXB.) - * @param c14nSupport - * See {@link #CANONICALIZATION_SUPPORT} for the meaning of this parameter. - * @param ar - * See {@link #ANNOTATION_READER} for the meaning of this parameter. - * Can be null. - * @since JAXB 2.1 EA2 - */ - public static JAXBRIContext newInstance(@NotNull Class[] classes, - @Nullable Collection typeRefs, - @Nullable Map subclassReplacements, - @Nullable String defaultNamespaceRemap, boolean c14nSupport, - @Nullable RuntimeAnnotationReader ar) throws JAXBException { - return newInstance(classes, typeRefs, subclassReplacements, - defaultNamespaceRemap, c14nSupport, ar, false, false, false, false); - } - - /** - * Creates a new {@link JAXBRIContext}. - * - *

- * {@link JAXBContext#newInstance(Class[]) JAXBContext.newInstance()} methods may - * return other JAXB providers that are not compatible with the JAX-RPC RI. - * This method guarantees that the JAX-WS RI will finds the JAXB RI. - * - * @param classes - * Classes to be bound. See {@link JAXBContext#newInstance(Class[])} for the meaning. - * @param typeRefs - * See {@link #TYPE_REFERENCES} for the meaning of this parameter. - * Can be null. - * @param subclassReplacements - * See {@link #SUBCLASS_REPLACEMENTS} for the meaning of this parameter. - * Can be null. - * @param defaultNamespaceRemap - * See {@link #DEFAULT_NAMESPACE_REMAP} for the meaning of this parameter. - * Can be null (and should be null for ordinary use of JAXB.) - * @param c14nSupport - * See {@link #CANONICALIZATION_SUPPORT} for the meaning of this parameter. - * @param ar - * See {@link #ANNOTATION_READER} for the meaning of this parameter. - * Can be null. - * @param xmlAccessorFactorySupport - * See {@link #XMLACCESSORFACTORY_SUPPORT} for the meaning of this parameter. - * @param allNillable - * See {@link #TREAT_EVERYTHING_NILLABLE} for the meaning of this parameter. - * @param retainPropertyInfo - * See {@link #RETAIN_REFERENCE_TO_INFO} for the meaning of this parameter. - * @param supressAccessorWarnings - * See {@link #SUPRESS_ACCESSOR_WARNINGS} for the meaning of this parameter. - */ - public static JAXBRIContext newInstance(@NotNull Class[] classes, - @Nullable Collection typeRefs, - @Nullable Map subclassReplacements, - @Nullable String defaultNamespaceRemap, boolean c14nSupport, - @Nullable RuntimeAnnotationReader ar, - boolean xmlAccessorFactorySupport, - boolean allNillable, - boolean retainPropertyInfo, - boolean supressAccessorWarnings) throws JAXBException { - Map properties = new HashMap(); - if (typeRefs != null) properties.put(JAXBRIContext.TYPE_REFERENCES, typeRefs); - if (subclassReplacements != null) properties.put(JAXBRIContext.SUBCLASS_REPLACEMENTS, subclassReplacements); - if (defaultNamespaceRemap != null) properties.put(JAXBRIContext.DEFAULT_NAMESPACE_REMAP, defaultNamespaceRemap); - if (ar != null) properties.put(JAXBRIContext.ANNOTATION_READER, ar); - properties.put(JAXBRIContext.CANONICALIZATION_SUPPORT, Boolean.valueOf(c14nSupport)); - properties.put(JAXBRIContext.XMLACCESSORFACTORY_SUPPORT, Boolean.valueOf(xmlAccessorFactorySupport)); - properties.put(JAXBRIContext.TREAT_EVERYTHING_NILLABLE, Boolean.valueOf(allNillable)); - properties.put(JAXBRIContext.RETAIN_REFERENCE_TO_INFO, Boolean.valueOf(retainPropertyInfo)); - properties.put(JAXBRIContext.SUPRESS_ACCESSOR_WARNINGS, Boolean.valueOf(supressAccessorWarnings)); - return (JAXBRIContext) ContextFactory.createContext(classes, properties); - } - - /** - * @deprecated - * Compatibility with older versions. - */ - public static JAXBRIContext newInstance(@NotNull Class[] classes, - @Nullable Collection typeRefs, - @Nullable String defaultNamespaceRemap, boolean c14nSupport ) throws JAXBException { - return newInstance(classes,typeRefs, Collections.emptyMap(), - defaultNamespaceRemap,c14nSupport,null); - } - - /** - * Returns true if this context includes a class - * that has {@link XmlAttachmentRef}. - * - * @since 2.1 - */ - public abstract boolean hasSwaRef(); - - /** - * If the given object is bound to an element in XML by JAXB, - * returns the element name. - * - * @return null - * if the object is not bound to an element. - * @throws JAXBException - * if the object is not known to this context. - * - * @since 2.0 EA1 - */ - public abstract @Nullable QName getElementName(@NotNull Object o) throws JAXBException; - - /** - * Allows to retrieve the element name based on Class. - * @param o - * @return - * @throws javax.xml.bind.JAXBException - * @since 2.1.10 - */ - public abstract @Nullable QName getElementName(@NotNull Class o) throws JAXBException; - - /** - * Creates a mini-marshaller/unmarshaller that can process a {@link TypeReference}. - * - * @return - * null if the specified reference is not given to {@link JAXBRIContext#newInstance}. - * - * @since 2.0 EA1 - */ - public abstract Bridge createBridge(@NotNull TypeReference ref); - - /** - * Creates a new {@link BridgeContext} instance. - * - * @return - * always a valid non-null instance. - * - * @since 2.0 EA1 - */ - public abstract @NotNull BridgeContext createBridgeContext(); - - /** - * Gets a {@link RawAccessor} for the specified element property of the specified wrapper bean class. - * - *

- * This method is designed to assist the JAX-RPC RI fill in a wrapper bean (in the doc/lit/wrap mode.) - * In the said mode, a wrapper bean is supposed to only have properties that match elements, - * and for each element that appear in the content model there's one property. - * - *

- * Therefore, this method takes a wrapper bean and a tag name that identifies a property - * on the given wrapper bean, then returns a {@link RawAccessor} that allows the caller - * to set/get a value from the property of the bean. - * - *

- * This method is not designed for a performance. The caller is expected to cache the result. - * - * @param - * type of the wrapper bean - * @param - * type of the property of the bean - * @return - * always return non-null valid accessor object. - * @throws JAXBException - * if the specified wrapper bean is not bound by JAXB, or if it doesn't have an element property - * of the given name. - * - * @since 2.0 EA1 - */ - public abstract RawAccessor getElementPropertyAccessor( Class wrapperBean, String nsUri, String localName ) - throws JAXBException; - - /** - * Gets the namespace URIs statically known to this {@link JAXBContext}. - * - *

- * When JAXB is used to marshal into sub-trees, it declares - * these namespace URIs at each top-level element that it marshals. - * - * To avoid repeated namespace declarations at sub-elements, the application - * may declare those namespaces at a higher level. - * - * @return - * always non-null. - * - * @since 2.0 EA2 - */ - public abstract @NotNull List getKnownNamespaceURIs(); - - - /** - * Generates the schema documents from the model. - * - *

- * The caller can use the additionalElementDecls parameter to - * add element declarations to the generate schema. - * For example, if the JAX-RPC passes in the following entry: - * - * {@code {foo}bar -> DeclaredType for java.lang.String} - * - * then JAXB generates the following element declaration (in the schema - * document for the namespace "foo")" - * - * {@code } - * - * This can be used for generating schema components necessary for WSDL. - * - * @param outputResolver - * this object controls the output to which schemas - * will be sent. - * - * @throws IOException - * if {@link SchemaOutputResolver} throws an {@link IOException}. - */ - @Override - public abstract void generateSchema(@NotNull SchemaOutputResolver outputResolver) throws IOException; - - /** - * Returns the name of the XML Type bound to the - * specified Java type. - * - * @param tr - * must not be null. This must be one of the {@link TypeReference}s specified - * in the {@link JAXBRIContext#newInstance} method. - * - * @throws IllegalArgumentException - * if the parameter is null or not a part of the {@link TypeReference}s specified - * in the {@link JAXBRIContext#newInstance} method. - * - * @return null - * if the referenced type is an anonymous and therefore doesn't have a name. - */ - public abstract QName getTypeName(@NotNull TypeReference tr); - - /** - * Gets the build information of the JAXB runtime. - * - * @return - * may be null, if the runtime is loaded by a class loader that doesn't support - * the access to the manifest informatino. - */ - public abstract @NotNull String getBuildId(); - - /** - * Generates the episode file that represents the binding known to this {@link JAXBContext}, - * so that XJC can later do separate compilation. - * - *

- * Episode file is really just a JAXB customization file, except that currently - * we use the RI-specific SCD to refer to schema components. - * - * @param output - * This receives the generated episode file. - * - * @since 2.1 - */ - public abstract void generateEpisode(Result output); - - /** - * Allows you to access the runtime model information of the JAXB XML/Java binding. - * - *

- * This is useful for doing a deeper integration with the JAXB RI. - * For more information about the model, see https://jaxb2-reflection.dev.java.net/ - * - * @since 2.1.10 - */ - public abstract RuntimeTypeInfoSet getRuntimeTypeInfoSet(); - - /** - * Computes a Java identifier from a local name. - * - *

- * This method faithfully implements the name mangling rule as specified in the JAXB spec. - * - *

- * In JAXB, a collision with a Java reserved word (such as "return") never happens. - * Accordingly, this method may return an identifier that collides with reserved words. - * - *

- * Use {@code JJavaName.isJavaIdentifier(String)} to check for such collision. - * - * @return - * Typically, this method returns "nameLikeThis". - */ - public static @NotNull String mangleNameToVariableName(@NotNull String localName) { - return NameConverter.standard.toVariableName(localName); - } - - /** - * Computes a Java class name from a local name. - * - *

- * This method faithfully implements the name mangling rule as specified in the JAXB spec. - * - * @return - * Typically, this method returns "NameLikeThis". - */ - public static @NotNull String mangleNameToClassName(@NotNull String localName) { - return NameConverter.standard.toClassName(localName); - } - - /** - * Computes a Java class name from a local name. - * - *

- * This method faithfully implements the name mangling rule as specified in the JAXB spec. - * This method works like {@link #mangleNameToClassName(String)} except that it looks - * for "getClass" and returns something else. - * - * @return - * Typically, this method returns "NameLikeThis". - */ - public static @NotNull String mangleNameToPropertyName(@NotNull String localName) { - return NameConverter.standard.toPropertyName(localName); - } - - /** - * Gets the parameterization of the given base type. - * - *

- * For example, given the following - *

{@code
-     * interface Foo extends List> {}
-     * interface Bar extends Foo {}
-     * }
- * This method works like this: - *
{@code
-     * getBaseClass( Bar, List ) = List
-     * getBaseClass( Bar, Foo  ) = Foo
-     * getBaseClass( Foo, Collection ) = Collection>
-     * getBaseClass( ArrayList, List ) = List
-     * }
- * - * @param type - * The type that derives from {@code baseType} - * @param baseType - * The class whose parameterization we are interested in. - * @return - * The use of {@code baseType} in {@code type}. - * or null if the type is not assignable to the base type. - * @since 2.0 FCS - */ - public static @Nullable Type getBaseType(@NotNull Type type, @NotNull Class baseType) { - return Utils.REFLECTION_NAVIGATOR.getBaseClass(type, baseType); - } - - /** - * The property that you can specify to {@link JAXBContext#newInstance} - * to reassign the default namespace URI to something else at the runtime. - * - *

- * The value of the property is {@link String}, and it is used as the namespace URI - * that succeeds the default namespace URI. - * - * @since 2.0 EA1 - */ - public static final String DEFAULT_NAMESPACE_REMAP = "com.sun.xml.internal.bind.defaultNamespaceRemap"; - - /** - * The property that you can specify to {@link JAXBContext#newInstance} - * to put additional JAXB type references into the {@link JAXBContext}. - * - *

- * The value of the property is {@link Collection}{@code <}{@link TypeReference}{@code >}. - * Those {@link TypeReference}s can then be used to create {@link Bridge}s. - * - *

- * This mechanism allows additional element declarations that were not a part of - * the schema into the created {@link JAXBContext}. - * - * @since 2.0 EA1 - */ - public static final String TYPE_REFERENCES = "com.sun.xml.internal.bind.typeReferences"; - - /** - * The property that you can specify to {@link JAXBContext#newInstance} - * and {@link Marshaller#setProperty(String, Object)} - * to enable the c14n marshalling support in the {@link JAXBContext}. - * - * Boolean - * @since 2.0 EA2 - */ - public static final String CANONICALIZATION_SUPPORT = "com.sun.xml.internal.bind.c14n"; - - /** - * The property that you can specify to {@link JAXBContext#newInstance} - * to allow unmarshaller to honor {@code xsi:nil} anywhere, even if they are - * not specifically allowed by the schema. - * - * Boolean - * @since 2.1.3 - */ - public static final String TREAT_EVERYTHING_NILLABLE = "com.sun.xml.internal.bind.treatEverythingNillable"; - - /** - * The property that you can specify to {@link JAXBContext#newInstance} - * to use alternative {@link RuntimeAnnotationReader} implementation. - * - * @since 2.1 EA2 - */ - public static final String ANNOTATION_READER = RuntimeAnnotationReader.class.getName(); - - /** - * Marshaller/Unmarshaller property to enable XOP processing. - * - * @since 2.0 EA2 - */ - public static final String ENABLE_XOP = "com.sun.xml.internal.bind.XOP"; - - /** - * The property that you can specify to {@link JAXBContext#newInstance} - * to specify specific classes that replace the reference to generic classes. - * - *

- * See the release notes for more details about this feature. - * - * @since 2.1 EA2 - */ - public static final String SUBCLASS_REPLACEMENTS = "com.sun.xml.internal.bind.subclassReplacements"; - - /** - * The property that you can specify to {@link JAXBContext#newInstance} - * enable support of XmlAccessorFactory annotation in the {@link JAXBContext}. - * - * @since 2.1 EA2 - */ - public static final String XMLACCESSORFACTORY_SUPPORT = "com.sun.xml.internal.bind.XmlAccessorFactory"; - - /** - * Retains references to PropertyInfos. - * - * Boolean - * @since 2.1.10 - */ - public static final String RETAIN_REFERENCE_TO_INFO = "retainReferenceToInfo"; - - /** - * Supress security warnings when trying to access fields through reflection. - * - * Boolean - * @since 2.1.14, 2.2.2 - */ - public static final String SUPRESS_ACCESSOR_WARNINGS = "supressAccessorWarnings"; - - /** - * Improves handling of xsi:type used on leaf properties. - * - * Boolean - * @since 2.2.3 - */ - public static final String IMPROVED_XSI_TYPE_HANDLING = "com.sun.xml.internal.bind.improvedXsiTypeHandling"; - - /** - * If true XML security features when parsing XML documents will be disabled. - * The default value is false. - * - * Boolean - * @since 2.2.6 - */ - public static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.bind.disableXmlSecurity"; - - /** - * If true and element namespace is not specified, namespace of parent element will be used. - * The default value is false. - * - * Boolean - * @since 2.3.0 - */ - public static final String BACKUP_WITH_PARENT_NAMESPACE = "com.sun.xml.internal.bind.backupWithParentNamespace"; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages.java 2018-01-30 20:30:23.000000000 -0500 +++ /dev/null 2018-01-30 20:30:23.000000000 -0500 @@ -1,52 +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.xml.internal.bind.api; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Formats error messages. - * - * @since JAXB 2.1.10 - */ - -enum Messages { - // TypeReference - ARGUMENT_CANT_BE_NULL - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - @Override - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages.properties 2018-01-30 20:30:24.000000000 -0500 +++ /dev/null 2018-01-30 20:30:24.000000000 -0500 @@ -1,27 +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. -# - -ARGUMENT_CANT_BE_NULL = \ - Argument(s) "{0}" can''t be null. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages_de.properties 2018-01-30 20:30:25.000000000 -0500 +++ /dev/null 2018-01-30 20:30:25.000000000 -0500 @@ -1,26 +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. -# - -ARGUMENT_CANT_BE_NULL = Argumente "{0}" m\u00FCssen angegeben werden. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages_es.properties 2018-01-30 20:30:26.000000000 -0500 +++ /dev/null 2018-01-30 20:30:26.000000000 -0500 @@ -1,26 +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. -# - -ARGUMENT_CANT_BE_NULL = Los argumentos"{0}" no pueden ser nulos. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages_fr.properties 2018-01-30 20:30:26.000000000 -0500 +++ /dev/null 2018-01-30 20:30:26.000000000 -0500 @@ -1,26 +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. -# - -ARGUMENT_CANT_BE_NULL = Les arguments "{0}" ne peuvent pas \u00EAtre NULL. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages_it.properties 2018-01-30 20:30:27.000000000 -0500 +++ /dev/null 2018-01-30 20:30:27.000000000 -0500 @@ -1,26 +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. -# - -ARGUMENT_CANT_BE_NULL = L''argomento o gli argomenti {0} non possono essere nulli. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages_ja.properties 2018-01-30 20:30:28.000000000 -0500 +++ /dev/null 2018-01-30 20:30:28.000000000 -0500 @@ -1,26 +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. -# - -ARGUMENT_CANT_BE_NULL = \u5F15\u6570"{0}"\u306Fnull\u306B\u3067\u304D\u307E\u305B\u3093\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages_ko.properties 2018-01-30 20:30:28.000000000 -0500 +++ /dev/null 2018-01-30 20:30:28.000000000 -0500 @@ -1,26 +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. -# - -ARGUMENT_CANT_BE_NULL = "{0}" \uC778\uC218\uB294 \uB110\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages_pt_BR.properties 2018-01-30 20:30:29.000000000 -0500 +++ /dev/null 2018-01-30 20:30:29.000000000 -0500 @@ -1,26 +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. -# - -ARGUMENT_CANT_BE_NULL = Argumento(s) "{0}" n\u00E3o pode(m) ser nulo(s). --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages_zh_CN.properties 2018-01-30 20:30:30.000000000 -0500 +++ /dev/null 2018-01-30 20:30:30.000000000 -0500 @@ -1,26 +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. -# - -ARGUMENT_CANT_BE_NULL = \u53C2\u6570 "{0}" \u4E0D\u80FD\u4E3A\u7A7A\u503C\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Messages_zh_TW.properties 2018-01-30 20:30:31.000000000 -0500 +++ /dev/null 2018-01-30 20:30:31.000000000 -0500 @@ -1,26 +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. -# - -ARGUMENT_CANT_BE_NULL = \u5F15\u6578 "{0}" \u4E0D\u53EF\u70BA\u7A7A\u503C. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/RawAccessor.java 2018-01-30 20:30:31.000000000 -0500 +++ /dev/null 2018-01-30 20:30:31.000000000 -0500 @@ -1,73 +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.xml.internal.bind.api; - - - -/** - * Accesses a particular property of a bean. - * - *

- * This interface allows JAX-RPC to access an element property of a JAXB bean. - * - *

- * Subject to change without notice. - * - * @author Kohsuke Kawaguchi - * - * @since 2.0 EA1 - */ -public abstract class RawAccessor { - - /** - * Gets the value of the property of the given bean object. - * - * @param bean - * must not be null. - * @throws AccessorException - * if failed to set a value. For example, the getter method - * may throw an exception. - * - * @since 2.0 EA1 - */ - public abstract V get(B bean) throws AccessorException; - - /** - * Sets the value of the property of the given bean object. - * - * @param bean - * must not be null. - * @param value - * the value to be set. Setting value to null means resetting - * to the VM default value (even for primitive properties.) - * @throws AccessorException - * if failed to set a value. For example, the setter method - * may throw an exception. - * - * @since 2.0 EA1 - */ - public abstract void set(B bean,V value) throws AccessorException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/TypeReference.java 2018-01-30 20:30:32.000000000 -0500 +++ /dev/null 2018-01-30 20:30:32.000000000 -0500 @@ -1,134 +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.bind.api; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.Collection; - -import javax.xml.namespace.QName; - -/** - * A reference to a JAXB-bound type. - * - *

- * Subject to change without notice. - * - * @since 2.0 EA1 - * @author Kohsuke Kawaguchi - */ -public final class TypeReference { - - /** - * The associated XML element name that the JAX-RPC uses with this type reference. - * - * Always non-null. Strings are interned. - */ - public final QName tagName; - - /** - * The Java type that's being referenced. - * - * Always non-null. - */ - public final Type type; - - /** - * The annotations associated with the reference of this type. - * - * Always non-null. - */ - public final Annotation[] annotations; - - public TypeReference(QName tagName, Type type, Annotation... annotations) { - if(tagName==null || type==null || annotations==null) { - String nullArgs = ""; - - if(tagName == null) nullArgs = "tagName"; - if(type == null) nullArgs += (nullArgs.length() > 0 ? ", type" : "type"); - if(annotations == null) nullArgs += (nullArgs.length() > 0 ? ", annotations" : "annotations"); - - Messages.ARGUMENT_CANT_BE_NULL.format(nullArgs); - - throw new IllegalArgumentException(Messages.ARGUMENT_CANT_BE_NULL.format(nullArgs)); - } - - this.tagName = new QName(tagName.getNamespaceURI().intern(), tagName.getLocalPart().intern(), tagName.getPrefix()); - this.type = type; - this.annotations = annotations; - } - - /** - * Finds the specified annotation from the array and returns it. - * Null if not found. - */ - public A get( Class annotationType ) { - for (Annotation a : annotations) { - if(a.annotationType()==annotationType) - return annotationType.cast(a); - } - return null; - } - - /** - * Creates a {@link TypeReference} for the item type, - * if this {@link TypeReference} represents a collection type. - * Otherwise returns an identical type. - */ - public TypeReference toItemType() { - // if we are to reinstitute this check, check JAXB annotations only - // assert annotations.length==0; // not designed to work with adapters. - - Type base = Utils.REFLECTION_NAVIGATOR.getBaseClass(type, Collection.class); - if(base==null) - return this; // not a collection - - return new TypeReference(tagName, Utils.REFLECTION_NAVIGATOR.getTypeArgument(base,0)); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - TypeReference that = (TypeReference) o; - - if (!Arrays.equals(annotations, that.annotations)) return false; - if (!tagName.equals(that.tagName)) return false; - if (!type.equals(that.type)) return false; - - return true; - } - - @Override - public int hashCode() { - int result = tagName.hashCode(); - result = 31 * result + type.hashCode(); - result = 31 * result + Arrays.hashCode(annotations); - return result; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/Utils.java 2018-01-30 20:30:33.000000000 -0500 +++ /dev/null 2018-01-30 20:30:33.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, 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.bind.api; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Utils class. - * - * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. - * - * Has *package private* access to avoid inappropriate usage. - */ -final class Utils { - - private static final Logger LOGGER = Logger.getLogger(Utils.class.getName()); - - /** - * static ReflectionNavigator field to avoid usage of reflection every time we use it. - */ - static final Navigator REFLECTION_NAVIGATOR; - - static { // we statically initializing REFLECTION_NAVIGATOR property - try { - final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - - // requires accessClassInPackage privilege - final Method getInstance = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Method run() { - try { - Method getInstance = refNav.getDeclaredMethod("getInstance"); - getInstance.setAccessible(true); - return getInstance; - } catch (NoSuchMethodException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); - } - } - } - ); - - //noinspection unchecked - REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); - } catch (ClassNotFoundException e) { - throw new IllegalStateException("Can't find ReflectionNavigator class"); - } catch (InvocationTargetException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (IllegalAccessException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); - } catch (SecurityException e) { - LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); - throw e; - } - } - - /** - * private constructor to avoid util class instantiating - */ - private Utils() { - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/impl/NameConverter.java 2018-01-30 20:30:34.000000000 -0500 +++ /dev/null 2018-01-30 20:30:34.000000000 -0500 @@ -1,269 +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.bind.api.impl; - -import javax.lang.model.SourceVersion; -import java.util.ArrayList; -import java.util.List; -import java.util.StringTokenizer; - -/** - * Converts aribitrary strings into Java identifiers. - * - * @author - * Kohsuke KAWAGUCHI - */ -public interface NameConverter -{ - /** - * converts a string into an identifier suitable for classes. - * - * In general, this operation should generate "NamesLikeThis". - */ - String toClassName( String token ); - - /** - * converts a string into an identifier suitable for interfaces. - * - * In general, this operation should generate "NamesLikeThis". - * But for example, it can prepend every interface with 'I'. - */ - String toInterfaceName( String token ); - - /** - * converts a string into an identifier suitable for properties. - * - * In general, this operation should generate "NamesLikeThis", - * which will be used with known prefixes like "get" or "set". - */ - String toPropertyName( String token ); - - /** - * converts a string into an identifier suitable for constants. - * - * In the standard Java naming convention, this operation should - * generate "NAMES_LIKE_THIS". - */ - String toConstantName( String token ); - - /** - * Converts a string into an identifier suitable for variables. - * - * In general it should generate "namesLikeThis". - */ - String toVariableName( String token ); - - /** - * Converts a namespace URI into a package name. - * This method should expect strings like - * "http://foo.bar.zot/org", "urn:abc:def:ghi" "", or even "###" - * (basically anything) and expected to return a package name, - * liks "org.acme.foo". - * - */ - String toPackageName( String namespaceUri ); - - /** - * The name converter implemented by Code Model. - * - * This is the standard name conversion for JAXB. - */ - public static final NameConverter standard = new Standard(); - - static class Standard extends NameUtil implements NameConverter { - public String toClassName(String s) { - return toMixedCaseName(toWordList(s), true); - } - public String toVariableName(String s) { - return toMixedCaseName(toWordList(s), false); - } - public String toInterfaceName( String token ) { - return toClassName(token); - } - public String toPropertyName(String s) { - String prop = toClassName(s); - // property name "Class" with collide with Object.getClass, - // so escape this. - if(prop.equals("Class")) - prop = "Clazz"; - return prop; - } - public String toConstantName( String token ) { - return super.toConstantName(token); - } - /** - * Computes a Java package name from a namespace URI, - * as specified in the spec. - * - * @return - * null if it fails to derive a package name. - */ - public String toPackageName( String nsUri ) { - // remove scheme and :, if present - // spec only requires us to remove 'http' and 'urn'... - int idx = nsUri.indexOf(':'); - String scheme = ""; - if(idx>=0) { - scheme = nsUri.substring(0,idx); - if( scheme.equalsIgnoreCase("http") || scheme.equalsIgnoreCase("urn") ) - nsUri = nsUri.substring(idx+1); - } - - // tokenize string - ArrayList tokens = tokenize( nsUri, "/: " ); - if( tokens.size() == 0 ) { - return null; - } - - // remove trailing file type, if necessary - if( tokens.size() > 1 ) { - // for uri's like "www.foo.com" and "foo.com", there is no trailing - // file, so there's no need to look at the last '.' and substring - // otherwise, we loose the "com" (which would be wrong) - String lastToken = tokens.get( tokens.size()-1 ); - idx = lastToken.lastIndexOf( '.' ); - if( idx > 0 ) { - lastToken = lastToken.substring( 0, idx ); - tokens.set( tokens.size()-1, lastToken ); - } - } - - // tokenize domain name and reverse. Also remove :port if it exists - String domain = tokens.get( 0 ); - idx = domain.indexOf(':'); - if( idx >= 0) domain = domain.substring(0, idx); - ArrayList r = reverse( tokenize( domain, scheme.equals("urn")?".-":"." ) ); - if( r.get( r.size()-1 ).equalsIgnoreCase( "www" ) ) { - // remove leading www - r.remove( r.size()-1 ); - } - - // replace the domain name with tokenized items - tokens.addAll( 1, r ); - tokens.remove( 0 ); - - // iterate through the tokens and apply xml->java name algorithm - for( int i = 0; i < tokens.size(); i++ ) { - - // get the token and remove illegal chars - String token = tokens.get( i ); - token = removeIllegalIdentifierChars( token ); - - // this will check for reserved keywords - if (SourceVersion.isKeyword(token.toLowerCase())) { - token = '_' + token; - } - - tokens.set( i, token.toLowerCase() ); - } - - // concat all the pieces and return it - return combine( tokens, '.' ); - } - - - private static String removeIllegalIdentifierChars(String token) { - StringBuilder newToken = new StringBuilder(token.length() + 1); // max expected length - for( int i = 0; i < token.length(); i++ ) { - char c = token.charAt( i ); - if (i == 0 && !Character.isJavaIdentifierStart(c)) { // c can't be used as FIRST char - newToken.append('_'); - } - if (!Character.isJavaIdentifierPart(c)) { // c can't be used - newToken.append('_'); - } else { - newToken.append(c); // c is valid - } - } - return newToken.toString(); - } - - - private static ArrayList tokenize( String str, String sep ) { - StringTokenizer tokens = new StringTokenizer(str,sep); - ArrayList r = new ArrayList(); - - while(tokens.hasMoreTokens()) - r.add( tokens.nextToken() ); - - return r; - } - - private static ArrayList reverse( List a ) { - ArrayList r = new ArrayList(); - - for( int i=a.size()-1; i>=0; i-- ) - r.add( a.get(i) ); - - return r; - } - - private static String combine( List r, char sep ) { - StringBuilder buf = new StringBuilder(r.get(0).toString()); - - for( int i=1; i - * What JAX-RPC name binding tells us is that even such basic method - * like "isLetter" can be different depending on the situation. - * - * For this reason, a whole lot of methods are made non-static, - * even though they look like they should be static. - */ -class NameUtil { - protected boolean isPunct(char c) { - return c == '-' || c == '.' || c == ':' || c == '_' || c == '\u00b7' || c == '\u0387' || c == '\u06dd' || c == '\u06de'; - } - - protected static boolean isDigit(char c) { - return c >= '0' && c <= '9' || Character.isDigit(c); - } - - protected static boolean isUpper(char c) { - return c >= 'A' && c <= 'Z' || Character.isUpperCase(c); - } - - protected static boolean isLower(char c) { - return c >= 'a' && c <= 'z' || Character.isLowerCase(c); - } - - protected boolean isLetter(char c) { - return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z' || Character.isLetter(c); - } - - private String toLowerCase(String s) - { - return s.toLowerCase(Locale.ENGLISH); - } - - private String toUpperCase(char c) - { - return String.valueOf(c).toUpperCase(Locale.ENGLISH); - } - - private String toUpperCase(String s) - { - return s.toUpperCase(Locale.ENGLISH); - } - - /** - * Capitalizes the first character of the specified string, - * and de-capitalize the rest of characters. - */ - public String capitalize(String s) { - if (!isLower(s.charAt(0))) - return s; - StringBuilder sb = new StringBuilder(s.length()); - sb.append(toUpperCase(s.charAt(0))); - sb.append(toLowerCase(s.substring(1))); - return sb.toString(); - } - - // Precondition: s[start] is not punctuation - private int nextBreak(String s, int start) { - int n = s.length(); - - char c1 = s.charAt(start); - int t1 = classify(c1); - - for (int i=start+1; i - * This method uses a change in character type as a splitter - * of two words. For example, "abc100ghi" will be splitted into - * {"Abc", "100","Ghi"}. - */ - public List toWordList(String s) { - ArrayList ss = new ArrayList(); - int n = s.length(); - for (int i = 0; i < n;) { - - // Skip punctuation - while (i < n) { - if (!isPunct(s.charAt(i))) - break; - i++; - } - if (i >= n) break; - - // Find next break and collect word - int b = nextBreak(s, i); - String w = (b == -1) ? s.substring(i) : s.substring(i, b); - ss.add(escape(capitalize(w))); - if (b == -1) break; - i = b; - } - -// we can't guarantee a valid Java identifier anyway, -// so there's not much point in rejecting things in this way. -// if (ss.size() == 0) -// throw new IllegalArgumentException("Zero-length identifier"); - return ss; - } - - protected String toMixedCaseName(List ss, boolean startUpper) { - StringBuilder sb = new StringBuilder(); - if(!ss.isEmpty()) { - sb.append(startUpper ? ss.get(0) : toLowerCase(ss.get(0))); - for (int i = 1; i < ss.size(); i++) - sb.append(ss.get(i)); - } - return sb.toString(); - } - - protected String toMixedCaseVariableName(String[] ss, - boolean startUpper, - boolean cdrUpper) { - if (cdrUpper) - for (int i = 1; i < ss.length; i++) - ss[i] = capitalize(ss[i]); - StringBuilder sb = new StringBuilder(); - if( ss.length>0 ) { - sb.append(startUpper ? ss[0] : toLowerCase(ss[0])); - for (int i = 1; i < ss.length; i++) - sb.append(ss[i]); - } - return sb.toString(); - } - - - /** - * Formats a string into "THIS_KIND_OF_FORMAT_ABC_DEF". - * - * @return - * Always return a string but there's no guarantee that - * the generated code is a valid Java identifier. - */ - public String toConstantName(String s) { - return toConstantName(toWordList(s)); - } - - /** - * Formats a string into "THIS_KIND_OF_FORMAT_ABC_DEF". - * - * @return - * Always return a string but there's no guarantee that - * the generated code is a valid Java identifier. - */ - public String toConstantName(List ss) { - StringBuilder sb = new StringBuilder(); - if( !ss.isEmpty() ) { - sb.append(toUpperCase(ss.get(0))); - for (int i = 1; i < ss.size(); i++) { - sb.append('_'); - sb.append(toUpperCase(ss.get(i))); - } - } - return sb.toString(); - } - - - - /** - * Escapes characters is the given string so that they can be - * printed by only using US-ASCII characters. - * - * The escaped characters will be appended to the given - * StringBuffer. - * - * @param sb - * StringBuffer that receives escaped string. - * @param s - * String to be escaped. s.substring(start) - * will be escaped and copied to the string buffer. - */ - public static void escape(StringBuilder sb, String s, int start) { - int n = s.length(); - for (int i = start; i < n; i++) { - char c = s.charAt(i); - if (Character.isJavaIdentifierPart(c)) - sb.append(c); - else { - sb.append('_'); - if (c <= '\u000f') sb.append("000"); - else if (c <= '\u00ff') sb.append("00"); - else if (c <= '\u0fff') sb.append('0'); - sb.append(Integer.toString(c, 16)); - } - } - } - - /** - * Escapes characters that are unusable as Java identifiers - * by replacing unsafe characters with safe characters. - */ - private static String escape(String s) { - int n = s.length(); - for (int i = 0; i < n; i++) - if (!Character.isJavaIdentifierPart(s.charAt(i))) { - StringBuilder sb = new StringBuilder(s.substring(0, i)); - escape(sb, s, i); - return sb.toString(); - } - return s; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/api/package-info.java 2018-01-30 20:30:35.000000000 -0500 +++ /dev/null 2018-01-30 20:30:35.000000000 -0500 @@ -1,40 +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. - */ - -/** - *

Runtime API for the JAX-WS RI

. - * - * This API is designed for the use by the JAX-WS RI runtime. The API is is subject to - * change without notice. - * - *

- * In an container environment, such as in J2SE/J2EE, if a new version with - * a modified runtime API is loaded into a child class loader, it will still be bound - * against the old runtime API in the base class loader. - * - *

- * So the compatibility of this API has to be managed carefully. - */ -package com.sun.xml.internal.bind.api; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/CharacterEscapeHandler.java 2018-01-30 20:30:36.000000000 -0500 +++ /dev/null 2018-01-30 20:30:36.000000000 -0500 @@ -1,49 +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.xml.internal.bind.marshaller; - -import java.io.IOException; -import java.io.Writer; - -/** - * Performs character escaping and write the result - * to the output. - * - * @since 1.0.1 - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public interface CharacterEscapeHandler { - - /** - * @param ch The array of characters. - * @param start The starting position. - * @param length The number of characters to use. - * @param isAttVal true if this is an attribute value literal. - */ - void escape( char[] ch, int start, int length, boolean isAttVal, Writer out ) throws IOException; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/DataWriter.java 2018-01-30 20:30:37.000000000 -0500 +++ /dev/null 2018-01-30 20:30:37.000000000 -0500 @@ -1,377 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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. - */ - -//@@3RD PARTY CODE@@ - -// DataWriter.java - XML writer for data-oriented files. - -package com.sun.xml.internal.bind.marshaller; - -import java.io.IOException; -import java.io.Writer; -import java.util.Stack; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - - -/** - * Write data- or field-oriented XML. - * - *

This filter pretty-prints field-oriented XML without mixed content. - * all added indentation and newlines will be passed on down - * the filter chain (if any).

- * - *

In general, all whitespace in an XML document is potentially - * significant, so a general-purpose XML writing tool like the - * {@link XMLWriter} class cannot - * add newlines or indentation.

- * - *

There is, however, a large class of XML documents where information - * is strictly fielded: each element contains either character data - * or other elements, but not both. For this special case, it is possible - * for a writing tool to provide automatic indentation and newlines - * without requiring extra work from the user. Note that this class - * will likely not yield appropriate results for document-oriented - * XML like XHTML pages, which mix character data and elements together.

- * - *

This writer will automatically place each start tag on a new line, - * optionally indented if an indent step is provided (by default, there - * is no indentation). If an element contains other elements, the end - * tag will also appear on a new line with leading indentation. Consider, - * for example, the following code:

- * - *
- * DataWriter w = new DataWriter();
- *
- * w.setIndentStep(2);
- * w.startDocument();
- * w.startElement("Person");
- * w.dataElement("name", "Jane Smith");
- * w.dataElement("date-of-birth", "1965-05-23");
- * w.dataElement("citizenship", "US");
- * w.endElement("Person");
- * w.endDocument();
- * 
- * - *

This code will produce the following document:

- * - *
{@code
- * 
- *
- * 
- *   Jane Smith
- *   1965-05-23
- *   US
- * 
- * }
- * - *

This class inherits from {@link XMLWriter}, - * and provides all of the same support for Namespaces.

- * - * @since 1.0 - * @author David Megginson, david@megginson.com - * @version 0.2 - * @see XMLWriter - */ -public class DataWriter extends XMLWriter -{ - - - - //////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////// - - - /** - * Create a new data writer for the specified output. - * - * @param writer The character stream where the XML document - * will be written. - * @param encoding - * If non-null string is specified, it is written as a part - * of the XML declaration. - */ - public DataWriter ( Writer writer, String encoding, CharacterEscapeHandler _escapeHandler ) - { - super(writer,encoding,_escapeHandler); - } - - - public DataWriter (Writer writer, String encoding ) { - this( writer, encoding, DumbEscapeHandler.theInstance ); - } - - - - //////////////////////////////////////////////////////////////////// - // Accessors and setters. - //////////////////////////////////////////////////////////////////// - - - /** - * Return the current indent step. - * - *

Return the current indent step: each start tag will be - * indented by this number of spaces times the number of - * ancestors that the element has.

- * - * @return The number of spaces in each indentation step, - * or 0 or less for no indentation. - * @see #setIndentStep(int) - * - * @deprecated - * Only return the length of the indent string. - */ - public int getIndentStep () - { - return indentStep.length(); - } - - - /** - * Set the current indent step. - * - * @param indentStep The new indent step (0 or less for no - * indentation). - * @see #getIndentStep() - * - * @deprecated - * Should use the version that takes string. - */ - public void setIndentStep (int indentStep) - { - StringBuilder buf = new StringBuilder(); - for( ; indentStep>0; indentStep-- ) - buf.append(' '); - setIndentStep(buf.toString()); - } - - public void setIndentStep(String s) { - this.indentStep = s; - } - - - - //////////////////////////////////////////////////////////////////// - // Override methods from XMLWriter. - //////////////////////////////////////////////////////////////////// - - - /** - * Reset the writer so that it can be reused. - * - *

This method is especially useful if the writer failed - * with an exception the last time through.

- * - * @see XMLWriter#reset() - */ - public void reset () - { - depth = 0; - state = SEEN_NOTHING; - stateStack = new Stack(); - super.reset(); - } - - protected void writeXmlDecl(String decl) throws IOException { - super.writeXmlDecl(decl); - write('\n'); - } - - - /** - * Write a start tag. - * - *

Each tag will begin on a new line, and will be - * indented by the current indent step times the number - * of ancestors that the element has.

- * - *

The newline and indentation will be passed on down - * the filter chain through regular characters events.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param qName The element's qualified (prefixed) name. - * @param atts The element's attribute list. - * @exception org.xml.sax.SAXException If there is an error - * writing the start tag, or if a filter further - * down the chain raises an exception. - * @see XMLWriter#startElement(String, String, String, Attributes) - */ - public void startElement (String uri, String localName, - String qName, Attributes atts) - throws SAXException - { - stateStack.push(SEEN_ELEMENT); - state = SEEN_NOTHING; - if (depth > 0) { - super.characters("\n"); - } - doIndent(); - super.startElement(uri, localName, qName, atts); - depth++; - } - - - /** - * Write an end tag. - * - *

If the element has contained other elements, the tag - * will appear indented on a new line; otherwise, it will - * appear immediately following whatever came before.

- * - *

The newline and indentation will be passed on down - * the filter chain through regular characters events.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param qName The element's qualified (prefixed) name. - * @exception org.xml.sax.SAXException If there is an error - * writing the end tag, or if a filter further - * down the chain raises an exception. - * @see XMLWriter#endElement(String, String, String) - */ - public void endElement (String uri, String localName, String qName) - throws SAXException - { - depth--; - if (state == SEEN_ELEMENT) { - super.characters("\n"); - doIndent(); - } - super.endElement(uri, localName, qName); - state = stateStack.pop(); - } - - public void endDocument() throws SAXException { - try { - write('\n'); - } catch( IOException e ) { - throw new SAXException(e); - } - super.endDocument(); - } - -// /** -// * Write a empty element tag. -// * -// *

Each tag will appear on a new line, and will be -// * indented by the current indent step times the number -// * of ancestors that the element has.

-// * -// *

The newline and indentation will be passed on down -// * the filter chain through regular characters events.

-// * -// * @param uri The element's Namespace URI. -// * @param localName The element's local name. -// * @param qName The element's qualified (prefixed) name. -// * @param atts The element's attribute list. -// * @exception org.xml.sax.SAXException If there is an error -// * writing the empty tag, or if a filter further -// * down the chain raises an exception. -// * @see XMLWriter#emptyElement(String, String, String, Attributes) -// */ -// public void emptyElement (String uri, String localName, -// String qName, Attributes atts) -// throws SAXException -// { -// state = SEEN_ELEMENT; -// if (depth > 0) { -// super.characters("\n"); -// } -// doIndent(); -// super.emptyElement(uri, localName, qName, atts); -// } - - - /** - * Write a sequence of characters. - * - * @param ch The characters to write. - * @param start The starting position in the array. - * @param length The number of characters to use. - * @exception org.xml.sax.SAXException If there is an error - * writing the characters, or if a filter further - * down the chain raises an exception. - * @see XMLWriter#characters(char[], int, int) - */ - public void characters (char ch[], int start, int length) - throws SAXException - { - state = SEEN_DATA; - super.characters(ch, start, length); - } - - - - //////////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Print indentation for the current level. - * - * @exception org.xml.sax.SAXException If there is an error - * writing the indentation characters, or if a filter - * further down the chain raises an exception. - */ - private void doIndent () - throws SAXException - { - if (depth > 0) { - char[] ch = indentStep.toCharArray(); - for( int i=0; i stateStack = new Stack(); - - private String indentStep = ""; - private int depth = 0; - -} - -// end of DataWriter.java --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/DumbEscapeHandler.java 2018-01-30 20:30:38.000000000 -0500 +++ /dev/null 2018-01-30 20:30:38.000000000 -0500 @@ -1,79 +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.xml.internal.bind.marshaller; - -import java.io.IOException; -import java.io.Writer; - -/** - * Escape everything above the US-ASCII code range. - * A fallback position. - * - * Works with any JDK, any encoding. - * - * @since 1.0.1 - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class DumbEscapeHandler implements CharacterEscapeHandler { - - private DumbEscapeHandler() {} // no instanciation please - - public static final CharacterEscapeHandler theInstance = new DumbEscapeHandler(); - - public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException { - int limit = start+length; - for (int i = start; i < limit; i++) { - switch (ch[i]) { - case '&': - out.write("&"); - break; - case '<': - out.write("<"); - break; - case '>': - out.write(">"); - break; - case '\"': - if (isAttVal) { - out.write("""); - } else { - out.write('\"'); - } - break; - default: - if (ch[i] > '\u007f') { - out.write("&#"); - out.write(Integer.toString(ch[i])); - out.write(';'); - } else { - out.write(ch[i]); - } - } - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages.java 2018-01-30 20:30:39.000000000 -0500 +++ /dev/null 2018-01-30 20:30:39.000000000 -0500 @@ -1,110 +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.xml.internal.bind.marshaller; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Formats error messages. - * - * @since JAXB 1.0 - */ -public class Messages -{ - public static String format( String property ) { - return format( property, null ); - } - - public static String format( String property, Object arg1 ) { - return format( property, new Object[]{arg1} ); - } - - public static String format( String property, Object arg1, Object arg2 ) { - return format( property, new Object[]{arg1,arg2} ); - } - - public static String format( String property, Object arg1, Object arg2, Object arg3 ) { - return format( property, new Object[]{arg1,arg2,arg3} ); - } - - // add more if necessary. - - /** Loads a string resource and formats it with specified arguments. */ - static String format( String property, Object[] args ) { - String text = ResourceBundle.getBundle(Messages.class.getName()).getString(property); - return MessageFormat.format(text,args); - } - -// -// -// Message resources -// -// - public static final String NOT_MARSHALLABLE = // 0 args - "MarshallerImpl.NotMarshallable"; - - public static final String UNSUPPORTED_RESULT = // 0 args - "MarshallerImpl.UnsupportedResult"; - - public static final String UNSUPPORTED_ENCODING = // 1 arg - "MarshallerImpl.UnsupportedEncoding"; - - public static final String NULL_WRITER = // 0 args - "MarshallerImpl.NullWriterParam"; - - public static final String ASSERT_FAILED = // 0 args - "SAXMarshaller.AssertFailed"; - - /** - * @deprecated use ERR_MISSING_OBJECT2 - */ - public static final String ERR_MISSING_OBJECT = // 0 args - "SAXMarshaller.MissingObject"; - - /** - * @deprecated - * use {@link com.sun.xml.internal.bind.v2.runtime.XMLSerializer#reportMissingObjectError(String)} - * Usage not found. TODO Remove - */ - // public static final String ERR_MISSING_OBJECT2 = // 1 arg - // "SAXMarshaller.MissingObject2"; - - /** - * @deprecated only used from 1.0 - */ - public static final String ERR_DANGLING_IDREF = // 1 arg - "SAXMarshaller.DanglingIDREF"; - - /** - * @deprecated only used from 1.0 - */ - public static final String ERR_NOT_IDENTIFIABLE = // 0 args - "SAXMarshaller.NotIdentifiable"; - - public static final String DOM_IMPL_DOESNT_SUPPORT_CREATELEMENTNS = // 2 args - "SAX2DOMEx.DomImplDoesntSupportCreateElementNs"; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages.properties 2018-01-30 20:30:39.000000000 -0500 +++ /dev/null 2018-01-30 20:30:39.000000000 -0500 @@ -1,62 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = \ - the object parameter to marshal() is not marshallable - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = \ - unsupported javax.xml.parser.transform.Result parameter - -MarshallerImpl.UnsupportedEncoding = \ - unsupported encoding: {0} - -MarshallerImpl.NullWriterParam = \ - StAX writer parameter must not be null - -SAXMarshaller.AssertFailed = \ - assertion failed - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = \ - a required object is missing - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = \ - A tree contains a reference to ID "{0}" but it's not a part of the object graph - -SAXMarshaller.NotIdentifiable = \ - An object is referenced as IDREF but its ID field is null - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = \ - DOM implementation ({0} from {1}) is broken. It does not support the createElementNS method. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages_de.properties 2018-01-30 20:30:40.000000000 -0500 +++ /dev/null 2018-01-30 20:30:40.000000000 -0500 @@ -1,53 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = die Methode marshal() kann nicht mit Objektparameter verwendet werden - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = nicht unterst\u00FCtzter javax.xml.parser.transform.Result-Parameter - -MarshallerImpl.UnsupportedEncoding = nicht unterst\u00FCtzte Codierung: {0} - -MarshallerImpl.NullWriterParam = StAX-Writer-Parameter muss angegeben werden - -SAXMarshaller.AssertFailed = Assertion nicht erfolgreich - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = ein erforderliches Objekt fehlt - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = Ein Baum enth\u00E4lt eine Referenz auf ID "{0}", ist jedoch nicht Bestandteil des Objektdiagramms - -SAXMarshaller.NotIdentifiable = Ein Objekt wird als IDREF referenziert, das ID-Feld ist jedoch null - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = DOM-Implementierung ({0} von {1}) ist unterbrochen. Sie unterst\u00FCtzt die createElementNS-Methode nicht. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages_es.properties 2018-01-30 20:30:41.000000000 -0500 +++ /dev/null 2018-01-30 20:30:41.000000000 -0500 @@ -1,53 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = No es posible utilizar el m\u00E9todo marshal() con el par\u00E1metro de objeto. - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = Par\u00E1metro javax.xml.parser.transform.Result no soportado. - -MarshallerImpl.UnsupportedEncoding = codificaci\u00F3n no soportada: {0} - -MarshallerImpl.NullWriterParam = El par\u00E1metro de escritor StAX no debe ser nulo - -SAXMarshaller.AssertFailed = fallo de afirmaci\u00F3n - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = falta un objeto necesario - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = Un \u00E1rbol contiene una referencia al identificador "{0}", pero no forma parte del gr\u00E1fico del objeto - -SAXMarshaller.NotIdentifiable = Se hace referencia a un objeto como IDREF, pero su campo de identificador es nulo - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = Se ha interrumpido la implantaci\u00F3n de DOM ({0} desde {1}). No soporta el m\u00E9todo createElementNS. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages_fr.properties 2018-01-30 20:30:42.000000000 -0500 +++ /dev/null 2018-01-30 20:30:42.000000000 -0500 @@ -1,53 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = Il n'est pas possible d'utiliser la m\u00E9thode marshal() avec le param\u00E8tre d'objet - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = param\u00E8tre javax.xml.parser.transform.Result non pris en charge - -MarshallerImpl.UnsupportedEncoding = encodage non pris en charge : {0} - -MarshallerImpl.NullWriterParam = Le param\u00E8tre de processus d'\u00E9criture StAX ne doit pas \u00EAtre NULL - -SAXMarshaller.AssertFailed = \u00E9chec de l'assertion - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = un objet obligatoire est manquant - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = Une arborescence contient une r\u00E9f\u00E9rence \u00E0 l''ID "{0}", mais elle ne fait pas partie du graphique d''objet - -SAXMarshaller.NotIdentifiable = Un objet est r\u00E9f\u00E9renc\u00E9 en tant qu'IDREF mais son champ d'ID est NULL - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = L''impl\u00E9mentation DOM ({0} \u00E0 partir de {1}) est interrompue. Elle ne prend pas en charge la m\u00E9thode createElementNS. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages_it.properties 2018-01-30 20:30:43.000000000 -0500 +++ /dev/null 2018-01-30 20:30:43.000000000 -0500 @@ -1,53 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = impossibile eseguire il marshalling del parametro dell'oggetto di cui eseguire il marshalling () - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = parametro javax.xml.parser.transform.Result non supportato - -MarshallerImpl.UnsupportedEncoding = codifica non supportata: {0} - -MarshallerImpl.NullWriterParam = il parametro del processo di scrittura StAX non deve essere nullo - -SAXMarshaller.AssertFailed = asserzione non riuscita - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = oggetto richiesto mancante - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = Una struttura contiene un riferimento all''ID "{0}" ma non fa parte del grafico dell''oggetto - -SAXMarshaller.NotIdentifiable = Viene fatto riferimento a un oggetto come IDREF ma il relativo campo ID \u00E8 nullo - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = Implementazione DOM ({0} da {1}) interrotta. Non supporta il metodo createElementNS. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages_ja.properties 2018-01-30 20:30:43.000000000 -0500 +++ /dev/null 2018-01-30 20:30:43.000000000 -0500 @@ -1,53 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = marshal()\u306Eobject\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u30DE\u30FC\u30B7\u30E3\u30EA\u30F3\u30B0\u53EF\u80FD\u3067\u306F\u3042\u308A\u307E\u305B\u3093 - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = \u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044javax.xml.parser.transform.Result\u30D1\u30E9\u30E1\u30FC\u30BF - -MarshallerImpl.UnsupportedEncoding = \u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0: {0} - -MarshallerImpl.NullWriterParam = StAX writer\u30D1\u30E9\u30E1\u30FC\u30BF\u306Fnull\u306B\u3067\u304D\u307E\u305B\u3093 - -SAXMarshaller.AssertFailed = \u30A2\u30B5\u30FC\u30B7\u30E7\u30F3\u306B\u5931\u6557\u3057\u307E\u3057\u305F - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = \u5FC5\u9808\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u3042\u308A\u307E\u305B\u3093 - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = \u30C4\u30EA\u30FC\u306BID "{0}"\u3078\u306E\u53C2\u7167\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30FB\u30B0\u30E9\u30D5\u306E\u4E00\u90E8\u3067\u306F\u3042\u308A\u307E\u305B\u3093 - -SAXMarshaller.NotIdentifiable = \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306FIDREF\u3068\u3057\u3066\u53C2\u7167\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001ID\u30D5\u30A3\u30FC\u30EB\u30C9\u304Cnull\u3067\u3059 - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = DOM\u5B9F\u88C5({1}\u304B\u3089\u306E{0})\u304C\u58CA\u308C\u3066\u3044\u307E\u3059\u3002createElementNS\u30E1\u30BD\u30C3\u30C9\u3092\u30B5\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u305B\u3093\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages_ko.properties 2018-01-30 20:30:44.000000000 -0500 +++ /dev/null 2018-01-30 20:30:44.000000000 -0500 @@ -1,53 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = \uAC1D\uCCB4 \uB9E4\uAC1C\uBCC0\uC218\uC5D0 \uB300\uD574\uC11C\uB294 marshal() \uBA54\uC18C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uB294 javax.xml.parser.transform.Result \uB9E4\uAC1C\uBCC0\uC218 - -MarshallerImpl.UnsupportedEncoding = \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uB294 \uC778\uCF54\uB529: {0} - -MarshallerImpl.NullWriterParam = StAX \uC4F0\uAE30 \uC7A5\uCE58 \uB9E4\uAC1C\uBCC0\uC218\uB294 \uB110\uC774 \uC544\uB2C8\uC5B4\uC57C \uD569\uB2C8\uB2E4. - -SAXMarshaller.AssertFailed = \uBA85\uC81C\uB97C \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = \uD544\uC218 \uAC1D\uCCB4\uAC00 \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4. - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = \uD2B8\uB9AC\uAC00 ID "{0}"\uC5D0 \uB300\uD55C \uCC38\uC870\uB97C \uD3EC\uD568\uD558\uACE0 \uC788\uC9C0\uB9CC \uAC1D\uCCB4 \uADF8\uB798\uD504\uC5D0 \uC18D\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -SAXMarshaller.NotIdentifiable = \uAC1D\uCCB4\uAC00 IDREF\uB85C \uCC38\uC870\uB418\uC5C8\uC9C0\uB9CC \uD574\uB2F9 ID \uD544\uB4DC\uAC00 \uB110\uC785\uB2C8\uB2E4. - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = DOM \uAD6C\uD604({1}\uC758 {0})\uC774 \uC911\uB2E8\uB418\uC5C8\uC2B5\uB2C8\uB2E4. createElementNS \uBA54\uC18C\uB4DC\uB97C \uC9C0\uC6D0\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages_pt_BR.properties 2018-01-30 20:30:45.000000000 -0500 +++ /dev/null 2018-01-30 20:30:45.000000000 -0500 @@ -1,53 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = o par\u00E2metro do objeto para fazer marshal() n\u00E3o pode ser submetido a marshal - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = par\u00E2metro javax.xml.parser.transform.Result n\u00E3o suportado - -MarshallerImpl.UnsupportedEncoding = codifica\u00E7\u00E3o n\u00E3o suportada: {0} - -MarshallerImpl.NullWriterParam = o par\u00E2metro do gravador StAX n\u00E3o deve ser nulo - -SAXMarshaller.AssertFailed = falha na asser\u00E7\u00E3o - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = n\u00E3o foi encontrado um objeto obrigat\u00F3rio - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = Uma \u00E1rvore cont\u00E9m uma refer\u00EAncia ao ID "{0}", mas n\u00E3o faz parte do gr\u00E1fico do objeto - -SAXMarshaller.NotIdentifiable = Um objeto \u00E9 mencionado como IDREF, mas seu campo ID \u00E9 nulo - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = A implementa\u00E7\u00E3o DOM ({0} de {1}) foi interrompida. Ela n\u00E3o suporta o m\u00E9todo createElementNS. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages_zh_CN.properties 2018-01-30 20:30:46.000000000 -0500 +++ /dev/null 2018-01-30 20:30:46.000000000 -0500 @@ -1,53 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = \u65E0\u6CD5\u4F7F\u7528\u5E26\u6709\u5BF9\u8C61\u53C2\u6570\u7684 marshal() - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = \u4E0D\u652F\u6301 javax.xml.parser.transform.Result \u53C2\u6570 - -MarshallerImpl.UnsupportedEncoding = \u4E0D\u652F\u6301\u7684\u7F16\u7801: {0} - -MarshallerImpl.NullWriterParam = StAX \u5199\u8FDB\u7A0B\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A\u503C - -SAXMarshaller.AssertFailed = \u65AD\u8A00\u5931\u8D25 - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = \u7F3A\u5C11\u5FC5\u9700\u7684\u5BF9\u8C61 - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = \u6811\u5305\u542B\u5BF9 ID "{0}" \u7684\u5F15\u7528, \u4F46\u4E0D\u662F\u5BF9\u8C61\u56FE\u7684\u4E00\u90E8\u5206 - -SAXMarshaller.NotIdentifiable = \u5BF9\u8C61\u5C06\u4F5C\u4E3A IDREF \u5F15\u7528, \u4F46\u5176 ID \u5B57\u6BB5\u4E3A\u7A7A\u503C - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = DOM \u5B9E\u73B0 ({0}\u6765\u81EA{1}) \u5DF2\u4E2D\u65AD\u3002\u5B83\u4E0D\u652F\u6301 createElementNS \u65B9\u6CD5\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/Messages_zh_TW.properties 2018-01-30 20:30:47.000000000 -0500 +++ /dev/null 2018-01-30 20:30:47.000000000 -0500 @@ -1,53 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# Wrapped into a JAXBException. Not concatenated with any other string. -MarshallerImpl.NotMarshallable = marshal() \u7684\u7269\u4EF6\u53C3\u6578\u7121\u6CD5\u5C01\u9001\u8655\u7406 - -# Not concatenated with any other string (written on a separate line). -MarshallerImpl.UnsupportedResult = \u4E0D\u652F\u63F4\u7684 javax.xml.parser.transform.Result \u53C3\u6578 - -MarshallerImpl.UnsupportedEncoding = \u4E0D\u652F\u63F4\u7684\u7DE8\u78BC: {0} - -MarshallerImpl.NullWriterParam = StAX \u5BEB\u5165\u5668\u53C3\u6578\u4E0D\u5F97\u70BA\u7A7A\u503C - -SAXMarshaller.AssertFailed = \u5BA3\u544A\u5931\u6557 - -# Printed after [ERROR]: string. -SAXMarshaller.MissingObject = \u907A\u6F0F\u5FC5\u8981\u7684\u7269\u4EF6 - -# Usage not found. TODO Remove -#SAXMarshaller.MissingObject2 = \ -# a required field "{0}" is missing an object - -SAXMarshaller.DanglingIDREF = \u6A39\u72C0\u7D50\u69CB\u5305\u542B ID "{0}" \u7684\u53C3\u7167, \u4F46\u5B83\u4E0D\u662F\u7269\u4EF6\u5716\u8868\u7684\u4E00\u90E8\u5206 - -SAXMarshaller.NotIdentifiable = \u7269\u4EF6\u88AB\u53C3\u7167\u70BA IDREF, \u4F46\u5176 ID \u6B04\u4F4D\u70BA\u7A7A\u503C - -SAX2DOMEx.DomImplDoesntSupportCreateElementNs = DOM \u5BE6\u884C ({1} \u7684 {0}) \u640D\u58DE. \u5B83\u4E0D\u652F\u63F4 createElementNS \u65B9\u6CD5. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/MinimumEscapeHandler.java 2018-01-30 20:30:48.000000000 -0500 +++ /dev/null 2018-01-30 20:30:48.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.marshaller; - -import java.io.IOException; -import java.io.Writer; - -/** - * Performs no character escaping. Usable only when the output encoding - * is UTF, but this handler gives the maximum performance. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class MinimumEscapeHandler implements CharacterEscapeHandler { - - private MinimumEscapeHandler() {} // no instanciation please - - public static final CharacterEscapeHandler theInstance = new MinimumEscapeHandler(); - - public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException { - // avoid calling the Writerwrite method too much by assuming - // that the escaping occurs rarely. - // profiling revealed that this is faster than the naive code. - int limit = start+length; - for (int i = start; i < limit; i++) { - char c = ch[i]; - if (c == '&' || c == '<' || c == '>' || c == '\r' || (c == '\n' && isAttVal) || (c == '\"' && isAttVal)) { - if (i != start) - out.write(ch, start, i - start); - start = i + 1; - switch (ch[i]) { - case '&': - out.write("&"); - break; - case '<': - out.write("<"); - break; - case '>': - out.write(">"); - break; - case '\"': - out.write("""); - break; - case '\n': - case '\r': - out.write("&#"); - out.write(Integer.toString(c)); - out.write(';'); - break; - default: - throw new IllegalArgumentException("Cannot escape: '" + c + "'"); - } - } - } - - if( start!=limit ) - out.write(ch,start,limit-start); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/NamespacePrefixMapper.java 2018-01-30 20:30:48.000000000 -0500 +++ /dev/null 2018-01-30 20:30:48.000000000 -0500 @@ -1,256 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.marshaller; - -import java.io.OutputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.stream.XMLEventWriter; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.dom.DOMResult; - -import org.w3c.dom.Node; - -// be careful about changing this class. this class is supposed to be -// extended by users and therefore we are not allowed to break -// those user code. -// -// this means: -// - don't add any abstract method -// - don't change any existing method signature -// - don't remove any existing method. - -/** - * Implemented by the user application to determine URI {@code ->} prefix - * mapping. - * - * This is considered as an interface, though it's implemented - * as an abstract class to make it easy to add new methods in - * a future. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public abstract class NamespacePrefixMapper { - - private static final String[] EMPTY_STRING = new String[0]; - - /** - * Returns a preferred prefix for the given namespace URI. - * - * This method is intended to be overrided by a derived class. - * - *

- * As noted in the return value portion of the javadoc, there - * are several cases where the preference cannot be honored. - * Specifically, as of JAXB RI 2.0 and onward: - * - *

    - *
  1. - * If the prefix returned is already in use as one of the in-scope - * namespace bindings. This is partly necessary for correctness - * (so that we don't unexpectedly change the meaning of QNames - * bound to {@link String}), partly to simplify the marshaller. - *
  2. - * If the prefix returned is "" yet the current {@link JAXBContext} - * includes classes that use the empty namespace URI. This allows - * the JAXB RI to reserve the "" prefix for the empty namespace URI, - * which is the only possible prefix for the URI. - * This restriction is also to simplify the marshaller. - *
- * - * @param namespaceUri - * The namespace URI for which the prefix needs to be found. - * Never be null. "" is used to denote the default namespace. - * @param suggestion - * When the content tree has a suggestion for the prefix - * to the given namespaceUri, that suggestion is passed as a - * parameter. Typicall this value comes from the QName.getPrefix - * to show the preference of the content tree. This parameter - * may be null, and this parameter may represent an already - * occupied prefix. - * @param requirePrefix - * If this method is expected to return non-empty prefix. - * When this flag is true, it means that the given namespace URI - * cannot be set as the default namespace. - * - * @return - * null if there's no prefered prefix for the namespace URI. - * In this case, the system will generate a prefix for you. - * - * Otherwise the system will try to use the returned prefix, - * but generally there's no guarantee if the prefix will be - * actually used or not. - * - * return "" to map this namespace URI to the default namespace. - * Again, there's no guarantee that this preference will be - * honored. - * - * If this method returns "" when requirePrefix=true, the return - * value will be ignored and the system will generate one. - * - * @since JAXB 1.0.1 - */ - public abstract String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix); - - /** - * Returns a list of namespace URIs that should be declared - * at the root element. - * - *

- * By default, the JAXB RI 1.0.x produces namespace declarations only when - * they are necessary, only at where they are used. Because of this - * lack of look-ahead, sometimes the marshaller produces a lot of - * namespace declarations that look redundant to human eyes. For example, - *

{@code
-     * 
-     * 
-     *    ... 
-     *    ... 
-     *    ... 
-     *   ...
-     * 
-     * }
- * - *

- * The JAXB RI 2.x mostly doesn't exhibit this behavior any more, - * as it declares all statically known namespace URIs (those URIs - * that are used as element/attribute names in JAXB annotations), - * but it may still declare additional namespaces in the middle of - * a document, for example when (i) a QName as an attribute/element value - * requires a new namespace URI, or (ii) DOM nodes as a portion of an object - * tree requires a new namespace URI. - * - *

- * If you know in advance that you are going to use a certain set of - * namespace URIs, you can override this method and have the marshaller - * declare those namespace URIs at the root element. - * - *

- * For example, by returning new String[]{"urn:foo"}, - * the marshaller will produce: - *

{@code
-     * 
-     * 
-     *    ... 
-     *    ... 
-     *    ... 
-     *   ...
-     * 
-     * }
- *

- * To control prefixes assigned to those namespace URIs, use the - * {@link #getPreferredPrefix(String, String, boolean)} method. - * - * @return - * A list of namespace URIs as an array of {@link String}s. - * This method can return a length-zero array but not null. - * None of the array component can be null. To represent - * the empty namespace, use the empty string "". - * - * @since - * JAXB RI 1.0.2 - */ - public String[] getPreDeclaredNamespaceUris() { - return EMPTY_STRING; - } - - /** - * Similar to {@link #getPreDeclaredNamespaceUris()} but allows the - * (prefix,nsUri) pairs to be returned. - * - *

- * With {@link #getPreDeclaredNamespaceUris()}, applications who wish to control - * the prefixes as well as the namespaces needed to implement both - * {@link #getPreDeclaredNamespaceUris()} and {@link #getPreferredPrefix(String, String, boolean)}. - * - *

- * This version eliminates the needs by returning an array of pairs. - * - * @return - * always return a non-null (but possibly empty) array. The array stores - * data like (prefix1,nsUri1,prefix2,nsUri2,...) Use an empty string to represent - * the empty namespace URI and the default prefix. Null is not allowed as a value - * in the array. - * - * @since - * JAXB RI 2.0 beta - */ - public String[] getPreDeclaredNamespaceUris2() { - return EMPTY_STRING; - } - - /** - * Returns a list of (prefix,namespace URI) pairs that represents - * namespace bindings available on ancestor elements (that need not be repeated - * by the JAXB RI.) - * - *

- * Sometimes JAXB is used to marshal an XML document, which will be - * used as a subtree of a bigger document. When this happens, it's nice - * for a JAXB marshaller to be able to use in-scope namespace bindings - * of the larger document and avoid declaring redundant namespace URIs. - * - *

- * This is automatically done when you are marshalling to {@link XMLStreamWriter}, - * {@link XMLEventWriter}, {@link DOMResult}, or {@link Node}, because - * those output format allows us to inspect what's currently available - * as in-scope namespace binding. However, with other output format, - * such as {@link OutputStream}, the JAXB RI cannot do this automatically. - * That's when this method comes into play. - * - *

- * Namespace bindings returned by this method will be used by the JAXB RI, - * but will not be re-declared. They are assumed to be available when you insert - * this subtree into a bigger document. - * - *

- * It is NOT OK to return the same binding, or give - * the receiver a conflicting binding information. - * It's a responsibility of the caller to make sure that this doesn't happen - * even if the ancestor elements look like: - *

{@code
-     *   
-     *     
-     *       
-     *         ... JAXB marshalling into here.
-     *       
-     *     
-     *   
-     * }
- * - * @return - * always return a non-null (but possibly empty) array. The array stores - * data like (prefix1,nsUri1,prefix2,nsUri2,...) Use an empty string to represent - * the empty namespace URI and the default prefix. Null is not allowed as a value - * in the array. - * - * @since JAXB RI 2.0 beta - */ - public String[] getContextualNamespaceDecls() { - return EMPTY_STRING; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/NioEscapeHandler.java 2018-01-30 20:30:49.000000000 -0500 +++ /dev/null 2018-01-30 20:30:49.000000000 -0500 @@ -1,95 +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.xml.internal.bind.marshaller; - -import java.io.IOException; -import java.io.Writer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetEncoder; - -/** - * Uses JDK1.4 NIO functionality to escape characters smartly. - * - * @since 1.0.1 - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class NioEscapeHandler implements CharacterEscapeHandler { - - private final CharsetEncoder encoder; - - // exposing those variations upset javac 1.3.1, since it needs to - // know about those classes to determine which overloaded version - // of the method it wants to use. So comment it out for the compatibility. - -// public NioEscapeHandler(CharsetEncoder _encoder) { -// this.encoder = _encoder; -// if(encoder==null) -// throw new NullPointerException(); -// } -// -// public NioEscapeHandler(Charset charset) { -// this(charset.newEncoder()); -// } - - public NioEscapeHandler(String charsetName) { -// this(Charset.forName(charsetName)); - this.encoder = Charset.forName(charsetName).newEncoder(); - } - - public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException { - int limit = start+length; - for (int i = start; i < limit; i++) { - switch (ch[i]) { - case '&': - out.write("&"); - break; - case '<': - out.write("<"); - break; - case '>': - out.write(">"); - break; - case '\"': - if (isAttVal) { - out.write("""); - } else { - out.write('\"'); - } - break; - default: - if( encoder.canEncode(ch[i]) ) { - out.write(ch[i]); - } else { - out.write("&#"); - out.write(Integer.toString(ch[i])); - out.write(';'); - } - } - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/NoEscapeHandler.java 2018-01-30 20:30:50.000000000 -0500 +++ /dev/null 2018-01-30 20:30:50.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, 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.bind.marshaller; - -import java.io.IOException; -import java.io.Writer; - -/** - * Performs no character escaping. - * - * @author - * Roman Grigoriadi (roman.grigoriadi@oracle.com) - */ -public class NoEscapeHandler implements CharacterEscapeHandler { - - public static final NoEscapeHandler theInstance = new NoEscapeHandler(); - - @Override - public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException { - out.write(ch, start, length); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/SAX2DOMEx.java 2018-01-30 20:30:50.000000000 -0500 +++ /dev/null 2018-01-30 20:30:50.000000000 -0500 @@ -1,234 +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.bind.marshaller; - -import java.util.Stack; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import com.sun.xml.internal.bind.util.Which; -import com.sun.istack.internal.FinalArrayList; - -import com.sun.xml.internal.bind.v2.util.XmlFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.Text; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.Locator; - -/** - * Builds a DOM tree from SAX2 events. - * - * @author Vivek Pandey - * @since 1.0 - */ -public class SAX2DOMEx implements ContentHandler { - - private Node node = null; - private boolean isConsolidate; - protected final Stack nodeStack = new Stack(); - private final FinalArrayList unprocessedNamespaces = new FinalArrayList(); - /** - * Document object that owns the specified node. - */ - protected final Document document; - - /** - * @param node - * Nodes will be created and added under this object. - */ - public SAX2DOMEx(Node node) { - this(node, false); - } - - /** - * @param node - * Nodes will be created and added under this object. - */ - public SAX2DOMEx(Node node, boolean isConsolidate) { - this.node = node; - this.isConsolidate = isConsolidate; - nodeStack.push(this.node); - - if (node instanceof Document) { - this.document = (Document) node; - } else { - this.document = node.getOwnerDocument(); - } - } - - /** - * Creates a fresh empty DOM document and adds nodes under this document. - */ - public SAX2DOMEx(DocumentBuilderFactory f) throws ParserConfigurationException { - f.setValidating(false); - document = f.newDocumentBuilder().newDocument(); - node = document; - nodeStack.push(document); - } - - /** - * Creates a fresh empty DOM document and adds nodes under this document. - * @deprecated - */ - public SAX2DOMEx() throws ParserConfigurationException { - DocumentBuilderFactory factory = XmlFactory.createDocumentBuilderFactory(false); - factory.setValidating(false); - - document = factory.newDocumentBuilder().newDocument(); - node = document; - nodeStack.push(document); - } - - public final Element getCurrentElement() { - return (Element) nodeStack.peek(); - } - - public Node getDOM() { - return node; - } - - public void startDocument() { - } - - public void endDocument() { - } - - protected void namespace(Element element, String prefix, String uri) { - String qname; - if ("".equals(prefix) || prefix == null) { - qname = "xmlns"; - } else { - qname = "xmlns:" + prefix; - } - - // older version of Xerces (I confirmed that the bug is gone with Xerces 2.4.0) - // have a problem of re-setting the same namespace attribute twice. - // work around this bug removing it first. - if (element.hasAttributeNS("http://www.w3.org/2000/xmlns/", qname)) { - // further workaround for an old Crimson bug where the removeAttribtueNS - // method throws NPE when the element doesn't have any attribute. - // to be on the safe side, check the existence of attributes before - // attempting to remove it. - // for details about this bug, see org.apache.crimson.tree.ElementNode2 - // line 540 or the following message: - // https://jaxb.dev.java.net/servlets/ReadMsg?list=users&msgNo=2767 - element.removeAttributeNS("http://www.w3.org/2000/xmlns/", qname); - } - // workaround until here - - element.setAttributeNS("http://www.w3.org/2000/xmlns/", qname, uri); - } - - public void startElement(String namespace, String localName, String qName, Attributes attrs) { - Node parent = nodeStack.peek(); - - // some broken DOM implementation (we confirmed it with SAXON) - // return null from this method. - Element element = document.createElementNS(namespace, qName); - - if (element == null) { - // if so, report an user-friendly error message, - // rather than dying mysteriously with NPE. - throw new AssertionError( - Messages.format(Messages.DOM_IMPL_DOESNT_SUPPORT_CREATELEMENTNS, - document.getClass().getName(), - Which.which(document.getClass()))); - } - - // process namespace bindings - for (int i = 0; i < unprocessedNamespaces.size(); i += 2) { - String prefix = unprocessedNamespaces.get(i); - String uri = unprocessedNamespaces.get(i + 1); - - namespace(element, prefix, uri); - } - unprocessedNamespaces.clear(); - - - if (attrs != null) { - int length = attrs.getLength(); - for (int i = 0; i < length; i++) { - String namespaceuri = attrs.getURI(i); - String value = attrs.getValue(i); - String qname = attrs.getQName(i); - element.setAttributeNS(namespaceuri, qname, value); - } - } - // append this new node onto current stack node - parent.appendChild(element); - // push this node onto stack - nodeStack.push(element); - } - - public void endElement(String namespace, String localName, String qName) { - nodeStack.pop(); - } - - public void characters(char[] ch, int start, int length) { - characters(new String(ch, start, length)); - } - - protected Text characters(String s) { - Node parent = nodeStack.peek(); - Node lastChild = parent.getLastChild(); - Text text; - if (isConsolidate && lastChild != null && lastChild.getNodeType() == Node.TEXT_NODE) { - text = (Text) lastChild; - text.appendData(s); - } else { - text = document.createTextNode(s); - parent.appendChild(text); - } - return text; - } - - public void ignorableWhitespace(char[] ch, int start, int length) { - } - - public void processingInstruction(String target, String data) throws org.xml.sax.SAXException { - Node parent = nodeStack.peek(); - Node n = document.createProcessingInstruction(target, data); - parent.appendChild(n); - } - - public void setDocumentLocator(Locator locator) { - } - - public void skippedEntity(String name) { - } - - public void startPrefixMapping(String prefix, String uri) { - unprocessedNamespaces.add(prefix); - unprocessedNamespaces.add(uri); - } - - public void endPrefixMapping(String prefix) { - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/marshaller/XMLWriter.java 2018-01-30 20:30:51.000000000 -0500 +++ /dev/null 2018-01-30 20:30:51.000000000 -0500 @@ -1,976 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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. - */ - -// @@3RD PARTY CODE@@ - -// XMLWriter.java - serialize an XML document. -// Written by David Megginson, david@megginson.com -// NO WARRANTY! This class is in the public domain. - -// Id: XMLWriter.java,v 1.5 2000/09/17 01:08:16 david Exp - -package com.sun.xml.internal.bind.marshaller; - -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.HashMap; -import java.util.Map; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; -import org.xml.sax.helpers.XMLFilterImpl; - - -/** - * Filter to write an XML document from a SAX event stream. - * - *

This class can be used by itself or as part of a SAX event - * stream: it takes as input a series of SAX2 ContentHandler - * events and uses the information in those events to write - * an XML document. Since this class is a filter, it can also - * pass the events on down a filter chain for further processing - * (you can use the XMLWriter to take a snapshot of the current - * state at any point in a filter chain), and it can be - * used directly as a ContentHandler for a SAX2 XMLReader.

- * - *

The client creates a document by invoking the methods for - * standard SAX2 events, always beginning with the - * {@link #startDocument startDocument} method and ending with - * the {@link #endDocument endDocument} method. There are convenience - * methods provided so that clients to not have to create empty - * attribute lists or provide empty strings as parameters; for - * example, the method invocation

- * - *
- * w.startElement("foo");
- * 
- * - *

is equivalent to the regular SAX2 ContentHandler method

- * - *
- * w.startElement("", "foo", "", new AttributesImpl());
- * 
- * - *

Except that it is more efficient because it does not allocate - * a new empty attribute list each time. The following code will send - * a simple XML document to standard output:

- * - *
- * XMLWriter w = new XMLWriter();
- *
- * w.startDocument();
- * w.startElement("greeting");
- * w.characters("Hello, world!");
- * w.endElement("greeting");
- * w.endDocument();
- * 
- * - *

The resulting document will look like this:

- * - *
{@code
- * 
- *
- * Hello, world!
- * }
- * - *

In fact, there is an even simpler convenience method, - * dataElement, designed for writing elements that - * contain only character data, so the code to generate the - * document could be shortened to

- * - *
- * XMLWriter w = new XMLWriter();
- *
- * w.startDocument();
- * w.dataElement("greeting", "Hello, world!");
- * w.endDocument();
- * 
- * - *

Whitespace

- * - *

According to the XML Recommendation, all whitespace - * in an XML document is potentially significant to an application, - * so this class never adds newlines or indentation. If you - * insert three elements in a row, as in

- * - *
- * w.dataElement("item", "1");
- * w.dataElement("item", "2");
- * w.dataElement("item", "3");
- * 
- * - *

you will end up with

- * - *
{@code
- * 133
- * }
- * - *

You need to invoke one of the characters methods - * explicitly to add newlines or indentation. Alternatively, you - * can use {@link DataWriter}, which - * is derived from this class -- it is optimized for writing - * purely data-oriented (or field-oriented) XML, and does automatic - * linebreaks and indentation (but does not support mixed content - * properly).

- * - * - *

Namespace Support

- * - *

The writer contains extensive support for XML Namespaces, so that - * a client application does not have to keep track of prefixes and - * supply xmlns attributes. By default, the XML writer will - * generate Namespace declarations in the form _NS1, _NS2, etc., wherever - * they are needed, as in the following example:

- * - *
- * w.startDocument();
- * w.emptyElement("http://www.foo.com/ns/", "foo");
- * w.endDocument();
- * 
- * - *

The resulting document will look like this:

- * - *
{@code
- * 
- *
- * <_NS1:foo xmlns:_NS1="http://www.foo.com/ns/"/>
- * }
- * - *

In many cases, document authors will prefer to choose their - * own prefixes rather than using the (ugly) default names. The - * XML writer allows two methods for selecting prefixes:

- * - *
    - *
  1. the qualified name
  2. - *
- * - *

Whenever the XML writer finds a new Namespace URI, it checks - * to see if a qualified (prefixed) name is also available; if so - * it attempts to use the name's prefix (as long as the prefix is - * not already in use for another Namespace URI).

- * - *

The resulting document will look like this:

- * - *
{@code
- * 
- *
- * 
- * }
- * - *

The default Namespace simply uses an empty string as the prefix:

- * - *
- * w.setPrefix("http://www.foo.com/ns/", "");
- * w.startDocument();
- * w.emptyElement("http://www.foo.com/ns/", "foo");
- * w.endDocument();
- * 
- * - *

The resulting document will look like this:

- * - *
{@code
- * 
- *
- * 
- * }
- * - *

By default, the XML writer will not declare a Namespace until - * it is actually used. Sometimes, this approach will create - * a large number of Namespace declarations, as in the following - * example:

- * - *
{@code
- * 
- *
- * 
- *  
- *   A Dark Night
- *   Jane Smith
- *   2000-09-09
- *  
- * 
- * }
- * - *

The "rdf" prefix is declared only once, because the RDF Namespace - * is used by the root element and can be inherited by all of its - * descendants; the "dc" prefix, on the other hand, is declared three - * times, because no higher element uses the Namespace. To solve this - * problem, you can instruct the XML writer to predeclare Namespaces - * on the root element even if they are not used there:

- * - *
- * w.forceNSDecl("http://www.purl.org/dc/");
- * 
- * - *

Now, the "dc" prefix will be declared on the root element even - * though it's not needed there, and can be inherited by its - * descendants:

- * - *
{@code
- * 
- *
- * 
- *  
- *   A Dark Night
- *   Jane Smith
- *   2000-09-09
- *  
- * 
- * }
- * - *

This approach is also useful for declaring Namespace prefixes - * that be used by qualified names appearing in attribute values or - * character data.

- * - * @author David Megginson, david@megginson.com - * @version 0.2 - * @since JAXB 1.0 - * @see org.xml.sax.XMLFilter - * @see org.xml.sax.ContentHandler - */ -public class XMLWriter extends XMLFilterImpl -{ - - //////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////// - - - - - /** - * Create a new XML writer. - * - *

Write to the writer provided.

- * - * @param writer - * The output destination, or null to use standard output. - * @param encoding - * If non-null string is specified, it is written as a part - * of the XML declaration. - */ - public XMLWriter (Writer writer, String encoding, CharacterEscapeHandler _escapeHandler ) - { - init(writer,encoding); - this.escapeHandler = _escapeHandler; - } - - public XMLWriter (Writer writer, String encoding ) { - this( writer, encoding, DumbEscapeHandler.theInstance ); - } - - - - /** - * Internal initialization method. - * - *

All of the public constructors invoke this method. - * - * @param writer The output destination, or null to use - * standard output. - */ - private void init (Writer writer,String encoding) - { - setOutput(writer,encoding); - } - - - - //////////////////////////////////////////////////////////////////// - // Public methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Reset the writer. - * - *

This method is especially useful if the writer throws an - * exception before it is finished, and you want to reuse the - * writer for a new document. It is usually a good idea to - * invoke {@link #flush flush} before resetting the writer, - * to make sure that no output is lost.

- * - *

This method is invoked automatically by the - * {@link #startDocument startDocument} method before writing - * a new document.

- * - *

Note: this method will not - * clear the prefix or URI information in the writer or - * the selected output writer.

- * - * @see #flush() - */ - public void reset () - { - elementLevel = 0; - startTagIsClosed = true; - } - - - /** - * Flush the output. - * - *

This method flushes the output stream. It is especially useful - * when you need to make certain that the entire document has - * been written to output but do not want to close the output - * stream.

- * - *

This method is invoked automatically by the - * {@link #endDocument endDocument} method after writing a - * document.

- * - * @see #reset() - */ - public void flush () - throws IOException - { - output.flush(); - } - - - /** - * Set a new output destination for the document. - * - * @param writer The output destination, or null to use - * standard output. - * @see #flush() - */ - public void setOutput (Writer writer,String _encoding) - { - if (writer == null) { - output = new OutputStreamWriter(System.out); - } else { - output = writer; - } - encoding = _encoding; - } - - /** - * Set whether the writer should print out the XML declaration - * ({@code }). - *

- * This option is set to true by default. - */ - public void setXmlDecl( boolean _writeXmlDecl ) { - this.writeXmlDecl = _writeXmlDecl; - } - - /** - * Sets the header string. - * - * This string will be written right after the xml declaration - * without any escaping. Useful for generating a boiler-plate - * DOCTYPE decl, PIs, and comments. - * - * @param _header - * passing null will work as if the empty string is passed. - */ - public void setHeader( String _header ) { - this.header = _header; - } - - - private final HashMap locallyDeclaredPrefix = new HashMap(); - public void startPrefixMapping( String prefix, String uri ) throws SAXException { - locallyDeclaredPrefix.put(prefix,uri); - } - - - //////////////////////////////////////////////////////////////////// - // Methods from org.xml.sax.ContentHandler. - //////////////////////////////////////////////////////////////////// - - /** - * Write the XML declaration at the beginning of the document. - * - * Pass the event on down the filter chain for further processing. - * - * @exception org.xml.sax.SAXException If there is an error - * writing the XML declaration, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#startDocument() - */ - public void startDocument () - throws SAXException - { - try { - reset(); - - if(writeXmlDecl) { - String e=""; - if(encoding!=null) - e = " encoding=\""+encoding+'\"'; - - writeXmlDecl(""); - } - - if(header!=null) - write(header); - - super.startDocument(); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - protected void writeXmlDecl(String decl) throws IOException { - write(decl); - } - - - /** - * Write a newline at the end of the document. - * - * Pass the event on down the filter chain for further processing. - * - * @exception org.xml.sax.SAXException If there is an error - * writing the newline, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#endDocument() - */ - public void endDocument () - throws SAXException - { - try { - super.endDocument(); - flush(); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - /** - * Write a start tag. - * - * Pass the event on down the filter chain for further processing. - * - * @param uri The Namespace URI, or the empty string if none - * is available. - * @param localName The element's local (unprefixed) name (required). - * @param qName The element's qualified (prefixed) name, or the - * empty string is none is available. This method will - * use the qName as a template for generating a prefix - * if necessary, but it is not guaranteed to use the - * same qName. - * @param atts The element's attribute list (must not be null). - * @exception org.xml.sax.SAXException If there is an error - * writing the start tag, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) - */ - public void startElement (String uri, String localName, - String qName, Attributes atts) - throws SAXException - { - try { - if (!startTagIsClosed) { - write(">"); - } - elementLevel++; -// nsSupport.pushContext(); - - write('<'); - write(qName); - writeAttributes(atts); - - // declare namespaces specified by the startPrefixMapping methods - if(!locallyDeclaredPrefix.isEmpty()) { - for (Map.Entry e : locallyDeclaredPrefix.entrySet()) { - String p = e.getKey(); - String u = e.getValue(); - if (u == null) { - u = ""; - } - write(' '); - if ("".equals(p)) { - write("xmlns=\""); - } else { - write("xmlns:"); - write(p); - write("=\""); - } - char ch[] = u.toCharArray(); - writeEsc(ch, 0, ch.length, true); - write('\"'); - } - locallyDeclaredPrefix.clear(); // clear the contents - } - -// if (elementLevel == 1) { -// forceNSDecls(); -// } -// writeNSDecls(); - super.startElement(uri, localName, qName, atts); - startTagIsClosed = false; - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - /** - * Write an end tag. - * - * Pass the event on down the filter chain for further processing. - * - * @param uri The Namespace URI, or the empty string if none - * is available. - * @param localName The element's local (unprefixed) name (required). - * @param qName The element's qualified (prefixed) name, or the - * empty string is none is available. This method will - * use the qName as a template for generating a prefix - * if necessary, but it is not guaranteed to use the - * same qName. - * @exception org.xml.sax.SAXException If there is an error - * writing the end tag, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) - */ - public void endElement (String uri, String localName, String qName) - throws SAXException - { - try { - if (startTagIsClosed) { - write("'); - } else { - write("/>"); - startTagIsClosed = true; - } - super.endElement(uri, localName, qName); -// nsSupport.popContext(); - elementLevel--; - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - /** - * Write character data. - * - * Pass the event on down the filter chain for further processing. - * - * @param ch The array of characters to write. - * @param start The starting position in the array. - * @param len The number of characters to write. - * @exception org.xml.sax.SAXException If there is an error - * writing the characters, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#characters(char[], int, int) - */ - public void characters (char ch[], int start, int len) - throws SAXException - { - try { - if (!startTagIsClosed) { - write('>'); - startTagIsClosed = true; - } - writeEsc(ch, start, len, false); - super.characters(ch, start, len); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - /** - * Write ignorable whitespace. - * - * Pass the event on down the filter chain for further processing. - * - * @param ch The array of characters to write. - * @param start The starting position in the array. - * @param length The number of characters to write. - * @exception org.xml.sax.SAXException If there is an error - * writing the whitespace, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) - */ - public void ignorableWhitespace (char ch[], int start, int length) - throws SAXException - { - try { - writeEsc(ch, start, length, false); - super.ignorableWhitespace(ch, start, length); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - - /** - * Write a processing instruction. - * - * Pass the event on down the filter chain for further processing. - * - * @param target The PI target. - * @param data The PI data. - * @exception org.xml.sax.SAXException If there is an error - * writing the PI, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) - */ - public void processingInstruction (String target, String data) - throws SAXException - { - try { - if (!startTagIsClosed) { - write('>'); - startTagIsClosed = true; - } - write(""); - if (elementLevel < 1) { - write('\n'); - } - super.processingInstruction(target, data); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Convenience methods. - //////////////////////////////////////////////////////////////////// - - - - /** - * Start a new element without a qname or attributes. - * - *

This method will provide a default empty attribute - * list and an empty string for the qualified name. - * It invokes {@link - * #startElement(String, String, String, Attributes)} - * directly.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @exception org.xml.sax.SAXException If there is an error - * writing the start tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - */ - public void startElement (String uri, String localName) - throws SAXException - { - startElement(uri, localName, "", EMPTY_ATTS); - } - - - /** - * Start a new element without a qname, attributes or a Namespace URI. - * - *

This method will provide an empty string for the - * Namespace URI, and empty string for the qualified name, - * and a default empty attribute list. It invokes - * #startElement(String, String, String, Attributes)} - * directly.

- * - * @param localName The element's local name. - * @exception org.xml.sax.SAXException If there is an error - * writing the start tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - */ - public void startElement (String localName) - throws SAXException - { - startElement("", localName, "", EMPTY_ATTS); - } - - - /** - * End an element without a qname. - * - *

This method will supply an empty string for the qName. - * It invokes {@link #endElement(String, String, String)} - * directly.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @exception org.xml.sax.SAXException If there is an error - * writing the end tag, or if a handler further down - * the filter chain raises an exception. - * @see #endElement(String, String, String) - */ - public void endElement (String uri, String localName) - throws SAXException - { - endElement(uri, localName, ""); - } - - - /** - * End an element without a Namespace URI or qname. - * - *

This method will supply an empty string for the qName - * and an empty string for the Namespace URI. - * It invokes {@link #endElement(String, String, String)} - * directly.

- * - * @param localName The element's local name. - * @exception org.xml.sax.SAXException If there is an error - * writing the end tag, or if a handler further down - * the filter chain raises an exception. - * @see #endElement(String, String, String) - */ - public void endElement (String localName) - throws SAXException - { - endElement("", localName, ""); - } - - - /** - * Write an element with character data content. - * - *

This is a convenience method to write a complete element - * with character data content, including the start tag - * and end tag.

- * - *

This method invokes - * {@link #startElement(String, String, String, Attributes)}, - * followed by - * {@link #characters(String)}, followed by - * {@link #endElement(String, String, String)}.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param qName The element's default qualified name. - * @param atts The element's attributes. - * @param content The character data content. - * @exception org.xml.sax.SAXException If there is an error - * writing the empty tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - * @see #characters(String) - * @see #endElement(String, String, String) - */ - public void dataElement (String uri, String localName, - String qName, Attributes atts, - String content) - throws SAXException - { - startElement(uri, localName, qName, atts); - characters(content); - endElement(uri, localName, qName); - } - - - /** - * Write an element with character data content but no attributes. - * - *

This is a convenience method to write a complete element - * with character data content, including the start tag - * and end tag. This method provides an empty string - * for the qname and an empty attribute list.

- * - *

This method invokes - * {@link #startElement(String, String, String, Attributes)}, - * followed by - * {@link #characters(String)}, followed by - * {@link #endElement(String, String, String)}.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param content The character data content. - * @exception org.xml.sax.SAXException If there is an error - * writing the empty tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - * @see #characters(String) - * @see #endElement(String, String, String) - */ - public void dataElement (String uri, String localName, String content) - throws SAXException - { - dataElement(uri, localName, "", EMPTY_ATTS, content); - } - - - /** - * Write an element with character data content but no attributes or Namespace URI. - * - *

This is a convenience method to write a complete element - * with character data content, including the start tag - * and end tag. The method provides an empty string for the - * Namespace URI, and empty string for the qualified name, - * and an empty attribute list.

- * - *

This method invokes - * {@link #startElement(String, String, String, Attributes)}, - * followed by - * {@link #characters(String)}, followed by - * {@link #endElement(String, String, String)}.

- * - * @param localName The element's local name. - * @param content The character data content. - * @exception org.xml.sax.SAXException If there is an error - * writing the empty tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - * @see #characters(String) - * @see #endElement(String, String, String) - */ - public void dataElement (String localName, String content) - throws SAXException - { - dataElement("", localName, "", EMPTY_ATTS, content); - } - - - /** - * Write a string of character data, with XML escaping. - * - *

This is a convenience method that takes an XML - * String, converts it to a character array, then invokes - * {@link #characters(char[], int, int)}.

- * - * @param data The character data. - * @exception org.xml.sax.SAXException If there is an error - * writing the string, or if a handler further down - * the filter chain raises an exception. - * @see #characters(char[], int, int) - */ - public void characters (String data) throws SAXException { - try { - if (!startTagIsClosed) { - write('>'); - startTagIsClosed = true; - } - char ch[] = data.toCharArray(); - characters(ch, 0, ch.length); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////////// - - - - - /** - * Write a raw character. - * - * @param c The character to write. - */ - protected final void write (char c) throws IOException { - output.write(c); - } - - - /** - * Write a raw string. - */ - protected final void write(String s) throws IOException { - output.write(s); - } - - - /** - * Write out an attribute list, escaping values. - * - * The names will have prefixes added to them. - * - * @param atts The attribute list to write. - */ - private void writeAttributes (Attributes atts) throws IOException { - int len = atts.getLength(); - for (int i = 0; i < len; i++) { - char ch[] = atts.getValue(i).toCharArray(); - write(' '); - write(atts.getQName(i)); - write("=\""); - writeEsc(ch, 0, ch.length, true); - write('"'); - } - } - - - /** - * Write an array of data characters with escaping. - * - * @param ch The array of characters. - * @param start The starting position. - * @param length The number of characters to use. - * @param isAttVal true if this is an attribute value literal. - */ - private void writeEsc (char ch[], int start, - int length, boolean isAttVal) - throws IOException - { - escapeHandler.escape(ch, start, length, isAttVal, output); - } - - - - //////////////////////////////////////////////////////////////////// - // Constants. - //////////////////////////////////////////////////////////////////// - - private final Attributes EMPTY_ATTS = new AttributesImpl(); - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - private int elementLevel = 0; - private Writer output; - private String encoding; - private boolean writeXmlDecl = true; - /** - * This string will be written right after the xml declaration - * without any escaping. Useful for generating a boiler-plate DOCTYPE decl - * , PIs, and comments. - */ - private String header=null; - - private final CharacterEscapeHandler escapeHandler; - - private boolean startTagIsClosed = true; -} - -// end of XMLWriter.java --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/DOMScanner.java 2018-01-30 20:30:52.000000000 -0500 +++ /dev/null 2018-01-30 20:30:52.000000000 -0500 @@ -1,316 +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.xml.internal.bind.unmarshaller; - -import java.util.Enumeration; - -import javax.xml.bind.ValidationEventLocator; -import javax.xml.bind.helpers.AbstractUnmarshallerImpl; -import javax.xml.bind.helpers.ValidationEventLocatorImpl; - -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.LocatorEx; - -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.w3c.dom.ProcessingInstruction; -import org.xml.sax.ContentHandler; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; -import org.xml.sax.helpers.NamespaceSupport; - -/** - * Visits a W3C DOM tree and generates SAX2 events from it. - * - *

- * This class is just intended to be used by {@link AbstractUnmarshallerImpl}. - * The javax.xml.bind.helpers package is generally a wrong place to put - * classes like this. - * - * @author

  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
- * @since JAXB 1.0 - */ -public class DOMScanner implements LocatorEx,InfosetScanner/* --- but can't do this to protect 1.0 clients, or can I? */ -{ - - /** reference to the current node being scanned - used for determining - * location info for validation events */ - private Node currentNode = null; - - /** To save memory, only one instance of AttributesImpl will be used. */ - private final AttributesImpl atts = new AttributesImpl(); - - /** This handler will receive SAX2 events. */ - private ContentHandler receiver=null; - - private Locator locator=this; - - public DOMScanner() { - } - - - /** - * Configures the locator object that the SAX {@link ContentHandler} will see. - */ - public void setLocator( Locator loc ) { - this.locator = loc; - } - - public void scan(Object node) throws SAXException { - if( node instanceof Document ) { - scan( (Document)node ); - } else { - scan( (Element)node ); - } - } - - public void scan( Document doc ) throws SAXException { - scan( doc.getDocumentElement() ); - } - - public void scan( Element e) throws SAXException { - setCurrentLocation( e ); - - receiver.setDocumentLocator(locator); - receiver.startDocument(); - - NamespaceSupport nss = new NamespaceSupport(); - buildNamespaceSupport( nss, e.getParentNode() ); - - for( Enumeration en = nss.getPrefixes(); en.hasMoreElements(); ) { - String prefix = (String)en.nextElement(); - receiver.startPrefixMapping( prefix, nss.getURI(prefix) ); - } - - visit(e); - - for( Enumeration en = nss.getPrefixes(); en.hasMoreElements(); ) { - String prefix = (String)en.nextElement(); - receiver.endPrefixMapping( prefix ); - } - - - setCurrentLocation( e ); - receiver.endDocument(); - } - - /** - * Parses a subtree starting from the element e and - * reports SAX2 events to the specified handler. - * - * @deprecated in JAXB 2.0 - * Use {@link #scan(Element)} - */ - public void parse( Element e, ContentHandler handler ) throws SAXException { - // it might be better to set receiver at the constructor. - receiver = handler; - - setCurrentLocation( e ); - receiver.startDocument(); - - receiver.setDocumentLocator(locator); - visit(e); - - setCurrentLocation( e ); - receiver.endDocument(); - } - - /** - * Similar to the parse method but it visits the ancestor nodes - * and properly emulate the all in-scope namespace declarations. - * - * @deprecated in JAXB 2.0 - * Use {@link #scan(Element)} - */ - public void parseWithContext( Element e, ContentHandler handler ) throws SAXException { - setContentHandler(handler); - scan(e); - } - - /** - * Recursively visit ancestors and build up {@link NamespaceSupport} oject. - */ - private void buildNamespaceSupport(NamespaceSupport nss, Node node) { - if(node==null || node.getNodeType()!=Node.ELEMENT_NODE) - return; - - buildNamespaceSupport( nss, node.getParentNode() ); - - nss.pushContext(); - NamedNodeMap atts = node.getAttributes(); - for( int i=0; i=0; i-- ) { - Attr a = (Attr)attributes.item(i); - String name = a.getName(); - // start namespace binding - if(name.startsWith("xmlns")) { - if(name.length()==5) { - receiver.startPrefixMapping( "", a.getValue() ); - } else { - String localName = a.getLocalName(); - if(localName==null) { - // DOM built without namespace support has this problem - localName = name.substring(6); - } - receiver.startPrefixMapping( localName, a.getValue() ); - } - continue; - } - - String uri = a.getNamespaceURI(); - if(uri==null) uri=""; - - String local = a.getLocalName(); - if(local==null) local = a.getName(); - // add other attributes to the attribute list - // that we will pass to the ContentHandler - atts.addAttribute( - uri, - local, - a.getName(), - "CDATA", - a.getValue()); - } - - String uri = e.getNamespaceURI(); - if(uri==null) uri=""; - String local = e.getLocalName(); - String qname = e.getTagName(); - if(local==null) local = qname; - receiver.startElement( uri, local, qname, atts ); - - // visit its children - NodeList children = e.getChildNodes(); - int clen = children.getLength(); - for( int i=0; i=0; i-- ) { - Attr a = (Attr)attributes.item(i); - String name = a.getName(); - if(name.startsWith("xmlns")) { - if(name.length()==5) - receiver.endPrefixMapping(""); - else - receiver.endPrefixMapping(a.getLocalName()); - } - } - } - - private void visit( Node n ) throws SAXException { - setCurrentLocation( n ); - - // if a case statement gets too big, it should be made into a separate method. - switch(n.getNodeType()) { - case Node.CDATA_SECTION_NODE: - case Node.TEXT_NODE: - String value = n.getNodeValue(); - receiver.characters( value.toCharArray(), 0, value.length() ); - break; - case Node.ELEMENT_NODE: - visit( (Element)n ); - break; - case Node.ENTITY_REFERENCE_NODE: - receiver.skippedEntity(n.getNodeName()); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - ProcessingInstruction pi = (ProcessingInstruction)n; - receiver.processingInstruction(pi.getTarget(),pi.getData()); - break; - } - } - - private void setCurrentLocation( Node currNode ) { - currentNode = currNode; - } - - /** - * The same as {@link #getCurrentElement()} but - * better typed. - */ - public Node getCurrentLocation() { - return currentNode; - } - - public Object getCurrentElement() { - return currentNode; - } - - public LocatorEx getLocator() { - return this; - } - - public void setContentHandler(ContentHandler handler) { - this.receiver = handler; - } - - public ContentHandler getContentHandler() { - return this.receiver; - } - - - // LocatorEx implementation - public String getPublicId() { return null; } - public String getSystemId() { return null; } - public int getLineNumber() { return -1; } - public int getColumnNumber() { return -1; } - - public ValidationEventLocator getLocation() { - return new ValidationEventLocatorImpl(getCurrentLocation()); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/InfosetScanner.java 2018-01-30 20:30:52.000000000 -0500 +++ /dev/null 2018-01-30 20:30:52.000000000 -0500 @@ -1,98 +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.xml.internal.bind.unmarshaller; - -import javax.xml.bind.Binder; - -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.LocatorEx; - -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; - -/** - * Visits a DOM-ish API and generates SAX events. - * - *

- * This interface is not tied to any particular DOM API. - * Used by the {@link Binder}. - * - *

- * Since we are parsing a DOM-ish tree, I don't think this - * scanner itself will ever find an error, so this class - * doesn't have its own error reporting scheme. - * - *

- * This interface MAY NOT be implemented by the generated - * runtime nor the generated code. We may add new methods on - * this interface later. This is to be implemented by the static runtime - * only. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * @since 2.0 - */ -public interface InfosetScanner { - /** - * Parses the given DOM-ish element/document and generates - * SAX events. - * - * @throws ClassCastException - * If the type of the node is not known to this implementation. - * - * @throws SAXException - * If the {@link ContentHandler} throws a {@link SAXException}. - * Do not throw an exception just because the scanner failed - * (if that can happen we need to change the API.) - */ - void scan( XmlNode node ) throws SAXException; - - /** - * Sets the {@link ContentHandler}. - * - * This handler receives the SAX events. - */ - void setContentHandler( ContentHandler handler ); - ContentHandler getContentHandler(); - - /** - * Gets the current element we are parsing. - * - *

- * This method could - * be called from the {@link ContentHandler#startElement(String, String, String, Attributes)} - * or {@link ContentHandler#endElement(String, String, String)}. - * - *

- * Otherwise the behavior of this method is undefined. - * - * @return - * never return null. - */ - XmlNode getCurrentElement(); - - LocatorEx getLocator(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages.java 2018-01-30 20:30:53.000000000 -0500 +++ /dev/null 2018-01-30 20:30:53.000000000 -0500 @@ -1,101 +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.xml.internal.bind.unmarshaller; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Formats error messages. - * - * @since JAXB 1.0 - */ -public class Messages -{ - public static String format( String property ) { - return format( property, null ); - } - - public static String format( String property, Object arg1 ) { - return format( property, new Object[]{arg1} ); - } - - public static String format( String property, Object arg1, Object arg2 ) { - return format( property, new Object[]{arg1,arg2} ); - } - - public static String format( String property, Object arg1, Object arg2, Object arg3 ) { - return format( property, new Object[]{arg1,arg2,arg3} ); - } - - // add more if necessary. - - /** Loads a string resource and formats it with specified arguments. */ - public static String format( String property, Object[] args ) { - String text = ResourceBundle.getBundle(Messages.class.getName()).getString(property); - return MessageFormat.format(text,args); - } - -// -// -// Message resources -// -// - public static final String UNEXPECTED_ENTER_ELEMENT = // arg:2 - "ContentHandlerEx.UnexpectedEnterElement"; - - public static final String UNEXPECTED_LEAVE_ELEMENT = // arg:2 - "ContentHandlerEx.UnexpectedLeaveElement"; - - public static final String UNEXPECTED_ENTER_ATTRIBUTE =// arg:2 - "ContentHandlerEx.UnexpectedEnterAttribute"; - - public static final String UNEXPECTED_LEAVE_ATTRIBUTE =// arg:2 - "ContentHandlerEx.UnexpectedLeaveAttribute"; - - public static final String UNEXPECTED_TEXT =// arg:1 - "ContentHandlerEx.UnexpectedText"; - - public static final String UNEXPECTED_LEAVE_CHILD = // 0 args - "ContentHandlerEx.UnexpectedLeaveChild"; - - public static final String UNEXPECTED_ROOT_ELEMENT = // 1 arg - "SAXUnmarshallerHandlerImpl.UnexpectedRootElement"; - - // Usage not found. TODO Remove - // public static final String UNEXPECTED_ROOT_ELEMENT2 = // 3 arg - // "SAXUnmarshallerHandlerImpl.UnexpectedRootElement2"; - - public static final String UNDEFINED_PREFIX = // 1 arg - "Util.UndefinedPrefix"; - - public static final String NULL_READER = // 0 args - "Unmarshaller.NullReader"; - - public static final String ILLEGAL_READER_STATE = // 1 arg - "Unmarshaller.IllegalReaderState"; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages.properties 2018-01-30 20:30:54.000000000 -0500 +++ /dev/null 2018-01-30 20:30:54.000000000 -0500 @@ -1,69 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = \ - Unexpected element '{'{0}'}':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = \ - Unexpected end of element '{'{0}'}':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = \ - Unexpected attribute '{'{0}'}':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = \ - Unexpected end of attribute '{'{0}'}':{1} - -ContentHandlerEx.UnexpectedText = \ - Unexpected text "{0}" - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = \ - compiler error(unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = \ - unexpected root element {0} - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = \ - undefined prefix: {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = \ - reader can not be null - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = \ - reader must be on a START_ELEMENT event, not a {0} event --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages_de.properties 2018-01-30 20:30:55.000000000 -0500 +++ /dev/null 2018-01-30 20:30:55.000000000 -0500 @@ -1,59 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = Unerwartetes Element ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = Unerwartetes Ende von Element ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = Unerwartetes Attribut ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = Unerwartetes Ende von Attribut ''{''{0}''}'':{1} - -ContentHandlerEx.UnexpectedText = Unerwarteter Text "{0}" - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = Compilerfehler (unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = unerwartetes Root-Element {0} - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = unerwartetes Pr\u00E4fix: {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = Reader darf nicht null sein\t - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = Reader muss auf ein START_ELEMENT-Ereignis gesetzt sein und kein {0}-Ereignis --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages_es.properties 2018-01-30 20:30:55.000000000 -0500 +++ /dev/null 2018-01-30 20:30:56.000000000 -0500 @@ -1,59 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = Elemento ''{''{0}''}'':{1} inesperado - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = Fin de elemento ''{''{0}''}'':{1} inesperado - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = Atributo ''{''{0}''}'':{1} inesperado - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = Fin de atributo ''{''{0}''}'':{1} inesperado - -ContentHandlerEx.UnexpectedText = Texto "{0}" inesperado - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = error del compilador (unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = elemento ra\u00EDz {0} inesperado - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = prefijo no definido: {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = El lector no puede ser nulo.\t - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = El lector debe estar en un evento START_ELEMENT, no en un evento {0}. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages_fr.properties 2018-01-30 20:30:56.000000000 -0500 +++ /dev/null 2018-01-30 20:30:56.000000000 -0500 @@ -1,59 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = El\u00E9ment ''{''{0}''}'':{1} inattendu - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = Fin inattendue de l''\u00E9l\u00E9ment ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = Attribut ''{''{0}''}'':{1} inattendu - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = Fin inattendue de l''attribut ''{''{0}''}'':{1} - -ContentHandlerEx.UnexpectedText = Texte "{0}" inattendu - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = erreur de compilateur (unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = \u00E9l\u00E9ment racine {0} inattendu - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = pr\u00E9fixe non d\u00E9fini : {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = le processus de lecture ne peut pas \u00EAtre NULL\t - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = le processus de lecture doit figurer sur un \u00E9v\u00E9nement START_ELEMENT, et non un \u00E9v\u00E9nement {0} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages_it.properties 2018-01-30 20:30:57.000000000 -0500 +++ /dev/null 2018-01-30 20:30:57.000000000 -0500 @@ -1,59 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = Elemento imprevisto ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = Fine imprevista dell''elemento ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = Attributo imprevisto ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = Fine imprevista dell''attributo ''{''{0}''}'':{1} - -ContentHandlerEx.UnexpectedText = Testo imprevisto "{0}" - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = errore del compilatore (unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = elemento radice imprevisto {0} - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = prefisso non definito: {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = il processo di lettura non pu\u00F2 essere nullo\t - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = il processo di lettura deve trovarsi su un evento START_ELEMENT non su un evento {0} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages_ja.properties 2018-01-30 20:30:58.000000000 -0500 +++ /dev/null 2018-01-30 20:30:58.000000000 -0500 @@ -1,59 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = \u4E88\u671F\u3057\u306A\u3044\u8981\u7D20''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = \u4E88\u671F\u3057\u306A\u3044\u8981\u7D20\u306E\u7D42\u308F\u308A''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = \u4E88\u671F\u3057\u306A\u3044\u5C5E\u6027''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = \u4E88\u671F\u3057\u306A\u3044\u5C5E\u6027\u306E\u7D42\u308F\u308A''{''{0}''}'':{1} - -ContentHandlerEx.UnexpectedText = \u4E88\u671F\u3057\u306A\u3044\u30C6\u30AD\u30B9\u30C8"{0}" - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = \u30B3\u30F3\u30D1\u30A4\u30EB\u30FB\u30A8\u30E9\u30FC(unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = \u4E88\u671F\u3057\u306A\u3044\u30EB\u30FC\u30C8\u8981\u7D20{0} - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = \u672A\u5B9A\u7FA9\u306E\u63A5\u982D\u8F9E: {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = \u30EA\u30FC\u30C0\u30FC\u306Fnull\u306B\u3067\u304D\u307E\u305B\u3093\t - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = \u30EA\u30FC\u30C0\u30FC\u306F{0}\u30A4\u30D9\u30F3\u30C8\u3067\u306F\u306A\u304F\u3001START_ELEMENT\u306B\u5B58\u5728\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages_ko.properties 2018-01-30 20:30:58.000000000 -0500 +++ /dev/null 2018-01-30 20:30:58.000000000 -0500 @@ -1,59 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = \uC608\uC0C1\uCE58 \uC54A\uC740 ''{''{0}''}'':{1} \uC694\uC18C - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = \uC608\uC0C1\uCE58 \uC54A\uC740 ''{''{0}''}'':{1} \uC694\uC18C\uC758 \uB05D - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = \uC608\uC0C1\uCE58 \uC54A\uC740 ''{''{0}''}'':{1} \uC18D\uC131 - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = \uC608\uC0C1\uCE58 \uC54A\uC740 ''{''{0}''}'':{1} \uC18D\uC131\uC758 \uB05D - -ContentHandlerEx.UnexpectedText = \uC608\uC0C1\uCE58 \uC54A\uC740 "{0}" \uD14D\uC2A4\uD2B8 - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = \uCEF4\uD30C\uC77C\uB7EC \uC624\uB958(unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = \uC608\uC0C1\uCE58 \uC54A\uC740 \uB8E8\uD2B8 \uC694\uC18C {0} - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = \uC815\uC758\uB418\uC9C0 \uC54A\uC740 \uC811\uB450\uC5B4: {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = \uC77D\uAE30 \uC7A5\uCE58\uB294 \uB110\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.\t - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = \uC77D\uAE30 \uC7A5\uCE58\uB294 {0} \uC774\uBCA4\uD2B8\uAC00 \uC544\uB2CC START_ELEMENT \uC774\uBCA4\uD2B8\uC5D0 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages_pt_BR.properties 2018-01-30 20:30:59.000000000 -0500 +++ /dev/null 2018-01-30 20:30:59.000000000 -0500 @@ -1,59 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = Elemento "{{0}}":{1} inesperado - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = Fim inesperado do elemento "{{0}}":{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = Atributo "{{0}}":{1} inesperado - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = Fim inesperado do atributo "{{0}}":{1} - -ContentHandlerEx.UnexpectedText = Texto "{0}" inesperado - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = erro do compilador (unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = elemento-raiz {0} inesperado - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = prefixo indefinido: {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = o leitor n\u00E3o pode ser nulo\t - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = o leitor deve estar em um evento START_ELEMENT, n\u00E3o em um evento {0} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages_zh_CN.properties 2018-01-30 20:31:00.000000000 -0500 +++ /dev/null 2018-01-30 20:31:00.000000000 -0500 @@ -1,59 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = \u610F\u5916\u7684\u5143\u7D20 ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = \u610F\u5916\u7684\u5143\u7D20\u7ED3\u5C3E ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = \u610F\u5916\u7684\u5C5E\u6027 ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = \u610F\u5916\u7684\u5C5E\u6027\u7ED3\u5C3E ''{''{0}''}'':{1} - -ContentHandlerEx.UnexpectedText = \u610F\u5916\u7684\u6587\u672C "{0}" - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = \u7F16\u8BD1\u5668\u9519\u8BEF (unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = \u610F\u5916\u7684\u6839\u5143\u7D20{0} - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = \u672A\u5B9A\u4E49\u7684\u524D\u7F00: {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = \u8BFB\u8FDB\u7A0B\u4E0D\u80FD\u4E3A\u7A7A\u503C\t - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = \u8BFB\u8FDB\u7A0B\u5FC5\u987B\u4F4D\u4E8E START_ELEMENT \u4E8B\u4EF6\u4E0A, \u800C\u4E0D\u662F{0}\u4E8B\u4EF6\u4E0A --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Messages_zh_TW.properties 2018-01-30 20:31:00.000000000 -0500 +++ /dev/null 2018-01-30 20:31:00.000000000 -0500 @@ -1,59 +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. -# - -# -# don't modify nor delete anything for backward compatibility -# - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterElement = \u672A\u9810\u671F\u7684\u5143\u7D20 ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveElement = \u672A\u9810\u671F\u7684\u5143\u7D20\u7D50\u5C3E ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedEnterAttribute = \u672A\u9810\u671F\u7684\u5C6C\u6027 ''{''{0}''}'':{1} - -# {0} - namespace uri, {1} - local name of the attribute/element e.g.: Unexpected end of attribute {http://www.w3.org/XML/1998/namespace}:lang -ContentHandlerEx.UnexpectedLeaveAttribute = \u672A\u9810\u671F\u7684\u5C6C\u6027\u7D50\u5C3E ''{''{0}''}'':{1} - -ContentHandlerEx.UnexpectedText = \u672A\u9810\u671F\u7684\u6587\u5B57 "{0}" - -# Wrapped into an InternalError. e.g.: java.lang.InternalError: compiler error(unexpectedLeaveChild) -ContentHandlerEx.UnexpectedLeaveChild = \u7DE8\u8B6F\u5668\u932F\u8AA4 (unexpectedLeaveChild) - -SAXUnmarshallerHandlerImpl.UnexpectedRootElement = \u672A\u9810\u671F\u7684\u6839\u5143\u7D20 {0} - -# Usage not found. TODO Remove -#SAXUnmarshallerHandlerImpl.UnexpectedRootElement2 = \ -# unexpected root element (uri:"{0}", local:"{1}"). Expected elements are {2} - -Util.UndefinedPrefix = \u672A\u5B9A\u7FA9\u7684\u524D\u7F6E\u78BC: {0} - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.NullReader = \u8B80\u53D6\u5668\u4E0D\u53EF\u70BA\u7A7A\u503C\t - -# Not concatenated with any other string (written on a separate line). -Unmarshaller.IllegalReaderState = \u8B80\u53D6\u5668\u5FC5\u9808\u4F4D\u65BC START_ELEMENT \u4E8B\u4EF6, \u800C\u975E {0} \u4E8B\u4EF6 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/unmarshaller/Patcher.java 2018-01-30 20:31:01.000000000 -0500 +++ /dev/null 2018-01-30 20:31:01.000000000 -0500 @@ -1,47 +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.xml.internal.bind.unmarshaller; - -import org.xml.sax.SAXException; - -/** - * Runs by UnmarshallingContext after all the parsing is done. - * - * Primarily used to resolve forward IDREFs, but it can run any action. - * - * @author Kohsuke Kawaguchi - */ -public interface Patcher { - /** - * Runs an post-action. - * - * @throws SAXException - * if an error is found during the action, it should be reporeted to the context. - * The context may then throw a {@link SAXException} to abort the processing, - * and that's when you can throw a {@link SAXException}. - */ - void run() throws SAXException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/util/AttributesImpl.java 2018-01-30 20:31:02.000000000 -0500 +++ /dev/null 2018-01-30 20:31:02.000000000 -0500 @@ -1,654 +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. - */ - -// AttributesImpl.java - default implementation of Attributes. -// http://www.saxproject.org -// Written by David Megginson -// NO WARRANTY! This class is in the public domain. -package com.sun.xml.internal.bind.util; - -import org.xml.sax.Attributes; - - -/** - * Default implementation of the Attributes interface. - * - *

- * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - *
- * - *

This class provides a default implementation of the SAX2 - * {@link org.xml.sax.Attributes Attributes} interface, with the - * addition of manipulators so that the list can be modified or - * reused.

- * - *

There are two typical uses of this class:

- * - *
    - *
  1. to take a persistent snapshot of an Attributes object - * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or
  2. - *
  3. to construct or modify an Attributes object in a SAX2 driver or filter.
  4. - *
- * - *

This class replaces the now-deprecated SAX1 {@link - * org.xml.sax.helpers.AttributeListImpl AttributeListImpl} - * class; in addition to supporting the updated Attributes - * interface rather than the deprecated {@link org.xml.sax.AttributeList - * AttributeList} interface, it also includes a much more efficient - * implementation using a single array rather than a set of Vectors.

- * - * @since JAXB 1.0 - * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - */ -public class AttributesImpl implements Attributes -{ - - - //////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////// - - - /** - * Construct a new, empty AttributesImpl object. - */ - public AttributesImpl () - { - length = 0; - data = null; - } - - - /** - * Copy an existing Attributes object. - * - *

This constructor is especially useful inside a - * {@link org.xml.sax.ContentHandler#startElement startElement} event.

- * - * @param atts The existing Attributes object. - */ - public AttributesImpl (Attributes atts) - { - setAttributes(atts); - } - - - - //////////////////////////////////////////////////////////////////// - // Implementation of org.xml.sax.Attributes. - //////////////////////////////////////////////////////////////////// - - - /** - * Return the number of attributes in the list. - * - * @return The number of attributes in the list. - * @see org.xml.sax.Attributes#getLength() - */ - public int getLength () - { - return length; - } - - - /** - * Return an attribute's Namespace URI. - * - * @param index The attribute's index (zero-based). - * @return The Namespace URI, the empty string if none is - * available, or null if the index is out of range. - * @see org.xml.sax.Attributes#getURI(int) - */ - public String getURI (int index) - { - if (index >= 0 && index < length) { - return data[index*5]; - } else { - return null; - } - } - - - /** - * Return an attribute's local name. - * - * @param index The attribute's index (zero-based). - * @return The attribute's local name, the empty string if - * none is available, or null if the index if out of range. - * @see org.xml.sax.Attributes#getLocalName(int) - */ - public String getLocalName (int index) - { - if (index >= 0 && index < length) { - return data[index*5+1]; - } else { - return null; - } - } - - - /** - * Return an attribute's qualified (prefixed) name. - * - * @param index The attribute's index (zero-based). - * @return The attribute's qualified name, the empty string if - * none is available, or null if the index is out of bounds. - * @see org.xml.sax.Attributes#getQName(int) - */ - public String getQName (int index) - { - if (index >= 0 && index < length) { - return data[index*5+2]; - } else { - return null; - } - } - - - /** - * Return an attribute's type by index. - * - * @param index The attribute's index (zero-based). - * @return The attribute's type, "CDATA" if the type is unknown, or null - * if the index is out of bounds. - * @see org.xml.sax.Attributes#getType(int) - */ - public String getType (int index) - { - if (index >= 0 && index < length) { - return data[index*5+3]; - } else { - return null; - } - } - - - /** - * Return an attribute's value by index. - * - * @param index The attribute's index (zero-based). - * @return The attribute's value or null if the index is out of bounds. - * @see org.xml.sax.Attributes#getValue(int) - */ - public String getValue (int index) - { - if (index >= 0 && index < length) { - return data[index*5+4]; - } else { - return null; - } - } - - - /** - * Look up an attribute's index by Namespace name. - * - *

In many cases, it will be more efficient to look up the name once and - * use the index query methods rather than using the name query methods - * repeatedly.

- * - * @param uri The attribute's Namespace URI, or the empty - * string if none is available. - * @param localName The attribute's local name. - * @return The attribute's index, or -1 if none matches. - * @see org.xml.sax.Attributes#getIndex(java.lang.String,java.lang.String) - */ - public int getIndex (String uri, String localName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i].equals(uri) && data[i+1].equals(localName)) { - return i / 5; - } - } - return -1; - } - - /** - * Can be used if parameters are interned. - */ - public int getIndexFast(String uri, String localName) { - for (int i = (length-1)*5; i>=0; i-=5) { - // local names tend to be different, so test it first - if (data[i + 1] == localName && data[i] == uri ) { - return i / 5; - } - } - return -1; - } - - - /** - * Look up an attribute's index by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's index, or -1 if none matches. - * @see org.xml.sax.Attributes#getIndex(java.lang.String) - */ - public int getIndex (String qName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i+2].equals(qName)) { - return i / 5; - } - } - return -1; - } - - - /** - * Look up an attribute's type by Namespace-qualified name. - * - * @param uri The Namespace URI, or the empty string for a name - * with no explicit Namespace URI. - * @param localName The local name. - * @return The attribute's type, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getType(java.lang.String,java.lang.String) - */ - public String getType (String uri, String localName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i].equals(uri) && data[i+1].equals(localName)) { - return data[i+3]; - } - } - return null; - } - - - /** - * Look up an attribute's type by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's type, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getType(java.lang.String) - */ - public String getType (String qName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i+2].equals(qName)) { - return data[i+3]; - } - } - return null; - } - - - /** - * Look up an attribute's value by Namespace-qualified name. - * - * @param uri The Namespace URI, or the empty string for a name - * with no explicit Namespace URI. - * @param localName The local name. - * @return The attribute's value, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getValue(java.lang.String,java.lang.String) - */ - public String getValue (String uri, String localName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i].equals(uri) && data[i+1].equals(localName)) { - return data[i+4]; - } - } - return null; - } - - - /** - * Look up an attribute's value by qualified (prefixed) name. - * - * @param qName The qualified name. - * @return The attribute's value, or null if there is no - * matching attribute. - * @see org.xml.sax.Attributes#getValue(java.lang.String) - */ - public String getValue (String qName) - { - int max = length * 5; - for (int i = 0; i < max; i += 5) { - if (data[i+2].equals(qName)) { - return data[i+4]; - } - } - return null; - } - - - - //////////////////////////////////////////////////////////////////// - // Manipulators. - //////////////////////////////////////////////////////////////////// - - - /** - * Clear the attribute list for reuse. - * - *

Note that little memory is freed by this call: - * the current array is kept so it can be - * reused.

- */ - public void clear () - { - if (data != null) { - for (int i = 0; i < (length * 5); i++) - data [i] = null; - } - length = 0; - } - - - /** - * Copy an entire Attributes object. - * - *

It may be more efficient to reuse an existing object - * rather than constantly allocating new ones.

- * - * @param atts The attributes to copy. - */ - public void setAttributes (Attributes atts) - { - clear(); - length = atts.getLength(); - if (length > 0) { - data = new String[length*5]; - for (int i = 0; i < length; i++) { - data[i*5] = atts.getURI(i); - data[i*5+1] = atts.getLocalName(i); - data[i*5+2] = atts.getQName(i); - data[i*5+3] = atts.getType(i); - data[i*5+4] = atts.getValue(i); - } - } - } - - - /** - * Add an attribute to the end of the list. - * - *

For the sake of speed, this method does no checking - * to see if the attribute is already in the list: that is - * the responsibility of the application.

- * - * @param uri The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified (prefixed) name, or the empty string - * if qualified names are not available. - * @param type The attribute type as a string. - * @param value The attribute value. - */ - public void addAttribute (String uri, String localName, String qName, - String type, String value) - { - ensureCapacity(length+1); - data[length*5] = uri; - data[length*5+1] = localName; - data[length*5+2] = qName; - data[length*5+3] = type; - data[length*5+4] = value; - length++; - } - - - /** - * Set an attribute in the list. - * - *

For the sake of speed, this method does no checking - * for name conflicts or well-formedness: such checks are the - * responsibility of the application.

- * - * @param index The index of the attribute (zero-based). - * @param uri The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified name, or the empty string - * if qualified names are not available. - * @param type The attribute type as a string. - * @param value The attribute value. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setAttribute (int index, String uri, String localName, - String qName, String type, String value) - { - if (index >= 0 && index < length) { - data[index*5] = uri; - data[index*5+1] = localName; - data[index*5+2] = qName; - data[index*5+3] = type; - data[index*5+4] = value; - } else { - badIndex(index); - } - } - - - /** - * Remove an attribute from the list. - * - * @param index The index of the attribute (zero-based). - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void removeAttribute (int index) - { - if (index >= 0 && index < length) { - if (index < length - 1) { - System.arraycopy(data, (index+1)*5, data, index*5, - (length-index-1)*5); - } - index = (length - 1) * 5; - data [index++] = null; - data [index++] = null; - data [index++] = null; - data [index++] = null; - data [index] = null; - length--; - } else { - badIndex(index); - } - } - - - /** - * Set the Namespace URI of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param uri The attribute's Namespace URI, or the empty - * string for none. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setURI (int index, String uri) - { - if (index >= 0 && index < length) { - data[index*5] = uri; - } else { - badIndex(index); - } - } - - - /** - * Set the local name of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param localName The attribute's local name, or the empty - * string for none. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setLocalName (int index, String localName) - { - if (index >= 0 && index < length) { - data[index*5+1] = localName; - } else { - badIndex(index); - } - } - - - /** - * Set the qualified name of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param qName The attribute's qualified name, or the empty - * string for none. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setQName (int index, String qName) - { - if (index >= 0 && index < length) { - data[index*5+2] = qName; - } else { - badIndex(index); - } - } - - - /** - * Set the type of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param type The attribute's type. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setType (int index, String type) - { - if (index >= 0 && index < length) { - data[index*5+3] = type; - } else { - badIndex(index); - } - } - - - /** - * Set the value of a specific attribute. - * - * @param index The index of the attribute (zero-based). - * @param value The attribute's value. - * @exception java.lang.ArrayIndexOutOfBoundsException When the - * supplied index does not point to an attribute - * in the list. - */ - public void setValue (int index, String value) - { - if (index >= 0 && index < length) { - data[index*5+4] = value; - } else { - badIndex(index); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Ensure the internal array's capacity. - * - * @param n The minimum number of attributes that the array must - * be able to hold. - */ - private void ensureCapacity (int n) { - if (n <= 0) { - return; - } - int max; - if (data == null || data.length == 0) { - max = 25; - } - else if (data.length >= n * 5) { - return; - } - else { - max = data.length; - } - while (max < n * 5) { - max *= 2; - } - - String newData[] = new String[max]; - if (length > 0) { - System.arraycopy(data, 0, newData, 0, length*5); - } - data = newData; - } - - - /** - * Report a bad array index in a manipulator. - * - * @param index The index to report. - * @exception java.lang.ArrayIndexOutOfBoundsException Always. - */ - private void badIndex (int index) - throws ArrayIndexOutOfBoundsException - { - String msg = - "Attempt to modify attribute at illegal index: " + index; - throw new ArrayIndexOutOfBoundsException(msg); - } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - int length; - String data []; - -} - -// end of AttributesImpl.java --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/util/SecureLoader.java 2018-01-30 20:31:03.000000000 -0500 +++ /dev/null 2018-01-30 20:31:03.000000000 -0500 @@ -1,75 +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.bind.util; - -/** - * Class defined for safe calls of getClassLoader methods of any kind (context/system/class - * classloader. This MUST be package private and defined in every package which - * uses such invocations. - * @author snajper - */ -class SecureLoader { - - static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - - static ClassLoader getClassClassLoader(final Class c) { - if (System.getSecurityManager() == null) { - return c.getClassLoader(); - } else { - return java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public ClassLoader run() { - return c.getClassLoader(); - } - }); - } - } - - static ClassLoader getSystemClassLoader() { - if (System.getSecurityManager() == null) { - return ClassLoader.getSystemClassLoader(); - } else { - return java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public ClassLoader run() { - return ClassLoader.getSystemClassLoader(); - } - }); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/util/ValidationEventLocatorExImpl.java 2018-01-30 20:31:03.000000000 -0500 +++ /dev/null 2018-01-30 20:31:03.000000000 -0500 @@ -1,73 +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.xml.internal.bind.util; - -import javax.xml.bind.helpers.ValidationEventLocatorImpl; - -import com.sun.xml.internal.bind.ValidationEventLocatorEx; - -/** - * - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class ValidationEventLocatorExImpl - extends ValidationEventLocatorImpl implements ValidationEventLocatorEx { - - private final String fieldName; - - public ValidationEventLocatorExImpl( Object target, String fieldName ) { - super(target); - this.fieldName = fieldName; - } - - public String getFieldName() { - return fieldName; - } - - /** - * Returns a nice string representation for better debug experience. - */ - public String toString() { - StringBuffer buf = new StringBuffer(); - buf.append("[url="); - buf.append(getURL()); - buf.append(",line="); - buf.append(getLineNumber()); - buf.append(",column="); - buf.append(getColumnNumber()); - buf.append(",node="); - buf.append(getNode()); - buf.append(",object="); - buf.append(getObject()); - buf.append(",field="); - buf.append(getFieldName()); - buf.append("]"); - - return buf.toString(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/util/Which.java 2018-01-30 20:31:04.000000000 -0500 +++ /dev/null 2018-01-30 20:31:04.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1997, 2016, 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.bind.util; - -import java.net.URL; - -/** - * Finds out where a class file is loaded from. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class Which { - - public static String which( Class clazz ) { - return which( clazz.getName(), SecureLoader.getClassClassLoader(clazz)); - } - - /** - * Search the specified classloader for the given classname. - * Then give the return value. - * @param classname the fully qualified name of the class to search for - * @param loader the classloader to search - * @return the source location of the resource, or null if it wasn't found - */ - public static String which(String classname, ClassLoader loader) { - - String classnameAsResource = classname.replace('.', '/') + ".class"; - - if(loader == null) { - loader = SecureLoader.getSystemClassLoader(); - } - - URL it = loader.getResource(classnameAsResource); - if (it != null) { - return it.toString(); - } else { - return null; - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ClassFactory.java 2018-01-30 20:31:05.000000000 -0500 +++ /dev/null 2018-01-30 20:31:05.000000000 -0500 @@ -1,225 +0,0 @@ -/* - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.xml.internal.bind.v2; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.ref.WeakReference; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Map; -import java.util.WeakHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.sun.xml.internal.bind.Util; - -/** - * Creates new instances of classes. - * - *

- * This code handles the case where the class is not public or the constructor is - * not public. - * - * @since 2.0 - * @author Kohsuke Kawaguchi - */ -public final class ClassFactory { - private static final Class[] emptyClass = new Class[0]; - private static final Object[] emptyObject = new Object[0]; - - private static final Logger logger = Util.getClassLogger(); - - /** - * Cache from a class to its default constructor. - * - * To avoid synchronization among threads, we use {@link ThreadLocal}. - */ - private static final ThreadLocal>> tls = new ThreadLocal>>() { - @Override - public Map> initialValue() { - return new WeakHashMap>(); - } - }; - - public static void cleanCache() { - if (tls != null) { - try { - tls.remove(); - } catch (Exception e) { - logger.log(Level.WARNING, "Unable to clean Thread Local cache of classes used in Unmarshaller: {0}", e.getLocalizedMessage()); - } - } - } - - /** - * Creates a new instance of the class but throw exceptions without catching it. - */ - public static T create0( final Class clazz ) throws IllegalAccessException, InvocationTargetException, InstantiationException { - Map> m = tls.get(); - Constructor cons = null; - WeakReference consRef = m.get(clazz); - if(consRef!=null) - cons = consRef.get(); - if(cons==null) { - if (System.getSecurityManager() == null) { - cons = tryGetDeclaredConstructor(clazz); - } else { - cons = AccessController.doPrivileged(new PrivilegedAction>() { - @Override - public Constructor run() { - return tryGetDeclaredConstructor(clazz); - } - }); - } - - int classMod = clazz.getModifiers(); - - if(!Modifier.isPublic(classMod) || !Modifier.isPublic(cons.getModifiers())) { - // attempt to make it work even if the constructor is not accessible - try { - cons.setAccessible(true); - } catch(SecurityException e) { - // but if we don't have a permission to do so, work gracefully. - logger.log(Level.FINE,"Unable to make the constructor of "+clazz+" accessible",e); - throw e; - } - } - - m.put(clazz,new WeakReference(cons)); - } - return cons.newInstance(emptyObject); - } - - private static Constructor tryGetDeclaredConstructor(Class clazz) { - try { - return clazz.getDeclaredConstructor((Class[])emptyClass); - } catch (NoSuchMethodException e) { - logger.log(Level.INFO,"No default constructor found on "+clazz,e); - NoSuchMethodError exp; - if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) { - exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS - .format(clazz.getName())); - } else { - exp = new NoSuchMethodError(e.getMessage()); - } - exp.initCause(e); - throw exp; - } - } - - /** - * The same as {@link #create0} but with an error handling to make - * the instantiation error fatal. - */ - public static T create( Class clazz ) { - try { - return create0(clazz); - } catch (InstantiationException e) { - logger.log(Level.INFO,"failed to create a new instance of "+clazz,e); - throw new InstantiationError(e.toString()); - } catch (IllegalAccessException e) { - logger.log(Level.INFO,"failed to create a new instance of "+clazz,e); - throw new IllegalAccessError(e.toString()); - } catch (InvocationTargetException e) { - Throwable target = e.getTargetException(); - - // most likely an error on the user's code. - // just let it through for the ease of debugging - if(target instanceof RuntimeException) - throw (RuntimeException)target; - - // error. just forward it for the ease of debugging - if(target instanceof Error) - throw (Error)target; - - // a checked exception. - // not sure how we should report this error, - // but for now we just forward it by wrapping it into a runtime exception - throw new IllegalStateException(target); - } - } - - /** - * Call a method in the factory class to get the object. - */ - public static Object create(Method method) { - Throwable errorMsg; - try { - return method.invoke(null, emptyObject); - } catch (InvocationTargetException ive) { - Throwable target = ive.getTargetException(); - - if(target instanceof RuntimeException) - throw (RuntimeException)target; - - if(target instanceof Error) - throw (Error)target; - - throw new IllegalStateException(target); - } catch (IllegalAccessException e) { - logger.log(Level.INFO,"failed to create a new instance of "+method.getReturnType().getName(),e); - throw new IllegalAccessError(e.toString()); - } catch (IllegalArgumentException iae){ - logger.log(Level.INFO,"failed to create a new instance of "+method.getReturnType().getName(),iae); - errorMsg = iae; - } catch (NullPointerException npe){ - logger.log(Level.INFO,"failed to create a new instance of "+method.getReturnType().getName(),npe); - errorMsg = npe; - } catch (ExceptionInInitializerError eie){ - logger.log(Level.INFO,"failed to create a new instance of "+method.getReturnType().getName(),eie); - errorMsg = eie; - } - - NoSuchMethodError exp; - exp = new NoSuchMethodError(errorMsg.getMessage()); - exp.initCause(errorMsg); - throw exp; - } - - /** - * Infers the instanciable implementation class that can be assigned to the given field type. - * - * @return null - * if inference fails. - */ - public static Class inferImplClass(Class fieldType, Class[] knownImplClasses) { - if(!fieldType.isInterface()) - return fieldType; - - for( Class impl : knownImplClasses ) { - if(fieldType.isAssignableFrom(impl)) - return impl.asSubclass(fieldType); - } - - // if we can't find an implementation class, - // let's just hope that we will never need to create a new object, - // and returns null - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/ContextFactory.java 2018-01-30 20:31:05.000000000 -0500 +++ /dev/null 2018-01-30 20:31:06.000000000 -0500 @@ -1,325 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.StringTokenizer; -import java.util.logging.Level; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import com.sun.istack.internal.FinalArrayList; -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.api.JAXBRIContext; -import com.sun.xml.internal.bind.api.TypeReference; -import com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.util.TypeCast; - -/** - * This class is responsible for producing RI JAXBContext objects. In - * the RI, this is the class that the javax.xml.bind.context.factory - * property will point to. - * - *

- * Used to create JAXBContext objects for v1.0.1 and forward - * - * @since 2.0 - * @author Kohsuke Kawaguchi - */ -public class ContextFactory { - - /** - * The API will invoke this method via reflection - */ - public static JAXBContext createContext(Class[] classes, Map properties ) throws JAXBException { - // fool-proof check, and copy the map to make it easier to find unrecognized properties. - if(properties==null) - properties = Collections.emptyMap(); - else - properties = new HashMap(properties); - - String defaultNsUri = getPropertyValue(properties,JAXBRIContext.DEFAULT_NAMESPACE_REMAP,String.class); - - Boolean c14nSupport = getPropertyValue(properties,JAXBRIContext.CANONICALIZATION_SUPPORT,Boolean.class); - if(c14nSupport==null) - c14nSupport = false; - - Boolean disablesecurityProcessing = getPropertyValue(properties, JAXBRIContext.DISABLE_XML_SECURITY, Boolean.class); - if (disablesecurityProcessing==null) - disablesecurityProcessing = false; - - Boolean allNillable = getPropertyValue(properties,JAXBRIContext.TREAT_EVERYTHING_NILLABLE,Boolean.class); - if(allNillable==null) - allNillable = false; - - Boolean retainPropertyInfo = getPropertyValue(properties, JAXBRIContext.RETAIN_REFERENCE_TO_INFO, Boolean.class); - if(retainPropertyInfo==null) - retainPropertyInfo = false; - - Boolean supressAccessorWarnings = getPropertyValue(properties, JAXBRIContext.SUPRESS_ACCESSOR_WARNINGS, Boolean.class); - if(supressAccessorWarnings==null) - supressAccessorWarnings = false; - - Boolean improvedXsiTypeHandling = getPropertyValue(properties, JAXBRIContext.IMPROVED_XSI_TYPE_HANDLING, Boolean.class); - if (improvedXsiTypeHandling == null) { - String improvedXsiSystemProperty = Util.getSystemProperty(JAXBRIContext.IMPROVED_XSI_TYPE_HANDLING); - if (improvedXsiSystemProperty == null) { - improvedXsiTypeHandling = true; - } else { - improvedXsiTypeHandling = Boolean.valueOf(improvedXsiSystemProperty); - } - } - - Boolean xmlAccessorFactorySupport = getPropertyValue(properties, - JAXBRIContext.XMLACCESSORFACTORY_SUPPORT,Boolean.class); - if(xmlAccessorFactorySupport==null){ - xmlAccessorFactorySupport = false; - Util.getClassLogger().log(Level.FINE, "Property " + - JAXBRIContext.XMLACCESSORFACTORY_SUPPORT + - "is not active. Using JAXB's implementation"); - } - - Boolean backupWithParentNamespace = getPropertyValue(properties, JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE, Boolean.class); - - RuntimeAnnotationReader ar = getPropertyValue(properties,JAXBRIContext.ANNOTATION_READER,RuntimeAnnotationReader.class); - - Collection tr = getPropertyValue(properties, JAXBRIContext.TYPE_REFERENCES, Collection.class); - if (tr == null) { - tr = Collections.emptyList(); - } - - Map subclassReplacements; - try { - subclassReplacements = TypeCast.checkedCast( - getPropertyValue(properties, JAXBRIContext.SUBCLASS_REPLACEMENTS, Map.class), Class.class, Class.class); - } catch (ClassCastException e) { - throw new JAXBException(Messages.INVALID_TYPE_IN_MAP.format(),e); - } - - if(!properties.isEmpty()) { - throw new JAXBException(Messages.UNSUPPORTED_PROPERTY.format(properties.keySet().iterator().next())); - } - - JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); - builder.setClasses(classes); - builder.setTypeRefs(tr); - builder.setSubclassReplacements(subclassReplacements); - builder.setDefaultNsUri(defaultNsUri); - builder.setC14NSupport(c14nSupport); - builder.setAnnotationReader(ar); - builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport); - builder.setAllNillable(allNillable); - builder.setRetainPropertyInfo(retainPropertyInfo); - builder.setSupressAccessorWarnings(supressAccessorWarnings); - builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); - builder.setDisableSecurityProcessing(disablesecurityProcessing); - builder.setBackupWithParentNamespace(backupWithParentNamespace); - return builder.build(); - } - - /** - * If a key is present in the map, remove the value and return it. - */ - private static T getPropertyValue(Map properties, String keyName, Class type ) throws JAXBException { - Object o = properties.get(keyName); - if(o==null) return null; - - properties.remove(keyName); - if(!type.isInstance(o)) - throw new JAXBException(Messages.INVALID_PROPERTY_VALUE.format(keyName,o)); - else - return type.cast(o); - } - - /** - * - * @param classes - * @param typeRefs - * @param subclassReplacements - * @param defaultNsUri - * @param c14nSupport - * @param ar - * @param xmlAccessorFactorySupport - * @param allNillable - * @param retainPropertyInfo - * @return - * @throws JAXBException - * @deprecated use {@code createContext(Class[] classes, Map properties)} method instead - */ - @Deprecated - public static JAXBRIContext createContext( Class[] classes, - Collection typeRefs, Map subclassReplacements, - String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, - boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo) throws JAXBException { - - return createContext(classes, typeRefs, subclassReplacements, - defaultNsUri, c14nSupport, ar, xmlAccessorFactorySupport, - allNillable, retainPropertyInfo, false); - } - - /** - * - * @param classes - * @param typeRefs - * @param subclassReplacements - * @param defaultNsUri - * @param c14nSupport - * @param ar - * @param xmlAccessorFactorySupport - * @param allNillable - * @param retainPropertyInfo - * @param improvedXsiTypeHandling - * @return - * @throws JAXBException - * @deprecated use {@code createContext( Class[] classes, Map properties)} method instead - */ - @Deprecated - public static JAXBRIContext createContext( Class[] classes, - Collection typeRefs, Map subclassReplacements, - String defaultNsUri, boolean c14nSupport, RuntimeAnnotationReader ar, - boolean xmlAccessorFactorySupport, boolean allNillable, boolean retainPropertyInfo, boolean improvedXsiTypeHandling) throws JAXBException { - - JAXBContextImpl.JAXBContextBuilder builder = new JAXBContextImpl.JAXBContextBuilder(); - builder.setClasses(classes); - builder.setTypeRefs(typeRefs); - builder.setSubclassReplacements(subclassReplacements); - builder.setDefaultNsUri(defaultNsUri); - builder.setC14NSupport(c14nSupport); - builder.setAnnotationReader(ar); - builder.setXmlAccessorFactorySupport(xmlAccessorFactorySupport); - builder.setAllNillable(allNillable); - builder.setRetainPropertyInfo(retainPropertyInfo); - builder.setImprovedXsiTypeHandling(improvedXsiTypeHandling); - return builder.build(); - } - - /** - * The API will invoke this method via reflection. - */ - public static JAXBContext createContext( String contextPath, - ClassLoader classLoader, Map properties ) throws JAXBException { - FinalArrayList classes = new FinalArrayList(); - StringTokenizer tokens = new StringTokenizer(contextPath,":"); - List indexedClasses; - - // at least on of these must be true per package - boolean foundObjectFactory; - boolean foundJaxbIndex; - - while(tokens.hasMoreTokens()) { - foundObjectFactory = foundJaxbIndex = false; - String pkg = tokens.nextToken(); - - // look for ObjectFactory and load it - final Class o; - try { - o = classLoader.loadClass(pkg+".ObjectFactory"); - classes.add(o); - foundObjectFactory = true; - } catch (ClassNotFoundException e) { - // not necessarily an error - } - - // look for jaxb.index and load the list of classes - try { - indexedClasses = loadIndexedClasses(pkg, classLoader); - } catch (IOException e) { - //TODO: think about this more - throw new JAXBException(e); - } - if(indexedClasses != null) { - classes.addAll(indexedClasses); - foundJaxbIndex = true; - } - - if( !(foundObjectFactory || foundJaxbIndex) ) { - throw new JAXBException( Messages.BROKEN_CONTEXTPATH.format(pkg)); - } - } - - - return createContext(classes.toArray(new Class[classes.size()]),properties); - } - - /** - * Look for jaxb.index file in the specified package and load it's contents - * - * @param pkg package name to search in - * @param classLoader ClassLoader to search in - * @return a List of Class objects to load, null if there weren't any - * @throws IOException if there is an error reading the index file - * @throws JAXBException if there are any errors in the index file - */ - private static List loadIndexedClasses(String pkg, ClassLoader classLoader) throws IOException, JAXBException { - final String resource = pkg.replace('.', '/') + "/jaxb.index"; - final InputStream resourceAsStream = classLoader.getResourceAsStream(resource); - - if (resourceAsStream == null) { - return null; - } - - BufferedReader in = - new BufferedReader(new InputStreamReader(resourceAsStream, "UTF-8")); - try { - FinalArrayList classes = new FinalArrayList(); - String className = in.readLine(); - while (className != null) { - className = className.trim(); - if (className.startsWith("#") || (className.length() == 0)) { - className = in.readLine(); - continue; - } - - if (className.endsWith(".class")) { - throw new JAXBException(Messages.ILLEGAL_ENTRY.format(className)); - } - - try { - classes.add(classLoader.loadClass(pkg + '.' + className)); - } catch (ClassNotFoundException e) { - throw new JAXBException(Messages.ERROR_LOADING_CLASS.format(className, resource),e); - } - - className = in.readLine(); - } - return classes; - } finally { - in.close(); - } - } - - public static final String USE_JAXB_PROPERTIES = "_useJAXBProperties"; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages.java 2018-01-30 20:31:06.000000000 -0500 +++ /dev/null 2018-01-30 20:31:06.000000000 -0500 @@ -1,58 +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.bind.v2; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Formats error messages. - */ -public enum Messages { - ILLEGAL_ENTRY, // 1 arg - ERROR_LOADING_CLASS, // 2 args - INVALID_PROPERTY_VALUE, // 2 args - UNSUPPORTED_PROPERTY, // 1 arg - BROKEN_CONTEXTPATH, // 1 arg - NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS, // 1 arg - INVALID_TYPE_IN_MAP, // 0args - INVALID_JAXP_IMPLEMENTATION, // 1 arg - JAXP_SUPPORTED_PROPERTY, // 1 arg - JAXP_UNSUPPORTED_PROPERTY, // 1 arg - JAXP_XML_SECURITY_DISABLED, // no arg - JAXP_EXTERNAL_ACCESS_CONFIGURED, // no arg - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages.properties 2018-01-30 20:31:07.000000000 -0500 +++ /dev/null 2018-01-30 20:31:07.000000000 -0500 @@ -1,64 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = \ - illegal entry: "{0}", entries should be of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = \ - error loading class "{0}" listed in {1}, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" - -INVALID_PROPERTY_VALUE = \ - {1} is not a valid value for property "{0}" - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = \ - property "{0}" is not supported - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = \ - "{0}" doesn't contain ObjectFactory.class or jaxb.index - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = \ - "{0}" is an inner class, and therefore it can never have a default no-argument constructor. Add 'static'. - -INVALID_TYPE_IN_MAP = \ - Map contains a wrong type - -INVALID_JAXP_IMPLEMENTATION = \ - You are running with invalid JAXP api or implementation. JAXP api/implementation of version 1.3.1 (included in JDK6) or higher is required. In case you are using ant, make sure ant 1.7.0 or higher is used - older versions of ant contain JAXP api/impl version 1.2 (in xml-apis.jar). If you want to keep using older ant versions, you have to configure it to use higher the JAXP api/impl versions. - -JAXP_SUPPORTED_PROPERTY =\ - Property "{0}" is supported and has been successfully set by used JAXP implementation. - -JAXP_UNSUPPORTED_PROPERTY =\ - Property "{0}" is not supported by used JAXP implementation. - -JAXP_XML_SECURITY_DISABLED=\ - "Xml Security disabled, no JAXP xsd external access configuration necessary." - -JAXP_EXTERNAL_ACCESS_CONFIGURED=\ - "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary." --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages_de.properties 2018-01-30 20:31:08.000000000 -0500 +++ /dev/null 2018-01-30 20:31:08.000000000 -0500 @@ -1,42 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = ung\u00FCltiger Eintrag: "{0}", Eintr\u00E4ge m\u00FCssen folgende Form aufweisen "ClassName" oder "OuterClass.InnerClass", nicht "ClassName.class" oder "fully.qualified.ClassName" - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = Fehler beim Laden der Klasse "{0}", die in {1} aufgef\u00FChrt wird. Stellen Sie sicher, dass die Eintr\u00E4ge in CLASSPATH zug\u00E4nglich sind und die Form "ClassName" oder "OuterClass.InnerClass", und nicht "ClassName.class" oder "fully.qualified.ClassName" haben - -INVALID_PROPERTY_VALUE = {1} ist kein g\u00FCltiger Wert f\u00FCr Eigenschaft "{0}" - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = Eigenschaft "{0}" wird nicht unterst\u00FCtzt. - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = "{0}" enth\u00E4lt ObjectFactory.class oder jaxb.index nicht - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = "{0}" ist eine innere Klasse und kann deshalb niemals einen "no-argument"-Standardkonstruktor haben. F\u00FCgen Sie "static" hinzu. - -INVALID_TYPE_IN_MAP = Zuordnung enth\u00E4lt falschen Typ --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages_es.properties 2018-01-30 20:31:08.000000000 -0500 +++ /dev/null 2018-01-30 20:31:08.000000000 -0500 @@ -1,42 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = Entrada no v\u00E1lida: "{0}"; las entradas deben tener el formato "ClassName" o "OuterClass.InnerClass", no "ClassName.class" ni "fully.qualified.ClassName". - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = error al cargar la clase "{0}" que se indica en {1}; aseg\u00FArese de que es posible acceder a las entradas en CLASSPATH y que tienen el formato "ClassName" o "OuterClass.InnerClass", no "ClassName.class" ni "fully.qualified.ClassName" - -INVALID_PROPERTY_VALUE = {1} no es un valor v\u00E1lido para la propiedad "{0}" - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = La propiedad "{0}" no est\u00E1 soportada. - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = "{0}" no contiene ObjectFactory.class ni jaxb.index - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = "{0}"es una clase interna y, por lo tanto, nunca puede tener un constructor sin argumentos por defecto. Agregue ''static''. - -INVALID_TYPE_IN_MAP = La asignaci\u00F3n contiene un tipo incorrecto --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages_fr.properties 2018-01-30 20:31:09.000000000 -0500 +++ /dev/null 2018-01-30 20:31:09.000000000 -0500 @@ -1,42 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = entr\u00E9e "{0}" interdite, les entr\u00E9es doivent \u00EAtre au format "ClassName" ou "OuterClass.InnerClass", et non"ClassName.class" ou "fully.qualified.ClassName" - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = erreur lors du chargement de la classe "{0}" list\u00E9e dans {1}, assurez-vous que les entr\u00E9es sont accessibles sur CLASSPATH et sont au format "ClassName" ou "OuterClass.InnerClass", et non "ClassName.class" ou "fully.qualified.ClassName" - -INVALID_PROPERTY_VALUE = {1} n''est pas une valeur valide pour la propri\u00E9t\u00E9 "{0}" - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = la propri\u00E9t\u00E9 ''{0}'' n''est pas prise en charge - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = "{0}" ne contient pas ObjectFactory.class ou jaxb.index - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = "{0}" est une classe interne et ne peut donc jamais comporter de constructeur sans argument par d\u00E9faut. Ajoutez ''static''. - -INVALID_TYPE_IN_MAP = La mappe contient un type incorrect --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages_it.properties 2018-01-30 20:31:10.000000000 -0500 +++ /dev/null 2018-01-30 20:31:10.000000000 -0500 @@ -1,42 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = voce non valida: "{0}". Le voci devono avere il formato "ClassName" o "OuterClass.InnerClass", non "ClassName.class" o "fully.qualified.ClassName" - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = errore di caricamento della classe "{0}" elencata in {1}. Assicurarsi che le voci siano accessibili su CLASSPATH e che abbiano il formato "ClassName" o "OuterClass.InnerClass", non "ClassName.class" o "fully.qualified.ClassName" - -INVALID_PROPERTY_VALUE = {1} non \u00E8 un valore valido per la propriet\u00E0 "{0}" - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = propriet\u00E0 "{0}" non supportata - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = "{0}" non contiene ObjectFactory.class o jaxb.index - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = "{0}" \u00E8 una classe interna e pertanto non pu\u00F2 mai avere un costruttore senza argomenti predefinito. Aggiungere ''static''. - -INVALID_TYPE_IN_MAP = La mappa contiene un tipo errato --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages_ja.properties 2018-01-30 20:31:10.000000000 -0500 +++ /dev/null 2018-01-30 20:31:10.000000000 -0500 @@ -1,42 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = \u4E0D\u6B63\u306A\u30A8\u30F3\u30C8\u30EA: "{0}"\u3002\u30A8\u30F3\u30C8\u30EA\u306F\u3001"ClassName.class"\u307E\u305F\u306F"fully.qualified.ClassName"\u3067\u306F\u306A\u304F\u3001"ClassName"\u307E\u305F\u306F"OuterClass.InnerClass"\u306E\u5F62\u5F0F\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059 - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = {1}\u306B\u30EA\u30B9\u30C8\u3055\u308C\u3066\u3044\u308B\u30AF\u30E9\u30B9"{0}"\u306E\u30ED\u30FC\u30C9\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u30A8\u30F3\u30C8\u30EA\u304CCLASSPATH\u4E0A\u3067\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u3067\u3042\u308A\u3001"ClassName.class"\u307E\u305F\u306F"fully.qualified.ClassName"\u3067\u306F\u306A\u304F\u3001"ClassName"\u307E\u305F\u306F"OuterClass.InnerClass"\u306E\u5F62\u5F0F\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059 - -INVALID_PROPERTY_VALUE = {1}\u306F\u30D7\u30ED\u30D1\u30C6\u30A3"{0}"\u306B\u5BFE\u3057\u3066\u7121\u52B9\u306A\u5024\u3067\u3059 - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = \u30D7\u30ED\u30D1\u30C6\u30A3"{0}"\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093 - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = "{0}"\u306B\u306FObjectFactory.class\u307E\u305F\u306Fjaxb.index\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093 - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = "{0}"\u306F\u5185\u90E8\u30AF\u30E9\u30B9\u3067\u3042\u308B\u305F\u3081\u3001\u5F15\u6570\u306A\u3057\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30B3\u30F3\u30C8\u30E9\u30AF\u30BF\u3092\u6301\u3064\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002''static''\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002 - -INVALID_TYPE_IN_MAP = \u30DE\u30C3\u30D7\u306B\u4E0D\u6B63\u306A\u30BF\u30A4\u30D7\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages_ko.properties 2018-01-30 20:31:11.000000000 -0500 +++ /dev/null 2018-01-30 20:31:11.000000000 -0500 @@ -1,42 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = \uC798\uBABB\uB41C \uD56D\uBAA9: "{0}". \uD56D\uBAA9\uC740 "ClassName.class" \uB610\uB294 "fully.qualified.ClassName" \uD615\uC2DD\uC774 \uC544\uB2CC "ClassName" \uB610\uB294 "OuterClass.InnerClass" \uD615\uC2DD\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4. - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = {1}\uC5D0 \uB098\uC5F4\uB41C "{0}" \uD074\uB798\uC2A4\uB97C \uB85C\uB4DC\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. CLASSPATH\uC5D0\uC11C \uD56D\uBAA9\uC5D0 \uC561\uC138\uC2A4\uD560 \uC218 \uC788\uC73C\uBA70 \uD56D\uBAA9\uC774 "ClassName.class" \uB610\uB294 "fully.qualified.ClassName" \uD615\uC2DD\uC774 \uC544\uB2CC "ClassName" \uB610\uB294 "OuterClass.InnerClass" \uD615\uC2DD\uC778\uC9C0 \uD655\uC778\uD558\uC2ED\uC2DC\uC624. - -INVALID_PROPERTY_VALUE = {1}\uC740(\uB294) "{0}" \uC18D\uC131\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4. - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = "{0}" \uC18D\uC131\uC740 \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = "{0}"\uC5D0 ObjectFactory.class \uB610\uB294 jaxb.index\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = "{0}"\uC740(\uB294) \uB0B4\uBD80 \uD074\uB798\uC2A4\uC774\uBBC0\uB85C \uC778\uC218\uAC00 \uC5C6\uB294 \uAE30\uBCF8 \uC0DD\uC131\uC790\uB97C \uD3EC\uD568\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. ''static''\uC744 \uCD94\uAC00\uD558\uC2ED\uC2DC\uC624. - -INVALID_TYPE_IN_MAP = \uB9F5\uC5D0 \uC798\uBABB\uB41C \uC720\uD615\uC774 \uD3EC\uD568\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages_pt_BR.properties 2018-01-30 20:31:12.000000000 -0500 +++ /dev/null 2018-01-30 20:31:12.000000000 -0500 @@ -1,42 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = entrada inv\u00E1lida: "{0}"; as entradas devem estar no formato "ClassName" ou "OuterClass.InnerClass", n\u00E3o no formato "ClassName.class" ou "fully.qualified.ClassName" - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = erro ao carregar a classe "{0}" listada em {1}; certifique-se de que as entradas n\u00E3o sejam acessadas no CLASSPATH e no formato "ClassName" ou "OuterClass.InnerClass", n\u00E3o no formato "ClassName.class" ou "fully.qualified.ClassName" - -INVALID_PROPERTY_VALUE = {1} n\u00E3o \u00E9 um valor v\u00E1lido para a propriedade "{0}" - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = a propriedade "{0}" n\u00E3o \u00E9 suportada - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = "{0}" n\u00E3o cont\u00E9m ObjectFactory.class ou jaxb.index - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = "{0}" \u00E9 uma classe interna e, portanto, nunca pode ter um construtor no-argument default. Adicione ''static''. - -INVALID_TYPE_IN_MAP = O mapa cont\u00E9m um tipo incorreto --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages_zh_CN.properties 2018-01-30 20:31:12.000000000 -0500 +++ /dev/null 2018-01-30 20:31:12.000000000 -0500 @@ -1,42 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = \u975E\u6CD5\u6761\u76EE: "{0}", \u6761\u76EE\u7684\u683C\u5F0F\u5E94\u4E3A "ClassName" \u6216 "OuterClass.InnerClass", \u800C\u4E0D\u662F "ClassName.class" \u6216 "fully.qualified.ClassName" - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = \u52A0\u8F7D{1}\u4E2D\u5217\u51FA\u7684\u7C7B "{0}" \u65F6\u51FA\u9519, \u8BF7\u786E\u4FDD\u6761\u76EE\u53EF\u5728 CLASSPATH \u4E2D\u8BBF\u95EE\u5E76\u4E14\u683C\u5F0F\u4E3A "ClassName" \u6216 "OuterClass.InnerClass", \u800C\u4E0D\u662F "ClassName.class" \u6216 "fully.qualified.ClassName" - -INVALID_PROPERTY_VALUE = {1}\u4E0D\u662F\u5C5E\u6027 "{0}" \u7684\u6709\u6548\u503C - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = \u4E0D\u652F\u6301\u5C5E\u6027 "{0}" - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = "{0}" \u4E0D\u5305\u542B ObjectFactory.class \u6216 jaxb.index - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = "{0}" \u662F\u5185\u90E8\u7C7B, \u56E0\u6B64\u7EDD\u4E0D\u80FD\u5177\u6709\u9ED8\u8BA4\u65E0\u53C2\u6570\u6784\u9020\u5668\u3002\u8BF7\u6DFB\u52A0 ''\u9759\u6001''\u3002 - -INVALID_TYPE_IN_MAP = \u6620\u5C04\u5305\u542B\u9519\u8BEF\u7C7B\u578B --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/Messages_zh_TW.properties 2018-01-30 20:31:13.000000000 -0500 +++ /dev/null 2018-01-30 20:31:13.000000000 -0500 @@ -1,42 +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. -# - -# Not concatenated with any other string (written on a separate line). -ILLEGAL_ENTRY = \u7121\u6548\u7684\u9805\u76EE: "{0}", \u9805\u76EE\u7684\u683C\u5F0F\u61C9\u70BA "ClassName" \u6216 "OuterClass.InnerClass", \u800C\u975E "ClassName.class" \u6216 "fully.qualified.ClassName" - -# {0} - class name, {1} - resource location e.g. error loading class "Foo" listed in foo/bar/jaxb.index, make sure that entries are accessable on CLASSPATH and of the form "ClassName" or "OuterClass.InnerClass", not "ClassName.class" or "fully.qualified.ClassName" -ERROR_LOADING_CLASS = \u8F09\u5165 {1} \u4E2D\u5217\u51FA\u7684\u985E\u5225 "{0}" \u6642\u767C\u751F\u932F\u8AA4, \u8ACB\u78BA\u5B9A\u53EF\u5728\u985E\u5225\u8DEF\u5F91\u4E2D\u5B58\u53D6\u8A72\u9805\u76EE, \u4E14\u683C\u5F0F\u70BA "ClassName" \u6216 "OuterClass.InnerClass", \u800C\u975E "ClassName.class" \u6216 "fully.qualified.ClassName" - -INVALID_PROPERTY_VALUE = {1} \u4E0D\u662F\u7279\u6027 "{0}" \u7684\u6709\u6548\u503C - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_PROPERTY = \u4E0D\u652F\u63F4\u7279\u6027 "{0}" - -#{0} - package name. e.g.: "foo.bar" doesn't contain ObjectFactory.class or jaxb.index -BROKEN_CONTEXTPATH = "{0}" \u672A\u5305\u542B ObjectFactory.class \u6216 jaxb.index - -NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS = "{0}" \u662F\u5167\u90E8\u985E\u5225, \u56E0\u6B64\u6C38\u9060\u4E0D\u80FD\u6709\u9810\u8A2D\u7684\u7121\u5F15\u6578\u5EFA\u69CB\u5B50. \u8ACB\u65B0\u589E ''static''. - -INVALID_TYPE_IN_MAP = \u5C0D\u61C9\u5305\u542B\u932F\u8AA4\u7684\u985E\u578B --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/TODO.java 2018-01-30 20:31:14.000000000 -0500 +++ /dev/null 2018-01-30 20:31:14.000000000 -0500 @@ -1,58 +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.xml.internal.bind.v2; - -/** - * Place holder for TODOs. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public abstract class TODO { - /** - * When this method is called, - * that means we need to check the spec and corrects - * the behavior. - * - * Search the usage of this method. - */ - public static void checkSpec() {} - public static void checkSpec(String comment) {} - - /** - * When this method iscalled, - * that means the current code is a mock up and - * it needs to be properly implemented later. - */ - public static void prototype() {} - - public static void prototype(String comment) {} - - /** - * When this method is called, it means that there is an - * unimplemeted portion of the spec in the schema generator. - */ - public static void schemaGenerator(String comment) {} -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/WellKnownNamespace.java 2018-01-30 20:31:14.000000000 -0500 +++ /dev/null 2018-01-30 20:31:14.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2; - -import javax.xml.XMLConstants; - -/** - * Well-known namespace URIs. - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com), Martin Grebac (martin.grebac@oracle.com) - * @since 2.0 - */ -public abstract class WellKnownNamespace { - private WellKnownNamespace() {} // no instanciation please - - /** - * @deprecated Use javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI instead; - */ - @Deprecated() - public static final String XML_SCHEMA = XMLConstants.W3C_XML_SCHEMA_NS_URI; - - /** - * @deprecated Use javax.xml.XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI instead - */ - @Deprecated() - public static final String XML_SCHEMA_INSTANCE = XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI; - - /** - * @deprecated Use javax.xml.XMLConstants.XML_NS_URI instead; - */ - @Deprecated() - public static final String XML_NAMESPACE_URI = XMLConstants.XML_NS_URI; - - public static final String XOP = "http://www.w3.org/2004/08/xop/include"; - - public static final String SWA_URI = "http://ws-i.org/profiles/basic/1.1/xsd"; - - public static final String XML_MIME_URI = "http://www.w3.org/2005/05/xmlmime"; - - public static final String JAXB = "http://java.sun.com/xml/ns/jaxb"; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/ClassTailor.java 2018-01-30 20:31:15.000000000 -0500 +++ /dev/null 2018-01-30 20:31:15.000000000 -0500 @@ -1,191 +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.xml.internal.bind.v2.bytecode; - -import java.io.ByteArrayOutputStream; -import java.io.DataInputStream; -import java.io.DataOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.sun.xml.internal.bind.Util; - -/** - * Replaces a few constant pool tokens from a class "template" and then loads it into the VM. - * - * @author Kohsuke Kawaguchi - */ -public final class ClassTailor { - - private ClassTailor() {} // no instanciation please - - private static final Logger logger = Util.getClassLogger(); - - /** - * Returns the class name in the JVM format (such as "java/lang/String") - */ - public static String toVMClassName( Class c ) { - assert !c.isPrimitive(); - if(c.isArray()) - // I have no idea why it is designed like this, but javap says so. - return toVMTypeName(c); - return c.getName().replace('.','/'); - } - - public static String toVMTypeName( Class c ) { - if(c.isArray()) { - // TODO: study how an array type is encoded. - return '['+toVMTypeName(c.getComponentType()); - } - if(c.isPrimitive()) { - if(c==Boolean.TYPE) return "Z"; - if(c==Character.TYPE) return "C"; - if(c==Byte.TYPE) return "B"; - if(c==Double.TYPE) return "D"; - if(c==Float.TYPE) return "F"; - if(c==Integer.TYPE) return "I"; - if(c==Long.TYPE) return "J"; - if(c==Short.TYPE) return "S"; - - throw new IllegalArgumentException(c.getName()); - } - return 'L'+c.getName().replace('.','/')+';'; - } - - - - public static byte[] tailor( Class templateClass, String newClassName, String... replacements ) { - String vmname = toVMClassName(templateClass); - return tailor( - SecureLoader.getClassClassLoader(templateClass).getResourceAsStream(vmname+".class"), - vmname, newClassName, replacements ); - } - - - /** - * Customizes a class file by replacing constant pools. - * - * @param image - * The image of the template class. - * @param replacements - * A list of pair of strings that specify the substitution - * {@code String[]{search_0, replace_0, search_1, replace_1, ..., search_n, replace_n }} - * - * The search strings found in the constant pool will be replaced by the corresponding - * replacement string. - */ - public static byte[] tailor( InputStream image, String templateClassName, String newClassName, String... replacements ) { - DataInputStream in = new DataInputStream(image); - - try { - ByteArrayOutputStream baos = new ByteArrayOutputStream(1024); - DataOutputStream out = new DataOutputStream(baos); - - // skip until the constant pool count - long l = in.readLong(); - out.writeLong(l); - - // read the constant pool size - short count = in.readShort(); - out.writeShort(count); - - // replace constant pools - for( int i=0; i0) - out.write(buf,0,len); - - in.close(); - out.close(); - - // by now we got the properly tailored class file image - return baos.toByteArray(); - - } catch( IOException e ) { - // never happen - logger.log(Level.WARNING,"failed to tailor",e); - return null; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/SecureLoader.java 2018-01-30 20:31:16.000000000 -0500 +++ /dev/null 2018-01-30 20:31:16.000000000 -0500 @@ -1,75 +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.xml.internal.bind.v2.bytecode; - -/** - * Class defined for safe calls of getClassLoader methods of any kind (context/system/class - * classloader. This MUST be package private and defined in every package which - * uses such invocations. - * @author snajper - */ -class SecureLoader { - - static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - - static ClassLoader getClassClassLoader(final Class c) { - if (System.getSecurityManager() == null) { - return c.getClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return c.getClassLoader(); - } - }); - } - } - - static ClassLoader getSystemClassLoader() { - if (System.getSecurityManager() == null) { - return ClassLoader.getSystemClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return ClassLoader.getSystemClassLoader(); - } - }); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/bytecode/package-info.java 2018-01-30 20:31:16.000000000 -0500 +++ /dev/null 2018-01-30 20:31:16.000000000 -0500 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * Code that deals with low level byte code manipulation. - */ -package com.sun.xml.internal.bind.v2.bytecode; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/AbstractInlineAnnotationReaderImpl.java 2018-01-30 20:31:17.000000000 -0500 +++ /dev/null 2018-01-30 20:31:17.000000000 -0500 @@ -1,102 +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.xml.internal.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; - -import com.sun.xml.internal.bind.v2.model.core.ErrorHandler; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; - -/** - * {@link AnnotationReader} that reads annotation from classes, - * not from external binding files. - * - * This is meant to be used as a convenient partial implementation. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public abstract class AbstractInlineAnnotationReaderImpl - implements AnnotationReader { - - private ErrorHandler errorHandler; - - public void setErrorHandler(ErrorHandler errorHandler) { - if(errorHandler==null) - throw new IllegalArgumentException(); - this.errorHandler = errorHandler; - } - - /** - * Always return a non-null valid {@link ErrorHandler} - */ - public final ErrorHandler getErrorHandler() { - assert errorHandler!=null : "error handler must be set before use"; - return errorHandler; - } - - public final A getMethodAnnotation(Class annotation, M getter, M setter, Locatable srcPos) { - A a1 = getter==null?null:getMethodAnnotation(annotation,getter,srcPos); - A a2 = setter==null?null:getMethodAnnotation(annotation,setter,srcPos); - - if(a1==null) { - if(a2==null) - return null; - else - return a2; - } else { - if(a2==null) - return a1; - else { - // both are present - getErrorHandler().error(new IllegalAnnotationException( - Messages.DUPLICATE_ANNOTATIONS.format( - annotation.getName(), fullName(getter),fullName(setter)), - a1, a2 )); - // recover by ignoring one of them - return a1; - } - } - } - - public boolean hasMethodAnnotation(Class annotation, String propertyName, M getter, M setter, Locatable srcPos) { - boolean x = ( getter != null && hasMethodAnnotation(annotation, getter) ); - boolean y = ( setter != null && hasMethodAnnotation(annotation, setter) ); - - if(x && y) { - // both are present. have getMethodAnnotation report an error - getMethodAnnotation(annotation,getter,setter,srcPos); - } - - return x||y; - } - - /** - * Gets the fully-qualified name of the method. - * - * Used for error messages. - */ - protected abstract String fullName(M m); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/AnnotationReader.java 2018-01-30 20:31:18.000000000 -0500 +++ /dev/null 2018-01-30 20:31:18.000000000 -0500 @@ -1,162 +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.xml.internal.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.Method; - -import com.sun.istack.internal.Nullable; -import com.sun.xml.internal.bind.v2.model.core.ErrorHandler; - -/** - * Reads annotations for the given property. - * - *

- * This is the lowest abstraction that encapsulates the difference - * between reading inline annotations and external binding files. - * - *

- * Because the former operates on a {@link Field} and {@link Method} - * while the latter operates on a "property", the methods defined - * on this interface takes both, and the callee gets to choose which - * to use. - * - *

- * Most of the get method takes {@link Locatable}, which points to - * the place/context in which the annotation is read. The returned - * annotation also implements {@link Locatable} (so that it can - * point to the place where the annotation is placed), and its - * {@link Locatable#getUpstream()} will return the given - * {@link Locatable}. - * - * - *

- * Errors found during reading annotations are reported through the error handler. - * A valid {@link ErrorHandler} must be registered before the {@link AnnotationReader} - * is used. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public interface AnnotationReader { - - /** - * Sets the error handler that receives errors found - * during reading annotations. - * - * @param errorHandler - * must not be null. - */ - void setErrorHandler(ErrorHandler errorHandler); - - /** - * Reads an annotation on a property that consists of a field. - */ - A getFieldAnnotation(Class annotation, - F field, Locatable srcpos); - - /** - * Checks if the given field has an annotation. - */ - boolean hasFieldAnnotation(Class annotationType, F field); - - /** - * Checks if a class has the annotation. - */ - boolean hasClassAnnotation(C clazz, Class annotationType); - - /** - * Gets all the annotations on a field. - */ - Annotation[] getAllFieldAnnotations(F field, Locatable srcPos); - - /** - * Reads an annotation on a property that consists of a getter and a setter. - * - */ - A getMethodAnnotation(Class annotation, - M getter, M setter, Locatable srcpos); - - /** - * Checks if the given method has an annotation. - */ - boolean hasMethodAnnotation(Class annotation, String propertyName, M getter, M setter, Locatable srcPos); - - /** - * Gets all the annotations on a method. - * - * @param srcPos - * the location from which this annotation is read. - */ - Annotation[] getAllMethodAnnotations(M method, Locatable srcPos); - - // TODO: we do need this to read certain annotations, - // but that shows inconsistency wrt the spec. consult the spec team about the abstraction. - A getMethodAnnotation(Class annotation, M method, Locatable srcpos ); - - boolean hasMethodAnnotation(Class annotation, M method ); - - /** - * Reads an annotation on a parameter of the method. - * - * @return null - * if the annotation was not found. - */ - @Nullable - A getMethodParameterAnnotation( - Class annotation, M method, int paramIndex, Locatable srcPos ); - - /** - * Reads an annotation on a class. - */ - @Nullable - A getClassAnnotation(Class annotation, C clazz, Locatable srcpos) ; - - /** - * Reads an annotation on the package that the given class belongs to. - */ - @Nullable - A getPackageAnnotation(Class annotation, C clazz, Locatable srcpos); - - /** - * Reads a value of an annotation that returns a Class object. - * - *

- * Depending on the underlying reflection library, you can't always - * obtain the {@link Class} object directly (see the Annotation Processing MirrorTypeException - * for example), so use this method to avoid that. - * - * @param name - * The name of the annotation parameter to be read. - */ - T getClassValue( Annotation a, String name ); - - /** - * Similar to {@link #getClassValue(Annotation, String)} method but - * obtains an array parameter. - */ - T[] getClassArrayValue( Annotation a, String name ); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/AnnotationSource.java 2018-01-30 20:31:18.000000000 -0500 +++ /dev/null 2018-01-30 20:31:18.000000000 -0500 @@ -1,56 +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.xml.internal.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; - -/** - * Implemented by objects that can have annotations. - * - * @author Kohsuke Kawaguchi - */ -public interface AnnotationSource { - /** - * Gets the value of the specified annotation from the given property. - * - *

- * When this method is used for a property that consists of a getter and setter, - * it returns the annotation on either of those methods. If both methods have - * the same annotation, it is an error. - * - * @return - * null if the annotation is not present. - */ - A readAnnotation(Class annotationType); - - /** - * Returns true if the property has the specified annotation. - *

- * Short for readAnnotation(annotationType)!=null, - * but this method is typically faster. - */ - boolean hasAnnotation(Class annotationType); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/ClassLocatable.java 2018-01-30 20:31:19.000000000 -0500 +++ /dev/null 2018-01-30 20:31:19.000000000 -0500 @@ -1,54 +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.xml.internal.bind.v2.model.annotation; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * {@link Locatable} implementation for a class. - * - * @author Kohsuke Kawaguchi - */ -public class ClassLocatable implements Locatable { - private final Locatable upstream; - private final C clazz; - private final Navigator nav; - - public ClassLocatable(Locatable upstream, C clazz, Navigator nav) { - this.upstream = upstream; - this.clazz = clazz; - this.nav = nav; - } - - public Locatable getUpstream() { - return upstream; - } - - public Location getLocation() { - return nav.getClassLocation(clazz); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/FieldLocatable.java 2018-01-30 20:31:20.000000000 -0500 +++ /dev/null 2018-01-30 20:31:20.000000000 -0500 @@ -1,54 +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.xml.internal.bind.v2.model.annotation; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * {@link Locatable} implementation for a field. - * - * @author Kohsuke Kawaguchi - */ -public class FieldLocatable implements Locatable { - private final Locatable upstream; - private final F field; - private final Navigator nav; - - public FieldLocatable(Locatable upstream, F field, Navigator nav) { - this.upstream = upstream; - this.field = field; - this.nav = nav; - } - - public Locatable getUpstream() { - return upstream; - } - - public Location getLocation() { - return nav.getFieldLocation(field); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Init.java 2018-01-30 20:31:20.000000000 -0500 +++ /dev/null 2018-01-30 20:31:20.000000000 -0500 @@ -1,39 +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.bind.v2.model.annotation; - -/** - *

Auto-generated, do not edit.

- * - */ -class Init { - - - static Quick[] getAll() { - return new Quick[] {new XmlAttributeQuick(null, null), new XmlElementQuick(null, null), new XmlElementDeclQuick(null, null), new XmlElementRefQuick(null, null), new XmlElementRefsQuick(null, null), new XmlEnumQuick(null, null), new XmlRootElementQuick(null, null), new XmlSchemaQuick(null, null), new XmlSchemaTypeQuick(null, null), new XmlTransientQuick(null, null), new XmlTypeQuick(null, null), new XmlValueQuick(null, null)}; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Locatable.java 2018-01-30 20:31:21.000000000 -0500 +++ /dev/null 2018-01-30 20:31:21.000000000 -0500 @@ -1,65 +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.xml.internal.bind.v2.model.annotation; - -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * {@link Location} that is chained. - * - *

- * {@link Locatable} forms a tree structure, where each {@link Locatable} - * points back to the upstream {@link Locatable}. - * For example, imagine {@link Locatable} X that points to a particular annotation, - * whose upstream is {@link Locatable} Y, which points to a particular method - * (on which the annotation is put), whose upstream is {@link Locatable} Z, - * which points to a particular class (in which the method is defined), - * whose upstream is {@link Locatable} W, - * which points to another class (which refers to the class Z), and so on. - * - *

- * This chain will be turned into a list when we report the error to users. - * This allows them to know where the error happened - * and why that place became relevant. - * - * @author Kohsuke Kawaguchi - */ -public interface Locatable { - /** - * Gets the upstream {@link Location} information. - * - * @return - * can be null. - */ - Locatable getUpstream(); - - /** - * Gets the location object that this object points to. - * - * This operation could be inefficient and costly. - */ - Location getLocation(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/LocatableAnnotation.java 2018-01-30 20:31:22.000000000 -0500 +++ /dev/null 2018-01-30 20:31:22.000000000 -0500 @@ -1,130 +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.xml.internal.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.lang.reflect.Modifier; -import java.util.HashMap; -import java.util.Map; - -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * {@link Annotation} that also implements {@link Locatable}. - * - * @author Kohsuke Kawaguchi - */ -public class LocatableAnnotation implements InvocationHandler, Locatable, Location { - private final Annotation core; - - private final Locatable upstream; - - /** - * Wraps the annotation into a proxy so that the returned object will also implement - * {@link Locatable}. - */ - public static A create( A annotation, Locatable parentSourcePos ) { - if(annotation==null) return null; - Class type = annotation.annotationType(); - if(quicks.containsKey(type)) { - // use the existing proxy implementation if available - return (A)quicks.get(type).newInstance(parentSourcePos,annotation); - } - - // otherwise take the slow route - - ClassLoader cl = SecureLoader.getClassClassLoader(LocatableAnnotation.class); - - try { - Class loadableT = Class.forName(type.getName(), false, cl); - if(loadableT !=type) - return annotation; // annotation type not loadable from this class loader - - return (A)Proxy.newProxyInstance(cl, - new Class[]{ type, Locatable.class }, - new LocatableAnnotation(annotation,parentSourcePos)); - } catch (ClassNotFoundException e) { - // annotation not loadable - return annotation; - } catch (IllegalArgumentException e) { - // Proxy.newProxyInstance throws this if it cannot resolve this annotation - // in this classloader - return annotation; - } - - } - - LocatableAnnotation(Annotation core, Locatable upstream) { - this.core = core; - this.upstream = upstream; - } - - public Locatable getUpstream() { - return upstream; - } - - public Location getLocation() { - return this; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - try { - if(method.getDeclaringClass()==Locatable.class) - return method.invoke(this,args); - if(Modifier.isStatic(method.getModifiers())) - // malicious code can pass in a static Method object. - // doing method.invoke() would end up executing it, - // so we need to protect against it. - throw new IllegalArgumentException(); - - return method.invoke(core,args); - } catch (InvocationTargetException e) { - if(e.getTargetException()!=null) - throw e.getTargetException(); - throw e; - } - } - - public String toString() { - return core.toString(); - } - - - /** - * List of {@link Quick} implementations keyed by their annotation type. - */ - private static final Map quicks = new HashMap(); - - static { - for( Quick q : Init.getAll() ) { - quicks.put(q.annotationType(),q); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages.java 2018-01-30 20:31:22.000000000 -0500 +++ /dev/null 2018-01-30 20:31:23.000000000 -0500 @@ -1,49 +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.xml.internal.bind.v2.model.annotation; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Message resources - */ -enum Messages { - // AnnotationParser - DUPLICATE_ANNOTATIONS, - CLASS_NOT_FOUND - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages.properties 2018-01-30 20:31:23.000000000 -0500 +++ /dev/null 2018-01-30 20:31:23.000000000 -0500 @@ -1,31 +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. -# - -DUPLICATE_ANNOTATIONS = \ - Annotation "{0}" is present on both "{1}" and "{2}" - -CLASS_NOT_FOUND = \ - \nError occured while invoking reflection on target classes. Make sure all referenced classes are on classpath: {0} \ - \nException: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages_de.properties 2018-01-30 20:31:24.000000000 -0500 +++ /dev/null 2018-01-30 20:31:24.000000000 -0500 @@ -1,28 +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. -# - -DUPLICATE_ANNOTATIONS = Annotation "{0}" ist sowohl f\u00FCr "{1}" als auch f\u00FCr "{2}" vorhanden - -CLASS_NOT_FOUND = \nFehler beim Aufruf von Reflektion auf Zielklassen. Stellen Sie sicher, dass alle referenzierten Klassen im Classpath vorhanden sind: {0} \nAusnahme: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages_es.properties 2018-01-30 20:31:25.000000000 -0500 +++ /dev/null 2018-01-30 20:31:25.000000000 -0500 @@ -1,28 +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. -# - -DUPLICATE_ANNOTATIONS = La anotaci\u00F3n "{0}" se encuentra en "{1}" y en "{2}" - -CLASS_NOT_FOUND = \nSe ha producido un error al llamar a la reflexi\u00F3n en las clases de destino. Aseg\u00FArese de que todas las clases a las que se hace referencia se encuentran en la classpath: {0} \nExcepci\u00F3n: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages_fr.properties 2018-01-30 20:31:25.000000000 -0500 +++ /dev/null 2018-01-30 20:31:25.000000000 -0500 @@ -1,28 +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. -# - -DUPLICATE_ANNOTATIONS = L''annotation "{0}" figure \u00E0 la fois sur "{1}" et "{2}" - -CLASS_NOT_FOUND = \nUne erreur s''est produite lors de l''appel de Reflection sur les classes cible. Assurez-vous que toutes les classes r\u00E9f\u00E9renc\u00E9es figurent sur le classpath {0} \nException : {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages_it.properties 2018-01-30 20:31:26.000000000 -0500 +++ /dev/null 2018-01-30 20:31:26.000000000 -0500 @@ -1,28 +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. -# - -DUPLICATE_ANNOTATIONS = L''annotazione "{0}" \u00E8 presente su "{1}" e su "{2}" - -CLASS_NOT_FOUND = \nSi \u00E8 verificato un errore durante il richiamo della riflessione sulle classi di destinazione. Assicurarsi che tutte le classi di riferimento si trovino sul classpath: {0} \nEccezione: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages_ja.properties 2018-01-30 20:31:27.000000000 -0500 +++ /dev/null 2018-01-30 20:31:27.000000000 -0500 @@ -1,28 +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. -# - -DUPLICATE_ANNOTATIONS = \u6CE8\u91C8"{0}"\u306F"{1}"\u3068"{2}"\u306E\u4E21\u65B9\u306B\u5B58\u5728\u3057\u307E\u3059 - -CLASS_NOT_FOUND = \n\u30BF\u30FC\u30B2\u30C3\u30C8\u30FB\u30AF\u30E9\u30B9\u3067\u306E\u30EA\u30D5\u30EC\u30AF\u30B7\u30E7\u30F3\u306E\u547C\u51FA\u3057\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002\u53C2\u7167\u3055\u308C\u308B\u3059\u3079\u3066\u306E\u30AF\u30E9\u30B9\u304C\u30AF\u30E9\u30B9\u30D1\u30B9\u306B\u5B58\u5728\u3057\u3066\u3044\u308B\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044: {0}\n\u4F8B\u5916: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages_ko.properties 2018-01-30 20:31:27.000000000 -0500 +++ /dev/null 2018-01-30 20:31:27.000000000 -0500 @@ -1,28 +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. -# - -DUPLICATE_ANNOTATIONS = "{0}" \uC8FC\uC11D\uC774 "{1}"\uACFC(\uC640) "{2}", \uB450 \uC704\uCE58\uC5D0 \uC788\uC2B5\uB2C8\uB2E4. - -CLASS_NOT_FOUND = \n\uB300\uC0C1 \uD074\uB798\uC2A4\uC5D0\uC11C \uB9AC\uD50C\uB809\uC158\uC744 \uD638\uCD9C\uD558\uB294 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. \uCC38\uC870\uB41C \uBAA8\uB4E0 \uD074\uB798\uC2A4\uAC00 \uD074\uB798\uC2A4 \uACBD\uB85C {0}\uC5D0 \uC788\uB294\uC9C0 \uD655\uC778\uD558\uC2ED\uC2DC\uC624. \n\uC608\uC678 \uC0AC\uD56D: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages_pt_BR.properties 2018-01-30 20:31:28.000000000 -0500 +++ /dev/null 2018-01-30 20:31:28.000000000 -0500 @@ -1,28 +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. -# - -DUPLICATE_ANNOTATIONS = A anota\u00E7\u00E3o "{0}" est\u00E1 presente em "{1}" e "{2}" - -CLASS_NOT_FOUND = \nOcorreu um erro ao chamar a reflex\u00E3o nas classes do alvo. Certifique-se de que todas as classes mencionadas estejam no classpath: {0} \nExce\u00E7\u00E3o: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages_zh_CN.properties 2018-01-30 20:31:29.000000000 -0500 +++ /dev/null 2018-01-30 20:31:29.000000000 -0500 @@ -1,28 +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. -# - -DUPLICATE_ANNOTATIONS = "{1}" \u548C "{2}" \u4E0A\u90FD\u5B58\u5728\u6CE8\u91CA "{0}" - -CLASS_NOT_FOUND = \n\u5728\u76EE\u6807\u7C7B\u4E0A\u8C03\u7528\u53CD\u5C04\u65F6\u51FA\u9519\u3002\u8BF7\u786E\u4FDD\u6240\u6709\u5F15\u7528\u7684\u7C7B\u90FD\u4F4D\u4E8E\u7C7B\u8DEF\u5F84\u4E0A: {0} \n\u5F02\u5E38\u9519\u8BEF: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Messages_zh_TW.properties 2018-01-30 20:31:29.000000000 -0500 +++ /dev/null 2018-01-30 20:31:30.000000000 -0500 @@ -1,28 +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. -# - -DUPLICATE_ANNOTATIONS = "{1}" \u8207 "{2}"\u90FD\u6709\u8A3B\u89E3 "{0}" - -CLASS_NOT_FOUND = \n\u5728\u76EE\u6A19\u985E\u5225\u4E0A\u547C\u53EB\u53CD\u6620\u6642\u767C\u751F\u932F\u8AA4. \u8ACB\u78BA\u5B9A\u6240\u6709\u53C3\u7167\u7684\u985E\u5225\u5747\u4F4D\u65BC\u985E\u5225\u8DEF\u5F91: {0} \n\u7570\u5E38\u72C0\u6CC1: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/MethodLocatable.java 2018-01-30 20:31:30.000000000 -0500 +++ /dev/null 2018-01-30 20:31:30.000000000 -0500 @@ -1,54 +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.xml.internal.bind.v2.model.annotation; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * {@link Locatable} implementation for a method. - * - * @author Kohsuke Kawaguchi - */ -public class MethodLocatable implements Locatable { - private final Locatable upstream; - private final M method; - private final Navigator nav; - - public MethodLocatable(Locatable upstream, M method, Navigator nav) { - this.upstream = upstream; - this.method = method; - this.nav = nav; - } - - public Locatable getUpstream() { - return upstream; - } - - public Location getLocation() { - return nav.getMethodLocation(method); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/Quick.java 2018-01-30 20:31:31.000000000 -0500 +++ /dev/null 2018-01-30 20:31:31.000000000 -0500 @@ -1,70 +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.xml.internal.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; - -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * Base implementation of {@link Locatable} {@link Annotation}. - * - *

- * Derived classes of this class is provided for annotations that are commonly - * used in JAXB, to improve the performance of {@link LocatableAnnotation#create}. - * - * @author Kohsuke Kawaguchi - */ -public /*so that our code generator can refer to this class*/ abstract class Quick implements Annotation, Locatable, Location { - private final Locatable upstream; - - protected Quick(Locatable upstream) { - this.upstream = upstream; - } - - /** - * Gets the annotation object that this object is wrapping. - */ - protected abstract Annotation getAnnotation(); - - /** - * Factory method to create a new instance of the same kind. - * A {@link Quick} object also works as a factory of itself - */ - protected abstract Quick newInstance( Locatable upstream, Annotation core ); - - public final Location getLocation() { - return this; - } - - public final Locatable getUpstream() { - return upstream; - } - - public final String toString() { - return getAnnotation().toString(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/RuntimeAnnotationReader.java 2018-01-30 20:31:31.000000000 -0500 +++ /dev/null 2018-01-30 20:31:32.000000000 -0500 @@ -1,36 +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.xml.internal.bind.v2.model.annotation; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeAnnotationReader extends AnnotationReader { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/RuntimeInlineAnnotationReader.java 2018-01-30 20:31:32.000000000 -0500 +++ /dev/null 2018-01-30 20:31:32.000000000 -0500 @@ -1,151 +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.xml.internal.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; - -/** - * {@link AnnotationReader} that uses {@code java.lang.reflect} to - * read annotations from class files. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public final class RuntimeInlineAnnotationReader extends AbstractInlineAnnotationReaderImpl - implements RuntimeAnnotationReader { - - public A getFieldAnnotation(Class annotation, Field field, Locatable srcPos) { - return LocatableAnnotation.create(field.getAnnotation(annotation),srcPos); - } - - public boolean hasFieldAnnotation(Class annotationType, Field field) { - return field.isAnnotationPresent(annotationType); - } - - public boolean hasClassAnnotation(Class clazz, Class annotationType) { - return clazz.isAnnotationPresent(annotationType); - } - - public Annotation[] getAllFieldAnnotations(Field field, Locatable srcPos) { - Annotation[] r = field.getAnnotations(); - for( int i=0; i A getMethodAnnotation(Class annotation, Method method, Locatable srcPos) { - return LocatableAnnotation.create(method.getAnnotation(annotation),srcPos); - } - - public boolean hasMethodAnnotation(Class annotation, Method method) { - return method.isAnnotationPresent(annotation); - } - - public Annotation[] getAllMethodAnnotations(Method method, Locatable srcPos) { - Annotation[] r = method.getAnnotations(); - for( int i=0; i A getMethodParameterAnnotation(Class annotation, Method method, int paramIndex, Locatable srcPos) { - Annotation[] pa = method.getParameterAnnotations()[paramIndex]; - for( Annotation a : pa ) { - if(a.annotationType()==annotation) - return LocatableAnnotation.create((A)a,srcPos); - } - return null; - } - - public A getClassAnnotation(Class a, Class clazz, Locatable srcPos) { - return LocatableAnnotation.create(((Class)clazz).getAnnotation(a),srcPos); - } - - - /** - * Cache for package-level annotations. - */ - private final Map,Map> packageCache = - new HashMap,Map>(); - - public A getPackageAnnotation(Class a, Class clazz, Locatable srcPos) { - Package p = clazz.getPackage(); - if(p==null) return null; - - Map cache = packageCache.get(a); - if(cache==null) { - cache = new HashMap(); - packageCache.put(a,cache); - } - - if(cache.containsKey(p)) - return (A)cache.get(p); - else { - A ann = LocatableAnnotation.create(p.getAnnotation(a),srcPos); - cache.put(p,ann); - return ann; - } - } - - public Class getClassValue(Annotation a, String name) { - try { - return (Class)a.annotationType().getMethod(name).invoke(a); - } catch (IllegalAccessException e) { - // impossible - throw new IllegalAccessError(e.getMessage()); - } catch (InvocationTargetException e) { - // impossible - throw new InternalError(Messages.CLASS_NOT_FOUND.format(a.annotationType(), e.getMessage())); - } catch (NoSuchMethodException e) { - throw new NoSuchMethodError(e.getMessage()); - } - } - - public Class[] getClassArrayValue(Annotation a, String name) { - try { - return (Class[])a.annotationType().getMethod(name).invoke(a); - } catch (IllegalAccessException e) { - // impossible - throw new IllegalAccessError(e.getMessage()); - } catch (InvocationTargetException e) { - // impossible - throw new InternalError(e.getMessage()); - } catch (NoSuchMethodException e) { - throw new NoSuchMethodError(e.getMessage()); - } - } - - protected String fullName(Method m) { - return m.getDeclaringClass().getName()+'#'+m.getName(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/SecureLoader.java 2018-01-30 20:31:33.000000000 -0500 +++ /dev/null 2018-01-30 20:31:33.000000000 -0500 @@ -1,75 +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.xml.internal.bind.v2.model.annotation; - -/** - * Class defined for safe calls of getClassLoader methods of any kind (context/system/class - * classloader. This MUST be package private and defined in every package which - * uses such invocations. - * @author snajper - */ -class SecureLoader { - - static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - - static ClassLoader getClassClassLoader(final Class c) { - if (System.getSecurityManager() == null) { - return c.getClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return c.getClassLoader(); - } - }); - } - } - - static ClassLoader getSystemClassLoader() { - if (System.getSecurityManager() == null) { - return ClassLoader.getSystemClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return ClassLoader.getSystemClassLoader(); - } - }); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlAttributeQuick.java 2018-01-30 20:31:34.000000000 -0500 +++ /dev/null 2018-01-30 20:31:34.000000000 -0500 @@ -1,72 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlAttribute; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlAttributeQuick - extends Quick - implements XmlAttribute -{ - - private final XmlAttribute core; - - public XmlAttributeQuick(Locatable upstream, XmlAttribute core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlAttributeQuick(upstream, ((XmlAttribute) core)); - } - - public Class annotationType() { - return XmlAttribute.class; - } - - public String name() { - return core.name(); - } - - public String namespace() { - return core.namespace(); - } - - public boolean required() { - return core.required(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlElementDeclQuick.java 2018-01-30 20:31:34.000000000 -0500 +++ /dev/null 2018-01-30 20:31:34.000000000 -0500 @@ -1,84 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlElementDecl; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlElementDeclQuick - extends Quick - implements XmlElementDecl -{ - - private final XmlElementDecl core; - - public XmlElementDeclQuick(Locatable upstream, XmlElementDecl core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlElementDeclQuick(upstream, ((XmlElementDecl) core)); - } - - public Class annotationType() { - return XmlElementDecl.class; - } - - public String name() { - return core.name(); - } - - public Class scope() { - return core.scope(); - } - - public String namespace() { - return core.namespace(); - } - - public String defaultValue() { - return core.defaultValue(); - } - - public String substitutionHeadNamespace() { - return core.substitutionHeadNamespace(); - } - - public String substitutionHeadName() { - return core.substitutionHeadName(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlElementQuick.java 2018-01-30 20:31:35.000000000 -0500 +++ /dev/null 2018-01-30 20:31:35.000000000 -0500 @@ -1,84 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlElement; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlElementQuick - extends Quick - implements XmlElement -{ - - private final XmlElement core; - - public XmlElementQuick(Locatable upstream, XmlElement core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlElementQuick(upstream, ((XmlElement) core)); - } - - public Class annotationType() { - return XmlElement.class; - } - - public String name() { - return core.name(); - } - - public Class type() { - return core.type(); - } - - public String namespace() { - return core.namespace(); - } - - public String defaultValue() { - return core.defaultValue(); - } - - public boolean required() { - return core.required(); - } - - public boolean nillable() { - return core.nillable(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlElementRefQuick.java 2018-01-30 20:31:36.000000000 -0500 +++ /dev/null 2018-01-30 20:31:36.000000000 -0500 @@ -1,76 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlElementRef; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlElementRefQuick - extends Quick - implements XmlElementRef -{ - - private final XmlElementRef core; - - public XmlElementRefQuick(Locatable upstream, XmlElementRef core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlElementRefQuick(upstream, ((XmlElementRef) core)); - } - - public Class annotationType() { - return XmlElementRef.class; - } - - public String name() { - return core.name(); - } - - public Class type() { - return core.type(); - } - - public String namespace() { - return core.namespace(); - } - - public boolean required() { - return core.required(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlElementRefsQuick.java 2018-01-30 20:31:36.000000000 -0500 +++ /dev/null 2018-01-30 20:31:36.000000000 -0500 @@ -1,65 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlElementRefs; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlElementRefsQuick - extends Quick - implements XmlElementRefs -{ - - private final XmlElementRefs core; - - public XmlElementRefsQuick(Locatable upstream, XmlElementRefs core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlElementRefsQuick(upstream, ((XmlElementRefs) core)); - } - - public Class annotationType() { - return XmlElementRefs.class; - } - - public XmlElementRef[] value() { - return core.value(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlEnumQuick.java 2018-01-30 20:31:37.000000000 -0500 +++ /dev/null 2018-01-30 20:31:37.000000000 -0500 @@ -1,64 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlEnum; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlEnumQuick - extends Quick - implements XmlEnum -{ - - private final XmlEnum core; - - public XmlEnumQuick(Locatable upstream, XmlEnum core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlEnumQuick(upstream, ((XmlEnum) core)); - } - - public Class annotationType() { - return XmlEnum.class; - } - - public Class value() { - return core.value(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlRootElementQuick.java 2018-01-30 20:31:38.000000000 -0500 +++ /dev/null 2018-01-30 20:31:38.000000000 -0500 @@ -1,68 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlRootElement; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlRootElementQuick - extends Quick - implements XmlRootElement -{ - - private final XmlRootElement core; - - public XmlRootElementQuick(Locatable upstream, XmlRootElement core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlRootElementQuick(upstream, ((XmlRootElement) core)); - } - - public Class annotationType() { - return XmlRootElement.class; - } - - public String name() { - return core.name(); - } - - public String namespace() { - return core.namespace(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlSchemaQuick.java 2018-01-30 20:31:38.000000000 -0500 +++ /dev/null 2018-01-30 20:31:39.000000000 -0500 @@ -1,82 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlNs; -import javax.xml.bind.annotation.XmlNsForm; -import javax.xml.bind.annotation.XmlSchema; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlSchemaQuick - extends Quick - implements XmlSchema -{ - - private final XmlSchema core; - - public XmlSchemaQuick(Locatable upstream, XmlSchema core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlSchemaQuick(upstream, ((XmlSchema) core)); - } - - public Class annotationType() { - return XmlSchema.class; - } - - public String location() { - return core.location(); - } - - public String namespace() { - return core.namespace(); - } - - public XmlNs[] xmlns() { - return core.xmlns(); - } - - public XmlNsForm elementFormDefault() { - return core.elementFormDefault(); - } - - public XmlNsForm attributeFormDefault() { - return core.attributeFormDefault(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlSchemaTypeQuick.java 2018-01-30 20:31:39.000000000 -0500 +++ /dev/null 2018-01-30 20:31:39.000000000 -0500 @@ -1,72 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlSchemaType; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlSchemaTypeQuick - extends Quick - implements XmlSchemaType -{ - - private final XmlSchemaType core; - - public XmlSchemaTypeQuick(Locatable upstream, XmlSchemaType core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlSchemaTypeQuick(upstream, ((XmlSchemaType) core)); - } - - public Class annotationType() { - return XmlSchemaType.class; - } - - public String name() { - return core.name(); - } - - public Class type() { - return core.type(); - } - - public String namespace() { - return core.namespace(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlTransientQuick.java 2018-01-30 20:31:40.000000000 -0500 +++ /dev/null 2018-01-30 20:31:40.000000000 -0500 @@ -1,60 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlTransient; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlTransientQuick - extends Quick - implements XmlTransient -{ - - private final XmlTransient core; - - public XmlTransientQuick(Locatable upstream, XmlTransient core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlTransientQuick(upstream, ((XmlTransient) core)); - } - - public Class annotationType() { - return XmlTransient.class; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlTypeQuick.java 2018-01-30 20:31:40.000000000 -0500 +++ /dev/null 2018-01-30 20:31:40.000000000 -0500 @@ -1,80 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlType; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlTypeQuick - extends Quick - implements XmlType -{ - - private final XmlType core; - - public XmlTypeQuick(Locatable upstream, XmlType core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlTypeQuick(upstream, ((XmlType) core)); - } - - public Class annotationType() { - return XmlType.class; - } - - public String name() { - return core.name(); - } - - public String namespace() { - return core.namespace(); - } - - public String[] propOrder() { - return core.propOrder(); - } - - public Class factoryClass() { - return core.factoryClass(); - } - - public String factoryMethod() { - return core.factoryMethod(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/XmlValueQuick.java 2018-01-30 20:31:41.000000000 -0500 +++ /dev/null 2018-01-30 20:31:41.000000000 -0500 @@ -1,60 +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.bind.v2.model.annotation; - -import java.lang.annotation.Annotation; -import javax.xml.bind.annotation.XmlValue; - - -/** - *

Auto-generated, do not edit.

- * - */ -final class XmlValueQuick - extends Quick - implements XmlValue -{ - - private final XmlValue core; - - public XmlValueQuick(Locatable upstream, XmlValue core) { - super(upstream); - this.core = core; - } - - protected Annotation getAnnotation() { - return core; - } - - protected Quick newInstance(Locatable upstream, Annotation core) { - return new XmlValueQuick(upstream, ((XmlValue) core)); - } - - public Class annotationType() { - return XmlValue.class; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/annotation/package-info.java 2018-01-30 20:31:42.000000000 -0500 +++ /dev/null 2018-01-30 20:31:42.000000000 -0500 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * Abstraction around reading annotations, to support internal/external annotations. - */ -package com.sun.xml.internal.bind.v2.model.annotation; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/Adapter.java 2018-01-30 20:31:42.000000000 -0500 +++ /dev/null 2018-01-30 20:31:42.000000000 -0500 @@ -1,88 +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.xml.internal.bind.v2.model.core; - -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -/** - * {@link Adapter} that wraps {@link XmlJavaTypeAdapter}. - * - * @author Kohsuke Kawaguchi - */ -public class Adapter { - /** - * The adapter class. Always non-null. - * - * A class that derives from {@link javax.xml.bind.annotation.adapters.XmlAdapter}. - */ - public final ClassDeclT adapterType; - - /** - * The type that the JAXB can handle natively. - * The {@code Default} parameter of {@code XmlAdapter}. - * - * Always non-null. - */ - public final TypeT defaultType; - - /** - * The type that is stored in memory. - * The {@code Custom} parameter of {@code XmlAdapter}. - */ - public final TypeT customType; - - - - public Adapter( - XmlJavaTypeAdapter spec, - AnnotationReader reader, - Navigator nav) { - - this( nav.asDecl(reader.getClassValue(spec,"value")), nav ); - } - - public Adapter(ClassDeclT adapterType,Navigator nav) { - this.adapterType = adapterType; - TypeT baseClass = nav.getBaseClass(nav.use(adapterType), nav.asDecl(XmlAdapter.class)); - - // because the parameterization of XmlJavaTypeAdapter requires that the class derives from XmlAdapter. - assert baseClass!=null; - - if(nav.isParameterizedType(baseClass)) - defaultType = nav.getTypeArgument(baseClass,0); - else - defaultType = nav.ref(Object.class); - - if(nav.isParameterizedType(baseClass)) - customType = nav.getTypeArgument(baseClass,1); - else - customType = nav.ref(Object.class); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ArrayInfo.java 2018-01-30 20:31:43.000000000 -0500 +++ /dev/null 2018-01-30 20:31:43.000000000 -0500 @@ -1,46 +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.xml.internal.bind.v2.model.core; - -/** - * Stand-alone array that can be marshalled/unmarshalled on its own - * (without being part of any encloding {@link ClassInfo}.) - * - *

- * Most of the times arrays are treated as properties of their enclosing classes, - * but sometimes we do need to map an array class to its own XML type. - * This object is used for that purpose. - * - * @author Kohsuke Kawaguchi - */ -public interface ArrayInfo extends NonElement { - /** - * T of T[]. The type of the items of the array. - * - * @return never null - */ - NonElement getItemType(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/AttributePropertyInfo.java 2018-01-30 20:31:44.000000000 -0500 +++ /dev/null 2018-01-30 20:31:44.000000000 -0500 @@ -1,62 +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.xml.internal.bind.v2.model.core; - -import javax.xml.namespace.QName; - -/** - * Attribute {@link PropertyInfo}. - * - * @author Kohsuke Kawaguchi - */ -public interface AttributePropertyInfo extends PropertyInfo, NonElementRef { - /** - * Gets the type of the attribute. - * - *

- * Note that when this property is a collection, this method returns - * the type of each item in the collection. - * - * @return - * always non-null. - */ - NonElement getTarget(); - - /** - * Returns true if this attribute is mandatory. - */ - boolean isRequired(); - - /** - * Gets the attribute name. - * - * @return - * must be non-null. - */ - QName getXmlName(); - - Adapter getAdapter(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/BuiltinLeafInfo.java 2018-01-30 20:31:45.000000000 -0500 +++ /dev/null 2018-01-30 20:31:45.000000000 -0500 @@ -1,51 +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.xml.internal.bind.v2.model.core; - -import javax.xml.namespace.QName; - -/** - * JAXB spec designates a few Java classes to be mapped to leaves in XML. - * - *

- * Built-in leaves also have another priviledge; specifically, they often - * have more than one XML type names associated with it. - * - * @author Kohsuke Kawaguchi - */ -public interface BuiltinLeafInfo extends LeafInfo { - /** - * {@inheritDoc} - * - *

- * This method returns the 'primary' type name of this built-in leaf, - * which should be used when values of this type are marshalled. - * - * @return - * never null. - */ - public QName getTypeName(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ClassInfo.java 2018-01-30 20:31:45.000000000 -0500 +++ /dev/null 2018-01-30 20:31:45.000000000 -0500 @@ -1,182 +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.xml.internal.bind.v2.model.core; - -import java.util.List; - -import javax.xml.bind.annotation.XmlTransient; -import javax.xml.bind.annotation.XmlValue; - -/** - * Information about JAXB-bound class. - * - *

- * All the JAXB annotations are already reflected to the model so that - * the caller doesn't have to worry about them. For this reason, you - * cannot access annotations on properties. - * - *

XML representation

- *

- * A JAXB-bound class always have at least one representation - * (called "type representation"),but it can optionally have another - * representation ("element representation"). - * - *

- * In the type representaion, a class - * is represented as a set of attributes and (elements or values). - * You can inspect the details of those attributes/elements/values by {@link #getProperties()}. - * This representation corresponds to a complex/simple type in XML Schema. - * You can obtain the schema type name by {@link #getTypeName()}. - * - *

- * If a class has an element representation, {@link #isElement()} returns true. - * This representation is mostly similar to the type representation - * except that the whoe attributes/elements/values are wrapped into - * one element. You can obtain the name of this element through {@link #asElement()}. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public interface ClassInfo extends MaybeElement { - - /** - * Obtains the information about the base class. - * - * @return null - * if this info extends from {@link Object}. - */ - ClassInfo getBaseClass(); - - /** - * Gets the declaration this object is wrapping. - */ - C getClazz(); - - /** - * Gets the fully-qualified name of the class. - */ - String getName(); - - /** - * Returns all the properties newly declared in this class. - * - *

- * This excludes properties defined in the super class. - * - *

- * If the properties are {@link #isOrdered() ordered}, - * it will be returned in the order that appear in XML. - * Otherwise it will be returned in no particular order. - * - *

- * Properties marked with {@link XmlTransient} will not show up - * in this list. As far as JAXB is concerned, they are considered - * non-existent. - * - * @return - * always non-null, but can be empty. - */ - List> getProperties(); - - /** - * Returns true if this class or its ancestor has {@link XmlValue} - * property. - */ - boolean hasValueProperty(); - - /** - * Gets the property that has the specified name. - * - *

- * This is just a convenience method for: - *

-     * for( PropertyInfo p : getProperties() ) {
-     *   if(p.getName().equals(name))
-     *     return p;
-     * }
-     * return null;
-     * 
- * - * @return null - * if the property was not found. - * - * @see PropertyInfo#getName() - */ - PropertyInfo getProperty(String name); - - /** - * If the class has properties, return true. This is only - * true if the Collection object returned by {@link #getProperties()} - * is not empty. - */ - boolean hasProperties(); - - /** - * If this class is abstract and thus shall never be directly instanciated. - */ - boolean isAbstract(); - - /** - * Returns true if the properties of this class is ordered in XML. - * False if it't not. - * - *

- * In RELAX NG context, ordered properties mean {@code } and - * unordered properties mean {@code }. - */ - boolean isOrdered(); - - /** - * If this class is marked as final and no further extension/restriction is allowed. - */ - boolean isFinal(); - - /** - * True if there's a known sub-type of this class in {@link TypeInfoSet}. - */ - boolean hasSubClasses(); - - /** - * Returns true if this bean class has an attribute wildcard. - * - *

- * This is true if the class declares an attribute wildcard, - * or it is inherited from its super classes. - * - * @see #inheritsAttributeWildcard() - */ - boolean hasAttributeWildcard(); - - /** - * Returns true iff this class inherits a wildcard attribute - * from its ancestor classes. - */ - boolean inheritsAttributeWildcard(); - - /** - * Returns true iff this class declares a wildcard attribute. - */ - boolean declaresAttributeWildcard(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/Element.java 2018-01-30 20:31:46.000000000 -0500 +++ /dev/null 2018-01-30 20:31:46.000000000 -0500 @@ -1,61 +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.xml.internal.bind.v2.model.core; - -import javax.xml.namespace.QName; - -/** - * {@link TypeInfo} that maps to an element. - * - * Either {@link ElementInfo} or {@link ClassInfo}. - * - * @author Kohsuke Kawaguchi - */ -public interface Element extends TypeInfo { - /** - * Gets the element name of the class. - * - * @return - * Always non-null. - */ - QName getElementName(); - - /** - * If this element can substitute another element, return that element. - * - *

- * Substitutability of elements are transitive. - * - * @return - * null if no such element exists. - */ - Element getSubstitutionHead(); - - /** - * If non-null, this element is only active inside the given scope. - */ - ClassInfo getScope(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ElementInfo.java 2018-01-30 20:31:47.000000000 -0500 +++ /dev/null 2018-01-30 20:31:47.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.model.core; - -import java.util.Collection; - -import javax.xml.bind.JAXBElement; - -/** - * A particular use (specialization) of {@link JAXBElement}. - * - * TODO: is ElementInfo adaptable? - * - * @author Kohsuke Kawaguchi - */ -public interface ElementInfo extends Element { - - /** - * Gets the object that represents the value property. - * - * @return - * non-null. - */ - ElementPropertyInfo getProperty(); - - /** - * Short for getProperty().ref().get(0). - * - * The type of the value this element holds. - * - * Normally, this is the T of {@code JAXBElement}. - * But if the property is adapted, this is the on-the-wire type. - * - * Or if the element has a list of values, then this field - * represents the type of the individual item. - * - * @see #getContentInMemoryType() - */ - NonElement getContentType(); - - /** - * T of {@code JAXBElement}. - * - *

- * This is tied to the in-memory representation. - * - * @see #getContentType() - */ - T getContentInMemoryType(); - - /** - * Returns the representation for {@link JAXBElement}{@code }. - * - *

- * This returns the signature in Java and thus isn't affected by the adapter. - */ - T getType(); - - /** - * {@inheritDoc} - * - * {@link ElementInfo} can only substitute {@link ElementInfo}. - */ - ElementInfo getSubstitutionHead(); - - /** - * All the {@link ElementInfo}s whose {@link #getSubstitutionHead()} points - * to this object. - * - * @return - * can be empty but never null. - */ - Collection> getSubstitutionMembers(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ElementPropertyInfo.java 2018-01-30 20:31:47.000000000 -0500 +++ /dev/null 2018-01-30 20:31:47.000000000 -0500 @@ -1,123 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.model.core; - -import java.util.List; - -import javax.xml.namespace.QName; - -/** - * Property that maps to an element. - * - * @author Kohsuke Kawaguchi - */ -// TODO: there seems to be too much interactions between switches, and that's no good. -public interface ElementPropertyInfo extends PropertyInfo { - /** - * Returns the information about the types allowed in this property. - * - *

- * In a simple case like the following, an element property only has - * one {@link TypeRef} that points to {@link String} and tag name "foo". - *

-     * @XmlElement
-     * String abc;
-     * 
- * - *

- * However, in a general case an element property can be heterogeneous, - * meaning you can put different types in it, each with a different tag name - * (and a few other settings.) - *


-     * // list can contain String or Integer.
-     * {@literal @}XmlElements({
-     *   {@literal @}XmlElement(name="a",type=String.class),
-     *   {@literal @}XmlElement(name="b",type=Integer.class),
-     * })
-     * {@literal List} abc;
-     * 
-     * 

- * In this case this method returns a list of two {@link TypeRef}s. - * - * - * @return - * Always non-null. Contains at least one entry. - * If {@link #isValueList()}==true, there's always exactly one type. - */ - List> getTypes(); - - /** - * Gets the wrapper element name. - * - * @return - * must be null if {@link #isCollection()}==false or - * if {@link #isValueList()}==true. - * - * Otherwise, - * this can be null (in which case there'll be no wrapper), - * or it can be non-null (in which case there'll be a wrapper) - */ - QName getXmlName(); - - /** - * Checks if the wrapper element is required. - * - * @return - * Always false if {@link #getXmlName()}==null. - */ - boolean isCollectionRequired(); - - /** - * Returns true if this property is nillable - * (meaning the absence of the value is treated as nil='true') - * - *

- * This method is only used when this property is a collection. - */ - boolean isCollectionNillable(); - - /** - * Returns true if this property is a collection but its XML - * representation is a list of values, not repeated elements. - * - *

- * If {@link #isCollection()}==false, this property is always false. - * - *

- * When this flag is true, {@code getTypes().size()==1} always holds. - */ - boolean isValueList(); - - /** - * Returns true if this element is mandatory. - * - * For collections, this property isn't used. - * TODO: define the semantics when this is a collection - */ - boolean isRequired(); - - Adapter getAdapter(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/EnumConstant.java 2018-01-30 20:31:48.000000000 -0500 +++ /dev/null 2018-01-30 20:31:48.000000000 -0500 @@ -1,83 +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.xml.internal.bind.v2.model.core; - -import javax.xml.bind.annotation.XmlEnumValue; - -/** - * Individual constant of an enumeration. - * - *

- * Javadoc in this class uses the following sample to explain the semantics: - *

- * @XmlEnum(Integer.class)
- * enum Foo {
- *   @XmlEnumValue("1")
- *   ONE,
- *   @XmlEnumValue("2")
- *   TWO
- * }
- * 
- * - * @see EnumLeafInfo - * @author Kohsuke Kawaguchi - */ -public interface EnumConstant { - - /** - * Gets the {@link EnumLeafInfo} to which this constant belongs to. - * - * @return never null. - */ - EnumLeafInfo getEnclosingClass(); - - /** - * Lexical value of this constant. - * - *

- * This value should be evaluated against - * {@link EnumLeafInfo#getBaseType()} to obtain the typed value. - * - *

- * This is the same value as written in the {@link XmlEnumValue} annotation. - * In the above example, this method returns "1" and "2". - * - * @return - * never null. - */ - String getLexicalValue(); - - /** - * Gets the constant name. - * - *

- * In the above example this method return "ONE" and "TWO". - * - * @return - * never null. A valid Java identifier. - */ - String getName(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/EnumLeafInfo.java 2018-01-30 20:31:49.000000000 -0500 +++ /dev/null 2018-01-30 20:31:49.000000000 -0500 @@ -1,73 +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.xml.internal.bind.v2.model.core; - -/** - * {@link NonElement} that represents an {@link Enum} class. - * - * @author Kohsuke Kawaguchi - */ -public interface EnumLeafInfo extends LeafInfo { - /** - * The same as {@link #getType()} but an {@link EnumLeafInfo} - * is guaranteed to represent an enum declaration, which is a - * kind of a class declaration. - * - * @return - * always non-null. - */ - C getClazz(); - - /** - * Returns the base type of the enumeration. - * - *

- * For example, with the following enum class, this method - * returns {@link BuiltinLeafInfo} for {@link Integer}. - * - *

-     * &XmlEnum(Integer.class)
-     * enum Foo {
-     *   &XmlEnumValue("1")
-     *   ONE,
-     *   &XmlEnumValue("2")
-     *   TWO
-     * }
-     * 
- * - * @return - * never null. - */ - NonElement getBaseType(); - - /** - * Returns the read-only list of enumeration constants. - * - * @return - * never null. Can be empty (really?). - */ - Iterable getConstants(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ErrorHandler.java 2018-01-30 20:31:49.000000000 -0500 +++ /dev/null 2018-01-30 20:31:49.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.model.core; - -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; - -/** - * listen to static errors found during building a JAXB model from a set of classes. - * Implemented by the client of {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI}. - * - *

- * All the static errors have to be reported while constructing a - * model, not when a model is used (IOW, until the {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} completes. - * Internally, {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI} wraps an {@link ErrorHandler} and all the model - * components should report errors through it. - * - *

- * {@link IllegalAnnotationException} is a checked exception to remind - * the model classes to report it rather than to throw it. - * - * @see com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI - * @author Kohsuke Kawaguchi - */ -public interface ErrorHandler { - /** - * Receives a notification for an error in the annotated code. - * @param e - */ - void error( IllegalAnnotationException e ); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ID.java 2018-01-30 20:31:50.000000000 -0500 +++ /dev/null 2018-01-30 20:31:50.000000000 -0500 @@ -1,33 +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.xml.internal.bind.v2.model.core; - -/** - * @author Kohsuke Kawaguchi - */ -public enum ID { - ID,IDREF,NONE -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/LeafInfo.java 2018-01-30 20:31:51.000000000 -0500 +++ /dev/null 2018-01-30 20:31:51.000000000 -0500 @@ -1,40 +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.xml.internal.bind.v2.model.core; - -/** - * Either {@link BuiltinLeafInfo} or {@link EnumLeafInfo}. - * - *

- * Those Java types are all mapped to a chunk of text, so we call - * them "leaves". - * This interface represents the mapping information for those - * special Java types. - * - * @author Kohsuke Kawaguchi - */ -public interface LeafInfo extends MaybeElement { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/MapPropertyInfo.java 2018-01-30 20:31:51.000000000 -0500 +++ /dev/null 2018-01-30 20:31:51.000000000 -0500 @@ -1,101 +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.xml.internal.bind.v2.model.core; - -import java.util.Map; - -import javax.xml.namespace.QName; - -/** - * Property that maps to the following schema fragment. - * - *

{@code
- * 
- *   
- *     
- *       
- *         
- *           
- *           
- *         
- *       
- *     
- *   
- * 
- * }
- * - *

- * This property is used to represent a default binding of a {@link Map} property. - * ({@link Map} properties with adapters will be represented by {@link ElementPropertyInfo}.) - * - * - *

Design Thinking Led to This

- *

- * I didn't like the idea of adding such a special-purpose {@link PropertyInfo} to a model. - * The alternative was to implicitly assume an adapter, and have internal representation of - * the Entry class ready. - * But the fact that the key type and the value type changes with the parameterization makes - * it very difficult to have such a class (especially inside Annotation Processing, where we can't even generate - * classes.) - * - * @author Kohsuke Kawaguchi - */ -public interface MapPropertyInfo extends PropertyInfo { - /** - * Gets the wrapper element name. - * - * @return - * always non-null. - */ - QName getXmlName(); - - /** - * Returns true if this property is nillable - * (meaning the absence of the value is treated as nil='true') - * - *

- * This method is only used when this property is a collection. - */ - boolean isCollectionNillable(); - - /** - * Type of the key of the map. K of {@code HashMap} - * - * @return never null. - */ - NonElement getKeyType(); - - /** - * Type of the value of the map. V of {@code HashMap} - * - * @return never null. - */ - NonElement getValueType(); - - // TODO - // Adapter getKeyAdapter(); - // Adapter getValueAdapter(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/MaybeElement.java 2018-01-30 20:31:52.000000000 -0500 +++ /dev/null 2018-01-30 20:31:52.000000000 -0500 @@ -1,63 +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.xml.internal.bind.v2.model.core; - -import javax.xml.namespace.QName; - -/** - * Some {@link NonElement} can optionally be an {@link Element}. - * - * This interface captures such characteristics. - * - * @author Kohsuke Kawaguchi - */ -public interface MaybeElement extends NonElement { - /** - * If the class is bound to an element, return true. - * - *

- * Note that when this is true, the class is bound to both an element - * and a type. - */ - boolean isElement(); - - /** - * Gets the element name of the class, if the class is bound - * to an element. - * - * @return - * non-null iff {@link #isElement()}. - */ - QName getElementName(); - - /** - * Returns the {@link Element} aspect of this {@link ClassInfo}. - * - * @return - * null if {@link #isElement()}==false, non-null if {@link #isElement()}==true. - */ - Element asElement(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/NonElement.java 2018-01-30 20:31:53.000000000 -0500 +++ /dev/null 2018-01-30 20:31:53.000000000 -0500 @@ -1,60 +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.xml.internal.bind.v2.model.core; - -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import javax.xml.namespace.QName; - -/** - * {@link TypeInfo} that maps to an element. - * - * Either {@link LeafInfo} or {@link ClassInfo}. - * - * TODO: better ANYTYPE_NAME. - * - * @author Kohsuke Kawaguchi - */ -public interface NonElement extends TypeInfo { - public static final QName ANYTYPE_NAME = new QName(WellKnownNamespace.XML_SCHEMA, "anyType"); - - /** - * Gets the primary XML type ANYTYPE_NAME of the class. - * - *

- * A Java type can be mapped to multiple XML types, but one of them is - * considered "primary" and used when we generate a schema. - * - * @return - * null if the object doesn't have an explicit type ANYTYPE_NAME (AKA anonymous.) - */ - QName getTypeName(); - - /** - * Returns true if this {@link NonElement} maps to text in XML, - * without any attribute nor child elements. - */ - boolean isSimpleType(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/NonElementRef.java 2018-01-30 20:31:53.000000000 -0500 +++ /dev/null 2018-01-30 20:31:53.000000000 -0500 @@ -1,51 +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.xml.internal.bind.v2.model.core; - - - -/** - * Reference to a {@link NonElement}. - * - * This interface defines properties of a reference. - * - * @author Kohsuke Kawaguchi - */ -public interface NonElementRef { - /** - * Target of the reference. - * - * @return never null - */ - NonElement getTarget(); - - /** - * Gets the property which is the source of this reference. - * - * @return never null - */ - PropertyInfo getSource(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyInfo.java 2018-01-30 20:31:54.000000000 -0500 +++ /dev/null 2018-01-30 20:31:54.000000000 -0500 @@ -1,152 +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.bind.v2.model.core; - -import java.util.Collection; - -import javax.activation.MimeType; -import javax.xml.bind.annotation.XmlID; -import javax.xml.bind.annotation.XmlIDREF; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.namespace.QName; - -import com.sun.istack.internal.Nullable; -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationSource; - -/** - * Information about a JAXB-bound property. - * - *

- * All the JAXB annotations are already incorporated into the model so that - * the caller doesn't have to worry about reading them. For this reason, you - * cannot access annotations on properties directly. - * - * TODO: don't we need a visitor? - * - * @author Kohsuke Kawaguchi - */ -public interface PropertyInfo extends AnnotationSource { - - /** - * Gets the {@link ClassInfo} or {@link ElementInfo} to which this property belongs. - */ - TypeInfo parent(); - - /** - * Gets the name of the property. - * - *

- * For example, "foo" or "bar". - * Generally, a property name is different from XML, - * (although they are often related, as a property name is often - * computed from tag names / attribute names.) - * In fact, property names do not directly affect XML. - * The property name uniquely identifies a property within a class. - * - * @see XmlType#propOrder() - */ - String getName(); - - /** - * Gets the display name of the property. - * - *

- * This is a convenience method for - * {@code parent().getName()+'#'+getName()}. - */ - String displayName(); - - /** - * Returns true if this is a multi-valued collection property. - * Otherwise false, in which case the property is a single value. - */ - boolean isCollection(); - - /** - * List of {@link TypeInfo}s that this property references. - * - * This allows the caller to traverse the reference graph without - * getting into the details of each different property type. - * - * @return - * non-null read-only collection. - */ - Collection> ref(); - - /** - * Gets the kind of this property. - * - * @return - * always non-null. - */ - PropertyKind kind(); - - /** - * @return - * null if the property is not adapted. - */ - Adapter getAdapter(); - - /** - * Returns the IDness of the value of this element. - * - * @see XmlID - * @see XmlIDREF - * - * @return - * always non-null - */ - ID id(); - - /** - * Expected MIME type, if any. - */ - MimeType getExpectedMimeType(); - - /** - * If this is true and this property indeed represents a binary data, - * it should be always inlined. - */ - boolean inlineBinaryData(); - - /** - * The effective value of {@link XmlSchemaType} annotation, if any. - * - *

- * If the property doesn't have {@link XmlSchemaType} annotation, - * this method returns null. - * - *

- * Since a type name is a property of a Java type, not a Java property, - * A schema type name of a Java type should be primarily obtained - * by using {@link NonElement#getTypeName()}. This method is to correctly - * implement the ugly semantics of {@link XmlSchemaType} (namely - * when this returns non-null, it overrides the type names of all types - * that are in this property.) - */ - @Nullable QName getSchemaType(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/PropertyKind.java 2018-01-30 20:31:55.000000000 -0500 +++ /dev/null 2018-01-30 20:31:55.000000000 -0500 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.model.core; - -import javax.xml.bind.annotation.XmlMimeType; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlInlineBinaryData; - -/** - * An Enum that indicates if the property is - * Element, ElementRef, Value, or Attribute. - * - *

- * Corresponds to the four different kind of {@link PropertyInfo}. - * @author Bhakti Mehta (bhakti.mehta@sun.com) - */ -public enum PropertyKind { - VALUE(true,false,Integer.MAX_VALUE), - ATTRIBUTE(false,false,Integer.MAX_VALUE), - ELEMENT(true,true,0), - REFERENCE(false,true,1), - MAP(false,true,2), - ; - - /** - * This kind of property can have {@link XmlMimeType} and {@link XmlInlineBinaryData} - * annotation with it. - */ - public final boolean canHaveXmlMimeType; - - /** - * This kind of properties need to show up in {@link XmlType#propOrder()}. - */ - public final boolean isOrdered; - - /** - * {@code com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory} benefits from having index numbers assigned to - * {@link #ELEMENT}, {@link #REFERENCE}, and {@link #MAP} in this order. - */ - public final int propertyIndex; - - PropertyKind(boolean canHaveExpectedContentType, boolean isOrdered, int propertyIndex) { - this.canHaveXmlMimeType = canHaveExpectedContentType; - this.isOrdered = isOrdered; - this.propertyIndex = propertyIndex; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/Ref.java 2018-01-30 20:31:55.000000000 -0500 +++ /dev/null 2018-01-30 20:31:55.000000000 -0500 @@ -1,88 +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.bind.v2.model.core; - -import javax.xml.bind.annotation.XmlList; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; - -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -/** - * Reference to a type in a model. - * - * TODO: isn't there a similarity between this and TypeUse in XJC? - * - * @author Kohsuke Kawaguchi - */ -public final class Ref { - /** - * The type being referenced. - *

- * If the type is adapted, this field is the same as the adapter's default type. - */ - public final T type; - /** - * If the reference has an adapter, non-null. - */ - public final Adapter adapter; - /** - * If the {@link #type} is an array and it is a value list, - * true. - */ - public final boolean valueList; - - public Ref(T type) { - this(type,null,false); - } - - public Ref(T type, Adapter adapter, boolean valueList) { - this.adapter = adapter; - if(adapter!=null) - type=adapter.defaultType; - this.type = type; - this.valueList = valueList; - } - - public Ref(ModelBuilderI builder, T type, XmlJavaTypeAdapter xjta, XmlList xl ) { - this(builder.getReader(),builder.getNavigator(),type,xjta,xl); - } - - public Ref(AnnotationReader reader, - Navigator nav, - T type, XmlJavaTypeAdapter xjta, XmlList xl ) { - Adapter adapter=null; - if(xjta!=null) { - adapter = new Adapter(xjta,reader,nav); - type = adapter.defaultType; - } - - this.type = type; - this.adapter = adapter; - this.valueList = xl!=null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ReferencePropertyInfo.java 2018-01-30 20:31:56.000000000 -0500 +++ /dev/null 2018-01-30 20:31:56.000000000 -0500 @@ -1,124 +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.xml.internal.bind.v2.model.core; - -import java.util.Collection; -import java.util.Set; - -import javax.xml.namespace.QName; - -/** - * {@link PropertyInfo} that holds references to other {@link Element}s. - * - * @author Kohsuke Kawaguchi - */ -public interface ReferencePropertyInfo extends PropertyInfo { - /** - * Returns the information about the possible elements in this property. - * - *

- * As of 2004/08/17, the spec only allows you to use different element names - * when a property is a collection, but I think there's really no reason - * to limit it there --- if the user wants to use a different tag name - * for different objects, I don't see why this can be limited to collections. - * - *

- * So this is a generalization of the spec. We always allow a property to have - * multiple types and use different tag names for it, depending on the actual type. - * - *

- * In most of the cases, this collection only contains 1 item. So the runtime system - * is encouraged to provide a faster code-path that is optimized toward such cases. - * - * @return - * Always non-null. Contains at least one entry. - */ - Set> getElements(); - - /** - * {@inheritDoc}. - * - * If this {@link ReferencePropertyInfo} has a wildcard in it, - * then the returned list will contain {@link WildcardTypeInfo}. - */ - Collection> ref(); - - /** - * Gets the wrapper element name. - * - * @return - * must be null if not collection. If the property is a collection, - * this can be null (in which case there'll be no wrapper), - * or it can be non-null (in which case there'll be a wrapper) - */ - QName getXmlName(); - - /** - * Returns true if this property is nillable - * (meaning the absence of the value is treated as nil='true') - * - *

- * This method is only used when this property is a collection. - */ - boolean isCollectionNillable(); - - /** - * Checks if the wrapper element is required. - * - * @return - * Always false if {@link #getXmlName()}==null. - */ - boolean isCollectionRequired(); - - /** - * Returns true if this property can hold {@link String}s to represent - * mixed content model. - */ - boolean isMixed(); - - /** - * If this property supports the wildcard, returns its mode. - * - * @return null - * if the wildcard is not allowed on this element. - */ - WildcardMode getWildcard(); - - /** - * If this property supports the wildcard, returns its DOM handler. - * - * @return null - * if the wildcard is not allowed on this element. - */ - C getDOMHandler(); - - /** - * Returns true if this element is mandatory. - */ - boolean isRequired(); - - Adapter getAdapter(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/RegistryInfo.java 2018-01-30 20:31:57.000000000 -0500 +++ /dev/null 2018-01-30 20:31:57.000000000 -0500 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.model.core; - -import java.util.Set; - -import javax.xml.bind.annotation.XmlRegistry; - -/** - * Represents the information in a class with {@link XmlRegistry} annotaion. - * - *

- * This interface is only meant to be used as a return type from - * {@link com.sun.xml.internal.bind.v2.model.impl.ModelBuilderI}. - * - * @author Kohsuke Kawaguchi - * @param - * @param - */ -public interface RegistryInfo { - /** - * Returns all the references to other types in this registry. - * @return - */ - Set> getReferences(); - - /** - * Returns the class with {@link XmlRegistry}. - * @return - */ - C getClazz(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/TypeInfo.java 2018-01-30 20:31:58.000000000 -0500 +++ /dev/null 2018-01-30 20:31:58.000000000 -0500 @@ -1,52 +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.xml.internal.bind.v2.model.core; - -import javax.xml.bind.annotation.XmlIDREF; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; - - -/** - * Either {@link ClassInfo}, {@link ElementInfo}, or {@link LeafInfo}. - * - * @author Kohsuke Kawaguchi - */ -public interface TypeInfo extends Locatable { - - /** - * Gets the underlying Java type that object represents. - * - * @return - * always non-null. - */ - T getType(); - - /** - * True if this type is a valid target from a property annotated with {@link XmlIDREF}. - */ - boolean canBeReferencedByIDREF(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/TypeInfoSet.java 2018-01-30 20:31:58.000000000 -0500 +++ /dev/null 2018-01-30 20:31:58.000000000 -0500 @@ -1,192 +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.xml.internal.bind.v2.model.core; - -import java.util.Map; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.bind.annotation.XmlNsForm; -import javax.xml.namespace.QName; -import javax.xml.transform.Result; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -/** - * Root of models. Set of {@link TypeInfo}s. - * - * @author Kohsuke Kawaguchi - */ -public interface TypeInfoSet { - - /** - * {@link Navigator} for this model. - */ - Navigator getNavigator(); - -// turns out we can't have AnnotationReader in XJC, so it's impossible to have this here. -// perhaps we should revisit this in the future. -// /** -// * {@link AnnotationReader} for this model. -// */ -// AnnotationReader getReader(); - - /** - * Returns a {@link TypeInfo} for the given type. - * - * @return - * null if the specified type cannot be bound by JAXB, or - * not known to this set. - */ - NonElement getTypeInfo( T type ); - - /** - * Gets the {@link TypeInfo} for the any type. - */ - NonElement getAnyTypeInfo(); - - /** - * Returns a {@link ClassInfo}, {@link ArrayInfo}, or {@link LeafInfo} - * for the given bean. - * - *

- * This method is almost like refinement of {@link #getTypeInfo(Object)} except - * our C cannot derive from T. - * - * @return - * null if the specified type is not bound by JAXB or otherwise - * unknown to this set. - */ - NonElement getClassInfo( C type ); - - /** - * Returns all the {@link ArrayInfo}s known to this set. - */ - Map> arrays(); - - /** - * Returns all the {@link ClassInfo}s known to this set. - */ - Map> beans(); - - /** - * Returns all the {@link BuiltinLeafInfo}s known to this set. - */ - Map> builtins(); - - /** - * Returns all the {@link EnumLeafInfo}s known to this set. - */ - Map> enums(); - - /** - * Returns a {@link ElementInfo} for the given element. - * - * @param scope - * if null, return the info about a global element. - * Otherwise return a local element in the given scope if available, - * then look for a global element next. - */ - ElementInfo getElementInfo( C scope, QName name ); - - /** - * Returns a type information for the given reference. - */ - NonElement getTypeInfo(Ref ref); - - /** - * Returns all {@link ElementInfo}s in the given scope. - * - * @param scope - * if non-null, this method only returns the local element mapping. - */ - Map> getElementMappings( C scope ); - - /** - * Returns all the {@link ElementInfo} known to this set. - */ - Iterable> getAllElements(); - - - /** - * Gets all {@link XmlSchema#xmlns()} found in this context for the given namespace URI. - * - *

- * This operation is expected to be only used in schema generator, so it can be slow. - * - * @return - * A map from prefixes to namespace URIs, which should be declared when generating a schema. - * Could be empty but never null. - */ - Map getXmlNs(String namespaceUri); - - /** - * Gets {@link XmlSchema#location()} found in this context. - * - *

- * This operation is expected to be only used in schema generator, so it can be slow. - * - * @return - * A map from namespace URI to the value of the location. - * If the entry is missing, that means a schema should be generated for that namespace. - * If the value is "", that means the schema location is implied - * ({@code } w/o schemaLocation.) - */ - Map getSchemaLocations(); - - /** - * Gets the reasonable {@link XmlNsForm} for the given namespace URI. - * - *

- * The spec doesn't define very precisely what the {@link XmlNsForm} value - * for the given namespace would be, so this method is implemented in rather - * ad-hoc way. It should work as what most people expect for simple cases. - * - * @return never null. - */ - XmlNsForm getElementFormDefault(String nsUri); - - /** - * Gets the reasonable {@link XmlNsForm} for the given namespace URI. - * - *

- * The spec doesn't define very precisely what the {@link XmlNsForm} value - * for the given namespace would be, so this method is implemented in rather - * ad-hoc way. It should work as what most people expect for simple cases. - * - * @return never null. - */ - XmlNsForm getAttributeFormDefault(String nsUri); - - /** - * Dumps this model into XML. - * - * For debug only. - * - * TODO: not sure if this actually works. We don't really know what are T,C. - */ - public void dump( Result out ) throws JAXBException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/TypeRef.java 2018-01-30 20:31:59.000000000 -0500 +++ /dev/null 2018-01-30 20:31:59.000000000 -0500 @@ -1,54 +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.xml.internal.bind.v2.model.core; - -import javax.xml.namespace.QName; - -/** - * Information about a type referenced from {@link ElementPropertyInfo}. - * - * @author Kohsuke Kawaguchi - */ -public interface TypeRef extends NonElementRef { - /** - * The associated element name. - * - * @return - * never null. - */ - QName getTagName(); - - /** - * Returns true if this element is nillable. - */ - boolean isNillable(); - - /** - * The default value for this element if any. - * Otherwise null. - */ - String getDefaultValue(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/ValuePropertyInfo.java 2018-01-30 20:32:00.000000000 -0500 +++ /dev/null 2018-01-30 20:32:00.000000000 -0500 @@ -1,35 +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.xml.internal.bind.v2.model.core; - -/** - * Value {@link PropertyInfo}. - * - * @author Kohsuke Kawaguchi - */ -public interface ValuePropertyInfo extends PropertyInfo, NonElementRef { - Adapter getAdapter(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/WildcardMode.java 2018-01-30 20:32:00.000000000 -0500 +++ /dev/null 2018-01-30 20:32:00.000000000 -0500 @@ -1,43 +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.xml.internal.bind.v2.model.core; - -/** - * Mode of the wildcard. - * - * @author Kohsuke Kawaguchi - */ -public enum WildcardMode { - STRICT(false,true), SKIP(true,false), LAX(true,true); - - public final boolean allowDom; - public final boolean allowTypedObject; - - WildcardMode(boolean allowDom, boolean allowTypedObject) { - this.allowDom = allowDom; - this.allowTypedObject = allowTypedObject; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/WildcardTypeInfo.java 2018-01-30 20:32:01.000000000 -0500 +++ /dev/null 2018-01-30 20:32:01.000000000 -0500 @@ -1,36 +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.xml.internal.bind.v2.model.core; - -/** - * Type referenced as a result of having the wildcard. - * - * TODO: think about how to gracefully handle the difference between LAX,SKIP, and STRICT. - * - * @author Kohsuke Kawaguchi - */ -public interface WildcardTypeInfo extends TypeInfo { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/core/package-info.java 2018-01-30 20:32:02.000000000 -0500 +++ /dev/null 2018-01-30 20:32:02.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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. - */ - -/** - * The in-memory model of the JAXB-bound beans. - * - *

Parameterizations

- *

- * Interfaces in this package are parameterized to work with arbitrary Java reflection library. - * This is necessary because the RI needs to work with both the runtime reflection library - * ({@link java.lang.reflect}) and the Annotation Processing. - * - *

- * The meaning of parameterizations are as follows: - * - *

- *
T
- *
Represents an use of type, such as {@code int}, {@code Foo[]}, or {@code List}. - * Corresponds to {@link java.lang.reflect.Type}.
-* - *
C
- *
Represents a declaration of a type (that is, class, interface, enum, or annotation.) - * This doesn't include {@code int}, {@code Foo[]}, or {@code List}, because - * they don't have corresponding declarations. - * Corresponds to {@link java.lang.Class} (roughly).
- * - *
F
- *
Represents a field. - * Corresponds to {@link java.lang.reflect.Field}.
- * - *
M
- *
Represents a method. - * Corresponds to {@link java.lang.reflect.Method}.
- * - *
- */ -@XmlSchema(namespace="http://jaxb.dev.java.net/xjc/model",elementFormDefault=QUALIFIED) -package com.sun.xml.internal.bind.v2.model.core; - -import javax.xml.bind.annotation.XmlSchema; - -import static javax.xml.bind.annotation.XmlNsForm.QUALIFIED; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/AnyTypeImpl.java 2018-01-30 20:32:02.000000000 -0500 +++ /dev/null 2018-01-30 20:32:03.000000000 -0500 @@ -1,82 +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.xml.internal.bind.v2.model.impl; - -import javax.xml.namespace.QName; -import javax.xml.bind.annotation.XmlIDREF; - -import com.sun.xml.internal.bind.v2.runtime.Location; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; - -/** - * {@link TypeInfo} implementation for {@code xs:anyType}. - * - * @author Kohsuke Kawaguchi - */ -class AnyTypeImpl implements NonElement { - - private final T type; - private final Navigator nav; - - public AnyTypeImpl(Navigator nav) { - this.type = nav.ref(Object.class); - this.nav = nav; - } - - public QName getTypeName() { - return ANYTYPE_NAME; - } - - public T getType() { - return type; - } - - public Locatable getUpstream() { - return null; - } - - public boolean isSimpleType() { - return false; - } - - public Location getLocation() { - return nav.getClassLocation(nav.asDecl(Object.class)); - } - - /** - * xs:anyType can be referenced from {@link XmlIDREF}. - * - * @deprecated - * why are you calling a method whose return value is always known? - */ - public final boolean canBeReferencedByIDREF() { - return true; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/ArrayInfoImpl.java 2018-01-30 20:32:03.000000000 -0500 +++ /dev/null 2018-01-30 20:32:03.000000000 -0500 @@ -1,105 +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.bind.v2.model.impl; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.ArrayInfo; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.util.ArrayInfoUtil; -import com.sun.xml.internal.bind.v2.runtime.Location; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; - -/** - * - *

- * Public because XJC needs to access it - * - * @author Kohsuke Kawaguchi - */ -public class ArrayInfoImpl - extends TypeInfoImpl - implements ArrayInfo, Location { - - private final NonElement itemType; - - private final QName typeName; - - /** - * The representation of T[] in the underlying reflection library. - */ - private final TypeT arrayType; - - public ArrayInfoImpl(ModelBuilder builder, - Locatable upstream, TypeT arrayType) { - super(builder, upstream); - this.arrayType = arrayType; - TypeT componentType = nav().getComponentType(arrayType); - this.itemType = builder.getTypeInfo(componentType, this); - - QName n = itemType.getTypeName(); - if(n==null) { - builder.reportError(new IllegalAnnotationException(Messages.ANONYMOUS_ARRAY_ITEM.format( - nav().getTypeName(componentType)),this)); - n = new QName("#dummy"); // for error recovery - } - this.typeName = ArrayInfoUtil.calcArrayTypeName(n); - } - - public NonElement getItemType() { - return itemType; - } - - public QName getTypeName() { - return typeName; - } - - public boolean isSimpleType() { - return false; - } - - public TypeT getType() { - return arrayType; - } - - /** - * Leaf-type cannot be referenced from IDREF. - * - * @deprecated - * why are you calling a method whose return value is always known? - */ - public final boolean canBeReferencedByIDREF() { - return false; - } - - public Location getLocation() { - return this; - } - public String toString() { - return nav().getTypeName(arrayType); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/AttributePropertyInfoImpl.java 2018-01-30 20:32:04.000000000 -0500 +++ /dev/null 2018-01-30 20:32:04.000000000 -0500 @@ -1,102 +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.xml.internal.bind.v2.model.impl; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.api.impl.NameConverter; -import com.sun.xml.internal.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; - -/** - * @author Kohsuke Kawaguchi - */ -class AttributePropertyInfoImpl - extends SingleTypePropertyInfoImpl - implements AttributePropertyInfo { - - private final QName xmlName; - - private final boolean isRequired; - - AttributePropertyInfoImpl(ClassInfoImpl parent, PropertySeed seed ) { - super(parent,seed); - XmlAttribute att = seed.readAnnotation(XmlAttribute.class); - assert att!=null; - - if(att.required()) - isRequired = true; - else isRequired = nav().isPrimitive(getIndividualType()); - - this.xmlName = calcXmlName(att); - } - - private QName calcXmlName(XmlAttribute att) { - String uri; - String local; - - uri = att.namespace(); - local = att.name(); - - // compute the default - if(local.equals("##default")) - local = NameConverter.standard.toVariableName(getName()); - if(uri.equals("##default")) { - XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this ); - // JAX-RPC doesn't want the default namespace URI swapping to take effect to - // local "unqualified" elements. UGLY. - if(xs!=null) { - switch(xs.attributeFormDefault()) { - case QUALIFIED: - uri = parent.getTypeName().getNamespaceURI(); - if(uri.length()==0) - uri = parent.builder.defaultNsUri; - break; - case UNQUALIFIED: - case UNSET: - uri = ""; - } - } else - uri = ""; - } - - return new QName(uri.intern(),local.intern()); - } - - public boolean isRequired() { - return isRequired; - } - - public final QName getXmlName() { - return xmlName; - } - - public final PropertyKind kind() { - return PropertyKind.ATTRIBUTE; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/BuiltinLeafInfoImpl.java 2018-01-30 20:32:05.000000000 -0500 +++ /dev/null 2018-01-30 20:32:05.000000000 -0500 @@ -1,100 +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.xml.internal.bind.v2.model.impl; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.internal.bind.v2.model.core.LeafInfo; -import com.sun.xml.internal.bind.v2.model.core.Element; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -/** - * JAXB spec designates a few Java classes to be mapped to XML types - * in a way that ignores restrictions placed on user-defined beans. - * - * @author Kohsuke Kawaguchi - */ -public class BuiltinLeafInfoImpl extends LeafInfoImpl implements BuiltinLeafInfo { - - private final QName[] typeNames; - - protected BuiltinLeafInfoImpl(TypeT type, QName... typeNames) { - super(type, typeNames.length>0?typeNames[0]:null); - this.typeNames = typeNames; - } - - /** - * Returns all the type names recognized by this bean info. - * - * @return - * do not modify the returned array. - */ - public final QName[] getTypeNames() { - return typeNames; - } - - /** - * @deprecated always return false at this level. - */ - public final boolean isElement() { - return false; - } - - /** - * @deprecated always return null at this level. - */ - public final QName getElementName() { - return null; - } - - /** - * @deprecated always return null at this level. - */ - public final Element asElement() { - return null; - } - - /** - * Creates all the {@link BuiltinLeafInfoImpl}s as specified in the spec. - * - * {@link LeafInfo}s are all defined by the spec. - */ - public static - Map> createLeaves( Navigator nav ) { - Map> leaves = new HashMap>(); - - for( RuntimeBuiltinLeafInfoImpl leaf : RuntimeBuiltinLeafInfoImpl.builtinBeanInfos ) { - TypeT t = nav.ref(leaf.getClazz()); - leaves.put( t, new BuiltinLeafInfoImpl(t,leaf.getTypeNames()) ); - } - - return leaves; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/ClassInfoImpl.java 2018-01-30 20:32:05.000000000 -0500 +++ /dev/null 2018-01-30 20:32:05.000000000 -0500 @@ -1,1320 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.model.impl; - -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeSet; -import java.util.AbstractList; - -import javax.xml.bind.annotation.XmlAccessOrder; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorOrder; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlAttachmentRef; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlElementRefs; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlElements; -import javax.xml.bind.annotation.XmlID; -import javax.xml.bind.annotation.XmlIDREF; -import javax.xml.bind.annotation.XmlInlineBinaryData; -import javax.xml.bind.annotation.XmlList; -import javax.xml.bind.annotation.XmlMimeType; -import javax.xml.bind.annotation.XmlMixed; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlTransient; -import javax.xml.bind.annotation.XmlType; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.namespace.QName; - -import com.sun.istack.internal.FinalArrayList; -import com.sun.xml.internal.bind.annotation.OverrideAnnotationOf; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.annotation.MethodLocatable; -import com.sun.xml.internal.bind.v2.model.core.ClassInfo; -import com.sun.xml.internal.bind.v2.model.core.Element; -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.Location; -import com.sun.xml.internal.bind.v2.util.EditDistance; - - -/** - * A part of the {@link ClassInfo} that doesn't depend on a particular - * reflection library. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public class ClassInfoImpl extends TypeInfoImpl - implements ClassInfo, Element { - - protected final C clazz; - - /** - * @see #getElementName() - */ - private final QName elementName; - - /** - * @see #getTypeName() - */ - private final QName typeName; - - /** - * Lazily created. - * - * @see #getProperties() - */ - private FinalArrayList> properties; - - /** - * The property order. - * - * null if unordered. {@link #DEFAULT_ORDER} if ordered but the order is defaulted - * - * @see #isOrdered() - */ - private /*final*/ String[] propOrder; - - /** - * Lazily computed. - * - * To avoid the cyclic references of the form C1 --base--> C2 --property--> C1. - */ - private ClassInfoImpl baseClass; - - private boolean baseClassComputed = false; - - private boolean hasSubClasses = false; - - /** - * If this class has a declared (not inherited) attribute wildcard, keep the reference - * to it. - * - * This parameter is initialized at the construction time and never change. - */ - protected /*final*/ PropertySeed attributeWildcard; - - - /** - * @see #getFactoryMethod() - */ - private M factoryMethod = null; - - ClassInfoImpl(ModelBuilder builder, Locatable upstream, C clazz) { - super(builder,upstream); - this.clazz = clazz; - assert clazz!=null; - - // compute the element name - elementName = parseElementName(clazz); - - // compute the type name - XmlType t = reader().getClassAnnotation(XmlType.class,clazz,this); - typeName = parseTypeName(clazz,t); - - if(t!=null) { - String[] propOrder = t.propOrder(); - if(propOrder.length==0) - this.propOrder = null; // unordered - else { - if(propOrder[0].length()==0) - this.propOrder = DEFAULT_ORDER; - else - this.propOrder = propOrder; - } - } else { - propOrder = DEFAULT_ORDER; - } - - // obtain XmlAccessorOrder and set proporder (XmlAccessorOrder can be defined for whole package) - // ( vs ) - XmlAccessorOrder xao = reader().getPackageAnnotation(XmlAccessorOrder.class, clazz, this); - if((xao != null) && (xao.value() == XmlAccessOrder.UNDEFINED)) { - propOrder = null; - } - - // obtain XmlAccessorOrder and set proporder ( vs ) - xao = reader().getClassAnnotation(XmlAccessorOrder.class, clazz, this); - if((xao != null) && (xao.value() == XmlAccessOrder.UNDEFINED)) { - propOrder = null; - } - - if(nav().isInterface(clazz)) { - builder.reportError(new IllegalAnnotationException( - Messages.CANT_HANDLE_INTERFACE.format(nav().getClassName(clazz)), this )); - } - - // the class must have the default constructor - if (!hasFactoryConstructor(t)){ - if(!nav().hasDefaultConstructor(clazz)){ - if(nav().isInnerClass(clazz)) { - builder.reportError(new IllegalAnnotationException( - Messages.CANT_HANDLE_INNER_CLASS.format(nav().getClassName(clazz)), this )); - } else if (elementName != null) { - builder.reportError(new IllegalAnnotationException( - Messages.NO_DEFAULT_CONSTRUCTOR.format(nav().getClassName(clazz)), this )); - } - } - } - } - - public ClassInfoImpl getBaseClass() { - if (!baseClassComputed) { - // compute the base class - C s = nav().getSuperClass(clazz); - if(s==null || s==nav().asDecl(Object.class)) { - baseClass = null; - } else { - NonElement b = builder.getClassInfo(s, true, this); - if(b instanceof ClassInfoImpl) { - baseClass = (ClassInfoImpl) b; - baseClass.hasSubClasses = true; - } else { - baseClass = null; - } - } - baseClassComputed = true; - } - return baseClass; - } - - /** - * {@inheritDoc} - * - * The substitution hierarchy is the same as the inheritance hierarchy. - */ - public final Element getSubstitutionHead() { - ClassInfoImpl c = getBaseClass(); - while(c!=null && !c.isElement()) - c = c.getBaseClass(); - return c; - } - - public final C getClazz() { - return clazz; - } - - /** - * When a bean binds to an element, it's always through {@link XmlRootElement}, - * so this method always return null. - * - * @deprecated - * you shouldn't be invoking this method on {@link ClassInfoImpl}. - */ - public ClassInfoImpl getScope() { - return null; - } - - public final T getType() { - return nav().use(clazz); - } - - /** - * A {@link ClassInfo} can be referenced by {@link XmlIDREF} if - * it has an ID property. - */ - public boolean canBeReferencedByIDREF() { - for (PropertyInfo p : getProperties()) { - if(p.id()== ID.ID) - return true; - } - ClassInfoImpl base = getBaseClass(); - if(base!=null) - return base.canBeReferencedByIDREF(); - else - return false; - } - - public final String getName() { - return nav().getClassName(clazz); - } - - public A readAnnotation(Class a) { - return reader().getClassAnnotation(a,clazz,this); - } - - public Element asElement() { - if(isElement()) - return this; - else - return null; - } - - public List> getProperties() { - if(properties!=null) return properties; - - // check the access type first - XmlAccessType at = getAccessType(); - - properties = new FinalArrayList>(); - - findFieldProperties(clazz,at); - - findGetterSetterProperties(at); - - if(propOrder==DEFAULT_ORDER || propOrder==null) { - XmlAccessOrder ao = getAccessorOrder(); - if(ao==XmlAccessOrder.ALPHABETICAL) - Collections.sort(properties); - } else { - //sort them as specified - PropertySorter sorter = new PropertySorter(); - for (PropertyInfoImpl p : properties) { - sorter.checkedGet(p); // have it check for errors - } - Collections.sort(properties,sorter); - sorter.checkUnusedProperties(); - } - - {// additional error checks - PropertyInfoImpl vp=null; // existing value property - PropertyInfoImpl ep=null; // existing element property - - for (PropertyInfoImpl p : properties) { - switch(p.kind()) { - case ELEMENT: - case REFERENCE: - case MAP: - ep = p; - break; - case VALUE: - if(vp!=null) { - // can't have multiple value properties. - builder.reportError(new IllegalAnnotationException( - Messages.MULTIPLE_VALUE_PROPERTY.format(), - vp, p )); - } - if(getBaseClass()!=null) { - builder.reportError(new IllegalAnnotationException( - Messages.XMLVALUE_IN_DERIVED_TYPE.format(), p )); - } - vp = p; - break; - case ATTRIBUTE: - break; // noop - default: - assert false; - } - } - - if(ep!=null && vp!=null) { - // can't have element and value property at the same time - builder.reportError(new IllegalAnnotationException( - Messages.ELEMENT_AND_VALUE_PROPERTY.format(), - vp, ep - )); - } - } - - return properties; - } - - private void findFieldProperties(C c, XmlAccessType at) { - - // always find properties from the super class first - C sc = nav().getSuperClass(c); - if (shouldRecurseSuperClass(sc)) { - findFieldProperties(sc,at); - } - - for( F f : nav().getDeclaredFields(c) ) { - Annotation[] annotations = reader().getAllFieldAnnotations(f,this); - boolean isDummy = reader().hasFieldAnnotation(OverrideAnnotationOf.class, f); - - if( nav().isTransient(f) ) { - // it's an error for transient field to have any binding annotation - if(hasJAXBAnnotation(annotations)) - builder.reportError(new IllegalAnnotationException( - Messages.TRANSIENT_FIELD_NOT_BINDABLE.format(nav().getFieldName(f)), - getSomeJAXBAnnotation(annotations))); - } else - if( nav().isStaticField(f) ) { - // static fields are bound only when there's explicit annotation. - if(hasJAXBAnnotation(annotations)) - addProperty(createFieldSeed(f),annotations, false); - } else { - if(at==XmlAccessType.FIELD - ||(at==XmlAccessType.PUBLIC_MEMBER && nav().isPublicField(f)) - || hasJAXBAnnotation(annotations)) { - if (isDummy) { - ClassInfo top = getBaseClass(); - while ((top != null) && (top.getProperty("content") == null)) { - top = top.getBaseClass(); - } - DummyPropertyInfo prop = (DummyPropertyInfo) top.getProperty("content"); - PropertySeed seed = createFieldSeed(f); - ((DummyPropertyInfo)prop).addType(createReferenceProperty(seed)); - } else { - addProperty(createFieldSeed(f), annotations, false); - } - } - checkFieldXmlLocation(f); - } - } - } - - public final boolean hasValueProperty() { - ClassInfoImpl bc = getBaseClass(); - if(bc!=null && bc.hasValueProperty()) - return true; - - for (PropertyInfo p : getProperties()) { - if (p instanceof ValuePropertyInfo) return true; - } - - return false; - } - - public PropertyInfo getProperty(String name) { - for( PropertyInfo p: getProperties() ) { - if(p.getName().equals(name)) - return p; - } - return null; - } - - /** - * This hook is used by {@link RuntimeClassInfoImpl} to look for {@link com.sun.xml.internal.bind.annotation.XmlLocation}. - */ - protected void checkFieldXmlLocation(F f) { - } - - /** - * Gets an annotation that are allowed on both class and type. - */ - private T getClassOrPackageAnnotation(Class type) { - T t = reader().getClassAnnotation(type,clazz,this); - if(t!=null) - return t; - // defaults to the package level - return reader().getPackageAnnotation(type,clazz,this); - } - - /** - * Computes the {@link XmlAccessType} on this class by looking at {@link XmlAccessorType} - * annotations. - */ - private XmlAccessType getAccessType() { - XmlAccessorType xat = getClassOrPackageAnnotation(XmlAccessorType.class); - if(xat!=null) - return xat.value(); - else - return XmlAccessType.PUBLIC_MEMBER; - } - - /** - * Gets the accessor order for this class by consulting {@link XmlAccessorOrder}. - */ - private XmlAccessOrder getAccessorOrder() { - XmlAccessorOrder xao = getClassOrPackageAnnotation(XmlAccessorOrder.class); - if(xao!=null) - return xao.value(); - else - return XmlAccessOrder.UNDEFINED; - } - - /** - * Compares orders among {@link PropertyInfoImpl} according to {@link ClassInfoImpl#propOrder}. - * - *

- * extends {@link HashMap} to save memory. - */ - private final class PropertySorter extends HashMap implements Comparator { - /** - * Mark property names that are used, so that we can report unused property names in the propOrder array. - */ - PropertyInfoImpl[] used = new PropertyInfoImpl[propOrder.length]; - - /** - * If any name collides, it will be added to this set. - * This is used to avoid repeating the same error message. - */ - private Set collidedNames; - - PropertySorter() { - super(propOrder.length); - for( String name : propOrder ) - if(put(name,size())!=null) { - // two properties with the same name - builder.reportError(new IllegalAnnotationException( - Messages.DUPLICATE_ENTRY_IN_PROP_ORDER.format(name),ClassInfoImpl.this)); - } - } - - public int compare(PropertyInfoImpl o1, PropertyInfoImpl o2) { - int lhs = checkedGet(o1); - int rhs = checkedGet(o2); - - return lhs-rhs; - } - - private int checkedGet(PropertyInfoImpl p) { - Integer i = get(p.getName()); - if(i==null) { - // missing - if (p.kind().isOrdered) - builder.reportError(new IllegalAnnotationException( - Messages.PROPERTY_MISSING_FROM_ORDER.format(p.getName()),p)); - - // give it an order to recover from an error - i = size(); - put(p.getName(),i); - } - - // mark the used field - int ii = i; - if(ii(); - - if(collidedNames.add(p.getName())) - // report the error only on the first time - builder.reportError(new IllegalAnnotationException( - Messages.DUPLICATE_PROPERTIES.format(p.getName()),p,used[ii])); - } - used[ii] = p; - } - - return i; - } - - /** - * Report errors for unused propOrder entries. - */ - public void checkUnusedProperties() { - for( int i=0; i() { - public String get(int index) { - return properties.get(index).getName(); - } - - public int size() { - return properties.size(); - } - }); - boolean isOverriding = (i > (properties.size()-1)) ? false : properties.get(i).hasAnnotation(OverrideAnnotationOf.class); - if (!isOverriding) { - builder.reportError(new IllegalAnnotationException( - Messages.PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY.format(unusedName,nearest),ClassInfoImpl.this)); - } - } - } - } - - public boolean hasProperties() { - return !properties.isEmpty(); - } - - - /** - * Picks the first non-null argument, or null if all arguments are null. - */ - private static T pickOne( T... args ) { - for( T arg : args ) - if(arg!=null) - return arg; - return null; - } - - private static List makeSet( T... args ) { - List l = new FinalArrayList(); - for( T arg : args ) - if(arg!=null) l.add(arg); - return l; - } - - private static final class ConflictException extends Exception { - final List annotations; - - public ConflictException(List one) { - this.annotations = one; - } - } - - private static final class DuplicateException extends Exception { - final Annotation a1,a2; - public DuplicateException(Annotation a1, Annotation a2) { - this.a1 = a1; - this.a2 = a2; - } - } - - /** - * Represents 6 groups of secondary annotations - */ - private static enum SecondaryAnnotation { - JAVA_TYPE (0x01, XmlJavaTypeAdapter.class), - ID_IDREF (0x02, XmlID.class, XmlIDREF.class), - BINARY (0x04, XmlInlineBinaryData.class, XmlMimeType.class, XmlAttachmentRef.class), - ELEMENT_WRAPPER (0x08, XmlElementWrapper.class), - LIST (0x10, XmlList.class), - SCHEMA_TYPE (0x20, XmlSchemaType.class); - - /** - * Each constant gets an unique bit mask so that the presence/absence - * of them can be represented in a single byte. - */ - final int bitMask; - /** - * List of annotations that belong to this member. - */ - final Class[] members; - - SecondaryAnnotation(int bitMask, Class... members) { - this.bitMask = bitMask; - this.members = members; - } - } - - private static final SecondaryAnnotation[] SECONDARY_ANNOTATIONS = SecondaryAnnotation.values(); - - /** - * Represents 7 groups of properties. - * - * Each instance is also responsible for rejecting annotations - * that are not allowed on that kind. - */ - private static enum PropertyGroup { - TRANSIENT (false,false,false,false,false,false), - ANY_ATTRIBUTE (true, false,false,false,false,false), - ATTRIBUTE (true, true, true, false,true, true ), - VALUE (true, true, true, false,true, true ), - ELEMENT (true, true, true, true, true, true ), - ELEMENT_REF (true, false,false,true, false,false), - MAP (false,false,false,true, false,false); - - /** - * Bit mask that represents secondary annotations that are allowed on this group. - * - * T = not allowed, F = allowed - */ - final int allowedsecondaryAnnotations; - - PropertyGroup(boolean... bits) { - int mask = 0; - assert bits.length==SECONDARY_ANNOTATIONS.length; - for( int i=0; i ANNOTATION_NUMBER_MAP = new HashMap(); - static { - Class[] annotations = { - XmlTransient.class, // 0 - XmlAnyAttribute.class, // 1 - XmlAttribute.class, // 2 - XmlValue.class, // 3 - XmlElement.class, // 4 - XmlElements.class, // 5 - XmlElementRef.class, // 6 - XmlElementRefs.class, // 7 - XmlAnyElement.class, // 8 - XmlMixed.class, // 9 - OverrideAnnotationOf.class,// 10 - }; - - HashMap m = ANNOTATION_NUMBER_MAP; - - // characterizing annotations - for( Class c : annotations ) - m.put(c, m.size() ); - - // secondary annotations - int index = 20; - for( SecondaryAnnotation sa : SECONDARY_ANNOTATIONS ) { - for( Class member : sa.members ) - m.put(member,index); - index++; - } - } - - private void checkConflict(Annotation a, Annotation b) throws DuplicateException { - assert b!=null; - if(a!=null) - throw new DuplicateException(a,b); - } - - /** - * Called only from {@link #getProperties()}. - * - *

- * This is where we decide the type of the property and checks for annotations - * that are not allowed. - * - * @param annotations - * all annotations on this property. It's the same as - * {@code seed.readAllAnnotation()}, but taken as a parameter - * because the caller should know it already. - */ - private void addProperty( PropertySeed seed, Annotation[] annotations, boolean dummy ) { - // since typically there's a very few annotations on a method, - // this runs faster than checking for each annotation via readAnnotation(A) - - - // characterizing annotations. these annotations (or lack thereof) decides - // the kind of the property it goes to. - // I wish I could use an array... - XmlTransient t = null; - XmlAnyAttribute aa = null; - XmlAttribute a = null; - XmlValue v = null; - XmlElement e1 = null; - XmlElements e2 = null; - XmlElementRef r1 = null; - XmlElementRefs r2 = null; - XmlAnyElement xae = null; - XmlMixed mx = null; - OverrideAnnotationOf ov = null; - - // encountered secondary annotations are accumulated into a bit mask - int secondaryAnnotations = 0; - - try { - for( Annotation ann : annotations ) { - Integer index = ANNOTATION_NUMBER_MAP.get(ann.annotationType()); - if(index==null) continue; - switch(index) { - case 0: checkConflict(t ,ann); t = (XmlTransient) ann; break; - case 1: checkConflict(aa ,ann); aa = (XmlAnyAttribute) ann; break; - case 2: checkConflict(a ,ann); a = (XmlAttribute) ann; break; - case 3: checkConflict(v ,ann); v = (XmlValue) ann; break; - case 4: checkConflict(e1 ,ann); e1 = (XmlElement) ann; break; - case 5: checkConflict(e2 ,ann); e2 = (XmlElements) ann; break; - case 6: checkConflict(r1 ,ann); r1 = (XmlElementRef) ann; break; - case 7: checkConflict(r2 ,ann); r2 = (XmlElementRefs) ann; break; - case 8: checkConflict(xae,ann); xae = (XmlAnyElement) ann; break; - case 9: checkConflict(mx, ann); mx = (XmlMixed) ann; break; - case 10: checkConflict(ov, ann); ov = (OverrideAnnotationOf) ann; break; - default: - // secondary annotations - secondaryAnnotations |= (1<<(index-20)); - break; - } - } - - // determine the group kind, and also count the numbers, since - // characterizing annotations are mutually exclusive. - PropertyGroup group = null; - int groupCount = 0; - - if(t!=null) { - group = PropertyGroup.TRANSIENT; - groupCount++; - } - if(aa!=null) { - group = PropertyGroup.ANY_ATTRIBUTE; - groupCount++; - } - if(a!=null) { - group = PropertyGroup.ATTRIBUTE; - groupCount++; - } - if(v!=null) { - group = PropertyGroup.VALUE; - groupCount++; - } - if(e1!=null || e2!=null) { - group = PropertyGroup.ELEMENT; - groupCount++; - } - if(r1!=null || r2!=null || xae!=null || mx!=null || ov != null) { - group = PropertyGroup.ELEMENT_REF; - groupCount++; - } - - if(groupCount>1) { - // collision between groups - List err = makeSet(t,aa,a,v,pickOne(e1,e2),pickOne(r1,r2,xae)); - throw new ConflictException(err); - } - - if(group==null) { - // if no characterizing annotation was found, it's either element or map - // sniff the signature and then decide. - assert groupCount==0; - - // UGLY: the presence of XmlJavaTypeAdapter makes it an element property. ARGH. - if(nav().isSubClassOf( seed.getRawType(), nav().ref(Map.class) ) - && !seed.hasAnnotation(XmlJavaTypeAdapter.class)) - group = PropertyGroup.MAP; - else - group = PropertyGroup.ELEMENT; - } else if (group.equals(PropertyGroup.ELEMENT)) { // see issue 791 - make sure @XmlElement annotated map property is mapped to map - if (nav().isSubClassOf( seed.getRawType(), nav().ref(Map.class)) && !seed.hasAnnotation(XmlJavaTypeAdapter.class)) { - group = PropertyGroup.MAP; - } - } - - // group determined by now - // make sure that there are no prohibited secondary annotations - if( (secondaryAnnotations&group.allowedsecondaryAnnotations)!=0 ) { - // uh oh. find the offending annotation - for( SecondaryAnnotation sa : SECONDARY_ANNOTATIONS ) { - if(group.allows(sa)) - continue; - for( Class m : sa.members ) { - Annotation offender = seed.readAnnotation(m); - if(offender!=null) { - // found it - builder.reportError(new IllegalAnnotationException( - Messages.ANNOTATION_NOT_ALLOWED.format(m.getSimpleName()),offender)); - return; - } - } - } - // there must have been an offender - assert false; - } - - // actually create annotations - switch(group) { - case TRANSIENT: - return; - case ANY_ATTRIBUTE: - // an attribute wildcard property - if(attributeWildcard!=null) { - builder.reportError(new IllegalAnnotationException( - Messages.TWO_ATTRIBUTE_WILDCARDS.format( - nav().getClassName(getClazz())),aa,attributeWildcard)); - return; // recover by ignore - } - attributeWildcard = seed; - - if(inheritsAttributeWildcard()) { - builder.reportError(new IllegalAnnotationException( - Messages.SUPER_CLASS_HAS_WILDCARD.format(), - aa,getInheritedAttributeWildcard())); - return; - } - - // check the signature and make sure it's assignable to Map - if(!nav().isSubClassOf(seed.getRawType(),nav().ref(Map.class))) { - builder.reportError(new IllegalAnnotationException( - Messages.INVALID_ATTRIBUTE_WILDCARD_TYPE.format(nav().getTypeName(seed.getRawType())), - aa,getInheritedAttributeWildcard())); - return; - } - - - return; - case ATTRIBUTE: - properties.add(createAttributeProperty(seed)); - return; - case VALUE: - properties.add(createValueProperty(seed)); - return; - case ELEMENT: - properties.add(createElementProperty(seed)); - return; - case ELEMENT_REF: - properties.add(createReferenceProperty(seed)); - return; - case MAP: - properties.add(createMapProperty(seed)); - return; - default: - assert false; - } - } catch( ConflictException x ) { - // report a conflicting annotation - List err = x.annotations; - - builder.reportError(new IllegalAnnotationException( - Messages.MUTUALLY_EXCLUSIVE_ANNOTATIONS.format( - nav().getClassName(getClazz())+'#'+seed.getName(), - err.get(0).annotationType().getName(), err.get(1).annotationType().getName()), - err.get(0), err.get(1) )); - - // recover by ignoring this property - } catch( DuplicateException e ) { - // both are present - builder.reportError(new IllegalAnnotationException( - Messages.DUPLICATE_ANNOTATIONS.format(e.a1.annotationType().getName()), - e.a1, e.a2 )); - // recover by ignoring this property - - } - } - - protected ReferencePropertyInfoImpl createReferenceProperty(PropertySeed seed) { - return new ReferencePropertyInfoImpl(this,seed); - } - - protected AttributePropertyInfoImpl createAttributeProperty(PropertySeed seed) { - return new AttributePropertyInfoImpl(this,seed); - } - - protected ValuePropertyInfoImpl createValueProperty(PropertySeed seed) { - return new ValuePropertyInfoImpl(this,seed); - } - - protected ElementPropertyInfoImpl createElementProperty(PropertySeed seed) { - return new ElementPropertyInfoImpl(this,seed); - } - - protected MapPropertyInfoImpl createMapProperty(PropertySeed seed) { - return new MapPropertyInfoImpl(this,seed); - } - - - /** - * Adds properties that consists of accessors. - */ - private void findGetterSetterProperties(XmlAccessType at) { - // in the first step we accumulate getters and setters - // into this map keyed by the property name. - Map getters = new LinkedHashMap(); - Map setters = new LinkedHashMap(); - - C c = clazz; - do { - collectGetterSetters(clazz, getters, setters); - - // take super classes into account if they have @XmlTransient - c = nav().getSuperClass(c); - } while(shouldRecurseSuperClass(c)); - - - // compute the intersection - Set complete = new TreeSet(getters.keySet()); - complete.retainAll(setters.keySet()); - - resurrect(getters, complete); - resurrect(setters, complete); - - // then look for read/write properties. - for (String name : complete) { - M getter = getters.get(name); - M setter = setters.get(name); - - Annotation[] ga = getter!=null ? reader().getAllMethodAnnotations(getter,new MethodLocatable(this,getter,nav())) : EMPTY_ANNOTATIONS; - Annotation[] sa = setter!=null ? reader().getAllMethodAnnotations(setter,new MethodLocatable(this,setter,nav())) : EMPTY_ANNOTATIONS; - - boolean hasAnnotation = hasJAXBAnnotation(ga) || hasJAXBAnnotation(sa); - boolean isOverriding = false; - if(!hasAnnotation) { - // checking if the method is overriding others isn't free, - // so we don't compute it if it's not necessary. - isOverriding = (getter!=null && nav().isOverriding(getter,c)) - && (setter!=null && nav().isOverriding(setter,c)); - } - - if((at==XmlAccessType.PROPERTY && !isOverriding) - || (at==XmlAccessType.PUBLIC_MEMBER && isConsideredPublic(getter) && isConsideredPublic(setter) && !isOverriding) - || hasAnnotation) { - // make sure that the type is consistent - if(getter!=null && setter!=null - && !nav().isSameType(nav().getReturnType(getter), nav().getMethodParameters(setter)[0])) { - // inconsistent - builder.reportError(new IllegalAnnotationException( - Messages.GETTER_SETTER_INCOMPATIBLE_TYPE.format( - nav().getTypeName(nav().getReturnType(getter)), - nav().getTypeName(nav().getMethodParameters(setter)[0]) - ), - new MethodLocatable( this, getter, nav()), - new MethodLocatable( this, setter, nav()))); - continue; - } - - // merge annotations from two list - Annotation[] r; - if(ga.length==0) { - r = sa; - } else - if(sa.length==0) { - r = ga; - } else { - r = new Annotation[ga.length+sa.length]; - System.arraycopy(ga,0,r,0,ga.length); - System.arraycopy(sa,0,r,ga.length,sa.length); - } - - addProperty(createAccessorSeed(getter, setter), r, false); - } - } - // done with complete pairs - getters.keySet().removeAll(complete); - setters.keySet().removeAll(complete); - - // TODO: think about - // class Foo { - // int getFoo(); - // } - // class Bar extends Foo { - // void setFoo(int x); - // } - // and how it will be XML-ized. - } - - private void collectGetterSetters(C c, Map getters, Map setters) { - // take super classes into account if they have @XmlTransient. - // always visit them first so that - // 1) order is right - // 2) overriden properties are handled accordingly - C sc = nav().getSuperClass(c); - if(shouldRecurseSuperClass(sc)) - collectGetterSetters(sc,getters,setters); - - Collection methods = nav().getDeclaredMethods(c); - Map> allSetters = new LinkedHashMap>(); - for( M method : methods ) { - boolean used = false; // if this method is added to getters or setters - - if(nav().isBridgeMethod(method)) - continue; // ignore - - String name = nav().getMethodName(method); - int arity = nav().getMethodParameters(method).length; - - if(nav().isStaticMethod(method)) { - ensureNoAnnotation(method); - continue; - } - - // is this a get method? - String propName = getPropertyNameFromGetMethod(name); - if(propName!=null && arity==0) { - getters.put(propName,method); - used = true; - } - - // is this a set method? - propName = getPropertyNameFromSetMethod(name); - if(propName!=null && arity==1) { - List propSetters = allSetters.get(propName); - if(null == propSetters){ - propSetters = new ArrayList(); - allSetters.put(propName, propSetters); - } - propSetters.add(method); - used = true; // used check performed later - } - - if(!used) - ensureNoAnnotation(method); - } - - // Match getter with setters by comparing getter return type to setter param - for (Map.Entry entry : getters.entrySet()) { - String propName = entry.getKey(); - M getter = entry.getValue(); - List propSetters = allSetters.remove(propName); - if (null == propSetters) { - //no matching setter - continue; - } - T getterType = nav().getReturnType(getter); - for (M setter : propSetters) { - T setterType = nav().getMethodParameters(setter)[0]; - if (nav().isSameType(setterType, getterType)) { - setters.put(propName, setter); - break; - } - } - } - - // also allow set-only properties - for (Map.Entry> e : allSetters.entrySet()) { - setters.put(e.getKey(),e.getValue().get(0)); - } - } - - /** - * Checks if the properties in this given super class should be aggregated into this class. - */ - private boolean shouldRecurseSuperClass(C sc) { - return sc!=null - && (builder.isReplaced(sc) || reader().hasClassAnnotation(sc, XmlTransient.class)); - } - - /** - * Returns true if the method is considered 'public'. - */ - private boolean isConsideredPublic(M m) { - return m ==null || nav().isPublicMethod(m); - } - - /** - * If the method has an explicit annotation, allow it to participate - * to the processing even if it lacks the setter or the getter. - */ - private void resurrect(Map methods, Set complete) { - for (Map.Entry e : methods.entrySet()) { - if(complete.contains(e.getKey())) - continue; - if(hasJAXBAnnotation(reader().getAllMethodAnnotations(e.getValue(),this))) - complete.add(e.getKey()); - } - } - - /** - * Makes sure that the method doesn't have any annotation, if it does, - * report it as an error - */ - private void ensureNoAnnotation(M method) { - Annotation[] annotations = reader().getAllMethodAnnotations(method,this); - for( Annotation a : annotations ) { - if(isJAXBAnnotation(a)) { - builder.reportError(new IllegalAnnotationException( - Messages.ANNOTATION_ON_WRONG_METHOD.format(), - a)); - return; - } - } - } - - /** - * Returns true if a given annotation is a JAXB annotation. - */ - private static boolean isJAXBAnnotation(Annotation a) { - return ANNOTATION_NUMBER_MAP.containsKey(a.annotationType()); - } - - /** - * Returns true if the array contains a JAXB annotation. - */ - private static boolean hasJAXBAnnotation(Annotation[] annotations) { - return getSomeJAXBAnnotation(annotations)!=null; - } - - private static Annotation getSomeJAXBAnnotation(Annotation[] annotations) { - for( Annotation a : annotations ) - if(isJAXBAnnotation(a)) - return a; - return null; - } - - - /** - * Returns "Foo" from "getFoo" or "isFoo". - * - * @return null - * if the method name doesn't look like a getter. - */ - private static String getPropertyNameFromGetMethod(String name) { - if(name.startsWith("get") && name.length()>3) - return name.substring(3); - if(name.startsWith("is") && name.length()>2) - return name.substring(2); - return null; - } - - /** - * Returns "Foo" from "setFoo". - * - * @return null - * if the method name doesn't look like a setter. - */ - private static String getPropertyNameFromSetMethod(String name) { - if(name.startsWith("set") && name.length()>3) - return name.substring(3); - return null; - } - - /** - * Creates a new {@link FieldPropertySeed} object. - * - *

- * Derived class can override this method to create a sub-class. - */ - protected PropertySeed createFieldSeed(F f) { - return new FieldPropertySeed(this, f); - } - - /** - * Creates a new {@link GetterSetterPropertySeed} object. - */ - protected PropertySeed createAccessorSeed(M getter, M setter) { - return new GetterSetterPropertySeed(this, getter,setter); - } - - public final boolean isElement() { - return elementName!=null; - } - - public boolean isAbstract() { - return nav().isAbstract(clazz); - } - - public boolean isOrdered() { - return propOrder!=null; - } - - public final boolean isFinal() { - return nav().isFinal(clazz); - } - - public final boolean hasSubClasses() { - return hasSubClasses; - } - - public final boolean hasAttributeWildcard() { - return declaresAttributeWildcard() || inheritsAttributeWildcard(); - } - - public final boolean inheritsAttributeWildcard() { - return getInheritedAttributeWildcard()!=null; - } - - public final boolean declaresAttributeWildcard() { - return attributeWildcard!=null; - } - - /** - * Gets the {@link PropertySeed} object for the inherited attribute wildcard. - */ - private PropertySeed getInheritedAttributeWildcard() { - for( ClassInfoImpl c=getBaseClass(); c!=null; c=c.getBaseClass() ) - if(c.attributeWildcard!=null) - return c.attributeWildcard; - return null; - } - - public final QName getElementName() { - return elementName; - } - - public final QName getTypeName() { - return typeName; - } - - public final boolean isSimpleType() { - List props = getProperties(); - if(props.size()!=1) return false; - return props.get(0).kind()==PropertyKind.VALUE; - } - - /** - * Called after all the {@link com.sun.xml.internal.bind.v2.model.core.TypeInfo}s are collected into the {@link #owner}. - */ - @Override - /*package*/ void link() { - getProperties(); // make sure properties!=null - - // property name collision cehck - Map names = new HashMap(); - for( PropertyInfoImpl p : properties ) { - p.link(); - PropertyInfoImpl old = names.put(p.getName(),p); - if(old!=null) { - builder.reportError(new IllegalAnnotationException( - Messages.PROPERTY_COLLISION.format(p.getName()), - p, old )); - } - } - super.link(); - } - - public Location getLocation() { - return nav().getClassLocation(clazz); - } - - /** - * XmlType allows specification of factoryClass and - * factoryMethod. There are to be used if no default - * constructor is found. - * - * @return - * true if the factory method was found. False if not. - */ - private boolean hasFactoryConstructor(XmlType t){ - if (t == null) return false; - - String method = t.factoryMethod(); - T fClass = reader().getClassValue(t, "factoryClass"); - if (method.length() > 0){ - if(nav().isSameType(fClass, nav().ref(XmlType.DEFAULT.class))){ - fClass = nav().use(clazz); - } - for(M m: nav().getDeclaredMethods(nav().asDecl(fClass))){ - //- Find the zero-arg public static method with the required return type - if (nav().getMethodName(m).equals(method) && - nav().isSameType(nav().getReturnType(m), nav().use(clazz)) && - nav().getMethodParameters(m).length == 0 && - nav().isStaticMethod(m)){ - factoryMethod = m; - break; - } - } - if (factoryMethod == null){ - builder.reportError(new IllegalAnnotationException( - Messages.NO_FACTORY_METHOD.format(nav().getClassName(nav().asDecl(fClass)), method), this )); - } - } else if(!nav().isSameType(fClass, nav().ref(XmlType.DEFAULT.class))){ - builder.reportError(new IllegalAnnotationException( - Messages.FACTORY_CLASS_NEEDS_FACTORY_METHOD.format(nav().getClassName(nav().asDecl(fClass))), this )); - } - return factoryMethod != null; - } - - public Method getFactoryMethod(){ - return (Method) factoryMethod; - } - - @Override - public String toString() { - return "ClassInfo("+clazz+')'; - } - - private static final String[] DEFAULT_ORDER = new String[0]; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/DummyPropertyInfo.java 2018-01-30 20:32:06.000000000 -0500 +++ /dev/null 2018-01-30 20:32:06.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.model.impl; - -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; - -/** - * {@link PropertyInfo} that allows to add additional elements to the collection. - * - * @author Martin Grebac - */ -public interface DummyPropertyInfo { - void addType(PropertyInfoImpl info); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/ERPropertyInfoImpl.java 2018-01-30 20:32:07.000000000 -0500 +++ /dev/null 2018-01-30 20:32:07.000000000 -0500 @@ -1,95 +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.xml.internal.bind.v2.model.impl; - -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; - -/** - * Common part of {@link ElementPropertyInfoImpl} and {@link ReferencePropertyInfoImpl}. - * - * @author Kohsuke Kawaguchi - */ -abstract class ERPropertyInfoImpl - extends PropertyInfoImpl { - - public ERPropertyInfoImpl(ClassInfoImpl classInfo, PropertySeed propertySeed) { - super(classInfo, propertySeed); - - XmlElementWrapper e = seed.readAnnotation(XmlElementWrapper.class); - - boolean nil = false; - boolean required = false; - if(!isCollection()) { - xmlName = null; - if(e!=null) - classInfo.builder.reportError(new IllegalAnnotationException( - Messages.XML_ELEMENT_WRAPPER_ON_NON_COLLECTION.format( - nav().getClassName(parent.getClazz())+'.'+seed.getName()), - e - )); - } else { - if(e!=null) { - xmlName = calcXmlName(e); - nil = e.nillable(); - required = e.required(); - } else - xmlName = null; - } - - wrapperNillable = nil; - wrapperRequired = required; - } - - private final QName xmlName; - - /** - * True if the wrapper tag name is nillable. - */ - private final boolean wrapperNillable; - - /** - * True if the wrapper tag is required. - */ - private final boolean wrapperRequired; - - /** - * Gets the wrapper element name. - */ - public final QName getXmlName() { - return xmlName; - } - - public final boolean isCollectionNillable() { - return wrapperNillable; - } - - public final boolean isCollectionRequired() { - return wrapperRequired; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/ElementInfoImpl.java 2018-01-30 20:32:07.000000000 -0500 +++ /dev/null 2018-01-30 20:32:07.000000000 -0500 @@ -1,430 +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.xml.internal.bind.v2.model.impl; - -import java.lang.annotation.Annotation; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.activation.MimeType; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlAttachmentRef; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlID; -import javax.xml.bind.annotation.XmlIDREF; -import javax.xml.bind.annotation.XmlInlineBinaryData; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.namespace.QName; - -import com.sun.istack.internal.FinalArrayList; -import com.sun.xml.internal.bind.v2.TODO; -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationSource; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.Adapter; -import com.sun.xml.internal.bind.v2.model.core.ClassInfo; -import com.sun.xml.internal.bind.v2.model.core.ElementInfo; -import com.sun.xml.internal.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeRef; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.Location; -import com.sun.xml.internal.bind.v2.runtime.SwaRefAdapter; - -/** - * {@link ElementInfo} implementation. - * - * @author Kohsuke Kawaguchi - */ -class ElementInfoImpl extends TypeInfoImpl implements ElementInfo { - - private final QName tagName; - - private final NonElement contentType; - - private final T tOfJAXBElementT; - - private final T elementType; - - private final ClassInfo scope; - - /** - * Annotation that controls the binding. - */ - private final XmlElementDecl anno; - - /** - * If this element can substitute another element, the element name. - * @see #link() - */ - private ElementInfoImpl substitutionHead; - - /** - * Lazily constructed list of {@link ElementInfo}s that can substitute this element. - * This could be null. - * @see #link() - */ - private FinalArrayList> substitutionMembers; - - /** - * The factory method from which this mapping was created. - */ - private final M method; - - /** - * If the content type is adapter, return that adapter. - */ - private final Adapter adapter; - - private final boolean isCollection; - - private final ID id; - - private final PropertyImpl property; - private final MimeType expectedMimeType; - private final boolean inlineBinary; - private final QName schemaType; - - /** - * Singleton instance of {@link ElementPropertyInfo} for this element. - */ - protected class PropertyImpl implements - ElementPropertyInfo, - TypeRef, - AnnotationSource { - // - // TypeRef impl - // - public NonElement getTarget() { - return contentType; - } - public QName getTagName() { - return tagName; - } - - public List> getTypes() { - return Collections.singletonList(this); - } - - public List> ref() { - return Collections.singletonList(contentType); - } - - public QName getXmlName() { - return tagName; - } - - public boolean isCollectionRequired() { - return false; - } - - public boolean isCollectionNillable() { - return true; - } - - public boolean isNillable() { - return true; - } - - public String getDefaultValue() { - String v = anno.defaultValue(); - if(v.equals("\u0000")) - return null; - else - return v; - } - - public ElementInfoImpl parent() { - return ElementInfoImpl.this; - } - - public String getName() { - return "value"; - } - - public String displayName() { - return "JAXBElement#value"; - } - - public boolean isCollection() { - return isCollection; - } - - /** - * For {@link ElementInfo}s, a collection always means a list of values. - */ - public boolean isValueList() { - return isCollection; - } - - public boolean isRequired() { - return true; - } - - public PropertyKind kind() { - return PropertyKind.ELEMENT; - } - - public Adapter getAdapter() { - return adapter; - } - - public ID id() { - return id; - } - - public MimeType getExpectedMimeType() { - return expectedMimeType; - } - - public QName getSchemaType() { - return schemaType; - } - - public boolean inlineBinaryData() { - return inlineBinary; - } - - public PropertyInfo getSource() { - return this; - } - - // - // - // AnnotationSource impl - // - // - public A readAnnotation(Class annotationType) { - return reader().getMethodAnnotation(annotationType,method,ElementInfoImpl.this); - } - - public boolean hasAnnotation(Class annotationType) { - return reader().hasMethodAnnotation(annotationType,method); - } - } - - /** - * @param m - * The factory method on ObjectFactory that comes with {@link XmlElementDecl}. - */ - public ElementInfoImpl(ModelBuilder builder, - RegistryInfoImpl registry, M m ) throws IllegalAnnotationException { - super(builder,registry); - - this.method = m; - anno = reader().getMethodAnnotation( XmlElementDecl.class, m, this ); - assert anno!=null; // the caller should check this - assert anno instanceof Locatable; - - elementType = nav().getReturnType(m); - T baseClass = nav().getBaseClass(elementType,nav().asDecl(JAXBElement.class)); - if(baseClass==null) - throw new IllegalAnnotationException( - Messages.XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD.format(nav().getMethodName(m)), - anno ); - - tagName = parseElementName(anno); - T[] methodParams = nav().getMethodParameters(m); - - // adapter - Adapter a = null; - if(methodParams.length>0) { - XmlJavaTypeAdapter adapter = reader().getMethodAnnotation(XmlJavaTypeAdapter.class,m,this); - if(adapter!=null) - a = new Adapter(adapter,reader(),nav()); - else { - XmlAttachmentRef xsa = reader().getMethodAnnotation(XmlAttachmentRef.class,m,this); - if(xsa!=null) { - TODO.prototype("in Annotation Processing swaRefAdapter isn't avaialble, so this returns null"); - a = new Adapter(owner.nav.asDecl(SwaRefAdapter.class),owner.nav); - } - } - } - this.adapter = a; - - // T of JAXBElement - tOfJAXBElementT = - methodParams.length>0 ? methodParams[0] // this is more reliable, as it works even for ObjectFactory that sometimes have to return public types - : nav().getTypeArgument(baseClass,0); // fall back to infer from the return type if no parameter. - - if(adapter==null) { - T list = nav().getBaseClass(tOfJAXBElementT,nav().asDecl(List.class)); - if(list==null) { - isCollection = false; - contentType = builder.getTypeInfo(tOfJAXBElementT,this); // suck this type into the current set. - } else { - isCollection = true; - contentType = builder.getTypeInfo(nav().getTypeArgument(list,0),this); - } - } else { - // but if adapted, use the adapted type - contentType = builder.getTypeInfo(this.adapter.defaultType,this); - isCollection = false; - } - - // scope - T s = reader().getClassValue(anno,"scope"); - if(nav().isSameType(s, nav().ref(XmlElementDecl.GLOBAL.class))) - scope = null; - else { - // TODO: what happens if there's an error? - NonElement scp = builder.getClassInfo(nav().asDecl(s),this); - if(!(scp instanceof ClassInfo)) { - throw new IllegalAnnotationException( - Messages.SCOPE_IS_NOT_COMPLEXTYPE.format(nav().getTypeName(s)), - anno ); - } - scope = (ClassInfo)scp; - } - - id = calcId(); - - property = createPropertyImpl(); - - this.expectedMimeType = Util.calcExpectedMediaType(property,builder); - this.inlineBinary = reader().hasMethodAnnotation(XmlInlineBinaryData.class,method); - this.schemaType = Util.calcSchemaType(reader(),property,registry.registryClass, - getContentInMemoryType(),this); - } - - final QName parseElementName(XmlElementDecl e) { - String local = e.name(); - String nsUri = e.namespace(); - if(nsUri.equals("##default")) { - // if defaulted ... - XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class, - nav().getDeclaringClassForMethod(method),this); - if(xs!=null) - nsUri = xs.namespace(); - else { - nsUri = builder.defaultNsUri; - } - } - - return new QName(nsUri.intern(),local.intern()); - } - - protected PropertyImpl createPropertyImpl() { - return new PropertyImpl(); - } - - public ElementPropertyInfo getProperty() { - return property; - } - - public NonElement getContentType() { - return contentType; - } - - public T getContentInMemoryType() { - if(adapter==null) { - return tOfJAXBElementT; - } else { - return adapter.customType; - } - } - - public QName getElementName() { - return tagName; - } - - public T getType() { - return elementType; - } - - /** - * Leaf-type cannot be referenced from IDREF. - * - * @deprecated - * why are you calling a method whose return value is always known? - */ - public final boolean canBeReferencedByIDREF() { - return false; - } - - private ID calcId() { - // TODO: share code with PropertyInfoImpl - if(reader().hasMethodAnnotation(XmlID.class,method)) { - return ID.ID; - } else - if(reader().hasMethodAnnotation(XmlIDREF.class,method)) { - return ID.IDREF; - } else { - return ID.NONE; - } - } - - public ClassInfo getScope() { - return scope; - } - - public ElementInfo getSubstitutionHead() { - return substitutionHead; - } - - public Collection> getSubstitutionMembers() { - if(substitutionMembers==null) - return Collections.emptyList(); - else - return substitutionMembers; - } - - /** - * Called after all the {@link TypeInfo}s are collected into the {@link #owner}. - */ - /*package*/ void link() { - // substitution head - if(anno.substitutionHeadName().length()!=0) { - QName name = new QName( - anno.substitutionHeadNamespace(), anno.substitutionHeadName() ); - substitutionHead = owner.getElementInfo(null,name); - if(substitutionHead==null) { - builder.reportError( - new IllegalAnnotationException(Messages.NON_EXISTENT_ELEMENT_MAPPING.format( - name.getNamespaceURI(),name.getLocalPart()), anno)); - // recover by ignoring this substitution declaration - } else - substitutionHead.addSubstitutionMember(this); - } else - substitutionHead = null; - super.link(); - } - - private void addSubstitutionMember(ElementInfoImpl child) { - if(substitutionMembers==null) - substitutionMembers = new FinalArrayList>(); - substitutionMembers.add(child); - } - - public Location getLocation() { - return nav().getMethodLocation(method); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/ElementPropertyInfoImpl.java 2018-01-30 20:32:08.000000000 -0500 +++ /dev/null 2018-01-30 20:32:08.000000000 -0500 @@ -1,201 +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.xml.internal.bind.v2.model.impl; - -import java.util.AbstractList; -import java.util.Collections; -import java.util.List; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElements; -import javax.xml.bind.annotation.XmlList; -import javax.xml.namespace.QName; - -import com.sun.istack.internal.FinalArrayList; -import com.sun.xml.internal.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeRef; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; - -/** - * Common {@link ElementPropertyInfo} implementation used for both - * Annotation Processing and runtime. - * - * @author Kohsuke Kawaguchi - */ -class ElementPropertyInfoImpl - extends ERPropertyInfoImpl - implements ElementPropertyInfo -{ - /** - * Lazily computed. - * @see #getTypes() - */ - private List> types; - - private final List> ref = new AbstractList>() { - public TypeInfo get(int index) { - return getTypes().get(index).getTarget(); - } - - public int size() { - return getTypes().size(); - } - }; - - /** - * Lazily computed. - * @see #isRequired() - */ - private Boolean isRequired; - - /** - * @see #isValueList() - */ - private final boolean isValueList; - - ElementPropertyInfoImpl( - ClassInfoImpl parent, - PropertySeed propertySeed) { - super(parent, propertySeed); - - isValueList = seed.hasAnnotation(XmlList.class); - - } - - public List> getTypes() { - if(types==null) { - types = new FinalArrayList>(); - XmlElement[] ann=null; - - XmlElement xe = seed.readAnnotation(XmlElement.class); - XmlElements xes = seed.readAnnotation(XmlElements.class); - - if(xe!=null && xes!=null) { - parent.builder.reportError(new IllegalAnnotationException( - Messages.MUTUALLY_EXCLUSIVE_ANNOTATIONS.format( - nav().getClassName(parent.getClazz())+'#'+seed.getName(), - xe.annotationType().getName(), xes.annotationType().getName()), - xe, xes )); - } - - isRequired = true; - - if(xe!=null) - ann = new XmlElement[]{xe}; - else - if(xes!=null) - ann = xes.value(); - - if(ann==null) { - // default - TypeT t = getIndividualType(); - if(!nav().isPrimitive(t) || isCollection()) - isRequired = false; - // nillableness defaults to true if it's collection - types.add(createTypeRef(calcXmlName((XmlElement)null),t,isCollection(),null)); - } else { - for( XmlElement item : ann ) { - // TODO: handle defaulting in names. - QName name = calcXmlName(item); - TypeT type = reader().getClassValue(item, "type"); - if (nav().isSameType(type, nav().ref(XmlElement.DEFAULT.class))) - type = getIndividualType(); - if((!nav().isPrimitive(type) || isCollection()) && !item.required()) - isRequired = false; - types.add(createTypeRef(name, type, item.nillable(), getDefaultValue(item.defaultValue()) )); - } - } - types = Collections.unmodifiableList(types); - assert !types.contains(null); - } - return types; - } - - private String getDefaultValue(String value) { - if(value.equals("\u0000")) - return null; - else - return value; - } - - /** - * Used by {@link PropertyInfoImpl} to create new instances of {@link TypeRef} - */ - protected TypeRefImpl createTypeRef(QName name,TypeT type,boolean isNillable,String defaultValue) { - return new TypeRefImpl(this,name,type,isNillable,defaultValue); - } - - public boolean isValueList() { - return isValueList; - } - - public boolean isRequired() { - if(isRequired==null) - getTypes(); // compute the value - return isRequired; - } - - public List> ref() { - return ref; - } - - public final PropertyKind kind() { - return PropertyKind.ELEMENT; - } - - protected void link() { - super.link(); - for (TypeRefImpl ref : getTypes() ) { - ref.link(); - } - - if(isValueList()) { - // ugly test, because IDREF's are represented as text on the wire, - // it's OK to be a value list in that case. - if(id()!= ID.IDREF) { - // check if all the item types are simple types - // this can't be done when we compute types because - // not all TypeInfos are available yet - for (TypeRefImpl ref : types) { - if(!ref.getTarget().isSimpleType()) { - parent.builder.reportError(new IllegalAnnotationException( - Messages.XMLLIST_NEEDS_SIMPLETYPE.format( - nav().getTypeName(ref.getTarget().getType())), this )); - break; - } - } - } - - if(!isCollection()) - parent.builder.reportError(new IllegalAnnotationException( - Messages.XMLLIST_ON_SINGLE_PROPERTY.format(), this - )); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/EnumConstantImpl.java 2018-01-30 20:32:09.000000000 -0500 +++ /dev/null 2018-01-30 20:32:09.000000000 -0500 @@ -1,62 +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.xml.internal.bind.v2.model.impl; - -import com.sun.xml.internal.bind.v2.model.core.EnumConstant; -import com.sun.xml.internal.bind.v2.model.core.EnumLeafInfo; - -/** - * @author Kohsuke Kawaguchi - */ -class EnumConstantImpl implements EnumConstant { - protected final String lexical; - protected final EnumLeafInfoImpl owner; - protected final String name; - - /** - * All the constants of the {@link EnumConstantImpl} is linked in one list. - */ - protected final EnumConstantImpl next; - - public EnumConstantImpl(EnumLeafInfoImpl owner, String name, String lexical, EnumConstantImpl next) { - this.lexical = lexical; - this.owner = owner; - this.name = name; - this.next = next; - } - - public EnumLeafInfo getEnclosingClass() { - return owner; - } - - public final String getLexicalValue() { - return lexical; - } - - public final String getName() { - return name; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/EnumLeafInfoImpl.java 2018-01-30 20:32:09.000000000 -0500 +++ /dev/null 2018-01-30 20:32:09.000000000 -0500 @@ -1,260 +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.xml.internal.bind.v2.model.impl; - -import java.util.Iterator; - -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.EnumConstant; -import com.sun.xml.internal.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.Element; -import com.sun.xml.internal.bind.v2.model.core.ClassInfo; -import com.sun.xml.internal.bind.v2.runtime.Location; -import java.util.Collection; -import javax.xml.bind.annotation.XmlSchemaType; - -/** - * {@link EnumLeafInfo} implementation. - * - * @author Kohsuke Kawaguchi - */ -class EnumLeafInfoImpl extends TypeInfoImpl - implements EnumLeafInfo, Element, Iterable> { - - /** - * The enum class whose information this object represents. - */ - /*package*/ final C clazz; - - NonElement baseType; - - private final T type; - - /** - * Can be null for anonymous types. - */ - private final QName typeName; - - /** - * All the {@link EnumConstantImpl}s are linked in this list. - */ - private EnumConstantImpl firstConstant; - - /** - * If this enum is also bound to an element, that tag name. - * Or else null. - */ - private QName elementName; - - /** - * Used to recognize token vs string. - */ - protected boolean tokenStringType; - - /** - * @param clazz - * @param type - * clazz and type should both point to the enum class - * that this {@link EnumLeafInfo} represents. - * Because of the type parameterization we have to take them separately. - */ - public EnumLeafInfoImpl(ModelBuilder builder, - Locatable upstream, C clazz, T type ) { - super(builder,upstream); - this.clazz = clazz; - this.type = type; - - elementName = parseElementName(clazz); - - // compute the type name - // TODO: I guess it must be allowed for enums to have @XmlElement - typeName = parseTypeName(clazz); - - // locate the base type. - // this can be done eagerly because there shouldn't be no cycle. - XmlEnum xe = builder.reader.getClassAnnotation(XmlEnum.class, clazz, this); - if(xe!=null) { - T base = builder.reader.getClassValue(xe, "value"); - baseType = builder.getTypeInfo(base,this); - } else { - baseType = builder.getTypeInfo(builder.nav.ref(String.class),this); - } - } - - /** - * Build {@link EnumConstant}s and discover/report any error in it. - */ - protected void calcConstants() { - EnumConstantImpl last = null; - - // first check if we represent xs:token derived type - Collection fields = nav().getDeclaredFields(clazz); - for (F f : fields) { - if (nav().isSameType(nav().getFieldType(f), nav().ref(String.class))) { - XmlSchemaType schemaTypeAnnotation = builder.reader.getFieldAnnotation(XmlSchemaType.class, f, this); - if (schemaTypeAnnotation != null) { - if ("token".equals(schemaTypeAnnotation.name())) { - tokenStringType = true; - break; - } - }; - } - } - F[] constants = nav().getEnumConstants(clazz); - for( int i=constants.length-1; i>=0; i-- ) { - F constant = constants[i]; - String name = nav().getFieldName(constant); - XmlEnumValue xev = builder.reader.getFieldAnnotation(XmlEnumValue.class, constant, this); - - String literal; - if(xev==null) literal = name; - else literal = xev.value(); - - last = createEnumConstant(name,literal,constant,last); - } - this.firstConstant = last; - } - - protected EnumConstantImpl createEnumConstant(String name, String literal, F constant, EnumConstantImpl last) { - return new EnumConstantImpl(this, name, literal, last); - } - - - public T getType() { - return type; - } - - /** - * - * @return true if enum is restriction/extension from xs:token type, otherwise false - */ - public boolean isToken() { - return tokenStringType; - } - - /** - * Leaf-type cannot be referenced from IDREF. - * - * @deprecated - * why are you calling a method whose return value is always known? - */ - public final boolean canBeReferencedByIDREF() { - return false; - } - - public QName getTypeName() { - return typeName; - } - - public C getClazz() { - return clazz; - } - - public NonElement getBaseType() { - return baseType; - } - - public boolean isSimpleType() { - return true; - } - - public Location getLocation() { - return nav().getClassLocation(clazz); - } - - public Iterable> getConstants() { - if(firstConstant==null) - calcConstants(); - return this; - } - - @Override - public void link() { - // make sure we've computed constants - getConstants(); - super.link(); - } - - /** - * No substitution. - * - * @deprecated if you are invoking this method directly, there's something wrong. - */ - public Element getSubstitutionHead() { - return null; - } - - public QName getElementName() { - return elementName; - } - - public boolean isElement() { - return elementName!=null; - } - - public Element asElement() { - if(isElement()) - return this; - else - return null; - } - - /** - * When a bean binds to an element, it's always through {@link XmlRootElement}, - * so this method always return null. - * - * @deprecated - * you shouldn't be invoking this method on {@link ClassInfoImpl}. - */ - public ClassInfo getScope() { - return null; - } - - public Iterator> iterator() { - return new Iterator>() { - private EnumConstantImpl next = firstConstant; - public boolean hasNext() { - return next!=null; - } - - public EnumConstantImpl next() { - EnumConstantImpl r = next; - next = next.next; - return r; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - }; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/FieldPropertySeed.java 2018-01-30 20:32:10.000000000 -0500 +++ /dev/null 2018-01-30 20:32:10.000000000 -0500 @@ -1,76 +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.xml.internal.bind.v2.model.impl; - -import java.lang.annotation.Annotation; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * {@link PropertyInfo} implementation backed by a field. - */ -class FieldPropertySeed implements - PropertySeed { - - protected final FieldT field; - private ClassInfoImpl parent; - - FieldPropertySeed(ClassInfoImpl classInfo, FieldT field) { - this.parent = classInfo; - this.field = field; - } - - public A readAnnotation(Class a) { - return parent.reader().getFieldAnnotation(a, field,this); - } - - public boolean hasAnnotation(Class annotationType) { - return parent.reader().hasFieldAnnotation(annotationType,field); - } - - public String getName() { - // according to the spec team, the BeanIntrospector.decapitalize does not apply - // to the fields. Don't call Introspector.decapitalize - return parent.nav().getFieldName(field); - } - - public TypeT getRawType() { - return parent.nav().getFieldType(field); - } - - /** - * Use the enclosing class as the upsream {@link Location}. - */ - public Locatable getUpstream() { - return parent; - } - - public Location getLocation() { - return parent.nav().getFieldLocation(field); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/GetterSetterPropertySeed.java 2018-01-30 20:32:11.000000000 -0500 +++ /dev/null 2018-01-30 20:32:11.000000000 -0500 @@ -1,107 +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.xml.internal.bind.v2.model.impl; - -import java.lang.annotation.Annotation; -import java.beans.Introspector; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * {@link PropertyInfo} implementation backed by a getter and a setter. - * - * We allow the getter or setter to be null, in which case the bean - * can only participate in unmarshalling (or marshalling) - */ -class GetterSetterPropertySeed implements - PropertySeed { - - protected final MethodT getter; - protected final MethodT setter; - private ClassInfoImpl parent; - - GetterSetterPropertySeed(ClassInfoImpl parent, MethodT getter, MethodT setter) { - this.parent = parent; - this.getter = getter; - this.setter = setter; - - if(getter==null && setter==null) - throw new IllegalArgumentException(); - } - - public TypeT getRawType() { - if(getter!=null) - return parent.nav().getReturnType(getter); - else - return parent.nav().getMethodParameters(setter)[0]; - } - - public A readAnnotation(Class annotation) { - return parent.reader().getMethodAnnotation(annotation, getter,setter,this); - } - - public boolean hasAnnotation(Class annotationType) { - return parent.reader().hasMethodAnnotation(annotationType,getName(),getter,setter,this); - } - - public String getName() { - if(getter!=null) - return getName(getter); - else - return getName(setter); - } - - private String getName(MethodT m) { - String seed = parent.nav().getMethodName(m); - String lseed = seed.toLowerCase(); - if(lseed.startsWith("get") || lseed.startsWith("set")) - return camelize(seed.substring(3)); - if(lseed.startsWith("is")) - return camelize(seed.substring(2)); - return seed; - } - - - private static String camelize(String s) { - return Introspector.decapitalize(s); - } - - /** - * Use the enclosing class as the upsream {@link Location}. - */ - public Locatable getUpstream() { - return parent; - } - - public Location getLocation() { - if(getter!=null) - return parent.nav().getMethodLocation(getter); - else - return parent.nav().getMethodLocation(setter); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/LeafInfoImpl.java 2018-01-30 20:32:11.000000000 -0500 +++ /dev/null 2018-01-30 20:32:12.000000000 -0500 @@ -1,91 +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.xml.internal.bind.v2.model.impl; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.LeafInfo; -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * @author Kohsuke Kawaguchi - */ -abstract class LeafInfoImpl implements LeafInfo, Location { - private final TypeT type; - /** - * Can be null for anonymous types. - */ - private final QName typeName; - - protected LeafInfoImpl(TypeT type,QName typeName) { - assert type!=null; - - this.type = type; - this.typeName = typeName; - } - - /** - * A reference to the representation of the type. - */ - public TypeT getType() { - return type; - } - - /** - * Leaf-type cannot be referenced from IDREF. - * - * @deprecated - * why are you calling a method whose return value is always known? - */ - public final boolean canBeReferencedByIDREF() { - return false; - } - - public QName getTypeName() { - return typeName; - } - - public Locatable getUpstream() { - return null; - } - - public Location getLocation() { - // this isn't very accurate, but it's not too bad - // doing it correctly need leaves to hold navigator. - // otherwise revisit the design so that we take navigator as a parameter - return this; - } - - public boolean isSimpleType() { - return true; - } - - public String toString() { - return type.toString(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/MapPropertyInfoImpl.java 2018-01-30 20:32:12.000000000 -0500 +++ /dev/null 2018-01-30 20:32:12.000000000 -0500 @@ -1,106 +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.xml.internal.bind.v2.model.impl; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Map; - -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; - -/** - * @author Kohsuke Kawaguchi - */ -class MapPropertyInfoImpl extends PropertyInfoImpl implements MapPropertyInfo { - - private final QName xmlName; - private boolean nil; - private final T keyType; - private final T valueType; - - // laziy computed to handle cyclic references - private NonElement keyTypeInfo; - private NonElement valueTypeInfo; - - - public MapPropertyInfoImpl(ClassInfoImpl ci, PropertySeed seed) { - super(ci, seed); - - XmlElementWrapper xe = seed.readAnnotation(XmlElementWrapper.class); - xmlName = calcXmlName(xe); - nil = xe!=null && xe.nillable(); - - T raw = getRawType(); - T bt = nav().getBaseClass(raw, nav().asDecl(Map.class) ); - assert bt!=null; // Map property is only for Maps - - if(nav().isParameterizedType(bt)) { - keyType = nav().getTypeArgument(bt,0); - valueType = nav().getTypeArgument(bt,1); - } else { - keyType = valueType = nav().ref(Object.class); - } - } - - public Collection> ref() { - return Arrays.asList(getKeyType(),getValueType()); - } - - public final PropertyKind kind() { - return PropertyKind.MAP; - } - - public QName getXmlName() { - return xmlName; - } - - public boolean isCollectionNillable() { - return nil; - } - - public NonElement getKeyType() { - if(keyTypeInfo==null) - keyTypeInfo = getTarget(keyType); - return keyTypeInfo; - } - - public NonElement getValueType() { - if(valueTypeInfo==null) - valueTypeInfo = getTarget(valueType); - return valueTypeInfo; - } - - public NonElement getTarget(T type) { - assert parent.builder!=null : "this method must be called during the build stage"; - return parent.builder.getTypeInfo(type,this); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages.java 2018-01-30 20:32:13.000000000 -0500 +++ /dev/null 2018-01-30 20:32:13.000000000 -0500 @@ -1,119 +0,0 @@ -/* - * 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.bind.v2.model.impl; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Message resources - */ -enum Messages { - // ClassInfoImpl - ID_MUST_BE_STRING, // 1 arg - - MUTUALLY_EXCLUSIVE_ANNOTATIONS, // 2 args - DUPLICATE_ANNOTATIONS, // 1 arg - NO_DEFAULT_CONSTRUCTOR, // 1 arg - CANT_HANDLE_INTERFACE, // 1 arg - CANT_HANDLE_INNER_CLASS, // 1 arg - ANNOTATION_ON_WRONG_METHOD, // 0 args - GETTER_SETTER_INCOMPATIBLE_TYPE, // 2 args - DUPLICATE_ENTRY_IN_PROP_ORDER, // 1 arg - DUPLICATE_PROPERTIES, // 1 arg - - XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD, // 1 arg - SCOPE_IS_NOT_COMPLEXTYPE, // 1 arg - CONFLICTING_XML_ELEMENT_MAPPING, // 2 args - - REFERENCE_TO_NON_ELEMENT, // 1 arg - - NON_EXISTENT_ELEMENT_MAPPING, // 2 args - - TWO_ATTRIBUTE_WILDCARDS, // 1 arg - SUPER_CLASS_HAS_WILDCARD, // 0 args - INVALID_ATTRIBUTE_WILDCARD_TYPE, // 1 arg - PROPERTY_MISSING_FROM_ORDER, // 1 arg - PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY, // 2 args - - INVALID_XML_ENUM_VALUE, // 2 arg - NO_IMAGE_WRITER, // 1 arg - - ILLEGAL_MIME_TYPE, // 2 args - ILLEGAL_ANNOTATION, // 1 arg - - MULTIPLE_VALUE_PROPERTY, // 0 args - ELEMENT_AND_VALUE_PROPERTY, // 0 args - CONFLICTING_XML_TYPE_MAPPING, // 1 arg - XMLVALUE_IN_DERIVED_TYPE, // 0 args - SIMPLE_TYPE_IS_REQUIRED, // 1 arg - PROPERTY_COLLISION, // 1 arg - INVALID_IDREF, // 1 arg - INVALID_XML_ELEMENT_REF, // 1 arg - NO_XML_ELEMENT_DECL, // 2 args - XML_ELEMENT_WRAPPER_ON_NON_COLLECTION, // 1 arg - - ANNOTATION_NOT_ALLOWED, // 1 arg - XMLLIST_NEEDS_SIMPLETYPE, // 1 arg - XMLLIST_ON_SINGLE_PROPERTY, // 0 arg - NO_FACTORY_METHOD, // 2 args - FACTORY_CLASS_NEEDS_FACTORY_METHOD, // 1 arg - - INCOMPATIBLE_API_VERSION, // 2 args - INCOMPATIBLE_API_VERSION_MUSTANG, // 2 args - RUNNING_WITH_1_0_RUNTIME, // 2 args - - MISSING_JAXB_PROPERTIES, // 1arg - TRANSIENT_FIELD_NOT_BINDABLE, // 1 arg - THERE_MUST_BE_VALUE_IN_XMLVALUE, // 1 arg - UNMATCHABLE_ADAPTER, // 2 args - ANONYMOUS_ARRAY_ITEM, // 1 arg - - ACCESSORFACTORY_INSTANTIATION_EXCEPTION, // 2 arg - ACCESSORFACTORY_ACCESS_EXCEPTION, // 2 arg - CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR, // 2 arg - CUSTOM_ACCESSORFACTORY_FIELD_ERROR, // 2 arg - XMLGREGORIANCALENDAR_INVALID, // 1 arg - XMLGREGORIANCALENDAR_SEC, // 0 arg - XMLGREGORIANCALENDAR_MIN, // 0 arg - XMLGREGORIANCALENDAR_HR, // 0 arg - XMLGREGORIANCALENDAR_DAY, // 0 arg - XMLGREGORIANCALENDAR_MONTH, // 0 arg - XMLGREGORIANCALENDAR_YEAR, // 0 arg - XMLGREGORIANCALENDAR_TIMEZONE, // 0 arg - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - @Override - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages.properties 2018-01-30 20:32:14.000000000 -0500 +++ /dev/null 2018-01-30 20:32:14.000000000 -0500 @@ -1,213 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = \ - Property "{0}" has an XmlID annotation but its type is not String. - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = \ - {0} has mutually exclusive annotations @{1} and @{2} - -DUPLICATE_ANNOTATIONS = \ - @{0} annotation is found on two places; one would be suffice. - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = \ - {0} does not have a no-arg default constructor. - -CANT_HANDLE_INTERFACE = \ - {0} is an interface, and JAXB can''t handle interfaces. - -CANT_HANDLE_INNER_CLASS = \ - {0} is a non-static inner class, and JAXB can''t handle those. - -ANNOTATION_ON_WRONG_METHOD = \ - JAXB annotation is placed on a method that is not a JAXB property - -GETTER_SETTER_INCOMPATIBLE_TYPE = \ - The type of the getter is {0} but that of the setter is {1}. They have to be the same. - -DUPLICATE_ENTRY_IN_PROP_ORDER = \ - Property "{0}" appears more than once in the @XmlType.propOrder - -DUPLICATE_PROPERTIES = \ - There are two properties named "{0}" - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = \ - The {0} method has @XmlElementMapping on it, but it doesn''t return a sub-type of JAXBElement. - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = \ - {0} is not bound to a complex type, and therefore illegal as the scope. - -CONFLICTING_XML_ELEMENT_MAPPING = \ - The element name '{'{0}'}'{1} has more than one mapping. - -REFERENCE_TO_NON_ELEMENT = \ - Property {0} is annotated with @XmlReference but doesn''t refer to an element. - -NON_EXISTENT_ELEMENT_MAPPING = \ - No element mapping exists for "{0}":"{1}" - -TWO_ATTRIBUTE_WILDCARDS = \ - {0} has two properties with the @XmlAnyAttribute annotation. - -SUPER_CLASS_HAS_WILDCARD = \ - Can''t have @XmlAnyAttribute when a base class has it already. - -INVALID_ATTRIBUTE_WILDCARD_TYPE = \ - @XmlAnyAttribute is placed on a property whose type is {0} but it needs to be assignable to java.util.Map. - -PROPERTY_MISSING_FROM_ORDER = \ - Property {0} is present but not specified in @XmlType.propOrder - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = \ - Property {0} appears in @XmlType.propOrder, but no such property exists. Maybe you meant {1}? - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = \ - "{0}" is not a valid value for {1}. - -NO_IMAGE_WRITER = \ - No javax.imageio.ImageWriter is available for the specified MIME type "{0}" - -ILLEGAL_MIME_TYPE = \ - "{0}" is not a valid MIME type: {1} - -ILLEGAL_ANNOTATION = \ - {0} annotation cannot be placed here - -MULTIPLE_VALUE_PROPERTY = \ - @XmlValue is only allowed one per class, but two properties are annotated with @XmlValue. - -XMLVALUE_IN_DERIVED_TYPE = \ - @XmlValue is not allowed on a class that derives another class. - -ELEMENT_AND_VALUE_PROPERTY = \ - If a class has @XmlElement property, it cannot have @XmlValue property. - -CONFLICTING_XML_TYPE_MAPPING = \ - Two classes have the same XML type name "{0}". Use @XmlType.name and @XmlType.namespace to \ - assign different names to them. - -SIMPLE_TYPE_IS_REQUIRED = \ - @XmlAttribute/@XmlValue need to reference a Java type that maps to text in XML. - -PROPERTY_COLLISION = \ - Class has two properties of the same name "{0}" - -INVALID_IDREF = \ - XmlIDREF property is referencing a type "{0}" that doesn''t have an XmlID property. - -INVALID_XML_ELEMENT_REF = \ - Invalid @XmlElementRef : Type "{0}" or any of it's subclasses are not known to this context. - -NO_XML_ELEMENT_DECL = \ - There''s no ObjectFactory with an @XmlElementDecl for the element '{'{0}'}'{1}. - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = \ - @XmlElementWrapper is only allowed on a collection property but "{0}" is not a collection property. - -ANNOTATION_NOT_ALLOWED = \ - {0} annotation is not allowed on this kind of property. - -XMLLIST_NEEDS_SIMPLETYPE = \ - {0} maps to a structured XML fragment (AKA complex type), and therefore incompatible with @XmlList. - -XMLLIST_ON_SINGLE_PROPERTY = \ - @XmlList cannot be placed on a single-value property - -NO_FACTORY_METHOD = \ - Factory class "{0}" does not have static zero args factory method "{1}". - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = \ - XmlType has not defined a factory method for Factory class "{0}". - -MISSING_JAXB_PROPERTIES = \ - Package "{0}" is missing jaxb.properties file. Have you copied this from the generated source directory or include it in the classpath? - -TRANSIENT_FIELD_NOT_BINDABLE = \ - Transient field "{0}" cannot have any JAXB annotations. - -THERE_MUST_BE_VALUE_IN_XMLVALUE = \ - Object must have some value in its @XmlValue field: {0} - -INCOMPATIBLE_API_VERSION = \ - JAXB 2.1 API jar is being loaded (from {0}), but this RI (from {1}) requires JAXB 2.2 API jar. - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = \ - JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from {1}) needs 2.2 API. \ - Use the endorsed directory mechanism to place jaxb-api.jar in the bootstrap classloader. \ - (See http://java.sun.com/j2se/1.6.0/docs/guide/standards/) - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = \ - You are trying to run JAXB 2.0 runtime (from {1}) but you have old JAXB 1.0 runtime earlier \ - in the classpath (at {0}) Please remove the JAXB 1.0 runtime for 2.0 runtime to work correctly. - -UNMATCHABLE_ADAPTER = \ - Adapter {0} is not applicable to the field type {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = \ - Unable to create instance of AccessorFactory, {0} for class {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = \ - Unable to access instance of AccessorFactory, {0} for class {1}. - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = \ - Custom AccessorFactory, {0}, is reporting an error accessing a property. {1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = \ - Custom AccessorFactory, {0}, is reporting an error accessing a field. {1} - -ANONYMOUS_ARRAY_ITEM = \ - {0} is used as an array component type, so it cannot be anonymous. - -XMLGREGORIANCALENDAR_INVALID = \ - Invalid set of fields set for XMLGregorianCalendar type {0}. - -XMLGREGORIANCALENDAR_SEC = \ - Seconds not set. - -XMLGREGORIANCALENDAR_MIN = \ - Minutes not set. - -XMLGREGORIANCALENDAR_HR = \ - Hour not set. - -XMLGREGORIANCALENDAR_DAY = \ - Day not set. - -XMLGREGORIANCALENDAR_MONTH = \ - Month not set. - -XMLGREGORIANCALENDAR_YEAR = \ - Year not set. - -XMLGREGORIANCALENDAR_TIMEZONE = \ - Timezone not set. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages_de.properties 2018-01-30 20:32:14.000000000 -0500 +++ /dev/null 2018-01-30 20:32:14.000000000 -0500 @@ -1,150 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = Eigenschaft "{0}" enth\u00E4lt eine XmlID-Annotation, der Typ ist jedoch nicht "String". - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = {0} enth\u00E4lt sich gegenseitig ausschlie\u00DFende Annotationen @{1} und @{2} - -DUPLICATE_ANNOTATIONS = @{0}-Annotation wird an zwei Stellen gefunden, eine Stelle w\u00FCrde ausreichen. - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = {0} enth\u00E4lt keinen "no-arg"-Standardkonstruktor. - -CANT_HANDLE_INTERFACE = {0} ist eine Schnittstelle, und JAXB kann keine Schnittstellen verarbeiten. - -CANT_HANDLE_INNER_CLASS = {0} ist eine nicht-statische innere Klasse, und JAXB kann diese nicht verarbeiten. - -ANNOTATION_ON_WRONG_METHOD = JAXB-Annotation wurde auf eine Methode gesetzt, die keine JAXB-Eigenschaft ist - -GETTER_SETTER_INCOMPATIBLE_TYPE = Der Getter-Typ ist {0}, der Setter-Typ hingegen {1}. Sie m\u00FCssen identisch sein. - -DUPLICATE_ENTRY_IN_PROP_ORDER = Eigenschaft "{0}" ist mehr als einmal in @XmlType.propOrder enthalten - -DUPLICATE_PROPERTIES = Es sind zwei Eigenschaften namens "{0}" vorhanden - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = Die {0}-Methode enth\u00E4lt @XmlElementMapping, gibt jedoch keinen Subtyp von JAXBElement zur\u00FCck. - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = {0} ist nicht an einen komplexen Typ gebunden und somit als Geltungsbereich unzul\u00E4ssig. - -CONFLICTING_XML_ELEMENT_MAPPING = Der Elementname ''{''{0}''}''{1} enth\u00E4lt mehr als eine Zuordnung. - -REFERENCE_TO_NON_ELEMENT = Eigenschaft {0} ist mit @XmlReference-Annotation versehen, referenziert jedoch kein Element. - -NON_EXISTENT_ELEMENT_MAPPING = Es ist keine Elementzuordnung f\u00FCr "{0}" vorhanden:"{1}" - -TWO_ATTRIBUTE_WILDCARDS = {0} enth\u00E4lt zwei Eigenschaften mit der @XmlAnyAttribute-Annotation. - -SUPER_CLASS_HAS_WILDCARD = @XmlAnyAttribute ist nicht zul\u00E4ssig, wenn es bereits in einer Basisklasse vorhanden ist. - -INVALID_ATTRIBUTE_WILDCARD_TYPE = @XmlAnyAttribute ist auf eine Eigenschaft gesetzt, deren Typ {0} ist, muss jedoch java.util.Map zugeordnet werden k\u00F6nnen. - -PROPERTY_MISSING_FROM_ORDER = Eigenschaft {0} ist vorhanden, jedoch in @XmlType.propOrder nicht angegeben - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = Eigenschaft {0} ist in @XmlType.propOrder enthalten, eine derartige Eigenschaft ist jedoch nicht vorhanden. Haben Sie {1} gemeint? - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = "{0}" ist kein g\u00FCltiger Wert f\u00FCr {1}. - -NO_IMAGE_WRITER = Es ist kein javax.imageio.ImageWriter f\u00FCr den angegebenen MIME-Typ "{0}" verf\u00FCgbar - -ILLEGAL_MIME_TYPE = "{0}" ist kein g\u00FCltiger MIME-Typ: {1} - -ILLEGAL_ANNOTATION = {0}-Annotation darf nicht hier stehen - -MULTIPLE_VALUE_PROPERTY = Es ist nur ein @XmlValue pro Klasse zul\u00E4ssig, zwei Eigenschaften enthalten jedoch die Annotation @XmlValue. - -XMLVALUE_IN_DERIVED_TYPE = @XmlValue ist bei einer Klasse nicht zul\u00E4ssig, die eine andere Klasse ableitet. - -ELEMENT_AND_VALUE_PROPERTY = Wenn eine Klasse die Eigenschaft @XmlElement enth\u00E4lt, kann sie die Eigenschaft @XmlValue nicht enthalten. - -CONFLICTING_XML_TYPE_MAPPING = Zwei Klassen haben denselben XML-Typnamen"{0}". Verwenden Sie @XmlType.name und @XmlType.namespace, um ihnen unterschiedliche Namen zuzuweisen. - -SIMPLE_TYPE_IS_REQUIRED = @XmlAttribute/@XmlValue muss einen Java-Typ referenzieren, der Text in XML zugeordnet ist. - -PROPERTY_COLLISION = Klasse enth\u00E4lt zwei Eigenschaften mit demselben Namen "{0}" - -INVALID_IDREF = XmlIDREF-Eigenschaft referenziert einen Typ "{0}", der keine XmlID-Eigenschaft enth\u00E4lt. - -INVALID_XML_ELEMENT_REF = Ung\u00FCltige @XmlElementRef: Typ "{0}" oder eine seiner Unterklassen sind in diesem Kontext nicht bekannt. - -NO_XML_ELEMENT_DECL = Es ist keine ObjectFactory mit @XmlElementDecl f\u00FCr das Element ''{''{0}''}''{1} vorhanden. - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = @XmlElementWrapper ist nur bei einer Collection-Eigenschaft zul\u00E4ssig, "{0}" ist jedoch keine Collection-Eigenschaft. - -ANNOTATION_NOT_ALLOWED = {0}-Annotation ist bei dieser Art von Eigenschaft nicht zul\u00E4ssig. - -XMLLIST_NEEDS_SIMPLETYPE = {0} ist einem strukturierten XML-Fragment (d.h. einem komplexen Typ) zugeordnet und deshalb nicht mit @XmlList kompatibel. - -XMLLIST_ON_SINGLE_PROPERTY = @XmlList kann nicht auf eine Einzelwerteigenschaft gesetzt werden - -NO_FACTORY_METHOD = Factory-Klasse "{0}" hat keine statische "zero-arguments" Factory-Methode "{1}". - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = XmlType hat keine Factory-Methode f\u00FCr Factory-Klasse "{0}" definiert. - -MISSING_JAXB_PROPERTIES = In Package "{0}" fehlt die jaxb.properties-Datei. Haben Sie diese aus dem generierten Quellverzeichnis kopiert oder im Classpath aufgenommen? - -TRANSIENT_FIELD_NOT_BINDABLE = Transientes Feld "{0}" darf keine JAXB-Annotationen enthalten. - -THERE_MUST_BE_VALUE_IN_XMLVALUE = Objekt muss einen Wert im @XmlValue-Feld enthalten: {0} - -INCOMPATIBLE_API_VERSION = JAXB 2.1 API-JAR wird geladen (aus {0}), diese RI (aus {1}) erfordert jedoch JAXB 2.2 API-JAR. - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = JAXB 2.1-API wird aus dem Bootstrap Classloader geladen, diese RI (aus {1}) erfordert jedoch 2.2-API. Verwenden Sie das "Endorsed"-Verzeichnisverfahren, um jaxb-api.jar in den Bootstrap Classloader zu setzen. (Siehe http://java.sun.com/j2se/1.6.0/docs/guide/standards/) - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = Sie versuchen, JAXB 2.0 Runtime (aus {1}) auszuf\u00FChren, es ist jedoch an fr\u00FCherer Stelle im Classpath ein altes JAXB 1.0 Runtime (bei {0}) vorhanden. Entfernen Sie JAXB 1.0 Runtime, damit 2.0 Runtime ordnungsgem\u00E4\u00DF ausgef\u00FChrt werden kann. - -UNMATCHABLE_ADAPTER = Adapter {0} ist f\u00FCr den Feldtyp {1} nicht anwendbar. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = Instanz von AccessorFactory {0} f\u00FCr Klasse {1} kann nicht erstellt werden. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = Auf Instanz von AccessorFactory, {0}, f\u00FCr Klasse {1} kann nicht zugegriffen werden. - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = Benutzerdefinierte AccessorFactory, {0}, meldet einen Fehler beim Zugriff auf eine Eigenschaft. {1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = Benutzerdefinierte AccessorFactory, {0}, meldet einen Fehler beim Zugriff auf ein Feld. {1} - -ANONYMOUS_ARRAY_ITEM = {0} wird als Array-Komponententyp verwendet, kann also nicht anonym sein. - -XMLGREGORIANCALENDAR_INVALID = Ung\u00FCltige Gruppe von Feldern f\u00FCr XMLGregorianCalendar-Typ {0} festgelegt. - -XMLGREGORIANCALENDAR_SEC = Sekunden nicht festgelegt. - -XMLGREGORIANCALENDAR_MIN = Minuten nicht festgelegt. - -XMLGREGORIANCALENDAR_HR = Stunde nicht festgelegt. - -XMLGREGORIANCALENDAR_DAY = Tag nicht festgelegt. - -XMLGREGORIANCALENDAR_MONTH = Monat nicht festgelegt. - -XMLGREGORIANCALENDAR_YEAR = Jahr nicht festgelegt. - -XMLGREGORIANCALENDAR_TIMEZONE = Zeitzone nicht festgelegt. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages_es.properties 2018-01-30 20:32:15.000000000 -0500 +++ /dev/null 2018-01-30 20:32:15.000000000 -0500 @@ -1,150 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = La propiedad "{0}" tiene una anotaci\u00F3n XmlID, pero no es del tipo Cadena. - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = {0} posee las anotaciones que se excluyen mutuamente @{1} y @{2} - -DUPLICATE_ANNOTATIONS = La anotaci\u00F3n @{0} se encuentra en dos lugares. Uno deber\u00EDa ser suficiente. - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = {0} no tiene un constructor por defecto sin argumentos. - -CANT_HANDLE_INTERFACE = {0} es una interfaz y JAXB no puede manejar interfaces. - -CANT_HANDLE_INNER_CLASS = {0} es una clase interna no est\u00E1tica y JAXB no las puede manejar. - -ANNOTATION_ON_WRONG_METHOD = La anotaci\u00F3n JAXB est\u00E1 colocada en un m\u00E9todo que no es una propiedad de JAXB - -GETTER_SETTER_INCOMPATIBLE_TYPE = El tipo de getter es {0}, pero el de setter es {1}. Tienen que ser del mismo tipo. - -DUPLICATE_ENTRY_IN_PROP_ORDER = La propiedad "{0}" aparece m\u00E1s de una vez en @XmlType.propOrder - -DUPLICATE_PROPERTIES = Hay dos propiedades con el nombre "{0}" - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = El m\u00E9todo {0} incluye @XmlElementMapping, pero no devuelve un subtipo del elemento JAXB. - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = {0} no est\u00E1 enlazado a un tipo complejo y, por lo tanto, no es v\u00E1lido, al igual que el \u00E1mbito. - -CONFLICTING_XML_ELEMENT_MAPPING = El nombre del elemento ''{''{0}''}''{1} tiene m\u00E1s de una asignaci\u00F3n. - -REFERENCE_TO_NON_ELEMENT = La propiedad {0} est\u00E1 anotada con @XmlReference, pero no hace referencia a un elemento. - -NON_EXISTENT_ELEMENT_MAPPING = No existe ninguna asignaci\u00F3n de elemento para "{0}":"{1}" - -TWO_ATTRIBUTE_WILDCARDS = {0} posee dos propiedades con la anotaci\u00F3n @XmlAnyAttribute. - -SUPER_CLASS_HAS_WILDCARD = No puede tener @XmlAnyAttribute cuando una clase base ya lo tiene. - -INVALID_ATTRIBUTE_WILDCARD_TYPE = @XmlAnyAttribute est\u00E1 colocado en una propiedad de tipo {0}, pero es necesario que se pueda asignar a java.util.Map. - -PROPERTY_MISSING_FROM_ORDER = La propiedad {0} existe, pero no est\u00E1 especificada en @XmlType.propOrder - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = La propiedad {0} aparece en @XmlType.propOrder, pero no existe. Quiz\u00E1 quiso decir {1}. - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = "{0}" no es un valor v\u00E1lido para {1}. - -NO_IMAGE_WRITER = No hay disponible ning\u00FAn javax.imageio.ImageWriter para el tipo MIME especificado "{0}" - -ILLEGAL_MIME_TYPE = "{0}" no es un tipo MIME v\u00E1lido: {1} - -ILLEGAL_ANNOTATION = La anotaci\u00F3n {0} no se puede colocar aqu\u00ED - -MULTIPLE_VALUE_PROPERTY = S\u00F3lo se permite un @XmlValue por clase, pero hay dos propiedades anotadas con @XmlValue. - -XMLVALUE_IN_DERIVED_TYPE = @XmlValue no est\u00E1 permitido en una clase que se deriva de otra clase. - -ELEMENT_AND_VALUE_PROPERTY = Si una clase tiene la propiedad @XmlElement, no puede tener la propiedad @XmlValue. - -CONFLICTING_XML_TYPE_MAPPING = Hay dos clases que tienen el mismo nombre de tipo XML "{0}". Utilice @XmlType.name y @XmlType.namespace para asignarles nombres diferentes. - -SIMPLE_TYPE_IS_REQUIRED = @XmlAttribute/@XmlValue tienen que hacer referencia a un tipo Java que se asigne a texto en XML. - -PROPERTY_COLLISION = La clase tiene dos propiedades con el mismo nombre "{0}" - -INVALID_IDREF = La propiedad XmlIDREF hace referencia a un tipo "{0}" que no tiene una propiedad XmlID. - -INVALID_XML_ELEMENT_REF = @XmlElementRef no v\u00E1lido: el tipo "{0}" o alguna de sus subclases son desconocidos en este contexto. - -NO_XML_ELEMENT_DECL = No hay ning\u00FAn ObjectFactory con @XmlElementDecl para el elemento ''{''{0}''}''{1}. - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = @XmlElementWrapper s\u00F3lo est\u00E1 permitido en una propiedad de recopilaci\u00F3n, pero "{0}" no es una propiedad de recopilaci\u00F3n. - -ANNOTATION_NOT_ALLOWED = La anotaci\u00F3n {0} no est\u00E1 permitida en este tipo de propiedad. - -XMLLIST_NEEDS_SIMPLETYPE = {0} se asigna a un fragmento XML estructurado (tambi\u00E9n conocido como tipo complejo) y, por lo tanto, es incompatible con @XmlList. - -XMLLIST_ON_SINGLE_PROPERTY = @XmlList no se puede colocar en una propiedad de un solo valor - -NO_FACTORY_METHOD = La clase de f\u00E1brica "{0}" no tiene un m\u00E9todo de f\u00E1brica sin argumentos est\u00E1tico "{1}". - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = XmlType no tiene definido un m\u00E9todo de f\u00E1brica para la clase de f\u00E1brica "{0}". - -MISSING_JAXB_PROPERTIES = Falta el archivo jaxb.properties en el paquete "{0}". \u00BFLo ha copiado del directorio de origen generado o lo ha incluido en la classpath? - -TRANSIENT_FIELD_NOT_BINDABLE = El campo transitorio "{0}" no puede tener ninguna anotaci\u00F3n de JAXB. - -THERE_MUST_BE_VALUE_IN_XMLVALUE = El objeto debe tener alg\u00FAn valor en el campo @XmlValue: {0} - -INCOMPATIBLE_API_VERSION = El archivo jar de la API de JAXB 2.1 se est\u00E1 cargando (desde {0}), pero esta implantaci\u00F3n de referencia (de {1}) necesita el archivo jar de la API de JAXB 2.2. - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = La API de JAXB 2.1 se est\u00E1 cargando desde el classloader de inicializaci\u00F3n de datos, pero esta implantaci\u00F3n de referencia (de {1}) necesita la API de la versi\u00F3n 2.2. Utilice el mecanismo de directorio aprobado para colocar jaxb-api.jar en el classloader de inicializaci\u00F3n de datos. (Visite http://java.sun.com/j2se/1.6.0/docs/guide/standards/) - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = Est\u00E1 intentando ejecutar JAXB 2.0 en tiempo de ejecuci\u00F3n (desde {1}), pero tiene un JAXB 1.0 en tiempo de ejecuci\u00F3n antiguo en la classpath (en {0}). Elimine JAXB 1.0 en tiempo de ejecuci\u00F3n para que la versi\u00F3n 2.0 en tiempo de ejecuci\u00F3n funcione correctamente. - -UNMATCHABLE_ADAPTER = El adaptador {0} no es aplicable al tipo de campo {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = No se ha podido crear la instancia de AccessorFactory, {0} para la clase {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = No se ha podido acceder a la instancia de AccessorFactory, {0} para la clase {1}. - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = El elemento AccessorFactory personalizado, {0}, est\u00E1 informando de un error al acceder a una propiedad. {1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = El elemento AccessorFactory personalizado, {0}, est\u00E1 informando de un error al acceder a un campo. {1} - -ANONYMOUS_ARRAY_ITEM = {0} se utiliza como un tipo de componente de matriz, por lo que no puede ser an\u00F3nimo. - -XMLGREGORIANCALENDAR_INVALID = Juego de campos no v\u00E1lido definido para el tipo XMLGregorianCalendar {0}. - -XMLGREGORIANCALENDAR_SEC = No se han definido los segundos. - -XMLGREGORIANCALENDAR_MIN = No se han definido los minutos. - -XMLGREGORIANCALENDAR_HR = No se ha definido la hora. - -XMLGREGORIANCALENDAR_DAY = No se ha definido el d\u00EDa. - -XMLGREGORIANCALENDAR_MONTH = No se ha definido el mes. - -XMLGREGORIANCALENDAR_YEAR = No se ha definido el a\u00F1o. - -XMLGREGORIANCALENDAR_TIMEZONE = No se ha definido la zona horaria. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages_fr.properties 2018-01-30 20:32:16.000000000 -0500 +++ /dev/null 2018-01-30 20:32:16.000000000 -0500 @@ -1,150 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = La propri\u00E9t\u00E9 "{0}" comporte une annotation XmlID qui n''est pas de type String. - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = {0} comporte des annotations @{1} et @{2} mutuellement exclusives - -DUPLICATE_ANNOTATIONS = L''annotation @{0} figure \u00E0 deux emplacements ; un seul est suffisant. - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = {0} ne comporte aucun constructeur sans argument par d\u00E9faut. - -CANT_HANDLE_INTERFACE = {0} est une interface et JAXB ne peut pas g\u00E9rer les interfaces. - -CANT_HANDLE_INNER_CLASS = {0} est une classe interne non statique et JAXB ne peut pas g\u00E9rer ce type de classe. - -ANNOTATION_ON_WRONG_METHOD = L'annotation JAXB figure sur une m\u00E9thode qui n'est pas une propri\u00E9t\u00E9 JAXB - -GETTER_SETTER_INCOMPATIBLE_TYPE = Le type de m\u00E9thode get est {0} mais celui de la m\u00E9thode set est {1}. Ils doivent \u00EAtre identiques. - -DUPLICATE_ENTRY_IN_PROP_ORDER = La propri\u00E9t\u00E9 "{0}" appara\u00EEt plusieurs fois dans l''annotation @XmlType.propOrder - -DUPLICATE_PROPERTIES = Il existe deux propri\u00E9t\u00E9s nomm\u00E9es "{0}" - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = L''annotation @XmlElementMapping figure sur la m\u00E9thode {0}, mais elle ne renvoie aucun sous-type de JAXBElement. - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = {0} n''est pas li\u00E9 \u00E0 un type complexe et est donc interdit en tant que port\u00E9e. - -CONFLICTING_XML_ELEMENT_MAPPING = Le nom d''\u00E9l\u00E9ment ''{''{0}''}''{1} comporte plusieurs mappings. - -REFERENCE_TO_NON_ELEMENT = La propri\u00E9t\u00E9 {0} est annot\u00E9e avec @XmlReference mais ne fait r\u00E9f\u00E9rence \u00E0 aucun \u00E9l\u00E9ment. - -NON_EXISTENT_ELEMENT_MAPPING = Aucun mapping d''\u00E9l\u00E9ments n''existe pour "{0}":"{1}" - -TWO_ATTRIBUTE_WILDCARDS = {0} comporte deux propri\u00E9t\u00E9s avec l''annotation @XmlAnyAttribute. - -SUPER_CLASS_HAS_WILDCARD = L'annotation @XmlAnyAttribute n'est pas possible lorsqu'elle figure d\u00E9j\u00E0 sur une classe de base. - -INVALID_ATTRIBUTE_WILDCARD_TYPE = L''annotation @XmlAnyAttribute figure sur une propri\u00E9t\u00E9 dont le type est {0}, mais elle doit pouvoir \u00EAtre affect\u00E9e \u00E0 java.util.Map. - -PROPERTY_MISSING_FROM_ORDER = La propri\u00E9t\u00E9 {0} est pr\u00E9sente, mais n''est pas indiqu\u00E9e dans @XmlType.propOrder - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = La propri\u00E9t\u00E9 {0} appara\u00EEt dans @XmlType.propOrder, mais ce type de propri\u00E9t\u00E9 n''existe pas. Vous vouliez peut-\u00EAtre dire {1} ? - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = "{0}" n''est pas une valeur valide pour {1}. - -NO_IMAGE_WRITER = Aucune classe javax.imageio.ImageWriter n''est disponible pour le type MIME "{0}" indiqu\u00E9 - -ILLEGAL_MIME_TYPE = "{0}" n''est pas un type MIME valide : {1} - -ILLEGAL_ANNOTATION = L''annotation {0} ne peut pas \u00EAtre plac\u00E9e ici - -MULTIPLE_VALUE_PROPERTY = Une seule annotation @XmlValue est autoris\u00E9e par classe, mais deux propri\u00E9t\u00E9s sont annot\u00E9es avec @XmlValue. - -XMLVALUE_IN_DERIVED_TYPE = L'annotation @XmlValue n'est pas autoris\u00E9e sur une classe qui d\u00E9rive d'une autre classe. - -ELEMENT_AND_VALUE_PROPERTY = Si une classe comporte la propri\u00E9t\u00E9 @XmlElement, elle ne peut pas comporter la propri\u00E9t\u00E9 @XmlValue. - -CONFLICTING_XML_TYPE_MAPPING = Deux classes portent le m\u00EAme nom de type XML "{0}". Utilisez @XmlType.name et XmlType.namespace pour leur affecter des noms diff\u00E9rents. - -SIMPLE_TYPE_IS_REQUIRED = @XmlAttribute/@XmlValue doit r\u00E9f\u00E9rencer un type Java correspondant au texte du XML. - -PROPERTY_COLLISION = La classe comporte deux propri\u00E9t\u00E9s du m\u00EAme nom ("{0}") - -INVALID_IDREF = La propri\u00E9t\u00E9 XmlIDREF r\u00E9f\u00E9rence un type "{0}" qui ne comporte aucune propri\u00E9t\u00E9 XmlID. - -INVALID_XML_ELEMENT_REF = @XmlElementRef non valide : le type "{0}" ou ses sous-classes ne sont pas connus dans ce contexte. - -NO_XML_ELEMENT_DECL = Il n''existe aucune classe ObjectFactory comportant une annotation @XmlElementDecl pour l''\u00E9l\u00E9ment ''{''{0}''}''{1}. - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = @XmlElementWrapper est autoris\u00E9e uniquement sur une propri\u00E9t\u00E9 de collection, mais "{0}" n''est pas une propri\u00E9t\u00E9 de collection. - -ANNOTATION_NOT_ALLOWED = L''annotation {0} n''est pas autoris\u00E9e sur ce type de propri\u00E9t\u00E9. - -XMLLIST_NEEDS_SIMPLETYPE = {0} correspond \u00E0 un fragment XML structur\u00E9 (c''est-\u00E0-dire un type complexe), qui n''est donc pas compatible avec @XmlList. - -XMLLIST_ON_SINGLE_PROPERTY = @XmlList ne peut pas figurer sur une propri\u00E9t\u00E9 monovaleur - -NO_FACTORY_METHOD = La classe de fabrique "{0}" ne comporte aucune m\u00E9thode de fabrique sans argument statique "{1}". - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = XmlType n''a d\u00E9fini aucune m\u00E9thode de fabrique pour la classe Factory "{0}". - -MISSING_JAXB_PROPERTIES = Le fichier jaxb.properties est manquant dans le package "{0}". L''avez-vous copi\u00E9 \u00E0 partir du r\u00E9pertoire source g\u00E9n\u00E9r\u00E9 ou inclus dans le classpath ? - -TRANSIENT_FIELD_NOT_BINDABLE = Le champ non persistant "{0}" ne peut comporter aucune annotation JAXB. - -THERE_MUST_BE_VALUE_IN_XMLVALUE = Le champ @XmlValue de l''objet doit comporter une valeur : {0} - -INCOMPATIBLE_API_VERSION = Le fichier JAR de l''API JAXB 2.1 est en cours de chargement (\u00E0 partir de {0}), mais cette impl\u00E9mentation de r\u00E9f\u00E9rence (\u00E0 partir de {1}) exige le fichier JAR de l''API JAXB 2.2. - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = L''API JAXB 2.1 est en cours de chargement \u00E0 partir du chargeur de classe "boostrap", mais cette impl\u00E9mentation de r\u00E9f\u00E9rence (\u00E0 partir de {1}) n\u00E9cessite l''API 2.2. Utilisez le m\u00E9canisme de r\u00E9pertoire "endorsed" pour placer jaxb-api.jar dans le chargeur de classe "boostrap". (Voir http://java.sun.com/j2se/1.6.0/docs/guide/standards/) - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = Vous essayez d''ex\u00E9cuter le runtime JAXB 2.0 (\u00E0 partir de {1}) mais l''ancien runtime JAXB 1.0 figure avant dans le classpath (au niveau de {0}). Enlevez le runtime JAXB 1.0 pour que le runtime 2.0 fonctionne correctement. - -UNMATCHABLE_ADAPTER = L''adaptateur {0} n''est pas applicable au type de champ {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = Impossible de cr\u00E9er une instance d''AccessorFactory {0} pour la classe {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = Impossible d''acc\u00E9der \u00E0 l''instance d''AccessorFactory {0} pour la classe {1}. - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = L''instance AccessorFactory personnalis\u00E9e, {0}, signale une erreur lors de l''acc\u00E8s \u00E0 une propri\u00E9t\u00E9. {1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = L''instance AccessorFactory personnalis\u00E9e, {0}, signale une erreur lors de l''acc\u00E8s \u00E0 un champ. {1} - -ANONYMOUS_ARRAY_ITEM = {0} est utilis\u00E9 en tant que type de composant de tableau, il ne peut donc pas \u00EAtre anonyme. - -XMLGREGORIANCALENDAR_INVALID = Ensemble de champs non valide d\u00E9fini pour le type XMLGregorianCalendar {0}. - -XMLGREGORIANCALENDAR_SEC = Secondes non d\u00E9finies. - -XMLGREGORIANCALENDAR_MIN = Minutes non d\u00E9finies. - -XMLGREGORIANCALENDAR_HR = Heure non d\u00E9finie. - -XMLGREGORIANCALENDAR_DAY = Jour non d\u00E9fini. - -XMLGREGORIANCALENDAR_MONTH = Mois non d\u00E9fini. - -XMLGREGORIANCALENDAR_YEAR = Ann\u00E9e non d\u00E9finie. - -XMLGREGORIANCALENDAR_TIMEZONE = Fuseau horaire non d\u00E9fini. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages_it.properties 2018-01-30 20:32:16.000000000 -0500 +++ /dev/null 2018-01-30 20:32:16.000000000 -0500 @@ -1,150 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = La propriet\u00E0 "{0}" contiene un''annotazione XmlID ma non \u00E8 di tipo String. - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = {0} contiene le annotazioni @{1} e @{2} che si escludono a vicenda - -DUPLICATE_ANNOTATIONS = L''annotazione @{0} si trova in due posizioni. Una posizione \u00E8 sufficiente. - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = {0} non dispone di un costruttore senza argomenti predefinito. - -CANT_HANDLE_INTERFACE = {0} \u00E8 un''interfaccia e JAXB non pu\u00F2 gestire interfacce. - -CANT_HANDLE_INNER_CLASS = {0} \u00E8 una classe interna non statica e JAXB non pu\u00F2 gestire tali classi. - -ANNOTATION_ON_WRONG_METHOD = L'annotazione JAXB \u00E8 posizionata su un metodo che non \u00E8 una propriet\u00E0 JAXB - -GETTER_SETTER_INCOMPATIBLE_TYPE = Il tipo del getter \u00E8 {0} mentre quello del setter \u00E8 {1}. Devono essere uguali. - -DUPLICATE_ENTRY_IN_PROP_ORDER = La propriet\u00E0 "{0}" \u00E8 presente pi\u00F9 volte in @XmlType.propOrder - -DUPLICATE_PROPERTIES = Esistono due propriet\u00E0 denominate "{0}" - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = Sul metodo {0} \u00E8 presente @XmlElementMapping ma non restituisce un sottotipo di JAXBElement. - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = {0} non \u00E8 associato a un tipo complesso e pertanto non \u00E8 valido come l''ambito. - -CONFLICTING_XML_ELEMENT_MAPPING = Il nome dell''elemento ''{''{0}''}''{1} ha pi\u00F9 mapping. - -REFERENCE_TO_NON_ELEMENT = La propriet\u00E0 {0} \u00E8 annotata con @XmlReference ma non fa riferimento a un elemento. - -NON_EXISTENT_ELEMENT_MAPPING = Non esiste alcun mapping dell''elemento per "{0}":"{1}" - -TWO_ATTRIBUTE_WILDCARDS = {0} ha due propriet\u00E0 con l''annotazione @XmlAnyAttribute. - -SUPER_CLASS_HAS_WILDCARD = Impossibile avere @XmlAnyAttribute se \u00E8 gi\u00E0 presente in una classe di base. - -INVALID_ATTRIBUTE_WILDCARD_TYPE = @XmlAnyAttribute \u00E8 posizionato su una propriet\u00E0 il cui tipo \u00E8 {0} ma deve essere assegnabile a Java.util.Map. - -PROPERTY_MISSING_FROM_ORDER = La propriet\u00E0 {0} \u00E8 presente ma non specificata in @XmlType.propOrder - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = La propriet\u00E0 {0} viene visualizzata in @XmlType.propOrder ma \u00E8 inesistente. Si intendeva forse {1}? - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = "{0}" non \u00E8 un valore valido per {1}. - -NO_IMAGE_WRITER = Nessun javax.imageio.ImageWriter disponibile per il tipo MIME specificato "{0}" - -ILLEGAL_MIME_TYPE = "{0}" non \u00E8 un tipo MIME valido: {1} - -ILLEGAL_ANNOTATION = Impossibile posizionare qui l''annotazione {0} - -MULTIPLE_VALUE_PROPERTY = \u00C8 consentito un solo @XmlValue per classe ma due propriet\u00E0 sono annotate con @XmlValue. - -XMLVALUE_IN_DERIVED_TYPE = @XmlValue non \u00E8 consentito su una classe derivante da un'altra classe. - -ELEMENT_AND_VALUE_PROPERTY = Se una classe ha la propriet\u00E0 @XmlElement non pu\u00F2 avere la propriet\u00E0 @XmlValue. - -CONFLICTING_XML_TYPE_MAPPING = Due classi hanno lo stesso nome del tipo XML "{0}". Usare @XmlType.name e @XmlType.namespace per assegnare loro nomi diversi. - -SIMPLE_TYPE_IS_REQUIRED = \u00C8 necessario che @XmlAttribute/@XmlValue faccia riferimento a un tipo Java mappato al testo in XML. - -PROPERTY_COLLISION = La classe ha due propriet\u00E0 dello stesso nome "{0}" - -INVALID_IDREF = La propriet\u00E0 XmlIDREF fa riferimento a un tipo "{0}" che non ha una propriet\u00E0 XmlID. - -INVALID_XML_ELEMENT_REF = @XmlElementRef non valido: il tipo "{0}" o una delle relative classi secondarie sono sconosciuti a questo contesto. - -NO_XML_ELEMENT_DECL = Non \u00E8 presente alcun ObjectFactory con un @XmlElementDecl per l''elemento ''{''{0}''}''{1}. - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = @XmlElementWrapper \u00E8 consentito solo su una propriet\u00E0 della raccolta ma "{0}" non \u00E8 una propriet\u00E0 della raccolta. - -ANNOTATION_NOT_ALLOWED = L''annotazione {0} non \u00E8 consentita su questo tipo di propriet\u00E0. - -XMLLIST_NEEDS_SIMPLETYPE = {0} \u00E8 mappato a un frammento XML strutturato (tipo complesso AKA) e pertanto \u00E8 incompatibile con @XmlList. - -XMLLIST_ON_SINGLE_PROPERTY = Impossibile posizionare @XmlList su una propriet\u00E0 a valore singolo - -NO_FACTORY_METHOD = La classe factory "{0}" non dispone del metodo factory ad argomenti zero statici "{1}". - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = XmlType non ha definito un metodo factory per la classe factory "{0}". - -MISSING_JAXB_PROPERTIES = File jaxb.properties mancante nel package "{0}". \u00C8 stato copiato dalla directory di origine generato o bisogna includerlo nel classpath? - -TRANSIENT_FIELD_NOT_BINDABLE = Il campo transitorio "{0}" non pu\u00F2 avere annotazioni JAXB. - -THERE_MUST_BE_VALUE_IN_XMLVALUE = L''oggetto deve avere un valore nel relativo campo @XmlValue: {0} - -INCOMPATIBLE_API_VERSION = \u00C8 in corso il caricamento del file jar API JAXB 2.1 (da {0}) ma questa RI (da {1}) richiede un file jar API JAXB 2.2. - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = \u00C8 in corso il caricamento dell''API JAXB 2.1 dal classloader di bootstrap ma questa RI (da {1}) richiede l''API 2.2. Usare il meccanismo della directory "endorsed" per posizionare jaxb-api.jar nel classloader di bootstrap (vedere http://java.sun.com/j2se/1.6.0/docs/guide/standards/). - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = Si sta tentando di eseguire il runtime JAXB 2.0 (da {1}) ma si dispone di un runtime JAXB 1.0 di versione precedente nel classpath (in {0}). Rimuovere il runtime JAXB 1.0 affinch\u00E9 il runtime 2.0 possa funzionare correttamente. - -UNMATCHABLE_ADAPTER = L''adattatore {0} non \u00E8 applicabile al tipo di campo {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = Impossibile creare l''istanza di AccessorFactory, {0} per la classe {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = Impossibile accedere all''istanza di AccessorFactory, {0} per la classe {1}. - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = AccessorFactory personalizzato, {0}, riporta un errore durante l''accesso a una propriet\u00E0. {1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = AccessorFactory personalizzato, {0}, riporta un errore durante l''accesso a un campo. {1} - -ANONYMOUS_ARRAY_ITEM = {0} viene usato come tipo di componente di array pertanto non pu\u00F2 essere anonimo. - -XMLGREGORIANCALENDAR_INVALID = Set di campi non valido impostato per il tipo XMLGregorianCalendar {0}. - -XMLGREGORIANCALENDAR_SEC = Secondi non impostati. - -XMLGREGORIANCALENDAR_MIN = Minuti non impostati. - -XMLGREGORIANCALENDAR_HR = Ora non impostata. - -XMLGREGORIANCALENDAR_DAY = Giorno non impostato. - -XMLGREGORIANCALENDAR_MONTH = Mese non impostato. - -XMLGREGORIANCALENDAR_YEAR = Anno non impostato. - -XMLGREGORIANCALENDAR_TIMEZONE = Fuso orario non impostato. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages_ja.properties 2018-01-30 20:32:17.000000000 -0500 +++ /dev/null 2018-01-30 20:32:17.000000000 -0500 @@ -1,150 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = \u30D7\u30ED\u30D1\u30C6\u30A3"{0}"\u306B\u306FXmlID\u6CE8\u91C8\u304C\u3042\u308A\u307E\u3059\u304C\u3001\u30BF\u30A4\u30D7\u304C\u6587\u5B57\u5217\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002 - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = {0}\u306B\u306F\u76F8\u4E92\u306B\u6392\u4ED6\u7684\u306A\u6CE8\u91C8@{1}\u304A\u3088\u3073@{2}\u304C\u3042\u308A\u307E\u3059 - -DUPLICATE_ANNOTATIONS = @{0}\u6CE8\u91C8\u304C2\u7B87\u6240\u3067\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u30021\u3064\u3067\u5341\u5206\u3067\u3059\u3002 - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = {0}\u306B\u306F\u5F15\u6570\u306A\u3057\u306E\u30C7\u30D5\u30A9\u30EB\u30C8\u30FB\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u304C\u3042\u308A\u307E\u305B\u3093\u3002 - -CANT_HANDLE_INTERFACE = {0}\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3067\u3059\u3002JAXB\u306F\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u3092\u51E6\u7406\u3067\u304D\u307E\u305B\u3093\u3002 - -CANT_HANDLE_INNER_CLASS = {0}\u306F\u9759\u7684\u3067\u306A\u3044\u5185\u90E8\u30AF\u30E9\u30B9\u3067\u3059\u3002JAXB\u306F\u305D\u308C\u3089\u3092\u51E6\u7406\u3067\u304D\u307E\u305B\u3093\u3002 - -ANNOTATION_ON_WRONG_METHOD = JAXB\u6CE8\u91C8\u306F\u3001JAXB\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u306F\u306A\u3044\u30E1\u30BD\u30C3\u30C9\u306B\u914D\u7F6E\u3055\u308C\u3066\u3044\u307E\u3059 - -GETTER_SETTER_INCOMPATIBLE_TYPE = getter\u306E\u30BF\u30A4\u30D7\u306F{0}\u3067\u3059\u304C\u3001setter\u306E\u30BF\u30A4\u30D7\u306F{1}\u3067\u3059\u3002\u540C\u3058\u30BF\u30A4\u30D7\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002 - -DUPLICATE_ENTRY_IN_PROP_ORDER = \u30D7\u30ED\u30D1\u30C6\u30A3"{0}"\u304C@XmlType.propOrder\u306B\u8907\u6570\u3042\u308A\u307E\u3059 - -DUPLICATE_PROPERTIES = "{0}"\u3068\u3044\u3046\u540D\u524D\u306E2\u3064\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u5B58\u5728\u3057\u307E\u3059 - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = {0}\u30E1\u30BD\u30C3\u30C9\u306B\u306F@XmlElementMapping\u304C\u3042\u308A\u307E\u3059\u304C\u3001JAXBElement\u306E\u30B5\u30D6\u30BF\u30A4\u30D7\u3092\u8FD4\u3057\u307E\u305B\u3093\u3002 - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = {0}\u306F\u8907\u5408\u578B\u306B\u30D0\u30A4\u30F3\u30C9\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u30B9\u30B3\u30FC\u30D7\u3068\u3057\u3066\u4E0D\u6B63\u3067\u3059\u3002 - -CONFLICTING_XML_ELEMENT_MAPPING = \u8981\u7D20\u540D''{''{0}''}''{1}\u306B\u8907\u6570\u306E\u30DE\u30C3\u30D4\u30F3\u30B0\u304C\u3042\u308A\u307E\u3059\u3002 - -REFERENCE_TO_NON_ELEMENT = \u30D7\u30ED\u30D1\u30C6\u30A3{0}\u306B\u306F@XmlReference\u306E\u6CE8\u91C8\u304C\u4ED8\u3044\u3066\u3044\u307E\u3059\u304C\u3001\u8981\u7D20\u3092\u53C2\u7167\u3057\u3066\u3044\u307E\u305B\u3093\u3002 - -NON_EXISTENT_ELEMENT_MAPPING = "{0}"\u306E\u8981\u7D20\u30DE\u30C3\u30D4\u30F3\u30B0\u304C\u5B58\u5728\u3057\u307E\u305B\u3093:"{1}" - -TWO_ATTRIBUTE_WILDCARDS = {0}\u306B@XmlAnyAttribute\u6CE8\u91C8\u3092\u6301\u30642\u3064\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308A\u307E\u3059\u3002 - -SUPER_CLASS_HAS_WILDCARD = @XmlAnyAttribute\u304C\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306B\u3059\u3067\u306B\u3042\u308B\u5834\u5408\u306F\u6307\u5B9A\u3067\u304D\u307E\u305B\u3093\u3002 - -INVALID_ATTRIBUTE_WILDCARD_TYPE = @XmlAnyAttribute\u306F\u30BF\u30A4\u30D7\u304C{0}\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u914D\u7F6E\u3055\u308C\u307E\u3059\u304C\u3001java.util.Map\u306B\u5272\u5F53\u53EF\u80FD\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002 - -PROPERTY_MISSING_FROM_ORDER = \u30D7\u30ED\u30D1\u30C6\u30A3{0}\u304C\u5B58\u5728\u3057\u307E\u3059\u304C\u3001@XmlType.propOrder\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093 - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = \u30D7\u30ED\u30D1\u30C6\u30A3{0}\u304C@XmlType.propOrder\u306B\u3042\u308A\u307E\u3059\u304C\u3001\u305D\u306E\u3088\u3046\u306A\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002{1}\u306E\u8AA4\u308A\u3067\u3042\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002 - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = "{0}"\u306F{1}\u306B\u5BFE\u3059\u308B\u6709\u52B9\u306A\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002 - -NO_IMAGE_WRITER = \u6307\u5B9A\u3057\u305FMIME \u30BF\u30A4\u30D7"{0}"\u306B\u4F7F\u7528\u3067\u304D\u308Bjavax.imageio.ImageWriter\u304C\u3042\u308A\u307E\u305B\u3093 - -ILLEGAL_MIME_TYPE = "{0}"\u306F\u6709\u52B9\u306AMIME\u30BF\u30A4\u30D7\u3067\u306F\u3042\u308A\u307E\u305B\u3093: {1} - -ILLEGAL_ANNOTATION = {0}\u6CE8\u91C8\u3092\u3053\u3053\u306B\u914D\u7F6E\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093 - -MULTIPLE_VALUE_PROPERTY = @XmlValue\u306F\u5404\u30AF\u30E9\u30B9\u306B1\u3064\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059\u304C\u30012\u3064\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u306B@XmlValue\u306E\u6CE8\u91C8\u304C\u4ED8\u3044\u3066\u3044\u307E\u3059\u3002 - -XMLVALUE_IN_DERIVED_TYPE = @XmlValue\u306F\u3001\u5225\u306E\u30AF\u30E9\u30B9\u3092\u5C0E\u51FA\u3059\u308B\u30AF\u30E9\u30B9\u3067\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002 - -ELEMENT_AND_VALUE_PROPERTY = \u30AF\u30E9\u30B9\u306B@XmlElement\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308B\u5834\u5408\u3001@XmlValue\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u6307\u5B9A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002 - -CONFLICTING_XML_TYPE_MAPPING = 2\u3064\u306E\u30AF\u30E9\u30B9\u306B\u540C\u3058XML\u30BF\u30A4\u30D7\u540D"{0}"\u304C\u4F7F\u7528\u3055\u308C\u3066\u3044\u307E\u3059\u3002@XmlType.name\u304A\u3088\u3073@XmlType.namespace\u3092\u4F7F\u7528\u3057\u3066\u3001\u5225\u306E\u540D\u524D\u3092\u5272\u308A\u5F53\u3066\u3066\u304F\u3060\u3055\u3044\u3002 - -SIMPLE_TYPE_IS_REQUIRED = @XmlAttribute/@XmlValue\u306F\u3001XML\u5185\u306E\u30C6\u30AD\u30B9\u30C8\u306B\u30DE\u30C3\u30D7\u3055\u308C\u308BJava\u30BF\u30A4\u30D7\u3092\u53C2\u7167\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002 - -PROPERTY_COLLISION = \u30AF\u30E9\u30B9\u306B\u540C\u3058\u540D\u524D"{0}"\u3092\u6301\u30642\u3064\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u3042\u308A\u307E\u3059 - -INVALID_IDREF = XmlIDREF\u30D7\u30ED\u30D1\u30C6\u30A3\u306F\u3001XmlID\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u306A\u3044\u30BF\u30A4\u30D7"{0}"\u3092\u53C2\u7167\u3057\u3066\u3044\u307E\u3059\u3002 - -INVALID_XML_ELEMENT_REF = @XmlElementRef\u304C\u7121\u52B9\u3067\u3059: \u30BF\u30A4\u30D7"{0}"\u307E\u305F\u306F\u305D\u306E\u30B5\u30D6\u30AF\u30E9\u30B9\u306F\u3053\u306E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u306F\u8A8D\u8B58\u3055\u308C\u307E\u305B\u3093\u3002 - -NO_XML_ELEMENT_DECL = \u8981\u7D20''{''{0}''}''{1}\u306E@XmlElementDecl\u3092\u6301\u3064ObjectFactory\u304C\u3042\u308A\u307E\u305B\u3093\u3002 - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = @XmlElementWrapper\u306F\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059\u304C\u3001"{0}"\u306F\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002 - -ANNOTATION_NOT_ALLOWED = {0}\u6CE8\u91C8\u306F\u3053\u306E\u7A2E\u985E\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002 - -XMLLIST_NEEDS_SIMPLETYPE = {0}\u306F\u69CB\u9020\u5316\u3055\u308C\u305FXML\u30D5\u30E9\u30B0\u30E1\u30F3\u30C8(\u8907\u5408\u578B)\u306B\u30DE\u30C3\u30D7\u3055\u308C\u308B\u305F\u3081\u3001@XmlList\u3068\u4E92\u63DB\u6027\u304C\u3042\u308A\u307E\u305B\u3093\u3002 - -XMLLIST_ON_SINGLE_PROPERTY = @XmlList\u3092\u3001\u5358\u4E00\u306E\u5024\u3092\u6301\u3064\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u914D\u7F6E\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093 - -NO_FACTORY_METHOD = \u30D5\u30A1\u30AF\u30C8\u30EA\u30FB\u30AF\u30E9\u30B9"{0}"\u306B\u5F15\u6570\u304C\u30BC\u30ED\u306E\u9759\u7684\u306A\u30D5\u30A1\u30AF\u30C8\u30EA\u30FB\u30E1\u30BD\u30C3\u30C9"{1}"\u304C\u3042\u308A\u307E\u305B\u3093\u3002 - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = XmlType\u3067\u306F\u30D5\u30A1\u30AF\u30C8\u30EA\u30FB\u30AF\u30E9\u30B9"{0}"\u306E\u30D5\u30A1\u30AF\u30C8\u30EA\u30FB\u30E1\u30BD\u30C3\u30C9\u304C\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 - -MISSING_JAXB_PROPERTIES = \u30D1\u30C3\u30B1\u30FC\u30B8"{0}"\u306Bjaxb.properties\u30D5\u30A1\u30A4\u30EB\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u3053\u306E\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3055\u308C\u305F\u30BD\u30FC\u30B9\u30FB\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304B\u3089\u30B3\u30D4\u30FC\u3057\u305F\u304B\u3001\u30AF\u30E9\u30B9\u30D1\u30B9\u306B\u542B\u3081\u307E\u3057\u305F\u304B\u3002 - -TRANSIENT_FIELD_NOT_BINDABLE = \u4E00\u6642\u30D5\u30A3\u30FC\u30EB\u30C9"{0}"\u306BJAXB\u6CE8\u91C8\u3092\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002 - -THERE_MUST_BE_VALUE_IN_XMLVALUE = \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E@XmlValue\u30D5\u30A3\u30FC\u30EB\u30C9\u306B\u306F\u5024\u304C\u5FC5\u8981\u3067\u3059: {0} - -INCOMPATIBLE_API_VERSION = JAXB 2.1 API jar\u304C({0}\u304B\u3089)\u30ED\u30FC\u30C9\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u3053\u306E({1}\u304B\u3089\u306E)RI\u306B\u306FJAXB 2.2 API jar\u304C\u5FC5\u8981\u3067\u3059\u3002 - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = JAXB 2.1 API\u306F\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30ED\u30FC\u30C0\u30FC\u304B\u3089\u30ED\u30FC\u30C9\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u3053\u306E({1}\u304B\u3089\u306E)RI\u306B\u306F2.2 API\u304C\u5FC5\u8981\u3067\u3059\u3002jaxb-api.jar\u3092\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30AF\u30E9\u30B9\u30FB\u30ED\u30FC\u30C0\u30FC\u306B\u914D\u7F6E\u3059\u308B\u306B\u306F\u3001\u63A8\u5968\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30FB\u30E1\u30AB\u30CB\u30BA\u30E0\u3092\u4F7F\u7528\u3057\u307E\u3059(http://java.sun.com/j2se/1.6.0/docs/guide/standards/\u3092\u53C2\u7167) - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = ({1}\u304B\u3089)JAXB 2.0\u30E9\u30F3\u30BF\u30A4\u30E0\u3092\u5B9F\u884C\u3057\u3088\u3046\u3068\u3057\u3066\u3044\u307E\u3059\u304C\u3001({0}\u306E)\u30AF\u30E9\u30B9\u30D1\u30B9\u306B\u4EE5\u524D\u306EJAXB 1.0\u30E9\u30F3\u30BF\u30A4\u30E0\u304C\u3042\u308A\u307E\u3059\u30022.0\u30E9\u30F3\u30BF\u30A4\u30E0\u304C\u6B63\u3057\u304F\u52D5\u4F5C\u3059\u308B\u3088\u3046\u306B\u3001JAXB 1.0\u30E9\u30F3\u30BF\u30A4\u30E0\u3092\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002 - -UNMATCHABLE_ADAPTER = \u30A2\u30C0\u30D7\u30BF{0}\u3092\u30D5\u30A3\u30FC\u30EB\u30C9\u30FB\u30BF\u30A4\u30D7{1}\u306B\u9069\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002 - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = \u30AF\u30E9\u30B9{1}\u306EAccessorFactory {0}\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002 - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = \u30AF\u30E9\u30B9{1}\u306EAccessorFactory {0}\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306B\u30A2\u30AF\u30BB\u30B9\u3067\u304D\u307E\u305B\u3093\u3002 - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = \u30AB\u30B9\u30BF\u30E0AccessorFactory {0}\u306F\u3001\u30D7\u30ED\u30D1\u30C6\u30A3\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u4E2D\u306B\u767A\u751F\u3057\u305F\u30A8\u30E9\u30FC\u3092\u30EC\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u3059\u3002{1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = \u30AB\u30B9\u30BF\u30E0AccessorFactory {0}\u306F\u3001\u30D5\u30A3\u30FC\u30EB\u30C9\u3078\u306E\u30A2\u30AF\u30BB\u30B9\u4E2D\u306B\u767A\u751F\u3057\u305F\u30A8\u30E9\u30FC\u3092\u30EC\u30DD\u30FC\u30C8\u3057\u3066\u3044\u307E\u3059\u3002{1} - -ANONYMOUS_ARRAY_ITEM = {0}\u306F\u914D\u5217\u30B3\u30F3\u30DD\u30FC\u30CD\u30F3\u30C8\u30FB\u30BF\u30A4\u30D7\u3068\u3057\u3066\u4F7F\u7528\u3055\u308C\u3066\u3044\u308B\u305F\u3081\u3001\u533F\u540D\u306B\u3067\u304D\u307E\u305B\u3093\u3002 - -XMLGREGORIANCALENDAR_INVALID = XMLGregorianCalendar\u30BF\u30A4\u30D7{0}\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u30FB\u30BB\u30C3\u30C8\u304C\u7121\u52B9\u3067\u3059\u3002 - -XMLGREGORIANCALENDAR_SEC = \u79D2\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 - -XMLGREGORIANCALENDAR_MIN = \u5206\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 - -XMLGREGORIANCALENDAR_HR = \u6642\u9593\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 - -XMLGREGORIANCALENDAR_DAY = \u65E5\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 - -XMLGREGORIANCALENDAR_MONTH = \u6708\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 - -XMLGREGORIANCALENDAR_YEAR = \u5E74\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 - -XMLGREGORIANCALENDAR_TIMEZONE = \u30BF\u30A4\u30E0\u30BE\u30FC\u30F3\u304C\u8A2D\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages_ko.properties 2018-01-30 20:32:18.000000000 -0500 +++ /dev/null 2018-01-30 20:32:18.000000000 -0500 @@ -1,150 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = "{0}" \uC18D\uC131\uC5D0 XmlID \uC8FC\uC11D\uC774 \uC788\uC9C0\uB9CC \uD574\uB2F9 \uC720\uD615\uC740 \uBB38\uC790\uC5F4\uC774 \uC544\uB2D9\uB2C8\uB2E4. - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = {0}\uC758 @{1} \uC8FC\uC11D\uACFC @{2} \uC8FC\uC11D\uC740 \uD568\uAED8 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -DUPLICATE_ANNOTATIONS = @{0} \uC8FC\uC11D\uC774 \uB450 \uC704\uCE58\uC5D0\uC11C \uBC1C\uACAC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uD55C \uC704\uCE58\uC5D0\uB9CC \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4. - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = {0}\uC5D0 \uC778\uC218\uAC00 \uC5C6\uB294 \uAE30\uBCF8 \uC0DD\uC131\uC790\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. - -CANT_HANDLE_INTERFACE = {0}\uC740(\uB294) \uC778\uD130\uD398\uC774\uC2A4\uC774\uBA70 JAXB\uB294 \uC778\uD130\uD398\uC774\uC2A4\uB97C \uCC98\uB9AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -CANT_HANDLE_INNER_CLASS = {0}\uC740(\uB294) non-static \uB0B4\uBD80 \uD074\uB798\uC2A4\uC774\uBA70 JAXB\uB294 \uD574\uB2F9 \uD074\uB798\uC2A4\uB97C \uCC98\uB9AC\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -ANNOTATION_ON_WRONG_METHOD = JAXB \uC18D\uC131\uC774 \uC544\uB2CC \uBA54\uC18C\uB4DC\uC5D0 JAXB \uC8FC\uC11D\uC774 \uBC30\uCE58\uB418\uC5C8\uC2B5\uB2C8\uB2E4. - -GETTER_SETTER_INCOMPATIBLE_TYPE = getter\uC758 \uC720\uD615\uC740 {0}, setter\uC758 \uC720\uD615\uC740 {1}\uC785\uB2C8\uB2E4. \uB450 \uC720\uD615\uC740 \uB3D9\uC77C\uD574\uC57C \uD569\uB2C8\uB2E4. - -DUPLICATE_ENTRY_IN_PROP_ORDER = "{0}" \uC18D\uC131\uC774 @XmlType.propOrder\uC5D0\uC11C \uB450 \uBC88 \uC774\uC0C1 \uB098\uD0C0\uB0A9\uB2C8\uB2E4. - -DUPLICATE_PROPERTIES = \uC774\uB984\uC774 "{0}"\uC778 \uC18D\uC131\uC774 \uB450 \uAC1C \uC788\uC2B5\uB2C8\uB2E4. - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = {0} \uBA54\uC18C\uB4DC\uC5D0 @XmlElementMapping\uC774 \uC788\uC9C0\uB9CC JAXBElement\uC758 \uD558\uC704 \uC720\uD615\uC744 \uBC18\uD658\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = {0}\uC774(\uAC00) \uBCF5\uD569 \uC720\uD615\uC5D0 \uBC14\uC778\uB4DC\uB418\uC9C0 \uC54A\uC544 \uBC94\uC704\uB85C \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -CONFLICTING_XML_ELEMENT_MAPPING = \uC694\uC18C \uC774\uB984 ''{''{0}''}''{1}\uC5D0 \uB9E4\uD551\uC774 \uB450 \uAC1C \uC774\uC0C1 \uC788\uC2B5\uB2C8\uB2E4. - -REFERENCE_TO_NON_ELEMENT = {0} \uC18D\uC131\uC740 @XmlReference\uB85C \uC8FC\uC11D \uCC98\uB9AC\uB418\uC5C8\uC9C0\uB9CC \uC694\uC18C\uB97C \uCC38\uC870\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -NON_EXISTENT_ELEMENT_MAPPING = "{0}":"{1}"\uC5D0 \uB300\uD55C \uC694\uC18C \uB9E4\uD551\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -TWO_ATTRIBUTE_WILDCARDS = {0}\uC5D0 @XmlAnyAttribute \uC8FC\uC11D\uC774 \uC788\uB294 \uC18D\uC131\uC774 \uB450 \uAC1C \uC788\uC2B5\uB2C8\uB2E4. - -SUPER_CLASS_HAS_WILDCARD = \uAE30\uBCF8 \uD074\uB798\uC2A4\uC5D0 \uC774\uBBF8 \uD3EC\uD568\uB41C \uACBD\uC6B0 @XmlAnyAttribute\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -INVALID_ATTRIBUTE_WILDCARD_TYPE = @XmlAnyAttribute\uB294 \uC720\uD615\uC774 {0}\uC778 \uC18D\uC131\uC5D0 \uBC30\uCE58\uB418\uC5C8\uC9C0\uB9CC java.util.Map\uC5D0 \uC9C0\uC815\uD560 \uC218 \uC788\uC5B4\uC57C \uD569\uB2C8\uB2E4. - -PROPERTY_MISSING_FROM_ORDER = {0} \uC18D\uC131\uC774 \uC788\uC9C0\uB9CC @XmlType.propOrder\uC5D0 \uC9C0\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = {0} \uC18D\uC131\uC774 @XmlType.propOrder\uC5D0 \uB098\uD0C0\uB098\uC9C0\uB9CC \uD574\uB2F9 \uC18D\uC131\uC774 \uC874\uC7AC\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. {1}\uC744(\uB97C) \uC0AC\uC6A9\uD558\uB824\uACE0 \uD55C \uAC83\uC785\uB2C8\uAE4C? - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = "{0}"\uC740(\uB294) {1}\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uAC12\uC774 \uC544\uB2D9\uB2C8\uB2E4. - -NO_IMAGE_WRITER = \uC9C0\uC815\uB41C MIME \uC720\uD615 "{0}"\uC5D0 \uC0AC\uC6A9 \uAC00\uB2A5\uD55C javax.imageio.ImageWriter\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. - -ILLEGAL_MIME_TYPE = "{0}"\uC740(\uB294) \uC801\uD569\uD55C MIME \uC720\uD615\uC774 \uC544\uB2D8: {1} - -ILLEGAL_ANNOTATION = {0} \uC8FC\uC11D\uC740 \uC5EC\uAE30\uC5D0 \uBC30\uCE58\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -MULTIPLE_VALUE_PROPERTY = @XmlValue\uB294 \uD074\uB798\uC2A4\uB2F9 \uD558\uB098\uB9CC \uD5C8\uC6A9\uB418\uC9C0\uB9CC \uB450 \uAC1C\uC758 \uC18D\uC131\uC774 @XmlValue\uB85C \uC8FC\uC11D \uCC98\uB9AC\uB418\uC5C8\uC2B5\uB2C8\uB2E4. - -XMLVALUE_IN_DERIVED_TYPE = @XmlValue\uB294 \uB2E4\uB978 \uD074\uB798\uC2A4\uB97C \uD30C\uC0DD\uD558\uB294 \uD074\uB798\uC2A4\uC5D0\uC11C \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -ELEMENT_AND_VALUE_PROPERTY = \uD074\uB798\uC2A4\uC5D0 @XmlElement \uC18D\uC131\uC774 \uC788\uC744 \uACBD\uC6B0 @XmlValue \uC18D\uC131\uC744 \uD3EC\uD568\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -CONFLICTING_XML_TYPE_MAPPING = \uB450 \uAC1C\uC758 \uD074\uB798\uC2A4\uC5D0 \uB3D9\uC77C\uD55C XML \uC720\uD615 \uC774\uB984 "{0}"\uC774(\uAC00) \uC0AC\uC6A9\uB429\uB2C8\uB2E4. @XmlType.name \uBC0F @XmlType.namespace\uB97C \uC0AC\uC6A9\uD558\uC5EC \uD574\uB2F9 \uD074\uB798\uC2A4\uC5D0 \uB2E4\uB978 \uC774\uB984\uC744 \uC9C0\uC815\uD558\uC2ED\uC2DC\uC624. - -SIMPLE_TYPE_IS_REQUIRED = @XmlAttribute/@XmlValue\uB294 XML\uC5D0\uC11C \uD14D\uC2A4\uD2B8\uC5D0 \uB9E4\uD551\uB418\uB294 Java \uC720\uD615\uC744 \uCC38\uC870\uD574\uC57C \uD569\uB2C8\uB2E4. - -PROPERTY_COLLISION = \uD074\uB798\uC2A4\uC5D0 \uB3D9\uC77C\uD55C \uC774\uB984 "{0}"\uC744(\uB97C) \uC0AC\uC6A9\uD558\uB294 \uC18D\uC131\uC774 \uB450 \uAC1C \uC788\uC2B5\uB2C8\uB2E4. - -INVALID_IDREF = XmlIDREF \uC18D\uC131\uC774 XmlID \uC18D\uC131\uC744 \uD3EC\uD568\uD558\uC9C0 \uC54A\uB294 "{0}" \uC720\uD615\uC744 \uCC38\uC870\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4. - -INVALID_XML_ELEMENT_REF = \uBD80\uC801\uD569\uD55C @XmlElementRef: \uC774 \uCEE8\uD14D\uC2A4\uD2B8\uC5D0\uC11C "{0}" \uC720\uD615 \uB610\uB294 \uD574\uB2F9 \uD558\uC704 \uD074\uB798\uC2A4\uB97C \uC778\uC2DD\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -NO_XML_ELEMENT_DECL = ''{''{0}''}''{1} \uC694\uC18C\uC5D0 \uB300\uD574 @XmlElementDecl\uC774 \uD3EC\uD568\uB41C ObjectFactory\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = @XmlElementWrapper\uB294 \uBAA8\uC74C \uC18D\uC131\uC5D0\uC11C\uB9CC \uD5C8\uC6A9\uB418\uC9C0\uB9CC "{0}"\uC740(\uB294) \uBAA8\uC74C \uC18D\uC131\uC774 \uC544\uB2D9\uB2C8\uB2E4. - -ANNOTATION_NOT_ALLOWED = {0} \uC8FC\uC11D\uC740 \uC774 \uC885\uB958\uC758 \uC18D\uC131\uC5D0\uC11C \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -XMLLIST_NEEDS_SIMPLETYPE = {0}\uC740(\uB294) \uAD6C\uC870\uD654\uB41C XML \uB2E8\uD3B8(AKA \uBCF5\uD569 \uC720\uD615)\uC5D0 \uB9E4\uD551\uB418\uBBC0\uB85C @XmlList\uC640 \uD638\uD658\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -XMLLIST_ON_SINGLE_PROPERTY = @XmlList\uB294 \uB2E8\uC77C \uAC12 \uC18D\uC131\uC5D0 \uBC30\uCE58\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -NO_FACTORY_METHOD = \uD329\uD1A0\uB9AC \uD074\uB798\uC2A4 "{0}"\uC5D0 \uC778\uC218\uAC00 \uC5C6\uB294 static \uD329\uD1A0\uB9AC \uBA54\uC18C\uB4DC "{1}"\uC774(\uAC00) \uC5C6\uC2B5\uB2C8\uB2E4. - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = XmlType\uC774 \uD329\uD1A0\uB9AC \uD074\uB798\uC2A4 "{0}"\uC5D0 \uB300\uD55C \uD329\uD1A0\uB9AC \uBA54\uC18C\uB4DC\uB97C \uC815\uC758\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. - -MISSING_JAXB_PROPERTIES = "{0}" \uD328\uD0A4\uC9C0\uC5D0 jaxb.properties \uD30C\uC77C\uC774 \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC774 \uD30C\uC77C\uC744 \uC0DD\uC131\uB41C \uC18C\uC2A4 \uB514\uB809\uD1A0\uB9AC\uC5D0\uC11C \uBCF5\uC0AC\uD558\uAC70\uB098 \uD074\uB798\uC2A4 \uACBD\uB85C\uC5D0 \uD3EC\uD568\uC2DC\uCF30\uC2B5\uB2C8\uAE4C? - -TRANSIENT_FIELD_NOT_BINDABLE = \uC784\uC2DC \uD544\uB4DC "{0}"\uC5D0\uB294 JAXB \uC8FC\uC11D\uC774 \uD3EC\uD568\uB420 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -THERE_MUST_BE_VALUE_IN_XMLVALUE = \uAC1D\uCCB4\uC758 @XmlValue \uD544\uB4DC\uC5D0 \uAC12\uC774 \uC788\uC5B4\uC57C \uD568: {0} - -INCOMPATIBLE_API_VERSION = JAXB 2.1 API jar\uC774 {0}\uC5D0\uC11C \uB85C\uB4DC\uB418\uACE0 \uC788\uC9C0\uB9CC {1}\uC758 \uC774 RI\uC5D0\uB294 JAXB 2.2 API jar\uC774 \uD544\uC694\uD569\uB2C8\uB2E4. - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = JAXB 2.1 API\uAC00 \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uB85C\uB354\uC5D0\uC11C \uB85C\uB4DC\uB418\uACE0 \uC788\uC9C0\uB9CC {1}\uC758 \uC774 RI\uC5D0\uB294 2.2 API\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. \uC778\uC99D\uB41C \uB514\uB809\uD1A0\uB9AC \uBC29\uC2DD\uC744 \uC0AC\uC6A9\uD558\uC5EC \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uD074\uB798\uC2A4 \uB85C\uB354\uC5D0 jaxb-api.jar\uC744 \uBC30\uCE58\uD558\uC2ED\uC2DC\uC624. http://java.sun.com/j2se/1.6.0/docs/guide/standards/\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624. - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = {1}\uC5D0\uC11C JAXB 2.0 \uB7F0\uD0C0\uC784\uC744 \uC2E4\uD589\uD558\uB824\uACE0 \uC2DC\uB3C4\uD558\uACE0 \uC788\uC9C0\uB9CC {0}\uC758 \uD074\uB798\uC2A4 \uACBD\uB85C\uC5D0 \uC774\uBBF8 \uC774\uC804 JAXB 1.0 \uB7F0\uD0C0\uC784\uC774 \uC788\uC2B5\uB2C8\uB2E4. 2.0 \uB7F0\uD0C0\uC784\uC774 \uC81C\uB300\uB85C \uC791\uB3D9\uB418\uB3C4\uB85D JAXB 1.0 \uB7F0\uD0C0\uC784\uC744 \uC81C\uAC70\uD558\uC2ED\uC2DC\uC624. - -UNMATCHABLE_ADAPTER = {0} \uC5B4\uB311\uD130\uB294 \uD544\uB4DC \uC720\uD615 {1}\uC5D0 \uC801\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = {1} \uD074\uB798\uC2A4\uC5D0 \uB300\uD55C AccessorFactory {0}\uC758 \uC778\uC2A4\uD134\uC2A4\uB97C \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = {1} \uD074\uB798\uC2A4\uC5D0 \uB300\uD55C AccessorFactory {0}\uC758 \uC778\uC2A4\uD134\uC2A4\uC5D0 \uC561\uC138\uC2A4\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = \uC0AC\uC6A9\uC790 \uC815\uC758 AccessorFactory {0}\uC774(\uAC00) \uC18D\uC131 \uC561\uC138\uC2A4 \uC624\uB958\uB97C \uBCF4\uACE0\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4. {1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = \uC0AC\uC6A9\uC790 \uC815\uC758 AccessorFactory {0}\uC774(\uAC00) \uD544\uB4DC \uC561\uC138\uC2A4 \uC624\uB958\uB97C \uBCF4\uACE0\uD558\uACE0 \uC788\uC2B5\uB2C8\uB2E4. {1} - -ANONYMOUS_ARRAY_ITEM = {0}\uC740(\uB294) \uBC30\uC5F4 \uAD6C\uC131 \uC694\uC18C \uC720\uD615\uC73C\uB85C \uC0AC\uC6A9\uB418\uBBC0\uB85C \uC775\uBA85\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -XMLGREGORIANCALENDAR_INVALID = XMLGregorianCalendar \uC720\uD615 {0}\uC5D0 \uB300\uD574 \uBD80\uC801\uD569\uD55C \uD544\uB4DC \uC9D1\uD569\uC774 \uC124\uC815\uB418\uC5C8\uC2B5\uB2C8\uB2E4. - -XMLGREGORIANCALENDAR_SEC = \uCD08\uAC00 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. - -XMLGREGORIANCALENDAR_MIN = \uBD84\uC774 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. - -XMLGREGORIANCALENDAR_HR = \uC2DC\uAC00 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. - -XMLGREGORIANCALENDAR_DAY = \uC77C\uC774 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. - -XMLGREGORIANCALENDAR_MONTH = \uC6D4\uC774 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. - -XMLGREGORIANCALENDAR_YEAR = \uC5F0\uB3C4\uAC00 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. - -XMLGREGORIANCALENDAR_TIMEZONE = \uC2DC\uAC04\uB300\uAC00 \uC124\uC815\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages_pt_BR.properties 2018-01-30 20:32:18.000000000 -0500 +++ /dev/null 2018-01-30 20:32:18.000000000 -0500 @@ -1,150 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = A propriedade "{0}" tem uma anota\u00E7\u00E3o XmlID, mas seu tipo n\u00E3o \u00E9 String. - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = {0} tem anota\u00E7\u00F5es mutuamente exclusivas @{1} e @{2} - -DUPLICATE_ANNOTATIONS = anota\u00E7\u00E3o @{0} encontrada em dois locais; um \u00E9 suficiente. - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = {0} n\u00E3o tem um construtor no-arg default. - -CANT_HANDLE_INTERFACE = {0} \u00E9 uma interface e JAXB n\u00E3o pode tratar interfaces. - -CANT_HANDLE_INNER_CLASS = {0} \u00E9 uma classe interna n\u00E3o est\u00E1tica e JAXB n\u00E3o pode trat\u00E1-la. - -ANNOTATION_ON_WRONG_METHOD = A anota\u00E7\u00E3o JAXB foi colocada em um m\u00E9todo que n\u00E3o \u00E9 uma propriedade JAXB - -GETTER_SETTER_INCOMPATIBLE_TYPE = O tipo de getter \u00E9 {0}, mas o do setter \u00E9 {1}. Eles devem ser iguais. - -DUPLICATE_ENTRY_IN_PROP_ORDER = A propriedade "{0}" aparece mais de uma vez em @XmlType.propOrder - -DUPLICATE_PROPERTIES = H\u00E1 duas propriedades com o nome "{0}" - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = O m\u00E9todo {0} tem @XmlElementMapping nele, mas ele n\u00E3o retorna um subtipo de JAXBElement. - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = {0} n\u00E3o est\u00E1 associado a um tipo complexo e, portanto, o escopo \u00E9 inv\u00E1lido. - -CONFLICTING_XML_ELEMENT_MAPPING = O nome do elemento "{{0}}"{1} tem mais de um mapeamento. - -REFERENCE_TO_NON_ELEMENT = A propriedade {0} foi anotada com @XmlReference, mas n\u00E3o se refere a um elemento. - -NON_EXISTENT_ELEMENT_MAPPING = N\u00E3o existe mapeamento de elemento para "{0}":"{1}" - -TWO_ATTRIBUTE_WILDCARDS = {0} tem duas propriedades com a anota\u00E7\u00E3o @XmlAnyAttribute. - -SUPER_CLASS_HAS_WILDCARD = N\u00E3o pode ter @XmlAnyAttribute quando uma classe-base j\u00E1 a possui. - -INVALID_ATTRIBUTE_WILDCARD_TYPE = @XmlAnyAttribute \u00E9 colocado em uma propriedade cujo tipo \u00E9 {0}, mas ele precisa ser atribu\u00EDdo a java.util.Map. - -PROPERTY_MISSING_FROM_ORDER = A propriedade {0} est\u00E1 presente, mas n\u00E3o foi especificada em @XmlType.propOrder - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = A propriedade {0} aparece na @XmlType.propOrder, mas essa propriedade n\u00E3o existe. Voc\u00EA quis dizer {1}? - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = "{0}" n\u00E3o \u00E9 um valor v\u00E1lido para {1}. - -NO_IMAGE_WRITER = Nenhum javax.imageio.ImageWriter dispon\u00EDvel para o tipo MIME "{0}" especificado - -ILLEGAL_MIME_TYPE = "{0}" n\u00E3o \u00E9 um tipo MIME v\u00E1lido: {1} - -ILLEGAL_ANNOTATION = a anota\u00E7\u00E3o {0} n\u00E3o pode ser colocada aqui - -MULTIPLE_VALUE_PROPERTY = S\u00F3 \u00E9 permitido um @XmlValue por classe, mas duas propriedades foram anotadas com @XmlValue. - -XMLVALUE_IN_DERIVED_TYPE = @XmlValue n\u00E3o \u00E9 permitido em uma classe que deriva outra classe. - -ELEMENT_AND_VALUE_PROPERTY = Se uma classe tiver a propriedade @XmlElement, ela n\u00E3o poder\u00E1 ter a propriedade @XmlValue. - -CONFLICTING_XML_TYPE_MAPPING = Duas classes t\u00EAm o mesmo nome do tipo XML "{0}". Use @XmlType.name e @XmlType.namespace para atribuir outros nomes a elas. - -SIMPLE_TYPE_IS_REQUIRED = @XmlAttribute/@XmlValue precisa fazer refer\u00EAncia a um tipo Java que \u00E9 mapeado ao texto em XML. - -PROPERTY_COLLISION = A classe tem duas propriedades do mesmo nome "{0}" - -INVALID_IDREF = A propriedade XmlIDREF est\u00E1 fazendo refer\u00EAncia a um tipo "{0}" que n\u00E3o tem uma propriedade XmlID. - -INVALID_XML_ELEMENT_REF = @XmlElementRef Inv\u00E1lido: o tipo "{0}" ou qualquer uma de suas subclasses n\u00E3o \u00E9 conhecida neste contexto. - -NO_XML_ELEMENT_DECL = N\u00E3o h\u00E1 ObjectFactory com um @XmlElementDecl para o elemento "{{0}}"{1}. - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = @XmlElementWrapper s\u00F3 \u00E9 permitido em uma propriedade de coleta, mas "{0}" n\u00E3o \u00E9 uma propriedade de coleta. - -ANNOTATION_NOT_ALLOWED = a anota\u00E7\u00E3o {0} n\u00E3o \u00E9 permitida neste tipo de propriedade. - -XMLLIST_NEEDS_SIMPLETYPE = {0} \u00E9 mapeado para um fragmento XML estruturado (tipo complexo AKA) e, portanto, \u00E9 incompat\u00EDvel com @XmlList. - -XMLLIST_ON_SINGLE_PROPERTY = @XmlList n\u00E3o pode ser colocado em uma propriedade de valor \u00FAnico - -NO_FACTORY_METHOD = A classe de factory "{0}" n\u00E3o tem o m\u00E9todo de factory de argumentos zero est\u00E1ticos "{1}". - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = XmlType n\u00E3o definiu um m\u00E9todo de factory para a classe de Factory "{0}". - -MISSING_JAXB_PROPERTIES = O pacote "{0}" n\u00E3o encontrou o arquivo jaxb.properties. Voc\u00EA copiou este arquivo do diret\u00F3rio de origem gerado ou incluiu-o no classpath? - -TRANSIENT_FIELD_NOT_BINDABLE = O campo transiente "{0}" n\u00E3o pode ter uma anota\u00E7\u00E3o JAXB. - -THERE_MUST_BE_VALUE_IN_XMLVALUE = O objeto deve ter algum valor no campo @XmlValue: {0} - -INCOMPATIBLE_API_VERSION = O jar da API do JAXB 2.1 est\u00E1 sendo carregado (de {0}), mas este RI (de {1}) requer o jar da API do JAXB 2.2. - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = A API do JAXB 2.1 est\u00E1 sendo carregada do carregador de classes de bootstrap, mas este RI (de {1}) precisa da API 2.2. Use o mecanismo do diret\u00F3rio endossado para colocar jaxb-api.jar no carregador de classes de bootstrap. (Consulte http://java.sun.com/j2se/1.6.0/docs/guide/standards/) - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = Voc\u00EA est\u00E1 tentando executar o runtime do JAXB 2.0 (de {1}) mas voc\u00EA tem o runtime do JAXB 1.0 antigo no classpath (em {0}). Remova o runtime do JAXB 1.0 do runtime do 2.0 para funcionar corretamente. - -UNMATCHABLE_ADAPTER = O adaptador {0} n\u00E3o \u00E9 aplic\u00E1vel ao tipo de campo {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = N\u00E3o \u00E9 poss\u00EDvel criar a inst\u00E2ncia de AccessorFactory {0} para a classe {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = N\u00E3o \u00E9 poss\u00EDvel acessar a inst\u00E2ncia de AccessorFactory {0} para a classe {1}. - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = A AccessorFactory {0} personalizada est\u00E1 reportando um erro ao acessar a propriedade. {1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = A AccessorFactory {0} personalizada est\u00E1 reportando um erro ao acessar um campo. {1} - -ANONYMOUS_ARRAY_ITEM = {0} foi usado como um tipo de componente do array; portanto, n\u00E3o pode ser an\u00F4nimo. - -XMLGREGORIANCALENDAR_INVALID = Conjunto inv\u00E1lido de campos definido para o tipo XMLGregorianCalendar {0}. - -XMLGREGORIANCALENDAR_SEC = Segundos n\u00E3o definidos. - -XMLGREGORIANCALENDAR_MIN = Minutos n\u00E3o definidos. - -XMLGREGORIANCALENDAR_HR = Hora n\u00E3o definida. - -XMLGREGORIANCALENDAR_DAY = Dia n\u00E3o definido. - -XMLGREGORIANCALENDAR_MONTH = M\u00EAs n\u00E3o definido. - -XMLGREGORIANCALENDAR_YEAR = Ano n\u00E3o definido. - -XMLGREGORIANCALENDAR_TIMEZONE = Fuso hor\u00E1rio n\u00E3o definido. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages_zh_CN.properties 2018-01-30 20:32:19.000000000 -0500 +++ /dev/null 2018-01-30 20:32:19.000000000 -0500 @@ -1,150 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = \u5C5E\u6027 "{0}" \u5177\u6709 XmlID \u6CE8\u91CA, \u4F46\u5B83\u4E0D\u662F\u5B57\u7B26\u4E32\u7C7B\u578B\u3002 - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = {0}\u5177\u6709\u4E92\u76F8\u6392\u65A5\u7684\u6CE8\u91CA @{1} \u548C @{2} - -DUPLICATE_ANNOTATIONS = \u53D1\u73B0 @{0} \u6CE8\u91CA\u4F4D\u4E8E\u4E24\u4E2A\u4F4D\u7F6E; \u6709\u4E00\u4E2A\u4F4D\u7F6E\u5C31\u8DB3\u591F\u3002 - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = {0}\u6CA1\u6709\u65E0\u53C2\u6570\u9ED8\u8BA4\u6784\u9020\u5668\u3002 - -CANT_HANDLE_INTERFACE = {0}\u662F\u63A5\u53E3, \u800C JAXB \u65E0\u6CD5\u5904\u7406\u63A5\u53E3\u3002 - -CANT_HANDLE_INNER_CLASS = {0}\u662F\u975E\u9759\u6001\u5185\u90E8\u7C7B, \u800C JAXB \u65E0\u6CD5\u5904\u7406\u8FD9\u4E9B\u7C7B\u3002 - -ANNOTATION_ON_WRONG_METHOD = \u5728\u5176\u4E2D\u653E\u5165 JAXB \u6CE8\u91CA\u7684\u65B9\u6CD5\u4E0D\u662F JAXB \u5C5E\u6027 - -GETTER_SETTER_INCOMPATIBLE_TYPE = getter \u7684\u7C7B\u578B\u4E3A{0}, \u800C setter \u7684\u7C7B\u578B\u4E3A{1}\u3002\u5B83\u4EEC\u7684\u7C7B\u578B\u5FC5\u987B\u76F8\u540C\u3002 - -DUPLICATE_ENTRY_IN_PROP_ORDER = \u5C5E\u6027 "{0}" \u5728 @XmlType.propOrder \u4E2D\u51FA\u73B0\u591A\u6B21 - -DUPLICATE_PROPERTIES = \u6709\u4E24\u4E2A\u540D\u4E3A "{0}" \u7684\u5C5E\u6027 - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = {0}\u65B9\u6CD5\u5177\u6709 @XmlElementMapping, \u4F46\u8BE5\u65B9\u6CD5\u672A\u8FD4\u56DE JAXBElement \u7684\u5B50\u7C7B\u578B\u3002 - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = {0}\u672A\u7ED1\u5B9A\u5230\u590D\u6742\u7C7B\u578B, \u56E0\u6B64\u4F5C\u4E3A\u8303\u56F4\u65F6\u662F\u975E\u6CD5\u7684\u3002 - -CONFLICTING_XML_ELEMENT_MAPPING = \u5143\u7D20\u540D\u79F0 ''{''{0}''}''{1}\u5177\u6709\u591A\u4E2A\u6620\u5C04\u3002 - -REFERENCE_TO_NON_ELEMENT = \u5C5E\u6027{0}\u5E26\u6709 @XmlReference \u6CE8\u91CA, \u4F46\u672A\u5F15\u7528\u5143\u7D20\u3002 - -NON_EXISTENT_ELEMENT_MAPPING = "{0}":"{1}" \u6CA1\u6709\u5143\u7D20\u6620\u5C04 - -TWO_ATTRIBUTE_WILDCARDS = {0}\u5177\u6709\u4E24\u4E2A\u5E26\u6709 @XmlAnyAttribute \u6CE8\u91CA\u7684\u5C5E\u6027\u3002 - -SUPER_CLASS_HAS_WILDCARD = \u5982\u679C\u57FA\u7C7B\u5DF2\u6709 @XmlAnyAttribute, \u5219\u4E0D\u80FD\u518D\u6709\u8BE5\u6CE8\u91CA\u3002 - -INVALID_ATTRIBUTE_WILDCARD_TYPE = @XmlAnyAttribute \u653E\u7F6E\u5728\u7C7B\u578B\u4E3A{0}\u7684\u5C5E\u6027\u4E0A, \u4F46\u5B83\u5FC5\u987B\u53EF\u5206\u914D\u7ED9 java.util.Map\u3002 - -PROPERTY_MISSING_FROM_ORDER = \u5C5E\u6027{0}\u5DF2\u5B58\u5728, \u4F46\u672A\u5728 @XmlType.propOrder \u4E2D\u6307\u5B9A - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = \u5C5E\u6027{0}\u51FA\u73B0\u5728 @XmlType.propOrder \u4E2D, \u4F46\u4E0D\u5B58\u5728\u8FD9\u79CD\u5C5E\u6027\u3002\u60A8\u662F\u5426\u6253\u7B97{1}? - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = "{0}" \u4E0D\u662F{1}\u7684\u6709\u6548\u503C\u3002 - -NO_IMAGE_WRITER = \u6307\u5B9A MIME \u7C7B\u578B "{0}" \u6CA1\u6709\u53EF\u7528\u7684 javax.imageio.ImageWriter - -ILLEGAL_MIME_TYPE = "{0}" \u4E0D\u662F\u6709\u6548\u7684 MIME \u7C7B\u578B: {1} - -ILLEGAL_ANNOTATION = \u4E0D\u80FD\u5728\u6B64\u5904\u653E\u7F6E{0}\u6CE8\u91CA - -MULTIPLE_VALUE_PROPERTY = \u6BCF\u4E2A\u7C7B\u53EA\u5141\u8BB8\u6709\u4E00\u4E2A @XmlValue, \u4F46\u6709\u4E24\u4E2A\u5C5E\u6027\u5E26\u6709 @XmlValue \u6CE8\u91CA\u3002 - -XMLVALUE_IN_DERIVED_TYPE = \u6D3E\u751F\u5176\u4ED6\u7C7B\u7684\u7C7B\u4E0D\u5141\u8BB8\u6709 @XmlValue\u3002 - -ELEMENT_AND_VALUE_PROPERTY = \u5982\u679C\u7C7B\u5177\u6709 @XmlElement \u5C5E\u6027, \u5219\u4E0D\u80FD\u5177\u6709 @XmlValue \u5C5E\u6027\u3002 - -CONFLICTING_XML_TYPE_MAPPING = \u4E24\u4E2A\u7C7B\u5177\u6709\u76F8\u540C\u7684 XML \u7C7B\u578B\u540D\u79F0 "{0}"\u3002\u8BF7\u4F7F\u7528 @XmlType.name \u548C @XmlType.namespace \u4E3A\u7C7B\u5206\u914D\u4E0D\u540C\u7684\u540D\u79F0\u3002 - -SIMPLE_TYPE_IS_REQUIRED = @XmlAttribute/@XmlValue \u5FC5\u987B\u5F15\u7528\u6620\u5C04\u5230 XML \u4E2D\u7684\u6587\u672C\u7684 Java \u7C7B\u578B\u3002 - -PROPERTY_COLLISION = \u7C7B\u7684\u4E24\u4E2A\u5C5E\u6027\u5177\u6709\u76F8\u540C\u540D\u79F0 "{0}" - -INVALID_IDREF = XmlIDREF \u5C5E\u6027\u5F15\u7528\u4E86\u7C7B\u578B "{0}", \u4F46\u6CA1\u6709 XmlID \u5C5E\u6027\u3002 - -INVALID_XML_ELEMENT_REF = @XmlElementRef \u65E0\u6548: \u7C7B\u578B "{0}" \u6216\u5176\u4EFB\u610F\u5B50\u7C7B\u5BF9\u6B64\u4E0A\u4E0B\u6587\u662F\u672A\u77E5\u7684\u3002 - -NO_XML_ELEMENT_DECL = \u5143\u7D20 ''{''{0}''}''{1}\u4E0D\u5B58\u5728\u5177\u6709 @XmlElementDecl \u7684 ObjectFactory\u3002 - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = @XmlElementWrapper \u53EA\u80FD\u4F4D\u4E8E\u96C6\u5408\u5C5E\u6027\u4E0A, \u800C "{0}" \u4E0D\u662F\u96C6\u5408\u5C5E\u6027\u3002 - -ANNOTATION_NOT_ALLOWED = \u6B64\u7C7B\u578B\u5C5E\u6027\u4E0A\u4E0D\u5141\u8BB8\u6709{0}\u6CE8\u91CA\u3002 - -XMLLIST_NEEDS_SIMPLETYPE = {0}\u6620\u5C04\u5230\u7ED3\u6784\u5316 XML \u7247\u6BB5 (\u5373\u590D\u6742\u7C7B\u578B), \u56E0\u6B64\u4E0E @XmlList \u4E0D\u517C\u5BB9\u3002 - -XMLLIST_ON_SINGLE_PROPERTY = @XmlList \u4E0D\u80FD\u653E\u7F6E\u5728\u5355\u503C\u5C5E\u6027\u4E0A - -NO_FACTORY_METHOD = \u5DE5\u5382\u7C7B "{0}" \u6CA1\u6709\u9759\u6001\u96F6\u53C2\u6570\u5DE5\u5382\u65B9\u6CD5 "{1}"\u3002 - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = XmlType \u6CA1\u6709\u4E3A\u5DE5\u5382\u7C7B "{0}" \u5B9A\u4E49\u5DE5\u5382\u65B9\u6CD5\u3002 - -MISSING_JAXB_PROPERTIES = \u7A0B\u5E8F\u5305 "{0}" \u7F3A\u5C11 jaxb.properties \u6587\u4EF6\u3002\u662F\u5426\u5DF2\u4ECE\u751F\u6210\u7684\u6E90\u76EE\u5F55\u590D\u5236\u6B64\u6587\u4EF6\u6216\u5DF2\u5C06\u6B64\u6587\u4EF6\u5305\u542B\u5728\u7C7B\u8DEF\u5F84\u4E2D? - -TRANSIENT_FIELD_NOT_BINDABLE = \u4E34\u65F6\u5B57\u6BB5 "{0}" \u4E0D\u80FD\u6709\u4EFB\u4F55 JAXB \u6CE8\u91CA\u3002 - -THERE_MUST_BE_VALUE_IN_XMLVALUE = \u5BF9\u8C61\u7684 @XmlValue \u5B57\u6BB5\u4E2D\u5FC5\u987B\u5305\u542B\u67D0\u4E00\u503C: {0} - -INCOMPATIBLE_API_VERSION = \u6B63\u5728\u52A0\u8F7D (\u4ECE{0}) JAXB 2.1 API jar, \u4F46\u6B64 RI (\u6765\u81EA{1}) \u9700\u8981 JAXB 2.2 API jar\u3002 - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = \u6B63\u5728\u4ECE\u5F15\u5BFC\u7C7B\u52A0\u8F7D\u5668\u52A0\u8F7D JAXB 2.1 API, \u4F46\u6B64 RI (\u6765\u81EA{1}) \u9700\u8981 2.2 API\u3002\u8BF7\u4F7F\u7528\u6388\u6743\u76EE\u5F55\u673A\u5236\u5C06 jaxb-api.jar \u653E\u5728\u5F15\u5BFC\u7C7B\u52A0\u8F7D\u5668\u4E2D\u3002(\u8BF7\u53C2\u9605 http://java.sun.com/j2se/1.6.0/docs/guide/standards/) - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = \u60A8\u6B63\u5728\u5C1D\u8BD5\u8FD0\u884C JAXB 2.0 \u8FD0\u884C\u65F6 (\u4ECE{1}), \u4F46\u7C7B\u8DEF\u5F84 (\u4F4D\u4E8E{0}\u4E2D) \u4E2D\u5148\u524D\u5305\u542B\u65E7 JAXB 1.0 \u8FD0\u884C\u65F6\u3002\u8981\u4F7F 2.0 \u8FD0\u884C\u65F6\u6B63\u5E38\u5DE5\u4F5C, \u8BF7\u5220\u9664 JAXB 1.0 \u8FD0\u884C\u65F6\u3002 - -UNMATCHABLE_ADAPTER = \u9002\u914D\u5668{0}\u4E0D\u9002\u7528\u4E8E\u5B57\u6BB5\u7C7B\u578B{1}\u3002 - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = \u65E0\u6CD5\u4E3A\u7C7B{1}\u521B\u5EFA AccessorFactory {0}\u7684\u5B9E\u4F8B\u3002 - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = \u65E0\u6CD5\u8BBF\u95EE\u7C7B{1}\u7684 AccessorFactory {0}\u7684\u5B9E\u4F8B\u3002 - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = \u8BBF\u95EE\u5C5E\u6027\u65F6\u5B9A\u5236 AccessorFactory {0}\u62A5\u544A\u9519\u8BEF\u3002{1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = \u8BBF\u95EE\u5B57\u6BB5\u65F6\u5B9A\u5236 AccessorFactory {0}\u62A5\u544A\u9519\u8BEF\u3002{1} - -ANONYMOUS_ARRAY_ITEM = {0}\u7528\u4F5C\u6570\u7EC4\u7EC4\u4EF6\u7C7B\u578B, \u56E0\u6B64\u4E0D\u80FD\u662F\u533F\u540D\u7684\u3002 - -XMLGREGORIANCALENDAR_INVALID = \u4E3A XMLGregorianCalendar \u7C7B\u578B{0}\u8BBE\u7F6E\u7684\u5B57\u6BB5\u96C6\u65E0\u6548\u3002 - -XMLGREGORIANCALENDAR_SEC = \u672A\u8BBE\u7F6E\u79D2\u3002 - -XMLGREGORIANCALENDAR_MIN = \u672A\u8BBE\u7F6E\u5206\u949F\u3002 - -XMLGREGORIANCALENDAR_HR = \u672A\u8BBE\u7F6E\u5C0F\u65F6\u3002 - -XMLGREGORIANCALENDAR_DAY = \u672A\u8BBE\u7F6E\u5929\u3002 - -XMLGREGORIANCALENDAR_MONTH = \u672A\u8BBE\u7F6E\u6708\u3002 - -XMLGREGORIANCALENDAR_YEAR = \u672A\u8BBE\u7F6E\u5E74\u3002 - -XMLGREGORIANCALENDAR_TIMEZONE = \u672A\u8BBE\u7F6E\u65F6\u533A\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Messages_zh_TW.properties 2018-01-30 20:32:20.000000000 -0500 +++ /dev/null 2018-01-30 20:32:20.000000000 -0500 @@ -1,150 +0,0 @@ -# -# 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. -# - -ID_MUST_BE_STRING = \u7279\u6027 "{0}" \u542B\u6709 XmlID \u8A3B\u89E3, \u4F46\u5176\u985E\u578B\u4E0D\u662F\u300C\u5B57\u4E32\u300D. - -# {0} - field or field accessor (getter/setter) e.g.: foo.Bar#field has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement OR foo.Bar#getField() has mutually exclusive annotations @javax.xml.bind.annotation.XmlAttribute and @javax.xml.bind.annotation.XmlElement -MUTUALLY_EXCLUSIVE_ANNOTATIONS = {0} \u542B\u6709\u4E92\u65A5\u7684\u8A3B\u89E3 @{1} \u8207 @{2} - -DUPLICATE_ANNOTATIONS = \u5728\u5169\u500B\u4E0D\u540C\u4F4D\u7F6E\u767C\u73FE @{0} \u8A3B\u89E3; \u53EA\u9700\u8981\u4E00\u500B\u8A3B\u89E3. - -# {0} - class name. e.g.: java.lang.StackTraceElement does not have a no-arg default constructor. -NO_DEFAULT_CONSTRUCTOR = {0} \u6C92\u6709\u7121\u5F15\u6578\u7684\u9810\u8A2D\u5EFA\u69CB\u5B50. - -CANT_HANDLE_INTERFACE = {0} \u662F\u4ECB\u9762, \u800C JAXB \u7121\u6CD5\u8655\u7406\u4ECB\u9762. - -CANT_HANDLE_INNER_CLASS = {0} \u662F\u975E\u975C\u614B\u5167\u90E8\u985E\u5225, \u800C JAXB \u7121\u6CD5\u8655\u7406\u90A3\u4E9B\u985E\u5225. - -ANNOTATION_ON_WRONG_METHOD = JAXB \u8A3B\u89E3\u653E\u7F6E\u65BC\u975E JAXB \u7279\u6027\u7684\u65B9\u6CD5\u4E2D - -GETTER_SETTER_INCOMPATIBLE_TYPE = getter \u7684\u985E\u578B\u70BA {0}, \u4F46 setter \u7684\u985E\u578B\u70BA {1}. \u5169\u8005\u985E\u578B\u5FC5\u9808\u76F8\u540C. - -DUPLICATE_ENTRY_IN_PROP_ORDER = \u7279\u6027 "{0}" \u5728 @XmlType.propOrder \u4E2D\u51FA\u73FE\u4E00\u6B21\u4EE5\u4E0A - -DUPLICATE_PROPERTIES = \u6709\u5169\u500B\u540D\u7A31\u70BA "{0}" \u7684\u7279\u6027 - -XML_ELEMENT_MAPPING_ON_NON_IXMLELEMENT_METHOD = {0} \u65B9\u6CD5\u4E2D\u542B\u6709 @XmlElementMapping, \u4F46\u672A\u50B3\u56DE\u5B50\u985E\u578B JAXBElement. - -# {0} - (xsd) type name. e.g. ns:MyType is not bound to a complex type, and therefore illegal as the scope. -SCOPE_IS_NOT_COMPLEXTYPE = {0} \u672A\u9023\u7D50\u81F3\u8907\u96DC\u985E\u578B, \u56E0\u6B64\u4E0D\u662F\u6709\u6548\u7684\u7BC4\u570D. - -CONFLICTING_XML_ELEMENT_MAPPING = \u5143\u7D20\u540D\u7A31 ''{''{0}''}''{1} \u6709\u4E00\u500B\u4EE5\u4E0A\u7684\u5C0D\u61C9. - -REFERENCE_TO_NON_ELEMENT = \u7279\u6027 {0} \u5DF2\u4F7F\u7528 @XmlReference \u52A0\u8A3B, \u4F46\u672A\u53C3\u7167\u5143\u7D20. - -NON_EXISTENT_ELEMENT_MAPPING = "{0}":"{1}" \u6C92\u6709\u5143\u7D20\u5C0D\u61C9 - -TWO_ATTRIBUTE_WILDCARDS = {0} \u6709\u5169\u500B\u7279\u6027\u542B\u6709 @XmlAnyAttribute \u8A3B\u89E3. - -SUPER_CLASS_HAS_WILDCARD = \u7576\u57FA\u790E\u985E\u5225\u5DF2\u5305\u542B @XmlAnyAttribute \u6642, \u5C31\u4E0D\u80FD\u518D\u4F7F\u7528\u5B83. - -INVALID_ATTRIBUTE_WILDCARD_TYPE = @XmlAnyAttribute \u653E\u7F6E\u65BC\u985E\u578B\u70BA {0} \u7684\u7279\u6027\u4E2D, \u4F46\u5176\u5FC5\u9808\u53EF\u6307\u5B9A\u7D66 java.util.Map. - -PROPERTY_MISSING_FROM_ORDER = \u7279\u6027 {0} \u5B58\u5728, \u4F46\u672A\u65BC @XmlType.propOrder \u4E2D\u6307\u5B9A - -PROPERTY_ORDER_CONTAINS_UNUSED_ENTRY = \u7279\u6027 {0} \u986F\u793A\u65BC @XmlType.propOrder \u4E2D, \u4F46\u6B64\u7279\u6027\u4E0D\u5B58\u5728. \u4E5F\u8A31\u60A8\u6307\u7684\u662F {1}? - -# {1} - (local) type name e.g.: '#foo' is not a valid value for 'NCName' -INVALID_XML_ENUM_VALUE = "{0}" \u4E0D\u662F {1} \u7684\u6709\u6548\u503C. - -NO_IMAGE_WRITER = \u6307\u5B9A\u7684 MIME \u985E\u578B "{0}" \u6C92\u6709\u53EF\u7528\u7684 javax.imageio.ImageWriter - -ILLEGAL_MIME_TYPE = "{0}" \u4E0D\u662F\u6709\u6548\u7684 MIME \u985E\u578B: {1} - -ILLEGAL_ANNOTATION = {0} \u8A3B\u89E3\u4E0D\u53EF\u653E\u7F6E\u65BC\u6B64\u8655 - -MULTIPLE_VALUE_PROPERTY = \u4E00\u500B\u985E\u5225\u53EA\u80FD\u6709\u4E00\u500B @XmlValue, \u4F46\u6709\u5169\u500B\u7279\u6027\u5747\u4F7F\u7528 @XmlValue \u8A3B\u89E3. - -XMLVALUE_IN_DERIVED_TYPE = \u6703\u884D\u751F\u5176\u4ED6\u985E\u5225\u7684\u985E\u5225, \u4E0D\u5141\u8A31\u4F7F\u7528 @XmlValue. - -ELEMENT_AND_VALUE_PROPERTY = \u82E5\u985E\u5225\u5305\u542B @XmlElement \u7279\u6027, \u5247\u4E0D\u5F97\u4F7F\u7528 @XmlValue \u7279\u6027. - -CONFLICTING_XML_TYPE_MAPPING = \u6709\u5169\u500B\u985E\u5225\u542B\u6709\u76F8\u540C\u7684 XML \u985E\u578B\u540D\u7A31 "{0}". \u8ACB\u4F7F\u7528 @XmlType.name \u8207 @XmlType.namespace \u70BA\u5B83\u5011\u6307\u5B9A\u4E0D\u540C\u7684\u540D\u7A31. - -SIMPLE_TYPE_IS_REQUIRED = @XmlAttribute/@XmlValue \u5FC5\u9808\u53C3\u7167\u5C0D\u61C9\u81F3 XML \u4E2D\u6587\u5B57\u7684 Java \u985E\u578B. - -PROPERTY_COLLISION = \u985E\u5225\u6709\u76F8\u540C\u540D\u7A31 "{0}" \u7684\u5169\u500B\u7279\u6027 - -INVALID_IDREF = XmlIDREF \u7279\u6027\u53C3\u7167\u7684\u985E\u578B "{0}" \u672A\u5305\u542B XmlID \u7279\u6027. - -INVALID_XML_ELEMENT_REF = \u7121\u6548\u7684 @XmlElementRef : \u6B64\u76F8\u95DC\u8CC7\u8A0A\u74B0\u5883\u4E0D\u8A8D\u5F97\u985E\u578B "{0}" \u6216\u5176\u4EFB\u4E00\u5B50\u985E\u5225. - -NO_XML_ELEMENT_DECL = \u6C92\u6709\u542B\u6709\u5143\u7D20 ''{''{0}''}''{1} \u4E4B @XmlElementDecl \u7684 ObjectFactory. - -XML_ELEMENT_WRAPPER_ON_NON_COLLECTION = \u53EA\u80FD\u5728\u96C6\u5408\u7279\u6027\u4E2D\u4F7F\u7528 @XmlElementWrapper, \u4F46 "{0}" \u4E0D\u662F\u96C6\u5408\u7279\u6027. - -ANNOTATION_NOT_ALLOWED = \u4E0D\u5141\u8A31\u5728\u6B64\u7A2E\u7279\u6027\u4E2D\u4F7F\u7528 {0} \u8A3B\u89E3. - -XMLLIST_NEEDS_SIMPLETYPE = {0} \u5C0D\u61C9\u81F3\u7D50\u69CB\u5316\u7684 XML \u7247\u6BB5 (\u4EA6\u7A31\u70BA\u8907\u96DC\u985E\u578B), \u56E0\u6B64\u8207 @XmlList \u4E0D\u76F8\u5BB9. - -XMLLIST_ON_SINGLE_PROPERTY = @XmlList \u7121\u6CD5\u653E\u7F6E\u65BC\u55AE\u4E00\u503C\u7279\u6027\u4E2D - -NO_FACTORY_METHOD = \u8655\u7406\u7AD9\u985E\u5225 "{0}" \u672A\u5305\u542B\u975C\u614B\u96F6\u5F15\u6578\u8655\u7406\u7AD9\u65B9\u6CD5 "{1}". - -FACTORY_CLASS_NEEDS_FACTORY_METHOD = XmlType \u672A\u5B9A\u7FA9\u8655\u7406\u7AD9\u985E\u5225 "{0}" \u7684\u8655\u7406\u7AD9\u65B9\u6CD5. - -MISSING_JAXB_PROPERTIES = \u5957\u88DD\u7A0B\u5F0F "{0}" \u907A\u6F0F jaxb.properties \u6A94\u6848. \u60A8\u662F\u5426\u5DF2\u5F9E\u7522\u751F\u7684\u4F86\u6E90\u76EE\u9304\u4E2D\u8907\u88FD\u8A72\u6A94\u6848, \u6216\u5C07\u5176\u5305\u542B\u65BC\u985E\u5225\u8DEF\u5F91\u4E2D? - -TRANSIENT_FIELD_NOT_BINDABLE = \u77AC\u6642\u6B04 "{0}" \u4E0D\u80FD\u5305\u542B\u4EFB\u4F55 JAXB \u8A3B\u89E3. - -THERE_MUST_BE_VALUE_IN_XMLVALUE = \u7269\u4EF6\u7684 @XmlValue \u6B04\u4F4D: {0} \u4E2D\u5FC5\u9808\u542B\u6709\u503C - -INCOMPATIBLE_API_VERSION = \u6B63\u5728\u8F09\u5165 JAXB 2.1 API jar (\u5F9E {0}), \u4F46\u6B64 RI (\u4F86\u81EA {1}) \u9700\u8981 JAXB 2.2 API jar. - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -INCOMPATIBLE_API_VERSION_MUSTANG = \u6B63\u5728\u5F9E\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8F09\u5165\u5668\u8F09\u5165 JAXB 2.1 API, \u4F46\u6B64 RI (\u4F86\u81EA {1}) \u9700\u8981 2.2 API. \u8ACB\u4F7F\u7528\u8A8D\u53EF\u7684\u76EE\u9304\u6A5F\u5236\u4EE5\u5C07 jaxb-api.jar \u653E\u7F6E\u65BC\u555F\u52D5\u5B89\u88DD\u985E\u5225\u8F09\u5165\u5668\u4E2D. (\u8ACB\u53C3\u95B1 http://java.sun.com/j2se/1.6.0/docs/guide/standards/) - -# {0}, {1} - absolute class location e.g. JAXB 2.1 API is being loaded from the bootstrap classloader, but this RI (from jar:file:/c:/foo/bar/jaxb-impl.jar!/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.class) needs 2.2 API. -RUNNING_WITH_1_0_RUNTIME = \u60A8\u6B63\u5728\u5617\u8A66\u57F7\u884C JAXB 2.0 \u7A0B\u5F0F\u5BE6\u969B\u57F7\u884C (\u5F9E {1}), \u4F46\u5148\u524D\u65BC\u985E\u5225\u8DEF\u5F91\u4E2D\u5DF2\u7D93\u6709\u820A\u7684 JAXB 1.0 \u7A0B\u5F0F\u5BE6\u969B\u57F7\u884C (\u4F4D\u65BC {0}). \u8ACB\u79FB\u9664 JAXB 1.0 \u7A0B\u5F0F\u5BE6\u969B\u57F7\u884C, \u4F7F 2.0 \u7A0B\u5F0F\u5BE6\u969B\u57F7\u884C\u80FD\u9806\u5229\u904B\u4F5C. - -UNMATCHABLE_ADAPTER = \u8F49\u63A5\u5668 {0} \u4E0D\u9069\u7528\u65BC\u6B04\u4F4D\u985E\u578B {1}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_INSTANTIATION_EXCEPTION = \u7121\u6CD5\u5EFA\u7ACB\u985E\u5225 {1} \u4E4B AccessorFactory \u7684\u57F7\u884C\u8655\u7406 {0}. - -# {0} - com.sun.xml.internal.bind.XmlAccessorFactory, {1} - class name -ACCESSORFACTORY_ACCESS_EXCEPTION = \u7121\u6CD5\u5B58\u53D6\u985E\u5225 {1} \u4E4B AccessorFactory \u7684\u57F7\u884C\u8655\u7406 {0}. - -CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR = \u81EA\u8A02\u7684 AccessorFactory {0} \u6B63\u5728\u56DE\u5831\u5B58\u53D6\u7279\u6027\u7684\u932F\u8AA4. {1} - -CUSTOM_ACCESSORFACTORY_FIELD_ERROR = \u81EA\u8A02\u7684 AccessorFactory {0} \u6B63\u5728\u56DE\u5831\u5B58\u53D6\u6B04\u4F4D\u7684\u932F\u8AA4. {1} - -ANONYMOUS_ARRAY_ITEM = {0} \u6703\u7576\u4F5C\u9663\u5217\u5143\u4EF6\u985E\u578B\u4F7F\u7528, \u56E0\u6B64\u4E0D\u53EF\u4EE5\u533F\u540D. - -XMLGREGORIANCALENDAR_INVALID = XMLGregorianCalendar \u985E\u578B {0} \u8A2D\u5B9A\u4E86\u7121\u6548\u7684\u6B04\u4F4D\u96C6. - -XMLGREGORIANCALENDAR_SEC = \u672A\u8A2D\u5B9A\u300C\u79D2\u300D. - -XMLGREGORIANCALENDAR_MIN = \u672A\u8A2D\u5B9A\u300C\u5206\u300D. - -XMLGREGORIANCALENDAR_HR = \u672A\u8A2D\u5B9A\u300C\u6642\u300D. - -XMLGREGORIANCALENDAR_DAY = \u672A\u8A2D\u5B9A\u300C\u65E5\u671F\u300D. - -XMLGREGORIANCALENDAR_MONTH = \u672A\u8A2D\u5B9A\u300C\u6708\u4EFD\u300D. - -XMLGREGORIANCALENDAR_YEAR = \u672A\u8A2D\u5B9A\u300C\u5E74\u4EFD\u300D. - -XMLGREGORIANCALENDAR_TIMEZONE = \u672A\u8A2D\u5B9A\u300C\u6642\u5340\u300D. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/ModelBuilder.java 2018-01-30 20:32:20.000000000 -0500 +++ /dev/null 2018-01-30 20:32:20.000000000 -0500 @@ -1,485 +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.bind.v2.model.impl; - -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlAttachmentRef; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.bind.annotation.XmlSeeAlso; -import javax.xml.bind.annotation.XmlTransient; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.util.Which; -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.annotation.ClassLocatable; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.ClassInfo; -import com.sun.xml.internal.bind.v2.model.core.ErrorHandler; -import com.sun.xml.internal.bind.v2.model.core.LeafInfo; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.Ref; -import com.sun.xml.internal.bind.v2.model.core.RegistryInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.WhiteSpaceProcessor; - -/** - * Builds a {@link TypeInfoSet} (a set of JAXB properties) - * by using {@link ElementInfoImpl} and {@link ClassInfoImpl}. - * from annotated Java classes. - * - *

- * This class uses {@link Navigator} and {@link AnnotationReader} to - * work with arbitrary annotation source and arbitrary Java model. - * For this purpose this class is parameterized. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class ModelBuilder implements ModelBuilderI { - private static final Logger logger; - - /** - * {@link TypeInfo}s that are built will go into this set. - */ - final TypeInfoSetImpl typeInfoSet; - - public final AnnotationReader reader; - - public final Navigator nav; - - /** - * Used to detect collisions among global type names. - */ - private final Map typeNames = new HashMap(); - - /** - * JAXB doesn't want to use namespaces unless we are told to, but WS-I BP - * conformace requires JAX-RPC to always use a non-empty namespace URI. - * (see http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#WSDLTYPES R2105) - * - *

- * To work around this issue, we allow the use of the empty namespaces to be - * replaced by a particular designated namespace URI. - * - *

- * This field keeps the value of that replacing namespace URI. - * When there's no replacement, this field is set to "". - */ - public final String defaultNsUri; - - - /** - * Packages whose registries are already added. - */ - /*package*/ final Map> registries - = new HashMap>(); - - private final Map subclassReplacements; - - /** - * @see #setErrorHandler - */ - private ErrorHandler errorHandler; - private boolean hadError; - - /** - * Set to true if the model includes {@link XmlAttachmentRef}. JAX-WS - * needs to know this information. - */ - public boolean hasSwaRef; - - private final ErrorHandler proxyErrorHandler = new ErrorHandler() { - public void error(IllegalAnnotationException e) { - reportError(e); - } - }; - - public ModelBuilder( - AnnotationReader reader, - Navigator navigator, - Map subclassReplacements, - String defaultNamespaceRemap - ) { - - this.reader = reader; - this.nav = navigator; - this.subclassReplacements = subclassReplacements; - if(defaultNamespaceRemap==null) - defaultNamespaceRemap = ""; - this.defaultNsUri = defaultNamespaceRemap; - reader.setErrorHandler(proxyErrorHandler); - typeInfoSet = createTypeInfoSet(); - } - - /** - * Makes sure that we are running with 2.1 JAXB API, - * and report an error if not. - */ - static { - try { - XmlSchema s = null; - s.location(); - } catch (NullPointerException e) { - // as epxected - } catch (NoSuchMethodError e) { - // this is not a 2.1 API. Where is it being loaded from? - Messages res; - if (SecureLoader.getClassClassLoader(XmlSchema.class) == null) { - res = Messages.INCOMPATIBLE_API_VERSION_MUSTANG; - } else { - res = Messages.INCOMPATIBLE_API_VERSION; - } - - throw new LinkageError( res.format( - Which.which(XmlSchema.class), - Which.which(ModelBuilder.class) - )); - } - } - - /** - * Makes sure that we don't have conflicting 1.0 runtime, - * and report an error if we do. - */ - static { - try { - WhiteSpaceProcessor.isWhiteSpace("xyz"); - } catch (NoSuchMethodError e) { - // we seem to be getting 1.0 runtime - throw new LinkageError( Messages.RUNNING_WITH_1_0_RUNTIME.format( - Which.which(WhiteSpaceProcessor.class), - Which.which(ModelBuilder.class) - )); - } - } - - /** - * Logger init - */ - static { - logger = Logger.getLogger(ModelBuilder.class.getName()); - } - - protected TypeInfoSetImpl createTypeInfoSet() { - return new TypeInfoSetImpl(nav,reader,BuiltinLeafInfoImpl.createLeaves(nav)); - } - - /** - * Builds a JAXB {@link ClassInfo} model from a given class declaration - * and adds that to this model owner. - * - *

- * Return type is either {@link ClassInfo} or {@link LeafInfo} (for types like - * {@link String} or {@link Enum}-derived ones) - */ - public NonElement getClassInfo( C clazz, Locatable upstream ) { - return getClassInfo(clazz,false,upstream); - } - - /** - * For limited cases where the caller needs to search for a super class. - * This is necessary because we don't want {@link #subclassReplacements} - * to kick in for the super class search, which will cause infinite recursion. - */ - public NonElement getClassInfo( C clazz, boolean searchForSuperClass, Locatable upstream ) { - assert clazz!=null; - NonElement r = typeInfoSet.getClassInfo(clazz); - if(r!=null) - return r; - - if(nav.isEnum(clazz)) { - EnumLeafInfoImpl li = createEnumLeafInfo(clazz,upstream); - typeInfoSet.add(li); - r = li; - addTypeName(r); - } else { - boolean isReplaced = subclassReplacements.containsKey(clazz); - if(isReplaced && !searchForSuperClass) { - // handle it as if the replacement was specified - r = getClassInfo(subclassReplacements.get(clazz),upstream); - } else - if(reader.hasClassAnnotation(clazz,XmlTransient.class) || isReplaced) { - // handle it as if the base class was specified - r = getClassInfo( nav.getSuperClass(clazz), searchForSuperClass, - new ClassLocatable(upstream,clazz,nav) ); - } else { - ClassInfoImpl ci = createClassInfo(clazz,upstream); - typeInfoSet.add(ci); - - // compute the closure by eagerly expanding references - for( PropertyInfo p : ci.getProperties() ) { - if(p.kind()== PropertyKind.REFERENCE) { - // make sure that we have a registry for this package - addToRegistry(clazz, (Locatable) p); - Class[] prmzdClasses = getParametrizedTypes(p); - if (prmzdClasses != null) { - for (Class prmzdClass : prmzdClasses) { - if (prmzdClass != clazz) { - addToRegistry((C) prmzdClass, (Locatable) p); - } - } - } - } - - for( TypeInfo t : p.ref() ) - ; // just compute a reference should be suffice - } - ci.getBaseClass(); // same as above. - - r = ci; - addTypeName(r); - } - } - - - // more reference closure expansion. @XmlSeeAlso - XmlSeeAlso sa = reader.getClassAnnotation(XmlSeeAlso.class, clazz, upstream); - if(sa!=null) { - for( T t : reader.getClassArrayValue(sa,"value") ) { - getTypeInfo(t,(Locatable)sa); - } - } - - - return r; - } - - /** - * Adding package's ObjectFactory methods to registry - * @param clazz which package will be used - * @param p location - */ - private void addToRegistry(C clazz, Locatable p) { - String pkg = nav.getPackageName(clazz); - if (!registries.containsKey(pkg)) { - // insert the package's object factory - C c = nav.loadObjectFactory(clazz, pkg); - if (c != null) - addRegistry(c, p); - } - } - - /** - * Getting parametrized classes of {@code JAXBElement<...>} property - * @param p property which parametrized types we will try to get - * @return null - if it's not JAXBElement property, or it's not parametrized, and array of parametrized classes in other case - */ - private Class[] getParametrizedTypes(PropertyInfo p) { - try { - Type pType = ((RuntimePropertyInfo) p).getIndividualType(); - if (pType instanceof ParameterizedType) { - ParameterizedType prmzdType = (ParameterizedType) pType; - if (prmzdType.getRawType() == JAXBElement.class) { - Type[] actualTypes = prmzdType.getActualTypeArguments(); - Class[] result = new Class[actualTypes.length]; - for (int i = 0; i < actualTypes.length; i++) { - result[i] = (Class) actualTypes[i]; - } - return result; - } - } - } catch (Exception e) { - logger.log(Level.FINE, "Error in ModelBuilder.getParametrizedTypes. " + e.getMessage()); - } - return null; - } - - /** - * Checks the uniqueness of the type name. - */ - private void addTypeName(NonElement r) { - QName t = r.getTypeName(); - if(t==null) return; - - TypeInfo old = typeNames.put(t,r); - if(old!=null) { - // collision - reportError(new IllegalAnnotationException( - Messages.CONFLICTING_XML_TYPE_MAPPING.format(r.getTypeName()), - old, r )); - } - } - - /** - * Have the builder recognize the type (if it hasn't done so yet), - * and returns a {@link NonElement} that represents it. - * - * @return - * always non-null. - */ - public NonElement getTypeInfo(T t,Locatable upstream) { - NonElement r = typeInfoSet.getTypeInfo(t); - if(r!=null) return r; - - if(nav.isArray(t)) { // no need for checking byte[], because above typeInfoset.getTypeInfo() would return non-null - ArrayInfoImpl ai = - createArrayInfo(upstream, t); - addTypeName(ai); - typeInfoSet.add(ai); - return ai; - } - - C c = nav.asDecl(t); - assert c!=null : t.toString()+" must be a leaf, but we failed to recognize it."; - return getClassInfo(c,upstream); - } - - /** - * This method is used to add a root reference to a model. - */ - public NonElement getTypeInfo(Ref ref) { - // TODO: handle XmlValueList - assert !ref.valueList; - C c = nav.asDecl(ref.type); - if(c!=null && reader.getClassAnnotation(XmlRegistry.class,c,null/*TODO: is this right?*/)!=null) { - if(!registries.containsKey(nav.getPackageName(c))) - addRegistry(c,null); - return null; // TODO: is this correct? - } else - return getTypeInfo(ref.type,null); - } - - - protected EnumLeafInfoImpl createEnumLeafInfo(C clazz,Locatable upstream) { - return new EnumLeafInfoImpl(this,upstream,clazz,nav.use(clazz)); - } - - protected ClassInfoImpl createClassInfo(C clazz, Locatable upstream ) { - return new ClassInfoImpl(this,upstream,clazz); - } - - protected ElementInfoImpl createElementInfo( - RegistryInfoImpl registryInfo, M m) throws IllegalAnnotationException { - return new ElementInfoImpl(this,registryInfo,m); - } - - protected ArrayInfoImpl createArrayInfo(Locatable upstream, T arrayType) { - return new ArrayInfoImpl(this,upstream,arrayType); - } - - - /** - * Visits a class with {@link XmlRegistry} and records all the element mappings - * in it. - */ - public RegistryInfo addRegistry(C registryClass, Locatable upstream ) { - return new RegistryInfoImpl(this,upstream,registryClass); - } - - /** - * Gets a {@link RegistryInfo} for the given package. - * - * @return - * null if no registry exists for the package. - * unlike other getXXX methods on this class, - * this method is side-effect free. - */ - public RegistryInfo getRegistry(String packageName) { - return registries.get(packageName); - } - - private boolean linked; - - /** - * Called after all the classes are added to the type set - * to "link" them together. - * - *

- * Don't expose implementation classes in the signature. - * - * @return - * fully built {@link TypeInfoSet} that represents the model, - * or null if there was an error. - */ - public TypeInfoSet link() { - - assert !linked; - linked = true; - - for( ElementInfoImpl ei : typeInfoSet.getAllElements() ) - ei.link(); - - for( ClassInfoImpl ci : typeInfoSet.beans().values() ) - ci.link(); - - for( EnumLeafInfoImpl li : typeInfoSet.enums().values() ) - li.link(); - - if(hadError) - return null; - else - return typeInfoSet; - } - -// -// -// error handling -// -// - - /** - * Sets the error handler that receives errors discovered during the model building. - * - * @param errorHandler - * can be null. - */ - public void setErrorHandler(ErrorHandler errorHandler) { - this.errorHandler = errorHandler; - } - - public final void reportError(IllegalAnnotationException e) { - hadError = true; - if(errorHandler!=null) - errorHandler.error(e); - } - - public boolean isReplaced(C sc) { - return subclassReplacements.containsKey(sc); - } - - @Override - public Navigator getNavigator() { - return nav; - } - - @Override - public AnnotationReader getReader() { - return reader; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/ModelBuilderI.java 2018-01-30 20:32:21.000000000 -0500 +++ /dev/null 2018-01-30 20:32:21.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2005, 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.bind.v2.model.impl; - -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -/** - * User: Iaroslav Savytskyi - * Date: 24/05/12 - */ -public interface ModelBuilderI { - - Navigator getNavigator(); - - AnnotationReader getReader(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/PropertyInfoImpl.java 2018-01-30 20:32:21.000000000 -0500 +++ /dev/null 2018-01-30 20:32:22.000000000 -0500 @@ -1,386 +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.xml.internal.bind.v2.model.impl; - -import java.util.Collection; -import java.lang.annotation.Annotation; - -import javax.activation.MimeType; -import javax.xml.bind.annotation.XmlAttachmentRef; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlID; -import javax.xml.bind.annotation.XmlIDREF; -import javax.xml.bind.annotation.XmlInlineBinaryData; -import javax.xml.bind.annotation.XmlMimeType; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapters; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.TODO; -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.Adapter; -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.Location; -import com.sun.xml.internal.bind.v2.runtime.SwaRefAdapter; - -/** - * Default partial implementation for {@link PropertyInfo}. - * - * @author Kohsuke Kawaguchi - */ -abstract class PropertyInfoImpl - implements PropertyInfo, Locatable, Comparable /*by their names*/ { - - /** - * Object that reads annotations. - */ - protected final PropertySeed seed; - - private final boolean isCollection; - - private final ID id; - - private final MimeType expectedMimeType; - private final boolean inlineBinary; - private final QName schemaType; - - protected final ClassInfoImpl parent; - - private final Adapter adapter; - - protected PropertyInfoImpl(ClassInfoImpl parent, PropertySeed spi) { - this.seed = spi; - this.parent = parent; - - if(parent==null) - /* - Various people reported a bug where this parameter is somehow null. - In an attempt to catch the error better, let's do an explicit check here. - - http://forums.java.net/jive/thread.jspa?threadID=18479 - http://forums.java.net/jive/thread.jspa?messageID=165946 - */ - throw new AssertionError(); - - MimeType mt = Util.calcExpectedMediaType(seed,parent.builder); - if(mt!=null && !kind().canHaveXmlMimeType) { - parent.builder.reportError(new IllegalAnnotationException( - Messages.ILLEGAL_ANNOTATION.format(XmlMimeType.class.getName()), - seed.readAnnotation(XmlMimeType.class) - )); - mt = null; - } - this.expectedMimeType = mt; - this.inlineBinary = seed.hasAnnotation(XmlInlineBinaryData.class); - - T t = seed.getRawType(); - - // check if there's an adapter applicable to the whole property - XmlJavaTypeAdapter xjta = getApplicableAdapter(t); - if(xjta!=null) { - isCollection = false; - adapter = new Adapter(xjta,reader(),nav()); - } else { - // check if the adapter is applicable to the individual item in the property - - this.isCollection = nav().isSubClassOf(t, nav().ref(Collection.class)) - || nav().isArrayButNotByteArray(t); - - xjta = getApplicableAdapter(getIndividualType()); - if(xjta==null) { - // ugly ugly hack, but we implement swaRef as adapter - XmlAttachmentRef xsa = seed.readAnnotation(XmlAttachmentRef.class); - if(xsa!=null) { - parent.builder.hasSwaRef = true; - adapter = new Adapter(nav().asDecl(SwaRefAdapter.class),nav()); - } else { - adapter = null; - - // if this field has adapter annotation but not applicable, - // that must be an error of the user - xjta = seed.readAnnotation(XmlJavaTypeAdapter.class); - if(xjta!=null) { - T ad = reader().getClassValue(xjta,"value"); - parent.builder.reportError(new IllegalAnnotationException( - Messages.UNMATCHABLE_ADAPTER.format( - nav().getTypeName(ad), nav().getTypeName(t)), - xjta - )); - } - } - } else { - adapter = new Adapter(xjta,reader(),nav()); - } - } - - this.id = calcId(); - this.schemaType = Util.calcSchemaType(reader(),seed,parent.clazz, - getIndividualType(),this); - } - - - public ClassInfoImpl parent() { - return parent; - } - - protected final Navigator nav() { - return parent.nav(); - } - protected final AnnotationReader reader() { - return parent.reader(); - } - - public T getRawType() { - return seed.getRawType(); - } - - public T getIndividualType() { - if(adapter!=null) - return adapter.defaultType; - T raw = getRawType(); - if(!isCollection()) { - return raw; - } else { - if(nav().isArrayButNotByteArray(raw)) - return nav().getComponentType(raw); - - T bt = nav().getBaseClass(raw, nav().asDecl(Collection.class) ); - if(nav().isParameterizedType(bt)) - return nav().getTypeArgument(bt,0); - else - return nav().ref(Object.class); - } - } - - public final String getName() { - return seed.getName(); - } - - /** - * Checks if the given adapter is applicable to the declared property type. - */ - private boolean isApplicable(XmlJavaTypeAdapter jta, T declaredType ) { - if(jta==null) return false; - - T type = reader().getClassValue(jta,"type"); - if(nav().isSameType(declaredType, type)) - return true; // for types explicitly marked in XmlJavaTypeAdapter.type() - - T ad = reader().getClassValue(jta,"value"); - T ba = nav().getBaseClass(ad, nav().asDecl(XmlAdapter.class)); - if(!nav().isParameterizedType(ba)) - return true; // can't check type applicability. assume Object, which means applicable to any. - T inMemType = nav().getTypeArgument(ba, 1); - - return nav().isSubClassOf(declaredType,inMemType); - } - - private XmlJavaTypeAdapter getApplicableAdapter(T type) { - XmlJavaTypeAdapter jta = seed.readAnnotation(XmlJavaTypeAdapter.class); - if(jta!=null && isApplicable(jta,type)) - return jta; - - // check the applicable adapters on the package - XmlJavaTypeAdapters jtas = reader().getPackageAnnotation(XmlJavaTypeAdapters.class, parent.clazz, seed ); - if(jtas!=null) { - for (XmlJavaTypeAdapter xjta : jtas.value()) { - if(isApplicable(xjta,type)) - return xjta; - } - } - jta = reader().getPackageAnnotation(XmlJavaTypeAdapter.class, parent.clazz, seed ); - if(isApplicable(jta,type)) - return jta; - - // then on the target class - C refType = nav().asDecl(type); - if(refType!=null) { - jta = reader().getClassAnnotation(XmlJavaTypeAdapter.class, refType, seed ); - if(jta!=null && isApplicable(jta,type)) // the one on the type always apply. - return jta; - } - - return null; - } - - /** - * This is the default implementation of the getAdapter method - * defined on many of the {@link PropertyInfo}-derived classes. - */ - public Adapter getAdapter() { - return adapter; - } - - - public final String displayName() { - return nav().getClassName(parent.getClazz())+'#'+getName(); - } - - public final ID id() { - return id; - } - - private ID calcId() { - if(seed.hasAnnotation(XmlID.class)) { - // check the type - if(!nav().isSameType(getIndividualType(), nav().ref(String.class))) - parent.builder.reportError(new IllegalAnnotationException( - Messages.ID_MUST_BE_STRING.format(getName()), seed ) - ); - return ID.ID; - } else - if(seed.hasAnnotation(XmlIDREF.class)) { - return ID.IDREF; - } else { - return ID.NONE; - } - } - - public final MimeType getExpectedMimeType() { - return expectedMimeType; - } - - public final boolean inlineBinaryData() { - return inlineBinary; - } - - public final QName getSchemaType() { - return schemaType; - } - - public final boolean isCollection() { - return isCollection; - } - - /** - * Called after all the {@link TypeInfo}s are collected into the governing {@link TypeInfoSet}. - * - * Derived class can do additional actions to complete the model. - */ - protected void link() { - if(id==ID.IDREF) { - // make sure that the refereced type has ID - for (TypeInfo ti : ref()) { - if(!ti.canBeReferencedByIDREF()) - parent.builder.reportError(new IllegalAnnotationException( - Messages.INVALID_IDREF.format( - parent.builder.nav.getTypeName(ti.getType())), this )); - } - } - } - - /** - * A {@link PropertyInfoImpl} is always referenced by its enclosing class, - * so return that as the upstream. - */ - public Locatable getUpstream() { - return parent; - } - - public Location getLocation() { - return seed.getLocation(); - } - - -// -// -// convenience methods for derived classes -// -// - - - /** - * Computes the tag name from a {@link XmlElement} by taking the defaulting into account. - */ - protected final QName calcXmlName(XmlElement e) { - if(e!=null) - return calcXmlName(e.namespace(),e.name()); - else - return calcXmlName("##default","##default"); - } - - /** - * Computes the tag name from a {@link XmlElementWrapper} by taking the defaulting into account. - */ - protected final QName calcXmlName(XmlElementWrapper e) { - if(e!=null) - return calcXmlName(e.namespace(),e.name()); - else - return calcXmlName("##default","##default"); - } - - private QName calcXmlName(String uri,String local) { - // compute the default - TODO.checkSpec(); - if(local.length()==0 || local.equals("##default")) - local = seed.getName(); - if(uri.equals("##default")) { - XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this ); - // JAX-RPC doesn't want the default namespace URI swapping to take effect to - // local "unqualified" elements. UGLY. - if(xs!=null) { - switch(xs.elementFormDefault()) { - case QUALIFIED: - QName typeName = parent.getTypeName(); - if(typeName!=null) - uri = typeName.getNamespaceURI(); - else - uri = xs.namespace(); - if(uri.length()==0) - uri = parent.builder.defaultNsUri; - break; - case UNQUALIFIED: - case UNSET: - uri = ""; - } - } else { - uri = ""; - } - } - return new QName(uri.intern(),local.intern()); - } - - public int compareTo(PropertyInfoImpl that) { - return this.getName().compareTo(that.getName()); - } - - public final A readAnnotation(Class annotationType) { - return seed.readAnnotation(annotationType); - } - - public final boolean hasAnnotation(Class annotationType) { - return seed.hasAnnotation(annotationType); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/PropertySeed.java 2018-01-30 20:32:22.000000000 -0500 +++ /dev/null 2018-01-30 20:32:22.000000000 -0500 @@ -1,60 +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.xml.internal.bind.v2.model.impl; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationSource; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; - -/** - * Exposes the core information that forms a {@link PropertyInfo}. - */ -interface PropertySeed extends Locatable, AnnotationSource { - - /** - * The name of the property is a spec defined concept --- although it doesn't do - * so explicitly in anywhere. - * - * @see PropertyInfo#getName() - */ - String getName(); - - - /** - * Gets the actual data type of the field. - * - *

- * The data of the property is stored by using this type. - * - *

- * The difference between the {@link RuntimePropertyInfo#getIndividualType()} - * and this method is clear when the property is a multi-value property. - * The {@link RuntimePropertyInfo#getIndividualType()} method returns the type of the item, - * but this method returns the actual collection type. - */ - T getRawType(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/ReferencePropertyInfoImpl.java 2018-01-30 20:32:23.000000000 -0500 +++ /dev/null 2018-01-30 20:32:23.000000000 -0500 @@ -1,392 +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.bind.v2.model.impl; - -import java.util.Collections; -import java.util.LinkedHashSet; -import java.util.Set; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlElementRefs; -import javax.xml.bind.annotation.XmlMixed; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.bind.annotation.XmlNsForm; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.core.ClassInfo; -import com.sun.xml.internal.bind.v2.model.core.Element; -import com.sun.xml.internal.bind.v2.model.core.ElementInfo; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.WildcardMode; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import java.util.Iterator; - -/** - * Implementation of {@link ReferencePropertyInfo}. - * - * @author Kohsuke Kawaguchi - */ -class ReferencePropertyInfoImpl - extends ERPropertyInfoImpl - implements ReferencePropertyInfo, DummyPropertyInfo -{ - /** - * Lazily computed. - * @see #getElements() - */ - private Set> types; - private Set> subTypes = new LinkedHashSet>(); - - private final boolean isMixed; - - private final WildcardMode wildcard; - private final C domHandler; - /** - * Lazily computed. - * @see #isRequired() - */ - private Boolean isRequired; - - public ReferencePropertyInfoImpl( - ClassInfoImpl classInfo, - PropertySeed seed) { - - super(classInfo, seed); - - isMixed = seed.readAnnotation(XmlMixed.class) != null; - - XmlAnyElement xae = seed.readAnnotation(XmlAnyElement.class); - if(xae==null) { - wildcard = null; - domHandler = null; - } else { - wildcard = xae.lax()?WildcardMode.LAX:WildcardMode.SKIP; - domHandler = nav().asDecl(reader().getClassValue(xae,"value")); - } - } - - public Set> ref() { - return getElements(); - } - - public PropertyKind kind() { - return PropertyKind.REFERENCE; - } - - public Set> getElements() { - if(types==null) - calcTypes(false); - assert types!=null; - return types; - } - - /** - * Compute {@link #types}. - * - * @param last - * if true, every {@link XmlElementRef} must yield at least one type. - */ - private void calcTypes(boolean last) { - XmlElementRef[] ann; - types = new LinkedHashSet>(); - XmlElementRefs refs = seed.readAnnotation(XmlElementRefs.class); - XmlElementRef ref = seed.readAnnotation(XmlElementRef.class); - - if(refs!=null && ref!=null) { - parent.builder.reportError(new IllegalAnnotationException( - Messages.MUTUALLY_EXCLUSIVE_ANNOTATIONS.format( - nav().getClassName(parent.getClazz())+'#'+seed.getName(), - ref.annotationType().getName(), refs.annotationType().getName()), - ref, refs )); - } - - if(refs!=null) - ann = refs.value(); - else { - if(ref!=null) - ann = new XmlElementRef[]{ref}; - else - ann = null; - } - - isRequired = !isCollection(); // this is by default, to remain compatible with 2.1 - - if(ann!=null) { - Navigator nav = nav(); - AnnotationReader reader = reader(); - - final T defaultType = nav.ref(XmlElementRef.DEFAULT.class); - final C je = nav.asDecl(JAXBElement.class); - - for( XmlElementRef r : ann ) { - boolean yield; - T type = reader.getClassValue(r,"type"); - if(nav().isSameType(type, defaultType)) - type = nav.erasure(getIndividualType()); - if(nav.getBaseClass(type,je)!=null) - yield = addGenericElement(r); - else - yield = addAllSubtypes(type); - - // essentially "isRequired &= isRequired(r)" except that we'd like to skip evaluating isRequird(r) - // if the value is already false. - if(isRequired && !isRequired(r)) - isRequired = false; - - if(last && !yield) { - // a reference didn't produce any type. - // diagnose the problem - if(nav().isSameType(type, nav.ref(JAXBElement.class))) { - // no XmlElementDecl - parent.builder.reportError(new IllegalAnnotationException( - Messages.NO_XML_ELEMENT_DECL.format( - getEffectiveNamespaceFor(r), r.name()), - this - )); - } else { - parent.builder.reportError(new IllegalAnnotationException( - Messages.INVALID_XML_ELEMENT_REF.format(type),this)); - } - - // reporting one error would do. - // often the element ref field is using @XmlElementRefs - // to point to multiple JAXBElements. - // reporting one error for each @XmlElemetnRef is thus often redundant. - return; - } - } - } - - for (ReferencePropertyInfoImpl info : subTypes) { - PropertySeed sd = info.seed; - refs = sd.readAnnotation(XmlElementRefs.class); - ref = sd.readAnnotation(XmlElementRef.class); - - if (refs != null && ref != null) { - parent.builder.reportError(new IllegalAnnotationException( - Messages.MUTUALLY_EXCLUSIVE_ANNOTATIONS.format( - nav().getClassName(parent.getClazz())+'#'+seed.getName(), - ref.annotationType().getName(), refs.annotationType().getName()), - ref, refs )); - } - - if (refs != null) { - ann = refs.value(); - } else { - if (ref != null) { - ann = new XmlElementRef[]{ref}; - } else { - ann = null; - } - } - - if (ann != null) { - Navigator nav = nav(); - AnnotationReader reader = reader(); - - final T defaultType = nav.ref(XmlElementRef.DEFAULT.class); - final C je = nav.asDecl(JAXBElement.class); - - for( XmlElementRef r : ann ) { - boolean yield; - T type = reader.getClassValue(r,"type"); - if (nav().isSameType(type, defaultType)) { - type = nav.erasure(getIndividualType()); - } - if (nav.getBaseClass(type,je) != null) { - yield = addGenericElement(r, info); - - } else { - yield = addAllSubtypes(type); - } - - if(last && !yield) { - // a reference didn't produce any type. - // diagnose the problem - if(nav().isSameType(type, nav.ref(JAXBElement.class))) { - // no XmlElementDecl - parent.builder.reportError(new IllegalAnnotationException( - Messages.NO_XML_ELEMENT_DECL.format( - getEffectiveNamespaceFor(r), r.name()), - this - )); - } else { - parent.builder.reportError(new IllegalAnnotationException( - Messages.INVALID_XML_ELEMENT_REF.format(),this)); - } - - // reporting one error would do. - // often the element ref field is using @XmlElementRefs - // to point to multiple JAXBElements. - // reporting one error for each @XmlElemetnRef is thus often redundant. - return; - } - } - } - } - - types = Collections.unmodifiableSet(types); - } - - public boolean isRequired() { - if(isRequired==null) - calcTypes(false); - return isRequired; - } - - /** - * If we find out that we are working with 2.1 API, remember the fact so that - * we don't waste time generating exceptions every time we call {@link #isRequired(XmlElementRef)}. - */ - private static boolean is2_2 = true; - - /** - * Reads the value of {@code XmlElementRef.required()}. - * - * If we are working as 2.1 RI, this defaults to true. - */ - private boolean isRequired(XmlElementRef ref) { - if(!is2_2) return true; - - try { - return ref.required(); - } catch(LinkageError e) { - is2_2 = false; - return true; // the value defaults to true - } - } - - /** - * @return - * true if the reference yields at least one type - */ - private boolean addGenericElement(XmlElementRef r) { - String nsUri = getEffectiveNamespaceFor(r); - // TODO: check spec. defaulting of localName. - return addGenericElement(parent.owner.getElementInfo(parent.getClazz(),new QName(nsUri,r.name()))); - } - - private boolean addGenericElement(XmlElementRef r, ReferencePropertyInfoImpl info) { - String nsUri = info.getEffectiveNamespaceFor(r); - ElementInfo ei = parent.owner.getElementInfo(info.parent.getClazz(), new QName(nsUri, r.name())); - types.add(ei); - return true; - } - - private String getEffectiveNamespaceFor(XmlElementRef r) { - String nsUri = r.namespace(); - - XmlSchema xs = reader().getPackageAnnotation( XmlSchema.class, parent.getClazz(), this ); - if(xs!=null && xs.attributeFormDefault()== XmlNsForm.QUALIFIED) { - // JAX-RPC doesn't want the default namespace URI swapping to take effect to - // local "unqualified" elements. UGLY. - if(nsUri.length()==0) - nsUri = parent.builder.defaultNsUri; - } - - return nsUri; - } - - private boolean addGenericElement(ElementInfo ei) { - if(ei==null) - return false; - types.add(ei); - for( ElementInfo subst : ei.getSubstitutionMembers() ) - addGenericElement(subst); - return true; - } - - private boolean addAllSubtypes(T type) { - Navigator nav = nav(); - - // this allows the explicitly referenced type to be sucked in to the model - NonElement t = parent.builder.getClassInfo(nav.asDecl(type),this); - if(!(t instanceof ClassInfo)) - // this is leaf. - return false; - - boolean result = false; - - ClassInfo c = (ClassInfo) t; - if(c.isElement()) { - types.add(c.asElement()); - result = true; - } - - // look for other possible types - for( ClassInfo ci : parent.owner.beans().values() ) { - if(ci.isElement() && nav.isSubClassOf(ci.getType(),type)) { - types.add(ci.asElement()); - result = true; - } - } - - // don't allow local elements to substitute. - for( ElementInfo ei : parent.owner.getElementMappings(null).values()) { - if(nav.isSubClassOf(ei.getType(),type)) { - types.add(ei); - result = true; - } - } - - return result; - } - - - @Override - protected void link() { - super.link(); - - // until we get the whole thing into TypeInfoSet, - // we never really know what are all the possible types that can be assigned on this field. - // so recompute this value when we have all the information. - calcTypes(true); - - } - - public final void addType(PropertyInfoImpl info) { - //noinspection unchecked - subTypes.add((ReferencePropertyInfoImpl)info); - } - - public final boolean isMixed() { - return isMixed; - } - - public final WildcardMode getWildcard() { - return wildcard; - } - - public final C getDOMHandler() { - return domHandler; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RegistryInfoImpl.java 2018-01-30 20:32:24.000000000 -0500 +++ /dev/null 2018-01-30 20:32:24.000000000 -0500 @@ -1,133 +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.xml.internal.bind.v2.model.impl; - -import java.util.LinkedHashSet; -import java.util.Set; - -import javax.xml.bind.annotation.XmlElementDecl; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.annotation.MethodLocatable; -import com.sun.xml.internal.bind.v2.model.core.RegistryInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.Location; -import com.sun.xml.internal.bind.v2.ContextFactory; - -/** - * Implementation of {@link RegistryInfo}. - * - * @author Kohsuke Kawaguchi - */ -// experimenting with shorter type parameters for quadruple. -// the idea is that they show so often that you'd understand the meaning -// without relying on the whole name. -final class RegistryInfoImpl implements Locatable, RegistryInfo { - - final C registryClass; - private final Locatable upstream; - private final Navigator nav; - - /** - * Types that are referenced from this registry. - */ - private final Set> references = new LinkedHashSet>(); - - /** - * Picks up references in this registry to other types. - */ - RegistryInfoImpl(ModelBuilder builder, Locatable upstream, C registryClass) { - this.nav = builder.nav; - this.registryClass = registryClass; - this.upstream = upstream; - builder.registries.put(getPackageName(),this); - - if(nav.getDeclaredField(registryClass,ContextFactory.USE_JAXB_PROPERTIES)!=null) { - // the user is trying to use ObjectFactory that we generate for interfaces, - // that means he's missing jaxb.properties - builder.reportError(new IllegalAnnotationException( - Messages.MISSING_JAXB_PROPERTIES.format(getPackageName()), - this - )); - // looking at members will only add more errors, so just abort now - return; - } - - for( M m : nav.getDeclaredMethods(registryClass) ) { - XmlElementDecl em = builder.reader.getMethodAnnotation( - XmlElementDecl.class, m, this ); - - if(em==null) { - if(nav.getMethodName(m).startsWith("create")) { - // this is a factory method. visit this class - references.add( - builder.getTypeInfo(nav.getReturnType(m), - new MethodLocatable(this,m,nav))); - } - - continue; - } - - ElementInfoImpl ei; - try { - ei = builder.createElementInfo(this,m); - } catch (IllegalAnnotationException e) { - builder.reportError(e); - continue; // recover by ignoring this element - } - - // register this mapping - // TODO: any chance this could cause a stack overflow (by recursively visiting classes)? - builder.typeInfoSet.add(ei,builder); - references.add(ei); - } - } - - public Locatable getUpstream() { - return upstream; - } - - public Location getLocation() { - return nav.getClassLocation(registryClass); - } - - public Set> getReferences() { - return references; - } - - /** - * Gets the name of the package that this registry governs. - */ - public String getPackageName() { - return nav.getPackageName(registryClass); - } - - public C getClazz() { - return registryClass; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeAnyTypeImpl.java 2018-01-30 20:32:24.000000000 -0500 +++ /dev/null 2018-01-30 20:32:24.000000000 -0500 @@ -1,47 +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.bind.v2.model.impl; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.runtime.Transducer; - -/** - * @author Kohsuke Kawaguchi - */ -final class RuntimeAnyTypeImpl extends AnyTypeImpl implements RuntimeNonElement { - private RuntimeAnyTypeImpl() { - super(Utils.REFLECTION_NAVIGATOR); - } - - public Transducer getTransducer() { - return null; - } - - static final RuntimeNonElement theInstance = new RuntimeAnyTypeImpl(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeArrayInfoImpl.java 2018-01-30 20:32:25.000000000 -0500 +++ /dev/null 2018-01-30 20:32:25.000000000 -0500 @@ -1,56 +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.xml.internal.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeArrayInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.runtime.Transducer; - -/** - * @author Kohsuke Kawaguchi - */ -final class RuntimeArrayInfoImpl extends ArrayInfoImpl implements RuntimeArrayInfo { - RuntimeArrayInfoImpl(RuntimeModelBuilder builder, Locatable upstream, Class arrayType) { - super(builder, upstream, arrayType); - } - - public Class getType() { - return (Class)super.getType(); - } - - public RuntimeNonElement getItemType() { - return (RuntimeNonElement)super.getItemType(); - } - - public Transducer getTransducer() { - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeAttributePropertyInfoImpl.java 2018-01-30 20:32:26.000000000 -0500 +++ /dev/null 2018-01-30 20:32:26.000000000 -0500 @@ -1,66 +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.xml.internal.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.List; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeAttributePropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; - -/** - * @author Kohsuke Kawaguchi - */ -class RuntimeAttributePropertyInfoImpl extends AttributePropertyInfoImpl - implements RuntimeAttributePropertyInfo { - - RuntimeAttributePropertyInfoImpl(RuntimeClassInfoImpl classInfo, PropertySeed seed) { - super(classInfo, seed); - } - - public boolean elementOnlyContent() { - return true; - } - - public RuntimeNonElement getTarget() { - return (RuntimeNonElement) super.getTarget(); - } - - public List ref() { - return (List)super.ref(); - } - - public RuntimePropertyInfo getSource() { - return this; - } - - public void link() { - getTransducer(); - super.link(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeBuiltinLeafInfoImpl.java 2018-01-30 20:32:26.000000000 -0500 +++ /dev/null 2018-01-30 20:32:26.000000000 -0500 @@ -1,1058 +0,0 @@ -/* - * 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.bind.v2.model.impl; - -import java.awt.Component; -import java.awt.Graphics; -import java.awt.Image; -import java.awt.MediaTracker; -import java.awt.image.BufferedImage; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; -import java.lang.reflect.Type; -import java.math.BigDecimal; -import java.math.BigInteger; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collections; -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.UUID; - -import javax.activation.DataHandler; -import javax.activation.DataSource; -import javax.activation.MimeType; -import javax.activation.MimeTypeParseException; -import javax.imageio.ImageIO; -import javax.imageio.ImageWriter; -import javax.imageio.stream.ImageOutputStream; -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.helpers.ValidationEventImpl; -import javax.xml.datatype.DatatypeConstants; -import javax.xml.datatype.Duration; -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; -import javax.xml.transform.OutputKeys; -import javax.xml.transform.Source; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.stream.StreamResult; - -import com.sun.istack.internal.ByteArrayDataSource; -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.WhiteSpaceProcessor; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.TODO; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeBuiltinLeafInfo; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.output.Pcdata; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; -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; - -/** - * {@link BuiltinLeafInfoImpl} with a support for runtime. - * - *

- * In particular this class defines {@link Transducer}s for the built-in types. - * - * @author Kohsuke Kawaguchi - */ -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); - } - - public final Class getClazz() { - return (Class)getType(); - } - - - public final Transducer getTransducer() { - return this; - } - - public boolean useNamespace() { - return false; - } - - public final boolean isDefault() { - return true; - } - - public void declareNamespace(T o, XMLSerializer w) throws AccessorException { - } - - public QName getTypeName(T instance) { - return null; - } - - /** - * Those built-in types that print to {@link String}. - */ - private static abstract class StringImpl extends RuntimeBuiltinLeafInfoImpl { - protected StringImpl(Class type, QName... typeNames) { - super(type,typeNames); - } - - public abstract String print(T o) throws AccessorException; - - public void writeText(XMLSerializer w, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - w.text(print(o),fieldName); - } - - public void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - w.leafElement(tagName,print(o),fieldName); - } - } - - /** - * Those built-in types that print to {@link Pcdata}. - */ - private static abstract class PcdataImpl extends RuntimeBuiltinLeafInfoImpl { - protected PcdataImpl(Class type, QName... typeNames) { - super(type,typeNames); - } - - public abstract Pcdata print(T o) throws AccessorException; - - public final void writeText(XMLSerializer w, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - w.text(print(o),fieldName); - } - - public final void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - w.leafElement(tagName,print(o),fieldName); - } - - } - - /** - * All instances of {@link RuntimeBuiltinLeafInfoImpl}s keyed by their type. - */ - public static final Map> LEAVES = new HashMap>(); - - private static QName createXS(String typeName) { - return new QName(WellKnownNamespace.XML_SCHEMA,typeName); - } - - public static final RuntimeBuiltinLeafInfoImpl STRING; - - private static final String DATE = "date"; - - /** - * List of all {@link RuntimeBuiltinLeafInfoImpl}s. - * - *

- * This corresponds to the built-in Java classes that are specified to be - * handled differently than ordinary classes. See table 8-2 "Mapping of Standard Java classes". - */ - 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 { - - String MAP_ANYURI_TO_URI_VALUE = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public String run() { - return System.getProperty(MAP_ANYURI_TO_URI); - } - } - ); - QName[] qnames = (MAP_ANYURI_TO_URI_VALUE == null) ? new QName[] { - createXS("string"), - createXS("anySimpleType"), - createXS("normalizedString"), - createXS("anyURI"), - createXS("token"), - createXS("language"), - createXS("Name"), - createXS("NCName"), - createXS("NMTOKEN"), - createXS("ENTITY")} - : - new QName[] { - createXS("string"), - createXS("anySimpleType"), - createXS("normalizedString"), - createXS("token"), - createXS("language"), - createXS("Name"), - createXS("NCName"), - createXS("NMTOKEN"), - createXS("ENTITY")}; - - STRING = new StringImplImpl(String.class, qnames); - - ArrayList> secondaryList = new ArrayList>(); - /* - There are cases where more than one Java classes map to the same XML type. - But when we see the same XML type in an incoming document, we only pick - one of those Java classes to unmarshal. This Java class is called 'primary'. - The rest are called 'secondary'. - - Currently we lack the proper infrastructure to handle those nicely. - For now, we rely on a hack. - - We define secondary mappings first, then primary ones later. GrammarInfo - builds a map from type name to BeanInfo. By defining primary ones later, - those primary bindings will overwrite the secondary ones. - */ - - /* - secondary bindings - */ - secondaryList.add( - new StringImpl(Character.class, createXS("unsignedShort")) { - public Character parse(CharSequence text) { - // TODO.checkSpec("default mapping for char is not defined yet"); - return (char)DatatypeConverterImpl._parseInt(text); - } - public String print(Character v) { - return Integer.toString(v); - } - }); - secondaryList.add( - new StringImpl(Calendar.class, DatatypeConstants.DATETIME) { - public Calendar parse(CharSequence text) { - return DatatypeConverterImpl._parseDateTime(text.toString()); - } - public String print(Calendar v) { - return DatatypeConverterImpl._printDateTime(v); - } - }); - secondaryList.add( - new StringImpl(GregorianCalendar.class, DatatypeConstants.DATETIME) { - public GregorianCalendar parse(CharSequence text) { - return DatatypeConverterImpl._parseDateTime(text.toString()); - } - public String print(GregorianCalendar v) { - return DatatypeConverterImpl._printDateTime(v); - } - }); - secondaryList.add( - new StringImpl(Date.class, DatatypeConstants.DATETIME) { - public Date parse(CharSequence text) { - return DatatypeConverterImpl._parseDateTime(text.toString()).getTime(); - } - public String print(Date v) { - XMLSerializer xs = XMLSerializer.getInstance(); - QName type = xs.getSchemaType(); - GregorianCalendar cal = new GregorianCalendar(0,0,0); - cal.setTime(v); - if ((type != null) && (WellKnownNamespace.XML_SCHEMA.equals(type.getNamespaceURI())) && - DATE.equals(type.getLocalPart())) { - return DatatypeConverterImpl._printDate(cal); - } else { - return DatatypeConverterImpl._printDateTime(cal); - } - } - }); - secondaryList.add( - new StringImpl(File.class, createXS("string")) { - public File parse(CharSequence text) { - return new File(WhiteSpaceProcessor.trim(text).toString()); - } - public String print(File v) { - return v.getPath(); - } - }); - secondaryList.add( - new StringImpl(URL.class, createXS("anyURI")) { - public URL parse(CharSequence text) throws SAXException { - TODO.checkSpec("JSR222 Issue #42"); - try { - return new URL(WhiteSpaceProcessor.trim(text).toString()); - } catch (MalformedURLException e) { - UnmarshallingContext.getInstance().handleError(e); - return null; - } - } - public String print(URL v) { - return v.toExternalForm(); - } - }); - if (MAP_ANYURI_TO_URI_VALUE == null) { - secondaryList.add( - new StringImpl(URI.class, createXS("string")) { - public URI parse(CharSequence text) throws SAXException { - try { - return new URI(text.toString()); - } catch (URISyntaxException e) { - UnmarshallingContext.getInstance().handleError(e); - return null; - } - } - - public String print(URI v) { - return v.toString(); - } - }); - } - secondaryList.add( - new StringImpl(Class.class, createXS("string")) { - public Class parse(CharSequence text) throws SAXException { - TODO.checkSpec("JSR222 Issue #42"); - try { - String name = WhiteSpaceProcessor.trim(text).toString(); - ClassLoader cl = UnmarshallingContext.getInstance().classLoader; - if(cl==null) - cl = Thread.currentThread().getContextClassLoader(); - - if(cl!=null) - return cl.loadClass(name); - else - return Class.forName(name); - } catch (ClassNotFoundException e) { - UnmarshallingContext.getInstance().handleError(e); - return null; - } - } - public String print(Class v) { - return v.getName(); - } - }); - - /* - classes that map to base64Binary / MTOM related classes. - a part of the secondary binding. - */ - secondaryList.add( - new PcdataImpl(Image.class, createXS("base64Binary")) { - public Image parse(CharSequence text) throws SAXException { - try { - InputStream is; - if(text instanceof Base64Data) - is = ((Base64Data)text).getInputStream(); - else - is = new ByteArrayInputStream(decodeBase64(text)); // TODO: buffering is inefficient - - // technically we should check the MIME type here, but - // normally images can be content-sniffed. - // so the MIME type check will only make us slower and draconian, both of which - // JAXB 2.0 isn't interested. - try { - return ImageIO.read(is); - } finally { - is.close(); - } - } catch (IOException e) { - UnmarshallingContext.getInstance().handleError(e); - return null; - } - } - - private BufferedImage convertToBufferedImage(Image image) throws IOException { - if (image instanceof BufferedImage) { - return (BufferedImage)image; - - } else { - MediaTracker tracker = new MediaTracker(new Component(){}); // not sure if this is the right thing to do. - tracker.addImage(image, 0); - try { - tracker.waitForAll(); - } catch (InterruptedException e) { - throw new IOException(e.getMessage()); - } - BufferedImage bufImage = new BufferedImage( - image.getWidth(null), - image.getHeight(null), - BufferedImage.TYPE_INT_ARGB); - - Graphics g = bufImage.createGraphics(); - g.drawImage(image, 0, 0, null); - return bufImage; - } - } - - public Base64Data print(Image v) { - ByteArrayOutputStreamEx imageData = new ByteArrayOutputStreamEx(); - XMLSerializer xs = XMLSerializer.getInstance(); - - String mimeType = xs.getXMIMEContentType(); - if(mimeType==null || mimeType.startsWith("image/*")) - // because PNG is lossless, it's a good default - // - // mime type can be a range, in which case we can't just pass that - // to ImageIO.getImageWritersByMIMEType, so here I'm just assuming - // the default of PNG. Not sure if this is complete. - mimeType = "image/png"; - - try { - Iterator itr = ImageIO.getImageWritersByMIMEType(mimeType); - if(itr.hasNext()) { - ImageWriter w = itr.next(); - ImageOutputStream os = ImageIO.createImageOutputStream(imageData); - w.setOutput(os); - w.write(convertToBufferedImage(v)); - os.close(); - w.dispose(); - } else { - // no encoder - xs.handleEvent(new ValidationEventImpl( - ValidationEvent.ERROR, - Messages.NO_IMAGE_WRITER.format(mimeType), - xs.getCurrentLocation(null) )); - // TODO: proper error reporting - throw new RuntimeException("no encoder for MIME type "+mimeType); - } - } catch (IOException e) { - xs.handleError(e); - // TODO: proper error reporting - throw new RuntimeException(e); - } - Base64Data bd = new Base64Data(); - imageData.set(bd,mimeType); - return bd; - } - }); - secondaryList.add( - new PcdataImpl(DataHandler.class, createXS("base64Binary")) { - public DataHandler parse(CharSequence text) { - if(text instanceof Base64Data) - return ((Base64Data)text).getDataHandler(); - else - return new DataHandler(new ByteArrayDataSource(decodeBase64(text), - UnmarshallingContext.getInstance().getXMIMEContentType())); - } - - public Base64Data print(DataHandler v) { - Base64Data bd = new Base64Data(); - bd.set(v); - return bd; - } - }); - secondaryList.add( - new PcdataImpl(Source.class, createXS("base64Binary")) { - public Source parse(CharSequence text) throws SAXException { - try { - if(text instanceof Base64Data) - return new DataSourceSource( ((Base64Data)text).getDataHandler() ); - else - return new DataSourceSource(new ByteArrayDataSource(decodeBase64(text), - UnmarshallingContext.getInstance().getXMIMEContentType())); - } catch (MimeTypeParseException e) { - UnmarshallingContext.getInstance().handleError(e); - return null; - } - } - - public Base64Data print(Source v) { - XMLSerializer xs = XMLSerializer.getInstance(); - Base64Data bd = new Base64Data(); - - String contentType = xs.getXMIMEContentType(); - MimeType mt = null; - if(contentType!=null) - try { - mt = new MimeType(contentType); - } catch (MimeTypeParseException e) { - xs.handleError(e); - // recover by ignoring the content type specification - } - - if( v instanceof DataSourceSource ) { - // if so, we already have immutable DataSource so - // this can be done efficiently - DataSource ds = ((DataSourceSource)v).getDataSource(); - - String dsct = ds.getContentType(); - if(dsct!=null && (contentType==null || contentType.equals(dsct))) { - bd.set(new DataHandler(ds)); - return bd; - } - } - - // general case. slower. - - // find out the encoding - String charset=null; - if(mt!=null) - charset = mt.getParameter("charset"); - if(charset==null) - charset = "UTF-8"; - - try { - ByteArrayOutputStreamEx baos = new ByteArrayOutputStreamEx(); - Transformer tr = xs.getIdentityTransformer(); - String defaultEncoding = tr.getOutputProperty(OutputKeys.ENCODING); - tr.setOutputProperty(OutputKeys.ENCODING, charset); - tr.transform(v, new StreamResult(new OutputStreamWriter(baos,charset))); - tr.setOutputProperty(OutputKeys.ENCODING, defaultEncoding); - baos.set(bd,"application/xml; charset="+charset); - return bd; - } catch (TransformerException e) { - // TODO: marshaller error handling - xs.handleError(e); - } catch (UnsupportedEncodingException e) { - xs.handleError(e); - } - - // error recoverly - bd.set(new byte[0],"application/xml"); - return bd; - } - }); - secondaryList.add( - new StringImpl(XMLGregorianCalendar.class, - createXS("anySimpleType"), - DatatypeConstants.DATE, - DatatypeConstants.DATETIME, - DatatypeConstants.TIME, - DatatypeConstants.GMONTH, - DatatypeConstants.GDAY, - DatatypeConstants.GYEAR, - DatatypeConstants.GYEARMONTH, - DatatypeConstants.GMONTHDAY - ) { - public String print(XMLGregorianCalendar cal) { - XMLSerializer xs = XMLSerializer.getInstance(); - - QName type = xs.getSchemaType(); - if (type != null) { - try { - checkXmlGregorianCalendarFieldRef(type, cal); - String format = xmlGregorianCalendarFormatString.get(type); - if (format != null) { - return format(format, cal); - } - } catch (javax.xml.bind.MarshalException e) { - // see issue 649 - xs.handleEvent(new ValidationEventImpl(ValidationEvent.WARNING, e.getMessage(), - xs.getCurrentLocation(null) )); - return ""; - } - } - return cal.toXMLFormat(); - } - - public XMLGregorianCalendar parse(CharSequence lexical) throws SAXException { - try { - return DatatypeConverterImpl.getDatatypeFactory() - .newXMLGregorianCalendar(lexical.toString().trim()); // (.trim() - issue 396) - } catch (Exception e) { - UnmarshallingContext.getInstance().handleError(e); - return null; - } - } - - // code duplicated from JAXP RI 1.3. See 6277586 - private String format( String format, XMLGregorianCalendar value ) { - StringBuilder buf = new StringBuilder(); - int fidx=0,flen=format.length(); - - while(fidx> primaryList = new ArrayList>(); - - /* - primary bindings - */ - primaryList.add(STRING); - primaryList.add(new StringImpl(Boolean.class, - createXS("boolean") - ) { - public Boolean parse(CharSequence text) { - return DatatypeConverterImpl._parseBoolean(text); - } - - public String print(Boolean v) { - return v.toString(); - } - }); - primaryList.add(new PcdataImpl(byte[].class, - createXS("base64Binary"), - createXS("hexBinary") - ) { - public byte[] parse(CharSequence text) { - return decodeBase64(text); - } - - public Base64Data print(byte[] v) { - XMLSerializer w = XMLSerializer.getInstance(); - Base64Data bd = new Base64Data(); - String mimeType = w.getXMIMEContentType(); - bd.set(v,mimeType); - return bd; - } - }); - primaryList.add(new StringImpl(Byte.class, - createXS("byte") - ) { - public Byte parse(CharSequence text) { - return DatatypeConverterImpl._parseByte(text); - } - - public String print(Byte v) { - return DatatypeConverterImpl._printByte(v); - } - }); - primaryList.add(new StringImpl(Short.class, - createXS("short"), - createXS("unsignedByte") - ) { - public Short parse(CharSequence text) { - return DatatypeConverterImpl._parseShort(text); - } - - public String print(Short v) { - return DatatypeConverterImpl._printShort(v); - } - }); - primaryList.add(new StringImpl(Integer.class, - createXS("int"), - createXS("unsignedShort") - ) { - public Integer parse(CharSequence text) { - return DatatypeConverterImpl._parseInt(text); - } - - public String print(Integer v) { - return DatatypeConverterImpl._printInt(v); - } - }); - primaryList.add( - new StringImpl(Long.class, - createXS("long"), - createXS("unsignedInt") - ) { - public Long parse(CharSequence text) { - return DatatypeConverterImpl._parseLong(text); - } - - public String print(Long v) { - return DatatypeConverterImpl._printLong(v); - } - }); - primaryList.add( - new StringImpl(Float.class, - createXS("float") - ) { - public Float parse(CharSequence text) { - return DatatypeConverterImpl._parseFloat(text.toString()); - } - - public String print(Float v) { - return DatatypeConverterImpl._printFloat(v); - } - }); - primaryList.add( - new StringImpl(Double.class, - createXS("double") - ) { - public Double parse(CharSequence text) { - return DatatypeConverterImpl._parseDouble(text); - } - - public String print(Double v) { - return DatatypeConverterImpl._printDouble(v); - } - }); - primaryList.add( - new StringImpl(BigInteger.class, - createXS("integer"), - createXS("positiveInteger"), - createXS("negativeInteger"), - createXS("nonPositiveInteger"), - createXS("nonNegativeInteger"), - createXS("unsignedLong") - ) { - public BigInteger parse(CharSequence text) { - return DatatypeConverterImpl._parseInteger(text); - } - - public String print(BigInteger v) { - return DatatypeConverterImpl._printInteger(v); - } - }); - primaryList.add( - new StringImpl(BigDecimal.class, - createXS("decimal") - ) { - public BigDecimal parse(CharSequence text) { - return DatatypeConverterImpl._parseDecimal(text.toString()); - } - - public String print(BigDecimal v) { - return DatatypeConverterImpl._printDecimal(v); - } - } - ); - primaryList.add( - new StringImpl(QName.class, - createXS("QName") - ) { - public QName parse(CharSequence text) throws SAXException { - try { - return DatatypeConverterImpl._parseQName(text.toString(),UnmarshallingContext.getInstance()); - } catch (IllegalArgumentException e) { - UnmarshallingContext.getInstance().handleError(e); - return null; - } - } - - public String print(QName v) { - return DatatypeConverterImpl._printQName(v,XMLSerializer.getInstance().getNamespaceContext()); - } - - @Override - public boolean useNamespace() { - return true; - } - - @Override - public void declareNamespace(QName v, XMLSerializer w) { - w.getNamespaceContext().declareNamespace(v.getNamespaceURI(),v.getPrefix(),false); - } - }); - if (MAP_ANYURI_TO_URI_VALUE != null) { - primaryList.add( - new StringImpl(URI.class, createXS("anyURI")) { - public URI parse(CharSequence text) throws SAXException { - try { - return new URI(text.toString()); - } catch (URISyntaxException e) { - UnmarshallingContext.getInstance().handleError(e); - return null; - } - } - - public String print(URI v) { - return v.toString(); - } - }); - } - primaryList.add( - new StringImpl(Duration.class, createXS("duration")) { - public String print(Duration duration) { - return duration.toString(); - } - - public Duration parse(CharSequence lexical) { - TODO.checkSpec("JSR222 Issue #42"); - return DatatypeConverterImpl.getDatatypeFactory().newDuration(lexical.toString()); - } - } - ); - primaryList.add( - new StringImpl(Void.class) { - // 'void' binding isn't defined by the spec, but when the JAX-RPC processes user-defined - // methods like "int actionFoo()", they need this pseudo-void property. - - public String print(Void value) { - return ""; - } - - public Void parse(CharSequence lexical) { - return null; - } - }); - - List> l = new ArrayList>(secondaryList.size()+primaryList.size()+1); - l.addAll(secondaryList); - - // UUID may fail to load if we are running on JDK 1.4. Handle gracefully - try { - l.add(new UUIDImpl()); - } catch (LinkageError e) { - // ignore - } - - l.addAll(primaryList); - - builtinBeanInfos = Collections.unmodifiableList(l); - } - - private static byte[] decodeBase64(CharSequence text) { - if (text instanceof Base64Data) { - Base64Data base64Data = (Base64Data) text; - return base64Data.getExact(); - } else { - return DatatypeConverterImpl._parseBase64Binary(text.toString()); - } - } - - private static void checkXmlGregorianCalendarFieldRef(QName type, - XMLGregorianCalendar cal)throws javax.xml.bind.MarshalException{ - StringBuilder buf = new StringBuilder(); - int bitField = xmlGregorianCalendarFieldRef.get(type); - final int l = 0x1; - int pos = 0; - while (bitField != 0x0){ - int bit = bitField & l; - bitField >>>= 4; - pos++; - - if (bit == 1) { - switch(pos){ - case 1: - if (cal.getSecond() == DatatypeConstants.FIELD_UNDEFINED){ - buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_SEC); - } - break; - case 2: - if (cal.getMinute() == DatatypeConstants.FIELD_UNDEFINED){ - buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MIN); - } - break; - case 3: - if (cal.getHour() == DatatypeConstants.FIELD_UNDEFINED){ - buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_HR); - } - break; - case 4: - if (cal.getDay() == DatatypeConstants.FIELD_UNDEFINED){ - buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_DAY); - } - break; - case 5: - if (cal.getMonth() == DatatypeConstants.FIELD_UNDEFINED){ - buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_MONTH); - } - break; - case 6: - if (cal.getYear() == DatatypeConstants.FIELD_UNDEFINED){ - buf.append(" ").append(Messages.XMLGREGORIANCALENDAR_YEAR); - } - break; - case 7: // ignore timezone setting - break; - } - } - } - if (buf.length() > 0){ - throw new javax.xml.bind.MarshalException( - Messages.XMLGREGORIANCALENDAR_INVALID.format(type.getLocalPart()) - + buf.toString()); - } - } - - /** - * Format string for the {@link XMLGregorianCalendar}. - */ - private static final Map xmlGregorianCalendarFormatString = new HashMap(); - - static { - Map m = xmlGregorianCalendarFormatString; - // See 4971612: be careful for SCCS substitution - 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"); - final String oldGmonthMappingProperty = AccessController.doPrivileged(new PrivilegedAction() { - @Override - public String run() { - return System.getProperty(USE_OLD_GMONTH_MAPPING); - } - }); - if (oldGmonthMappingProperty == 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"); - m.put(DatatypeConstants.GMONTHDAY, "--%M-%D" +"%z"); - } - - /** - * Field designations for XMLGregorianCalendar format string. - * sec 0x0000001 - * min 0x0000010 - * hrs 0x0000100 - * day 0x0001000 - * month 0x0010000 - * year 0x0100000 - * timezone 0x1000000 - */ - private static final Map xmlGregorianCalendarFieldRef = - new HashMap(); - static { - Map f = xmlGregorianCalendarFieldRef; - f.put(DatatypeConstants.DATETIME, 0x1111111); - f.put(DatatypeConstants.DATE, 0x1111000); - f.put(DatatypeConstants.TIME, 0x1000111); - f.put(DatatypeConstants.GDAY, 0x1001000); - f.put(DatatypeConstants.GMONTH, 0x1010000); - f.put(DatatypeConstants.GYEAR, 0x1100000); - f.put(DatatypeConstants.GYEARMONTH, 0x1110000); - f.put(DatatypeConstants.GMONTHDAY, 0x1011000); - } - - /** - * {@link RuntimeBuiltinLeafInfoImpl} for {@link UUID}. - * - * This class is given a name so that failing to load this class won't cause a fatal problem. - */ - private static class UUIDImpl extends StringImpl { - public UUIDImpl() { - super(UUID.class, RuntimeBuiltinLeafInfoImpl.createXS("string")); - } - - public UUID parse(CharSequence text) throws SAXException { - TODO.checkSpec("JSR222 Issue #42"); - try { - return UUID.fromString(WhiteSpaceProcessor.trim(text).toString()); - } catch (IllegalArgumentException e) { - UnmarshallingContext.getInstance().handleError(e); - return null; - } - } - - public String print(UUID v) { - return v.toString(); - } - } - - private static class StringImplImpl extends StringImpl { - - public StringImplImpl(Class type, QName[] typeNames) { - super(type, typeNames); - } - - public String parse(CharSequence text) { - return text.toString(); - } - - public String print(String s) { - return s; - } - - @Override - public final void writeText(XMLSerializer w, String o, String fieldName) throws IOException, SAXException, XMLStreamException { - w.text(o, fieldName); - } - - @Override - public final void writeLeafElement(XMLSerializer w, Name tagName, String o, String fieldName) throws IOException, SAXException, XMLStreamException { - w.leafElement(tagName, o, fieldName); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeClassInfoImpl.java 2018-01-30 20:32:27.000000000 -0500 +++ /dev/null 2018-01-30 20:32:27.000000000 -0500 @@ -1,403 +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.xml.internal.bind.v2.model.impl; - -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.Type; -import java.util.List; -import java.util.Map; - -import javax.xml.bind.JAXBException; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.istack.internal.NotNull; -import com.sun.xml.internal.bind.AccessorFactory; -import com.sun.xml.internal.bind.AccessorFactoryImpl; -import com.sun.xml.internal.bind.InternalAccessorFactory; -import com.sun.xml.internal.bind.XmlAccessorFactory; -import com.sun.xml.internal.bind.annotation.XmlLocation; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.ClassFactory; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeValuePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.Location; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; - -import org.xml.sax.Locator; -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -class RuntimeClassInfoImpl extends ClassInfoImpl - implements RuntimeClassInfo, RuntimeElement { - - /** - * If this class has a property annotated with {@link XmlLocation}, - * this field will get the accessor for it. - * - * TODO: support method based XmlLocation - */ - private Accessor xmlLocationAccessor; - - private AccessorFactory accessorFactory; - - private boolean supressAccessorWarnings = false; - - public RuntimeClassInfoImpl(RuntimeModelBuilder modelBuilder, Locatable upstream, Class clazz) { - super(modelBuilder, upstream, clazz); - accessorFactory = createAccessorFactory(clazz); - } - - protected AccessorFactory createAccessorFactory(Class clazz) { - XmlAccessorFactory factoryAnn; - AccessorFactory accFactory = null; - - // user providing class to be used. - JAXBContextImpl context = ((RuntimeModelBuilder) builder).context; - if (context!=null) { - this.supressAccessorWarnings = context.supressAccessorWarnings; - if (context.xmlAccessorFactorySupport) { - factoryAnn = findXmlAccessorFactoryAnnotation(clazz); - if (factoryAnn != null) { - try { - accFactory = factoryAnn.value().newInstance(); - } catch (InstantiationException e) { - builder.reportError(new IllegalAnnotationException( - Messages.ACCESSORFACTORY_INSTANTIATION_EXCEPTION.format( - factoryAnn.getClass().getName(), nav().getClassName(clazz)), this)); - } catch (IllegalAccessException e) { - builder.reportError(new IllegalAnnotationException( - Messages.ACCESSORFACTORY_ACCESS_EXCEPTION.format( - factoryAnn.getClass().getName(), nav().getClassName(clazz)),this)); - } - } - } - } - - - // Fall back to local AccessorFactory when no - // user not providing one or as error recovery. - if (accFactory == null){ - accFactory = AccessorFactoryImpl.getInstance(); - } - return accFactory; - } - - protected XmlAccessorFactory findXmlAccessorFactoryAnnotation(Class clazz) { - XmlAccessorFactory factoryAnn = reader().getClassAnnotation(XmlAccessorFactory.class,clazz,this); - if (factoryAnn == null) { - factoryAnn = reader().getPackageAnnotation(XmlAccessorFactory.class,clazz,this); - } - return factoryAnn; - } - - - public Method getFactoryMethod(){ - return super.getFactoryMethod(); - } - - public final RuntimeClassInfoImpl getBaseClass() { - return (RuntimeClassInfoImpl)super.getBaseClass(); - } - - @Override - protected ReferencePropertyInfoImpl createReferenceProperty(PropertySeed seed) { - return new RuntimeReferencePropertyInfoImpl(this,seed); - } - - @Override - protected AttributePropertyInfoImpl createAttributeProperty(PropertySeed seed) { - return new RuntimeAttributePropertyInfoImpl(this,seed); - } - - @Override - protected ValuePropertyInfoImpl createValueProperty(PropertySeed seed) { - return new RuntimeValuePropertyInfoImpl(this,seed); - } - - @Override - protected ElementPropertyInfoImpl createElementProperty(PropertySeed seed) { - return new RuntimeElementPropertyInfoImpl(this,seed); - } - - @Override - protected MapPropertyInfoImpl createMapProperty(PropertySeed seed) { - return new RuntimeMapPropertyInfoImpl(this,seed); - } - - - @Override - public List getProperties() { - return (List)super.getProperties(); - } - - @Override - public RuntimePropertyInfo getProperty(String name) { - return (RuntimePropertyInfo)super.getProperty(name); - } - - - public void link() { - getTransducer(); // populate the transducer - super.link(); - } - - private Accessor> attributeWildcardAccessor; - - public Accessor> getAttributeWildcard() { - for( RuntimeClassInfoImpl c=this; c!=null; c=c.getBaseClass() ) { - if(c.attributeWildcard!=null) { - if(c.attributeWildcardAccessor==null) - c.attributeWildcardAccessor = c.createAttributeWildcardAccessor(); - return (Accessor>)c.attributeWildcardAccessor; - } - } - return null; - } - - private boolean computedTransducer = false; - private Transducer xducer = null; - - public Transducer getTransducer() { - if(!computedTransducer) { - computedTransducer = true; - xducer = calcTransducer(); - } - return xducer; - } - - /** - * Creates a transducer if this class is bound to a text in XML. - */ - private Transducer calcTransducer() { - RuntimeValuePropertyInfo valuep=null; - if(hasAttributeWildcard()) - return null; // has attribute wildcard. Can't be handled as a leaf - for (RuntimeClassInfoImpl ci = this; ci != null; ci = ci.getBaseClass()) { - for( RuntimePropertyInfo pi : ci.getProperties() ) - if(pi.kind()==PropertyKind.VALUE) { - valuep = (RuntimeValuePropertyInfo)pi; - } else { - // this bean has something other than a value - return null; - } - } - if(valuep==null) - return null; - if( !valuep.getTarget().isSimpleType() ) - return null; // if there's an error, recover from it by returning null. - - return new TransducerImpl(getClazz(),TransducedAccessor.get( - ((RuntimeModelBuilder)builder).context,valuep)); - } - - /** - * Creates - */ - private Accessor> createAttributeWildcardAccessor() { - assert attributeWildcard!=null; - return ((RuntimePropertySeed)attributeWildcard).getAccessor(); - } - - @Override - protected RuntimePropertySeed createFieldSeed(Field field) { - final boolean readOnly = Modifier.isStatic(field.getModifiers()); - Accessor acc; - try { - if (supressAccessorWarnings) { - acc = ((InternalAccessorFactory)accessorFactory).createFieldAccessor(clazz, field, readOnly, supressAccessorWarnings); - } else { - acc = accessorFactory.createFieldAccessor(clazz, field, readOnly); - } - } catch(JAXBException e) { - builder.reportError(new IllegalAnnotationException( - Messages.CUSTOM_ACCESSORFACTORY_FIELD_ERROR.format( - nav().getClassName(clazz), e.toString()), this )); - acc = Accessor.getErrorInstance(); // error recovery - } - return new RuntimePropertySeed(super.createFieldSeed(field), acc ); - } - - @Override - public RuntimePropertySeed createAccessorSeed(Method getter, Method setter) { - Accessor acc; - try { - acc = accessorFactory.createPropertyAccessor(clazz, getter, setter); - } catch(JAXBException e) { - builder.reportError(new IllegalAnnotationException( - Messages.CUSTOM_ACCESSORFACTORY_PROPERTY_ERROR.format( - nav().getClassName(clazz), e.toString()), this )); - acc = Accessor.getErrorInstance(); // error recovery - } - return new RuntimePropertySeed( super.createAccessorSeed(getter,setter), - acc ); - } - - @Override - protected void checkFieldXmlLocation(Field f) { - if(reader().hasFieldAnnotation(XmlLocation.class,f)) - // TODO: check for XmlLocation signature - // TODO: check a collision with the super class - xmlLocationAccessor = new Accessor.FieldReflection(f); - } - - public Accessor getLocatorField() { - return xmlLocationAccessor; - } - - static final class RuntimePropertySeed implements PropertySeed { - /** - * @see #getAccessor() - */ - private final Accessor acc; - - private final PropertySeed core; - - public RuntimePropertySeed(PropertySeed core, Accessor acc) { - this.core = core; - this.acc = acc; - } - - public String getName() { - return core.getName(); - } - - public A readAnnotation(Class annotationType) { - return core.readAnnotation(annotationType); - } - - public boolean hasAnnotation(Class annotationType) { - return core.hasAnnotation(annotationType); - } - - public Type getRawType() { - return core.getRawType(); - } - - public Location getLocation() { - return core.getLocation(); - } - - public Locatable getUpstream() { - return core.getUpstream(); - } - - public Accessor getAccessor() { - return acc; - } - } - - - - /** - * {@link Transducer} implementation used when this class maps to PCDATA in XML. - * - * TODO: revisit the exception handling - */ - private static final class TransducerImpl implements Transducer { - private final TransducedAccessor xacc; - private final Class ownerClass; - - public TransducerImpl(Class ownerClass,TransducedAccessor xacc) { - this.xacc = xacc; - this.ownerClass = ownerClass; - } - - public boolean useNamespace() { - return xacc.useNamespace(); - } - - public boolean isDefault() { - return false; - } - - public void declareNamespace(BeanT bean, XMLSerializer w) throws AccessorException { - try { - xacc.declareNamespace(bean,w); - } catch (SAXException e) { - throw new AccessorException(e); - } - } - - public @NotNull CharSequence print(BeanT o) throws AccessorException { - try { - CharSequence value = xacc.print(o); - if(value==null) - throw new AccessorException(Messages.THERE_MUST_BE_VALUE_IN_XMLVALUE.format(o)); - return value; - } catch (SAXException e) { - throw new AccessorException(e); - } - } - - public BeanT parse(CharSequence lexical) throws AccessorException, SAXException { - UnmarshallingContext ctxt = UnmarshallingContext.getInstance(); - BeanT inst; - if(ctxt!=null) - inst = (BeanT)ctxt.createInstance(ownerClass); - else - // when this runs for parsing enum constants, - // there's no UnmarshallingContext. - inst = ClassFactory.create(ownerClass); - - xacc.parse(inst,lexical); - return inst; - } - - public void writeText(XMLSerializer w, BeanT o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - if(!xacc.hasValue(o)) - throw new AccessorException(Messages.THERE_MUST_BE_VALUE_IN_XMLVALUE.format(o)); - xacc.writeText(w,o,fieldName); - } - - public void writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - if(!xacc.hasValue(o)) - throw new AccessorException(Messages.THERE_MUST_BE_VALUE_IN_XMLVALUE.format(o)); - xacc.writeLeafElement(w,tagName,o,fieldName); - } - - public QName getTypeName(BeanT instance) { - return null; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeElementInfoImpl.java 2018-01-30 20:32:27.000000000 -0500 +++ /dev/null 2018-01-30 20:32:28.000000000 -0500 @@ -1,135 +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.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import com.sun.xml.internal.bind.v2.model.core.Adapter; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeRef; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * @author Kohsuke Kawaguchi - */ -final class RuntimeElementInfoImpl extends ElementInfoImpl - implements RuntimeElementInfo { - - public RuntimeElementInfoImpl(RuntimeModelBuilder modelBuilder, RegistryInfoImpl registry, Method method) throws IllegalAnnotationException { - super(modelBuilder, registry, method); - - Adapter a = getProperty().getAdapter(); - - if(a!=null) - adapterType = a.adapterType; - else - adapterType = null; - } - - @Override - protected PropertyImpl createPropertyImpl() { - return new RuntimePropertyImpl(); - } - - class RuntimePropertyImpl extends PropertyImpl implements RuntimeElementPropertyInfo, RuntimeTypeRef { - public Accessor getAccessor() { - if(adapterType==null) - return Accessor.JAXB_ELEMENT_VALUE; - else - return Accessor.JAXB_ELEMENT_VALUE.adapt( - (Class)getAdapter().defaultType,(Class)adapterType); - } - - public Type getRawType() { - return Collection.class; - } - - public Type getIndividualType() { - return getContentType().getType(); - } - - - public boolean elementOnlyContent() { - return false; // this method doesn't make sense here - } - - public List getTypes() { - return Collections.singletonList(this); - } - - public List ref() { - return (List)super.ref(); - } - - public RuntimeNonElement getTarget() { - return (RuntimeNonElement)super.getTarget(); - } - - public RuntimePropertyInfo getSource() { - return this; - } - - public Transducer getTransducer() { - return RuntimeModelBuilder.createTransducer(this); - } - } - - /** - * The adapter specified by getProperty().getAdapter(). - */ - private final Class adapterType; - - public RuntimeElementPropertyInfo getProperty() { - return (RuntimeElementPropertyInfo)super.getProperty(); - } - - public Class getType() { - //noinspection unchecked - return (Class) Utils.REFLECTION_NAVIGATOR.erasure(super.getType()); - } - - public RuntimeClassInfo getScope() { - return (RuntimeClassInfo)super.getScope(); - } - - public RuntimeNonElement getContentType() { - return (RuntimeNonElement)super.getContentType(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeElementPropertyInfoImpl.java 2018-01-30 20:32:28.000000000 -0500 +++ /dev/null 2018-01-30 20:32:28.000000000 -0500 @@ -1,77 +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.xml.internal.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.List; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfo; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * @author Kohsuke Kawaguchi - */ -class RuntimeElementPropertyInfoImpl extends ElementPropertyInfoImpl - implements RuntimeElementPropertyInfo { - - private final Accessor acc; - - RuntimeElementPropertyInfoImpl(RuntimeClassInfoImpl classInfo, PropertySeed seed) { - super(classInfo, seed); - Accessor rawAcc = ((RuntimeClassInfoImpl.RuntimePropertySeed)seed).getAccessor(); - if(getAdapter()!=null && !isCollection()) - // adapter for a single-value property is handled by accessor. - // adapter for a collection property is handled by lister. - rawAcc = rawAcc.adapt(getAdapter()); - this.acc = rawAcc; - } - - public Accessor getAccessor() { - return acc; - } - - public boolean elementOnlyContent() { - return true; - } - - public List ref() { - return (List)super.ref(); - } - - @Override - protected RuntimeTypeRefImpl createTypeRef(QName name, Type type, boolean isNillable, String defaultValue) { - return new RuntimeTypeRefImpl(this,name,type,isNillable,defaultValue); - } - - public List getTypes() { - return (List)super.getTypes(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeEnumConstantImpl.java 2018-01-30 20:32:29.000000000 -0500 +++ /dev/null 2018-01-30 20:32:29.000000000 -0500 @@ -1,41 +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.xml.internal.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; - -/** - * @author Kohsuke Kawaguchi - */ -final class RuntimeEnumConstantImpl extends EnumConstantImpl { - public RuntimeEnumConstantImpl( - RuntimeEnumLeafInfoImpl owner, String name, String lexical, - EnumConstantImpl next) { - super(owner, name, lexical, next); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeEnumLeafInfoImpl.java 2018-01-30 20:32:29.000000000 -0500 +++ /dev/null 2018-01-30 20:32:30.000000000 -0500 @@ -1,157 +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.xml.internal.bind.v2.model.impl; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.EnumMap; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.annotation.FieldLocatable; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeEnumLeafInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi - */ -final class RuntimeEnumLeafInfoImpl,B> extends EnumLeafInfoImpl - implements RuntimeEnumLeafInfo, Transducer { - - public Transducer getTransducer() { - return this; - } - - /** - * {@link Transducer} that knows how to convert a lexical value - * into the Java value that we can handle. - */ - private final Transducer baseXducer; - - private final Map parseMap = new HashMap(); - private final Map printMap; - - RuntimeEnumLeafInfoImpl(RuntimeModelBuilder builder, Locatable upstream, Class enumType) { - super(builder,upstream,enumType,enumType); - this.printMap = new EnumMap(enumType); - - baseXducer = ((RuntimeNonElement)baseType).getTransducer(); - } - - @Override - public RuntimeEnumConstantImpl createEnumConstant(String name, String literal, Field constant, EnumConstantImpl last) { - T t; - try { - try { - constant.setAccessible(true); - } catch (SecurityException e) { - // in case the constant is already accessible, swallow this error. - // if the constant is indeed not accessible, we will get IllegalAccessException - // in the following line, and that is not too late. - } - t = (T)constant.get(null); - } catch (IllegalAccessException e) { - // impossible, because this is an enum constant - throw new IllegalAccessError(e.getMessage()); - } - - B b = null; - try { - b = baseXducer.parse(literal); - } catch (Exception e) { - builder.reportError(new IllegalAnnotationException( - Messages.INVALID_XML_ENUM_VALUE.format(literal,baseType.getType().toString()), e, - new FieldLocatable(this,constant,nav()) )); - } - - parseMap.put(b,t); - printMap.put(t,b); - - return new RuntimeEnumConstantImpl(this, name, literal, last); - } - - public QName[] getTypeNames() { - return new QName[]{getTypeName()}; - } - - public boolean isDefault() { - return false; - } - - @Override - public Class getClazz() { - return clazz; - } - - public boolean useNamespace() { - return baseXducer.useNamespace(); - } - - public void declareNamespace(T t, XMLSerializer w) throws AccessorException { - baseXducer.declareNamespace(printMap.get(t),w); - } - - public CharSequence print(T t) throws AccessorException { - return baseXducer.print(printMap.get(t)); - } - - public T parse(CharSequence lexical) throws AccessorException, SAXException { - // TODO: error handling - - B b = baseXducer.parse(lexical); - - if (tokenStringType) { - b = (B) ((String)b).trim(); - } - - return parseMap.get(b); - } - - public void writeText(XMLSerializer w, T t, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - baseXducer.writeText(w,printMap.get(t),fieldName); - } - - public void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - baseXducer.writeLeafElement(w,tagName,printMap.get(o),fieldName); - } - - public QName getTypeName(T instance) { - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeMapPropertyInfoImpl.java 2018-01-30 20:32:30.000000000 -0500 +++ /dev/null 2018-01-30 20:32:30.000000000 -0500 @@ -1,68 +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.xml.internal.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.List; - -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeMapPropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfo; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * @author Kohsuke Kawaguchi - */ -class RuntimeMapPropertyInfoImpl extends MapPropertyInfoImpl implements RuntimeMapPropertyInfo { - private final Accessor acc; - - RuntimeMapPropertyInfoImpl(RuntimeClassInfoImpl classInfo, PropertySeed seed) { - super(classInfo, seed); - this.acc = ((RuntimeClassInfoImpl.RuntimePropertySeed)seed).getAccessor(); - } - - public Accessor getAccessor() { - return acc; - } - - public boolean elementOnlyContent() { - return true; - } - - public RuntimeNonElement getKeyType() { - return (RuntimeNonElement)super.getKeyType(); - } - - public RuntimeNonElement getValueType() { - return (RuntimeNonElement)super.getValueType(); - } - - public List ref() { - return (List)super.ref(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeModelBuilder.java 2018-01-30 20:32:31.000000000 -0500 +++ /dev/null 2018-01-30 20:32:31.000000000 -0500 @@ -1,179 +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.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.Map; - -import javax.activation.MimeType; - -import com.sun.xml.internal.bind.WhiteSpaceProcessor; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader; -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElementRef; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfoSet; -import com.sun.xml.internal.bind.v2.runtime.FilterTransducer; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.InlineBinaryTransducer; -import com.sun.xml.internal.bind.v2.runtime.MimeTypedTransducer; -import com.sun.xml.internal.bind.v2.runtime.SchemaTypeTransducer; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; -import com.sun.istack.internal.Nullable; - -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import javax.xml.namespace.QName; -import org.xml.sax.SAXException; - -/** - * {@link ModelBuilder} that works at the run-time by using - * the {@code java.lang.reflect} package. - * - *

- * This extends {@link ModelBuilder} by providing more functionalities such - * as accessing the fields and classes. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public class RuntimeModelBuilder extends ModelBuilder { - /** - * The {@link JAXBContextImpl} for which the model is built. - * Null when created for reflection. - */ - public final @Nullable JAXBContextImpl context; - - public RuntimeModelBuilder(JAXBContextImpl context, RuntimeAnnotationReader annotationReader, Map subclassReplacements, String defaultNamespaceRemap) { - super(annotationReader, Utils.REFLECTION_NAVIGATOR, subclassReplacements, defaultNamespaceRemap); - this.context = context; - } - - @Override - public RuntimeNonElement getClassInfo( Class clazz, Locatable upstream ) { - return (RuntimeNonElement)super.getClassInfo(clazz,upstream); - } - - @Override - public RuntimeNonElement getClassInfo( Class clazz, boolean searchForSuperClass, Locatable upstream ) { - return (RuntimeNonElement)super.getClassInfo(clazz,searchForSuperClass,upstream); - } - - @Override - protected RuntimeEnumLeafInfoImpl createEnumLeafInfo(Class clazz, Locatable upstream) { - return new RuntimeEnumLeafInfoImpl(this,upstream,clazz); - } - - @Override - protected RuntimeClassInfoImpl createClassInfo( Class clazz, Locatable upstream ) { - return new RuntimeClassInfoImpl(this,upstream,clazz); - } - - @Override - public RuntimeElementInfoImpl createElementInfo(RegistryInfoImpl registryInfo, Method method) throws IllegalAnnotationException { - return new RuntimeElementInfoImpl(this,registryInfo, method); - } - - @Override - public RuntimeArrayInfoImpl createArrayInfo(Locatable upstream, Type arrayType) { - return new RuntimeArrayInfoImpl(this, upstream, (Class)arrayType); - } - - @Override - protected RuntimeTypeInfoSetImpl createTypeInfoSet() { - return new RuntimeTypeInfoSetImpl(reader); - } - - @Override - public RuntimeTypeInfoSet link() { - return (RuntimeTypeInfoSet)super.link(); - } - - /** - * Creates a {@link Transducer} given a reference. - * - * Used to implement {@link RuntimeNonElementRef#getTransducer()}. - * Shouldn't be called from anywhere else. - * - * TODO: this is not the proper place for this class to be in. - */ - public static Transducer createTransducer(RuntimeNonElementRef ref) { - Transducer t = ref.getTarget().getTransducer(); - RuntimePropertyInfo src = ref.getSource(); - ID id = src.id(); - - if(id==ID.IDREF) - return RuntimeBuiltinLeafInfoImpl.STRING; - - if(id==ID.ID) - t = new IDTransducerImpl(t); - - MimeType emt = src.getExpectedMimeType(); - if(emt!=null) - t = new MimeTypedTransducer(t,emt); - - if(src.inlineBinaryData()) - t = new InlineBinaryTransducer(t); - - if(src.getSchemaType()!=null) { - if (src.getSchemaType().equals(createXSSimpleType())) { - return RuntimeBuiltinLeafInfoImpl.STRING; - } - t = new SchemaTypeTransducer(t,src.getSchemaType()); - } - - return t; - } - - private static QName createXSSimpleType() { - return new QName(WellKnownNamespace.XML_SCHEMA,"anySimpleType"); - } - - /** - * Transducer implementation for ID. - * - * This transducer wraps another {@link Transducer} and adds - * handling for ID. - */ - private static final class IDTransducerImpl extends FilterTransducer { - public IDTransducerImpl(Transducer core) { - super(core); - } - - @Override - public ValueT parse(CharSequence lexical) throws AccessorException, SAXException { - String value = WhiteSpaceProcessor.trim(lexical).toString(); - UnmarshallingContext.getInstance().addToIdTable(value); - return core.parse(value); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeReferencePropertyInfoImpl.java 2018-01-30 20:32:32.000000000 -0500 +++ /dev/null 2018-01-30 20:32:32.000000000 -0500 @@ -1,70 +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.xml.internal.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.Set; - -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeReferencePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * @author Kohsuke Kawaguchi - */ -class RuntimeReferencePropertyInfoImpl extends ReferencePropertyInfoImpl - implements RuntimeReferencePropertyInfo { - - private final Accessor acc; - - public RuntimeReferencePropertyInfoImpl(RuntimeClassInfoImpl classInfo, PropertySeed seed) { - super(classInfo,seed); - Accessor rawAcc = ((RuntimeClassInfoImpl.RuntimePropertySeed)seed).getAccessor(); - if(getAdapter()!=null && !isCollection()) - // adapter for a single-value property is handled by accessor. - // adapter for a collection property is handled by lister. - rawAcc = rawAcc.adapt(getAdapter()); - this.acc = rawAcc; - } - - public Set getElements() { - return (Set)super.getElements(); - } - - public Set ref() { - return (Set)super.ref(); - } - - public Accessor getAccessor() { - return acc; - } - - public boolean elementOnlyContent() { - return !isMixed(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeTypeInfoSetImpl.java 2018-01-30 20:32:32.000000000 -0500 +++ /dev/null 2018-01-30 20:32:32.000000000 -0500 @@ -1,95 +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.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.Map; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfoSet; - -/** - * {@link TypeInfoSet} specialized for runtime. - * - * @author Kohsuke Kawaguchi - */ -final class RuntimeTypeInfoSetImpl extends TypeInfoSetImpl implements RuntimeTypeInfoSet { - public RuntimeTypeInfoSetImpl(AnnotationReader reader) { - super(Utils.REFLECTION_NAVIGATOR,reader,RuntimeBuiltinLeafInfoImpl.LEAVES); - } - - @Override - protected RuntimeNonElement createAnyType() { - return RuntimeAnyTypeImpl.theInstance; - } - - public RuntimeNonElement getTypeInfo( Type type ) { - return (RuntimeNonElement)super.getTypeInfo(type); - } - - public RuntimeNonElement getAnyTypeInfo() { - return (RuntimeNonElement)super.getAnyTypeInfo(); - } - - public RuntimeNonElement getClassInfo(Class clazz) { - return (RuntimeNonElement)super.getClassInfo(clazz); - } - - public Map beans() { - return (Map)super.beans(); - } - - public Map> builtins() { - return (Map>)super.builtins(); - } - - public Map> enums() { - return (Map>)super.enums(); - } - - public Map arrays() { - return (Map)super.arrays(); - } - - public RuntimeElementInfoImpl getElementInfo(Class scope,QName name) { - return (RuntimeElementInfoImpl)super.getElementInfo(scope,name); - } - - public Map getElementMappings(Class scope) { - return (Map)super.getElementMappings(scope); - } - - public Iterable getAllElements() { - return (Iterable)super.getAllElements(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeTypeRefImpl.java 2018-01-30 20:32:33.000000000 -0500 +++ /dev/null 2018-01-30 20:32:33.000000000 -0500 @@ -1,57 +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.xml.internal.bind.v2.model.impl; - -import java.lang.reflect.Type; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeRef; -import com.sun.xml.internal.bind.v2.runtime.Transducer; - -/** - * @author Kohsuke Kawaguchi - */ -final class RuntimeTypeRefImpl extends TypeRefImpl implements RuntimeTypeRef { - - public RuntimeTypeRefImpl(RuntimeElementPropertyInfoImpl elementPropertyInfo, QName elementName, Type type, boolean isNillable, String defaultValue) { - super(elementPropertyInfo, elementName, type, isNillable, defaultValue); - } - - public RuntimeNonElement getTarget() { - return (RuntimeNonElement)super.getTarget(); - } - - public Transducer getTransducer() { - return RuntimeModelBuilder.createTransducer(this); - } - - public RuntimePropertyInfo getSource() { - return (RuntimePropertyInfo)owner; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/RuntimeValuePropertyInfoImpl.java 2018-01-30 20:32:34.000000000 -0500 +++ /dev/null 2018-01-30 20:32:34.000000000 -0500 @@ -1,66 +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.xml.internal.bind.v2.model.impl; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.List; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeValuePropertyInfo; - -/** - * @author Kohsuke Kawaguchi - */ -final class RuntimeValuePropertyInfoImpl extends ValuePropertyInfoImpl - implements RuntimeValuePropertyInfo { - - RuntimeValuePropertyInfoImpl(RuntimeClassInfoImpl classInfo, PropertySeed seed) { - super(classInfo, seed); - } - - public boolean elementOnlyContent() { - return false; - } - - public RuntimePropertyInfo getSource() { - return (RuntimePropertyInfo)super.getSource(); - } - - public RuntimeNonElement getTarget() { - return (RuntimeNonElement)super.getTarget(); - } - - public List ref() { - return (List)super.ref(); - } - - public void link() { - getTransducer(); - super.link(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/SecureLoader.java 2018-01-30 20:32:34.000000000 -0500 +++ /dev/null 2018-01-30 20:32:34.000000000 -0500 @@ -1,75 +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.xml.internal.bind.v2.model.impl; - -/** - * Class defined for safe calls of getClassLoader methods of any kind (context/system/class - * classloader. This MUST be package private and defined in every package which - * uses such invocations. - * @author snajper - */ -class SecureLoader { - - static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - - static ClassLoader getClassClassLoader(final Class c) { - if (System.getSecurityManager() == null) { - return c.getClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return c.getClassLoader(); - } - }); - } - } - - static ClassLoader getSystemClassLoader() { - if (System.getSecurityManager() == null) { - return ClassLoader.getSystemClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return ClassLoader.getSystemClassLoader(); - } - }); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/SingleTypePropertyInfoImpl.java 2018-01-30 20:32:35.000000000 -0500 +++ /dev/null 2018-01-30 20:32:35.000000000 -0500 @@ -1,134 +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.xml.internal.bind.v2.model.impl; - -import java.util.Collections; -import java.util.List; - -import javax.xml.bind.annotation.XmlList; - -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElementRef; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * {@link PropertyInfoImpl} that can only have one type. - * - * Specifically, {@link AttributePropertyInfoImpl} and {@link ValuePropertyInfoImpl}. - * - * @author Kohsuke Kawaguchi - */ -abstract class SingleTypePropertyInfoImpl - extends PropertyInfoImpl { - - /** - * Computed lazily. - * - * @see {@link #getTarget()}. - */ - private NonElement type; - - public SingleTypePropertyInfoImpl(ClassInfoImpl classInfo, PropertySeed seed) { - super(classInfo, seed); - if(this instanceof RuntimePropertyInfo) { - Accessor rawAcc = ((RuntimeClassInfoImpl.RuntimePropertySeed)seed).getAccessor(); - if(getAdapter()!=null && !isCollection()) - // adapter for a single-value property is handled by accessor. - // adapter for a collection property is handled by lister. - rawAcc = rawAcc.adapt(((RuntimePropertyInfo)this).getAdapter()); - this.acc = rawAcc; - } else - this.acc = null; - } - - public List> ref() { - return Collections.singletonList(getTarget()); - } - - public NonElement getTarget() { - if(type==null) { - assert parent.builder!=null : "this method must be called during the build stage"; - type = parent.builder.getTypeInfo(getIndividualType(),this); - } - return type; - } - - public PropertyInfo getSource() { - return this; - } - - public void link() { - super.link(); - - if (!(NonElement.ANYTYPE_NAME.equals(type.getTypeName()) || type.isSimpleType() || id()==ID.IDREF)) { - parent.builder.reportError(new IllegalAnnotationException( - Messages.SIMPLE_TYPE_IS_REQUIRED.format(), - seed - )); - } - - if(!isCollection() && seed.hasAnnotation(XmlList.class)) { - parent.builder.reportError(new IllegalAnnotationException( - Messages.XMLLIST_ON_SINGLE_PROPERTY.format(), this - )); - } - } - -// -// -// technically these code belong to runtime implementation, but moving the code up here -// allows this to be shared between RuntimeValuePropertyInfoImpl and RuntimeAttributePropertyInfoImpl -// -// - - private final Accessor acc; - /** - * Lazily created. - */ - private Transducer xducer; - - public Accessor getAccessor() { - return acc; - } - - - public Transducer getTransducer() { - if(xducer==null) { - xducer = RuntimeModelBuilder.createTransducer((RuntimeNonElementRef)this); - if(xducer==null) { - // this situation is checked by by the link method. - // avoid repeating the same error by silently recovering - xducer = RuntimeBuiltinLeafInfoImpl.STRING; - } - } - return xducer; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/TypeInfoImpl.java 2018-01-30 20:32:36.000000000 -0500 +++ /dev/null 2018-01-30 20:32:36.000000000 -0500 @@ -1,165 +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.xml.internal.bind.v2.model.impl; - -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.bind.annotation.XmlType; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.api.impl.NameConverter; -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -/** - * Common implementation between {@link ClassInfoImpl} and {@link ElementInfoImpl}. - * - * @author Kohsuke Kawaguchi - */ -abstract class TypeInfoImpl - implements TypeInfo, Locatable { - - /** - * The Java class that caused this Java class to be a part of the JAXB processing. - * - * null if it's specified explicitly by the user. - */ - private final Locatable upstream; - - /** - * {@link TypeInfoSet} to which this class belongs. - */ - protected final TypeInfoSetImpl owner; - - /** - * Reference to the {@link ModelBuilder}, only until we link {@link TypeInfo}s all together, - * because we don't want to keep {@link ModelBuilder} too long. - */ - protected ModelBuilder builder; - - protected TypeInfoImpl( - ModelBuilder builder, - Locatable upstream) { - - this.builder = builder; - this.owner = builder.typeInfoSet; - this.upstream = upstream; - } - - public Locatable getUpstream() { - return upstream; - } - - /*package*/ void link() { - builder = null; - } - - protected final Navigator nav() { - return owner.nav; - } - - protected final AnnotationReader reader() { - return owner.reader; - } - - /** - * Parses an {@link XmlRootElement} annotation on a class - * and determine the element name. - * - * @return null - * if none was found. - */ - protected final QName parseElementName(ClassDeclT clazz) { - XmlRootElement e = reader().getClassAnnotation(XmlRootElement.class,clazz,this); - if(e==null) - return null; - - String local = e.name(); - if(local.equals("##default")) { - // if defaulted... - local = NameConverter.standard.toVariableName(nav().getClassShortName(clazz)); - } - String nsUri = e.namespace(); - if(nsUri.equals("##default")) { - // if defaulted ... - XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,clazz,this); - if(xs!=null) - nsUri = xs.namespace(); - else { - nsUri = builder.defaultNsUri; - } - } - - return new QName(nsUri.intern(),local.intern()); - } - - protected final QName parseTypeName(ClassDeclT clazz) { - return parseTypeName( clazz, reader().getClassAnnotation(XmlType.class,clazz,this) ); - } - - /** - * Parses a (potentially-null) {@link XmlType} annotation on a class - * and determine the actual value. - * - * @param clazz - * The class on which the XmlType annotation is checked. - * @param t - * The {@link XmlType} annotation on the clazz. This value - * is taken as a parameter to improve the performance for the case where - * 't' is pre-computed. - */ - protected final QName parseTypeName(ClassDeclT clazz, XmlType t) { - String nsUri="##default"; - String local="##default"; - if(t!=null) { - nsUri = t.namespace(); - local = t.name(); - } - - if(local.length()==0) - return null; // anonymous - - - if(local.equals("##default")) - // if defaulted ... - local = NameConverter.standard.toVariableName(nav().getClassShortName(clazz)); - - if(nsUri.equals("##default")) { - // if defaulted ... - XmlSchema xs = reader().getPackageAnnotation(XmlSchema.class,clazz,this); - if(xs!=null) - nsUri = xs.namespace(); - else { - nsUri = builder.defaultNsUri; - } - } - - return new QName(nsUri.intern(),local.intern()); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/TypeInfoSetImpl.java 2018-01-30 20:32:36.000000000 -0500 +++ /dev/null 2018-01-30 20:32:37.000000000 -0500 @@ -1,391 +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.xml.internal.bind.v2.model.impl; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.Map; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.annotation.XmlNs; -import javax.xml.bind.annotation.XmlNsForm; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.bind.annotation.XmlTransient; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.namespace.QName; -import javax.xml.transform.Result; - -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.core.BuiltinLeafInfo; -import com.sun.xml.internal.bind.v2.model.core.ClassInfo; -import com.sun.xml.internal.bind.v2.model.core.LeafInfo; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.Ref; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; -import com.sun.xml.internal.bind.v2.runtime.RuntimeUtil; -import com.sun.xml.internal.bind.v2.util.FlattenIterator; - -/** - * Set of {@link TypeInfo}s. - * - *

- * This contains a fixed set of {@link LeafInfo}s and arbitrary set of {@link ClassInfo}s. - * - *

- * Members are annotated with JAXB annotations so that we can dump it easily. - * - * @author Kohsuke Kawaguchi - */ -class TypeInfoSetImpl implements TypeInfoSet { - - @XmlTransient - public final Navigator nav; - - @XmlTransient - public final AnnotationReader reader; - - /** - * All the leaves. - */ - private final Map> builtins = - new LinkedHashMap>(); - - /** All {@link EnumLeafInfoImpl}s. */ - private final Map> enums = - new LinkedHashMap>(); - - /** All {@link ArrayInfoImpl}s. */ - private final Map> arrays = - new LinkedHashMap>(); - - /** - * All the user-defined classes. - * - * Using {@link LinkedHashMap} allows us to process classes - * in the order they are given to us. When the user incorrectly - * puts an unexpected class into a reference graph, this causes - * an error to be reported on a class closer to the user's code. - */ - @XmlJavaTypeAdapter(RuntimeUtil.ToStringAdapter.class) - private final Map> beans - = new LinkedHashMap>(); - - @XmlTransient - private final Map> beansView = - Collections.unmodifiableMap(beans); - - /** - * The element mapping. - */ - private final Map>> elementMappings = - new LinkedHashMap>>(); - - private final Iterable> allElements = - new Iterable>() { - public Iterator> iterator() { - return new FlattenIterator>(elementMappings.values()); - } - }; - - /** - * {@link TypeInfo} for {@code xs:anyType}. - * - * anyType is the only {@link TypeInfo} that works with an interface, - * and accordingly it requires a lot of special casing. - */ - private final NonElement anyType; - - /** - * Lazily parsed set of {@link XmlNs}s. - * - * @see #getXmlNs(String) - */ - private Map> xmlNsCache; - - public TypeInfoSetImpl(Navigator nav, - AnnotationReader reader, - Map> leaves) { - this.nav = nav; - this.reader = reader; - this.builtins.putAll(leaves); - - this.anyType = createAnyType(); - - // register primitive types. - for (Map.Entry e : RuntimeUtil.primitiveToBox.entrySet()) { - this.builtins.put( nav.getPrimitive(e.getKey()), leaves.get(nav.ref(e.getValue())) ); - } - - // make sure at lease we got a map for global ones. - elementMappings.put(null,new LinkedHashMap>()); - } - - protected NonElement createAnyType() { - return new AnyTypeImpl(nav); - } - - public Navigator getNavigator() { - return nav; - } - - /** - * Adds a new {@link ClassInfo} to the set. - */ - public void add( ClassInfoImpl ci ) { - beans.put( ci.getClazz(), ci ); - } - - /** - * Adds a new {@link LeafInfo} to the set. - */ - public void add( EnumLeafInfoImpl li ) { - enums.put( li.clazz, li ); - } - - public void add(ArrayInfoImpl ai) { - arrays.put( ai.getType(), ai ); - } - - /** - * Returns a {@link TypeInfo} for the given type. - * - * @return - * null if the specified type cannot be bound by JAXB, or - * not known to this set. - */ - public NonElement getTypeInfo( T type ) { - type = nav.erasure(type); // replace type variables by their bounds - - LeafInfo l = builtins.get(type); - if(l!=null) return l; - - if( nav.isArray(type) ) { - return arrays.get(type); - } - - C d = nav.asDecl(type); - if(d==null) return null; - return getClassInfo(d); - } - - public NonElement getAnyTypeInfo() { - return anyType; - } - - /** - * This method is used to add a root reference to a model. - */ - public NonElement getTypeInfo(Ref ref) { - // TODO: handle XmlValueList - assert !ref.valueList; - C c = nav.asDecl(ref.type); - if(c!=null && reader.getClassAnnotation(XmlRegistry.class,c,null/*TODO: is this right?*/)!=null) { - return null; // TODO: is this correct? - } else - return getTypeInfo(ref.type); - } - - /** - * Returns all the {@link ClassInfo}s known to this set. - */ - public Map> beans() { - return beansView; - } - - public Map> builtins() { - return builtins; - } - - public Map> enums() { - return enums; - } - - public Map> arrays() { - return arrays; - } - - /** - * Returns a {@link ClassInfo} for the given bean. - * - *

- * This method is almost like refinement of {@link #getTypeInfo(Object)} except - * our C cannot derive from T. - * - * @return - * null if the specified type is not bound by JAXB or otherwise - * unknown to this set. - */ - public NonElement getClassInfo( C type ) { - LeafInfo l = builtins.get(nav.use(type)); - if(l!=null) return l; - - l = enums.get(type); - if(l!=null) return l; - - if(nav.asDecl(Object.class).equals(type)) - return anyType; - - return beans.get(type); - } - - public ElementInfoImpl getElementInfo( C scope, QName name ) { - while(scope!=null) { - Map> m = elementMappings.get(scope); - if(m!=null) { - ElementInfoImpl r = m.get(name); - if(r!=null) return r; - } - scope = nav.getSuperClass(scope); - } - return elementMappings.get(null).get(name); - } - - /** - * @param builder - * used for reporting errors. - */ - public final void add( ElementInfoImpl ei, ModelBuilder builder ) { - C scope = null; - if(ei.getScope()!=null) - scope = ei.getScope().getClazz(); - - Map> m = elementMappings.get(scope); - if(m==null) - elementMappings.put(scope,m=new LinkedHashMap>()); - - ElementInfoImpl existing = m.put(ei.getElementName(),ei); - - if(existing!=null) { - QName en = ei.getElementName(); - builder.reportError( - new IllegalAnnotationException( - Messages.CONFLICTING_XML_ELEMENT_MAPPING.format(en.getNamespaceURI(),en.getLocalPart()), - ei, existing )); - } - } - - public Map> getElementMappings( C scope ) { - return elementMappings.get(scope); - } - - public Iterable> getAllElements() { - return allElements; - } - - public Map getXmlNs(String namespaceUri) { - if(xmlNsCache==null) { - xmlNsCache = new HashMap>(); - - for (ClassInfoImpl ci : beans().values()) { - XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null ); - if(xs==null) - continue; - - String uri = xs.namespace(); - Map m = xmlNsCache.get(uri); - if(m==null) - xmlNsCache.put(uri,m=new HashMap()); - - for( XmlNs xns : xs.xmlns() ) { - m.put(xns.prefix(),xns.namespaceURI()); - } - } - } - - Map r = xmlNsCache.get(namespaceUri); - if(r!=null) return r; - else return Collections.emptyMap(); - } - - public Map getSchemaLocations() { - Map r = new HashMap(); - for (ClassInfoImpl ci : beans().values()) { - XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null ); - if(xs==null) - continue; - - String loc = xs.location(); - if(loc.equals(XmlSchema.NO_LOCATION)) - continue; // unspecified - - r.put(xs.namespace(),loc); - } - return r; - } - - public final XmlNsForm getElementFormDefault(String nsUri) { - for (ClassInfoImpl ci : beans().values()) { - XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null ); - if(xs==null) - continue; - - if(!xs.namespace().equals(nsUri)) - continue; - - XmlNsForm xnf = xs.elementFormDefault(); - if(xnf!=XmlNsForm.UNSET) - return xnf; - } - return XmlNsForm.UNSET; - } - - public final XmlNsForm getAttributeFormDefault(String nsUri) { - for (ClassInfoImpl ci : beans().values()) { - XmlSchema xs = reader.getPackageAnnotation( XmlSchema.class, ci.getClazz(), null ); - if(xs==null) - continue; - - if(!xs.namespace().equals(nsUri)) - continue; - - XmlNsForm xnf = xs.attributeFormDefault(); - if(xnf!=XmlNsForm.UNSET) - return xnf; - } - return XmlNsForm.UNSET; - } - - /** - * Dumps this model into XML. - * - * For debug only. - * - * TODO: not sure if this actually works. We don't really know what are T,C. - */ - public void dump( Result out ) throws JAXBException { - JAXBContext context = JAXBContext.newInstance(this.getClass()); - Marshaller m = context.createMarshaller(); - m.marshal(this,out); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/TypeRefImpl.java 2018-01-30 20:32:37.000000000 -0500 +++ /dev/null 2018-01-30 20:32:37.000000000 -0500 @@ -1,88 +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.xml.internal.bind.v2.model.impl; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeRef; - -/** - * @author Kohsuke Kawaguchi - */ -class TypeRefImpl implements TypeRef { - private final QName elementName; - private final TypeT type; - protected final ElementPropertyInfoImpl owner; - private NonElement ref; - private final boolean isNillable; - private String defaultValue; - - public TypeRefImpl(ElementPropertyInfoImpl owner, QName elementName, TypeT type, boolean isNillable, String defaultValue) { - this.owner = owner; - this.elementName = elementName; - this.type = type; - this.isNillable = isNillable; - this.defaultValue = defaultValue; - assert owner!=null; - assert elementName!=null; - assert type!=null; - } - - public NonElement getTarget() { - if(ref==null) - calcRef(); - return ref; - } - - public QName getTagName() { - return elementName; - } - - public boolean isNillable() { - return isNillable; - } - - public String getDefaultValue() { - return defaultValue; - } - - protected void link() { - // if we have'nt computed the ref yet, do so now. - calcRef(); - } - - private void calcRef() { - // we can't do this eagerly because of a cyclic dependency - ref = owner.parent.builder.getTypeInfo(type,owner); - assert ref!=null; - } - - public PropertyInfo getSource() { - return owner; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Util.java 2018-01-30 20:32:38.000000000 -0500 +++ /dev/null 2018-01-30 20:32:38.000000000 -0500 @@ -1,94 +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.xml.internal.bind.v2.model.impl; - -import javax.activation.MimeType; -import javax.activation.MimeTypeParseException; -import javax.xml.bind.annotation.XmlMimeType; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlSchemaTypes; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationReader; -import com.sun.xml.internal.bind.v2.model.annotation.AnnotationSource; -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; -import com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationException; - -/** - * Common code between {@link PropertyInfoImpl} and {@link ElementInfoImpl}. - * - * @author Kohsuke Kawaguchi - */ -final class Util { - static QName calcSchemaType( - AnnotationReader reader, - AnnotationSource primarySource, C enclosingClass, T individualType, Locatable src ) { - - XmlSchemaType xst = primarySource.readAnnotation(XmlSchemaType.class); - if(xst!=null) { - return new QName(xst.namespace(),xst.name()); - } - - // check the defaulted annotation - XmlSchemaTypes xsts = reader.getPackageAnnotation(XmlSchemaTypes.class,enclosingClass,src); - XmlSchemaType[] values = null; - if(xsts!=null) - values = xsts.value(); - else { - xst = reader.getPackageAnnotation(XmlSchemaType.class,enclosingClass,src); - if(xst!=null) { - values = new XmlSchemaType[1]; - values[0] = xst; - } - } - if(values!=null) { - for( XmlSchemaType item : values ) { - if(reader.getClassValue(item,"type").equals(individualType)) { - return new QName(item.namespace(),item.name()); - } - } - } - - return null; - } - - static MimeType calcExpectedMediaType(AnnotationSource primarySource, - ModelBuilder builder ) { - XmlMimeType xmt = primarySource.readAnnotation(XmlMimeType.class); - if(xmt==null) - return null; - - try { - return new MimeType(xmt.value()); - } catch (MimeTypeParseException e) { - builder.reportError(new IllegalAnnotationException( - Messages.ILLEGAL_MIME_TYPE.format(xmt.value(),e.getMessage()), - xmt - )); - return null; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/Utils.java 2018-01-30 20:32:39.000000000 -0500 +++ /dev/null 2018-01-30 20:32:39.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, 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.bind.v2.model.impl; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Utils class. - * - * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. - * - * Has *package private* access to avoid inappropriate usage. - */ -final class Utils { - - private static final Logger LOGGER = Logger.getLogger(Utils.class.getName()); - - /** - * static ReflectionNavigator field to avoid usage of reflection every time we use it. - */ - static final Navigator REFLECTION_NAVIGATOR; - - static { // we statically initializing REFLECTION_NAVIGATOR property - try { - final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - - // requires accessClassInPackage privilege - final Method getInstance = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Method run() { - try { - Method getInstance = refNav.getDeclaredMethod("getInstance"); - getInstance.setAccessible(true); - return getInstance; - } catch (NoSuchMethodException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); - } - } - } - ); - - //noinspection unchecked - REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); - } catch (ClassNotFoundException e) { - throw new IllegalStateException("Can't find ReflectionNavigator class"); - } catch (InvocationTargetException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (IllegalAccessException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); - } catch (SecurityException e) { - LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); - throw e; - } - } - - /** - * private constructor to avoid util class instantiating - */ - private Utils() { - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/ValuePropertyInfoImpl.java 2018-01-30 20:32:39.000000000 -0500 +++ /dev/null 2018-01-30 20:32:39.000000000 -0500 @@ -1,48 +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.xml.internal.bind.v2.model.impl; - -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.ValuePropertyInfo; - -/** - * @author Kohsuke Kawaguchi - */ -class ValuePropertyInfoImpl - extends SingleTypePropertyInfoImpl - implements ValuePropertyInfo { - - ValuePropertyInfoImpl( - ClassInfoImpl parent, - PropertySeed seed) { - - super(parent,seed); - } - - public PropertyKind kind() { - return PropertyKind.VALUE; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/impl/package-info.java 2018-01-30 20:32:40.000000000 -0500 +++ /dev/null 2018-01-30 20:32:40.000000000 -0500 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * Implementation of the com.sun.xml.internal.bind.j2s.model package. - */ -package com.sun.xml.internal.bind.v2.model.impl; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/GenericArrayTypeImpl.java 2018-01-30 20:32:41.000000000 -0500 +++ /dev/null 2018-01-30 20:32:41.000000000 -0500 @@ -1,81 +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.xml.internal.bind.v2.model.nav; - -import java.lang.reflect.GenericArrayType; -import java.lang.reflect.Type; - -/** - * Implementation of GenericArrayType interface for core reflection. - */ -final class GenericArrayTypeImpl implements GenericArrayType { - private Type genericComponentType; - - GenericArrayTypeImpl(Type ct) { - assert ct!=null; - genericComponentType = ct; - } - - /** - * Returns a {@code Type} object representing the component type - * of this array. - * - * @return a {@code Type} object representing the component type - * of this array - * @since 1.5 - */ - public Type getGenericComponentType() { - return genericComponentType; // return cached component type - } - - public String toString() { - Type componentType = getGenericComponentType(); - StringBuilder sb = new StringBuilder(); - - if (componentType instanceof Class) - sb.append(((Class) componentType).getName()); - else - sb.append(componentType.toString()); - sb.append("[]"); - return sb.toString(); - } - - @Override - public boolean equals(Object o) { - if (o instanceof GenericArrayType) { - GenericArrayType that = (GenericArrayType) o; - - Type thatComponentType = that.getGenericComponentType(); - return genericComponentType.equals(thatComponentType); - } else - return false; - } - - @Override - public int hashCode() { - return genericComponentType.hashCode(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/Navigator.java 2018-01-30 20:32:41.000000000 -0500 +++ /dev/null 2018-01-30 20:32:41.000000000 -0500 @@ -1,404 +0,0 @@ -/* - * 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.bind.v2.model.nav; - -import java.util.Collection; - -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * Provides unified view of the underlying reflection library, - * such as {@code java.lang.reflect} and/or Annotation Processing. - * - *

- * This interface provides navigation over the reflection model - * to decouple the caller from any particular implementation. - * This allows the JAXB RI to reuse much of the code between - * the compile time (which works on top of Annotation Processing) and the run-time - * (which works on top of {@code java.lang.reflect}) - * - *

- * {@link Navigator} instances are stateless and immutable. - * - * - *

Parameterization

- *

C

- *

- * A Java class declaration (not an interface, a class and an enum.) - * - *

T

- *

- * A Java type. This includs declaration, but also includes such - * things like arrays, primitive types, parameterized types, and etc. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public interface Navigator { - /** - * Gets the base class of the specified class. - * - * @return - * null if the parameter represents {@link Object}. - */ - C getSuperClass(C clazz); - - /** - * Gets the parameterization of the given base type. - * - *

- * For example, given the following - *

{@code
-     * interface Foo extends List> {}
-     * interface Bar extends Foo {}
-     * }
- * This method works like this: - *
{@code
-     * getBaseClass( Bar, List ) = List>
-     * getBaseClass( Bar, Foo  ) = Foo
-     * getBaseClass( Foo, Collection ) = Collection>
-     * getBaseClass( ArrayList, List ) = List
-     * }
- * - * @param type - * The type that derives from {@code baseType} - * @param baseType - * The class whose parameterization we are interested in. - * @return - * The use of {@code baseType} in {@code type}. - * or null if the type is not assignable to the base type. - */ - T getBaseClass(T type, C baseType); - - /** - * Gets the fully-qualified name of the class. - * ("java.lang.Object" for {@link Object}) - */ - String getClassName(C clazz); - - /** - * Gets the display name of the type object - * - * @return - * a human-readable name that the type represents. - */ - String getTypeName(T rawType); - - /** - * Gets the short name of the class ("Object" for {@link Object}.) - * - * For nested classes, this method should just return the inner name. - * (for example "Inner" for "com.acme.Outer$Inner". - */ - String getClassShortName(C clazz); - - /** - * Gets all the declared fields of the given class. - */ - Collection getDeclaredFields(C clazz); - - /** - * Gets the named field declared on the given class. - * - * This method doesn't visit ancestors, but does recognize - * non-public fields. - * - * @return - * null if not found - */ - F getDeclaredField(C clazz, String fieldName); - - /** - * Gets all the declared methods of the given class - * (regardless of their access modifiers, regardless - * of whether they override methods of the base classes.) - * - *

- * Note that this method does not list methods declared on base classes. - * - * @return - * can be empty but always non-null. - */ - Collection getDeclaredMethods(C clazz); - - /** - * Gets the class that declares the given field. - */ - C getDeclaringClassForField(F field); - - /** - * Gets the class that declares the given method. - */ - C getDeclaringClassForMethod(M method); - - /** - * Gets the type of the field. - */ - T getFieldType(F f); - - /** - * Gets the name of the field. - */ - String getFieldName(F field); - - /** - * Gets the name of the method, such as "toString" or "equals". - */ - String getMethodName(M m); - - /** - * Gets the return type of a method. - */ - T getReturnType(M m); - - /** - * Returns the list of parameters to the method. - */ - T[] getMethodParameters(M method); - - /** - * Returns true if the method is static. - */ - boolean isStaticMethod(M method); - - /** - * Checks if {@code sub} is a sub-type of {@code sup}. - * - * TODO: should this method take T or C? - */ - boolean isSubClassOf(T sub, T sup); - - /** - * Gets the representation of the given Java type in {@code T}. - * - * @param c - * can be a primitive, array, class, or anything. - * (therefore the return type has to be T, not C) - */ - T ref(Class c); - - /** - * Gets the T for the given C. - */ - T use(C c); - - /** - * If the given type is an use of class declaration, - * returns the type casted as {@code C}. - * Otherwise null. - * - *

- * TODO: define the exact semantics. - */ - C asDecl(T type); - - /** - * Gets the {@code C} representation for the given class. - * - * The behavior is undefined if the class object represents - * primitives, arrays, and other types that are not class declaration. - */ - C asDecl(Class c); - - /** - * Checks if the type is an array type. - */ - boolean isArray(T t); - - /** - * Checks if the type is an array type but not byte[]. - */ - boolean isArrayButNotByteArray(T t); - - /** - * Gets the component type of the array. - * - * @param t - * must be an array. - */ - T getComponentType(T t); - - /** - * Gets the i-th type argument from a parameterized type. - * - * For example, {@code getTypeArgument([Map],0)=Integer} - * - * @throws IllegalArgumentException - * If t is not a parameterized type - * @throws IndexOutOfBoundsException - * If i is out of range. - * - * @see #isParameterizedType(Object) - */ - T getTypeArgument(T t, int i); - - /** - * Returns true if t is a parameterized type. - */ - boolean isParameterizedType(T t); - - /** - * Checks if the given type is a primitive type. - */ - boolean isPrimitive(T t); - - /** - * Returns the representation for the given primitive type. - * - * @param primitiveType - * must be Class objects like {@link Integer#TYPE}. - */ - T getPrimitive(Class primitiveType); - - /** - * Returns a location of the specified class. - */ - Location getClassLocation(C clazz); - - Location getFieldLocation(F field); - - Location getMethodLocation(M getter); - - /** - * Returns true if the given class has a no-arg default constructor. - * The constructor does not need to be public. - */ - boolean hasDefaultConstructor(C clazz); - - /** - * Returns true if the field is static. - */ - boolean isStaticField(F field); - - /** - * Returns true if the method is public. - */ - boolean isPublicMethod(M method); - - /** - * Returns true if the method is final. - */ - boolean isFinalMethod(M method); - - /** - * Returns true if the field is public. - */ - boolean isPublicField(F field); - - /** - * Returns true if this is an enum class. - */ - boolean isEnum(C clazz); - - /** - * Computes the erasure - */ -

T erasure(T contentInMemoryType); - // This unused P is necessary to make ReflectionNavigator.erasure work nicely - - /** - * Returns true if this is an abstract class. - */ - boolean isAbstract(C clazz); - - /** - * Returns true if this is a final class. - */ - boolean isFinal(C clazz); - - /** - * Gets the enumeration constants from an enum class. - * - * @param clazz - * must derive from {@link Enum}. - * - * @return - * can be empty but never null. - */ - F[] getEnumConstants(C clazz); - - /** - * Gets the representation of the primitive "void" type. - */ - T getVoidType(); - - /** - * Gets the package name of the given class. - * - * @return - * i.e. "", "java.lang" but not null. - */ - String getPackageName(C clazz); - - /** - * Finds ObjectFactory for the given referencePoint. - * - * @param referencePoint - * The class that refers to the specified class. - * @return - * null if not found. - */ - C loadObjectFactory(C referencePoint, String packageName); - - /** - * Returns true if this method is a bridge method as defined in JLS. - */ - boolean isBridgeMethod(M method); - - /** - * Returns true if the given method is overriding another one - * defined in the base class 'base' or its ancestors. - */ - boolean isOverriding(M method, C base); - - /** - * Returns true if 'clazz' is an interface. - */ - boolean isInterface(C clazz); - - /** - * Returns true if the field is transient. - */ - boolean isTransient(F f); - - /** - * Returns true if the given class is an inner class. - * - * This is only used to improve the error diagnostics, so - * it's OK to fail to detect some inner classes as such. - * - * Note that this method should return false for nested classes - * (static classes.) - */ - boolean isInnerClass(C clazz); - - /** - * Checks if types are the same - * @param t1 type - * @param t2 type - * @return true if types are the same - */ - boolean isSameType(T t1, T t2); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/ParameterizedTypeImpl.java 2018-01-30 20:32:42.000000000 -0500 +++ /dev/null 2018-01-30 20:32:42.000000000 -0500 @@ -1,181 +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.bind.v2.model.nav; - -import java.lang.reflect.MalformedParameterizedTypeException; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.util.Arrays; - - -/** - * {@link ParameterizedType} implementation. - */ -class ParameterizedTypeImpl implements ParameterizedType { - private Type[] actualTypeArguments; - private Class rawType; - private Type ownerType; - - ParameterizedTypeImpl(Class rawType, - Type[] actualTypeArguments, - Type ownerType) { - this.actualTypeArguments = actualTypeArguments; - this.rawType = rawType; - if (ownerType != null) { - this.ownerType = ownerType; - } else { - this.ownerType = rawType.getDeclaringClass(); - } - validateConstructorArguments(); - } - - private void validateConstructorArguments() { - TypeVariable/**/[] formals = rawType.getTypeParameters(); - // check correct arity of actual type args - if (formals.length != actualTypeArguments.length) { - throw new MalformedParameterizedTypeException(); - } -/* - for (int i = 0; i < actualTypeArguments.length; i++) { - // check actuals against formals' bounds - } -*/ - } - - public Type[] getActualTypeArguments() { - return actualTypeArguments.clone(); - } - - public Class getRawType() { - return rawType; - } - - public Type getOwnerType() { - return ownerType; - } - - /* - * From the JavaDoc for java.lang.reflect.ParameterizedType - * "Instances of classes that implement this interface must - * implement an equals() method that equates any two instances - * that share the same generic type declaration and have equal - * type parameters." - */ - @Override - public boolean equals(Object o) { - if (o instanceof ParameterizedType) { - // Check that information is equivalent - ParameterizedType that = (ParameterizedType) o; - - if (this == that) - return true; - - Type thatOwner = that.getOwnerType(); - Type thatRawType = that.getRawType(); - -/* - if (false) { // Debugging - boolean ownerEquality = (ownerType == null ? - thatOwner == null : - ownerType.equals(thatOwner)); - boolean rawEquality = (rawType == null ? - thatRawType == null : - rawType.equals(thatRawType)); - - boolean typeArgEquality = Arrays.equals(actualTypeArguments, // avoid clone - that.getActualTypeArguments()); - for (Type t : actualTypeArguments) { - System.out.printf("\t\t%s%s%n", t, t.getClass()); - } - - System.out.printf("\towner %s\traw %s\ttypeArg %s%n", - ownerEquality, rawEquality, typeArgEquality); - return ownerEquality && rawEquality && typeArgEquality; - } -*/ - - - return - (ownerType == null ? - thatOwner == null : - ownerType.equals(thatOwner)) && - (rawType == null ? - thatRawType == null : - rawType.equals(thatRawType)) && - Arrays.equals(actualTypeArguments, // avoid clone - that.getActualTypeArguments()); - } else - return false; - } - - @Override - public int hashCode() { - return Arrays.hashCode(actualTypeArguments) ^ - (ownerType == null ? 0 : ownerType.hashCode()) ^ - (rawType == null ? 0 : rawType.hashCode()); - } - - public String toString() { - StringBuilder sb = new StringBuilder(); - - if (ownerType != null) { - if (ownerType instanceof Class) - sb.append(((Class) ownerType).getName()); - else - sb.append(ownerType.toString()); - - sb.append("."); - - if (ownerType instanceof ParameterizedTypeImpl) { - // Find simple name of nested type by removing the - // shared prefix with owner. - sb.append(rawType.getName().replace(((ParameterizedTypeImpl) ownerType).rawType.getName() + "$", - "")); - } else - sb.append(rawType.getName()); - } else - sb.append(rawType.getName()); - - if (actualTypeArguments != null && - actualTypeArguments.length > 0) { - sb.append("<"); - boolean first = true; - for (Type t : actualTypeArguments) { - if (!first) - sb.append(", "); - if (t instanceof Class) - sb.append(((Class) t).getName()); - else - sb.append(t.toString()); - first = false; - } - sb.append(">"); - } - - return sb.toString(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/ReflectionNavigator.java 2018-01-30 20:32:43.000000000 -0500 +++ /dev/null 2018-01-30 20:32:43.000000000 -0500 @@ -1,661 +0,0 @@ -/* - * 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.bind.v2.model.nav; - -import java.lang.reflect.Array; -import java.lang.reflect.Field; -import java.lang.reflect.GenericArrayType; -import java.lang.reflect.GenericDeclaration; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.lang.reflect.WildcardType; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Arrays; -import java.util.Collection; - -import com.sun.xml.internal.bind.v2.runtime.Location; - -/** - * {@link Navigator} implementation for {@code java.lang.reflect}. - * - */ -/*package*/final class ReflectionNavigator implements Navigator { - -// ---------- Singleton ----------------- - private static final ReflectionNavigator INSTANCE = new ReflectionNavigator(); - - /*package*/static ReflectionNavigator getInstance() { - return INSTANCE; - } - - private ReflectionNavigator() { - } -// --------------------------------------- - - public Class getSuperClass(Class clazz) { - if (clazz == Object.class) { - return null; - } - Class sc = clazz.getSuperclass(); - if (sc == null) { - sc = Object.class; // error recovery - } - return sc; - } - - private static final TypeVisitor baseClassFinder = new TypeVisitor() { - - public Type onClass(Class c, Class sup) { - // t is a raw type - if (sup == c) { - return sup; - } - - Type r; - - Type sc = c.getGenericSuperclass(); - if (sc != null) { - r = visit(sc, sup); - if (r != null) { - return r; - } - } - - for (Type i : c.getGenericInterfaces()) { - r = visit(i, sup); - if (r != null) { - return r; - } - } - - return null; - } - - public Type onParameterizdType(ParameterizedType p, Class sup) { - Class raw = (Class) p.getRawType(); - if (raw == sup) { - // p is of the form sup<...> - return p; - } else { - // recursively visit super class/interfaces - Type r = raw.getGenericSuperclass(); - if (r != null) { - r = visit(bind(r, raw, p), sup); - } - if (r != null) { - return r; - } - for (Type i : raw.getGenericInterfaces()) { - r = visit(bind(i, raw, p), sup); - if (r != null) { - return r; - } - } - return null; - } - } - - public Type onGenericArray(GenericArrayType g, Class sup) { - // not clear what I should do here - return null; - } - - public Type onVariable(TypeVariable v, Class sup) { - return visit(v.getBounds()[0], sup); - } - - public Type onWildcard(WildcardType w, Class sup) { - // not clear what I should do here - return null; - } - - /** - * Replaces the type variables in {@code t} by its actual arguments. - * - * @param decl - * provides a list of type variables. See {@link GenericDeclaration#getTypeParameters()} - * @param args - * actual arguments. See {@link ParameterizedType#getActualTypeArguments()} - */ - private Type bind(Type t, GenericDeclaration decl, ParameterizedType args) { - return binder.visit(t, new BinderArg(decl, args.getActualTypeArguments())); - } - }; - - private static class BinderArg { - - final TypeVariable[] params; - final Type[] args; - - BinderArg(TypeVariable[] params, Type[] args) { - this.params = params; - this.args = args; - assert params.length == args.length; - } - - public BinderArg(GenericDeclaration decl, Type[] args) { - this(decl.getTypeParameters(), args); - } - - Type replace(TypeVariable v) { - for (int i = 0; i < params.length; i++) { - if (params[i].equals(v)) { - return args[i]; - } - } - return v; // this is a free variable - } - } - private static final TypeVisitor binder = new TypeVisitor() { - - public Type onClass(Class c, BinderArg args) { - return c; - } - - public Type onParameterizdType(ParameterizedType p, BinderArg args) { - Type[] params = p.getActualTypeArguments(); - - boolean different = false; - for (int i = 0; i < params.length; i++) { - Type t = params[i]; - params[i] = visit(t, args); - different |= t != params[i]; - } - - Type newOwner = p.getOwnerType(); - if (newOwner != null) { - newOwner = visit(newOwner, args); - } - different |= p.getOwnerType() != newOwner; - - if (!different) { - return p; - } - - return new ParameterizedTypeImpl((Class) p.getRawType(), params, newOwner); - } - - public Type onGenericArray(GenericArrayType g, BinderArg types) { - Type c = visit(g.getGenericComponentType(), types); - if (c == g.getGenericComponentType()) { - return g; - } - - return new GenericArrayTypeImpl(c); - } - - public Type onVariable(TypeVariable v, BinderArg types) { - return types.replace(v); - } - - public Type onWildcard(WildcardType w, BinderArg types) { - // TODO: this is probably still incorrect - // bind( "? extends T" ) with T= "? extends Foo" should be "? extends Foo", - // not "? extends (? extends Foo)" - Type[] lb = w.getLowerBounds(); - Type[] ub = w.getUpperBounds(); - boolean diff = false; - - for (int i = 0; i < lb.length; i++) { - Type t = lb[i]; - lb[i] = visit(t, types); - diff |= (t != lb[i]); - } - - for (int i = 0; i < ub.length; i++) { - Type t = ub[i]; - ub[i] = visit(t, types); - diff |= (t != ub[i]); - } - - if (!diff) { - return w; - } - - return new WildcardTypeImpl(lb, ub); - } - }; - - public Type getBaseClass(Type t, Class sup) { - return baseClassFinder.visit(t, sup); - } - - public String getClassName(Class clazz) { - return clazz.getName(); - } - - public String getTypeName(Type type) { - if (type instanceof Class) { - Class c = (Class) type; - if (c.isArray()) { - return getTypeName(c.getComponentType()) + "[]"; - } - return c.getName(); - } - return type.toString(); - } - - public String getClassShortName(Class clazz) { - return clazz.getSimpleName(); - } - - public Collection getDeclaredFields(final Class clazz) { - Field[] fields = AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Field[] run() { - return clazz.getDeclaredFields(); - } - }); - return Arrays.asList(fields); - } - - public Field getDeclaredField(final Class clazz, final String fieldName) { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Field run() { - try { - return clazz.getDeclaredField(fieldName); - } catch (NoSuchFieldException e) { - return null; - } - } - }); - } - - public Collection getDeclaredMethods(final Class clazz) { - Method[] methods = - AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Method[] run() { - return clazz.getDeclaredMethods(); - } - }); - return Arrays.asList(methods); - } - - public Class getDeclaringClassForField(Field field) { - return field.getDeclaringClass(); - } - - public Class getDeclaringClassForMethod(Method method) { - return method.getDeclaringClass(); - } - - public Type getFieldType(Field field) { - if (field.getType().isArray()) { - Class c = field.getType().getComponentType(); - if (c.isPrimitive()) { - return Array.newInstance(c, 0).getClass(); - } - } - return fix(field.getGenericType()); - } - - public String getFieldName(Field field) { - return field.getName(); - } - - public String getMethodName(Method method) { - return method.getName(); - } - - public Type getReturnType(Method method) { - return fix(method.getGenericReturnType()); - } - - public Type[] getMethodParameters(Method method) { - return method.getGenericParameterTypes(); - } - - public boolean isStaticMethod(Method method) { - return Modifier.isStatic(method.getModifiers()); - } - - public boolean isFinalMethod(Method method) { - return Modifier.isFinal(method.getModifiers()); - } - - public boolean isSubClassOf(Type sub, Type sup) { - return erasure(sup).isAssignableFrom(erasure(sub)); - } - - public Class ref(Class c) { - return c; - } - - public Class use(Class c) { - return c; - } - - public Class asDecl(Type t) { - return erasure(t); - } - - public Class asDecl(Class c) { - return c; - } - /** - * Implements the logic for {@link #erasure(Type)}. - */ - private static final TypeVisitor eraser = new TypeVisitor() { - - public Class onClass(Class c, Void v) { - return c; - } - - public Class onParameterizdType(ParameterizedType p, Void v) { - // TODO: why getRawType returns Type? not Class? - return visit(p.getRawType(), null); - } - - public Class onGenericArray(GenericArrayType g, Void v) { - return Array.newInstance( - visit(g.getGenericComponentType(), null), - 0).getClass(); - } - - public Class onVariable(TypeVariable tv, Void v) { - return visit(tv.getBounds()[0], null); - } - - public Class onWildcard(WildcardType w, Void v) { - return visit(w.getUpperBounds()[0], null); - } - }; - - /** - * Returns the runtime representation of the given type. - * - * This corresponds to the notion of the erasure in JSR-14. - * - *

- * Because of the difference in the way Annotation Processing and the Java reflection - * treats primitive type and array type, we can't define this method - * on {@link Navigator}. - * - *

- * It made me realize how difficult it is to define the common navigation - * layer for two different underlying reflection library. The other way - * is to throw away the entire parameterization and go to the wrapper approach. - */ - public Class erasure(Type t) { - return eraser.visit(t, null); - } - - public boolean isAbstract(Class clazz) { - return Modifier.isAbstract(clazz.getModifiers()); - } - - public boolean isFinal(Class clazz) { - return Modifier.isFinal(clazz.getModifiers()); - } - - /** - * Returns the {@link Type} object that represents {@code clazz}. - */ - public Type createParameterizedType(Class rawType, Type... arguments) { - return new ParameterizedTypeImpl(rawType, arguments, null); - } - - public boolean isArray(Type t) { - if (t instanceof Class) { - Class c = (Class) t; - return c.isArray(); - } - if (t instanceof GenericArrayType) { - return true; - } - return false; - } - - public boolean isArrayButNotByteArray(Type t) { - if (t instanceof Class) { - Class c = (Class) t; - return c.isArray() && c != byte[].class; - } - if (t instanceof GenericArrayType) { - t = ((GenericArrayType) t).getGenericComponentType(); - return t != Byte.TYPE; - } - return false; - } - - public Type getComponentType(Type t) { - if (t instanceof Class) { - Class c = (Class) t; - return c.getComponentType(); - } - if (t instanceof GenericArrayType) { - return ((GenericArrayType) t).getGenericComponentType(); - } - - throw new IllegalArgumentException(); - } - - public Type getTypeArgument(Type type, int i) { - if (type instanceof ParameterizedType) { - ParameterizedType p = (ParameterizedType) type; - return fix(p.getActualTypeArguments()[i]); - } else { - throw new IllegalArgumentException(); - } - } - - public boolean isParameterizedType(Type type) { - return type instanceof ParameterizedType; - } - - public boolean isPrimitive(Type type) { - if (type instanceof Class) { - Class c = (Class) type; - return c.isPrimitive(); - } - return false; - } - - public Type getPrimitive(Class primitiveType) { - assert primitiveType.isPrimitive(); - return primitiveType; - } - - public Location getClassLocation(final Class clazz) { - return new Location() { - - @Override - public String toString() { - return clazz.getName(); - } - }; - } - - public Location getFieldLocation(final Field field) { - return new Location() { - - @Override - public String toString() { - return field.toString(); - } - }; - } - - public Location getMethodLocation(final Method method) { - return new Location() { - - @Override - public String toString() { - return method.toString(); - } - }; - } - - public boolean hasDefaultConstructor(Class c) { - try { - c.getDeclaredConstructor(); - return true; - } catch (NoSuchMethodException e) { - return false; // todo: do this WITHOUT exception throw - } - } - - public boolean isStaticField(Field field) { - return Modifier.isStatic(field.getModifiers()); - } - - public boolean isPublicMethod(Method method) { - return Modifier.isPublic(method.getModifiers()); - } - - public boolean isPublicField(Field field) { - return Modifier.isPublic(field.getModifiers()); - } - - public boolean isEnum(Class c) { - return Enum.class.isAssignableFrom(c); - } - - public Field[] getEnumConstants(Class clazz) { - try { - Object[] values = clazz.getEnumConstants(); - Field[] fields = new Field[values.length]; - for (int i = 0; i < values.length; i++) { - fields[i] = clazz.getField(((Enum) values[i]).name()); - } - return fields; - } catch (NoSuchFieldException e) { - // impossible - throw new NoSuchFieldError(e.getMessage()); - } - } - - public Type getVoidType() { - return Void.class; - } - - public String getPackageName(Class clazz) { - String name = clazz.getName(); - int idx = name.lastIndexOf('.'); - if (idx < 0) { - return ""; - } else { - return name.substring(0, idx); - } - } - - @Override - public Class loadObjectFactory(Class referencePoint, String pkg) { - ClassLoader cl = SecureLoader.getClassClassLoader(referencePoint); - if (cl == null) - cl = SecureLoader.getSystemClassLoader(); - - try { - return cl.loadClass(pkg + ".ObjectFactory"); - } catch (ClassNotFoundException e) { - return null; - } - } - - public boolean isBridgeMethod(Method method) { - return method.isBridge(); - } - - public boolean isOverriding(Method method, final Class base) { - // this isn't actually correct, - // as the JLS considers - // class Derived extends Base { - // Integer getX() { ... } - // } - // class Base { - // T getX() { ... } - // } - // to be overrided. Handling this correctly needs a careful implementation - - final String name = method.getName(); - final Class[] params = method.getParameterTypes(); - - return AccessController.doPrivileged( - new PrivilegedAction() { - - @Override - public Boolean run() { - Class clazz = base; - while (clazz != null) { - try { - Method m = clazz.getDeclaredMethod(name, params); - if (m != null) { - return Boolean.TRUE; - } - } catch (NoSuchMethodException ignored) { - // recursively go into the base class - } - clazz = clazz.getSuperclass(); - } - return Boolean.FALSE; - } - } - ); - } - - public boolean isInterface(Class clazz) { - return clazz.isInterface(); - } - - public boolean isTransient(Field f) { - return Modifier.isTransient(f.getModifiers()); - } - - public boolean isInnerClass(Class clazz) { - return clazz.getEnclosingClass() != null && !Modifier.isStatic(clazz.getModifiers()); - } - - @Override - public boolean isSameType(Type t1, Type t2) { - return t1.equals(t2); - } - - /** - * JDK 5.0 has a bug of creating {@link GenericArrayType} where it shouldn't. - * fix that manually to work around the problem. - * - * See bug 6202725. - */ - private Type fix(Type t) { - if (!(t instanceof GenericArrayType)) { - return t; - } - - GenericArrayType gat = (GenericArrayType) t; - if (gat.getGenericComponentType() instanceof Class) { - Class c = (Class) gat.getGenericComponentType(); - return Array.newInstance(c, 0).getClass(); - } - - return t; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/SecureLoader.java 2018-01-30 20:32:43.000000000 -0500 +++ /dev/null 2018-01-30 20:32:44.000000000 -0500 @@ -1,75 +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.bind.v2.model.nav; - -/** - * Class defined for safe calls of getClassLoader methods of any kind (context/system/class - * classloader. This MUST be package private and defined in every package which - * uses such invocations. - * @author snajper - */ -class SecureLoader { - - static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - - static ClassLoader getClassClassLoader(final Class c) { - if (System.getSecurityManager() == null) { - return c.getClassLoader(); - } else { - return java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public ClassLoader run() { - return c.getClassLoader(); - } - }); - } - } - - static ClassLoader getSystemClassLoader() { - if (System.getSecurityManager() == null) { - return ClassLoader.getSystemClassLoader(); - } else { - return java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public ClassLoader run() { - return ClassLoader.getSystemClassLoader(); - } - }); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/TypeVisitor.java 2018-01-30 20:32:44.000000000 -0500 +++ /dev/null 2018-01-30 20:32:44.000000000 -0500 @@ -1,62 +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.xml.internal.bind.v2.model.nav; - -import java.lang.reflect.GenericArrayType; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; -import java.lang.reflect.TypeVariable; -import java.lang.reflect.WildcardType; - -/** - * @author Kohsuke Kawaguchi - */ -abstract class TypeVisitor { - public final T visit( Type t, P param ) { - assert t!=null; - - if (t instanceof Class) - return onClass((Class)t,param); - if (t instanceof ParameterizedType) - return onParameterizdType( (ParameterizedType)t,param); - if(t instanceof GenericArrayType) - return onGenericArray((GenericArrayType)t,param); - if(t instanceof WildcardType) - return onWildcard((WildcardType)t,param); - if(t instanceof TypeVariable) - return onVariable((TypeVariable)t,param); - - // covered all the cases - assert false; - throw new IllegalArgumentException(); - } - - protected abstract T onClass(Class c, P param); - protected abstract T onParameterizdType(ParameterizedType p, P param); - protected abstract T onGenericArray(GenericArrayType g, P param); - protected abstract T onVariable(TypeVariable v, P param); - protected abstract T onWildcard(WildcardType w, P param); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/WildcardTypeImpl.java 2018-01-30 20:32:45.000000000 -0500 +++ /dev/null 2018-01-30 20:32:45.000000000 -0500 @@ -1,65 +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.xml.internal.bind.v2.model.nav; - -import java.lang.reflect.Type; -import java.lang.reflect.WildcardType; -import java.util.Arrays; - -/** - * @author Kohsuke Kawaguchi - */ -final class WildcardTypeImpl implements WildcardType { - - private final Type[] ub; - private final Type[] lb; - - public WildcardTypeImpl(Type[] ub, Type[] lb) { - this.ub = ub; - this.lb = lb; - } - - public Type[] getUpperBounds() { - return ub; - } - - public Type[] getLowerBounds() { - return lb; - } - - public int hashCode() { - return Arrays.hashCode(lb) ^ Arrays.hashCode(ub); - } - - public boolean equals(Object obj) { - if (obj instanceof WildcardType) { - WildcardType that = (WildcardType) obj; - return Arrays.equals(that.getLowerBounds(),lb) - && Arrays.equals(that.getUpperBounds(),ub); - } - return false; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/nav/package-info.java 2018-01-30 20:32:46.000000000 -0500 +++ /dev/null 2018-01-30 20:32:46.000000000 -0500 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * Abstraction around the reflection library, to support various reflection models (such as java.lang.reflect and Annotation Processing). - */ -package com.sun.xml.internal.bind.v2.model.nav; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeArrayInfo.java 2018-01-30 20:32:46.000000000 -0500 +++ /dev/null 2018-01-30 20:32:46.000000000 -0500 @@ -1,49 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.ArrayInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeArrayInfo extends ArrayInfo, RuntimeNonElement { - /** - * Represents {@code T[]}. - * - * The same as {@link TypeInfo#getType()} but at the runtime, an array - * is guaranteed to have a {@link Class} representation, not just any {@link Type}. - */ - Class getType(); - - /** - * {@inheritDoc} - */ - RuntimeNonElement getItemType(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeAttributePropertyInfo.java 2018-01-30 20:32:47.000000000 -0500 +++ /dev/null 2018-01-30 20:32:47.000000000 -0500 @@ -1,38 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.AttributePropertyInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeAttributePropertyInfo extends AttributePropertyInfo, RuntimePropertyInfo, RuntimeNonElementRef { - // refinement - RuntimeNonElement getTarget(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeBuiltinLeafInfo.java 2018-01-30 20:32:48.000000000 -0500 +++ /dev/null 2018-01-30 20:32:48.000000000 -0500 @@ -1,36 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.BuiltinLeafInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeBuiltinLeafInfo extends BuiltinLeafInfo, RuntimeLeafInfo { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeClassInfo.java 2018-01-30 20:32:49.000000000 -0500 +++ /dev/null 2018-01-30 20:32:49.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.model.runtime; - -import java.lang.reflect.Type; -import java.lang.reflect.Method; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.core.ClassInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.annotation.XmlLocation; - -import org.xml.sax.Locator; - -/** - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public interface RuntimeClassInfo extends ClassInfo, RuntimeNonElement { - RuntimeClassInfo getBaseClass(); - - // refined to return RuntimePropertyInfo - List getProperties(); - RuntimePropertyInfo getProperty(String name); - - Method getFactoryMethod(); - - /** - * If {@link #hasAttributeWildcard()} is true, - * returns the accessor to access the property. - * - * @return - * unoptimized accessor. - * non-null iff {@link #hasAttributeWildcard()}==true. - * - * @see Accessor#optimize(JAXBContextImpl) - */ - Accessor> getAttributeWildcard(); - - /** - * If this JAXB bean has a property annotated with {@link XmlLocation}, - * this method returns it. - * - * @return may be null. - */ - Accessor getLocatorField(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeElement.java 2018-01-30 20:32:49.000000000 -0500 +++ /dev/null 2018-01-30 20:32:49.000000000 -0500 @@ -1,36 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.Element; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeElement extends Element, RuntimeTypeInfo { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeElementInfo.java 2018-01-30 20:32:50.000000000 -0500 +++ /dev/null 2018-01-30 20:32:50.000000000 -0500 @@ -1,51 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import javax.xml.bind.JAXBElement; - -import com.sun.xml.internal.bind.v2.model.core.ElementInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeElementInfo extends ElementInfo, RuntimeElement { - RuntimeClassInfo getScope(); - - RuntimeElementPropertyInfo getProperty(); - - /** - * Returns the custom {@link JAXBElement} class tailored this element. - */ - Class getType(); - - /** - * {@inheritDoc} - */ - RuntimeNonElement getContentType(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeElementPropertyInfo.java 2018-01-30 20:32:50.000000000 -0500 +++ /dev/null 2018-01-30 20:32:51.000000000 -0500 @@ -1,42 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; -import java.util.Collection; -import java.util.List; - -import com.sun.xml.internal.bind.v2.model.core.ElementPropertyInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeElementPropertyInfo extends ElementPropertyInfo, RuntimePropertyInfo { - /** {@inheritDoc} */ - Collection ref(); - - List getTypes(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeEnumLeafInfo.java 2018-01-30 20:32:51.000000000 -0500 +++ /dev/null 2018-01-30 20:32:51.000000000 -0500 @@ -1,36 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.EnumLeafInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeEnumLeafInfo extends EnumLeafInfo, RuntimeLeafInfo { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeLeafInfo.java 2018-01-30 20:32:52.000000000 -0500 +++ /dev/null 2018-01-30 20:32:52.000000000 -0500 @@ -1,67 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.core.LeafInfo; -import com.sun.xml.internal.bind.v2.runtime.Transducer; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeLeafInfo extends LeafInfo, RuntimeNonElement { - /** - * {@inheritDoc} - * - * @return - * always non-null. - */ - Transducer getTransducer(); - - /** - * The same as {@link #getType()} but returns the type as a {@link Class}. - *

- * Note that the returned {@link Class} object does not necessarily represents - * a class declaration. It can be primitive types. - */ - Class getClazz(); - - /** - * Returns all the type names recognized by this type for unmarshalling. - * - *

- * While conceptually this method belongs to {@link RuntimeNonElement}, - * if we do that we have to put a lot of dummy implementations everywhere, - * so it's placed here, where it's actually needed. - * - * @return - * Always non-null. Do not modify the returned array. - */ - QName[] getTypeNames(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeMapPropertyInfo.java 2018-01-30 20:32:53.000000000 -0500 +++ /dev/null 2018-01-30 20:32:53.000000000 -0500 @@ -1,38 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.MapPropertyInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeMapPropertyInfo extends RuntimePropertyInfo, MapPropertyInfo { - RuntimeNonElement getKeyType(); - RuntimeNonElement getValueType(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeNonElement.java 2018-01-30 20:32:53.000000000 -0500 +++ /dev/null 2018-01-30 20:32:53.000000000 -0500 @@ -1,44 +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.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.runtime.Transducer; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeNonElement extends NonElement, RuntimeTypeInfo { - /** - * This method doesn't take the reference properties defined on - * {@link RuntimeNonElementRef} into account (such as ID-ness.) - * - * @see RuntimeNonElementRef#getTransducer() - */ - Transducer getTransducer(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeNonElementRef.java 2018-01-30 20:32:54.000000000 -0500 +++ /dev/null 2018-01-30 20:32:54.000000000 -0500 @@ -1,56 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.NonElementRef; -import com.sun.xml.internal.bind.v2.runtime.Transducer; - -/** - * Runtime version of {@link NonElementRef}. - * - *

- * Inside the implementation, reference decorators implement this interface - * and this interface is used for chaining. Also, every {@link RuntimeNonElement} - * implementation implements this interface so that undecorated plain - * reference can be represented without using a separate object. - * - * @author Kohsuke Kawaguchi - */ -public interface RuntimeNonElementRef extends NonElementRef { - // refinements - RuntimeNonElement getTarget(); - RuntimePropertyInfo getSource(); - - /** - * If the XML representation of the referenced Java type is just a text, - * return a transducer that converts between the bean and XML. - */ - Transducer getTransducer(); - - // TransducedAccessor should be created -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimePropertyInfo.java 2018-01-30 20:32:55.000000000 -0500 +++ /dev/null 2018-01-30 20:32:55.000000000 -0500 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.model.runtime; - -import java.lang.reflect.Type; -import java.util.Collection; - -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * {@link PropertyInfo} that exposes more information. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public interface RuntimePropertyInfo extends PropertyInfo { - - /** {@inheritDoc} */ - Collection ref(); - - - /** - * Gets the {@link Accessor} for this property. - * - *

- * Even for a multi-value property, this method returns an accessor - * to that property. IOW, the accessor works against the raw type. - * - *

- * This methods returns unoptimized accessor (because optimization - * accessors are often combined into bigger pieces, and optimization - * generally works better if you can look at a bigger piece, as opposed - * to individually optimize a smaller components) - * - * @return - * never null. - * - * @see Accessor#optimize(JAXBContextImpl) - */ - Accessor getAccessor(); - - /** - * Returns true if this property has an element-only content. False otherwise. - */ - public boolean elementOnlyContent(); - - /** - * Gets the "raw" type of the field. - * - * The raw type is the actual signature of the property. - * For example, if the field is the primitive int, this will be the primitive int. - * If the field is Object, this will be Object. - * If the property is the collection and typed as {@code Collection}, - * this method returns {@code Collection}. - * - * @return always non-null. - */ - Type getRawType(); - - /** - * Gets the type of the individual item. - * - * The individual type is the signature of the property used to store individual - * values. For a non-collection field, this is the same as {@link #getRawType()}. - * For acollection property, this is the type used to store individual value. - * So if {@link #getRawType()} is {@code Collection}, this method will - * return {@link Integer}. - * - * @return always non-null. - */ - Type getIndividualType(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeReferencePropertyInfo.java 2018-01-30 20:32:55.000000000 -0500 +++ /dev/null 2018-01-30 20:32:55.000000000 -0500 @@ -1,38 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; -import java.util.Set; - -import com.sun.xml.internal.bind.v2.model.core.ReferencePropertyInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeReferencePropertyInfo extends ReferencePropertyInfo, RuntimePropertyInfo { - Set getElements(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeTypeInfo.java 2018-01-30 20:32:56.000000000 -0500 +++ /dev/null 2018-01-30 20:32:56.000000000 -0500 @@ -1,36 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeTypeInfo extends TypeInfo { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeTypeInfoSet.java 2018-01-30 20:32:57.000000000 -0500 +++ /dev/null 2018-01-30 20:32:57.000000000 -0500 @@ -1,53 +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.bind.v2.model.runtime; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.Map; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet; - -/** - * {@link TypeInfoSet} refined for runtime. - * - * @author Kohsuke Kawaguchi - */ -public interface RuntimeTypeInfoSet extends TypeInfoSet{ - Map arrays(); - Map beans(); - Map builtins(); - Map enums(); - RuntimeNonElement getTypeInfo( Type type ); - RuntimeNonElement getAnyTypeInfo(); - RuntimeNonElement getClassInfo( Class type ); - RuntimeElementInfo getElementInfo( Class scope, QName name ); - Map getElementMappings( Class scope ); - Iterable getAllElements(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeTypeRef.java 2018-01-30 20:32:57.000000000 -0500 +++ /dev/null 2018-01-30 20:32:57.000000000 -0500 @@ -1,38 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.TypeRef; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeTypeRef extends TypeRef, RuntimeNonElementRef { - RuntimeNonElement getTarget(); - RuntimePropertyInfo getSource(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/RuntimeValuePropertyInfo.java 2018-01-30 20:32:58.000000000 -0500 +++ /dev/null 2018-01-30 20:32:58.000000000 -0500 @@ -1,37 +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.xml.internal.bind.v2.model.runtime; - -import java.lang.reflect.Type; - -import com.sun.xml.internal.bind.v2.model.core.ValuePropertyInfo; - -/** - * @author Kohsuke Kawaguchi - */ -public interface RuntimeValuePropertyInfo extends ValuePropertyInfo,RuntimePropertyInfo,RuntimeNonElementRef { - RuntimeNonElement getTarget(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/runtime/package-info.java 2018-01-30 20:32:59.000000000 -0500 +++ /dev/null 2018-01-30 20:32:59.000000000 -0500 @@ -1,38 +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. - */ - -/** - * The specialization of {@link com.sun.xml.internal.bind.v2.model.core} for the runtime. - * - *

- * This package offers stronger types and additional methods available at the runtime - * to access objects according to the model. Most of the interfaces correspond one to one - * with the core package, and they are simply named with {@code Runtime} prefix. - */ -@XmlSchema(namespace="http://jaxb.dev.java.net/xjc/model",elementFormDefault=XmlNsForm.QUALIFIED) -package com.sun.xml.internal.bind.v2.model.runtime; - -import javax.xml.bind.annotation.XmlNsForm; -import javax.xml.bind.annotation.XmlSchema; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/model/util/ArrayInfoUtil.java 2018-01-30 20:32:59.000000000 -0500 +++ /dev/null 2018-01-30 20:32:59.000000000 -0500 @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2005, 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.bind.v2.model.util; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.TODO; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; - -/** - * Util class for ArrayInfo - * - * @author Iaroslav Savytskyi - */ -public class ArrayInfoUtil { - - private ArrayInfoUtil() {} - - /** - * Computes the type name of the array from that of the item type. - */ - public static QName calcArrayTypeName(QName n) { - String uri; - if(n.getNamespaceURI().equals(WellKnownNamespace.XML_SCHEMA)) { - TODO.checkSpec("this URI"); - uri = "http://jaxb.dev.java.net/array"; - } else - uri = n.getNamespaceURI(); - return new QName(uri,n.getLocalPart()+"Array"); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/package-info.java 2018-01-30 20:33:00.000000000 -0500 +++ /dev/null 2018-01-30 20:33:00.000000000 -0500 @@ -1,146 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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. - */ - -/** - *

The JAXB 2.0 runtime

. - * - *

Overview

- *

- * This module provides code that implements {@link javax.xml.bind.JAXBContext}. - * Roughly speaking the runtime works like this: - * - *

    - *
  1. There's a set of classes and interfaces that model JAXB-bound types. - * You can think of this as a reflection library for JAXB. - *
  2. There's a set of classes that constitute the unmarshaller and marshaller. - * Each class represents a small portion, and they are composed to perform - * the operations. - *
  3. {@link com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl} builds itself by reading the model and - * composing unmarshallers and marshallers. - *
- * - *

Interesting Pieces inside Runtime

- *

- * The followings are the interesting pieces inside the runtime. - * - *

- *
{@link com.sun.xml.internal.bind.v2.model model} - *
- * This set of classes and interfaces models JAXB-bound types. - * - *
{@link com.sun.xml.internal.bind.v2.runtime XML I/O} - *
- * This set of classes implements the JAXB API and provides the XML I/O functionality. - *
- * - *

- * The classes NOT in the {@link com.sun.xml.internal.bind.v2} package (and its subpackages) - * are also used by old JAXB 1.0 clients. - * - *

Models

- *

- * "Model" is the portion of the code that represents JAXB-bound types. - * - *

- * The following picture illustrates the relationship among major - * packages of the binding model. - * - *

- * - *
- * - *

- * The core model contracts are all interfaces, and they are parameterized - * so that they can be used - * with different reflection libraries. This is necessary, as the model - * is used: - *

    - *
  1. at runtime to process loaded classes, - *
  2. at tool-time to process source files / class files, and - *
  3. at schema compile time to generate source code. - *
- * They all use different reflection libraries. - * - *

- * This portion is used by all - * three running mode of JAXB. - * The corresponding base-level implementaion - * is also parameterized. - * - *

- * The runtime model contract and implementation are used only at the run-time. - * These packages fix the parameterization to the Java reflection, - * and also exposes additional functionalities to actually do the - * unmarshalling/marshalling. These classes have "Runtime" prefix. - * - *

- * Finally XJC has its own implementation of the contract in - * its own package. This package also fixes the parameterization - * to its own reflection library. - * - *

- * When you work on the code, it is often helpful to know the layer you are in. - * - * - *

- * The binding model design roughly looks like the following. - * For more details, see the javadoc of each component. - * - *

- * - *
- * - * TODO: link to classes from above pictures - * - * - *

Evolution Rules

- * None of the class in this package or below should be directly - * referenced by the generated code. Hence they can be changed freely - * from versions to versions. - * - * - * - * - *

Performance Characteristics

- *

- * Model construction happens inside {@link javax.xml.bind.JAXBContext#newInstance(Class[])}. - * It's desirable for this step to be fast and consume less memory, - * but it's not too performance sensitive. - * - *

- * Code that implements the unmarshaller and the marshaller OTOH - * needs to be very carefully written to achieve maximum sustaining - * performance. - * - * - * - * - *

Bootstrap Sequence

- *

- * The following picture illustrates how the {@link javax.xml.bind.JAXBContext#newInstance(Class[])} method - * triggers activities. - * - */ -package com.sun.xml.internal.bind.v2; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/AnyTypeBeanInfo.java 2018-01-30 20:33:01.000000000 -0500 +++ /dev/null 2018-01-30 20:33:01.000000000 -0500 @@ -1,177 +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.xml.internal.bind.v2.runtime; - -import java.io.IOException; - -import javax.xml.bind.annotation.W3CDomHandler; -import javax.xml.bind.helpers.ValidationEventImpl; -import javax.xml.bind.ValidationEvent; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfo; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.DomLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiTypeLoader; - -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -/** - * {@link JaxBeanInfo} for handling {@code xs:anyType}. - * - * @author Kohsuke Kawaguchi - */ -final class AnyTypeBeanInfo extends JaxBeanInfo implements AttributeAccessor { - - private boolean nilIncluded = false; - - public AnyTypeBeanInfo(JAXBContextImpl grammar,RuntimeTypeInfo anyTypeInfo) { - super(grammar, anyTypeInfo, Object.class, new QName(WellKnownNamespace.XML_SCHEMA,"anyType"), false, true, false); - } - - public String getElementNamespaceURI(Object element) { - throw new UnsupportedOperationException(); - } - - public String getElementLocalName(Object element) { - throw new UnsupportedOperationException(); - } - - public Object createInstance(UnmarshallingContext context) { - throw new UnsupportedOperationException(); - // return JAXBContextImpl.createDom().createElementNS("","noname"); - } - - public boolean reset(Object element, UnmarshallingContext context) { - return false; -// NodeList nl = element.getChildNodes(); -// while(nl.getLength()>0) -// element.removeChild(nl.item(0)); -// NamedNodeMap al = element.getAttributes(); -// while(al.getLength()>0) -// element.removeAttributeNode((Attr)al.item(0)); -// return true; - } - - public String getId(Object element, XMLSerializer target) { - return null; - } - - public void serializeBody(Object element, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - NodeList childNodes = ((Element)element).getChildNodes(); - int len = childNodes.getLength(); - for( int i=0; i0) - context.declareNamespace( nsUri, a.getPrefix(), true ); - } - } - - public Transducer getTransducer() { - return null; - } - - public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) { - if(typeSubstitutionCapable) - return substLoader; - else - return domLoader; - } - - private static final W3CDomHandler domHandler = new W3CDomHandler(); - private static final DomLoader domLoader = new DomLoader(domHandler); - private final XsiTypeLoader substLoader = new XsiTypeLoader(this); - - } --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ArrayBeanInfoImpl.java 2018-01-30 20:33:02.000000000 -0500 +++ /dev/null 2018-01-30 20:33:02.000000000 -0500 @@ -1,182 +0,0 @@ -/* - * 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.bind.v2.runtime; - -import java.io.IOException; -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; - -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.helpers.ValidationEventImpl; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeArrayInfo; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Receiver; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.TagName; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; - -import org.xml.sax.SAXException; - -/** - * {@link JaxBeanInfo} implementation that binds T[] to a complex type - * with an element for each item. - * - * @author Kohsuke Kawaguchi - */ -final class ArrayBeanInfoImpl extends JaxBeanInfo { - - private final Class itemType; - private final JaxBeanInfo itemBeanInfo; - private Loader loader; - - public ArrayBeanInfoImpl(JAXBContextImpl owner, RuntimeArrayInfo rai) { - super(owner,rai,rai.getType(), rai.getTypeName(), false, true, false); - this.itemType = jaxbType.getComponentType(); - this.itemBeanInfo = owner.getOrCreate(rai.getItemType()); - } - - @Override - protected void link(JAXBContextImpl grammar) { - getLoader(grammar,false); - super.link(grammar); - } - - private final class ArrayLoader extends Loader implements Receiver { - public ArrayLoader(JAXBContextImpl owner) { - super(false); - itemLoader = itemBeanInfo.getLoader(owner,true); - } - - private final Loader itemLoader; - - @Override - public void startElement(UnmarshallingContext.State state, TagName ea) { - state.setTarget(new ArrayList()); - } - - @Override - public void leaveElement(UnmarshallingContext.State state, TagName ea) { - state.setTarget(toArray((List)state.getTarget())); - } - - @Override - public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - if(ea.matches("","item")) { - state.setLoader(itemLoader); - state.setReceiver(this); - } else { - super.childElement(state,ea); - } - } - - @Override - public Collection getExpectedChildElements() { - return Collections.singleton(new QName("","item")); - } - - public void receive(UnmarshallingContext.State state, Object o) { - ((List)state.getTarget()).add(o); - } - } - - protected Object toArray( List list ) { - int len = list.size(); - Object array = Array.newInstance(itemType,len); - for( int i=0; i - * TODO: this should be rewritten for efficiency. - * - * @since 2.0 - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class AssociationMap { - final static class Entry { - /** XML element. */ - private XmlNode element; - /** inner peer, or null. */ - private Object inner; - /** outer peer, or null. */ - private Object outer; - - public XmlNode element() { - return element; - } - public Object inner() { - return inner; - } - public Object outer() { - return outer; - } - } - - private final Map> byElement = new IdentityHashMap>(); - private final Map> byPeer = new IdentityHashMap>(); - private final Set usedNodes = new HashSet(); - - /** Records the new {@code element <->inner} peer association. */ - public void addInner( XmlNode element, Object inner ) { - Entry e = byElement.get(element); - if(e!=null) { - if(e.inner!=null) - byPeer.remove(e.inner); - e.inner = inner; - } else { - e = new Entry(); - e.element = element; - e.inner = inner; - } - - byElement.put(element,e); - - Entry old = byPeer.put(inner,e); - if(old!=null) { - if(old.outer!=null) - byPeer.remove(old.outer); - if(old.element!=null) - byElement.remove(old.element); - } - } - - /** Records the new {@code element <-> outer} peer association. */ - public void addOuter( XmlNode element, Object outer ) { - Entry e = byElement.get(element); - if(e!=null) { - if(e.outer!=null) - byPeer.remove(e.outer); - e.outer = outer; - } else { - e = new Entry(); - e.element = element; - e.outer = outer; - } - - byElement.put(element,e); - - Entry old = byPeer.put(outer,e); - if(old!=null) { - old.outer=null; - - if(old.inner==null) - // remove this entry - byElement.remove(old.element); - } - } - - public void addUsed( XmlNode n ) { - usedNodes.add(n); - } - - public Entry byElement( Object e ) { - return byElement.get(e); - } - - public Entry byPeer( Object o ) { - return byPeer.get(o); - } - - public Object getInnerPeer( XmlNode element ) { - Entry e = byElement(element); - if(e==null) return null; - else return e.inner; - } - - public Object getOuterPeer( XmlNode element ) { - Entry e = byElement(element); - if(e==null) return null; - else return e.outer; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/AttributeAccessor.java 2018-01-30 20:33:03.000000000 -0500 +++ /dev/null 2018-01-30 20:33:03.000000000 -0500 @@ -1,35 +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.xml.internal.bind.v2.runtime; - -/** - * - * @author snajper - */ -public interface AttributeAccessor { - - public boolean isNilIncluded(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/BinderImpl.java 2018-01-30 20:33:04.000000000 -0500 +++ /dev/null 2018-01-30 20:33:04.000000000 -0500 @@ -1,277 +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.xml.internal.bind.v2.runtime; - -import javax.xml.bind.Binder; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.PropertyException; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.validation.Schema; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.unmarshaller.InfosetScanner; -import com.sun.xml.internal.bind.v2.runtime.output.DOMOutput; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl; - -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.SAXException; - -/** - * Implementation of {@link Binder}. - * - * TODO: investigate how much in-place unmarshalling is implemented - * - some preliminary work is there. Probably buggy. - * TODO: work on the marshaller side. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class BinderImpl extends Binder { - - /** - * The parent context object. - */ - private final JAXBContextImpl context; - - /** - * Lazily created unmarshaller to do XML->Java binding. - * @see #getUnmarshaller() - */ - private UnmarshallerImpl unmarshaller; - - /** - * Lazily create marshaller to do Java->XML binding. - * @see #getMarshaller() - */ - private MarshallerImpl marshaller; - - private final InfosetScanner scanner; - - /** - * A {@link Binder} always works with the same - * association map. - */ - private final AssociationMap assoc = new AssociationMap(); - - BinderImpl(JAXBContextImpl _context,InfosetScanner scanner) { - this.context = _context; - this.scanner = scanner; - } - - private UnmarshallerImpl getUnmarshaller() { - if(unmarshaller==null) - unmarshaller = new UnmarshallerImpl(context,assoc); - return unmarshaller; - } - - private MarshallerImpl getMarshaller() { - if(marshaller==null) - marshaller = new MarshallerImpl(context,assoc); - return marshaller; - } - - public void marshal(Object jaxbObject, XmlNode xmlNode) throws JAXBException { - if ((xmlNode == null) || (jaxbObject == null)) - throw new IllegalArgumentException(); - getMarshaller().marshal(jaxbObject,createOutput(xmlNode)); - } - - // TODO move this to a sub class once we support something other than W3C DOM - private DOMOutput createOutput(XmlNode xmlNode) { - return new DOMOutput((Node)xmlNode,assoc); - } - - - public Object updateJAXB(XmlNode xmlNode) throws JAXBException { - return associativeUnmarshal(xmlNode,true,null); - } - - public Object unmarshal( XmlNode xmlNode ) throws JAXBException { - return associativeUnmarshal(xmlNode,false,null); - } - - public JAXBElement unmarshal(XmlNode xmlNode, Class expectedType) throws JAXBException { - if(expectedType==null) throw new IllegalArgumentException(); - return (JAXBElement)associativeUnmarshal(xmlNode,true,expectedType); - } - - public void setSchema(Schema schema) { - getMarshaller().setSchema(schema); - getUnmarshaller().setSchema(schema); - } - - public Schema getSchema() { - return getUnmarshaller().getSchema(); - } - - private Object associativeUnmarshal(XmlNode xmlNode, boolean inplace, Class expectedType) throws JAXBException { - if (xmlNode == null) - throw new IllegalArgumentException(); - - JaxBeanInfo bi = null; - if(expectedType!=null) - bi = context.getBeanInfo(expectedType, true); - - InterningXmlVisitor handler = new InterningXmlVisitor( - getUnmarshaller().createUnmarshallerHandler(scanner,inplace,bi)); - scanner.setContentHandler(new SAXConnector(handler,scanner.getLocator())); - try { - scanner.scan(xmlNode); - } catch( SAXException e ) { - throw unmarshaller.createUnmarshalException(e); - } - - return handler.getContext().getResult(); - } - - public XmlNode getXMLNode(Object jaxbObject) { - if(jaxbObject==null) - throw new IllegalArgumentException(); - AssociationMap.Entry e = assoc.byPeer(jaxbObject); - if(e==null) return null; - return e.element(); - } - - public Object getJAXBNode(XmlNode xmlNode) { - if(xmlNode==null) - throw new IllegalArgumentException(); - AssociationMap.Entry e = assoc.byElement(xmlNode); - if(e==null) return null; - if(e.outer()!=null) return e.outer(); - return e.inner(); - } - - public XmlNode updateXML(Object jaxbObject) throws JAXBException { - return updateXML(jaxbObject,getXMLNode(jaxbObject)); - } - - public XmlNode updateXML(Object jaxbObject, XmlNode xmlNode) throws JAXBException { - if(jaxbObject==null || xmlNode==null) throw new IllegalArgumentException(); - - // TODO - // for now just marshal - // TODO: object model independenc - Element e = (Element)xmlNode; - Node ns = e.getNextSibling(); - Node p = e.getParentNode(); - p.removeChild(e); - - // if the type object is passed, the following step is necessary to make - // the marshalling successful. - JaxBeanInfo bi = context.getBeanInfo(jaxbObject, true); - if(!bi.isElement()) - jaxbObject = new JAXBElement(new QName(e.getNamespaceURI(),e.getLocalName()),bi.jaxbType,jaxbObject); - - - getMarshaller().marshal(jaxbObject,p); - Node newNode = p.getLastChild(); - p.removeChild(newNode); - p.insertBefore(newNode,ns); - - return (XmlNode)newNode; - } - - public void setEventHandler(ValidationEventHandler handler) throws JAXBException { - getUnmarshaller().setEventHandler(handler); - getMarshaller().setEventHandler(handler); - } - - public ValidationEventHandler getEventHandler() { - return getUnmarshaller().getEventHandler(); - } - - public Object getProperty(String name) throws PropertyException { - if (name == null) - throw new IllegalArgumentException(Messages.NULL_PROPERTY_NAME.format()); - - // exclude RI properties that don't make sense for Binder - if (excludeProperty(name)) { - throw new PropertyException(name); - } - - Object prop = null; - PropertyException pe = null; - - try { - prop = getMarshaller().getProperty(name); - return prop; - } catch (PropertyException p) { - pe = p; - } - - try { - prop = getUnmarshaller().getProperty(name); - return prop; - } catch (PropertyException p) { - pe = p; - } - - pe.setStackTrace(Thread.currentThread().getStackTrace()); - throw pe; - } - - public void setProperty(String name, Object value) throws PropertyException { - if (name == null) - throw new IllegalArgumentException(Messages.NULL_PROPERTY_NAME.format()); - - // exclude RI properties that don't make sense for Binder - if (excludeProperty(name)) { - throw new PropertyException(name, value); - } - - PropertyException pe = null; - - try { - getMarshaller().setProperty(name, value); - return; - } catch (PropertyException p) { - pe = p; - } - - try { - getUnmarshaller().setProperty(name, value); - return; - } catch (PropertyException p) { - pe = p; - } - - // replace the stacktrace - we don't want to see a trace - // originating from Un|Marshaller.setProperty - pe.setStackTrace(Thread.currentThread().getStackTrace()); - throw pe; - } - - private boolean excludeProperty(String name) { - return name.equals( - MarshallerImpl.ENCODING_HANDLER) || - name.equals(MarshallerImpl.XMLDECLARATION) || - name.equals(MarshallerImpl.XML_HEADERS); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/BridgeAdapter.java 2018-01-30 20:33:04.000000000 -0500 +++ /dev/null 2018-01-30 20:33:04.000000000 -0500 @@ -1,150 +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.bind.v2.runtime; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.MarshalException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.UnmarshalException; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.namespace.NamespaceContext; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.Result; -import javax.xml.transform.Source; - -import com.sun.istack.internal.NotNull; -import com.sun.xml.internal.bind.api.Bridge; -import com.sun.xml.internal.bind.api.TypeReference; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl; - -import org.w3c.dom.Node; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; - -/** - * {@link Bridge} decorator for {@link XmlAdapter}. - * - * @author Kohsuke Kawaguchi - */ -final class BridgeAdapter extends InternalBridge { - private final InternalBridge core; - private final Class> adapter; - - public BridgeAdapter(InternalBridge core, Class> adapter) { - super(core.getContext()); - this.core = core; - this.adapter = adapter; - } - - public void marshal(Marshaller m, InMemory inMemory, XMLStreamWriter output) throws JAXBException { - core.marshal(m,adaptM(m,inMemory),output); - } - - public void marshal(Marshaller m, InMemory inMemory, OutputStream output, NamespaceContext nsc) throws JAXBException { - core.marshal(m,adaptM(m,inMemory),output,nsc); - } - - public void marshal(Marshaller m, InMemory inMemory, Node output) throws JAXBException { - core.marshal(m,adaptM(m,inMemory),output); - } - - public void marshal(Marshaller context, InMemory inMemory, ContentHandler contentHandler) throws JAXBException { - core.marshal(context,adaptM(context,inMemory),contentHandler); - } - - public void marshal(Marshaller context, InMemory inMemory, Result result) throws JAXBException { - core.marshal(context,adaptM(context,inMemory),result); - } - - private OnWire adaptM(Marshaller m,InMemory v) throws JAXBException { - XMLSerializer serializer = ((MarshallerImpl)m).serializer; - serializer.pushCoordinator(); - try { - return _adaptM(serializer, v); - } finally { - serializer.popCoordinator(); - } - } - - private OnWire _adaptM(XMLSerializer serializer, InMemory v) throws MarshalException { - XmlAdapter a = serializer.getAdapter(adapter); - try { - return a.marshal(v); - } catch (Exception e) { - serializer.handleError(e,v,null); - throw new MarshalException(e); - } - } - - - public @NotNull InMemory unmarshal(Unmarshaller u, XMLStreamReader in) throws JAXBException { - return adaptU(u, core.unmarshal(u,in)); - } - - public @NotNull InMemory unmarshal(Unmarshaller u, Source in) throws JAXBException { - return adaptU(u, core.unmarshal(u,in)); - } - - public @NotNull InMemory unmarshal(Unmarshaller u, InputStream in) throws JAXBException { - return adaptU(u, core.unmarshal(u,in)); - } - - public @NotNull InMemory unmarshal(Unmarshaller u, Node n) throws JAXBException { - return adaptU(u, core.unmarshal(u,n)); - } - - public TypeReference getTypeReference() { - return core.getTypeReference(); - } - - private @NotNull InMemory adaptU(Unmarshaller _u, OnWire v) throws JAXBException { - UnmarshallerImpl u = (UnmarshallerImpl) _u; - XmlAdapter a = u.coordinator.getAdapter(adapter); - u.coordinator.pushCoordinator(); - try { - return a.unmarshal(v); - } catch (Exception e) { - throw new UnmarshalException(e); - } finally { - u.coordinator.popCoordinator(); - } - } - - void marshal(InMemory o, XMLSerializer out) throws IOException, SAXException, XMLStreamException { - try { - core.marshal(_adaptM( XMLSerializer.getInstance(), o ), out ); - } catch (MarshalException e) { - // recover from error by not marshalling this element. - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/BridgeContextImpl.java 2018-01-30 20:33:05.000000000 -0500 +++ /dev/null 2018-01-30 20:33:05.000000000 -0500 @@ -1,76 +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.xml.internal.bind.v2.runtime; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.attachment.AttachmentMarshaller; -import javax.xml.bind.attachment.AttachmentUnmarshaller; - -import com.sun.xml.internal.bind.api.BridgeContext; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl; - -/** - * {@link BridgeContext} implementation. - * - * @author Kohsuke Kawaguchi - */ -public final class BridgeContextImpl extends BridgeContext { - - public final UnmarshallerImpl unmarshaller; - public final MarshallerImpl marshaller; - - BridgeContextImpl(JAXBContextImpl context) { - unmarshaller = context.createUnmarshaller(); - marshaller = context.createMarshaller(); - } - - public void setErrorHandler(ValidationEventHandler handler) { - try { - unmarshaller.setEventHandler(handler); - marshaller.setEventHandler(handler); - } catch (JAXBException e) { - // impossible - throw new Error(e); - } - } - - public void setAttachmentMarshaller(AttachmentMarshaller m) { - marshaller.setAttachmentMarshaller(m); - } - - public void setAttachmentUnmarshaller(AttachmentUnmarshaller u) { - unmarshaller.setAttachmentUnmarshaller(u); - } - - public AttachmentMarshaller getAttachmentMarshaller() { - return marshaller.getAttachmentMarshaller(); - } - - public AttachmentUnmarshaller getAttachmentUnmarshaller() { - return unmarshaller.getAttachmentUnmarshaller(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/BridgeImpl.java 2018-01-30 20:33:06.000000000 -0500 +++ /dev/null 2018-01-30 20:33:06.000000000 -0500 @@ -1,141 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.namespace.NamespaceContext; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.Result; -import javax.xml.transform.Source; - -import com.sun.istack.internal.NotNull; -import com.sun.xml.internal.bind.api.Bridge; -import com.sun.xml.internal.bind.api.TypeReference; -import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; -import com.sun.xml.internal.bind.v2.runtime.output.SAXOutput; -import com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl; - -import org.w3c.dom.Node; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; - -/** - * {@link Bridge} implementaiton. - * - * @author Kohsuke Kawaguchi - */ -final class BridgeImpl extends InternalBridge { - - /** - * Tag name associated with this {@link Bridge}. - * Used for marshalling. - */ - private final Name tagName; - private final JaxBeanInfo bi; - private final TypeReference typeRef; - - public BridgeImpl(JAXBContextImpl context, Name tagName, JaxBeanInfo bi,TypeReference typeRef) { - super(context); - this.tagName = tagName; - this.bi = bi; - this.typeRef = typeRef; - } - - public void marshal(Marshaller _m, T t, XMLStreamWriter output) throws JAXBException { - MarshallerImpl m = (MarshallerImpl)_m; - m.write(tagName,bi,t,XMLStreamWriterOutput.create(output,context, m.getEscapeHandler()),new StAXPostInitAction(output,m.serializer)); - } - - public void marshal(Marshaller _m, T t, OutputStream output, NamespaceContext nsContext) throws JAXBException { - MarshallerImpl m = (MarshallerImpl)_m; - - Runnable pia = null; - if(nsContext!=null) - pia = new StAXPostInitAction(nsContext,m.serializer); - - m.write(tagName,bi,t,m.createWriter(output),pia); - } - - public void marshal(Marshaller _m, T t, Node output) throws JAXBException { - MarshallerImpl m = (MarshallerImpl)_m; - m.write(tagName,bi,t,new SAXOutput(new SAX2DOMEx(output)),new DomPostInitAction(output,m.serializer)); - } - - public void marshal(Marshaller _m, T t, ContentHandler contentHandler) throws JAXBException { - MarshallerImpl m = (MarshallerImpl)_m; - m.write(tagName,bi,t,new SAXOutput(contentHandler),null); - } - - public void marshal(Marshaller _m, T t, Result result) throws JAXBException { - MarshallerImpl m = (MarshallerImpl)_m; - m.write(tagName,bi,t, m.createXmlOutput(result),m.createPostInitAction(result)); - } - - public @NotNull T unmarshal(Unmarshaller _u, XMLStreamReader in) throws JAXBException { - UnmarshallerImpl u = (UnmarshallerImpl)_u; - return ((JAXBElement)u.unmarshal0(in,bi)).getValue(); - } - - public @NotNull T unmarshal(Unmarshaller _u, Source in) throws JAXBException { - UnmarshallerImpl u = (UnmarshallerImpl)_u; - return ((JAXBElement)u.unmarshal0(in,bi)).getValue(); - } - - public @NotNull T unmarshal(Unmarshaller _u, InputStream in) throws JAXBException { - UnmarshallerImpl u = (UnmarshallerImpl)_u; - return ((JAXBElement)u.unmarshal0(in,bi)).getValue(); - } - - public @NotNull T unmarshal(Unmarshaller _u, Node n) throws JAXBException { - UnmarshallerImpl u = (UnmarshallerImpl)_u; - return ((JAXBElement)u.unmarshal0(n,bi)).getValue(); - } - - public TypeReference getTypeReference() { - return typeRef; - } - - public void marshal(T value, XMLSerializer out) throws IOException, SAXException, XMLStreamException { - out.startElement(tagName,null); - if(value==null) { - out.writeXsiNilTrue(); - } else { - out.childAsXsiType(value,null,bi,false); - } - out.endElement(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ClassBeanInfoImpl.java 2018-01-30 20:33:06.000000000 -0500 +++ /dev/null 2018-01-30 20:33:06.000000000 -0500 @@ -1,439 +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.bind.v2.runtime; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.helpers.ValidationEventImpl; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.istack.internal.FinalArrayList; -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.ClassFactory; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.property.AttributeProperty; -import com.sun.xml.internal.bind.v2.runtime.property.Property; -import com.sun.xml.internal.bind.v2.runtime.property.PropertyFactory; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiTypeLoader; - -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.LocatorImpl; - -/** - * {@link JaxBeanInfo} implementation for j2s bean. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class ClassBeanInfoImpl extends JaxBeanInfo implements AttributeAccessor { - - /** - * Properties of this bean class but not its ancestor classes. - */ - public final Property[] properties; - - /** - * Non-null if this bean has an ID property. - */ - private Property idProperty; - - /** - * Immutable configured loader for this class. - * - *

- * Set from the link method, but considered final. - */ - private Loader loader; - private Loader loaderWithTypeSubst; - - /** - * Set only until the link phase to avoid leaking memory. - */ - private RuntimeClassInfo ci; - - private final Accessor> inheritedAttWildcard; - private final Transducer xducer; - - /** - * {@link ClassBeanInfoImpl} that represents the super class of {@link #jaxbType}. - */ - public final ClassBeanInfoImpl superClazz; - - private final Accessor xmlLocatorField; - - private final Name tagName; - - private boolean retainPropertyInfo = false; - - /** - * The {@link AttributeProperty}s for this type and all its ancestors. - * If {@link JAXBContextImpl#c14nSupport} is true, this is sorted alphabetically. - */ - private /*final*/ AttributeProperty[] attributeProperties; - - /** - * {@link Property}s that need to receive {@link Property#serializeURIs(Object, XMLSerializer)} callback. - */ - private /*final*/ Property[] uriProperties; - - private final Method factoryMethod; - - /*package*/ ClassBeanInfoImpl(JAXBContextImpl owner, RuntimeClassInfo ci) { - super(owner,ci,ci.getClazz(),ci.getTypeName(),ci.isElement(),false,true); - - this.ci = ci; - this.inheritedAttWildcard = ci.getAttributeWildcard(); - this.xducer = ci.getTransducer(); - this.factoryMethod = ci.getFactoryMethod(); - this.retainPropertyInfo = owner.retainPropertyInfo; - - // make the factory accessible - if(factoryMethod!=null) { - int classMod = factoryMethod.getDeclaringClass().getModifiers(); - - if(!Modifier.isPublic(classMod) || !Modifier.isPublic(factoryMethod.getModifiers())) { - // attempt to make it work even if the constructor is not accessible - try { - factoryMethod.setAccessible(true); - } catch(SecurityException e) { - // but if we don't have a permission to do so, work gracefully. - logger.log(Level.FINE,"Unable to make the method of "+factoryMethod+" accessible",e); - throw e; - } - } - } - - - if(ci.getBaseClass()==null) - this.superClazz = null; - else - this.superClazz = owner.getOrCreate(ci.getBaseClass()); - - if(superClazz!=null && superClazz.xmlLocatorField!=null) - xmlLocatorField = superClazz.xmlLocatorField; - else - xmlLocatorField = ci.getLocatorField(); - - // create property objects - Collection ps = ci.getProperties(); - this.properties = new Property[ps.size()]; - int idx=0; - boolean elementOnly = true; - for( RuntimePropertyInfo info : ps ) { - Property p = PropertyFactory.create(owner,info); - if(info.id()==ID.ID) - idProperty = p; - properties[idx++] = p; - elementOnly &= info.elementOnlyContent(); - checkOverrideProperties(p); - } - // super class' idProperty might not be computed at this point, - // so check that later - - hasElementOnlyContentModel( elementOnly ); - // again update this value later when we know that of the super class - - if(ci.isElement()) - tagName = owner.nameBuilder.createElementName(ci.getElementName()); - else - tagName = null; - - setLifecycleFlags(); - } - - private void checkOverrideProperties(Property p) { - ClassBeanInfoImpl bi = this; - while ((bi = bi.superClazz) != null) { - Property[] props = bi.properties; - if (props == null) break; - for (Property superProperty : props) { - if (superProperty != null) { - String spName = superProperty.getFieldName(); - if ((spName != null) && (spName.equals(p.getFieldName()))) { - superProperty.setHiddenByOverride(true); - } - } - } - } - } - - @Override - protected void link(JAXBContextImpl grammar) { - if(uriProperties!=null) - return; // avoid linking twice - - super.link(grammar); - - if(superClazz!=null) - superClazz.link(grammar); - - getLoader(grammar,true); // make sure to build the loader if we haven't done so. - - // propagate values from super class - if(superClazz!=null) { - if(idProperty==null) - idProperty = superClazz.idProperty; - - if(!superClazz.hasElementOnlyContentModel()) - hasElementOnlyContentModel(false); - } - - // create a list of attribute/URI handlers - List attProps = new FinalArrayList(); - List uriProps = new FinalArrayList(); - for (ClassBeanInfoImpl bi = this; bi != null; bi = bi.superClazz) { - for (int i = 0; i < bi.properties.length; i++) { - Property p = bi.properties[i]; - if(p instanceof AttributeProperty) - attProps.add((AttributeProperty) p); - if(p.hasSerializeURIAction()) - uriProps.add(p); - } - } - if(grammar.c14nSupport) - Collections.sort(attProps); - - if(attProps.isEmpty()) - attributeProperties = EMPTY_PROPERTIES; - else - attributeProperties = attProps.toArray(new AttributeProperty[attProps.size()]); - - if(uriProps.isEmpty()) - uriProperties = EMPTY_PROPERTIES; - else - uriProperties = uriProps.toArray(new Property[uriProps.size()]); - } - - @Override - public void wrapUp() { - for (Property p : properties) - p.wrapUp(); - ci = null; - super.wrapUp(); - } - - public String getElementNamespaceURI(BeanT bean) { - return tagName.nsUri; - } - - public String getElementLocalName(BeanT bean) { - return tagName.localName; - } - - public BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException { - - BeanT bean = null; - if (factoryMethod == null){ - bean = ClassFactory.create0(jaxbType); - }else { - Object o = ClassFactory.create(factoryMethod); - if( jaxbType.isInstance(o) ){ - bean = (BeanT)o; - } else { - throw new InstantiationException("The factory method didn't return a correct object"); - } - } - - if(xmlLocatorField!=null) - // need to copy because Locator is mutable - try { - xmlLocatorField.set(bean,new LocatorImpl(context.getLocator())); - } catch (AccessorException e) { - context.handleError(e); - } - return bean; - } - - public boolean reset(BeanT bean, UnmarshallingContext context) throws SAXException { - try { - if(superClazz!=null) - superClazz.reset(bean,context); - for( Property p : properties ) - p.reset(bean); - return true; - } catch (AccessorException e) { - context.handleError(e); - return false; - } - } - - public String getId(BeanT bean, XMLSerializer target) throws SAXException { - if(idProperty!=null) { - try { - return idProperty.getIdValue(bean); - } catch (AccessorException e) { - target.reportError(null,e); - } - } - return null; - } - - public void serializeRoot(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - if(tagName==null) { - Class beanClass = bean.getClass(); - String message; - if (beanClass.isAnnotationPresent(XmlRootElement.class)) { - message = Messages.UNABLE_TO_MARSHAL_UNBOUND_CLASS.format(beanClass.getName()); - } else { - message = Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(beanClass.getName()); - } - target.reportError(new ValidationEventImpl(ValidationEvent.ERROR,message,null, null)); - } else { - target.startElement(tagName,bean); - target.childAsSoleContent(bean,null); - target.endElement(); - if (retainPropertyInfo) { - target.currentProperty.remove(); - } - } - } - - public void serializeBody(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - if (superClazz != null) { - superClazz.serializeBody(bean, target); - } - try { - for (Property p : properties) { - if (retainPropertyInfo) { - target.currentProperty.set(p); - } - boolean isThereAnOverridingProperty = p.isHiddenByOverride(); - if (!isThereAnOverridingProperty || bean.getClass().equals(jaxbType)) { - p.serializeBody(bean, target, null); - } else if (isThereAnOverridingProperty) { - // need to double check the override - it should be safe to do after the model has been created because it's targeted to override properties only - Class beanClass = bean.getClass(); - if (Utils.REFLECTION_NAVIGATOR.getDeclaredField(beanClass, p.getFieldName()) == null) { - p.serializeBody(bean, target, null); - } - } - } - } catch (AccessorException e) { - target.reportError(null, e); - } - } - - public void serializeAttributes(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - for( AttributeProperty p : attributeProperties ) - try { - if (retainPropertyInfo) { - final Property parentProperty = target.getCurrentProperty(); - target.currentProperty.set(p); - p.serializeAttributes(bean,target); - target.currentProperty.set(parentProperty); - } else { - p.serializeAttributes(bean,target); - } - if (p.attName.equals(WellKnownNamespace.XML_SCHEMA_INSTANCE, "nil")) { - isNilIncluded = true; - } - } catch (AccessorException e) { - target.reportError(null,e); - } - - try { - if(inheritedAttWildcard!=null) { - Map map = inheritedAttWildcard.get(bean); - target.attWildcardAsAttributes(map,null); - } - } catch (AccessorException e) { - target.reportError(null,e); - } - } - - public void serializeURIs(BeanT bean, XMLSerializer target) throws SAXException { - try { - if (retainPropertyInfo) { - final Property parentProperty = target.getCurrentProperty(); - for( Property p : uriProperties ) { - target.currentProperty.set(p); - p.serializeURIs(bean,target); - } - target.currentProperty.set(parentProperty); - } else { - for( Property p : uriProperties ) { - p.serializeURIs(bean,target); - } - } - if(inheritedAttWildcard!=null) { - Map map = inheritedAttWildcard.get(bean); - target.attWildcardAsURIs(map,null); - } - } catch (AccessorException e) { - target.reportError(null,e); - } - } - - public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) { - if(loader==null) { - // these variables have to be set before they are initialized, - // because the initialization may build other loaders and they may refer to this. - StructureLoader sl = new StructureLoader(this); - loader = sl; - if(ci.hasSubClasses()) - loaderWithTypeSubst = new XsiTypeLoader(this); - else - // optimization. we know there can be no @xsi:type - loaderWithTypeSubst = loader; - - - sl.init(context,this,ci.getAttributeWildcard()); - } - if(typeSubstitutionCapable) - return loaderWithTypeSubst; - else - return loader; - } - - public Transducer getTransducer() { - return xducer; - } - - private static final AttributeProperty[] EMPTY_PROPERTIES = new AttributeProperty[0]; - - private static final Logger logger = Util.getClassLogger(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/CompositeStructureBeanInfo.java 2018-01-30 20:33:07.000000000 -0500 +++ /dev/null 2018-01-30 20:33:07.000000000 -0500 @@ -1,103 +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.xml.internal.bind.v2.runtime; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.helpers.ValidationEventImpl; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.CompositeStructure; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; - -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi - */ -public class CompositeStructureBeanInfo extends JaxBeanInfo { - public CompositeStructureBeanInfo(JAXBContextImpl context) { - super(context,null, CompositeStructure.class,false,true,false); - } - - public String getElementNamespaceURI(CompositeStructure o) { - throw new UnsupportedOperationException(); - } - - public String getElementLocalName(CompositeStructure o) { - throw new UnsupportedOperationException(); - } - - public CompositeStructure createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException { - throw new UnsupportedOperationException(); - } - - public boolean reset(CompositeStructure o, UnmarshallingContext context) throws SAXException { - throw new UnsupportedOperationException(); - } - - public String getId(CompositeStructure o, XMLSerializer target) throws SAXException { - return null; - } - - public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) { - // no unmarshaller support for this. - throw new UnsupportedOperationException(); - } - - public void serializeRoot(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - target.reportError( - new ValidationEventImpl( - ValidationEvent.ERROR, - Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(o.getClass().getName()), - null, - null)); - } - - public void serializeURIs(CompositeStructure o, XMLSerializer target) throws SAXException { - // noop - } - - public void serializeAttributes(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - // noop - } - - public void serializeBody(CompositeStructure o, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - int len = o.bridges.length; - for( int i=0; i getTransducer() { - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java 2018-01-30 20:33:08.000000000 -0500 +++ /dev/null 2018-01-30 20:33:08.000000000 -0500 @@ -1,157 +0,0 @@ -/* - * 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.bind.v2.runtime; - -import com.sun.istack.internal.FinalArrayList; -import com.sun.istack.internal.SAXException2; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.DefaultHandler; - -import javax.xml.stream.XMLStreamException; -import java.io.IOException; - -/** - * Receives SAX2 events and send the equivalent events to - * {@link XMLSerializer} - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -final class ContentHandlerAdaptor extends DefaultHandler { - - /** Stores newly declared prefix-URI mapping. */ - private final FinalArrayList prefixMap = new FinalArrayList(); - - /** Events will be sent to this object. */ - private final XMLSerializer serializer; - - private final StringBuffer text = new StringBuffer(); - - - ContentHandlerAdaptor( XMLSerializer _serializer ) { - this.serializer = _serializer; - } - - public void startDocument() { - prefixMap.clear(); - } - - public void startPrefixMapping(String prefix, String uri) { - prefixMap.add(prefix); - prefixMap.add(uri); - } - - private boolean containsPrefixMapping(String prefix, String uri) { - for( int i=0; i - * This class takes care of the logic that allows code to obtain - * {@link UnmarshallingContext} and {@link XMLSerializer} instances - * during the unmarshalling/marshalling. - * - *

- * This is done by using a {@link ThreadLocal}. Therefore one unmarshalling/marshalling - * episode has to be done from the beginning till end by the same thread. - * (Note that the same {@link Coordinator} can be then used by a different thread - * for an entirely different episode.) - * - * This class also maintains the user-configured instances of {@link XmlAdapter}s. - * - *

- * This class implements {@link ErrorHandler} and propages erros to this object - * as the {@link ValidationEventHandler}, which will be implemented in a derived class. - * - * @author Kohsuke Kawaguchi - */ -public abstract class Coordinator implements ErrorHandler, ValidationEventHandler { - - private final HashMap,XmlAdapter> adapters = - new HashMap,XmlAdapter>(); - - - public final XmlAdapter putAdapter(Class c, XmlAdapter a) { - if(a==null) - return adapters.remove(c); - else - return adapters.put(c,a); - } - - /** - * Gets the instance of the adapter. - * - * @return - * always non-null. - */ - public final T getAdapter(Class key) { - T v = key.cast(adapters.get(key)); - if(v==null) { - v = ClassFactory.create(key); - putAdapter(key,v); - } - return v; - } - - public boolean containsAdapter(Class type) { - return adapters.containsKey(type); - } - - // this much is necessary to avoid calling get and set twice when we push. - private static final ThreadLocal activeTable = new ThreadLocal(); - - /** - * The {@link Coordinator} in charge before this {@link Coordinator}. - */ - private Coordinator old; - - /** - * Called whenever an execution flow enters the realm of this {@link Coordinator}. - */ - protected final void pushCoordinator() { - old = activeTable.get(); - activeTable.set(this); - } - - /** - * Called whenever an execution flow exits the realm of this {@link Coordinator}. - */ - protected final void popCoordinator() { - if (old != null) - activeTable.set(old); - else - activeTable.remove(); - old = null; // avoid memory leak - } - - public static Coordinator _getInstance() { - return activeTable.get(); - } - -// -// -// ErrorHandler implementation -// -// - /** - * Gets the current location. Used for reporting the error source location. - */ - protected abstract ValidationEventLocator getLocation(); - - public final void error(SAXParseException exception) throws SAXException { - propagateEvent( ValidationEvent.ERROR, exception ); - } - - public final void warning(SAXParseException exception) throws SAXException { - propagateEvent( ValidationEvent.WARNING, exception ); - } - - public final void fatalError(SAXParseException exception) throws SAXException { - propagateEvent( ValidationEvent.FATAL_ERROR, exception ); - } - - private void propagateEvent( int severity, SAXParseException saxException ) - throws SAXException { - - ValidationEventImpl ve = - new ValidationEventImpl( severity, saxException.getMessage(), getLocation() ); - - Exception e = saxException.getException(); - if( e != null ) { - ve.setLinkedException( e ); - } else { - ve.setLinkedException( saxException ); - } - - // call the client's event handler. If it returns false, then bail-out - // and terminate the unmarshal operation. - boolean result = handleEvent( ve ); - if( ! result ) { - // bail-out of the parse with a SAX exception, but convert it into - // an UnmarshalException back in in the AbstractUnmarshaller - throw saxException; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/DomPostInitAction.java 2018-01-30 20:33:09.000000000 -0500 +++ /dev/null 2018-01-30 20:33:09.000000000 -0500 @@ -1,81 +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.xml.internal.bind.v2.runtime; - -import java.util.HashSet; -import java.util.Set; - -import javax.xml.XMLConstants; - -import org.w3c.dom.Attr; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; - -/** - * Post-init action for {@link MarshallerImpl} that incorporate the in-scope namespace bindings - * from a DOM node. - * - * TODO: do we really need this? think about a better way to put this logic back into marshaller. - * - * @author Kohsuke Kawaguchi - */ -final class DomPostInitAction implements Runnable { - - private final Node node; - private final XMLSerializer serializer; - - DomPostInitAction(Node node, XMLSerializer serializer) { - this.node = node; - this.serializer = serializer; - } - - // declare the currently in-scope namespace bindings - public void run() { - Set declaredPrefixes = new HashSet(); - for( Node n=node; n!=null && n.getNodeType()==Node.ELEMENT_NODE; n=n.getParentNode() ) { - NamedNodeMap atts = n.getAttributes(); - if(atts==null) continue; // broken DOM. but be graceful. - for( int i=0; i { - - private Loader loader; - - private final Property property; - - // used to create new instances of JAXBElement. - private final QName tagName; - public final Class expectedType; - private final Class scope; - - /** - * If non-null, use this to create an instance. - * It takes one value. - */ - private final Constructor constructor; - - ElementBeanInfoImpl(JAXBContextImpl grammar, RuntimeElementInfo rei) { - super(grammar,rei,(Class)rei.getType(),true,false,true); - - this.property = PropertyFactory.create(grammar,rei.getProperty()); - - tagName = rei.getElementName(); - expectedType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(rei.getContentInMemoryType()); - scope = rei.getScope()==null ? JAXBElement.GlobalScope.class : rei.getScope().getClazz(); - - Class type = (Class) Utils.REFLECTION_NAVIGATOR.erasure(rei.getType()); - if(type==JAXBElement.class) - constructor = null; - else { - try { - constructor = type.getConstructor(expectedType); - } catch (NoSuchMethodException e) { - NoSuchMethodError x = new NoSuchMethodError("Failed to find the constructor for " + type + " with " + expectedType); - x.initCause(e); - throw x; - } - } - } - - /** - * The constructor for the sole instanceof {@link JaxBeanInfo} for - * handling user-created {@link JAXBElement}. - * - * Such {@link JaxBeanInfo} is used only for marshalling. - * - * This is a hack. - */ - protected ElementBeanInfoImpl(final JAXBContextImpl grammar) { - super(grammar,null,JAXBElement.class,true,false,true); - tagName = null; - expectedType = null; - scope = null; - constructor = null; - - this.property = new Property() { - public void reset(JAXBElement o) { - throw new UnsupportedOperationException(); - } - - public void serializeBody(JAXBElement e, XMLSerializer target, Object outerPeer) throws SAXException, IOException, XMLStreamException { - Class scope = e.getScope(); - if(e.isGlobalScope()) scope = null; - QName n = e.getName(); - ElementBeanInfoImpl bi = grammar.getElement(scope,n); - if(bi==null) { - // infer what to do from the type - JaxBeanInfo tbi; - try { - tbi = grammar.getBeanInfo(e.getDeclaredType(),true); - } catch (JAXBException x) { - // if e.getDeclaredType() isn't known to this JAXBContext - target.reportError(null,x); - return; - } - Object value = e.getValue(); - target.startElement(n.getNamespaceURI(),n.getLocalPart(),n.getPrefix(),null); - if(value==null) { - target.writeXsiNilTrue(); - } else { - target.childAsXsiType(value,"value",tbi, false); - } - target.endElement(); - } else { - try { - bi.property.serializeBody(e,target,e); - } catch (AccessorException x) { - target.reportError(null,x); - } - } - } - - public void serializeURIs(JAXBElement o, XMLSerializer target) { - } - - public boolean hasSerializeURIAction() { - return false; - } - - public String getIdValue(JAXBElement o) { - return null; - } - - public PropertyKind getKind() { - return PropertyKind.ELEMENT; - } - - public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap handlers) { - } - - public Accessor getElementPropertyAccessor(String nsUri, String localName) { - throw new UnsupportedOperationException(); - } - - public void wrapUp() { - } - - public RuntimePropertyInfo getInfo() { - return property.getInfo(); - } - - public boolean isHiddenByOverride() { - return false; - } - - public void setHiddenByOverride(boolean hidden) { - throw new UnsupportedOperationException("Not supported on jaxbelements."); - } - - public String getFieldName() { - return null; - } - - }; - } - - /** - * Use the previous {@link UnmarshallingContext.State}'s target to store - * {@link JAXBElement} object to be unmarshalled. This allows the property {@link Loader} - * to correctly find the parent object. - * This is a hack. - */ - private final class IntercepterLoader extends Loader implements Intercepter { - private final Loader core; - - public IntercepterLoader(Loader core) { - this.core = core; - } - - @Override - public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - state.setLoader(core); - state.setIntercepter(this); - - // TODO: make sure there aren't too many duplicate of this code - // create the object to unmarshal - Object child; - UnmarshallingContext context = state.getContext(); - - // let's see if we can reuse the existing peer object - child = context.getOuterPeer(); - - if(child!=null && jaxbType!=child.getClass()) - child = null; // unexpected type. - - if(child!=null) - reset((JAXBElement)child,context); - - if(child==null) - child = context.createInstance(ElementBeanInfoImpl.this); - - fireBeforeUnmarshal(ElementBeanInfoImpl.this, child, state); - - context.recordOuterPeer(child); - UnmarshallingContext.State p = state.getPrev(); - p.setBackup(p.getTarget()); - p.setTarget(child); - - core.startElement(state,ea); - } - - public Object intercept(UnmarshallingContext.State state, Object o) throws SAXException { - JAXBElement e = (JAXBElement)state.getTarget(); - state.setTarget(state.getBackup()); - state.setBackup(null); - - if (state.isNil()) { - e.setNil(true); - state.setNil(false); - } - - if(o!=null) - // if the value is a leaf type, it's often already set to the element - // through Accessor. - e.setValue(o); - - fireAfterUnmarshal(ElementBeanInfoImpl.this, e, state); - - return e; - } - } - - public String getElementNamespaceURI(JAXBElement e) { - return e.getName().getNamespaceURI(); - } - - public String getElementLocalName(JAXBElement e) { - return e.getName().getLocalPart(); - } - - public Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) { - if(loader==null) { - // this has to be done lazily to avoid cyclic reference issue - UnmarshallerChain c = new UnmarshallerChain(context); - QNameMap result = new QNameMap(); - property.buildChildElementUnmarshallers(c,result); - if(result.size()==1) - // for ElementBeanInfoImpl created from RuntimeElementInfo - this.loader = new IntercepterLoader(result.getOne().getValue().loader); - else - // for special ElementBeanInfoImpl only used for marshalling - this.loader = Discarder.INSTANCE; - } - return loader; - } - - public final JAXBElement createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException { - return createInstanceFromValue(null); - } - - public final JAXBElement createInstanceFromValue(Object o) throws IllegalAccessException, InvocationTargetException, InstantiationException { - if(constructor==null) - return new JAXBElement(tagName,expectedType,scope,o); - else - return constructor.newInstance(o); - } - - public boolean reset(JAXBElement e, UnmarshallingContext context) { - e.setValue(null); - return true; - } - - public String getId(JAXBElement e, XMLSerializer target) { - // TODO: is this OK? Should we be returning the ID value of the type property? - /* - There's one case where we JAXBElement needs to be designated as ID, - and that is when there's a global element whose type is ID. - */ - Object o = e.getValue(); - if(o instanceof String) - return (String)o; - else - return null; - } - - public void serializeBody(JAXBElement element, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - try { - property.serializeBody(element,target,null); - } catch (AccessorException x) { - target.reportError(null,x); - } - } - - public void serializeRoot(JAXBElement e, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - serializeBody(e,target); - } - - public void serializeAttributes(JAXBElement e, XMLSerializer target) { - // noop - } - - public void serializeURIs(JAXBElement e, XMLSerializer target) { - // noop - } - - public final Transducer getTransducer() { - return null; - } - - @Override - public void wrapUp() { - super.wrapUp(); - property.wrapUp(); - } - - @Override - public void link(JAXBContextImpl grammar) { - super.link(grammar); - getLoader(grammar,true); // make sure to build them, if we hadn't done so - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/FilterTransducer.java 2018-01-30 20:33:11.000000000 -0500 +++ /dev/null 2018-01-30 20:33:11.000000000 -0500 @@ -1,83 +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.xml.internal.bind.v2.runtime; - -import java.io.IOException; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.istack.internal.NotNull; -import com.sun.xml.internal.bind.api.AccessorException; - -import org.xml.sax.SAXException; - -/** - * {@link Transducer} that delegates to another {@link Transducer}. - * - * @author Kohsuke Kawaguchi - */ -public abstract class FilterTransducer implements Transducer { - protected final Transducer core; - - protected FilterTransducer(Transducer core) { - this.core = core; - } - - public final boolean isDefault() { - // this must be used as a decorating transducer, - // so it may never be default. - return false; - } - - public boolean useNamespace() { - return core.useNamespace(); - } - - public void declareNamespace(T o, XMLSerializer w) throws AccessorException { - core.declareNamespace(o, w); - } - - public @NotNull CharSequence print(@NotNull T o) throws AccessorException { - return core.print(o); - } - - public T parse(CharSequence lexical) throws AccessorException, SAXException { - return core.parse(lexical); - } - - public void writeText(XMLSerializer w, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - core.writeText(w, o, fieldName); - } - - public void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - core.writeLeafElement(w,tagName,o,fieldName); - } - - public QName getTypeName(T instance) { - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/IllegalAnnotationException.java 2018-01-30 20:33:11.000000000 -0500 +++ /dev/null 2018-01-30 20:33:11.000000000 -0500 @@ -1,187 +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.xml.internal.bind.v2.runtime; - -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import com.sun.xml.internal.bind.v2.model.annotation.Locatable; - -/** - * Signals an incorrect use of JAXB annotations. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - * @since JAXB 2.0 EA1 - */ -public class IllegalAnnotationException extends JAXBException { - - /** - * Read-only list of {@link Location}s. - */ - private final List> pos; - - private static final long serialVersionUID = 1L; - - public IllegalAnnotationException(String message, Locatable src) { - super(message); - pos = build(src); - } - - public IllegalAnnotationException(String message, Annotation src) { - this(message,cast(src)); - } - - public IllegalAnnotationException(String message, Locatable src1, Locatable src2) { - super(message); - pos = build(src1,src2); - } - - public IllegalAnnotationException(String message, Annotation src1, Annotation src2) { - this(message,cast(src1),cast(src2)); - } - - public IllegalAnnotationException(String message, Annotation src1, Locatable src2) { - this(message,cast(src1),src2); - } - - public IllegalAnnotationException(String message, Throwable cause, Locatable src) { - super(message, cause); - pos = build(src); - } - - private static Locatable cast(Annotation a) { - if(a instanceof Locatable) - return (Locatable)a; - else - return null; - } - - private List> build(Locatable... srcs) { - List> r = new ArrayList>(); - for( Locatable l : srcs ) { - if(l!=null) { - List ll = convert(l); - if(ll!=null && !ll.isEmpty()) - r.add(ll); - } - } - return Collections.unmodifiableList(r); - } - - /** - * Builds a list of {@link Location}s out of a {@link Locatable}. - */ - private List convert(Locatable src) { - if(src==null) return null; - - List r = new ArrayList(); - for( ; src!=null; src=src.getUpstream()) - r.add(src.getLocation()); - return Collections.unmodifiableList(r); - } - - - - /** - * Returns a read-only list of {@link Location} that indicates - * where in the source code the problem has happened. - * - *

- * Normally, an annotation error happens on one particular - * annotation, in which case this method returns a list that - * contains another list, which in turn contains the location - * information that leads to the error location - * (IOW, {@code [ [pos1,pos2,...,posN] ]}) - * - *

- * Sometimes, an error could occur because of two or more conflicting - * annotations, in which case this method returns a list - * that contains many lists, where each list contains - * the location information that leads to each of the conflicting - * annotations - * (IOW, {@code [ [pos11,pos12,...,pos1N],[pos21,pos22,...,pos2M], ... ]}) - * - *

- * Yet some other time, the runtime can fail to provide any - * error location, in which case this method returns an empty list. - * (IOW, {@code []}). We do try hard to make sure this won't happen, - * so please let us know - * if you see this behavior. - * - * - *

List of {@link Location}

- *

- * Each error location is identified not just by one {@link Location} - * object, but by a sequence of {@link Location}s that shows why - * the runtime is led to the place of the error. - * This list is sorted such that the most specific {@link Location} comes - * to the first in the list, sort of like a stack trace. - * - *

- * For example, suppose you specify class {@code Foo} to {@link JAXBContext}, - * {@code Foo} derives from {@code Bar}, {@code Bar} has a field {@code pea} - * that points to {@code Zot}, {@code Zot} contains a {@code gum} - * property, and this property has an errornous annotation. - * Then when this exception is thrown, the list of {@link Location}s - * will look something like - * {@code [ "gum property", "Zot class", "pea property", "Bar class", "Foo class" ]} - * - * - * @return - * can be empty when no source position is available, - * but never null. The returned list will never contain - * null nor length-0 {@link List}. - */ - public List> getSourcePos() { - return pos; - } - - /** - * Returns the exception name, message, and related information - * together in one string. - * - *

- * Overriding this method (instead of {@link #printStackTrace} allows - * this crucial detail to show up even when this exception is nested - * inside other exceptions. - */ - public String toString() { - StringBuilder sb = new StringBuilder(getMessage()); - - for( List locs : pos ) { - sb.append("\n\tthis problem is related to the following location:"); - for( Location loc : locs ) - sb.append("\n\t\tat ").append(loc.toString()); - } - - return sb.toString(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/IllegalAnnotationsException.java 2018-01-30 20:33:12.000000000 -0500 +++ /dev/null 2018-01-30 20:33:12.000000000 -0500 @@ -1,94 +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.xml.internal.bind.v2.runtime; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; - -import com.sun.xml.internal.bind.v2.model.core.ErrorHandler; - -/** - * A list of {@link IllegalAnnotationException} wrapped in one exception. - * - *

- * This exception is used to report all the errors to the client application - * through {@link JAXBContext#newInstance}. - * - * @since JAXB 2.0 EA1 - * @author Kohsuke Kawaguchi - */ -public class IllegalAnnotationsException extends JAXBException { - private final List errors; - - private static final long serialVersionUID = 1L; - - public IllegalAnnotationsException(List errors) { - super(errors.size()+" counts of IllegalAnnotationExceptions"); - assert !errors.isEmpty() : "there must be at least one error"; - this.errors = Collections.unmodifiableList(new ArrayList(errors)); - } - - public String toString() { - StringBuilder sb = new StringBuilder(super.toString()); - sb.append('\n'); - - for( IllegalAnnotationException error : errors ) - sb.append(error.toString()).append('\n'); - - return sb.toString(); - } - - /** - * Returns a read-only list of {@link IllegalAnnotationException}s - * wrapped in this exception. - * - * @return - * a non-null list. - */ - public List getErrors() { - return errors; - } - - public static class Builder implements ErrorHandler { - private final List list = new ArrayList(); - public void error(IllegalAnnotationException e) { - list.add(e); - } - /** - * If an error was reported, throw the exception. - * Otherwise exit normally. - */ - public void check() throws IllegalAnnotationsException { - if(list.isEmpty()) - return; - throw new IllegalAnnotationsException(list); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/InlineBinaryTransducer.java 2018-01-30 20:33:13.000000000 -0500 +++ /dev/null 2018-01-30 20:33:13.000000000 -0500 @@ -1,77 +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.xml.internal.bind.v2.runtime; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.istack.internal.NotNull; -import com.sun.xml.internal.bind.api.AccessorException; - -import org.xml.sax.SAXException; - -/** - * Transducer that signals the runtime that this binary data shall be always inlined. - * - * @author Kohsuke Kawaguchi - */ -public class InlineBinaryTransducer extends FilterTransducer { - public InlineBinaryTransducer(Transducer core) { - super(core); - } - - @Override - public @NotNull CharSequence print(@NotNull V o) throws AccessorException { - XMLSerializer w = XMLSerializer.getInstance(); - boolean old = w.setInlineBinaryFlag(true); - try { - return core.print(o); - } finally { - w.setInlineBinaryFlag(old); - } - } - - @Override - public void writeText(XMLSerializer w, V o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - boolean old = w.setInlineBinaryFlag(true); - try { - core.writeText(w,o,fieldName); - } finally { - w.setInlineBinaryFlag(old); - } - } - - @Override - public void writeLeafElement(XMLSerializer w, Name tagName, V o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - boolean old = w.setInlineBinaryFlag(true); - try { - core.writeLeafElement(w, tagName, o, fieldName); - } finally { - w.setInlineBinaryFlag(old); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/InternalBridge.java 2018-01-30 20:33:13.000000000 -0500 +++ /dev/null 2018-01-30 20:33:13.000000000 -0500 @@ -1,53 +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.xml.internal.bind.v2.runtime; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.Bridge; - -import org.xml.sax.SAXException; - -/** - * Additional methods on {@link Bridge} that are only available for the JAXB runtime. - * @author Kohsuke Kawaguchi - */ -abstract class InternalBridge extends Bridge { - protected InternalBridge(JAXBContextImpl context) { - super(context); - } - - public JAXBContextImpl getContext() { - return context; - } - - /** - * Called from {@link CompositeStructureBeanInfo} to marshal this bridge as a sub-tree. - */ - abstract void marshal( T o, XMLSerializer out ) throws IOException, SAXException, XMLStreamException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/JAXBContextImpl.java 2018-01-30 20:33:14.000000000 -0500 +++ /dev/null 2018-01-30 20:33:14.000000000 -0500 @@ -1,1146 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime; - -import java.io.IOException; -import java.lang.ref.WeakReference; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeSet; -import javax.xml.bind.Binder; -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.JAXBIntrospector; -import javax.xml.bind.Marshaller; -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.Validator; -import javax.xml.bind.annotation.XmlAttachmentRef; -import javax.xml.bind.annotation.XmlList; -import javax.xml.bind.annotation.XmlNs; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.namespace.QName; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.FactoryConfigurationError; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Result; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.sax.SAXTransformerFactory; -import javax.xml.transform.sax.TransformerHandler; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Pool; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.api.Bridge; -import com.sun.xml.internal.bind.api.BridgeContext; -import com.sun.xml.internal.bind.api.CompositeStructure; -import com.sun.xml.internal.bind.api.ErrorListener; -import com.sun.xml.internal.bind.api.JAXBRIContext; -import com.sun.xml.internal.bind.api.RawAccessor; -import com.sun.xml.internal.bind.api.TypeReference; -import com.sun.xml.internal.bind.unmarshaller.DOMScanner; -import com.sun.xml.internal.bind.util.Which; -import com.sun.xml.internal.bind.v2.model.annotation.RuntimeAnnotationReader; -import com.sun.xml.internal.bind.v2.model.annotation.RuntimeInlineAnnotationReader; -import com.sun.xml.internal.bind.v2.model.core.Adapter; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.Ref; -import com.sun.xml.internal.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl; -import com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeArrayInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeBuiltinLeafInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeEnumLeafInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeLeafInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfoSet; -import com.sun.xml.internal.bind.v2.runtime.output.Encoded; -import com.sun.xml.internal.bind.v2.runtime.property.AttributeProperty; -import com.sun.xml.internal.bind.v2.runtime.property.Property; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.TagName; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; -import com.sun.xml.internal.bind.v2.schemagen.XmlSchemaGenerator; -import com.sun.xml.internal.bind.v2.util.EditDistance; -import com.sun.xml.internal.bind.v2.util.QNameMap; -import com.sun.xml.internal.bind.v2.util.XmlFactory; -import com.sun.xml.internal.txw2.output.ResultFactory; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -/** - * This class provides the implementation of JAXBContext. - * - */ -public final class JAXBContextImpl extends JAXBRIContext { - - /** - * All the bridge classes. - */ - private final Map bridges = new LinkedHashMap(); - - /** - * Shared instance of {@link DocumentBuilder}. - * Lock before use. Lazily created. - */ - private static DocumentBuilder db; - - private final QNameMap rootMap = new QNameMap(); - private final HashMap typeMap = new HashMap(); - - /** - * Map from JAXB-bound {@link Class} to its {@link JaxBeanInfo}. - */ - private final Map beanInfoMap = new LinkedHashMap(); - - /** - * All created {@link JaxBeanInfo}s. - * Updated from each {@link JaxBeanInfo}s constructors to avoid infinite recursion - * for a cyclic reference. - * - *

- * This map is only used while the {@link JAXBContextImpl} is built and set to null - * to avoid keeping references too long. - */ - protected Map beanInfos = new LinkedHashMap(); - - private final Map> elements = new LinkedHashMap>(); - - /** - * Pool of {@link Marshaller}s. - */ - public final Pool marshallerPool = new Pool.Impl() { - protected @NotNull Marshaller create() { - return createMarshaller(); - } - }; - - public final Pool unmarshallerPool = new Pool.Impl() { - protected @NotNull Unmarshaller create() { - return createUnmarshaller(); - } - }; - - /** - * Used to assign indices to known names in this grammar. - * Reset to null once the build phase is completed. - */ - public NameBuilder nameBuilder = new NameBuilder(); - - /** - * Keeps the list of known names. - * This field is set once the build pahse is completed. - */ - public final NameList nameList; - - /** - * Input to the JAXBContext.newInstance, so that we can recreate - * {@link RuntimeTypeInfoSet} whenever we need. - */ - private final String defaultNsUri; - private final Class[] classes; - - /** - * true to reorder attributes lexicographically in preparation of the c14n support. - */ - protected final boolean c14nSupport; - - /** - * Flag that user has provided a custom AccessorFactory for JAXB to use - */ - public final boolean xmlAccessorFactorySupport; - - /** - * @see JAXBRIContext#TREAT_EVERYTHING_NILLABLE - */ - public final boolean allNillable; - - /** - * Store properties, so that they can be recovered in the run (is here because of JSON encoding of Jersey). - */ - public final boolean retainPropertyInfo; - - /** - * Suppress reflection accessor warnings. - */ - public final boolean supressAccessorWarnings; - - /** - * Improved xsi type handling. - */ - public final boolean improvedXsiTypeHandling; - - /** - * Disable security processing. - */ - public final boolean disableSecurityProcessing; - - private WeakReference typeInfoSetCache; - - private @NotNull RuntimeAnnotationReader annotationReader; - - private /*almost final*/ boolean hasSwaRef; - private final @NotNull Map subclassReplacements; - - /** - * If true, we aim for faster {@link JAXBContext} instantiation performance, - * instead of going after efficient sustained unmarshalling/marshalling performance. - * - * @since 2.0.4 - */ - public final boolean fastBoot; - - private Set xmlNsSet = null; - - /** - * If true, despite the specification, unmarshall child element with parent namespace, if child namespace is not specified. - * The default value is null for System {code}com.sun.xml.internal.bind.backupWithParentNamespace{code} property to be used, - * and false is assumed if it's not set either. - * - * Boolean - * @since 2.3.0 - */ - public Boolean backupWithParentNamespace = null; - - /** - * Returns declared XmlNs annotations (from package-level annotation XmlSchema - * - * @return set of all present XmlNs annotations - */ - public Set getXmlNsSet() { - return xmlNsSet; - } - - private JAXBContextImpl(JAXBContextBuilder builder) throws JAXBException { - - this.defaultNsUri = builder.defaultNsUri; - this.retainPropertyInfo = builder.retainPropertyInfo; - this.annotationReader = builder.annotationReader; - this.subclassReplacements = builder.subclassReplacements; - this.c14nSupport = builder.c14nSupport; - this.classes = builder.classes; - this.xmlAccessorFactorySupport = builder.xmlAccessorFactorySupport; - this.allNillable = builder.allNillable; - this.supressAccessorWarnings = builder.supressAccessorWarnings; - this.improvedXsiTypeHandling = builder.improvedXsiTypeHandling; - this.disableSecurityProcessing = builder.disableSecurityProcessing; - this.backupWithParentNamespace = builder.backupWithParentNamespace; - - Collection typeRefs = builder.typeRefs; - - boolean fastB; - try { - fastB = Boolean.getBoolean(JAXBContextImpl.class.getName()+".fastBoot"); - } catch (SecurityException e) { - fastB = false; - } - this.fastBoot = fastB; - - RuntimeTypeInfoSet typeSet = getTypeInfoSet(); - - // at least prepare the empty table so that we don't have to check for null later - elements.put(null,new LinkedHashMap()); - - // recognize leaf bean infos - for( RuntimeBuiltinLeafInfo leaf : RuntimeBuiltinLeafInfoImpl.builtinBeanInfos ) { - LeafBeanInfoImpl bi = new LeafBeanInfoImpl(this,leaf); - beanInfoMap.put(leaf.getClazz(),bi); - for( QName t : bi.getTypeNames() ) - typeMap.put(t,bi); - } - - for (RuntimeEnumLeafInfo e : typeSet.enums().values()) { - JaxBeanInfo bi = getOrCreate(e); - for (QName qn : bi.getTypeNames()) - typeMap.put( qn, bi ); - if(e.isElement()) - rootMap.put( e.getElementName(), bi ); - } - - for (RuntimeArrayInfo a : typeSet.arrays().values()) { - JaxBeanInfo ai = getOrCreate(a); - for (QName qn : ai.getTypeNames()) - typeMap.put( qn, ai ); - } - - for( Entry e : typeSet.beans().entrySet() ) { - ClassBeanInfoImpl bi = getOrCreate(e.getValue()); - - XmlSchema xs = this.annotationReader.getPackageAnnotation(XmlSchema.class, e.getKey(), null); - if(xs != null) { - if(xs.xmlns() != null && xs.xmlns().length > 0) { - if(xmlNsSet == null) - xmlNsSet = new HashSet(); - xmlNsSet.addAll(Arrays.asList(xs.xmlns())); - } - } - - if(bi.isElement()) - rootMap.put( e.getValue().getElementName(), bi ); - - for (QName qn : bi.getTypeNames()) - typeMap.put( qn, bi ); - } - - // fill in element mappings - for( RuntimeElementInfo n : typeSet.getAllElements() ) { - ElementBeanInfoImpl bi = getOrCreate(n); - if(n.getScope()==null) - rootMap.put(n.getElementName(),bi); - - RuntimeClassInfo scope = n.getScope(); - Class scopeClazz = scope==null?null:scope.getClazz(); - Map m = elements.get(scopeClazz); - if(m==null) { - m = new LinkedHashMap(); - elements.put(scopeClazz,m); - } - m.put(n.getElementName(),bi); - } - - // this one is so that we can handle plain JAXBElements. - beanInfoMap.put(JAXBElement.class,new ElementBeanInfoImpl(this)); - // another special BeanInfoImpl just for marshalling - beanInfoMap.put(CompositeStructure.class,new CompositeStructureBeanInfo(this)); - - getOrCreate(typeSet.getAnyTypeInfo()); - - // then link them all! - for (JaxBeanInfo bi : beanInfos.values()) - bi.link(this); - - // register primitives for boxed types just to make GrammarInfo fool-proof - for( Map.Entry e : RuntimeUtil.primitiveToBox.entrySet() ) - beanInfoMap.put( e.getKey(), beanInfoMap.get(e.getValue()) ); - - // build bridges - Navigator nav = typeSet.getNavigator(); - - for (TypeReference tr : typeRefs) { - XmlJavaTypeAdapter xjta = tr.get(XmlJavaTypeAdapter.class); - Adapter a=null; - XmlList xl = tr.get(XmlList.class); - - // eventually compute the in-memory type - Class erasedType = (Class) nav.erasure(tr.type); - - if(xjta!=null) { - a = new Adapter(xjta.value(),nav); - } - if(tr.get(XmlAttachmentRef.class)!=null) { - a = new Adapter(SwaRefAdapter.class,nav); - hasSwaRef = true; - } - - if(a!=null) { - erasedType = (Class) nav.erasure(a.defaultType); - } - - Name name = nameBuilder.createElementName(tr.tagName); - - InternalBridge bridge; - if(xl==null) - bridge = new BridgeImpl(this, name,getBeanInfo(erasedType,true),tr); - else - bridge = new BridgeImpl(this, name,new ValueListBeanInfoImpl(this,erasedType),tr); - - if(a!=null) - bridge = new BridgeAdapter(bridge,a.adapterType); - - bridges.put(tr,bridge); - } - - this.nameList = nameBuilder.conclude(); - - for (JaxBeanInfo bi : beanInfos.values()) - bi.wrapUp(); - - // no use for them now - nameBuilder = null; - beanInfos = null; - } - - /** - * True if this JAXBContext has {@link XmlAttachmentRef}. - */ - public boolean hasSwaRef() { - return hasSwaRef; - } - - public RuntimeTypeInfoSet getRuntimeTypeInfoSet() { - try { - return getTypeInfoSet(); - } catch (IllegalAnnotationsException e) { - // impossible, once the model is constructred - throw new AssertionError(e); - } - } - - /** - * Creates a {@link RuntimeTypeInfoSet}. - */ - public RuntimeTypeInfoSet getTypeInfoSet() throws IllegalAnnotationsException { - - // check cache - if(typeInfoSetCache!=null) { - RuntimeTypeInfoSet r = typeInfoSetCache.get(); - if(r!=null) - return r; - } - - final RuntimeModelBuilder builder = new RuntimeModelBuilder(this,annotationReader,subclassReplacements,defaultNsUri); - - IllegalAnnotationsException.Builder errorHandler = new IllegalAnnotationsException.Builder(); - builder.setErrorHandler(errorHandler); - - for( Class c : classes ) { - if(c==CompositeStructure.class) - // CompositeStructure doesn't have TypeInfo, so skip it. - // We'll add JaxBeanInfo for this later automatically - continue; - builder.getTypeInfo(new Ref(c)); - } - - this.hasSwaRef |= builder.hasSwaRef; - RuntimeTypeInfoSet r = builder.link(); - - errorHandler.check(); - assert r!=null : "if no error was reported, the link must be a success"; - - typeInfoSetCache = new WeakReference(r); - - return r; - } - - - public ElementBeanInfoImpl getElement(Class scope, QName name) { - Map m = elements.get(scope); - if(m!=null) { - ElementBeanInfoImpl bi = m.get(name); - if(bi!=null) - return bi; - } - m = elements.get(null); - return m.get(name); - } - - - - - - private ElementBeanInfoImpl getOrCreate( RuntimeElementInfo rei ) { - JaxBeanInfo bi = beanInfos.get(rei); - if(bi!=null) return (ElementBeanInfoImpl)bi; - - // all elements share the same type, so we can't register them to beanInfoMap - return new ElementBeanInfoImpl(this, rei); - } - - protected JaxBeanInfo getOrCreate( RuntimeEnumLeafInfo eli ) { - JaxBeanInfo bi = beanInfos.get(eli); - if(bi!=null) return bi; - bi = new LeafBeanInfoImpl(this,eli); - beanInfoMap.put(bi.jaxbType,bi); - return bi; - } - - protected ClassBeanInfoImpl getOrCreate( RuntimeClassInfo ci ) { - ClassBeanInfoImpl bi = (ClassBeanInfoImpl)beanInfos.get(ci); - if(bi!=null) return bi; - bi = new ClassBeanInfoImpl(this,ci); - beanInfoMap.put(bi.jaxbType,bi); - return bi; - } - - protected JaxBeanInfo getOrCreate( RuntimeArrayInfo ai ) { - JaxBeanInfo abi = beanInfos.get(ai); - if(abi!=null) return abi; - - abi = new ArrayBeanInfoImpl(this,ai); - - beanInfoMap.put(ai.getType(),abi); - return abi; - } - - public JaxBeanInfo getOrCreate(RuntimeTypeInfo e) { - if(e instanceof RuntimeElementInfo) - return getOrCreate((RuntimeElementInfo)e); - if(e instanceof RuntimeClassInfo) - return getOrCreate((RuntimeClassInfo)e); - if(e instanceof RuntimeLeafInfo) { - JaxBeanInfo bi = beanInfos.get(e); // must have been created - assert bi!=null; - return bi; - } - if(e instanceof RuntimeArrayInfo) - return getOrCreate((RuntimeArrayInfo)e); - if(e.getType()==Object.class) { - // anyType - JaxBeanInfo bi = beanInfoMap.get(Object.class); - if(bi==null) { - bi = new AnyTypeBeanInfo(this,e); - beanInfoMap.put(Object.class,bi); - } - return bi; - } - - throw new IllegalArgumentException(); - } - - /** - * Gets the {@link JaxBeanInfo} object that can handle - * the given JAXB-bound object. - * - *

- * This method traverses the base classes of the given object. - * - * @return null - * if {@code c} isn't a JAXB-bound class and {@code fatal==false}. - */ - public final JaxBeanInfo getBeanInfo(Object o) { - // don't allow xs:anyType beanInfo to handle all the unbound objects - for( Class c=o.getClass(); c!=Object.class; c=c.getSuperclass()) { - JaxBeanInfo bi = beanInfoMap.get(c); - if(bi!=null) return bi; - } - if(o instanceof Element) - return beanInfoMap.get(Object.class); // return the BeanInfo for xs:anyType - for( Class c : o.getClass().getInterfaces()) { - JaxBeanInfo bi = beanInfoMap.get(c); - if(bi!=null) return bi; - } - return null; - } - - /** - * Gets the {@link JaxBeanInfo} object that can handle - * the given JAXB-bound object. - * - * @param fatal - * if true, the failure to look up will throw an exception. - * Otherwise it will just return null. - */ - public final JaxBeanInfo getBeanInfo(Object o,boolean fatal) throws JAXBException { - JaxBeanInfo bi = getBeanInfo(o); - if(bi!=null) return bi; - if(fatal) { - if(o instanceof Document) - throw new JAXBException(Messages.ELEMENT_NEEDED_BUT_FOUND_DOCUMENT.format(o.getClass())); - throw new JAXBException(Messages.UNKNOWN_CLASS.format(o.getClass())); - } - return null; - } - - /** - * Gets the {@link JaxBeanInfo} object that can handle - * the given JAXB-bound class. - * - *

- * This method doesn't look for base classes. - * - * @return null - * if {@code c} isn't a JAXB-bound class and {@code fatal==false}. - */ - public final JaxBeanInfo getBeanInfo(Class clazz) { - return (JaxBeanInfo)beanInfoMap.get(clazz); - } - - /** - * Gets the {@link JaxBeanInfo} object that can handle - * the given JAXB-bound class. - * - * @param fatal - * if true, the failure to look up will throw an exception. - * Otherwise it will just return null. - */ - public final JaxBeanInfo getBeanInfo(Class clazz,boolean fatal) throws JAXBException { - JaxBeanInfo bi = getBeanInfo(clazz); - if(bi!=null) return bi; - if(fatal) - throw new JAXBException(clazz.getName()+" is not known to this context"); - return null; - } - - /** - * Based on the tag name, determine what object to unmarshal, - * and then set a new object and its loader to the current unmarshaller state. - * - * @return - * null if the given name pair is not recognized. - */ - public final Loader selectRootLoader( UnmarshallingContext.State state, TagName tag ) { - JaxBeanInfo beanInfo = rootMap.get(tag.uri,tag.local); - if(beanInfo==null) - return null; - - return beanInfo.getLoader(this,true); - } - - /** - * Gets the {@link JaxBeanInfo} for the given named XML Schema type. - * - * @return - * null if the type name is not recognized. For schema - * languages other than XML Schema, this method always - * returns null. - */ - public JaxBeanInfo getGlobalType(QName name) { - return typeMap.get(name); - } - - /** - * Finds a type name that this context recognizes which is - * "closest" to the given type name. - * - *

- * This method is used for error recovery. - */ - public String getNearestTypeName(QName name) { - String[] all = new String[typeMap.size()]; - int i=0; - for (QName qn : typeMap.keySet()) { - if(qn.getLocalPart().equals(name.getLocalPart())) - return qn.toString(); // probably a match, as people often gets confused about namespace. - all[i++] = qn.toString(); - } - - String nearest = EditDistance.findNearest(name.toString(), all); - - if(EditDistance.editDistance(nearest,name.toString())>10) - return null; // too far apart. - - return nearest; - } - - /** - * Returns the set of valid root tag names. - * For diagnostic use. - */ - public Set getValidRootNames() { - Set r = new TreeSet(QNAME_COMPARATOR); - for (QNameMap.Entry e : rootMap.entrySet()) { - r.add(e.createQName()); - } - return r; - } - - /** - * Cache of UTF-8 encoded local names to improve the performance for the marshalling. - */ - private Encoded[] utf8nameTable; - - public synchronized Encoded[] getUTF8NameTable() { - if(utf8nameTable==null) { - Encoded[] x = new Encoded[nameList.localNames.length]; - for( int i=0; i getXmlType(RuntimeTypeInfoSet tis, TypeReference tr) { - if(tr==null) - throw new IllegalArgumentException(); - - XmlJavaTypeAdapter xjta = tr.get(XmlJavaTypeAdapter.class); - XmlList xl = tr.get(XmlList.class); - - Ref ref = new Ref(annotationReader, tis.getNavigator(), tr.type, xjta, xl ); - - return tis.getTypeInfo(ref); - } - - @Override - public void generateEpisode(Result output) { - if(output==null) - throw new IllegalArgumentException(); - createSchemaGenerator().writeEpisodeFile(ResultFactory.createSerializer(output)); - } - - @Override - @SuppressWarnings("ThrowableInitCause") - public void generateSchema(SchemaOutputResolver outputResolver) throws IOException { - if(outputResolver==null) - throw new IOException(Messages.NULL_OUTPUT_RESOLVER.format()); - - final SAXParseException[] e = new SAXParseException[1]; - final SAXParseException[] w = new SAXParseException[1]; - - createSchemaGenerator().write(outputResolver, new ErrorListener() { - public void error(SAXParseException exception) { - e[0] = exception; - } - - public void fatalError(SAXParseException exception) { - e[0] = exception; - } - - public void warning(SAXParseException exception) { - w[0] = exception; - } - - public void info(SAXParseException exception) {} - }); - - if (e[0]!=null) { - IOException x = new IOException(Messages.FAILED_TO_GENERATE_SCHEMA.format()); - x.initCause(e[0]); - throw x; - } - if (w[0]!=null) { - IOException x = new IOException(Messages.ERROR_PROCESSING_SCHEMA.format()); - x.initCause(w[0]); - throw x; - } - } - - private XmlSchemaGenerator createSchemaGenerator() { - RuntimeTypeInfoSet tis; - try { - tis = getTypeInfoSet(); - } catch (IllegalAnnotationsException e) { - // this shouldn't happen because we've already - throw new AssertionError(e); - } - - XmlSchemaGenerator xsdgen = - new XmlSchemaGenerator(tis.getNavigator(),tis); - - // JAX-RPC uses Bridge objects that collide with - // @XmlRootElement. - // we will avoid collision here - Set rootTagNames = new HashSet(); - for (RuntimeElementInfo ei : tis.getAllElements()) { - rootTagNames.add(ei.getElementName()); - } - for (RuntimeClassInfo ci : tis.beans().values()) { - if(ci.isElement()) - rootTagNames.add(ci.asElement().getElementName()); - } - - for (TypeReference tr : bridges.keySet()) { - if(rootTagNames.contains(tr.tagName)) - continue; - - if(tr.type==void.class || tr.type==Void.class) { - xsdgen.add(tr.tagName,false,null); - } else - if(tr.type==CompositeStructure.class) { - // this is a special class we introduced for JAX-WS that we *don't* want in the schema - } else { - NonElement typeInfo = getXmlType(tis,tr); - xsdgen.add(tr.tagName, !tis.getNavigator().isPrimitive(tr.type),typeInfo); - } - } - return xsdgen; - } - - public QName getTypeName(TypeReference tr) { - try { - NonElement xt = getXmlType(getTypeInfoSet(),tr); - if(xt==null) throw new IllegalArgumentException(); - return xt.getTypeName(); - } catch (IllegalAnnotationsException e) { - // impossible given that JAXBRIContext has been successfully built in the first place - throw new AssertionError(e); - } - } - - @Override - public Binder createBinder(Class domType) { - if(domType==Node.class) - return (Binder)createBinder(); - else - return super.createBinder(domType); - } - - @Override - public Binder createBinder() { - return new BinderImpl(this,new DOMScanner()); - } - - public QName getElementName(Object o) throws JAXBException { - JaxBeanInfo bi = getBeanInfo(o,true); - if(!bi.isElement()) - return null; - return new QName(bi.getElementNamespaceURI(o),bi.getElementLocalName(o)); - } - - public QName getElementName(Class o) throws JAXBException { - JaxBeanInfo bi = getBeanInfo(o,true); - if(!bi.isElement()) - return null; - return new QName(bi.getElementNamespaceURI(o),bi.getElementLocalName(o)); - } - - public Bridge createBridge(TypeReference ref) { - return bridges.get(ref); - } - - public @NotNull BridgeContext createBridgeContext() { - return new BridgeContextImpl(this); - } - - public RawAccessor getElementPropertyAccessor(Class wrapperBean, String nsUri, String localName) throws JAXBException { - JaxBeanInfo bi = getBeanInfo(wrapperBean,true); - if(!(bi instanceof ClassBeanInfoImpl)) - throw new JAXBException(wrapperBean+" is not a bean"); - - for( ClassBeanInfoImpl cb = (ClassBeanInfoImpl) bi; cb!=null; cb=cb.superClazz) { - for (Property p : cb.properties) { - final Accessor acc = p.getElementPropertyAccessor(nsUri,localName); - if(acc!=null) - return new RawAccessor() { - // Accessor.set/get are designed for unmarshaller/marshaller, and hence - // they go through an adapter behind the scene. - // this isn't desirable for JAX-WS, which essentially uses this method - // just as a reflection library. So use the "unadapted" version to - // achieve the desired semantics - public Object get(Object bean) throws AccessorException { - return acc.getUnadapted(bean); - } - - public void set(Object bean, Object value) throws AccessorException { - acc.setUnadapted(bean,value); - } - }; - } - } - throw new JAXBException(new QName(nsUri,localName)+" is not a valid property on "+wrapperBean); - } - - public List getKnownNamespaceURIs() { - return Arrays.asList(nameList.namespaceURIs); - } - - public String getBuildId() { - Package pkg = getClass().getPackage(); - if(pkg==null) return null; - return pkg.getImplementationVersion(); - } - - @Override - public String toString() { - StringBuilder buf = new StringBuilder(Which.which(getClass()) + " Build-Id: " + getBuildId()); - buf.append("\nClasses known to this context:\n"); - - Set names = new TreeSet(); // sort them so that it's easy to read - - for (Class key : beanInfoMap.keySet()) - names.add(key.getName()); - - for(String name: names) - buf.append(" ").append(name).append('\n'); - - return buf.toString(); - } - - /** - * Gets the value of the xmime:contentType attribute on the given object, or null - * if for some reason it couldn't be found, including any error. - */ - public String getXMIMEContentType( Object o ) { - JaxBeanInfo bi = getBeanInfo(o); - if(!(bi instanceof ClassBeanInfoImpl)) - return null; - - ClassBeanInfoImpl cb = (ClassBeanInfoImpl) bi; - for (Property p : cb.properties) { - if (p instanceof AttributeProperty) { - AttributeProperty ap = (AttributeProperty) p; - if(ap.attName.equals(WellKnownNamespace.XML_MIME_URI,"contentType")) - try { - return (String)ap.xacc.print(o); - } catch (AccessorException e) { - return null; - } catch (SAXException e) { - return null; - } catch (ClassCastException e) { - return null; - } - } - } - return null; - } - - /** - * Creates a {@link JAXBContextImpl} that includes the specified additional classes. - */ - public JAXBContextImpl createAugmented(Class clazz) throws JAXBException { - Class[] newList = new Class[classes.length+1]; - System.arraycopy(classes,0,newList,0,classes.length); - newList[classes.length] = clazz; - - JAXBContextBuilder builder = new JAXBContextBuilder(this); - builder.setClasses(newList); - return builder.build(); - } - - private static final Comparator QNAME_COMPARATOR = new Comparator() { - public int compare(QName lhs, QName rhs) { - int r = lhs.getLocalPart().compareTo(rhs.getLocalPart()); - if(r!=0) return r; - - return lhs.getNamespaceURI().compareTo(rhs.getNamespaceURI()); - } - }; - - public static class JAXBContextBuilder { - - private boolean retainPropertyInfo = false; - private boolean supressAccessorWarnings = false; - private String defaultNsUri = ""; - private @NotNull RuntimeAnnotationReader annotationReader = new RuntimeInlineAnnotationReader(); - private @NotNull Map subclassReplacements = Collections.emptyMap(); - private boolean c14nSupport = false; - private Class[] classes; - private Collection typeRefs; - private boolean xmlAccessorFactorySupport = false; - private boolean allNillable; - private boolean improvedXsiTypeHandling = true; - private boolean disableSecurityProcessing = true; - private Boolean backupWithParentNamespace = null; // null for System property to be used - - public JAXBContextBuilder() {}; - - public JAXBContextBuilder(JAXBContextImpl baseImpl) { - this.supressAccessorWarnings = baseImpl.supressAccessorWarnings; - this.retainPropertyInfo = baseImpl.retainPropertyInfo; - this.defaultNsUri = baseImpl.defaultNsUri; - this.annotationReader = baseImpl.annotationReader; - this.subclassReplacements = baseImpl.subclassReplacements; - this.c14nSupport = baseImpl.c14nSupport; - this.classes = baseImpl.classes; - this.typeRefs = baseImpl.bridges.keySet(); - this.xmlAccessorFactorySupport = baseImpl.xmlAccessorFactorySupport; - this.allNillable = baseImpl.allNillable; - this.disableSecurityProcessing = baseImpl.disableSecurityProcessing; - this.backupWithParentNamespace = baseImpl.backupWithParentNamespace; - } - - public JAXBContextBuilder setRetainPropertyInfo(boolean val) { - this.retainPropertyInfo = val; - return this; - } - - public JAXBContextBuilder setSupressAccessorWarnings(boolean val) { - this.supressAccessorWarnings = val; - return this; - } - - public JAXBContextBuilder setC14NSupport(boolean val) { - this.c14nSupport = val; - return this; - } - - public JAXBContextBuilder setXmlAccessorFactorySupport(boolean val) { - this.xmlAccessorFactorySupport = val; - return this; - } - - public JAXBContextBuilder setDefaultNsUri(String val) { - this.defaultNsUri = val; - return this; - } - - public JAXBContextBuilder setAllNillable(boolean val) { - this.allNillable = val; - return this; - } - - public JAXBContextBuilder setClasses(Class[] val) { - this.classes = val; - return this; - } - - public JAXBContextBuilder setAnnotationReader(RuntimeAnnotationReader val) { - this.annotationReader = val; - return this; - } - - public JAXBContextBuilder setSubclassReplacements(Map val) { - this.subclassReplacements = val; - return this; - } - - public JAXBContextBuilder setTypeRefs(Collection val) { - this.typeRefs = val; - return this; - } - - public JAXBContextBuilder setImprovedXsiTypeHandling(boolean val) { - this.improvedXsiTypeHandling = val; - return this; - } - - public JAXBContextBuilder setDisableSecurityProcessing(boolean val) { - this.disableSecurityProcessing = val; - return this; - } - - public JAXBContextBuilder setBackupWithParentNamespace(Boolean backupWithParentNamespace) { - this.backupWithParentNamespace = backupWithParentNamespace; - return this; - } - - public JAXBContextImpl build() throws JAXBException { - - // fool-proof - if (this.defaultNsUri == null) { - this.defaultNsUri = ""; - } - - if (this.subclassReplacements == null) { - this.subclassReplacements = Collections.emptyMap(); - } - - if (this.annotationReader == null) { - this.annotationReader = new RuntimeInlineAnnotationReader(); - } - - if (this.typeRefs == null) { - this.typeRefs = Collections.emptyList(); - } - - return new JAXBContextImpl(this); - } - - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/JaxBeanInfo.java 2018-01-30 20:33:15.000000000 -0500 +++ /dev/null 2018-01-30 20:33:15.000000000 -0500 @@ -1,561 +0,0 @@ -/* - * 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.bind.v2.runtime; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Marshaller; -import javax.xml.bind.Unmarshaller; -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.istack.internal.NotNull; -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfo; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; - -import org.xml.sax.SAXException; - -/** - * Encapsulates various JAXB operations on objects bound by JAXB. - * Immutable and thread-safe. - * - *

- * Each JAXB-bound class has a corresponding {@link JaxBeanInfo} object, - * which performs all the JAXB related operations on behalf of - * the JAXB-bound object. - * - *

- * Given a class, the corresponding {@link JaxBeanInfo} can be located - * via {@link JAXBContextImpl#getBeanInfo(Class,boolean)}. - * - *

- * Typically, {@link JaxBeanInfo} implementations should be generated - * by XJC/JXC. Those impl classes will register themselves to their - * master {@code ObjectFactory} class. - * - *

- * The type parameter BeanT is the Java class of the bean that this represents. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public abstract class JaxBeanInfo { - - protected boolean isNilIncluded = false; - - /** - * For {@link JaxBeanInfo} that has multiple type names. - */ - protected JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class jaxbType, QName[] typeNames, boolean isElement,boolean isImmutable, boolean hasLifecycleEvents) { - this(grammar,rti,jaxbType,(Object)typeNames,isElement,isImmutable,hasLifecycleEvents); - } - - /** - * For {@link JaxBeanInfo} that has one type name. - */ - protected JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class jaxbType, QName typeName, boolean isElement,boolean isImmutable, boolean hasLifecycleEvents) { - this(grammar,rti,jaxbType,(Object)typeName,isElement,isImmutable,hasLifecycleEvents); - } - - /** - * For {@link JaxBeanInfo} that has no type names. - */ - protected JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class jaxbType, boolean isElement,boolean isImmutable, boolean hasLifecycleEvents) { - this(grammar,rti,jaxbType,(Object)null,isElement,isImmutable,hasLifecycleEvents); - } - - private JaxBeanInfo(JAXBContextImpl grammar, RuntimeTypeInfo rti, Class jaxbType, Object typeName, boolean isElement,boolean isImmutable, boolean hasLifecycleEvents) { - grammar.beanInfos.put(rti,this); - - this.jaxbType = jaxbType; - this.typeName = typeName; - this.flag = (short)((isElement?FLAG_IS_ELEMENT:0) - |(isImmutable?FLAG_IS_IMMUTABLE:0) - |(hasLifecycleEvents?FLAG_HAS_LIFECYCLE_EVENTS:0)); - } - - /** - * Various boolean flags combined into one field to improve memory footprint. - */ - protected short flag; - - private static final short FLAG_IS_ELEMENT = 1; - private static final short FLAG_IS_IMMUTABLE = 2; - private static final short FLAG_HAS_ELEMENT_ONLY_CONTENTMODEL = 4; - private static final short FLAG_HAS_BEFORE_UNMARSHAL_METHOD = 8; - private static final short FLAG_HAS_AFTER_UNMARSHAL_METHOD = 16; - private static final short FLAG_HAS_BEFORE_MARSHAL_METHOD = 32; - private static final short FLAG_HAS_AFTER_MARSHAL_METHOD = 64; - private static final short FLAG_HAS_LIFECYCLE_EVENTS = 128; - - /** cache of lifecycle methods */ - private LifecycleMethods lcm = null; - - /** - * True if {@link #jaxbType} has the lifecycle method. - */ - public final boolean hasBeforeUnmarshalMethod() { - return (flag&FLAG_HAS_BEFORE_UNMARSHAL_METHOD) != 0; - } - - /** - * True if {@link #jaxbType} has the lifecycle method. - */ - public final boolean hasAfterUnmarshalMethod() { - return (flag&FLAG_HAS_AFTER_UNMARSHAL_METHOD) != 0; - } - - /** - * True if {@link #jaxbType} has the lifecycle method. - */ - public final boolean hasBeforeMarshalMethod() { - return (flag&FLAG_HAS_BEFORE_MARSHAL_METHOD) != 0; - } - - /** - * True if {@link #jaxbType} has the lifecycle method. - */ - public final boolean hasAfterMarshalMethod() { - return (flag&FLAG_HAS_AFTER_MARSHAL_METHOD) != 0; - } - - /** - * Gets the JAXB bound class type that this {@link JaxBeanInfo} - * handles. - * - *

- * IOW, when a bean info object is requested for T, - * sometimes the bean info for one of its base classes might be - * returned. - */ - public final Class jaxbType; - - /** - * Returns true if the bean is mapped to/from an XML element. - * - *

- * When this method returns true, {@link #getElementNamespaceURI(Object)} - * and {@link #getElementLocalName(Object)} returns the element name of - * the bean. - */ - public final boolean isElement() { - return (flag&FLAG_IS_ELEMENT)!=0; - } - - /** - * Returns true if the bean is immutable. - * - *

- * If this is true, Binder won't try to ueuse this object, and the unmarshaller - * won't create a new instance of it before it starts. - */ - public final boolean isImmutable() { - return (flag&FLAG_IS_IMMUTABLE)!=0; - } - - /** - * True if this bean has an element-only content model. - *

- * If this flag is true, the unmarshaller can work - * faster by ignoring whitespaces more efficiently. - */ - public final boolean hasElementOnlyContentModel() { - return (flag&FLAG_HAS_ELEMENT_ONLY_CONTENTMODEL)!=0; - } - - /** - * True if this bean has an element-only content model. - *

- * Should be considered immutable, though I can't mark it final - * because it cannot be computed in this constructor. - */ - protected final void hasElementOnlyContentModel(boolean value) { - if(value) - flag |= FLAG_HAS_ELEMENT_ONLY_CONTENTMODEL; - else - flag &= ~FLAG_HAS_ELEMENT_ONLY_CONTENTMODEL; - } - - public boolean isNilIncluded() { - return isNilIncluded; - } - - /** - * This method is used to determine which of the sub-classes should be - * interrogated for the existence of lifecycle methods. - * - * @return true if the un|marshaller should look for lifecycle methods - * on this beanInfo, false otherwise. - */ - public boolean lookForLifecycleMethods() { - return (flag&FLAG_HAS_LIFECYCLE_EVENTS)!=0; - } - - /** - * Returns the namespace URI portion of the element name, - * if the bean that this class represents is mapped from/to - * an XML element. - * - * @throws UnsupportedOperationException - * if {@link #isElement} is false. - */ - public abstract String getElementNamespaceURI(BeanT o); - - /** - * Returns the local name portion of the element name, - * if the bean that this class represents is mapped from/to - * an XML element. - * - * @throws UnsupportedOperationException - * if {@link #isElement} is false. - */ - public abstract String getElementLocalName(BeanT o); - - /** - * Type names associated with this {@link JaxBeanInfo}. - * - * @see #getTypeNames() - */ - private final Object typeName; // either null, QName, or QName[]. save memory since most of them have just one. - - /** - * Returns XML Schema type names if the bean is mapped from - * a complex/simple type of XML Schema. - * - *

- * This is an ugly necessity to correctly handle - * the type substitution semantics of XML Schema. - * - *

- * A single Java class maybe mapped to more than one - * XML types. All the types listed here are recognized - * when we are unmarshalling XML. - * - *

- * null if the class is not bound to a named schema type. - * - *

- */ - public Collection getTypeNames() { - if(typeName==null) return Collections.emptyList(); - if(typeName instanceof QName) return Collections.singletonList((QName)typeName); - return Arrays.asList((QName[])typeName); - } - - /** - * Returns the XML type name to be used to marshal the specified instance. - * - *

- * Most of the times the type can be determined regardless of the actual - * instance, but there's a few exceptions (most notably {@link XMLGregorianCalendar}), - * so as a general rule we need an instance to determine it. - */ - public QName getTypeName(@NotNull BeanT instance) { - if(typeName==null) return null; - if(typeName instanceof QName) return (QName)typeName; - return ((QName[])typeName)[0]; - } - - /** - * Creates a new instance of the bean. - * - *

- * This operation is only supported when {@link #isImmutable} is false. - * - * @param context - * Sometimes the created bean remembers the corresponding source location, - */ - public abstract BeanT createInstance(UnmarshallingContext context) throws IllegalAccessException, InvocationTargetException, InstantiationException, SAXException; - - /** - * Resets the object to the initial state, as if the object - * is created fresh. - * - *

- * This is used to reuse an existing object for unmarshalling. - * - * @param context - * used for reporting any errors. - * - * @return - * true if the object was successfuly resetted. - * False if the object is not resettable, in which case the object will be - * discarded and new one will be created. - *

- * If the object is resettable but failed by an error, it should be reported to the context, - * then return false. If the object is not resettable to begin with, do not report an error. - * - * @throws SAXException - * as a result of reporting an error, the context may throw a {@link SAXException}. - */ - public abstract boolean reset( BeanT o, UnmarshallingContext context ) throws SAXException; - - /** - * Gets the ID value of the given bean, if it has an ID value. - * Otherwise return null. - */ - public abstract String getId(BeanT o, XMLSerializer target) throws SAXException; - - /** - * Serializes child elements and texts into the specified target. - */ - public abstract void serializeBody( BeanT o, XMLSerializer target ) throws SAXException, IOException, XMLStreamException; - - /** - * Serializes attributes into the specified target. - */ - public abstract void serializeAttributes( BeanT o, XMLSerializer target ) throws SAXException, IOException, XMLStreamException; - - /** - * Serializes the bean as the root element. - * - *

- * In the java-to-schema binding, an object might marshal in two different - * ways depending on whether it is used as the root of the graph or not. - * In the former case, an object could marshal as an element, whereas - * in the latter case, it marshals as a type. - * - *

- * This method is used to marshal the root of the object graph to allow - * this semantics to be implemented. - * - *

- * It is doubtful to me if it's a good idea for an object to marshal - * in two ways depending on the context. - * - *

- * For schema-to-java, this is equivalent to {@link #serializeBody(Object, XMLSerializer)}. - */ - public abstract void serializeRoot( BeanT o, XMLSerializer target ) throws SAXException, IOException, XMLStreamException; - - /** - * Declares all the namespace URIs this object is using at - * its top-level scope into the specified target. - */ - public abstract void serializeURIs( BeanT o, XMLSerializer target ) throws SAXException; - - /** - * Gets the {@link Loader} that will unmarshall the given object. - * - * @param context - * The {@link JAXBContextImpl} object that governs this object. - * This object is taken as a parameter so that {@link JaxBeanInfo} doesn't have - * to store them on its own. - * - * When this method is invoked from within the unmarshaller, tihs parameter can be - * null (because the loader is constructed already.) - * - * @param typeSubstitutionCapable - * If true, the returned {@link Loader} is capable of recognizing @xsi:type (if necessary) - * and unmarshals a subtype. This allowes an optimization where this bean info - * is guaranteed not to have a type substitution. - * If false, the returned {@link Loader} doesn't look for @xsi:type. - * @return - * must return non-null valid object - */ - public abstract Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable); - - /** - * If the bean's representation in XML is just a text, - * this method return a {@link Transducer} that lets you convert - * values between the text and the bean. - */ - public abstract Transducer getTransducer(); - - - /** - * Called after all the {@link JaxBeanInfo}s are created. - * @param grammar - */ - protected void link(JAXBContextImpl grammar) { - } - - /** - * Called at the end of the {@link JAXBContext} initialization phase - * to clean up any unnecessary references. - */ - public void wrapUp() {} - - - private static final Class[] unmarshalEventParams = { Unmarshaller.class, Object.class }; - private static Class[] marshalEventParams = { Marshaller.class }; - - private Method[] getDeclaredMethods(final Class c) { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Method[] run() { - return c.getDeclaredMethods(); - } - }); - } - - /** - * use reflection to determine which of the 4 object lifecycle methods exist on - * the JAXB bound type. - */ - protected final void setLifecycleFlags() { - try { - Class jt = jaxbType; - - if (lcm == null) { - lcm = new LifecycleMethods(); - } - - while (jt != null) { - for (Method m : getDeclaredMethods(jt)) { - String name = m.getName(); - - if (lcm.beforeUnmarshal == null) { - if (name.equals("beforeUnmarshal")) { - if (match(m, unmarshalEventParams)) { - cacheLifecycleMethod(m, FLAG_HAS_BEFORE_UNMARSHAL_METHOD); - } - } - } - - if (lcm.afterUnmarshal == null) { - if (name.equals("afterUnmarshal")) { - if (match(m, unmarshalEventParams)) { - cacheLifecycleMethod(m, FLAG_HAS_AFTER_UNMARSHAL_METHOD); - } - } - } - - if (lcm.beforeMarshal == null) { - if (name.equals("beforeMarshal")) { - if (match(m, marshalEventParams)) { - cacheLifecycleMethod(m, FLAG_HAS_BEFORE_MARSHAL_METHOD); - } - } - } - - if (lcm.afterMarshal == null) { - if (name.equals("afterMarshal")) { - if (match(m, marshalEventParams)) { - cacheLifecycleMethod(m, FLAG_HAS_AFTER_MARSHAL_METHOD); - } - } - } - } - jt = (Class) jt.getSuperclass(); - } - } catch (SecurityException e) { - // this happens when we don't have enough permission. - logger.log(Level.WARNING, Messages.UNABLE_TO_DISCOVER_EVENTHANDLER.format( - jaxbType.getName(), e), e); - } - } - - private boolean match(Method m, Class[] params) { - return Arrays.equals(m.getParameterTypes(),params); - } - - /** - * Cache a reference to the specified lifecycle method for the jaxbType - * associated with this beanInfo. - * - * @param m Method reference - * @param lifecycleFlag byte representing which of the 4 lifecycle methods - * is being cached - */ - private void cacheLifecycleMethod(Method m, short lifecycleFlag) { - //LifecycleMethods lcm = getLifecycleMethods(); - if(lcm==null) { - lcm = new LifecycleMethods(); - //lcmCache.put(jaxbType, lcm); - } - - m.setAccessible(true); - - flag |= lifecycleFlag; - - switch (lifecycleFlag) { - case FLAG_HAS_BEFORE_UNMARSHAL_METHOD: - lcm.beforeUnmarshal = m; - break; - case FLAG_HAS_AFTER_UNMARSHAL_METHOD: - lcm.afterUnmarshal = m; - break; - case FLAG_HAS_BEFORE_MARSHAL_METHOD: - lcm.beforeMarshal = m; - break; - case FLAG_HAS_AFTER_MARSHAL_METHOD: - lcm.afterMarshal = m; - break; - } - } - - /** - * Return the LifecycleMethods cache for this ClassBeanInfo's corresponding - * jaxbType if it exists, else return null. - * - */ - public final LifecycleMethods getLifecycleMethods() { - return lcm; - } - - /** - * Invokes the beforeUnmarshal method if applicable. - */ - public final void invokeBeforeUnmarshalMethod(UnmarshallerImpl unm, Object child, Object parent) throws SAXException { - Method m = getLifecycleMethods().beforeUnmarshal; - invokeUnmarshallCallback(m, child, unm, parent); - } - - /** - * Invokes the afterUnmarshal method if applicable. - */ - public final void invokeAfterUnmarshalMethod(UnmarshallerImpl unm, Object child, Object parent) throws SAXException { - Method m = getLifecycleMethods().afterUnmarshal; - invokeUnmarshallCallback(m, child, unm, parent); - } - - private void invokeUnmarshallCallback(Method m, Object child, UnmarshallerImpl unm, Object parent) throws SAXException { - try { - m.invoke(child,unm,parent); - } catch (IllegalAccessException e) { - UnmarshallingContext.getInstance().handleError(e, false); - } catch (InvocationTargetException e) { - UnmarshallingContext.getInstance().handleError(e, false); - } - } - - private static final Logger logger = Util.getClassLogger(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/LeafBeanInfoImpl.java 2018-01-30 20:33:15.000000000 -0500 +++ /dev/null 2018-01-30 20:33:16.000000000 -0500 @@ -1,163 +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.bind.v2.runtime; - -import java.io.IOException; - -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.helpers.ValidationEventImpl; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeLeafInfo; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.TextLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiTypeLoader; - -import org.xml.sax.SAXException; - -/** - * {@link JaxBeanInfo} implementation for immutable leaf classes. - * - *

- * Leaf classes are always bound to a text and they are often immutable. - * The JAXB spec allows this binding for a few special Java classes plus - * type-safe enums. - * - *

- * This implementation obtains necessary information from {@link RuntimeLeafInfo}. - * - * @author Kohsuke Kawaguchi - */ -final class LeafBeanInfoImpl extends JaxBeanInfo { - - private final Loader loader; - private final Loader loaderWithSubst; - - private final Transducer xducer; - - /** - * Non-null only if the leaf is also an element. - */ - private final Name tagName; - - public LeafBeanInfoImpl(JAXBContextImpl grammar, RuntimeLeafInfo li) { - super(grammar,li,li.getClazz(),li.getTypeNames(),li.isElement(),true,false); - - xducer = li.getTransducer(); - loader = new TextLoader(xducer); - loaderWithSubst = new XsiTypeLoader(this); - - if(isElement()) - tagName = grammar.nameBuilder.createElementName(li.getElementName()); - else - tagName = null; - } - - @Override - public QName getTypeName(BeanT instance) { - QName tn = xducer.getTypeName(instance); - if(tn!=null) return tn; - // rely on default - return super.getTypeName(instance); - } - - public final String getElementNamespaceURI(BeanT t) { - return tagName.nsUri; - } - - public final String getElementLocalName(BeanT t) { - return tagName.localName; - } - - public BeanT createInstance(UnmarshallingContext context) { - throw new UnsupportedOperationException(); - } - - public final boolean reset(BeanT bean, UnmarshallingContext context) { - return false; - } - - public final String getId(BeanT bean, XMLSerializer target) { - return null; - } - - public final void serializeBody(BeanT bean, XMLSerializer w) throws SAXException, IOException, XMLStreamException { - // most of the times leaves are printed as leaf element/attribute property, - // so this code is only used for example when you have multiple XmlElement on a property - // and some of them are leaves. Hence this doesn't need to be super-fast. - try { - xducer.writeText(w,bean,null); - } catch (AccessorException e) { - w.reportError(null,e); - } - } - - public final void serializeAttributes(BeanT bean, XMLSerializer target) { - // noop - } - - public final void serializeRoot(BeanT bean, XMLSerializer target) throws SAXException, IOException, XMLStreamException { - if(tagName==null) { - target.reportError( - new ValidationEventImpl( - ValidationEvent.ERROR, - Messages.UNABLE_TO_MARSHAL_NON_ELEMENT.format(bean.getClass().getName()), - null, - null)); - } - else { - target.startElement(tagName,bean); - target.childAsSoleContent(bean,null); - target.endElement(); - } - } - - public final void serializeURIs(BeanT bean, XMLSerializer target) throws SAXException { - // TODO: maybe we should create another LeafBeanInfoImpl class for - // context-dependent xducers? - if(xducer.useNamespace()) { - try { - xducer.declareNamespace(bean,target); - } catch (AccessorException e) { - target.reportError(null,e); - } - } - } - - public final Loader getLoader(JAXBContextImpl context, boolean typeSubstitutionCapable) { - if(typeSubstitutionCapable) - return loaderWithSubst; - else - return loader; - } - - public Transducer getTransducer() { - return xducer; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/LifecycleMethods.java 2018-01-30 20:33:16.000000000 -0500 +++ /dev/null 2018-01-30 20:33:16.000000000 -0500 @@ -1,47 +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.xml.internal.bind.v2.runtime; - -import java.lang.reflect.Method; - -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; - -/** - * This class is a simple container for caching lifecycle methods that are - * discovered during construction of (@link JAXBContext}. - * - * @see JaxBeanInfo#lcm - * @see Loader#fireBeforeUnmarshal(JaxBeanInfo, Object, UnmarshallingContext.State) - * @see Loader#fireAfterUnmarshal(JaxBeanInfo, Object, UnmarshallingContext.State) - * @see XMLSerializer#fireMarshalEvent(Object, Method) - */ -final class LifecycleMethods { - Method beforeUnmarshal; - Method afterUnmarshal; - Method beforeMarshal; - Method afterMarshal; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Location.java 2018-01-30 20:33:17.000000000 -0500 +++ /dev/null 2018-01-30 20:33:17.000000000 -0500 @@ -1,45 +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.xml.internal.bind.v2.runtime; - - - -/** - * Location information for {@link IllegalAnnotationException}. - * - * @author Kohsuke Kawaguchi - * @since JAXB 2.0 EA1 - */ -// internally, Location is created from Locatable. -public interface Location { - /** - * Returns a human-readable string that represents this position. - * - * @return - * never null. - */ - String toString(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MarshallerImpl.java 2018-01-30 20:33:17.000000000 -0500 +++ /dev/null 2018-01-30 20:33:18.000000000 -0500 @@ -1,636 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime; - -import java.io.BufferedWriter; -import java.io.Closeable; -import java.io.FileOutputStream; -import java.io.Flushable; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.UnsupportedEncodingException; -import java.io.Writer; - -import java.net.URI; -import javax.xml.bind.JAXBException; -import javax.xml.bind.MarshalException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.PropertyException; -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.attachment.AttachmentMarshaller; -import javax.xml.bind.helpers.AbstractMarshallerImpl; -import javax.xml.stream.XMLEventWriter; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.Result; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamResult; -import javax.xml.validation.Schema; -import javax.xml.validation.ValidatorHandler; -import javax.xml.namespace.NamespaceContext; - -import com.sun.xml.internal.bind.api.JAXBRIContext; -import com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler; -import com.sun.xml.internal.bind.marshaller.DataWriter; -import com.sun.xml.internal.bind.marshaller.DumbEscapeHandler; -import com.sun.xml.internal.bind.marshaller.MinimumEscapeHandler; -import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper; -import com.sun.xml.internal.bind.marshaller.NioEscapeHandler; -import com.sun.xml.internal.bind.marshaller.SAX2DOMEx; -import com.sun.xml.internal.bind.marshaller.XMLWriter; -import com.sun.xml.internal.bind.v2.runtime.output.C14nXmlOutput; -import com.sun.xml.internal.bind.v2.runtime.output.Encoded; -import com.sun.xml.internal.bind.v2.runtime.output.ForkXmlOutput; -import com.sun.xml.internal.bind.v2.runtime.output.IndentingUTF8XmlOutput; -import com.sun.xml.internal.bind.v2.runtime.output.NamespaceContextImpl; -import com.sun.xml.internal.bind.v2.runtime.output.SAXOutput; -import com.sun.xml.internal.bind.v2.runtime.output.UTF8XmlOutput; -import com.sun.xml.internal.bind.v2.runtime.output.XMLEventWriterOutput; -import com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput; -import com.sun.xml.internal.bind.v2.runtime.output.XmlOutput; -import com.sun.xml.internal.bind.v2.util.FatalAdapter; - -import java.net.URISyntaxException; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.w3c.dom.Document; -import org.w3c.dom.Node; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.XMLFilterImpl; - -/** - * Implementation of {@link Marshaller} interface for the JAXB RI. - * - *

- * Eventually all the {@link #marshal} methods call into - * the {@link #write} method. - * - * @author Kohsuke Kawaguchi - * @author Vivek Pandey - */ -public /*to make unit tests happy*/ final class MarshallerImpl extends AbstractMarshallerImpl implements ValidationEventHandler -{ - private static final Logger LOGGER = Logger.getLogger(MarshallerImpl.class.getName()); - - /** Indentation string. Default is four whitespaces. */ - private String indent = " "; - - /** Used to assign prefixes to namespace URIs. */ - private NamespacePrefixMapper prefixMapper = null; - - /** Object that handles character escaping. */ - private CharacterEscapeHandler escapeHandler = null; - - /** XML BLOB written after the XML declaration. */ - private String header=null; - - /** reference to the context that created this object */ - final JAXBContextImpl context; - - protected final XMLSerializer serializer; - - /** - * Non-null if we do the marshal-time validation. - */ - private Schema schema; - - /** Marshaller.Listener */ - private Listener externalListener = null; - - /** Configured for c14n? */ - private boolean c14nSupport; - - // while createing XmlOutput those values may be set. - // if these are non-null they need to be cleaned up - private Flushable toBeFlushed; - private Closeable toBeClosed; - - /** - * @param assoc - * non-null if the marshaller is working inside {@link BinderImpl}. - */ - public MarshallerImpl( JAXBContextImpl c, AssociationMap assoc ) { - context = c; - serializer = new XMLSerializer(this); - c14nSupport = context.c14nSupport; - - try { - setEventHandler(this); - } catch (JAXBException e) { - throw new AssertionError(e); // impossible - } - } - - public JAXBContextImpl getContext() { - return context; - } - - /** - * Marshals to {@link OutputStream} with the given in-scope namespaces - * taken into account. - * - * @since 2.1.5 - */ - public void marshal(Object obj, OutputStream out, NamespaceContext inscopeNamespace) throws JAXBException { - write(obj, createWriter(out), new StAXPostInitAction(inscopeNamespace,serializer)); - } - - @Override - public void marshal(Object obj, XMLStreamWriter writer) throws JAXBException { - write(obj, XMLStreamWriterOutput.create(writer,context, escapeHandler), new StAXPostInitAction(writer,serializer)); - } - - @Override - public void marshal(Object obj, XMLEventWriter writer) throws JAXBException { - write(obj, new XMLEventWriterOutput(writer), new StAXPostInitAction(writer,serializer)); - } - - public void marshal(Object obj, XmlOutput output) throws JAXBException { - write(obj, output, null ); - } - - /** - * Creates {@link XmlOutput} from the given {@link Result} object. - */ - final XmlOutput createXmlOutput(Result result) throws JAXBException { - if (result instanceof SAXResult) - return new SAXOutput(((SAXResult) result).getHandler()); - - if (result instanceof DOMResult) { - final Node node = ((DOMResult) result).getNode(); - - if (node == null) { - Document doc = JAXBContextImpl.createDom(getContext().disableSecurityProcessing); - ((DOMResult) result).setNode(doc); - return new SAXOutput(new SAX2DOMEx(doc)); - } else { - return new SAXOutput(new SAX2DOMEx(node)); - } - } - if (result instanceof StreamResult) { - StreamResult sr = (StreamResult) result; - - if (sr.getWriter() != null) - return createWriter(sr.getWriter()); - else if (sr.getOutputStream() != null) - return createWriter(sr.getOutputStream()); - else if (sr.getSystemId() != null) { - String fileURL = sr.getSystemId(); - - try { - fileURL = new URI(fileURL).getPath(); - } catch (URISyntaxException use) { - // otherwise assume that it's a file name - } - - try { - FileOutputStream fos = new FileOutputStream(fileURL); - assert toBeClosed==null; - toBeClosed = fos; - return createWriter(fos); - } catch (IOException e) { - throw new MarshalException(e); - } - } - } - - // unsupported parameter type - throw new MarshalException(Messages.UNSUPPORTED_RESULT.format()); - } - - /** - * Creates an appropriate post-init action object. - */ - final Runnable createPostInitAction(Result result) { - if (result instanceof DOMResult) { - Node node = ((DOMResult) result).getNode(); - return new DomPostInitAction(node,serializer); - } - return null; - } - - public void marshal(Object target,Result result) throws JAXBException { - write(target, createXmlOutput(result), createPostInitAction(result)); - } - - - /** - * Used by {@link BridgeImpl} to write an arbitrary object as a fragment. - */ - protected final void write(Name rootTagName, JaxBeanInfo bi, T obj, XmlOutput out,Runnable postInitAction) throws JAXBException { - try { - try { - prewrite(out, true, postInitAction); - serializer.startElement(rootTagName,null); - if(bi.jaxbType==Void.class || bi.jaxbType==void.class) { - // special case for void - serializer.endNamespaceDecls(null); - serializer.endAttributes(); - } else { // normal cases - if(obj==null) - serializer.writeXsiNilTrue(); - else - serializer.childAsXsiType(obj,"root",bi, false); - } - serializer.endElement(); - postwrite(); - } catch( SAXException e ) { - throw new MarshalException(e); - } catch (IOException e) { - throw new MarshalException(e); - } catch (XMLStreamException e) { - throw new MarshalException(e); - } finally { - serializer.close(); - } - } finally { - cleanUp(); - } - } - - /** - * All the marshal method invocation eventually comes down to this call. - */ - private void write(Object obj, XmlOutput out, Runnable postInitAction) throws JAXBException { - try { - if( obj == null ) - throw new IllegalArgumentException(Messages.NOT_MARSHALLABLE.format()); - - if( schema!=null ) { - // send the output to the validator as well - ValidatorHandler validator = schema.newValidatorHandler(); - validator.setErrorHandler(new FatalAdapter(serializer)); - // work around a bug in JAXP validator in Tiger - XMLFilterImpl f = new XMLFilterImpl() { - @Override - public void startPrefixMapping(String prefix, String uri) throws SAXException { - super.startPrefixMapping(prefix.intern(), uri.intern()); - } - }; - f.setContentHandler(validator); - out = new ForkXmlOutput( new SAXOutput(f) { - @Override - public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws SAXException, IOException, XMLStreamException { - super.startDocument(serializer, false, nsUriIndex2prefixIndex, nsContext); - } - @Override - public void endDocument(boolean fragment) throws SAXException, IOException, XMLStreamException { - super.endDocument(false); - } - }, out ); - } - - try { - prewrite(out,isFragment(),postInitAction); - serializer.childAsRoot(obj); - postwrite(); - } catch( SAXException e ) { - throw new MarshalException(e); - } catch (IOException e) { - throw new MarshalException(e); - } catch (XMLStreamException e) { - throw new MarshalException(e); - } finally { - serializer.close(); - } - } finally { - cleanUp(); - } - } - - private void cleanUp() { - if(toBeFlushed!=null) - try { - toBeFlushed.flush(); - } catch (IOException e) { - // ignore - LOGGER.log(Level.SEVERE, e.getMessage(), e); - } - if(toBeClosed!=null) - try { - toBeClosed.close(); - } catch (IOException e) { - // ignore - LOGGER.log(Level.SEVERE, e.getMessage(), e); - } - toBeFlushed = null; - toBeClosed = null; - } - - // common parts between two write methods. - - private void prewrite(XmlOutput out, boolean fragment, Runnable postInitAction) throws IOException, SAXException, XMLStreamException { - serializer.startDocument(out,fragment,getSchemaLocation(),getNoNSSchemaLocation()); - if(postInitAction!=null) postInitAction.run(); - if(prefixMapper!=null) { - // be defensive as we work with the user's code - String[] decls = prefixMapper.getContextualNamespaceDecls(); - if(decls!=null) { // defensive check - for( int i=0; i void setAdapter(Class type, A adapter) { - if(type==null) - throw new IllegalArgumentException(); - serializer.putAdapter(type,adapter); - } - - @Override - public A getAdapter(Class type) { - if(type==null) - throw new IllegalArgumentException(); - if(serializer.containsAdapter(type)) - // so as not to create a new instance when this method is called - return serializer.getAdapter(type); - else - return null; - } - - @Override - public void setAttachmentMarshaller(AttachmentMarshaller am) { - serializer.attachmentMarshaller = am; - } - - @Override - public AttachmentMarshaller getAttachmentMarshaller() { - return serializer.attachmentMarshaller; - } - - @Override - public Schema getSchema() { - return schema; - } - - @Override - public void setSchema(Schema s) { - this.schema = s; - } - - /** - * Default error handling behavior fot {@link Marshaller}. - */ - public boolean handleEvent(ValidationEvent event) { - // draconian by default - return false; - } - - @Override - public Listener getListener() { - return externalListener; - } - - @Override - public void setListener(Listener listener) { - externalListener = listener; - } - - // features supported - protected static final String INDENT_STRING = "com.sun.xml.internal.bind.indentString"; - protected static final String PREFIX_MAPPER = "com.sun.xml.internal.bind.namespacePrefixMapper"; - protected static final String ENCODING_HANDLER = "com.sun.xml.internal.bind.characterEscapeHandler"; - protected static final String ENCODING_HANDLER2 = "com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler"; - protected static final String XMLDECLARATION = "com.sun.xml.internal.bind.xmlDeclaration"; - protected static final String XML_HEADERS = "com.sun.xml.internal.bind.xmlHeaders"; - protected static final String C14N = JAXBRIContext.CANONICALIZATION_SUPPORT; - protected static final String OBJECT_IDENTITY_CYCLE_DETECTION = "com.sun.xml.internal.bind.objectIdentitityCycleDetection"; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages.java 2018-01-30 20:33:18.000000000 -0500 +++ /dev/null 2018-01-30 20:33:18.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * 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.bind.v2.runtime; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Message resources - */ -enum Messages { - ILLEGAL_PARAMETER, // 2 args - UNABLE_TO_FIND_CONVERSION_METHOD, // 3 args - MISSING_ID, // 1 arg - NOT_IMPLEMENTED_IN_2_0, - UNRECOGNIZED_ELEMENT_NAME, - TYPE_MISMATCH, // 3 args - MISSING_OBJECT, // 1 arg - NOT_IDENTIFIABLE, // 0 args - DANGLING_IDREF, // 1 arg - NULL_OUTPUT_RESOLVER, // 0 args - UNABLE_TO_MARSHAL_NON_ELEMENT, // 1 arg - UNABLE_TO_MARSHAL_UNBOUND_CLASS, // 1 arg - UNSUPPORTED_PROPERTY, // 1 arg - NULL_PROPERTY_NAME, // 0 args - MUST_BE_X, // 3 args - NOT_MARSHALLABLE, // 0 args - UNSUPPORTED_RESULT, // 0 args - UNSUPPORTED_ENCODING, // 1 arg - SUBSTITUTED_BY_ANONYMOUS_TYPE, // 3 arg - CYCLE_IN_MARSHALLER, // 1 arg - UNABLE_TO_DISCOVER_EVENTHANDLER, // 1 arg - ELEMENT_NEEDED_BUT_FOUND_DOCUMENT, // 1 arg - UNKNOWN_CLASS, // 1 arg - FAILED_TO_GENERATE_SCHEMA, // 0 args - ERROR_PROCESSING_SCHEMA, // 0 args - ILLEGAL_CONTENT, // 2 args - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - @Override - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages.properties 2018-01-30 20:33:19.000000000 -0500 +++ /dev/null 2018-01-30 20:33:19.000000000 -0500 @@ -1,110 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = \ - the object parameter to marshal() is not marshallable - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = \ - unsupported javax.xml.parser.transform.Result parameter - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = \ - unsupported encoding: {0} - -ILLEGAL_PARAMETER = \ - Illegal "{0}" parameter: {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = \ - {0} doesn''t have a method {1} {2}(); - -MISSING_ID = \ - Object "{0}" is found in an IDREF property but this object doesn't have an ID. - -NOT_IMPLEMENTED_IN_2_0 = \ - This feature is not available in JAXB RI 2.0 - -UNRECOGNIZED_ELEMENT_NAME = \ - The tag name "{0}" is not known to this JAXBContext. - -TYPE_MISMATCH = \ - "{1}" property of a "{0}" object contains an object of type "{2}" but this is not allowed. \ - See javadoc of this property for what this property can accept. - -MISSING_OBJECT = \ - a required field "{0}" is missing an object - -NOT_IDENTIFIABLE = \ - An object is referenced as IDREF but its ID field is null - -DANGLING_IDREF = \ - A tree contains a reference to ID "{0}" but it's not a part of the object graph - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = \ - schema output resolver must not be null - -UNABLE_TO_MARSHAL_NON_ELEMENT = \ - unable to marshal type "{0}" as an element because it is missing an @XmlRootElement annotation - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = \ - unable to marshal type "{0}" as an element because it is not known to this context. - -UNSUPPORTED_PROPERTY = \ - "{0}" is not a supported property - -NULL_PROPERTY_NAME = \ - property name parameter can not be null - -MUST_BE_X = \ - property "{0}" must be an instance of type {1}, not {2} - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = \ - Instance of "{1}" is substituting "{0}", but "{2}" is bound to an anonymous type. - -CYCLE_IN_MARSHALLER = \ - A cycle is detected in the object graph. This will cause infinitely deep XML: {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = \ - Unable to list methods of "{0}". If there is any event callback handler on this class, it will be ignored. - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = \ - A DOM document "{0}" is found but an element is needed. Use Document.getDocumentElement() and set that object instead. - -UNKNOWN_CLASS = \ - {0} nor any of its super class is known to this context. - -FAILED_TO_GENERATE_SCHEMA = \ - Failed to generate schema. - -ERROR_PROCESSING_SCHEMA = \ - Error during schema processing. - -ILLEGAL_CONTENT = \ - Illegal XML content in <{0}>: "{1}". --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages_de.properties 2018-01-30 20:33:20.000000000 -0500 +++ /dev/null 2018-01-30 20:33:20.000000000 -0500 @@ -1,83 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = die Methode marshal() kann nicht mit Objektparameter verwendet werden - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = nicht unterst\u00FCtzter javax.xml.parser.transform.Result-Parameter - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = nicht unterst\u00FCtzte Codierung: {0} - -ILLEGAL_PARAMETER = Ung\u00FCltiger "{0}"-Parameter: {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = {0} enth\u00E4lt keine Methode {1} {2}(); - -MISSING_ID = Objekt "{0}" ist in einer IDREF-Eigenschaft enthalten, dieses Objekt hat jedoch keine ID. - -NOT_IMPLEMENTED_IN_2_0 = Dieses Feature ist in JAXB RI 2.0 nicht verf\u00FCgbar - -UNRECOGNIZED_ELEMENT_NAME = Der Tag-Name "{0}" ist diesem JAXBContext nicht bekannt. - -TYPE_MISMATCH = "{1}"-Eigenschaft eines "{0}"-Objekts enth\u00E4lt ein Objekt vom Typ "{2}", dies ist jedoch nicht zul\u00E4ssig. In javadoc f\u00FCr diese Eigenschaft wird beschrieben, was diese Eigenschaft akzeptieren kann. - -MISSING_OBJECT = bei einem Pflichtfeld "{0}" fehlt ein Objekt - -NOT_IDENTIFIABLE = Ein Objekt wird als IDREF referenziert, das ID-Feld ist jedoch null - -DANGLING_IDREF = Ein Baum enth\u00E4lt eine Referenz auf ID "{0}", ist jedoch nicht Bestandteil des Objektdiagramms - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = Schemaausgabe-Resolver darf nicht null sein - -UNABLE_TO_MARSHAL_NON_ELEMENT = Marshalling von Typ "{0}" als Element ist nicht m\u00F6glich, weil eine @XmlRootElement-Annotation fehlt - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = Marshalling von Typ "{0}" als Element ist nicht m\u00F6glich, weil er diesem Kontext nicht bekannt ist - -UNSUPPORTED_PROPERTY = "{0}" ist keine unterst\u00FCtzte Eigenschaft - -NULL_PROPERTY_NAME = Parameter f\u00FCr Eigenschaftsname darf nicht null sein - -MUST_BE_X = Eigenschaft "{0}" muss eine Instanz vom Typ {1} sein, und nicht {2} - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = Instanz von "{1}" ersetzt "{0}", "{2}" ist jedoch an einen anonymen Typ gebunden. - -CYCLE_IN_MARSHALLER = Ein Zyklus wird in dem Objektdiagramm ermittelt. Dies verursacht ein endlos tiefes XML: {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = Methoden von "{0}" k\u00F6nnen nicht aufgelistet werden. Wenn ein Ereignis-Callback Handler auf dieser Klasse vorhanden ist, wird er ignoriert. - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = Ein DOM-Dokument "{0}" wurde gefunden, es ist jedoch ein Element erforderlich. Verwenden Sie Document.getDocumentElement(), und legen Sie dieses Objekt stattdessen fest. - -UNKNOWN_CLASS = Weder {0} noch eine der zugeh\u00F6rigen Superklassen ist diesem Kontext bekannt. - -FAILED_TO_GENERATE_SCHEMA = Generieren von Schema nicht erfolgreich. - -ERROR_PROCESSING_SCHEMA = Fehler bei der Schemaverarbeitung. - -ILLEGAL_CONTENT = Ung\u00FCltiger XML-Content in <{0}>: "{1}". --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages_es.properties 2018-01-30 20:33:20.000000000 -0500 +++ /dev/null 2018-01-30 20:33:20.000000000 -0500 @@ -1,83 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = No es posible utilizar el m\u00E9todo marshal() con el par\u00E1metro de objeto. - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = Par\u00E1metro javax.xml.parser.transform.Result no soportado. - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = Codificaci\u00F3n no soportada: {0}. - -ILLEGAL_PARAMETER = Par\u00E1metro "{0}" no v\u00E1lido: {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = {0} no tiene un m\u00E9todo {1} {2}(); - -MISSING_ID = El objeto "{0}" se encuentra en una propiedad IDREF, pero este objeto no tiene un identificador. - -NOT_IMPLEMENTED_IN_2_0 = Esta funci\u00F3n no est\u00E1 disponible en la implantaci\u00F3n de referencia de JAXB 2.0. - -UNRECOGNIZED_ELEMENT_NAME = El nombre de la etiqueta "{0}" no es conocido en este contexto de JAXB. - -TYPE_MISMATCH = La propiedad "{1}" de un objeto "{0}" contiene un objeto del tipo "{2}", pero esto no est\u00E1 permitido. Consulte la documentaci\u00F3n javadoc de esta propiedad para saber qu\u00E9 permite. - -MISSING_OBJECT = falta un objeto en un campo necesario"{0}" - -NOT_IDENTIFIABLE = Se hace referencia a un objeto como IDREF, pero su campo de identificador es nulo - -DANGLING_IDREF = Un \u00E1rbol contiene una referencia al identificador "{0}", pero no forma parte del gr\u00E1fico del objeto - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = La resoluci\u00F3n de salida del esquema no debe ser nula. - -UNABLE_TO_MARSHAL_NON_ELEMENT = no se ha podido canalizar el tipo "{0}" como un elemento, porque le falta una anotaci\u00F3n @XmlRootElement - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = no se ha podido canalizar el tipo "{0}" como un elemento, porque no se conoce en este contexto. - -UNSUPPORTED_PROPERTY = "{0}" no es una propiedad soportada - -NULL_PROPERTY_NAME = el par\u00E1metro del nombre de propiedad no puede ser nulo - -MUST_BE_X = la propiedad "{0}" debe ser una instancia del tipo {1}, no {2} - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = La instancia de "{1}" sustituye a "{0}", pero "{2}" est\u00E1 enlazado a un tipo an\u00F3nimo. - -CYCLE_IN_MARSHALLER = Se ha detectado un ciclo en el gr\u00E1fico de objeto. Esto provocar\u00E1 un XML con profundidad infinita: {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = No se han podido mostrar los m\u00E9todos de "{0}". Si hay un elemento CallbackHandler de eventos en esta clase, se ignorar\u00E1. - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = Se ha encontrado un documento DOM "{0}", pero se necesita un elemento. Utilice Document.getDocumentElement() y defina ese objeto en su lugar. - -UNKNOWN_CLASS = {0} ni ninguna de sus superclases se conocen en este contexto. - -FAILED_TO_GENERATE_SCHEMA = Fallo al generar el esquema. - -ERROR_PROCESSING_SCHEMA = Error durante el procesamiento del esquema. - -ILLEGAL_CONTENT = Contenido XML no v\u00E1lido en <{0}>: "{1}". --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages_fr.properties 2018-01-30 20:33:21.000000000 -0500 +++ /dev/null 2018-01-30 20:33:21.000000000 -0500 @@ -1,83 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = Il n'est pas possible d'utiliser la m\u00E9thode marshal() avec le param\u00E8tre d'objet - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = param\u00E8tre javax.xml.parser.transform.Result non pris en charge - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = encodage non pris en charge : {0} - -ILLEGAL_PARAMETER = Param\u00E8tre "{0}" interdit : {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = {0} ne comporte aucune m\u00E9thode {1} {2}() ; - -MISSING_ID = L"objet "{0}" a \u00E9t\u00E9 d\u00E9tect\u00E9 dans une propri\u00E9t\u00E9 IDREF, mais cet objet ne comporte aucun ID. - -NOT_IMPLEMENTED_IN_2_0 = Cette fonctionnalit\u00E9 n'est pas disponible dans JAXB RI 2.0 - -UNRECOGNIZED_ELEMENT_NAME = Le nom de balise "{0}" est inconnu pour ce contexte JAXBContext. - -TYPE_MISMATCH = La propri\u00E9t\u00E9 "{1}" d''un objet "{0}" contient un objet de type "{2}" mais cela n''est pas autoris\u00E9. Pour savoir ce que cette propri\u00E9t\u00E9 peut accepter, consultez Javadoc. - -MISSING_OBJECT = un objet est manquant dans un champ obligatoire "{0}" - -NOT_IDENTIFIABLE = Un objet est r\u00E9f\u00E9renc\u00E9 en tant qu'IDREF mais son champ d'ID est NULL - -DANGLING_IDREF = Une arborescence contient une r\u00E9f\u00E9rence \u00E0 l''ID "{0}" mais elle ne fait pas partie du graphique d''objet - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = le r\u00E9solveur de sortie de sch\u00E9ma ne doit pas \u00EAtre NULL - -UNABLE_TO_MARSHAL_NON_ELEMENT = impossible de s\u00E9rialiser le type "{0}" en tant qu''\u00E9l\u00E9ment car il lui manque une annotation @XmlRootElement - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = impossible de s\u00E9rialiser le type "{0}" en tant qu''\u00E9l\u00E9ment car il est inconnu dans ce contexte. - -UNSUPPORTED_PROPERTY = "{0}" n''est pas une propri\u00E9t\u00E9 prise en charge - -NULL_PROPERTY_NAME = le param\u00E8tre de nom de propri\u00E9t\u00E9 ne peut pas \u00EAtre NULL - -MUST_BE_X = la propri\u00E9t\u00E9 "{0}" doit \u00EAtre une instance de type {1}, non pas {2} - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = L''instance de "{1}" remplace "{0}", mais "{2}" est li\u00E9 \u00E0 un type anonyme. - -CYCLE_IN_MARSHALLER = Un cycle est d\u00E9tect\u00E9 dans le graphique d''objet. Cela g\u00E9n\u00E9rera un fichier XML d''une profondeur infinie : {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = Impossible de lister les m\u00E9thodes de "{0}". S''il existe un gestionnaire de callback d''\u00E9v\u00E9nement sur cette classe, il ne sera pas pris en compte. - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = Un document DOM "{0}" a \u00E9t\u00E9 d\u00E9tect\u00E9 mais un \u00E9l\u00E9ment est n\u00E9cessaire. Utilisez Document.getDocumentElement() et d\u00E9finissez cet objet \u00E0 la place. - -UNKNOWN_CLASS = {0} ni aucune de ses superclasses n''est connue dans ce contexte. - -FAILED_TO_GENERATE_SCHEMA = Echec de la g\u00E9n\u00E9ration du sch\u00E9ma. - -ERROR_PROCESSING_SCHEMA = Erreur lors du traitement du sch\u00E9ma. - -ILLEGAL_CONTENT = Contenu XML interdit dans <{0}> : "{1}". --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages_it.properties 2018-01-30 20:33:22.000000000 -0500 +++ /dev/null 2018-01-30 20:33:22.000000000 -0500 @@ -1,83 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = impossibile eseguire il marshalling del parametro dell'oggetto di cui eseguire il marshalling () - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = parametro javax.xml.parser.transform.Result non supportato - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = codifica non supportata: {0} - -ILLEGAL_PARAMETER = Parametro "{0}" non valido: {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = {0} non ha un metodo {1} {2}(); - -MISSING_ID = Oggetto "{0}" trovato in una propriet\u00E0 IDREF ma questo oggetto non ha un ID. - -NOT_IMPLEMENTED_IN_2_0 = Questa funzione non \u00E8 disponibile in JAXB RI 2.0 - -UNRECOGNIZED_ELEMENT_NAME = Nome della tag "{0}" sconosciuto a questo JAXBContext. - -TYPE_MISMATCH = La propriet\u00E0 "{1}" di un oggetto "{0}" contiene un oggetto di tipo "{2}" non consentito. Vedere il javadoc di questa propriet\u00E0 per quello che pu\u00F2 essere accettato dalla propriet\u00E0. - -MISSING_OBJECT = oggetto mancante in un campo obbligatorio ''{0}'' - -NOT_IDENTIFIABLE = Viene fatto riferimento a un oggetto come IDREF ma il relativo campo ID \u00E8 nullo - -DANGLING_IDREF = Una struttura contiene un riferimento all''ID "{0}" ma non fa parte del grafico dell''oggetto - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = il resolver di output dello schema non deve essere nullo - -UNABLE_TO_MARSHAL_NON_ELEMENT = impossibile eseguire il marshalling del tipo "{0}" come elemento poich\u00E9 manca un''annotazione @XmlRootElement - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = impossibile eseguire il marshalling del tipo "{0}" come elemento poich\u00E9 \u00E8 sconosciuto a questo contesto. - -UNSUPPORTED_PROPERTY = "{0}" non \u00E8 una propriet\u00E0 supportata - -NULL_PROPERTY_NAME = il parametro del nome della propriet\u00E0 non pu\u00F2 essere nullo - -MUST_BE_X = la propriet\u00E0 "{0}" deve essere un''istanza di tipo {1}, non {2} - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = L''istanza di "{1}" sta sostituendo "{0}" ma "{2}" \u00E8 associato a un tipo anonimo. - -CYCLE_IN_MARSHALLER = \u00C8 stato rilevato un ciclo nel grafico dell''oggetto. Questo provocher\u00E0 un XML con profondit\u00E0 infinita: {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = Impossibile elencare i metodi di "{0}". Gli handler di callback degli eventi presenti su questa classe verranno ignorati. - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = \u00C8 stato trovato un documento DOM "{0}" ma \u00E8 richiesto un elemento. Usare Document.getDocumentElement() e impostare invece tale oggetto. - -UNKNOWN_CLASS = {0} e le relative classi superiori sono sconosciute a questo contesto. - -FAILED_TO_GENERATE_SCHEMA = Generazione dello schema non riuscita. - -ERROR_PROCESSING_SCHEMA = Errore durante l'elaborazione dello schema. - -ILLEGAL_CONTENT = Contenuto XML non valido in <{0}>: "{1}". --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages_ja.properties 2018-01-30 20:33:22.000000000 -0500 +++ /dev/null 2018-01-30 20:33:22.000000000 -0500 @@ -1,83 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = marshal()\u306Eobject\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u30DE\u30FC\u30B7\u30E3\u30EA\u30F3\u30B0\u53EF\u80FD\u3067\u306F\u3042\u308A\u307E\u305B\u3093 - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = \u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044javax.xml.parser.transform.Result\u30D1\u30E9\u30E1\u30FC\u30BF\u3067\u3059 - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = \u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u306A\u3044\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0: {0} - -ILLEGAL_PARAMETER = "{0}"\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u4E0D\u6B63\u3067\u3059: {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = {0}\u306B\u30E1\u30BD\u30C3\u30C9{1} {2}()\u304C\u3042\u308A\u307E\u305B\u3093; - -MISSING_ID = \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8"{0}"\u304CIDREF\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u304C\u3001\u3053\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u306FID\u304C\u3042\u308A\u307E\u305B\u3093\u3002 - -NOT_IMPLEMENTED_IN_2_0 = \u3053\u306E\u6A5F\u80FD\u306FJAXB RI 2.0\u3067\u306F\u4F7F\u7528\u4E0D\u53EF\u3067\u3059 - -UNRECOGNIZED_ELEMENT_NAME = \u30BF\u30B0\u540D"{0}"\u306F\u3053\u306EJAXBContext\u3067\u306F\u8A8D\u8B58\u3055\u308C\u307E\u305B\u3093\u3002 - -TYPE_MISMATCH = "{0}"\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E"{1}"\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u306F"{2}"\u30BF\u30A4\u30D7\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u3053\u308C\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002\u3053\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u304C\u53D7\u5165\u53EF\u80FD\u306A\u30BF\u30A4\u30D7\u306B\u3064\u3044\u3066\u306F\u3001\u3053\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u306Ejavadoc\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002 - -MISSING_OBJECT = \u5FC5\u9808\u30D5\u30A3\u30FC\u30EB\u30C9"{0}"\u306B\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u3042\u308A\u307E\u305B\u3093 - -NOT_IDENTIFIABLE = \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306FIDREF\u3068\u3057\u3066\u53C2\u7167\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001ID\u30D5\u30A3\u30FC\u30EB\u30C9\u304Cnull\u3067\u3059 - -DANGLING_IDREF = \u30C4\u30EA\u30FC\u306BID "{0}"\u3078\u306E\u53C2\u7167\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30FB\u30B0\u30E9\u30D5\u306E\u4E00\u90E8\u3067\u306F\u3042\u308A\u307E\u305B\u3093 - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = \u30B9\u30AD\u30FC\u30DE\u51FA\u529B\u30EA\u30BE\u30EB\u30D0\u306Fnull\u306B\u3067\u304D\u307E\u305B\u3093 - -UNABLE_TO_MARSHAL_NON_ELEMENT = @XmlRootElement\u6CE8\u91C8\u304C\u306A\u3044\u305F\u3081\u3001\u30BF\u30A4\u30D7"{0}"\u3092\u8981\u7D20\u3068\u3057\u3066\u30DE\u30FC\u30B7\u30E3\u30EA\u30F3\u30B0\u3067\u304D\u307E\u305B\u3093 - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = \u3053\u306E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u8A8D\u8B58\u3055\u308C\u306A\u3044\u305F\u3081\u3001\u30BF\u30A4\u30D7"{0}"\u3092\u8981\u7D20\u3068\u3057\u3066\u30DE\u30FC\u30B7\u30E3\u30EA\u30F3\u30B0\u3067\u304D\u307E\u305B\u3093\u3002 - -UNSUPPORTED_PROPERTY = "{0}"\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u308B\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u306F\u3042\u308A\u307E\u305B\u3093 - -NULL_PROPERTY_NAME = \u30D7\u30ED\u30D1\u30C6\u30A3\u306Ename\u30D1\u30E9\u30E1\u30FC\u30BF\u306Fnull\u306B\u3067\u304D\u307E\u305B\u3093 - -MUST_BE_X = \u30D7\u30ED\u30D1\u30C6\u30A3"{0}"\u306F\u3001{2}\u3067\u306F\u306A\u304F\u30BF\u30A4\u30D7{1}\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059 - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = "{1}"\u306E\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306F"{0}"\u3092\u4EE3\u7528\u3057\u3066\u3044\u307E\u3059\u304C\u3001"{2}"\u306F\u533F\u540D\u30BF\u30A4\u30D7\u306B\u30D0\u30A4\u30F3\u30C9\u3055\u308C\u3066\u3044\u307E\u3059\u3002 - -CYCLE_IN_MARSHALLER = \u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u30FB\u30B0\u30E9\u30D5\u3067\u5FAA\u74B0\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\u3053\u308C\u306B\u3088\u308AXML\u304C\u7121\u9650\u306B\u6DF1\u304F\u306A\u308A\u307E\u3059: {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = "{0}"\u306E\u30E1\u30BD\u30C3\u30C9\u3092\u30EA\u30B9\u30C8\u3067\u304D\u307E\u305B\u3093\u3002\u3053\u306E\u30AF\u30E9\u30B9\u306B\u30A4\u30D9\u30F3\u30C8\u30FB\u30B3\u30FC\u30EB\u30D0\u30C3\u30AF\u30FB\u30CF\u30F3\u30C9\u30E9\u304C\u3042\u308B\u5834\u5408\u306F\u7121\u8996\u3055\u308C\u307E\u3059\u3002 - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = DOM\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8"{0}"\u304C\u898B\u3064\u304B\u308A\u307E\u3057\u305F\u304C\u3001\u8981\u7D20\u304C\u5FC5\u8981\u3067\u3059\u3002Document.getDocumentElement()\u3092\u4F7F\u7528\u3057\u3066\u3001\u304B\u308F\u308A\u306B\u305D\u306E\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002 - -UNKNOWN_CLASS = {0}\u304A\u3088\u3073\u305D\u306E\u30B9\u30FC\u30D1\u30FC\u30FB\u30AF\u30E9\u30B9\u306F\u3053\u306E\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u3067\u306F\u8A8D\u8B58\u3055\u308C\u307E\u305B\u3093\u3002 - -FAILED_TO_GENERATE_SCHEMA = \u30B9\u30AD\u30FC\u30DE\u306E\u751F\u6210\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002 - -ERROR_PROCESSING_SCHEMA = \u30B9\u30AD\u30FC\u30DE\u306E\u51E6\u7406\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u3002 - -ILLEGAL_CONTENT = <{0}>\u306EXML\u30B3\u30F3\u30C6\u30F3\u30C4\u304C\u4E0D\u6B63\u3067\u3059: "{1}"\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages_ko.properties 2018-01-30 20:33:23.000000000 -0500 +++ /dev/null 2018-01-30 20:33:23.000000000 -0500 @@ -1,83 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = \uAC1D\uCCB4 \uB9E4\uAC1C\uBCC0\uC218\uC5D0 \uB300\uD574\uC11C\uB294 marshal() \uBA54\uC18C\uB4DC\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uB294 javax.xml.parser.transform.Result \uB9E4\uAC1C\uBCC0\uC218 - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = \uC9C0\uC6D0\uB418\uC9C0 \uC54A\uB294 \uC778\uCF54\uB529: {0} - -ILLEGAL_PARAMETER = \uC798\uBABB\uB41C "{0}" \uB9E4\uAC1C\uBCC0\uC218: {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = {0}\uC5D0 {1} {2}(); \uBA54\uC18C\uB4DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. - -MISSING_ID = "{0}" \uAC1D\uCCB4\uAC00 IDREF \uC18D\uC131\uC5D0\uC11C \uBC1C\uACAC\uB418\uC5C8\uC9C0\uB9CC \uC774 \uAC1D\uCCB4\uC5D0 ID\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. - -NOT_IMPLEMENTED_IN_2_0 = \uC774 \uAE30\uB2A5\uC740 JAXB RI 2.0\uC5D0\uC11C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -UNRECOGNIZED_ELEMENT_NAME = \uC774 JAXBContext\uC5D0\uC11C \uD0DC\uADF8 \uC774\uB984 "{0}"\uC744(\uB97C) \uC778\uC2DD\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -TYPE_MISMATCH = "{0}" \uAC1D\uCCB4\uC758 "{1}" \uC18D\uC131\uC5D0 "{2}" \uC720\uD615\uC758 \uAC1D\uCCB4\uAC00 \uD3EC\uD568\uB418\uC5B4 \uC788\uC9C0\uB9CC \uC774 \uC720\uD615\uC740 \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uC774 \uC18D\uC131\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC788\uB294 \uC720\uD615\uC740 \uC774 \uC18D\uC131\uC758 javadoc\uB97C \uCC38\uC870\uD558\uC2ED\uC2DC\uC624. - -MISSING_OBJECT = \uD544\uC218 \uD544\uB4DC "{0}"\uC5D0 \uAC1D\uCCB4\uAC00 \uB204\uB77D\uB418\uC5C8\uC2B5\uB2C8\uB2E4. - -NOT_IDENTIFIABLE = \uAC1D\uCCB4\uAC00 IDREF\uB85C \uCC38\uC870\uB418\uC5C8\uC9C0\uB9CC \uD574\uB2F9 ID \uD544\uB4DC\uAC00 \uB110\uC785\uB2C8\uB2E4. - -DANGLING_IDREF = \uD2B8\uB9AC\uAC00 ID "{0}"\uC5D0 \uB300\uD55C \uCC38\uC870\uB97C \uD3EC\uD568\uD558\uACE0 \uC788\uC9C0\uB9CC \uAC1D\uCCB4 \uADF8\uB798\uD504\uC5D0 \uC18D\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = \uC2A4\uD0A4\uB9C8 \uCD9C\uB825 \uBD84\uC11D\uAE30\uB294 \uB110\uC774 \uC544\uB2C8\uC5B4\uC57C \uD569\uB2C8\uB2E4. - -UNABLE_TO_MARSHAL_NON_ELEMENT = @XmlRootElement \uC8FC\uC11D\uC774 \uB204\uB77D\uB418\uC5B4 "{0}" \uC720\uD615\uC744 \uC694\uC18C\uB85C \uB9C8\uC15C\uB9C1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = "{0}" \uC720\uD615\uC740 \uC774 \uCEE8\uD14D\uC2A4\uD2B8\uC5D0\uC11C \uC778\uC2DD\uD560 \uC218 \uC5C6\uC73C\uBBC0\uB85C \uC694\uC18C\uB85C \uB9C8\uC15C\uB9C1\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -UNSUPPORTED_PROPERTY = "{0}"\uC740(\uB294) \uC9C0\uC6D0\uB418\uB294 \uC18D\uC131\uC774 \uC544\uB2D9\uB2C8\uB2E4. - -NULL_PROPERTY_NAME = \uC18D\uC131 \uC774\uB984 \uB9E4\uAC1C\uBCC0\uC218\uB294 \uB110\uC77C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -MUST_BE_X = "{0}" \uC18D\uC131\uC740 {2}\uC774(\uAC00) \uC544\uB2CC {1} \uC720\uD615\uC758 \uC778\uC2A4\uD134\uC2A4\uC5EC\uC57C \uD569\uB2C8\uB2E4. - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = "{1}"\uC758 \uC778\uC2A4\uD134\uC2A4\uAC00 "{0}"\uC744(\uB97C) \uB300\uCCB4\uD558\uACE0 \uC788\uC9C0\uB9CC "{2}"\uC774(\uAC00) \uC775\uBA85 \uC720\uD615\uC5D0 \uBC14\uC778\uB4DC\uB418\uC5B4 \uC788\uC2B5\uB2C8\uB2E4. - -CYCLE_IN_MARSHALLER = \uAC1D\uCCB4 \uADF8\uB798\uD504\uC5D0\uC11C \uC21C\uD658\uC774 \uAC10\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC774\uB85C \uC778\uD574 XML\uC774 \uBB34\uD55C\uB300\uB85C \uAE4A\uC5B4\uC9D0: {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = "{0}"\uC758 \uBA54\uC18C\uB4DC\uB97C \uB098\uC5F4\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC774 \uD074\uB798\uC2A4\uC5D0 \uC774\uBCA4\uD2B8 \uCF5C\uBC31 \uCC98\uB9AC\uAE30\uAC00 \uC788\uC744 \uACBD\uC6B0 \uBB34\uC2DC\uB429\uB2C8\uB2E4. - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = DOM \uBB38\uC11C "{0}"\uC774(\uAC00) \uBC1C\uACAC\uB418\uC5C8\uC9C0\uB9CC \uC694\uC18C\uAC00 \uD544\uC694\uD569\uB2C8\uB2E4. Document.getDocumentElement()\uB97C \uC0AC\uC6A9\uD558\uACE0 \uD574\uB2F9 \uAC1D\uCCB4\uB97C \uC124\uC815\uD558\uC2ED\uC2DC\uC624. - -UNKNOWN_CLASS = \uC774 \uCEE8\uD14D\uC2A4\uD2B8\uC5D0\uC11C {0}\uACFC(\uC640) \uD574\uB2F9 \uC218\uD37C \uD074\uB798\uC2A4\uB97C \uC778\uC2DD\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -FAILED_TO_GENERATE_SCHEMA = \uC2A4\uD0A4\uB9C8 \uC0DD\uC131\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. - -ERROR_PROCESSING_SCHEMA = \uC2A4\uD0A4\uB9C8 \uCC98\uB9AC \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4. - -ILLEGAL_CONTENT = <{0}>\uC5D0 \uC798\uBABB\uB41C XML \uCF58\uD150\uCE20\uAC00 \uC788\uC74C: "{1}". --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages_pt_BR.properties 2018-01-30 20:33:24.000000000 -0500 +++ /dev/null 2018-01-30 20:33:24.000000000 -0500 @@ -1,83 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = o par\u00E2metro do objeto para fazer marshal() n\u00E3o pode ser submetido a marshal - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = par\u00E2metro javax.xml.parser.transform.Result n\u00E3o suportado - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = codifica\u00E7\u00E3o n\u00E3o suportada: {0} - -ILLEGAL_PARAMETER = par\u00E2metro "{0}" inv\u00E1lido: {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = {0} n\u00E3o tem um m\u00E9todo {1} {2}(); - -MISSING_ID = O objeto "{0}" foi encontrado em uma propriedade IDREF, mas este objeto n\u00E3o tem um ID. - -NOT_IMPLEMENTED_IN_2_0 = Este recurso n\u00E3o est\u00E1 dispon\u00EDvel no JAXB RI 2.0 - -UNRECOGNIZED_ELEMENT_NAME = O nome da tag "{0}" n\u00E3o \u00E9 conhecido para este JAXBContext. - -TYPE_MISMATCH = a propriedade "{1}" de um objeto "{0}" cont\u00E9m um objeto do tipo "{2}", mas esse tipo n\u00E3o \u00E9 permitido. Consulte javadoc desta propriedade para saber o que essa propriedade pode aceitar. - -MISSING_OBJECT = n\u00E3o foi encontrado um campo "{0}" obrigat\u00F3rio em um objeto - -NOT_IDENTIFIABLE = Um objeto \u00E9 mencionado como IDREF, mas seu campo ID \u00E9 nulo - -DANGLING_IDREF = Uma \u00E1rvore cont\u00E9m uma refer\u00EAncia ao ID "{0}", mas n\u00E3o faz parte do gr\u00E1fico do objeto - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = o resolvedor de sa\u00EDda do esquema n\u00E3o deve ser nulo - -UNABLE_TO_MARSHAL_NON_ELEMENT = n\u00E3o \u00E9 poss\u00EDvel fazer marshalling do tipo "{0}" como um elemento porque ele n\u00E3o foi encontrado em uma anota\u00E7\u00E3o @XmlRootElement - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = n\u00E3o \u00E9 poss\u00EDvel fazer marshalling do tipo "{0}" como um elemento porque ele n\u00E3o foi encontrado para este contexto. - -UNSUPPORTED_PROPERTY = "{0}" n\u00E3o \u00E9 uma propriedade suportada - -NULL_PROPERTY_NAME = o par\u00E2metro de nome da propriedade n\u00E3o pode ser nulo - -MUST_BE_X = a propriedade "{0}" deve ser uma inst\u00E2ncia do tipo {1}, n\u00E3o {2} - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = A inst\u00E2ncia de "{1}" est\u00E1 substituindo "{0}", mas "{2}" est\u00E1 vinculado a um tipo an\u00F4nimo. - -CYCLE_IN_MARSHALLER = Foi detectado um ciclo no gr\u00E1fico do objeto. Isso causar\u00E1 XML profundo infinitamente: {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = N\u00E3o \u00E9 poss\u00EDvel listar os m\u00E9todos de "{0}". Se houver qualquer handler de callback do evento nesta classe, ele ser\u00E1 ignorado. - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = Um documento DOM "{0}" foi encontrado, mas \u00E9 necess\u00E1rio um elemento. Use Document.getDocumentElement() e defina esse objeto. - -UNKNOWN_CLASS = {0} e nenhuma de sua superclasse \u00E9 conhecida para este contexto. - -FAILED_TO_GENERATE_SCHEMA = Falha ao gerar o esquema. - -ERROR_PROCESSING_SCHEMA = Erro durante o processamento do esquema. - -ILLEGAL_CONTENT = Conte\u00FAdo XML inv\u00E1lido em <{0}>: "{1}". --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages_zh_CN.properties 2018-01-30 20:33:24.000000000 -0500 +++ /dev/null 2018-01-30 20:33:24.000000000 -0500 @@ -1,83 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = \u65E0\u6CD5\u4F7F\u7528\u5E26\u6709\u5BF9\u8C61\u53C2\u6570\u7684 marshal() - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = \u4E0D\u652F\u6301 javax.xml.parser.transform.Result \u53C2\u6570 - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = \u4E0D\u652F\u6301\u7684\u7F16\u7801: {0} - -ILLEGAL_PARAMETER = \u975E\u6CD5 "{0}" \u53C2\u6570: {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = {0}\u6CA1\u6709\u65B9\u6CD5{1} {2}(); - -MISSING_ID = \u53D1\u73B0\u5BF9\u8C61 "{0}" \u4F4D\u4E8E IDREF \u5C5E\u6027\u4E2D, \u4F46\u6B64\u5BF9\u8C61\u6CA1\u6709 ID\u3002 - -NOT_IMPLEMENTED_IN_2_0 = \u6B64\u529F\u80FD\u5728 JAXB RI 2.0 \u4E2D\u4E0D\u53EF\u7528 - -UNRECOGNIZED_ELEMENT_NAME = \u6807\u8BB0\u540D\u79F0 "{0}" \u5BF9\u6B64 JAXBContext \u662F\u672A\u77E5\u7684\u3002 - -TYPE_MISMATCH = "{0}" \u5BF9\u8C61\u7684 "{1}" \u5C5E\u6027\u5305\u542B "{2}" \u7C7B\u578B\u7684\u5BF9\u8C61, \u4F46\u8FD9\u662F\u4E0D\u5141\u8BB8\u7684\u3002\u6709\u5173\u6B64\u5C5E\u6027\u53EF\u63A5\u53D7\u7684\u7C7B\u578B, \u8BF7\u53C2\u9605\u6B64\u5C5E\u6027\u7684 javadoc\u3002 - -MISSING_OBJECT = \u5FC5\u586B\u5B57\u6BB5 "{0}" \u7F3A\u5C11\u5BF9\u8C61 - -NOT_IDENTIFIABLE = \u5BF9\u8C61\u5C06\u4F5C\u4E3A IDREF \u5F15\u7528, \u4F46\u5176 ID \u5B57\u6BB5\u4E3A\u7A7A\u503C - -DANGLING_IDREF = \u6811\u5305\u542B\u5BF9 ID "{0}" \u7684\u5F15\u7528, \u4F46\u4E0D\u662F\u5BF9\u8C61\u56FE\u7684\u4E00\u90E8\u5206 - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = \u6A21\u5F0F\u8F93\u51FA\u89E3\u6790\u5668\u4E0D\u80FD\u4E3A\u7A7A\u503C - -UNABLE_TO_MARSHAL_NON_ELEMENT = \u7531\u4E8E\u7C7B\u578B "{0}" \u7F3A\u5C11 @XmlRootElement \u6CE8\u91CA, \u65E0\u6CD5\u5C06\u8BE5\u7C7B\u578B\u7F16\u96C6\u4E3A\u5143\u7D20 - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = \u7531\u4E8E\u7C7B\u578B "{0}" \u5BF9\u6B64\u4E0A\u4E0B\u6587\u662F\u672A\u77E5\u7684, \u65E0\u6CD5\u5C06\u8BE5\u7C7B\u578B\u7F16\u96C6\u4E3A\u5143\u7D20\u3002 - -UNSUPPORTED_PROPERTY = "{0}" \u4E0D\u662F\u652F\u6301\u7684\u5C5E\u6027 - -NULL_PROPERTY_NAME = \u5C5E\u6027\u540D\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A\u503C - -MUST_BE_X = \u5C5E\u6027 "{0}" \u5FC5\u987B\u4E3A{1}\u7C7B\u578B\u7684\u5B9E\u4F8B, \u800C\u4E0D\u662F{2}\u7C7B\u578B\u7684\u5B9E\u4F8B - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = "{1}" \u7684\u5B9E\u4F8B\u66FF\u4EE3\u4E86 "{0}", \u4F46 "{2}" \u7ED1\u5B9A\u5230\u533F\u540D\u7C7B\u578B\u3002 - -CYCLE_IN_MARSHALLER = \u5728\u5BF9\u8C61\u56FE\u4E2D\u68C0\u6D4B\u5230\u5FAA\u73AF\u3002\u8FD9\u5C06\u4EA7\u751F\u65E0\u9650\u6DF1\u7684 XML: {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = \u65E0\u6CD5\u5217\u51FA "{0}" \u7684\u65B9\u6CD5\u3002\u5982\u679C\u6B64\u7C7B\u4E0A\u5B58\u5728\u4EFB\u610F\u4E8B\u4EF6\u56DE\u8C03\u5904\u7406\u7A0B\u5E8F, \u5219\u5C06\u5FFD\u7565\u8BE5\u5904\u7406\u7A0B\u5E8F\u3002 - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = \u627E\u5230 DOM \u6587\u6863 "{0}", \u4F46\u9700\u8981\u4E00\u4E2A\u5143\u7D20\u3002\u8BF7\u6539\u7528 Document.getDocumentElement() \u5E76\u8BBE\u7F6E\u8BE5\u5BF9\u8C61\u3002 - -UNKNOWN_CLASS = {0}\u4EE5\u53CA\u5176\u4EFB\u4F55\u8D85\u7C7B\u5BF9\u6B64\u4E0A\u4E0B\u6587\u90FD\u662F\u672A\u77E5\u7684\u3002 - -FAILED_TO_GENERATE_SCHEMA = \u65E0\u6CD5\u751F\u6210\u6A21\u5F0F\u3002 - -ERROR_PROCESSING_SCHEMA = \u6A21\u5F0F\u5904\u7406\u671F\u95F4\u51FA\u9519\u3002 - -ILLEGAL_CONTENT = <{0}> \u4E2D\u7684\u975E\u6CD5 XML \u5185\u5BB9: "{1}"\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Messages_zh_TW.properties 2018-01-30 20:33:25.000000000 -0500 +++ /dev/null 2018-01-30 20:33:25.000000000 -0500 @@ -1,83 +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. -# - -# Wrapped into an Exception. Not concatenated with any other string. -NOT_MARSHALLABLE = marshal() \u7684\u7269\u4EF6\u53C3\u6578\u7121\u6CD5\u5C01\u9001\u8655\u7406 - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_RESULT = \u4E0D\u652F\u63F4\u7684 javax.xml.parser.transform.Result \u53C3\u6578 - -# Not concatenated with any other string (written on a separate line). -UNSUPPORTED_ENCODING = \u4E0D\u652F\u63F4\u7684\u7DE8\u78BC: {0} - -ILLEGAL_PARAMETER = \u7121\u6548\u7684 "{0}" \u53C3\u6578: {1} - -# {0} - class name, {2} - method name -UNABLE_TO_FIND_CONVERSION_METHOD = {0} \u672A\u5305\u542B\u65B9\u6CD5 {1} {2}(); - -MISSING_ID = \u5728 IDREF \u7279\u6027\u4E2D\u627E\u5230\u7269\u4EF6 "{0}", \u4F46\u6B64\u7269\u4EF6\u6C92\u6709 ID. - -NOT_IMPLEMENTED_IN_2_0 = JAXB RI 2.0 \u4E2D\u672A\u63D0\u4F9B\u6B64\u529F\u80FD - -UNRECOGNIZED_ELEMENT_NAME = JAXBContext \u4E0D\u8A8D\u5F97\u6A19\u8A18\u540D\u7A31 "{0}". - -TYPE_MISMATCH = \u7269\u4EF6 "{0}" \u7684\u7279\u6027 "{1}" \u5305\u542B\u985E\u578B "{2}" \u7684\u7269\u4EF6, \u4F46\u9019\u662F\u4E0D\u5141\u8A31\u7684. \u8ACB\u53C3\u95B1\u6B64\u7279\u6027\u7684 javadoc, \u77AD\u89E3\u6B64\u7279\u6027\u53EF\u63A5\u53D7\u7684\u7269\u4EF6\u985E\u578B. - -MISSING_OBJECT = \u5FC5\u8981\u7684\u6B04\u4F4D "{0}" \u7F3A\u5C11\u7269\u4EF6 - -NOT_IDENTIFIABLE = \u7269\u4EF6\u88AB\u53C3\u7167\u70BA IDREF, \u4F46\u5176 ID \u6B04\u4F4D\u70BA\u7A7A\u503C - -DANGLING_IDREF = \u6A39\u72C0\u7D50\u69CB\u5305\u542B ID "{0}" \u7684\u53C3\u7167, \u4F46\u5B83\u4E0D\u662F\u7269\u4EF6\u5716\u8868\u7684\u4E00\u90E8\u5206 - -# Wrapped into a IOException. Not concatenated with any other string. -NULL_OUTPUT_RESOLVER = \u7DB1\u8981\u8F38\u51FA\u89E3\u6790\u5668\u4E0D\u5F97\u70BA\u7A7A\u503C - -UNABLE_TO_MARSHAL_NON_ELEMENT = \u7121\u6CD5\u5C07\u985E\u578B "{0}" \u5C01\u9001\u8655\u7406\u70BA\u5143\u7D20, \u56E0\u5176\u907A\u6F0F @XmlRootElement \u8A3B\u89E3 - -UNABLE_TO_MARSHAL_UNBOUND_CLASS = \u7121\u6CD5\u5C07\u985E\u578B "{0}" \u5C01\u9001\u8655\u7406\u70BA\u5143\u7D20, \u6B64\u76F8\u95DC\u8CC7\u8A0A\u74B0\u5883\u4E0D\u8A8D\u5F97\u5B83. - -UNSUPPORTED_PROPERTY = "{0}" \u4E0D\u662F\u652F\u63F4\u7684\u7279\u6027 - -NULL_PROPERTY_NAME = \u7279\u6027\u540D\u7A31\u53C3\u6578\u4E0D\u53EF\u70BA\u7A7A\u503C - -MUST_BE_X = \u7279\u6027 "{0}" \u5FC5\u9808\u662F\u985E\u578B {1} (\u800C\u975E {2}) \u7684\u57F7\u884C\u8655\u7406 - -# {0}, {1}, {2} - class name. e.g.: Instance of "com.test.implementation.Implementation" is substituting "com.test.abstractbase.AbstractType", but "com.test.implementation.Implementation" is bound to an anonymous type. -SUBSTITUTED_BY_ANONYMOUS_TYPE = "{1}" \u7684\u57F7\u884C\u8655\u7406\u5C07\u66FF\u4EE3 "{0}", \u4F46 "{2}" \u5DF2\u9023\u7D50\u81F3\u533F\u540D\u985E\u578B. - -CYCLE_IN_MARSHALLER = \u5728\u7269\u4EF6\u5716\u8868\u4E2D\u5075\u6E2C\u5230\u5FAA\u74B0. \u9019\u5C07\u5C0E\u81F4\u7121\u9650\u6DF1\u7684 XML: {0} - -# {0} - class name -UNABLE_TO_DISCOVER_EVENTHANDLER = \u7121\u6CD5\u5217\u793A "{0}" \u7684\u65B9\u6CD5. \u82E5\u6B64\u985E\u5225\u4E2D\u6709\u4EFB\u4F55\u4E8B\u4EF6\u56DE\u547C\u8655\u7406\u7A0B\u5F0F, \u5C07\u6703\u88AB\u5FFD\u7565. - -ELEMENT_NEEDED_BUT_FOUND_DOCUMENT = \u767C\u73FE DOM \u6587\u4EF6 "{0}", \u4F46\u9700\u8981\u7684\u662F\u5143\u7D20. \u8ACB\u6539\u7528 Document.getDocumentElement() \u4E26\u8A2D\u5B9A\u8A72\u7269\u4EF6. - -UNKNOWN_CLASS = {0} \u6216\u5176\u4EFB\u4F55\u8D85\u7D1A\u985E\u5225\u90FD\u77E5\u9053\u6B64\u76F8\u95DC\u8CC7\u8A0A\u74B0\u5883. - -FAILED_TO_GENERATE_SCHEMA = \u7121\u6CD5\u7522\u751F\u7DB1\u8981. - -ERROR_PROCESSING_SCHEMA = \u8655\u7406\u7DB1\u8981\u6642\u767C\u751F\u932F\u8AA4. - -ILLEGAL_CONTENT = <{0}> \u4E2D\u6709\u7121\u6548\u7684 XML \u5167\u5BB9: "{1}". --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/MimeTypedTransducer.java 2018-01-30 20:33:26.000000000 -0500 +++ /dev/null 2018-01-30 20:33:26.000000000 -0500 @@ -1,86 +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.xml.internal.bind.v2.runtime; - -import java.awt.*; -import java.io.IOException; - -import javax.activation.MimeType; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; - -import org.xml.sax.SAXException; - -/** - * {@link Transducer} decorator that wraps another {@link Transducer} - * and sets the expected MIME type to the context. - * - *

- * Combined with {@link Transducer} implementations (such as one for {@link Image}), - * this is used to control the marshalling of the BLOB types. - * - * @author Kohsuke Kawaguchi - */ -public final class MimeTypedTransducer extends FilterTransducer { - private final MimeType expectedMimeType; - - public MimeTypedTransducer(Transducer core,MimeType expectedMimeType) { - super(core); - this.expectedMimeType = expectedMimeType; - } - - @Override - public CharSequence print(V o) throws AccessorException { - XMLSerializer w = XMLSerializer.getInstance(); - MimeType old = w.setExpectedMimeType(expectedMimeType); - try { - return core.print(o); - } finally { - w.setExpectedMimeType(old); - } - } - - @Override - public void writeText(XMLSerializer w, V o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - MimeType old = w.setExpectedMimeType(expectedMimeType); - try { - core.writeText(w, o, fieldName); - } finally { - w.setExpectedMimeType(old); - } - } - - @Override - public void writeLeafElement(XMLSerializer w, Name tagName, V o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - MimeType old = w.setExpectedMimeType(expectedMimeType); - try { - core.writeLeafElement(w, tagName, o, fieldName); - } finally { - w.setExpectedMimeType(old); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Name.java 2018-01-30 20:33:26.000000000 -0500 +++ /dev/null 2018-01-30 20:33:26.000000000 -0500 @@ -1,98 +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.xml.internal.bind.v2.runtime; - -import javax.xml.namespace.QName; - -/** - * The internal representation of an XML name. - * - *

- * This class keeps indicies for URI and local name for enabling faster processing. - * - *

- * {@link Name}s are ordered lexicographically (nsUri first, local name next.) - * This is the same order required by canonical XML. - * - * @author Kohsuke Kawaguchi - */ -public final class Name implements Comparable { - /** - * Namespace URI. interned. - */ - public final String nsUri; - - /** - * Local name. interned. - */ - public final String localName; - - /** - * Index -1 is reserved for representing the empty namespace URI of attributes. - */ - public final short nsUriIndex; - public final short localNameIndex; - - /** - * Index of the Name for an EII or AII - */ - public final short qNameIndex; - - /** - * Specifies if the Name is associated with an EII or AII - */ - public final boolean isAttribute; - - Name(int qNameIndex, int nsUriIndex, String nsUri, int localIndex, String localName, boolean isAttribute) { - this.qNameIndex = (short)qNameIndex; - this.nsUri = nsUri; - this.localName = localName; - this.nsUriIndex = (short)nsUriIndex; - this.localNameIndex = (short)localIndex; - this.isAttribute = isAttribute; - } - - public String toString() { - return '{'+nsUri+'}'+localName; - } - - /** - * Creates a {@link QName} from this. - */ - public QName toQName() { - return new QName(nsUri,localName); - } - - public boolean equals( String nsUri, String localName ) { - return localName.equals(this.localName) && nsUri.equals(this.nsUri); - } - - public int compareTo(Name that) { - int r = this.nsUri.compareTo(that.nsUri); - if(r!=0) return r; - return this.localName.compareTo(that.localName); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/NameBuilder.java 2018-01-30 20:33:27.000000000 -0500 +++ /dev/null 2018-01-30 20:33:27.000000000 -0500 @@ -1,143 +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.xml.internal.bind.v2.runtime; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.util.QNameMap; - -/** - * Creates {@link Name}s and assign index numbers to them. - * - *

- * During this process, this class also finds out which namespace URIs - * are statically known to be un-bindable as the default namespace. - * Those are the namespace URIs that are used by attribute names. - * - * @author Kohsuke Kawaguchi - */ -@SuppressWarnings({"StringEquality"}) -public final class NameBuilder { - private Map uriIndexMap = new HashMap(); - private Set nonDefaultableNsUris = new HashSet(); - private Map localNameIndexMap = new HashMap(); - private QNameMap elementQNameIndexMap = new QNameMap(); - private QNameMap attributeQNameIndexMap = new QNameMap(); - - public Name createElementName(QName name) { - return createElementName(name.getNamespaceURI(),name.getLocalPart()); - } - - public Name createElementName(String nsUri, String localName) { - return createName(nsUri, localName, false, elementQNameIndexMap); - } - - public Name createAttributeName(QName name) { - return createAttributeName(name.getNamespaceURI(),name.getLocalPart()); - } - - public Name createAttributeName(String nsUri, String localName) { - assert nsUri.intern()==nsUri; - assert localName.intern()==localName; - - if(nsUri.length()==0) - return new Name( - allocIndex(attributeQNameIndexMap,"",localName), - -1, - nsUri, - allocIndex(localNameIndexMap,localName), - localName, - true); - else { - nonDefaultableNsUris.add(nsUri); - return createName(nsUri,localName, true, attributeQNameIndexMap); - } - } - - private Name createName(String nsUri, String localName, boolean isAttribute, QNameMap map) { - assert nsUri.intern()==nsUri; - assert localName.intern()==localName; - - return new Name( - allocIndex(map,nsUri,localName), - allocIndex(uriIndexMap,nsUri), - nsUri, - allocIndex(localNameIndexMap,localName), - localName, - isAttribute ); - } - - private int allocIndex(Map map, String str) { - Integer i = map.get(str); - if(i==null) { - i = map.size(); - map.put(str,i); - } - return i; - } - - private int allocIndex(QNameMap map, String nsUri, String localName) { - Integer i = map.get(nsUri,localName); - if(i==null) { - i = map.size(); - map.put(nsUri,localName,i); - } - return i; - } - - /** - * Wraps up everything and creates {@link NameList}. - */ - public NameList conclude() { - boolean[] nsUriCannotBeDefaulted = new boolean[uriIndexMap.size()]; - for (Map.Entry e : uriIndexMap.entrySet()) { - nsUriCannotBeDefaulted[e.getValue()] = nonDefaultableNsUris.contains(e.getKey()); - } - - NameList r = new NameList( - list(uriIndexMap), - nsUriCannotBeDefaulted, - list(localNameIndexMap), - elementQNameIndexMap.size(), - attributeQNameIndexMap.size() ); - // delete them so that the create method can never be called again - uriIndexMap = null; - localNameIndexMap = null; - return r; - } - - private String[] list(Map map) { - String[] r = new String[map.size()]; - for (Map.Entry e : map.entrySet()) - r[e.getValue()] = e.getKey(); - return r; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/NameList.java 2018-01-30 20:33:28.000000000 -0500 +++ /dev/null 2018-01-30 20:33:28.000000000 -0500 @@ -1,73 +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.xml.internal.bind.v2.runtime; - -/** - * Namespace URIs and local names sorted by their indices. - * Number of Names used for EIIs and AIIs - * - * @author Kohsuke Kawaguchi - */ -public final class NameList { - /** - * Namespace URIs by their indices. No nulls in this array. - * Read-only. - */ - public final String[] namespaceURIs; - - /** - * For each entry in {@link #namespaceURIs}, whether the namespace URI - * can be declared as the default. If namespace URI is used in attributes, - * we always need a prefix, so we can't. - * - * True if this URI has to have a prefix. - */ - public final boolean[] nsUriCannotBeDefaulted; - - /** - * Local names by their indices. No nulls in this array. - * Read-only. - */ - public final String[] localNames; - - /** - * Number of Names for elements - */ - public final int numberOfElementNames; - - /** - * Number of Names for attributes - */ - public final int numberOfAttributeNames; - - public NameList(String[] namespaceURIs, boolean[] nsUriCannotBeDefaulted, String[] localNames, int numberElementNames, int numberAttributeNames) { - this.namespaceURIs = namespaceURIs; - this.nsUriCannotBeDefaulted = nsUriCannotBeDefaulted; - this.localNames = localNames; - this.numberOfElementNames = numberElementNames; - this.numberOfAttributeNames = numberAttributeNames; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/NamespaceContext2.java 2018-01-30 20:33:28.000000000 -0500 +++ /dev/null 2018-01-30 20:33:28.000000000 -0500 @@ -1,88 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.runtime; - -import javax.xml.namespace.NamespaceContext; - -import com.sun.istack.internal.NotNull; - -/** - * Maintains {@code namespace <-> prefix} bindings. - * - *

- * This interface extends {@link NamespaceContext} and provides - * an additional functionality, which is necessary to declare - * namespaced attributes on elements. The added method is for - * self-consumption by the marshaller. - * - * This object is composed into a Serializer. - */ -public interface NamespaceContext2 extends NamespaceContext -{ - /** - * Declares a new namespace binding within the current context. - * - *

- * The prefix is automatically assigned by MarshallingContext. If - * a given namespace URI is already declared, nothing happens. - * - *

- * It is NOT an error to declare the same namespace URI - * more than once. - * - *

- * For marshalling to work correctly, all namespace bindings - * for an element must be declared between its startElement method and - * its endAttributes event. Calling the same method with the same - * parameter between the endAttributes and the endElement returns - * the same prefix. - * - * @param requirePrefix - * If this parameter is true, this method must assign a prefix - * to this namespace, even if it's already bound to the default - * namespace. IOW, this method will never return null if this - * flag is true. This functionality is necessary to declare - * namespace URI used for attribute names. - * @param preferedPrefix - * If the caller has any particular preference to the - * prefix, pass that as a parameter. The callee will try - * to honor it. Set null if there's no particular preference. - * - * @return - * returns the assigned prefix. If the namespace is bound to - * the default namespace, null is returned. - */ - String declareNamespace( String namespaceUri, String preferedPrefix, boolean requirePrefix ); - - /** - * Forcibly make a namespace declaration in effect. - * - * If the (prefix,uri) binding is already in-scope, this method - * simply returns the assigned prefix index. Otherwise a new - * declaration will be put. - */ - int force(@NotNull String uri, @NotNull String prefix); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/RuntimeUtil.java 2018-01-30 20:33:29.000000000 -0500 +++ /dev/null 2018-01-30 20:33:29.000000000 -0500 @@ -1,128 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.runtime; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -/** - * @author Kohsuke Kawaguchi - */ -public class RuntimeUtil { - /** - * XmlAdapter for printing arbitrary object by using {@link Object#toString()}. - */ - public static final class ToStringAdapter extends XmlAdapter { - public Object unmarshal(String s) { - throw new UnsupportedOperationException(); - } - - public String marshal(Object o) { - if(o==null) return null; - return o.toString(); - } - } - - /** - * Map from {@link Class} objects representing primitive types - * to {@link Class} objects representing their boxed types. - *

- * e.g., {@code int -> Integer}. - */ - public static final Map boxToPrimitive; - - /** - * Reverse map of {@link #boxToPrimitive}. - */ - public static final Map primitiveToBox; - - static { - Map b = new HashMap(); - b.put(Byte.TYPE,Byte.class); - b.put(Short.TYPE,Short.class); - b.put(Integer.TYPE,Integer.class); - b.put(Long.TYPE,Long.class); - b.put(Character.TYPE,Character.class); - b.put(Boolean.TYPE,Boolean.class); - b.put(Float.TYPE,Float.class); - b.put(Double.TYPE,Double.class); - b.put(Void.TYPE,Void.class); - - primitiveToBox = Collections.unmodifiableMap(b); - - Map p = new HashMap(); - for( Map.Entry e : b.entrySet() ) - p.put(e.getValue(),e.getKey()); - - boxToPrimitive = Collections.unmodifiableMap(p); - } - - /** - * Reports a print conversion error while marshalling. - */ -/* - public static void handlePrintConversionException( - Object caller, Exception e, XMLSerializer serializer ) throws SAXException { - - if( e instanceof SAXException ) - // assume this exception is not from application. - // (e.g., when a marshaller aborts the processing, this exception - // will be thrown) - throw (SAXException)e; - - ValidationEvent ve = new PrintConversionEventImpl( - ValidationEvent.ERROR, e.getMessage(), - new ValidationEventLocatorImpl(caller), e ); - serializer.reportError(ve); - } -*/ - - /** - * Reports that the type of an object in a property is unexpected. - */ -/* - public static void handleTypeMismatchError( XMLSerializer serializer, - Object parentObject, String fieldName, Object childObject ) throws SAXException { - - ValidationEvent ve = new ValidationEventImpl( - ValidationEvent.ERROR, // maybe it should be a fatal error. - Messages.TYPE_MISMATCH.format( - getTypeName(parentObject), - fieldName, - getTypeName(childObject) ), - new ValidationEventLocatorExImpl(parentObject,fieldName) ); - - serializer.reportError(ve); - } -*/ - - private static String getTypeName( Object o ) { - return o.getClass().getName(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/SchemaTypeTransducer.java 2018-01-30 20:33:30.000000000 -0500 +++ /dev/null 2018-01-30 20:33:30.000000000 -0500 @@ -1,87 +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.xml.internal.bind.v2.runtime; - -import java.io.IOException; - -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; - -import org.xml.sax.SAXException; - -/** - * {@link Transducer} that signals the runtime that this datatype - * is marshalled to a different XML Schema type. - * - *

- * This transducer is used to implement the semantics of {@link XmlSchemaType} annotation. - * - * - * @see XMLSerializer#schemaType - * @author Kohsuke Kawaguchi - */ -public class SchemaTypeTransducer extends FilterTransducer { - private final QName schemaType; - - public SchemaTypeTransducer(Transducer core, QName schemaType) { - super(core); - this.schemaType = schemaType; - } - - @Override - public CharSequence print(V o) throws AccessorException { - XMLSerializer w = XMLSerializer.getInstance(); - QName old = w.setSchemaType(schemaType); - try { - return core.print(o); - } finally { - w.setSchemaType(old); - } - } - - @Override - public void writeText(XMLSerializer w, V o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - QName old = w.setSchemaType(schemaType); - try { - core.writeText(w,o,fieldName); - } finally { - w.setSchemaType(old); - } - } - - @Override - public void writeLeafElement(XMLSerializer w, Name tagName, V o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException { - QName old = w.setSchemaType(schemaType); - try { - core.writeLeafElement(w, tagName, o, fieldName); - } finally { - w.setSchemaType(old); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/StAXPostInitAction.java 2018-01-30 20:33:30.000000000 -0500 +++ /dev/null 2018-01-30 20:33:30.000000000 -0500 @@ -1,89 +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.xml.internal.bind.v2.runtime; - -import javax.xml.namespace.NamespaceContext; -import javax.xml.stream.XMLEventWriter; -import javax.xml.stream.XMLStreamWriter; - -/** - * Post-init action for {@link MarshallerImpl} that incorporate the in-scope namespace bindings - * from a StAX writer. - * - *

- * It's always used either with {@link XMLStreamWriter}, {@link XMLEventWriter}, or bare - * {@link NamespaceContext}, - * but to reduce the # of classes in the runtime I wrote only one class that handles both. - * - * @author Kohsuke Kawaguchi - */ -final class StAXPostInitAction implements Runnable { - private final XMLStreamWriter xsw; - private final XMLEventWriter xew; - private final NamespaceContext nsc; - private final XMLSerializer serializer; - - StAXPostInitAction(XMLStreamWriter xsw,XMLSerializer serializer) { - this.xsw = xsw; - this.xew = null; - this.nsc = null; - this.serializer = serializer; - } - - StAXPostInitAction(XMLEventWriter xew,XMLSerializer serializer) { - this.xsw = null; - this.xew = xew; - this.nsc = null; - this.serializer = serializer; - } - - StAXPostInitAction(NamespaceContext nsc,XMLSerializer serializer) { - this.xsw = null; - this.xew = null; - this.nsc = nsc; - this.serializer = serializer; - } - - public void run() { - NamespaceContext ns = nsc; - if(xsw!=null) ns = xsw.getNamespaceContext(); - if(xew!=null) ns = xew.getNamespaceContext(); - - // StAX javadoc isn't very clear on the behavior, - // so work defensively in anticipation of broken implementations. - if(ns==null) - return; - - // we can't enumerate all the in-scope namespace bindings in StAX, - // so we only look for the known static namespace URIs. - // this is less than ideal, but better than nothing. - for( String nsUri : serializer.grammar.nameList.namespaceURIs ) { - String p = ns.getPrefix(nsUri); - if(p!=null) - serializer.addInscopeBinding(nsUri,p); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/SwaRefAdapter.java 2018-01-30 20:33:31.000000000 -0500 +++ /dev/null 2018-01-30 20:33:31.000000000 -0500 @@ -1,71 +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.xml.internal.bind.v2.runtime; - - -import javax.activation.DataHandler; -import javax.xml.bind.annotation.XmlAttachmentRef; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import javax.xml.bind.attachment.AttachmentMarshaller; -import javax.xml.bind.attachment.AttachmentUnmarshaller; - -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; - - -/** - * {@link XmlAdapter} that binds the value as a SOAP attachment. - * - *

- * On the user classes the SwA handling is done by using the {@link XmlAttachmentRef} - * annotation, but internally we treat it as a {@link XmlJavaTypeAdapter} with this - * adapter class. This is true with both XJC and the runtime. - * - *

- * the model builder code and the code generator does the conversion and - * shield the rest of the RI from this mess. - * Also see @see http://webservices.xml.com/pub/a/ws/2003/09/16/wsbp.html?page=2. - * - * @author Kohsuke Kawaguchi - */ -public final class SwaRefAdapter extends XmlAdapter { - - public SwaRefAdapter() { - } - - public DataHandler unmarshal(String cid) { - AttachmentUnmarshaller au = UnmarshallingContext.getInstance().parent.getAttachmentUnmarshaller(); - // TODO: error check - return au.getAttachmentAsDataHandler(cid); - } - - public String marshal(DataHandler data) { - if(data==null) return null; - AttachmentMarshaller am = XMLSerializer.getInstance().attachmentMarshaller; - // TODO: error check - return am.addSwaRefAttachment(data); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/SwaRefAdapterMarker.java 2018-01-30 20:33:32.000000000 -0500 +++ /dev/null 2018-01-30 20:33:32.000000000 -0500 @@ -1,45 +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.bind.v2.runtime; - - -import javax.activation.DataHandler; -import javax.xml.bind.annotation.adapters.XmlAdapter; - - -/** - * Marker class used to identify swaref attachments and to generate appropriate annotations later. - */ -public class SwaRefAdapterMarker extends XmlAdapter { - - public DataHandler unmarshal(String v) throws Exception { - throw new IllegalStateException("Not implemented"); - } - - public String marshal(DataHandler v) throws Exception { - throw new IllegalStateException("Not implemented"); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Transducer.java 2018-01-30 20:33:33.000000000 -0500 +++ /dev/null 2018-01-30 20:33:33.000000000 -0500 @@ -1,134 +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.xml.internal.bind.v2.runtime; - -import java.io.IOException; - -import javax.xml.bind.annotation.XmlValue; -import javax.xml.datatype.XMLGregorianCalendar; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.istack.internal.NotNull; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.reflect.opt.OptimizedTransducedAccessorFactory; - -import org.xml.sax.SAXException; - - -/** - * Responsible for converting a Java object to a lexical representation - * and vice versa. - * - *

- * An implementation of this interface hides how this conversion happens. - * - *

- * {@link Transducer}s are immutable. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public interface Transducer { - - /** - * If this {@link Transducer} is the default transducer for the ValueT, - * this method returns true. - * - * Used exclusively by {@link OptimizedTransducedAccessorFactory#get(RuntimePropertyInfo)} - */ - boolean isDefault(); - - /** - * If true, this {@link Transducer} doesn't declare any namespace, - * and therefore {@link #declareNamespace(Object, XMLSerializer)} is no-op. - * - * It also means that the {@link #parse(CharSequence)} method - * won't use the context parameter. - */ - boolean useNamespace(); - - /** - * Declares the namespace URIs used in the given value to {@code w}. - * - * @param o - * never be null. - * @param w - * may be null if {@code !{@link #useNamespace()}}. - */ - void declareNamespace( ValueT o, XMLSerializer w ) throws AccessorException; - - /** - * Converts the given value to its lexical representation. - * - * @param o - * never be null. - * @return - * always non-null valid lexical representation. - */ - @NotNull CharSequence print(@NotNull ValueT o) throws AccessorException; - - /** - * Converts the lexical representation to a value object. - * - * @param lexical - * never be null. - * @throws AccessorException - * if the transducer is used to parse an user bean that uses {@link XmlValue}, - * then this exception may occur when it tries to set the leaf value to the bean. - * @throws SAXException - * if the lexical form is incorrect, the error should be reported - * and SAXException may thrown (or it can return null to recover.) - */ - ValueT parse(CharSequence lexical) throws AccessorException, SAXException; - - /** - * Sends the result of the {@link #print(Object)} operation - * to one of the {@link XMLSerializer#text(String, String)} method, - * but with the best representation of the value, not necessarily String. - */ - void writeText(XMLSerializer w, ValueT o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException; - - /** - * Sends the result of the {@link #print(Object)} operation - * to one of the {@link XMLSerializer#leafElement(Name, String, String)} method. - * but with the best representation of the value, not necessarily String. - */ - void writeLeafElement(XMLSerializer w, Name tagName, @NotNull ValueT o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException; - - /** - * Transducers implicitly work against a single XML type, - * but sometimes (most notably {@link XMLGregorianCalendar}, - * an instance may choose different XML types. - * - * @return - * return non-null from this method allows transducers - * to specify the type it wants to marshal to. - * Most of the time this method returns null, in which case - * the implicitly associated type will be used. - */ - QName getTypeName(@NotNull ValueT instance); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/Utils.java 2018-01-30 20:33:33.000000000 -0500 +++ /dev/null 2018-01-30 20:33:33.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, 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.bind.v2.runtime; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Utils class. - * - * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. - * - * Has *package private* access to avoid inappropriate usage. - */ -final class Utils { - - private static final Logger LOGGER = Logger.getLogger(Utils.class.getName()); - - /** - * static ReflectionNavigator field to avoid usage of reflection every time we use it. - */ - static final Navigator REFLECTION_NAVIGATOR; - - static { // we statically initializing REFLECTION_NAVIGATOR property - try { - final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - - // requires accessClassInPackage privilege - final Method getInstance = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Method run() { - try { - Method getInstance = refNav.getDeclaredMethod("getInstance"); - getInstance.setAccessible(true); - return getInstance; - } catch (NoSuchMethodException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); - } - } - } - ); - - //noinspection unchecked - REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); - } catch (ClassNotFoundException e) { - throw new IllegalStateException("Can't find ReflectionNavigator class"); - } catch (InvocationTargetException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (IllegalAccessException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); - } catch (SecurityException e) { - LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); - throw e; - } - } - - /** - * private constructor to avoid util class instantiating - */ - private Utils() { - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ValueListBeanInfoImpl.java 2018-01-30 20:33:34.000000000 -0500 +++ /dev/null 2018-01-30 20:33:34.000000000 -0500 @@ -1,172 +0,0 @@ -/* - * 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.bind.v2.runtime; - -import java.io.IOException; -import java.lang.reflect.Array; -import java.util.List; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.helpers.ValidationEventImpl; -import javax.xml.stream.XMLStreamException; - -import com.sun.istack.internal.FinalArrayList; -import com.sun.xml.internal.bind.WhiteSpaceProcessor; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; - -import org.xml.sax.SAXException; - -/** - * {@link JaxBeanInfo} implementation that binds T[] to a list of simple types. - * - * @author Kohsuke Kawaguchi - */ -final class ValueListBeanInfoImpl extends JaxBeanInfo { - - private final Class itemType; - private final Transducer xducer; // for items - - public ValueListBeanInfoImpl(JAXBContextImpl owner, Class arrayType) throws JAXBException { - super(owner, null, arrayType, false, true, false); - this.itemType = jaxbType.getComponentType(); - this.xducer = owner.getBeanInfo(arrayType.getComponentType(),true).getTransducer(); - assert xducer!=null; - } - - private final Loader loader = new Loader(true) { - @Override - public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { - List r = new FinalArrayList(); - - int idx = 0; - int len = text.length(); - - while(true) { - int p = idx; - while( p - * This object coordinates the overall marshalling efforts across different - * content-tree objects and different target formats. - * - *

- * The following CFG gives the proper sequence of method invocation. - * - *

- * MARSHALLING  :=  ELEMENT
- * ELEMENT      :=  "startElement" NSDECL* "endNamespaceDecls"
- *                        ATTRIBUTE* "endAttributes" BODY "endElement"
- *
- * NSDECL       :=  "declareNamespace"
- *
- * ATTRIBUTE    :=  "attribute"
- * ATTVALUES    :=  "text"*
- *
- *
- * BODY         :=  ( "text" | ELEMENT )*
- * 
- * - *

- * A marshalling of one element consists of two stages. The first stage is - * for marshalling attributes and collecting namespace declarations. - * The second stage is for marshalling characters/child elements of that element. - * - *

- * Observe that multiple invocation of "text" is allowed. - * - *

- * Also observe that the namespace declarations are allowed only between - * "startElement" and "endAttributes". - * - *

Exceptions in marshaller

- *

- * {@link IOException}, {@link SAXException}, and {@link XMLStreamException} - * are thrown from {@link XmlOutput}. They are always considered fatal, and - * therefore caught only by {@link MarshallerImpl}. - *

- * {@link AccessorException} can be thrown when an access to a property/field - * fails, and this is considered as a recoverable error, so it's caught everywhere. - * - * @author Kohsuke Kawaguchi - */ -public final class XMLSerializer extends Coordinator { - public final JAXBContextImpl grammar; - - /** The XML printer. */ - private XmlOutput out; - - public final NameList nameList; - - public final int[] knownUri2prefixIndexMap; - - private final NamespaceContextImpl nsContext; - - private NamespaceContextImpl.Element nse; - - // Introduced based on Jersey requirements - to be able to retrieve marshalled name - ThreadLocal currentProperty = new ThreadLocal(); - - /** - * Set to true if a text is already written, - * and we need to print ' ' for additional text methods. - */ - private boolean textHasAlreadyPrinted = false; - - /** - * Set to false once we see the start tag of the root element. - */ - private boolean seenRoot = false; - - /** Marshaller object to which this object belongs. */ - private final MarshallerImpl marshaller; - - /** Objects referenced through IDREF. */ - private final Set idReferencedObjects = new HashSet(); - - /** Objects with ID. */ - private final Set objectsWithId = new HashSet(); - - /** - * Used to detect cycles in the object. - * Also used to learn what's being marshalled. - */ - private final CollisionCheckStack cycleDetectionStack = new CollisionCheckStack(); - - /** Optional attributes to go with root element. */ - private String schemaLocation; - private String noNsSchemaLocation; - - /** Lazily created identitiy transformer. */ - private Transformer identityTransformer; - - /** Lazily created. */ - private ContentHandlerAdaptor contentHandlerAdapter; - - private boolean fragment; - - /** - * Cached instance of {@link Base64Data}. - */ - private Base64Data base64Data; - - /** - * Cached instance of {@link IntData}. - */ - private final IntData intData = new IntData(); - - public AttachmentMarshaller attachmentMarshaller; - - /*package*/ XMLSerializer( MarshallerImpl _owner ) { - this.marshaller = _owner; - this.grammar = marshaller.context; - nsContext = new NamespaceContextImpl(this); - nameList = marshaller.context.nameList; - knownUri2prefixIndexMap = new int[nameList.namespaceURIs.length]; - } - - /** - * Gets the cached instance of {@link Base64Data}. - * - * @deprecated - * {@link Base64Data} is no longer cached, so that - * XMLStreamWriterEx impl can retain the data, like JAX-WS does. - */ - public Base64Data getCachedBase64DataInstance() { - return new Base64Data(); - } - - /** - * Gets the ID value from an identifiable object. - */ - private String getIdFromObject(Object identifiableObject) throws SAXException, JAXBException { - return grammar.getBeanInfo(identifiableObject,true).getId(identifiableObject,this); - } - - private void handleMissingObjectError(String fieldName) throws SAXException, IOException, XMLStreamException { - reportMissingObjectError(fieldName); - // as a marshaller, we should be robust, so we'll continue to marshal - // this document by skipping this missing object. - endNamespaceDecls(null); - endAttributes(); - } - - - public void reportError( ValidationEvent ve ) throws SAXException { - ValidationEventHandler handler; - - try { - handler = marshaller.getEventHandler(); - } catch( JAXBException e ) { - throw new SAXException2(e); - } - - if(!handler.handleEvent(ve)) { - if(ve.getLinkedException() instanceof Exception) - throw new SAXException2((Exception)ve.getLinkedException()); - else - throw new SAXException2(ve.getMessage()); - } - } - - /** - * Report an error found as an exception. - * - * @param fieldName - * the name of the property being processed when an error is found. - */ - public final void reportError(String fieldName, Throwable t) throws SAXException { - ValidationEvent ve = new ValidationEventImpl(ValidationEvent.ERROR, - t.getMessage(), getCurrentLocation(fieldName), t); - reportError(ve); - } - - public void startElement(Name tagName, Object outerPeer) { - startElement(); - nse.setTagName(tagName,outerPeer); - } - - public void startElement(String nsUri, String localName, String preferredPrefix, Object outerPeer) { - startElement(); - int idx = nsContext.declareNsUri(nsUri, preferredPrefix, false); - nse.setTagName(idx,localName,outerPeer); - } - - /** - * Variation of {@link #startElement(String, String, String, Object)} that forces - * a specific prefix. Needed to preserve the prefix when marshalling DOM. - */ - public void startElementForce(String nsUri, String localName, String forcedPrefix, Object outerPeer) { - startElement(); - int idx = nsContext.force(nsUri, forcedPrefix); - nse.setTagName(idx,localName,outerPeer); - } - - public void endNamespaceDecls(Object innerPeer) throws IOException, XMLStreamException { - nsContext.collectionMode = false; - nse.startElement(out,innerPeer); - } - - /** - * Switches to the "marshal child texts/elements" mode. - * This method has to be called after the 1st pass is completed. - */ - public void endAttributes() throws SAXException, IOException, XMLStreamException { - if(!seenRoot) { - seenRoot = true; - if(schemaLocation!=null || noNsSchemaLocation!=null) { - int p = nsContext.getPrefixIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE); - if(schemaLocation!=null) - out.attribute(p,"schemaLocation",schemaLocation); - if(noNsSchemaLocation!=null) - out.attribute(p,"noNamespaceSchemaLocation",noNsSchemaLocation); - } - } - - out.endStartTag(); - } - - /** - * Ends marshalling of an element. - * Pops the internal stack. - */ - public void endElement() throws SAXException, IOException, XMLStreamException { - nse.endElement(out); - nse = nse.pop(); - textHasAlreadyPrinted = false; - } - - public void leafElement( Name tagName, String data, String fieldName ) throws SAXException, IOException, XMLStreamException { - if(seenRoot) { - textHasAlreadyPrinted = false; - nse = nse.push(); - out.beginStartTag(tagName); - out.endStartTag(); - if(data != null) - try { - out.text(data,false); - } catch (IllegalArgumentException e) { - throw new IllegalArgumentException(Messages.ILLEGAL_CONTENT.format(fieldName, e.getMessage())); - } - out.endTag(tagName); - nse = nse.pop(); - } else { - // root element has additional processing like xsi:schemaLocation, - // so we need to go the slow way - startElement(tagName,null); - endNamespaceDecls(null); - endAttributes(); - try { - out.text(data, false); - } catch (IllegalArgumentException e) { - throw new IllegalArgumentException(Messages.ILLEGAL_CONTENT.format(fieldName, e.getMessage())); - } - endElement(); - } - } - - public void leafElement( Name tagName, Pcdata data, String fieldName ) throws SAXException, IOException, XMLStreamException { - if(seenRoot) { - textHasAlreadyPrinted = false; - nse = nse.push(); - out.beginStartTag(tagName); - out.endStartTag(); - if(data != null) - out.text(data,false); - out.endTag(tagName); - nse = nse.pop(); - } else { - // root element has additional processing like xsi:schemaLocation, - // so we need to go the slow way - startElement(tagName,null); - endNamespaceDecls(null); - endAttributes(); - out.text(data,false); - endElement(); - } - } - - public void leafElement( Name tagName, int data, String fieldName ) throws SAXException, IOException, XMLStreamException { - intData.reset(data); - leafElement(tagName,intData,fieldName); - } - - /** - * Marshalls text. - * - *

- * This method can be called after the {@link #endAttributes()} - * method to marshal texts inside elements. - * If the method is called more than once, those texts are considered - * as separated by whitespaces. For example, - * - *

-     * c.startElement("","foo");
-     * c.endAttributes();
-     * c.text("abc");
-     * c.text("def");
-     *   c.startElement("","bar");
-     *   c.endAttributes();
-     *   c.endElement();
-     * c.text("ghi");
-     * c.endElement();
-     * 
- * - * will generate {@code abc defghi}. - */ - public void text( String text, String fieldName ) throws SAXException, IOException, XMLStreamException { - // If the assertion fails, it must be a bug of xjc. - // right now, we are not expecting the text method to be called. - if(text==null) { - reportMissingObjectError(fieldName); - return; - } - - out.text(text,textHasAlreadyPrinted); - textHasAlreadyPrinted = true; - } - - /** - * The {@link #text(String, String)} method that takes {@link Pcdata}. - */ - public void text( Pcdata text, String fieldName ) throws SAXException, IOException, XMLStreamException { - // If the assertion fails, it must be a bug of xjc. - // right now, we are not expecting the text method to be called. - if(text==null) { - reportMissingObjectError(fieldName); - return; - } - - out.text(text,textHasAlreadyPrinted); - textHasAlreadyPrinted = true; - } - - public void attribute(String uri, String local, String value) throws SAXException { - int prefix; - if(uri.length()==0) { - // default namespace. don't need prefix - prefix = -1; - } else { - prefix = nsContext.getPrefixIndex(uri); - } - - try { - out.attribute(prefix,local,value); - } catch (IOException e) { - throw new SAXException2(e); - } catch (XMLStreamException e) { - throw new SAXException2(e); - } - } - - public void attribute(Name name, CharSequence value) throws IOException, XMLStreamException { - // TODO: consider having the version that takes Pcdata. - // it's common for an element to have int attributes - out.attribute(name,value.toString()); - } - - public NamespaceContext2 getNamespaceContext() { - return nsContext; - } - - - public String onID( Object owner, String value ) { - objectsWithId.add(owner); - return value; - } - - public String onIDREF( Object obj ) throws SAXException { - String id; - try { - id = getIdFromObject(obj); - } catch (JAXBException e) { - reportError(null,e); - return null; // recover by returning null - } - idReferencedObjects.add(obj); - if(id==null) { - reportError( new NotIdentifiableEventImpl( - ValidationEvent.ERROR, - Messages.NOT_IDENTIFIABLE.format(), - new ValidationEventLocatorImpl(obj) ) ); - } - return id; - } - - - // TODO: think about the exception handling. - // I suppose we don't want to use SAXException. -kk - - public void childAsRoot(Object obj) throws JAXBException, IOException, SAXException, XMLStreamException { - final JaxBeanInfo beanInfo = grammar.getBeanInfo(obj, true); - - // since the same object will be reported to childAsRoot or - // childAsXsiType, don't make it a part of the collision check. - // but we do need to push it so that getXMIMEContentType will work. - cycleDetectionStack.pushNocheck(obj); - - final boolean lookForLifecycleMethods = beanInfo.lookForLifecycleMethods(); - if (lookForLifecycleMethods) { - fireBeforeMarshalEvents(beanInfo, obj); - } - - beanInfo.serializeRoot(obj,this); - - if (lookForLifecycleMethods) { - fireAfterMarshalEvents(beanInfo, obj); - } - - cycleDetectionStack.pop(); - } - - /** - * Pushes the object to {@link #cycleDetectionStack} and also - * detect any cycles. - * - * When a cycle is found, this method tries to recover from it. - * - * @return - * the object that should be marshalled instead of the given {@code obj}, - * or null if the error is found and we need to avoid marshalling this object - * to prevent infinite recursion. When this method returns null, the error - * has already been reported. - */ - private Object pushObject(Object obj, String fieldName) throws SAXException { - if(!cycleDetectionStack.push(obj)) - return obj; - - // allow the object to nominate its replacement - if(obj instanceof CycleRecoverable) { - obj = ((CycleRecoverable)obj).onCycleDetected(new CycleRecoverable.Context(){ - public Marshaller getMarshaller() { - return marshaller; - } - }); - if(obj!=null) { - // object nominated its replacement. - // we still need to make sure that the nominated. - // this may cause inifinite recursion on its own. - cycleDetectionStack.pop(); - return pushObject(obj,fieldName); - } else - return null; - } - - // cycle detected and no one is catching the error. - reportError(new ValidationEventImpl( - ValidationEvent.ERROR, - Messages.CYCLE_IN_MARSHALLER.format(cycleDetectionStack.getCycleString()), - getCurrentLocation(fieldName), - null)); - return null; - } - - /** - * The equivalent of: - * - *
-     * childAsURIs(child, fieldName);
-     * endNamespaceDecls();
-     * childAsAttributes(child, fieldName);
-     * endAttributes();
-     * childAsBody(child, fieldName);
-     * 
- * - * This produces the given child object as the sole content of - * an element. - * Used to reduce the code size in the generated marshaller. - */ - public final void childAsSoleContent( Object child, String fieldName) throws SAXException, IOException, XMLStreamException { - if(child==null) { - handleMissingObjectError(fieldName); - } else { - child = pushObject(child,fieldName); - if(child==null) { - // error recovery - endNamespaceDecls(null); - endAttributes(); - cycleDetectionStack.pop(); - } - - JaxBeanInfo beanInfo; - try { - beanInfo = grammar.getBeanInfo(child,true); - } catch (JAXBException e) { - reportError(fieldName,e); - // recover by ignore - endNamespaceDecls(null); - endAttributes(); - cycleDetectionStack.pop(); - return; - } - - final boolean lookForLifecycleMethods = beanInfo.lookForLifecycleMethods(); - if (lookForLifecycleMethods) { - fireBeforeMarshalEvents(beanInfo, child); - } - - beanInfo.serializeURIs(child,this); - endNamespaceDecls(child); - beanInfo.serializeAttributes(child,this); - endAttributes(); - beanInfo.serializeBody(child,this); - - if (lookForLifecycleMethods) { - fireAfterMarshalEvents(beanInfo, child); - } - - cycleDetectionStack.pop(); - } - } - - - // the version of childAsXXX where it produces @xsi:type if the expected type name - // and the actual type name differs. - - /** - * This method is called when a type child object is found. - * - *

- * This method produces events of the following form: - *

-     * NSDECL* "endNamespaceDecls" ATTRIBUTE* "endAttributes" BODY
-     * 
- * optionally including @xsi:type if necessary. - * - * @param child - * Object to be marshalled. The {@link JaxBeanInfo} for - * this object must return a type name. - * @param expected - * Expected type of the object. - * @param fieldName - * property name of the parent objeect from which 'o' comes. - * Used as a part of the error message in case anything goes wrong - * with 'o'. - */ - public final void childAsXsiType( Object child, String fieldName, JaxBeanInfo expected, boolean nillable) throws SAXException, IOException, XMLStreamException { - if(child==null) { - handleMissingObjectError(fieldName); - } else { - child = pushObject(child,fieldName); - if(child==null) { // error recovery - endNamespaceDecls(null); - endAttributes(); - return; - } - - boolean asExpected = child.getClass()==expected.jaxbType; - JaxBeanInfo actual = expected; - QName actualTypeName = null; - - if((asExpected) && (actual.lookForLifecycleMethods())) { - fireBeforeMarshalEvents(actual, child); - } - - if(!asExpected) { - try { - actual = grammar.getBeanInfo(child,true); - if (actual.lookForLifecycleMethods()) { - fireBeforeMarshalEvents(actual, child); - } - } catch (JAXBException e) { - reportError(fieldName,e); - endNamespaceDecls(null); - endAttributes(); - return; // recover by ignore - } - if(actual==expected) - asExpected = true; - else { - actualTypeName = actual.getTypeName(child); - if(actualTypeName==null) { - reportError(new ValidationEventImpl( - ValidationEvent.ERROR, - Messages.SUBSTITUTED_BY_ANONYMOUS_TYPE.format( - expected.jaxbType.getName(), - child.getClass().getName(), - actual.jaxbType.getName()), - getCurrentLocation(fieldName))); - // recover by not printing @xsi:type - } else { - getNamespaceContext().declareNamespace(WellKnownNamespace.XML_SCHEMA_INSTANCE,"xsi",true); - getNamespaceContext().declareNamespace(actualTypeName.getNamespaceURI(),null,false); - } - } - } - actual.serializeURIs(child,this); - - if (nillable) { - getNamespaceContext().declareNamespace(WellKnownNamespace.XML_SCHEMA_INSTANCE,"xsi",true); - } - - endNamespaceDecls(child); - if(!asExpected) { - attribute(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type", - DatatypeConverter.printQName(actualTypeName,getNamespaceContext())); - } - - actual.serializeAttributes(child,this); - boolean nilDefined = actual.isNilIncluded(); - if ((nillable) && (!nilDefined)) { - attribute(WellKnownNamespace.XML_SCHEMA_INSTANCE,"nil","true"); - } - - endAttributes(); - actual.serializeBody(child,this); - - if (actual.lookForLifecycleMethods()) { - fireAfterMarshalEvents(actual, child); - } - - cycleDetectionStack.pop(); - } - } - - /** - * Invoke the afterMarshal api on the external listener (if it exists) and on the bean embedded - * afterMarshal api(if it exists). - * - * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true. - * - * @param beanInfo - * @param currentTarget - */ - private void fireAfterMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) { - // first invoke bean embedded listener - if (beanInfo.hasAfterMarshalMethod()) { - Method m = beanInfo.getLifecycleMethods().afterMarshal; - fireMarshalEvent(currentTarget, m); - } - - // then invoke external listener before bean embedded listener - Marshaller.Listener externalListener = marshaller.getListener(); - if (externalListener != null) { - externalListener.afterMarshal(currentTarget); - } - - } - - /** - * Invoke the beforeMarshal api on the external listener (if it exists) and on the bean embedded - * beforeMarshal api(if it exists). - * - * This method is called only after the callee has determined that beanInfo.lookForLifecycleMethods == true. - * - * @param beanInfo - * @param currentTarget - */ - private void fireBeforeMarshalEvents(final JaxBeanInfo beanInfo, Object currentTarget) { - // first invoke bean embedded listener - if (beanInfo.hasBeforeMarshalMethod()) { - Method m = beanInfo.getLifecycleMethods().beforeMarshal; - fireMarshalEvent(currentTarget, m); - } - - // then invoke external listener - Marshaller.Listener externalListener = marshaller.getListener(); - if (externalListener != null) { - externalListener.beforeMarshal(currentTarget); - } - } - - private void fireMarshalEvent(Object target, Method m) { - try { - m.invoke(target, marshaller); - } catch (Exception e) { - // this really only happens if there is a bug in the ri - throw new IllegalStateException(e); - } - } - - public void attWildcardAsURIs(Map attributes, String fieldName) { - if(attributes==null) return; - for( Map.Entry e : attributes.entrySet() ) { - QName n = e.getKey(); - String nsUri = n.getNamespaceURI(); - if(nsUri.length()>0) { - String p = n.getPrefix(); - if(p.length()==0) p=null; - nsContext.declareNsUri(nsUri, p, true); - } - } - } - - public void attWildcardAsAttributes(Map attributes, String fieldName) throws SAXException { - if(attributes==null) return; - for( Map.Entry e : attributes.entrySet() ) { - QName n = e.getKey(); - attribute(n.getNamespaceURI(),n.getLocalPart(),e.getValue()); - } - } - - /** - * Short for the following call sequence: - * - *
-         getNamespaceContext().declareNamespace(WellKnownNamespace.XML_SCHEMA_INSTANCE,"xsi",true);
-         endNamespaceDecls();
-         attribute(WellKnownNamespace.XML_SCHEMA_INSTANCE,"nil","true");
-         endAttributes();
-     * 
- */ - public final void writeXsiNilTrue() throws SAXException, IOException, XMLStreamException { - getNamespaceContext().declareNamespace(WellKnownNamespace.XML_SCHEMA_INSTANCE,"xsi",true); - endNamespaceDecls(null); - attribute(WellKnownNamespace.XML_SCHEMA_INSTANCE,"nil","true"); - endAttributes(); - } - - public void writeDom(E element, DomHandler domHandler, Object parentBean, String fieldName) throws SAXException { - Source source = domHandler.marshal(element,this); - if(contentHandlerAdapter==null) - contentHandlerAdapter = new ContentHandlerAdaptor(this); - try { - getIdentityTransformer().transform(source,new SAXResult(contentHandlerAdapter)); - } catch (TransformerException e) { - reportError(fieldName,e); - } - } - - public Transformer getIdentityTransformer() { - if (identityTransformer==null) - identityTransformer = JAXBContextImpl.createTransformer(grammar.disableSecurityProcessing); - return identityTransformer; - } - - public void setPrefixMapper(NamespacePrefixMapper prefixMapper) { - nsContext.setPrefixMapper(prefixMapper); - } - - /** - * Reset this object to write to the specified output. - * - * @param schemaLocation - * if non-null, this value is printed on the root element as xsi:schemaLocation - * @param noNsSchemaLocation - * Similar to 'schemaLocation' but this one works for xsi:noNamespaceSchemaLocation - */ - public void startDocument(XmlOutput out,boolean fragment,String schemaLocation,String noNsSchemaLocation) throws IOException, SAXException, XMLStreamException { - pushCoordinator(); - nsContext.reset(); - nse = nsContext.getCurrent(); - if(attachmentMarshaller!=null && attachmentMarshaller.isXOPPackage()) - out = new MTOMXmlOutput(out); - this.out = out; - objectsWithId.clear(); - idReferencedObjects.clear(); - textHasAlreadyPrinted = false; - seenRoot = false; - this.schemaLocation = schemaLocation; - this.noNsSchemaLocation = noNsSchemaLocation; - this.fragment = fragment; - this.inlineBinaryFlag = false; - this.expectedMimeType = null; - cycleDetectionStack.reset(); - - out.startDocument(this,fragment,knownUri2prefixIndexMap,nsContext); - } - - public void endDocument() throws IOException, SAXException, XMLStreamException { - out.endDocument(fragment); - } - - public void close() { - out = null; - clearCurrentProperty(); - popCoordinator(); - } - - /** - * This method can be called after {@link #startDocument} is called - * but before the marshalling begins, to set the currently in-scope namespace - * bindings. - * - *

- * This method is useful to avoid redundant namespace declarations when - * the marshalling is producing a sub-document. - */ - public void addInscopeBinding(String nsUri,String prefix) { - nsContext.put(nsUri,prefix); - } - - /** - * Gets the MIME type with which the binary content shall be printed. - * - *

- * This method shall be used from those {@link RuntimeBuiltinLeafInfo} that are - * bound to base64Binary. - * - * @see JAXBContextImpl#getXMIMEContentType(Object) - */ - public String getXMIMEContentType() { - // xmime:contentType takes precedence - String v = grammar.getXMIMEContentType(cycleDetectionStack.peek()); - if(v!=null) return v; - - // then look for the current in-scope @XmlMimeType - if(expectedMimeType!=null) - return expectedMimeType.toString(); - - return null; - } - - private void startElement() { - nse = nse.push(); - - if( !seenRoot ) { - - if (grammar.getXmlNsSet() != null) { - for(XmlNs xmlNs : grammar.getXmlNsSet()) - nsContext.declareNsUri( - xmlNs.namespaceURI(), - xmlNs.prefix() == null ? "" : xmlNs.prefix(), - xmlNs.prefix() != null); - } - - // seenRoot set to true in endAttributes - // first declare all known URIs - String[] knownUris = nameList.namespaceURIs; - for( int i=0; i - * When we are marshalling a property with an effective {@link XmlSchemaType}, - * this field is set to hold the QName of that type. The {@link Transducer} that - * actually converts a Java object into XML can look this property to decide - * how to marshal the value. - */ - private QName schemaType; - - public QName setSchemaType(QName st) { - QName old = schemaType; - schemaType = st; - return old; - } - - public QName getSchemaType() { - return schemaType; - } - - public void setObjectIdentityCycleDetection(boolean val) { - cycleDetectionStack.setUseIdentity(val); - } - public boolean getObjectIdentityCycleDetection() { - return cycleDetectionStack.getUseIdentity(); - } - - void reconcileID() throws SAXException { - // find objects that were not a part of the object graph - idReferencedObjects.removeAll(objectsWithId); - - for( Object idObj : idReferencedObjects ) { - try { - String id = getIdFromObject(idObj); - reportError( new NotIdentifiableEventImpl( - ValidationEvent.ERROR, - Messages.DANGLING_IDREF.format(id), - new ValidationEventLocatorImpl(idObj) ) ); - } catch (JAXBException e) { - // this error should have been reported already. just ignore here. - } - } - - // clear the garbage - idReferencedObjects.clear(); - objectsWithId.clear(); - } - - public boolean handleError(Exception e) { - return handleError(e,cycleDetectionStack.peek(),null); - } - - public boolean handleError(Exception e,Object source,String fieldName) { - return handleEvent( - new ValidationEventImpl( - ValidationEvent.ERROR, - e.getMessage(), - new ValidationEventLocatorExImpl(source,fieldName), - e)); - } - - public boolean handleEvent(ValidationEvent event) { - try { - return marshaller.getEventHandler().handleEvent(event); - } catch (JAXBException e) { - // impossible - throw new Error(e); - } - } - - private void reportMissingObjectError(String fieldName) throws SAXException { - reportError(new ValidationEventImpl( - ValidationEvent.ERROR, - Messages.MISSING_OBJECT.format(fieldName), - getCurrentLocation(fieldName), - new NullPointerException() )); - } - - /** - * Called when a referenced object doesn't have an ID. - */ - public void errorMissingId(Object obj) throws SAXException { - reportError( new ValidationEventImpl( - ValidationEvent.ERROR, - Messages.MISSING_ID.format(obj), - new ValidationEventLocatorImpl(obj)) ); - } - - public ValidationEventLocator getCurrentLocation(String fieldName) { - return new ValidationEventLocatorExImpl(cycleDetectionStack.peek(),fieldName); - } - - protected ValidationEventLocator getLocation() { - return getCurrentLocation(null); - } - - /** - * May return null when the property hasn't been set. - * Introduced based on Jersey requirements. - */ - public Property getCurrentProperty() { - return currentProperty.get(); - } - - /** - * Takes care of cleaning the currentProperty. Must be called from the same thread that created the XMLSerializer. - */ - public void clearCurrentProperty() { - if (currentProperty != null) { - currentProperty.remove(); - } - } - - /** - * When called from within the realm of the marshaller, this method - * returns the current {@link XMLSerializer} in charge. - */ - public static XMLSerializer getInstance() { - return (XMLSerializer)Coordinator._getInstance(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/C14nXmlOutput.java 2018-01-30 20:33:35.000000000 -0500 +++ /dev/null 2018-01-30 20:33:35.000000000 -0500 @@ -1,221 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.runtime.output; - -import java.io.IOException; -import java.io.OutputStream; -import java.util.Arrays; -import java.util.Collections; - -import com.sun.xml.internal.bind.api.JAXBRIContext; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.istack.internal.FinalArrayList; -import com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler; - -/** - * {@link XmlOutput} that generates canonical XML. - * - * @author Kohsuke Kawaguchi - */ -public class C14nXmlOutput extends UTF8XmlOutput { - public C14nXmlOutput(OutputStream out, Encoded[] localNames, boolean namedAttributesAreOrdered, CharacterEscapeHandler escapeHandler) { - super(out, localNames, escapeHandler); - this.namedAttributesAreOrdered = namedAttributesAreOrdered; - - for( int i=0; i otherAttributes = new FinalArrayList(); - - /** - * True if {@link JAXBRIContext} is created with c14n support on, - * in which case all named attributes are sorted by the marshaller - * and we won't have to do it here. - */ - private final boolean namedAttributesAreOrdered; - - final class StaticAttribute implements Comparable { - Name name; - String value; - - public void set(Name name, String value) { - this.name = name; - this.value = value; - } - - void write() throws IOException { - C14nXmlOutput.super.attribute(name,value); - } - - DynamicAttribute toDynamicAttribute() { - int nsUriIndex = name.nsUriIndex; - int prefix; - if(nsUriIndex==-1) - prefix = -1; - else - prefix = nsUriIndex2prefixIndex[nsUriIndex]; - return new DynamicAttribute( - prefix, name.localName, value ); - } - - public int compareTo(StaticAttribute that) { - return this.name.compareTo(that.name); - } - - } - - final class DynamicAttribute implements Comparable { - final int prefix; - final String localName; - final String value; - - public DynamicAttribute(int prefix, String localName, String value) { - this.prefix = prefix; - this.localName = localName; - this.value = value; - } - - private String getURI() { - if(prefix==-1) return ""; - else return nsContext.getNamespaceURI(prefix); - } - - public int compareTo(DynamicAttribute that) { - int r = this.getURI().compareTo(that.getURI()); - if(r!=0) return r; - return this.localName.compareTo(that.localName); - } - } - - @Override - public void attribute(Name name, String value) throws IOException { - if(staticAttributes.length==len) { - // reallocate - int newLen = len*2; - StaticAttribute[] newbuf = new StaticAttribute[newLen]; - System.arraycopy(staticAttributes,0,newbuf,0,len); - for(int i=len;insBuf.length) - nsBuf = new int[count]; - - for( int i=count-1; i>=0; i-- ) - nsBuf[i] = base+i; - - // do a bubble sort. Hopefully # of ns decls are small enough to justify bubble sort. - // faster algorithm is more compliated to implement - for( int i=0; i 0 ) { - // swap - int t = nsBuf[j]; - nsBuf[j] = nsBuf[i]; - nsBuf[i] = t; - } - } - } - - // write them out - for( int i=0; i - * This is used for binder. - * - * @author Kohsuke Kawaguchi - */ -public final class DOMOutput extends SAXOutput { - private final AssociationMap assoc; - - public DOMOutput(Node node, AssociationMap assoc) { - super(new SAX2DOMEx(node)); - this.assoc = assoc; - assert assoc!=null; - } - - private SAX2DOMEx getBuilder() { - return (SAX2DOMEx)out; - } - - @Override - public void endStartTag() throws SAXException { - super.endStartTag(); - - Object op = nsContext.getCurrent().getOuterPeer(); - if(op!=null) - assoc.addOuter( getBuilder().getCurrentElement(), op ); - - Object ip = nsContext.getCurrent().getInnerPeer(); - if(ip!=null) - assoc.addInner( getBuilder().getCurrentElement(), ip ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/Encoded.java 2018-01-30 20:33:37.000000000 -0500 +++ /dev/null 2018-01-30 20:33:37.000000000 -0500 @@ -1,198 +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.xml.internal.bind.v2.runtime.output; - -import java.io.IOException; - -/** - * Buffer for UTF-8 encoded string. - * - * See http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8 for the UTF-8 encoding. - * - * @author Kohsuke Kawaguchi - */ -public final class Encoded { - public byte[] buf; - - public int len; - - public Encoded() {} - - public Encoded(String text) { - set(text); - } - - public void ensureSize(int size) { - if(buf==null || buf.length 0x7F) { - if (chr > 0x7FF) { - if(Character.MIN_HIGH_SURROGATE<=chr && chr<=Character.MAX_LOW_SURROGATE) { - // surrogate - int uc = (((chr & 0x3ff) << 10) | (text.charAt(++i) & 0x3ff)) + 0x10000; - - buf[ptr++] = (byte)(0xF0 | ((uc >> 18))); - buf[ptr++] = (byte)(0x80 | ((uc >> 12) & 0x3F)); - buf[ptr++] = (byte)(0x80 | ((uc >> 6) & 0x3F)); - buf[ptr++] = (byte)(0x80 + (uc & 0x3F)); - continue; - } - buf[ptr++] = (byte)(0xE0 + (chr >> 12)); - buf[ptr++] = (byte)(0x80 + ((chr >> 6) & 0x3F)); - } else { - buf[ptr++] = (byte)(0xC0 + (chr >> 6)); - } - buf[ptr++] = (byte)(0x80 + (chr & 0x3F)); - } else { - buf[ptr++] = (byte)chr; - } - } - - len = ptr; - } - - /** - * Fill in the buffer by encoding the specified characters - * while escaping characters like < - * - * @param isAttribute - * if true, characters like \t, \r, and \n are also escaped. - */ - public final void setEscape(String text, boolean isAttribute) { - int length = text.length(); - ensureSize(length*6+1); // in the worst case the text is like """""", so we need 6 bytes per char - - int ptr = 0; - - for (int i = 0; i < length; i++) { - final char chr = text.charAt(i); - - int ptr1 = ptr; - if (chr > 0x7F) { - if (chr > 0x7FF) { - if(Character.MIN_HIGH_SURROGATE<=chr && chr<=Character.MAX_LOW_SURROGATE) { - // surrogate - int uc = (((chr & 0x3ff) << 10) | (text.charAt(++i) & 0x3ff)) + 0x10000; - - buf[ptr++] = (byte)(0xF0 | ((uc >> 18))); - buf[ptr++] = (byte)(0x80 | ((uc >> 12) & 0x3F)); - buf[ptr++] = (byte)(0x80 | ((uc >> 6) & 0x3F)); - buf[ptr++] = (byte)(0x80 + (uc & 0x3F)); - continue; - } - buf[ptr1++] = (byte)(0xE0 + (chr >> 12)); - buf[ptr1++] = (byte)(0x80 + ((chr >> 6) & 0x3F)); - } else { - buf[ptr1++] = (byte)(0xC0 + (chr >> 6)); - } - buf[ptr1++] = (byte)(0x80 + (chr & 0x3F)); - } else { - byte[] ent; - - if((ent=attributeEntities[chr])!=null) { - // the majority of the case is just printed as a char, - // so it's very important to reject them as quickly as possible - - // check again to see if this really needs to be escaped - if(isAttribute || entities[chr]!=null) - ptr1 = writeEntity(ent,ptr1); - else - buf[ptr1++] = (byte)chr; - } else - buf[ptr1++] = (byte)chr; - } - ptr = ptr1; - } - len = ptr; - } - - private int writeEntity( byte[] entity, int ptr ) { - System.arraycopy(entity,0,buf,ptr,entity.length); - return ptr+entity.length; - } - - /** - * Writes the encoded bytes to the given output stream. - */ - public final void write(UTF8XmlOutput out) throws IOException { - out.write(buf,0,len); - } - - /** - * Appends a new character to the end of the buffer. - * This assumes that you have enough space in the buffer. - */ - public void append(char b) { - buf[len++] = (byte)b; - } - - /** - * Reallocate the buffer to the exact size of the data - * to reduce the memory footprint. - */ - public void compact() { - byte[] b = new byte[len]; - System.arraycopy(buf,0,b,0,len); - buf = b; - } - - /** - * UTF-8 encoded entities keyed by their character code. - * e.g., entities['&'] == AMP_ENTITY. - * - * In attributes we need to encode more characters. - */ - private static final byte[][] entities = new byte[0x80][]; - private static final byte[][] attributeEntities = new byte[0x80][]; - - static { - add('&',"&",false); - add('<',"<",false); - add('>',">",false); - add('"',""",true); - add('\t'," ",true); - add('\r'," ",false); - add('\n'," ",true); - } - - private static void add(char c, String s, boolean attOnly) { - byte[] image = UTF8XmlOutput.toBytes(s); - attributeEntities[c] = image; - if(!attOnly) - entities[c] = image; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/FastInfosetStreamWriterOutput.java 2018-01-30 20:33:37.000000000 -0500 +++ /dev/null 2018-01-30 20:33:37.000000000 -0500 @@ -1,464 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime.output; - -import com.sun.xml.internal.bind.marshaller.NoEscapeHandler; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.stax.StAXDocumentSerializer; -import com.sun.xml.internal.org.jvnet.fastinfoset.VocabularyApplicationData; -import org.xml.sax.SAXException; - -import javax.xml.bind.JAXBContext; -import javax.xml.stream.XMLStreamException; -import java.io.IOException; -import java.util.Collection; -import java.util.Map; -import java.util.WeakHashMap; - -/** - * {@link XmlOutput} for {@link StAXDocumentSerializer}. - *

- * This class is responsible for managing the indexing of elements, attributes - * and local names that are known to JAXB by way of the JAXBContext (generated - * from JAXB beans or schema). The pre-encoded UTF-8 representations of known - * local names are also utilized. - *

- * The lookup of elements, attributes and local names with respect to a context - * is very efficient. It relies on an incrementing base line so that look up is - * performed in O(1) time and only uses static memory. When the base line reaches - * a point where integer overflow will occur the arrays and base line are reset - * (such an event is rare and will have little impact on performance). - *

- * A weak map of JAXB contexts to optimized tables for attributes, elements and - * local names is utilized and stored on the LowLevel StAX serializer. Thus, - * optimized serializing can work other multiple serializing of JAXB beans using - * the same LowLevel StAX serializer instance. This approach works best when JAXB - * contexts are only created once per schema or JAXB beans (which is the recommended - * practice as the creation JAXB contexts are expensive, they are thread safe and - * can be reused). - * - * @author Paul.Sandoz@Sun.Com - */ -public final class FastInfosetStreamWriterOutput extends XMLStreamWriterOutput { - private final StAXDocumentSerializer fiout; - private final Encoded[] localNames; - private final TablesPerJAXBContext tables; - - /** - * Holder for the optimzed element, attribute and - * local name tables. - */ - final static class TablesPerJAXBContext { - final int[] elementIndexes; - final int[] elementIndexPrefixes; - - final int[] attributeIndexes; - final int[] localNameIndexes; - - /** - * The offset of the index - */ - int indexOffset; - - /** - * The the maximum known value of an index - */ - int maxIndex; - - /** - * True if the tables require clearing - */ - boolean requiresClear; - - /** - * Create a new set of tables for a JAXB context. - *

- * @param context the JAXB context. - * @param initialIndexOffset the initial index offset to calculate - * the maximum possible index - * - */ - TablesPerJAXBContext(JAXBContextImpl context, int initialIndexOffset) { - elementIndexes = new int[context.getNumberOfElementNames()]; - elementIndexPrefixes = new int[context.getNumberOfElementNames()]; - attributeIndexes = new int[context.getNumberOfAttributeNames()]; - localNameIndexes = new int[context.getNumberOfLocalNames()]; - - indexOffset = 1; - maxIndex = initialIndexOffset + elementIndexes.length + attributeIndexes.length; - } - - /** - * Require that tables are cleared. - */ - public void requireClearTables() { - requiresClear = true; - } - - /** - * Clear or reset the tables. - *

- * @param intialIndexOffset the initial index offset to calculate - * the maximum possible index - */ - public void clearOrResetTables(int intialIndexOffset) { - if (requiresClear) { - requiresClear = false; - - // Increment offset to new position - indexOffset += maxIndex; - // Reset the maximum known value of an index - maxIndex = intialIndexOffset + elementIndexes.length + attributeIndexes.length; - // Check if there is enough free space - // If overflow - if ((indexOffset + maxIndex) < 0) { - clearAll(); - } - } else { - // Reset the maximum known value of an index - maxIndex = intialIndexOffset + elementIndexes.length + attributeIndexes.length; - // Check if there is enough free space - // If overflow - if ((indexOffset + maxIndex) < 0) { - resetAll(); - } - } - } - - private void clearAll() { - clear(elementIndexes); - clear(attributeIndexes); - clear(localNameIndexes); - indexOffset = 1; - } - - private void clear(int[] array) { - for (int i = 0; i < array.length; i++) { - array[i] = 0; - } - } - - /** - * Increment the maximum know index value - *

- * The indexes are preserved. - */ - public void incrementMaxIndexValue() { - // Increment the maximum value of an index - maxIndex++; - // Check if there is enough free space - // If overflow - if ((indexOffset + maxIndex) < 0) { - resetAll(); - } - } - - private void resetAll() { - clear(elementIndexes); - clear(attributeIndexes); - clear(localNameIndexes); - indexOffset = 1; - } - - private void reset(int[] array) { - for (int i = 0; i < array.length; i++) { - if (array[i] > indexOffset) { - array[i] = array[i] - indexOffset + 1; - } else { - array[i] = 0; - } - } - } - - } - - /** - * Holder of JAXB contexts -> tables. - *

- * An instance will be registered with the - * {@link StAXDocumentSerializer}. - */ - final static class AppData implements VocabularyApplicationData { - final Map contexts = - new WeakHashMap(); - final Collection collectionOfContexts = contexts.values(); - - /** - * Clear all the tables. - */ - public void clear() { - for(TablesPerJAXBContext c : collectionOfContexts) - c.requireClearTables(); - } - } - - public FastInfosetStreamWriterOutput(StAXDocumentSerializer out, - JAXBContextImpl context) { - super(out, NoEscapeHandler.theInstance); - - this.fiout = out; - this.localNames = context.getUTF8NameTable(); - - final VocabularyApplicationData vocabAppData = fiout.getVocabularyApplicationData(); - AppData appData = null; - if (vocabAppData == null || !(vocabAppData instanceof AppData)) { - appData = new AppData(); - fiout.setVocabularyApplicationData(appData); - } else { - appData = (AppData)vocabAppData; - } - - final TablesPerJAXBContext tablesPerContext = appData.contexts.get(context); - if (tablesPerContext != null) { - tables = tablesPerContext; - /** - * Obtain the current local name index. Thus will be used to - * calculate the maximum index value when serializing for this context - */ - tables.clearOrResetTables(out.getLocalNameIndex()); - } else { - tables = new TablesPerJAXBContext(context, out.getLocalNameIndex()); - appData.contexts.put(context, tables); - } - } - - @Override - public void startDocument(XMLSerializer serializer, boolean fragment, - int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) - throws IOException, SAXException, XMLStreamException { - super.startDocument(serializer, fragment, nsUriIndex2prefixIndex, nsContext); - - if (fragment) - fiout.initiateLowLevelWriting(); - } - - @Override - public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException { - super.endDocument(fragment); - } - - @Override - public void beginStartTag(Name name) throws IOException { - fiout.writeLowLevelTerminationAndMark(); - - if (nsContext.getCurrent().count() == 0) { - final int qNameIndex = tables.elementIndexes[name.qNameIndex] - tables.indexOffset; - final int prefixIndex = nsUriIndex2prefixIndex[name.nsUriIndex]; - - if (qNameIndex >= 0 && - tables.elementIndexPrefixes[name.qNameIndex] == prefixIndex) { - fiout.writeLowLevelStartElementIndexed(EncodingConstants.ELEMENT, qNameIndex); - } else { - tables.elementIndexes[name.qNameIndex] = fiout.getNextElementIndex() + tables.indexOffset; - tables.elementIndexPrefixes[name.qNameIndex] = prefixIndex; - writeLiteral(EncodingConstants.ELEMENT | EncodingConstants.ELEMENT_LITERAL_QNAME_FLAG, - name, - nsContext.getPrefix(prefixIndex), - nsContext.getNamespaceURI(prefixIndex)); - } - } else { - beginStartTagWithNamespaces(name); - } - } - - public void beginStartTagWithNamespaces(Name name) throws IOException { - final NamespaceContextImpl.Element nse = nsContext.getCurrent(); - - fiout.writeLowLevelStartNamespaces(); - for (int i = nse.count() - 1; i >= 0; i--) { - final String uri = nse.getNsUri(i); - if (uri.length() == 0 && nse.getBase() == 1) - continue; // no point in definint xmlns='' on the root - fiout.writeLowLevelNamespace(nse.getPrefix(i), uri); - } - fiout.writeLowLevelEndNamespaces(); - - final int qNameIndex = tables.elementIndexes[name.qNameIndex] - tables.indexOffset; - final int prefixIndex = nsUriIndex2prefixIndex[name.nsUriIndex]; - - if (qNameIndex >= 0 && - tables.elementIndexPrefixes[name.qNameIndex] == prefixIndex) { - fiout.writeLowLevelStartElementIndexed(0, qNameIndex); - } else { - tables.elementIndexes[name.qNameIndex] = fiout.getNextElementIndex() + tables.indexOffset; - tables.elementIndexPrefixes[name.qNameIndex] = prefixIndex; - writeLiteral(EncodingConstants.ELEMENT_LITERAL_QNAME_FLAG, - name, - nsContext.getPrefix(prefixIndex), - nsContext.getNamespaceURI(prefixIndex)); - } - } - - @Override - public void attribute(Name name, String value) throws IOException { - fiout.writeLowLevelStartAttributes(); - - final int qNameIndex = tables.attributeIndexes[name.qNameIndex] - tables.indexOffset; - if (qNameIndex >= 0) { - fiout.writeLowLevelAttributeIndexed(qNameIndex); - } else { - tables.attributeIndexes[name.qNameIndex] = fiout.getNextAttributeIndex() + tables.indexOffset; - - final int namespaceURIId = name.nsUriIndex; - if (namespaceURIId == -1) { - writeLiteral(EncodingConstants.ATTRIBUTE_LITERAL_QNAME_FLAG, - name, - "", - ""); - } else { - final int prefix = nsUriIndex2prefixIndex[namespaceURIId]; - writeLiteral(EncodingConstants.ATTRIBUTE_LITERAL_QNAME_FLAG, - name, - nsContext.getPrefix(prefix), - nsContext.getNamespaceURI(prefix)); - } - } - - fiout.writeLowLevelAttributeValue(value); - } - - private void writeLiteral(int type, Name name, String prefix, String namespaceURI) throws IOException { - final int localNameIndex = tables.localNameIndexes[name.localNameIndex] - tables.indexOffset; - - if (localNameIndex < 0) { - tables.localNameIndexes[name.localNameIndex] = fiout.getNextLocalNameIndex() + tables.indexOffset; - - fiout.writeLowLevelStartNameLiteral( - type, - prefix, - localNames[name.localNameIndex].buf, - namespaceURI); - } else { - fiout.writeLowLevelStartNameLiteral( - type, - prefix, - localNameIndex, - namespaceURI); - } - } - - @Override - public void endStartTag() throws IOException { - fiout.writeLowLevelEndStartElement(); - } - - @Override - public void endTag(Name name) throws IOException { - fiout.writeLowLevelEndElement(); - } - - @Override - public void endTag(int prefix, String localName) throws IOException { - fiout.writeLowLevelEndElement(); - } - - - @Override - public void text(Pcdata value, boolean needsSeparatingWhitespace) throws IOException { - if (needsSeparatingWhitespace) - fiout.writeLowLevelText(" "); - - /* - * Check if the CharSequence is from a base64Binary data type - */ - if (!(value instanceof Base64Data)) { - final int len = value.length(); - if(len 0) { - final NamespaceContextImpl.Element nse = nsContext.getCurrent(); - - fiout.writeLowLevelStartNamespaces(); - for (int i = nse.count() - 1; i >= 0; i--) { - final String uri = nse.getNsUri(i); - if (uri.length() == 0 && nse.getBase() == 1) - continue; // no point in definint xmlns='' on the root - fiout.writeLowLevelNamespace(nse.getPrefix(i), uri); - } - fiout.writeLowLevelEndNamespaces(); - - type= 0; - } - - final boolean isIndexed = fiout.writeLowLevelStartElement( - type, - nsContext.getPrefix(prefix), - localName, - nsContext.getNamespaceURI(prefix)); - - if (!isIndexed) - tables.incrementMaxIndexValue(); - } - - @Override - public void attribute(int prefix, String localName, String value) throws IOException { - fiout.writeLowLevelStartAttributes(); - - boolean isIndexed; - if (prefix == -1) - isIndexed = fiout.writeLowLevelAttribute("", "", localName); - else - isIndexed = fiout.writeLowLevelAttribute( - nsContext.getPrefix(prefix), - nsContext.getNamespaceURI(prefix), - localName); - - if (!isIndexed) - tables.incrementMaxIndexValue(); - - fiout.writeLowLevelAttributeValue(value); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/ForkXmlOutput.java 2018-01-30 20:33:38.000000000 -0500 +++ /dev/null 2018-01-30 20:33:38.000000000 -0500 @@ -1,109 +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.xml.internal.bind.v2.runtime.output; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.Name; - -import org.xml.sax.SAXException; - -/** - * {@link XmlOutput} that writes to two {@link XmlOutput}s. - * @author Kohsuke Kawaguchi - */ -public final class ForkXmlOutput extends XmlOutputAbstractImpl { - private final XmlOutput lhs; - private final XmlOutput rhs; - - public ForkXmlOutput(XmlOutput lhs, XmlOutput rhs) { - this.lhs = lhs; - this.rhs = rhs; - } - - @Override - public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws IOException, SAXException, XMLStreamException { - lhs.startDocument(serializer, fragment, nsUriIndex2prefixIndex, nsContext); - rhs.startDocument(serializer, fragment, nsUriIndex2prefixIndex, nsContext); - } - - @Override - public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException { - lhs.endDocument(fragment); - rhs.endDocument(fragment); - } - - @Override - public void beginStartTag(Name name) throws IOException, XMLStreamException { - lhs.beginStartTag(name); - rhs.beginStartTag(name); - } - - @Override - public void attribute(Name name, String value) throws IOException, XMLStreamException { - lhs.attribute(name, value); - rhs.attribute(name, value); - } - - @Override - public void endTag(Name name) throws IOException, SAXException, XMLStreamException { - lhs.endTag(name); - rhs.endTag(name); - } - - public void beginStartTag(int prefix, String localName) throws IOException, XMLStreamException { - lhs.beginStartTag(prefix,localName); - rhs.beginStartTag(prefix,localName); - } - - public void attribute(int prefix, String localName, String value) throws IOException, XMLStreamException { - lhs.attribute(prefix,localName,value); - rhs.attribute(prefix,localName,value); - } - - public void endStartTag() throws IOException, SAXException { - lhs.endStartTag(); - rhs.endStartTag(); - } - - public void endTag(int prefix, String localName) throws IOException, SAXException, XMLStreamException { - lhs.endTag(prefix,localName); - rhs.endTag(prefix,localName); - } - - public void text(String value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException { - lhs.text(value,needsSeparatingWhitespace); - rhs.text(value,needsSeparatingWhitespace); - } - - public void text(Pcdata value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException { - lhs.text(value,needsSeparatingWhitespace); - rhs.text(value,needsSeparatingWhitespace); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/IndentingUTF8XmlOutput.java 2018-01-30 20:33:39.000000000 -0500 +++ /dev/null 2018-01-30 20:33:39.000000000 -0500 @@ -1,156 +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.xml.internal.bind.v2.runtime.output; - -import com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler; -import java.io.IOException; -import java.io.OutputStream; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.v2.runtime.Name; - -import org.xml.sax.SAXException; - -/** - * {@link UTF8XmlOutput} with indentation. - * - * TODO: not sure if it's a good idea to move the indenting functionality to another class. - * - * Doesn't have to be final, but it helps the JVM. - * - * @author Kohsuke Kawaguchi - */ -public final class IndentingUTF8XmlOutput extends UTF8XmlOutput { - - /** - * Null if the writer should perform no indentation. - * - * Otherwise this will keep the 8 copies of the string for indentation. - * (so that we can write 8 indentation at once.) - */ - private final Encoded indent8; - - /** - * Length of one indentation. - */ - private final int unitLen; - - private int depth = 0; - - private boolean seenText = false; - - /** - * - * @param indentStr - * set to null for no indentation and optimal performance. - * otherwise the string is used for indentation. - */ - public IndentingUTF8XmlOutput(OutputStream out, String indentStr, Encoded[] localNames, CharacterEscapeHandler escapeHandler) { - super(out, localNames, escapeHandler); - - if(indentStr!=null) { - Encoded e = new Encoded(indentStr); - indent8 = new Encoded(); - indent8.ensureSize(e.len*8); - unitLen = e.len; - for( int i=0; i<8; i++ ) - System.arraycopy(e.buf, 0, indent8.buf, unitLen*i, unitLen); - } else { - this.indent8 = null; - this.unitLen = 0; - } - } - - @Override - public void beginStartTag(int prefix, String localName) throws IOException { - indentStartTag(); - super.beginStartTag(prefix, localName); - } - - @Override - public void beginStartTag(Name name) throws IOException { - indentStartTag(); - super.beginStartTag(name); - } - - private void indentStartTag() throws IOException { - closeStartTag(); - if(!seenText) - printIndent(); - depth++; - seenText = false; - } - - @Override - public void endTag(Name name) throws IOException { - indentEndTag(); - super.endTag(name); - } - - @Override - public void endTag(int prefix, String localName) throws IOException { - indentEndTag(); - super.endTag(prefix, localName); - } - - private void indentEndTag() throws IOException { - depth--; - if(!closeStartTagPending && !seenText) - printIndent(); - seenText = false; - } - - private void printIndent() throws IOException { - write('\n'); - int i = depth%8; - - write( indent8.buf, 0, i*unitLen ); - - i>>=3; // really i /= 8; - - for( ; i>0; i-- ) - indent8.write(this); - } - - @Override - public void text(String value, boolean needSP) throws IOException { - seenText = true; - super.text(value, needSP); - } - - @Override - public void text(Pcdata value, boolean needSP) throws IOException { - seenText = true; - super.text(value, needSP); - } - - @Override - public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException { - write('\n'); - super.endDocument(fragment); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/MTOMXmlOutput.java 2018-01-30 20:33:39.000000000 -0500 +++ /dev/null 2018-01-30 20:33:39.000000000 -0500 @@ -1,129 +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.xml.internal.bind.v2.runtime.output; - -import java.io.IOException; - -import javax.xml.bind.attachment.AttachmentMarshaller; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; - -import org.xml.sax.SAXException; - -/** - * {@link XmlOutput} decorator that supports MTOM. - * - * @author Kohsuke Kawaguchi - */ -public final class MTOMXmlOutput extends XmlOutputAbstractImpl { - - private final XmlOutput next; - - /** - * Remembers the last namespace URI and local name so that we can pass them to - * {@link AttachmentMarshaller}. - */ - private String nsUri,localName; - - public MTOMXmlOutput(XmlOutput next) { - this.next = next; - } - - public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws IOException, SAXException, XMLStreamException { - super.startDocument(serializer,fragment,nsUriIndex2prefixIndex, nsContext); - next.startDocument(serializer, fragment, nsUriIndex2prefixIndex, nsContext); - } - - public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException { - next.endDocument(fragment); - super.endDocument(fragment); - } - - public void beginStartTag(Name name) throws IOException, XMLStreamException { - next.beginStartTag(name); - this.nsUri = name.nsUri; - this.localName = name.localName; - } - - public void beginStartTag(int prefix, String localName) throws IOException, XMLStreamException { - next.beginStartTag(prefix, localName); - this.nsUri = nsContext.getNamespaceURI(prefix); - this.localName = localName; - } - - public void attribute( Name name, String value ) throws IOException, XMLStreamException { - next.attribute(name, value); - } - - public void attribute( int prefix, String localName, String value ) throws IOException, XMLStreamException { - next.attribute(prefix, localName, value); - } - - public void endStartTag() throws IOException, SAXException { - next.endStartTag(); - } - - public void endTag(Name name) throws IOException, SAXException, XMLStreamException { - next.endTag(name); - } - - public void endTag(int prefix, String localName) throws IOException, SAXException, XMLStreamException { - next.endTag(prefix, localName); - } - - public void text( String value, boolean needsSeparatingWhitespace ) throws IOException, SAXException, XMLStreamException { - next.text(value,needsSeparatingWhitespace); - } - - public void text( Pcdata value, boolean needsSeparatingWhitespace ) throws IOException, SAXException, XMLStreamException { - if(value instanceof Base64Data && !serializer.getInlineBinaryFlag()) { - Base64Data b64d = (Base64Data) value; - String cid; - if(b64d.hasData()) - cid = serializer.attachmentMarshaller.addMtomAttachment( - b64d.get(),0,b64d.getDataLen(),b64d.getMimeType(),nsUri,localName); - else - cid = serializer.attachmentMarshaller.addMtomAttachment( - b64d.getDataHandler(),nsUri,localName); - - if(cid!=null) { - nsContext.getCurrent().push(); - int prefix = nsContext.declareNsUri(WellKnownNamespace.XOP,"xop",false); - beginStartTag(prefix,"Include"); - attribute(-1,"href",cid); - endStartTag(); - endTag(prefix,"Include"); - nsContext.getCurrent().pop(); - return; - } - } - next.text(value, needsSeparatingWhitespace); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/NamespaceContextImpl.java 2018-01-30 20:33:40.000000000 -0500 +++ /dev/null 2018-01-30 20:33:40.000000000 -0500 @@ -1,559 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.runtime.output; - -import java.io.IOException; -import java.util.Collections; -import java.util.Iterator; - -import javax.xml.XMLConstants; -import javax.xml.stream.XMLStreamException; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; -import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.NamespaceContext2; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.SAXException; - -/** - * Keeps track of in-scope namespace bindings for the marshaller. - * - *

- * This class is also used to keep track of tag names for each element - * for the marshaller (for the performance reason.) - * - * @author Kohsuke Kawaguchi - */ -public final class NamespaceContextImpl implements NamespaceContext2 { - private final XMLSerializer owner; - - private String[] prefixes = new String[4]; - private String[] nsUris = new String[4]; -// /** -// * True if the correponding namespace declaration is an authentic one that should be printed. -// * -// * False if it's a re-discovered in-scope namespace binding available at the ancestor elements -// * outside this marhsalling. The false value is used to incorporate the in-scope namespace binding -// * information from {@link #inscopeNamespaceContext}. When false, such a declaration does not need -// * to be printed, as it's already available in ancestors. -// */ -// private boolean[] visible = new boolean[4]; -// -// /** -// * {@link NamespaceContext} that informs this {@link XMLSerializer} about the -// * in-scope namespace bindings of the ancestor elements outside this marshalling. -// * -// *

-// * This is used when the marshaller is marshalling into a subtree that has ancestor -// * elements created outside the JAXB marshaller. -// * -// * Its {@link NamespaceContext#getPrefix(String)} is used to discover in-scope namespace -// * binding, -// */ -// private final NamespaceContext inscopeNamespaceContext; - - /** - * Number of URIs declared. Identifies the valid portion of - * the {@link #prefixes} and {@link #nsUris} arrays. - */ - private int size; - - private Element current; - - /** - * This is the {@link Element} whose prev==null. - * This element is used to hold the contextual namespace bindings - * that are assumed to be outside of the document we are marshalling. - * Specifically the xml prefix and any other user-specified bindings. - * - * @see NamespacePrefixMapper#getPreDeclaredNamespaceUris() - */ - private final Element top; - - /** - * Never null. - */ - private NamespacePrefixMapper prefixMapper = defaultNamespacePrefixMapper; - - /** - * True to allow new URIs to be declared. False otherwise. - */ - public boolean collectionMode; - - - public NamespaceContextImpl(XMLSerializer owner) { - this.owner = owner; - - current = top = new Element(this,null); - // register namespace URIs that are implicitly bound - put(XMLConstants.XML_NS_URI,XMLConstants.XML_NS_PREFIX); - } - - public void setPrefixMapper( NamespacePrefixMapper mapper ) { - if(mapper==null) - mapper = defaultNamespacePrefixMapper; - this.prefixMapper = mapper; - } - - public NamespacePrefixMapper getPrefixMapper() { - return prefixMapper; - } - - public void reset() { - current = top; - size = 1; - collectionMode = false; - } - - /** - * Returns the prefix index to the specified URI. - * This method allocates a new URI if necessary. - */ - public int declareNsUri( String uri, String preferedPrefix, boolean requirePrefix ) { - preferedPrefix = prefixMapper.getPreferredPrefix(uri,preferedPrefix,requirePrefix); - - if(uri.length()==0) { - for( int i=size-1; i>=0; i-- ) { - if(nsUris[i].length()==0) - return i; // already declared - if(prefixes[i].length()==0) { - // the default prefix is already taken. - // move that URI to another prefix, then assign "" to the default prefix. - assert current.defaultPrefixIndex==-1 && current.oldDefaultNamespaceUriIndex==-1; - - String oldUri = nsUris[i]; - String[] knownURIs = owner.nameList.namespaceURIs; - - if(current.baseIndex<=i) { - // this default prefix is declared in this context. just reassign it - - nsUris[i] = ""; - - int subst = put(oldUri,null); - - // update uri->prefix table if necessary - for( int j=knownURIs.length-1; j>=0; j-- ) { - if(knownURIs[j].equals(oldUri)) { - owner.knownUri2prefixIndexMap[j] = subst; - break; - } - } - if (current.elementLocalName != null) { - current.setTagName(subst, current.elementLocalName, current.getOuterPeer()); - } - return i; - } else { - // first, if the previous URI assigned to "" is - // a "known URI", remember what we've reallocated - // so that we can fix it when this context pops. - for( int j=knownURIs.length-1; j>=0; j-- ) { - if(knownURIs[j].equals(oldUri)) { - current.defaultPrefixIndex = i; - current.oldDefaultNamespaceUriIndex = j; - // assert commented out; too strict/not valid any more - // assert owner.knownUri2prefixIndexMap[j]==current.defaultPrefixIndex; - // update the table to point to the prefix we'll declare - owner.knownUri2prefixIndexMap[j] = size; - break; - } - } - if (current.elementLocalName!=null) { - current.setTagName(size, current.elementLocalName, current.getOuterPeer()); - } - - put(nsUris[i],null); - return put("", ""); - } - } - } - - // "" isn't in use - return put("", ""); - } else { - // check for the existing binding - for( int i=size-1; i>=0; i-- ) { - String p = prefixes[i]; - if(nsUris[i].equals(uri)) { - if (!requirePrefix || p.length()>0) - return i; - // declared but this URI is bound to empty. Look further - } - if(p.equals(preferedPrefix)) { - // the suggested prefix is already taken. can't use it - preferedPrefix = null; - } - } - - if(preferedPrefix==null && requirePrefix) - // we know we can't bind to "", but we don't have any possible name at hand. - // generate it here to avoid this namespace to be bound to "". - preferedPrefix = makeUniquePrefix(); - - // haven't been declared. allocate a new one - // if the preferred prefix is already in use, it should have been set to null by this time - return put(uri, preferedPrefix); - } - } - - public int force(@NotNull String uri, @NotNull String prefix) { - // check for the existing binding - - for( int i=size-1; i>=0; i-- ) { - if(prefixes[i].equals(prefix)) { - if(nsUris[i].equals(uri)) - return i; // found duplicate - else - // the prefix is used for another namespace. we need to declare it - break; - } - } - - return put(uri, prefix); - } - - /** - * Puts this new binding into the declared prefixes list - * without doing any duplicate check. - * - * This can be used to forcibly set namespace declarations. - * - *

- * Most of the time {@link #declareNamespace(String, String, boolean)} shall be used. - * - * @return - * the index of this new binding. - */ - public int put(@NotNull String uri, @Nullable String prefix) { - if(size==nsUris.length) { - // reallocate - String[] u = new String[nsUris.length*2]; - String[] p = new String[prefixes.length*2]; - System.arraycopy(nsUris,0,u,0,nsUris.length); - System.arraycopy(prefixes,0,p,0,prefixes.length); - nsUris = u; - prefixes = p; - } - if(prefix==null) { - if(size==1) - prefix = ""; // if this is the first user namespace URI we see, use "". - else { - // otherwise make up an unique name - prefix = makeUniquePrefix(); - } - } - nsUris[size] = uri; - prefixes[size] = prefix; - - return size++; - } - - private String makeUniquePrefix() { - String prefix; - prefix = new StringBuilder(5).append("ns").append(size).toString(); - while(getNamespaceURI(prefix)!=null) { - prefix += '_'; // under a rare circumstance there might be existing 'nsNNN', so rename them - } - return prefix; - } - - - public Element getCurrent() { - return current; - } - - /** - * Returns the prefix index of the specified URI. - * It is an error if the URI is not declared. - */ - public int getPrefixIndex( String uri ) { - for( int i=size-1; i>=0; i-- ) { - if(nsUris[i].equals(uri)) - return i; - } - throw new IllegalStateException(); - } - - /** - * Gets the prefix from a prefix index. - * - * The behavior is undefined if the index is out of range. - */ - public String getPrefix(int prefixIndex) { - return prefixes[prefixIndex]; - } - - public String getNamespaceURI(int prefixIndex) { - return nsUris[prefixIndex]; - } - - /** - * Gets the namespace URI that is bound to the specified prefix. - * - * @return null - * if the prefix is unbound. - */ - public String getNamespaceURI(String prefix) { - for( int i=size-1; i>=0; i-- ) - if(prefixes[i].equals(prefix)) - return nsUris[i]; - return null; - } - - /** - * Returns the prefix of the specified URI, - * or null if none exists. - */ - public String getPrefix( String uri ) { - if(collectionMode) { - return declareNamespace(uri,null,false); - } else { - for( int i=size-1; i>=0; i-- ) - if(nsUris[i].equals(uri)) - return prefixes[i]; - return null; - } - } - - public Iterator getPrefixes(String uri) { - String prefix = getPrefix(uri); - if(prefix==null) - return Collections.emptySet().iterator(); - else - return Collections.singleton(uri).iterator(); - } - - public String declareNamespace(String namespaceUri, String preferedPrefix, boolean requirePrefix) { - int idx = declareNsUri(namespaceUri,preferedPrefix,requirePrefix); - return getPrefix(idx); - } - - /** - * Number of total bindings declared. - */ - public int count() { - return size; - } - - - /** - * This model of namespace declarations maintain the following invariants. - * - *

    - *
  • If a non-empty prefix is declared, it will never be reassigned to different namespace URIs.
  • - *
- */ - public final class Element { - - public final NamespaceContextImpl context; - - /** - * {@link Element}s form a doubly-linked list. - */ - private final Element prev; - private Element next; - - private int oldDefaultNamespaceUriIndex; - private int defaultPrefixIndex; - - - /** - * The numbe of prefixes declared by ancestor {@link Element}s. - */ - private int baseIndex; - - /** - * The depth of the {@link Element}. - * - * This value is equivalent as the result of the following computation. - * - *
-         * int depth() {
-         *   int i=-1;
-         *   for(Element e=this; e!=null;e=e.prev)
-         *     i++;
-         *   return i;
-         * }
-         * 
- */ - private final int depth; - - - - private int elementNamePrefix; - private String elementLocalName; - - /** - * Tag name of this element. - * Either this field is used or the {@link #elementNamePrefix} and {@link #elementLocalName} pair. - */ - private Name elementName; - - /** - * Used for the binder. The JAXB object that corresponds to this element. - */ - private Object outerPeer; - private Object innerPeer; - - - private Element(NamespaceContextImpl context,Element prev) { - this.context = context; - this.prev = prev; - this.depth = (prev==null) ? 0 : prev.depth+1; - } - - /** - * Returns true if this {@link Element} represents the root element that - * we are marshalling. - */ - public boolean isRootElement() { - return depth==1; - } - - public Element push() { - if(next==null) - next = new Element(context,this); - next.onPushed(); - return next; - } - - public Element pop() { - if(oldDefaultNamespaceUriIndex>=0) { - // restore the old default namespace URI binding - context.owner.knownUri2prefixIndexMap[oldDefaultNamespaceUriIndex] = defaultPrefixIndex; - } - context.size = baseIndex; - context.current = prev; - // release references to user objects - outerPeer = innerPeer = null; - return prev; - } - - private void onPushed() { - oldDefaultNamespaceUriIndex = defaultPrefixIndex = -1; - baseIndex = context.size; - context.current = this; - } - - public void setTagName( int prefix, String localName, Object outerPeer ) { - assert localName!=null; - this.elementNamePrefix = prefix; - this.elementLocalName = localName; - this.elementName = null; - this.outerPeer = outerPeer; - } - - public void setTagName( Name tagName, Object outerPeer ) { - assert tagName!=null; - this.elementName = tagName; - this.outerPeer = outerPeer; - } - - public void startElement(XmlOutput out, Object innerPeer) throws IOException, XMLStreamException { - this.innerPeer = innerPeer; - if(elementName!=null) { - out.beginStartTag(elementName); - } else { - out.beginStartTag(elementNamePrefix,elementLocalName); - } - } - - public void endElement(XmlOutput out) throws IOException, SAXException, XMLStreamException { - if(elementName!=null) { - out.endTag(elementName); - elementName = null; - } else { - out.endTag(elementNamePrefix,elementLocalName); - } - } - - /** - * Gets the number of bindings declared on this element. - */ - public final int count() { - return context.size-baseIndex; - } - - /** - * Gets the prefix declared in this context. - * - * @param idx - * between 0 and {@link #count()} - */ - public final String getPrefix(int idx) { - return context.prefixes[baseIndex+idx]; - } - - /** - * Gets the namespace URI declared in this context. - * - * @param idx - * between 0 and {@link #count()} - */ - public final String getNsUri(int idx) { - return context.nsUris[baseIndex+idx]; - } - - public int getBase() { - return baseIndex; - } - - public Object getOuterPeer() { - return outerPeer; - } - - public Object getInnerPeer() { - return innerPeer; - } - - /** - * Gets the parent {@link Element}. - */ - public Element getParent() { - return prev; - } - } - - - /** - * Default {@link NamespacePrefixMapper} implementation used when - * it is not specified by the user. - */ - private static final NamespacePrefixMapper defaultNamespacePrefixMapper = new NamespacePrefixMapper() { - public String getPreferredPrefix(String namespaceUri, String suggestion, boolean requirePrefix) { - if( namespaceUri.equals(WellKnownNamespace.XML_SCHEMA_INSTANCE) ) - return "xsi"; - if( namespaceUri.equals(WellKnownNamespace.XML_SCHEMA) ) - return "xs"; - if( namespaceUri.equals(WellKnownNamespace.XML_MIME_URI) ) - return "xmime"; - return suggestion; - } - }; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/Pcdata.java 2018-01-30 20:33:41.000000000 -0500 +++ /dev/null 2018-01-30 20:33:41.000000000 -0500 @@ -1,75 +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.xml.internal.bind.v2.runtime.output; - -import java.io.IOException; - -/** - * Text data in XML. - * - *

- * This class is used inside the marshaller/unmarshaller to - * send/receive text data. - * - *

- * On top of {@link CharSequence}, this class has an - * ability to write itself to the {@link XmlOutput}. This allows - * the implementation to choose the most efficient way possible - * when writing to XML (for example, it can skip the escaping - * of buffer copying.) - * - * TODO: visitor pattern support? - * - * @author Kohsuke Kawaguchi - */ -public abstract class Pcdata implements CharSequence { - - /** - * Writes itself to {@link UTF8XmlOutput}. - * - *

- * This is the most performance critical path for the marshaller, - * so it warrants its own method. - */ - public abstract void writeTo(UTF8XmlOutput output) throws IOException; - - /** - * Writes itself to the character array. - * - *

- * This method is used by most other {@link XmlOutput}. - * The default implementation involves in one extra char[] copying. - * - *

- * The caller must provide a big enough buffer that can hold - * enough characters returned by the {@link #length()} method. - */ - public void writeTo(char[] buf, int start) { - toString().getChars(0,length(),buf,start); - } - - public abstract String toString(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/SAXOutput.java 2018-01-30 20:33:41.000000000 -0500 +++ /dev/null 2018-01-30 20:33:41.000000000 -0500 @@ -1,173 +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.xml.internal.bind.v2.runtime.output; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.util.AttributesImpl; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.LocatorImpl; - -/** - * {@link XmlOutput} implementation that writes to SAX {@link ContentHandler}. - * - * @author Kohsuke Kawaguchi - */ -public class SAXOutput extends XmlOutputAbstractImpl { - protected final ContentHandler out; - - public SAXOutput(ContentHandler out) { - this.out = out; - out.setDocumentLocator(new LocatorImpl()); - } - - private String elementNsUri,elementLocalName,elementQName; - - private char[] buf = new char[256]; - - private final AttributesImpl atts = new AttributesImpl(); - - - // not called if we are generating fragments - @Override - public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws SAXException, IOException, XMLStreamException { - super.startDocument(serializer, fragment,nsUriIndex2prefixIndex,nsContext); - if(!fragment) - out.startDocument(); - } - - public void endDocument(boolean fragment) throws SAXException, IOException, XMLStreamException { - if(!fragment) - out.endDocument(); - super.endDocument(fragment); - } - - public void beginStartTag(int prefix, String localName) { - elementNsUri = nsContext.getNamespaceURI(prefix); - elementLocalName = localName; - elementQName = getQName(prefix,localName); - atts.clear(); - } - - public void attribute(int prefix, String localName, String value) { - String qname; - String nsUri; - if(prefix==-1) { - nsUri = ""; - qname = localName; - } else { - nsUri = nsContext.getNamespaceURI(prefix); - String p = nsContext.getPrefix(prefix); - if(p.length()==0) - // this is more likely a bug in the application code (NamespacePrefixMapper implementation) - // this only happens when it tries to assign "" prefix to a non-"" URI, - // which is by itself violation of namespace rec. But let's just be safe. - // See http://forums.java.net/jive/thread.jspa?messageID=212598#212598 - qname = localName; - else - qname = p +':'+localName; - } - atts.addAttribute( nsUri, localName, qname, "CDATA", value ); - } - - public void endStartTag() throws SAXException { - NamespaceContextImpl.Element ns = nsContext.getCurrent(); - if(ns!=null) { - int sz = ns.count(); - for( int i=0; i=0; i-- ) { - String p = ns.getPrefix(i); - String uri = ns.getNsUri(i); - if(uri.length()==0 && ns.getBase()==1) - continue; // no point in definint xmlns='' on the root - out.endPrefixMapping(p); - } - } - } - - private String getQName(int prefix, String localName) { - String qname; - String p = nsContext.getPrefix(prefix); - if(p.length()==0) - qname = localName; - else - qname = p+':'+localName; - return qname; - } - - public void text(String value, boolean needsSP) throws IOException, SAXException, XMLStreamException { - int vlen = value.length(); - if(buf.length<=vlen) { - buf = new char[Math.max(buf.length*2,vlen+1)]; - } - if(needsSP) { - value.getChars(0,vlen,buf,1); - buf[0] = ' '; - } else { - value.getChars(0,vlen,buf,0); - } - out.characters(buf,0,vlen+(needsSP?1:0)); - } - - public void text(Pcdata value, boolean needsSP) throws IOException, SAXException, XMLStreamException { - int vlen = value.length(); - if(buf.length<=vlen) { - buf = new char[Math.max(buf.length*2,vlen+1)]; - } - if(needsSP) { - value.writeTo(buf,1); - buf[0] = ' '; - } else { - value.writeTo(buf,0); - } - out.characters(buf,0,vlen+(needsSP?1:0)); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/SecureLoader.java 2018-01-30 20:33:42.000000000 -0500 +++ /dev/null 2018-01-30 20:33:42.000000000 -0500 @@ -1,75 +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.xml.internal.bind.v2.runtime.output; - -/** - * Class defined for safe calls of getClassLoader methods of any kind (context/system/class - * classloader. This MUST be package private and defined in every package which - * uses such invocations. - * @author snajper - */ -class SecureLoader { - - static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - - static ClassLoader getClassClassLoader(final Class c) { - if (System.getSecurityManager() == null) { - return c.getClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return c.getClassLoader(); - } - }); - } - } - - static ClassLoader getSystemClassLoader() { - if (System.getSecurityManager() == null) { - return ClassLoader.getSystemClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return ClassLoader.getSystemClassLoader(); - } - }); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/StAXExStreamWriterOutput.java 2018-01-30 20:33:43.000000000 -0500 +++ /dev/null 2018-01-30 20:33:43.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime.output; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.marshaller.NoEscapeHandler; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; - -import com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx; - -/** - * {@link XmlOutput} for {@link XMLStreamWriterEx}. - * - * @author Paul Sandoz. - */ -public final class StAXExStreamWriterOutput extends XMLStreamWriterOutput { - private final XMLStreamWriterEx out; - - public StAXExStreamWriterOutput(XMLStreamWriterEx out) { - super(out, NoEscapeHandler.theInstance); - this.out = out; - } - - public void text(Pcdata value, boolean needsSeparatingWhitespace) throws XMLStreamException { - if(needsSeparatingWhitespace) { - out.writeCharacters(" "); - } - - if (!(value instanceof Base64Data)) { - out.writeCharacters(value.toString()); - } else { - Base64Data v = (Base64Data)value; - out.writeBinary(v.getDataHandler()); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/UTF8XmlOutput.java 2018-01-30 20:33:43.000000000 -0500 +++ /dev/null 2018-01-30 20:33:43.000000000 -0500 @@ -1,433 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.runtime.output; - -import java.io.IOException; -import java.io.OutputStream; - -import java.io.StringWriter; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.MarshallerImpl; - -import org.xml.sax.SAXException; - -/** - * {@link XmlOutput} implementation specialized for UTF-8. - * - * @author Kohsuke Kawaguchi - * @author Paul Sandoz - */ -public class UTF8XmlOutput extends XmlOutputAbstractImpl { - protected final OutputStream out; - - /** prefixes encoded. */ - private Encoded[] prefixes = new Encoded[8]; - - /** - * Of the {@link #prefixes}, number of filled entries. - * This is almost the same as {@link NamespaceContextImpl#count()}, - * except that it allows us to handle contextual in-scope namespace bindings correctly. - */ - private int prefixCount; - - /** local names encoded in UTF-8. All entries are pre-filled. */ - private final Encoded[] localNames; - - /** Temporary buffer used to encode text. */ - /* - * TODO - * The textBuffer could write directly to the _octetBuffer - * when encoding a string if Encoder is modified. - * This will avoid an additional memory copy. - */ - private final Encoded textBuffer = new Encoded(); - - /** Buffer of octets for writing. */ - // TODO: Obtain buffer size from property on the JAXB context - protected final byte[] octetBuffer = new byte[1024]; - - /** Index in buffer to write to. */ - protected int octetBufferIndex; - - /** - * Set to true to indicate that we need to write {@code '>'} - * to close a start tag. Deferring the write of this char - * allows us to write {@code "/>"} for empty elements. - */ - protected boolean closeStartTagPending = false; - - /** - * @see MarshallerImpl#header - */ - private String header; - - private CharacterEscapeHandler escapeHandler = null; - - /** - * - * @param localNames - * local names encoded in UTF-8. - */ - public UTF8XmlOutput(OutputStream out, Encoded[] localNames, CharacterEscapeHandler escapeHandler) { - this.out = out; - this.localNames = localNames; - for( int i=0; i'} to close the start tag, if necessary. - */ - protected final void closeStartTag() throws IOException { - if(closeStartTagPending) { - write('>'); - closeStartTagPending = false; - } - } - - public void beginStartTag(int prefix, String localName) throws IOException { - closeStartTag(); - int base= pushNsDecls(); - write('<'); - writeName(prefix,localName); - writeNsDecls(base); - } - - @Override - public void beginStartTag(Name name) throws IOException { - closeStartTag(); - int base = pushNsDecls(); - write('<'); - writeName(name); - writeNsDecls(base); - } - - private int pushNsDecls() { - int total = nsContext.count(); - NamespaceContextImpl.Element ns = nsContext.getCurrent(); - - if(total > prefixes.length) { - // reallocate - int m = Math.max(total,prefixes.length*2); - Encoded[] buf = new Encoded[m]; - System.arraycopy(prefixes,0,buf,0,prefixes.length); - for( int i=prefixes.length; i'); - } - } - - public void endTag(int prefix, String localName) throws IOException { - if(closeStartTagPending) { - write(EMPTY_TAG); - closeStartTagPending = false; - } else { - write(CLOSE_TAG); - writeName(prefix,localName); - write('>'); - } - } - - public void text(String value, boolean needSP) throws IOException { - closeStartTag(); - if(needSP) - write(' '); - doText(value,false); - } - - public void text(Pcdata value, boolean needSP) throws IOException { - closeStartTag(); - if(needSP) - write(' '); - value.writeTo(this); - } - - private void doText(String value,boolean isAttribute) throws IOException { - if (escapeHandler != null) { - StringWriter sw = new StringWriter(); - escapeHandler.escape(value.toCharArray(), 0, value.length(), isAttribute, sw); - textBuffer.set(sw.toString()); - } else { - textBuffer.setEscape(value, isAttribute); - } - textBuffer.write(this); - } - - public final void text(int value) throws IOException { - closeStartTag(); - /* - * TODO - * Change to use the octet buffer directly - */ - - // max is -2147483648 and 11 digits - boolean minus = (value<0); - textBuffer.ensureSize(11); - byte[] buf = textBuffer.buf; - int idx = 11; - - do { - int r = value%10; - if(r<0) r = -r; - buf[--idx] = (byte)('0'|r); // really measn 0x30+r but 0<=r<10, so bit-OR would do. - value /= 10; - } while(value!=0); - - if(minus) buf[--idx] = (byte)'-'; - - write(buf,idx,11-idx); - } - - /** - * Writes the given byte[] as base64 encoded binary to the output. - * - *

- * Being defined on this class allows this method to access the buffer directly, - * which translates to a better performance. - */ - public void text(byte[] data, int dataLen) throws IOException { - closeStartTag(); - - int start = 0; - - while(dataLen>0) { - // how many bytes (in data) can we write without overflowing the buffer? - int batchSize = Math.min(((octetBuffer.length-octetBufferIndex)/4)*3,dataLen); - - // write the batch - octetBufferIndex = DatatypeConverterImpl._printBase64Binary(data,start,batchSize,octetBuffer,octetBufferIndex); - - if(batchSize - * This method can be used somewhat like the {@code text} method, - * but it doesn't perform character escaping. - */ - public final void write(int i) throws IOException { - if (octetBufferIndex < octetBuffer.length) { - octetBuffer[octetBufferIndex++] = (byte)i; - } else { - out.write(octetBuffer); - octetBufferIndex = 1; - octetBuffer[0] = (byte)i; - } - } - - protected final void write(byte[] b) throws IOException { - write(b, 0, b.length); - } - - protected final void write(byte[] b, int start, int length) throws IOException { - if ((octetBufferIndex + length) < octetBuffer.length) { - System.arraycopy(b, start, octetBuffer, octetBufferIndex, length); - octetBufferIndex += length; - } else { - out.write(octetBuffer, 0, octetBufferIndex); - out.write(b, start, length); - octetBufferIndex = 0; - } - } - - protected final void flushBuffer() throws IOException { - out.write(octetBuffer, 0, octetBufferIndex); - octetBufferIndex = 0; - } - - static byte[] toBytes(String s) { - byte[] buf = new byte[s.length()]; - for( int i=s.length()-1; i>=0; i-- ) - buf[i] = (byte)s.charAt(i); - return buf; - } - - // per instance copy to prevent an attack where malicious OutputStream - // rewrites the byte array. - private final byte[] XMLNS_EQUALS = _XMLNS_EQUALS.clone(); - private final byte[] XMLNS_COLON = _XMLNS_COLON.clone(); - private final byte[] EQUALS = _EQUALS.clone(); - private final byte[] CLOSE_TAG = _CLOSE_TAG.clone(); - private final byte[] EMPTY_TAG = _EMPTY_TAG.clone(); - private final byte[] XML_DECL = _XML_DECL.clone(); - - // masters - private static final byte[] _XMLNS_EQUALS = toBytes(" xmlns=\""); - private static final byte[] _XMLNS_COLON = toBytes(" xmlns:"); - private static final byte[] _EQUALS = toBytes("=\""); - private static final byte[] _CLOSE_TAG = toBytes(""); - private static final byte[] _XML_DECL = toBytes(""); - - // no need to copy - private static final byte[] EMPTY_BYTE_ARRAY = new byte[0]; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/XMLEventWriterOutput.java 2018-01-30 20:33:44.000000000 -0500 +++ /dev/null 2018-01-30 20:33:44.000000000 -0500 @@ -1,126 +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.xml.internal.bind.v2.runtime.output; - -import java.io.IOException; - -import javax.xml.stream.XMLEventFactory; -import javax.xml.stream.XMLEventWriter; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.events.Attribute; -import javax.xml.stream.events.Characters; - -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.SAXException; - -/** - * {@link XmlOutput} that writes to StAX {@link XMLEventWriter}. - * - * @author Kohsuke Kawaguchi - */ -public class XMLEventWriterOutput extends XmlOutputAbstractImpl { - private final XMLEventWriter out; - private final XMLEventFactory ef; - - /** One whitespace. */ - private final Characters sp; - - public XMLEventWriterOutput(XMLEventWriter out) { - this.out = out; - ef = XMLEventFactory.newInstance(); - sp = ef.createCharacters(" "); - } - - // not called if we are generating fragments - @Override - public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws IOException, SAXException, XMLStreamException { - super.startDocument(serializer, fragment,nsUriIndex2prefixIndex,nsContext); - if(!fragment) - out.add(ef.createStartDocument()); - } - - public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException { - if(!fragment) { - out.add(ef.createEndDocument()); - out.flush(); - } - super.endDocument(fragment); - } - - public void beginStartTag(int prefix, String localName) throws IOException, XMLStreamException { - out.add( - ef.createStartElement( - nsContext.getPrefix(prefix), - nsContext.getNamespaceURI(prefix), - localName)); - - NamespaceContextImpl.Element nse = nsContext.getCurrent(); - if(nse.count()>0) { - for( int i=nse.count()-1; i>=0; i-- ) { - String uri = nse.getNsUri(i); - if(uri.length()==0 && nse.getBase()==1) - continue; // no point in definint xmlns='' on the root - out.add(ef.createNamespace(nse.getPrefix(i),uri)); - } - } - } - - public void attribute(int prefix, String localName, String value) throws IOException, XMLStreamException { - Attribute att; - if(prefix==-1) - att = ef.createAttribute(localName,value); - else - att = ef.createAttribute( - nsContext.getPrefix(prefix), - nsContext.getNamespaceURI(prefix), - localName, value); - - out.add(att); - } - - public void endStartTag() throws IOException, SAXException { - // noop - } - - public void endTag(int prefix, String localName) throws IOException, SAXException, XMLStreamException { - out.add( - ef.createEndElement( - nsContext.getPrefix(prefix), - nsContext.getNamespaceURI(prefix), - localName)); - } - - public void text(String value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException { - if(needsSeparatingWhitespace) - out.add(sp); - out.add(ef.createCharacters(value)); - } - - public void text(Pcdata value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException { - text(value.toString(),needsSeparatingWhitespace); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/XMLStreamWriterOutput.java 2018-01-30 20:33:45.000000000 -0500 +++ /dev/null 2018-01-30 20:33:45.000000000 -0500 @@ -1,297 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime.output; - -import java.io.IOException; -import java.io.Writer; -import java.lang.reflect.Constructor; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -import com.sun.xml.internal.bind.marshaller.CharacterEscapeHandler; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.SAXException; - -/** - * {@link XmlOutput} that writes to StAX {@link XMLStreamWriter}. - *

- * TODO: - * Finding the optimized FI implementations is a bit hacky and not very - * extensible. Can we use the service provider mechanism in general for - * concrete implementations of XmlOutputAbstractImpl. - * - * @author Kohsuke Kawaguchi - */ -public class XMLStreamWriterOutput extends XmlOutputAbstractImpl { - - /** - * Creates a new {@link XmlOutput} from a {@link XMLStreamWriter}. - * This method recognizes an FI StAX writer. - */ - public static XmlOutput create(XMLStreamWriter out, JAXBContextImpl context, CharacterEscapeHandler escapeHandler) { - // try optimized path - final Class writerClass = out.getClass(); - if (writerClass==FI_STAX_WRITER_CLASS) { - try { - return FI_OUTPUT_CTOR.newInstance(out, context); - } catch (Exception e) { - } - } - if (STAXEX_WRITER_CLASS!=null && STAXEX_WRITER_CLASS.isAssignableFrom(writerClass)) { - try { - return STAXEX_OUTPUT_CTOR.newInstance(out); - } catch (Exception e) { - } - } - - CharacterEscapeHandler xmlStreamEscapeHandler = escapeHandler != null ? - escapeHandler : NewLineEscapeHandler.theInstance; - - // otherwise the normal writer. - return new XMLStreamWriterOutput(out, xmlStreamEscapeHandler); - } - - - private final XMLStreamWriter out; - - private final CharacterEscapeHandler escapeHandler; - - private final XmlStreamOutWriterAdapter writerWrapper; - - protected final char[] buf = new char[256]; - - protected XMLStreamWriterOutput(XMLStreamWriter out, CharacterEscapeHandler escapeHandler) { - this.out = out; - this.escapeHandler = escapeHandler; - this.writerWrapper = new XmlStreamOutWriterAdapter(out); - } - - // not called if we are generating fragments - @Override - public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws IOException, SAXException, XMLStreamException { - super.startDocument(serializer, fragment,nsUriIndex2prefixIndex,nsContext); - if(!fragment) - out.writeStartDocument(); - } - - @Override - public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException { - if(!fragment) { - out.writeEndDocument(); - out.flush(); - } - super.endDocument(fragment); - } - - public void beginStartTag(int prefix, String localName) throws IOException, XMLStreamException { - out.writeStartElement( - nsContext.getPrefix(prefix), - localName, - nsContext.getNamespaceURI(prefix)); - - NamespaceContextImpl.Element nse = nsContext.getCurrent(); - if(nse.count()>0) { - for( int i=nse.count()-1; i>=0; i-- ) { - String uri = nse.getNsUri(i); - if(uri.length()==0 && nse.getBase()==1) - continue; // no point in definint xmlns='' on the root - out.writeNamespace(nse.getPrefix(i),uri); - } - } - } - - public void attribute(int prefix, String localName, String value) throws IOException, XMLStreamException { - if(prefix==-1) - out.writeAttribute(localName,value); - else - out.writeAttribute( - nsContext.getPrefix(prefix), - nsContext.getNamespaceURI(prefix), - localName, value); - } - - public void endStartTag() throws IOException, SAXException { - // noop - } - - public void endTag(int prefix, String localName) throws IOException, SAXException, XMLStreamException { - out.writeEndElement(); - } - - public void text(String value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException { - if(needsSeparatingWhitespace) - out.writeCharacters(" "); - escapeHandler.escape(value.toCharArray(), 0, value.length(), false, writerWrapper); - } - - public void text(Pcdata value, boolean needsSeparatingWhitespace) throws IOException, SAXException, XMLStreamException { - if(needsSeparatingWhitespace) - out.writeCharacters(" "); - - int len = value.length(); - if(len FI_OUTPUT_CTOR = initFastInfosetOutputClass(); - - private static Class initFIStAXWriterClass() { - try { - Class llfisw = Class.forName("com.sun.xml.internal.org.jvnet.fastinfoset.stax.LowLevelFastInfosetStreamWriter"); - Class sds = Class.forName("com.sun.xml.internal.fastinfoset.stax.StAXDocumentSerializer"); - // Check if StAXDocumentSerializer implements LowLevelFastInfosetStreamWriter - if (llfisw.isAssignableFrom(sds)) - return sds; - else - return null; - } catch (Throwable e) { - return null; - } - } - - private static Constructor initFastInfosetOutputClass() { - try { - if (FI_STAX_WRITER_CLASS == null) - return null; - Class c = Class.forName("com.sun.xml.internal.bind.v2.runtime.output.FastInfosetStreamWriterOutput"); - return c.getConstructor(FI_STAX_WRITER_CLASS, JAXBContextImpl.class); - } catch (Throwable e) { - return null; - } - } - - // - // StAX-ex - // - private static final Class STAXEX_WRITER_CLASS = initStAXExWriterClass(); - private static final Constructor STAXEX_OUTPUT_CTOR = initStAXExOutputClass(); - - private static Class initStAXExWriterClass() { - try { - return Class.forName("com.sun.xml.internal.org.jvnet.staxex.XMLStreamWriterEx"); - } catch (Throwable e) { - return null; - } - } - - private static Constructor initStAXExOutputClass() { - try { - Class c = Class.forName("com.sun.xml.internal.bind.v2.runtime.output.StAXExStreamWriterOutput"); - return c.getConstructor(STAXEX_WRITER_CLASS); - } catch (Throwable e) { - return null; - } - } - - /** - * Performs character escaping only for new lines. - */ - private static class NewLineEscapeHandler implements CharacterEscapeHandler { - - public static final NewLineEscapeHandler theInstance = new NewLineEscapeHandler(); - - @Override - public void escape(char[] ch, int start, int length, boolean isAttVal, Writer out) throws IOException { - int limit = start+length; - int lastEscaped = start; - for (int i = start; i < limit; i++) { - char c = ch[i]; - if (c == '\r' || c == '\n') { - if (i != lastEscaped) { - out.write(ch, lastEscaped, i - lastEscaped); - } - lastEscaped = i + 1; - if (out instanceof XmlStreamOutWriterAdapter) { - try { - ((XmlStreamOutWriterAdapter)out).writeEntityRef("#x" + Integer.toHexString(c)); - } catch (XMLStreamException e) { - throw new IOException("Error writing xml stream", e); - } - } else { - out.write("&#x"); - out.write(Integer.toHexString(c)); - out.write(';'); - } - } - } - - if (lastEscaped != limit) { - out.write(ch, lastEscaped, length - lastEscaped); - } - } - } - - private static final class XmlStreamOutWriterAdapter extends Writer { - - private final XMLStreamWriter writer; - - private XmlStreamOutWriterAdapter(XMLStreamWriter writer) { - this.writer = writer; - } - - @Override - public void write(char[] cbuf, int off, int len) throws IOException { - try { - writer.writeCharacters(cbuf, off, len); - } catch (XMLStreamException e) { - throw new IOException("Error writing XML stream", e); - } - } - - public void writeEntityRef(String entityReference) throws XMLStreamException { - writer.writeEntityRef(entityReference); - } - - @Override - public void flush() throws IOException { - try { - writer.flush(); - } catch (XMLStreamException e) { - throw new IOException("Error flushing XML stream", e); - } - } - - @Override - public void close() throws IOException { - try { - writer.close(); - } catch (XMLStreamException e) { - throw new IOException("Error closing XML stream", e); - } - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/XmlOutput.java 2018-01-30 20:33:45.000000000 -0500 +++ /dev/null 2018-01-30 20:33:46.000000000 -0500 @@ -1,175 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.runtime.output; - -import java.io.IOException; - -import javax.xml.bind.JAXBContext; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.NameList; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.SAXException; - -/** - * Well-formed XML writer. - * - *

- * Implementations of this interface is used to connect {@link XMLSerializer} - * to the actual target. This allows {@link XMLSerializer} to be API agnostic. - * - * - *

Notes

- *

- * {@link JAXBContext} assigns indices to URIs and local names - * that are statically known by using {@link NameList}. - * {@link XmlOutput} implementation can use these indices to improve - * the performance. For example, those namespace URI indices can be - * turned into prefixes quickly. - * - *

- * {@link XmlOutput} still allows arbitrary namepsace URIs / local names - * to be written. - * - *

- * The {@link NamespaceContextImpl} object, which is shared between {@link XmlOutput} and - * {@link XMLSerializer}, keeps track of the in-scope namespace bindings. By the time - * the {@link #beginStartTag} method is called, all the namespace bindings for the new - * element is already declared. Similarly, after the {@link #endTag} method is called, - * in-scope bindings will be removed. This book keeping is all done outside {@link XmlOutput}. - * - *

- * {@link XmlOutput} and {@link XMLSerializer} uses indices to - * reference prefixes/URIs to be written. {@link NamespaceContextImpl} can - * convert prefix indices to URIs and the string representations of prefixes. - * Binding from indices to URIs and prefixes do not change while indices - * are "in scope", so {@link XmlOutput} is again expected to take advantage of - * this to improve the perofmrnace. - * - *

- * prefix index 0 is reserved for "xml", and this binding is assumed to be always there. - * {@link NamespaceContextImpl} can handle this index correctly, but this binding will never - * be reported to {@link XmlOutput} through {@link #beginStartTag}. - * - *

- * One pecurilar behavior of a {@link NamespaceContextImpl} object is that it tries - * to define redundant xmlns="" on the root element. Implementations of {@link XmlOutput} - * is encouraged to check for this and avoid generating redundant namespace declarations. - * - * - * - *

Call Sequence

- *

- * {@link XMLSerializer} calls the writer methods in the following order: - * - *

- * CALLSEQUENCE  :=  {@link #startDocument startDocument} ELEMENT {@link #endDocument endDocument}
- *               |   ELEMENT   // for fragment
- *
- * ELEMENT       :=  {@link #beginStartTag beginStartTag} {@link #attribute attribute}* {@link #endStartTag endStartTag} CONTENTS {@link #endTag endTag}
- *
- * CONTENTS      :=  (ELEMENT | {@link #text text})*
- * 
- * - * TODO: for FI, consider making attribute values from Strings to CharSequences. - * - * @author Kohsuke Kawaguchi - */ -public interface XmlOutput { -// -// -// Contracts -// -// - /** - * Called at the very beginning. - * - * @param serializer - * the {@link XMLSerializer} that coordinates this whole marshalling episode. - * @param fragment - * true if we are marshalling a fragment. - */ - public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws IOException, SAXException, XMLStreamException; - - /** - * Called at the very end. This is the last method to be invoked. - * - * @param fragment - * false if we are writing the whole document. - */ - public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException; - - /** - * Writes a start tag. - * - *

- * At this point {@link NamespaceContextImpl} holds namespace declarations needed for this - * new element. - * - *

- * This method is used for writing tags that are indexed. - */ - public void beginStartTag(Name name) throws IOException, XMLStreamException; - - public void beginStartTag(int prefix, String localName) throws IOException, XMLStreamException; - - public void attribute( Name name, String value ) throws IOException, XMLStreamException; - - /** - * @param prefix - * -1 if this attribute does not have a prefix - * (this handling differs from that of elements.) - */ - public void attribute( int prefix, String localName, String value ) throws IOException, XMLStreamException; - - public void endStartTag() throws IOException, SAXException; - - public void endTag(Name name) throws IOException, SAXException, XMLStreamException; - - public void endTag(int prefix, String localName) throws IOException, SAXException, XMLStreamException; - - /** - * Writes XML text with character escaping, if necessary. - * - * @param value - * this string can contain characters that might need escaping - * (such as {@code '&' or '>'}) - * @param needsSeparatingWhitespace - */ - public void text( String value, boolean needsSeparatingWhitespace ) throws IOException, SAXException, XMLStreamException; - - /** - * Writes XML text with character escaping, if necessary. - * - * @param value - * this string can contain characters that might need escaping - * (such as {@code '&' or '>'}) - * @param needsSeparatingWhitespace - */ - public void text( Pcdata value, boolean needsSeparatingWhitespace ) throws IOException, SAXException, XMLStreamException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/XmlOutputAbstractImpl.java 2018-01-30 20:33:46.000000000 -0500 +++ /dev/null 2018-01-30 20:33:46.000000000 -0500 @@ -1,138 +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.xml.internal.bind.v2.runtime.output; - -import java.io.IOException; -import java.io.OutputStream; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.SAXException; - -/** - * Abstract implementation of {@link XmlOutput} - * - * Implements the optimal methods, where defer to - * the non-optimal methods. - * - * @author Kohsuke Kawaguchi - */ -public abstract class XmlOutputAbstractImpl implements XmlOutput { -// -// -// Contracts -// -// - /** - * Called at the very beginning. - * - * @param serializer - * the {@link XMLSerializer} that coordinates this whole marshalling episode. - * @param fragment - * true if we are marshalling a fragment. - */ - public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws IOException, SAXException, XMLStreamException { - this.nsUriIndex2prefixIndex = nsUriIndex2prefixIndex; - this.nsContext = nsContext; - this.serializer = serializer; - } - - /** - * Called at the very end. - * - * @param fragment - * false if we are writing the whole document. - */ - public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException { - serializer = null; - } - - /** - * Writes a start tag. - * - *

- * At this point {@link #nsContext} holds namespace declarations needed for this - * new element. - * - *

- * This method is used for writing tags that are indexed. - */ - public void beginStartTag(Name name) throws IOException, XMLStreamException { - beginStartTag( nsUriIndex2prefixIndex[name.nsUriIndex], name.localName ); - } - - public abstract void beginStartTag(int prefix, String localName) throws IOException, XMLStreamException; - - public void attribute( Name name, String value ) throws IOException, XMLStreamException { - short idx = name.nsUriIndex; - if(idx==-1) - attribute(-1,name.localName, value); - else - attribute( nsUriIndex2prefixIndex[idx], name.localName, value ); - } - /** - * @param prefix - * -1 if this attribute does not have a prefix - * (this handling differs from that of elements.) - */ - public abstract void attribute( int prefix, String localName, String value ) throws IOException, XMLStreamException; - - public abstract void endStartTag() throws IOException, SAXException; - - public void endTag(Name name) throws IOException, SAXException, XMLStreamException { - endTag( nsUriIndex2prefixIndex[name.nsUriIndex], name.localName); - } - public abstract void endTag(int prefix, String localName) throws IOException, SAXException, XMLStreamException; - - - - -// -// -// Utilities for implementations -// -// - /** - * The conversion table from the namespace URI index to prefix index. - * - * This array is shared with {@link XMLSerializer} and - * is updated by it automatically. - * - * This allows {@link Name#nsUriIndex} to be converted to prefix index - * (for {@link NamespaceContextImpl}) quickly. - */ - protected int[] nsUriIndex2prefixIndex; - - /** - * Set by the marshaller before the start tag is written for the root element. - */ - protected NamespaceContextImpl nsContext; - - protected XMLSerializer serializer; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/output/package-info.java 2018-01-30 20:33:47.000000000 -0500 +++ /dev/null 2018-01-30 20:33:47.000000000 -0500 @@ -1,29 +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. - */ - -/** - * Code that writes well-formed XML ({@link XmlOutput} and its implementations}. - */ -package com.sun.xml.internal.bind.v2.runtime.output; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/package-info.java 2018-01-30 20:33:48.000000000 -0500 +++ /dev/null 2018-01-30 20:33:48.000000000 -0500 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * Code that implements JAXBContext, Unmarshaller, and Marshaller. - */ -package com.sun.xml.internal.bind.v2.runtime; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayERProperty.java 2018-01-30 20:33:48.000000000 -0500 +++ /dev/null 2018-01-30 20:33:48.000000000 -0500 @@ -1,200 +0,0 @@ -/* - * 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.bind.v2.runtime.property; - -import java.io.IOException; -import java.util.Collection; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.util.QNameMap; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Lister; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.TagName; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Receiver; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Scope; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader; - -import org.xml.sax.SAXException; - -/** - * Commonality between {@link ArrayElementProperty} and {@link ArrayReferenceNodeProperty}. - * - * Mostly handles the unmarshalling of the wrapper element. - * - * @author Kohsuke Kawaguchi - */ -abstract class ArrayERProperty extends ArrayProperty { - - /** - * Wrapper tag name if any, or null. - */ - protected final Name wrapperTagName; - - /** - * True if the wrapper tag name is nillable. - * Always false if {@link #wrapperTagName}==null. - */ - protected final boolean isWrapperNillable; - - protected ArrayERProperty(JAXBContextImpl grammar, RuntimePropertyInfo prop, QName tagName, boolean isWrapperNillable) { - super(grammar,prop); - if(tagName==null) - this.wrapperTagName = null; - else - this.wrapperTagName = grammar.nameBuilder.createElementName(tagName); - this.isWrapperNillable = isWrapperNillable; - } - - /** - * Used to handle the collection wrapper element. - */ - private static final class ItemsLoader extends Loader { - - private final Accessor acc; - private final Lister lister; - - public ItemsLoader(Accessor acc, Lister lister, QNameMap children) { - super(false); - this.acc = acc; - this.lister = lister; - this.children = children; - } - - @Override - public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - UnmarshallingContext context = state.getContext(); - context.startScope(1); - // inherit the target so that our children can access its target - state.setTarget(state.getPrev().getTarget()); - - // start it now, so that even if there's no children we can still return empty collection - context.getScope(0).start(acc,lister); - } - - private final QNameMap children; - - @Override - public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - ChildLoader child = children.get(ea.uri,ea.local); - if (child == null) { - child = children.get(CATCH_ALL); - } - if (child == null) { - super.childElement(state,ea); - return; - } - state.setLoader(child.loader); - state.setReceiver(child.receiver); - } - - @Override - public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - state.getContext().endScope(1); - } - - @Override - public Collection getExpectedChildElements() { - return children.keySet(); - } - } - - public final void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException { - ListT list = acc.get(o); - - if(list!=null) { - if(wrapperTagName!=null) { - w.startElement(wrapperTagName,null); - w.endNamespaceDecls(list); - w.endAttributes(); - } - - serializeListBody(o,w,list); - - if(wrapperTagName!=null) - w.endElement(); - } else { - // list is null - if(isWrapperNillable) { - w.startElement(wrapperTagName,null); - w.writeXsiNilTrue(); - w.endElement(); - } // otherwise don't print the wrapper tag name - } - } - - /** - * Serializes the items of the list. - * This method is invoked after the necessary wrapper tag is produced (if necessary.) - * - * @param list - * always non-null. - */ - protected abstract void serializeListBody(BeanT o, XMLSerializer w, ListT list) throws IOException, XMLStreamException, SAXException, AccessorException; - - /** - * Creates the unmarshaler to unmarshal the body. - */ - protected abstract void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap loaders); - - - public final void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap loaders) { - if(wrapperTagName!=null) { - UnmarshallerChain c = new UnmarshallerChain(chain.context); - QNameMap m = new QNameMap(); - createBodyUnmarshaller(c,m); - Loader loader = new ItemsLoader(acc, lister, m); - if(isWrapperNillable || chain.context.allNillable) - loader = new XsiNilLoader(loader); - loaders.put(wrapperTagName,new ChildLoader(loader,null)); - } else { - createBodyUnmarshaller(chain,loaders); - } - } - - /** - * {@link Receiver} that puts the child object into the {@link Scope} object. - */ - protected final class ReceiverImpl implements Receiver { - private final int offset; - - protected ReceiverImpl(int offset) { - this.offset = offset; - } - - public void receive(UnmarshallingContext.State state, Object o) throws SAXException { - state.getContext().getScope(offset).add(acc,lister,o); - } - }} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayElementLeafProperty.java 2018-01-30 20:33:49.000000000 -0500 +++ /dev/null 2018-01-30 20:33:49.000000000 -0500 @@ -1,73 +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.xml.internal.bind.v2.runtime.property; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.SAXException; - -/** - * {@link ArrayProperty} that contains only one leaf type. - * - *

- * This class is optimized for the case where there's only one kind of types - * in the array and that type is a leaf type. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -final class ArrayElementLeafProperty extends ArrayElementProperty { - - private final Transducer xducer; - - public ArrayElementLeafProperty(JAXBContextImpl p, RuntimeElementPropertyInfo prop) { - super(p, prop); - - // unless those are true, use the ArrayElementNodeProperty. - assert prop.getTypes().size()==1; -// assert prop.getTypes().get(0).getType().isLeaf(); // this assertion is incorrect in case it's IDREF - - xducer = prop.getTypes().get(0).getTransducer(); - assert xducer!=null; - } - - public void serializeItem(JaxBeanInfo bi, ItemT item, XMLSerializer w) throws SAXException, AccessorException, IOException, XMLStreamException { - xducer.declareNamespace(item,w); - w.endNamespaceDecls(item); - w.endAttributes(); - // this is leaf, so by definition there's no type substitution - // if there's, we'll be using ArrayElementNodeProperty - xducer.writeText(w,item,fieldName); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayElementNodeProperty.java 2018-01-30 20:33:49.000000000 -0500 +++ /dev/null 2018-01-30 20:33:50.000000000 -0500 @@ -1,57 +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.xml.internal.bind.v2.runtime.property; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.SAXException; - -/** - * {@link ArrayProperty} that contains node values. - * - * @author Kohsuke Kawaguchi - */ -final class ArrayElementNodeProperty extends ArrayElementProperty { - - public ArrayElementNodeProperty(JAXBContextImpl p, RuntimeElementPropertyInfo prop) { - super(p, prop); - } - - public void serializeItem(JaxBeanInfo expected, ItemT item, XMLSerializer w) throws SAXException, IOException, XMLStreamException { - if(item==null) { - w.writeXsiNilTrue(); - } else { - w.childAsXsiType(item,fieldName,expected, false); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayElementProperty.java 2018-01-30 20:33:50.000000000 -0500 +++ /dev/null 2018-01-30 20:33:50.000000000 -0500 @@ -1,244 +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.xml.internal.bind.v2.runtime.property; - -import java.io.IOException; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.bind.JAXBException; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.TypeRef; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeRef; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.RuntimeUtil; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.ListIterator; -import com.sun.xml.internal.bind.v2.runtime.reflect.Lister; -import com.sun.xml.internal.bind.v2.runtime.reflect.NullSafeAccessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.DefaultValueLoaderDecorator; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Receiver; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.TextLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader; -import com.sun.xml.internal.bind.v2.util.QNameMap; - -import org.xml.sax.SAXException; - -/** - * {@link Property} implementation for multi-value property that maps to an element. - * - * @author Kohsuke Kawaguchi - */ -abstract class ArrayElementProperty extends ArrayERProperty { - - private final Map typeMap = new HashMap(); - /** - * Set by the constructor and reset in the {@link #wrapUp()} method. - */ - private Map,JaxBeanInfo> refs = new HashMap, JaxBeanInfo>(); - /** - * Set by the constructor and reset in the {@link #wrapUp()} method. - */ - protected RuntimeElementPropertyInfo prop; - - /** - * Tag name used when we see null in the collection. Can be null. - */ - private final Name nillableTagName; - - protected ArrayElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) { - super(grammar, prop, prop.getXmlName(), prop.isCollectionNillable()); - this.prop = prop; - - List types = prop.getTypes(); - - Name n = null; - - for (RuntimeTypeRef typeRef : types) { - Class type = (Class)typeRef.getTarget().getType(); - if(type.isPrimitive()) - type = RuntimeUtil.primitiveToBox.get(type); - - JaxBeanInfo beanInfo = grammar.getOrCreate(typeRef.getTarget()); - TagAndType tt = new TagAndType( - grammar.nameBuilder.createElementName(typeRef.getTagName()), - beanInfo); - typeMap.put(type,tt); - refs.put(typeRef,beanInfo); - if(typeRef.isNillable() && n==null) - n = tt.tagName; - } - - nillableTagName = n; - } - - @Override - public void wrapUp() { - super.wrapUp(); - refs = null; - prop = null; // avoid keeping model objects live - } - - protected void serializeListBody(BeanT beanT, XMLSerializer w, ListT list) throws IOException, XMLStreamException, SAXException, AccessorException { - ListIterator itr = lister.iterator(list, w); - - boolean isIdref = itr instanceof Lister.IDREFSIterator; // UGLY - - while(itr.hasNext()) { - try { - ItemT item = itr.next(); - if (item != null) { - Class itemType = item.getClass(); - if(isIdref) - // This should be the only place where we need to be aware - // that the iterator is iterating IDREFS. - itemType = ((Lister.IDREFSIterator)itr).last().getClass(); - - // normally, this returns non-null - TagAndType tt = typeMap.get(itemType); - while(tt==null && itemType!=null) { - // otherwise we'll just have to try the slow way - itemType = itemType.getSuperclass(); - tt = typeMap.get(itemType); - } - - if(tt==null) { - // item is not of the expected type. -// w.reportError(new ValidationEventImpl(ValidationEvent.ERROR, -// Messages.UNEXPECTED_JAVA_TYPE.format( -// item.getClass().getName(), -// getExpectedClassNameList() -// ), -// w.getCurrentLocation(fieldName))); -// continue; - - // see the similar code in SingleElementNodeProperty. - // for the purpose of simple type substitution, make it a non-error - - w.startElement(typeMap.values().iterator().next().tagName,null); - w.childAsXsiType(item,fieldName,w.grammar.getBeanInfo(Object.class), false); - } else { - w.startElement(tt.tagName,null); - serializeItem(tt.beanInfo,item,w); - } - - w.endElement(); - } else { - if(nillableTagName!=null) { - w.startElement(nillableTagName,null); - w.writeXsiNilTrue(); - w.endElement(); - } - } - } catch (JAXBException e) { - w.reportError(fieldName,e); - // recover by ignoring this item - } - } - } - - /** - * Serializes one item of the property. - */ - protected abstract void serializeItem(JaxBeanInfo expected, ItemT item, XMLSerializer w) throws SAXException, AccessorException, IOException, XMLStreamException; - - - public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap loaders) { - - // all items go to the same lister, - // so they should share the same offset. - int offset = chain.allocateOffset(); - Receiver recv = new ReceiverImpl(offset); - - for (RuntimeTypeRef typeRef : prop.getTypes()) { - - Name tagName = chain.context.nameBuilder.createElementName(typeRef.getTagName()); - Loader item = createItemUnmarshaller(chain,typeRef); - - if(typeRef.isNillable() || chain.context.allNillable) - item = new XsiNilLoader.Array(item); - if(typeRef.getDefaultValue()!=null) - item = new DefaultValueLoaderDecorator(item,typeRef.getDefaultValue()); - - loaders.put(tagName,new ChildLoader(item,recv)); - } - } - - public final PropertyKind getKind() { - return PropertyKind.ELEMENT; - } - - /** - * Creates a loader handler that unmarshals the body of the item. - * - *

- * This will be sandwiched into ... . - * - *

- * When unmarshalling the body of item, the Pack of {@link Lister} is available - * as the handler state. - * - * @param chain - * @param typeRef - */ - private Loader createItemUnmarshaller(UnmarshallerChain chain, RuntimeTypeRef typeRef) { - if(PropertyFactory.isLeaf(typeRef.getSource())) { - final Transducer xducer = typeRef.getTransducer(); - return new TextLoader(xducer); - } else { - return refs.get(typeRef).getLoader(chain.context,true); - } - } - - public Accessor getElementPropertyAccessor(String nsUri, String localName) { - if(wrapperTagName!=null) { - if(wrapperTagName.equals(nsUri,localName)) - return acc; - } else { - for (TagAndType tt : typeMap.values()) { - if(tt.tagName.equals(nsUri,localName)) - // when we can't distinguish null and empty list, JAX-WS doesn't want to see - // null (just like any user apps), but since we are providing a raw accessor, - // which just grabs the value from the field, we wrap it so that it won't return - // null. - return new NullSafeAccessor(acc,lister); - } - } - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayProperty.java 2018-01-30 20:33:51.000000000 -0500 +++ /dev/null 2018-01-30 20:33:51.000000000 -0500 @@ -1,65 +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.bind.v2.runtime.property; - - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.Lister; - - -/** - * {@link Property} implementation for multi-value properties - * (including arrays and collections.) - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -abstract class ArrayProperty extends PropertyImpl { - protected final Accessor acc; - protected final Lister lister; - - protected ArrayProperty(JAXBContextImpl context, RuntimePropertyInfo prop) { - super(context,prop); - - assert prop.isCollection(); - lister = Lister.create( - Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()),prop.id(),prop.getAdapter()); - assert lister!=null; - acc = prop.getAccessor().optimize(context); - assert acc!=null; - } - - public void reset(BeanT o) throws AccessorException { - lister.reset(o,acc); - } - - public final String getIdValue(BeanT bean) { - // mutli-value property can't be ID - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/ArrayReferenceNodeProperty.java 2018-01-30 20:33:52.000000000 -0500 +++ /dev/null 2018-01-30 20:33:52.000000000 -0500 @@ -1,167 +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.xml.internal.bind.v2.runtime.property; - -import java.io.IOException; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.annotation.DomHandler; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.v2.ClassFactory; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.WildcardMode; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeReferencePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.ListIterator; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Receiver; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.WildcardLoader; -import com.sun.xml.internal.bind.v2.util.QNameMap; - -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi - */ -class ArrayReferenceNodeProperty extends ArrayERProperty { - - /** - * Expected element names and what class to unmarshal. - */ - private final QNameMap expectedElements = new QNameMap(); - - private final boolean isMixed; - - private final DomHandler domHandler; - private final WildcardMode wcMode; - - public ArrayReferenceNodeProperty(JAXBContextImpl p, RuntimeReferencePropertyInfo prop) { - super(p, prop, prop.getXmlName(), prop.isCollectionNillable()); - - for (RuntimeElement e : prop.getElements()) { - JaxBeanInfo bi = p.getOrCreate(e); - expectedElements.put( e.getElementName().getNamespaceURI(),e.getElementName().getLocalPart(), bi ); - } - - isMixed = prop.isMixed(); - - if(prop.getWildcard()!=null) { - domHandler = (DomHandler) ClassFactory.create(prop.getDOMHandler()); - wcMode = prop.getWildcard(); - } else { - domHandler = null; - wcMode = null; - } - } - - protected final void serializeListBody(BeanT o, XMLSerializer w, ListT list) throws IOException, XMLStreamException, SAXException { - ListIterator itr = lister.iterator(list, w); - - while(itr.hasNext()) { - try { - ItemT item = itr.next(); - if (item != null) { - if(isMixed && item.getClass()==String.class) { - w.text((String)item,null); - } else { - JaxBeanInfo bi = w.grammar.getBeanInfo(item,true); - if(bi.jaxbType==Object.class && domHandler!=null) - // even if 'v' is a DOM node, it always derive from Object, - // so the getBeanInfo returns BeanInfo for Object - w.writeDom(item,domHandler,o,fieldName); - else - bi.serializeRoot(item,w); - } - } - } catch (JAXBException e) { - w.reportError(fieldName,e); - // recover by ignoring this item - } - } - } - - public void createBodyUnmarshaller(UnmarshallerChain chain, QNameMap loaders) { - final int offset = chain.allocateOffset(); - - Receiver recv = new ReceiverImpl(offset); - - for( QNameMap.Entry n : expectedElements.entrySet() ) { - final JaxBeanInfo beanInfo = n.getValue(); - loaders.put(n.nsUri,n.localName,new ChildLoader(beanInfo.getLoader(chain.context,true),recv)); - } - - if(isMixed) { - // handler for processing mixed contents. - loaders.put(TEXT_HANDLER, - new ChildLoader(new MixedTextLoader(recv),null)); - } - - if(domHandler!=null) { - loaders.put(CATCH_ALL, - new ChildLoader(new WildcardLoader(domHandler,wcMode),recv)); - } - } - - private static final class MixedTextLoader extends Loader { - - private final Receiver recv; - - public MixedTextLoader(Receiver recv) { - super(true); - this.recv = recv; - } - - public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { - if(text.length()!=0) // length 0 text is pointless - recv.receive(state,text.toString()); - } - } - - - public PropertyKind getKind() { - return PropertyKind.REFERENCE; - } - - @Override - public Accessor getElementPropertyAccessor(String nsUri, String localName) { - // TODO: unwrap JAXBElement - if(wrapperTagName!=null) { - if(wrapperTagName.equals(nsUri,localName)) - return acc; - } else { - if(expectedElements.containsKey(nsUri,localName)) - return acc; - } - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/AttributeProperty.java 2018-01-30 20:33:52.000000000 -0500 +++ /dev/null 2018-01-30 20:33:52.000000000 -0500 @@ -1,119 +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.xml.internal.bind.v2.runtime.property; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.util.QNameMap; -import com.sun.xml.internal.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeAttributePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; - -import org.xml.sax.SAXException; - -/** - * {@link Property} implementation for {@link AttributePropertyInfo}. - * - *

- * This one works for both leaves and nodes, scalars and arrays. - * - *

- * Implements {@link Comparable} so that it can be sorted lexicographically. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public final class AttributeProperty extends PropertyImpl - implements Comparable { - - /** - * Attribute name. - */ - public final Name attName; - - /** - * Heart of the conversion logic. - */ - public final TransducedAccessor xacc; - - private final Accessor acc; - - public AttributeProperty(JAXBContextImpl context, RuntimeAttributePropertyInfo prop) { - super(context,prop); - this.attName = context.nameBuilder.createAttributeName(prop.getXmlName()); - this.xacc = TransducedAccessor.get(context,prop); - this.acc = prop.getAccessor(); // we only use this for binder, so don't waste memory by optimizing - } - - /** - * Marshals one attribute. - * - * @see JaxBeanInfo#serializeAttributes(Object, XMLSerializer) - */ - public void serializeAttributes(BeanT o, XMLSerializer w) throws SAXException, AccessorException, IOException, XMLStreamException { - CharSequence value = xacc.print(o); - if(value!=null) - w.attribute(attName,value.toString()); - } - - public void serializeURIs(BeanT o, XMLSerializer w) throws AccessorException, SAXException { - xacc.declareNamespace(o,w); - } - - public boolean hasSerializeURIAction() { - return xacc.useNamespace(); - } - - public void buildChildElementUnmarshallers(UnmarshallerChain chainElem, QNameMap handlers) { - throw new IllegalStateException(); - } - - - public PropertyKind getKind() { - return PropertyKind.ATTRIBUTE; - } - - public void reset(BeanT o) throws AccessorException { - acc.set(o,null); - } - - public String getIdValue(BeanT bean) throws AccessorException, SAXException { - return xacc.print(bean).toString(); - } - - public int compareTo(AttributeProperty that) { - return this.attName.compareTo(that.attName); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/ListElementProperty.java 2018-01-30 20:33:53.000000000 -0500 +++ /dev/null 2018-01-30 20:33:53.000000000 -0500 @@ -1,120 +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.bind.v2.runtime.property; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.util.QNameMap; -import com.sun.xml.internal.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeRef; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.ListTransducedAccessorImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.DefaultValueLoaderDecorator; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; - -import org.xml.sax.SAXException; - -/** - * {@link Property} implementation for {@link ElementPropertyInfo} whose - * {@link ElementPropertyInfo#isValueList()} is true. - * - * @author Kohsuke Kawaguchi - */ -final class ListElementProperty extends ArrayProperty { - - private final Name tagName; - private final String defaultValue; - - /** - * Converts all the values to a list and back. - */ - private final TransducedAccessor xacc; - - public ListElementProperty(JAXBContextImpl grammar, RuntimeElementPropertyInfo prop) { - super(grammar, prop); - - assert prop.isValueList(); - assert prop.getTypes().size()==1; // required by the contract of isValueList - RuntimeTypeRef ref = prop.getTypes().get(0); - - tagName = grammar.nameBuilder.createElementName(ref.getTagName()); - defaultValue = ref.getDefaultValue(); - - // transducer for each item - Transducer xducer = ref.getTransducer(); - // transduced accessor for the whole thing - xacc = new ListTransducedAccessorImpl(xducer,acc,lister); - } - - public PropertyKind getKind() { - return PropertyKind.ELEMENT; - } - - public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap handlers) { - Loader l = new LeafPropertyLoader(xacc); - l = new DefaultValueLoaderDecorator(l, defaultValue); - handlers.put(tagName, new ChildLoader(l,null)); - } - - @Override - public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException { - ListT list = acc.get(o); - - if(list!=null) { - if(xacc.useNamespace()) { - w.startElement(tagName,null); - xacc.declareNamespace(o,w); - w.endNamespaceDecls(list); - w.endAttributes(); - xacc.writeText(w,o,fieldName); - w.endElement(); - } else { - xacc.writeLeafElement(w, tagName, o, fieldName); - } - } - } - - @Override - public Accessor getElementPropertyAccessor(String nsUri, String localName) { - if(tagName!=null) { - if(tagName.equals(nsUri,localName)) - return acc; - } - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages.java 2018-01-30 20:33:54.000000000 -0500 +++ /dev/null 2018-01-30 20:33:54.000000000 -0500 @@ -1,48 +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.xml.internal.bind.v2.runtime.property; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Message resources - */ -enum Messages { - UNSUBSTITUTABLE_TYPE, // 3 args - UNEXPECTED_JAVA_TYPE, // 2 args - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages.properties 2018-01-30 20:33:54.000000000 -0500 +++ /dev/null 2018-01-30 20:33:54.000000000 -0500 @@ -1,31 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = \ - type {0} is mapped to {1} but it cannot substitute {2} here - -UNEXPECTED_JAVA_TYPE = \ - Java class {0} is not allowed in this property. Expected types are: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages_de.properties 2018-01-30 20:33:55.000000000 -0500 +++ /dev/null 2018-01-30 20:33:55.000000000 -0500 @@ -1,29 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = Typ {0} ist {1} zugeordnet, kann jedoch {2} hier nicht ersetzen - -UNEXPECTED_JAVA_TYPE = Java-Klasse {0} ist in dieser Eigenschaft nicht zul\u00E4ssig. Folgende Typen werden erwartet: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages_es.properties 2018-01-30 20:33:56.000000000 -0500 +++ /dev/null 2018-01-30 20:33:56.000000000 -0500 @@ -1,29 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = el tipo {0} est\u00E1 asignado a {1}, pero no puede sustituir a {2} aqu\u00ED - -UNEXPECTED_JAVA_TYPE = La clase Java {0} no est\u00E1 permitida en esta propiedad. Los tipos esperados son: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages_fr.properties 2018-01-30 20:33:56.000000000 -0500 +++ /dev/null 2018-01-30 20:33:56.000000000 -0500 @@ -1,29 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = le type {0} est mapp\u00E9 avec {1} mais il ne peut pas remplacer {2} ici - -UNEXPECTED_JAVA_TYPE = La classe Java {0} n''est pas autoris\u00E9e dans cette propri\u00E9t\u00E9. Les types attendus sont : {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages_it.properties 2018-01-30 20:33:57.000000000 -0500 +++ /dev/null 2018-01-30 20:33:57.000000000 -0500 @@ -1,29 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = il tipo {0} \u00E8 mappato a {1} ma qui non pu\u00F2 sostituire {2} - -UNEXPECTED_JAVA_TYPE = La classe Java {0} non \u00E8 consentita in questa propriet\u00E0. I tipi previsti sono: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages_ja.properties 2018-01-30 20:33:58.000000000 -0500 +++ /dev/null 2018-01-30 20:33:58.000000000 -0500 @@ -1,29 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = \u30BF\u30A4\u30D7{0}\u304C{1}\u306B\u30DE\u30C3\u30D7\u3055\u308C\u3066\u3044\u307E\u3059\u304C\u3001\u3053\u3053\u3067{2}\u3092\u4EE3\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093 - -UNEXPECTED_JAVA_TYPE = Java\u30AF\u30E9\u30B9{0}\u306F\u3053\u306E\u30D7\u30ED\u30D1\u30C6\u30A3\u3067\u306F\u4F7F\u7528\u3067\u304D\u307E\u305B\u3093\u3002\u4E88\u671F\u3055\u308C\u308B\u30BF\u30A4\u30D7\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages_ko.properties 2018-01-30 20:33:58.000000000 -0500 +++ /dev/null 2018-01-30 20:33:58.000000000 -0500 @@ -1,29 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = {0} \uC720\uD615\uC774 {1}\uC5D0 \uB9E4\uD551\uB418\uC5C8\uC9C0\uB9CC \uC5EC\uAE30\uC11C {2}\uC744(\uB97C) \uB300\uCCB4\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -UNEXPECTED_JAVA_TYPE = Java \uD074\uB798\uC2A4 {0}\uC740(\uB294) \uC774 \uC18D\uC131\uC5D0\uC11C \uD5C8\uC6A9\uB418\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uD544\uC694\uD55C \uC720\uD615: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages_pt_BR.properties 2018-01-30 20:33:59.000000000 -0500 +++ /dev/null 2018-01-30 20:33:59.000000000 -0500 @@ -1,29 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = o tipo {0} foi mapeado para {1}, mas n\u00E3o pode substituir {2} aqui - -UNEXPECTED_JAVA_TYPE = A classe Java {0} n\u00E3o \u00E9 permitida nesta propriedade. Os tipos esperados s\u00E3o: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages_zh_CN.properties 2018-01-30 20:34:00.000000000 -0500 +++ /dev/null 2018-01-30 20:34:00.000000000 -0500 @@ -1,29 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = \u7C7B\u578B{0}\u6620\u5C04\u5230{1}, \u4F46\u5B83\u4E0D\u80FD\u66FF\u4EE3\u6B64\u5904\u7684{2} - -UNEXPECTED_JAVA_TYPE = \u6B64\u5C5E\u6027\u4E2D\u4E0D\u5141\u8BB8\u6709 Java \u7C7B{0}\u3002\u6240\u9700\u7C7B\u578B\u4E3A: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Messages_zh_TW.properties 2018-01-30 20:34:01.000000000 -0500 +++ /dev/null 2018-01-30 20:34:01.000000000 -0500 @@ -1,29 +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. -# - -# Not in use anymore - commented. -UNSUBSTITUTABLE_TYPE = \u985E\u578B {0} \u5C0D\u61C9\u81F3 {1}, \u4F46\u5176\u7121\u6CD5\u53D6\u4EE3\u6B64\u8655\u7684 {2} - -UNEXPECTED_JAVA_TYPE = \u4E0D\u5141\u8A31\u5728\u6B64\u7279\u6027\u4E2D\u4F7F\u7528 Java \u985E\u5225 {0}. \u9810\u671F\u7684\u985E\u578B\u70BA: {1} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Property.java 2018-01-30 20:34:01.000000000 -0500 +++ /dev/null 2018-01-30 20:34:01.000000000 -0500 @@ -1,144 +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.xml.internal.bind.v2.runtime.property; - -import java.io.IOException; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -import org.xml.sax.SAXException; - -/** - * A JAXB property that constitutes a JAXB-bound bean. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public interface Property extends StructureLoaderBuilder { - -// // is this method necessary? --> probably not -// RuntimePropertyInfo owner(); - - /** - * Resets the property value on the given object. - * - *

- * ... for example by setting 0 or null. - */ - void reset( BeanT o ) throws AccessorException; - - /** - * @see JaxBeanInfo#serializeBody(Object, XMLSerializer) - * - * @param outerPeer - * used when this property is expected to print out an element - * and that should be associated with this outer peer. normally null. - * this is only used for {@link JaxBeanInfo} for {@link JAXBElement}s. - * @throws AccessorException - * If thrown, caught by the caller and reported. - */ - public void serializeBody(BeanT beanT, XMLSerializer target, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException; - - /** - * @see JaxBeanInfo#serializeURIs(Object, XMLSerializer) - */ - public void serializeURIs(BeanT beanT, XMLSerializer target) throws SAXException, AccessorException; - - /** - * Returns true if - * {@link #serializeURIs(Object,XMLSerializer)} performs some meaningful action. - */ - public boolean hasSerializeURIAction(); - -// /** -// * Builds the unmarshaller. -// * -// * @param grammar -// * the context object to which this property ultimately belongs to. -// * a property will only belong to one grammar, but to reduce the memory footprint -// * we don't keep that information stored in {@link Property}, and instead we -// * just pass the value as a parameter when needed. -// */ -// Unmarshaller.Handler createUnmarshallerHandler(JAXBContextImpl grammar, Unmarshaller.Handler tail); - - /** - * Gets the value of the property. - * - * This method is only used when the corresponding {@link PropertyInfo#id()} is {@link ID#ID}, - * and therefore the return type is fixed to {@link String}. - */ - String getIdValue(BeanT bean) throws AccessorException, SAXException; - - /** - * Gets the Kind of property - * @return - * always non-null. - */ - PropertyKind getKind(); - - - // UGLY HACK to support JAX-WS - // if other clients want to access those functionalities, - // we should design a better model - /** - * If this property is mapped to the specified element, - * return an accessor to it. - * - * @return - * null if the property is not mapped to the specified element. - */ - Accessor getElementPropertyAccessor(String nsUri,String localName); - - /** - * Called at the end of the {@link JAXBContext} initialization phase - * to clean up any unnecessary references. - */ - void wrapUp(); - - /** - * Provides more {@link RuntimePropertyInfo} information on the property. - * - * @return - * null if RETAIN_REFERENCE_TO_INFO property is not set on the {@link JAXBContext} - */ - public RuntimePropertyInfo getInfo(); - - public boolean isHiddenByOverride(); - - public void setHiddenByOverride(boolean hidden); - - public String getFieldName(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/PropertyFactory.java 2018-01-30 20:34:02.000000000 -0500 +++ /dev/null 2018-01-30 20:34:02.000000000 -0500 @@ -1,155 +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.xml.internal.bind.v2.runtime.property; - -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.Collection; - -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeAttributePropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeValuePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; - -/** - * Create {@link Property} objects. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public abstract class PropertyFactory { - private PropertyFactory() {} - - - /** - * Constructors of the {@link Property} implementation. - */ - private static final Constructor[] propImpls; - - static { - Class[] implClasses = new Class[] { - SingleElementLeafProperty.class, - null, // single reference leaf --- but there's no such thing as "reference leaf" - null, // no such thing as "map leaf" - - ArrayElementLeafProperty.class, - null, // array reference leaf --- but there's no such thing as "reference leaf" - null, // no such thing as "map leaf" - - SingleElementNodeProperty.class, - SingleReferenceNodeProperty.class, - SingleMapNodeProperty.class, - - ArrayElementNodeProperty.class, - ArrayReferenceNodeProperty.class, - null, // map is always a single property (Map doesn't implement Collection) - }; - - propImpls = new Constructor[implClasses.length]; - for( int i=0; i c = propImpls[(isLeaf?0:6)+(isCollection?3:0)+kind.propertyIndex]; - try { - return c.newInstance( grammar, info ); - } catch (InstantiationException e) { - throw new InstantiationError(e.getMessage()); - } catch (IllegalAccessException e) { - throw new IllegalAccessError(e.getMessage()); - } catch (InvocationTargetException e) { - Throwable t = e.getCause(); - if(t instanceof Error) - throw (Error)t; - if(t instanceof RuntimeException) - throw (RuntimeException)t; - - throw new AssertionError(t); - } - } - - /** - * Look for the case that can be optimized as a leaf, - * which is a kind of type whose XML representation is just PCDATA. - */ - static boolean isLeaf(RuntimePropertyInfo info) { - Collection types = info.ref(); - if(types.size()!=1) return false; - - RuntimeTypeInfo rti = types.iterator().next(); - if(!(rti instanceof RuntimeNonElement)) return false; - - if(info.id()==ID.IDREF) - // IDREF is always handled as leaf -- Transducer maps IDREF String back to an object - return true; - - if(((RuntimeNonElement)rti).getTransducer()==null) - // Transducer!=null means definitely binds to PCDATA. - // even if transducer==null, a referene might be IDREF, - // in which case it will still produce PCDATA in this reference. - return false; - - if(!info.getIndividualType().equals(rti.getType())) - return false; - - return true; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/PropertyImpl.java 2018-01-30 20:34:03.000000000 -0500 +++ /dev/null 2018-01-30 20:34:03.000000000 -0500 @@ -1,90 +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.xml.internal.bind.v2.runtime.property; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -abstract class PropertyImpl implements Property { - /** - * Name of this field. - */ - protected final String fieldName; - private RuntimePropertyInfo propertyInfo = null; - private boolean hiddenByOverride = false; - - public PropertyImpl(JAXBContextImpl context, RuntimePropertyInfo prop) { - fieldName = prop.getName(); - if (context.retainPropertyInfo) { - propertyInfo = prop; - } - } - - public RuntimePropertyInfo getInfo() { - return propertyInfo; - } - - public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException { - } - - public void serializeURIs(BeanT o, XMLSerializer w) throws SAXException, AccessorException { - } - - public boolean hasSerializeURIAction() { - return false; - } - - public Accessor getElementPropertyAccessor(String nsUri, String localName) { - // default implementation. should be overrided - return null; - } - - public void wrapUp() {/*noop*/} - - public boolean isHiddenByOverride() { - return hiddenByOverride; - } - - public void setHiddenByOverride(boolean hidden) { - this.hiddenByOverride = hidden; - } - - public String getFieldName() { - return fieldName; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/SingleElementLeafProperty.java 2018-01-30 20:34:03.000000000 -0500 +++ /dev/null 2018-01-30 20:34:03.000000000 -0500 @@ -1,191 +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.bind.v2.runtime.property; - -import java.io.IOException; -import java.lang.reflect.Modifier; - -import javax.xml.bind.JAXBElement; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeRef; -import com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.DefaultValueLoaderDecorator; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.LeafPropertyXsiLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader; -import com.sun.xml.internal.bind.v2.util.QNameMap; - -import org.xml.sax.SAXException; - -/** - * {@link Property} that contains a leaf value. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -final class SingleElementLeafProperty extends PropertyImpl { - - private final Name tagName; - private final boolean nillable; - private final Accessor acc; - private final String defaultValue; - private final TransducedAccessor xacc; - private final boolean improvedXsiTypeHandling; - private final boolean idRef; - - public SingleElementLeafProperty(JAXBContextImpl context, RuntimeElementPropertyInfo prop) { - super(context, prop); - RuntimeTypeRef ref = prop.getTypes().get(0); - tagName = context.nameBuilder.createElementName(ref.getTagName()); - assert tagName != null; - nillable = ref.isNillable(); - defaultValue = ref.getDefaultValue(); - this.acc = prop.getAccessor().optimize(context); - - xacc = TransducedAccessor.get(context, ref); - assert xacc != null; - - improvedXsiTypeHandling = context.improvedXsiTypeHandling; - idRef = ref.getSource().id() == ID.IDREF; - } - - public void reset(BeanT o) throws AccessorException { - acc.set(o, null); - } - - public String getIdValue(BeanT bean) throws AccessorException, SAXException { - return xacc.print(bean).toString(); - } - - @Override - public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException { - boolean hasValue = xacc.hasValue(o); - - Object obj = null; - - try { - obj = acc.getUnadapted(o); - } catch (AccessorException ae) { - ; // noop - } - - Class valueType = acc.getValueType(); - - // check for different type than expected. If found, add xsi:type declaration - if (xsiTypeNeeded(o, w, obj, valueType)) { - w.startElement(tagName, outerPeer); - w.childAsXsiType(obj, fieldName, w.grammar.getBeanInfo(valueType), false); - w.endElement(); - } else { // current type is expected - if (hasValue) { - xacc.writeLeafElement(w, tagName, o, fieldName); - } else if (nillable) { - w.startElement(tagName, null); - w.writeXsiNilTrue(); - w.endElement(); - } - } - } - - /** - * Checks if xsi type needed to be specified - */ - private boolean xsiTypeNeeded(BeanT bean, XMLSerializer w, Object value, Class valueTypeClass) { - if (!improvedXsiTypeHandling) // improved xsi type set - return false; - if (acc.isAdapted()) // accessor is not adapted - return false; - if (value == null) // value is not null - return false; - if (value.getClass().equals(valueTypeClass)) // value represented by different class - return false; - if (idRef) // IDREF - return false; - if (valueTypeClass.isPrimitive()) // is not primitive - return false; - return acc.isValueTypeAbstractable() || isNillableAbstract(bean, w.grammar, value, valueTypeClass); - } - - /** - * Checks if element is nillable and represented by abstract class. - */ - private boolean isNillableAbstract(BeanT bean, JAXBContextImpl context, Object value, Class valueTypeClass) { - if (!nillable) // check if element is nillable - return false; - if (valueTypeClass != Object.class) // required type wasn't recognized - return false; - if (bean.getClass() != JAXBElement.class) // is JAXBElement - return false; - JAXBElement jaxbElement = (JAXBElement) bean; - Class valueClass = value.getClass(); - Class declaredTypeClass = jaxbElement.getDeclaredType(); - if (declaredTypeClass.equals(valueClass)) // JAXBElement is different from unadapted class) - return false; - if (!declaredTypeClass.isAssignableFrom(valueClass)) // and is subclass from it - return false; - if (!Modifier.isAbstract(declaredTypeClass.getModifiers())) // declared class is abstract - return false; - return acc.isAbstractable(declaredTypeClass); // and is not builtin type - } - - public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap handlers) { - Loader l = new LeafPropertyLoader(xacc); - if (defaultValue != null) - l = new DefaultValueLoaderDecorator(l, defaultValue); - if (nillable || chain.context.allNillable) - l = new XsiNilLoader.Single(l, acc); - - // LeafPropertyXsiLoader doesn't work well with nillable elements - if (improvedXsiTypeHandling) - l = new LeafPropertyXsiLoader(l, xacc, acc); - - handlers.put(tagName, new ChildLoader(l, null)); - } - - - public PropertyKind getKind() { - return PropertyKind.ELEMENT; - } - - @Override - public Accessor getElementPropertyAccessor(String nsUri, String localName) { - if (tagName.equals(nsUri, localName)) - return acc; - else - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/SingleElementNodeProperty.java 2018-01-30 20:34:04.000000000 -0500 +++ /dev/null 2018-01-30 20:34:04.000000000 -0500 @@ -1,182 +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.xml.internal.bind.v2.runtime.property; - -import java.io.IOException; -import java.lang.reflect.Modifier; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.TypeRef; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeTypeRef; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.DefaultValueLoaderDecorator; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.XsiNilLoader; -import com.sun.xml.internal.bind.v2.util.QNameMap; - -import javax.xml.bind.JAXBElement; -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -final class SingleElementNodeProperty extends PropertyImpl { - - private final Accessor acc; - - private final boolean nillable; - - private final QName[] acceptedElements; - - private final Map typeNames = new HashMap(); - - private RuntimeElementPropertyInfo prop; - - /** - * The tag name used to produce xsi:nil. The first one in the list. - */ - private final Name nullTagName; - - public SingleElementNodeProperty(JAXBContextImpl context, RuntimeElementPropertyInfo prop) { - super(context,prop); - acc = prop.getAccessor().optimize(context); - this.prop = prop; - - QName nt = null; - boolean nil = false; - - acceptedElements = new QName[prop.getTypes().size()]; - for( int i=0; i e : typeNames.entrySet()) { - if(e.getKey().isAssignableFrom(vtype)) { - tt = e.getValue(); - break; - } - } - } - - boolean addNilDecl = (o instanceof JAXBElement) && ((JAXBElement)o).isNil(); - if(tt==null) { - // actually this is an error, because the actual type was not a sub-type - // of any of the types specified in the annotations, - // but for the purpose of experimenting with simple type substitution, - // it's convenient to marshal this anyway (for example so that classes - // generated from simple types like String can be marshalled as expected.) - w.startElement(typeNames.values().iterator().next().tagName,null); - w.childAsXsiType(v,fieldName,w.grammar.getBeanInfo(Object.class), addNilDecl && nillable); - } else { - w.startElement(tt.tagName,null); - w.childAsXsiType(v,fieldName,tt.beanInfo, addNilDecl && nillable); - } - w.endElement(); - } else if (nillable) { - w.startElement(nullTagName,null); - w.writeXsiNilTrue(); - w.endElement(); - } - } - - public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap handlers) { - JAXBContextImpl context = chain.context; - - for (TypeRef e : prop.getTypes()) { - JaxBeanInfo bi = context.getOrCreate((RuntimeTypeInfo) e.getTarget()); - // if the expected Java type is already final, type substitution won't really work anyway. - // this also traps cases like trying to substitute xsd:long element with xsi:type='xsd:int' - Loader l = bi.getLoader(context,!Modifier.isFinal(bi.jaxbType.getModifiers())); - if(e.getDefaultValue()!=null) - l = new DefaultValueLoaderDecorator(l,e.getDefaultValue()); - if(nillable || chain.context.allNillable) - l = new XsiNilLoader.Single(l,acc); - handlers.put( e.getTagName(), new ChildLoader(l,acc)); - } - } - - public PropertyKind getKind() { - return PropertyKind.ELEMENT; - } - - @Override - public Accessor getElementPropertyAccessor(String nsUri, String localName) { - for( QName n : acceptedElements) { - if(n.getNamespaceURI().equals(nsUri) && n.getLocalPart().equals(localName)) - return acc; - } - return null; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java 2018-01-30 20:34:05.000000000 -0500 +++ /dev/null 2018-01-30 20:34:05.000000000 -0500 @@ -1,321 +0,0 @@ -/* - * 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.bind.v2.runtime.property; - -import java.io.IOException; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.TreeMap; -import java.util.Collection; -import java.util.Collections; -import java.util.Arrays; -import java.util.Set; - -import javax.xml.stream.XMLStreamException; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.ClassFactory; -import com.sun.xml.internal.bind.v2.util.QNameMap; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeMapPropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.TagName; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Receiver; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.State; - -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi - */ -final class SingleMapNodeProperty extends PropertyImpl { - - private final Accessor acc; - /** - * The tag name that surrounds the whole property. - */ - private final Name tagName; - /** - * The tag name that corresponds to the 'entry' element. - */ - private final Name entryTag; - private final Name keyTag; - private final Name valueTag; - - private final boolean nillable; - - private JaxBeanInfo keyBeanInfo; - private JaxBeanInfo valueBeanInfo; - - /** - * The implementation class for this property. - * If the property is null, we create an instance of this class. - */ - private final Class mapImplClass; - - public SingleMapNodeProperty(JAXBContextImpl context, RuntimeMapPropertyInfo prop) { - super(context, prop); - acc = prop.getAccessor().optimize(context); - this.tagName = context.nameBuilder.createElementName(prop.getXmlName()); - this.entryTag = context.nameBuilder.createElementName("","entry"); - this.keyTag = context.nameBuilder.createElementName("","key"); - this.valueTag = context.nameBuilder.createElementName("","value"); - this.nillable = prop.isCollectionNillable(); - this.keyBeanInfo = context.getOrCreate(prop.getKeyType()); - this.valueBeanInfo = context.getOrCreate(prop.getValueType()); - - // infer the implementation class - //noinspection unchecked - Class sig = (Class) Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()); - mapImplClass = ClassFactory.inferImplClass(sig,knownImplClasses); - // TODO: error check for mapImplClass==null - // what is the error reporting path for this part of the code? - } - - private static final Class[] knownImplClasses = { - HashMap.class, TreeMap.class, LinkedHashMap.class - }; - - public void reset(BeanT bean) throws AccessorException { - acc.set(bean,null); - } - - - /** - * A Map property can never be ID. - */ - public String getIdValue(BeanT bean) { - return null; - } - - public PropertyKind getKind() { - return PropertyKind.MAP; - } - - public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap handlers) { - keyLoader = keyBeanInfo.getLoader(chain.context,true); - valueLoader = valueBeanInfo.getLoader(chain.context,true); - handlers.put(tagName,new ChildLoader(itemsLoader,null)); - } - - private Loader keyLoader; - private Loader valueLoader; - - /** - * Handles {@code } and {@code }. - * - * The target will be set to a {@link Map}. - */ - private final Loader itemsLoader = new Loader(false) { - - 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 { - BeanT target = (BeanT) state.getPrev().getTarget(); - 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.setTarget(mapValue); - } catch (AccessorException e) { - // recover from error by setting a dummy Map that receives and discards the values - handleGenericException(e,true); - state.setTarget(new HashMap()); - } - } - - @Override - public void leaveElement(State state, TagName ea) throws SAXException { - super.leaveElement(state, ea); - try { - acc.set(Stack.pop(target), Stack.pop(map)); - } catch (AccessorException ex) { - handleGenericException(ex,true); - } - } - - @Override - public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - if(ea.matches(entryTag)) { - state.setLoader(entryLoader); - } else { - super.childElement(state,ea); - } - } - - @Override - public Collection getExpectedChildElements() { - return Collections.singleton(entryTag.toQName()); - } - }; - - /** - * Handles {@code } and {@code }. - * - * The target will be set to a {@link Map}. - */ - private final Loader entryLoader = new Loader(false) { - @Override - public void startElement(UnmarshallingContext.State state, TagName ea) { - state.setTarget(new Object[2]); // this is inefficient - } - - @Override - public void leaveElement(UnmarshallingContext.State state, TagName ea) { - Object[] keyValue = (Object[])state.getTarget(); - Map map = (Map) state.getPrev().getTarget(); - map.put(keyValue[0],keyValue[1]); - } - - @Override - public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - if(ea.matches(keyTag)) { - state.setLoader(keyLoader); - state.setReceiver(keyReceiver); - return; - } - if(ea.matches(valueTag)) { - state.setLoader(valueLoader); - state.setReceiver(valueReceiver); - return; - } - super.childElement(state,ea); - } - - @Override - public Collection getExpectedChildElements() { - return Arrays.asList(keyTag.toQName(),valueTag.toQName()); - } - }; - - private static final class ReceiverImpl implements Receiver { - private final int index; - public ReceiverImpl(int index) { - this.index = index; - } - public void receive(UnmarshallingContext.State state, Object o) { - ((Object[])state.getTarget())[index] = o; - } - } - - private static final Receiver keyReceiver = new ReceiverImpl(0); - private static final Receiver valueReceiver = new ReceiverImpl(1); - - @Override - public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException { - ValueT v = acc.get(o); - if(v!=null) { - bareStartTag(w,tagName,v); - for( Map.Entry e : (Set)v.entrySet() ) { - bareStartTag(w,entryTag,null); - - Object key = e.getKey(); - if(key!=null) { - w.startElement(keyTag,key); - w.childAsXsiType(key,fieldName,keyBeanInfo, false); - w.endElement(); - } - - Object value = e.getValue(); - if(value!=null) { - w.startElement(valueTag,value); - w.childAsXsiType(value,fieldName,valueBeanInfo, false); - w.endElement(); - } - - w.endElement(); - } - w.endElement(); - } else - if(nillable) { - w.startElement(tagName,null); - w.writeXsiNilTrue(); - w.endElement(); - } - } - - private void bareStartTag(XMLSerializer w, Name tagName, Object peer) throws IOException, XMLStreamException, SAXException { - w.startElement(tagName,peer); - w.endNamespaceDecls(peer); - w.endAttributes(); - } - - @Override - public Accessor getElementPropertyAccessor(String nsUri, String localName) { - if(tagName.equals(nsUri,localName)) - 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/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/SingleReferenceNodeProperty.java 2018-01-30 20:34:05.000000000 -0500 +++ /dev/null 2018-01-30 20:34:05.000000000 -0500 @@ -1,160 +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.xml.internal.bind.v2.runtime.property; - -import java.io.IOException; -import java.lang.reflect.InvocationTargetException; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.annotation.DomHandler; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.ClassFactory; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.core.WildcardMode; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeElement; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeReferencePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.WildcardLoader; -import com.sun.xml.internal.bind.v2.util.QNameMap; - -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi - */ -final class SingleReferenceNodeProperty extends PropertyImpl { - - private final Accessor acc; - - private final QNameMap expectedElements = new QNameMap(); - - private final DomHandler domHandler; - private final WildcardMode wcMode; - - public SingleReferenceNodeProperty(JAXBContextImpl context, RuntimeReferencePropertyInfo prop) { - super(context,prop); - acc = prop.getAccessor().optimize(context); - - for (RuntimeElement e : prop.getElements()) { - expectedElements.put( e.getElementName(), context.getOrCreate(e) ); - } - - if(prop.getWildcard()!=null) { - domHandler = (DomHandler) ClassFactory.create(prop.getDOMHandler()); - wcMode = prop.getWildcard(); - } else { - domHandler = null; - wcMode = null; - } - } - - public void reset(BeanT bean) throws AccessorException { - acc.set(bean,null); - } - - public String getIdValue(BeanT beanT) { - return null; - } - - public void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException { - ValueT v = acc.get(o); - if(v!=null) { - try { - JaxBeanInfo bi = w.grammar.getBeanInfo(v,true); - if(bi.jaxbType==Object.class && domHandler!=null) - // even if 'v' is a DOM node, it always derive from Object, - // so the getBeanInfo returns BeanInfo for Object - w.writeDom(v,domHandler,o,fieldName); - else - bi.serializeRoot(v,w); - } catch (JAXBException e) { - w.reportError(fieldName,e); - // recover by ignoring this property - } - } - } - - public void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap handlers) { - for (QNameMap.Entry n : expectedElements.entrySet()) - handlers.put(n.nsUri,n.localName, new ChildLoader(n.getValue().getLoader(chain.context,true),acc)); - - if(domHandler!=null) - handlers.put(CATCH_ALL,new ChildLoader(new WildcardLoader(domHandler,wcMode),acc)); - - } - - public PropertyKind getKind() { - return PropertyKind.REFERENCE; - } - - @Override - public Accessor getElementPropertyAccessor(String nsUri, String localName) { - JaxBeanInfo bi = expectedElements.get(nsUri, localName); - if(bi!=null) { - if(bi instanceof ElementBeanInfoImpl) { - final ElementBeanInfoImpl ebi = (ElementBeanInfoImpl) bi; - // a JAXBElement. We need to handle JAXBElement for JAX-WS - return new Accessor(ebi.expectedType) { - public Object get(BeanT bean) throws AccessorException { - ValueT r = acc.get(bean); - if(r instanceof JAXBElement) { - return ((JAXBElement)r).getValue(); - } else - // this is sloppy programming, but hey... - return r; - } - - public void set(BeanT bean, Object value) throws AccessorException { - if(value!=null) { - try { - value = ebi.createInstanceFromValue(value); - } catch (IllegalAccessException e) { - throw new AccessorException(e); - } catch (InvocationTargetException e) { - throw new AccessorException(e); - } catch (InstantiationException e) { - throw new AccessorException(e); - } - } - acc.set(bean,(ValueT)value); - } - }; - } else { - // a custom element type, like @XmlRootElement class Foo { ... } - return acc; - } - } else - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/StructureLoaderBuilder.java 2018-01-30 20:34:06.000000000 -0500 +++ /dev/null 2018-01-30 20:34:06.000000000 -0500 @@ -1,79 +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.xml.internal.bind.v2.runtime.property; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.util.QNameMap; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValuePropertyLoader; - -/** - * Component that contributes element unmarshallers into - * {@link StructureLoader}. - * - * TODO: think of a better name. - * - * @author Bhakti Mehta - */ -public interface StructureLoaderBuilder { - /** - * Every Property class has an implementation of buildChildElementUnmarshallers - * which will fill in the specified {@link QNameMap} by elements that are expected - * by this property. - */ - void buildChildElementUnmarshallers(UnmarshallerChain chain, QNameMap handlers); - - /** - * Magic {@link QName} used to store a handler for the text. - * - *

- * To support the mixed content model, {@link StructureLoader} can have - * at most one {@link ValuePropertyLoader} for processing text - * found amoung elements. - * - * This special text handler is put into the {@link QNameMap} parameter - * of the {@link #buildChildElementUnmarshallers} method by using - * this magic token as the key. - */ - public static final QName TEXT_HANDLER = new QName("\u0000","text"); - - /** - * Magic {@link QName} used to store a handler for the rest of the elements. - * - *

- * To support the wildcard, {@link StructureLoader} can have - * at most one {@link Loader} for processing elements - * that didn't match any of the named elements. - * - * This special text handler is put into the {@link QNameMap} parameter - * of the {@link #buildChildElementUnmarshallers} method by using - * this magic token as the key. - */ - public static final QName CATCH_ALL = new QName("\u0000","catchAll"); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/TagAndType.java 2018-01-30 20:34:07.000000000 -0500 +++ /dev/null 2018-01-30 20:34:07.000000000 -0500 @@ -1,45 +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.xml.internal.bind.v2.runtime.property; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.Name; - -/** - * Pair of {@link QName} and {@link JaxBeanInfo}. - * - * @author Kohsuke Kawaguchi - */ -class TagAndType { - final Name tagName; - final JaxBeanInfo beanInfo; - TagAndType(Name tagName, JaxBeanInfo beanInfo) { - this.tagName = tagName; - this.beanInfo = beanInfo; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/UnmarshallerChain.java 2018-01-30 20:34:07.000000000 -0500 +++ /dev/null 2018-01-30 20:34:07.000000000 -0500 @@ -1,69 +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.xml.internal.bind.v2.runtime.property; - -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Scope; - - -/** - * Pass around a 'ticket dispenser' when creating new - * unmarshallers. This controls the index of the slot - * allocated to the chain of handlers. - - * - *

- * A ticket dispenser also maintains the offset for handlers - * to access state slots. A handler records this value when it's created. - * - * - */ -public final class UnmarshallerChain { - /** - * This offset allows child unmarshallers to have its own {@link Scope} without colliding with siblings. - */ - private int offset = 0; - - public final JAXBContextImpl context; - - public UnmarshallerChain(JAXBContextImpl context) { - this.context = context; - } - - /** - * Allocates a new {@link Scope} offset. - */ - public int allocateOffset() { - return offset++; - } - - /** - * Gets the number of total scope offset allocated. - */ - public int getScopeSize() { - return offset; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/Utils.java 2018-01-30 20:34:08.000000000 -0500 +++ /dev/null 2018-01-30 20:34:08.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, 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.bind.v2.runtime.property; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Utils class. - * - * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. - * - * Has *package private* access to avoid inappropriate usage. - */ -final class Utils { - - private static final Logger LOGGER = Logger.getLogger(Utils.class.getName()); - - /** - * static ReflectionNavigator field to avoid usage of reflection every time we use it. - */ - static final Navigator REFLECTION_NAVIGATOR; - - static { // we statically initializing REFLECTION_NAVIGATOR property - try { - final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - - // requires accessClassInPackage privilege - final Method getInstance = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Method run() { - try { - Method getInstance = refNav.getDeclaredMethod("getInstance"); - getInstance.setAccessible(true); - return getInstance; - } catch (NoSuchMethodException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); - } - } - } - ); - - //noinspection unchecked - REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); - } catch (ClassNotFoundException e) { - throw new IllegalStateException("Can't find ReflectionNavigator class"); - } catch (InvocationTargetException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (IllegalAccessException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); - } catch (SecurityException e) { - LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); - throw e; - } - } - - /** - * private constructor to avoid util class instantiating - */ - private Utils() { - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/property/ValueProperty.java 2018-01-30 20:34:09.000000000 -0500 +++ /dev/null 2018-01-30 20:34:09.000000000 -0500 @@ -1,100 +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.xml.internal.bind.v2.runtime.property; - - -import java.io.IOException; - -import javax.xml.bind.annotation.XmlValue; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.core.PropertyKind; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeValuePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ChildLoader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.ValuePropertyLoader; -import com.sun.xml.internal.bind.v2.util.QNameMap; - -import org.xml.sax.SAXException; - -/** - * {@link Property} implementation for {@link XmlValue} properties. - * - *

- * This one works for both leaves and nodes, scalars and arrays. - * - * @author Bhakti Mehta (bhakti.mehta@sun.com) - */ -public final class ValueProperty extends PropertyImpl { - - /** - * Heart of the conversion logic. - */ - private final TransducedAccessor xacc; - private final Accessor acc; - - - public ValueProperty(JAXBContextImpl context, RuntimeValuePropertyInfo prop) { - super(context,prop); - xacc = TransducedAccessor.get(context,prop); - acc = prop.getAccessor(); // we only use this for binder, so don't waste memory by optimizing - } - - public final void serializeBody(BeanT o, XMLSerializer w, Object outerPeer) throws SAXException, AccessorException, IOException, XMLStreamException { - if(xacc.hasValue(o)) - xacc.writeText(w,o,fieldName); - } - - public void serializeURIs(BeanT o, XMLSerializer w) throws SAXException, AccessorException { - xacc.declareNamespace(o,w); - } - - public boolean hasSerializeURIAction() { - return xacc.useNamespace(); - } - - public void buildChildElementUnmarshallers(UnmarshallerChain chainElem, QNameMap handlers) { - handlers.put(StructureLoaderBuilder.TEXT_HANDLER, - new ChildLoader(new ValuePropertyLoader(xacc),null)); - } - - public PropertyKind getKind() { - return PropertyKind.VALUE; - } - - public void reset(BeanT o) throws AccessorException { - acc.set(o,null); - } - - public String getIdValue(BeanT bean) throws AccessorException, SAXException { - return xacc.print(bean).toString(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Accessor.java 2018-01-30 20:34:09.000000000 -0500 +++ /dev/null 2018-01-30 20:34:09.000000000 -0500 @@ -1,485 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.runtime.reflect; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.Type; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import com.sun.istack.internal.Nullable; -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.api.JAXBRIContext; -import com.sun.xml.internal.bind.v2.model.core.Adapter; -import com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Receiver; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; - -import org.xml.sax.SAXException; - -/** - * Accesses a particular property of a bean. - *

- *

- * This interface encapsulates the access to the actual data store. - * The intention is to generate implementations for a particular bean - * and a property to improve the performance. - *

- *

- * Accessor can be used as a receiver. Upon receiving an object - * it sets that to the field. - * - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - * @see Accessor.FieldReflection - * @see TransducedAccessor - */ -public abstract class Accessor implements Receiver { - - public final Class valueType; - - public Class getValueType() { - return valueType; - } - - protected Accessor(Class valueType) { - this.valueType = valueType; - } - - /** - * Returns the optimized version of the same accessor. - * - * @param context The {@link JAXBContextImpl} that owns the whole thing. - * (See {@link RuntimeModelBuilder#context}.) - * @return At least the implementation can return {@code this}. - */ - public Accessor optimize(@Nullable JAXBContextImpl context) { - return this; - } - - - /** - * Gets the value of the property of the given bean object. - * - * @param bean must not be null. - * @throws AccessorException if failed to set a value. For example, the getter method - * may throw an exception. - * @since 2.0 EA1 - */ - public abstract ValueT get(BeanT bean) throws AccessorException; - - /** - * Sets the value of the property of the given bean object. - * - * @param bean must not be null. - * @param value the value to be set. Setting value to null means resetting - * to the VM default value (even for primitive properties.) - * @throws AccessorException if failed to set a value. For example, the setter method - * may throw an exception. - * @since 2.0 EA1 - */ - public abstract void set(BeanT bean, ValueT value) throws AccessorException; - - - /** - * Sets the value without adapting the value. - *

- * This ugly entry point is only used by JAX-WS. - * See {@link JAXBRIContext#getElementPropertyAccessor} - */ - public Object getUnadapted(BeanT bean) throws AccessorException { - return get(bean); - } - - /** - * Returns true if this accessor wraps an adapter. - *

- * This method needs to be used with care, but it helps some optimization. - */ - public boolean isAdapted() { - return false; - } - - /** - * Sets the value without adapting the value. - *

- * This ugly entry point is only used by JAX-WS. - * See {@link JAXBRIContext#getElementPropertyAccessor} - */ - public void setUnadapted(BeanT bean, Object value) throws AccessorException { - set(bean, (ValueT) value); - } - - public void receive(UnmarshallingContext.State state, Object o) throws SAXException { - try { - set((BeanT) state.getTarget(), (ValueT) o); - } catch (AccessorException e) { - Loader.handleGenericException(e, true); - } catch (IllegalAccessError iae) { - // throw UnmarshalException instead IllegalAccesssError | Issue 475 - Loader.handleGenericError(iae); - } - } - - private static List nonAbstractableClasses = Arrays.asList(new Class[]{ - Object.class, - java.util.Calendar.class, - javax.xml.datatype.Duration.class, - javax.xml.datatype.XMLGregorianCalendar.class, - java.awt.Image.class, - javax.activation.DataHandler.class, - javax.xml.transform.Source.class, - java.util.Date.class, - java.io.File.class, - java.net.URI.class, - java.net.URL.class, - Class.class, - String.class, - javax.xml.transform.Source.class} - ); - - public boolean isValueTypeAbstractable() { - return !nonAbstractableClasses.contains(getValueType()); - } - - /** - * Checks if it is not builtin jaxb class - * @param clazz to be checked - * @return true if it is NOT builtin class - */ - public boolean isAbstractable(Class clazz) { - return !nonAbstractableClasses.contains(clazz); - } - - /** - * Wraps this {@link Accessor} into another {@link Accessor} - * and performs the type adaption as necessary. - */ - public final Accessor adapt(Class targetType, final Class> adapter) { - return new AdaptedAccessor(targetType, this, adapter); - } - - public final Accessor adapt(Adapter adapter) { - return new AdaptedAccessor( - (Class) Utils.REFLECTION_NAVIGATOR.erasure(adapter.defaultType), - this, - adapter.adapterType); - } - - /** - * Flag that will be set to true after issueing a warning - * about the lack of permission to access non-public fields. - */ - private static boolean accessWarned = false; - - - /** - * {@link Accessor} that uses Java reflection to access a field. - */ - public static class FieldReflection extends Accessor { - public final Field f; - - private static final Logger logger = Util.getClassLogger(); - - public FieldReflection(Field f) { - this(f, false); - } - - public FieldReflection(Field f, boolean supressAccessorWarnings) { - super((Class) f.getType()); - this.f = f; - - int mod = f.getModifiers(); - if (!Modifier.isPublic(mod) || Modifier.isFinal(mod) || !Modifier.isPublic(f.getDeclaringClass().getModifiers())) { - try { - // attempt to make it accessible, but do so in the security context of the calling application. - // don't do this in the doPrivilege block - f.setAccessible(true); - } catch (SecurityException e) { - if ((!accessWarned) && (!supressAccessorWarnings)) { - // this happens when we don't have enough permission. - logger.log(Level.WARNING, Messages.UNABLE_TO_ACCESS_NON_PUBLIC_FIELD.format( - f.getDeclaringClass().getName(), - f.getName()), - e); - } - accessWarned = true; - } - } - } - - public ValueT get(BeanT bean) { - try { - return (ValueT) f.get(bean); - } catch (IllegalAccessException e) { - throw new IllegalAccessError(e.getMessage()); - } - } - - public void set(BeanT bean, ValueT value) { - try { - if (value == null) - value = (ValueT) uninitializedValues.get(valueType); - f.set(bean, value); - } catch (IllegalAccessException e) { - throw new IllegalAccessError(e.getMessage()); - } - } - - @Override - public Accessor optimize(JAXBContextImpl context) { - if (context != null && context.fastBoot) - // let's not waste time on doing this for the sake of faster boot. - return this; - Accessor acc = OptimizedAccessorFactory.get(f); - if (acc != null) - return acc; - else - return this; - } - } - - /** - * Read-only access to {@link Field}. Used to handle a static field. - */ - public static final class ReadOnlyFieldReflection extends FieldReflection { - public ReadOnlyFieldReflection(Field f, boolean supressAccessorWarnings) { - super(f, supressAccessorWarnings); - } - public ReadOnlyFieldReflection(Field f) { - super(f); - } - - @Override - public void set(BeanT bean, ValueT value) { - // noop - } - - @Override - public Accessor optimize(JAXBContextImpl context) { - return this; - } - } - - - /** - * {@link Accessor} that uses Java reflection to access a getter and a setter. - */ - public static class GetterSetterReflection extends Accessor { - public final Method getter; - public final Method setter; - - private static final Logger logger = Util.getClassLogger(); - - public GetterSetterReflection(Method getter, Method setter) { - super( - (Class) (getter != null ? - getter.getReturnType() : - setter.getParameterTypes()[0])); - this.getter = getter; - this.setter = setter; - - if (getter != null) - makeAccessible(getter); - if (setter != null) - makeAccessible(setter); - } - - private void makeAccessible(Method m) { - if (!Modifier.isPublic(m.getModifiers()) || !Modifier.isPublic(m.getDeclaringClass().getModifiers())) { - try { - m.setAccessible(true); - } catch (SecurityException e) { - if (!accessWarned) - // this happens when we don't have enough permission. - logger.log(Level.WARNING, Messages.UNABLE_TO_ACCESS_NON_PUBLIC_FIELD.format( - m.getDeclaringClass().getName(), - m.getName()), - e); - accessWarned = true; - } - } - } - - public ValueT get(BeanT bean) throws AccessorException { - try { - return (ValueT) getter.invoke(bean); - } catch (IllegalAccessException e) { - throw new IllegalAccessError(e.getMessage()); - } catch (InvocationTargetException e) { - throw handleInvocationTargetException(e); - } - } - - public void set(BeanT bean, ValueT value) throws AccessorException { - try { - if (value == null) - value = (ValueT) uninitializedValues.get(valueType); - setter.invoke(bean, value); - } catch (IllegalAccessException e) { - throw new IllegalAccessError(e.getMessage()); - } catch (InvocationTargetException e) { - throw handleInvocationTargetException(e); - } - } - - private AccessorException handleInvocationTargetException(InvocationTargetException e) { - // don't block a problem in the user code - Throwable t = e.getTargetException(); - if (t instanceof RuntimeException) - throw (RuntimeException) t; - if (t instanceof Error) - throw (Error) t; - - // otherwise it's a checked exception. - // I'm not sure how to handle this. - // we can throw a checked exception from here, - // but because get/set would be called from so many different places, - // the handling would be tedious. - return new AccessorException(t); - } - - @Override - public Accessor optimize(JAXBContextImpl context) { - if (getter == null || setter == null) - // if we aren't complete, OptimizedAccessor won't always work - return this; - if (context != null && context.fastBoot) - // let's not waste time on doing this for the sake of faster boot. - return this; - - Accessor acc = OptimizedAccessorFactory.get(getter, setter); - if (acc != null) - return acc; - else - return this; - } - } - - /** - * A version of {@link GetterSetterReflection} that doesn't have any setter. - *

- *

- * This provides a user-friendly error message. - */ - public static class GetterOnlyReflection extends GetterSetterReflection { - public GetterOnlyReflection(Method getter) { - super(getter, null); - } - - @Override - public void set(BeanT bean, ValueT value) throws AccessorException { - throw new AccessorException(Messages.NO_SETTER.format(getter.toString())); - } - } - - /** - * A version of {@link GetterSetterReflection} thaat doesn't have any getter. - *

- *

- * This provides a user-friendly error message. - */ - public static class SetterOnlyReflection extends GetterSetterReflection { - public SetterOnlyReflection(Method setter) { - super(null, setter); - } - - @Override - public ValueT get(BeanT bean) throws AccessorException { - throw new AccessorException(Messages.NO_GETTER.format(setter.toString())); - } - } - - /** - * Gets the special {@link Accessor} used to recover from errors. - */ - @SuppressWarnings("unchecked") - public static Accessor getErrorInstance() { - return ERROR; - } - - private static final Accessor ERROR = new Accessor(Object.class) { - public Object get(Object o) { - return null; - } - - public void set(Object o, Object o1) { - } - }; - - /** - * {@link Accessor} for {@link JAXBElement#getValue()}. - */ - public static final Accessor JAXB_ELEMENT_VALUE = new Accessor(Object.class) { - public Object get(JAXBElement jaxbElement) { - return jaxbElement.getValue(); - } - - public void set(JAXBElement jaxbElement, Object o) { - jaxbElement.setValue(o); - } - }; - - /** - * Uninitialized map keyed by their classes. - */ - private static final Map uninitializedValues = new HashMap(); - - static { -/* - static byte default_value_byte = 0; - static boolean default_value_boolean = false; - static char default_value_char = 0; - static float default_value_float = 0; - static double default_value_double = 0; - static int default_value_int = 0; - static long default_value_long = 0; - static short default_value_short = 0; -*/ - 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)); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/AdaptedAccessor.java 2018-01-30 20:34:10.000000000 -0500 +++ /dev/null 2018-01-30 20:34:10.000000000 -0500 @@ -1,103 +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.xml.internal.bind.v2.runtime.reflect; - -import javax.xml.bind.annotation.adapters.XmlAdapter; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.ClassFactory; -import com.sun.xml.internal.bind.v2.model.core.Adapter; -import com.sun.xml.internal.bind.v2.runtime.Coordinator; - -/** - * {@link Accessor} that adapts the value by using {@link Adapter}. - * - * @see Accessor#adapt - * @author Kohsuke Kawaguchi - */ -final class AdaptedAccessor extends Accessor { - private final Accessor core; - private final Class> adapter; - - /*pacakge*/ AdaptedAccessor(Class targetType, Accessor extThis, Class> adapter) { - super(targetType); - this.core = extThis; - this.adapter = adapter; - } - - @Override - public boolean isAdapted() { - return true; - } - - public OnWireValueT get(BeanT bean) throws AccessorException { - InMemValueT v = core.get(bean); - - XmlAdapter a = getAdapter(); - try { - return a.marshal(v); - } catch (Exception e) { - throw new AccessorException(e); - } - } - - public void set(BeanT bean, OnWireValueT o) throws AccessorException { - XmlAdapter a = getAdapter(); - try { - core.set(bean, (o == null ? null : a.unmarshal(o))); - } catch (Exception e) { - throw new AccessorException(e); - } - } - - public Object getUnadapted(BeanT bean) throws AccessorException { - return core.getUnadapted(bean); - } - - public void setUnadapted(BeanT bean, Object value) throws AccessorException { - core.setUnadapted(bean,value); - } - - /** - * Sometimes Adapters are used directly by JAX-WS outside any - * {@link Coordinator}. Use this lazily-created cached - * {@link XmlAdapter} in such cases. - */ - private XmlAdapter staticAdapter; - - private XmlAdapter getAdapter() { - Coordinator coordinator = Coordinator._getInstance(); - if(coordinator!=null) - return coordinator.getAdapter(adapter); - else { - synchronized(this) { - if(staticAdapter==null) - staticAdapter = ClassFactory.create(adapter); - } - return staticAdapter; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/AdaptedLister.java 2018-01-30 20:34:11.000000000 -0500 +++ /dev/null 2018-01-30 20:34:11.000000000 -0500 @@ -1,105 +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.xml.internal.bind.v2.runtime.reflect; - -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.JAXBException; - -import com.sun.xml.internal.bind.v2.runtime.Coordinator; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.api.AccessorException; - -import org.xml.sax.SAXException; - -/** - * {@link Lister} that adapts individual item types. - */ -final class AdaptedLister extends Lister { - private final Lister core; - private final Class> adapter; - - /*package*/ AdaptedLister( - Lister core, - Class> adapter) { - - this.core = core; - this.adapter = adapter; - } - - private XmlAdapter getAdapter() { - return Coordinator._getInstance().getAdapter(adapter); - } - - public ListIterator iterator(PropT prop, XMLSerializer context) { - return new ListIteratorImpl( core.iterator(prop,context), context ); - } - - public PackT startPacking(BeanT bean, Accessor accessor) throws AccessorException { - return core.startPacking(bean,accessor); - } - - public void addToPack(PackT pack, OnWireItemT item) throws AccessorException { - InMemItemT r; - try { - r = getAdapter().unmarshal(item); - } catch (Exception e) { - throw new AccessorException(e); - } - core.addToPack(pack,r); - } - - public void endPacking(PackT pack, BeanT bean, Accessor accessor) throws AccessorException { - core.endPacking(pack,bean,accessor); - } - - public void reset(BeanT bean, Accessor accessor) throws AccessorException { - core.reset(bean,accessor); - } - - private final class ListIteratorImpl implements ListIterator { - private final ListIterator core; - private final XMLSerializer serializer; - - public ListIteratorImpl(ListIterator core,XMLSerializer serializer) { - this.core = core; - this.serializer = serializer; - } - - public boolean hasNext() { - return core.hasNext(); - } - - public OnWireItemT next() throws SAXException, JAXBException { - InMemItemT next = core.next(); - try { - return getAdapter().marshal(next); - } catch (Exception e) { - serializer.reportError(null,e); - return null; // recover this error by returning null - } - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/DefaultTransducedAccessor.java 2018-01-30 20:34:12.000000000 -0500 +++ /dev/null 2018-01-30 20:34:12.000000000 -0500 @@ -1,60 +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.xml.internal.bind.v2.runtime.reflect; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.Name; - -import org.xml.sax.SAXException; - -/** - * {@link TransducedAccessor} that prints to {@link String}. - * - *

- * The print method that works for {@link String} determines the dispatching - * of the {@link #writeText(XMLSerializer,Object,String)} and - * {@link #writeLeafElement(XMLSerializer, Name, Object, String)} methods, - * so those are implemented here. - * - * @author Kohsuke Kawaguchi - */ -public abstract class DefaultTransducedAccessor extends TransducedAccessor { - - public abstract String print(T o) throws AccessorException, SAXException; - - public void writeLeafElement(XMLSerializer w, Name tagName, T o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException { - w.leafElement(tagName,print(o),fieldName); - } - - public void writeText(XMLSerializer w, T o, String fieldName) throws AccessorException, SAXException, IOException, XMLStreamException { - w.text(print(o),fieldName); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/ListIterator.java 2018-01-30 20:34:12.000000000 -0500 +++ /dev/null 2018-01-30 20:34:12.000000000 -0500 @@ -1,53 +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.xml.internal.bind.v2.runtime.reflect; - -import java.util.Iterator; - -import javax.xml.bind.JAXBException; - -import org.xml.sax.SAXException; - -/** - * Almost like {@link Iterator} but can throw JAXB specific exceptions. - * @author Kohsuke Kawaguchi - */ -public interface ListIterator { - /** - * Works like {@link Iterator#hasNext()}. - */ - boolean hasNext(); - - /** - * Works like {@link Iterator#next()}. - * - * @throws SAXException - * if an error is found, reported, and we were told to abort - * @throws JAXBException - * if an error is found, reported, and we were told to abort - */ - E next() throws SAXException, JAXBException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/ListTransducedAccessorImpl.java 2018-01-30 20:34:13.000000000 -0500 +++ /dev/null 2018-01-30 20:34:13.000000000 -0500 @@ -1,146 +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.xml.internal.bind.v2.runtime.reflect; - -import javax.xml.bind.JAXBException; - -import com.sun.xml.internal.bind.WhiteSpaceProcessor; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -import org.xml.sax.SAXException; - -/** - * {@link TransducedAccessor} for a list simple type. - * - * @author Kohsuke Kawaguchi - */ -public final class ListTransducedAccessorImpl extends DefaultTransducedAccessor { - /** - * {@link Transducer} for each item type. - */ - private final Transducer xducer; - /** - * {@link Lister} for handling list of tokens. - */ - private final Lister lister; - /** - * {@link Accessor} to get/set the list. - */ - private final Accessor acc; - - public ListTransducedAccessorImpl(Transducer xducer, Accessor acc, Lister lister) { - this.xducer = xducer; - this.lister = lister; - this.acc = acc; - } - - public boolean useNamespace() { - return xducer.useNamespace(); - } - - public void declareNamespace(BeanT bean, XMLSerializer w) throws AccessorException, SAXException { - ListT list = acc.get(bean); - - if(list!=null) { - ListIterator itr = lister.iterator(list, w); - - while(itr.hasNext()) { - try { - ItemT item = itr.next(); - if (item != null) { - xducer.declareNamespace(item,w); - } - } catch (JAXBException e) { - w.reportError(null,e); - } - } - } - } - - // TODO: this is inefficient, consider a redesign - // perhaps we should directly write to XMLSerializer, - // or maybe add more methods like writeLeafElement. - public String print(BeanT o) throws AccessorException, SAXException { - ListT list = acc.get(o); - - if(list==null) - return null; - - StringBuilder buf = new StringBuilder(); - XMLSerializer w = XMLSerializer.getInstance(); - ListIterator itr = lister.iterator(list, w); - - while(itr.hasNext()) { - try { - ItemT item = itr.next(); - if (item != null) { - if(buf.length()>0) buf.append(' '); - buf.append(xducer.print(item)); - } - } catch (JAXBException e) { - w.reportError(null,e); - } - } - return buf.toString(); - } - - private void processValue(BeanT bean, CharSequence s) throws AccessorException, SAXException { - PackT pack = lister.startPacking(bean,acc); - - int idx = 0; - int len = s.length(); - - while(true) { - int p = idx; - while( p { - - protected Lister() {} - - /** - * Iterates values of a multi-value property. - * - * @param context - * This parameter is used to support ID/IDREF handling. - */ - public abstract ListIterator iterator(PropT multiValueProp, XMLSerializer context); - - /** - * Setting values to a multi-value property starts by creating - * a transient object called "pack" from the current field. - */ - public abstract PackT startPacking(BeanT bean, Accessor acc) throws AccessorException; - - /** - * Once the {@link #startPacking} is called, you can - * add values to the pack by using this method. - */ - public abstract void addToPack( PackT pack, ItemT newValue ) throws AccessorException; - - /** - * Finally, call this method to - * wraps up the {@code pack}. This method may update the field of - * the given bean. - */ - public abstract void endPacking( PackT pack, BeanT bean, Accessor acc ) throws AccessorException; - - /** - * Clears the values of the property. - */ - public abstract void reset(BeanT o,Accessor acc) throws AccessorException; - - - /** - * Gets a reference to the appropriate {@link Lister} object - * if the field is a multi-value field. Otherwise null. - * - * @param fieldType - * the type of the field that stores the collection - * @param idness - * ID-ness of the property. - * @param adapter - * adapter to be used for individual items. can be null. - */ - public static - Lister create(Type fieldType,ID idness, Adapter adapter) { - - Class rawType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(fieldType); - Class itemType; - - Lister l; - if( rawType.isArray() ) { - itemType = rawType.getComponentType(); - l = getArrayLister(itemType); - } else - if( Collection.class.isAssignableFrom(rawType) ) { - Type bt = Utils.REFLECTION_NAVIGATOR.getBaseClass(fieldType,Collection.class); - if(bt instanceof ParameterizedType) - itemType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)bt).getActualTypeArguments()[0]); - else - itemType = Object.class; - l = new CollectionLister(getImplClass(rawType)); - } else - return null; - - if(idness==ID.IDREF) - l = new IDREFS(l,itemType); - - if(adapter!=null) - l = new AdaptedLister(l,adapter.adapterType); - - return l; - } - - private static Class getImplClass(Class fieldType) { - return ClassFactory.inferImplClass(fieldType,COLLECTION_IMPL_CLASSES); - } - - /** - * Cache instances of {@link ArrayLister}s. - */ - private static final Map> arrayListerCache = - Collections.synchronizedMap(new WeakHashMap>()); - - /** - * Creates a lister for array type. - */ - private static Lister getArrayLister( Class componentType ) { - Lister l=null; - if(componentType.isPrimitive()) - l = primitiveArrayListers.get(componentType); - else { - WeakReference wr = arrayListerCache.get(componentType); - if(wr!=null) - l = wr.get(); - if(l==null) { - l = new ArrayLister(componentType); - arrayListerCache.put(componentType,new WeakReference(l)); - } - } - assert l!=null; - return l; - } - - /** - * {@link Lister} for an array. - * - *

- * Array packing is slower, but we expect this to be used less frequently than - * the {@link CollectionLister}. - */ - private static final class ArrayLister extends Lister> { - - private final Class itemType; - - public ArrayLister(Class itemType) { - this.itemType = itemType; - } - - public ListIterator iterator(final ItemT[] objects, XMLSerializer context) { - return new ListIterator() { - int idx=0; - public boolean hasNext() { - return idx acc) { - return new Pack(itemType); - } - - public void addToPack(Pack objects, ItemT o) { - objects.add(o); - } - - public void endPacking( Pack pack, BeanT bean, Accessor acc ) throws AccessorException { - acc.set(bean,pack.build()); - } - - public void reset(BeanT o,Accessor acc) throws AccessorException { - acc.set(o,(ItemT[])Array.newInstance(itemType,0)); - } - - } - - public static final class Pack extends ArrayList { - private final Class itemType; - - public Pack(Class itemType) { - this.itemType = itemType; - } - - public ItemT[] build() { - return super.toArray( (ItemT[])Array.newInstance(itemType,size()) ); - } - } - - /** - * Listers for the primitive type arrays, keyed by their primitive Class object. - */ - /*package*/ static final Map primitiveArrayListers = new HashMap(); - - static { - // register primitive array listers - PrimitiveArrayListerBoolean.register(); - PrimitiveArrayListerByte.register(); - PrimitiveArrayListerCharacter.register(); - PrimitiveArrayListerDouble.register(); - PrimitiveArrayListerFloat.register(); - PrimitiveArrayListerInteger.register(); - PrimitiveArrayListerLong.register(); - PrimitiveArrayListerShort.register(); - } - - /** - * {@link Lister} for a collection - */ - public static final class CollectionLister extends Lister { - - /** - * Sometimes we need to create a new instance of a collection. - * This is such an implementation class. - */ - private final Class implClass; - - public CollectionLister(Class implClass) { - this.implClass = implClass; - } - - public ListIterator iterator(T collection, XMLSerializer context) { - final Iterator itr = collection.iterator(); - return new ListIterator() { - public boolean hasNext() { - return itr.hasNext(); - } - public Object next() { - return itr.next(); - } - }; - } - - public T startPacking(BeanT bean, Accessor acc) throws AccessorException { - T collection = acc.get(bean); - if(collection==null) { - collection = ClassFactory.create(implClass); - if(!acc.isAdapted()) - acc.set(bean,collection); - } - collection.clear(); - return collection; - } - - public void addToPack(T collection, Object o) { - collection.add(o); - } - - public void endPacking( T collection, BeanT bean, Accessor acc ) throws AccessorException { - // this needs to be done in the endPacking, because - // sometimes the accessor uses an adapter, and the adapter needs to see - // the whole thing. - - // but always doing so causes a problem when this collection property - // is getter-only - - // invoke set when possible (see Issue 488) - try { - if (acc.isAdapted()) { - acc.set(bean,collection); - } - } catch (AccessorException ae) { - if(acc.isAdapted()) throw ae; - } - } - - public void reset(BeanT bean, Accessor acc) throws AccessorException { - T collection = acc.get(bean); - if(collection == null) { - return; - } - collection.clear(); - } - } - - /** - * {@link Lister} for IDREFS. - */ - private static final class IDREFS extends Lister.Pack> { - private final Lister core; - /** - * Expected type to which IDREF resolves to. - */ - private final Class itemType; - - public IDREFS(Lister core, Class itemType) { - this.core = core; - this.itemType = itemType; - } - - public ListIterator iterator(PropT prop, XMLSerializer context) { - final ListIterator i = core.iterator(prop,context); - - return new IDREFSIterator(i, context); - } - - public Pack startPacking(BeanT bean, Accessor acc) { - return new Pack(bean,acc); - } - - public void addToPack(Pack pack, String item) { - pack.add(item); - } - - public void endPacking(Pack pack, BeanT bean, Accessor acc) { - } - - public void reset(BeanT bean, Accessor acc) throws AccessorException { - core.reset(bean,acc); - } - - /** - * PackT for this lister. - */ - private class Pack implements Patcher { - private final BeanT bean; - private final List idrefs = new ArrayList(); - private final UnmarshallingContext context; - private final Accessor acc; - private final LocatorEx location; - - public Pack(BeanT bean, Accessor acc) { - this.bean = bean; - this.acc = acc; - this.context = UnmarshallingContext.getInstance(); - this.location = new LocatorEx.Snapshot(context.getLocator()); - context.addPatcher(this); - } - - public void add(String item) { - idrefs.add(item); - } - - /** - * Resolves IDREFS and fill in the actual array. - */ - public void run() throws SAXException { - try { - Object pack = core.startPacking(bean,acc); - - for( String id : idrefs ) { - Callable callable = context.getObjectFromId(id,itemType); - Object t; - - try { - t = (callable!=null) ? callable.call() : null; - } catch (SAXException e) { - throw e; - } catch (Exception e) { - throw new SAXException2(e); - } - - if(t==null) { - context.errorUnresolvedIDREF(bean,id,location); - } else { - TODO.prototype(); // TODO: check if the type of t is proper. - core.addToPack(pack,t); - } - } - - core.endPacking(pack,bean,acc); - } catch (AccessorException e) { - context.handleError(e); - } - } - } - } - - /** - * {@link Iterator} for IDREFS lister. - * - *

- * Only in ArrayElementProperty we need to get the actual - * referenced object. This is a kind of ugly way to make that work. - */ - public static final class IDREFSIterator implements ListIterator { - private final ListIterator i; - private final XMLSerializer context; - private Object last; - - private IDREFSIterator(ListIterator i, XMLSerializer context) { - this.i = i; - this.context = context; - } - - public boolean hasNext() { - return i.hasNext(); - } - - /** - * Returns the last referenced object (not just its ID) - */ - public Object last() { - return last; - } - - public String next() throws SAXException, JAXBException { - last = i.next(); - String id = context.grammar.getBeanInfo(last,true).getId(last,context); - if(id==null) { - context.errorMissingId(last); - } - return id; - } - } - - /** - * Gets the special {@link Lister} used to recover from an error. - */ - @SuppressWarnings("unchecked") - public static Lister getErrorInstance() { - return ERROR; - } - - public static final Lister ERROR = new Lister() { - public ListIterator iterator(Object o, XMLSerializer context) { - return EMPTY_ITERATOR; - } - - public Object startPacking(Object o, Accessor accessor) { - return null; - } - - public void addToPack(Object o, Object o1) { - } - - public void endPacking(Object o, Object o1, Accessor accessor) { - } - - public void reset(Object o, Accessor accessor) { - } - }; - - private static final ListIterator EMPTY_ITERATOR = new ListIterator() { - public boolean hasNext() { - return false; - } - - public Object next() { - throw new IllegalStateException(); - } - }; - - private static final Class[] COLLECTION_IMPL_CLASSES = new Class[] { - ArrayList.class, - LinkedList.class, - HashSet.class, - TreeSet.class, - Stack.class - }; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages.java 2018-01-30 20:34:14.000000000 -0500 +++ /dev/null 2018-01-30 20:34:14.000000000 -0500 @@ -1,51 +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.xml.internal.bind.v2.runtime.reflect; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Message resources - */ -enum Messages { - // Accessor - UNABLE_TO_ACCESS_NON_PUBLIC_FIELD, // 2 args - UNASSIGNABLE_TYPE, // 2 args - NO_SETTER, // 1 arg - NO_GETTER, // 1 arg - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages.properties 2018-01-30 20:34:15.000000000 -0500 +++ /dev/null 2018-01-30 20:34:15.000000000 -0500 @@ -1,43 +0,0 @@ -# -# 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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = \ - Unable to make {0}.{1} accessible. - -UNASSIGNABLE_TYPE = \ - The type of the field is {0}, but the type of the object is {1} - -# these are normally developer error, so they should be verbose. -NO_SETTER = \ - The property has a getter "{0}" but no setter. \ - For unmarshalling, please define setters. \ - (Or if this is a collection property, make sure that the getter returns a collection instance.) - -NO_GETTER = \ - The property has a setter "{0}" but no getter. \ - For marshaller, please define getters. - -INVALID_XML_ENUM_VALUE = \ - "{0}" is not a valid value for {1}. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages_de.properties 2018-01-30 20:34:16.000000000 -0500 +++ /dev/null 2018-01-30 20:34:16.000000000 -0500 @@ -1,33 +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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = {0}.{1} kann nicht zug\u00E4nglich gemacht werden. - -UNASSIGNABLE_TYPE = Der Typ des Feldes ist {0}, der Typ des Objekts ist jedoch {1} - -# these are normally developer error, so they should be verbose. -NO_SETTER = Die Eigenschaft enth\u00E4lt einen Getter "{0}", jedoch keinen Setter. F\u00FCr das Unmarshalling m\u00FCssen Sie Setter definieren. (Wenn es sich jedoch um eine Collection-Eigenschaft handelt, muss der Getter eine Collection-Instanz zur\u00FCckgeben.) - -NO_GETTER = Die Eigenschaft enth\u00E4lt einen Setter "{0}", jedoch keinen Getter. F\u00FCr das Marshalling m\u00FCssen Sie Getter definieren. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages_es.properties 2018-01-30 20:34:16.000000000 -0500 +++ /dev/null 2018-01-30 20:34:16.000000000 -0500 @@ -1,33 +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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = No se ha podido permitir el acceso a {0}.{1}. - -UNASSIGNABLE_TYPE = El tipo del campo es {0}, pero el tipo del objeto es {1} - -# these are normally developer error, so they should be verbose. -NO_SETTER = La propiedad tiene un getter "{0}" pero no un setter. Para anular la canalizaci\u00F3n, defina setters. (O bien, si se trata de una propiedad de recopilaci\u00F3n, aseg\u00FArese de que el getter devuelve una instancia de recopilaci\u00F3n.) - -NO_GETTER = La propiedad tiene un setter "{0}", pero no un getter. Defina getters para el marshaller. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages_fr.properties 2018-01-30 20:34:17.000000000 -0500 +++ /dev/null 2018-01-30 20:34:17.000000000 -0500 @@ -1,33 +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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = Impossible de rendre {0}.{1} accessible. - -UNASSIGNABLE_TYPE = Le type du champ est {0}, mais le type de l''objet est {1} - -# these are normally developer error, so they should be verbose. -NO_SETTER = La propri\u00E9t\u00E9 comporte une m\u00E9thode get "{0}" mais aucune m\u00E9thode set. Pour la d\u00E9s\u00E9rialisation, d\u00E9finissez des m\u00E9thodes set. (S''il s''agit d''une propri\u00E9t\u00E9 de collection, assurez-vous que la m\u00E9thode get renvoie une instance de collection.) - -NO_GETTER = La propri\u00E9t\u00E9 comporte une m\u00E9thode set "{0}" mais aucune m\u00E9thode get. Pour le s\u00E9rialiseur, d\u00E9finissez des m\u00E9thodes get. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages_it.properties 2018-01-30 20:34:18.000000000 -0500 +++ /dev/null 2018-01-30 20:34:18.000000000 -0500 @@ -1,33 +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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = Impossibile rendere accessibile {0}.{1}. - -UNASSIGNABLE_TYPE = Il tipo del campo \u00E8 {0} mentre quello dell''oggetto \u00E8 {1} - -# these are normally developer error, so they should be verbose. -NO_SETTER = La propriet\u00E0 dispone di un getter "{0}" ma non di un setter. Per eseguire l''unmarshalling, definire i setter (oppure, se si tratta di una propriet\u00E0 della raccolta, assicurarsi che il getter restituisca un''istanza della raccolta). - -NO_GETTER = La propriet\u00E0 dispone di un setter "{0}" ma non di un getter. Per il marshaller, definire i getter. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages_ja.properties 2018-01-30 20:34:18.000000000 -0500 +++ /dev/null 2018-01-30 20:34:19.000000000 -0500 @@ -1,33 +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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = {0}.{1}\u3092\u30A2\u30AF\u30BB\u30B9\u53EF\u80FD\u306B\u3067\u304D\u307E\u305B\u3093\u3002 - -UNASSIGNABLE_TYPE = \u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u30BF\u30A4\u30D7\u306F{0}\u3067\u3059\u304C\u3001\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u30BF\u30A4\u30D7\u306F{1}\u3067\u3059 - -# these are normally developer error, so they should be verbose. -NO_SETTER = \u30D7\u30ED\u30D1\u30C6\u30A3\u306Bgetter "{0}"\u304C\u3042\u308A\u307E\u3059\u304C\u3001setter\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u30A2\u30F3\u30DE\u30FC\u30B7\u30E3\u30EA\u30F3\u30B0\u306E\u305F\u3081\u306B\u3001setter\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044(\u307E\u305F\u306F\u3001\u3053\u308C\u304C\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u30FB\u30D7\u30ED\u30D1\u30C6\u30A3\u306E\u5834\u5408\u306F\u3001getter\u304C\u30B3\u30EC\u30AF\u30B7\u30E7\u30F3\u30FB\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u8FD4\u3059\u3053\u3068\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044)\u3002 - -NO_GETTER = \u30D7\u30ED\u30D1\u30C6\u30A3\u306Bsetter "{0}"\u304C\u3042\u308A\u307E\u3059\u304C\u3001getter\u304C\u3042\u308A\u307E\u305B\u3093\u3002marshaller\u306E\u305F\u3081\u306B\u3001getter\u3092\u5B9A\u7FA9\u3057\u3066\u304F\u3060\u3055\u3044\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages_ko.properties 2018-01-30 20:34:19.000000000 -0500 +++ /dev/null 2018-01-30 20:34:19.000000000 -0500 @@ -1,33 +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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = {0}.{1}\uC744(\uB97C) \uC561\uC138\uC2A4 \uAC00\uB2A5\uD55C \uC0C1\uD0DC\uB85C \uC124\uC815\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. - -UNASSIGNABLE_TYPE = \uD544\uB4DC\uC758 \uC720\uD615\uC740 {0}, \uAC1D\uCCB4\uC758 \uC720\uD615\uC740 {1}\uC785\uB2C8\uB2E4. - -# these are normally developer error, so they should be verbose. -NO_SETTER = \uC18D\uC131\uC5D0 getter "{0}"\uC740(\uB294) \uC788\uC9C0\uB9CC setter\uB294 \uC5C6\uC2B5\uB2C8\uB2E4. \uB9C8\uC15C\uB9C1 \uD574\uC81C\uC5D0 \uB300\uD55C setter\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624. \uB610\uB294 \uC774 \uC18D\uC131\uC774 \uBAA8\uC74C \uC18D\uC131\uC77C \uACBD\uC6B0 getter\uAC00 \uBAA8\uC74C \uC778\uC2A4\uD134\uC2A4\uB97C \uBC18\uD658\uD558\uB294\uC9C0 \uD655\uC778\uD558\uC2ED\uC2DC\uC624. - -NO_GETTER = \uC18D\uC131\uC5D0 setter "{0}"\uC740(\uB294) \uC788\uC9C0\uB9CC getter\uB294 \uC5C6\uC2B5\uB2C8\uB2E4. \uB9C8\uC15C\uB7EC\uC5D0 \uB300\uD55C getter\uB97C \uC815\uC758\uD558\uC2ED\uC2DC\uC624. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages_pt_BR.properties 2018-01-30 20:34:20.000000000 -0500 +++ /dev/null 2018-01-30 20:34:20.000000000 -0500 @@ -1,33 +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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = N\u00E3o \u00E9 poss\u00EDvel tornar {0}.{1} acess\u00EDvel. - -UNASSIGNABLE_TYPE = O tipo de campo \u00E9 {0}, mas o tipo de objeto \u00E9 {1} - -# these are normally developer error, so they should be verbose. -NO_SETTER = A propriedade tem um getter "{0}", mas nenhum setter. Para cancelar o marshal, defina os setters. (Ou, se esta for uma propriedade de coleta, certifique-se de que getter retorne uma inst\u00E2ncia da coleta). - -NO_GETTER = A propriedade tem um setter "{0}", mas nenhum getter. Para marshaller, defina os getters. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages_zh_CN.properties 2018-01-30 20:34:21.000000000 -0500 +++ /dev/null 2018-01-30 20:34:21.000000000 -0500 @@ -1,33 +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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = \u65E0\u6CD5\u4F7F{0}.{1}\u6210\u4E3A\u53EF\u8BBF\u95EE\u7684\u3002 - -UNASSIGNABLE_TYPE = \u5B57\u6BB5\u7684\u7C7B\u578B\u4E3A{0}, \u800C\u5BF9\u8C61\u7684\u7C7B\u578B\u4E3A{1} - -# these are normally developer error, so they should be verbose. -NO_SETTER = \u6B64\u5C5E\u6027\u5177\u6709 getter "{0}" \u4F46\u6CA1\u6709 setter\u3002\u8981\u89E3\u7F16\u96C6, \u8BF7\u5B9A\u4E49 setter\u3002(\u5982\u679C\u8FD9\u662F\u96C6\u5408\u5C5E\u6027, \u8BF7\u786E\u4FDD getter \u8FD4\u56DE\u96C6\u5408\u5B9E\u4F8B\u3002) - -NO_GETTER = \u6B64\u5C5E\u6027\u5177\u6709 setter "{0}" \u4F46\u6CA1\u6709 getter\u3002\u8981\u7528\u4E8E\u7F16\u96C6\u5668, \u8BF7\u5B9A\u4E49 getter\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Messages_zh_TW.properties 2018-01-30 20:34:21.000000000 -0500 +++ /dev/null 2018-01-30 20:34:21.000000000 -0500 @@ -1,33 +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. -# - -UNABLE_TO_ACCESS_NON_PUBLIC_FIELD = \u7121\u6CD5\u5C07 {0}.{1} \u8A2D\u70BA\u53EF\u5B58\u53D6. - -UNASSIGNABLE_TYPE = \u6B04\u4F4D\u7684\u985E\u578B\u70BA {0}, \u4F46\u7269\u4EF6\u7684\u985E\u578B\u70BA {1} - -# these are normally developer error, so they should be verbose. -NO_SETTER = \u7279\u6027\u5305\u542B getter "{0}", \u4F46\u672A\u5305\u542B setter. \u82E5\u8981\u89E3\u9664\u5C01\u9001\u8655\u7406 (Unmarshal), \u8ACB\u5B9A\u7FA9 setter. (\u6216\u8005, \u82E5\u9019\u662F\u96C6\u5408\u7279\u6027, \u8ACB\u78BA\u5B9A getter \u6703\u50B3\u56DE\u96C6\u5408\u57F7\u884C\u8655\u7406.) - -NO_GETTER = \u7279\u6027\u5305\u542B setter "{0}", \u4F46\u672A\u5305\u542B getter. \u8ACB\u5B9A\u7FA9\u5C01\u9001\u8655\u7406\u7A0B\u5F0F (Marshaller) \u7684 getter. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/NullSafeAccessor.java 2018-01-30 20:34:22.000000000 -0500 +++ /dev/null 2018-01-30 20:34:22.000000000 -0500 @@ -1,63 +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.xml.internal.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.api.AccessorException; - -/** - * {@link Accessor} wrapper that replaces a null with an empty collection. - * - *

- * This is so that JAX-WS property accessor will work like an ordinary getter. - * - * - * @author Kohsuke Kawaguchi - */ -public class NullSafeAccessor extends Accessor { - private final Accessor core; - private final Lister lister; - - public NullSafeAccessor(Accessor core, Lister lister) { - super(core.getValueType()); - this.core = core; - this.lister = lister; - } - - public V get(B bean) throws AccessorException { - V v = core.get(bean); - if(v==null) { - // creates a new object - P pack = lister.startPacking(bean,core); - lister.endPacking(pack,bean,core); - v = core.get(bean); - } - return v; - } - - public void set(B bean, V value) throws AccessorException { - core.set(bean,value); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/PrimitiveArrayListerBoolean.java 2018-01-30 20:34:22.000000000 -0500 +++ /dev/null 2018-01-30 20:34:23.000000000 -0500 @@ -1,104 +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.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -/** - * {@link Lister} for primitive type arrays. - *

- * Auto-generated, do not edit. - *

- *

- * B y t e ArrayLister is used as the master to generate the rest of the - * lister classes. Do not modify the generated copies. - *

- */ -final class PrimitiveArrayListerBoolean extends Lister { - - private PrimitiveArrayListerBoolean() { - } - - /*package*/ static void register() { - Lister.primitiveArrayListers.put(Boolean.TYPE,new PrimitiveArrayListerBoolean()); - } - - public ListIterator iterator(final boolean[] objects, XMLSerializer context) { - return new ListIterator() { - int idx=0; - public boolean hasNext() { - return idx acc) { - return new BooleanArrayPack(); - } - - public void addToPack(BooleanArrayPack objects, Boolean o) { - objects.add(o); - } - - public void endPacking( BooleanArrayPack pack, BeanT bean, Accessor acc ) throws AccessorException { - acc.set(bean,pack.build()); - } - - public void reset(BeanT o,Accessor acc) throws AccessorException { - acc.set(o,new boolean[0]); - } - - static final class BooleanArrayPack { - boolean[] buf = new boolean[16]; - int size; - - void add(Boolean b) { - if(buf.length==size) { - // realloc - boolean[] nb = new boolean[buf.length*2]; - System.arraycopy(buf,0,nb,0,buf.length); - buf = nb; - } - if(b!=null) - buf[size++] = b; - } - - boolean[] build() { - if(buf.length==size) - // if we are lucky enough - return buf; - - boolean[] r = new boolean[size]; - System.arraycopy(buf,0,r,0,size); - return r; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/PrimitiveArrayListerByte.java 2018-01-30 20:34:23.000000000 -0500 +++ /dev/null 2018-01-30 20:34:23.000000000 -0500 @@ -1,101 +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.xml.internal.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -/** - * {@link Lister} for primitive type arrays. - * - *

- * B y t e ArrayLister is used as the master to generate the rest of the - * lister classes. Do not modify the generated copies. - */ -final class PrimitiveArrayListerByte extends Lister { - - private PrimitiveArrayListerByte() { - } - - /*package*/ static void register() { - Lister.primitiveArrayListers.put(Byte.TYPE,new PrimitiveArrayListerByte()); - } - - public ListIterator iterator(final byte[] objects, XMLSerializer context) { - return new ListIterator() { - int idx=0; - public boolean hasNext() { - return idx acc) { - return new ByteArrayPack(); - } - - public void addToPack(ByteArrayPack objects, Byte o) { - objects.add(o); - } - - public void endPacking( ByteArrayPack pack, BeanT bean, Accessor acc ) throws AccessorException { - acc.set(bean,pack.build()); - } - - public void reset(BeanT o,Accessor acc) throws AccessorException { - acc.set(o,new byte[0]); - } - - static final class ByteArrayPack { - byte[] buf = new byte[16]; - int size; - - void add(Byte b) { - if(buf.length==size) { - // realloc - byte[] nb = new byte[buf.length*2]; - System.arraycopy(buf,0,nb,0,buf.length); - buf = nb; - } - if(b!=null) - buf[size++] = b; - } - - byte[] build() { - if(buf.length==size) - // if we are lucky enough - return buf; - - byte[] r = new byte[size]; - System.arraycopy(buf,0,r,0,size); - return r; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/PrimitiveArrayListerCharacter.java 2018-01-30 20:34:24.000000000 -0500 +++ /dev/null 2018-01-30 20:34:24.000000000 -0500 @@ -1,104 +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.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -/** - * {@link Lister} for primitive type arrays. - *

- * Auto-generated, do not edit. - *

- *

- * B y t e ArrayLister is used as the master to generate the rest of the - * lister classes. Do not modify the generated copies. - *

- */ -final class PrimitiveArrayListerCharacter extends Lister { - - private PrimitiveArrayListerCharacter() { - } - - /*package*/ static void register() { - Lister.primitiveArrayListers.put(Character.TYPE,new PrimitiveArrayListerCharacter()); - } - - public ListIterator iterator(final char[] objects, XMLSerializer context) { - return new ListIterator() { - int idx=0; - public boolean hasNext() { - return idx acc) { - return new CharacterArrayPack(); - } - - public void addToPack(CharacterArrayPack objects, Character o) { - objects.add(o); - } - - public void endPacking( CharacterArrayPack pack, BeanT bean, Accessor acc ) throws AccessorException { - acc.set(bean,pack.build()); - } - - public void reset(BeanT o,Accessor acc) throws AccessorException { - acc.set(o,new char[0]); - } - - static final class CharacterArrayPack { - char[] buf = new char[16]; - int size; - - void add(Character b) { - if(buf.length==size) { - // realloc - char[] nb = new char[buf.length*2]; - System.arraycopy(buf,0,nb,0,buf.length); - buf = nb; - } - if(b!=null) - buf[size++] = b; - } - - char[] build() { - if(buf.length==size) - // if we are lucky enough - return buf; - - char[] r = new char[size]; - System.arraycopy(buf,0,r,0,size); - return r; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/PrimitiveArrayListerDouble.java 2018-01-30 20:34:24.000000000 -0500 +++ /dev/null 2018-01-30 20:34:24.000000000 -0500 @@ -1,104 +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.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -/** - * {@link Lister} for primitive type arrays. - *

- * Auto-generated, do not edit. - *

- *

- * B y t e ArrayLister is used as the master to generate the rest of the - * lister classes. Do not modify the generated copies. - *

- */ -final class PrimitiveArrayListerDouble extends Lister { - - private PrimitiveArrayListerDouble() { - } - - /*package*/ static void register() { - Lister.primitiveArrayListers.put(Double.TYPE,new PrimitiveArrayListerDouble()); - } - - public ListIterator iterator(final double[] objects, XMLSerializer context) { - return new ListIterator() { - int idx=0; - public boolean hasNext() { - return idx acc) { - return new DoubleArrayPack(); - } - - public void addToPack(DoubleArrayPack objects, Double o) { - objects.add(o); - } - - public void endPacking( DoubleArrayPack pack, BeanT bean, Accessor acc ) throws AccessorException { - acc.set(bean,pack.build()); - } - - public void reset(BeanT o,Accessor acc) throws AccessorException { - acc.set(o,new double[0]); - } - - static final class DoubleArrayPack { - double[] buf = new double[16]; - int size; - - void add(Double b) { - if(buf.length==size) { - // realloc - double[] nb = new double[buf.length*2]; - System.arraycopy(buf,0,nb,0,buf.length); - buf = nb; - } - if(b!=null) - buf[size++] = b; - } - - double[] build() { - if(buf.length==size) - // if we are lucky enough - return buf; - - double[] r = new double[size]; - System.arraycopy(buf,0,r,0,size); - return r; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/PrimitiveArrayListerFloat.java 2018-01-30 20:34:25.000000000 -0500 +++ /dev/null 2018-01-30 20:34:25.000000000 -0500 @@ -1,104 +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.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -/** - * {@link Lister} for primitive type arrays. - *

- * Auto-generated, do not edit. - *

- *

- * B y t e ArrayLister is used as the master to generate the rest of the - * lister classes. Do not modify the generated copies. - *

- */ -final class PrimitiveArrayListerFloat extends Lister { - - private PrimitiveArrayListerFloat() { - } - - /*package*/ static void register() { - Lister.primitiveArrayListers.put(Float.TYPE,new PrimitiveArrayListerFloat()); - } - - public ListIterator iterator(final float[] objects, XMLSerializer context) { - return new ListIterator() { - int idx=0; - public boolean hasNext() { - return idx acc) { - return new FloatArrayPack(); - } - - public void addToPack(FloatArrayPack objects, Float o) { - objects.add(o); - } - - public void endPacking( FloatArrayPack pack, BeanT bean, Accessor acc ) throws AccessorException { - acc.set(bean,pack.build()); - } - - public void reset(BeanT o,Accessor acc) throws AccessorException { - acc.set(o,new float[0]); - } - - static final class FloatArrayPack { - float[] buf = new float[16]; - int size; - - void add(Float b) { - if(buf.length==size) { - // realloc - float[] nb = new float[buf.length*2]; - System.arraycopy(buf,0,nb,0,buf.length); - buf = nb; - } - if(b!=null) - buf[size++] = b; - } - - float[] build() { - if(buf.length==size) - // if we are lucky enough - return buf; - - float[] r = new float[size]; - System.arraycopy(buf,0,r,0,size); - return r; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/PrimitiveArrayListerInteger.java 2018-01-30 20:34:26.000000000 -0500 +++ /dev/null 2018-01-30 20:34:26.000000000 -0500 @@ -1,104 +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.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -/** - * {@link Lister} for primitive type arrays. - *

- * Auto-generated, do not edit. - *

- *

- * B y t e ArrayLister is used as the master to generate the rest of the - * lister classes. Do not modify the generated copies. - *

- */ -final class PrimitiveArrayListerInteger extends Lister { - - private PrimitiveArrayListerInteger() { - } - - /*package*/ static void register() { - Lister.primitiveArrayListers.put(Integer.TYPE,new PrimitiveArrayListerInteger()); - } - - public ListIterator iterator(final int[] objects, XMLSerializer context) { - return new ListIterator() { - int idx=0; - public boolean hasNext() { - return idx acc) { - return new IntegerArrayPack(); - } - - public void addToPack(IntegerArrayPack objects, Integer o) { - objects.add(o); - } - - public void endPacking( IntegerArrayPack pack, BeanT bean, Accessor acc ) throws AccessorException { - acc.set(bean,pack.build()); - } - - public void reset(BeanT o,Accessor acc) throws AccessorException { - acc.set(o,new int[0]); - } - - static final class IntegerArrayPack { - int[] buf = new int[16]; - int size; - - void add(Integer b) { - if(buf.length==size) { - // realloc - int[] nb = new int[buf.length*2]; - System.arraycopy(buf,0,nb,0,buf.length); - buf = nb; - } - if(b!=null) - buf[size++] = b; - } - - int[] build() { - if(buf.length==size) - // if we are lucky enough - return buf; - - int[] r = new int[size]; - System.arraycopy(buf,0,r,0,size); - return r; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/PrimitiveArrayListerLong.java 2018-01-30 20:34:26.000000000 -0500 +++ /dev/null 2018-01-30 20:34:27.000000000 -0500 @@ -1,104 +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.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -/** - * {@link Lister} for primitive type arrays. - *

- * Auto-generated, do not edit. - *

- *

- * B y t e ArrayLister is used as the master to generate the rest of the - * lister classes. Do not modify the generated copies. - *

- */ -final class PrimitiveArrayListerLong extends Lister { - - private PrimitiveArrayListerLong() { - } - - /*package*/ static void register() { - Lister.primitiveArrayListers.put(Long.TYPE,new PrimitiveArrayListerLong()); - } - - public ListIterator iterator(final long[] objects, XMLSerializer context) { - return new ListIterator() { - int idx=0; - public boolean hasNext() { - return idx acc) { - return new LongArrayPack(); - } - - public void addToPack(LongArrayPack objects, Long o) { - objects.add(o); - } - - public void endPacking( LongArrayPack pack, BeanT bean, Accessor acc ) throws AccessorException { - acc.set(bean,pack.build()); - } - - public void reset(BeanT o,Accessor acc) throws AccessorException { - acc.set(o,new long[0]); - } - - static final class LongArrayPack { - long[] buf = new long[16]; - int size; - - void add(Long b) { - if(buf.length==size) { - // realloc - long[] nb = new long[buf.length*2]; - System.arraycopy(buf,0,nb,0,buf.length); - buf = nb; - } - if(b!=null) - buf[size++] = b; - } - - long[] build() { - if(buf.length==size) - // if we are lucky enough - return buf; - - long[] r = new long[size]; - System.arraycopy(buf,0,r,0,size); - return r; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/PrimitiveArrayListerShort.java 2018-01-30 20:34:27.000000000 -0500 +++ /dev/null 2018-01-30 20:34:27.000000000 -0500 @@ -1,104 +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.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; - -/** - * {@link Lister} for primitive type arrays. - *

- * Auto-generated, do not edit. - *

- *

- * B y t e ArrayLister is used as the master to generate the rest of the - * lister classes. Do not modify the generated copies. - *

- */ -final class PrimitiveArrayListerShort extends Lister { - - private PrimitiveArrayListerShort() { - } - - /*package*/ static void register() { - Lister.primitiveArrayListers.put(Short.TYPE,new PrimitiveArrayListerShort()); - } - - public ListIterator iterator(final short[] objects, XMLSerializer context) { - return new ListIterator() { - int idx=0; - public boolean hasNext() { - return idx acc) { - return new ShortArrayPack(); - } - - public void addToPack(ShortArrayPack objects, Short o) { - objects.add(o); - } - - public void endPacking( ShortArrayPack pack, BeanT bean, Accessor acc ) throws AccessorException { - acc.set(bean,pack.build()); - } - - public void reset(BeanT o,Accessor acc) throws AccessorException { - acc.set(o,new short[0]); - } - - static final class ShortArrayPack { - short[] buf = new short[16]; - int size; - - void add(Short b) { - if(buf.length==size) { - // realloc - short[] nb = new short[buf.length*2]; - System.arraycopy(buf,0,nb,0,buf.length); - buf = nb; - } - if(b!=null) - buf[size++] = b; - } - - short[] build() { - if(buf.length==size) - // if we are lucky enough - return buf; - - short[] r = new short[size]; - System.arraycopy(buf,0,r,0,size); - return r; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/TransducedAccessor.java 2018-01-30 20:34:28.000000000 -0500 +++ /dev/null 2018-01-30 20:34:28.000000000 -0500 @@ -1,343 +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.bind.v2.runtime.reflect; - -import java.io.IOException; -import java.util.concurrent.Callable; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.stream.XMLStreamException; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; -import com.sun.istack.internal.SAXException2; -import com.sun.xml.internal.bind.WhiteSpaceProcessor; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.model.core.ID; -import com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeNonElementRef; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.Transducer; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.opt.OptimizedTransducedAccessorFactory; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Patcher; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext; -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.LocatorEx; - -import org.xml.sax.SAXException; - -/** - * {@link Accessor} and {@link Transducer} combined into one object. - * - *

- * This allows efficient conversions between primitive values and - * String without using boxing. - * - *

- * This abstraction only works for a single-value property. - * - *

- * An instance of {@link TransducedAccessor} implicitly holds a - * field of the {@code BeanT} that the accessors access. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public abstract class TransducedAccessor { - - /** - * @see Transducer#useNamespace() - */ - public boolean useNamespace() { - return false; - } - - /** - * Obtain the value of the field and declares the namespace URIs used in - * the value. - * - * @see Transducer#declareNamespace(Object, XMLSerializer) - */ - public void declareNamespace( BeanT o, XMLSerializer w ) throws AccessorException, SAXException { - } - - /** - * Prints the responsible field of the given bean to the writer. - * - *

- * Use {@link XMLSerializer#getInstance()} to access to the namespace bindings - * - * @return - * if the accessor didn't yield a value, return null. - */ - public abstract @Nullable CharSequence print(@NotNull BeanT o) throws AccessorException, SAXException; - - /** - * Parses the text value into the responsible field of the given bean. - * - *

- * Use {@link UnmarshallingContext#getInstance()} to access to the namespace bindings - * - * @throws AccessorException - * if the transducer is used to parse an user bean that uses {@link XmlValue}, - * then this exception may occur when it tries to set the leaf value to the bean. - * @throws RuntimeException - * if the lexical form is incorrect. The method may throw a RuntimeException, - * but it shouldn't cause the entire unmarshalling to fail. - * @throws SAXException - * if the parse method found an error, the error is reported, and then - * the processing is aborted. - */ - public abstract void parse(BeanT o, CharSequence lexical) throws AccessorException, SAXException; - - /** - * Checks if the field has a value. - */ - public abstract boolean hasValue(BeanT o) throws AccessorException; - - - - - - - - - - - - /** - * Gets the {@link TransducedAccessor} appropriately configured for - * the given property. - * - *

- * This allows the implementation to use an optimized code. - */ - public static TransducedAccessor get(JAXBContextImpl context, RuntimeNonElementRef ref) { - Transducer xducer = RuntimeModelBuilder.createTransducer(ref); - RuntimePropertyInfo prop = ref.getSource(); - - if(prop.isCollection()) { - return new ListTransducedAccessorImpl(xducer,prop.getAccessor(), - Lister.create(Utils.REFLECTION_NAVIGATOR.erasure(prop.getRawType()), prop.id(), prop.getAdapter())); - } - - if(prop.id()==ID.IDREF) - return new IDREFTransducedAccessorImpl(prop.getAccessor()); - - if(xducer.isDefault() && context != null && !context.fastBoot) { - TransducedAccessor xa = OptimizedTransducedAccessorFactory.get(prop); - if(xa!=null) return xa; - } - - if(xducer.useNamespace()) - return new CompositeContextDependentTransducedAccessorImpl( context, xducer, prop.getAccessor() ); - else - return new CompositeTransducedAccessorImpl( context, xducer, prop.getAccessor() ); - } - - /** - * Convenience method to write the value as a text inside an element - * without any attributes. - * Can be overridden for improved performance. - * - *

- * The callee assumes that there's an associated value in the field. - * No @xsi:type handling is expected. - */ - public abstract void writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException; - - /** - * Invokes one of the {@link XMLSerializer#text(String, String)} method - * with the representation of data bested suited for this transduced accessor. - */ - public abstract void writeText(XMLSerializer w, BeanT o, String fieldName) throws AccessorException, SAXException, IOException, XMLStreamException; - - static class CompositeContextDependentTransducedAccessorImpl extends CompositeTransducedAccessorImpl { - public CompositeContextDependentTransducedAccessorImpl(JAXBContextImpl context,Transducer xducer, Accessor acc) { - super(context,xducer,acc); - assert xducer.useNamespace(); - } - - @Override - public boolean useNamespace() { - return true; - } - - @Override - public void declareNamespace(BeanT bean, XMLSerializer w) throws AccessorException { - ValueT o = acc.get(bean); - if(o!=null) - xducer.declareNamespace(o,w); - } - - @Override - public void writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException { - w.startElement(tagName,null); - declareNamespace(o,w); - w.endNamespaceDecls(null); - w.endAttributes(); - xducer.writeText(w,acc.get(o),fieldName); - w.endElement(); - } - } - - - /** - * Implementation of {@link TransducedAccessor} that - * simply combines a {@link Transducer} and {@link Accessor}. - */ - public static class CompositeTransducedAccessorImpl extends TransducedAccessor { - protected final Transducer xducer; - protected final Accessor acc; - - public CompositeTransducedAccessorImpl(JAXBContextImpl context, Transducer xducer, Accessor acc) { - this.xducer = xducer; - this.acc = acc.optimize(context); - } - - public CharSequence print(BeanT bean) throws AccessorException { - ValueT o = acc.get(bean); - if(o==null) return null; - return xducer.print(o); - } - - public void parse(BeanT bean, CharSequence lexical) throws AccessorException, SAXException { - acc.set(bean,xducer.parse(lexical)); - } - - public boolean hasValue(BeanT bean) throws AccessorException { - return acc.getUnadapted(bean)!=null; - } - - @Override - public void writeLeafElement(XMLSerializer w, Name tagName, BeanT o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException { - xducer.writeLeafElement(w,tagName,acc.get(o),fieldName); - } - - @Override - public void writeText(XMLSerializer w, BeanT o, String fieldName) throws AccessorException, SAXException, IOException, XMLStreamException { - xducer.writeText(w,acc.get(o),fieldName); - } - } - - /** - * {@link TransducedAccessor} for IDREF. - * - * BeanT: the type of the bean that contains this the IDREF field. - * TargetT: the type of the bean pointed by IDREF. - */ - private static final class IDREFTransducedAccessorImpl extends DefaultTransducedAccessor { - private final Accessor acc; - /** - * The object that an IDREF resolves to should be - * assignable to this type. - */ - private final Class targetType; - - public IDREFTransducedAccessorImpl(Accessor acc) { - this.acc = acc; - this.targetType = acc.getValueType(); - } - - public String print(BeanT bean) throws AccessorException, SAXException { - TargetT target = acc.get(bean); - if(target==null) return null; - - XMLSerializer w = XMLSerializer.getInstance(); - try { - String id = w.grammar.getBeanInfo(target,true).getId(target,w); - if(id==null) - w.errorMissingId(target); - return id; - } catch (JAXBException e) { - w.reportError(null,e); - return null; - } - } - - private void assign( BeanT bean, TargetT t, UnmarshallingContext context ) throws AccessorException { - if(!targetType.isInstance(t)) - context.handleError(Messages.UNASSIGNABLE_TYPE.format(targetType,t.getClass())); - else - acc.set(bean,t); - } - - public void parse(final BeanT bean, CharSequence lexical) throws AccessorException, SAXException { - final String idref = WhiteSpaceProcessor.trim(lexical).toString(); - final UnmarshallingContext context = UnmarshallingContext.getInstance(); - - final Callable callable = context.getObjectFromId(idref,acc.valueType); - if(callable==null) { - // the IDResolver decided to abort it now - context.errorUnresolvedIDREF(bean,idref,context.getLocator()); - return; - } - - TargetT t; - try { - t = (TargetT)callable.call(); - } catch (SAXException e) {// from callable.call - throw e; - } catch (RuntimeException e) {// from callable.call - throw e; - } catch (Exception e) {// from callable.call - throw new SAXException2(e); - } - if(t!=null) { - assign(bean,t,context); - } else { - // try again later - final LocatorEx loc = new LocatorEx.Snapshot(context.getLocator()); - context.addPatcher(new Patcher() { - public void run() throws SAXException { - try { - TargetT t = (TargetT)callable.call(); - if(t==null) { - context.errorUnresolvedIDREF(bean,idref,loc); - } else { - assign(bean,t,context); - } - } catch (AccessorException e) { - context.handleError(e); - } catch (SAXException e) {// from callable.call - throw e; - } catch (RuntimeException e) {// from callable.call - throw e; - } catch (Exception e) {// from callable.call - throw new SAXException2(e); - } - } - }); - } - } - - public boolean hasValue(BeanT bean) throws AccessorException { - return acc.get(bean)!=null; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/Utils.java 2018-01-30 20:34:28.000000000 -0500 +++ /dev/null 2018-01-30 20:34:28.000000000 -0500 @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2013, 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.bind.v2.runtime.reflect; - -import com.sun.xml.internal.bind.v2.model.nav.Navigator; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Type; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Utils class. - * - * WARNING: If you are doing any changes don't forget to change other Utils classes in different packages. - * - * Has *package private* access to avoid inappropriate usage. - */ -final class Utils { - - private static final Logger LOGGER = Logger.getLogger(Utils.class.getName()); - - /** - * static ReflectionNavigator field to avoid usage of reflection every time we use it. - */ - static final Navigator REFLECTION_NAVIGATOR; - - static { // we statically initializing REFLECTION_NAVIGATOR property - try { - final Class refNav = Class.forName("com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator"); - - // requires accessClassInPackage privilege - final Method getInstance = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Method run() { - try { - Method getInstance = refNav.getDeclaredMethod("getInstance"); - getInstance.setAccessible(true); - return getInstance; - } catch (NoSuchMethodException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance can't be found"); - } - } - } - ); - - //noinspection unchecked - REFLECTION_NAVIGATOR = (Navigator) getInstance.invoke(null); - } catch (ClassNotFoundException e) { - throw new IllegalStateException("Can't find ReflectionNavigator class"); - } catch (InvocationTargetException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance throws the exception"); - } catch (IllegalAccessException e) { - throw new IllegalStateException("ReflectionNavigator.getInstance method is inaccessible"); - } catch (SecurityException e) { - LOGGER.log(Level.FINE, "Unable to access ReflectionNavigator.getInstance", e); - throw e; - } - } - - /** - * private constructor to avoid util class instantiating - */ - private Utils() { - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java 2018-01-30 20:34:29.000000000 -0500 +++ /dev/null 2018-01-30 20:34:29.000000000 -0500 @@ -1,112 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime.reflect.opt; - -import java.io.InputStream; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.v2.bytecode.ClassTailor; - -/** - * @author Kohsuke Kawaguchi - */ -class AccessorInjector { - - private static final Logger logger = Util.getClassLogger(); - - protected static final boolean noOptimize = - Util.getSystemProperty(ClassTailor.class.getName()+".noOptimize")!=null; - - static { - if(noOptimize) - logger.info("The optimized code generation is disabled"); - } - - /** - * Loads the optimized class and returns it. - * - * @return null - * if it fails for some reason. - */ - public static Class prepare( - Class beanClass, String templateClassName, String newClassName, String... replacements ) { - - if(noOptimize) - return null; - - try { - ClassLoader cl = SecureLoader.getClassClassLoader(beanClass); - if(cl==null) return null; // how do I inject classes to this "null" class loader? for now, back off. - - Class c = Injector.find(cl,newClassName); - if (c==null) { - byte[] image = tailor(templateClassName,newClassName,replacements); - if (image==null) { - return null; - } - c = Injector.inject(cl,newClassName,image); - if (c == null) { - Injector.find(cl, newClassName); - } - } - return c; - } catch(SecurityException e) { - // we don't have enough permission to do this - logger.log(Level.INFO,"Unable to create an optimized TransducedAccessor ",e); - return null; - } - } - - - /** - * Customizes a class file by replacing constant pools. - * - * @param templateClassName - * The resource that contains the template class file. - * @param replacements - * A list of pair of strings that specify the substitution - * {@code String[]{search_0, replace_0, search_1, replace_1, ..., search_n, replace_n } - * - * The search strings found in the constant pool will be replaced by the corresponding - * replacement string. - */ - private static byte[] tailor( String templateClassName, String newClassName, String... replacements ) { - InputStream resource; - if(CLASS_LOADER!=null) - resource = CLASS_LOADER.getResourceAsStream(templateClassName+".class"); - else - resource = ClassLoader.getSystemResourceAsStream(templateClassName+".class"); - if(resource==null) - return null; - - return ClassTailor.tailor(resource,templateClassName,newClassName,replacements); - } - - private static final ClassLoader CLASS_LOADER = SecureLoader.getClassClassLoader(AccessorInjector.class); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Bean.java 2018-01-30 20:34:30.000000000 -0500 +++ /dev/null 2018-01-30 20:34:30.000000000 -0500 @@ -1,79 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; - -/** - * Used by {@link TransducedAccessor} templates. - * - *

- * Fields needs to have a distinctive name. - * - * @author Kohsuke Kawaguchi - */ -final class Bean { - public boolean f_boolean; - public char f_char; - public byte f_byte; - public short f_short; - int f_int; - public long f_long; - public float f_float; - public double f_double; - /** - * Field of a reference type. - * We need a distinctive type so that it can be easily replaced. - */ - public Ref f_ref; - - public boolean get_boolean() { throw new UnsupportedOperationException(); } - public void set_boolean(boolean b) { throw new UnsupportedOperationException(); } - - public char get_char() { throw new UnsupportedOperationException(); } - public void set_char(char b) { throw new UnsupportedOperationException(); } - - public byte get_byte() { throw new UnsupportedOperationException(); } - public void set_byte(byte b) { throw new UnsupportedOperationException(); } - - public short get_short() { throw new UnsupportedOperationException(); } - public void set_short(short b) { throw new UnsupportedOperationException(); } - - public int get_int() { throw new UnsupportedOperationException(); } - public void set_int(int b) { throw new UnsupportedOperationException(); } - - public long get_long() { throw new UnsupportedOperationException(); } - public void set_long(long b) { throw new UnsupportedOperationException(); } - - public float get_float() { throw new UnsupportedOperationException(); } - public void set_float(float b) { throw new UnsupportedOperationException(); } - - public double get_double() { throw new UnsupportedOperationException(); } - public void set_double(double b) { throw new UnsupportedOperationException(); } - - public Ref get_ref() { throw new UnsupportedOperationException(); } - public void set_ref(Ref r) { throw new UnsupportedOperationException(); } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Const.java 2018-01-30 20:34:30.000000000 -0500 +++ /dev/null 2018-01-30 20:34:30.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 1997, 2016, 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.bind.v2.runtime.reflect.opt; - -/** - * @author Kohsuke Kawaguchi - */ -public final class Const { - public static final byte default_value_byte = 0; - public static final boolean default_value_boolean = false; - public static final char default_value_char = 0; - public static final float default_value_float = 0; - public static final double default_value_double = 0; - public static final int default_value_int = 0; - public static final long default_value_long = 0; - public static final short default_value_short = 0; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/FieldAccessor_Boolean.java 2018-01-30 20:34:31.000000000 -0500 +++ /dev/null 2018-01-30 20:34:31.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for boolean fields. - *

- * Auto-generated, do not edit. - *

- *

- * All the FieldAccessors are generated from FieldAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class FieldAccessor_Boolean extends Accessor { - public FieldAccessor_Boolean() { - super(Boolean.class); - } - - public Object get(Object bean) { - return ((Bean)bean).f_boolean; - } - - public void set(Object bean, Object value) { - ((Bean)bean).f_boolean = value==null ? Const.default_value_boolean : (Boolean)value; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/FieldAccessor_Byte.java 2018-01-30 20:34:32.000000000 -0500 +++ /dev/null 2018-01-30 20:34:32.000000000 -0500 @@ -1,50 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for byte fields. - * - *

- * All the FieldAccessors are generated from FieldAccessor_B y t e - * - * @author Kohsuke Kawaguchi - */ -public class FieldAccessor_Byte extends Accessor { - public FieldAccessor_Byte() { - super(Byte.class); - } - - public Object get(Object bean) { - return ((Bean)bean).f_byte; - } - - public void set(Object bean, Object value) { - ((Bean)bean).f_byte = value==null ? Const.default_value_byte : (Byte)value; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/FieldAccessor_Character.java 2018-01-30 20:34:32.000000000 -0500 +++ /dev/null 2018-01-30 20:34:32.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for char fields. - *

- * Auto-generated, do not edit. - *

- *

- * All the FieldAccessors are generated from FieldAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class FieldAccessor_Character extends Accessor { - public FieldAccessor_Character() { - super(Character.class); - } - - public Object get(Object bean) { - return ((Bean)bean).f_char; - } - - public void set(Object bean, Object value) { - ((Bean)bean).f_char = value==null ? Const.default_value_char : (Character)value; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/FieldAccessor_Double.java 2018-01-30 20:34:33.000000000 -0500 +++ /dev/null 2018-01-30 20:34:33.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for double fields. - *

- * Auto-generated, do not edit. - *

- *

- * All the FieldAccessors are generated from FieldAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class FieldAccessor_Double extends Accessor { - public FieldAccessor_Double() { - super(Double.class); - } - - public Object get(Object bean) { - return ((Bean)bean).f_double; - } - - public void set(Object bean, Object value) { - ((Bean)bean).f_double = value==null ? Const.default_value_double : (Double)value; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/FieldAccessor_Float.java 2018-01-30 20:34:34.000000000 -0500 +++ /dev/null 2018-01-30 20:34:34.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for float fields. - *

- * Auto-generated, do not edit. - *

- *

- * All the FieldAccessors are generated from FieldAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class FieldAccessor_Float extends Accessor { - public FieldAccessor_Float() { - super(Float.class); - } - - public Object get(Object bean) { - return ((Bean)bean).f_float; - } - - public void set(Object bean, Object value) { - ((Bean)bean).f_float = value==null ? Const.default_value_float : (Float)value; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/FieldAccessor_Integer.java 2018-01-30 20:34:34.000000000 -0500 +++ /dev/null 2018-01-30 20:34:35.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for int fields. - *

- * Auto-generated, do not edit. - *

- *

- * All the FieldAccessors are generated from FieldAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class FieldAccessor_Integer extends Accessor { - public FieldAccessor_Integer() { - super(Integer.class); - } - - public Object get(Object bean) { - return ((Bean)bean).f_int; - } - - public void set(Object bean, Object value) { - ((Bean)bean).f_int = value==null ? Const.default_value_int : (Integer)value; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/FieldAccessor_Long.java 2018-01-30 20:34:35.000000000 -0500 +++ /dev/null 2018-01-30 20:34:35.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for long fields. - *

- * Auto-generated, do not edit. - *

- *

- * All the FieldAccessors are generated from FieldAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class FieldAccessor_Long extends Accessor { - public FieldAccessor_Long() { - super(Long.class); - } - - public Object get(Object bean) { - return ((Bean)bean).f_long; - } - - public void set(Object bean, Object value) { - ((Bean)bean).f_long = value==null ? Const.default_value_long : (Long)value; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/FieldAccessor_Ref.java 2018-01-30 20:34:36.000000000 -0500 +++ /dev/null 2018-01-30 20:34:36.000000000 -0500 @@ -1,47 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for reference type fields. - * - * @author Kohsuke Kawaguchi - */ -public class FieldAccessor_Ref extends Accessor { - public FieldAccessor_Ref() { - super(Ref.class); - } - - public Object get(Object bean) { - return ((Bean)bean).f_ref; - } - - public void set(Object bean, Object value) { - ((Bean)bean).f_ref = (Ref)value; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/FieldAccessor_Short.java 2018-01-30 20:34:36.000000000 -0500 +++ /dev/null 2018-01-30 20:34:36.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for short fields. - *

- * Auto-generated, do not edit. - *

- *

- * All the FieldAccessors are generated from FieldAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class FieldAccessor_Short extends Accessor { - public FieldAccessor_Short() { - super(Short.class); - } - - public Object get(Object bean) { - return ((Bean)bean).f_short; - } - - public void set(Object bean, Object value) { - ((Bean)bean).f_short = value==null ? Const.default_value_short : (Short)value; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java 2018-01-30 20:34:37.000000000 -0500 +++ /dev/null 2018-01-30 20:34:37.000000000 -0500 @@ -1,350 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime.reflect.opt; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.ref.WeakReference; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.concurrent.locks.Lock; -import java.util.concurrent.locks.ReentrantReadWriteLock; -import java.util.HashMap; -import java.util.Map; -import java.util.WeakHashMap; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import java.lang.reflect.Field; -import java.security.CodeSource; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.security.ProtectionDomain; - -/** - * A {@link ClassLoader} used to "inject" optimized accessor classes - * into the VM. - * - *

- * Its parent class loader needs to be set to the one that can see the user - * class. - * - * @author Kohsuke Kawaguchi - */ -final class Injector { - - /** - * {@link Injector}s keyed by their parent {@link ClassLoader}. - * - * We only need one injector per one user class loader. - */ - private static final ReentrantReadWriteLock irwl = new ReentrantReadWriteLock(); - private static final Lock ir = irwl.readLock(); - private static final Lock iw = irwl.writeLock(); - private static final Map> injectors = - new WeakHashMap>(); - private static final Logger logger = Util.getClassLogger(); - - /** - * Injects a new class into the given class loader. - * - * @return null - * if it fails to inject. - */ - static Class inject(ClassLoader cl, String className, byte[] image) { - Injector injector = get(cl); - if (injector != null) { - return injector.inject(className, image); - } else { - return null; - } - } - - /** - * Returns the already injected class, or null. - */ - static Class find(ClassLoader cl, String className) { - Injector injector = get(cl); - if (injector != null) { - return injector.find(className); - } else { - return null; - } - } - - /** - * Gets or creates an {@link Injector} for the given class loader. - * - * @return null - * if it fails. - */ - private static Injector get(ClassLoader cl) { - Injector injector = null; - WeakReference wr; - ir.lock(); - try { - wr = injectors.get(cl); - } finally { - ir.unlock(); - } - if (wr != null) { - injector = wr.get(); - } - if (injector == null) { - try { - wr = new WeakReference(injector = new Injector(cl)); - iw.lock(); - try { - if (!injectors.containsKey(cl)) { - injectors.put(cl, wr); - } - } finally { - iw.unlock(); - } - } catch (SecurityException e) { - logger.log(Level.FINE, "Unable to set up a back-door for the injector", e); - return null; - } - } - return injector; - } - /** - * Injected classes keyed by their names. - */ - private final Map classes = new HashMap<>(); - private final ReentrantReadWriteLock rwl = new ReentrantReadWriteLock(); - private final Lock r = rwl.readLock(); - private final Lock w = rwl.writeLock(); - private final ClassLoader parent; - /** - * True if this injector is capable of injecting accessors. - * False otherwise, which happens if this classloader can't see {@link Accessor}. - */ - private final boolean loadable; - private static Method defineClass; - private static Method resolveClass; - private static Method findLoadedClass; - private static Object U; - - static { - try { - Method[] m = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Method[] run() { - return new Method[]{ - getMethod(ClassLoader.class, "defineClass", String.class, byte[].class, Integer.TYPE, Integer.TYPE), - getMethod(ClassLoader.class, "resolveClass", Class.class), - getMethod(ClassLoader.class, "findLoadedClass", String.class) - }; - } - } - ); - defineClass = m[0]; - resolveClass = m[1]; - findLoadedClass = m[2]; - } catch (Throwable t) { - try { - U = AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public Object run() throws Exception { - Class u = Class.forName("sun.misc.Unsafe"); - Field theUnsafe = u.getDeclaredField("theUnsafe"); - theUnsafe.setAccessible(true); - return theUnsafe.get(null); - } - }); - defineClass = AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public Method run() throws Exception { - try { - return U.getClass().getMethod("defineClass", - new Class[]{String.class, - byte[].class, - Integer.TYPE, - Integer.TYPE, - ClassLoader.class, - ProtectionDomain.class}); - } catch (NoSuchMethodException | SecurityException ex) { - throw ex; - } - } - }); - } catch (SecurityException | PrivilegedActionException ex) { - Logger.getLogger(Injector.class.getName()).log(Level.SEVERE, null, ex); - } - } - } - - private static Method getMethod(final Class c, final String methodname, final Class... params) { - try { - Method m = c.getDeclaredMethod(methodname, params); - m.setAccessible(true); - return m; - } catch (NoSuchMethodException e) { - throw new NoSuchMethodError(e.getMessage()); - } - } - - private Injector(ClassLoader parent) { - this.parent = parent; - assert parent != null; - - boolean loadableCheck = false; - - try { - loadableCheck = parent.loadClass(Accessor.class.getName()) == Accessor.class; - } catch (ClassNotFoundException e) { - // not loadable - } - - this.loadable = loadableCheck; - } - - @SuppressWarnings("LockAcquiredButNotSafelyReleased") - private Class inject(String className, byte[] image) { - if (!loadable) // this injector cannot inject anything - { - return null; - } - - boolean wlocked = false; - boolean rlocked = false; - try { - - r.lock(); - rlocked = true; - - Class c = classes.get(className); - - // Unlock now during the findLoadedClass process to avoid - // deadlocks - r.unlock(); - rlocked = false; - - //find loaded class from classloader - if (c == null && findLoadedClass != null) { - - try { - c = (Class) findLoadedClass.invoke(parent, className.replace('/', '.')); - } catch (IllegalArgumentException | IllegalAccessException e) { - logger.log(Level.FINE, "Unable to find " + className, e); - } catch (InvocationTargetException e) { - Throwable t = e.getTargetException(); - logger.log(Level.FINE, "Unable to find " + className, t); - } - - if (c != null) { - - w.lock(); - wlocked = true; - - classes.put(className, c); - - w.unlock(); - wlocked = false; - - return c; - } - } - - if (c == null) { - - r.lock(); - rlocked = true; - - c = classes.get(className); - - // Unlock now during the define/resolve process to avoid - // deadlocks - r.unlock(); - rlocked = false; - - if (c == null) { - - // we need to inject a class into the - try { - if (resolveClass != null) { - c = (Class) defineClass.invoke(parent, className.replace('/', '.'), image, 0, image.length); - resolveClass.invoke(parent, c); - } else { - c = (Class) defineClass.invoke(U, className.replace('/', '.'), image, 0, image.length, parent, Injector.class.getProtectionDomain()); - } - } catch (IllegalAccessException e) { - logger.log(Level.FINE, "Unable to inject " + className, e); - return null; - } catch (InvocationTargetException e) { - Throwable t = e.getTargetException(); - if (t instanceof LinkageError) { - logger.log(Level.FINE, "duplicate class definition bug occured? Please report this : " + className, t); - } else { - logger.log(Level.FINE, "Unable to inject " + className, t); - } - return null; - } catch (SecurityException e) { - logger.log(Level.FINE, "Unable to inject " + className, e); - return null; - } catch (LinkageError e) { - logger.log(Level.FINE, "Unable to inject " + className, e); - return null; - } - - w.lock(); - wlocked = true; - - // During the time we were unlocked, we could have tried to - // load the class from more than one thread. Check now to see - // if someone else beat us to registering this class - if (!classes.containsKey(className)) { - classes.put(className, c); - } - - w.unlock(); - wlocked = false; - } - } - return c; - } finally { - if (rlocked) { - r.unlock(); - } - if (wlocked) { - w.unlock(); - } - } - } - - private Class find(String className) { - r.lock(); - try { - return classes.get(className); - } finally { - r.unlock(); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/MethodAccessor_Boolean.java 2018-01-30 20:34:38.000000000 -0500 +++ /dev/null 2018-01-30 20:34:38.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for boolean getter/setter. - *

- * Auto-generated, do not edit. - *

- *

- * All the MethodAccessors are generated from MethodAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class MethodAccessor_Boolean extends Accessor { - public MethodAccessor_Boolean() { - super(Boolean.class); - } - - public Object get(Object bean) { - return ((Bean)bean).get_boolean(); - } - - public void set(Object bean, Object value) { - ((Bean)bean).set_boolean( value==null ? Const.default_value_boolean : (Boolean)value ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/MethodAccessor_Byte.java 2018-01-30 20:34:39.000000000 -0500 +++ /dev/null 2018-01-30 20:34:39.000000000 -0500 @@ -1,50 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for boolean getter/setter. - * - *

- * All the MethodAccessors are generated from MethodAccessor_B y t e - * - * @author Kohsuke Kawaguchi - */ -public class MethodAccessor_Byte extends Accessor { - public MethodAccessor_Byte() { - super(Byte.class); - } - - public Object get(Object bean) { - return ((Bean)bean).get_byte(); - } - - public void set(Object bean, Object value) { - ((Bean)bean).set_byte( value==null ? Const.default_value_byte : (Byte)value ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/MethodAccessor_Character.java 2018-01-30 20:34:39.000000000 -0500 +++ /dev/null 2018-01-30 20:34:39.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for boolean getter/setter. - *

- * Auto-generated, do not edit. - *

- *

- * All the MethodAccessors are generated from MethodAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class MethodAccessor_Character extends Accessor { - public MethodAccessor_Character() { - super(Character.class); - } - - public Object get(Object bean) { - return ((Bean)bean).get_char(); - } - - public void set(Object bean, Object value) { - ((Bean)bean).set_char( value==null ? Const.default_value_char : (Character)value ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/MethodAccessor_Double.java 2018-01-30 20:34:40.000000000 -0500 +++ /dev/null 2018-01-30 20:34:40.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for boolean getter/setter. - *

- * Auto-generated, do not edit. - *

- *

- * All the MethodAccessors are generated from MethodAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class MethodAccessor_Double extends Accessor { - public MethodAccessor_Double() { - super(Double.class); - } - - public Object get(Object bean) { - return ((Bean)bean).get_double(); - } - - public void set(Object bean, Object value) { - ((Bean)bean).set_double( value==null ? Const.default_value_double : (Double)value ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/MethodAccessor_Float.java 2018-01-30 20:34:41.000000000 -0500 +++ /dev/null 2018-01-30 20:34:41.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for boolean getter/setter. - *

- * Auto-generated, do not edit. - *

- *

- * All the MethodAccessors are generated from MethodAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class MethodAccessor_Float extends Accessor { - public MethodAccessor_Float() { - super(Float.class); - } - - public Object get(Object bean) { - return ((Bean)bean).get_float(); - } - - public void set(Object bean, Object value) { - ((Bean)bean).set_float( value==null ? Const.default_value_float : (Float)value ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/MethodAccessor_Integer.java 2018-01-30 20:34:41.000000000 -0500 +++ /dev/null 2018-01-30 20:34:41.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for boolean getter/setter. - *

- * Auto-generated, do not edit. - *

- *

- * All the MethodAccessors are generated from MethodAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class MethodAccessor_Integer extends Accessor { - public MethodAccessor_Integer() { - super(Integer.class); - } - - public Object get(Object bean) { - return ((Bean)bean).get_int(); - } - - public void set(Object bean, Object value) { - ((Bean)bean).set_int( value==null ? Const.default_value_int : (Integer)value ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/MethodAccessor_Long.java 2018-01-30 20:34:42.000000000 -0500 +++ /dev/null 2018-01-30 20:34:42.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for boolean getter/setter. - *

- * Auto-generated, do not edit. - *

- *

- * All the MethodAccessors are generated from MethodAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class MethodAccessor_Long extends Accessor { - public MethodAccessor_Long() { - super(Long.class); - } - - public Object get(Object bean) { - return ((Bean)bean).get_long(); - } - - public void set(Object bean, Object value) { - ((Bean)bean).set_long( value==null ? Const.default_value_long : (Long)value ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/MethodAccessor_Ref.java 2018-01-30 20:34:43.000000000 -0500 +++ /dev/null 2018-01-30 20:34:43.000000000 -0500 @@ -1,47 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for reference types getter/setter. - * - * @author Kohsuke Kawaguchi - */ -public class MethodAccessor_Ref extends Accessor { - public MethodAccessor_Ref() { - super(Ref.class); - } - - public Object get(Object bean) { - return ((Bean)bean).get_ref(); - } - - public void set(Object bean, Object value) { - ((Bean)bean).set_ref((Ref)value); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/MethodAccessor_Short.java 2018-01-30 20:34:43.000000000 -0500 +++ /dev/null 2018-01-30 20:34:43.000000000 -0500 @@ -1,52 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -/** - * Template {@link Accessor} for boolean getter/setter. - *

- * Auto-generated, do not edit. - *

- *

- * All the MethodAccessors are generated from MethodAccessor_B y t e - *

- * @author Kohsuke Kawaguchi - */ -public class MethodAccessor_Short extends Accessor { - public MethodAccessor_Short() { - super(Short.class); - } - - public Object get(Object bean) { - return ((Bean)bean).get_short(); - } - - public void set(Object bean, Object value) { - ((Bean)bean).set_short( value==null ? Const.default_value_short : (Short)value ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/OptimizedAccessorFactory.java 2018-01-30 20:34:44.000000000 -0500 +++ /dev/null 2018-01-30 20:34:44.000000000 -0500 @@ -1,200 +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.bind.v2.runtime.reflect.opt; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.RuntimeUtil; - -import static com.sun.xml.internal.bind.v2.bytecode.ClassTailor.toVMClassName; -import static com.sun.xml.internal.bind.v2.bytecode.ClassTailor.toVMTypeName; - -/** - * @author Kohsuke Kawaguchi - */ -public abstract class OptimizedAccessorFactory { - private OptimizedAccessorFactory() {} // no instanciation please - - private static final Logger logger = Util.getClassLogger(); - - - private static final String fieldTemplateName; - private static final String methodTemplateName; - - static { - String s = FieldAccessor_Byte.class.getName(); - fieldTemplateName = s.substring(0,s.length()-"Byte".length()).replace('.','/'); - - s = MethodAccessor_Byte.class.getName(); - methodTemplateName = s.substring(0,s.length()-"Byte".length()).replace('.','/'); - } - - /** - * Gets the optimized {@link Accessor} that accesses the given getter/setter. - * - * @return null - * if for some reason it fails to create an optimized version. - */ - public static final Accessor get(Method getter, Method setter) { - // make sure the method signatures are what we expect - if(getter.getParameterTypes().length!=0) - return null; - Class[] sparams = setter.getParameterTypes(); - if(sparams.length!=1) - return null; - if(sparams[0]!=getter.getReturnType()) - return null; - if(setter.getReturnType()!=Void.TYPE) - return null; - if(getter.getDeclaringClass()!=setter.getDeclaringClass()) - return null; - if(Modifier.isPrivate(getter.getModifiers()) || Modifier.isPrivate(setter.getModifiers())) - // we can't access private fields - return null; - - Class t = sparams[0]; - String typeName = t.getName().replace('.','_'); - if (t.isArray()) { - typeName = "AOf_"; - String compName = t.getComponentType().getName().replace('.','_'); - while (compName.startsWith("[L")) { - compName = compName.substring(2); - typeName += "AOf_"; - } - typeName = typeName + compName; - } - - String newClassName = toVMClassName(getter.getDeclaringClass())+"$JaxbAccessorM_"+getter.getName()+'_'+setter.getName()+'_'+typeName; - Class opt; - - if(t.isPrimitive()) - opt = AccessorInjector.prepare( getter.getDeclaringClass(), - methodTemplateName+RuntimeUtil.primitiveToBox.get(t).getSimpleName(), - newClassName, - toVMClassName(Bean.class), - toVMClassName(getter.getDeclaringClass()), - "get_"+t.getName(), - getter.getName(), - "set_"+t.getName(), - setter.getName()); - else - opt = AccessorInjector.prepare( getter.getDeclaringClass(), - methodTemplateName+"Ref", - newClassName, - toVMClassName(Bean.class), - toVMClassName(getter.getDeclaringClass()), - toVMClassName(Ref.class), - toVMClassName(t), - "()"+toVMTypeName(Ref.class), - "()"+toVMTypeName(t), - '('+toVMTypeName(Ref.class)+")V", - '('+toVMTypeName(t)+")V", - "get_ref", - getter.getName(), - "set_ref", - setter.getName()); - - if(opt==null) - return null; - - Accessor acc = instanciate(opt); - if (acc!=null) { - if (logger.isLoggable(Level.FINE)) { - logger.log(Level.FINE, "Using optimized Accessor for {0} and {1}", new Object[]{getter, setter}); - } - } - return acc; - } - - - /** - * Gets the optimized {@link Accessor} that accesses the given field. - * - * @return null - * if for some reason it fails to create an optimized version. - */ - public static final Accessor get(Field field) { - int mods = field.getModifiers(); - if(Modifier.isPrivate(mods) || Modifier.isFinal(mods)) - // we can't access private fields - return null; - - String newClassName = toVMClassName(field.getDeclaringClass())+"$JaxbAccessorF_"+field.getName(); - - Class opt; - - if(field.getType().isPrimitive()) - opt = AccessorInjector.prepare( field.getDeclaringClass(), - fieldTemplateName+RuntimeUtil.primitiveToBox.get(field.getType()).getSimpleName(), - newClassName, - toVMClassName(Bean.class), - toVMClassName(field.getDeclaringClass()), - "f_"+field.getType().getName(), - field.getName() ); - else - opt = AccessorInjector.prepare( field.getDeclaringClass(), - fieldTemplateName+"Ref", - newClassName, - toVMClassName(Bean.class), - toVMClassName(field.getDeclaringClass()), - toVMClassName(Ref.class), - toVMClassName(field.getType()), - toVMTypeName(Ref.class), - toVMTypeName(field.getType()), - "f_ref", - field.getName() ); - - if(opt==null) - return null; - - Accessor acc = instanciate(opt); - if (acc!=null) { - if (logger.isLoggable(Level.FINE)) { - logger.log(Level.FINE, "Using optimized Accessor for {0}", field); - } - } - return acc; - } - - private static Accessor instanciate(Class opt) { - try { - return (Accessor)opt.newInstance(); - } catch (InstantiationException e) { - logger.log(Level.INFO,"failed to load an optimized Accessor",e); - } catch (IllegalAccessException e) { - logger.log(Level.INFO,"failed to load an optimized Accessor",e); - } catch (SecurityException e) { - logger.log(Level.INFO,"failed to load an optimized Accessor",e); - } - return null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/OptimizedTransducedAccessorFactory.java 2018-01-30 20:34:45.000000000 -0500 +++ /dev/null 2018-01-30 20:34:45.000000000 -0500 @@ -1,167 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.lang.reflect.Type; -import java.util.HashMap; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimeClassInfo; -import com.sun.xml.internal.bind.v2.model.runtime.RuntimePropertyInfo; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; - -import static com.sun.xml.internal.bind.v2.bytecode.ClassTailor.toVMClassName; - -/** - * Prepares optimized {@link TransducedAccessor} from templates. - * - * @author Kohsuke Kawaguchi - */ -public abstract class OptimizedTransducedAccessorFactory { - private OptimizedTransducedAccessorFactory() {} // no instanciation please - - // http://java.sun.com/docs/books/vmspec/2nd-edition/html/ConstantPool.doc.html#75929 - // "same runtime package" - - private static final Logger logger = Util.getClassLogger(); - - private static final String fieldTemplateName; - private static final String methodTemplateName; - - static { - String s = TransducedAccessor_field_Byte.class.getName(); - fieldTemplateName = s.substring(0,s.length()-"Byte".length()).replace('.','/'); - - s = TransducedAccessor_method_Byte.class.getName(); - methodTemplateName = s.substring(0,s.length()-"Byte".length()).replace('.','/'); - } - - /** - * Gets the optimized {@link TransducedAccessor} if possible. - * - * @return null - * if for some reason it fails to create an optimized version. - */ - public static final TransducedAccessor get(RuntimePropertyInfo prop) { - Accessor acc = prop.getAccessor(); - - // consider using an optimized TransducedAccessor implementations. - Class opt=null; - - TypeInfo parent = prop.parent(); - if(!(parent instanceof RuntimeClassInfo)) - return null; - - Class dc = ((RuntimeClassInfo)parent).getClazz(); - String newClassName = toVMClassName(dc)+"_JaxbXducedAccessor_"+prop.getName(); - - - if(acc instanceof Accessor.FieldReflection) { - // TODO: we also need to make sure that the default xducer is used. - Accessor.FieldReflection racc = (Accessor.FieldReflection) acc; - Field field = racc.f; - - int mods = field.getModifiers(); - if(Modifier.isPrivate(mods) || Modifier.isFinal(mods)) - // we can't access private fields. - // TODO: think about how to improve this case - return null; - - Class t = field.getType(); - if(t.isPrimitive()) - opt = AccessorInjector.prepare( dc, - fieldTemplateName+suffixMap.get(t), - newClassName, - toVMClassName(Bean.class), - toVMClassName(dc), - "f_"+t.getName(), - field.getName() ); - } - - if(acc.getClass()==Accessor.GetterSetterReflection.class) { - Accessor.GetterSetterReflection gacc = (Accessor.GetterSetterReflection) acc; - - if(gacc.getter==null || gacc.setter==null) - return null; // incomplete - - Class t = gacc.getter.getReturnType(); - - if(Modifier.isPrivate(gacc.getter.getModifiers()) - || Modifier.isPrivate(gacc.setter.getModifiers())) - // we can't access private methods. - return null; - - - if(t.isPrimitive()) - opt = AccessorInjector.prepare( dc, - methodTemplateName+suffixMap.get(t), - newClassName, - toVMClassName(Bean.class), - toVMClassName(dc), - "get_"+t.getName(), - gacc.getter.getName(), - "set_"+t.getName(), - gacc.setter.getName()); - } - - if(opt==null) - return null; - - logger.log(Level.FINE,"Using optimized TransducedAccessor for "+prop.displayName()); - - - try { - return (TransducedAccessor)opt.newInstance(); - } catch (InstantiationException e) { - logger.log(Level.INFO,"failed to load an optimized TransducedAccessor",e); - } catch (IllegalAccessException e) { - logger.log(Level.INFO,"failed to load an optimized TransducedAccessor",e); - } catch (SecurityException e) { - logger.log(Level.INFO,"failed to load an optimized TransducedAccessor",e); - } - return null; - } - - private static final Map suffixMap = new HashMap(); - - static { - suffixMap.put(Byte.TYPE,"Byte"); - suffixMap.put(Short.TYPE,"Short"); - suffixMap.put(Integer.TYPE,"Integer"); - suffixMap.put(Long.TYPE,"Long"); - suffixMap.put(Boolean.TYPE,"Boolean"); - suffixMap.put(Float.TYPE,"Float"); - suffixMap.put(Double.TYPE,"Double"); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Ref.java 2018-01-30 20:34:45.000000000 -0500 +++ /dev/null 2018-01-30 20:34:45.000000000 -0500 @@ -1,37 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; - -/** - * Used by {@link TransducedAccessor} templates. - * - * @author Kohsuke Kawaguchi - * @see Bean - */ -final class Ref { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/SecureLoader.java 2018-01-30 20:34:46.000000000 -0500 +++ /dev/null 2018-01-30 20:34:46.000000000 -0500 @@ -1,75 +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.xml.internal.bind.v2.runtime.reflect.opt; - -/** - * Class defined for safe calls of getClassLoader methods of any kind (context/system/class - * classloader. This MUST be package private and defined in every package which - * uses such invocations. - * @author snajper - */ -class SecureLoader { - - static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - - static ClassLoader getClassClassLoader(final Class c) { - if (System.getSecurityManager() == null) { - return c.getClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return c.getClassLoader(); - } - }); - } - } - - static ClassLoader getSystemClassLoader() { - if (System.getSecurityManager() == null) { - return ClassLoader.getSystemClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return ClassLoader.getSystemClassLoader(); - } - }); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_field_Boolean.java 2018-01-30 20:34:47.000000000 -0500 +++ /dev/null 2018-01-30 20:34:47.000000000 -0500 @@ -1,57 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a boolean field. - * - *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - * - * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_field_Boolean extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printBoolean( ((Bean)o).f_boolean ); - } - - public void parse(Object o, CharSequence lexical) { - Boolean b = DatatypeConverterImpl._parseBoolean(lexical); - - if(b != null) - ((Bean)o).f_boolean=b; - } - - public boolean hasValue(Object o) { - return true; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_field_Byte.java 2018-01-30 20:34:47.000000000 -0500 +++ /dev/null 2018-01-30 20:34:47.000000000 -0500 @@ -1,54 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a byte field. - * - *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - * - * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_field_Byte extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printByte( ((Bean)o).f_byte ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).f_byte=DatatypeConverterImpl._parseByte(lexical); - } - - public boolean hasValue(Object o) { - return true; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_field_Double.java 2018-01-30 20:34:48.000000000 -0500 +++ /dev/null 2018-01-30 20:34:48.000000000 -0500 @@ -1,56 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a double field. - *

- * Auto-generated, do not edit. - *

- *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - *

- * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_field_Double extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printDouble( ((Bean)o).f_double ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).f_double=DatatypeConverterImpl._parseDouble(lexical); - } - - public boolean hasValue(Object o) { - return true; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_field_Float.java 2018-01-30 20:34:49.000000000 -0500 +++ /dev/null 2018-01-30 20:34:49.000000000 -0500 @@ -1,56 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a float field. - *

- * Auto-generated, do not edit. - *

- *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - *

- * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_field_Float extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printFloat( ((Bean)o).f_float ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).f_float=DatatypeConverterImpl._parseFloat(lexical); - } - - public boolean hasValue(Object o) { - return true; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_field_Integer.java 2018-01-30 20:34:50.000000000 -0500 +++ /dev/null 2018-01-30 20:34:50.000000000 -0500 @@ -1,68 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -import org.xml.sax.SAXException; - -/** - * Template {@link TransducedAccessor} for a byte field. - * - *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - * - * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_field_Integer extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printInt( ((Bean)o).f_int ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).f_int=DatatypeConverterImpl._parseInt(lexical); - } - - public boolean hasValue(Object o) { - return true; - } - - @Override - public void writeLeafElement(XMLSerializer w, Name tagName, Object o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException { - w.leafElement(tagName, ((Bean)o).f_int, fieldName ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_field_Long.java 2018-01-30 20:34:50.000000000 -0500 +++ /dev/null 2018-01-30 20:34:50.000000000 -0500 @@ -1,56 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a long field. - *

- * Auto-generated, do not edit. - *

- *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - *

- * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_field_Long extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printLong( ((Bean)o).f_long ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).f_long=DatatypeConverterImpl._parseLong(lexical); - } - - public boolean hasValue(Object o) { - return true; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_field_Short.java 2018-01-30 20:34:51.000000000 -0500 +++ /dev/null 2018-01-30 20:34:51.000000000 -0500 @@ -1,56 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a short field. - *

- * Auto-generated, do not edit. - *

- *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - *

- * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_field_Short extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printShort( ((Bean)o).f_short ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).f_short=DatatypeConverterImpl._parseShort(lexical); - } - - public boolean hasValue(Object o) { - return true; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_method_Boolean.java 2018-01-30 20:34:52.000000000 -0500 +++ /dev/null 2018-01-30 20:34:52.000000000 -0500 @@ -1,60 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a boolean field. - *

- * Auto-generated, do not edit. - *

- *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - *

- * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_method_Boolean extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printBoolean( ((Bean)o).get_boolean() ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).set_boolean(DatatypeConverterImpl._parseBoolean(lexical)); - } - - public boolean hasValue(Object o) { - return true; - } -// -// public void writeLeafElement(Object o, QName tagName, String fieldName, XMLSerializer w) throws SAXException, AccessorException { -// w.leafElement(tagName, ((Bean)o).get_boolean(), fieldName ); -// } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_method_Byte.java 2018-01-30 20:34:52.000000000 -0500 +++ /dev/null 2018-01-30 20:34:52.000000000 -0500 @@ -1,58 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a byte field. - * - *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - * - * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_method_Byte extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printByte( ((Bean)o).get_byte() ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).set_byte(DatatypeConverterImpl._parseByte(lexical)); - } - - public boolean hasValue(Object o) { - return true; - } -// -// public void writeLeafElement(Object o, QName tagName, String fieldName, XMLSerializer w) throws SAXException, AccessorException { -// w.leafElement(tagName, ((Bean)o).get_byte(), fieldName ); -// } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_method_Double.java 2018-01-30 20:34:53.000000000 -0500 +++ /dev/null 2018-01-30 20:34:53.000000000 -0500 @@ -1,60 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a double field. - *

- * Auto-generated, do not edit. - *

- *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - *

- * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_method_Double extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printDouble( ((Bean)o).get_double() ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).set_double(DatatypeConverterImpl._parseDouble(lexical)); - } - - public boolean hasValue(Object o) { - return true; - } -// -// public void writeLeafElement(Object o, QName tagName, String fieldName, XMLSerializer w) throws SAXException, AccessorException { -// w.leafElement(tagName, ((Bean)o).get_double(), fieldName ); -// } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_method_Float.java 2018-01-30 20:34:54.000000000 -0500 +++ /dev/null 2018-01-30 20:34:54.000000000 -0500 @@ -1,60 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a float field. - *

- * Auto-generated, do not edit. - *

- *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - *

- * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_method_Float extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printFloat( ((Bean)o).get_float() ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).set_float(DatatypeConverterImpl._parseFloat(lexical)); - } - - public boolean hasValue(Object o) { - return true; - } -// -// public void writeLeafElement(Object o, QName tagName, String fieldName, XMLSerializer w) throws SAXException, AccessorException { -// w.leafElement(tagName, ((Bean)o).get_float(), fieldName ); -// } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_method_Integer.java 2018-01-30 20:34:54.000000000 -0500 +++ /dev/null 2018-01-30 20:34:54.000000000 -0500 @@ -1,68 +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.xml.internal.bind.v2.runtime.reflect.opt; - -import java.io.IOException; - -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.Name; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -import org.xml.sax.SAXException; - -/** - * Template {@link TransducedAccessor} for a byte field. - * - *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - * - * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_method_Integer extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printInt( ((Bean)o).get_int() ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).set_int(DatatypeConverterImpl._parseInt(lexical)); - } - - public boolean hasValue(Object o) { - return true; - } - - @Override - public void writeLeafElement(XMLSerializer w, Name tagName, Object o, String fieldName) throws SAXException, AccessorException, IOException, XMLStreamException { - w.leafElement(tagName, ((Bean)o).get_int(), fieldName ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_method_Long.java 2018-01-30 20:34:55.000000000 -0500 +++ /dev/null 2018-01-30 20:34:55.000000000 -0500 @@ -1,60 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a long field. - *

- * Auto-generated, do not edit. - *

- *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - *

- * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_method_Long extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printLong( ((Bean)o).get_long() ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).set_long(DatatypeConverterImpl._parseLong(lexical)); - } - - public boolean hasValue(Object o) { - return true; - } -// -// public void writeLeafElement(Object o, QName tagName, String fieldName, XMLSerializer w) throws SAXException, AccessorException { -// w.leafElement(tagName, ((Bean)o).get_long(), fieldName ); -// } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/TransducedAccessor_method_Short.java 2018-01-30 20:34:56.000000000 -0500 +++ /dev/null 2018-01-30 20:34:56.000000000 -0500 @@ -1,60 +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.bind.v2.runtime.reflect.opt; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.DefaultTransducedAccessor; - -/** - * Template {@link TransducedAccessor} for a short field. - *

- * Auto-generated, do not edit. - *

- *

- * All the TransducedAccessor_field are generated from TransducedAccessor_field_B y t e - *

- * @author Kohsuke Kawaguchi - * - * @see TransducedAccessor#get - */ -public final class TransducedAccessor_method_Short extends DefaultTransducedAccessor { - public String print(Object o) { - return DatatypeConverterImpl._printShort( ((Bean)o).get_short() ); - } - - public void parse(Object o, CharSequence lexical) { - ((Bean)o).set_short(DatatypeConverterImpl._parseShort(lexical)); - } - - public boolean hasValue(Object o) { - return true; - } -// -// public void writeLeafElement(Object o, QName tagName, String fieldName, XMLSerializer w) throws SAXException, AccessorException { -// w.leafElement(tagName, ((Bean)o).get_short(), fieldName ); -// } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/package-info.java 2018-01-30 20:34:56.000000000 -0500 +++ /dev/null 2018-01-30 20:34:57.000000000 -0500 @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * Hosts optimized - * {@link com.sun.xml.internal.bind.v2.runtime.reflect.Accessor}, - * {@link com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor}, and {@link com.sun.xml.internal.bind.v2.runtime.Transducer}. - * - *

How it works

- *

- * Most of the classes in this package are "templates." At run-time, A template class file is slightly modified to match - * the target Java Bean, then it will be loaded into the VM. - */ -package com.sun.xml.internal.bind.v2.runtime.reflect.opt; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/reflect/package-info.java 2018-01-30 20:34:57.000000000 -0500 +++ /dev/null 2018-01-30 20:34:57.000000000 -0500 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * Abstraction around accessing data of actual objects. - */ -package com.sun.xml.internal.bind.v2.runtime.reflect; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/AttributesEx.java 2018-01-30 20:34:58.000000000 -0500 +++ /dev/null 2018-01-30 20:34:58.000000000 -0500 @@ -1,49 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import org.xml.sax.Attributes; - -/** - * {@link Attributes} extension that allows attribute values - * to be exposed as {@link CharSequence}. - * - *

- * All namespace URIs and local names are assumed to be interned. - * - * @author Kohsuke Kawaguchi - */ -public interface AttributesEx extends Attributes { - /** - * The same as {@link #getValue(int)} - */ - CharSequence getData(int idx); - - /** - * The same as {@link #getValue(String,String)} - */ - CharSequence getData(String nsUri,String localName); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/AttributesExImpl.java 2018-01-30 20:34:58.000000000 -0500 +++ /dev/null 2018-01-30 20:34:59.000000000 -0500 @@ -1,45 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import com.sun.xml.internal.bind.util.AttributesImpl; - -/** - * {@link AttributesEx} implementation. - * - * TODO: proper implementation that holds CharSequence - * - * @author Kohsuke Kawaguchi - */ -public final class AttributesExImpl extends AttributesImpl implements AttributesEx { - public CharSequence getData(int idx) { - return getValue(idx); - } - - public CharSequence getData(String nsUri, String localName) { - return getValue(nsUri,localName); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Base64Data.java 2018-01-30 20:34:59.000000000 -0500 +++ /dev/null 2018-01-30 20:34:59.000000000 -0500 @@ -1,307 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import javax.activation.DataHandler; -import javax.activation.DataSource; -import javax.xml.stream.XMLStreamException; - -import javax.xml.stream.XMLStreamWriter; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.runtime.XMLSerializer; -import com.sun.xml.internal.bind.v2.runtime.output.Pcdata; -import com.sun.xml.internal.bind.v2.runtime.output.UTF8XmlOutput; -import com.sun.xml.internal.bind.v2.util.ByteArrayOutputStreamEx; -import com.sun.istack.internal.Nullable; - -/** - * Fed to unmarshaller when the 'text' data is actually - * a virtual image of base64 encoding of the binary data - * transferred on the wire. - * - * Used for the MTOM support. - * - * This object is mutable and the owner of this object can - * reuse it with new data. - * - * Also used by the marshaller to write out the binary data - * that could be possibly attached. - * - * @see XmlVisitor#text(CharSequence) - * @see XMLSerializer#text(Pcdata,String) - * - * @author Kohsuke Kawaguchi, Martin Grebac - */ -public final class Base64Data extends Pcdata { - - // either dataHandler or (data,dataLen,mimeType?) must be present - private DataHandler dataHandler; - private byte[] data; - /** - * Length of the valid data in {@link #data}. - */ - private int dataLen; - /** - * Optional MIME type of {@link #data}. - * - * Unused when {@link #dataHandler} is set. - * Use {@link DataHandler#getContentType()} in that case. - */ - private @Nullable - String mimeType; - - /** - * Fills in the data object by a portion of the byte[]. - * - * @param len - * data[0] to data[len-1] are treated as the data. - */ - public void set(byte[] data, int len, @Nullable String mimeType) { - this.data = data; - this.dataLen = len; - this.dataHandler = null; - this.mimeType = mimeType; - } - - /** - * Fills in the data object by the byte[] of the exact length. - * - * @param data - * this buffer may be owned directly by the unmarshaleld JAXB object. - */ - public void set(byte[] data, @Nullable String mimeType) { - set(data, data.length, mimeType); - } - - /** - * Fills in the data object by a {@link DataHandler}. - */ - public void set(DataHandler data) { - assert data != null; - this.dataHandler = data; - this.data = null; - } - - /** - * Gets the raw data. - */ - public DataHandler getDataHandler() { - if (dataHandler == null) { - dataHandler = new DataHandler(new DataSource() { - - public String getContentType() { - return getMimeType(); - } - - public InputStream getInputStream() { - return new ByteArrayInputStream(data, 0, dataLen); - } - - public String getName() { - return null; - } - - public OutputStream getOutputStream() { - throw new UnsupportedOperationException(); - } - }); - } - - return dataHandler; - } - - /** - * Gets the byte[] of the exact length. - */ - public byte[] getExact() { - get(); - if (dataLen != data.length) { - byte[] buf = new byte[dataLen]; - System.arraycopy(data, 0, buf, 0, dataLen); - data = buf; - } - return data; - } - - /** - * Gets the data as an {@link InputStream}. - */ - public InputStream getInputStream() throws IOException { - if (dataHandler != null) { - return dataHandler.getInputStream(); - } else { - return new ByteArrayInputStream(data, 0, dataLen); - } - } - - /** - * Returns false if this object only has {@link DataHandler} and therefore - * {@link #get()} operation is likely going to be expensive. - */ - public boolean hasData() { - return data != null; - } - - /** - * Gets the raw data. The size of the byte array maybe larger than the actual length. - */ - public byte[] get() { - if (data == null) { - try { - ByteArrayOutputStreamEx baos = new ByteArrayOutputStreamEx(1024); - InputStream is = dataHandler.getDataSource().getInputStream(); - baos.readFrom(is); - is.close(); - data = baos.getBuffer(); - dataLen = baos.size(); - } catch (IOException e) { - // TODO: report the error to the unmarshaller - dataLen = 0; // recover by assuming length-0 data - } - } - return data; - } - - public int getDataLen() { - return dataLen; - } - - public String getMimeType() { - if (mimeType == null) { - return "application/octet-stream"; - } - return mimeType; - } - - /** - * Gets the number of characters needed to represent - * this binary data in the base64 encoding. - */ - public int length() { - // for each 3 bytes you use 4 chars - // if the remainder is 1 or 2 there will be 4 more - get(); // fill in the buffer if necessary - return ((dataLen + 2) / 3) * 4; - } - - /** - * Encode this binary data in the base64 encoding - * and returns the character at the specified position. - */ - public char charAt(int index) { - // we assume that the length() method is called before this method - // (otherwise how would the caller know that the index is valid?) - // so we assume that the byte[] is already populated - - int offset = index % 4; - int base = (index / 4) * 3; - - byte b1, b2; - - switch (offset) { - case 0: - return DatatypeConverterImpl.encode(data[base] >> 2); - case 1: - if (base + 1 < dataLen) { - b1 = data[base + 1]; - } else { - b1 = 0; - } - return DatatypeConverterImpl.encode( - ((data[base] & 0x3) << 4) - | ((b1 >> 4) & 0xF)); - case 2: - if (base + 1 < dataLen) { - b1 = data[base + 1]; - if (base + 2 < dataLen) { - b2 = data[base + 2]; - } else { - b2 = 0; - } - - return DatatypeConverterImpl.encode( - ((b1 & 0xF) << 2) - | ((b2 >> 6) & 0x3)); - } else { - return '='; - } - case 3: - if (base + 2 < dataLen) { - return DatatypeConverterImpl.encode(data[base + 2] & 0x3F); - } else { - return '='; - } - } - - throw new IllegalStateException(); - } - - /** - * Internally this is only used to split a text to a list, - * which doesn't happen that much for base64. - * So this method should be smaller than faster. - */ - public CharSequence subSequence(int start, int end) { - StringBuilder buf = new StringBuilder(); - get(); // fill in the buffer if we haven't done so - for (int i = start; i < end; i++) { - buf.append(charAt(i)); - } - return buf; - } - - /** - * Returns the base64 encoded string of this data. - */ - public String toString() { - get(); // fill in the buffer - return DatatypeConverterImpl._printBase64Binary(data, 0, dataLen); - } - - @Override - public void writeTo(char[] buf, int start) { - get(); - DatatypeConverterImpl._printBase64Binary(data, 0, dataLen, buf, start); - } - - public void writeTo(UTF8XmlOutput output) throws IOException { - // TODO: this is inefficient if the data source is note byte[] but DataHandler - get(); - output.text(data, dataLen); - } - - public void writeTo(XMLStreamWriter output) throws IOException, XMLStreamException { - get(); - DatatypeConverterImpl._printBase64Binary(data, 0, dataLen, output); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ChildLoader.java 2018-01-30 20:35:00.000000000 -0500 +++ /dev/null 2018-01-30 20:35:00.000000000 -0500 @@ -1,44 +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.xml.internal.bind.v2.runtime.unmarshaller; - -/** - * Pair of {@link Loader} and {@link Receiver}. - * - * Used by {@link StructureLoader}. - * - * @author Kohsuke Kawaguchi - */ -public final class ChildLoader { - public final Loader loader; - public final Receiver receiver; - - public ChildLoader(Loader loader, Receiver receiver) { - assert loader!=null; - this.loader = loader; - this.receiver = receiver; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultIDResolver.java 2018-01-30 20:35:01.000000000 -0500 +++ /dev/null 2018-01-30 20:35:01.000000000 -0500 @@ -1,67 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import java.util.HashMap; -import java.util.concurrent.Callable; - -import javax.xml.bind.ValidationEventHandler; - -import com.sun.xml.internal.bind.IDResolver; - -import org.xml.sax.SAXException; - -/** - * Default implementation of {@link IDResolver}. - * - * @author Kohsuke Kawaguchi - */ -final class DefaultIDResolver extends IDResolver { - /** Records ID->Object map. */ - private HashMap idmap = null; - - @Override - public void startDocument(ValidationEventHandler eventHandler) throws SAXException { - if(idmap!=null) - idmap.clear(); - } - - @Override - public void bind(String id, Object obj) { - if(idmap==null) idmap = new HashMap(); - idmap.put(id,obj); - } - - @Override - public Callable resolve(final String id, Class targetType) { - return new Callable() { - public Object call() throws Exception { - if(idmap==null) return null; - return idmap.get(id); - } - }; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DefaultValueLoaderDecorator.java 2018-01-30 20:35:01.000000000 -0500 +++ /dev/null 2018-01-30 20:35:01.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import org.xml.sax.SAXException; - -/** - * Decorates another {@link Loader} by setting a default value. - * - * @author Kohsuke Kawaguchi - */ -public final class DefaultValueLoaderDecorator extends Loader { - private final Loader l; - private final String defaultValue; - - public DefaultValueLoaderDecorator(Loader l, String defaultValue) { - this.l = l; - this.defaultValue = defaultValue; - } - - @Override - public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - // install the default value, but don't override the one given by the parent loader - if(state.getElementDefaultValue() == null) - state.setElementDefaultValue(defaultValue); - - state.setLoader(l); - l.startElement(state,ea); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Discarder.java 2018-01-30 20:35:02.000000000 -0500 +++ /dev/null 2018-01-30 20:35:02.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - - - -/** - * {@link Loader} implementation that discards the whole sub-tree. - * - * Mostly used for recovering fom errors. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class Discarder extends Loader { - public static final Loader INSTANCE = new Discarder(); - - private Discarder() { - super(false); - } - - @Override - public void childElement(UnmarshallingContext.State state, TagName ea) { - state.setTarget(null); - // registering this allows the discarder to process the whole subtree. - state.setLoader(this); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/DomLoader.java 2018-01-30 20:35:03.000000000 -0500 +++ /dev/null 2018-01-30 20:35:03.000000000 -0500 @@ -1,164 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import javax.xml.bind.annotation.DomHandler; -import javax.xml.transform.Result; -import javax.xml.transform.sax.TransformerHandler; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import org.xml.sax.SAXException; - -/** - * Loads a DOM. - * - * @author Kohsuke Kawaguchi - */ -public class DomLoader extends Loader { - - private final DomHandler dom; - - /** - * Used to capture the state. - * - * This instance is created for each unmarshalling episode. - */ - private final class State { - - /** This handler will receive SAX events. */ - private TransformerHandler handler = null; - - /** {@link #handler} will produce this result. */ - private final ResultT result; - - // nest level of elements. - int depth = 1; - - public State( UnmarshallingContext context ) throws SAXException { - handler = JAXBContextImpl.createTransformerHandler(context.getJAXBContext().disableSecurityProcessing); - result = dom.createUnmarshaller(context); - - handler.setResult(result); - - // emulate the start of documents - try { - handler.setDocumentLocator(context.getLocator()); - handler.startDocument(); - declarePrefixes( context, context.getAllDeclaredPrefixes() ); - } catch( SAXException e ) { - context.handleError(e); - throw e; - } - } - - public Object getElement() { - return dom.getElement(result); - } - - private void declarePrefixes( UnmarshallingContext context, String[] prefixes ) throws SAXException { - for( int i=prefixes.length-1; i>=0; i-- ) { - String nsUri = context.getNamespaceURI(prefixes[i]); - if(nsUri==null) throw new IllegalStateException("prefix \'"+prefixes[i]+"\' isn't bound"); - handler.startPrefixMapping(prefixes[i],nsUri ); - } - } - - private void undeclarePrefixes( String[] prefixes ) throws SAXException { - for( int i=prefixes.length-1; i>=0; i-- ) - handler.endPrefixMapping( prefixes[i] ); - } - } - - public DomLoader(DomHandler dom) { - super(true); - this.dom = dom; - } - - @Override - public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - UnmarshallingContext context = state.getContext(); - if (state.getTarget() == null) - state.setTarget(new State(context)); - - State s = (State) state.getTarget(); - try { - s.declarePrefixes(context, context.getNewlyDeclaredPrefixes()); - s.handler.startElement(ea.uri, ea.local, ea.getQname(), ea.atts); - } catch (SAXException e) { - context.handleError(e); - throw e; - } - } - - @Override - public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - state.setLoader(this); - State s = (State) state.getPrev().getTarget(); - s.depth++; - state.setTarget(s); - } - - @Override - public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { - if(text.length()==0) - return; // there's no point in creating an empty Text node in DOM. - try { - State s = (State) state.getTarget(); - s.handler.characters(text.toString().toCharArray(),0,text.length()); - } catch( SAXException e ) { - state.getContext().handleError(e); - throw e; - } - } - - @Override - public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - State s = (State) state.getTarget(); - UnmarshallingContext context = state.getContext(); - - try { - s.handler.endElement(ea.uri, ea.local, ea.getQname()); - s.undeclarePrefixes(context.getNewlyDeclaredPrefixes()); - } catch( SAXException e ) { - context.handleError(e); - throw e; - } - - if((--s.depth)==0) { - // emulate the end of the document - try { - s.undeclarePrefixes(context.getAllDeclaredPrefixes()); - s.handler.endDocument(); - } catch( SAXException e ) { - context.handleError(e); - throw e; - } - - // we are done - state.setTarget(s.getElement()); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/FastInfosetConnector.java 2018-01-30 20:35:03.000000000 -0500 +++ /dev/null 2018-01-30 20:35:03.000000000 -0500 @@ -1,294 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import javax.xml.stream.Location; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; - -import com.sun.xml.internal.bind.WhiteSpaceProcessor; -import com.sun.xml.internal.fastinfoset.stax.StAXDocumentParser; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes; -import org.xml.sax.SAXException; - -/** - * Reads from FastInfoset StAX parser and feeds into JAXB Unmarshaller. - *

- * This class will peek at future events to ascertain if characters need to be - * buffered or not. - * - * @author Paul Sandoz. - */ -final class FastInfosetConnector extends StAXConnector { - - // event source - private final StAXDocumentParser fastInfosetStreamReader; - - // Flag set to true if text has been reported - private boolean textReported; - - // Buffer for octets - private final Base64Data base64Data = new Base64Data(); - - // Buffer for characters - private final StringBuilder buffer = new StringBuilder(); - - public FastInfosetConnector(StAXDocumentParser fastInfosetStreamReader, - XmlVisitor visitor) { - super(visitor); - fastInfosetStreamReader.setStringInterning(true); - this.fastInfosetStreamReader = fastInfosetStreamReader; - } - - public void bridge() throws XMLStreamException { - try { - // remembers the nest level of elements to know when we are done. - int depth=0; - - // if the parser is at the start tag, proceed to the first element - int event = fastInfosetStreamReader.getEventType(); - if(event == XMLStreamConstants.START_DOCUMENT) { - // nextTag doesn't correctly handle DTDs - while( !fastInfosetStreamReader.isStartElement() ) - event = fastInfosetStreamReader.next(); - } - - - if( event!=XMLStreamConstants.START_ELEMENT) - throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event); - - // TODO: we don't have to rely on this hack --- we can just emulate - // start/end prefix mappings. But for now, I'll rely on this hack. - handleStartDocument(fastInfosetStreamReader.getNamespaceContext()); - - OUTER: - while(true) { - // 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 : - handleStartElement(); - depth++; - break; - case XMLStreamConstants.END_ELEMENT : - depth--; - handleEndElement(); - if(depth==0) break OUTER; - break; - case XMLStreamConstants.CHARACTERS : - case XMLStreamConstants.CDATA : - case XMLStreamConstants.SPACE : - if (predictor.expectText()) { - // Peek at the next event to see if there are - // fragmented characters - event = fastInfosetStreamReader.peekNext(); - if (event == XMLStreamConstants.END_ELEMENT) - processNonIgnorableText(); - else if (event == XMLStreamConstants.START_ELEMENT) - processIgnorableText(); - else - handleFragmentedCharacters(); - } - break; - // otherwise simply ignore - } - - event=fastInfosetStreamReader.next(); - } - - fastInfosetStreamReader.next(); // move beyond the end tag. - - handleEndDocument(); - } catch (SAXException e) { - throw new XMLStreamException(e); - } - } - - protected Location getCurrentLocation() { - return fastInfosetStreamReader.getLocation(); - } - - protected String getCurrentQName() { - return fastInfosetStreamReader.getNameString(); - } - - private void handleStartElement() throws SAXException { - processUnreportedText(); - - for (int i = 0; i < fastInfosetStreamReader.accessNamespaceCount(); i++) { - visitor.startPrefixMapping(fastInfosetStreamReader.getNamespacePrefix(i), - fastInfosetStreamReader.getNamespaceURI(i)); - } - - tagName.uri = fastInfosetStreamReader.accessNamespaceURI(); - tagName.local = fastInfosetStreamReader.accessLocalName(); - tagName.atts = fastInfosetStreamReader.getAttributesHolder(); - - visitor.startElement(tagName); - } - - private void handleFragmentedCharacters() throws XMLStreamException, SAXException { - buffer.setLength(0); - - // Append characters of first character event - buffer.append(fastInfosetStreamReader.getTextCharacters(), - fastInfosetStreamReader.getTextStart(), - fastInfosetStreamReader.getTextLength()); - - // Consume all character - while(true) { - switch(fastInfosetStreamReader.peekNext()) { - case XMLStreamConstants.START_ELEMENT : - processBufferedText(true); - return; - case XMLStreamConstants.END_ELEMENT : - processBufferedText(false); - return; - case XMLStreamConstants.CHARACTERS : - case XMLStreamConstants.CDATA : - case XMLStreamConstants.SPACE : - // Append characters of second and subsequent character events - fastInfosetStreamReader.next(); - buffer.append(fastInfosetStreamReader.getTextCharacters(), - fastInfosetStreamReader.getTextStart(), - fastInfosetStreamReader.getTextLength()); - break; - default: - fastInfosetStreamReader.next(); - } - } - } - - private void handleEndElement() throws SAXException { - processUnreportedText(); - - tagName.uri = fastInfosetStreamReader.accessNamespaceURI(); - tagName.local = fastInfosetStreamReader.accessLocalName(); - - visitor.endElement(tagName); - - for (int i = fastInfosetStreamReader.accessNamespaceCount() - 1; i >= 0; i--) { - visitor.endPrefixMapping(fastInfosetStreamReader.getNamespacePrefix(i)); - } - } - - final private class CharSequenceImpl implements CharSequence { - char[] ch; - int start; - int length; - - CharSequenceImpl() { - } - - CharSequenceImpl(final char[] ch, final int start, final int length) { - this.ch = ch; - this.start = start; - this.length = length; - } - - public void set() { - ch = fastInfosetStreamReader.getTextCharacters(); - start = fastInfosetStreamReader.getTextStart(); - length = fastInfosetStreamReader.getTextLength(); - } - - // CharSequence interface - - public final int length() { - return length; - } - - public final char charAt(final int index) { - return ch[start + index]; - } - - public final CharSequence subSequence(final int start, final int end) { - return new CharSequenceImpl(ch, this.start + start, end - start); - } - - public String toString() { - return new String(ch, start, length); - } - } - - final private CharSequenceImpl charArray = new CharSequenceImpl(); - - private void processNonIgnorableText() throws SAXException { - textReported = true; - boolean isTextAlgorithmAplied = - (fastInfosetStreamReader.getTextAlgorithmBytes() != null); - - if (isTextAlgorithmAplied && - fastInfosetStreamReader.getTextAlgorithmIndex() == EncodingAlgorithmIndexes.BASE64) { - base64Data.set(fastInfosetStreamReader.getTextAlgorithmBytesClone(),null); - visitor.text(base64Data); - } else { - if (isTextAlgorithmAplied) { - fastInfosetStreamReader.getText(); - } - - charArray.set(); - visitor.text(charArray); - } - } - - private void processIgnorableText() throws SAXException { - boolean isTextAlgorithmAplied = - (fastInfosetStreamReader.getTextAlgorithmBytes() != null); - - if (isTextAlgorithmAplied && - fastInfosetStreamReader.getTextAlgorithmIndex() == EncodingAlgorithmIndexes.BASE64) { - base64Data.set(fastInfosetStreamReader.getTextAlgorithmBytesClone(),null); - visitor.text(base64Data); - textReported = true; - } else { - if (isTextAlgorithmAplied) { - fastInfosetStreamReader.getText(); - } - - charArray.set(); - if (!WhiteSpaceProcessor.isWhiteSpace(charArray)) { - visitor.text(charArray); - textReported = true; - } - } - } - - private void processBufferedText(boolean ignorable) throws SAXException { - if (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer)) { - visitor.text(buffer); - textReported = true; - } - } - - private void processUnreportedText() throws SAXException { - if(!textReported && predictor.expectText()) { - visitor.text(""); - } - textReported = false; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/IntArrayData.java 2018-01-30 20:35:04.000000000 -0500 +++ /dev/null 2018-01-30 20:35:04.000000000 -0500 @@ -1,122 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import java.io.IOException; - -import com.sun.xml.internal.bind.v2.runtime.output.Pcdata; -import com.sun.xml.internal.bind.v2.runtime.output.UTF8XmlOutput; - -/** - * Typed {@link CharSequence} for int[]. - * - *

- * Fed to unmarshaller when the 'text' data is actually - * a virtual image of int array. - * - *

- * This class holds int[] as a triplet of (data,start,len) - * where 'start' and 'len' represents the start position of the - * data and the length. - * - * @author Kohsuke Kawaguchi - */ -public final class IntArrayData extends Pcdata { - - private int[] data; - private int start; - private int len; - - /** - * String representation of the data. Lazily computed. - */ - private StringBuilder literal; - - - public IntArrayData(int[] data, int start, int len) { - set(data, start, len); - } - - public IntArrayData() { - } - - /** - * Sets the int[] data to this object. - * - *

- * This method doesn't make a copy for a performance reason. - * The caller is still free to modify the array it passed to this method, - * but he should do so with a care. The unmarshalling code isn't expecting - * the value to be changed while it's being routed. - */ - public void set(int[] data, int start, int len) { - this.data = data; - this.start = start; - this.len = len; - this.literal = null; - } - - public int length() { - return getLiteral().length(); - } - - public char charAt(int index) { - return getLiteral().charAt(index); - } - - public CharSequence subSequence(int start, int end) { - return getLiteral().subSequence(start,end); - } - - /** - * Computes the literal form from the data. - */ - private StringBuilder getLiteral() { - if(literal!=null) return literal; - - literal = new StringBuilder(); - int p = start; - for( int i=len; i>0; i-- ) { - if(literal.length()>0) literal.append(' '); - literal.append(data[p++]); - } - - return literal; - } - - public String toString() { - return literal.toString(); - } - - public void writeTo(UTF8XmlOutput output) throws IOException { - int p = start; - for( int i=len; i>0; i-- ) { - if(i!=len) - output.write(' '); - output.text(data[p++]); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/IntData.java 2018-01-30 20:35:05.000000000 -0500 +++ /dev/null 2018-01-30 20:35:05.000000000 -0500 @@ -1,90 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import java.io.IOException; - -import com.sun.xml.internal.bind.v2.runtime.output.Pcdata; -import com.sun.xml.internal.bind.v2.runtime.output.UTF8XmlOutput; - -/** - * {@link Pcdata} that represents a single integer. - * - * @author Kohsuke Kawaguchi - */ -public class IntData extends Pcdata { - /** - * The int value that this {@link Pcdata} represents. - * - * Modifiable. - */ - private int data; - - /** - * Length of the {@link #data} in ASCII string. - * For example if data=-10, then length=3 - */ - private int length; - - public void reset(int i) { - this.data = i; - if(i==Integer.MIN_VALUE) - length = 11; - else - length = (i < 0) ? stringSizeOfInt(-i) + 1 : stringSizeOfInt(i); - } - - private final static int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999, - 99999999, 999999999, Integer.MAX_VALUE }; - - // Requires positive x - private static int stringSizeOfInt(int x) { - for (int i=0; ; i++) - if (x <= sizeTable[i]) - return i+1; - } - - public String toString() { - return String.valueOf(data); - } - - - public int length() { - return length; - } - - public char charAt(int index) { - return toString().charAt(index); - } - - public CharSequence subSequence(int start, int end) { - return toString().substring(start,end); - } - - public void writeTo(UTF8XmlOutput output) throws IOException { - output.text(data); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Intercepter.java 2018-01-30 20:35:05.000000000 -0500 +++ /dev/null 2018-01-30 20:35:05.000000000 -0500 @@ -1,48 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import org.xml.sax.SAXException; - -/** - * Used solely by {@link com.sun.xml.internal.bind.v2.runtime.ElementBeanInfoImpl} to wrap - * the loaded value object into a JAXBElement object. - * - * UGLY HACK. - * - * @author Kohsuke Kawaguchi - */ -public interface Intercepter { - /** - * Called when the child loader is deactivated. - * - * @param state - * points to the parent's current state. - * @param o - * object that was loaded. may be null. - */ - Object intercept(UnmarshallingContext.State state, Object o) throws SAXException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/InterningXmlVisitor.java 2018-01-30 20:35:06.000000000 -0500 +++ /dev/null 2018-01-30 20:35:06.000000000 -0500 @@ -1,154 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import javax.xml.namespace.NamespaceContext; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * {@link XmlVisitor} decorator that interns all string tokens. - * - * @author Kohsuke Kawaguchi - */ -public final class InterningXmlVisitor implements XmlVisitor { - private final XmlVisitor next; - - private final AttributesImpl attributes = new AttributesImpl(); - - public InterningXmlVisitor(XmlVisitor next) { - this.next = next; - } - - public void startDocument(LocatorEx locator, NamespaceContext nsContext) throws SAXException { - next.startDocument(locator,nsContext); - } - - public void endDocument() throws SAXException { - next.endDocument(); - } - - public void startElement(TagName tagName ) throws SAXException { - attributes.setAttributes(tagName.atts); - tagName.atts = attributes; - tagName.uri = intern(tagName.uri); - tagName.local = intern(tagName.local); - next.startElement(tagName); - } - - public void endElement(TagName tagName ) throws SAXException { - tagName.uri = intern(tagName.uri); - tagName.local = intern(tagName.local); - next.endElement(tagName); - } - - public void startPrefixMapping( String prefix, String nsUri ) throws SAXException { - next.startPrefixMapping(intern(prefix),intern(nsUri)); - } - - public void endPrefixMapping( String prefix ) throws SAXException { - next.endPrefixMapping(intern(prefix)); - } - - public void text( CharSequence pcdata ) throws SAXException { - next.text(pcdata); - } - - public UnmarshallingContext getContext() { - return next.getContext(); - } - - public TextPredictor getPredictor() { - return next.getPredictor(); - } - - private static class AttributesImpl implements Attributes { - private Attributes core; - - void setAttributes(Attributes att) { - this.core = att; - } - - public int getIndex(String qName) { - return core.getIndex(qName); - } - - public int getIndex(String uri, String localName) { - return core.getIndex(uri, localName); - } - - public int getLength() { - return core.getLength(); - } - - public String getLocalName(int index) { - return intern(core.getLocalName(index)); - } - - public String getQName(int index) { - return intern(core.getQName(index)); - } - - public String getType(int index) { - return intern(core.getType(index)); - } - - public String getType(String qName) { - return intern(core.getType(qName)); - } - - public String getType(String uri, String localName) { - return intern(core.getType(uri, localName)); - } - - public String getURI(int index) { - return intern(core.getURI(index)); - } - - // - // since values may vary a lot, - // we don't (probably shouldn't) intern values. - // - - public String getValue(int index) { - return core.getValue(index); - } - - public String getValue(String qName) { - return core.getValue(qName); - } - - public String getValue(String uri, String localName) { - return core.getValue(uri, localName); - } - } - - private static String intern(String s) { - if(s==null) return null; - else return s.intern(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyLoader.java 2018-01-30 20:35:07.000000000 -0500 +++ /dev/null 2018-01-30 20:35:07.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; - -import org.xml.sax.SAXException; - -/** - * Unmarshals a text into a property of the parent element. - * - * @see ValuePropertyLoader - * @author Kohsuke Kawaguchi - */ -public class LeafPropertyLoader extends Loader { - - private final TransducedAccessor xacc; - - public LeafPropertyLoader(TransducedAccessor xacc) { - super(true); - this.xacc = xacc; - } - - public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { - try { - xacc.parse(state.getPrev().getTarget(), text); - } catch (AccessorException e) { - handleGenericException(e,true); - } catch (RuntimeException e) { - handleParseConversionException(state,e); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LeafPropertyXsiLoader.java 2018-01-30 20:35:07.000000000 -0500 +++ /dev/null 2018-01-30 20:35:08.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import java.util.Collection; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -public final class LeafPropertyXsiLoader extends Loader { - - private final Loader defaultLoader; - private final TransducedAccessor xacc; - private final Accessor acc; - - public LeafPropertyXsiLoader(Loader defaultLoader, TransducedAccessor xacc, Accessor acc) { - this.defaultLoader = defaultLoader; - this.expectText = true; - this.xacc = xacc; - this.acc = acc; - } - - - @Override - public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - final Loader loader = selectLoader(state, ea); - state.setLoader(loader); - loader.startElement(state, ea); - } - - protected Loader selectLoader(UnmarshallingContext.State state, TagName ea) throws SAXException { - - UnmarshallingContext context = state.getContext(); - JaxBeanInfo beanInfo = null; - - // look for @xsi:type - Attributes atts = ea.atts; - int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE, "type"); - - if (idx >= 0) { - String value = atts.getValue(idx); - - QName type = DatatypeConverterImpl._parseQName(value, context); - - if (type == null) - return defaultLoader; - - beanInfo = context.getJAXBContext().getGlobalType(type); - if (beanInfo == null) - return defaultLoader; - ClassBeanInfoImpl cbii; - try { - cbii = (ClassBeanInfoImpl) beanInfo; - } catch (ClassCastException cce) { - return defaultLoader; - } - - if (null == cbii.getTransducer()) { - return defaultLoader; - } - - return new LeafPropertyLoader( - new TransducedAccessor.CompositeTransducedAccessorImpl( - state.getContext().getJAXBContext(), - cbii.getTransducer(), - acc)); - } - - return defaultLoader; - } - - @Override - public Collection getExpectedChildElements() { - return defaultLoader.getExpectedChildElements(); - } - - @Override - public Collection getExpectedAttributes() { - return defaultLoader.getExpectedAttributes(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Loader.java 2018-01-30 20:35:08.000000000 -0500 +++ /dev/null 2018-01-30 20:35:08.000000000 -0500 @@ -1,262 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import java.util.Collection; -import java.util.Collections; - -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.helpers.ValidationEventImpl; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; - -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi - */ -public abstract class Loader { - - // allow derived classes to change it later - protected boolean expectText; - - protected Loader(boolean expectText) { - this.expectText = expectText; - } - - protected Loader() { - } - -// -// -// -// Contract -// -// -// - /** - * Called when the loader is activated, which is when a new start tag is seen - * and when the parent designated this loader as the child loader. - * - *

- * The callee may change {@code state.loader} to designate another {@link Loader} - * for the processing. It's the responsibility of the callee to forward the startElement - * event in such a case. - * - * @param ea - * info about the start tag. never null. - */ - public void startElement(UnmarshallingContext.State state,TagName ea) throws SAXException { - } - - /** - * Called when this loaderis an active loaderand we see a new child start tag. - * - *

- * The callee is expected to designate another loaderas a loaderthat processes - * this element, then it should also register a {@link Receiver}. - * The designated loaderwill become an active loader. - * - *

- * The default implementation reports an error saying an element is unexpected. - */ - public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - // notify the error, then recover by ignoring the whole element. - reportUnexpectedChildElement(ea, true); - state.setLoader(Discarder.INSTANCE); - state.setReceiver(null); - } - - @SuppressWarnings({"StringEquality"}) - protected final void reportUnexpectedChildElement(TagName ea, boolean canRecover) throws SAXException { - if (canRecover) { - // this error happens particurly often (when input documents contain a lot of unexpected elements to be ignored), - // so don't bother computing all the messages and etc if we know that - // there's no event handler to receive the error in the end. See #286 - UnmarshallingContext context = UnmarshallingContext.getInstance(); - if (!context.parent.hasEventHandler() // is somebody listening? - || !context.shouldErrorBeReported()) // should we report error? - return; - } - if(ea.uri!=ea.uri.intern() || ea.local!=ea.local.intern()) - reportError(Messages.UNINTERNED_STRINGS.format(), canRecover ); - else - reportError(Messages.UNEXPECTED_ELEMENT.format(ea.uri,ea.local,computeExpectedElements()), canRecover ); - } - - /** - * Returns a set of tag names expected as possible child elements in this context. - */ - public Collection getExpectedChildElements() { - return Collections.emptyList(); - } - - /** - * Returns a set of tag names expected as possible child elements in this context. - */ - public Collection getExpectedAttributes() { - return Collections.emptyList(); - } - - /** - * Called when this loaderis an active loaderand we see a chunk of text. - * - * The runtime makes sure that adjacent characters (even those separated - * by comments, PIs, etc) are reported as one event. - * IOW, you won't see two text event calls in a row. - */ - public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { - // make str printable - text = text.toString().replace('\r',' ').replace('\n',' ').replace('\t',' ').trim(); - reportError(Messages.UNEXPECTED_TEXT.format(text), true ); - } - - /** - * True if this loader expects the {@link #text(UnmarshallingContext.State, CharSequence)} method - * to be called. False otherwise. - */ - public final boolean expectText() { - return expectText; - } - - - /** - * Called when this loaderis an active loaderand we see an end tag. - */ - public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - } - - - - - - - - - - -// -// -// -// utility methods -// -// -// - /** - * Computes the names of possible root elements for a better error diagnosis. - */ - private String computeExpectedElements() { - StringBuilder r = new StringBuilder(); - - for( QName n : getExpectedChildElements() ) { - if(r.length()!=0) r.append(','); - r.append("<{").append(n.getNamespaceURI()).append('}').append(n.getLocalPart()).append('>'); - } - if(r.length()==0) { - return "(none)"; - } - - return r.toString(); - } - - /** - * Fires the beforeUnmarshal event if necessary. - * - * @param state - * state of the newly create child object. - */ - protected final void fireBeforeUnmarshal(JaxBeanInfo beanInfo, Object child, UnmarshallingContext.State state) throws SAXException { - if(beanInfo.lookForLifecycleMethods()) { - UnmarshallingContext context = state.getContext(); - Unmarshaller.Listener listener = context.parent.getListener(); - if(beanInfo.hasBeforeUnmarshalMethod()) { - beanInfo.invokeBeforeUnmarshalMethod(context.parent, child, state.getPrev().getTarget()); - } - if(listener!=null) { - listener.beforeUnmarshal(child, state.getPrev().getTarget()); - } - } - } - - /** - * Fires the afterUnmarshal event if necessary. - * - * @param state - * state of the parent object - */ - protected final void fireAfterUnmarshal(JaxBeanInfo beanInfo, Object child, UnmarshallingContext.State state) throws SAXException { - // fire the event callback - if(beanInfo.lookForLifecycleMethods()) { - UnmarshallingContext context = state.getContext(); - Unmarshaller.Listener listener = context.parent.getListener(); - if(beanInfo.hasAfterUnmarshalMethod()) { - beanInfo.invokeAfterUnmarshalMethod(context.parent, child, state.getTarget()); - } - if(listener!=null) - listener.afterUnmarshal(child, state.getTarget()); - } - } - - - /** - * Last resort when something goes terribly wrong within the unmarshaller. - */ - protected static void handleGenericException(Exception e) throws SAXException { - handleGenericException(e,false); - } - - public static void handleGenericException(Exception e, boolean canRecover) throws SAXException { - reportError(e.getMessage(), e, canRecover ); - } - - public static void handleGenericError(Error e) throws SAXException { - reportError(e.getMessage(), false); - } - - protected static void reportError(String msg, boolean canRecover) throws SAXException { - reportError(msg, null, canRecover ); - } - - public static void reportError(String msg, Exception nested, boolean canRecover) throws SAXException { - UnmarshallingContext context = UnmarshallingContext.getInstance(); - context.handleEvent( new ValidationEventImpl( - canRecover? ValidationEvent.ERROR : ValidationEvent.FATAL_ERROR, - msg, - context.getLocator().getLocation(), - nested ), canRecover ); - } - - /** - * This method is called by the generated derived class - * when a datatype parse method throws an exception. - */ - protected static void handleParseConversionException(UnmarshallingContext.State state, Exception e) throws SAXException { - // wrap it into a ParseConversionEvent and report it - state.getContext().handleError(e); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LocatorEx.java 2018-01-30 20:35:09.000000000 -0500 +++ /dev/null 2018-01-30 20:35:09.000000000 -0500 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime.unmarshaller; - -import java.net.URL; - -import javax.xml.bind.ValidationEventLocator; - -import org.xml.sax.Locator; -import org.w3c.dom.Node; - -/** - * Object that returns the current location that the {@code com.sun.xml.internal.bind.v2.runtime.unmarshaller.XmlVisitor} - * is parsing. - * - * @author Kohsuke Kawaguchi - */ -public interface LocatorEx extends Locator { - /** - * Gets the current location in a {@link ValidationEventLocator} object. - * @return - */ - ValidationEventLocator getLocation(); - - /** - * Immutable snapshot of a {@link LocatorEx} - */ - public static final class Snapshot implements LocatorEx, ValidationEventLocator { - private final int columnNumber,lineNumber,offset; - private final String systemId,publicId; - private final URL url; - private final Object object; - private final Node node; - - public Snapshot(LocatorEx loc) { - columnNumber = loc.getColumnNumber(); - lineNumber = loc.getLineNumber(); - systemId = loc.getSystemId(); - publicId = loc.getPublicId(); - - ValidationEventLocator vel = loc.getLocation(); - offset = vel.getOffset(); - url = vel.getURL(); - object = vel.getObject(); - node = vel.getNode(); - } - - public Object getObject() { - return object; - } - - public Node getNode() { - return node; - } - - public int getOffset() { - return offset; - } - - public URL getURL() { - return url; - } - - public int getColumnNumber() { - return columnNumber; - } - - public int getLineNumber() { - return lineNumber; - } - - public String getSystemId() { - return systemId; - } - - public String getPublicId() { - return publicId; - } - - public ValidationEventLocator getLocation() { - return this; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/LocatorExWrapper.java 2018-01-30 20:35:10.000000000 -0500 +++ /dev/null 2018-01-30 20:35:10.000000000 -0500 @@ -1,64 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import javax.xml.bind.ValidationEventLocator; -import javax.xml.bind.helpers.ValidationEventLocatorImpl; - -import org.xml.sax.Locator; - -/** - * {@link LocatorEx} implemented by {@link Locator}. - * - * @author Kohsuke Kawaguchi - */ -class LocatorExWrapper implements LocatorEx { - private final Locator locator; - - public LocatorExWrapper(Locator locator) { - this.locator = locator; - } - - public ValidationEventLocator getLocation() { - return new ValidationEventLocatorImpl(locator); - } - - public String getPublicId() { - return locator.getPublicId(); - } - - public String getSystemId() { - return locator.getSystemId(); - } - - public int getLineNumber() { - return locator.getLineNumber(); - } - - public int getColumnNumber() { - return locator.getColumnNumber(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/MTOMDecorator.java 2018-01-30 20:35:10.000000000 -0500 +++ /dev/null 2018-01-30 20:35:10.000000000 -0500 @@ -1,131 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import javax.activation.DataHandler; -import javax.xml.bind.attachment.AttachmentUnmarshaller; -import javax.xml.namespace.NamespaceContext; - -import com.sun.xml.internal.bind.v2.WellKnownNamespace; - -import org.xml.sax.SAXException; - -/** - * Decorator of {@link XmlVisitor} that performs XOP processing. - * Used to support MTOM. - * - * @author Kohsuke Kawaguchi - */ -final class MTOMDecorator implements XmlVisitor { - - private final XmlVisitor next; - - private final AttachmentUnmarshaller au; - - private UnmarshallerImpl parent; - - private final Base64Data base64data = new Base64Data(); - - /** - * True if we are between the start and the end of xop:Include - */ - private boolean inXopInclude; - - /** - * UGLY HACK: we need to ignore the whitespace that follows - * the attached base64 image. - * - * This happens twice; once before {@code }, another - * after {@code }. The spec guarantees that - * no valid pcdata can follow {@code }. - */ - private boolean followXop; - - public MTOMDecorator(UnmarshallerImpl parent,XmlVisitor next, AttachmentUnmarshaller au) { - this.parent = parent; - this.next = next; - this.au = au; - } - - public void startDocument(LocatorEx loc, NamespaceContext nsContext) throws SAXException { - next.startDocument(loc,nsContext); - } - - public void endDocument() throws SAXException { - next.endDocument(); - } - - public void startElement(TagName tagName) throws SAXException { - if(tagName.local.equals("Include") && tagName.uri.equals(WellKnownNamespace.XOP)) { - // found xop:Include - String href = tagName.atts.getValue("href"); - DataHandler attachment = au.getAttachmentAsDataHandler(href); - if(attachment==null) { - // report an error and ignore - parent.getEventHandler().handleEvent(null); - // TODO - } - base64data.set(attachment); - next.text(base64data); - inXopInclude = true; - followXop = true; - } else - next.startElement(tagName); - } - - public void endElement(TagName tagName) throws SAXException { - if(inXopInclude) { - // consume by ourselves. - inXopInclude = false; - followXop = true; - return; - } - next.endElement(tagName); - } - - public void startPrefixMapping(String prefix, String nsUri) throws SAXException { - next.startPrefixMapping(prefix,nsUri); - } - - public void endPrefixMapping(String prefix) throws SAXException { - next.endPrefixMapping(prefix); - } - - public void text( CharSequence pcdata ) throws SAXException { - if(!followXop) - next.text(pcdata); - else - followXop = false; - } - - public UnmarshallingContext getContext() { - return next.getContext(); - } - - public TextPredictor getPredictor() { - return next.getPredictor(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages.java 2018-01-30 20:35:11.000000000 -0500 +++ /dev/null 2018-01-30 20:35:11.000000000 -0500 @@ -1,55 +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.bind.v2.runtime.unmarshaller; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * @author Kohsuke Kawaguchi - */ -enum Messages { - UNRESOLVED_IDREF, // 1 arg - UNEXPECTED_ELEMENT, // 3 args - UNEXPECTED_TEXT, // 1 arg - NOT_A_QNAME, // 1 arg - UNRECOGNIZED_TYPE_NAME, // 1 arg - UNRECOGNIZED_TYPE_NAME_MAYBE, // 2 args - UNABLE_TO_CREATE_MAP, // 1 arg - UNINTERNED_STRINGS, // no args - ERRORS_LIMIT_EXCEEDED, // no arg - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages.properties 2018-01-30 20:35:12.000000000 -0500 +++ /dev/null 2018-01-30 20:35:12.000000000 -0500 @@ -1,56 +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. -# - -NOT_A_QNAME = \ - {0} is not a valid QName - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = \ - unrecognized type name: {0} - -UNRECOGNIZED_TYPE_NAME_MAYBE = \ - unrecognized type name: {0}. Did you mean {1}? - -UNRESOLVED_IDREF = \ - Undefined ID "{0}". - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = \ - unexpected element (uri:"{0}", local:"{1}"). Expected elements are {2} - -UNEXPECTED_TEXT = \ - unexpected text "{0}" - -UNABLE_TO_CREATE_MAP = \ - The type of the field is {0}, but JAXB doesn't know how to create an instance \ - assignable to it. Create an instance in the constructor, or use a type that can \ - be assignable from HashMap. - -UNINTERNED_STRINGS = \ - Namespace URIs and local names to the unmarshaller needs to be interned. - -# user have to set Logger.getLogger("com.sun.xml.internal.bind").setLevel(Level.FINEST) -ERRORS_LIMIT_EXCEEDED = \ - Errors limit exceeded. To receive all errors set 'com.sun.xml.internal.bind' logger to FINEST level. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages_de.properties 2018-01-30 20:35:12.000000000 -0500 +++ /dev/null 2018-01-30 20:35:12.000000000 -0500 @@ -1,42 +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. -# - -NOT_A_QNAME = {0} ist kein g\u00FCltiger QName - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = unbekannter Typname: {0} - -UNRECOGNIZED_TYPE_NAME_MAYBE = unbekannter Typname: {0}. Haben Sie {1} gemeint? - -UNRESOLVED_IDREF = Undefinierte ID "{0}". - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = unerwartetes Element (URI:"{0}", lokal:"{1}"). Erwartete Elemente sind {2} - -UNEXPECTED_TEXT = unerwarteter Text "{0}" - -UNABLE_TO_CREATE_MAP = Der Typ des Feldes ist {0}, JAXB wei\u00DF jedoch nicht, wie eine Instanz erstellt werden soll, die ihm zugewiesen werden kann. Erstellen Sie eine Instanz im Konstruktor, oder verwenden Sie einen Typ, der aus HashMap zugewiesen werden kann. - -UNINTERNED_STRINGS = Die Methode intern() muss f\u00FCr Namespace-URIs und lokale Unmarshaller-Namen angewendet werden. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages_es.properties 2018-01-30 20:35:13.000000000 -0500 +++ /dev/null 2018-01-30 20:35:13.000000000 -0500 @@ -1,42 +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. -# - -NOT_A_QNAME = {0} no es un QName v\u00E1lido - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = Nombre de tipo no reconocido: {0}. - -UNRECOGNIZED_TYPE_NAME_MAYBE = nombre de tipo no reconocido: {0}. \u00BFQuiso decir {1}? - -UNRESOLVED_IDREF = Identificador no definido "{0}". - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = elemento inesperado (URI:"{0}", local:"{1}"). Los elementos esperados son {2} - -UNEXPECTED_TEXT = texto inesperado "{0}" - -UNABLE_TO_CREATE_MAP = El tipo del campo es {0}, pero JAXB no sabe c\u00F3mo crear una instancia que se le pueda asignar. Cree una instancia en el constructor o utilice un tipo que se pueda asignar desde HashMap. - -UNINTERNED_STRINGS = Se debe aplicar el m\u00E9todo intern() a los URI de espacios de nombres y los nombres locales del unmarshaller. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages_fr.properties 2018-01-30 20:35:14.000000000 -0500 +++ /dev/null 2018-01-30 20:35:14.000000000 -0500 @@ -1,42 +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. -# - -NOT_A_QNAME = {0} n''est pas un QName valide - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = nom de type non reconnu : {0} - -UNRECOGNIZED_TYPE_NAME_MAYBE = non de type non reconnu : {0}. Vouliez-vous dire {1} ? - -UNRESOLVED_IDREF = ID "{0}" non d\u00E9fini. - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = \u00E9l\u00E9ment inattendu (URI : "{0}", local : "{1}"). Les \u00E9l\u00E9ments attendus sont {2} - -UNEXPECTED_TEXT = texte "{0}" inattendu - -UNABLE_TO_CREATE_MAP = Le type du champ est {0}, mais JAXB ne sait pas comment cr\u00E9er une instance qui peut lui \u00EAtre affect\u00E9e. Cr\u00E9ez une instance dans le constructeur ou utilisez un type qui peut \u00EAtre affect\u00E9 \u00E0 partir de HashMap. - -UNINTERNED_STRINGS = La m\u00E9thode intern() doit \u00EAtre appliqu\u00E9e aux URI d'espace de noms et aux noms locaux du d\u00E9s\u00E9rialiseur. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages_it.properties 2018-01-30 20:35:14.000000000 -0500 +++ /dev/null 2018-01-30 20:35:14.000000000 -0500 @@ -1,42 +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. -# - -NOT_A_QNAME = {0} non \u00E8 un QName valido - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = nome tipo non riconosciuto: {0} - -UNRECOGNIZED_TYPE_NAME_MAYBE = nome tipo non riconosciuto: {0}. Si intendeva {1}? - -UNRESOLVED_IDREF = ID non definito: "{0}". - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = elemento non previsto (uri:"{0}", local:"{1}"). Gli elementi previsti sono {2} - -UNEXPECTED_TEXT = testo non previsto "{0}" - -UNABLE_TO_CREATE_MAP = Il tipo del campo \u00E8 {0} ma JAXB non \u00E8 in grado di creare un''istanza a esso assegnabile. Creare un''istanza nel costruttore o usare un tipo che possa essere assegnabile da HashMap. - -UNINTERNED_STRINGS = Il metodo intern() deve essere applicato agli URI dello spazio di nomi e ai nomi locali dell'unmarshaller. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages_ja.properties 2018-01-30 20:35:15.000000000 -0500 +++ /dev/null 2018-01-30 20:35:15.000000000 -0500 @@ -1,42 +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. -# - -NOT_A_QNAME = {0}\u306F\u6709\u52B9\u306AQName\u3067\u306F\u3042\u308A\u307E\u305B\u3093 - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = \u30BF\u30A4\u30D7\u306E\u540D\u524D\u3092\u8A8D\u8B58\u3067\u304D\u307E\u305B\u3093: {0} - -UNRECOGNIZED_TYPE_NAME_MAYBE = \u30BF\u30A4\u30D7\u306E\u540D\u524D\u3092\u8A8D\u8B58\u3067\u304D\u307E\u305B\u3093: {0}\u3002{1}\u306E\u8AA4\u308A\u3067\u3042\u308B\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059\u3002 - -UNRESOLVED_IDREF = \u672A\u5B9A\u7FA9\u306EID "{0}"\u3067\u3059\u3002 - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = \u4E88\u671F\u3057\u306A\u3044\u8981\u7D20(URI:"{0}"\u3001\u30ED\u30FC\u30AB\u30EB:"{1}")\u3067\u3059\u3002\u4E88\u671F\u3055\u308C\u308B\u8981\u7D20\u306F{2}\u3067\u3059 - -UNEXPECTED_TEXT = \u4E88\u671F\u3057\u306A\u3044\u30C6\u30AD\u30B9\u30C8"{0}" - -UNABLE_TO_CREATE_MAP = \u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u30BF\u30A4\u30D7\u306F{0}\u3067\u3059\u304C\u3001JAXB\u3067\u306F\u5272\u5F53\u53EF\u80FD\u306A\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u306E\u4F5C\u6210\u65B9\u6CD5\u304C\u4E0D\u660E\u3067\u3059\u3002\u30B3\u30F3\u30B9\u30C8\u30E9\u30AF\u30BF\u5185\u306B\u30A4\u30F3\u30B9\u30BF\u30F3\u30B9\u3092\u4F5C\u6210\u3059\u308B\u304B\u3001HashMap\u304B\u3089\u5272\u5F53\u53EF\u80FD\u306A\u30BF\u30A4\u30D7\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002 - -UNINTERNED_STRINGS = unmarshaller\u306B\u5BFE\u3059\u308B\u30CD\u30FC\u30E0\u30B9\u30DA\u30FC\u30B9URI\u304A\u3088\u3073\u30ED\u30FC\u30AB\u30EB\u540D\u3092\u30A4\u30F3\u30BF\u30FC\u30F3\u5316\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages_ko.properties 2018-01-30 20:35:16.000000000 -0500 +++ /dev/null 2018-01-30 20:35:16.000000000 -0500 @@ -1,42 +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. -# - -NOT_A_QNAME = {0}\uC740(\uB294) \uC801\uD569\uD55C QName\uC774 \uC544\uB2D9\uB2C8\uB2E4. - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = \uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uC720\uD615 \uC774\uB984: {0} - -UNRECOGNIZED_TYPE_NAME_MAYBE = \uC778\uC2DD\uD560 \uC218 \uC5C6\uB294 \uC720\uD615 \uC774\uB984: {0}. {1}\uC744(\uB97C) \uC0AC\uC6A9\uD558\uB824\uACE0 \uD55C \uAC83\uC785\uB2C8\uAE4C? - -UNRESOLVED_IDREF = "{0}"\uC740(\uB294) \uC815\uC758\uB418\uC9C0 \uC54A\uC740 ID\uC785\uB2C8\uB2E4. - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = \uC608\uC0C1\uCE58 \uC54A\uC740 \uC694\uC18C(URI: "{0}", \uB85C\uCEEC: "{1}")\uC785\uB2C8\uB2E4. \uD544\uC694\uD55C \uC694\uC18C\uB294 {2}\uC785\uB2C8\uB2E4. - -UNEXPECTED_TEXT = \uC608\uC0C1\uCE58 \uC54A\uC740 "{0}" \uD14D\uC2A4\uD2B8 - -UNABLE_TO_CREATE_MAP = \uC774 \uD544\uB4DC\uC758 \uC720\uD615\uC740 {0}\uC774\uC9C0\uB9CC JAXB\uAC00 \uC774 \uD544\uB4DC\uC5D0 \uC9C0\uC815 \uAC00\uB2A5\uD55C \uC778\uC2A4\uD134\uC2A4\uB97C \uC0DD\uC131\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uC0DD\uC131\uC790\uC5D0 \uC778\uC2A4\uD134\uC2A4\uB97C \uC0DD\uC131\uD558\uAC70\uB098 HashMap\uC5D0\uC11C \uC9C0\uC815 \uAC00\uB2A5\uD55C \uC720\uD615\uC744 \uC0AC\uC6A9\uD558\uC2ED\uC2DC\uC624. - -UNINTERNED_STRINGS = \uC5B8\uB9C8\uC15C\uB7EC\uC5D0 \uB300\uD55C \uB124\uC784\uC2A4\uD398\uC774\uC2A4 URI \uBC0F \uB85C\uCEEC \uC774\uB984\uC5D0 \uB300\uD574 intern() \uBA54\uC18C\uB4DC\uB97C \uD638\uCD9C\uD574\uC57C \uD569\uB2C8\uB2E4. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages_pt_BR.properties 2018-01-30 20:35:16.000000000 -0500 +++ /dev/null 2018-01-30 20:35:16.000000000 -0500 @@ -1,42 +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. -# - -NOT_A_QNAME = {0} n\u00E3o \u00E9 um QName v\u00E1lido - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = nome do tipo n\u00E3o reconhecido: {0} - -UNRECOGNIZED_TYPE_NAME_MAYBE = nome do tipo n\u00E3o reconhecido: {0}. Voc\u00EA quis dizer {1}? - -UNRESOLVED_IDREF = ID Indefinido "{0}". - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = elemento inesperado (uri:"{0}", local:"{1}"). Os elementos esperados s\u00E3o {2} - -UNEXPECTED_TEXT = texto inesperado "{0}" - -UNABLE_TO_CREATE_MAP = O tipo de campo \u00E9 {0}, mas JAXB n\u00E3o sabe como criar uma inst\u00E2ncia atribu\u00EDvel a ele. Crie uma inst\u00E2ncia no construtor ou use um tipo que pode ser atribu\u00EDvel do HashMap. - -UNINTERNED_STRINGS = URIs de namespace e nomes locais para o unmarshaller precisam ser internos. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages_zh_CN.properties 2018-01-30 20:35:17.000000000 -0500 +++ /dev/null 2018-01-30 20:35:17.000000000 -0500 @@ -1,42 +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. -# - -NOT_A_QNAME = {0}\u4E0D\u662F\u6709\u6548\u7684 QName - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = \u65E0\u6CD5\u8BC6\u522B\u7C7B\u578B\u540D\u79F0: {0} - -UNRECOGNIZED_TYPE_NAME_MAYBE = \u65E0\u6CD5\u8BC6\u522B\u7C7B\u578B\u540D\u79F0: {0}\u3002\u662F\u5426\u6253\u7B97{1}? - -UNRESOLVED_IDREF = \u672A\u5B9A\u4E49\u7684 ID "{0}"\u3002 - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = \u610F\u5916\u7684\u5143\u7D20 (uri:"{0}", local:"{1}")\u3002\u6240\u9700\u5143\u7D20\u4E3A{2} - -UNEXPECTED_TEXT = \u610F\u5916\u7684\u6587\u672C "{0}" - -UNABLE_TO_CREATE_MAP = \u6B64\u5B57\u6BB5\u7684\u7C7B\u578B\u4E3A{0}, \u4F46 JAXB \u4E0D\u77E5\u9053\u5982\u4F55\u521B\u5EFA\u53EF\u5206\u914D\u7ED9\u8BE5\u7C7B\u578B\u7684\u5B9E\u4F8B\u3002\u8BF7\u5728\u6784\u9020\u5668\u4E2D\u521B\u5EFA\u5B9E\u4F8B, \u6216\u8005\u4F7F\u7528\u53EF\u4ECE HashMap \u5206\u914D\u7684\u7C7B\u578B\u3002 - -UNINTERNED_STRINGS = \u89E3\u7F16\u96C6\u5668\u7684\u540D\u79F0\u7A7A\u95F4 URI \u548C\u672C\u5730\u540D\u79F0\u9700\u8981\u4FDD\u7559\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Messages_zh_TW.properties 2018-01-30 20:35:18.000000000 -0500 +++ /dev/null 2018-01-30 20:35:18.000000000 -0500 @@ -1,42 +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. -# - -NOT_A_QNAME = {0} \u4E0D\u662F\u6709\u6548\u7684 QName - -# Not concatenated with any other string. -UNRECOGNIZED_TYPE_NAME = \u7121\u6CD5\u8FA8\u8B58\u7684\u985E\u578B\u540D\u7A31: {0} - -UNRECOGNIZED_TYPE_NAME_MAYBE = \u7121\u6CD5\u8FA8\u8B58\u7684\u985E\u578B\u540D\u7A31: {0}. \u60A8\u6307\u7684\u662F {1} \u55CE? - -UNRESOLVED_IDREF = \u672A\u5B9A\u7FA9\u7684 ID "{0}". - -# Printed after [ERROR]: string. -UNEXPECTED_ELEMENT = \u672A\u9810\u671F\u7684\u5143\u7D20 (URI:"{0}", \u672C\u6A5F:"{1}"). \u9810\u671F\u7684\u5143\u7D20\u70BA {2} - -UNEXPECTED_TEXT = \u672A\u9810\u671F\u7684\u6587\u5B57 "{0}" - -UNABLE_TO_CREATE_MAP = \u6B04\u4F4D\u7684\u985E\u578B\u70BA {0}, \u4F46 JAXB \u4E0D\u77E5\u9053\u5982\u4F55\u5EFA\u7ACB\u53EF\u6307\u5B9A\u7D66\u5B83\u7684\u57F7\u884C\u8655\u7406. \u8ACB\u5728\u5EFA\u69CB\u5B50\u4E2D\u5EFA\u7ACB\u57F7\u884C\u8655\u7406, \u6216\u4F7F\u7528\u53EF\u5F9E HashMap \u6307\u5B9A\u7684\u985E\u578B. - -UNINTERNED_STRINGS = \u5FC5\u9808\u99D0\u7559 (intern) \u89E3\u9664\u5C01\u9001\u8655\u7406\u7A0B\u5F0F (Unmarshaller) \u7684\u547D\u540D\u7A7A\u9593 URI \u8207\u672C\u6A5F\u540D\u7A31. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Patcher.java 2018-01-30 20:35:18.000000000 -0500 +++ /dev/null 2018-01-30 20:35:19.000000000 -0500 @@ -1,35 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi - */ -public interface Patcher { - void run() throws SAXException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ProxyLoader.java 2018-01-30 20:35:19.000000000 -0500 +++ /dev/null 2018-01-30 20:35:19.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import org.xml.sax.SAXException; - -/** - * {@link Loader} that delegates the processing to another {@link Loader} - * at {@link #startElement(UnmarshallingContext.State, TagName)}. - * - * @author Kohsuke Kawaguchi - */ -public abstract class ProxyLoader extends Loader { - public ProxyLoader() { - super(false); - } - - @Override - public final void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - Loader loader = selectLoader(state,ea); - state.setLoader(loader); - loader.startElement(state,ea); - } - - /** - * Picks the loader to delegate to. - * - * @return never null. - */ - protected abstract Loader selectLoader(UnmarshallingContext.State state, TagName ea) throws SAXException; - - @Override - public final void leaveElement(UnmarshallingContext.State state, TagName ea) { - // this loader is used just to forward to another loader, - // so we should never get this event. - throw new IllegalStateException(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Receiver.java 2018-01-30 20:35:20.000000000 -0500 +++ /dev/null 2018-01-30 20:35:20.000000000 -0500 @@ -1,45 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import org.xml.sax.SAXException; - -/** - * Receives an object by a child {@link Loader}. - * - * @author Kohsuke Kawaguchi - */ -public interface Receiver { - /** - * Called when the child loader is deactivated. - * - * @param state - * points to the parent's current state. - * @param o - * object that was loaded. may be null. - */ - void receive(UnmarshallingContext.State state, Object o) throws SAXException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SAXConnector.java 2018-01-30 20:35:21.000000000 -0500 +++ /dev/null 2018-01-30 20:35:21.000000000 -0500 @@ -1,202 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import com.sun.xml.internal.bind.Util; -import javax.xml.bind.JAXBException; -import javax.xml.bind.UnmarshallerHandler; - -import com.sun.xml.internal.bind.WhiteSpaceProcessor; -import com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.xml.sax.Attributes; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; - -/** - * Receives SAX events and convert them to our internal events. - * - * @author Kohsuke Kawaguchi - */ -public final class SAXConnector implements UnmarshallerHandler { - - private LocatorEx loc; - - private static final Logger logger = Util.getClassLogger(); - - /** - * SAX may fire consecutive characters event, but we don't allow it. - * so use this buffer to perform buffering. - */ - private final StringBuilder buffer = new StringBuilder(); - - private final XmlVisitor next; - private final UnmarshallingContext context; - private final XmlVisitor.TextPredictor predictor; - - private static final class TagNameImpl extends TagName { - String qname; - @Override - public String getQname() { - return qname; - } - } - - private final TagNameImpl tagName = new TagNameImpl(); - - /** - * @param externalLocator - * If the caller is producing SAX events from sources other than Unicode and angle brackets, - * the caller can override the default SAX {@link Locator} object by this object - * to provide better location information. - */ - public SAXConnector(XmlVisitor next, LocatorEx externalLocator ) { - this.next = next; - this.context = next.getContext(); - this.predictor = next.getPredictor(); - this.loc = externalLocator; - } - - @Override - public Object getResult() throws JAXBException, IllegalStateException { - return context.getResult(); - } - - public UnmarshallingContext getContext() { - return context; - } - - @Override - public void setDocumentLocator(final Locator locator) { - if(loc!=null) - return; // we already have an external locator. ignore. - - this.loc = new LocatorExWrapper(locator); - } - - @Override - public void startDocument() throws SAXException { - if (logger.isLoggable(Level.FINER)) { - logger.log(Level.FINER, "SAXConnector.startDocument"); - } - next.startDocument(loc,null); - } - - @Override - public void endDocument() throws SAXException { - if (logger.isLoggable(Level.FINER)) { - logger.log(Level.FINER, "SAXConnector.endDocument"); - } - next.endDocument(); - } - - @Override - public void startPrefixMapping(String prefix, String uri) throws SAXException { - if (logger.isLoggable(Level.FINER)) { - logger.log(Level.FINER, "SAXConnector.startPrefixMapping: {0}:{1}", new Object[]{prefix, uri}); - } - next.startPrefixMapping(prefix,uri); - } - - @Override - public void endPrefixMapping(String prefix) throws SAXException { - if (logger.isLoggable(Level.FINER)) { - logger.log(Level.FINER, "SAXConnector.endPrefixMapping: {0}", new Object[]{prefix}); - } - next.endPrefixMapping(prefix); - } - - @Override - public void startElement(String uri, String local, String qname, Attributes atts) throws SAXException { - if (logger.isLoggable(Level.FINER)) { - logger.log(Level.FINER, "SAXConnector.startElement: {0}:{1}:{2}, attrs: {3}", new Object[]{uri, local, qname, atts}); - } - // work gracefully with misconfigured parsers that don't support namespaces - if( uri==null || uri.length()==0 ) - uri=""; - if( local==null || local.length()==0 ) - local=qname; - if( qname==null || qname.length()==0 ) - qname=local; - - processText(!context.getCurrentState().isMixed()); - - tagName.uri = uri; - tagName.local = local; - tagName.qname = qname; - tagName.atts = atts; - next.startElement(tagName); - } - - @Override - public void endElement(String uri, String localName, String qName) throws SAXException { - if (logger.isLoggable(Level.FINER)) { - logger.log(Level.FINER, "SAXConnector.startElement: {0}:{1}:{2}", new Object[]{uri, localName, qName}); - } - processText(false); - tagName.uri = uri; - tagName.local = localName; - tagName.qname = qName; - next.endElement(tagName); - } - - - @Override - public final void characters( char[] buf, int start, int len ) { - if (logger.isLoggable(Level.FINEST)) { - logger.log(Level.FINEST, "SAXConnector.characters: {0}", buf); - } - if( predictor.expectText() ) - buffer.append(buf,start,len); - } - - @Override - public final void ignorableWhitespace( char[] buf, int start, int len ) { - if (logger.isLoggable(Level.FINEST)) { - logger.log(Level.FINEST, "SAXConnector.characters{0}", buf); - } - characters(buf,start,len); - } - - @Override - public void processingInstruction(String target, String data) { - // nop - } - - @Override - public void skippedEntity(String name) { - // nop - } - - private void processText( boolean ignorable ) throws SAXException { - if (predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer))) - next.text(buffer); - buffer.setLength(0); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/Scope.java 2018-01-30 20:35:21.000000000 -0500 +++ /dev/null 2018-01-30 20:35:21.000000000 -0500 @@ -1,136 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.Lister; - -import org.xml.sax.SAXException; - -/** - * Holds the information about packing scope. - * - *

- * When no packing is started yet, all the fields should be set to null. - * - * @author Kohsuke Kawaguchi - */ -public final class Scope { - - public final UnmarshallingContext context; - - private BeanT bean; - private Accessor acc; - private PackT pack; - private Lister lister; - - Scope(UnmarshallingContext context) { - this.context = context; - } - - /** - * Returns true if this scope object is filled by a packing in progress. - */ - public boolean hasStarted() { - return bean!=null; - } - - /** - * Initializes all the fields to null. - */ - public void reset() { - if(bean==null) { - // already initialized - assert clean(); - return; - } - - bean = null; - acc = null; - pack = null; - lister = null; - } - - /** - * Finishes up the current packing in progress (if any) and - * resets this object. - */ - public void finish() throws AccessorException { - if(hasStarted()) { - lister.endPacking(pack,bean,acc); - reset(); - } - assert clean(); - } - - private boolean clean() { - return bean==null && acc==null && pack==null && lister==null; - } - - /** - * Adds a new item to this packing scope. - */ - public void add( Accessor acc, Lister lister, ItemT value) throws SAXException{ - try { - if(!hasStarted()) { - this.bean = (BeanT)context.getCurrentState().getTarget(); - this.acc = acc; - this.lister = lister; - this.pack = lister.startPacking(bean,acc); - } - - lister.addToPack(pack,value); - } catch (AccessorException e) { - Loader.handleGenericException(e,true); - // recover from this error by ignoring future items. - this.lister = Lister.getErrorInstance(); - this.acc = Accessor.getErrorInstance(); - } - } - - /** - * Starts the packing scope, without adding any item. - * - * This allows us to return an empty pack, thereby allowing the user - * to distinguish empty array vs null array. - */ - public void start( Accessor acc, Lister lister) throws SAXException{ - try { - if(!hasStarted()) { - this.bean = (BeanT)context.getCurrentState().getTarget(); - this.acc = acc; - this.lister = lister; - this.pack = lister.startPacking(bean,acc); - } - } catch (AccessorException e) { - Loader.handleGenericException(e,true); - // recover from this error by ignoring future items. - this.lister = Lister.getErrorInstance(); - this.acc = Accessor.getErrorInstance(); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/SecureLoader.java 2018-01-30 20:35:22.000000000 -0500 +++ /dev/null 2018-01-30 20:35:22.000000000 -0500 @@ -1,75 +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.xml.internal.bind.v2.runtime.unmarshaller; - -/** - * Class defined for safe calls of getClassLoader methods of any kind (context/system/class - * classloader. This MUST be package private and defined in every package which - * uses such invocations. - * @author snajper - */ -class SecureLoader { - - static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - - static ClassLoader getClassClassLoader(final Class c) { - if (System.getSecurityManager() == null) { - return c.getClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return c.getClassLoader(); - } - }); - } - } - - static ClassLoader getSystemClassLoader() { - if (System.getSecurityManager() == null) { - return ClassLoader.getSystemClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public java.lang.Object run() { - return ClassLoader.getSystemClassLoader(); - } - }); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXConnector.java 2018-01-30 20:35:23.000000000 -0500 +++ /dev/null 2018-01-30 20:35:23.000000000 -0500 @@ -1,109 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import javax.xml.bind.ValidationEventLocator; -import javax.xml.bind.helpers.ValidationEventLocatorImpl; -import javax.xml.namespace.NamespaceContext; -import javax.xml.stream.Location; -import javax.xml.stream.XMLStreamException; - -import org.xml.sax.SAXException; - -/** - * @author Kohsuke Kawaguchi - */ -abstract class StAXConnector { - public abstract void bridge() throws XMLStreamException; - - - // event sink - protected final XmlVisitor visitor; - - protected final UnmarshallingContext context; - protected final XmlVisitor.TextPredictor predictor; - - private final class TagNameImpl extends TagName { - public String getQname() { - return StAXConnector.this.getCurrentQName(); - } - } - - protected final TagName tagName = new TagNameImpl(); - - protected StAXConnector(XmlVisitor visitor) { - this.visitor = visitor; - context = visitor.getContext(); - predictor = visitor.getPredictor(); - } - - /** - * Gets the {@link Location}. Used for implementing the line number information. - * @return must not null. - */ - protected abstract Location getCurrentLocation(); - - /** - * Gets the QName of the current element. - */ - protected abstract String getCurrentQName(); - - protected final void handleStartDocument(NamespaceContext nsc) throws SAXException { - visitor.startDocument(new LocatorEx() { - public ValidationEventLocator getLocation() { - return new ValidationEventLocatorImpl(this); - } - public int getColumnNumber() { - return getCurrentLocation().getColumnNumber(); - } - public int getLineNumber() { - return getCurrentLocation().getLineNumber(); - } - public String getPublicId() { - return getCurrentLocation().getPublicId(); - } - public String getSystemId() { - return getCurrentLocation().getSystemId(); - } - },nsc); - } - - protected final void handleEndDocument() throws SAXException { - visitor.endDocument(); - } - - protected static String fixNull(String s) { - if(s==null) return ""; - else return s; - } - - protected final String getQName(String prefix, String localName) { - if(prefix==null || prefix.length()==0) - return localName; - else - return prefix + ':' + localName; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXEventConnector.java 2018-01-30 20:35:24.000000000 -0500 +++ /dev/null 2018-01-30 20:35:24.000000000 -0500 @@ -1,286 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import java.util.Iterator; - -import javax.xml.namespace.QName; -import javax.xml.stream.Location; -import javax.xml.stream.XMLEventReader; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.events.Attribute; -import javax.xml.stream.events.Characters; -import javax.xml.stream.events.EndElement; -import javax.xml.stream.events.Namespace; -import javax.xml.stream.events.StartElement; -import javax.xml.stream.events.XMLEvent; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.AttributesImpl; - -/** - * This is a simple utility class that adapts StAX events from an - * {@link XMLEventReader} to unmarshaller events on a - * {@link XmlVisitor}, bridging between the two - * parser technologies. - * - * @author Ryan.Shoemaker@Sun.COM - * @version 1.0 - */ -final class StAXEventConnector extends StAXConnector { - - // StAX event source - private final XMLEventReader staxEventReader; - - /** Current event. */ - private XMLEvent event; - - /** - * Shared and reused {@link Attributes}. - */ - private final AttributesImpl attrs = new AttributesImpl(); - - /** - * SAX may fire consective characters event, but we don't allow it. - * so use this buffer to perform buffering. - */ - private final StringBuilder buffer = new StringBuilder(); - - private boolean seenText; - - /** - * Construct a new StAX to SAX adapter that will convert a StAX event - * stream into a SAX event stream. - * - * @param staxCore - * StAX event source - * @param visitor - * sink - */ - public StAXEventConnector(XMLEventReader staxCore, XmlVisitor visitor) { - super(visitor); - staxEventReader = staxCore; - } - - public void bridge() throws XMLStreamException { - - try { - // remembers the nest level of elements to know when we are done. - int depth=0; - - event = staxEventReader.peek(); - - if( !event.isStartDocument() && !event.isStartElement() ) - throw new IllegalStateException(); - - // if the parser is on START_DOCUMENT, skip ahead to the first element - do { - event = staxEventReader.nextEvent(); - } while( !event.isStartElement() ); - - handleStartDocument(event.asStartElement().getNamespaceContext()); - - OUTER: - while(true) { - // These are all of the events listed in the javadoc for - // XMLEvent. - // The spec only really describes 11 of them. - switch (event.getEventType()) { - case XMLStreamConstants.START_ELEMENT : - handleStartElement(event.asStartElement()); - depth++; - break; - case XMLStreamConstants.END_ELEMENT : - depth--; - handleEndElement(event.asEndElement()); - if(depth==0) break OUTER; - break; - case XMLStreamConstants.CHARACTERS : - case XMLStreamConstants.CDATA : - case XMLStreamConstants.SPACE : - handleCharacters(event.asCharacters()); - break; - } - - - event=staxEventReader.nextEvent(); - } - - handleEndDocument(); - event = null; // avoid keeping a stale reference - } catch (SAXException e) { - throw new XMLStreamException(e); - } - } - - protected Location getCurrentLocation() { - return event.getLocation(); - } - - protected String getCurrentQName() { - QName qName; - if(event.isEndElement()) - qName = event.asEndElement().getName(); - else - qName = event.asStartElement().getName(); - return getQName(qName.getPrefix(), qName.getLocalPart()); - } - - - private void handleCharacters(Characters event) throws SAXException, XMLStreamException { - if(!predictor.expectText()) - return; // text isn't expected. simply skip - - seenText = true; - - // check the next event - XMLEvent next; - while(true) { - next = staxEventReader.peek(); - if(!isIgnorable(next)) - break; - staxEventReader.nextEvent(); - } - - if(isTag(next)) { - // this is by far the common case --- you have abc or abc... - visitor.text(event.getData()); - return; - } - - // otherwise we have things like "abcdef". - // concatenate all text - buffer.append(event.getData()); - - while(true) { - while(true) { - next = staxEventReader.peek(); - if(!isIgnorable(next)) - break; - staxEventReader.nextEvent(); - } - - if(isTag(next)) { - // found all adjacent text - visitor.text(buffer); - buffer.setLength(0); - return; - } - - buffer.append(next.asCharacters().getData()); - staxEventReader.nextEvent(); // consume - } - } - - private boolean isTag(XMLEvent event) { - int eventType = event.getEventType(); - return eventType==XMLEvent.START_ELEMENT || eventType==XMLEvent.END_ELEMENT; - } - - private boolean isIgnorable(XMLEvent event) { - int eventType = event.getEventType(); - return eventType==XMLEvent.COMMENT || eventType==XMLEvent.PROCESSING_INSTRUCTION; - } - - private void handleEndElement(EndElement event) throws SAXException { - if(!seenText && predictor.expectText()) { - visitor.text(""); - } - - // fire endElement - QName qName = event.getName(); - tagName.uri = fixNull(qName.getNamespaceURI()); - tagName.local = qName.getLocalPart(); - visitor.endElement(tagName); - - // end namespace bindings - for( Iterator i = event.getNamespaces(); i.hasNext();) { - String prefix = fixNull(i.next().getPrefix()); // be defensive - visitor.endPrefixMapping(prefix); - } - - seenText = false; - } - - private void handleStartElement(StartElement event) throws SAXException { - // start namespace bindings - for (Iterator i = event.getNamespaces(); i.hasNext();) { - Namespace ns = (Namespace)i.next(); - visitor.startPrefixMapping( - fixNull(ns.getPrefix()), - fixNull(ns.getNamespaceURI())); - } - - // fire startElement - QName qName = event.getName(); - tagName.uri = fixNull(qName.getNamespaceURI()); - String localName = qName.getLocalPart(); - tagName.uri = fixNull(qName.getNamespaceURI()); - tagName.local = localName; - tagName.atts = getAttributes(event); - visitor.startElement(tagName); - - seenText = false; - } - - - - /** - * Get the attributes associated with the given START_ELEMENT StAXevent. - * - * @return the StAX attributes converted to an org.xml.sax.Attributes - */ - private Attributes getAttributes(StartElement event) { - attrs.clear(); - - // in SAX, namespace declarations are not part of attributes by default. - // (there's a property to control that, but as far as we are concerned - // we don't use it.) So don't add xmlns:* to attributes. - - // gather non-namespace attrs - for (Iterator i = event.getAttributes(); i.hasNext();) { - Attribute staxAttr = (Attribute)i.next(); - - QName name = staxAttr.getName(); - String uri = fixNull(name.getNamespaceURI()); - String localName = name.getLocalPart(); - String prefix = name.getPrefix(); - String qName; - if (prefix == null || prefix.length() == 0) - qName = localName; - else - qName = prefix + ':' + localName; - String type = staxAttr.getDTDType(); - String value = staxAttr.getValue(); - - attrs.addAttribute(uri, localName, qName, type, value); - } - - return attrs; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXExConnector.java 2018-01-30 20:35:24.000000000 -0500 +++ /dev/null 2018-01-30 20:35:24.000000000 -0500 @@ -1,72 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx; -import org.xml.sax.SAXException; - -/** - * Reads XML from StAX {@link XMLStreamReader} and - * feeds events to {@link XmlVisitor}. - * - * @author Ryan.Shoemaker@Sun.COM - * @author Kohsuke Kawaguchi - * @version JAXB 2.0 - */ -final class StAXExConnector extends StAXStreamConnector { - - // StAX event source - private final XMLStreamReaderEx in; - - public StAXExConnector(XMLStreamReaderEx in, XmlVisitor visitor) { - super(in,visitor); - this.in = in; - } - - @Override - protected void handleCharacters() throws XMLStreamException, SAXException { - if( predictor.expectText() ) { - CharSequence pcdata = in.getPCDATA(); - if(pcdata instanceof com.sun.xml.internal.org.jvnet.staxex.Base64Data) { - com.sun.xml.internal.org.jvnet.staxex.Base64Data bd = (com.sun.xml.internal.org.jvnet.staxex.Base64Data) pcdata; - Base64Data binary = new Base64Data(); - if(!bd.hasData()) - binary.set(bd.getDataHandler()); - else - binary.set( bd.get(), bd.getDataLen(), bd.getMimeType() ); - // we make an assumption here that the binary data shows up on its own - // not adjacent to other text. So it's OK to fire it off right now. - visitor.text(binary); - textReported = true; - } else { - buffer.append(pcdata); - } - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java 2018-01-30 20:35:25.000000000 -0500 +++ /dev/null 2018-01-30 20:35:25.000000000 -0500 @@ -1,387 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import java.lang.reflect.Constructor; - -import javax.xml.stream.Location; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; - -import com.sun.xml.internal.bind.WhiteSpaceProcessor; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Reads XML from StAX {@link XMLStreamReader} and - * feeds events to {@link XmlVisitor}. - *

- * TODO: - * Finding the optimized FI implementations is a bit hacky and not very - * extensible. Can we use the service provider mechanism in general for - * concrete implementations of StAXConnector. - * - * @author Ryan.Shoemaker@Sun.COM - * @author Kohsuke Kawaguchi - * @version JAXB 2.0 - */ -class StAXStreamConnector extends StAXConnector { - - /** - * Creates a {@link StAXConnector} from {@link XMLStreamReader}. - * - * This method checks if the parser is FI parser and acts accordingly. - */ - public static StAXConnector create(XMLStreamReader reader, XmlVisitor visitor) { - // try optimized codepath - final Class readerClass = reader.getClass(); - if (FI_STAX_READER_CLASS != null && FI_STAX_READER_CLASS.isAssignableFrom(readerClass) && FI_CONNECTOR_CTOR!=null) { - try { - return FI_CONNECTOR_CTOR.newInstance(reader,visitor); - } catch (Exception t) { - } - } - - // Quick hack until SJSXP fixes 6270116 - boolean isZephyr = readerClass.getName().equals("com.sun.xml.internal.stream.XMLReaderImpl"); - if (getBoolProp(reader,"org.codehaus.stax2.internNames") && - getBoolProp(reader,"org.codehaus.stax2.internNsUris")) - ; // no need for interning - else - if (isZephyr) - ; // no need for interning - else - if (checkImplementaionNameOfSjsxp(reader)) - ; // no need for interning. - else - visitor = new InterningXmlVisitor(visitor); - - if (STAX_EX_READER_CLASS!=null && STAX_EX_READER_CLASS.isAssignableFrom(readerClass)) { - try { - return STAX_EX_CONNECTOR_CTOR.newInstance(reader,visitor); - } catch (Exception t) { - } - } - - return new StAXStreamConnector(reader,visitor); - } - - private static boolean checkImplementaionNameOfSjsxp(XMLStreamReader reader) { - try { - Object name = reader.getProperty("http://java.sun.com/xml/stream/properties/implementation-name"); - return name!=null && name.equals("sjsxp"); - } catch (Exception e) { - // be defensive against broken StAX parsers since javadoc is not clear - // about when an error happens - return false; - } - } - - private static boolean getBoolProp(XMLStreamReader r, String n) { - try { - Object o = r.getProperty(n); - if(o instanceof Boolean) return (Boolean)o; - return false; - } catch (Exception e) { - // be defensive against broken StAX parsers since javadoc is not clear - // about when an error happens - return false; - } - } - - - // StAX event source - private final XMLStreamReader staxStreamReader; - - /** - * SAX may fire consecutive characters event, but we don't allow it. - * so use this buffer to perform buffering. - */ - protected final StringBuilder buffer = new StringBuilder(); - - /** - * Set to true if the text() event is reported, and therefore - * the following text() event should be suppressed. - */ - protected boolean textReported = false; - - protected StAXStreamConnector(XMLStreamReader staxStreamReader, XmlVisitor visitor) { - super(visitor); - this.staxStreamReader = staxStreamReader; - } - - public void bridge() throws XMLStreamException { - - try { - // remembers the nest level of elements to know when we are done. - int depth=0; - - // if the parser is at the start tag, proceed to the first element - int event = staxStreamReader.getEventType(); - if(event == XMLStreamConstants.START_DOCUMENT) { - // nextTag doesn't correctly handle DTDs - while( !staxStreamReader.isStartElement() ) - event = staxStreamReader.next(); - } - - - if( event!=XMLStreamConstants.START_ELEMENT) - throw new IllegalStateException("The current event is not START_ELEMENT\n but " + event); - - handleStartDocument(staxStreamReader.getNamespaceContext()); - - OUTER: - while(true) { - // 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 : - handleStartElement(); - depth++; - break; - case XMLStreamConstants.END_ELEMENT : - depth--; - handleEndElement(); - if(depth==0) break OUTER; - break; - case XMLStreamConstants.CHARACTERS : - case XMLStreamConstants.CDATA : - case XMLStreamConstants.SPACE : - handleCharacters(); - break; - // otherwise simply ignore - } - - event=staxStreamReader.next(); - } - - staxStreamReader.next(); // move beyond the end tag. - - handleEndDocument(); - } catch (SAXException e) { - throw new XMLStreamException(e); - } - } - - protected Location getCurrentLocation() { - return staxStreamReader.getLocation(); - } - - protected String getCurrentQName() { - return getQName(staxStreamReader.getPrefix(),staxStreamReader.getLocalName()); - } - - private void handleEndElement() throws SAXException { - processText(false); - - // fire endElement - tagName.uri = fixNull(staxStreamReader.getNamespaceURI()); - tagName.local = staxStreamReader.getLocalName(); - visitor.endElement(tagName); - - // end namespace bindings - int nsCount = staxStreamReader.getNamespaceCount(); - for (int i = nsCount - 1; i >= 0; i--) { - visitor.endPrefixMapping(fixNull(staxStreamReader.getNamespacePrefix(i))); - } - } - - private void handleStartElement() throws SAXException { - processText(true); - - // start namespace bindings - int nsCount = staxStreamReader.getNamespaceCount(); - for (int i = 0; i < nsCount; i++) { - visitor.startPrefixMapping( - fixNull(staxStreamReader.getNamespacePrefix(i)), - fixNull(staxStreamReader.getNamespaceURI(i))); - } - - // fire startElement - tagName.uri = fixNull(staxStreamReader.getNamespaceURI()); - tagName.local = staxStreamReader.getLocalName(); - tagName.atts = attributes; - - visitor.startElement(tagName); - } - - /** - * Proxy of {@link Attributes} that read from {@link XMLStreamReader}. - */ - private final Attributes attributes = new Attributes() { - public int getLength() { - return staxStreamReader.getAttributeCount(); - } - - public String getURI(int index) { - String uri = staxStreamReader.getAttributeNamespace(index); - if(uri==null) return ""; - return uri; - } - - public String getLocalName(int index) { - return staxStreamReader.getAttributeLocalName(index); - } - - public String getQName(int index) { - String prefix = staxStreamReader.getAttributePrefix(index); - if(prefix==null || prefix.length()==0) - return getLocalName(index); - else - return prefix + ':' + getLocalName(index); - } - - public String getType(int index) { - return staxStreamReader.getAttributeType(index); - } - - public String getValue(int index) { - return staxStreamReader.getAttributeValue(index); - } - - public int getIndex(String uri, String localName) { - for( int i=getLength()-1; i>=0; i-- ) - if( localName.equals(getLocalName(i)) && uri.equals(getURI(i))) - return i; - return -1; - } - - // this method sholdn't be used that often (if at all) - // so it's OK to be slow. - public int getIndex(String qName) { - for( int i=getLength()-1; i>=0; i-- ) { - if(qName.equals(getQName(i))) - return i; - } - return -1; - } - - public String getType(String uri, String localName) { - int index = getIndex(uri,localName); - if(index<0) return null; - return getType(index); - } - - public String getType(String qName) { - int index = getIndex(qName); - if(index<0) return null; - return getType(index); - } - - public String getValue(String uri, String localName) { - int index = getIndex(uri,localName); - if(index<0) return null; - return getValue(index); - } - - public String getValue(String qName) { - int index = getIndex(qName); - if(index<0) return null; - return getValue(index); - } - }; - - protected void handleCharacters() throws XMLStreamException, SAXException { - if( predictor.expectText() ) - buffer.append( - staxStreamReader.getTextCharacters(), - staxStreamReader.getTextStart(), - staxStreamReader.getTextLength() ); - } - - private void processText( boolean ignorable ) throws SAXException { - if( predictor.expectText() && (!ignorable || !WhiteSpaceProcessor.isWhiteSpace(buffer) || context.getCurrentState().isMixed())) { - if(textReported) { - textReported = false; - } else { - visitor.text(buffer); - } - } - buffer.setLength(0); - } - - - - /** - * Reference to FI's StAXReader class, if FI can be loaded. - */ - private static final Class FI_STAX_READER_CLASS = initFIStAXReaderClass(); - private static final Constructor FI_CONNECTOR_CTOR = initFastInfosetConnectorClass(); - - private static Class initFIStAXReaderClass() { - try { - Class fisr = Class.forName("com.sun.xml.internal.org.jvnet.fastinfoset.stax.FastInfosetStreamReader"); - Class sdp = Class.forName("com.sun.xml.internal.fastinfoset.stax.StAXDocumentParser"); - // Check if StAXDocumentParser implements FastInfosetStreamReader - if (fisr.isAssignableFrom(sdp)) - return sdp; - else - return null; - } catch (Throwable e) { - return null; - } - } - - private static Constructor initFastInfosetConnectorClass() { - try { - if (FI_STAX_READER_CLASS == null) - return null; - - Class c = Class.forName( - "com.sun.xml.internal.bind.v2.runtime.unmarshaller.FastInfosetConnector"); - return c.getConstructor(FI_STAX_READER_CLASS,XmlVisitor.class); - } catch (Throwable e) { - return null; - } - } - - // - // reference to StAXEx classes - // - private static final Class STAX_EX_READER_CLASS = initStAXExReader(); - private static final Constructor STAX_EX_CONNECTOR_CTOR = initStAXExConnector(); - - private static Class initStAXExReader() { - try { - return Class.forName("com.sun.xml.internal.org.jvnet.staxex.XMLStreamReaderEx"); - } catch (Throwable e) { - return null; - } - } - - private static Constructor initStAXExConnector() { - try { - Class c = Class.forName("com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXExConnector"); - return c.getConstructor(STAX_EX_READER_CLASS,XmlVisitor.class); - } catch (Throwable e) { - return null; - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StructureLoader.java 2018-01-30 20:35:26.000000000 -0500 +++ /dev/null 2018-01-30 20:35:26.000000000 -0500 @@ -1,290 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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.bind.v2.runtime.unmarshaller; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.api.JAXBRIContext; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.runtime.ClassBeanInfoImpl; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.runtime.property.AttributeProperty; -import com.sun.xml.internal.bind.v2.runtime.property.Property; -import com.sun.xml.internal.bind.v2.runtime.property.StructureLoaderBuilder; -import com.sun.xml.internal.bind.v2.runtime.property.UnmarshallerChain; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; -import com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor; -import com.sun.xml.internal.bind.v2.util.QNameMap; - -import java.util.Iterator; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Loads children of an element. - * - *

- * This loader works with a single {@link JaxBeanInfo} and handles - * attributes, child elements, or child text. - * - * @author Kohsuke Kawaguchi - */ -public final class StructureLoader extends Loader { - /** - * This map statically stores information of the - * unmarshaller loader and can be used while unmarshalling - * Since creating new QNames is expensive use this optimized - * version of the map - */ - private final QNameMap childUnmarshallers = new QNameMap(); - - /** - * Loader that processes elements that didn't match anf of the {@link #childUnmarshallers}. - * Can be null. - */ - private /*final*/ ChildLoader catchAll; - - /** - * If we have a loader for processing text. Otherwise null. - */ - private /*final*/ ChildLoader textHandler; - - /** - * Unmarshallers for attribute values. - * May be null if no attribute is expected and {@link #attCatchAll}==null. - */ - private /*final*/ QNameMap attUnmarshallers; - - /** - * This will receive all the attributes - * that were not processed. Never be null. - */ - private /*final*/ Accessor> attCatchAll; - - private final JaxBeanInfo beanInfo; - - /** - * The number of scopes this dispatcher needs to keep active. - */ - private /*final*/ int frameSize; - - // this class is potentially useful for general audience, not just for ClassBeanInfoImpl, - // but since right now that is the only user, we make the construction code very specific - // to ClassBeanInfoImpl. See rev.1.5 of this file for the original general purpose definition. - public StructureLoader(ClassBeanInfoImpl beanInfo) { - super(true); - this.beanInfo = beanInfo; - } - - /** - * Completes the initialization. - * - *

- * To fix the cyclic reference issue, the main part of the initialization needs to be done - * after a {@link StructureLoader} is set to {@link ClassBeanInfoImpl#loader}. - */ - public void init( JAXBContextImpl context, ClassBeanInfoImpl beanInfo, Accessor> attWildcard) { - UnmarshallerChain chain = new UnmarshallerChain(context); - for (ClassBeanInfoImpl bi = beanInfo; bi != null; bi = bi.superClazz) { - for (int i = bi.properties.length - 1; i >= 0; i--) { - Property p = bi.properties[i]; - - switch(p.getKind()) { - case ATTRIBUTE: - if(attUnmarshallers==null) - attUnmarshallers = new QNameMap(); - AttributeProperty ap = (AttributeProperty) p; - attUnmarshallers.put(ap.attName.toQName(),ap.xacc); - break; - case ELEMENT: - case REFERENCE: - case MAP: - case VALUE: - p.buildChildElementUnmarshallers(chain,childUnmarshallers); - break; - } - } - } - - this.frameSize = chain.getScopeSize(); - - textHandler = childUnmarshallers.get(StructureLoaderBuilder.TEXT_HANDLER); - catchAll = childUnmarshallers.get(StructureLoaderBuilder.CATCH_ALL); - - if(attWildcard!=null) { - attCatchAll = (Accessor>) attWildcard; - // we use attUnmarshallers==null as a sign to skip the attribute processing - // altogether, so if we have an att wildcard we need to have an empty qname map. - if(attUnmarshallers==null) - attUnmarshallers = EMPTY; - } else { - attCatchAll = null; - } - } - - @Override - public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - UnmarshallingContext context = state.getContext(); - - // create the object to unmarshal - Object child; - assert !beanInfo.isImmutable(); - - // let's see if we can reuse the existing peer object - child = context.getInnerPeer(); - - if(child != null && beanInfo.jaxbType!=child.getClass()) - child = null; // unexpected type. - - if(child != null) - beanInfo.reset(child,context); - - if(child == null) - child = context.createInstance(beanInfo); - - context.recordInnerPeer(child); - - state.setTarget(child); - - fireBeforeUnmarshal(beanInfo, child, state); - - - context.startScope(frameSize); - - if(attUnmarshallers!=null) { - Attributes atts = ea.atts; - for (int i = 0; i < atts.getLength(); i ++){ - String auri = atts.getURI(i); - // may be empty string based on parser settings - String alocal = atts.getLocalName(i); - if ("".equals(alocal)) { - alocal = atts.getQName(i); - } - String avalue = atts.getValue(i); - TransducedAccessor xacc = attUnmarshallers.get(auri, alocal); - try { - if(xacc!=null) { - xacc.parse(child,avalue); - } else if (attCatchAll!=null) { - String qname = atts.getQName(i); - if(atts.getURI(i).equals(WellKnownNamespace.XML_SCHEMA_INSTANCE)) - continue; // xsi:* attributes are meant to be processed by us, not by user apps. - Object o = state.getTarget(); - Map map = attCatchAll.get(o); - if(map==null) { - // TODO: use ClassFactory.inferImplClass(sig,knownImplClasses) - - // if null, create a new map. - if(attCatchAll.valueType.isAssignableFrom(HashMap.class)) - map = new HashMap(); - else { - // we don't know how to create a map for this. - // report an error and back out - context.handleError(Messages.UNABLE_TO_CREATE_MAP.format(attCatchAll.valueType)); - return; - } - attCatchAll.set(o,map); - } - - String prefix; - int idx = qname.indexOf(':'); - if(idx<0) prefix=""; - else prefix=qname.substring(0,idx); - - map.put(new QName(auri,alocal,prefix),avalue); - } - } catch (AccessorException e) { - handleGenericException(e,true); - } - } - } - } - - @Override - public void childElement(UnmarshallingContext.State state, TagName arg) throws SAXException { - ChildLoader child = childUnmarshallers.get(arg.uri,arg.local); - if(child == null) { - Boolean backupWithParentNamespace = ((JAXBContextImpl) state.getContext().getJAXBContext()).backupWithParentNamespace; - backupWithParentNamespace = backupWithParentNamespace != null - ? backupWithParentNamespace - : Boolean.parseBoolean(Util.getSystemProperty(JAXBRIContext.BACKUP_WITH_PARENT_NAMESPACE)); - if ((beanInfo != null) && (beanInfo.getTypeNames() != null) && backupWithParentNamespace) { - Iterator typeNamesIt = beanInfo.getTypeNames().iterator(); - QName parentQName = null; - if ((typeNamesIt != null) && (typeNamesIt.hasNext()) && (catchAll == null)) { - parentQName = (QName) typeNamesIt.next(); - String parentUri = parentQName.getNamespaceURI(); - child = childUnmarshallers.get(parentUri, arg.local); - } - } - if (child == null) { - child = catchAll; - if(child==null) { - super.childElement(state,arg); - return; - } - } - } - - state.setLoader(child.loader); - state.setReceiver(child.receiver); - } - - @Override - public Collection getExpectedChildElements() { - return childUnmarshallers.keySet(); - } - - @Override - public Collection getExpectedAttributes() { - return attUnmarshallers.keySet(); - } - - @Override - public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { - if(textHandler!=null) - textHandler.loader.text(state,text); - } - - @Override - public void leaveElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - state.getContext().endScope(frameSize); - fireAfterUnmarshal(beanInfo, state.getTarget(), state.getPrev()); - } - - private static final QNameMap EMPTY = new QNameMap(); - - public JaxBeanInfo getBeanInfo() { - return beanInfo; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TagName.java 2018-01-30 20:35:27.000000000 -0500 +++ /dev/null 2018-01-30 20:35:27.000000000 -0500 @@ -1,134 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.runtime.Name; - -import org.xml.sax.Attributes; - -/** - * Represents an XML tag name (and attributes for start tags.) - * - *

- * This object is used so reduce the number of method call parameters - * among unmarshallers. - * - * An instance of this is expected to be reused by the caller of - * {@link XmlVisitor}. Note that the rest of the unmarshaller may - * modify any of the fields while processing an event (such as to - * intern strings, replace attributes), - * so {@link XmlVisitor} should reset all fields for each use. - * - *

- * The 'qname' parameter, which holds the qualified name of the tag - * (such as 'foo:bar' or 'zot'), is not used in the typical unmarshalling - * route and it's also expensive to compute for some input. - * Thus this parameter is computed lazily. - * - * @author Kohsuke Kawaguchi - */ -@SuppressWarnings({"StringEquality"}) -public abstract class TagName { - /** - * URI of the attribute/element name. - * - * Can be empty, but never null. Interned. - */ - public String uri; - /** - * Local part of the attribute/element name. - * - * Never be null. Interned. - */ - public String local; - - /** - * Used only for the enterElement event. - * Otherwise the value is undefined. - * - * This might be {@link AttributesEx}. - */ - public Attributes atts; - - public TagName() { - } - - /** - * Checks if the given name pair matches this name. - */ - public final boolean matches( String nsUri, String local ) { - return this.uri==nsUri && this.local==local; - } - - /** - * Checks if the given name pair matches this name. - */ - public final boolean matches( Name name ) { - return this.local==name.localName && this.uri==name.nsUri; - } - -// /** -// * @return -// * Can be empty but always non-null. NOT interned. -// */ -// public final String getPrefix() { -// int idx = qname.indexOf(':'); -// if(idx<0) return ""; -// else return qname.substring(0,idx); -// } - - public String toString() { - return '{'+uri+'}'+local; - } - - /** - * Gets the qualified name of the tag. - * - * @return never null. - */ - public abstract String getQname(); - - /** - * Gets the prefix. This is slow. - * - * @return can be "" but never null. - */ - public String getPrefix() { - String qname = getQname(); - int idx = qname.indexOf(':'); - if(idx<0) return ""; - else return qname.substring(0,idx); - } - - /** - * Creates {@link QName}. - */ - public QName createQName() { - return new QName(uri,local,getPrefix()); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/TextLoader.java 2018-01-30 20:35:27.000000000 -0500 +++ /dev/null 2018-01-30 20:35:27.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.runtime.Transducer; - -import org.xml.sax.SAXException; - -/** - * Unmarshals a text into an object. - * - *

- * If the caller can use {@link LeafPropertyLoader}, that's usually faster. - * - * @see LeafPropertyLoader - * @see ValuePropertyLoader - * @author Kohsuke Kawaguchi - */ -public class TextLoader extends Loader { - - private final Transducer xducer; - - public TextLoader(Transducer xducer) { - super(true); - this.xducer = xducer; - } - - public void text(UnmarshallingContext.State state, CharSequence text) throws SAXException { - try { - state.setTarget(xducer.parse(text)); - } catch (AccessorException e) { - handleGenericException(e,true); - } catch (RuntimeException e) { - handleParseConversionException(state,e); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallerImpl.java 2018-01-30 20:35:28.000000000 -0500 +++ /dev/null 2018-01-30 20:35:28.000000000 -0500 @@ -1,619 +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.bind.v2.runtime.unmarshaller; - -import java.io.IOException; -import java.io.InputStream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.JAXBException; -import javax.xml.bind.PropertyException; -import javax.xml.bind.UnmarshalException; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.UnmarshallerHandler; -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.attachment.AttachmentUnmarshaller; -import javax.xml.bind.helpers.AbstractUnmarshallerImpl; -import javax.xml.stream.XMLEventReader; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.events.XMLEvent; -import javax.xml.transform.Source; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; - -import com.sun.xml.internal.bind.IDResolver; -import com.sun.xml.internal.bind.api.ClassResolver; -import com.sun.xml.internal.bind.unmarshaller.DOMScanner; -import com.sun.xml.internal.bind.unmarshaller.InfosetScanner; -import com.sun.xml.internal.bind.unmarshaller.Messages; -import com.sun.xml.internal.bind.v2.ClassFactory; -import com.sun.xml.internal.bind.v2.runtime.AssociationMap; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.xml.internal.bind.v2.util.XmlFactory; - -import java.io.Closeable; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParserFactory; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Default Unmarshaller implementation. - * - *

- * This class can be extended by the generated code to provide - * type-safe unmarshall methods. - * - * @author - * Kohsuke KAWAGUCHI - */ - public final class UnmarshallerImpl extends AbstractUnmarshallerImpl implements ValidationEventHandler, Closeable -{ - /** Owning {@link JAXBContext} */ - protected final JAXBContextImpl context; - - /** - * schema which will be used to validate during calls to unmarshal - */ - private Schema schema; - - public final UnmarshallingContext coordinator; - - /** Unmarshaller.Listener */ - private Listener externalListener; - - /** - * The attachment unmarshaller used to support MTOM and swaRef. - */ - private AttachmentUnmarshaller attachmentUnmarshaller; - private IDResolver idResolver = new DefaultIDResolver(); - - public UnmarshallerImpl( JAXBContextImpl context, AssociationMap assoc ) { - this.context = context; - this.coordinator = new UnmarshallingContext( this, assoc ); - - try { - setEventHandler(this); - } catch (JAXBException e) { - throw new AssertionError(e); // impossible - } - } - - public UnmarshallerHandler getUnmarshallerHandler() { - return getUnmarshallerHandler(true,null); - } - - private XMLReader reader = null; - - /** - * Obtains a configured XMLReader. - * - * This method is used when the client-specified - * {@link SAXSource} object doesn't have XMLReader. - * - * {@link Unmarshaller} is not re-entrant, so we will - * only use one instance of XMLReader. - * - * Overriden in order to fix potential security issue. - */ - @Override - protected XMLReader getXMLReader() throws JAXBException { - if (reader == null) { - try { - SAXParserFactory parserFactory = XmlFactory.createParserFactory(context.disableSecurityProcessing); - // there is no point in asking a validation because - // there is no guarantee that the document will come with - // a proper schemaLocation. - parserFactory.setValidating(false); - reader = parserFactory.newSAXParser().getXMLReader(); - } catch (ParserConfigurationException e) { - throw new JAXBException(e); - } catch (SAXException e) { - throw new JAXBException(e); - } - } - return reader; - } - - private SAXConnector getUnmarshallerHandler( boolean intern, JaxBeanInfo expectedType ) { - XmlVisitor h = createUnmarshallerHandler(null, false, expectedType); - if (intern) { - h = new InterningXmlVisitor(h); - } - return new SAXConnector(h,null); - } - - /** - * Creates and configures a new unmarshalling pipe line. - * Depending on the setting, we put a validator as a filter. - * - * @return - * A component that implements both {@link UnmarshallerHandler} - * and {@link ValidationEventHandler}. All the parsing errors - * should be reported to this error handler for the unmarshalling - * process to work correctly. - * - * Also, returned handler expects all the XML names to be interned. - * - */ - public final XmlVisitor createUnmarshallerHandler(InfosetScanner scanner, boolean inplace, JaxBeanInfo expectedType ) { - - coordinator.reset(scanner,inplace,expectedType,idResolver); - XmlVisitor unmarshaller = coordinator; - - // delegate to JAXP 1.3 for validation if the client provided a schema - if (schema != null) { - unmarshaller = new ValidatingUnmarshaller(schema,unmarshaller); - } - - if(attachmentUnmarshaller!=null && attachmentUnmarshaller.isXOPPackage()) { - unmarshaller = new MTOMDecorator(this,unmarshaller,attachmentUnmarshaller); - } - - return unmarshaller; - } - - private static final DefaultHandler dummyHandler = new DefaultHandler(); - - public static boolean needsInterning( XMLReader reader ) { - // attempt to set it to true, which could fail - try { - reader.setFeature("http://xml.org/sax/features/string-interning",true); - } catch (SAXException e) { - // if it fails that's fine. we'll work around on our side - } - - try { - if (reader.getFeature("http://xml.org/sax/features/string-interning")) { - return false; // no need for intern - } - } catch (SAXException e) { - // unrecognized/unsupported - } - // otherwise we need intern - return true; - } - - protected Object unmarshal( XMLReader reader, InputSource source ) throws JAXBException { - return unmarshal0(reader,source,null); - } - - protected JAXBElement unmarshal( XMLReader reader, InputSource source, Class expectedType ) throws JAXBException { - if(expectedType==null) { - throw new IllegalArgumentException(); - } - return (JAXBElement)unmarshal0(reader,source,getBeanInfo(expectedType)); - } - - private Object unmarshal0( XMLReader reader, InputSource source, JaxBeanInfo expectedType ) throws JAXBException { - - SAXConnector connector = getUnmarshallerHandler(needsInterning(reader),expectedType); - - reader.setContentHandler(connector); - // saxErrorHandler will be set by the getUnmarshallerHandler method. - // configure XMLReader so that the error will be sent to it. - // This is essential for the UnmarshallerHandler to be able to abort - // unmarshalling when an error is found. - // - // Note that when this XMLReader is provided by the client code, - // it might be already configured to call a client error handler. - // This will clobber such handler, if any. - // - // Ryan noted that we might want to report errors to such a client - // error handler as well. - reader.setErrorHandler(coordinator); - - try { - reader.parse(source); - } catch( IOException e ) { - coordinator.clearStates(); - throw new UnmarshalException(e); - } catch( SAXException e ) { - coordinator.clearStates(); - throw createUnmarshalException(e); - } - - Object result = connector.getResult(); - - // avoid keeping unnecessary references too long to let the GC - // reclaim more memory. - // setting null upsets some parsers, so use a dummy instance instead. - reader.setContentHandler(dummyHandler); - reader.setErrorHandler(dummyHandler); - - return result; - } - - @Override - public JAXBElement unmarshal( Source source, Class expectedType ) throws JAXBException { - if (source instanceof SAXSource) { - SAXSource ss = (SAXSource) source; - - XMLReader locReader = ss.getXMLReader(); - if (locReader == null) { - locReader = getXMLReader(); - } - - return unmarshal(locReader, ss.getInputSource(), expectedType); - } - if (source instanceof StreamSource) { - return unmarshal(getXMLReader(), streamSourceToInputSource((StreamSource) source), expectedType); - } - if (source instanceof DOMSource) { - return unmarshal(((DOMSource) source).getNode(), expectedType); - } - - // we don't handle other types of Source - throw new IllegalArgumentException(); - } - - public Object unmarshal0( Source source, JaxBeanInfo expectedType ) throws JAXBException { - if (source instanceof SAXSource) { - SAXSource ss = (SAXSource) source; - - XMLReader locReader = ss.getXMLReader(); - if (locReader == null) { - locReader = getXMLReader(); - } - - return unmarshal0(locReader, ss.getInputSource(), expectedType); - } - if (source instanceof StreamSource) { - return unmarshal0(getXMLReader(), streamSourceToInputSource((StreamSource) source), expectedType); - } - if (source instanceof DOMSource) { - return unmarshal0(((DOMSource) source).getNode(), expectedType); - } - - // we don't handle other types of Source - throw new IllegalArgumentException(); - } - - - @Override - public final ValidationEventHandler getEventHandler() { - try { - return super.getEventHandler(); - } catch (JAXBException e) { - // impossible - throw new AssertionError(); - } - } - - /** - * Returns true if an event handler is installed. - *

- * The default handler ignores any errors, and for that this method returns false. - */ - public final boolean hasEventHandler() { - return getEventHandler()!=this; - } - - @Override - public JAXBElement unmarshal(Node node, Class expectedType) throws JAXBException { - if (expectedType == null) { - throw new IllegalArgumentException(); - } - return (JAXBElement)unmarshal0(node,getBeanInfo(expectedType)); - } - - public final Object unmarshal( Node node ) throws JAXBException { - return unmarshal0(node,null); - } - - // just to make the the test harness happy by making this method accessible - @Deprecated - public final Object unmarshal( SAXSource source ) throws JAXBException { - return super.unmarshal(source); - } - - public final Object unmarshal0( Node node, JaxBeanInfo expectedType ) throws JAXBException { - try { - final DOMScanner scanner = new DOMScanner(); - - InterningXmlVisitor handler = new InterningXmlVisitor(createUnmarshallerHandler(null,false,expectedType)); - scanner.setContentHandler(new SAXConnector(handler,scanner)); - - if(node.getNodeType() == Node.ELEMENT_NODE) { - scanner.scan((Element)node); - } else if(node.getNodeType() == Node.DOCUMENT_NODE) { - scanner.scan((Document)node); - } else { - throw new IllegalArgumentException("Unexpected node type: "+node); - } - - Object retVal = handler.getContext().getResult(); - handler.getContext().clearResult(); - return retVal; - } catch( SAXException e ) { - throw createUnmarshalException(e); - } - } - - @Override - public Object unmarshal(XMLStreamReader reader) throws JAXBException { - return unmarshal0(reader,null); - } - - @Override - public JAXBElement unmarshal(XMLStreamReader reader, Class expectedType) throws JAXBException { - if (expectedType==null) { - throw new IllegalArgumentException(); - } - return (JAXBElement)unmarshal0(reader,getBeanInfo(expectedType)); - } - - public Object unmarshal0(XMLStreamReader reader, JaxBeanInfo expectedType) throws JAXBException { - if (reader == null) { - throw new IllegalArgumentException( - Messages.format(Messages.NULL_READER)); - } - - int eventType = reader.getEventType(); - if (eventType != XMLStreamConstants.START_ELEMENT - && eventType != XMLStreamConstants.START_DOCUMENT) { - // TODO: convert eventType into event name - throw new IllegalStateException( - Messages.format(Messages.ILLEGAL_READER_STATE,eventType)); - } - - XmlVisitor h = createUnmarshallerHandler(null,false,expectedType); - StAXConnector connector=StAXStreamConnector.create(reader,h); - - try { - connector.bridge(); - } catch (XMLStreamException e) { - throw handleStreamException(e); - } - - Object retVal = h.getContext().getResult(); - h.getContext().clearResult(); - return retVal; - } - - @Override - public JAXBElement unmarshal(XMLEventReader reader, Class expectedType) throws JAXBException { - if(expectedType==null) { - throw new IllegalArgumentException(); - } - return (JAXBElement)unmarshal0(reader,getBeanInfo(expectedType)); - } - - @Override - public Object unmarshal(XMLEventReader reader) throws JAXBException { - return unmarshal0(reader,null); - } - - private Object unmarshal0(XMLEventReader reader,JaxBeanInfo expectedType) throws JAXBException { - if (reader == null) { - throw new IllegalArgumentException( - Messages.format(Messages.NULL_READER)); - } - - try { - XMLEvent event = reader.peek(); - - if (!event.isStartElement() && !event.isStartDocument()) { - // TODO: convert event into event name - throw new IllegalStateException( - Messages.format( - Messages.ILLEGAL_READER_STATE,event.getEventType())); - } - - // Quick hack until SJSXP fixes 6270116 - boolean isZephyr = reader.getClass().getName().equals("com.sun.xml.internal.stream.XMLReaderImpl"); - XmlVisitor h = createUnmarshallerHandler(null,false,expectedType); - if(!isZephyr) { - h = new InterningXmlVisitor(h); - } - new StAXEventConnector(reader,h).bridge(); - return h.getContext().getResult(); - } catch (XMLStreamException e) { - throw handleStreamException(e); - } - } - - public Object unmarshal0( InputStream input, JaxBeanInfo expectedType ) throws JAXBException { - return unmarshal0(getXMLReader(),new InputSource(input),expectedType); - } - - private static JAXBException handleStreamException(XMLStreamException e) { - // StAXStreamConnector wraps SAXException to XMLStreamException. - // XMLStreamException doesn't print its nested stack trace when it prints - // its stack trace, so if we wrap XMLStreamException in JAXBException, - // it becomes harder to find out the real problem. - // So we unwrap them here. But we don't want to unwrap too eagerly, because - // that could throw away some meaningful exception information. - Throwable ne = e.getNestedException(); - if(ne instanceof JAXBException) { - return (JAXBException)ne; - } - if(ne instanceof SAXException) { - return new UnmarshalException(ne); - } - return new UnmarshalException(e); - } - - @Override - public Object getProperty(String name) throws PropertyException { - if(name.equals(IDResolver.class.getName())) { - return idResolver; - } - return super.getProperty(name); - } - - @Override - public void setProperty(String name, Object value) throws PropertyException { - if(name.equals(FACTORY)) { - coordinator.setFactories(value); - return; - } - if(name.equals(IDResolver.class.getName())) { - idResolver = (IDResolver)value; - return; - } - if(name.equals(ClassResolver.class.getName())) { - coordinator.classResolver = (ClassResolver)value; - return; - } - if(name.equals(ClassLoader.class.getName())) { - coordinator.classLoader = (ClassLoader)value; - return; - } - super.setProperty(name, value); - } - - public static final String FACTORY = "com.sun.xml.internal.bind.ObjectFactory"; - - @Override - public void setSchema(Schema schema) { - this.schema = schema; - } - - @Override - public Schema getSchema() { - return schema; - } - - @Override - public AttachmentUnmarshaller getAttachmentUnmarshaller() { - return attachmentUnmarshaller; - } - - @Override - public void setAttachmentUnmarshaller(AttachmentUnmarshaller au) { - this.attachmentUnmarshaller = au; - } - - /** - * @deprecated since 2.0 - */ - @Override - public boolean isValidating() { - throw new UnsupportedOperationException(); - } - - /** - * @deprecated since 2.0 - */ - @Override - public void setValidating(boolean validating) { - throw new UnsupportedOperationException(); - } - - @Override - public void setAdapter(Class type, A adapter) { - if (type==null) { - throw new IllegalArgumentException(); - } - coordinator.putAdapter(type,adapter); - } - - @Override - public A getAdapter(Class type) { - if(type==null) { - throw new IllegalArgumentException(); - } - if(coordinator.containsAdapter(type)) { - return coordinator.getAdapter(type); - } else { - return null; - } - } - - // opening up for public use - @Override - public UnmarshalException createUnmarshalException( SAXException e ) { - return super.createUnmarshalException(e); - } - - - /** - * Default error handling behavior for {@link Unmarshaller}. - */ - public boolean handleEvent(ValidationEvent event) { - return event.getSeverity()!=ValidationEvent.FATAL_ERROR; - } - - private static InputSource streamSourceToInputSource( StreamSource ss ) { - InputSource is = new InputSource(); - is.setSystemId( ss.getSystemId() ); - is.setByteStream( ss.getInputStream() ); - is.setCharacterStream( ss.getReader() ); - - return is; - } - - public JaxBeanInfo getBeanInfo(Class clazz) throws JAXBException { - return context.getBeanInfo(clazz,true); - } - - @Override - public Listener getListener() { - return externalListener; - } - - @Override - public void setListener(Listener listener) { - externalListener = listener; - } - - public UnmarshallingContext getContext() { - return coordinator; - } - - @Override - @SuppressWarnings("FinalizeDeclaration") - protected void finalize() throws Throwable { - try { - ClassFactory.cleanCache(); - } finally { - super.finalize(); - } - } - - /** - * Must be called from same thread which created the UnmarshallerImpl instance. - * @throws IOException - */ - public void close() throws IOException { - ClassFactory.cleanCache(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/UnmarshallingContext.java 2018-01-30 20:35:29.000000000 -0500 +++ /dev/null 2018-01-30 20:35:29.000000000 -0500 @@ -1,1347 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.runtime.unmarshaller; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -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.concurrent.Callable; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.xml.XMLConstants; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.UnmarshalException; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.ValidationEventLocator; -import javax.xml.bind.helpers.ValidationEventImpl; -import javax.xml.namespace.NamespaceContext; -import javax.xml.namespace.QName; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; -import com.sun.istack.internal.SAXParseException2; -import com.sun.xml.internal.bind.IDResolver; -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.api.ClassResolver; -import com.sun.xml.internal.bind.unmarshaller.InfosetScanner; -import com.sun.xml.internal.bind.v2.ClassFactory; -import com.sun.xml.internal.bind.v2.runtime.AssociationMap; -import com.sun.xml.internal.bind.v2.runtime.Coordinator; -import com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import java.util.logging.Level; -import java.util.logging.Logger; - -import org.xml.sax.ErrorHandler; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.helpers.LocatorImpl; - -/** - * Center of the unmarshalling. - * - *

- * This object is responsible for coordinating {@link Loader}s to - * perform the whole unmarshalling. - * - * @author Kohsuke Kawaguchi - */ -public final class UnmarshallingContext extends Coordinator - implements NamespaceContext, ValidationEventHandler, ErrorHandler, XmlVisitor, XmlVisitor.TextPredictor { - - private static final Logger logger = Logger.getLogger(UnmarshallingContext.class.getName()); - - /** - * Root state. - */ - private final State root; - - /** - * The currently active state. - */ - private State current; - - private static final LocatorEx DUMMY_INSTANCE; - - static { - LocatorImpl loc = new LocatorImpl(); - loc.setPublicId(null); - loc.setSystemId(null); - loc.setLineNumber(-1); - loc.setColumnNumber(-1); - DUMMY_INSTANCE = new LocatorExWrapper(loc); - } - - private @NotNull LocatorEx locator = DUMMY_INSTANCE; - - /** Root object that is being unmarshalled. */ - private Object result; - - /** - * If non-null, this unmarshaller will unmarshal {@code JAXBElement} - * regardless of the tag name, as opposed to deciding the root object by using - * the tag name. - * - * The property has a package-level access, because we cannot copy this value - * to {@link UnmarshallingContext} when it is created. The property - * on {@link Unmarshaller} could be changed after the handler is created. - */ - private JaxBeanInfo expectedType; - - /** - * Handles ID/IDREF. - */ - private IDResolver idResolver; - - /** - * This flag is set to true at the startDocument event - * and false at the endDocument event. - * - * Until the first document is unmarshalled, we don't - * want to return an object. So this variable is initialized - * to true. - */ - private boolean isUnmarshalInProgress = true; - private boolean aborted = false; - - public final UnmarshallerImpl parent; - - /** - * If the unmarshaller is doing associative unmarshalling, - * this field is initialized to non-null. - */ - private final AssociationMap assoc; - - /** - * Indicates whether we are doing in-place unmarshalling - * or not. - * - *

- * This flag is unused when {@link #assoc}==null. - * If it's non-null, then {@code true} indicates - * that we are doing in-place associative unmarshalling. - * If {@code false}, then we are doing associative unmarshalling - * without object reuse. - */ - private boolean isInplaceMode; - - /** - * This object is consulted to get the element object for - * the current element event. - * - * This is used when we are building an association map. - */ - private InfosetScanner scanner; - - private Object currentElement; - - /** - * @see XmlVisitor#startDocument(LocatorEx, NamespaceContext) - */ - private NamespaceContext environmentNamespaceContext; - - /** - * Used to discover additional classes when we hit unknown elements/types. - */ - public @Nullable ClassResolver classResolver; - - /** - * User-supplied {@link ClassLoader} for converting name to {@link Class}. - * For backward compatibility, when null, use thread context classloader. - */ - public @Nullable ClassLoader classLoader; - - /** - * The variable introduced to avoid reporting n^10 similar errors. - * After error is reported counter is decremented. When it became 0 - errors should not be reported any more. - * - * volatile is required to ensure that concurrent threads will see changed value - */ - private static volatile int errorsCounter = 10; - - /** - * State information for each element. - */ - public final class State { - /** - * Loader that owns this element. - */ - private Loader loader; - /** - * Once {@link #loader} is completed, this receiver - * receives the result. - */ - private Receiver receiver; - - private Intercepter intercepter; - - /** - * Object being unmarshalled by this {@link #loader}. - */ - private Object target; - - /** - * Hack for making JAXBElement unmarshalling work. - * - *

- * While the unmarshalling is in progress, the {@link #target} field stores the object being unmarshalled. - * This makes it convenient to keep track of the unmarshalling activity in context of XML infoset, but - * since there's only one {@link State} per element, this mechanism only works when there's one object - * per element, which breaks down when we have {@link JAXBElement}, since the presence of JAXBElement - * requires that we have two objects unmarshalled (a JAXBElement X and a value object Y bound to an XML type.) - * - *

- * So to make room for storing both, this {@link #backup} field is used. When we create X instance - * in the above example, we set that to {@code state.prev.target} and displace its old value to - * {@code state.prev.backup} (where Y goes to {@code state.target}.) Upon the completion of the unmarshalling - * of Y, we revert this. - * - *

- * While this attributes X incorrectly to its parent element, this preserves the parent/child - * relationship between unmarshalled objects and {@link State} parent/child relationship, and - * it thereby makes {@link Receiver} mechanism simpler. - * - *

- * Yes, I know this is a hack, and no, I'm not proud of it. - * - * @see ElementBeanInfoImpl.IntercepterLoader#startElement(State, TagName) - * @see ElementBeanInfoImpl.IntercepterLoader#intercept(State, Object) - */ - private Object backup; - - /** - * Number of {@link UnmarshallingContext#nsBind}s declared thus far. - * (The value of {@link UnmarshallingContext#nsLen} when this state is pushed. - */ - private int numNsDecl; - - /** - * If this element has an element default value. - * - * This should be set by either a parent {@link Loader} when - * {@link Loader#childElement(State, TagName)} is called - * or by a child {@link Loader} when - * {@link Loader#startElement(State, TagName)} is called. - */ - private String elementDefaultValue; - - /** - * {@link State} for the parent element - * - * {@link State} objects form a doubly linked list. - */ - private State prev; - private State next; - - private boolean nil = false; - - /** - * specifies that we are working with mixed content - */ - private boolean mixed = false; - - /** - * Gets the context. - */ - public UnmarshallingContext getContext() { - return UnmarshallingContext.this; - } - - @SuppressWarnings("LeakingThisInConstructor") - private State(State prev) { - this.prev = prev; - if (prev!=null) { - prev.next = this; - if (prev.mixed) // parent is in mixed mode - this.mixed = true; - } - } - - private void push() { - if (logger.isLoggable(Level.FINEST)) { - logger.log(Level.FINEST, "State.push"); - } - if (next==null) { - assert current == this; - next = new State(this); - } - nil = false; - State n = next; - n.numNsDecl = nsLen; - current = n; - } - - private void pop() { - if (logger.isLoggable(Level.FINEST)) { - logger.log(Level.FINEST, "State.pop"); - } - assert prev!=null; - loader = null; - nil = false; - mixed = false; - receiver = null; - intercepter = null; - elementDefaultValue = null; - target = null; - current = prev; - next = null; - } - - public boolean isMixed() { - return mixed; - } - - public Object getTarget() { - return target; - } - - public void setLoader(Loader loader) { - if (loader instanceof StructureLoader) // set mixed mode - mixed = !((StructureLoader)loader).getBeanInfo().hasElementOnlyContentModel(); - this.loader = loader; - } - - public void setReceiver(Receiver receiver) { - this.receiver = receiver; - } - - public State getPrev() { - return prev; - } - - public void setIntercepter(Intercepter intercepter) { - this.intercepter = intercepter; - } - - public void setBackup(Object backup) { - this.backup = backup; - } - - public void setTarget(Object target) { - this.target = target; - } - - public Object getBackup() { - return backup; - } - - public boolean isNil() { - return nil; - } - - public void setNil(boolean nil) { - this.nil = nil; - } - - public Loader getLoader() { - return loader; - } - - public String getElementDefaultValue() { - return elementDefaultValue; - } - - public void setElementDefaultValue(String elementDefaultValue) { - this.elementDefaultValue = elementDefaultValue; - } - } - - /** - * Stub to the user-specified factory method. - */ - private static class Factory { - private final Object factorInstance; - private final Method method; - - public Factory(Object factorInstance, Method method) { - this.factorInstance = factorInstance; - this.method = method; - } - - public Object createInstance() throws SAXException { - try { - return method.invoke(factorInstance); - } catch (IllegalAccessException e) { - getInstance().handleError(e,false); - } catch (InvocationTargetException e) { - getInstance().handleError(e,false); - } - return null; // can never be executed - } - } - - - /** - * Creates a new unmarshaller. - * - * @param assoc - * Must be both non-null when the unmarshaller does the - * in-place unmarshalling. Otherwise must be both null. - */ - public UnmarshallingContext( UnmarshallerImpl _parent, AssociationMap assoc) { - this.parent = _parent; - this.assoc = assoc; - this.root = this.current = new State(null); - } - - public void reset(InfosetScanner scanner,boolean isInplaceMode, JaxBeanInfo expectedType, IDResolver idResolver) { - this.scanner = scanner; - this.isInplaceMode = isInplaceMode; - this.expectedType = expectedType; - this.idResolver = idResolver; - } - - public JAXBContextImpl getJAXBContext() { - return parent.context; - } - - public State getCurrentState() { - return current; - } - - /** - * On top of {@link JAXBContextImpl#selectRootLoader(State, TagName)}, - * this method also consults {@link ClassResolver}. - * - * @throws SAXException - * if {@link ValidationEventHandler} reported a failure. - */ - public Loader selectRootLoader(State state, TagName tag) throws SAXException { - try { - Loader l = getJAXBContext().selectRootLoader(state, tag); - if(l!=null) return l; - - if(classResolver!=null) { - Class clazz = classResolver.resolveElementName(tag.uri, tag.local); - if(clazz!=null) { - JAXBContextImpl enhanced = getJAXBContext().createAugmented(clazz); - JaxBeanInfo bi = enhanced.getBeanInfo(clazz); - return bi.getLoader(enhanced,true); - } - } - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - handleError(e); - } - - return null; - } - - public void clearStates() { - State last = current; - while (last.next != null) last = last.next; - while (last.prev != null) { - last.loader = null; - last.nil = false; - last.receiver = null; - last.intercepter = null; - last.elementDefaultValue = null; - last.target = null; - last = last.prev; - last.next.prev = null; - last.next = null; - } - current = last; - } - - /** - * User-specified factory methods. - */ - private final Map factories = new HashMap(); - - public void setFactories(Object factoryInstances) { - factories.clear(); - if(factoryInstances==null) { - return; - } - if(factoryInstances instanceof Object[]) { - for( Object factory : (Object[])factoryInstances ) { - // look for all the public methods inlcuding derived ones - addFactory(factory); - } - } else { - addFactory(factoryInstances); - } - } - - private void addFactory(Object factory) { - for( Method m : factory.getClass().getMethods() ) { - // look for methods whose signature is T createXXX() - if(!m.getName().startsWith("create")) - continue; - if(m.getParameterTypes().length>0) - continue; - - Class type = m.getReturnType(); - - factories.put(type,new Factory(factory,m)); - } - } - - @Override - public void startDocument(LocatorEx locator, NamespaceContext nsContext) throws SAXException { - if(locator!=null) - this.locator = locator; - this.environmentNamespaceContext = nsContext; - // reset the object - result = null; - current = root; - - patchersLen=0; - aborted = false; - isUnmarshalInProgress = true; - nsLen=0; - - if(expectedType!=null) - root.loader = EXPECTED_TYPE_ROOT_LOADER; - else - root.loader = DEFAULT_ROOT_LOADER; - - idResolver.startDocument(this); - } - - @Override - public void startElement(TagName tagName) throws SAXException { - pushCoordinator(); - try { - _startElement(tagName); - } finally { - popCoordinator(); - } - } - - private void _startElement(TagName tagName) throws SAXException { - // remember the current element if we are interested in it. - // because the inner peer might not be found while we consume - // the enter element token, we need to keep this information - // longer than this callback. That's why we assign it to a field. - if( assoc!=null ) - currentElement = scanner.getCurrentElement(); - - Loader h = current.loader; - current.push(); - - // tell the parent about the new child - h.childElement(current,tagName); - assert current.loader!=null; // the childElement should register this - // and tell the new child that you are activated - current.loader.startElement(current,tagName); - } - - @Override - public void text(CharSequence pcdata) throws SAXException { - pushCoordinator(); - try { - if (current.elementDefaultValue != null) { - if (pcdata.length() == 0) { - // send the default value into the unmarshaller instead - pcdata = current.elementDefaultValue; - } - } - current.loader.text(current, pcdata); - } finally { - popCoordinator(); - } - } - - @Override - public final void endElement(TagName tagName) throws SAXException { - pushCoordinator(); - try { - State child = current; - - // tell the child that your time is up - child.loader.leaveElement(child,tagName); - - // child.pop will erase them so store them now - Object target = child.target; - Receiver recv = child.receiver; - Intercepter intercepter = child.intercepter; - child.pop(); - - // then let the parent know - if(intercepter!=null) - target = intercepter.intercept(current,target); - if(recv!=null) - recv.receive(current,target); - } finally { - popCoordinator(); - } - } - - @Override - public void endDocument() throws SAXException { - runPatchers(); - idResolver.endDocument(); - - isUnmarshalInProgress = false; - currentElement = null; - locator = DUMMY_INSTANCE; - environmentNamespaceContext = null; - - // at the successful completion, scope must be all closed - assert root==current; - } - - /** - * You should be always calling this through {@link TextPredictor}. - */ - @Deprecated - @Override - public boolean expectText() { - return current.loader.expectText; - } - - /** - * You should be always getting {@link TextPredictor} from {@link XmlVisitor}. - */ - @Deprecated - @Override - public TextPredictor getPredictor() { - return this; - } - - @Override - public UnmarshallingContext getContext() { - return this; - } - - /** - * Gets the result of the unmarshalling - */ - public Object getResult() throws UnmarshalException { - if(isUnmarshalInProgress) - throw new IllegalStateException(); - - if(!aborted) return result; - - // there was an error. - throw new UnmarshalException((String)null); - } - - void clearResult() { - if (isUnmarshalInProgress) { - throw new IllegalStateException(); - } - result = null; - } - - /** - * Creates a new instance of the specified class. - * In the unmarshaller, we need to check the user-specified factory class. - */ - public Object createInstance( Class clazz ) throws SAXException { - if(!factories.isEmpty()) { - Factory factory = factories.get(clazz); - if(factory!=null) - return factory.createInstance(); - } - return ClassFactory.create(clazz); - } - - /** - * Creates a new instance of the specified class. - * In the unmarshaller, we need to check the user-specified factory class. - */ - public Object createInstance( JaxBeanInfo beanInfo ) throws SAXException { - if(!factories.isEmpty()) { - Factory factory = factories.get(beanInfo.jaxbType); - if(factory!=null) - return factory.createInstance(); - } - try { - return beanInfo.createInstance(this); - } catch (IllegalAccessException e) { - Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); - } catch (InvocationTargetException e) { - Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); - } catch (InstantiationException e) { - Loader.reportError("Unable to create an instance of "+beanInfo.jaxbType.getName(),e,false); - } - return null; // can never be here - } - - - -// -// -// error handling -// -// - - /** - * Reports an error to the user, and asks if s/he wants - * to recover. If the canRecover flag is false, regardless - * of the client instruction, an exception will be thrown. - * - * Only if the flag is true and the user wants to recover from an error, - * the method returns normally. - * - * The thrown exception will be catched by the unmarshaller. - */ - public void handleEvent(ValidationEvent event, boolean canRecover ) throws SAXException { - ValidationEventHandler eventHandler = parent.getEventHandler(); - - boolean recover = eventHandler.handleEvent(event); - - // if the handler says "abort", we will not return the object - // from the unmarshaller.getResult() - if(!recover) aborted = true; - - if( !canRecover || !recover ) - throw new SAXParseException2( event.getMessage(), locator, - new UnmarshalException( - event.getMessage(), - event.getLinkedException() ) ); - } - - @Override - public boolean handleEvent(ValidationEvent event) { - try { - // if the handler says "abort", we will not return the object. - boolean recover = parent.getEventHandler().handleEvent(event); - if(!recover) aborted = true; - return recover; - } catch( RuntimeException re ) { - // if client event handler causes a runtime exception, then we - // have to return false. - return false; - } - } - - /** - * Reports an exception found during the unmarshalling to the user. - * This method is a convenience method that calls into - * {@link #handleEvent(ValidationEvent, boolean)} - */ - public void handleError(Exception e) throws SAXException { - handleError(e,true); - } - - public void handleError(Exception e,boolean canRecover) throws SAXException { - handleEvent(new ValidationEventImpl(ValidationEvent.ERROR,e.getMessage(),locator.getLocation(),e),canRecover); - } - - public void handleError(String msg) { - handleEvent(new ValidationEventImpl(ValidationEvent.ERROR,msg,locator.getLocation())); - } - - @Override - protected ValidationEventLocator getLocation() { - return locator.getLocation(); - } - - /** - * Gets the current source location information in SAX {@link Locator}. - *

- * Sometimes the unmarshaller works against a different kind of XML source, - * making this information meaningless. - */ - public LocatorEx getLocator() { return locator; } - - /** - * Called when there's no corresponding ID value. - */ - public void errorUnresolvedIDREF(Object bean, String idref, LocatorEx loc) throws SAXException { - handleEvent( new ValidationEventImpl( - ValidationEvent.ERROR, - Messages.UNRESOLVED_IDREF.format(idref), - loc.getLocation()), true ); - } - - -// -// -// ID/IDREF related code -// -// - /** - * Submitted patchers in the order they've submitted. - * Many XML vocabulary doesn't use ID/IDREF at all, so we - * initialize it with null. - */ - private Patcher[] patchers = null; - private int patchersLen = 0; - - /** - * Adds a job that will be executed at the last of the unmarshalling. - * This method is used to support ID/IDREF feature, but it can be used - * for other purposes as well. - * - * @param job - * The run method of this object is called. - */ - public void addPatcher( Patcher job ) { - // re-allocate buffer if necessary - if( patchers==null ) - patchers = new Patcher[32]; - if( patchers.length == patchersLen ) { - Patcher[] buf = new Patcher[patchersLen*2]; - System.arraycopy(patchers,0,buf,0,patchersLen); - patchers = buf; - } - patchers[patchersLen++] = job; - } - - /** Executes all the patchers. */ - private void runPatchers() throws SAXException { - if( patchers!=null ) { - for( int i=0; i - * The exception thrown from {@link Callable#call()} means the unmarshaller should abort - * right away. - * - * @see IDResolver#resolve(String, Class) - */ - public Callable getObjectFromId( String id, Class targetType ) throws SAXException { - return idResolver.resolve(id,targetType); - } - -// -// -// namespace binding maintainance -// -// - private String[] nsBind = new String[16]; - private int nsLen=0; - - @Override - public void startPrefixMapping( String prefix, String uri ) { - if(nsBind.length==nsLen) { - // expand the buffer - String[] n = new String[nsLen*2]; - System.arraycopy(nsBind,0,n,0,nsLen); - nsBind=n; - } - nsBind[nsLen++] = prefix; - nsBind[nsLen++] = uri; - } - @Override - public void endPrefixMapping( String prefix ) { - nsLen-=2; - } - private String resolveNamespacePrefix( String prefix ) { - if(prefix.equals("xml")) - return XMLConstants.XML_NS_URI; - - for( int i=nsLen-2; i>=0; i-=2 ) { - if(prefix.equals(nsBind[i])) - return nsBind[i+1]; - } - - if(environmentNamespaceContext!=null) - // temporary workaround until Zephyr fixes 6337180 - return environmentNamespaceContext.getNamespaceURI(prefix.intern()); - - // by default, the default ns is bound to "". - // but allow environmentNamespaceContext to take precedence - if(prefix.equals("")) - return ""; - - // unresolved. error. - return null; - } - - /** - * Returns a list of prefixes newly declared on the current element. - * - * @return - * A possible zero-length array of prefixes. The default prefix - * is represented by the empty string. - */ - public String[] getNewlyDeclaredPrefixes() { - return getPrefixList( current.prev.numNsDecl ); - } - - /** - * Returns a list of all in-scope prefixes. - * - * @return - * A possible zero-length array of prefixes. The default prefix - * is represented by the empty string. - */ - public String[] getAllDeclaredPrefixes() { - return getPrefixList(0); - } - - private String[] getPrefixList( int startIndex ) { - int size = (current.numNsDecl - startIndex)/2; - String[] r = new String[size]; - for( int i=0; i getPrefixes(String uri) { - // TODO: could be implemented much faster - // wrap it into unmodifiable list so that the remove method - // will throw UnsupportedOperationException. - return Collections.unmodifiableList( - getAllPrefixesInList(uri)).iterator(); - } - - private List getAllPrefixesInList(String uri) { - List a = new ArrayList(); - - if( uri==null ) - throw new IllegalArgumentException(); - if( uri.equals(XMLConstants.XML_NS_URI) ) { - a.add(XMLConstants.XML_NS_PREFIX); - return a; - } - if( uri.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI) ) { - a.add(XMLConstants.XMLNS_ATTRIBUTE); - return a; - } - - for( int i=nsLen-2; i>=0; i-=2 ) - if(uri.equals(nsBind[i+1])) - if( getNamespaceURI(nsBind[i]).equals(nsBind[i+1]) ) - // make sure that this prefix is still effective. - a.add(nsBind[i]); - - return a; - } - - @Override - public String getPrefix(String uri) { - if( uri==null ) - throw new IllegalArgumentException(); - if( uri.equals(XMLConstants.XML_NS_URI) ) - return XMLConstants.XML_NS_PREFIX; - if( uri.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI) ) - return XMLConstants.XMLNS_ATTRIBUTE; - - for( int i=nsLen-2; i>=0; i-=2 ) - if(uri.equals(nsBind[i+1])) - if( getNamespaceURI(nsBind[i]).equals(nsBind[i+1]) ) - // make sure that this prefix is still effective. - return nsBind[i]; - - if(environmentNamespaceContext!=null) - return environmentNamespaceContext.getPrefix(uri); - - return null; - } - - @Override - public String getNamespaceURI(String prefix) { - if (prefix == null) - throw new IllegalArgumentException(); - if (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE)) - return XMLConstants.XMLNS_ATTRIBUTE_NS_URI; - - return resolveNamespacePrefix(prefix); - } - -// -// -// -// scope management -// -// -// - private Scope[] scopes = new Scope[16]; - /** - * Points to the top of the scope stack (=size-1). - */ - private int scopeTop=0; - - { - for( int i=0; i - * This method allocates a specified number of fresh {@link Scope} objects. - * They can be accessed by the {@link #getScope} method until the corresponding - * {@link #endScope} method is invoked. - * - *

- * A new scope will mask the currently active scope. Only one frame of {@link Scope}s - * can be accessed at any given time. - * - * @param frameSize - * The # of slots to be allocated. - */ - public void startScope(int frameSize) { - scopeTop += frameSize; - - // reallocation - if(scopeTop>=scopes.length) { - Scope[] s = new Scope[Math.max(scopeTop+1,scopes.length*2)]; - System.arraycopy(scopes,0,s,0,scopes.length); - for( int i=scopes.length; i - * If any packing in progress will be finalized by this method. - * - * @param frameSize - * The same size that gets passed to the {@link #startScope(int)} - * method. - */ - public void endScope(int frameSize) throws SAXException { - try { - for( ; frameSize>0; frameSize--, scopeTop-- ) - scopes[scopeTop].finish(); - } catch (AccessorException e) { - handleError(e); - - // the error might have left scopes in inconsistent state, - // so replace them by fresh ones - for( ; frameSize>0; frameSize-- ) - scopes[scopeTop--] = new Scope(this); - } - } - - /** - * Gets the currently active {@link Scope}. - * - * @param offset - * a number between [0,frameSize) - * - * @return - * always a valid {@link Scope} object. - */ - public Scope getScope(int offset) { - return scopes[scopeTop-offset]; - } - -// -// -// -// -// -// -// - - private static final Loader DEFAULT_ROOT_LOADER = new DefaultRootLoader(); - private static final Loader EXPECTED_TYPE_ROOT_LOADER = new ExpectedTypeRootLoader(); - - /** - * Root loader that uses the tag name and possibly its @xsi:type - * to decide how to start unmarshalling. - */ - private static final class DefaultRootLoader extends Loader implements Receiver { - /** - * Receives the root element and determines how to start - * unmarshalling. - */ - @Override - public void childElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - Loader loader = state.getContext().selectRootLoader(state,ea); - if(loader!=null) { - state.loader = loader; - state.receiver = this; - return; - } - - // the registry doesn't know about this element. - // try its xsi:type - JaxBeanInfo beanInfo = XsiTypeLoader.parseXsiType(state, ea, null); - if(beanInfo==null) { - // we don't even know its xsi:type - reportUnexpectedChildElement(ea,false); - return; - } - - state.loader = beanInfo.getLoader(null,false); - state.prev.backup = new JAXBElement(ea.createQName(),Object.class,null); - state.receiver = this; - } - - @Override - public Collection getExpectedChildElements() { - return getInstance().getJAXBContext().getValidRootNames(); - } - - @Override - public void receive(State state, Object o) { - if(state.backup!=null) { - ((JAXBElement)state.backup).setValue(o); - o = state.backup; - } - if (state.nil) { - ((JAXBElement)o).setNil(true); - } - state.getContext().result = o; - } - } - - /** - * Root loader that uses {@link UnmarshallingContext#expectedType} - * to decide how to start unmarshalling. - */ - private static final class ExpectedTypeRootLoader extends Loader implements Receiver { - /** - * Receives the root element and determines how to start - * unmarshalling. - */ - @Override - public void childElement(UnmarshallingContext.State state, TagName ea) { - UnmarshallingContext context = state.getContext(); - - // unmarshals the specified type - QName qn = new QName(ea.uri,ea.local); - state.prev.target = new JAXBElement(qn,context.expectedType.jaxbType,null,null); - state.receiver = this; - // this is bit wasteful, as in theory we should have each expectedType keep - // nillable version --- but that increases the combination from two to four, - // which adds the resident memory footprint. Since XsiNilLoader is small, - // I intentionally allocate a new instance freshly. - state.loader = new XsiNilLoader(context.expectedType.getLoader(null,true)); - } - - @Override - public void receive(State state, Object o) { - JAXBElement e = (JAXBElement)state.target; - e.setValue(o); - state.getContext().recordOuterPeer(e); - state.getContext().result = e; - } - } - -// -// in-place unmarshalling related capabilities -// - /** - * Notifies the context about the inner peer of the current element. - * - *

- * If the unmarshalling is building the association, the context - * will use this information. Otherwise it will be just ignored. - */ - public void recordInnerPeer(Object innerPeer) { - if(assoc!=null) - assoc.addInner(currentElement,innerPeer); - } - - /** - * Gets the inner peer JAXB object associated with the current element. - * - * @return - * null if the current element doesn't have an inner peer, - * or if we are not doing the in-place unmarshalling. - */ - public Object getInnerPeer() { - if(assoc!=null && isInplaceMode) - return assoc.getInnerPeer(currentElement); - else - return null; - } - - /** - * Notifies the context about the outer peer of the current element. - * - *

- * If the unmarshalling is building the association, the context - * will use this information. Otherwise it will be just ignored. - */ - public void recordOuterPeer(Object outerPeer) { - if(assoc!=null) - assoc.addOuter(currentElement,outerPeer); - } - - /** - * Gets the outer peer JAXB object associated with the current element. - * - * @return - * null if the current element doesn't have an inner peer, - * or if we are not doing the in-place unmarshalling. - */ - public Object getOuterPeer() { - if(assoc!=null && isInplaceMode) - return assoc.getOuterPeer(currentElement); - else - return null; - } - - /** - * Gets the xmime:contentType value for the current object. - * - * @see JAXBContextImpl#getXMIMEContentType(Object) - */ - public String getXMIMEContentType() { - /* - this won't work when the class is like - - class Foo { - @XmlValue Image img; - } - - because the target will return Foo, not the class enclosing Foo - which will have xmime:contentType - */ - Object t = current.target; - if(t==null) return null; - return getJAXBContext().getXMIMEContentType(t); - } - - /** - * When called from within the realm of the unmarshaller, this method - * returns the current {@link UnmarshallingContext} in charge. - */ - public static UnmarshallingContext getInstance() { - return (UnmarshallingContext) Coordinator._getInstance(); - } - - /** - * Allows to access elements which are expected in current state. - * Useful for getting elements for current parent. - * - * @return - */ - public Collection getCurrentExpectedElements() { - pushCoordinator(); - try { - State s = getCurrentState(); - Loader l = s.loader; - return (l != null) ? l.getExpectedChildElements() : null; - } finally { - popCoordinator(); - } - } - - /** - * Allows to access attributes which are expected in current state. - * Useful for getting attributes for current parent. - * - * @return - */ - public Collection getCurrentExpectedAttributes() { - pushCoordinator(); - try { - State s = getCurrentState(); - Loader l = s.loader; - return (l != null) ? l.getExpectedAttributes() : null; - } finally { - popCoordinator(); - } - } - - /** - * Gets StructureLoader if used as loader. - * Useful when determining if element is mixed or not. - * - */ - public StructureLoader getStructureLoader() { - if(current.loader instanceof StructureLoader) - return (StructureLoader)current.loader; - - return null; - } - - /** - * Based on current {@link Logger} {@link Level} and errorCounter value determines if error should be reported. - * - * If the method called and return true it is expected that error will be reported. And that's why - * errorCounter is automatically decremented during the check. - * - * NOT THREAD SAFE!!! In case of heave concurrency access several additional errors could be reported. It's not expected to be the - * problem. Otherwise add synchronization here. - * - * @return true in case if {@link Level#FINEST} is set OR we haven't exceed errors reporting limit. - */ - public boolean shouldErrorBeReported() throws SAXException { - if (logger.isLoggable(Level.FINEST)) - return true; - - if (errorsCounter >= 0) { - --errorsCounter; - if (errorsCounter == 0) // it's possible to miss this because of concurrency. If required add synchronization here - handleEvent(new ValidationEventImpl(ValidationEvent.WARNING, Messages.ERRORS_LIMIT_EXCEEDED.format(), - getLocator().getLocation(), null), true); - } - return errorsCounter >= 0; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/ValidatingUnmarshaller.java 2018-01-30 20:35:29.000000000 -0500 +++ /dev/null 2018-01-30 20:35:30.000000000 -0500 @@ -1,134 +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.xml.internal.bind.v2.runtime.unmarshaller; - -import javax.xml.namespace.NamespaceContext; -import javax.xml.validation.Schema; -import javax.xml.validation.ValidatorHandler; - -import com.sun.xml.internal.bind.v2.util.FatalAdapter; - -import org.xml.sax.SAXException; - -/** - * {@link XmlVisitor} decorator that validates the events by using JAXP validation API. - * - * @author Kohsuke Kawaguchi - */ -final class ValidatingUnmarshaller implements XmlVisitor, XmlVisitor.TextPredictor { - - private final XmlVisitor next; - private final ValidatorHandler validator; - private NamespaceContext nsContext = null; - - /** - * {@link TextPredictor} of the next {@link XmlVisitor}. - */ - private final TextPredictor predictor; - - private char[] buf = new char[256]; - - /** - * Creates a new instance of ValidatingUnmarshaller. - */ - public ValidatingUnmarshaller( Schema schema, XmlVisitor next ) { - this.validator = schema.newValidatorHandler(); - this.next = next; - this.predictor = next.getPredictor(); - // if the user bothers to use a validator, make validation errors fatal - // so that it will abort unmarshalling. - validator.setErrorHandler(new FatalAdapter(getContext())); - } - - public void startDocument(LocatorEx locator, NamespaceContext nsContext) throws SAXException { - this.nsContext = nsContext; - validator.setDocumentLocator(locator); - validator.startDocument(); - next.startDocument(locator,nsContext); - } - - public void endDocument() throws SAXException { - this.nsContext = null; - validator.endDocument(); - next.endDocument(); - } - - public void startElement(TagName tagName) throws SAXException { - if(nsContext != null) { - String tagNamePrefix = tagName.getPrefix().intern(); - if(tagNamePrefix != "") { - validator.startPrefixMapping(tagNamePrefix, nsContext.getNamespaceURI(tagNamePrefix)); - } - } - validator.startElement(tagName.uri,tagName.local,tagName.getQname(),tagName.atts); - next.startElement(tagName); - } - - public void endElement(TagName tagName ) throws SAXException { - validator.endElement(tagName.uri,tagName.local,tagName.getQname()); - next.endElement(tagName); - } - - public void startPrefixMapping(String prefix, String nsUri) throws SAXException { - validator.startPrefixMapping(prefix,nsUri); - next.startPrefixMapping(prefix,nsUri); - } - - public void endPrefixMapping(String prefix) throws SAXException { - validator.endPrefixMapping(prefix); - next.endPrefixMapping(prefix); - } - - public void text( CharSequence pcdata ) throws SAXException { - int len = pcdata.length(); - if(buf.length - * Note that the SAXException returned by the ContentHandler is - * unreported. So we have to catch them and report it, then rethrow - * it if necessary. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class WildcardLoader extends ProxyLoader { - - private final DomLoader dom; - - private final WildcardMode mode; - - public WildcardLoader(DomHandler dom, WildcardMode mode) { - this.dom = new DomLoader(dom); - this.mode = mode; - } - - protected Loader selectLoader(UnmarshallingContext.State state, TagName tag) throws SAXException { - UnmarshallingContext context = state.getContext(); - - if(mode.allowTypedObject) { - Loader l = context.selectRootLoader(state,tag); - if(l!=null) - return l; - } - if(mode.allowDom) - return dom; - - // simply discard. - return Discarder.INSTANCE; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XmlVisitor.java 2018-01-30 20:35:32.000000000 -0500 +++ /dev/null 2018-01-30 20:35:32.000000000 -0500 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.runtime.unmarshaller; - -import javax.xml.namespace.NamespaceContext; - -import org.xml.sax.SAXException; - -/** - * Walks the XML document structure. - * - * Implemented by the unmarshaller and called by the API-specific connectors. - * - *

Event Call Sequence

- * - * The {@link XmlVisitor} expects the event callbacks in the following order: - *
- * CALL SEQUENCE := startDocument ELEMENT endDocument
- * ELEMENT       := startPrefixMapping ELEMENT endPrefixMapping
- *               |  startElement BODY endElement
- * BODY          := text? (ELEMENT text?)*
- * 
- * Note in particular that text events may not be called in a row; - * consecutive characters (even those separated by PIs and comments) - * must be reported as one event, unlike SAX. - * - *

- * All namespace URIs, local names, and prefixes of element and attribute - * names must be interned. qnames need not be interned. - * - * - *

Typed PCDATA

- * For efficiency, JAXB RI defines a few {@link CharSequence} implementations - * that can be used as a parameter to the {@link #text(CharSequence)} method. - * For example, see {@link Base64Data}. - * - *

Error Handling

- * The visitor may throw {@link SAXException} to abort the unmarshalling process - * in the middle. - * - * @author Kohsuke Kawaguchi - */ -public interface XmlVisitor { - /** - * Notifies a start of the document. - * - * @param locator - * This live object returns the location information as the parsing progresses. - * must not be null. - * @param nsContext - * Some broken XML APIs can't iterate all the in-scope namespace bindings, - * which makes it impossible to emulate {@link #startPrefixMapping(String, String)} correctly - * when unmarshalling a subtree. Connectors that use such an API can - * pass in additional {@link NamespaceContext} object that knows about the - * in-scope namespace bindings. Otherwise (and normally) it is null. - * - *

- * Ideally this object should be immutable and only represent the namespace URI bindings - * in the context (those done above the element that JAXB started unmarshalling), - * but it can also work even if it changes as the parsing progress (to include - * namespaces declared on the current element being parsed.) - */ - void startDocument(LocatorEx locator, NamespaceContext nsContext) throws SAXException; - void endDocument() throws SAXException; - - /** - * Notifies a start tag of a new element. - * - * namespace URIs and local names must be interned. - */ - void startElement(TagName tagName) throws SAXException; - void endElement(TagName tagName) throws SAXException; - - /** - * Called before {@link #startElement} event to notify a new namespace binding. - */ - void startPrefixMapping( String prefix, String nsUri ) throws SAXException; - /** - * Called after {@link #endElement} event to notify the end of a binding. - */ - void endPrefixMapping( String prefix ) throws SAXException; - - /** - * Text events. - * - *

- * The caller should consult {@link TextPredictor} to see - * if the unmarshaller is expecting any PCDATA. If the above is returning - * false, the caller is OK to skip any text in XML. The net effect is - * that we can ignore whitespaces quickly. - * - * @param pcdata - * represents character data. This object can be mutable - * (such as {@link StringBuilder}); it only needs to be fixed - * while this method is executing. - */ - void text( CharSequence pcdata ) throws SAXException; - - /** - * Returns the {@link UnmarshallingContext} at the end of the chain. - * - * @return - * always return the same object, so caching the result is recommended. - */ - UnmarshallingContext getContext(); - - /** - * Gets the predictor that can be used for the caller to avoid - * calling {@link #text(CharSequence)} unnecessarily. - */ - TextPredictor getPredictor(); - - interface TextPredictor { - /** - * Returns true if the visitor is expecting a text event as the next event. - * - *

- * This is primarily intended to be used for optimization to avoid buffering - * characters unnecessarily. If this method returns false and the connector - * sees whitespace it can safely skip it. - * - *

- * If this method returns true, all the whitespaces are considered significant - * and thus need to be reported as a {@link XmlVisitor#text} event. Furthermore, - * if the element has no children (like {@code }), then it has to be reported - * an empty {@link XmlVisitor#text} event. - */ - boolean expectText(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiNilLoader.java 2018-01-30 20:35:32.000000000 -0500 +++ /dev/null 2018-01-30 20:35:32.000000000 -0500 @@ -1,119 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import java.util.Collection; - -import javax.xml.bind.JAXBElement; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.api.AccessorException; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.runtime.reflect.Accessor; - -import org.xml.sax.SAXException; - -/** - * Looks for xsi:nil='true' and sets the target to null. - * Otherwise delegate to another handler. - * - * @author Kohsuke Kawaguchi - */ -public class XsiNilLoader extends ProxyLoader { - - private final Loader defaultLoader; - - public XsiNilLoader(Loader defaultLoader) { - this.defaultLoader = defaultLoader; - assert defaultLoader!=null; - } - - protected Loader selectLoader(UnmarshallingContext.State state, TagName ea) throws SAXException { - int idx = ea.atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"nil"); - - if (idx!=-1) { - Boolean b = DatatypeConverterImpl._parseBoolean(ea.atts.getValue(idx)); - - if (b != null && b) { - onNil(state); - boolean hasOtherAttributes = (ea.atts.getLength() - 1) > 0; - // see issues 6759703 and 565 - need to preserve attributes even if the element is nil; only when the type is stored in JAXBElement - if (!(hasOtherAttributes && (state.getPrev().getTarget() instanceof JAXBElement))) { - return Discarder.INSTANCE; - } - } - } - return defaultLoader; - } - - @Override - public Collection getExpectedChildElements() { - return defaultLoader.getExpectedChildElements(); - } - - @Override - public Collection getExpectedAttributes() { - return defaultLoader.getExpectedAttributes(); - } - - /** - * Called when xsi:nil='true' was found. - */ - protected void onNil(UnmarshallingContext.State state) throws SAXException { - } - - public static final class Single extends XsiNilLoader { - private final Accessor acc; - public Single(Loader l, Accessor acc) { - super(l); - this.acc = acc; - } - - @Override - protected void onNil(UnmarshallingContext.State state) throws SAXException { - try { - acc.set(state.getPrev().getTarget(),null); - state.getPrev().setNil(true); - } catch (AccessorException e) { - handleGenericException(e,true); - } - } - - } - - public static final class Array extends XsiNilLoader { - public Array(Loader core) { - super(core); - } - - @Override - protected void onNil(UnmarshallingContext.State state) { - // let the receiver add this to the lister - state.setTarget(null); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/XsiTypeLoader.java 2018-01-30 20:35:33.000000000 -0500 +++ /dev/null 2018-01-30 20:35:33.000000000 -0500 @@ -1,127 +0,0 @@ -/* - * 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.bind.v2.runtime.unmarshaller; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.DatatypeConverterImpl; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.runtime.JaxBeanInfo; -import com.sun.istack.internal.Nullable; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -/** - * Looks at @xsi:type and forwards to the right {@link Loader}. - * - * @author Kohsuke Kawaguchi - */ -public class XsiTypeLoader extends Loader { - - /** - * Use this when no @xsi:type was found. - */ - private final JaxBeanInfo defaultBeanInfo; - - public XsiTypeLoader(JaxBeanInfo defaultBeanInfo) { - super(true); - this.defaultBeanInfo = defaultBeanInfo; - } - - public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { - JaxBeanInfo beanInfo = parseXsiType(state,ea,defaultBeanInfo); - if(beanInfo==null) - beanInfo = defaultBeanInfo; - - Loader loader = beanInfo.getLoader(null,false); - state.setLoader(loader); - loader.startElement(state,ea); - } - - /*pacakge*/ static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException { - UnmarshallingContext context = state.getContext(); - JaxBeanInfo beanInfo = null; - - // look for @xsi:type - Attributes atts = ea.atts; - int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type"); - - if(idx>=0) { - // we'll consume the value only when it's a recognized value, - // so don't consume it just yet. - String value = atts.getValue(idx); - - QName type = DatatypeConverterImpl._parseQName(value,context); - if(type==null) { - reportError(Messages.NOT_A_QNAME.format(value),true); - } else { - if(defaultBeanInfo!=null && defaultBeanInfo.getTypeNames().contains(type)) - // if this xsi:type is something that the default type can already handle, - // let it do so. This is added as a work around to bug https://jax-ws.dev.java.net/issues/show_bug.cgi?id=195 - // where a redundant xsi:type="xs:dateTime" causes JAXB to unmarshal XMLGregorianCalendar, - // where Date is expected. - // this is not a complete fix, as we still won't be able to handle simple type substitution in general, - // but none-the-less - return defaultBeanInfo; - - beanInfo = context.getJAXBContext().getGlobalType(type); - if(beanInfo==null) { // let's report an error - if (context.parent.hasEventHandler() // is somebody listening? - && context.shouldErrorBeReported()) { // should we report error? - String nearest = context.getJAXBContext().getNearestTypeName(type); - if(nearest!=null) - reportError(Messages.UNRECOGNIZED_TYPE_NAME_MAYBE.format(type,nearest),true); - else - reportError(Messages.UNRECOGNIZED_TYPE_NAME.format(type),true); - } - } - // TODO: resurrect the following check - // else - // if(!target.isAssignableFrom(actual)) { - // reportError(context, - // Messages.UNSUBSTITUTABLE_TYPE.format(value,actual.getName(),target.getName()), - // true); - // actual = targetBeanInfo; // ditto - // } - } - } - return beanInfo; - } - - static final QName XsiTypeQNAME = new QName(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type"); - - @Override - public Collection getExpectedAttributes() { - final Collection expAttrs = new HashSet(); - expAttrs.addAll(super.getExpectedAttributes()); - expAttrs.add(XsiTypeQNAME); - return Collections.unmodifiableCollection(expAttrs); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/FoolProofResolver.java 2018-01-30 20:35:34.000000000 -0500 +++ /dev/null 2018-01-30 20:35:34.000000000 -0500 @@ -1,73 +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.xml.internal.bind.v2.schemagen; - -import java.io.IOException; -import java.util.logging.Logger; - -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.transform.Result; - -import com.sun.xml.internal.bind.Util; - -/** - * {@link SchemaOutputResolver} that wraps the user-specified resolver - * and makes sure that it's following the contract. - * - *

- * This protects the rest of the {@link XmlSchemaGenerator} from client programming - * error. - */ -final class FoolProofResolver extends SchemaOutputResolver { - private static final Logger logger = Util.getClassLogger(); - private final SchemaOutputResolver resolver; - - public FoolProofResolver(SchemaOutputResolver resolver) { - assert resolver!=null; - this.resolver = resolver; - } - - public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException { - logger.entering(getClass().getName(),"createOutput",new Object[]{namespaceUri,suggestedFileName}); - Result r = resolver.createOutput(namespaceUri,suggestedFileName); - if(r!=null) { - String sysId = r.getSystemId(); - logger.finer("system ID = "+sysId); - if(sysId!=null) { - // TODO: make sure that the system Id is absolute - - // don't use java.net.URI, because it doesn't allow some characters (like SP) - // which can legally used as file names. - - // but don't use java.net.URL either, because it doesn't allow a made-up URI - // like kohsuke://foo/bar/zot - } else - throw new AssertionError("system ID cannot be null"); - } - logger.exiting(getClass().getName(),"createOutput",r); - return r; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Form.java 2018-01-30 20:35:34.000000000 -0500 +++ /dev/null 2018-01-30 20:35:35.000000000 -0500 @@ -1,112 +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.xml.internal.bind.v2.schemagen; - -import javax.xml.bind.annotation.XmlNsForm; -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.LocalAttribute; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.LocalElement; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Schema; -import com.sun.xml.internal.txw2.TypedXmlWriter; - -/** - * Represents the form default value. - * - * @author Kohsuke Kawaguchi - */ -enum Form { - QUALIFIED(XmlNsForm.QUALIFIED,true) { - void declare(String attName,Schema schema) { - schema._attribute(attName,"qualified"); - } - }, - UNQUALIFIED(XmlNsForm.UNQUALIFIED,false) { - void declare(String attName,Schema schema) { - // pointless, but required by the spec. - // people need to understand that @attributeFormDefault is a syntax sugar - schema._attribute(attName,"unqualified"); - } - }, - UNSET(XmlNsForm.UNSET,false) { - void declare(String attName,Schema schema) { - } - }; - - /** - * The same constant defined in the spec. - */ - private final XmlNsForm xnf; - - /** - * What's the effective value? UNSET means unqualified per XSD spec.) - */ - public final boolean isEffectivelyQualified; - - Form(XmlNsForm xnf, boolean effectivelyQualified) { - this.xnf = xnf; - this.isEffectivelyQualified = effectivelyQualified; - } - - /** - * Writes the attribute on the generated {@code } element. - */ - abstract void declare(String attName, Schema schema); - - /** - * Given the effective 'form' value, write (or suppress) the @form attribute - * on the generated XML. - */ - public void writeForm(LocalElement e, QName tagName) { - _writeForm(e,tagName); - } - - public void writeForm(LocalAttribute a, QName tagName) { - _writeForm(a,tagName); - } - - private void _writeForm(TypedXmlWriter e, QName tagName) { - boolean qualified = tagName.getNamespaceURI().length()>0; - - if(qualified && this!=QUALIFIED) - e._attribute("form","qualified"); - else - if(!qualified && this==QUALIFIED) - e._attribute("form","unqualified"); - } - - /** - * Gets the constant the corresponds to the given {@link XmlNsForm}. - */ - public static Form get(XmlNsForm xnf) { - for (Form v : values()) { - if(v.xnf==xnf) - return v; - } - throw new IllegalArgumentException(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/GroupKind.java 2018-01-30 20:35:35.000000000 -0500 +++ /dev/null 2018-01-30 20:35:35.000000000 -0500 @@ -1,51 +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.xml.internal.bind.v2.schemagen; - -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Particle; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ContentModelContainer; - -/** - * Enum for model group type. - * - * @author Kohsuke Kawaguchi - */ -enum GroupKind { - ALL("all"), SEQUENCE("sequence"), CHOICE("choice"); - - private final String name; - - GroupKind(String name) { - this.name = name; - } - - /** - * Writes the model group. - */ - Particle write(ContentModelContainer parent) { - return parent._element(name,Particle.class); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages.java 2018-01-30 20:35:36.000000000 -0500 +++ /dev/null 2018-01-30 20:35:36.000000000 -0500 @@ -1,48 +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.xml.internal.bind.v2.schemagen; - -import java.util.ResourceBundle; -import java.text.MessageFormat; - -/** - * Message resources - */ -enum Messages { - ANONYMOUS_TYPE_CYCLE // 1 arg - ; - - private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName()); - - @Override - public String toString() { - return format(); - } - - public String format( Object... args ) { - return MessageFormat.format( rb.getString(name()), args ); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages.properties 2018-01-30 20:35:37.000000000 -0500 +++ /dev/null 2018-01-30 20:35:37.000000000 -0500 @@ -1,31 +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. -# - -ANONYMOUS_TYPE_CYCLE= Error occured during schema generation, however the schema could be generated. \ -There is a circular dependency on an element in your schema: {0} \ -This element \ -is not defined as global element and thus references were not generated and \ -the type has been inlined where possible. To allow references for the type, add \ -XmlRootElement annotation to your type definition class. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages_de.properties 2018-01-30 20:35:37.000000000 -0500 +++ /dev/null 2018-01-30 20:35:37.000000000 -0500 @@ -1,26 +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. -# - -ANONYMOUS_TYPE_CYCLE= Bei der Schemagenerierung ist ein Fehler aufgetreten, das Schema konnte jedoch generiert werden. Es ist eine zyklische Abh\u00E4ngigkeit von einem Element in Ihrem Schema vorhanden: {0} Dieses Element ist nicht als globales Element definiert, somit wurden keine Referenzen generiert und der Typ wurde wenn m\u00F6glich eingebettet. Um Referenzen f\u00FCr den Typ zuzulassen, f\u00FCgen Sie eine XmlRootElement-Annotation der Typdefinitionsklasse hinzu. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages_es.properties 2018-01-30 20:35:38.000000000 -0500 +++ /dev/null 2018-01-30 20:35:38.000000000 -0500 @@ -1,26 +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. -# - -ANONYMOUS_TYPE_CYCLE= Se ha producido un error durante la generaci\u00F3n del esquema, aunque el esquema se ha podido generar. Existe una dependencia circular en un elemento del esquema: {0} Este elemento no est\u00E1 definido como un elemento global y, por lo tanto, no se han generado referencias y el tipo se ha puesto en l\u00EDnea cuando ha sido posible. Para permitir referencias para el tipo, agregue la anotaci\u00F3n XmlRootElement a la clase de definici\u00F3n de tipos. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages_fr.properties 2018-01-30 20:35:39.000000000 -0500 +++ /dev/null 2018-01-30 20:35:39.000000000 -0500 @@ -1,26 +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. -# - -ANONYMOUS_TYPE_CYCLE= Une erreur s''est produite lors de la g\u00E9n\u00E9ration du sch\u00E9ma, mais ce dernier a pu \u00EAtre g\u00E9n\u00E9r\u00E9. Il existe une d\u00E9pendance circulaire sur un \u00E9l\u00E9ment du sch\u00E9ma : {0}. Cet \u00E9l\u00E9ment n''est pas d\u00E9fini en tant qu''\u00E9l\u00E9ment global, les r\u00E9f\u00E9rences n''ont donc pas \u00E9t\u00E9 g\u00E9n\u00E9r\u00E9es et le type a \u00E9t\u00E9 incorpor\u00E9 l\u00E0 o\u00F9 cela \u00E9tait possible. Pour autoriser les r\u00E9f\u00E9rences pour le type, ajoutez l''annotation XmlRootElement \u00E0 la classe de d\u00E9finition du type. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages_it.properties 2018-01-30 20:35:39.000000000 -0500 +++ /dev/null 2018-01-30 20:35:39.000000000 -0500 @@ -1,26 +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. -# - -ANONYMOUS_TYPE_CYCLE= Si \u00E8 verificato un errore durante la generazione dello schema, tuttavia \u00E8 stato possibile generare quest''ultimo. Esiste una dipendenza circolare su un elemento nello schema: {0} Questo elemento non \u00E8 definito come elemento globale e pertanto non sono stati generati riferimenti e il tipo \u00E8 inserito in linea dove possibile. Per consentire i riferimenti per il tipo, aggiungere l''annotazione XmlRootElement alla classe di definizione del tipo in uso. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages_ja.properties 2018-01-30 20:35:40.000000000 -0500 +++ /dev/null 2018-01-30 20:35:40.000000000 -0500 @@ -1,26 +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. -# - -ANONYMOUS_TYPE_CYCLE= \u30B9\u30AD\u30FC\u30DE\u751F\u6210\u4E2D\u306B\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\u304C\u3001\u30B9\u30AD\u30FC\u30DE\u3092\u751F\u6210\u3067\u304D\u307E\u3057\u305F\u3002\u30B9\u30AD\u30FC\u30DE\u5185\u306E\u8981\u7D20\u306B\u5FAA\u74B0\u4F9D\u5B58\u95A2\u4FC2\u304C\u3042\u308A\u307E\u3059: {0}\u3002\u3053\u306E\u8981\u7D20\u306F\u30B0\u30ED\u30FC\u30D0\u30EB\u8981\u7D20\u3068\u3057\u3066\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u306A\u3044\u305F\u3081\u3001\u53C2\u7167\u306F\u751F\u6210\u3055\u308C\u305A\u3001\u30BF\u30A4\u30D7\u306F\u4F7F\u7528\u53EF\u80FD\u306A\u5834\u6240\u3067\u30A4\u30F3\u30E9\u30A4\u30F3\u5316\u3055\u308C\u3066\u3044\u307E\u3059\u3002\u30BF\u30A4\u30D7\u306E\u53C2\u7167\u3092\u8A31\u53EF\u3059\u308B\u306B\u306F\u3001\u30BF\u30A4\u30D7\u5B9A\u7FA9\u30AF\u30E9\u30B9\u306BXmlRootElement\u6CE8\u91C8\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages_ko.properties 2018-01-30 20:35:41.000000000 -0500 +++ /dev/null 2018-01-30 20:35:41.000000000 -0500 @@ -1,26 +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. -# - -ANONYMOUS_TYPE_CYCLE= \uC2A4\uD0A4\uB9C8 \uC0DD\uC131 \uC911 \uC624\uB958\uAC00 \uBC1C\uC0DD\uD588\uC9C0\uB9CC \uC2A4\uD0A4\uB9C8\uB97C \uC0DD\uC131\uD560 \uC218 \uC788\uC5C8\uC2B5\uB2C8\uB2E4. \uC2A4\uD0A4\uB9C8\uC758 \uC694\uC18C\uC5D0 \uC21C\uD658 \uC885\uC18D\uC131\uC774 \uC788\uC74C: {0}. \uC774 \uC694\uC18C\uB294 \uC804\uC5ED \uC694\uC18C\uB85C \uC815\uC758\uB418\uC9C0 \uC54A\uC544 \uCC38\uC870\uAC00 \uC0DD\uC131\uB418\uC9C0 \uC54A\uC558\uC73C\uBA70 \uAC00\uB2A5\uD55C \uACBD\uC6B0 \uC720\uD615\uC774 \uC778\uB77C\uC778\uB418\uC5C8\uC2B5\uB2C8\uB2E4. \uC720\uD615\uC5D0 \uB300\uD55C \uCC38\uC870\uB97C \uD5C8\uC6A9\uD558\uB824\uBA74 \uC720\uD615 \uC815\uC758 \uD074\uB798\uC2A4\uC5D0 XmlRootElement \uC8FC\uC11D\uC744 \uCD94\uAC00\uD558\uC2ED\uC2DC\uC624. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages_pt_BR.properties 2018-01-30 20:35:41.000000000 -0500 +++ /dev/null 2018-01-30 20:35:41.000000000 -0500 @@ -1,26 +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. -# - -ANONYMOUS_TYPE_CYCLE= Ocorreu um erro durante a gera\u00E7\u00E3o do esquema, no entanto, foi poss\u00EDvel ger\u00E1-lo. H\u00E1 uma depend\u00EAncia circular ou um elemento em seu esquema: {0} Este elemento n\u00E3o foi definido como elemento global e, por isso, as refer\u00EAncias n\u00E3o foram geradas e o tipo foi alinhado, quando poss\u00EDvel. Para permitir refer\u00EAncias ao tipo, adicione a anota\u00E7\u00E3o XmlRootElement \u00E0 classe de defini\u00E7\u00E3o do tipo. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages_zh_CN.properties 2018-01-30 20:35:42.000000000 -0500 +++ /dev/null 2018-01-30 20:35:42.000000000 -0500 @@ -1,26 +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. -# - -ANONYMOUS_TYPE_CYCLE= \u6A21\u5F0F\u751F\u6210\u671F\u95F4\u51FA\u9519, \u4F46\u53EF\u4EE5\u751F\u6210\u6A21\u5F0F\u3002\u6A21\u5F0F\u4E2D\u7684\u67D0\u4E00\u5143\u7D20\u5B58\u5728\u5FAA\u73AF\u76F8\u5173\u6027: {0}\u3002\u6B64\u5143\u7D20\u672A\u5B9A\u4E49\u4E3A\u5168\u5C40\u5143\u7D20, \u56E0\u6B64\u672A\u751F\u6210\u5F15\u7528\u5E76\u5DF2\u5C3D\u53EF\u80FD\u5730\u5C06\u7C7B\u578B\u5185\u5D4C\u3002\u8981\u5141\u8BB8\u7C7B\u578B\u7684\u5F15\u7528, \u8BF7\u5411\u7C7B\u578B\u5B9A\u4E49\u7C7B\u6DFB\u52A0 XmlRootElement \u6CE8\u91CA\u3002 --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Messages_zh_TW.properties 2018-01-30 20:35:43.000000000 -0500 +++ /dev/null 2018-01-30 20:35:43.000000000 -0500 @@ -1,26 +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. -# - -ANONYMOUS_TYPE_CYCLE= \u7DB1\u8981\u7522\u751F\u671F\u9593\u767C\u751F\u932F\u8AA4, \u4F46\u53EF\u4EE5\u7522\u751F\u7DB1\u8981. \u60A8\u7DB1\u8981\u4E2D\u7684\u67D0\u500B\u5143\u7D20\u6709\u5FAA\u74B0\u76F8\u4F9D\u6027: {0}. \u6B64\u5143\u7D20\u672A\u5B9A\u7FA9\u70BA\u5168\u57DF\u5143\u7D20, \u56E0\u6B64\u672A\u7522\u751F\u53C3\u7167, \u4E26\u4E14\u5DF2\u76E1\u53EF\u80FD\u5167\u7F6E\u8A72\u985E\u578B. \u82E5\u8981\u5141\u8A31\u8A72\u985E\u578B\u7684\u53C3\u7167, \u8ACB\u65B0\u589E XmlRootElement \u8A3B\u89E3\u81F3\u60A8\u7684\u985E\u578B\u5B9A\u7FA9\u985E\u5225. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/MultiMap.java 2018-01-30 20:35:43.000000000 -0500 +++ /dev/null 2018-01-30 20:35:43.000000000 -0500 @@ -1,62 +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.xml.internal.bind.v2.schemagen; - -import java.util.TreeMap; -import java.util.Map; - -/** - * A special {@link Map} that 'conceptually' stores a set of values for each key. - * - *

- * When multiple values are stored, however, this class doesn't let the caller - * see individual values, and instead it returns a specially designated "MANY" value, - * which is given as a parameter to the constructor. - * - * @author Kohsuke Kawaguchi - */ -final class MultiMap,V> extends TreeMap { - private final V many; - - public MultiMap(V many) { - this.many = many; - } - - @Override - public V put(K key, V value) { - V old = super.put(key, value); - if(old!=null && !old.equals(value)) { - // different value stored - super.put(key,many); - } - return old; - } - - @Override - public void putAll(Map map) { - throw new UnsupportedOperationException(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Tree.java 2018-01-30 20:35:44.000000000 -0500 +++ /dev/null 2018-01-30 20:35:44.000000000 -0500 @@ -1,244 +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.xml.internal.bind.v2.schemagen; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ContentModelContainer; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Particle; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.TypeDefParticle; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Occurs; - -/** - * Normalized representation of the content model. - * - *

- * This is built from bottom up so that we can eliminate redundant constructs, - * and produce the most concise content model definition in XML. - * - * @author Kohsuke Kawaguchi - */ -abstract class Tree { - - /** - * Returns "T?" from "T". - * - * @param really - * if false this method becomes no-op. This is so that we can write - * the caller fluently. - */ - Tree makeOptional(boolean really) { - return really?new Optional(this) :this; - } - - /** - * Returns "T+" from "T". - * - * @param really - * if false this method becomes no-op. This is so that we can write - * the caller fluently. - */ - Tree makeRepeated(boolean really) { - return really?new Repeated(this) :this; - } - - /** - * Returns a group tree. - */ - static Tree makeGroup(GroupKind kind, List children ) { - // pointless binary operator. - if(children.size()==1) - return children.get(0); - - // we neither have epsilon or emptySet, so can't handle children.length==0 nicely - - // eliminated nesting groups of the same kind. - // this is where binary tree would have shined. - List normalizedChildren = new ArrayList(children.size()); - for (Tree t : children) { - if (t instanceof Group) { - Group g = (Group) t; - if(g.kind==kind) { - normalizedChildren.addAll(Arrays.asList(g.children)); - continue; - } - } - normalizedChildren.add(t); - } - - return new Group(kind,normalizedChildren.toArray(new Tree[normalizedChildren.size()])); - } - - /** - * Returns true if this tree accepts empty sequence. - */ - abstract boolean isNullable(); - - /** - * Returns true if the top node of this tree can - * appear as a valid top-level content model in XML Schema. - * - *

- * Model groups and occurrences that have model group in it can. - */ - boolean canBeTopLevel() { return false; } - - /** - * Writes out the content model. - * - * Normall this runs recursively until we write out the whole content model. - */ - protected abstract void write(ContentModelContainer parent, boolean isOptional, boolean repeated); - - /** - * Writes inside the given complex type. - */ - protected void write(TypeDefParticle ct) { - if(canBeTopLevel()) - write(ct._cast(ContentModelContainer.class), false, false); - else - // need a dummy wrapper - new Group(GroupKind.SEQUENCE,this).write(ct); - } - - /** - * Convenience method to write occurrence constraints. - */ - protected final void writeOccurs(Occurs o, boolean isOptional, boolean repeated) { - if(isOptional) - o.minOccurs(0); - if(repeated) - o.maxOccurs("unbounded"); - } - - /** - * Represents a terminal tree node, such as element, wildcard, etc. - */ - abstract static class Term extends Tree { - boolean isNullable() { - return false; - } - } - - /** - * "T?" - */ - private static final class Optional extends Tree { - private final Tree body; - - private Optional(Tree body) { - this.body = body; - } - - @Override - boolean isNullable() { - return true; - } - - @Override - Tree makeOptional(boolean really) { - return this; - } - - @Override - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - body.write(parent,true,repeated); - } - } - - /** - * "T+" - */ - private static final class Repeated extends Tree { - private final Tree body; - - private Repeated(Tree body) { - this.body = body; - } - - @Override - boolean isNullable() { - return body.isNullable(); - } - - @Override - Tree makeRepeated(boolean really) { - return this; - } - - @Override - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - body.write(parent,isOptional,true); - } - } - - /** - * "S|T", "S,T", and "S&T". - */ - private static final class Group extends Tree { - private final GroupKind kind; - private final Tree[] children; - - private Group(GroupKind kind, Tree... children) { - this.kind = kind; - this.children = children; - } - - @Override - boolean canBeTopLevel() { - return true; - } - - @Override - boolean isNullable() { - if(kind== GroupKind.CHOICE) { - for (Tree t : children) { - if(t.isNullable()) - return true; - } - return false; - } else { - for (Tree t : children) { - if(!t.isNullable()) - return false; - } - return true; - } - } - - @Override - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - Particle c = kind.write(parent); - writeOccurs(c,isOptional,repeated); - - for (Tree child : children) { - child.write(c,false,false); - } - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/Util.java 2018-01-30 20:35:45.000000000 -0500 +++ /dev/null 2018-01-30 20:35:45.000000000 -0500 @@ -1,130 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.bind.v2.schemagen; - - -/** - * TODO: JAX-WS dependes on this class - consider moving it somewhere more stable, Notify JAX-WS before modifying anything... - * - * Other miscellaneous utility methods. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class Util { - private Util() {} // no instanciation please - - /** - * Escape any characters that would cause the single arg constructor - * of java.net.URI to complain about illegal chars. - * - * @param s source string to be escaped - */ - public static String escapeURI(String s) { - StringBuilder sb = new StringBuilder(); - for( int i = 0; i < s.length(); i++ ) { - char c = s.charAt(i); - if(Character.isSpaceChar(c)) { - sb.append("%20"); - } else { - sb.append(c); - } - } - return sb.toString(); - } - - /** - * Calculate the parent URI path of the given URI path. - * - * @param uriPath the uriPath (as returned by java.net.URI#getPath() - * @return the parent URI path of the given URI path - */ - public static String getParentUriPath(String uriPath) { - int idx = uriPath.lastIndexOf('/'); - - if (uriPath.endsWith("/")) { - uriPath = uriPath.substring(0,idx); // trim trailing slash - idx = uriPath.lastIndexOf('/'); // move idx to parent context - } - - return uriPath.substring(0, idx)+"/"; - } - - /** - * Calculate the normalized form of the given uriPath. - *

- * For example:

{@code
-     *    /a/b/c/ -> /a/b/c/
-     *    /a/b/c  -> /a/b/
-     *    /a/     -> /a/
-     *    /a      -> /
-     *    }
- * - * @param uriPath path of a URI (as returned by java.net.URI#getPath() - * @return the normalized uri path - */ - public static String normalizeUriPath(String uriPath) { - if (uriPath.endsWith("/")) - return uriPath; - - // the uri path should always have at least a leading slash, - // so no need to make sure that ( idx == -1 ) - int idx = uriPath.lastIndexOf('/'); - return uriPath.substring(0, idx+1); - } - - /** - * determine if two Strings are equal ignoring case allowing null values - * - * @param s string 1 - * @param t string 2 - * @return true iff the given strings are equal ignoring case, false if they aren't - * equal or either of them are null. - */ - public static boolean equalsIgnoreCase(String s, String t) { - if (s == t) return true; - if ((s != null) && (t != null)) { - return s.equalsIgnoreCase(t); - } - return false; - } - - /** - * determine if two Strings are iqual allowing null values - * - * @param s string 1 - * @param t string 2 - * @return true iff the strings are equal, false if they aren't equal or either of - * them are null. - */ - public static boolean equal(String s, String t) { - if (s == t) return true; - if ((s != null) && (t != null)) { - return s.equals(t); - } - return false; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/XmlSchemaGenerator.java 2018-01-30 20:35:45.000000000 -0500 +++ /dev/null 2018-01-30 20:35:45.000000000 -0500 @@ -1,1624 +0,0 @@ -/* - * Copyright (c) 1997, 2016, 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.bind.v2.schemagen; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.Writer; -import java.io.File; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Comparator; -import java.util.HashMap; -import java.util.LinkedHashSet; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; - -import javax.activation.MimeType; -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.namespace.QName; -import javax.xml.transform.Result; -import javax.xml.transform.stream.StreamResult; - -import com.sun.istack.internal.Nullable; -import com.sun.istack.internal.NotNull; -import com.sun.xml.internal.bind.Util; -import com.sun.xml.internal.bind.api.CompositeStructure; -import com.sun.xml.internal.bind.api.ErrorListener; -import com.sun.xml.internal.bind.v2.TODO; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; -import com.sun.xml.internal.bind.v2.util.CollisionCheckStack; -import com.sun.xml.internal.bind.v2.util.StackRecorder; -import static com.sun.xml.internal.bind.v2.WellKnownNamespace.XML_SCHEMA; -import com.sun.xml.internal.bind.v2.model.core.Adapter; -import com.sun.xml.internal.bind.v2.model.core.ArrayInfo; -import com.sun.xml.internal.bind.v2.model.core.AttributePropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.ClassInfo; -import com.sun.xml.internal.bind.v2.model.core.Element; -import com.sun.xml.internal.bind.v2.model.core.ElementInfo; -import com.sun.xml.internal.bind.v2.model.core.ElementPropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.EnumConstant; -import com.sun.xml.internal.bind.v2.model.core.EnumLeafInfo; -import com.sun.xml.internal.bind.v2.model.core.MapPropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.MaybeElement; -import com.sun.xml.internal.bind.v2.model.core.NonElement; -import com.sun.xml.internal.bind.v2.model.core.NonElementRef; -import com.sun.xml.internal.bind.v2.model.core.PropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.ReferencePropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfo; -import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet; -import com.sun.xml.internal.bind.v2.model.core.TypeRef; -import com.sun.xml.internal.bind.v2.model.core.ValuePropertyInfo; -import com.sun.xml.internal.bind.v2.model.core.WildcardMode; -import com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl; -import com.sun.xml.internal.bind.v2.model.nav.Navigator; -import com.sun.xml.internal.bind.v2.runtime.SwaRefAdapter; -import static com.sun.xml.internal.bind.v2.schemagen.Util.*; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Any; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.AttrDecls; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ComplexExtension; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ComplexType; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ComplexTypeHost; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ExplicitGroup; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Import; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.List; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.LocalAttribute; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.LocalElement; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Schema; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.SimpleExtension; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.SimpleRestrictionModel; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.SimpleType; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.SimpleTypeHost; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.TopLevelAttribute; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.TopLevelElement; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.TypeHost; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ContentModelContainer; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.TypeDefParticle; -import com.sun.xml.internal.bind.v2.schemagen.xmlschema.AttributeType; -import com.sun.xml.internal.bind.v2.schemagen.episode.Bindings; -import com.sun.xml.internal.txw2.TXW; -import com.sun.xml.internal.txw2.TxwException; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.output.ResultFactory; -import com.sun.xml.internal.txw2.output.XmlSerializer; -import java.util.Collection; -import java.util.HashSet; -import org.xml.sax.SAXParseException; - -/** - * Generates a set of W3C XML Schema documents from a set of Java classes. - * - *

- * A client must invoke methods in the following order: - *

    - *
  1. Create a new {@link XmlSchemaGenerator} - *
  2. Invoke {@link #add} methods, multiple times if necessary. - *
  3. Invoke {@link #write} - *
  4. Discard the {@link XmlSchemaGenerator}. - *
- * - * @author Ryan Shoemaker - * @author Kohsuke Kawaguchi (kk@kohsuke.org) - */ -public final class XmlSchemaGenerator { - - private static final Logger logger = Util.getClassLogger(); - - /** - * Java classes to be written, organized by their namespace. - * - *

- * We use a {@link TreeMap} here so that the suggested names will - * be consistent across JVMs. - * - * @see SchemaOutputResolver#createOutput(String, String) - */ - private final Map namespaces = new TreeMap(NAMESPACE_COMPARATOR); - - /** - * {@link ErrorListener} to send errors to. - */ - private ErrorListener errorListener; - - /** model navigator **/ - private Navigator navigator; - - private final TypeInfoSet types; - - /** - * Representation for xs:string. - */ - private final NonElement stringType; - - /** - * Represents xs:anyType. - */ - private final NonElement anyType; - - /** - * Used to detect cycles in anonymous types. - */ - private final CollisionCheckStack> collisionChecker = new CollisionCheckStack>(); - - public XmlSchemaGenerator( Navigator navigator, TypeInfoSet types ) { - this.navigator = navigator; - this.types = types; - - this.stringType = types.getTypeInfo(navigator.ref(String.class)); - this.anyType = types.getAnyTypeInfo(); - - // populate the object - for( ClassInfo ci : types.beans().values() ) - add(ci); - for( ElementInfo ei1 : types.getElementMappings(null).values() ) - add(ei1); - for( EnumLeafInfo ei : types.enums().values() ) - add(ei); - for( ArrayInfo a : types.arrays().values()) - add(a); - } - - private Namespace getNamespace(String uri) { - Namespace n = namespaces.get(uri); - if(n==null) - namespaces.put(uri,n=new Namespace(uri)); - return n; - } - - /** - * Adds a new class to the list of classes to be written. - * - *

- * A {@link ClassInfo} may have two namespaces --- one for the element name - * and the other for the type name. If they are different, we put the same - * {@link ClassInfo} to two {@link Namespace}s. - */ - public void add( ClassInfo clazz ) { - assert clazz!=null; - - String nsUri = null; - - if(clazz.getClazz()==navigator.asDecl(CompositeStructure.class)) - return; // this is a special class we introduced for JAX-WS that we *don't* want in the schema - - if(clazz.isElement()) { - // put element -> type reference - nsUri = clazz.getElementName().getNamespaceURI(); - Namespace ns = getNamespace(nsUri); - ns.classes.add(clazz); - ns.addDependencyTo(clazz.getTypeName()); - - // schedule writing this global element - add(clazz.getElementName(),false,clazz); - } - - QName tn = clazz.getTypeName(); - if(tn!=null) { - nsUri = tn.getNamespaceURI(); - } else { - // anonymous type - if(nsUri==null) - return; - } - - Namespace n = getNamespace(nsUri); - n.classes.add(clazz); - - // search properties for foreign namespace references - for( PropertyInfo p : clazz.getProperties()) { - n.processForeignNamespaces(p, 1); - if (p instanceof AttributePropertyInfo) { - AttributePropertyInfo ap = (AttributePropertyInfo) p; - String aUri = ap.getXmlName().getNamespaceURI(); - if(aUri.length()>0) { - // global attribute - getNamespace(aUri).addGlobalAttribute(ap); - n.addDependencyTo(ap.getXmlName()); - } - } - if (p instanceof ElementPropertyInfo) { - ElementPropertyInfo ep = (ElementPropertyInfo) p; - for (TypeRef tref : ep.getTypes()) { - String eUri = tref.getTagName().getNamespaceURI(); - if(eUri.length()>0 && !eUri.equals(n.uri)) { - getNamespace(eUri).addGlobalElement(tref); - n.addDependencyTo(tref.getTagName()); - } - } - } - - if(generateSwaRefAdapter(p)) - n.useSwaRef = true; - - MimeType mimeType = p.getExpectedMimeType(); - if( mimeType != null ) { - n.useMimeNs = true; - } - - } - - // recurse on baseTypes to make sure that we can refer to them in the schema - ClassInfo bc = clazz.getBaseClass(); - if (bc != null) { - add(bc); - n.addDependencyTo(bc.getTypeName()); - } - } - - /** - * Adds a new element to the list of elements to be written. - */ - public void add( ElementInfo elem ) { - assert elem!=null; - - @SuppressWarnings("UnusedAssignment") - boolean nillable = false; // default value - - QName name = elem.getElementName(); - Namespace n = getNamespace(name.getNamespaceURI()); - ElementInfo ei; - - if (elem.getScope() != null) { // (probably) never happens - ei = this.types.getElementInfo(elem.getScope().getClazz(), name); - } else { - ei = this.types.getElementInfo(null, name); - } - - XmlElement xmlElem = ei.getProperty().readAnnotation(XmlElement.class); - - if (xmlElem == null) { - nillable = false; - } else { - nillable = xmlElem.nillable(); - } - - n.elementDecls.put(name.getLocalPart(),n.new ElementWithType(nillable, elem.getContentType())); - - // search for foreign namespace references - n.processForeignNamespaces(elem.getProperty(), 1); - } - - public void add( EnumLeafInfo envm ) { - assert envm!=null; - - String nsUri = null; - - if(envm.isElement()) { - // put element -> type reference - nsUri = envm.getElementName().getNamespaceURI(); - Namespace ns = getNamespace(nsUri); - ns.enums.add(envm); - ns.addDependencyTo(envm.getTypeName()); - - // schedule writing this global element - add(envm.getElementName(),false,envm); - } - - final QName typeName = envm.getTypeName(); - if (typeName != null) { - nsUri = typeName.getNamespaceURI(); - } else { - if(nsUri==null) - return; // anonymous type - } - - Namespace n = getNamespace(nsUri); - n.enums.add(envm); - - // search for foreign namespace references - n.addDependencyTo(envm.getBaseType().getTypeName()); - } - - public void add( ArrayInfo a ) { - assert a!=null; - - final String namespaceURI = a.getTypeName().getNamespaceURI(); - Namespace n = getNamespace(namespaceURI); - n.arrays.add(a); - - // search for foreign namespace references - n.addDependencyTo(a.getItemType().getTypeName()); - } - - /** - * Adds an additional element declaration. - * - * @param tagName - * The name of the element declaration to be added. - * @param type - * The type this element refers to. - * Can be null, in which case the element refers to an empty anonymous complex type. - */ - public void add( QName tagName, boolean isNillable, NonElement type ) { - - if(type!=null && type.getType()==navigator.ref(CompositeStructure.class)) - return; // this is a special class we introduced for JAX-WS that we *don't* want in the schema - - - Namespace n = getNamespace(tagName.getNamespaceURI()); - n.elementDecls.put(tagName.getLocalPart(), n.new ElementWithType(isNillable,type)); - - // search for foreign namespace references - if(type!=null) - n.addDependencyTo(type.getTypeName()); - } - - /** - * Writes out the episode file. - */ - public void writeEpisodeFile(XmlSerializer out) { - Bindings root = TXW.create(Bindings.class, out); - - if(namespaces.containsKey("")) // otherwise jaxb binding NS should be the default namespace - root._namespace(WellKnownNamespace.JAXB,"jaxb"); - root.version("2.1"); - // TODO: don't we want to bake in versions? - - // generate listing per schema - for (Map.Entry e : namespaces.entrySet()) { - Bindings group = root.bindings(); - - String prefix; - String tns = e.getKey(); - if(!tns.equals("")) { - group._namespace(tns,"tns"); - prefix = "tns:"; - } else { - prefix = ""; - } - - group.scd("x-schema::"+(tns.equals("")?"":"tns")); - group.schemaBindings().map(false); - - for (ClassInfo ci : e.getValue().classes) { - if(ci.getTypeName()==null) continue; // local type - - if(ci.getTypeName().getNamespaceURI().equals(tns)) { - Bindings child = group.bindings(); - child.scd('~'+prefix+ci.getTypeName().getLocalPart()); - child.klass().ref(ci.getName()); - } - - if(ci.isElement() && ci.getElementName().getNamespaceURI().equals(tns)) { - Bindings child = group.bindings(); - child.scd(prefix+ci.getElementName().getLocalPart()); - child.klass().ref(ci.getName()); - } - } - - for (EnumLeafInfo en : e.getValue().enums) { - if(en.getTypeName()==null) continue; // local type - - Bindings child = group.bindings(); - child.scd('~'+prefix+en.getTypeName().getLocalPart()); - child.klass().ref(navigator.getClassName(en.getClazz())); - } - - group.commit(true); - } - - root.commit(); - } - - /** - * Write out the schema documents. - */ - public void write(SchemaOutputResolver resolver, ErrorListener errorListener) throws IOException { - if(resolver==null) - throw new IllegalArgumentException(); - - if(logger.isLoggable(Level.FINE)) { - // debug logging to see what's going on. - logger.log(Level.FINE,"Writing XML Schema for "+toString(),new StackRecorder()); - } - - // make it fool-proof - resolver = new FoolProofResolver(resolver); - this.errorListener = errorListener; - - Map schemaLocations = types.getSchemaLocations(); - - Map out = new HashMap(); - Map systemIds = new HashMap(); - - // we create a Namespace object for the XML Schema namespace - // as a side-effect, but we don't want to generate it. - namespaces.remove(WellKnownNamespace.XML_SCHEMA); - - // first create the outputs for all so that we can resolve references among - // schema files when we write - for( Namespace n : namespaces.values() ) { - String schemaLocation = schemaLocations.get(n.uri); - if(schemaLocation!=null) { - systemIds.put(n,schemaLocation); - } else { - Result output = resolver.createOutput(n.uri,"schema"+(out.size()+1)+".xsd"); - if(output!=null) { // null result means no schema for that namespace - out.put(n,output); - systemIds.put(n,output.getSystemId()); - } - } - //Clear the namespace specific set with already written classes - n.resetWritten(); - } - - // then write'em all - for( Map.Entry e : out.entrySet() ) { - Result result = e.getValue(); - e.getKey().writeTo( result, systemIds ); - if(result instanceof StreamResult) { - OutputStream outputStream = ((StreamResult)result).getOutputStream(); - if(outputStream != null) { - outputStream.close(); // fix for bugid: 6291301 - } else { - final Writer writer = ((StreamResult)result).getWriter(); - if(writer != null) writer.close(); - } - } - } - } - - - - /** - * Schema components are organized per namespace. - */ - private class Namespace { - final @NotNull String uri; - - /** - * Other {@link Namespace}s that this namespace depends on. - */ - private final Set depends = new LinkedHashSet(); - - /** - * If this schema refers to components from this schema by itself. - */ - private boolean selfReference; - - /** - * List of classes in this namespace. - */ - private final Set> classes = new LinkedHashSet>(); - - /** - * Set of enums in this namespace - */ - private final Set> enums = new LinkedHashSet>(); - - /** - * Set of arrays in this namespace - */ - private final Set> arrays = new LinkedHashSet>(); - - /** - * Global attribute declarations keyed by their local names. - */ - private final MultiMap> attributeDecls = new MultiMap>(null); - - /** - * Global element declarations to be written, keyed by their local names. - */ - private final MultiMap elementDecls = - new MultiMap(new ElementWithType(true,anyType)); - - private Form attributeFormDefault; - private Form elementFormDefault; - - /** - * Does schema in this namespace uses swaRef? If so, we need to generate import - * statement. - */ - private boolean useSwaRef; - - /** - * Import for mime namespace needs to be generated. - * See #856 - */ - private boolean useMimeNs; - - /** - * Container for already processed classes - */ - private final Set written = new HashSet(); - - public Namespace(String uri) { - this.uri = uri; - assert !XmlSchemaGenerator.this.namespaces.containsKey(uri); - XmlSchemaGenerator.this.namespaces.put(uri,this); - } - - /** - * Clear out the set of already processed classes for this namespace - */ - void resetWritten() { - written.clear(); - } - - /** - * Process the given PropertyInfo looking for references to namespaces that - * are foreign to the given namespace. Any foreign namespace references - * found are added to the given namespaces dependency list and an {@code } - * is generated for it. - * - * @param p the PropertyInfo - */ - private void processForeignNamespaces(PropertyInfo p, int processingDepth) { - for (TypeInfo t : p.ref()) { - if ((t instanceof ClassInfo) && (processingDepth > 0)) { - java.util.List l = ((ClassInfo) t).getProperties(); - for (PropertyInfo subp : l) { - processForeignNamespaces(subp, --processingDepth); - } - } - if (t instanceof Element) { - addDependencyTo(((Element) t).getElementName()); - } - if (t instanceof NonElement) { - addDependencyTo(((NonElement) t).getTypeName()); - } - } - } - - private void addDependencyTo(@Nullable QName qname) { - // even though the Element interface says getElementName() returns non-null, - // ClassInfo always implements Element (even if an instance of ClassInfo might not be an Element). - // so this check is still necessary - if (qname==null) { - return; - } - - String nsUri = qname.getNamespaceURI(); - - if (nsUri.equals(XML_SCHEMA)) { - // no need to explicitly refer to XSD namespace - return; - } - - if (nsUri.equals(uri)) { - selfReference = true; - return; - } - - // found a type in a foreign namespace, so make sure we generate an import for it - depends.add(getNamespace(nsUri)); - } - - /** - * Writes the schema document to the specified result. - * - * @param systemIds - * System IDs of the other schema documents. "" indicates 'implied'. - */ - private void writeTo(Result result, Map systemIds) throws IOException { - try { - Schema schema = TXW.create(Schema.class,ResultFactory.createSerializer(result)); - - // additional namespace declarations to be made. - Map xmlNs = types.getXmlNs(uri); - - for (Map.Entry e : xmlNs.entrySet()) { - schema._namespace(e.getValue(),e.getKey()); - } - - if(useSwaRef) - schema._namespace(WellKnownNamespace.SWA_URI,"swaRef"); - - if(useMimeNs) - schema._namespace(WellKnownNamespace.XML_MIME_URI,"xmime"); - - attributeFormDefault = Form.get(types.getAttributeFormDefault(uri)); - attributeFormDefault.declare("attributeFormDefault",schema); - - elementFormDefault = Form.get(types.getElementFormDefault(uri)); - // TODO: if elementFormDefault is UNSET, figure out the right default value to use - elementFormDefault.declare("elementFormDefault",schema); - - - // declare XML Schema namespace to be xs, but allow the user to override it. - // if 'xs' is used for other things, we'll just let TXW assign a random prefix - if(!xmlNs.containsValue(WellKnownNamespace.XML_SCHEMA) - && !xmlNs.containsKey("xs")) - schema._namespace(WellKnownNamespace.XML_SCHEMA,"xs"); - schema.version("1.0"); - - if(uri.length()!=0) - schema.targetNamespace(uri); - - // declare prefixes for them at this level, so that we can avoid redundant - // namespace declarations - for (Namespace ns : depends) { - schema._namespace(ns.uri); - } - - if(selfReference && uri.length()!=0) { - // use common 'tns' prefix for the own namespace - // if self-reference is needed - schema._namespace(uri,"tns"); - } - - schema._pcdata(newline); - - // refer to other schemas - for( Namespace n : depends ) { - Import imp = schema._import(); - if(n.uri.length()!=0) - imp.namespace(n.uri); - String refSystemId = systemIds.get(n); - if(refSystemId!=null && !refSystemId.equals("")) { - // "" means implied. null if the SchemaOutputResolver said "don't generate!" - imp.schemaLocation(relativize(refSystemId,result.getSystemId())); - } - schema._pcdata(newline); - } - if(useSwaRef) { - schema._import().namespace(WellKnownNamespace.SWA_URI).schemaLocation("http://ws-i.org/profiles/basic/1.1/swaref.xsd"); - } - if(useMimeNs) { - schema._import().namespace(WellKnownNamespace.XML_MIME_URI).schemaLocation("http://www.w3.org/2005/05/xmlmime"); - } - - // then write each component - for (Map.Entry e : elementDecls.entrySet()) { - e.getValue().writeTo(e.getKey(),schema); - schema._pcdata(newline); - } - for (ClassInfo c : classes) { - if (c.getTypeName()==null) { - // don't generate anything if it's an anonymous type - continue; - } - if(uri.equals(c.getTypeName().getNamespaceURI())) - writeClass(c, schema); - schema._pcdata(newline); - } - for (EnumLeafInfo e : enums) { - if (e.getTypeName()==null) { - // don't generate anything if it's an anonymous type - continue; - } - if(uri.equals(e.getTypeName().getNamespaceURI())) - writeEnum(e,schema); - schema._pcdata(newline); - } - for (ArrayInfo a : arrays) { - writeArray(a,schema); - schema._pcdata(newline); - } - for (Map.Entry> e : attributeDecls.entrySet()) { - TopLevelAttribute a = schema.attribute(); - a.name(e.getKey()); - if(e.getValue()==null) - writeTypeRef(a,stringType,"type"); - else - writeAttributeTypeRef(e.getValue(),a); - schema._pcdata(newline); - } - - // close the schema - schema.commit(); - } catch( TxwException e ) { - logger.log(Level.INFO,e.getMessage(),e); - throw new IOException(e.getMessage()); - } - } - - /** - * Writes a type attribute (if the referenced type is a global type) - * or writes out the definition of the anonymous type in place (if the referenced - * type is not a global type.) - * - * Also provides processing for ID/IDREF, MTOM @xmime, and swa:ref - * - * ComplexTypeHost and SimpleTypeHost don't share an api for creating - * and attribute in a type-safe way, so we will compromise for now and - * use _attribute(). - */ - private void writeTypeRef(TypeHost th, NonElementRef typeRef, String refAttName) { - // ID / IDREF handling - switch(typeRef.getSource().id()) { - case ID: - th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "ID")); - return; - case IDREF: - th._attribute(refAttName, new QName(WellKnownNamespace.XML_SCHEMA, "IDREF")); - return; - case NONE: - // no ID/IDREF, so continue on and generate the type - break; - default: - throw new IllegalStateException(); - } - - // MTOM handling - MimeType mimeType = typeRef.getSource().getExpectedMimeType(); - if( mimeType != null ) { - th._attribute(new QName(WellKnownNamespace.XML_MIME_URI, "expectedContentTypes", "xmime"), mimeType.toString()); - } - - // ref:swaRef handling - if(generateSwaRefAdapter(typeRef)) { - th._attribute(refAttName, new QName(WellKnownNamespace.SWA_URI, "swaRef", "ref")); - return; - } - - // type name override - if(typeRef.getSource().getSchemaType()!=null) { - th._attribute(refAttName,typeRef.getSource().getSchemaType()); - return; - } - - // normal type generation - writeTypeRef(th, typeRef.getTarget(), refAttName); - } - - /** - * Writes a type attribute (if the referenced type is a global type) - * or writes out the definition of the anonymous type in place (if the referenced - * type is not a global type.) - * - * @param th - * the TXW interface to which the attribute will be written. - * @param type - * type to be referenced. - * @param refAttName - * The name of the attribute used when referencing a type by QName. - */ - private void writeTypeRef(TypeHost th, NonElement type, String refAttName) { - Element e = null; - if (type instanceof MaybeElement) { - MaybeElement me = (MaybeElement)type; - boolean isElement = me.isElement(); - if (isElement) e = me.asElement(); - } - if (type instanceof Element) { - e = (Element)type; - } - if (type.getTypeName()==null) { - if ((e != null) && (e.getElementName() != null)) { - th.block(); // so that the caller may write other attributes - if(type instanceof ClassInfo) { - writeClass( (ClassInfo)type, th ); - } else { - writeEnum( (EnumLeafInfo)type, (SimpleTypeHost)th); - } - } else { - // anonymous - th.block(); // so that the caller may write other attributes - if(type instanceof ClassInfo) { - if(collisionChecker.push((ClassInfo)type)) { - errorListener.warning(new SAXParseException( - Messages.ANONYMOUS_TYPE_CYCLE.format(collisionChecker.getCycleString()), - null - )); - } else { - writeClass( (ClassInfo)type, th ); - } - collisionChecker.pop(); - } else { - writeEnum( (EnumLeafInfo)type, (SimpleTypeHost)th); - } - } - } else { - th._attribute(refAttName,type.getTypeName()); - } - } - - /** - * writes the schema definition for the given array class - */ - private void writeArray(ArrayInfo a, Schema schema) { - ComplexType ct = schema.complexType().name(a.getTypeName().getLocalPart()); - ct._final("#all"); - LocalElement le = ct.sequence().element().name("item"); - le.type(a.getItemType().getTypeName()); - le.minOccurs(0).maxOccurs("unbounded"); - le.nillable(true); - ct.commit(); - } - - /** - * writes the schema definition for the specified type-safe enum in the given TypeHost - */ - private void writeEnum(EnumLeafInfo e, SimpleTypeHost th) { - SimpleType st = th.simpleType(); - writeName(e,st); - - SimpleRestrictionModel base = st.restriction(); - writeTypeRef(base, e.getBaseType(), "base"); - - for (EnumConstant c : e.getConstants()) { - base.enumeration().value(c.getLexicalValue()); - } - st.commit(); - } - - /** - * Writes the schema definition for the specified class to the schema writer. - * - * @param c the class info - * @param parent the writer of the parent element into which the type will be defined - */ - private void writeClass(ClassInfo c, TypeHost parent) { - if (written.contains(c)) { // to avoid cycles let's check if we haven't already processed the class - return; - } - written.add(c); - // special handling for value properties - if (containsValueProp(c)) { - if (c.getProperties().size() == 1) { - // [RESULT 2 - simpleType if the value prop is the only prop] - // - // - // - // - ValuePropertyInfo vp = (ValuePropertyInfo)c.getProperties().get(0); - SimpleType st = ((SimpleTypeHost)parent).simpleType(); - writeName(c, st); - if(vp.isCollection()) { - writeTypeRef(st.list(),vp.getTarget(),"itemType"); - } else { - writeTypeRef(st.restriction(),vp.getTarget(),"base"); - } - return; - } else { - // [RESULT 1 - complexType with simpleContent] - // - // - // - // - // - // - // - // - // ... - // - // ... - ComplexType ct = ((ComplexTypeHost)parent).complexType(); - writeName(c,ct); - if(c.isFinal()) - ct._final("extension restriction"); - - SimpleExtension se = ct.simpleContent().extension(); - se.block(); // because we might have attribute before value - for (PropertyInfo p : c.getProperties()) { - switch (p.kind()) { - case ATTRIBUTE: - handleAttributeProp((AttributePropertyInfo)p,se); - break; - case VALUE: - TODO.checkSpec("what if vp.isCollection() == true?"); - ValuePropertyInfo vp = (ValuePropertyInfo) p; - se.base(vp.getTarget().getTypeName()); - break; - case ELEMENT: // error - case REFERENCE: // error - default: - assert false; - throw new IllegalStateException(); - } - } - se.commit(); - } - TODO.schemaGenerator("figure out what to do if bc != null"); - TODO.checkSpec("handle sec 8.9.5.2, bullet #4"); - // Java types containing value props can only contain properties of type - // ValuePropertyinfo and AttributePropertyInfo which have just been handled, - // so return. - return; - } - - // we didn't fall into the special case for value props, so we - // need to initialize the ct. - // generate the complexType - ComplexType ct = ((ComplexTypeHost)parent).complexType(); - writeName(c,ct); - if(c.isFinal()) - ct._final("extension restriction"); - if(c.isAbstract()) - ct._abstract(true); - - // these are where we write content model and attributes - AttrDecls contentModel = ct; - TypeDefParticle contentModelOwner = ct; - - // if there is a base class, we need to generate an extension in the schema - final ClassInfo bc = c.getBaseClass(); - if (bc != null) { - if(bc.hasValueProperty()) { - // extending complex type with simple content - SimpleExtension se = ct.simpleContent().extension(); - contentModel = se; - contentModelOwner = null; - se.base(bc.getTypeName()); - } else { - ComplexExtension ce = ct.complexContent().extension(); - contentModel = ce; - contentModelOwner = ce; - - ce.base(bc.getTypeName()); - // TODO: what if the base type is anonymous? - } - } - - if(contentModelOwner!=null) { - // build the tree that represents the explicit content model from iterate over the properties - ArrayList children = new ArrayList(); - for (PropertyInfo p : c.getProperties()) { - // handling for - if(p instanceof ReferencePropertyInfo && ((ReferencePropertyInfo)p).isMixed()) { - ct.mixed(true); - } - Tree t = buildPropertyContentModel(p); - if(t!=null) - children.add(t); - } - - Tree top = Tree.makeGroup( c.isOrdered() ? GroupKind.SEQUENCE : GroupKind.ALL, children); - - // write the content model - top.write(contentModelOwner); - } - - // then attributes - for (PropertyInfo p : c.getProperties()) { - if (p instanceof AttributePropertyInfo) { - handleAttributeProp((AttributePropertyInfo)p, contentModel); - } - } - if( c.hasAttributeWildcard()) { - contentModel.anyAttribute().namespace("##other").processContents("skip"); - } - ct.commit(); - } - - /** - * Writes the name attribute if it's named. - */ - private void writeName(NonElement c, TypedXmlWriter xw) { - QName tn = c.getTypeName(); - if(tn!=null) - xw._attribute("name",tn.getLocalPart()); // named - } - - private boolean containsValueProp(ClassInfo c) { - for (PropertyInfo p : c.getProperties()) { - if (p instanceof ValuePropertyInfo) return true; - } - return false; - } - - /** - * Builds content model writer for the specified property. - */ - private Tree buildPropertyContentModel(PropertyInfo p) { - switch(p.kind()) { - case ELEMENT: - return handleElementProp((ElementPropertyInfo)p); - case ATTRIBUTE: - // attribuets are handled later - return null; - case REFERENCE: - return handleReferenceProp((ReferencePropertyInfo)p); - case MAP: - return handleMapProp((MapPropertyInfo)p); - case VALUE: - // value props handled above in writeClass() - assert false; - throw new IllegalStateException(); - default: - assert false; - throw new IllegalStateException(); - } - } - - /** - * Generate the proper schema fragment for the given element property into the - * specified schema compositor. - * - * The element property may or may not represent a collection and it may or may - * not be wrapped. - * - * @param ep the element property - */ - private Tree handleElementProp(final ElementPropertyInfo ep) { - if (ep.isValueList()) { - return new Tree.Term() { - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - TypeRef t = ep.getTypes().get(0); - LocalElement e = parent.element(); - e.block(); // we will write occurs later - QName tn = t.getTagName(); - e.name(tn.getLocalPart()); - List lst = e.simpleType().list(); - writeTypeRef(lst,t, "itemType"); - elementFormDefault.writeForm(e,tn); - writeOccurs(e,isOptional||!ep.isRequired(),repeated); - } - }; - } - - ArrayList children = new ArrayList(); - for (final TypeRef t : ep.getTypes()) { - children.add(new Tree.Term() { - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - LocalElement e = parent.element(); - - QName tn = t.getTagName(); - - PropertyInfo propInfo = t.getSource(); - TypeInfo parentInfo = (propInfo == null) ? null : propInfo.parent(); - - if (canBeDirectElementRef(t, tn, parentInfo)) { - if ((!t.getTarget().isSimpleType()) && (t.getTarget() instanceof ClassInfo) && collisionChecker.findDuplicate((ClassInfo) t.getTarget())) { - e.ref(new QName(uri, tn.getLocalPart())); - } else { - - QName elemName = null; - if (t.getTarget() instanceof Element) { - Element te = (Element) t.getTarget(); - elemName = te.getElementName(); - } - - Collection refs = propInfo.ref(); - 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) { - if (tn.getNamespaceURI() != null && tn.getNamespaceURI().trim().length() != 0) { - e.ref(new QName(tn.getNamespaceURI(), tn.getLocalPart())); - } else { - e.ref(new QName(cImpl.getElementName().getNamespaceURI(), tn.getLocalPart())); - } - } else - e.ref(new QName("", tn.getLocalPart())); - } else - e.ref(tn); - } - } else { - e.name(tn.getLocalPart()); - writeTypeRef(e,t, "type"); - elementFormDefault.writeForm(e,tn); - } - - if (t.isNillable()) { - e.nillable(true); - } - if(t.getDefaultValue()!=null) - e._default(t.getDefaultValue()); - writeOccurs(e,isOptional,repeated); - } - }); - } - - final Tree choice = Tree.makeGroup(GroupKind.CHOICE, children) - .makeOptional(!ep.isRequired()) - .makeRepeated(ep.isCollection()); // see Spec table 8-13 - - - final QName ename = ep.getXmlName(); - if (ename != null) { // wrapped collection - return new Tree.Term() { - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - LocalElement e = parent.element(); - if(ename.getNamespaceURI().length()>0) { - if (!ename.getNamespaceURI().equals(uri)) { - // TODO: we need to generate the corresponding element declaration for this - // table 8-25: Property/field element wrapper with ref attribute - e.ref(new QName(ename.getNamespaceURI(), ename.getLocalPart())); - return; - } - } - e.name(ename.getLocalPart()); - elementFormDefault.writeForm(e,ename); - - if(ep.isCollectionNillable()) { - e.nillable(true); - } - writeOccurs(e,!ep.isCollectionRequired(),repeated); - - ComplexType p = e.complexType(); - choice.write(p); - } - }; - } else {// non-wrapped - return choice; - } - } - - /** - * Checks if we can collapse - * {@code } - * to {@code }. - * - * This is possible if we already have such declaration to begin with. - */ - private boolean canBeDirectElementRef(TypeRef t, QName tn, TypeInfo parentInfo) { - Element te = null; - ClassInfo ci = null; - QName targetTagName = null; - - if(t.isNillable() || t.getDefaultValue()!=null) { - // can't put those attributes on - return false; - } - - if (t.getTarget() instanceof Element) { - te = (Element) t.getTarget(); - targetTagName = te.getElementName(); - if (te instanceof ClassInfo) { - ci = (ClassInfo)te; - } - } - - String nsUri = tn.getNamespaceURI(); - if ((!nsUri.equals(uri) && nsUri.length()>0) && (!((parentInfo instanceof ClassInfo) && (((ClassInfo)parentInfo).getTypeName() == null)))) { - return true; - } - - if ((ci != null) && ((targetTagName != null) && (te.getScope() == null) && (targetTagName.getNamespaceURI() == null))) { - if (targetTagName.equals(tn)) { - return true; - } - } - - // we have the precise element defined already - if (te != null) { // it is instanceof Element - return targetTagName!=null && targetTagName.equals(tn); - } - - return false; - } - - - /** - * Generate an attribute for the specified property on the specified complexType - * - * @param ap the attribute - * @param attr the schema definition to which the attribute will be added - */ - private void handleAttributeProp(AttributePropertyInfo ap, AttrDecls attr) { - // attr is either a top-level ComplexType or a ComplexExtension - // - // [RESULT] - // - // - // <...>... - // - // - // - // or - // - // - // - // - // <...>... - // - // - // - // - // - // or it could also be an in-lined type (attr ref) - // - LocalAttribute localAttribute = attr.attribute(); - - final String attrURI = ap.getXmlName().getNamespaceURI(); - if (attrURI.equals("") /*|| attrURI.equals(uri) --- those are generated as global attributes anyway, so use them.*/) { - localAttribute.name(ap.getXmlName().getLocalPart()); - - writeAttributeTypeRef(ap, localAttribute); - - attributeFormDefault.writeForm(localAttribute,ap.getXmlName()); - } else { // generate an attr ref - localAttribute.ref(ap.getXmlName()); - } - - if(ap.isRequired()) { - // TODO: not type safe - localAttribute.use("required"); - } - } - - private void writeAttributeTypeRef(AttributePropertyInfo ap, AttributeType a) { - if( ap.isCollection() ) - writeTypeRef(a.simpleType().list(), ap, "itemType"); - else - writeTypeRef(a, ap, "type"); - } - - /** - * Generate the proper schema fragment for the given reference property into the - * specified schema compositor. - * - * The reference property may or may not refer to a collection and it may or may - * not be wrapped. - */ - private Tree handleReferenceProp(final ReferencePropertyInfo rp) { - // fill in content model - ArrayList children = new ArrayList(); - - for (final Element e : rp.getElements()) { - children.add(new Tree.Term() { - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - LocalElement eref = parent.element(); - - boolean local=false; - - QName en = e.getElementName(); - if(e.getScope()!=null) { - // scoped. needs to be inlined - boolean qualified = en.getNamespaceURI().equals(uri); - boolean unqualified = en.getNamespaceURI().equals(""); - if(qualified || unqualified) { - // can be inlined indeed - - // write form="..." if necessary - if(unqualified) { - if(elementFormDefault.isEffectivelyQualified) - eref.form("unqualified"); - } else { - if(!elementFormDefault.isEffectivelyQualified) - eref.form("qualified"); - } - - local = true; - eref.name(en.getLocalPart()); - - // write out type reference - if(e instanceof ClassInfo) { - writeTypeRef(eref,(ClassInfo)e,"type"); - } else { - writeTypeRef(eref,((ElementInfo)e).getContentType(),"type"); - } - } - } - if(!local) - eref.ref(en); - writeOccurs(eref,isOptional,repeated); - } - }); - } - - final WildcardMode wc = rp.getWildcard(); - if( wc != null ) { - children.add(new Tree.Term() { - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - Any any = parent.any(); - final String pcmode = getProcessContentsModeName(wc); - if( pcmode != null ) any.processContents(pcmode); - any.namespace("##other"); - writeOccurs(any,isOptional,repeated); - } - }); - } - - - final Tree choice = Tree.makeGroup(GroupKind.CHOICE, children).makeRepeated(rp.isCollection()).makeOptional(!rp.isRequired()); - - final QName ename = rp.getXmlName(); - - if (ename != null) { // wrapped - return new Tree.Term() { - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - LocalElement e = parent.element().name(ename.getLocalPart()); - elementFormDefault.writeForm(e,ename); - if(rp.isCollectionNillable()) - e.nillable(true); - writeOccurs(e,true,repeated); - - ComplexType p = e.complexType(); - choice.write(p); - } - }; - } else { // unwrapped - return choice; - } - } - - /** - * Generate the proper schema fragment for the given map property into the - * specified schema compositor. - * - * @param mp the map property - */ - private Tree handleMapProp(final MapPropertyInfo mp) { - return new Tree.Term() { - protected void write(ContentModelContainer parent, boolean isOptional, boolean repeated) { - QName ename = mp.getXmlName(); - - LocalElement e = parent.element(); - elementFormDefault.writeForm(e,ename); - if(mp.isCollectionNillable()) - e.nillable(true); - - e = e.name(ename.getLocalPart()); - writeOccurs(e,isOptional,repeated); - ComplexType p = e.complexType(); - - // TODO: entry, key, and value are always unqualified. that needs to be fixed, too. - // TODO: we need to generate the corresponding element declaration, if they are qualified - e = p.sequence().element(); - e.name("entry").minOccurs(0).maxOccurs("unbounded"); - - ExplicitGroup seq = e.complexType().sequence(); - writeKeyOrValue(seq, "key", mp.getKeyType()); - writeKeyOrValue(seq, "value", mp.getValueType()); - } - }; - } - - private void writeKeyOrValue(ExplicitGroup seq, String tagName, NonElement typeRef) { - LocalElement key = seq.element().name(tagName); - key.minOccurs(0); - writeTypeRef(key, typeRef, "type"); - } - - public void addGlobalAttribute(AttributePropertyInfo ap) { - attributeDecls.put( ap.getXmlName().getLocalPart(), ap ); - addDependencyTo(ap.getTarget().getTypeName()); - } - - public void addGlobalElement(TypeRef tref) { - elementDecls.put( tref.getTagName().getLocalPart(), new ElementWithType(false,tref.getTarget()) ); - addDependencyTo(tref.getTarget().getTypeName()); - } - - @Override - public String toString() { - StringBuilder buf = new StringBuilder(); - buf.append("[classes=").append(classes); - buf.append(",elementDecls=").append(elementDecls); - buf.append(",enums=").append(enums); - buf.append("]"); - return super.toString(); - } - - /** - * Represents a global element declaration to be written. - * - *

- * Because multiple properties can name the same global element even if - * they have different Java type, the schema generator first needs to - * walk through the model and decide what to generate for the given - * element declaration. - * - *

- * This class represents what will be written, and its {@link #equals(Object)} - * method is implemented in such a way that two identical declarations - * are considered as the same. - */ - abstract class ElementDeclaration { - /** - * Returns true if two {@link ElementDeclaration}s are representing - * the same schema fragment. - */ - @Override - public abstract boolean equals(Object o); - @Override - public abstract int hashCode(); - - /** - * Generates the declaration. - */ - public abstract void writeTo(String localName, Schema schema); - } - - /** - * {@link ElementDeclaration} that refers to a {@link NonElement}. - */ - class ElementWithType extends ElementDeclaration { - private final boolean nillable; - private final NonElement type; - - public ElementWithType(boolean nillable,NonElement type) { - this.type = type; - this.nillable = nillable; - } - - public void writeTo(String localName, Schema schema) { - TopLevelElement e = schema.element().name(localName); - if(nillable) - e.nillable(true); - if (type != null) { - writeTypeRef(e,type, "type"); - } else { - e.complexType(); // refer to the nested empty complex type - } - e.commit(); - } - - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - final ElementWithType that = (ElementWithType) o; - return type.equals(that.type); - } - - public int hashCode() { - return type.hashCode(); - } - } - } - - /** - * Examine the specified element ref and determine if a swaRef attribute needs to be generated - * @param typeRef - */ - private boolean generateSwaRefAdapter(NonElementRef typeRef) { - return generateSwaRefAdapter(typeRef.getSource()); - } - - /** - * Examine the specified element ref and determine if a swaRef attribute needs to be generated - */ - private boolean generateSwaRefAdapter(PropertyInfo prop) { - final Adapter adapter = prop.getAdapter(); - if (adapter == null) return false; - final Object o = navigator.asDecl(SwaRefAdapter.class); - if (o == null) return false; - return (o.equals(adapter.adapterType)); - } - - /** - * Debug information of what's in this {@link XmlSchemaGenerator}. - */ - @Override - public String toString() { - StringBuilder buf = new StringBuilder(); - for (Namespace ns : namespaces.values()) { - if(buf.length()>0) buf.append(','); - buf.append(ns.uri).append('=').append(ns); - } - return super.toString()+'['+buf+']'; - } - - /** - * return the string representation of the processContents mode of the - * give wildcard, or null if it is the schema default "strict" - * - */ - private static String getProcessContentsModeName(WildcardMode wc) { - switch(wc) { - case LAX: - case SKIP: - return wc.name().toLowerCase(); - case STRICT: - return null; - default: - throw new IllegalStateException(); - } - } - - - /** - * Relativizes a URI by using another URI (base URI.) - * - *

- * For example, {@code relative("http://www.sun.com/abc/def","http://www.sun.com/pqr/stu") => "../abc/def"} - * - *

- * This method only works on hierarchical URI's, not opaque URI's (refer to the - * java.net.URI - * javadoc for complete definitions of these terms. - * - *

- * This method will not normalize the relative URI. - * - * @return the relative URI or the original URI if a relative one could not be computed - */ - protected static String relativize(String uri, String baseUri) { - try { - assert uri!=null; - - if(baseUri==null) return uri; - - URI theUri = new URI(escapeURI(uri)); - URI theBaseUri = new URI(escapeURI(baseUri)); - - if (theUri.isOpaque() || theBaseUri.isOpaque()) - return uri; - - if (!equalsIgnoreCase(theUri.getScheme(), theBaseUri.getScheme()) || - !equal(theUri.getAuthority(), theBaseUri.getAuthority())) - return uri; - - String uriPath = theUri.getPath(); - String basePath = theBaseUri.getPath(); - - // normalize base path - if (!basePath.endsWith("/")) { - basePath = normalizeUriPath(basePath); - } - - if( uriPath.equals(basePath)) - return "."; - - String relPath = calculateRelativePath(uriPath, basePath, fixNull(theUri.getScheme()).equals("file")); - - if (relPath == null) - return uri; // recursion found no commonality in the two uris at all - StringBuilder relUri = new StringBuilder(); - relUri.append(relPath); - if (theUri.getQuery() != null) - relUri.append('?').append(theUri.getQuery()); - if (theUri.getFragment() != null) - relUri.append('#').append(theUri.getFragment()); - - return relUri.toString(); - } catch (URISyntaxException e) { - throw new InternalError("Error escaping one of these uris:\n\t"+uri+"\n\t"+baseUri); - } - } - - private static String fixNull(String s) { - if(s==null) return ""; - else return s; - } - - private static String calculateRelativePath(String uri, String base, boolean fileUrl) { - // if this is a file URL (very likely), and if this is on a case-insensitive file system, - // then treat it accordingly. - boolean onWindows = File.pathSeparatorChar==';'; - - if (base == null) { - return null; - } - if ((fileUrl && onWindows && startsWithIgnoreCase(uri,base)) || uri.startsWith(base)) { - return uri.substring(base.length()); - } else { - return "../" + calculateRelativePath(uri, getParentUriPath(base), fileUrl); - } - } - - private static boolean startsWithIgnoreCase(String s, String t) { - return s.toUpperCase().startsWith(t.toUpperCase()); - } - - /** - * JAX-RPC wants the namespaces to be sorted in the reverse order - * so that the empty namespace "" comes to the very end. Don't ask me why. - */ - private static final Comparator NAMESPACE_COMPARATOR = new Comparator() { - public int compare(String lhs, String rhs) { - return -lhs.compareTo(rhs); - } - }; - - private static final String newline = "\n"; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/episode/Bindings.java 2018-01-30 20:35:46.000000000 -0500 +++ /dev/null 2018-01-30 20:35:46.000000000 -0500 @@ -1,62 +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.xml.internal.bind.v2.schemagen.episode; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -/** - * @author Kohsuke Kawaguchi - */ -@XmlElement("bindings") -public interface Bindings extends TypedXmlWriter { - /** - * Nested bindings. - */ - @XmlElement - Bindings bindings(); - - /** - * Nested class customization. - */ - @XmlElement("class") - Klass klass(); - - /** - * Nested typesafeEnumClass customization - */ - Klass typesafeEnumClass(); - - @XmlElement - SchemaBindings schemaBindings(); - - @XmlAttribute - void scd(String scd); - - @XmlAttribute - void version(String v); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/episode/Klass.java 2018-01-30 20:35:47.000000000 -0500 +++ /dev/null 2018-01-30 20:35:47.000000000 -0500 @@ -1,40 +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.xml.internal.bind.v2.schemagen.episode; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -/** - * @author Kohsuke Kawaguchi - */ -public interface Klass extends TypedXmlWriter { - /** - * FQCN. - */ - @XmlAttribute - void ref(String className); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/episode/Package.java 2018-01-30 20:35:47.000000000 -0500 +++ /dev/null 2018-01-30 20:35:47.000000000 -0500 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2011, 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.xml.internal.bind.v2.schemagen.episode; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -public interface Package extends TypedXmlWriter{ - - @XmlAttribute - void name(String packageName); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/episode/SchemaBindings.java 2018-01-30 20:35:48.000000000 -0500 +++ /dev/null 2018-01-30 20:35:48.000000000 -0500 @@ -1,41 +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.xml.internal.bind.v2.schemagen.episode; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - * @author Kohsuke Kawaguchi - */ -public interface SchemaBindings extends TypedXmlWriter { - @XmlAttribute - void map(boolean value); - - @XmlElement("package") - Package _package(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/episode/package-info.java 2018-01-30 20:35:49.000000000 -0500 +++ /dev/null 2018-01-30 20:35:49.000000000 -0500 @@ -1,34 +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. - */ - -/** - * TXW interfaces for writing episode file, which is what XJC needs to - * handle separate compilation. - */ -@XmlNamespace(WellKnownNamespace.JAXB) -package com.sun.xml.internal.bind.v2.schemagen.episode; - -import com.sun.xml.internal.txw2.annotation.XmlNamespace; -import com.sun.xml.internal.bind.v2.WellKnownNamespace; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/package-info.java 2018-01-30 20:35:49.000000000 -0500 +++ /dev/null 2018-01-30 20:35:50.000000000 -0500 @@ -1,34 +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. - */ - -/** - * Schema generator. - * - * This package hosts the code that generates schemas from - * {@link TypeInfoSet} (without the user interface.) - */ -package com.sun.xml.internal.bind.v2.schemagen; - -import com.sun.xml.internal.bind.v2.model.core.TypeInfoSet; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Annotated.java 2018-01-30 20:35:50.000000000 -0500 +++ /dev/null 2018-01-30 20:35:50.000000000 -0500 @@ -1,48 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface Annotated - extends TypedXmlWriter -{ - - - @XmlElement - public Annotation annotation(); - - @XmlAttribute - public Annotated id(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Annotation.java 2018-01-30 20:35:51.000000000 -0500 +++ /dev/null 2018-01-30 20:35:51.000000000 -0500 @@ -1,52 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("annotation") -public interface Annotation - extends TypedXmlWriter -{ - - - @XmlElement - public Appinfo appinfo(); - - @XmlElement - public Documentation documentation(); - - @XmlAttribute - public Annotation id(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Any.java 2018-01-30 20:35:52.000000000 -0500 +++ /dev/null 2018-01-30 20:35:52.000000000 -0500 @@ -1,42 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("any") -public interface Any - extends Occurs, Wildcard, TypedXmlWriter -{ - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Appinfo.java 2018-01-30 20:35:53.000000000 -0500 +++ /dev/null 2018-01-30 20:35:53.000000000 -0500 @@ -1,46 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("appinfo") -public interface Appinfo - extends TypedXmlWriter -{ - - - @XmlAttribute - public Appinfo source(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/AttrDecls.java 2018-01-30 20:35:53.000000000 -0500 +++ /dev/null 2018-01-30 20:35:54.000000000 -0500 @@ -1,47 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface AttrDecls - extends TypedXmlWriter -{ - - - @XmlElement - public LocalAttribute attribute(); - - @XmlElement - public Wildcard anyAttribute(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/AttributeType.java 2018-01-30 20:35:54.000000000 -0500 +++ /dev/null 2018-01-30 20:35:54.000000000 -0500 @@ -1,45 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface AttributeType - extends SimpleTypeHost, TypedXmlWriter -{ - - - @XmlAttribute - public AttributeType type(QName value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ComplexContent.java 2018-01-30 20:35:55.000000000 -0500 +++ /dev/null 2018-01-30 20:35:55.000000000 -0500 @@ -1,52 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("complexContent") -public interface ComplexContent - extends Annotated, TypedXmlWriter -{ - - - @XmlElement - public ComplexExtension extension(); - - @XmlElement - public ComplexRestriction restriction(); - - @XmlAttribute - public ComplexContent mixed(boolean value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ComplexExtension.java 2018-01-30 20:35:56.000000000 -0500 +++ /dev/null 2018-01-30 20:35:56.000000000 -0500 @@ -1,42 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("extension") -public interface ComplexExtension - extends AttrDecls, ExtensionType, TypeDefParticle, TypedXmlWriter -{ - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ComplexRestriction.java 2018-01-30 20:35:57.000000000 -0500 +++ /dev/null 2018-01-30 20:35:57.000000000 -0500 @@ -1,47 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("restriction") -public interface ComplexRestriction - extends Annotated, AttrDecls, TypeDefParticle, TypedXmlWriter -{ - - - @XmlAttribute - public ComplexRestriction base(QName value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ComplexType.java 2018-01-30 20:35:58.000000000 -0500 +++ /dev/null 2018-01-30 20:35:58.000000000 -0500 @@ -1,61 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("complexType") -public interface ComplexType - extends Annotated, ComplexTypeModel, TypedXmlWriter -{ - - - @XmlAttribute("final") - public ComplexType _final(String[] value); - - @XmlAttribute("final") - public ComplexType _final(String value); - - @XmlAttribute - public ComplexType block(String[] value); - - @XmlAttribute - public ComplexType block(String value); - - @XmlAttribute("abstract") - public ComplexType _abstract(boolean value); - - @XmlAttribute - public ComplexType name(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ComplexTypeHost.java 2018-01-30 20:35:59.000000000 -0500 +++ /dev/null 2018-01-30 20:35:59.000000000 -0500 @@ -1,44 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface ComplexTypeHost - extends TypeHost, TypedXmlWriter -{ - - - @XmlElement - public ComplexType complexType(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ComplexTypeModel.java 2018-01-30 20:35:59.000000000 -0500 +++ /dev/null 2018-01-30 20:35:59.000000000 -0500 @@ -1,51 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface ComplexTypeModel - extends AttrDecls, TypeDefParticle, TypedXmlWriter -{ - - - @XmlElement - public SimpleContent simpleContent(); - - @XmlElement - public ComplexContent complexContent(); - - @XmlAttribute - public ComplexTypeModel mixed(boolean value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ContentModelContainer.java 2018-01-30 20:36:00.000000000 -0500 +++ /dev/null 2018-01-30 20:36:00.000000000 -0500 @@ -1,53 +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.xml.internal.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - * Used to write a content model. - * - * This mixes the particle and model group as the child of complex type. - * - * @author Kohsuke Kawaguchi - */ -public interface ContentModelContainer extends TypedXmlWriter { - @XmlElement - LocalElement element(); - - @XmlElement - Any any(); - - @XmlElement - ExplicitGroup all(); - - @XmlElement - ExplicitGroup sequence(); - - @XmlElement - ExplicitGroup choice(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Documentation.java 2018-01-30 20:36:01.000000000 -0500 +++ /dev/null 2018-01-30 20:36:01.000000000 -0500 @@ -1,49 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("documentation") -public interface Documentation - extends TypedXmlWriter -{ - - - @XmlAttribute - public Documentation source(String value); - - @XmlAttribute(ns = "http://www.w3.org/XML/1998/namespace") - public Documentation lang(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Element.java 2018-01-30 20:36:02.000000000 -0500 +++ /dev/null 2018-01-30 20:36:02.000000000 -0500 @@ -1,54 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface Element - extends Annotated, ComplexTypeHost, FixedOrDefault, SimpleTypeHost, TypedXmlWriter -{ - - - @XmlAttribute - public Element type(QName value); - - @XmlAttribute - public Element block(String[] value); - - @XmlAttribute - public Element block(String value); - - @XmlAttribute - public Element nillable(boolean value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ExplicitGroup.java 2018-01-30 20:36:02.000000000 -0500 +++ /dev/null 2018-01-30 20:36:02.000000000 -0500 @@ -1,40 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface ExplicitGroup - extends Annotated, NestedParticle, Occurs, TypedXmlWriter -{ - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/ExtensionType.java 2018-01-30 20:36:03.000000000 -0500 +++ /dev/null 2018-01-30 20:36:03.000000000 -0500 @@ -1,45 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface ExtensionType - extends Annotated, TypedXmlWriter -{ - - - @XmlAttribute - public ExtensionType base(QName value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/FixedOrDefault.java 2018-01-30 20:36:04.000000000 -0500 +++ /dev/null 2018-01-30 20:36:04.000000000 -0500 @@ -1,47 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface FixedOrDefault - extends TypedXmlWriter -{ - - - @XmlAttribute("default") - public FixedOrDefault _default(String value); - - @XmlAttribute - public FixedOrDefault fixed(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Import.java 2018-01-30 20:36:05.000000000 -0500 +++ /dev/null 2018-01-30 20:36:05.000000000 -0500 @@ -1,49 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("import") -public interface Import - extends Annotated, TypedXmlWriter -{ - - - @XmlAttribute - public Import namespace(String value); - - @XmlAttribute - public Import schemaLocation(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/List.java 2018-01-30 20:36:05.000000000 -0500 +++ /dev/null 2018-01-30 20:36:05.000000000 -0500 @@ -1,47 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("list") -public interface List - extends Annotated, SimpleTypeHost, TypedXmlWriter -{ - - - @XmlAttribute - public List itemType(QName value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/LocalAttribute.java 2018-01-30 20:36:06.000000000 -0500 +++ /dev/null 2018-01-30 20:36:06.000000000 -0500 @@ -1,56 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("attribute") -public interface LocalAttribute - extends Annotated, AttributeType, FixedOrDefault, TypedXmlWriter -{ - - - @XmlAttribute - public LocalAttribute form(String value); - - @XmlAttribute - public LocalAttribute name(String value); - - @XmlAttribute - public LocalAttribute ref(QName value); - - @XmlAttribute - public LocalAttribute use(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/LocalElement.java 2018-01-30 20:36:07.000000000 -0500 +++ /dev/null 2018-01-30 20:36:07.000000000 -0500 @@ -1,53 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("element") -public interface LocalElement - extends Element, Occurs, TypedXmlWriter -{ - - - @XmlAttribute - public LocalElement form(String value); - - @XmlAttribute - public LocalElement name(String value); - - @XmlAttribute - public LocalElement ref(QName value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/NestedParticle.java 2018-01-30 20:36:08.000000000 -0500 +++ /dev/null 2018-01-30 20:36:08.000000000 -0500 @@ -1,53 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface NestedParticle - extends TypedXmlWriter -{ - - - @XmlElement - public LocalElement element(); - - @XmlElement - public Any any(); - - @XmlElement - public ExplicitGroup sequence(); - - @XmlElement - public ExplicitGroup choice(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/NoFixedFacet.java 2018-01-30 20:36:08.000000000 -0500 +++ /dev/null 2018-01-30 20:36:08.000000000 -0500 @@ -1,44 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface NoFixedFacet - extends Annotated, TypedXmlWriter -{ - - - @XmlAttribute - public NoFixedFacet value(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Occurs.java 2018-01-30 20:36:09.000000000 -0500 +++ /dev/null 2018-01-30 20:36:09.000000000 -0500 @@ -1,50 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface Occurs - extends TypedXmlWriter -{ - - - @XmlAttribute - public Occurs minOccurs(int value); - - @XmlAttribute - public Occurs maxOccurs(String value); - - @XmlAttribute - public Occurs maxOccurs(int value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Particle.java 2018-01-30 20:36:10.000000000 -0500 +++ /dev/null 2018-01-30 20:36:10.000000000 -0500 @@ -1,32 +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.xml.internal.bind.v2.schemagen.xmlschema; - -/** - * @author Kohsuke Kawaguchi - */ -public interface Particle extends ContentModelContainer, Occurs { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Redefinable.java 2018-01-30 20:36:11.000000000 -0500 +++ /dev/null 2018-01-30 20:36:11.000000000 -0500 @@ -1,40 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface Redefinable - extends ComplexTypeHost, SimpleTypeHost, TypedXmlWriter -{ - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Schema.java 2018-01-30 20:36:11.000000000 -0500 +++ /dev/null 2018-01-30 20:36:11.000000000 -0500 @@ -1,79 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("schema") -public interface Schema - extends SchemaTop, TypedXmlWriter -{ - - - @XmlElement - public Annotation annotation(); - - @XmlElement("import") - public Import _import(); - - @XmlAttribute - public Schema targetNamespace(String value); - - @XmlAttribute(ns = "http://www.w3.org/XML/1998/namespace") - public Schema lang(String value); - - @XmlAttribute - public Schema id(String value); - - @XmlAttribute - public Schema elementFormDefault(String value); - - @XmlAttribute - public Schema attributeFormDefault(String value); - - @XmlAttribute - public Schema blockDefault(String[] value); - - @XmlAttribute - public Schema blockDefault(String value); - - @XmlAttribute - public Schema finalDefault(String[] value); - - @XmlAttribute - public Schema finalDefault(String value); - - @XmlAttribute - public Schema version(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SchemaTop.java 2018-01-30 20:36:12.000000000 -0500 +++ /dev/null 2018-01-30 20:36:12.000000000 -0500 @@ -1,47 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface SchemaTop - extends Redefinable, TypedXmlWriter -{ - - - @XmlElement - public TopLevelAttribute attribute(); - - @XmlElement - public TopLevelElement element(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleContent.java 2018-01-30 20:36:13.000000000 -0500 +++ /dev/null 2018-01-30 20:36:13.000000000 -0500 @@ -1,48 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("simpleContent") -public interface SimpleContent - extends Annotated, TypedXmlWriter -{ - - - @XmlElement - public SimpleExtension extension(); - - @XmlElement - public SimpleRestriction restriction(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleDerivation.java 2018-01-30 20:36:13.000000000 -0500 +++ /dev/null 2018-01-30 20:36:13.000000000 -0500 @@ -1,50 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface SimpleDerivation - extends TypedXmlWriter -{ - - - @XmlElement - public SimpleRestriction restriction(); - - @XmlElement - public Union union(); - - @XmlElement - public List list(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleExtension.java 2018-01-30 20:36:14.000000000 -0500 +++ /dev/null 2018-01-30 20:36:14.000000000 -0500 @@ -1,42 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("extension") -public interface SimpleExtension - extends AttrDecls, ExtensionType, TypedXmlWriter -{ - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleRestriction.java 2018-01-30 20:36:15.000000000 -0500 +++ /dev/null 2018-01-30 20:36:15.000000000 -0500 @@ -1,42 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("restriction") -public interface SimpleRestriction - extends Annotated, AttrDecls, SimpleRestrictionModel, TypedXmlWriter -{ - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleRestrictionModel.java 2018-01-30 20:36:16.000000000 -0500 +++ /dev/null 2018-01-30 20:36:16.000000000 -0500 @@ -1,49 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface SimpleRestrictionModel - extends SimpleTypeHost, TypedXmlWriter -{ - - - @XmlAttribute - public SimpleRestrictionModel base(QName value); - - @XmlElement - public NoFixedFacet enumeration(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleType.java 2018-01-30 20:36:16.000000000 -0500 +++ /dev/null 2018-01-30 20:36:17.000000000 -0500 @@ -1,52 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("simpleType") -public interface SimpleType - extends Annotated, SimpleDerivation, TypedXmlWriter -{ - - - @XmlAttribute("final") - public SimpleType _final(String value); - - @XmlAttribute("final") - public SimpleType _final(String[] value); - - @XmlAttribute - public SimpleType name(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/SimpleTypeHost.java 2018-01-30 20:36:17.000000000 -0500 +++ /dev/null 2018-01-30 20:36:17.000000000 -0500 @@ -1,44 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface SimpleTypeHost - extends TypeHost, TypedXmlWriter -{ - - - @XmlElement - public SimpleType simpleType(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/TopLevelAttribute.java 2018-01-30 20:36:18.000000000 -0500 +++ /dev/null 2018-01-30 20:36:18.000000000 -0500 @@ -1,46 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("attribute") -public interface TopLevelAttribute - extends Annotated, AttributeType, FixedOrDefault, TypedXmlWriter -{ - - - @XmlAttribute - public TopLevelAttribute name(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/TopLevelElement.java 2018-01-30 20:36:19.000000000 -0500 +++ /dev/null 2018-01-30 20:36:19.000000000 -0500 @@ -1,59 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("element") -public interface TopLevelElement - extends Element, TypedXmlWriter -{ - - - @XmlAttribute("final") - public TopLevelElement _final(String[] value); - - @XmlAttribute("final") - public TopLevelElement _final(String value); - - @XmlAttribute("abstract") - public TopLevelElement _abstract(boolean value); - - @XmlAttribute - public TopLevelElement substitutionGroup(QName value); - - @XmlAttribute - public TopLevelElement name(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/TypeDefParticle.java 2018-01-30 20:36:20.000000000 -0500 +++ /dev/null 2018-01-30 20:36:20.000000000 -0500 @@ -1,50 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface TypeDefParticle - extends TypedXmlWriter -{ - - - @XmlElement - public ExplicitGroup all(); - - @XmlElement - public ExplicitGroup sequence(); - - @XmlElement - public ExplicitGroup choice(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/TypeHost.java 2018-01-30 20:36:21.000000000 -0500 +++ /dev/null 2018-01-30 20:36:21.000000000 -0500 @@ -1,40 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface TypeHost - extends TypedXmlWriter -{ - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Union.java 2018-01-30 20:36:22.000000000 -0500 +++ /dev/null 2018-01-30 20:36:22.000000000 -0500 @@ -1,47 +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.bind.v2.schemagen.xmlschema; - -import javax.xml.namespace.QName; -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; - -/** - *

- * Auto-generated, do not edit. - *

- */ -@XmlElement("union") -public interface Union - extends Annotated, SimpleTypeHost, TypedXmlWriter -{ - - - @XmlAttribute - public Union memberTypes(QName[] value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/Wildcard.java 2018-01-30 20:36:22.000000000 -0500 +++ /dev/null 2018-01-30 20:36:22.000000000 -0500 @@ -1,50 +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.bind.v2.schemagen.xmlschema; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.annotation.XmlAttribute; - -/** - *

- * Auto-generated, do not edit. - *

- */ -public interface Wildcard - extends Annotated, TypedXmlWriter -{ - - - @XmlAttribute - public Wildcard processContents(String value); - - @XmlAttribute - public Wildcard namespace(String[] value); - - @XmlAttribute - public Wildcard namespace(String value); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/schemagen/xmlschema/package-info.java 2018-01-30 20:36:23.000000000 -0500 +++ /dev/null 2018-01-30 20:36:23.000000000 -0500 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 1997, 2017, 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. - */ - -/** - * XML Schema writer generated by TXW. - */ -@com.sun.xml.internal.txw2.annotation.XmlNamespace("http://www.w3.org/2001/XMLSchema") -package com.sun.xml.internal.bind.v2.schemagen.xmlschema; --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/util/ByteArrayOutputStreamEx.java 2018-01-30 20:36:24.000000000 -0500 +++ /dev/null 2018-01-30 20:36:24.000000000 -0500 @@ -1,70 +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.xml.internal.bind.v2.util; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; - -import com.sun.xml.internal.bind.v2.runtime.unmarshaller.Base64Data; - -/** - * {@link ByteArrayOutputStream} with access to its raw buffer. - */ -public final class ByteArrayOutputStreamEx extends ByteArrayOutputStream { - public ByteArrayOutputStreamEx() { - } - - public ByteArrayOutputStreamEx(int size) { - super(size); - } - - public void set(Base64Data dt,String mimeType) { - dt.set(buf,count,mimeType); - } - - public byte[] getBuffer() { - return buf; - } - - /** - * Reads the given {@link InputStream} completely into the buffer. - */ - public void readFrom(InputStream is) throws IOException { - while(true) { - if(count==buf.length) { - // realllocate - byte[] data = new byte[buf.length*2]; - System.arraycopy(buf,0,data,0,buf.length); - buf = data; - } - - int sz = is.read(buf,count,buf.length-count); - if(sz<0) return; - count += sz; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/util/CollisionCheckStack.java 2018-01-30 20:36:25.000000000 -0500 +++ /dev/null 2018-01-30 20:36:25.000000000 -0500 @@ -1,221 +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.xml.internal.bind.v2.util; - -import java.util.AbstractList; -import java.util.Arrays; -import java.util.List; -import java.util.Stack; - -/** - * {@link Stack}-like data structure that allows the following efficient operations: - * - *
    - *
  1. Push/pop operation. - *
  2. Duplicate check. When an object that's already in the stack is pushed, - * this class will tell you so. - *
- * - *

- * Object equality is their identity equality. - * - *

- * This class implements {@link List} for accessing items in the stack, - * but {@link List} methods that alter the stack is not supported. - * - * @author Kohsuke Kawaguchi - */ -public final class CollisionCheckStack extends AbstractList { - private Object[] data; - private int[] next; - private int size = 0; - - private boolean latestPushResult = false; - - /** - * True if the check shall be done by using the object identity. - * False if the check shall be done with the equals method. - */ - private boolean useIdentity = true; - - // for our purpose, there isn't much point in resizing this as we don't expect - // the stack to grow that much. - private final int[] initialHash; - - public CollisionCheckStack() { - initialHash = new int[17]; - data = new Object[16]; - next = new int[16]; - } - - /** - * Set to false to use {@link Object#equals(Object)} to detect cycles. - * This method can be only used when the stack is empty. - */ - public void setUseIdentity(boolean useIdentity) { - this.useIdentity = useIdentity; - } - - public boolean getUseIdentity() { - return useIdentity; - } - - public boolean getLatestPushResult() { - return latestPushResult; - } - - /** - * Pushes a new object to the stack. - * - * @return - * true if this object has already been pushed - */ - public boolean push(E o) { - if(data.length==size) - expandCapacity(); - - data[size] = o; - int hash = hash(o); - boolean r = findDuplicate(o, hash); - next[size] = initialHash[hash]; - initialHash[hash] = size+1; - size++; - this.latestPushResult = r; - return latestPushResult; - } - - /** - * Pushes a new object to the stack without making it participate - * with the collision check. - */ - public void pushNocheck(E o) { - if(data.length==size) - expandCapacity(); - data[size] = o; - next[size] = -1; - size++; - } - - public boolean findDuplicate(E o) { - int hash = hash(o); - return findDuplicate(o, hash); - } - - @Override - public E get(int index) { - return (E)data[index]; - } - - @Override - public int size() { - return size; - } - - private int hash(Object o) { - return ((useIdentity?System.identityHashCode(o):o.hashCode())&0x7FFFFFFF) % initialHash.length; - } - - /** - * Pops an object from the stack - */ - public E pop() { - size--; - Object o = data[size]; - data[size] = null; // keeping references too long == memory leak - int n = next[size]; - if(n<0) { - // pushed by nocheck. no need to update hash - } else { - int hash = hash(o); - assert initialHash[hash]==size+1; - initialHash[hash] = n; - } - return (E)o; - } - - /** - * Returns the top of the stack. - */ - public E peek() { - return (E)data[size-1]; - } - - private boolean findDuplicate(E o, int hash) { - int p = initialHash[hash]; - while(p!=0) { - p--; - Object existing = data[p]; - if (useIdentity) { - if(existing==o) return true; - } else { - if (o.equals(existing)) return true; - } - p = next[p]; - } - return false; - } - - private void expandCapacity() { - int oldSize = data.length; - int newSize = oldSize * 2; - Object[] d = new Object[newSize]; - int[] n = new int[newSize]; - - System.arraycopy(data,0,d,0,oldSize); - System.arraycopy(next,0,n,0,oldSize); - - data = d; - next = n; - } - - /** - * Clears all the contents in the stack. - */ - public void reset() { - if(size>0) { - size = 0; - Arrays.fill(initialHash,0); - } - } - - /** - * String that represents the cycle. - */ - public String getCycleString() { - StringBuilder sb = new StringBuilder(); - int i=size()-1; - E obj = get(i); - sb.append(obj); - Object x; - do { - sb.append(" -> "); - x = get(--i); - sb.append(x); - } while(obj!=x); - - return sb.toString(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/util/DataSourceSource.java 2018-01-30 20:36:25.000000000 -0500 +++ /dev/null 2018-01-30 20:36:25.000000000 -0500 @@ -1,123 +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.xml.internal.bind.v2.util; - -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; - -import javax.activation.DataHandler; -import javax.activation.DataSource; -import javax.activation.MimeType; -import javax.activation.MimeTypeParseException; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamSource; - -/** - * {@link Source} implementation backed by {@link DataHandler}. - * - *

- * This implementation allows the same {@link Source} to be used - * mutliple times. - * - *

- * {@link Source} isn't really pluggable. As a consequence, - * this implementation is clunky --- weak against unexpected - * usage of the class. - * - * @author Kohsuke Kawaguchi - */ -public final class DataSourceSource extends StreamSource { - private final DataSource source; - - /** - * If null, default to the encoding declaration - */ - private final String charset; - - // remember the value we returned so that the 2nd invocation - // will return the same object, which is what's expeted out of - // StreamSource - private Reader r; - private InputStream is; - - public DataSourceSource(DataHandler dh) throws MimeTypeParseException { - this(dh.getDataSource()); - } - - public DataSourceSource(DataSource source) throws MimeTypeParseException { - this.source = source; - - String ct = source.getContentType(); - if(ct==null) { - charset = null; - } else { - MimeType mimeType = new MimeType(ct); - this.charset = mimeType.getParameter("charset"); - } - } - - @Override - public void setReader(Reader reader) { - throw new UnsupportedOperationException(); - } - - @Override - public void setInputStream(InputStream inputStream) { - throw new UnsupportedOperationException(); - } - - @Override - public Reader getReader() { - try { - if(charset==null) return null; - if(r==null) - r = new InputStreamReader(source.getInputStream(),charset); - return r; - } catch (IOException e) { - // argh - throw new RuntimeException(e); - } - } - - @Override - public InputStream getInputStream() { - try { - if(charset!=null) return null; - if(is==null) - is = source.getInputStream(); - return is; - } catch (IOException e) { - // argh - throw new RuntimeException(e); - } - } - - public DataSource getDataSource() { - return source; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/util/EditDistance.java 2018-01-30 20:36:26.000000000 -0500 +++ /dev/null 2018-01-30 20:36:26.000000000 -0500 @@ -1,143 +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.bind.v2.util; - -import java.util.AbstractMap; -import java.util.Arrays; -import java.util.Collection; -import java.util.WeakHashMap; - -/** - * Computes the string edit distance. - * - *

- * Refer to a computer science text book for the definition - * of the "string edit distance". - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class EditDistance { - - /** - * Weak results cache to avoid additional computations. - * Because of high complexity caching is required. - */ - private static final WeakHashMap, Integer> CACHE = new WeakHashMap, Integer>(); - - /** - * Computes the edit distance between two strings. - * - *

- * The complexity is O(nm) where n=a.length() and m=b.length(). - */ - public static int editDistance( String a, String b ) { - // let's check cache - AbstractMap.SimpleEntry entry = new AbstractMap.SimpleEntry(a, b); // using this class to avoid creation of my own which will handle PAIR of values - Integer result = null; - if (CACHE.containsKey(entry)) - result = CACHE.get(entry); // looks like we have it - - if (result == null) { - result = new EditDistance(a, b).calc(); - CACHE.put(entry, result); // cache the result - } - return result; - } - - /** - * Finds the string in the group closest to - * key and returns it. - * - * @return null if group.length==0. - */ - public static String findNearest( String key, String[] group ) { - return findNearest(key, Arrays.asList(group)); - } - - /** - * Finds the string in the group closest to - * key and returns it. - * - * @return null if group.length==0. - */ - public static String findNearest( String key, Collection group ) { - int c = Integer.MAX_VALUE; - String r = null; - - for (String s : group) { - int ed = editDistance(key,s); - if( c>ed ) { - c = ed; - r = s; - } - } - return r; - } - - /** cost vector. */ - private int[] cost; - /** back buffer. */ - private int[] back; - - /** Two strings to be compared. */ - private final String a,b; - - private EditDistance( String a, String b ) { - this.a=a; - this.b=b; - cost = new int[a.length()+1]; - back = new int[a.length()+1]; // back buffer - - for( int i=0; i<=a.length(); i++ ) - cost[i] = i; - } - - /** - * Swaps two buffers. - */ - private void flip() { - int[] t = cost; - cost = back; - back = t; - } - - private int min(int a,int b,int c) { - return Math.min(a,Math.min(b,c)); - } - - private int calc() { - for( int j=0; j implements Iterator { - - private final Iterator> parent; - private Iterator child = null; - private T next; - - public FlattenIterator( Iterable> core ) { - this.parent = core.iterator(); - } - - - public void remove() { - throw new UnsupportedOperationException(); - } - - public boolean hasNext() { - getNext(); - return next!=null; - } - - public T next() { - T r = next; - next = null; - if(r==null) - throw new NoSuchElementException(); - return r; - } - - private void getNext() { - if(next!=null) return; - - if(child!=null && child.hasNext()) { - next = child.next(); - return; - } - // child is empty - if(parent.hasNext()) { - child = parent.next().values().iterator(); - getNext(); - } - // else - // no more object - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/util/QNameMap.java 2018-01-30 20:36:28.000000000 -0500 +++ /dev/null 2018-01-30 20:36:29.000000000 -0500 @@ -1,480 +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.xml.internal.bind.v2.util; -import java.util.AbstractSet; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Set; -import java.util.Map; -import java.util.Collection; -import java.util.HashSet; - -import javax.xml.namespace.QName; - -import com.sun.xml.internal.bind.v2.runtime.Name; - -/** - * Map keyed by {@link QName}. - * - * This specialized map allows a look up operation without constructing - * a new QName instance, for a performance reason. This {@link Map} assumes - * that both namespace URI and local name are {@link String#intern() intern}ed. - * - * @since JAXB 2.0 - */ -public final class QNameMap { - /** - * The default initial capacity - MUST be a power of two. - */ - private static final int DEFAULT_INITIAL_CAPACITY = 16; - - /** - * The maximum capacity, used if a higher value is implicitly specified - * by either of the constructors with arguments. - * MUST be a power of two <= 1<<30. - */ - private static final int MAXIMUM_CAPACITY = 1 << 30; - - /** - * The table, resized as necessary. Length MUST Always be a power of two. - */ - transient Entry[] table = new Entry[DEFAULT_INITIAL_CAPACITY]; - - /** - * The number of key-value mappings contained in this identity hash map. - */ - transient int size; - - /** - * The next size value at which to resize . Taking it as - * MAXIMUM_CAPACITY - * @serial - */ - private int threshold; - - /** - * The load factor used when none specified in constructor. - **/ - private static final float DEFAULT_LOAD_FACTOR = 0.75f; - - - - /** - * Gives an entrySet view of this map - */ - private Set> entrySet = null; - - public QNameMap() { - threshold = (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); - table = new Entry[DEFAULT_INITIAL_CAPACITY]; - - } - - /** - * Associates the specified value with the specified keys in this map. - * If the map previously contained a mapping for this key, the old - * value is replaced. - * - * @param namespaceUri First key with which the specified value is to be associated. - * @param localname Second key with which the specified value is to be associated. - * @param value value to be associated with the specified key. - * - */ - public void put(String namespaceUri,String localname, V value ) { - //keys cannot be null - assert localname !=null; - assert namespaceUri !=null; - // keys must be interned - assert localname == localname.intern(); - assert namespaceUri == namespaceUri.intern(); - - int hash = hash(localname); - int i = indexFor(hash, table.length); - - for (Entry e = table[i]; e != null; e = e.next) { - if (e.hash == hash && localname == e.localName && namespaceUri==e.nsUri) { - e.value = value; - return; - } - } - - addEntry(hash, namespaceUri,localname, value, i); - - } - - public void put(QName name, V value ) { - put(name.getNamespaceURI(),name.getLocalPart(),value); - } - - public void put(Name name, V value ) { - put(name.nsUri,name.localName,value); - } - - /** - * Returns the value to which the specified keys are mapped in this QNameMap, - * or {@code null} if the map contains no mapping for this key. - * - * @param nsUri the namespaceUri key whose associated value is to be returned. - * @param localPart the localPart key whose associated value is to be returned. - * @return the value to which this map maps the specified set of keya, or - * {@code null} if the map contains no mapping for this set of keys. - * @see #put(String,String, Object) - */ - public V get( String nsUri, String localPart ) { - Entry e = getEntry(nsUri,localPart); - if(e==null) return null; - else return e.value; - } - - public V get( QName name ) { - return get(name.getNamespaceURI(),name.getLocalPart()); - } - - /** - * Returns the number of keys-value mappings in this map. - * - * @return the number of keys-value mappings in this map. - */ - public int size() { - return size; - } - - /** - * Copies all of the mappings from the specified map to this map - * These mappings will replace any mappings that - * this map had for any of the keys currently in the specified map. - * - * @param map mappings to be stored in this map. - * - */ - public QNameMap putAll(QNameMap map) { - int numKeysToBeAdded = map.size(); - if (numKeysToBeAdded == 0) - return this; - - - if (numKeysToBeAdded > threshold) { - int targetCapacity = numKeysToBeAdded; - if (targetCapacity > MAXIMUM_CAPACITY) - targetCapacity = MAXIMUM_CAPACITY; - int newCapacity = table.length; - while (newCapacity < targetCapacity) - newCapacity <<= 1; - if (newCapacity > table.length) - resize(newCapacity); - } - - for( Entry e : map.entrySet() ) - put(e.nsUri,e.localName,e.getValue()); - return this; - } - - - /** - * Returns a hash value for the specified object.The hash value is computed - * for the localName. - */ - private static int hash(String x) { - int h = x.hashCode(); - - h += ~(h << 9); - h ^= (h >>> 14); - h += (h << 4); - h ^= (h >>> 10); - return h; - } - - /** - * Returns index for hash code h. - */ - private static int indexFor(int h, int length) { - return h & (length-1); - } - - /** - * Add a new entry with the specified keys, value and hash code to - * the specified bucket. It is the responsibility of this - * method to resize the table if appropriate. - * - */ - private void addEntry(int hash, String nsUri, String localName, V value, int bucketIndex) { - Entry e = table[bucketIndex]; - table[bucketIndex] = new Entry(hash, nsUri, localName, value, e); - if (size++ >= threshold) - resize(2 * table.length); - } - - - /** - * Rehashes the contents of this map into a new array with a - * larger capacity. This method is called automatically when the - * number of keys in this map reaches its threshold. - */ - private void resize(int newCapacity) { - Entry[] oldTable = table; - int oldCapacity = oldTable.length; - if (oldCapacity == MAXIMUM_CAPACITY) { - threshold = Integer.MAX_VALUE; - return; - } - - Entry[] newTable = new Entry[newCapacity]; - transfer(newTable); - table = newTable; - threshold = newCapacity; - } - - /** - * Transfer all entries from current table to newTable. - */ - private void transfer(Entry[] newTable) { - Entry[] src = table; - int newCapacity = newTable.length; - for (int j = 0; j < src.length; j++) { - Entry e = src[j]; - if (e != null) { - src[j] = null; - do { - Entry next = e.next; - int i = indexFor(e.hash, newCapacity); - e.next = newTable[i]; - newTable[i] = e; - e = next; - } while (e != null); - } - } - } - - /** - * Returns one random item in the map. - * If this map is empty, return null. - * - *

- * This method is useful to obtain the value from a map that only contains one element. - */ - public Entry getOne() { - for( Entry e : table ) { - if(e!=null) - return e; - } - return null; - } - - public Collection keySet() { - Set r = new HashSet(); - for (Entry e : entrySet()) { - r.add(e.createQName()); - } - return r; - } - - private abstract class HashIterator implements Iterator { - Entry next; // next entry to return - int index; // current slot - - HashIterator() { - Entry[] t = table; - int i = t.length; - Entry n = null; - if (size != 0) { // advance to first entry - while (i > 0 && (n = t[--i]) == null) {} - } - next = n; - index = i; - } - - public boolean hasNext() { - return next != null; - } - - Entry nextEntry() { - Entry e = next; - if (e == null) - throw new NoSuchElementException(); - - Entry n = e.next; - Entry[] t = table; - int i = index; - while (n == null && i > 0) - n = t[--i]; - index = i; - next = n; - return e; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - } - - public boolean containsKey(String nsUri,String localName) { - return getEntry(nsUri,localName)!=null; - } - - - /** - * Returns true if this map is empty. - */ - public boolean isEmpty() { - return size == 0; - } - - - public static final class Entry { - /** The namespace URI. */ - public final String nsUri; - - /** The localPart. */ - public final String localName; - - V value; - final int hash; - Entry next; - - /** - * Create new entry. - */ - Entry(int h, String nsUri, String localName, V v, Entry n) { - value = v; - next = n; - this.nsUri = nsUri; - this.localName = localName; - hash = h; - } - - /** - * Creates a new QName object from {@link #nsUri} and {@link #localName}. - */ - public QName createQName() { - return new QName(nsUri,localName); - } - - public V getValue() { - return value; - } - - public V setValue(V newValue) { - V oldValue = value; - value = newValue; - return oldValue; - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof Entry)) - return false; - Entry e = (Entry)o; - String k1 = nsUri; - String k2 = e.nsUri; - String k3 = localName; - String k4 = e.localName; - if (k1 == k2 || (k1 != null && k1.equals(k2)) && - (k3 == k4 ||(k3 !=null && k3.equals(k4)))) { - Object v1 = getValue(); - Object v2 = e.getValue(); - if (v1 == v2 || (v1 != null && v1.equals(v2))) - return true; - } - return false; - } - - @Override - public int hashCode() { - return ( localName.hashCode()) ^ - (value==null ? 0 : value.hashCode()); - } - - @Override - public String toString() { - return '"'+nsUri +"\",\"" +localName + "\"=" + getValue(); - } - } - - public Set> entrySet() { - Set> es = entrySet; - return es != null ? es : (entrySet = new EntrySet()); - } - - private Iterator> newEntryIterator() { - return new EntryIterator(); - } - - private class EntryIterator extends HashIterator> { - public Entry next() { - return nextEntry(); - } - } - private class EntrySet extends AbstractSet> { - public Iterator> iterator() { - return newEntryIterator(); - } - @Override - public boolean contains(Object o) { - if (!(o instanceof Entry)) - return false; - Entry e = (Entry) o; - Entry candidate = getEntry(e.nsUri,e.localName); - return candidate != null && candidate.equals(e); - } - @Override - public boolean remove(Object o) { - throw new UnsupportedOperationException(); - } - public int size() { - return size; - } - } - - private Entry getEntry(String nsUri,String localName) { - // strings must be interned - assert nsUri==nsUri.intern(); - assert localName==localName.intern(); - - int hash = hash(localName); - int i = indexFor(hash, table.length); - Entry e = table[i]; - while (e != null && !(localName == e.localName && nsUri == e.nsUri)) - e = e.next; - return e; - } - - @Override - public String toString() { - StringBuilder buf = new StringBuilder(); - buf.append('{'); - - for( Entry e : entrySet() ) { - if(buf.length()>1) - buf.append(','); - buf.append('['); - buf.append(e); - buf.append(']'); - } - - buf.append('}'); - return buf.toString(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/util/StackRecorder.java 2018-01-30 20:36:29.000000000 -0500 +++ /dev/null 2018-01-30 20:36:29.000000000 -0500 @@ -1,34 +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.xml.internal.bind.v2.util; - -/** - * Created to record the caller stack trace in logging. - * - * @author Kohsuke Kawaguchi - */ -public class StackRecorder extends Throwable { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/util/TypeCast.java 2018-01-30 20:36:30.000000000 -0500 +++ /dev/null 2018-01-30 20:36:30.000000000 -0500 @@ -1,48 +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.xml.internal.bind.v2.util; - -import java.util.Map; - -/** - * @author Kohsuke Kawaguchi - */ -public class TypeCast { - /** - * Makes sure that a map contains the right type, and returns it to the desirable type. - */ - public static Map checkedCast( Map m, Class keyType, Class valueType ) { - if(m==null) - return null; - for (Map.Entry e : m.entrySet()) { - if(!keyType.isInstance(e.getKey())) - throw new ClassCastException(e.getKey().getClass().toString()); - if(!valueType.isInstance(e.getValue())) - throw new ClassCastException(e.getValue().getClass().toString()); - } - return (Map)m; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java 2018-01-30 20:36:31.000000000 -0500 +++ /dev/null 2018-01-30 20:36:31.000000000 -0500 @@ -1,265 +0,0 @@ -/* - * Copyright (c) 2013, 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.bind.v2.util; - -import com.sun.xml.internal.bind.v2.Messages; - -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.TransformerConfigurationException; -import javax.xml.transform.TransformerFactory; -import javax.xml.validation.SchemaFactory; -import javax.xml.xpath.XPathFactory; -import javax.xml.xpath.XPathFactoryConfigurationException; - -import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; - -/** - * Provides helper methods for creating properly configured XML parser - * factory instances with namespace support turned on and configured for - * security. - * @author snajper - */ -public class XmlFactory { - - // not in older JDK, so must be duplicated here, otherwise javax.xml.XMLConstants should be used - public static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema"; - public static final String ACCESS_EXTERNAL_DTD = "http://javax.xml.XMLConstants/property/accessExternalDTD"; - - private static final Logger LOGGER = Logger.getLogger(XmlFactory.class.getName()); - - /** - * If true XML security features when parsing XML documents will be disabled. - * The default value is false. - * - * Boolean - * @since 2.2.6 - */ - private static final String DISABLE_XML_SECURITY = "com.sun.xml.internal.bind.disableXmlSecurity"; - - private static final boolean XML_SECURITY_DISABLED = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Boolean run() { - return Boolean.getBoolean(DISABLE_XML_SECURITY); - } - } - ); - - private static boolean isXMLSecurityDisabled(boolean runtimeSetting) { - return XML_SECURITY_DISABLED || runtimeSetting; - } - - /** - * Returns properly configured (e.g. security features) schema factory - * - namespaceAware == true - * - securityProcessing == is set based on security processing property, default is true - */ - public static SchemaFactory createSchemaFactory(final String language, boolean disableSecureProcessing) throws IllegalStateException { - try { - SchemaFactory factory = SchemaFactory.newInstance(language); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "SchemaFactory instance: {0}", factory); - } - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing)); - return factory; - } catch (SAXNotRecognizedException ex) { - LOGGER.log(Level.SEVERE, null, ex); - throw new IllegalStateException(ex); - } catch (SAXNotSupportedException ex) { - LOGGER.log(Level.SEVERE, null, ex); - throw new IllegalStateException(ex); - } catch (AbstractMethodError er) { - LOGGER.log(Level.SEVERE, null, er); - throw new IllegalStateException(Messages.INVALID_JAXP_IMPLEMENTATION.format(), er); - } - } - - /** - * Returns properly configured (e.g. security features) parser factory - * - namespaceAware == true - * - securityProcessing == is set based on security processing property, default is true - */ - public static SAXParserFactory createParserFactory(boolean disableSecureProcessing) throws IllegalStateException { - try { - SAXParserFactory factory = SAXParserFactory.newInstance(); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "SAXParserFactory instance: {0}", factory); - } - factory.setNamespaceAware(true); - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing)); - return factory; - } catch (ParserConfigurationException ex) { - LOGGER.log(Level.SEVERE, null, ex); - throw new IllegalStateException( ex); - } catch (SAXNotRecognizedException ex) { - LOGGER.log(Level.SEVERE, null, ex); - throw new IllegalStateException( ex); - } catch (SAXNotSupportedException ex) { - LOGGER.log(Level.SEVERE, null, ex); - throw new IllegalStateException( ex); - } catch (AbstractMethodError er) { - LOGGER.log(Level.SEVERE, null, er); - throw new IllegalStateException(Messages.INVALID_JAXP_IMPLEMENTATION.format(), er); - } - } - - /** - * Returns properly configured (e.g. security features) factory - * - securityProcessing == is set based on security processing property, default is true - */ - public static XPathFactory createXPathFactory(boolean disableSecureProcessing) throws IllegalStateException { - try { - XPathFactory factory = XPathFactory.newInstance(); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "XPathFactory instance: {0}", factory); - } - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing)); - return factory; - } catch (XPathFactoryConfigurationException ex) { - LOGGER.log(Level.SEVERE, null, ex); - throw new IllegalStateException( ex); - } catch (AbstractMethodError er) { - LOGGER.log(Level.SEVERE, null, er); - throw new IllegalStateException(Messages.INVALID_JAXP_IMPLEMENTATION.format(), er); - } - } - - /** - * Returns properly configured (e.g. security features) factory - * - securityProcessing == is set based on security processing property, default is true - */ - public static TransformerFactory createTransformerFactory(boolean disableSecureProcessing) throws IllegalStateException { - try { - TransformerFactory factory = TransformerFactory.newInstance(); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "TransformerFactory instance: {0}", factory); - } - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing)); - return factory; - } catch (TransformerConfigurationException ex) { - LOGGER.log(Level.SEVERE, null, ex); - throw new IllegalStateException( ex); - } catch (AbstractMethodError er) { - LOGGER.log(Level.SEVERE, null, er); - throw new IllegalStateException(Messages.INVALID_JAXP_IMPLEMENTATION.format(), er); - } - } - - /** - * Returns properly configured (e.g. security features) factory - * - namespaceAware == true - * - securityProcessing == is set based on security processing property, default is true - */ - public static DocumentBuilderFactory createDocumentBuilderFactory(boolean disableSecureProcessing) throws IllegalStateException { - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "DocumentBuilderFactory instance: {0}", factory); - } - factory.setNamespaceAware(true); - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing)); - return factory; - } catch (ParserConfigurationException ex) { - LOGGER.log(Level.SEVERE, null, ex); - throw new IllegalStateException( ex); - } catch (AbstractMethodError er) { - LOGGER.log(Level.SEVERE, null, er); - throw new IllegalStateException(Messages.INVALID_JAXP_IMPLEMENTATION.format(), er); - } - } - - public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { - - // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied - if (isXMLSecurityDisabled(disableSecureProcessing)) { - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); - } - return sf; - } - - if (System.getProperty("javax.xml.accessExternalSchema") != null) { - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); - } - return sf; - } - - try { - sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA)); - } - } catch (SAXException ignored) { - // nothing to do; support depends on version JDK or SAX implementation - if (LOGGER.isLoggable(Level.CONFIG)) { - LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored); - } - } - return sf; - } - - public static SchemaFactory allowExternalDTDAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) { - - // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied - if (isXMLSecurityDisabled(disableSecureProcessing)) { - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format()); - } - return sf; - } - - if (System.getProperty("javax.xml.accessExternalDTD") != null) { - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format()); - } - return sf; - } - - try { - sf.setProperty(ACCESS_EXTERNAL_DTD, value); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD)); - } - } catch (SAXException ignored) { - // nothing to do; support depends on version JDK or SAX implementation - if (LOGGER.isLoggable(Level.CONFIG)) { - LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD), ignored); - } - } - return sf; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/AbstractResourceBundle.java 2018-01-30 20:36:31.000000000 -0500 +++ /dev/null 2018-01-30 20:36:32.000000000 -0500 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -/* - * - * This code is subject to the freebxml License, Version 1.1 - * - * Copyright (c) 2001 - 2005 freebxml.org. All rights reserved. - * - * $Header: /zpool01/javanet/scm/svn/tmp/cvs2svn/fi/FastInfoset/src/com/sun/xml/internal/fastinfoset/AbstractResourceBundle.java,v 1.3.2.4 2009-05-13 08:53:01 oleksiys Exp $ - */ -package com.sun.xml.internal.fastinfoset; - -import java.text.MessageFormat; -import java.util.Enumeration; -import java.util.Locale; -import java.util.ResourceBundle; - - -/** - * This class contains methods common to all *ResourceBundle classes - * - * @author FastInfoset team - */ -public abstract class AbstractResourceBundle extends ResourceBundle { - - public static final String LOCALE = "com.sun.xml.internal.fastinfoset.locale"; - - /** - * Gets 'key' from ResourceBundle and format mesage using 'args'. - * - * @param key String key for message. - * @param args Array of arguments for message. - * @return String formatted message. - */ - public String getString(String key, Object args[]) { - String pattern = getBundle().getString(key); - return MessageFormat.format(pattern, args); - } - - /** - * Parse a locale string, return corresponding Locale instance. - * - * @param localeString - * Name for the locale of interest. If null, use VM default locale. - * @return New Locale instance. - */ - public static Locale parseLocale(String localeString) { - Locale locale = null; - if (localeString == null) { - locale = Locale.getDefault(); - } else { - try { - String[] args = localeString.split("_"); - if (args.length == 1) { - locale = new Locale(args[0]); - } else if (args.length == 2) { - locale = new Locale(args[0], args[1]); - } else if (args.length == 3) { - locale = new Locale(args[0], args[1], args[2]); - } - } catch (Throwable t) { - locale = Locale.getDefault(); - } - } - return locale; - } - - /** - * Subclasses of this class must implement this method so that the - * correct resource bundle is passed to methods in this class - * - * @return - * A java.util.ResourceBundle from the subsclass. Methods in this class - * will use this reference. - */ - public abstract ResourceBundle getBundle(); - - - /** - * Since we are changing the ResourceBundle extension point, must - * implement handleGetObject() using delegate getBundle(). Uses - * getObject() call to work around protected access to - * ResourceBundle.handleGetObject(). Happily, this means parent tree - * of delegate bundle is searched for a match. - * - * Implements java.util.ResourceBundle.handleGetObject; inherits that - * javadoc information. - * - * @see java.util.ResourceBundle#handleGetObject(String) - */ - protected Object handleGetObject(String key) { - return getBundle().getObject(key); - } - - /** - * Since we are changing the ResourceBundle extension point, must - * implement getKeys() using delegate getBundle(). - * - * Implements java.util.ResourceBundle.getKeys; inherits that javadoc - * information. - * - * @see java.util.ResourceBundle#getKeys() - */ - public final Enumeration getKeys() { - return getBundle().getKeys(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/CommonResourceBundle.java 2018-01-30 20:36:32.000000000 -0500 +++ /dev/null 2018-01-30 20:36:32.000000000 -0500 @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset; - -import java.util.Locale; -import java.util.ResourceBundle; - -/** Resource bundle implementation for localized messages. - */ -public class CommonResourceBundle extends AbstractResourceBundle { - - public static final String BASE_NAME = "com.sun.xml.internal.fastinfoset.resources.ResourceBundle"; - private static volatile CommonResourceBundle instance = null; - private static Locale locale = null; - private ResourceBundle bundle = null; - - protected CommonResourceBundle() { - // Load the resource bundle of default locale - bundle = ResourceBundle.getBundle(BASE_NAME); - } - - protected CommonResourceBundle(Locale locale) { - // Load the resource bundle of specified locale - bundle = ResourceBundle.getBundle(BASE_NAME, locale); - } - - public static CommonResourceBundle getInstance() { - if (instance == null) { - synchronized (CommonResourceBundle.class) { - instance = new CommonResourceBundle(); - //**need to know where to get the locale - //String localeString = CommonProperties.getInstance() - // .getProperty("omar.common.locale"); - locale = parseLocale(/*localeString*/null); - } - } - - return instance; - } - - public static CommonResourceBundle getInstance(Locale locale) { - if (instance == null) { - synchronized (CommonResourceBundle.class) { - instance = new CommonResourceBundle(locale); - } - } else { - synchronized (CommonResourceBundle.class) { - if (CommonResourceBundle.locale != locale) { - instance = new CommonResourceBundle(locale); - } - } - } - return instance; - } - - - public ResourceBundle getBundle() { - return bundle; - } - public ResourceBundle getBundle(Locale locale) { - return ResourceBundle.getBundle(BASE_NAME, locale); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/Decoder.java 2018-01-30 20:36:33.000000000 -0500 +++ /dev/null 2018-01-30 20:36:33.000000000 -0500 @@ -1,2010 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset; - -import com.sun.xml.internal.fastinfoset.alphabet.BuiltInRestrictedAlphabets; -import com.sun.xml.internal.fastinfoset.org.apache.xerces.util.XMLChar; -import com.sun.xml.internal.fastinfoset.util.CharArray; -import com.sun.xml.internal.fastinfoset.util.CharArrayArray; -import com.sun.xml.internal.fastinfoset.util.CharArrayString; -import com.sun.xml.internal.fastinfoset.util.ContiguousCharArrayArray; -import com.sun.xml.internal.fastinfoset.util.DuplicateAttributeVerifier; -import com.sun.xml.internal.fastinfoset.util.PrefixArray; -import com.sun.xml.internal.fastinfoset.util.QualifiedNameArray; -import com.sun.xml.internal.fastinfoset.util.StringArray; -import com.sun.xml.internal.fastinfoset.vocab.ParserVocabulary; -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetParser; - -/** - * Abstract decoder for developing concrete encoders. - * - * Concrete implementations extending Decoder will utilize methods on Decoder - * to decode XML infoset according to the Fast Infoset standard. It is the - * responsibility of the concrete implementation to ensure that methods are - * invoked in the correct order to correctly decode a valid fast infoset - * document. - * - *

- * This class extends org.sax.xml.DefaultHandler so that concrete SAX - * implementations can be used with javax.xml.parsers.SAXParser and the parse - * methods that take org.sax.xml.DefaultHandler as a parameter. - * - *

- * Buffering of octets that are read from an {@link java.io.InputStream} is - * supported in a similar manner to a {@link java.io.BufferedInputStream}. - * Combining buffering with decoding enables better performance. - * - *

- * More than one fast infoset document may be decoded from the - * {@link java.io.InputStream}. - */ -public abstract class Decoder implements FastInfosetParser { - - private static final char[] XML_NAMESPACE_NAME_CHARS = - EncodingConstants.XML_NAMESPACE_NAME.toCharArray(); - - private static final char[] XMLNS_NAMESPACE_PREFIX_CHARS = - EncodingConstants.XMLNS_NAMESPACE_PREFIX.toCharArray(); - - private static final char[] XMLNS_NAMESPACE_NAME_CHARS = - EncodingConstants.XMLNS_NAMESPACE_NAME.toCharArray(); - - /** - * String interning system property. - */ - public static final String STRING_INTERNING_SYSTEM_PROPERTY = - "com.sun.xml.internal.fastinfoset.parser.string-interning"; - - /** - * Internal buffer size interning system property. - */ - public static final String BUFFER_SIZE_SYSTEM_PROPERTY = - "com.sun.xml.internal.fastinfoset.parser.buffer-size"; - - private static boolean _stringInterningSystemDefault = false; - - private static int _bufferSizeSystemDefault = 1024; - - static { - String p = System.getProperty(STRING_INTERNING_SYSTEM_PROPERTY, - Boolean.toString(_stringInterningSystemDefault)); - _stringInterningSystemDefault = Boolean.valueOf(p).booleanValue(); - - p = System.getProperty(BUFFER_SIZE_SYSTEM_PROPERTY, - Integer.toString(_bufferSizeSystemDefault)); - try { - int i = Integer.valueOf(p).intValue(); - if (i > 0) { - _bufferSizeSystemDefault = i; - } - } catch (NumberFormatException e) { - } - } - - /** - * True if string interning is performed by the decoder. - */ - private boolean _stringInterning = _stringInterningSystemDefault; - - /** - * The input stream from which the fast infoset document is being read. - */ - private InputStream _s; - - /** - * The map of URIs to referenced vocabularies. - */ - private Map _externalVocabularies; - - /** - * True if can parse fragments. - */ - protected boolean _parseFragments; - - /** - * True if needs to close underlying input stream. - */ - protected boolean _needForceStreamClose; - - /** - * True if the vocabulary is internally created by decoder. - */ - private boolean _vIsInternal; - - /** - * The list of Notation Information Items that are part of the - * Document Information Item. - */ - protected List _notations; - - /** - * The list of Unparsed Entity Information Items that are part of the - * Document Information Item. - */ - protected List _unparsedEntities; - - /** - * The map of URIs to registered encoding algorithms. - */ - protected Map _registeredEncodingAlgorithms = new HashMap(); - - /** - * The vocabulary used for decoding. - */ - protected ParserVocabulary _v; - - /** - * The prefix table of the vocabulary. - */ - protected PrefixArray _prefixTable; - - /** - * The element name table of the vocabulary. - */ - protected QualifiedNameArray _elementNameTable; - - /** - * The attribute name table of the vocabulary. - */ - protected QualifiedNameArray _attributeNameTable; - - /** - * The character content chunk table of the vocabulary. - */ - protected ContiguousCharArrayArray _characterContentChunkTable; - - /** - * The attribute value table of the vocabulary. - */ - protected StringArray _attributeValueTable; - - /** - * The current octet that is being read - */ - protected int _b; - - /** - * True if an information item is terminated. - */ - protected boolean _terminate; - - /** - * True if two information item are terminated in direct sequence. - */ - protected boolean _doubleTerminate; - - /** - * True if an entry is required to be added to a table - */ - protected boolean _addToTable; - - /** - * The vocabulary table index to an indexed non identifying string. - */ - protected int _integer; - - /** - * The vocabulary table index of identifying string or the identifier of - * an encoding algorithm or restricted alphabet. - */ - protected int _identifier; - - /** - * The size of the internal buffer. - */ - protected int _bufferSize = _bufferSizeSystemDefault; - - /** - * The internal buffer used for decoding. - */ - protected byte[] _octetBuffer = new byte[_bufferSizeSystemDefault]; - - /** - * A mark into the internal buffer used for decoding encoded algorithm - * or restricted alphabet data. - */ - protected int _octetBufferStart; - - /** - * The offset into the buffer to read the next byte. - */ - protected int _octetBufferOffset; - - /** - * The end of the buffer. - */ - protected int _octetBufferEnd; - - /** - * The length of some octets in the buffer that are to be read. - */ - protected int _octetBufferLength; - - /** - * The internal buffer of characters. - */ - protected char[] _charBuffer = new char[512]; - - /** - * The length of characters in the buffer of characters. - */ - protected int _charBufferLength; - - /** - * Helper class that checks for duplicate attribute information items. - */ - protected DuplicateAttributeVerifier _duplicateAttributeVerifier = new DuplicateAttributeVerifier(); - - /** - * Default constructor for the Decoder. - */ - protected Decoder() { - _v = new ParserVocabulary(); - _prefixTable = _v.prefix; - _elementNameTable = _v.elementName; - _attributeNameTable = _v.attributeName; - _characterContentChunkTable = _v.characterContentChunk; - _attributeValueTable = _v.attributeValue; - _vIsInternal = true; - } - - - // FastInfosetParser interface - - /** - * {@inheritDoc} - */ - public void setStringInterning(boolean stringInterning) { - _stringInterning = stringInterning; - } - - /** - * {@inheritDoc} - */ - public boolean getStringInterning() { - return _stringInterning; - } - - /** - * {@inheritDoc} - */ - public void setBufferSize(int bufferSize) { - if (_bufferSize > _octetBuffer.length) { - _bufferSize = bufferSize; - } - } - - /** - * {@inheritDoc} - */ - public int getBufferSize() { - return _bufferSize; - } - - /** - * {@inheritDoc} - */ - public void setRegisteredEncodingAlgorithms(Map algorithms) { - _registeredEncodingAlgorithms = algorithms; - if (_registeredEncodingAlgorithms == null) { - _registeredEncodingAlgorithms = new HashMap(); - } - } - - /** - * {@inheritDoc} - */ - public Map getRegisteredEncodingAlgorithms() { - return _registeredEncodingAlgorithms; - } - - /** - * {@inheritDoc} - */ - public void setExternalVocabularies(Map referencedVocabualries) { - if (referencedVocabualries != null) { - // Clone the input map - _externalVocabularies = new HashMap(); - _externalVocabularies.putAll(referencedVocabualries); - } else { - _externalVocabularies = null; - } - } - - /** - * {@inheritDoc} - */ - public Map getExternalVocabularies() { - return _externalVocabularies; - } - - /** - * {@inheritDoc} - */ - public void setParseFragments(boolean parseFragments) { - _parseFragments = parseFragments; - } - - /** - * {@inheritDoc} - */ - public boolean getParseFragments() { - return _parseFragments; - } - - /** - * {@inheritDoc} - */ - public void setForceStreamClose(boolean needForceStreamClose) { - _needForceStreamClose = needForceStreamClose; - } - - /** - * {@inheritDoc} - */ - public boolean getForceStreamClose() { - return _needForceStreamClose; - } - -// End FastInfosetParser interface - - /** - * Reset the decoder for reuse decoding another XML infoset. - */ - public void reset() { - _terminate = _doubleTerminate = false; - } - - /** - * Set the ParserVocabulary to be used for decoding. - * - * @param v the vocabulary to be used for decoding. - */ - public void setVocabulary(ParserVocabulary v) { - _v = v; - _prefixTable = _v.prefix; - _elementNameTable = _v.elementName; - _attributeNameTable = _v.attributeName; - _characterContentChunkTable = _v.characterContentChunk; - _attributeValueTable = _v.attributeValue; - _vIsInternal = false; - } - - /** - * Set the InputStream to decode the fast infoset document. - * - * @param s the InputStream where the fast infoset document is decoded from. - */ - public void setInputStream(InputStream s) { - _s = s; - _octetBufferOffset = 0; - _octetBufferEnd = 0; - if (_vIsInternal == true) { - _v.clear(); - } - } - - protected final void decodeDII() throws FastInfosetException, IOException { - final int b = read(); - if (b == EncodingConstants.DOCUMENT_INITIAL_VOCABULARY_FLAG) { - decodeInitialVocabulary(); - } else if (b != 0) { - throw new IOException(CommonResourceBundle.getInstance(). - getString("message.optinalValues")); - } - } - - protected final void decodeAdditionalData() throws FastInfosetException, IOException { - final int noOfItems = decodeNumberOfItemsOfSequence(); - - for (int i = 0; i < noOfItems; i++) { - /*String URI = */decodeNonEmptyOctetStringOnSecondBitAsUtf8String(); - - decodeNonEmptyOctetStringLengthOnSecondBit(); - ensureOctetBufferSize(); - _octetBufferStart = _octetBufferOffset; - _octetBufferOffset += _octetBufferLength; - } - } - - protected final void decodeInitialVocabulary() throws FastInfosetException, IOException { - // First 5 optionals of 13 bit optional field - int b = read(); - // Next 8 optionals of 13 bit optional field - int b2 = read(); - - // Optimize for the most common case - if (b == EncodingConstants.INITIAL_VOCABULARY_EXTERNAL_VOCABULARY_FLAG && b2 == 0) { - decodeExternalVocabularyURI(); - return; - } - - if ((b & EncodingConstants.INITIAL_VOCABULARY_EXTERNAL_VOCABULARY_FLAG) > 0) { - decodeExternalVocabularyURI(); - } - - if ((b & EncodingConstants.INITIAL_VOCABULARY_RESTRICTED_ALPHABETS_FLAG) > 0) { - decodeTableItems(_v.restrictedAlphabet); - } - - if ((b & EncodingConstants.INITIAL_VOCABULARY_ENCODING_ALGORITHMS_FLAG) > 0) { - decodeTableItems(_v.encodingAlgorithm); - } - - if ((b & EncodingConstants.INITIAL_VOCABULARY_PREFIXES_FLAG) > 0) { - decodeTableItems(_v.prefix); - } - - if ((b & EncodingConstants.INITIAL_VOCABULARY_NAMESPACE_NAMES_FLAG) > 0) { - decodeTableItems(_v.namespaceName); - } - - if ((b2 & EncodingConstants.INITIAL_VOCABULARY_LOCAL_NAMES_FLAG) > 0) { - decodeTableItems(_v.localName); - } - - if ((b2 & EncodingConstants.INITIAL_VOCABULARY_OTHER_NCNAMES_FLAG) > 0) { - decodeTableItems(_v.otherNCName); - } - - if ((b2 & EncodingConstants.INITIAL_VOCABULARY_OTHER_URIS_FLAG) > 0) { - decodeTableItems(_v.otherURI); - } - - if ((b2 & EncodingConstants.INITIAL_VOCABULARY_ATTRIBUTE_VALUES_FLAG) > 0) { - decodeTableItems(_v.attributeValue); - } - - if ((b2 & EncodingConstants.INITIAL_VOCABULARY_CONTENT_CHARACTER_CHUNKS_FLAG) > 0) { - decodeTableItems(_v.characterContentChunk); - } - - if ((b2 & EncodingConstants.INITIAL_VOCABULARY_OTHER_STRINGS_FLAG) > 0) { - decodeTableItems(_v.otherString); - } - - if ((b2 & EncodingConstants.INITIAL_VOCABULARY_ELEMENT_NAME_SURROGATES_FLAG) > 0) { - decodeTableItems(_v.elementName, false); - } - - if ((b2 & EncodingConstants.INITIAL_VOCABULARY_ATTRIBUTE_NAME_SURROGATES_FLAG) > 0) { - decodeTableItems(_v.attributeName, true); - } - } - - private void decodeExternalVocabularyURI() throws FastInfosetException, IOException { - if (_externalVocabularies == null) { - throw new IOException(CommonResourceBundle. - getInstance().getString("message.noExternalVocabularies")); - } - - String externalVocabularyURI = - decodeNonEmptyOctetStringOnSecondBitAsUtf8String(); - - Object o = _externalVocabularies.get(externalVocabularyURI); - if (o instanceof ParserVocabulary) { - _v.setReferencedVocabulary(externalVocabularyURI, - (ParserVocabulary)o, false); - } else if (o instanceof com.sun.xml.internal.org.jvnet.fastinfoset.ExternalVocabulary) { - com.sun.xml.internal.org.jvnet.fastinfoset.ExternalVocabulary v = - (com.sun.xml.internal.org.jvnet.fastinfoset.ExternalVocabulary)o; - ParserVocabulary pv = new ParserVocabulary(v.vocabulary); - - _externalVocabularies.put(externalVocabularyURI, pv); - _v.setReferencedVocabulary(externalVocabularyURI, - pv, false); - } else { - throw new FastInfosetException(CommonResourceBundle.getInstance(). - getString("message.externalVocabularyNotRegistered", - new Object[]{externalVocabularyURI})); - } - } - - private void decodeTableItems(StringArray array) throws FastInfosetException, IOException { - final int noOfItems = decodeNumberOfItemsOfSequence(); - - for (int i = 0; i < noOfItems; i++) { - array.add(decodeNonEmptyOctetStringOnSecondBitAsUtf8String()); - } - } - - private void decodeTableItems(PrefixArray array) throws FastInfosetException, IOException { - final int noOfItems = decodeNumberOfItemsOfSequence(); - - for (int i = 0; i < noOfItems; i++) { - array.add(decodeNonEmptyOctetStringOnSecondBitAsUtf8String()); - } - } - - private void decodeTableItems(ContiguousCharArrayArray array) throws FastInfosetException, IOException { - final int noOfItems = decodeNumberOfItemsOfSequence(); - - for (int i = 0; i < noOfItems; i++) { - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - array.add(_charBuffer, _charBufferLength); - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.illegalState")); - } - } - } - - private void decodeTableItems(CharArrayArray array) throws FastInfosetException, IOException { - final int noOfItems = decodeNumberOfItemsOfSequence(); - - for (int i = 0; i < noOfItems; i++) { - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - array.add(new CharArray(_charBuffer, 0, _charBufferLength, true)); - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.illegalState")); - } - } - } - - private void decodeTableItems(QualifiedNameArray array, boolean isAttribute) throws FastInfosetException, IOException { - final int noOfItems = decodeNumberOfItemsOfSequence(); - - for (int i = 0; i < noOfItems; i++) { - final int b = read(); - - String prefix = ""; - int prefixIndex = -1; - if ((b & EncodingConstants.NAME_SURROGATE_PREFIX_FLAG) > 0) { - prefixIndex = decodeIntegerIndexOnSecondBit(); - prefix = _v.prefix.get(prefixIndex); - } - - String namespaceName = ""; - int namespaceNameIndex = -1; - if ((b & EncodingConstants.NAME_SURROGATE_NAME_FLAG) > 0) { - namespaceNameIndex = decodeIntegerIndexOnSecondBit(); - namespaceName = _v.namespaceName.get(namespaceNameIndex); - } - - if (namespaceName == "" && prefix != "") { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.missingNamespace")); - } - - final int localNameIndex = decodeIntegerIndexOnSecondBit(); - final String localName = _v.localName.get(localNameIndex); - - QualifiedName qualifiedName = new QualifiedName(prefix, namespaceName, localName, - prefixIndex, namespaceNameIndex, localNameIndex, - _charBuffer); - if (isAttribute) { - qualifiedName.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE); - } - array.add(qualifiedName); - } - } - - private int decodeNumberOfItemsOfSequence() throws IOException { - final int b = read(); - if (b < 128) { - return b + 1; - } else { - return (((b & 0x0F) << 16) | (read() << 8) | read()) + 129; - } - } - - protected final void decodeNotations() throws FastInfosetException, IOException { - if (_notations == null) { - _notations = new ArrayList(); - } else { - _notations.clear(); - } - - int b = read(); - while ((b & EncodingConstants.NOTATIONS_MASK) == EncodingConstants.NOTATIONS) { - String name = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - - String system_identifier = ((_b & EncodingConstants.NOTATIONS_SYSTEM_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - String public_identifier = ((_b & EncodingConstants.NOTATIONS_PUBLIC_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - - Notation notation = new Notation(name, system_identifier, public_identifier); - _notations.add(notation); - - b = read(); - } - if (b != EncodingConstants.TERMINATOR) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IIsNotTerminatedCorrectly")); - } - } - - protected final void decodeUnparsedEntities() throws FastInfosetException, IOException { - if (_unparsedEntities == null) { - _unparsedEntities = new ArrayList(); - } else { - _unparsedEntities.clear(); - } - - int b = read(); - while ((b & EncodingConstants.UNPARSED_ENTITIES_MASK) == EncodingConstants.UNPARSED_ENTITIES) { - String name = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - String system_identifier = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI); - - String public_identifier = ((_b & EncodingConstants.UNPARSED_ENTITIES_PUBLIC_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - - String notation_name = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - - UnparsedEntity unparsedEntity = new UnparsedEntity(name, system_identifier, public_identifier, notation_name); - _unparsedEntities.add(unparsedEntity); - - b = read(); - } - if (b != EncodingConstants.TERMINATOR) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.unparsedEntities")); - } - } - - protected final String decodeCharacterEncodingScheme() throws FastInfosetException, IOException { - return decodeNonEmptyOctetStringOnSecondBitAsUtf8String(); - } - - protected final String decodeVersion() throws FastInfosetException, IOException { - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - final String data = new String(_charBuffer, 0, _charBufferLength); - if (_addToTable) { - _v.otherString.add(new CharArrayString(data)); - } - return data; - case NISTRING_ENCODING_ALGORITHM: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingNotSupported")); - case NISTRING_INDEX: - return _v.otherString.get(_integer).toString(); - case NISTRING_EMPTY_STRING: - default: - return ""; - } - } - - protected final QualifiedName decodeEIIIndexMedium() throws FastInfosetException, IOException { - final int i = (((_b & EncodingConstants.INTEGER_3RD_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_3RD_BIT_SMALL_LIMIT; - return _v.elementName._array[i]; - } - - protected final QualifiedName decodeEIIIndexLarge() throws FastInfosetException, IOException { - int i; - if ((_b & EncodingConstants.INTEGER_3RD_BIT_LARGE_LARGE_FLAG) == 0x20) { - // EII large index - i = (((_b & EncodingConstants.INTEGER_3RD_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_3RD_BIT_MEDIUM_LIMIT; - } else { - // EII large large index - i = (((read() & EncodingConstants.INTEGER_3RD_BIT_LARGE_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_3RD_BIT_LARGE_LIMIT; - } - return _v.elementName._array[i]; - } - - protected final QualifiedName decodeLiteralQualifiedName(int state, QualifiedName q) - throws FastInfosetException, IOException { - if (q == null) q = new QualifiedName(); - switch (state) { - // no prefix, no namespace - case 0: - return q.set( - "", - "", - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - -1, - -1, - _identifier, - null); - // no prefix, namespace - case 1: - return q.set( - "", - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(false), - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - -1, - _namespaceNameIndex, - _identifier, - null); - // prefix, no namespace - case 2: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.qNameMissingNamespaceName")); - // prefix, namespace - case 3: - return q.set( - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix(true), - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(true), - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - _prefixIndex, - _namespaceNameIndex, - _identifier, - _charBuffer); - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingEII")); - } - } - - protected static final int NISTRING_STRING = 0; - protected static final int NISTRING_INDEX = 1; - protected static final int NISTRING_ENCODING_ALGORITHM = 2; - protected static final int NISTRING_EMPTY_STRING = 3; - - /* - * C.14 - * decodeNonIdentifyingStringOnFirstBit - */ - protected final int decodeNonIdentifyingStringOnFirstBit() throws FastInfosetException, IOException { - final int b = read(); - switch(DecoderStateTables.NISTRING(b)) { - case DecoderStateTables.NISTRING_UTF8_SMALL_LENGTH: - _addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_MASK) + 1; - decodeUtf8StringAsCharBuffer(); - return NISTRING_STRING; - case DecoderStateTables.NISTRING_UTF8_MEDIUM_LENGTH: - _addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT; - decodeUtf8StringAsCharBuffer(); - return NISTRING_STRING; - case DecoderStateTables.NISTRING_UTF8_LARGE_LENGTH: - { - _addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - final int length = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength = length + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - decodeUtf8StringAsCharBuffer(); - return NISTRING_STRING; - } - case DecoderStateTables.NISTRING_UTF16_SMALL_LENGTH: - _addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_MASK) + 1; - decodeUtf16StringAsCharBuffer(); - return NISTRING_STRING; - case DecoderStateTables.NISTRING_UTF16_MEDIUM_LENGTH: - _addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT; - decodeUtf16StringAsCharBuffer(); - return NISTRING_STRING; - case DecoderStateTables.NISTRING_UTF16_LARGE_LENGTH: - { - _addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - final int length = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength = length + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - decodeUtf16StringAsCharBuffer(); - return NISTRING_STRING; - } - case DecoderStateTables.NISTRING_RA: - { - _addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - // Decode resitricted alphabet integer - _identifier = (b & 0x0F) << 4; - final int b2 = read(); - _identifier |= (b2 & 0xF0) >> 4; - - decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(b2); - - decodeRestrictedAlphabetAsCharBuffer(); - return NISTRING_STRING; - } - case DecoderStateTables.NISTRING_EA: - { - _addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - // Decode encoding algorithm integer - _identifier = (b & 0x0F) << 4; - final int b2 = read(); - _identifier |= (b2 & 0xF0) >> 4; - - decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(b2); - return NISTRING_ENCODING_ALGORITHM; - } - case DecoderStateTables.NISTRING_INDEX_SMALL: - _integer = b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK; - return NISTRING_INDEX; - case DecoderStateTables.NISTRING_INDEX_MEDIUM: - _integer = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - return NISTRING_INDEX; - case DecoderStateTables.NISTRING_INDEX_LARGE: - _integer = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - return NISTRING_INDEX; - case DecoderStateTables.NISTRING_EMPTY: - return NISTRING_EMPTY_STRING; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingNonIdentifyingString")); - } - } - - protected final void decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(int b) throws FastInfosetException, IOException { - // Remove top 4 bits of restricted alphabet or encoding algorithm integer - b &= 0x0F; - // Reuse UTF8 length states - switch(DecoderStateTables.NISTRING(b)) { - case DecoderStateTables.NISTRING_UTF8_SMALL_LENGTH: - _octetBufferLength = b + 1; - break; - case DecoderStateTables.NISTRING_UTF8_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT; - break; - case DecoderStateTables.NISTRING_UTF8_LARGE_LENGTH: - final int length = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength = length + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingOctets")); - } - ensureOctetBufferSize(); - _octetBufferStart = _octetBufferOffset; - _octetBufferOffset += _octetBufferLength; - } - - protected final void decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(int b) throws FastInfosetException, IOException { - // Remove top 6 bits of restricted alphabet or encoding algorithm integer - switch (b & 0x03) { - // Small length - case 0: - _octetBufferLength = 1; - break; - // Small length - case 1: - _octetBufferLength = 2; - break; - // Medium length - case 2: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT; - break; - // Large length - case 3: - _octetBufferLength = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength += EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - break; - } - - ensureOctetBufferSize(); - _octetBufferStart = _octetBufferOffset; - _octetBufferOffset += _octetBufferLength; - } - - /* - * C.13 - */ - protected final String decodeIdentifyingNonEmptyStringOnFirstBit(StringArray table) throws FastInfosetException, IOException { - final int b = read(); - switch(DecoderStateTables.ISTRING(b)) { - case DecoderStateTables.ISTRING_SMALL_LENGTH: - { - _octetBufferLength = b + 1; - final String s = (_stringInterning) ? decodeUtf8StringAsString().intern() : decodeUtf8StringAsString(); - _identifier = table.add(s) - 1; - return s; - } - case DecoderStateTables.ISTRING_MEDIUM_LENGTH: - { - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_SMALL_LIMIT; - final String s = (_stringInterning) ? decodeUtf8StringAsString().intern() : decodeUtf8StringAsString(); - _identifier = table.add(s) - 1; - return s; - } - case DecoderStateTables.ISTRING_LARGE_LENGTH: - { - final int length = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength = length + EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_LIMIT; - final String s = (_stringInterning) ? decodeUtf8StringAsString().intern() : decodeUtf8StringAsString(); - _identifier = table.add(s) - 1; - return s; - } - case DecoderStateTables.ISTRING_INDEX_SMALL: - _identifier = b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK; - return table._array[_identifier]; - case DecoderStateTables.ISTRING_INDEX_MEDIUM: - _identifier = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - return table._array[_identifier]; - case DecoderStateTables.ISTRING_INDEX_LARGE: - _identifier = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - return table._array[_identifier]; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingIdentifyingString")); - } - } - - protected int _prefixIndex; - - /* - * C.13 - */ - protected final String decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix(boolean namespaceNamePresent) throws FastInfosetException, IOException { - final int b = read(); - switch(DecoderStateTables.ISTRING_PREFIX_NAMESPACE(b)) { - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_LENGTH_3: - { - _octetBufferLength = EncodingConstants.XML_NAMESPACE_PREFIX_LENGTH; - decodeUtf8StringAsCharBuffer(); - - if (_charBuffer[0] == 'x' && - _charBuffer[1] == 'm' && - _charBuffer[2] == 'l') { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.prefixIllegal")); - } - - final String s = (_stringInterning) ? new String(_charBuffer, 0, _charBufferLength).intern() : - new String(_charBuffer, 0, _charBufferLength); - _prefixIndex = _v.prefix.add(s); - return s; - } - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_LENGTH_5: - { - _octetBufferLength = EncodingConstants.XMLNS_NAMESPACE_PREFIX_LENGTH; - decodeUtf8StringAsCharBuffer(); - - if (_charBuffer[0] == 'x' && - _charBuffer[1] == 'm' && - _charBuffer[2] == 'l' && - _charBuffer[3] == 'n' && - _charBuffer[4] == 's') { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.xmlns")); - } - - final String s = (_stringInterning) ? new String(_charBuffer, 0, _charBufferLength).intern() : - new String(_charBuffer, 0, _charBufferLength); - _prefixIndex = _v.prefix.add(s); - return s; - } - case DecoderStateTables.ISTRING_SMALL_LENGTH: - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_LENGTH_29: - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_LENGTH_36: - { - _octetBufferLength = b + 1; - final String s = (_stringInterning) ? decodeUtf8StringAsString().intern() : decodeUtf8StringAsString(); - _prefixIndex = _v.prefix.add(s); - return s; - } - case DecoderStateTables.ISTRING_MEDIUM_LENGTH: - { - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_SMALL_LIMIT; - final String s = (_stringInterning) ? decodeUtf8StringAsString().intern() : decodeUtf8StringAsString(); - _prefixIndex = _v.prefix.add(s); - return s; - } - case DecoderStateTables.ISTRING_LARGE_LENGTH: - { - final int length = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength = length + EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_LIMIT; - final String s = (_stringInterning) ? decodeUtf8StringAsString().intern() : decodeUtf8StringAsString(); - _prefixIndex = _v.prefix.add(s); - return s; - } - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_INDEX_ZERO: - if (namespaceNamePresent) { - _prefixIndex = 0; - // Peak at next byte and check the index of the XML namespace name - if (DecoderStateTables.ISTRING_PREFIX_NAMESPACE(peek()) - != DecoderStateTables.ISTRING_PREFIX_NAMESPACE_INDEX_ZERO) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.wrongNamespaceName")); - } - return EncodingConstants.XML_NAMESPACE_PREFIX; - } else { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.missingNamespaceName")); - } - case DecoderStateTables.ISTRING_INDEX_SMALL: - _prefixIndex = b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK; - return _v.prefix._array[_prefixIndex - 1]; - case DecoderStateTables.ISTRING_INDEX_MEDIUM: - _prefixIndex = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - return _v.prefix._array[_prefixIndex - 1]; - case DecoderStateTables.ISTRING_INDEX_LARGE: - _prefixIndex = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - return _v.prefix._array[_prefixIndex - 1]; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingIdentifyingStringForPrefix")); - } - } - - /* - * C.13 - */ - protected final String decodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix(boolean namespaceNamePresent) throws FastInfosetException, IOException { - final int b = read(); - switch(DecoderStateTables.ISTRING_PREFIX_NAMESPACE(b)) { - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_INDEX_ZERO: - if (namespaceNamePresent) { - _prefixIndex = 0; - // Peak at next byte and check the index of the XML namespace name - if (DecoderStateTables.ISTRING_PREFIX_NAMESPACE(peek()) - != DecoderStateTables.ISTRING_PREFIX_NAMESPACE_INDEX_ZERO) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.wrongNamespaceName")); - } - return EncodingConstants.XML_NAMESPACE_PREFIX; - } else { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.missingNamespaceName")); - } - case DecoderStateTables.ISTRING_INDEX_SMALL: - _prefixIndex = b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK; - return _v.prefix._array[_prefixIndex - 1]; - case DecoderStateTables.ISTRING_INDEX_MEDIUM: - _prefixIndex = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - return _v.prefix._array[_prefixIndex - 1]; - case DecoderStateTables.ISTRING_INDEX_LARGE: - _prefixIndex = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - return _v.prefix._array[_prefixIndex - 1]; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingIdentifyingStringForPrefix")); - } - } - - protected int _namespaceNameIndex; - - /* - * C.13 - */ - protected final String decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName(boolean prefixPresent) throws FastInfosetException, IOException { - final int b = read(); - switch(DecoderStateTables.ISTRING_PREFIX_NAMESPACE(b)) { - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_LENGTH_3: - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_LENGTH_5: - case DecoderStateTables.ISTRING_SMALL_LENGTH: - { - _octetBufferLength = b + 1; - final String s = (_stringInterning) ? decodeUtf8StringAsString().intern() : decodeUtf8StringAsString(); - _namespaceNameIndex = _v.namespaceName.add(s); - return s; - } - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_LENGTH_29: - { - _octetBufferLength = EncodingConstants.XMLNS_NAMESPACE_NAME_LENGTH; - decodeUtf8StringAsCharBuffer(); - - if (compareCharsWithCharBufferFromEndToStart(XMLNS_NAMESPACE_NAME_CHARS)) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.xmlnsConnotBeBoundToPrefix")); - } - - final String s = (_stringInterning) ? new String(_charBuffer, 0, _charBufferLength).intern() : - new String(_charBuffer, 0, _charBufferLength); - _namespaceNameIndex = _v.namespaceName.add(s); - return s; - } - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_LENGTH_36: - { - _octetBufferLength = EncodingConstants.XML_NAMESPACE_NAME_LENGTH; - decodeUtf8StringAsCharBuffer(); - - if (compareCharsWithCharBufferFromEndToStart(XML_NAMESPACE_NAME_CHARS)) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.illegalNamespaceName")); - } - - final String s = (_stringInterning) ? new String(_charBuffer, 0, _charBufferLength).intern() : - new String(_charBuffer, 0, _charBufferLength); - _namespaceNameIndex = _v.namespaceName.add(s); - return s; - } - case DecoderStateTables.ISTRING_MEDIUM_LENGTH: - { - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_SMALL_LIMIT; - final String s = (_stringInterning) ? decodeUtf8StringAsString().intern() : decodeUtf8StringAsString(); - _namespaceNameIndex = _v.namespaceName.add(s); - return s; - } - case DecoderStateTables.ISTRING_LARGE_LENGTH: - { - final int length = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength = length + EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_LIMIT; - final String s = (_stringInterning) ? decodeUtf8StringAsString().intern() : decodeUtf8StringAsString(); - _namespaceNameIndex = _v.namespaceName.add(s); - return s; - } - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_INDEX_ZERO: - if (prefixPresent) { - _namespaceNameIndex = 0; - return EncodingConstants.XML_NAMESPACE_NAME; - } else { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.namespaceWithoutPrefix")); - } - case DecoderStateTables.ISTRING_INDEX_SMALL: - _namespaceNameIndex = b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK; - return _v.namespaceName._array[_namespaceNameIndex - 1]; - case DecoderStateTables.ISTRING_INDEX_MEDIUM: - _namespaceNameIndex = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - return _v.namespaceName._array[_namespaceNameIndex - 1]; - case DecoderStateTables.ISTRING_INDEX_LARGE: - _namespaceNameIndex = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - return _v.namespaceName._array[_namespaceNameIndex - 1]; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingForNamespaceName")); - } - } - - /* - * C.13 - */ - protected final String decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(boolean prefixPresent) throws FastInfosetException, IOException { - final int b = read(); - switch(DecoderStateTables.ISTRING_PREFIX_NAMESPACE(b)) { - case DecoderStateTables.ISTRING_PREFIX_NAMESPACE_INDEX_ZERO: - if (prefixPresent) { - _namespaceNameIndex = 0; - return EncodingConstants.XML_NAMESPACE_NAME; - } else { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.namespaceWithoutPrefix")); - } - case DecoderStateTables.ISTRING_INDEX_SMALL: - _namespaceNameIndex = b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK; - return _v.namespaceName._array[_namespaceNameIndex - 1]; - case DecoderStateTables.ISTRING_INDEX_MEDIUM: - _namespaceNameIndex = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - return _v.namespaceName._array[_namespaceNameIndex - 1]; - case DecoderStateTables.ISTRING_INDEX_LARGE: - _namespaceNameIndex = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - return _v.namespaceName._array[_namespaceNameIndex - 1]; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingForNamespaceName")); - } - } - - private boolean compareCharsWithCharBufferFromEndToStart(char[] c) { - int i = _charBufferLength ; - while (--i >= 0) { - if (c[i] != _charBuffer[i]) { - return false; - } - } - return true; - } - - /* - * C.22 - */ - protected final String decodeNonEmptyOctetStringOnSecondBitAsUtf8String() throws FastInfosetException, IOException { - decodeNonEmptyOctetStringOnSecondBitAsUtf8CharArray(); - return new String(_charBuffer, 0, _charBufferLength); - } - - /* - * C.22 - */ - protected final void decodeNonEmptyOctetStringOnSecondBitAsUtf8CharArray() throws FastInfosetException, IOException { - decodeNonEmptyOctetStringLengthOnSecondBit(); - decodeUtf8StringAsCharBuffer(); - } - - /* - * C.22 - */ - protected final void decodeNonEmptyOctetStringLengthOnSecondBit() throws FastInfosetException, IOException { - final int b = read(); - switch(DecoderStateTables.ISTRING(b)) { - case DecoderStateTables.ISTRING_SMALL_LENGTH: - _octetBufferLength = b + 1; - break; - case DecoderStateTables.ISTRING_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_SMALL_LIMIT; - break; - case DecoderStateTables.ISTRING_LARGE_LENGTH: - { - final int length = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength = length + EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_LIMIT; - break; - } - case DecoderStateTables.ISTRING_INDEX_SMALL: - case DecoderStateTables.ISTRING_INDEX_MEDIUM: - case DecoderStateTables.ISTRING_INDEX_LARGE: - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingNonEmptyOctet")); - } - } - - /* - * C.25 - */ - protected final int decodeIntegerIndexOnSecondBit() throws FastInfosetException, IOException { - final int b = read() | 0x80; - switch(DecoderStateTables.ISTRING(b)) { - case DecoderStateTables.ISTRING_INDEX_SMALL: - return b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK; - case DecoderStateTables.ISTRING_INDEX_MEDIUM: - return (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - case DecoderStateTables.ISTRING_INDEX_LARGE: - return (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - case DecoderStateTables.ISTRING_SMALL_LENGTH: - case DecoderStateTables.ISTRING_MEDIUM_LENGTH: - case DecoderStateTables.ISTRING_LARGE_LENGTH: - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingIndexOnSecondBit")); - } - } - - protected final void decodeHeader() throws FastInfosetException, IOException { - if (!_isFastInfosetDocument()) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.notFIDocument")); - } - } - - protected final void decodeRestrictedAlphabetAsCharBuffer() throws FastInfosetException, IOException { - if (_identifier <= EncodingConstants.RESTRICTED_ALPHABET_BUILTIN_END) { - decodeFourBitAlphabetOctetsAsCharBuffer(BuiltInRestrictedAlphabets.table[_identifier]); - // decodeAlphabetOctetsAsCharBuffer(BuiltInRestrictedAlphabets.table[_identifier]); - } else if (_identifier >= EncodingConstants.RESTRICTED_ALPHABET_APPLICATION_START) { - CharArray ca = _v.restrictedAlphabet.get(_identifier - EncodingConstants.RESTRICTED_ALPHABET_APPLICATION_START); - if (ca == null) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.alphabetNotPresent", new Object[]{Integer.valueOf(_identifier)})); - } - decodeAlphabetOctetsAsCharBuffer(ca.ch); - } else { - // Reserved built-in algorithms for future use - // TODO should use sax property to decide if event will be - // reported, allows for support through handler if required. - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.alphabetIdentifiersReserved")); - } - } - - protected final String decodeRestrictedAlphabetAsString() throws FastInfosetException, IOException { - decodeRestrictedAlphabetAsCharBuffer(); - return new String(_charBuffer, 0, _charBufferLength); - } - - protected final String decodeRAOctetsAsString(char[] restrictedAlphabet) throws FastInfosetException, IOException { - decodeAlphabetOctetsAsCharBuffer(restrictedAlphabet); - return new String(_charBuffer, 0, _charBufferLength); - } - - protected final void decodeFourBitAlphabetOctetsAsCharBuffer(char[] restrictedAlphabet) throws FastInfosetException, IOException { - _charBufferLength = 0; - final int characters = _octetBufferLength * 2; - if (_charBuffer.length < characters) { - _charBuffer = new char[characters]; - } - - int v = 0; - for (int i = 0; i < _octetBufferLength - 1; i++) { - v = _octetBuffer[_octetBufferStart++] & 0xFF; - _charBuffer[_charBufferLength++] = restrictedAlphabet[v >> 4]; - _charBuffer[_charBufferLength++] = restrictedAlphabet[v & 0x0F]; - } - v = _octetBuffer[_octetBufferStart++] & 0xFF; - _charBuffer[_charBufferLength++] = restrictedAlphabet[v >> 4]; - v &= 0x0F; - if (v != 0x0F) { - _charBuffer[_charBufferLength++] = restrictedAlphabet[v & 0x0F]; - } - } - - protected final void decodeAlphabetOctetsAsCharBuffer(char[] restrictedAlphabet) throws FastInfosetException, IOException { - if (restrictedAlphabet.length < 2) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.alphabetMustContain2orMoreChars")); - } - - int bitsPerCharacter = 1; - while ((1 << bitsPerCharacter) <= restrictedAlphabet.length) { - bitsPerCharacter++; - } - final int terminatingValue = (1 << bitsPerCharacter) - 1; - - int characters = (_octetBufferLength << 3) / bitsPerCharacter; - if (characters == 0) { - throw new IOException(""); - } - - _charBufferLength = 0; - if (_charBuffer.length < characters) { - _charBuffer = new char[characters]; - } - - resetBits(); - for (int i = 0; i < characters; i++) { - int value = readBits(bitsPerCharacter); - if (bitsPerCharacter < 8 && value == terminatingValue) { - int octetPosition = (i * bitsPerCharacter) >>> 3; - if (octetPosition != _octetBufferLength - 1) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.alphabetIncorrectlyTerminated")); - } - break; - } - _charBuffer[_charBufferLength++] = restrictedAlphabet[value]; - } - } - - private int _bitsLeftInOctet; - - private void resetBits() { - _bitsLeftInOctet = 0; - } - - private int readBits(int bits) throws IOException { - int value = 0; - while (bits > 0) { - if (_bitsLeftInOctet == 0) { - _b = _octetBuffer[_octetBufferStart++] & 0xFF; - _bitsLeftInOctet = 8; - } - int bit = ((_b & (1 << --_bitsLeftInOctet)) > 0) ? 1 : 0; - value |= (bit << --bits); - } - - return value; - } - - protected final void decodeUtf8StringAsCharBuffer() throws IOException { - ensureOctetBufferSize(); - decodeUtf8StringIntoCharBuffer(); - } - - protected final void decodeUtf8StringAsCharBuffer(char[] ch, int offset) throws IOException { - ensureOctetBufferSize(); - decodeUtf8StringIntoCharBuffer(ch, offset); - } - - protected final String decodeUtf8StringAsString() throws IOException { - decodeUtf8StringAsCharBuffer(); - return new String(_charBuffer, 0, _charBufferLength); - } - - protected final void decodeUtf16StringAsCharBuffer() throws IOException { - ensureOctetBufferSize(); - decodeUtf16StringIntoCharBuffer(); - } - - protected final String decodeUtf16StringAsString() throws IOException { - decodeUtf16StringAsCharBuffer(); - return new String(_charBuffer, 0, _charBufferLength); - } - - private void ensureOctetBufferSize() throws IOException { - if (_octetBufferEnd < (_octetBufferOffset + _octetBufferLength)) { - final int octetsInBuffer = _octetBufferEnd - _octetBufferOffset; - - if (_octetBuffer.length < _octetBufferLength) { - // Length to read is too large, resize the buffer - byte[] newOctetBuffer = new byte[_octetBufferLength]; - // Move partially read octets to the start of the buffer - System.arraycopy(_octetBuffer, _octetBufferOffset, newOctetBuffer, 0, octetsInBuffer); - _octetBuffer = newOctetBuffer; - } else { - // Move partially read octets to the start of the buffer - System.arraycopy(_octetBuffer, _octetBufferOffset, _octetBuffer, 0, octetsInBuffer); - } - _octetBufferOffset = 0; - - // Read as many octets as possible to fill the buffer - final int octetsRead = _s.read(_octetBuffer, octetsInBuffer, _octetBuffer.length - octetsInBuffer); - if (octetsRead < 0) { - throw new EOFException("Unexpeceted EOF"); - } - _octetBufferEnd = octetsInBuffer + octetsRead; - - // Check if the number of octets that have been read is not enough - // This can happen when underlying non-blocking is used to read - if (_octetBufferEnd < _octetBufferLength) { - repeatedRead(); - } - } - } - - private void repeatedRead() throws IOException { - // Check if the number of octets that have been read is not enough - while (_octetBufferEnd < _octetBufferLength) { - // Read as many octets as possible to fill the buffer - final int octetsRead = _s.read(_octetBuffer, _octetBufferEnd, _octetBuffer.length - _octetBufferEnd); - if (octetsRead < 0) { - throw new EOFException("Unexpeceted EOF"); - } - _octetBufferEnd += octetsRead; - } - } - - protected final void decodeUtf8StringIntoCharBuffer() throws IOException { - if (_charBuffer.length < _octetBufferLength) { - _charBuffer = new char[_octetBufferLength]; - } - - _charBufferLength = 0; - final int end = _octetBufferLength + _octetBufferOffset; - int b1; - while (end != _octetBufferOffset) { - b1 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if (DecoderStateTables.UTF8(b1) == DecoderStateTables.UTF8_ONE_BYTE) { - _charBuffer[_charBufferLength++] = (char) b1; - } else { - decodeTwoToFourByteUtf8Character(b1, end); - } - } - } - - protected final void decodeUtf8StringIntoCharBuffer(char[] ch, int offset) throws IOException { - _charBufferLength = offset; - final int end = _octetBufferLength + _octetBufferOffset; - int b1; - while (end != _octetBufferOffset) { - b1 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if (DecoderStateTables.UTF8(b1) == DecoderStateTables.UTF8_ONE_BYTE) { - ch[_charBufferLength++] = (char) b1; - } else { - decodeTwoToFourByteUtf8Character(ch, b1, end); - } - } - _charBufferLength -= offset; - } - - private void decodeTwoToFourByteUtf8Character(int b1, int end) throws IOException { - switch(DecoderStateTables.UTF8(b1)) { - case DecoderStateTables.UTF8_TWO_BYTES: - { - // Decode byte 2 - if (end == _octetBufferOffset) { - decodeUtf8StringLengthTooSmall(); - } - final int b2 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if ((b2 & 0xC0) != 0x80) { - decodeUtf8StringIllegalState(); - } - - // Character guaranteed to be in [0x20, 0xD7FF] range - // since a character encoded in two bytes will be in the - // range [0x80, 0x1FFF] - _charBuffer[_charBufferLength++] = (char) ( - ((b1 & 0x1F) << 6) - | (b2 & 0x3F)); - break; - } - case DecoderStateTables.UTF8_THREE_BYTES: - final char c = decodeUtf8ThreeByteChar(end, b1); - if (XMLChar.isContent(c)) { - _charBuffer[_charBufferLength++] = c; - } else { - decodeUtf8StringIllegalState(); - } - break; - case DecoderStateTables.UTF8_FOUR_BYTES: - { - final int supplemental = decodeUtf8FourByteChar(end, b1); - if (XMLChar.isContent(supplemental)) { - _charBuffer[_charBufferLength++] = _utf8_highSurrogate; - _charBuffer[_charBufferLength++] = _utf8_lowSurrogate; - } else { - decodeUtf8StringIllegalState(); - } - break; - } - default: - decodeUtf8StringIllegalState(); - } - } - - private void decodeTwoToFourByteUtf8Character(char ch[], int b1, int end) throws IOException { - switch(DecoderStateTables.UTF8(b1)) { - case DecoderStateTables.UTF8_TWO_BYTES: - { - // Decode byte 2 - if (end == _octetBufferOffset) { - decodeUtf8StringLengthTooSmall(); - } - final int b2 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if ((b2 & 0xC0) != 0x80) { - decodeUtf8StringIllegalState(); - } - - // Character guaranteed to be in [0x20, 0xD7FF] range - // since a character encoded in two bytes will be in the - // range [0x80, 0x1FFF] - ch[_charBufferLength++] = (char) ( - ((b1 & 0x1F) << 6) - | (b2 & 0x3F)); - break; - } - case DecoderStateTables.UTF8_THREE_BYTES: - final char c = decodeUtf8ThreeByteChar(end, b1); - if (XMLChar.isContent(c)) { - ch[_charBufferLength++] = c; - } else { - decodeUtf8StringIllegalState(); - } - break; - case DecoderStateTables.UTF8_FOUR_BYTES: - { - final int supplemental = decodeUtf8FourByteChar(end, b1); - if (XMLChar.isContent(supplemental)) { - ch[_charBufferLength++] = _utf8_highSurrogate; - ch[_charBufferLength++] = _utf8_lowSurrogate; - } else { - decodeUtf8StringIllegalState(); - } - break; - } - default: - decodeUtf8StringIllegalState(); - } - } - - protected final void decodeUtf8NCNameIntoCharBuffer() throws IOException { - _charBufferLength = 0; - if (_charBuffer.length < _octetBufferLength) { - _charBuffer = new char[_octetBufferLength]; - } - - final int end = _octetBufferLength + _octetBufferOffset; - - int b1 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if (DecoderStateTables.UTF8_NCNAME(b1) == DecoderStateTables.UTF8_NCNAME_NCNAME) { - _charBuffer[_charBufferLength++] = (char) b1; - } else { - decodeUtf8NCNameStartTwoToFourByteCharacters(b1, end); - } - - while (end != _octetBufferOffset) { - b1 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if (DecoderStateTables.UTF8_NCNAME(b1) < DecoderStateTables.UTF8_TWO_BYTES) { - _charBuffer[_charBufferLength++] = (char) b1; - } else { - decodeUtf8NCNameTwoToFourByteCharacters(b1, end); - } - } - } - - private void decodeUtf8NCNameStartTwoToFourByteCharacters(int b1, int end) throws IOException { - switch(DecoderStateTables.UTF8_NCNAME(b1)) { - case DecoderStateTables.UTF8_TWO_BYTES: - { - // Decode byte 2 - if (end == _octetBufferOffset) { - decodeUtf8StringLengthTooSmall(); - } - final int b2 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if ((b2 & 0xC0) != 0x80) { - decodeUtf8StringIllegalState(); - } - - final char c = (char) ( - ((b1 & 0x1F) << 6) - | (b2 & 0x3F)); - if (XMLChar.isNCNameStart(c)) { - _charBuffer[_charBufferLength++] = c; - } else { - decodeUtf8NCNameIllegalState(); - } - break; - } - case DecoderStateTables.UTF8_THREE_BYTES: - final char c = decodeUtf8ThreeByteChar(end, b1); - if (XMLChar.isNCNameStart(c)) { - _charBuffer[_charBufferLength++] = c; - } else { - decodeUtf8NCNameIllegalState(); - } - break; - case DecoderStateTables.UTF8_FOUR_BYTES: - { - final int supplemental = decodeUtf8FourByteChar(end, b1); - if (XMLChar.isNCNameStart(supplemental)) { - _charBuffer[_charBufferLength++] = _utf8_highSurrogate; - _charBuffer[_charBufferLength++] = _utf8_lowSurrogate; - } else { - decodeUtf8NCNameIllegalState(); - } - break; - } - case DecoderStateTables.UTF8_NCNAME_NCNAME_CHAR: - default: - decodeUtf8NCNameIllegalState(); - } - - } - - private void decodeUtf8NCNameTwoToFourByteCharacters(int b1, int end) throws IOException { - switch(DecoderStateTables.UTF8_NCNAME(b1)) { - case DecoderStateTables.UTF8_TWO_BYTES: - { - // Decode byte 2 - if (end == _octetBufferOffset) { - decodeUtf8StringLengthTooSmall(); - } - final int b2 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if ((b2 & 0xC0) != 0x80) { - decodeUtf8StringIllegalState(); - } - - final char c = (char) ( - ((b1 & 0x1F) << 6) - | (b2 & 0x3F)); - if (XMLChar.isNCName(c)) { - _charBuffer[_charBufferLength++] = c; - } else { - decodeUtf8NCNameIllegalState(); - } - break; - } - case DecoderStateTables.UTF8_THREE_BYTES: - final char c = decodeUtf8ThreeByteChar(end, b1); - if (XMLChar.isNCName(c)) { - _charBuffer[_charBufferLength++] = c; - } else { - decodeUtf8NCNameIllegalState(); - } - break; - case DecoderStateTables.UTF8_FOUR_BYTES: - { - final int supplemental = decodeUtf8FourByteChar(end, b1); - if (XMLChar.isNCName(supplemental)) { - _charBuffer[_charBufferLength++] = _utf8_highSurrogate; - _charBuffer[_charBufferLength++] = _utf8_lowSurrogate; - } else { - decodeUtf8NCNameIllegalState(); - } - break; - } - default: - decodeUtf8NCNameIllegalState(); - } - } - - private char decodeUtf8ThreeByteChar(int end, int b1) throws IOException { - // Decode byte 2 - if (end == _octetBufferOffset) { - decodeUtf8StringLengthTooSmall(); - } - final int b2 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if ((b2 & 0xC0) != 0x80 - || (b1 == 0xED && b2 >= 0xA0) - || ((b1 & 0x0F) == 0 && (b2 & 0x20) == 0)) { - decodeUtf8StringIllegalState(); - } - - // Decode byte 3 - if (end == _octetBufferOffset) { - decodeUtf8StringLengthTooSmall(); - } - final int b3 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if ((b3 & 0xC0) != 0x80) { - decodeUtf8StringIllegalState(); - } - - return (char) ( - (b1 & 0x0F) << 12 - | (b2 & 0x3F) << 6 - | (b3 & 0x3F)); - } - - private char _utf8_highSurrogate; - private char _utf8_lowSurrogate; - - private int decodeUtf8FourByteChar(int end, int b1) throws IOException { - // Decode byte 2 - if (end == _octetBufferOffset) { - decodeUtf8StringLengthTooSmall(); - } - final int b2 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if ((b2 & 0xC0) != 0x80 - || ((b2 & 0x30) == 0 && (b1 & 0x07) == 0)) { - decodeUtf8StringIllegalState(); - } - - // Decode byte 3 - if (end == _octetBufferOffset) { - decodeUtf8StringLengthTooSmall(); - } - final int b3 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if ((b3 & 0xC0) != 0x80) { - decodeUtf8StringIllegalState(); - } - - // Decode byte 4 - if (end == _octetBufferOffset) { - decodeUtf8StringLengthTooSmall(); - } - final int b4 = _octetBuffer[_octetBufferOffset++] & 0xFF; - if ((b4 & 0xC0) != 0x80) { - decodeUtf8StringIllegalState(); - } - - final int uuuuu = ((b1 << 2) & 0x001C) | ((b2 >> 4) & 0x0003); - if (uuuuu > 0x10) { - decodeUtf8StringIllegalState(); - } - final int wwww = uuuuu - 1; - - _utf8_highSurrogate = (char) (0xD800 | - ((wwww << 6) & 0x03C0) | ((b2 << 2) & 0x003C) | - ((b3 >> 4) & 0x0003)); - _utf8_lowSurrogate = (char) (0xDC00 | ((b3 << 6) & 0x03C0) | (b4 & 0x003F)); - - return XMLChar.supplemental(_utf8_highSurrogate, _utf8_lowSurrogate); - } - - private void decodeUtf8StringLengthTooSmall() throws IOException { - throw new IOException(CommonResourceBundle.getInstance().getString("message.deliminatorTooSmall")); - } - - private void decodeUtf8StringIllegalState() throws IOException { - throw new IOException(CommonResourceBundle.getInstance().getString("message.UTF8Encoded")); - } - - private void decodeUtf8NCNameIllegalState() throws IOException { - throw new IOException(CommonResourceBundle.getInstance().getString("message.UTF8EncodedNCName")); - } - - private void decodeUtf16StringIntoCharBuffer() throws IOException { - _charBufferLength = _octetBufferLength / 2; - if (_charBuffer.length < _charBufferLength) { - _charBuffer = new char[_charBufferLength]; - } - - for (int i = 0; i < _charBufferLength; i++) { - final char c = (char)((read() << 8) | read()); - // TODO check c is a valid Char character - _charBuffer[i] = c; - } - - } - - protected String createQualifiedNameString(String second) { - return createQualifiedNameString(XMLNS_NAMESPACE_PREFIX_CHARS, second); - } - - protected String createQualifiedNameString(char[] first, String second) { - final int l1 = first.length; - final int l2 = second.length(); - final int total = l1 + l2 + 1; - if (total < _charBuffer.length) { - System.arraycopy(first, 0, _charBuffer, 0, l1); - _charBuffer[l1] = ':'; - second.getChars(0, l2, _charBuffer, l1 + 1); - return new String(_charBuffer, 0, total); - } else { - StringBuilder b = new StringBuilder(new String(first)); - b.append(':'); - b.append(second); - return b.toString(); - } - } - - protected final int read() throws IOException { - if (_octetBufferOffset < _octetBufferEnd) { - return _octetBuffer[_octetBufferOffset++] & 0xFF; - } else { - _octetBufferEnd = _s.read(_octetBuffer); - if (_octetBufferEnd < 0) { - throw new EOFException(CommonResourceBundle.getInstance().getString("message.EOF")); - } - - _octetBufferOffset = 1; - return _octetBuffer[0] & 0xFF; - } - } - - protected final void closeIfRequired() throws IOException { - if (_s != null && _needForceStreamClose) { - _s.close(); - } - } - - protected final int peek() throws IOException { - return peek(null); - } - - protected final int peek(OctetBufferListener octetBufferListener) throws IOException { - if (_octetBufferOffset < _octetBufferEnd) { - return _octetBuffer[_octetBufferOffset] & 0xFF; - } else { - if (octetBufferListener != null) { - octetBufferListener.onBeforeOctetBufferOverwrite(); - } - - _octetBufferEnd = _s.read(_octetBuffer); - if (_octetBufferEnd < 0) { - throw new EOFException(CommonResourceBundle.getInstance().getString("message.EOF")); - } - - _octetBufferOffset = 0; - return _octetBuffer[0] & 0xFF; - } - } - - protected final int peek2(OctetBufferListener octetBufferListener) throws IOException { - if (_octetBufferOffset + 1 < _octetBufferEnd) { - return _octetBuffer[_octetBufferOffset + 1] & 0xFF; - } else { - if (octetBufferListener != null) { - octetBufferListener.onBeforeOctetBufferOverwrite(); - } - - int offset = 0; - if (_octetBufferOffset < _octetBufferEnd) { - _octetBuffer[0] = _octetBuffer[_octetBufferOffset]; - offset = 1; - } - _octetBufferEnd = _s.read(_octetBuffer, offset, _octetBuffer.length - offset); - - if (_octetBufferEnd < 0) { - throw new EOFException(CommonResourceBundle.getInstance().getString("message.EOF")); - } - - _octetBufferOffset = 0; - return _octetBuffer[1] & 0xFF; - } - } - - protected class EncodingAlgorithmInputStream extends InputStream { - - public int read() throws IOException { - if (_octetBufferStart < _octetBufferOffset) { - return (_octetBuffer[_octetBufferStart++] & 0xFF); - } else { - return -1; - } - } - - @Override - public int read(byte b[]) throws IOException { - return read(b, 0, b.length); - } - - @Override - public int read(byte b[], int off, int len) throws IOException { - if (b == null) { - throw new NullPointerException(); - } else if ((off < 0) || (off > b.length) || (len < 0) || - ((off + len) > b.length) || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { - return 0; - } - - final int newOctetBufferStart = _octetBufferStart + len; - if (newOctetBufferStart < _octetBufferOffset) { - System.arraycopy(_octetBuffer, _octetBufferStart, b, off, len); - _octetBufferStart = newOctetBufferStart; - return len; - } else if (_octetBufferStart < _octetBufferOffset) { - final int bytesToRead = _octetBufferOffset - _octetBufferStart; - System.arraycopy(_octetBuffer, _octetBufferStart, b, off, bytesToRead); - _octetBufferStart += bytesToRead; - return bytesToRead; - } else { - return -1; - } - } - } - - protected final boolean _isFastInfosetDocument() throws IOException { - // Fill up the octet buffer - peek(); - - _octetBufferLength = EncodingConstants.BINARY_HEADER.length; - ensureOctetBufferSize(); - _octetBufferOffset += _octetBufferLength; - - // Check for binary header - if (_octetBuffer[0] != EncodingConstants.BINARY_HEADER[0] || - _octetBuffer[1] != EncodingConstants.BINARY_HEADER[1] || - _octetBuffer[2] != EncodingConstants.BINARY_HEADER[2] || - _octetBuffer[3] != EncodingConstants.BINARY_HEADER[3]) { - - // Check for each form of XML declaration - for (int i = 0; i < EncodingConstants.XML_DECLARATION_VALUES.length; i++) { - _octetBufferLength = EncodingConstants.XML_DECLARATION_VALUES[i].length - _octetBufferOffset; - ensureOctetBufferSize(); - _octetBufferOffset += _octetBufferLength; - - // Check XML declaration - if (arrayEquals(_octetBuffer, 0, - EncodingConstants.XML_DECLARATION_VALUES[i], - EncodingConstants.XML_DECLARATION_VALUES[i].length)) { - _octetBufferLength = EncodingConstants.BINARY_HEADER.length; - ensureOctetBufferSize(); - - // Check for binary header - if (_octetBuffer[_octetBufferOffset++] != EncodingConstants.BINARY_HEADER[0] || - _octetBuffer[_octetBufferOffset++] != EncodingConstants.BINARY_HEADER[1] || - _octetBuffer[_octetBufferOffset++] != EncodingConstants.BINARY_HEADER[2] || - _octetBuffer[_octetBufferOffset++] != EncodingConstants.BINARY_HEADER[3]) { - return false; - } else { - // Fast Infoset document with XML declaration and binary header - return true; - } - } - } - - return false; - } - - // Fast Infoset document with binary header - return true; - } - - private boolean arrayEquals(byte[] b1, int offset, byte[] b2, int length) { - for (int i = 0; i < length; i++) { - if (b1[offset + i] != b2[i]) { - return false; - } - } - - return true; - } - - static public boolean isFastInfosetDocument(InputStream s) throws IOException { - // TODO - // Check for - * This class extends org.sax.xml.DefaultHandler so that concrete SAX - * implementations can be used with javax.xml.parsers.SAXParser and the parse - * methods that take org.sax.xml.DefaultHandler as a parameter. - * - *

- * Buffering of octets that are written to an {@link java.io.OutputStream} is - * supported in a similar manner to a {@link java.io.BufferedOutputStream}. - * Combining buffering with encoding enables better performance. - * - *

- * More than one fast infoset document may be encoded to the - * {@link java.io.OutputStream}. - * - */ -public abstract class Encoder extends DefaultHandler implements FastInfosetSerializer { - - /** - * Character encoding scheme system property for the encoding - * of content and attribute values. - */ - public static final String CHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTY = - "com.sun.xml.internal.fastinfoset.serializer.character-encoding-scheme"; - - /** - * Default character encoding scheme system property for the encoding - * of content and attribute values. - */ - protected static final String _characterEncodingSchemeSystemDefault = getDefaultEncodingScheme(); - - private static String getDefaultEncodingScheme() { - String p = System.getProperty(CHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTY, - UTF_8); - if (p.equals(UTF_16BE)) { - return UTF_16BE; - } else { - return UTF_8; - } - } - - private static int[] NUMERIC_CHARACTERS_TABLE; - - private static int[] DATE_TIME_CHARACTERS_TABLE; - - static { - NUMERIC_CHARACTERS_TABLE = new int[maxCharacter(RestrictedAlphabet.NUMERIC_CHARACTERS) + 1]; - DATE_TIME_CHARACTERS_TABLE = new int[maxCharacter(RestrictedAlphabet.DATE_TIME_CHARACTERS) + 1]; - - for (int i = 0; i < NUMERIC_CHARACTERS_TABLE.length ; i++) { - NUMERIC_CHARACTERS_TABLE[i] = -1; - } - for (int i = 0; i < DATE_TIME_CHARACTERS_TABLE.length ; i++) { - DATE_TIME_CHARACTERS_TABLE[i] = -1; - } - - for (int i = 0; i < RestrictedAlphabet.NUMERIC_CHARACTERS.length() ; i++) { - NUMERIC_CHARACTERS_TABLE[RestrictedAlphabet.NUMERIC_CHARACTERS.charAt(i)] = i; - } - for (int i = 0; i < RestrictedAlphabet.DATE_TIME_CHARACTERS.length() ; i++) { - DATE_TIME_CHARACTERS_TABLE[RestrictedAlphabet.DATE_TIME_CHARACTERS.charAt(i)] = i; - } - } - - private static int maxCharacter(String alphabet) { - int c = 0; - for (int i = 0; i < alphabet.length() ; i++) { - if (c < alphabet.charAt(i)) { - c = alphabet.charAt(i); - } - } - - return c; - } - - /** - * True if DTD and internal subset shall be ignored. - */ - private boolean _ignoreDTD; - - /** - * True if comments shall be ignored. - */ - private boolean _ignoreComments; - - /** - * True if procesing instructions shall be ignored. - */ - private boolean _ignoreProcessingInstructions; - - /** - * True if white space characters for text content shall be ignored. - */ - private boolean _ignoreWhiteSpaceTextContent; - - /** - * True, if the local name string is used as the key to find the - * associated set of qualified names. - *

- * False, if the : string is used as the key - * to find the associated set of qualified names. - */ - private boolean _useLocalNameAsKeyForQualifiedNameLookup; - - /** - * True if strings for text content and attribute values will be - * UTF-8 encoded otherwise they will be UTF-16 encoded. - */ - private boolean _encodingStringsAsUtf8 = true; - - /** - * Encoding constant generated from the string encoding. - */ - private int _nonIdentifyingStringOnThirdBitCES; - - /** - * Encoding constant generated from the string encoding. - */ - private int _nonIdentifyingStringOnFirstBitCES; - - /** - * The map of URIs to algorithms. - */ - private Map _registeredEncodingAlgorithms = new HashMap(); - - /** - * The vocabulary that is used by the encoder - */ - protected SerializerVocabulary _v; - - /** - * The vocabulary application data that is used by the encoder - */ - protected VocabularyApplicationData _vData; - - /** - * True if the vocubulary is internal to the encoder - */ - private boolean _vIsInternal; - - /** - * True if terminatation of an information item is required - */ - protected boolean _terminate = false; - - /** - * The current octet that is to be written. - */ - protected int _b; - - /** - * The {@link java.io.OutputStream} that the encoded XML infoset (the - * fast infoset document) is written to. - */ - protected OutputStream _s; - - /** - * The internal buffer of characters used for the UTF-8 or UTF-16 encoding - * of characters. - */ - protected char[] _charBuffer = new char[512]; - - /** - * The internal buffer of bytes. - */ - protected byte[] _octetBuffer = new byte[1024]; - - /** - * The current position in the internal buffer. - */ - protected int _octetBufferIndex; - - /** - * The current mark in the internal buffer. - * - *

- * If the value of the mark is < 0 then the mark is not set. - */ - protected int _markIndex = -1; - - /** - * The minimum size of [normalized value] of Attribute Information - * Items that will be indexed. - */ - protected int minAttributeValueSize = FastInfosetSerializer.MIN_ATTRIBUTE_VALUE_SIZE; - - /** - * The maximum size of [normalized value] of Attribute Information - * Items that will be indexed. - */ - protected int maxAttributeValueSize = FastInfosetSerializer.MAX_ATTRIBUTE_VALUE_SIZE; - - /** - * The limit on the size of indexed Map for attribute values - * Limit is measured in characters number - */ - protected int attributeValueMapTotalCharactersConstraint = FastInfosetSerializer.ATTRIBUTE_VALUE_MAP_MEMORY_CONSTRAINT / 2; - - /** - * The minimum size of character content chunks - * of Character Information Items or Comment Information Items that - * will be indexed. - */ - protected int minCharacterContentChunkSize = FastInfosetSerializer.MIN_CHARACTER_CONTENT_CHUNK_SIZE; - - /** - * The maximum size of character content chunks - * of Character Information Items or Comment Information Items that - * will be indexed. - */ - protected int maxCharacterContentChunkSize = FastInfosetSerializer.MAX_CHARACTER_CONTENT_CHUNK_SIZE; - - /** - * The limit on the size of indexed Map for character content chunks - * Limit is measured in characters number - */ - protected int characterContentChunkMapTotalCharactersConstraint = FastInfosetSerializer.CHARACTER_CONTENT_CHUNK_MAP_MEMORY_CONSTRAINT / 2; - - /** - * Default constructor for the Encoder. - */ - protected Encoder() { - setCharacterEncodingScheme(_characterEncodingSchemeSystemDefault); - } - - protected Encoder(boolean useLocalNameAsKeyForQualifiedNameLookup) { - setCharacterEncodingScheme(_characterEncodingSchemeSystemDefault); - _useLocalNameAsKeyForQualifiedNameLookup = useLocalNameAsKeyForQualifiedNameLookup; - } - - - // FastInfosetSerializer interface - - /** - * {@inheritDoc} - */ - public final void setIgnoreDTD(boolean ignoreDTD) { - _ignoreDTD = ignoreDTD; - } - - /** - * {@inheritDoc} - */ - public final boolean getIgnoreDTD() { - return _ignoreDTD; - } - - /** - * {@inheritDoc} - */ - public final void setIgnoreComments(boolean ignoreComments) { - _ignoreComments = ignoreComments; - } - - /** - * {@inheritDoc} - */ - public final boolean getIgnoreComments() { - return _ignoreComments; - } - - /** - * {@inheritDoc} - */ - public final void setIgnoreProcesingInstructions(boolean - ignoreProcesingInstructions) { - _ignoreProcessingInstructions = ignoreProcesingInstructions; - } - - /** - * {@inheritDoc} - */ - public final boolean getIgnoreProcesingInstructions() { - return _ignoreProcessingInstructions; - } - - /** - * {@inheritDoc} - */ - public final void setIgnoreWhiteSpaceTextContent(boolean ignoreWhiteSpaceTextContent) { - _ignoreWhiteSpaceTextContent = ignoreWhiteSpaceTextContent; - } - - /** - * {@inheritDoc} - */ - public final boolean getIgnoreWhiteSpaceTextContent() { - return _ignoreWhiteSpaceTextContent; - } - - /** - * {@inheritDoc} - */ - public void setCharacterEncodingScheme(String characterEncodingScheme) { - if (characterEncodingScheme.equals(UTF_16BE)) { - _encodingStringsAsUtf8 = false; - _nonIdentifyingStringOnThirdBitCES = EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_UTF_16_FLAG; - _nonIdentifyingStringOnFirstBitCES = EncodingConstants.NISTRING_UTF_16_FLAG; - } else { - _encodingStringsAsUtf8 = true; - _nonIdentifyingStringOnThirdBitCES = EncodingConstants.CHARACTER_CHUNK; - _nonIdentifyingStringOnFirstBitCES = 0; - } - } - - /** - * {@inheritDoc} - */ - public String getCharacterEncodingScheme() { - return (_encodingStringsAsUtf8) ? UTF_8 : UTF_16BE; - } - - /** - * {@inheritDoc} - */ - public void setRegisteredEncodingAlgorithms(Map algorithms) { - _registeredEncodingAlgorithms = algorithms; - if (_registeredEncodingAlgorithms == null) { - _registeredEncodingAlgorithms = new HashMap(); - } - } - - /** - * {@inheritDoc} - */ - public Map getRegisteredEncodingAlgorithms() { - return _registeredEncodingAlgorithms; - } - - /** - * {@inheritDoc} - */ - public int getMinCharacterContentChunkSize() { - return minCharacterContentChunkSize; - } - - /** - * {@inheritDoc} - */ - public void setMinCharacterContentChunkSize(int size) { - if (size < 0 ) { - size = 0; - } - - minCharacterContentChunkSize = size; - } - - /** - * {@inheritDoc} - */ - public int getMaxCharacterContentChunkSize() { - return maxCharacterContentChunkSize; - } - - /** - * {@inheritDoc} - */ - public void setMaxCharacterContentChunkSize(int size) { - if (size < 0 ) { - size = 0; - } - - maxCharacterContentChunkSize = size; - } - - /** - * {@inheritDoc} - */ - public int getCharacterContentChunkMapMemoryLimit() { - return characterContentChunkMapTotalCharactersConstraint * 2; - } - - /** - * {@inheritDoc} - */ - public void setCharacterContentChunkMapMemoryLimit(int size) { - if (size < 0 ) { - size = 0; - } - - characterContentChunkMapTotalCharactersConstraint = size / 2; - } - - /** - * Checks whether character content chunk (its length) matches length limit - * - * @param length the length of character content chunk is checking to be added to Map. - * @return whether character content chunk length matches limit - */ - public boolean isCharacterContentChunkLengthMatchesLimit(int length) { - return length >= minCharacterContentChunkSize && - length < maxCharacterContentChunkSize; - } - - /** - * Checks whether character content table has enough memory to - * store character content chunk with the given length - * - * @param length the length of character content chunk is checking to be added to Map. - * @param map the custom CharArrayIntMap, which memory limits will be checked. - * @return whether character content map has enough memory - */ - public boolean canAddCharacterContentToTable(int length, CharArrayIntMap map) { - return map.getTotalCharacterCount() + length < - characterContentChunkMapTotalCharactersConstraint; - } - - /** - * {@inheritDoc} - */ - public int getMinAttributeValueSize() { - return minAttributeValueSize; - } - - /** - * {@inheritDoc} - */ - public void setMinAttributeValueSize(int size) { - if (size < 0 ) { - size = 0; - } - - minAttributeValueSize = size; - } - - /** - * {@inheritDoc} - */ - public int getMaxAttributeValueSize() { - return maxAttributeValueSize; - } - - /** - * {@inheritDoc} - */ - public void setMaxAttributeValueSize(int size) { - if (size < 0 ) { - size = 0; - } - - maxAttributeValueSize = size; - } - - /** - * {@inheritDoc} - */ - public void setAttributeValueMapMemoryLimit(int size) { - if (size < 0 ) { - size = 0; - } - - attributeValueMapTotalCharactersConstraint = size / 2; - - } - - /** - * {@inheritDoc} - */ - public int getAttributeValueMapMemoryLimit() { - return attributeValueMapTotalCharactersConstraint * 2; - } - - /** - * Checks whether attribute value (its length) matches length limit - * - * @param length the length of attribute - * @return whether attribute value matches limit - */ - public boolean isAttributeValueLengthMatchesLimit(int length) { - return length >= minAttributeValueSize && - length < maxAttributeValueSize; - } - - /** - * Checks whether attribute table has enough memory to - * store attribute value with the given length - * - * @param length the length of attribute value is checking to be added to Map. - * @return whether attribute map has enough memory - */ - public boolean canAddAttributeToTable(int length) { - return _v.attributeValue.getTotalCharacterCount() + length < - attributeValueMapTotalCharactersConstraint; - } - - /** - * {@inheritDoc} - */ - public void setExternalVocabulary(ExternalVocabulary v) { - // Create internal serializer vocabulary - _v = new SerializerVocabulary(); - // Set the external vocabulary - SerializerVocabulary ev = new SerializerVocabulary(v.vocabulary, - _useLocalNameAsKeyForQualifiedNameLookup); - _v.setExternalVocabulary(v.URI, - ev, false); - - _vIsInternal = true; - } - - /** - * {@inheritDoc} - */ - public void setVocabularyApplicationData(VocabularyApplicationData data) { - _vData = data; - } - - /** - * {@inheritDoc} - */ - public VocabularyApplicationData getVocabularyApplicationData() { - return _vData; - } - - // End of FastInfosetSerializer interface - - /** - * Reset the encoder for reuse encoding another XML infoset. - */ - public void reset() { - _terminate = false; - } - - /** - * Set the OutputStream to encode the XML infoset to a - * fast infoset document. - * - * @param s the OutputStream where the fast infoset document is written to. - */ - public void setOutputStream(OutputStream s) { - _octetBufferIndex = 0; - _markIndex = -1; - _s = s; - } - - /** - * Set the SerializerVocabulary to be used for encoding. - * - * @param vocabulary the vocabulary to be used for encoding. - */ - public void setVocabulary(SerializerVocabulary vocabulary) { - _v = vocabulary; - _vIsInternal = false; - } - - /** - * Encode the header of a fast infoset document. - * - * @param encodeXmlDecl true if the XML declaration should be encoded. - */ - protected final void encodeHeader(boolean encodeXmlDecl) throws IOException { - if (encodeXmlDecl) { - _s.write(EncodingConstants.XML_DECLARATION_VALUES[0]); - } - _s.write(EncodingConstants.BINARY_HEADER); - } - - /** - * Encode the initial vocabulary of a fast infoset document. - * - */ - protected final void encodeInitialVocabulary() throws IOException { - if (_v == null) { - _v = new SerializerVocabulary(); - _vIsInternal = true; - } else if (_vIsInternal) { - _v.clear(); - if (_vData != null) - _vData.clear(); - } - - if (!_v.hasInitialVocabulary() && !_v.hasExternalVocabulary()) { - write(0); - } else if (_v.hasInitialVocabulary()) { - _b = EncodingConstants.DOCUMENT_INITIAL_VOCABULARY_FLAG; - write(_b); - - SerializerVocabulary initialVocabulary = _v.getReadOnlyVocabulary(); - - // TODO check for contents of vocabulary to assign bits - if (initialVocabulary.hasExternalVocabulary()) { - _b = EncodingConstants.INITIAL_VOCABULARY_EXTERNAL_VOCABULARY_FLAG; - write(_b); - write(0); - } - - if (initialVocabulary.hasExternalVocabulary()) { - encodeNonEmptyOctetStringOnSecondBit(_v.getExternalVocabularyURI()); - } - - // TODO check for contents of vocabulary to encode values - } else if (_v.hasExternalVocabulary()) { - _b = EncodingConstants.DOCUMENT_INITIAL_VOCABULARY_FLAG; - write(_b); - - _b = EncodingConstants.INITIAL_VOCABULARY_EXTERNAL_VOCABULARY_FLAG; - write(_b); - write(0); - - encodeNonEmptyOctetStringOnSecondBit(_v.getExternalVocabularyURI()); - } - } - - /** - * Encode the termination of the Document Information Item. - * - */ - protected final void encodeDocumentTermination() throws IOException { - encodeElementTermination(); - encodeTermination(); - _flush(); - _s.flush(); - } - - /** - * Encode the termination of an Element Information Item. - * - */ - protected final void encodeElementTermination() throws IOException { - _terminate = true; - switch (_b) { - case EncodingConstants.TERMINATOR: - _b = EncodingConstants.DOUBLE_TERMINATOR; - break; - case EncodingConstants.DOUBLE_TERMINATOR: - write(EncodingConstants.DOUBLE_TERMINATOR); - default: - _b = EncodingConstants.TERMINATOR; - } - } - - /** - * Encode a termination if required. - * - */ - protected final void encodeTermination() throws IOException { - if (_terminate) { - write(_b); - _b = 0; - _terminate = false; - } - } - - /** - * Encode a Attribute Information Item that is a namespace declaration. - * - * @param prefix the prefix of the namespace declaration, - * if "" then there is no prefix for the namespace declaration. - * @param uri the URI of the namespace declaration, - * if "" then there is no URI for the namespace declaration. - */ - protected final void encodeNamespaceAttribute(String prefix, String uri) throws IOException { - _b = EncodingConstants.NAMESPACE_ATTRIBUTE; - if (prefix.length() > 0) { - _b |= EncodingConstants.NAMESPACE_ATTRIBUTE_PREFIX_FLAG; - } - if (uri.length() > 0) { - _b |= EncodingConstants.NAMESPACE_ATTRIBUTE_NAME_FLAG; - } - - // NOTE a prefix with out a namespace name is an undeclaration - // of the namespace bound to the prefix - // TODO needs to investigate how the startPrefixMapping works in - // relation to undeclaration - - write(_b); - - if (prefix.length() > 0) { - encodeIdentifyingNonEmptyStringOnFirstBit(prefix, _v.prefix); - } - if (uri.length() > 0) { - encodeIdentifyingNonEmptyStringOnFirstBit(uri, _v.namespaceName); - } - } - - /** - * Encode a chunk of Character Information Items. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @throws ArrayIndexOutOfBoundsException. - */ - protected final void encodeCharacters(char[] ch, int offset, int length) throws IOException { - final boolean addToTable = isCharacterContentChunkLengthMatchesLimit(length); - encodeNonIdentifyingStringOnThirdBit(ch, offset, length, _v.characterContentChunk, addToTable, true); - } - - /** - * Encode a chunk of Character Information Items. - * - * If the array of characters is to be indexed (as determined by - * {@link Encoder#characterContentChunkSizeContraint}) then the array is not cloned - * when adding the array to the vocabulary. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @throws ArrayIndexOutOfBoundsException. - */ - protected final void encodeCharactersNoClone(char[] ch, int offset, int length) throws IOException { - final boolean addToTable = isCharacterContentChunkLengthMatchesLimit(length); - encodeNonIdentifyingStringOnThirdBit(ch, offset, length, _v.characterContentChunk, addToTable, false); - } - - /** - * Encode a chunk of Character Information Items using a numeric - * alphabet that results in the encoding of a character in 4 bits - * (or two characters per octet). - * - * @param id the restricted alphabet identifier. - * @param table the table mapping characters to 4 bit values. - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @param addToTable if characters should be added to table. - * @throws ArrayIndexOutOfBoundsException. - */ - protected final void encodeNumericFourBitCharacters(char[] ch, int offset, int length, - boolean addToTable) throws FastInfosetException, IOException { - encodeFourBitCharacters(RestrictedAlphabet.NUMERIC_CHARACTERS_INDEX, - NUMERIC_CHARACTERS_TABLE, ch, offset, length, addToTable); - } - - /** - * Encode a chunk of Character Information Items using a date-time - * alphabet that results in the encoding of a character in 4 bits - * (or two characters per octet). - * - * @param id the restricted alphabet identifier. - * @param table the table mapping characters to 4 bit values. - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @param addToTable if characters should be added to table. - * @throws ArrayIndexOutOfBoundsException. - */ - protected final void encodeDateTimeFourBitCharacters(char[] ch, int offset, int length, - boolean addToTable) throws FastInfosetException, IOException { - encodeFourBitCharacters(RestrictedAlphabet.DATE_TIME_CHARACTERS_INDEX, - DATE_TIME_CHARACTERS_TABLE, ch, offset, length, addToTable); - } - - /** - * Encode a chunk of Character Information Items using a restricted - * alphabet that results in the encoding of a character in 4 bits - * (or two characters per octet). - * - * @param id the restricted alphabet identifier. - * @param table the table mapping characters to 4 bit values. - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @param addToTable if characters should be added to table. - * @throws ArrayIndexOutOfBoundsException. - */ - protected final void encodeFourBitCharacters(int id, int[] table, char[] ch, int offset, int length, - boolean addToTable) throws FastInfosetException, IOException { - if (addToTable) { - // if char array could be added to table - boolean canAddCharacterContentToTable = - canAddCharacterContentToTable(length, _v.characterContentChunk); - - // obtain/get index - int index = canAddCharacterContentToTable ? - _v.characterContentChunk.obtainIndex(ch, offset, length, true) : - _v.characterContentChunk.get(ch, offset, length); - - if (index != KeyIntMap.NOT_PRESENT) { - // if char array is in table - _b = EncodingConstants.CHARACTER_CHUNK | 0x20; - encodeNonZeroIntegerOnFourthBit(index); - return; - } else if (canAddCharacterContentToTable) { - // if char array is not in table, but could be added - _b = EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_RESTRICTED_ALPHABET_FLAG | EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG; - } else { - // if char array is not in table and could not be added - _b = EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_RESTRICTED_ALPHABET_FLAG; - } - } else { - _b = EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_RESTRICTED_ALPHABET_FLAG; - } - - write (_b); - - // Encode bottom 6 bits of enoding algorithm id - _b = id << 2; - - encodeNonEmptyFourBitCharacterStringOnSeventhBit(table, ch, offset, length); - } - - /** - * Encode a chunk of Character Information Items using a restricted - * alphabet table. - * - * @param alphabet the alphabet defining the mapping between characters and - * integer values. - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @param addToTable if characters should be added to table - * @throws ArrayIndexOutOfBoundsException. - * @throws FastInfosetException if the alphabet is not present in the - * vocabulary. - */ - protected final void encodeAlphabetCharacters(String alphabet, char[] ch, int offset, int length, - boolean addToTable) throws FastInfosetException, IOException { - if (addToTable) { - // if char array could be added to table - boolean canAddCharacterContentToTable = - canAddCharacterContentToTable(length, _v.characterContentChunk); - - // obtain/get index - int index = canAddCharacterContentToTable ? - _v.characterContentChunk.obtainIndex(ch, offset, length, true) : - _v.characterContentChunk.get(ch, offset, length); - - if (index != KeyIntMap.NOT_PRESENT) { - // if char array is in table - _b = EncodingConstants.CHARACTER_CHUNK | 0x20; - encodeNonZeroIntegerOnFourthBit(index); - return; - } else if (canAddCharacterContentToTable) { - // if char array is not in table, but could be added - _b = EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_RESTRICTED_ALPHABET_FLAG | EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG; - } else { - // if char array is not in table and could not be added - _b = EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_RESTRICTED_ALPHABET_FLAG; - } - } else { - _b = EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_RESTRICTED_ALPHABET_FLAG; - } - - int id = _v.restrictedAlphabet.get(alphabet); - if (id == KeyIntMap.NOT_PRESENT) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.restrictedAlphabetNotPresent")); - } - id += EncodingConstants.RESTRICTED_ALPHABET_APPLICATION_START; - - _b |= (id & 0xC0) >> 6; - write(_b); - - // Encode bottom 6 bits of enoding algorithm id - _b = (id & 0x3F) << 2; - - encodeNonEmptyNBitCharacterStringOnSeventhBit(alphabet, ch, offset, length); - } - - /** - * Encode a Processing Instruction Information Item. - * - * @param target the target of the processing instruction. - * @param data the data of the processing instruction. - */ - protected final void encodeProcessingInstruction(String target, String data) throws IOException { - write(EncodingConstants.PROCESSING_INSTRUCTION); - - // Target - encodeIdentifyingNonEmptyStringOnFirstBit(target, _v.otherNCName); - - // Data - boolean addToTable = isCharacterContentChunkLengthMatchesLimit(data.length()); - encodeNonIdentifyingStringOnFirstBit(data, _v.otherString, addToTable); - } - - /** - * Encode a Document Type Declaration. - * - * @param systemId the system identifier of the external subset. - * @param publicId the public identifier of the external subset. - */ - protected final void encodeDocumentTypeDeclaration(String systemId, String publicId) throws IOException { - _b = EncodingConstants.DOCUMENT_TYPE_DECLARATION; - if (systemId != null && systemId.length() > 0) { - _b |= EncodingConstants.DOCUMENT_TYPE_SYSTEM_IDENTIFIER_FLAG; - } - if (publicId != null && publicId.length() > 0) { - _b |= EncodingConstants.DOCUMENT_TYPE_PUBLIC_IDENTIFIER_FLAG; - } - write(_b); - - if (systemId != null && systemId.length() > 0) { - encodeIdentifyingNonEmptyStringOnFirstBit(systemId, _v.otherURI); - } - if (publicId != null && publicId.length() > 0) { - encodeIdentifyingNonEmptyStringOnFirstBit(publicId, _v.otherURI); - } - } - - /** - * Encode a Comment Information Item. - * - * @param ch the array of characters that is as comment. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @throws ArrayIndexOutOfBoundsException. - */ - protected final void encodeComment(char[] ch, int offset, int length) throws IOException { - write(EncodingConstants.COMMENT); - - boolean addToTable = isCharacterContentChunkLengthMatchesLimit(length); - encodeNonIdentifyingStringOnFirstBit(ch, offset, length, _v.otherString, addToTable, true); - } - - /** - * Encode a Comment Information Item. - * - * If the array of characters that is a comment is to be indexed (as - * determined by {@link Encoder#characterContentChunkSizeContraint}) then - * the array is not cloned when adding the array to the vocabulary. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @throws ArrayIndexOutOfBoundsException. - */ - protected final void encodeCommentNoClone(char[] ch, int offset, int length) throws IOException { - write(EncodingConstants.COMMENT); - - boolean addToTable = isCharacterContentChunkLengthMatchesLimit(length); - encodeNonIdentifyingStringOnFirstBit(ch, offset, length, _v.otherString, addToTable, false); - } - - /** - * Encode a qualified name of an Element Informaiton Item on the third bit - * of an octet. - * Implementation of clause C.18 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - *

- * The index of the qualified name will be encoded if the name is present - * in the vocabulary otherwise the qualified name will be encoded literally - * (see {@link #encodeLiteralElementQualifiedNameOnThirdBit}). - * - * @param namespaceURI the namespace URI of the qualified name. - * @param prefix the prefix of the qualified name. - * @param localName the local name of the qualified name. - */ - protected final void encodeElementQualifiedNameOnThirdBit(String namespaceURI, String prefix, String localName) throws IOException { - LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName); - if (entry._valueIndex > 0) { - QualifiedName[] names = entry._value; - for (int i = 0; i < entry._valueIndex; i++) { - if ((prefix == names[i].prefix || prefix.equals(names[i].prefix)) - && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) { - encodeNonZeroIntegerOnThirdBit(names[i].index); - return; - } - } - } - - encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, prefix, - localName, entry); - } - - /** - * Encode a literal qualified name of an Element Informaiton Item on the - * third bit of an octet. - * Implementation of clause C.18 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param namespaceURI the namespace URI of the qualified name. - * @param prefix the prefix of the qualified name. - * @param localName the local name of the qualified name. - */ - protected final void encodeLiteralElementQualifiedNameOnThirdBit(String namespaceURI, String prefix, String localName, - LocalNameQualifiedNamesMap.Entry entry) throws IOException { - QualifiedName name = new QualifiedName(prefix, namespaceURI, localName, "", _v.elementName.getNextIndex()); - entry.addQualifiedName(name); - - int namespaceURIIndex = KeyIntMap.NOT_PRESENT; - int prefixIndex = KeyIntMap.NOT_PRESENT; - if (namespaceURI.length() > 0) { - namespaceURIIndex = _v.namespaceName.get(namespaceURI); - if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) { - throw new IOException(CommonResourceBundle.getInstance().getString("message.namespaceURINotIndexed", new Object[]{namespaceURI})); - } - - if (prefix.length() > 0) { - prefixIndex = _v.prefix.get(prefix); - if (prefixIndex == KeyIntMap.NOT_PRESENT) { - throw new IOException(CommonResourceBundle.getInstance().getString("message.prefixNotIndexed", new Object[]{prefix})); - } - } - } - - int localNameIndex = _v.localName.obtainIndex(localName); - - _b |= EncodingConstants.ELEMENT_LITERAL_QNAME_FLAG; - if (namespaceURIIndex >= 0) { - _b |= EncodingConstants.LITERAL_QNAME_NAMESPACE_NAME_FLAG; - if (prefixIndex >= 0) { - _b |= EncodingConstants.LITERAL_QNAME_PREFIX_FLAG; - } - } - write(_b); - - if (namespaceURIIndex >= 0) { - if (prefixIndex >= 0) { - encodeNonZeroIntegerOnSecondBitFirstBitOne(prefixIndex); - } - encodeNonZeroIntegerOnSecondBitFirstBitOne(namespaceURIIndex); - } - - if (localNameIndex >= 0) { - encodeNonZeroIntegerOnSecondBitFirstBitOne(localNameIndex); - } else { - encodeNonEmptyOctetStringOnSecondBit(localName); - } - } - - /** - * Encode a qualified name of an Attribute Informaiton Item on the third bit - * of an octet. - * Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - *

- * The index of the qualified name will be encoded if the name is present - * in the vocabulary otherwise the qualified name will be encoded literally - * (see {@link #encodeLiteralAttributeQualifiedNameOnSecondBit}). - * - * @param namespaceURI the namespace URI of the qualified name. - * @param prefix the prefix of the qualified name. - * @param localName the local name of the qualified name. - */ - protected final void encodeAttributeQualifiedNameOnSecondBit(String namespaceURI, String prefix, String localName) throws IOException { - LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName); - if (entry._valueIndex > 0) { - QualifiedName[] names = entry._value; - for (int i = 0; i < entry._valueIndex; i++) { - if ((prefix == names[i].prefix || prefix.equals(names[i].prefix)) - && (namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) { - encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index); - return; - } - } - } - - encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, prefix, - localName, entry); - } - - /** - * Encode a literal qualified name of an Attribute Informaiton Item on the - * third bit of an octet. - * Implementation of clause C.17 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param namespaceURI the namespace URI of the qualified name. - * @param prefix the prefix of the qualified name. - * @param localName the local name of the qualified name. - */ - protected final boolean encodeLiteralAttributeQualifiedNameOnSecondBit(String namespaceURI, String prefix, String localName, - LocalNameQualifiedNamesMap.Entry entry) throws IOException { - int namespaceURIIndex = KeyIntMap.NOT_PRESENT; - int prefixIndex = KeyIntMap.NOT_PRESENT; - if (namespaceURI.length() > 0) { - namespaceURIIndex = _v.namespaceName.get(namespaceURI); - if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) { - if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME || - namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) { - return false; - } else { - throw new IOException(CommonResourceBundle.getInstance().getString("message.namespaceURINotIndexed", new Object[]{namespaceURI})); - } - } - - if (prefix.length() > 0) { - prefixIndex = _v.prefix.get(prefix); - if (prefixIndex == KeyIntMap.NOT_PRESENT) { - throw new IOException(CommonResourceBundle.getInstance().getString("message.prefixNotIndexed", new Object[]{prefix})); - } - } - } - - int localNameIndex = _v.localName.obtainIndex(localName); - - QualifiedName name = new QualifiedName(prefix, namespaceURI, localName, "", _v.attributeName.getNextIndex()); - entry.addQualifiedName(name); - - _b = EncodingConstants.ATTRIBUTE_LITERAL_QNAME_FLAG; - if (namespaceURI.length() > 0) { - _b |= EncodingConstants.LITERAL_QNAME_NAMESPACE_NAME_FLAG; - if (prefix.length() > 0) { - _b |= EncodingConstants.LITERAL_QNAME_PREFIX_FLAG; - } - } - - write(_b); - - if (namespaceURIIndex >= 0) { - if (prefixIndex >= 0) { - encodeNonZeroIntegerOnSecondBitFirstBitOne(prefixIndex); - } - encodeNonZeroIntegerOnSecondBitFirstBitOne(namespaceURIIndex); - } else if (namespaceURI != "") { - // XML prefix and namespace name - encodeNonEmptyOctetStringOnSecondBit("xml"); - encodeNonEmptyOctetStringOnSecondBit("http://www.w3.org/XML/1998/namespace"); - } - - if (localNameIndex >= 0) { - encodeNonZeroIntegerOnSecondBitFirstBitOne(localNameIndex); - } else { - encodeNonEmptyOctetStringOnSecondBit(localName); - } - - return true; - } - - /** - * Encode a non identifying string on the first bit of an octet. - * Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param s the string to encode - * @param map the vocabulary table of strings to indexes. - * @param addToTable true if the string could be added to the vocabulary - * table (if table has enough memory) - * @param mustBeAddedToTable true if the string must be added to the vocabulary - * table (if not already present in the table). - */ - protected final void encodeNonIdentifyingStringOnFirstBit(String s, StringIntMap map, - boolean addToTable, boolean mustBeAddedToTable) throws IOException { - if (s == null || s.length() == 0) { - // C.26 an index (first bit '1') with seven '1' bits for an empty string - write(0xFF); - } else { - if (addToTable || mustBeAddedToTable) { - // if attribute value could be added to table - boolean canAddAttributeToTable = mustBeAddedToTable || - canAddAttributeToTable(s.length()); - - // obtain/get index - int index = canAddAttributeToTable ? - map.obtainIndex(s) : - map.get(s); - - if (index != KeyIntMap.NOT_PRESENT) { - // if attribute value is in table - encodeNonZeroIntegerOnSecondBitFirstBitOne(index); - } else if (canAddAttributeToTable) { - // if attribute value is not in table, but could be added - _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG | - _nonIdentifyingStringOnFirstBitCES; - encodeNonEmptyCharacterStringOnFifthBit(s); - } else { - // if attribute value is not in table and could not be added - _b = _nonIdentifyingStringOnFirstBitCES; - encodeNonEmptyCharacterStringOnFifthBit(s); - } - } else { - _b = _nonIdentifyingStringOnFirstBitCES; - encodeNonEmptyCharacterStringOnFifthBit(s); - } - } - } - - /** - * Encode a non identifying string on the first bit of an octet. - * Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param s the string to encode - * @param map the vocabulary table of character arrays to indexes. - * @param addToTable true if the string should be added to the vocabulary - * table (if not already present in the table). - */ - protected final void encodeNonIdentifyingStringOnFirstBit(String s, CharArrayIntMap map, boolean addToTable) throws IOException { - if (s == null || s.length() == 0) { - // C.26 an index (first bit '1') with seven '1' bits for an empty string - write(0xFF); - } else { - if (addToTable) { - final char[] ch = s.toCharArray(); - final int length = s.length(); - - // if char array could be added to table - boolean canAddCharacterContentToTable = - canAddCharacterContentToTable(length, map); - - // obtain/get index - int index = canAddCharacterContentToTable ? - map.obtainIndex(ch, 0, length, false) : - map.get(ch, 0, length); - - if (index != KeyIntMap.NOT_PRESENT) { - // if char array is in table - encodeNonZeroIntegerOnSecondBitFirstBitOne(index); - } else if (canAddCharacterContentToTable) { - // if char array is not in table, but could be added - _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG | - _nonIdentifyingStringOnFirstBitCES; - encodeNonEmptyCharacterStringOnFifthBit(ch, 0, length); - } else { - // if char array is not in table and could not be added - _b = _nonIdentifyingStringOnFirstBitCES; - encodeNonEmptyCharacterStringOnFifthBit(s); - } - } else { - _b = _nonIdentifyingStringOnFirstBitCES; - encodeNonEmptyCharacterStringOnFifthBit(s); - } - } - } - - /** - * Encode a non identifying string on the first bit of an octet. - * Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @param map the vocabulary table of character arrays to indexes. - * @param addToTable true if the string should be added to the vocabulary - * table (if not already present in the table). - * @param clone true if the array of characters should be cloned if added - * to the vocabulary table. - */ - protected final void encodeNonIdentifyingStringOnFirstBit(char[] ch, int offset, int length, CharArrayIntMap map, - boolean addToTable, boolean clone) throws IOException { - if (length == 0) { - // C.26 an index (first bit '1') with seven '1' bits for an empty string - write(0xFF); - } else { - if (addToTable) { - // if char array could be added to table - boolean canAddCharacterContentToTable = - canAddCharacterContentToTable(length, map); - - // obtain/get index - int index = canAddCharacterContentToTable ? - map.obtainIndex(ch, offset, length, clone) : - map.get(ch, offset, length); - - if (index != KeyIntMap.NOT_PRESENT) { - // if char array is in table - encodeNonZeroIntegerOnSecondBitFirstBitOne(index); - } else if (canAddCharacterContentToTable) { - // if char array is not in table, but could be added - _b = EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG | - _nonIdentifyingStringOnFirstBitCES; - encodeNonEmptyCharacterStringOnFifthBit(ch, offset, length); - } else { - // if char array is not in table and could not be added - _b = _nonIdentifyingStringOnFirstBitCES; - encodeNonEmptyCharacterStringOnFifthBit(ch, offset, length); - } - } else { - _b = _nonIdentifyingStringOnFirstBitCES; - encodeNonEmptyCharacterStringOnFifthBit(ch, offset, length); - } - } - } - - protected final void encodeNumericNonIdentifyingStringOnFirstBit( - String s, boolean addToTable, boolean mustBeAddedToTable) - throws IOException, FastInfosetException { - encodeNonIdentifyingStringOnFirstBit( - RestrictedAlphabet.NUMERIC_CHARACTERS_INDEX, - NUMERIC_CHARACTERS_TABLE, s, addToTable, - mustBeAddedToTable); - } - - protected final void encodeDateTimeNonIdentifyingStringOnFirstBit( - String s, boolean addToTable, boolean mustBeAddedToTable) - throws IOException, FastInfosetException { - encodeNonIdentifyingStringOnFirstBit( - RestrictedAlphabet.DATE_TIME_CHARACTERS_INDEX, - DATE_TIME_CHARACTERS_TABLE, s, addToTable, - mustBeAddedToTable); - } - - protected final void encodeNonIdentifyingStringOnFirstBit(int id, int[] table, - String s, boolean addToTable, boolean mustBeAddedToTable) - throws IOException, FastInfosetException { - if (s == null || s.length() == 0) { - // C.26 an index (first bit '1') with seven '1' bits for an empty string - write(0xFF); - return; - } - - if (addToTable || mustBeAddedToTable) { - // if attribute value could be added to table - boolean canAddAttributeToTable = mustBeAddedToTable || - canAddAttributeToTable(s.length()); - - // obtain/get index - int index = canAddAttributeToTable ? - _v.attributeValue.obtainIndex(s) : - _v.attributeValue.get(s); - - if (index != KeyIntMap.NOT_PRESENT) { - // if attribute value is in table - encodeNonZeroIntegerOnSecondBitFirstBitOne(index); - return; - } else if (canAddAttributeToTable) { - // if attribute value is not in table, but could be added - _b = EncodingConstants.NISTRING_RESTRICTED_ALPHABET_FLAG | - EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG; - } else { - // if attribute value is not in table and could not be added - _b = EncodingConstants.NISTRING_RESTRICTED_ALPHABET_FLAG; - } - } else { - _b = EncodingConstants.NISTRING_RESTRICTED_ALPHABET_FLAG; - } - - // Encode identification and top four bits of alphabet id - write (_b | ((id & 0xF0) >> 4)); - // Encode bottom 4 bits of alphabet id - _b = (id & 0x0F) << 4; - - final int length = s.length(); - final int octetPairLength = length / 2; - final int octetSingleLength = length % 2; - encodeNonZeroOctetStringLengthOnFifthBit(octetPairLength + octetSingleLength); - encodeNonEmptyFourBitCharacterString(table, s.toCharArray(), 0, octetPairLength, octetSingleLength); - } - - /** - * Encode a non identifying string on the first bit of an octet as binary - * data using an encoding algorithm. - * Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param URI the encoding algorithm URI. If the URI == null then the - * encoding algorithm identifier takes precendence. - * @param id the encoding algorithm identifier. - * @param data the data to be encoded using an encoding algorithm. - * @throws EncodingAlgorithmException if the encoding algorithm URI is not - * present in the vocabulary, or the encoding algorithm identifier - * is not with the required range. - */ - protected final void encodeNonIdentifyingStringOnFirstBit(String URI, int id, Object data) throws FastInfosetException, IOException { - if (URI != null) { - id = _v.encodingAlgorithm.get(URI); - if (id == KeyIntMap.NOT_PRESENT) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.EncodingAlgorithmURI", new Object[]{URI})); - } - id += EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START; - - EncodingAlgorithm ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI); - if (ea != null) { - encodeAIIObjectAlgorithmData(id, data, ea); - } else { - if (data instanceof byte[]) { - byte[] d = (byte[])data; - encodeAIIOctetAlgorithmData(id, d, 0, d.length); - } else { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.nullEncodingAlgorithmURI")); - } - } - } else if (id <= EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - int length = 0; - switch(id) { - case EncodingAlgorithmIndexes.HEXADECIMAL: - case EncodingAlgorithmIndexes.BASE64: - length = ((byte[])data).length; - break; - case EncodingAlgorithmIndexes.SHORT: - length = ((short[])data).length; - break; - case EncodingAlgorithmIndexes.INT: - length = ((int[])data).length; - break; - case EncodingAlgorithmIndexes.LONG: - case EncodingAlgorithmIndexes.UUID: - length = ((long[])data).length; - break; - case EncodingAlgorithmIndexes.BOOLEAN: - length = ((boolean[])data).length; - break; - case EncodingAlgorithmIndexes.FLOAT: - length = ((float[])data).length; - break; - case EncodingAlgorithmIndexes.DOUBLE: - length = ((double[])data).length; - break; - case EncodingAlgorithmIndexes.CDATA: - throw new UnsupportedOperationException(CommonResourceBundle.getInstance().getString("message.CDATA")); - default: - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.UnsupportedBuiltInAlgorithm", new Object[]{Integer.valueOf(id)})); - } - encodeAIIBuiltInAlgorithmData(id, data, 0, length); - } else if (id >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - if (data instanceof byte[]) { - byte[] d = (byte[])data; - encodeAIIOctetAlgorithmData(id, d, 0, d.length); - } else { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.nullEncodingAlgorithmURI")); - } - } else { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.identifiers10to31Reserved")); - } - } - - /** - * Encode the [normalized value] of an Attribute Information Item using - * using an encoding algorithm. - * Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param id the encoding algorithm identifier. - * @param d the data, as an array of bytes, to be encoded. - * @param offset the offset into the array of bytes. - * @param length the length of bytes. - */ - protected final void encodeAIIOctetAlgorithmData(int id, byte[] d, int offset, int length) throws IOException { - // Encode identification and top four bits of encoding algorithm id - write (EncodingConstants.NISTRING_ENCODING_ALGORITHM_FLAG | - ((id & 0xF0) >> 4)); - - // Encode bottom 4 bits of enoding algorithm id - _b = (id & 0x0F) << 4; - - // Encode the length - encodeNonZeroOctetStringLengthOnFifthBit(length); - - write(d, offset, length); - } - - /** - * Encode the [normalized value] of an Attribute Information Item using - * using an encoding algorithm. - * Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param id the encoding algorithm identifier. - * @param data the data to be encoded using an encoding algorithm. - * @param ea the encoding algorithm to use to encode the data into an - * array of bytes. - */ - protected final void encodeAIIObjectAlgorithmData(int id, Object data, EncodingAlgorithm ea) throws FastInfosetException, IOException { - // Encode identification and top four bits of encoding algorithm id - write (EncodingConstants.NISTRING_ENCODING_ALGORITHM_FLAG | - ((id & 0xF0) >> 4)); - - // Encode bottom 4 bits of enoding algorithm id - _b = (id & 0x0F) << 4; - - _encodingBufferOutputStream.reset(); - ea.encodeToOutputStream(data, _encodingBufferOutputStream); - encodeNonZeroOctetStringLengthOnFifthBit(_encodingBufferIndex); - write(_encodingBuffer, _encodingBufferIndex); - } - - /** - * Encode the [normalized value] of an Attribute Information Item using - * using a built in encoding algorithm. - * Implementation of clause C.14 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param id the built in encoding algorithm identifier. - * @param data the data to be encoded using an encoding algorithm. The data - * represents an array of items specified by the encoding algorithm - * identifier - * @param offset the offset into the array of bytes. - * @param length the length of bytes. - */ - protected final void encodeAIIBuiltInAlgorithmData(int id, Object data, int offset, int length) throws IOException { - // Encode identification and top four bits of encoding algorithm id - write (EncodingConstants.NISTRING_ENCODING_ALGORITHM_FLAG | - ((id & 0xF0) >> 4)); - - // Encode bottom 4 bits of enoding algorithm id - _b = (id & 0x0F) << 4; - - final int octetLength = BuiltInEncodingAlgorithmFactory.getAlgorithm(id). - getOctetLengthFromPrimitiveLength(length); - - encodeNonZeroOctetStringLengthOnFifthBit(octetLength); - - ensureSize(octetLength); - BuiltInEncodingAlgorithmFactory.getAlgorithm(id). - encodeToBytes(data, offset, length, _octetBuffer, _octetBufferIndex); - _octetBufferIndex += octetLength; - } - - /** - * Encode a non identifying string on the third bit of an octet. - * Implementation of clause C.15 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * @param map the vocabulary table of character arrays to indexes. - * @param addToTable true if the array of characters should be added to the vocabulary - * table (if not already present in the table). - * @param clone true if the array of characters should be cloned if added - * to the vocabulary table. - */ - protected final void encodeNonIdentifyingStringOnThirdBit(char[] ch, int offset, int length, - CharArrayIntMap map, boolean addToTable, boolean clone) throws IOException { - // length cannot be zero since sequence of CIIs has to be > 0 - - if (addToTable) { - // if char array could be added to table - boolean canAddCharacterContentToTable = - canAddCharacterContentToTable(length, map); - - // obtain/get index - int index = canAddCharacterContentToTable ? - map.obtainIndex(ch, offset, length, clone) : - map.get(ch, offset, length); - - if (index != KeyIntMap.NOT_PRESENT) { - // if char array is in table - _b = EncodingConstants.CHARACTER_CHUNK | 0x20; - encodeNonZeroIntegerOnFourthBit(index); - } else if (canAddCharacterContentToTable) { - // if char array is not in table, but could be added - _b = EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG | - _nonIdentifyingStringOnThirdBitCES; - encodeNonEmptyCharacterStringOnSeventhBit(ch, offset, length); - } else { - // if char array is not in table and could not be added - _b = _nonIdentifyingStringOnThirdBitCES; - encodeNonEmptyCharacterStringOnSeventhBit(ch, offset, length); - } - } else { - // char array will not be added to map - _b = _nonIdentifyingStringOnThirdBitCES; - encodeNonEmptyCharacterStringOnSeventhBit(ch, offset, length); - } - } - - /** - * Encode a non identifying string on the third bit of an octet as binary - * data using an encoding algorithm. - * Implementation of clause C.15 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param URI the encoding algorithm URI. If the URI == null then the - * encoding algorithm identifier takes precendence. - * @param id the encoding algorithm identifier. - * @param data the data to be encoded using an encoding algorithm. - * @throws EncodingAlgorithmException if the encoding algorithm URI is not - * present in the vocabulary, or the encoding algorithm identifier - * is not with the required range. - */ - protected final void encodeNonIdentifyingStringOnThirdBit(String URI, int id, Object data) throws FastInfosetException, IOException { - if (URI != null) { - id = _v.encodingAlgorithm.get(URI); - if (id == KeyIntMap.NOT_PRESENT) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.EncodingAlgorithmURI", new Object[]{URI})); - } - id += EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START; - - EncodingAlgorithm ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI); - if (ea != null) { - encodeCIIObjectAlgorithmData(id, data, ea); - } else { - if (data instanceof byte[]) { - byte[] d = (byte[])data; - encodeCIIOctetAlgorithmData(id, d, 0, d.length); - } else { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.nullEncodingAlgorithmURI")); - } - } - } else if (id <= EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - int length = 0; - switch(id) { - case EncodingAlgorithmIndexes.HEXADECIMAL: - case EncodingAlgorithmIndexes.BASE64: - length = ((byte[])data).length; - break; - case EncodingAlgorithmIndexes.SHORT: - length = ((short[])data).length; - break; - case EncodingAlgorithmIndexes.INT: - length = ((int[])data).length; - break; - case EncodingAlgorithmIndexes.LONG: - case EncodingAlgorithmIndexes.UUID: - length = ((long[])data).length; - break; - case EncodingAlgorithmIndexes.BOOLEAN: - length = ((boolean[])data).length; - break; - case EncodingAlgorithmIndexes.FLOAT: - length = ((float[])data).length; - break; - case EncodingAlgorithmIndexes.DOUBLE: - length = ((double[])data).length; - break; - case EncodingAlgorithmIndexes.CDATA: - throw new UnsupportedOperationException(CommonResourceBundle.getInstance().getString("message.CDATA")); - default: - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.UnsupportedBuiltInAlgorithm", new Object[]{Integer.valueOf(id)})); - } - encodeCIIBuiltInAlgorithmData(id, data, 0, length); - } else if (id >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - if (data instanceof byte[]) { - byte[] d = (byte[])data; - encodeCIIOctetAlgorithmData(id, d, 0, d.length); - } else { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.nullEncodingAlgorithmURI")); - } - } else { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.identifiers10to31Reserved")); - } - } - - /** - * Encode a non identifying string on the third bit of an octet as binary - * data using an encoding algorithm. - * Implementation of clause C.15 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param URI the encoding algorithm URI. If the URI == null then the - * encoding algorithm identifier takes precendence. - * @param id the encoding algorithm identifier. - * @param d the data, as an array of bytes, to be encoded. - * @param offset the offset into the array of bytes. - * @param length the length of bytes. - * @throws EncodingAlgorithmException if the encoding algorithm URI is not - * present in the vocabulary. - */ - protected final void encodeNonIdentifyingStringOnThirdBit(String URI, int id, byte[] d, int offset, int length) throws FastInfosetException, IOException { - if (URI != null) { - id = _v.encodingAlgorithm.get(URI); - if (id == KeyIntMap.NOT_PRESENT) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.EncodingAlgorithmURI", new Object[]{URI})); - } - id += EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START; - } - - encodeCIIOctetAlgorithmData(id, d, offset, length); - } - - /** - * Encode a chunk of Character Information Items using - * using an encoding algorithm. - * Implementation of clause C.15 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param id the encoding algorithm identifier. - * @param d the data, as an array of bytes, to be encoded. - * @param offset the offset into the array of bytes. - * @param length the length of bytes. - */ - protected final void encodeCIIOctetAlgorithmData(int id, byte[] d, int offset, int length) throws IOException { - // Encode identification and top two bits of encoding algorithm id - write (EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_ENCODING_ALGORITHM_FLAG | - ((id & 0xC0) >> 6)); - - // Encode bottom 6 bits of enoding algorithm id - _b = (id & 0x3F) << 2; - - // Encode the length - encodeNonZeroOctetStringLengthOnSenventhBit(length); - - write(d, offset, length); - } - - /** - * Encode a chunk of Character Information Items using - * using an encoding algorithm. - * Implementation of clause C.15 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param id the encoding algorithm identifier. - * @param data the data to be encoded using an encoding algorithm. - * @param ea the encoding algorithm to use to encode the data into an - * array of bytes. - */ - protected final void encodeCIIObjectAlgorithmData(int id, Object data, EncodingAlgorithm ea) throws FastInfosetException, IOException { - // Encode identification and top two bits of encoding algorithm id - write (EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_ENCODING_ALGORITHM_FLAG | - ((id & 0xC0) >> 6)); - - // Encode bottom 6 bits of enoding algorithm id - _b = (id & 0x3F) << 2; - - _encodingBufferOutputStream.reset(); - ea.encodeToOutputStream(data, _encodingBufferOutputStream); - encodeNonZeroOctetStringLengthOnSenventhBit(_encodingBufferIndex); - write(_encodingBuffer, _encodingBufferIndex); - } - - /** - * Encode a chunk of Character Information Items using - * using an encoding algorithm. - * Implementation of clause C.15 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param id the built in encoding algorithm identifier. - * @param data the data to be encoded using an encoding algorithm. The data - * represents an array of items specified by the encoding algorithm - * identifier - * @param offset the offset into the array of bytes. - * @param length the length of bytes. - */ - protected final void encodeCIIBuiltInAlgorithmData(int id, Object data, int offset, int length) throws FastInfosetException, IOException { - // Encode identification and top two bits of encoding algorithm id - write (EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_ENCODING_ALGORITHM_FLAG | - ((id & 0xC0) >> 6)); - - // Encode bottom 6 bits of enoding algorithm id - _b = (id & 0x3F) << 2; - - final int octetLength = BuiltInEncodingAlgorithmFactory.getAlgorithm(id). - getOctetLengthFromPrimitiveLength(length); - - encodeNonZeroOctetStringLengthOnSenventhBit(octetLength); - - ensureSize(octetLength); - BuiltInEncodingAlgorithmFactory.getAlgorithm(id). - encodeToBytes(data, offset, length, _octetBuffer, _octetBufferIndex); - _octetBufferIndex += octetLength; - } - - /** - * Encode a chunk of Character Information Items using - * using the CDATA built in encoding algorithm. - * Implementation of clause C.15 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - */ - protected final void encodeCIIBuiltInAlgorithmDataAsCDATA(char[] ch, int offset, int length) throws FastInfosetException, IOException { - // Encode identification and top two bits of encoding algorithm id - write (EncodingConstants.CHARACTER_CHUNK | EncodingConstants.CHARACTER_CHUNK_ENCODING_ALGORITHM_FLAG); - - // Encode bottom 6 bits of enoding algorithm id - _b = EncodingAlgorithmIndexes.CDATA << 2; - - - length = encodeUTF8String(ch, offset, length); - encodeNonZeroOctetStringLengthOnSenventhBit(length); - write(_encodingBuffer, length); - } - - /** - * Encode a non empty identifying string on the first bit of an octet. - * Implementation of clause C.13 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param s the identifying string. - * @param map the vocabulary table to use to determin the index of the - * identifying string - */ - protected final void encodeIdentifyingNonEmptyStringOnFirstBit(String s, StringIntMap map) throws IOException { - int index = map.obtainIndex(s); - if (index == KeyIntMap.NOT_PRESENT) { - // _b = 0; - encodeNonEmptyOctetStringOnSecondBit(s); - } else { - // _b = 0x80; - encodeNonZeroIntegerOnSecondBitFirstBitOne(index); - } - } - - /** - * Encode a non empty string on the second bit of an octet using the UTF-8 - * encoding. - * Implementation of clause C.22 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param s the string. - */ - protected final void encodeNonEmptyOctetStringOnSecondBit(String s) throws IOException { - final int length = encodeUTF8String(s); - encodeNonZeroOctetStringLengthOnSecondBit(length); - write(_encodingBuffer, length); - } - - /** - * Encode the length of a UTF-8 encoded string on the second bit of an octet. - * Implementation of clause C.22 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param length the length to encode. - */ - protected final void encodeNonZeroOctetStringLengthOnSecondBit(int length) throws IOException { - if (length < EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_SMALL_LIMIT) { - // [1, 64] - write(length - 1); - } else if (length < EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_LIMIT) { - // [65, 320] - write(EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_FLAG); // 010 00000 - write(length - EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_SMALL_LIMIT); - } else { - // [321, 4294967296] - write(EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_LARGE_FLAG); // 0110 0000 - length -= EncodingConstants.OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_LIMIT; - write(length >>> 24); - write((length >> 16) & 0xFF); - write((length >> 8) & 0xFF); - write(length & 0xFF); - } - } - - /** - * Encode a non empty string on the fifth bit of an octet using the UTF-8 - * or UTF-16 encoding. - * Implementation of clause C.23 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param s the string. - */ - protected final void encodeNonEmptyCharacterStringOnFifthBit(String s) throws IOException { - final int length = (_encodingStringsAsUtf8) ? encodeUTF8String(s) : encodeUtf16String(s); - encodeNonZeroOctetStringLengthOnFifthBit(length); - write(_encodingBuffer, length); - } - - /** - * Encode a non empty string on the fifth bit of an octet using the UTF-8 - * or UTF-16 encoding. - * Implementation of clause C.23 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - */ - protected final void encodeNonEmptyCharacterStringOnFifthBit(char[] ch, int offset, int length) throws IOException { - length = (_encodingStringsAsUtf8) ? encodeUTF8String(ch, offset, length) : encodeUtf16String(ch, offset, length); - encodeNonZeroOctetStringLengthOnFifthBit(length); - write(_encodingBuffer, length); - } - - /** - * Encode the length of a UTF-8 or UTF-16 encoded string on the fifth bit - * of an octet. - * Implementation of clause C.23 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param length the length to encode. - */ - protected final void encodeNonZeroOctetStringLengthOnFifthBit(int length) throws IOException { - if (length < EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT) { - // [1, 8] - write(_b | (length - 1)); - } else if (length < EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT) { - // [9, 264] - write(_b | EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_FLAG); // 000010 00 - write(length - EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT); - } else { - // [265, 4294967296] - write(_b | EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_LARGE_FLAG); // 000011 00 - length -= EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - write(length >>> 24); - write((length >> 16) & 0xFF); - write((length >> 8) & 0xFF); - write(length & 0xFF); - } - } - - /** - * Encode a non empty string on the seventh bit of an octet using the UTF-8 - * or UTF-16 encoding. - * Implementation of clause C.24 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - */ - protected final void encodeNonEmptyCharacterStringOnSeventhBit(char[] ch, int offset, int length) throws IOException { - length = (_encodingStringsAsUtf8) ? encodeUTF8String(ch, offset, length) : encodeUtf16String(ch, offset, length); - encodeNonZeroOctetStringLengthOnSenventhBit(length); - write(_encodingBuffer, length); - } - - /** - * Encode a non empty string on the seventh bit of an octet using a restricted - * alphabet that results in the encoding of a character in 4 bits - * (or two characters per octet). - * Implementation of clause C.24 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param table the table mapping characters to 4 bit values. - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - */ - protected final void encodeNonEmptyFourBitCharacterStringOnSeventhBit(int[] table, char[] ch, int offset, int length) throws FastInfosetException, IOException { - final int octetPairLength = length / 2; - final int octetSingleLength = length % 2; - - // Encode the length - encodeNonZeroOctetStringLengthOnSenventhBit(octetPairLength + octetSingleLength); - encodeNonEmptyFourBitCharacterString(table, ch, offset, octetPairLength, octetSingleLength); - } - - protected final void encodeNonEmptyFourBitCharacterString(int[] table, char[] ch, int offset, - int octetPairLength, int octetSingleLength) throws FastInfosetException, IOException { - ensureSize(octetPairLength + octetSingleLength); - // Encode all pairs - int v = 0; - for (int i = 0; i < octetPairLength; i++) { - v = (table[ch[offset++]] << 4) | table[ch[offset++]]; - if (v < 0) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.characterOutofAlphabetRange")); - } - _octetBuffer[_octetBufferIndex++] = (byte)v; - } - // Encode single character at end with termination bits - if (octetSingleLength == 1) { - v = (table[ch[offset]] << 4) | 0x0F; - if (v < 0) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.characterOutofAlphabetRange")); - } - _octetBuffer[_octetBufferIndex++] = (byte)v; - } - } - - /** - * Encode a non empty string on the seventh bit of an octet using a restricted - * alphabet table. - * Implementation of clause C.24 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param alphabet the alphabet defining the mapping between characters and - * integer values. - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - */ - protected final void encodeNonEmptyNBitCharacterStringOnSeventhBit(String alphabet, char[] ch, int offset, int length) throws FastInfosetException, IOException { - int bitsPerCharacter = 1; - while ((1 << bitsPerCharacter) <= alphabet.length()) { - bitsPerCharacter++; - } - - final int bits = length * bitsPerCharacter; - final int octets = bits / 8; - final int bitsOfLastOctet = bits % 8; - final int totalOctets = octets + ((bitsOfLastOctet > 0) ? 1 : 0); - - // Encode the length - encodeNonZeroOctetStringLengthOnSenventhBit(totalOctets); - - resetBits(); - ensureSize(totalOctets); - int v = 0; - for (int i = 0; i < length; i++) { - final char c = ch[offset + i]; - // This is grotesquely slow, need to use hash table of character to int value - for (v = 0; v < alphabet.length(); v++) { - if (c == alphabet.charAt(v)) { - break; - } - } - if (v == alphabet.length()) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.characterOutofAlphabetRange")); - } - writeBits(bitsPerCharacter, v); - } - - if (bitsOfLastOctet > 0) { - _b |= (1 << (8 - bitsOfLastOctet)) - 1; - write(_b); - } - } - - private int _bitsLeftInOctet; - - private final void resetBits() { - _bitsLeftInOctet = 8; - _b = 0; - } - - private final void writeBits(int bits, int v) throws IOException { - while (bits > 0) { - final int bit = (v & (1 << --bits)) > 0 ? 1 : 0; - _b |= bit << (--_bitsLeftInOctet); - if (_bitsLeftInOctet == 0) { - write(_b); - _bitsLeftInOctet = 8; - _b = 0; - } - } - } - - /** - * Encode the length of a encoded string on the seventh bit - * of an octet. - * Implementation of clause C.24 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param length the length to encode. - */ - protected final void encodeNonZeroOctetStringLengthOnSenventhBit(int length) throws IOException { - if (length < EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT) { - // [1, 2] - write(_b | (length - 1)); - } else if (length < EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT) { - // [3, 258] - write(_b | EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_FLAG); // 00000010 - write(length - EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT); - } else { - // [259, 4294967296] - write(_b | EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_LARGE_FLAG); // 00000011 - length -= EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - write(length >>> 24); - write((length >> 16) & 0xFF); - write((length >> 8) & 0xFF); - write(length & 0xFF); - } - } - - /** - * Encode a non zero integer on the second bit of an octet, setting - * the first bit to 1. - * Implementation of clause C.24 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - *

- * The first bit of the first octet is set, as specified in clause C.13 of - * ITU-T Rec. X.891 | ISO/IEC 24824-1 - * - * @param i The integer to encode, which is a member of the interval - * [0, 1048575]. In the specification the interval is [1, 1048576] - * - */ - protected final void encodeNonZeroIntegerOnSecondBitFirstBitOne(int i) throws IOException { - if (i < EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT) { - // [1, 64] ( [0, 63] ) 6 bits - write(0x80 | i); - } else if (i < EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT) { - // [65, 8256] ( [64, 8255] ) 13 bits - i -= EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - _b = (0x80 | EncodingConstants.INTEGER_2ND_BIT_MEDIUM_FLAG) | (i >> 8); // 010 00000 - // _b = 0xC0 | (i >> 8); // 010 00000 - write(_b); - write(i & 0xFF); - } else if (i < EncodingConstants.INTEGER_2ND_BIT_LARGE_LIMIT) { - // [8257, 1048576] ( [8256, 1048575] ) 20 bits - i -= EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - _b = (0x80 | EncodingConstants.INTEGER_2ND_BIT_LARGE_FLAG) | (i >> 16); // 0110 0000 - // _b = 0xE0 | (i >> 16); // 0110 0000 - write(_b); - write((i >> 8) & 0xFF); - write(i & 0xFF); - } else { - throw new IOException( - CommonResourceBundle.getInstance().getString("message.integerMaxSize", - new Object[]{Integer.valueOf(EncodingConstants.INTEGER_2ND_BIT_LARGE_LIMIT)})); - } - } - - /** - * Encode a non zero integer on the second bit of an octet, setting - * the first bit to 0. - * Implementation of clause C.25 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - *

- * The first bit of the first octet is set, as specified in clause C.13 of - * ITU-T Rec. X.891 | ISO/IEC 24824-1 - * - * @param i The integer to encode, which is a member of the interval - * [0, 1048575]. In the specification the interval is [1, 1048576] - * - */ - protected final void encodeNonZeroIntegerOnSecondBitFirstBitZero(int i) throws IOException { - if (i < EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT) { - // [1, 64] ( [0, 63] ) 6 bits - write(i); - } else if (i < EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT) { - // [65, 8256] ( [64, 8255] ) 13 bits - i -= EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - _b = EncodingConstants.INTEGER_2ND_BIT_MEDIUM_FLAG | (i >> 8); // 010 00000 - write(_b); - write(i & 0xFF); - } else { - // [8257, 1048576] ( [8256, 1048575] ) 20 bits - i -= EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - _b = EncodingConstants.INTEGER_2ND_BIT_LARGE_FLAG | (i >> 16); // 0110 0000 - write(_b); - write((i >> 8) & 0xFF); - write(i & 0xFF); - } - } - - /** - * Encode a non zero integer on the third bit of an octet. - * Implementation of clause C.27 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param i The integer to encode, which is a member of the interval - * [0, 1048575]. In the specification the interval is [1, 1048576] - * - */ - protected final void encodeNonZeroIntegerOnThirdBit(int i) throws IOException { - if (i < EncodingConstants.INTEGER_3RD_BIT_SMALL_LIMIT) { - // [1, 32] ( [0, 31] ) 5 bits - write(_b | i); - } else if (i < EncodingConstants.INTEGER_3RD_BIT_MEDIUM_LIMIT) { - // [33, 2080] ( [32, 2079] ) 11 bits - i -= EncodingConstants.INTEGER_3RD_BIT_SMALL_LIMIT; - _b |= EncodingConstants.INTEGER_3RD_BIT_MEDIUM_FLAG | (i >> 8); // 00100 000 - write(_b); - write(i & 0xFF); - } else if (i < EncodingConstants.INTEGER_3RD_BIT_LARGE_LIMIT) { - // [2081, 526368] ( [2080, 526367] ) 19 bits - i -= EncodingConstants.INTEGER_3RD_BIT_MEDIUM_LIMIT; - _b |= EncodingConstants.INTEGER_3RD_BIT_LARGE_FLAG | (i >> 16); // 00101 000 - write(_b); - write((i >> 8) & 0xFF); - write(i & 0xFF); - } else { - // [526369, 1048576] ( [526368, 1048575] ) 20 bits - i -= EncodingConstants.INTEGER_3RD_BIT_LARGE_LIMIT; - _b |= EncodingConstants.INTEGER_3RD_BIT_LARGE_LARGE_FLAG; // 00110 000 - write(_b); - write(i >> 16); - write((i >> 8) & 0xFF); - write(i & 0xFF); - } - } - - /** - * Encode a non zero integer on the fourth bit of an octet. - * Implementation of clause C.28 of ITU-T Rec. X.891 | ISO/IEC 24824-1. - * - * @param i The integer to encode, which is a member of the interval - * [0, 1048575]. In the specification the interval is [1, 1048576] - * - */ - protected final void encodeNonZeroIntegerOnFourthBit(int i) throws IOException { - if (i < EncodingConstants.INTEGER_4TH_BIT_SMALL_LIMIT) { - // [1, 16] ( [0, 15] ) 4 bits - write(_b | i); - } else if (i < EncodingConstants.INTEGER_4TH_BIT_MEDIUM_LIMIT) { - // [17, 1040] ( [16, 1039] ) 10 bits - i -= EncodingConstants.INTEGER_4TH_BIT_SMALL_LIMIT; - _b |= EncodingConstants.INTEGER_4TH_BIT_MEDIUM_FLAG | (i >> 8); // 000 100 00 - write(_b); - write(i & 0xFF); - } else if (i < EncodingConstants.INTEGER_4TH_BIT_LARGE_LIMIT) { - // [1041, 263184] ( [1040, 263183] ) 18 bits - i -= EncodingConstants.INTEGER_4TH_BIT_MEDIUM_LIMIT; - _b |= EncodingConstants.INTEGER_4TH_BIT_LARGE_FLAG | (i >> 16); // 000 101 00 - write(_b); - write((i >> 8) & 0xFF); - write(i & 0xFF); - } else { - // [263185, 1048576] ( [263184, 1048575] ) 20 bits - i -= EncodingConstants.INTEGER_4TH_BIT_LARGE_LIMIT; - _b |= EncodingConstants.INTEGER_4TH_BIT_LARGE_LARGE_FLAG; // 000 110 00 - write(_b); - write(i >> 16); - write((i >> 8) & 0xFF); - write(i & 0xFF); - } - } - - /** - * Encode a non empty string using the UTF-8 encoding. - * - * @param b the current octet that is being written. - * @param s the string to be UTF-8 encoded. - * @param constants the array of constants to use when encoding to determin - * how the length of the UTF-8 encoded string is encoded. - */ - protected final void encodeNonEmptyUTF8StringAsOctetString(int b, String s, int[] constants) throws IOException { - final char[] ch = s.toCharArray(); - encodeNonEmptyUTF8StringAsOctetString(b, ch, 0, ch.length, constants); - } - - /** - * Encode a non empty string using the UTF-8 encoding. - * - * @param b the current octet that is being written. - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - * how the length of the UTF-8 encoded string is encoded. - * @param constants the array of constants to use when encoding to determin - * how the length of the UTF-8 encoded string is encoded. - */ - protected final void encodeNonEmptyUTF8StringAsOctetString(int b, char ch[], int offset, int length, int[] constants) throws IOException { - length = encodeUTF8String(ch, offset, length); - encodeNonZeroOctetStringLength(b, length, constants); - write(_encodingBuffer, length); - } - - /** - * Encode the length of non empty UTF-8 encoded string. - * - * @param b the current octet that is being written. - * @param length the length of the UTF-8 encoded string. - * how the length of the UTF-8 encoded string is encoded. - * @param constants the array of constants to use when encoding to determin - * how the length of the UTF-8 encoded string is encoded. - */ - protected final void encodeNonZeroOctetStringLength(int b, int length, int[] constants) throws IOException { - if (length < constants[EncodingConstants.OCTET_STRING_LENGTH_SMALL_LIMIT]) { - write(b | (length - 1)); - } else if (length < constants[EncodingConstants.OCTET_STRING_LENGTH_MEDIUM_LIMIT]) { - write(b | constants[EncodingConstants.OCTET_STRING_LENGTH_MEDIUM_FLAG]); - write(length - constants[EncodingConstants.OCTET_STRING_LENGTH_SMALL_LIMIT]); - } else { - write(b | constants[EncodingConstants.OCTET_STRING_LENGTH_LARGE_FLAG]); - length -= constants[EncodingConstants.OCTET_STRING_LENGTH_MEDIUM_LIMIT]; - write(length >>> 24); - write((length >> 16) & 0xFF); - write((length >> 8) & 0xFF); - write(length & 0xFF); - } - } - - /** - * Encode a non zero integer. - * - * @param b the current octet that is being written. - * @param i the non zero integer. - * @param constants the array of constants to use when encoding to determin - * how the non zero integer is encoded. - */ - protected final void encodeNonZeroInteger(int b, int i, int[] constants) throws IOException { - if (i < constants[EncodingConstants.INTEGER_SMALL_LIMIT]) { - write(b | i); - } else if (i < constants[EncodingConstants.INTEGER_MEDIUM_LIMIT]) { - i -= constants[EncodingConstants.INTEGER_SMALL_LIMIT]; - write(b | constants[EncodingConstants.INTEGER_MEDIUM_FLAG] | (i >> 8)); - write(i & 0xFF); - } else if (i < constants[EncodingConstants.INTEGER_LARGE_LIMIT]) { - i -= constants[EncodingConstants.INTEGER_MEDIUM_LIMIT]; - write(b | constants[EncodingConstants.INTEGER_LARGE_FLAG] | (i >> 16)); - write((i >> 8) & 0xFF); - write(i & 0xFF); - } else if (i < EncodingConstants.INTEGER_MAXIMUM_SIZE) { - i -= constants[EncodingConstants.INTEGER_LARGE_LIMIT]; - write(b | constants[EncodingConstants.INTEGER_LARGE_LARGE_FLAG]); - write(i >> 16); - write((i >> 8) & 0xFF); - write(i & 0xFF); - } else { - throw new IOException(CommonResourceBundle.getInstance().getString("message.integerMaxSize", new Object[]{Integer.valueOf(EncodingConstants.INTEGER_MAXIMUM_SIZE)})); - } - } - - /** - * Mark the current position in the buffered stream. - */ - protected final void mark() { - _markIndex = _octetBufferIndex; - } - - /** - * Reset the marked position in the buffered stream. - */ - protected final void resetMark() { - _markIndex = -1; - } - - /** - * @return true if the mark has been set, otherwise false if the mark - * has not been set. - */ - protected final boolean hasMark() { - return _markIndex != -1; - } - - /** - * Write a byte to the buffered stream. - */ - protected final void write(int i) throws IOException { - if (_octetBufferIndex < _octetBuffer.length) { - _octetBuffer[_octetBufferIndex++] = (byte)i; - } else { - if (_markIndex == -1) { - _s.write(_octetBuffer); - _octetBufferIndex = 1; - _octetBuffer[0] = (byte)i; - } else { - resize(_octetBuffer.length * 3 / 2); - _octetBuffer[_octetBufferIndex++] = (byte)i; - } - } - } - - /** - * Write an array of bytes to the buffered stream. - * - * @param b the array of bytes. - * @param length the length of bytes. - */ - protected final void write(byte[] b, int length) throws IOException { - write(b, 0, length); - } - - /** - * Write an array of bytes to the buffered stream. - * - * @param b the array of bytes. - * @param offset the offset into the array of bytes. - * @param length the length of bytes. - */ - protected final void write(byte[] b, int offset, int length) throws IOException { - if ((_octetBufferIndex + length) < _octetBuffer.length) { - System.arraycopy(b, offset, _octetBuffer, _octetBufferIndex, length); - _octetBufferIndex += length; - } else { - if (_markIndex == -1) { - _s.write(_octetBuffer, 0, _octetBufferIndex); - _s.write(b, offset, length); - _octetBufferIndex = 0; - } else { - resize((_octetBuffer.length + length) * 3 / 2 + 1); - System.arraycopy(b, offset, _octetBuffer, _octetBufferIndex, length); - _octetBufferIndex += length; - } - } - } - - private void ensureSize(int length) { - if ((_octetBufferIndex + length) > _octetBuffer.length) { - resize((_octetBufferIndex + length) * 3 / 2 + 1); - } - } - - private void resize(int length) { - byte[] b = new byte[length]; - System.arraycopy(_octetBuffer, 0, b, 0, _octetBufferIndex); - _octetBuffer = b; - } - - private void _flush() throws IOException { - if (_octetBufferIndex > 0) { - _s.write(_octetBuffer, 0, _octetBufferIndex); - _octetBufferIndex = 0; - } - } - - - private EncodingBufferOutputStream _encodingBufferOutputStream = new EncodingBufferOutputStream(); - - private byte[] _encodingBuffer = new byte[512]; - - private int _encodingBufferIndex; - - private class EncodingBufferOutputStream extends OutputStream { - - public void write(int b) throws IOException { - if (_encodingBufferIndex < _encodingBuffer.length) { - _encodingBuffer[_encodingBufferIndex++] = (byte)b; - } else { - byte newbuf[] = new byte[Math.max(_encodingBuffer.length << 1, _encodingBufferIndex)]; - System.arraycopy(_encodingBuffer, 0, newbuf, 0, _encodingBufferIndex); - _encodingBuffer = newbuf; - - _encodingBuffer[_encodingBufferIndex++] = (byte)b; - } - } - - public void write(byte b[], int off, int len) throws IOException { - if ((off < 0) || (off > b.length) || (len < 0) || - ((off + len) > b.length) || ((off + len) < 0)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { - return; - } - final int newoffset = _encodingBufferIndex + len; - if (newoffset > _encodingBuffer.length) { - byte newbuf[] = new byte[Math.max(_encodingBuffer.length << 1, newoffset)]; - System.arraycopy(_encodingBuffer, 0, newbuf, 0, _encodingBufferIndex); - _encodingBuffer = newbuf; - } - System.arraycopy(b, off, _encodingBuffer, _encodingBufferIndex, len); - _encodingBufferIndex = newoffset; - } - - public int getLength() { - return _encodingBufferIndex; - } - - public void reset() { - _encodingBufferIndex = 0; - } - } - - /** - * Encode a string using the UTF-8 encoding. - * - * @param s the string to encode. - */ - protected final int encodeUTF8String(String s) throws IOException { - final int length = s.length(); - if (length < _charBuffer.length) { - s.getChars(0, length, _charBuffer, 0); - return encodeUTF8String(_charBuffer, 0, length); - } else { - char[] ch = s.toCharArray(); - return encodeUTF8String(ch, 0, length); - } - } - - private void ensureEncodingBufferSizeForUtf8String(int length) { - final int newLength = 4 * length; - if (_encodingBuffer.length < newLength) { - _encodingBuffer = new byte[newLength]; - } - } - - /** - * Encode a string using the UTF-8 encoding. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - */ - protected final int encodeUTF8String(char[] ch, int offset, int length) throws IOException { - int bpos = 0; - - // Make sure buffer is large enough - ensureEncodingBufferSizeForUtf8String(length); - - final int end = offset + length; - int c; - while (end != offset) { - c = ch[offset++]; - if (c < 0x80) { - // 1 byte, 7 bits - _encodingBuffer[bpos++] = (byte) c; - } else if (c < 0x800) { - // 2 bytes, 11 bits - _encodingBuffer[bpos++] = - (byte) (0xC0 | (c >> 6)); // first 5 - _encodingBuffer[bpos++] = - (byte) (0x80 | (c & 0x3F)); // second 6 - } else if (c <= '\uFFFF') { - if (!XMLChar.isHighSurrogate(c) && !XMLChar.isLowSurrogate(c)) { - // 3 bytes, 16 bits - _encodingBuffer[bpos++] = - (byte) (0xE0 | (c >> 12)); // first 4 - _encodingBuffer[bpos++] = - (byte) (0x80 | ((c >> 6) & 0x3F)); // second 6 - _encodingBuffer[bpos++] = - (byte) (0x80 | (c & 0x3F)); // third 6 - } else { - // 4 bytes, high and low surrogate - encodeCharacterAsUtf8FourByte(c, ch, offset, end, bpos); - bpos += 4; - offset++; - } - } - } - - return bpos; - } - - private void encodeCharacterAsUtf8FourByte(int c, char[] ch, int chpos, int chend, int bpos) throws IOException { - if (chpos == chend) { - throw new IOException(""); - } - - final char d = ch[chpos]; - if (!XMLChar.isLowSurrogate(d)) { - throw new IOException(""); - } - - final int uc = (((c & 0x3ff) << 10) | (d & 0x3ff)) + 0x10000; - if (uc < 0 || uc >= 0x200000) { - throw new IOException(""); - } - - _encodingBuffer[bpos++] = (byte)(0xF0 | ((uc >> 18))); - _encodingBuffer[bpos++] = (byte)(0x80 | ((uc >> 12) & 0x3F)); - _encodingBuffer[bpos++] = (byte)(0x80 | ((uc >> 6) & 0x3F)); - _encodingBuffer[bpos++] = (byte)(0x80 | (uc & 0x3F)); - } - - /** - * Encode a string using the UTF-16 encoding. - * - * @param s the string to encode. - */ - protected final int encodeUtf16String(String s) throws IOException { - final int length = s.length(); - if (length < _charBuffer.length) { - s.getChars(0, length, _charBuffer, 0); - return encodeUtf16String(_charBuffer, 0, length); - } else { - char[] ch = s.toCharArray(); - return encodeUtf16String(ch, 0, length); - } - } - - private void ensureEncodingBufferSizeForUtf16String(int length) { - final int newLength = 2 * length; - if (_encodingBuffer.length < newLength) { - _encodingBuffer = new byte[newLength]; - } - } - - /** - * Encode a string using the UTF-16 encoding. - * - * @param ch the array of characters. - * @param offset the offset into the array of characters. - * @param length the length of characters. - */ - protected final int encodeUtf16String(char[] ch, int offset, int length) throws IOException { - int byteLength = 0; - - // Make sure buffer is large enough - ensureEncodingBufferSizeForUtf16String(length); - - final int n = offset + length; - for (int i = offset; i < n; i++) { - final int c = (int) ch[i]; - _encodingBuffer[byteLength++] = (byte)(c >> 8); - _encodingBuffer[byteLength++] = (byte)(c & 0xFF); - } - - return byteLength; - } - - /** - * Obtain the prefix from a qualified name. - * - * @param qName the qualified name - * @return the prefix, or "" if there is no prefix. - */ - public static String getPrefixFromQualifiedName(String qName) { - int i = qName.indexOf(':'); - String prefix = ""; - if (i != -1) { - prefix = qName.substring(0, i); - } - return prefix; - } - - /** - * Check if character array contains characters that are all white space. - * - * @param ch the character array - * @param start the starting character index into the array to check from - * @param length the number of characters to check - * @return true if all characters are white space, false otherwise - */ - public static boolean isWhiteSpace(final char[] ch, int start, final int length) { - if (!XMLChar.isSpace(ch[start])) return false; - - final int end = start + length; - while(++start < end && XMLChar.isSpace(ch[start])); - - return start == end; - } - - /** - * Check if a String contains characters that are all white space. - * - * @param s the string - * @return true if all characters are white space, false otherwise - */ - public static boolean isWhiteSpace(String s) { - if (!XMLChar.isSpace(s.charAt(0))) return false; - - final int end = s.length(); - int start = 1; - while(start < end && XMLChar.isSpace(s.charAt(start++))); - return start == end; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/EncodingConstants.java 2018-01-30 20:36:35.000000000 -0500 +++ /dev/null 2018-01-30 20:36:35.000000000 -0500 @@ -1,301 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset; - -import java.io.UnsupportedEncodingException; - -public final class EncodingConstants { - static { - initiateXMLDeclarationValues(); - } - - public static final String XML_NAMESPACE_PREFIX = "xml"; - public static final int XML_NAMESPACE_PREFIX_LENGTH = XML_NAMESPACE_PREFIX.length(); - public static final String XML_NAMESPACE_NAME = "http://www.w3.org/XML/1998/namespace"; - public static final int XML_NAMESPACE_NAME_LENGTH = XML_NAMESPACE_NAME.length(); - - public static final String XMLNS_NAMESPACE_PREFIX = "xmlns"; - public static final int XMLNS_NAMESPACE_PREFIX_LENGTH = XMLNS_NAMESPACE_PREFIX.length(); - public static final String XMLNS_NAMESPACE_NAME = "http://www.w3.org/2000/xmlns/"; - public static final int XMLNS_NAMESPACE_NAME_LENGTH = XMLNS_NAMESPACE_NAME.length(); - - public static final QualifiedName DEFAULT_NAMESPACE_DECLARATION = new QualifiedName( - "", - EncodingConstants.XMLNS_NAMESPACE_NAME, - EncodingConstants.XMLNS_NAMESPACE_PREFIX, - EncodingConstants.XMLNS_NAMESPACE_PREFIX); - - public static final int DOCUMENT_ADDITIONAL_DATA_FLAG = 0x40; // 01000000 - public static final int DOCUMENT_INITIAL_VOCABULARY_FLAG = 0x20; // 00100000 - public static final int DOCUMENT_NOTATIONS_FLAG = 0x10; // 00010000 - public static final int DOCUMENT_UNPARSED_ENTITIES_FLAG = 0x08; // 00001000 - public static final int DOCUMENT_CHARACTER_ENCODING_SCHEME = 0x04; // 00000100 - public static final int DOCUMENT_STANDALONE_FLAG = 0x02; // 00000010 - public static final int DOCUMENT_VERSION_FLAG = 0x01; // 00000001 - - public static final int INITIAL_VOCABULARY_EXTERNAL_VOCABULARY_FLAG = 0x10; // 00010000 - public static final int INITIAL_VOCABULARY_RESTRICTED_ALPHABETS_FLAG = 0x08; // 00001000 - public static final int INITIAL_VOCABULARY_ENCODING_ALGORITHMS_FLAG = 0x04; // 00000100 - public static final int INITIAL_VOCABULARY_PREFIXES_FLAG = 0x02; // 00000010 - public static final int INITIAL_VOCABULARY_NAMESPACE_NAMES_FLAG = 0x01; // 00000001 - public static final int INITIAL_VOCABULARY_LOCAL_NAMES_FLAG = 0x80; // 1000000 - public static final int INITIAL_VOCABULARY_OTHER_NCNAMES_FLAG = 0x40; // 01000000 - public static final int INITIAL_VOCABULARY_OTHER_URIS_FLAG = 0x20; // 00100000 - public static final int INITIAL_VOCABULARY_ATTRIBUTE_VALUES_FLAG = 0x10; // 00010000 - public static final int INITIAL_VOCABULARY_CONTENT_CHARACTER_CHUNKS_FLAG = 0x08; // 00001000 - public static final int INITIAL_VOCABULARY_OTHER_STRINGS_FLAG = 0x04; // 00000100 - public static final int INITIAL_VOCABULARY_ELEMENT_NAME_SURROGATES_FLAG = 0x02; // 0000010 - public static final int INITIAL_VOCABULARY_ATTRIBUTE_NAME_SURROGATES_FLAG = 0x01; // 00000001 - - public static final int NAME_SURROGATE_PREFIX_FLAG = 0x02; - public static final int NAME_SURROGATE_NAME_FLAG = 0x01; - - public static final int NOTATIONS = 0xC0; // 110000 - public static final int NOTATIONS_MASK = 0xFC; // 6 bits - public static final int NOTATIONS_SYSTEM_IDENTIFIER_FLAG = 0x02; - public static final int NOTATIONS_PUBLIC_IDENTIFIER_FLAG = 0x01; - - public static final int UNPARSED_ENTITIES = 0xD0; // 1101000 - public static final int UNPARSED_ENTITIES_MASK = 0xFE; // 7 bits - public static final int UNPARSED_ENTITIES_PUBLIC_IDENTIFIER_FLAG = 0x01; - - public static final int PROCESSING_INSTRUCTION = 0xE1; // 11100001 - public static final int PROCESSING_INSTRUCTION_MASK = 0xFF; // 8 bits - - public static final int COMMENT = 0xE2; // 11100010 - public static final int COMMENT_MASK = 0xFF; // 8 bits - - public static final int DOCUMENT_TYPE_DECLARATION = 0xC4; // 110001 - public static final int DOCUMENT_TYPE_DECLARATION_MASK = 0xFC; // 6 bits - public static final int DOCUMENT_TYPE_SYSTEM_IDENTIFIER_FLAG = 0x02; - public static final int DOCUMENT_TYPE_PUBLIC_IDENTIFIER_FLAG = 0x01; - - public static final int ELEMENT = 0x00; // 0 - public static final int ELEMENT_ATTRIBUTE_FLAG = 0x40; // 01000000 - public static final int ELEMENT_NAMESPACES_FLAG = 0x38; // 00111000 - public static final int ELEMENT_LITERAL_QNAME_FLAG = 0x3C; // 00111100 - - public static final int NAMESPACE_ATTRIBUTE = 0xCC; // 110011 00 - public static final int NAMESPACE_ATTRIBUTE_MASK = 0xFC; // 6 bits - public static final int NAMESPACE_ATTRIBUTE_PREFIX_NAME_MASK = 0x03; // 2 bits - public static final int NAMESPACE_ATTRIBUTE_PREFIX_FLAG = 0x02; - public static final int NAMESPACE_ATTRIBUTE_NAME_FLAG = 0x01; - - public static final int ATTRIBUTE_LITERAL_QNAME_FLAG = 0x78; // 01111000 - - public static final int LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK = 0x03; - public static final int LITERAL_QNAME_PREFIX_FLAG = 0x02; - public static final int LITERAL_QNAME_NAMESPACE_NAME_FLAG = 0x01; - - public static final int CHARACTER_CHUNK = 0x80; // 10 - public static final int CHARACTER_CHUNK_ADD_TO_TABLE_FLAG = 0x10; // 00010000 - public static final int CHARACTER_CHUNK_UTF_8_FLAG = 0x00; // 00000000 - public static final int CHARACTER_CHUNK_UTF_16_FLAG = 0x04; // 00000100 - public static final int CHARACTER_CHUNK_RESTRICTED_ALPHABET_FLAG = 0x08; // 00001000 - public static final int CHARACTER_CHUNK_ENCODING_ALGORITHM_FLAG = 0x0C; // 00001100 - - public static final int UNEXPANDED_ENTITY_REFERENCE = 0xC8; // 110010 - public static final int UNEXPANDED_ENTITY_REFERENCE_MASK = 0xFC; // 6 bits - public static final int UNEXPANDED_ENTITY_SYSTEM_IDENTIFIER_FLAG = 0x02; - public static final int UNEXPANDED_ENTITY_PUBLIC_IDENTIFIER_FLAG = 0x01; - - public static final int NISTRING_ADD_TO_TABLE_FLAG = 0x40; // 01000000 - public static final int NISTRING_UTF_8_FLAG = 0x00; // 00000000 - public static final int NISTRING_UTF_16_FLAG = 0x10; // 00010000 - public static final int NISTRING_RESTRICTED_ALPHABET_FLAG = 0x20; // 00100000 - public static final int NISTRING_ENCODING_ALGORITHM_FLAG = 0x30; // 00110000 - - public static final int TERMINATOR = 0xF0; - public static final int DOUBLE_TERMINATOR = 0xFF; - - - public static final int ENCODING_ALGORITHM_BUILTIN_END = 9; - public static final int ENCODING_ALGORITHM_APPLICATION_START = 32; - public static final int ENCODING_ALGORITHM_APPLICATION_MAX = 255; - - public static final int RESTRICTED_ALPHABET_BUILTIN_END = 1; - public static final int RESTRICTED_ALPHABET_APPLICATION_START = 32; - public static final int RESTRICTED_ALPHABET_APPLICATION_MAX = 255; - - // Octet string length contants - - public static final int OCTET_STRING_LENGTH_SMALL_LIMIT = 0; - public static final int OCTET_STRING_LENGTH_MEDIUM_LIMIT = 1; - public static final int OCTET_STRING_LENGTH_MEDIUM_FLAG = 2; - public static final int OCTET_STRING_LENGTH_LARGE_FLAG = 3; - - public static final long OCTET_STRING_MAXIMUM_LENGTH = 4294967296L; - - /* - * C.22 - */ - public static final int OCTET_STRING_LENGTH_2ND_BIT_SMALL_LIMIT = 65; - public static final int OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_LIMIT = 321; - public static final int OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_FLAG = 0x40; - public static final int OCTET_STRING_LENGTH_2ND_BIT_LARGE_FLAG = 0x60; - public static final int OCTET_STRING_LENGTH_2ND_BIT_SMALL_MASK = 0x1F; - - /* package */ static final int[] OCTET_STRING_LENGTH_2ND_BIT_VALUES = { - OCTET_STRING_LENGTH_2ND_BIT_SMALL_LIMIT, - OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_LIMIT, - OCTET_STRING_LENGTH_2ND_BIT_MEDIUM_FLAG, - OCTET_STRING_LENGTH_2ND_BIT_LARGE_FLAG - }; - - /* - * C.23 - */ - public static final int OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT = 9; - public static final int OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT = 265; - public static final int OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_FLAG = 0x08; - public static final int OCTET_STRING_LENGTH_5TH_BIT_LARGE_FLAG = 0x0C; - public static final int OCTET_STRING_LENGTH_5TH_BIT_SMALL_MASK = 0x07; - - /* package */ static final int[] OCTET_STRING_LENGTH_5TH_BIT_VALUES = { - OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT, - OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT, - OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_FLAG, - OCTET_STRING_LENGTH_5TH_BIT_LARGE_FLAG - }; - - /* - * C.24 - */ - public static final int OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT = 3; - public static final int OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT = 259; - public static final int OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_FLAG = 0x02; - public static final int OCTET_STRING_LENGTH_7TH_BIT_LARGE_FLAG = 0x03; - public static final int OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK = 0x01; - - /* package */ static final int[] OCTET_STRING_LENGTH_7TH_BIT_VALUES = { - OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT, - OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT, - OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_FLAG, - OCTET_STRING_LENGTH_7TH_BIT_LARGE_FLAG - }; - - - // Integer - - public static final int INTEGER_SMALL_LIMIT = 0; - public static final int INTEGER_MEDIUM_LIMIT = 1; - public static final int INTEGER_LARGE_LIMIT = 2; - public static final int INTEGER_MEDIUM_FLAG = 3; - public static final int INTEGER_LARGE_FLAG = 4; - public static final int INTEGER_LARGE_LARGE_FLAG = 5; - - public static final int INTEGER_MAXIMUM_SIZE = 1048576; - - /* - * C.25 - */ - public static final int INTEGER_2ND_BIT_SMALL_LIMIT = 64; - public static final int INTEGER_2ND_BIT_MEDIUM_LIMIT = 8256; - public static final int INTEGER_2ND_BIT_LARGE_LIMIT = INTEGER_MAXIMUM_SIZE; - public static final int INTEGER_2ND_BIT_MEDIUM_FLAG = 0x40; - public static final int INTEGER_2ND_BIT_LARGE_FLAG = 0x60; - public static final int INTEGER_2ND_BIT_SMALL_MASK = 0x3F; - public static final int INTEGER_2ND_BIT_MEDIUM_MASK = 0x1F; - public static final int INTEGER_2ND_BIT_LARGE_MASK = 0x0F; - - /* package */ static final int[] INTEGER_2ND_BIT_VALUES = { - INTEGER_2ND_BIT_SMALL_LIMIT, - INTEGER_2ND_BIT_MEDIUM_LIMIT, - INTEGER_2ND_BIT_LARGE_LIMIT, - INTEGER_2ND_BIT_MEDIUM_FLAG, - INTEGER_2ND_BIT_LARGE_FLAG, - -1 - }; - - /* - * C.27 - */ - public static final int INTEGER_3RD_BIT_SMALL_LIMIT = 32; - public static final int INTEGER_3RD_BIT_MEDIUM_LIMIT = 2080; - public static final int INTEGER_3RD_BIT_LARGE_LIMIT = 526368; - public static final int INTEGER_3RD_BIT_MEDIUM_FLAG = 0x20; - public static final int INTEGER_3RD_BIT_LARGE_FLAG = 0x28; - public static final int INTEGER_3RD_BIT_LARGE_LARGE_FLAG = 0x30; - public static final int INTEGER_3RD_BIT_SMALL_MASK = 0x1F; - public static final int INTEGER_3RD_BIT_MEDIUM_MASK = 0x07; - public static final int INTEGER_3RD_BIT_LARGE_MASK = 0x07; - public static final int INTEGER_3RD_BIT_LARGE_LARGE_MASK = 0x0F; - - /* package */ static final int[] INTEGER_3RD_BIT_VALUES = { - INTEGER_3RD_BIT_SMALL_LIMIT, - INTEGER_3RD_BIT_MEDIUM_LIMIT, - INTEGER_3RD_BIT_LARGE_LIMIT, - INTEGER_3RD_BIT_MEDIUM_FLAG, - INTEGER_3RD_BIT_LARGE_FLAG, - INTEGER_3RD_BIT_LARGE_LARGE_FLAG - }; - - /* - * C.28 - */ - public static final int INTEGER_4TH_BIT_SMALL_LIMIT = 16; - public static final int INTEGER_4TH_BIT_MEDIUM_LIMIT = 1040; - public static final int INTEGER_4TH_BIT_LARGE_LIMIT = 263184; - public static final int INTEGER_4TH_BIT_MEDIUM_FLAG = 0x10; - public static final int INTEGER_4TH_BIT_LARGE_FLAG = 0x14; - public static final int INTEGER_4TH_BIT_LARGE_LARGE_FLAG = 0x18; - public static final int INTEGER_4TH_BIT_SMALL_MASK = 0x0F; - public static final int INTEGER_4TH_BIT_MEDIUM_MASK = 0x03; - public static final int INTEGER_4TH_BIT_LARGE_MASK = 0x03; - - /* package */ static final int[] INTEGER_4TH_BIT_VALUES = { - INTEGER_4TH_BIT_SMALL_LIMIT, - INTEGER_4TH_BIT_MEDIUM_LIMIT, - INTEGER_4TH_BIT_LARGE_LIMIT, - INTEGER_4TH_BIT_MEDIUM_FLAG, - INTEGER_4TH_BIT_LARGE_FLAG, - INTEGER_4TH_BIT_LARGE_LARGE_FLAG - }; - - /* package */ static final byte[] BINARY_HEADER = {(byte)0xE0, 0, 0, 1}; - - /* package */ static byte[][] XML_DECLARATION_VALUES; - - private static void initiateXMLDeclarationValues() { - - XML_DECLARATION_VALUES = new byte[9][]; - - try { - XML_DECLARATION_VALUES[0] = "".getBytes("UTF-8"); - XML_DECLARATION_VALUES[1] = "".getBytes("UTF-8"); - XML_DECLARATION_VALUES[2] = "".getBytes("UTF-8"); - XML_DECLARATION_VALUES[3] = "".getBytes("UTF-8"); - XML_DECLARATION_VALUES[4] = "".getBytes("UTF-8"); - XML_DECLARATION_VALUES[5] = "".getBytes("UTF-8"); - XML_DECLARATION_VALUES[6] = "".getBytes("UTF-8"); - XML_DECLARATION_VALUES[7] = "".getBytes("UTF-8"); - XML_DECLARATION_VALUES[8] = "".getBytes("UTF-8"); - } catch (UnsupportedEncodingException e) { - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/Notation.java 2018-01-30 20:36:36.000000000 -0500 +++ /dev/null 2018-01-30 20:36:36.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset; - -public class Notation { - public final String name; - public final String systemIdentifier; - public final String publicIdentifier; - - /** Creates a new instance of Notation */ - public Notation(String _name, String _systemIdentifier, String _publicIdentifier) { - name = _name; - systemIdentifier = _systemIdentifier; - publicIdentifier = _publicIdentifier; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/OctetBufferListener.java 2018-01-30 20:36:37.000000000 -0500 +++ /dev/null 2018-01-30 20:36:37.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset; - -/** - * @author Paul Sandoz - * @author Alexey Stashok - */ -public interface OctetBufferListener { - /** - * Callback method that will be called before the - * (@link Decoder) octet buffer content is going to be changed. - * So it will be possible to preserve a read data by - * cloning, or perform other actions. - */ - public void onBeforeOctetBufferOverwrite(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/QualifiedName.java 2018-01-30 20:36:38.000000000 -0500 +++ /dev/null 2018-01-30 20:36:38.000000000 -0500 @@ -1,310 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset; - -import javax.xml.namespace.QName; - -public class QualifiedName { - public String prefix; - public String namespaceName; - public String localName; - public String qName; - public int index; - public int prefixIndex; - public int namespaceNameIndex; - public int localNameIndex; - public int attributeId; - public int attributeHash; - private QName qNameObject; - - public QualifiedName() { } - - public QualifiedName(String prefix, String namespaceName, String localName, String qName) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = qName; - this.index = -1; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - } - - public void set(String prefix, String namespaceName, String localName, String qName) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = qName; - this.index = -1; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - this.qNameObject = null; - } - - public QualifiedName(String prefix, String namespaceName, String localName, String qName, int index) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = qName; - this.index = index; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - } - - public final QualifiedName set(String prefix, String namespaceName, String localName, String qName, int index) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = qName; - this.index = index; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - this.qNameObject = null; - return this; - } - - public QualifiedName(String prefix, String namespaceName, String localName, String qName, int index, - int prefixIndex, int namespaceNameIndex, int localNameIndex) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = qName; - this.index = index; - this.prefixIndex = prefixIndex + 1; - this.namespaceNameIndex = namespaceNameIndex + 1; - this.localNameIndex = localNameIndex; - } - - public final QualifiedName set(String prefix, String namespaceName, String localName, String qName, int index, - int prefixIndex, int namespaceNameIndex, int localNameIndex) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = qName; - this.index = index; - this.prefixIndex = prefixIndex + 1; - this.namespaceNameIndex = namespaceNameIndex + 1; - this.localNameIndex = localNameIndex; - this.qNameObject = null; - return this; - } - - public QualifiedName(String prefix, String namespaceName, String localName) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = createQNameString(prefix, localName); - this.index = -1; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - } - - public final QualifiedName set(String prefix, String namespaceName, String localName) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = createQNameString(prefix, localName); - this.index = -1; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - this.qNameObject = null; - return this; - } - - public QualifiedName(String prefix, String namespaceName, String localName, - int prefixIndex, int namespaceNameIndex, int localNameIndex, - char[] charBuffer) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - - if (charBuffer != null) { - final int l1 = prefix.length(); - final int l2 = localName.length(); - final int total = l1 + l2 + 1; - if (total < charBuffer.length) { - prefix.getChars(0, l1, charBuffer, 0); - charBuffer[l1] = ':'; - localName.getChars(0, l2, charBuffer, l1 + 1); - this.qName = new String(charBuffer, 0, total); - } else { - this.qName = createQNameString(prefix, localName); - } - } else { - this.qName = this.localName; - } - - this.prefixIndex = prefixIndex + 1; - this.namespaceNameIndex = namespaceNameIndex + 1; - this.localNameIndex = localNameIndex; - this.index = -1; - } - - public final QualifiedName set(String prefix, String namespaceName, String localName, - int prefixIndex, int namespaceNameIndex, int localNameIndex, - char[] charBuffer) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - - if (charBuffer != null) { - final int l1 = prefix.length(); - final int l2 = localName.length(); - final int total = l1 + l2 + 1; - if (total < charBuffer.length) { - prefix.getChars(0, l1, charBuffer, 0); - charBuffer[l1] = ':'; - localName.getChars(0, l2, charBuffer, l1 + 1); - this.qName = new String(charBuffer, 0, total); - } else { - this.qName = createQNameString(prefix, localName); - } - } else { - this.qName = this.localName; - } - - this.prefixIndex = prefixIndex + 1; - this.namespaceNameIndex = namespaceNameIndex + 1; - this.localNameIndex = localNameIndex; - this.index = -1; - this.qNameObject = null; - return this; - } - - public QualifiedName(String prefix, String namespaceName, String localName, int index) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = createQNameString(prefix, localName); - this.index = index; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - } - - public final QualifiedName set(String prefix, String namespaceName, String localName, int index) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = createQNameString(prefix, localName); - this.index = index; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - this.qNameObject = null; - return this; - } - - public QualifiedName(String prefix, String namespaceName, String localName, int index, - int prefixIndex, int namespaceNameIndex, int localNameIndex) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = createQNameString(prefix, localName); - this.index = index; - this.prefixIndex = prefixIndex + 1; - this.namespaceNameIndex = namespaceNameIndex + 1; - this.localNameIndex = localNameIndex; - } - - public final QualifiedName set(String prefix, String namespaceName, String localName, int index, - int prefixIndex, int namespaceNameIndex, int localNameIndex) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = localName; - this.qName = createQNameString(prefix, localName); - this.index = index; - this.prefixIndex = prefixIndex + 1; - this.namespaceNameIndex = namespaceNameIndex + 1; - this.localNameIndex = localNameIndex; - this.qNameObject = null; - return this; - } - - // Qualified Name as a Namespace Name - public QualifiedName(String prefix, String namespaceName) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = ""; - this.qName = ""; - this.index = -1; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - } - - public final QualifiedName set(String prefix, String namespaceName) { - this.prefix = prefix; - this.namespaceName = namespaceName; - this.localName = ""; - this.qName = ""; - this.index = -1; - this.prefixIndex = 0; - this.namespaceNameIndex = 0; - this.localNameIndex = -1; - this.qNameObject = null; - return this; - } - - public final QName getQName() { - if (qNameObject == null) { - qNameObject = new QName(namespaceName, localName, prefix); - } - - return qNameObject; - } - - public final String getQNameString() { - if (this.qName != "") { - return this.qName; - } - - return this.qName = createQNameString(prefix, localName); - } - - public final void createAttributeValues(int size) { - attributeId = localNameIndex | (namespaceNameIndex << 20); - attributeHash = localNameIndex % size; - } - - private final String createQNameString(String p, String l) { - if (p != null && p.length() > 0) { - final StringBuffer b = new StringBuffer(p); - b.append(':'); - b.append(l); - return b.toString(); - } else { - return l; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/UnparsedEntity.java 2018-01-30 20:36:38.000000000 -0500 +++ /dev/null 2018-01-30 20:36:38.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset; - -public class UnparsedEntity extends Notation { - public final String notationName; - - /** Creates a new instance of UnparsedEntityDeclaration */ - public UnparsedEntity(String _name, String _systemIdentifier, String _publicIdentifier, String _notationName) { - super(_name, _systemIdentifier, _publicIdentifier); - notationName = _notationName; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/BASE64EncodingAlgorithm.java 2018-01-30 20:36:39.000000000 -0500 +++ /dev/null 2018-01-30 20:36:39.000000000 -0500 @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class BASE64EncodingAlgorithm extends BuiltInEncodingAlgorithm { - - /* package */ static final char encodeBase64[] = { - 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', - 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', - 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' - }; - - /* package */ static final int decodeBase64[] = { - /*'+'*/ 62, - -1, -1, -1, - /*'/'*/ 63, - /*'0'*/ 52, - /*'1'*/ 53, - /*'2'*/ 54, - /*'3'*/ 55, - /*'4'*/ 56, - /*'5'*/ 57, - /*'6'*/ 58, - /*'7'*/ 59, - /*'8'*/ 60, - /*'9'*/ 61, - -1, -1, -1, -1, -1, -1, -1, - /*'A'*/ 0, - /*'B'*/ 1, - /*'C'*/ 2, - /*'D'*/ 3, - /*'E'*/ 4, - /*'F'*/ 5, - /*'G'*/ 6, - /*'H'*/ 7, - /*'I'*/ 8, - /*'J'*/ 9, - /*'K'*/ 10, - /*'L'*/ 11, - /*'M'*/ 12, - /*'N'*/ 13, - /*'O'*/ 14, - /*'P'*/ 15, - /*'Q'*/ 16, - /*'R'*/ 17, - /*'S'*/ 18, - /*'T'*/ 19, - /*'U'*/ 20, - /*'V'*/ 21, - /*'W'*/ 22, - /*'X'*/ 23, - /*'Y'*/ 24, - /*'Z'*/ 25, - -1, -1, -1, -1, -1, -1, - /*'a'*/ 26, - /*'b'*/ 27, - /*'c'*/ 28, - /*'d'*/ 29, - /*'e'*/ 30, - /*'f'*/ 31, - /*'g'*/ 32, - /*'h'*/ 33, - /*'i'*/ 34, - /*'j'*/ 35, - /*'k'*/ 36, - /*'l'*/ 37, - /*'m'*/ 38, - /*'n'*/ 39, - /*'o'*/ 40, - /*'p'*/ 41, - /*'q'*/ 42, - /*'r'*/ 43, - /*'s'*/ 44, - /*'t'*/ 45, - /*'u'*/ 46, - /*'v'*/ 47, - /*'w'*/ 48, - /*'x'*/ 49, - /*'y'*/ 50, - /*'z'*/ 51 - }; - - public final Object decodeFromBytes(byte[] b, int start, int length) throws EncodingAlgorithmException { - final byte[] data = new byte[length]; - System.arraycopy(b, start, data, 0, length); - return data; - } - - public final Object decodeFromInputStream(InputStream s) throws IOException { - throw new UnsupportedOperationException(CommonResourceBundle.getInstance().getString("message.notImplemented")); - } - - - public void encodeToOutputStream(Object data, OutputStream s) throws IOException { - if (!(data instanceof byte[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotByteArray")); - } - - s.write((byte[])data); - } - - public final Object convertFromCharacters(char[] ch, int start, int length) { - if (length == 0) { - return new byte[0]; - } - - StringBuilder encodedValue = removeWhitespace(ch, start, length); - int encodedLength = encodedValue.length(); - if (encodedLength == 0) { - return new byte[0]; - } - - int blockCount = encodedLength / 4; - int partialBlockLength = 3; - - if (encodedValue.charAt(encodedLength - 1) == '=') { - --partialBlockLength; - if (encodedValue.charAt(encodedLength - 2) == '=') { - --partialBlockLength; - } - } - - int valueLength = (blockCount - 1) * 3 + partialBlockLength; - byte[] value = new byte[valueLength]; - - int idx = 0; - int encodedIdx = 0; - for (int i = 0; i < blockCount; ++i) { - int x1 = decodeBase64[encodedValue.charAt(encodedIdx++) - '+']; - int x2 = decodeBase64[encodedValue.charAt(encodedIdx++) - '+']; - int x3 = decodeBase64[encodedValue.charAt(encodedIdx++) - '+']; - int x4 = decodeBase64[encodedValue.charAt(encodedIdx++) - '+']; - - value[idx++] = (byte) ((x1 << 2) | (x2 >> 4)); - if (idx < valueLength) { - value[idx++] = (byte) (((x2 & 0x0f) << 4) | (x3 >> 2)); - } - if (idx < valueLength) { - value[idx++] = (byte) (((x3 & 0x03) << 6) | x4); - } - } - - return value; - } - - public final void convertToCharacters(Object data, StringBuffer s) { - if (data == null) { - return; - } - final byte[] value = (byte[]) data; - - convertToCharacters(value, 0, value.length, s); - } - - public final int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException { - return octetLength; - } - - public int getOctetLengthFromPrimitiveLength(int primitiveLength) { - return primitiveLength; - } - - public final void encodeToBytes(Object array, int astart, int alength, byte[] b, int start) { - System.arraycopy((byte[])array, astart, b, start, alength); - } - - public final void convertToCharacters(byte[] data, int offset, int length, StringBuffer s) { - if (data == null) { - return; - } - final byte[] value = data; - if (length == 0) { - return; - } - - final int partialBlockLength = length % 3; - final int blockCount = (partialBlockLength != 0) ? - length / 3 + 1 : - length / 3; - - final int encodedLength = blockCount * 4; - final int originalBufferSize = s.length(); - s.ensureCapacity(encodedLength + originalBufferSize); - - int idx = offset; - int lastIdx = offset + length; - for (int i = 0; i < blockCount; ++i) { - int b1 = value[idx++] & 0xFF; - int b2 = (idx < lastIdx) ? value[idx++] & 0xFF : 0; - int b3 = (idx < lastIdx) ? value[idx++] & 0xFF : 0; - - s.append(encodeBase64[b1 >> 2]); - - s.append(encodeBase64[((b1 & 0x03) << 4) | (b2 >> 4)]); - - s.append(encodeBase64[((b2 & 0x0f) << 2) | (b3 >> 6)]); - - s.append(encodeBase64[b3 & 0x3f]); - } - - switch (partialBlockLength) { - case 1 : - s.setCharAt(originalBufferSize + encodedLength - 1, '='); - s.setCharAt(originalBufferSize + encodedLength - 2, '='); - break; - case 2 : - s.setCharAt(originalBufferSize + encodedLength - 1, '='); - break; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/BooleanEncodingAlgorithm.java 2018-01-30 20:36:40.000000000 -0500 +++ /dev/null 2018-01-30 20:36:40.000000000 -0500 @@ -1,271 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - - -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.CharBuffer; -import java.util.ArrayList; -import java.util.List; - -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - - -/** - * - * An encoder for handling boolean values. Suppports the builtin BOOLEAN encoder. - * - * @author Alan Hudson - * @author Paul Sandoz - * - */ -public class BooleanEncodingAlgorithm extends BuiltInEncodingAlgorithm { - - /** Table for setting a particular bit of a byte */ - private static final int[] BIT_TABLE = { - 1 << 7, - 1 << 6, - 1 << 5, - 1 << 4, - 1 << 3, - 1 << 2, - 1 << 1, - 1 << 0}; - - public int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException { - // Cannot determine the number of boolean values from just the octet length - throw new UnsupportedOperationException(); - } - - public int getOctetLengthFromPrimitiveLength(int primitiveLength) { - if (primitiveLength < 5) { - return 1; - } else { - final int div = primitiveLength / 8; - return (div == 0) ? 2 : 1 + div; - } - } - - public final Object decodeFromBytes(byte[] b, int start, int length) throws EncodingAlgorithmException { - final int blength = getPrimtiveLengthFromOctetLength(length, b[start]); - boolean[] data = new boolean[blength]; - - decodeFromBytesToBooleanArray(data, 0, blength, b, start, length); - return data; - } - - public final Object decodeFromInputStream(InputStream s) throws IOException { - final List booleanList = new ArrayList(); - - int value = s.read(); - if (value == -1) { - throw new EOFException(); - } - final int unusedBits = (value >> 4) & 0xFF; - - int bitPosition = 4; - int bitPositionEnd = 8; - int valueNext = 0; - do { - valueNext = s.read(); - if (valueNext == -1) { - bitPositionEnd -= unusedBits; - } - - while(bitPosition < bitPositionEnd) { - booleanList.add( - Boolean.valueOf((value & BIT_TABLE[bitPosition++]) > 0)); - } - - value = valueNext; - } while (value != -1); - - return generateArrayFromList(booleanList); - } - - public void encodeToOutputStream(Object data, OutputStream s) throws IOException { - if (!(data instanceof boolean[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotBoolean")); - } - - boolean array[] = (boolean[])data; - final int alength = array.length; - - final int mod = (alength + 4) % 8; - final int unusedBits = (mod == 0) ? 0 : 8 - mod; - - int bitPosition = 4; - int value = unusedBits << 4; - int astart = 0; - while (astart < alength) { - if (array[astart++]) { - value |= BIT_TABLE[bitPosition]; - } - - if (++bitPosition == 8) { - s.write(value); - bitPosition = value = 0; - } - } - - if (bitPosition != 8) { - s.write(value); - } - } - - public final Object convertFromCharacters(char[] ch, int start, int length) { - if (length == 0) { - return new boolean[0]; - } - - final CharBuffer cb = CharBuffer.wrap(ch, start, length); - final List booleanList = new ArrayList(); - - matchWhiteSpaceDelimnatedWords(cb, - new WordListener() { - public void word(int start, int end) { - if (cb.charAt(start) == 't') { - booleanList.add(Boolean.TRUE); - } else { - booleanList.add(Boolean.FALSE); - } - } - } - ); - - return generateArrayFromList(booleanList); - } - - public final void convertToCharacters(Object data, StringBuffer s) { - if (data == null) { - return; - } - - final boolean[] value = (boolean[]) data; - if (value.length == 0) { - return; - } - - // Insure conservately as all false - s.ensureCapacity(value.length * 5); - - final int end = value.length - 1; - for (int i = 0; i <= end; i++) { - if (value[i]) { - s.append("true"); - } else { - s.append("false"); - } - if (i != end) { - s.append(' '); - } - } - } - - public int getPrimtiveLengthFromOctetLength(int octetLength, int firstOctet) throws EncodingAlgorithmException { - final int unusedBits = (firstOctet >> 4) & 0xFF; - if (octetLength == 1) { - if (unusedBits > 3) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.unusedBits4")); - } - return 4 - unusedBits; - } else { - if (unusedBits > 7) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.unusedBits8")); - } - return octetLength * 8 - 4 - unusedBits; - } - } - - public final void decodeFromBytesToBooleanArray(boolean[] bdata, int bstart, int blength, byte[] b, int start, int length) { - int value = b[start++] & 0xFF; - int bitPosition = 4; - final int bend = bstart + blength; - while (bstart < bend) { - if (bitPosition == 8) { - value = b[start++] & 0xFF; - bitPosition = 0; - } - - bdata[bstart++] = (value & BIT_TABLE[bitPosition++]) > 0; - } - } - - public void encodeToBytes(Object array, int astart, int alength, byte[] b, int start) { - if (!(array instanceof boolean[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotBoolean")); - } - - encodeToBytesFromBooleanArray((boolean[])array, astart, alength, b, start); - } - - public void encodeToBytesFromBooleanArray(boolean[] array, int astart, int alength, byte[] b, int start) { - final int mod = (alength + 4) % 8; - final int unusedBits = (mod == 0) ? 0 : 8 - mod; - - int bitPosition = 4; - int value = unusedBits << 4; - final int aend = astart + alength; - while (astart < aend) { - if (array[astart++]) { - value |= BIT_TABLE[bitPosition]; - } - - if (++bitPosition == 8) { - b[start++] = (byte)value; - bitPosition = value = 0; - } - } - - if (bitPosition > 0) { - b[start] = (byte)value; - } - } - - - /** - * - * Generate a boolean array from a list of Booleans. - * - * @param array The array - * - */ - private boolean[] generateArrayFromList(List array) { - boolean[] bdata = new boolean[array.size()]; - for (int i = 0; i < bdata.length; i++) { - bdata[i] = ((Boolean)array.get(i)).booleanValue(); - } - - return bdata; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/BuiltInEncodingAlgorithm.java 2018-01-30 20:36:40.000000000 -0500 +++ /dev/null 2018-01-30 20:36:40.000000000 -0500 @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import java.nio.CharBuffer; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; - -public abstract class BuiltInEncodingAlgorithm implements EncodingAlgorithm { - protected final static Pattern SPACE_PATTERN = Pattern.compile("\\s"); - - public abstract int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException; - - public abstract int getOctetLengthFromPrimitiveLength(int primitiveLength); - - public abstract void encodeToBytes(Object array, int astart, int alength, byte[] b, int start); - - public interface WordListener { - public void word(int start, int end); - } - - public void matchWhiteSpaceDelimnatedWords(CharBuffer cb, WordListener wl) { - Matcher m = SPACE_PATTERN.matcher(cb); - int i = 0; - int s = 0; - while(m.find()) { - s = m.start(); - if (s != i) { - wl.word(i, s); - } - i = m.end(); - } - if (i != cb.length()) - wl.word(i, cb.length()); - } - - public StringBuilder removeWhitespace(char[] ch, int start, int length) { - StringBuilder buf = new StringBuilder(); - int firstNonWS = 0; - int idx = 0; - for (; idx < length; ++idx) { - if (Character.isWhitespace(ch[idx + start])) { - if (firstNonWS < idx) { - buf.append(ch, firstNonWS + start, idx - firstNonWS); - } - firstNonWS = idx + 1; - } - } - if (firstNonWS < idx) { - buf.append(ch, firstNonWS + start, idx - firstNonWS); - } - return buf; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/BuiltInEncodingAlgorithmFactory.java 2018-01-30 20:36:41.000000000 -0500 +++ /dev/null 2018-01-30 20:36:41.000000000 -0500 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes; - -public final class BuiltInEncodingAlgorithmFactory { - - private final static BuiltInEncodingAlgorithm[] table = - new BuiltInEncodingAlgorithm[EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END + 1]; - - public final static HexadecimalEncodingAlgorithm hexadecimalEncodingAlgorithm = new HexadecimalEncodingAlgorithm(); - - public final static BASE64EncodingAlgorithm base64EncodingAlgorithm = new BASE64EncodingAlgorithm(); - - public final static BooleanEncodingAlgorithm booleanEncodingAlgorithm = new BooleanEncodingAlgorithm(); - - public final static ShortEncodingAlgorithm shortEncodingAlgorithm = new ShortEncodingAlgorithm(); - - public final static IntEncodingAlgorithm intEncodingAlgorithm = new IntEncodingAlgorithm(); - - public final static LongEncodingAlgorithm longEncodingAlgorithm = new LongEncodingAlgorithm(); - - public final static FloatEncodingAlgorithm floatEncodingAlgorithm = new FloatEncodingAlgorithm(); - - public final static DoubleEncodingAlgorithm doubleEncodingAlgorithm = new DoubleEncodingAlgorithm(); - - public final static UUIDEncodingAlgorithm uuidEncodingAlgorithm = new UUIDEncodingAlgorithm(); - - static { - table[EncodingAlgorithmIndexes.HEXADECIMAL] = hexadecimalEncodingAlgorithm; - table[EncodingAlgorithmIndexes.BASE64] = base64EncodingAlgorithm; - table[EncodingAlgorithmIndexes.SHORT] = shortEncodingAlgorithm; - table[EncodingAlgorithmIndexes.INT] = intEncodingAlgorithm; - table[EncodingAlgorithmIndexes.LONG] = longEncodingAlgorithm; - table[EncodingAlgorithmIndexes.BOOLEAN] = booleanEncodingAlgorithm; - table[EncodingAlgorithmIndexes.FLOAT] = floatEncodingAlgorithm; - table[EncodingAlgorithmIndexes.DOUBLE] = doubleEncodingAlgorithm; - table[EncodingAlgorithmIndexes.UUID] = uuidEncodingAlgorithm; - } - - public static BuiltInEncodingAlgorithm getAlgorithm(int index) { - return table[index]; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/BuiltInEncodingAlgorithmState.java 2018-01-30 20:36:42.000000000 -0500 +++ /dev/null 2018-01-30 20:36:42.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -public class BuiltInEncodingAlgorithmState { - - public static final int INITIAL_LENGTH = 8; - - public boolean[] booleanArray = new boolean[INITIAL_LENGTH]; - - public short[] shortArray = new short[INITIAL_LENGTH]; - - public int[] intArray = new int[INITIAL_LENGTH]; - - public long[] longArray = new long[INITIAL_LENGTH]; - - public float[] floatArray = new float[INITIAL_LENGTH]; - - public double[] doubleArray = new double[INITIAL_LENGTH]; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/DoubleEncodingAlgorithm.java 2018-01-30 20:36:43.000000000 -0500 +++ /dev/null 2018-01-30 20:36:43.000000000 -0500 @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.CharBuffer; -import java.util.ArrayList; -import java.util.List; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - - - -public class DoubleEncodingAlgorithm extends IEEE754FloatingPointEncodingAlgorithm { - - public final int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException { - if (octetLength % DOUBLE_SIZE != 0) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance(). - getString("message.lengthIsNotMultipleOfDouble", new Object[]{Integer.valueOf(DOUBLE_SIZE)})); - } - - return octetLength / DOUBLE_SIZE; - } - - public int getOctetLengthFromPrimitiveLength(int primitiveLength) { - return primitiveLength * DOUBLE_SIZE; - } - - public final Object decodeFromBytes(byte[] b, int start, int length) throws EncodingAlgorithmException { - double[] data = new double[getPrimtiveLengthFromOctetLength(length)]; - decodeFromBytesToDoubleArray(data, 0, b, start, length); - - return data; - } - - public final Object decodeFromInputStream(InputStream s) throws IOException { - return decodeFromInputStreamToDoubleArray(s); - } - - - public void encodeToOutputStream(Object data, OutputStream s) throws IOException { - if (!(data instanceof double[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotDouble")); - } - - final double[] fdata = (double[])data; - - encodeToOutputStreamFromDoubleArray(fdata, s); - } - - public final Object convertFromCharacters(char[] ch, int start, int length) { - final CharBuffer cb = CharBuffer.wrap(ch, start, length); - final List doubleList = new ArrayList(); - - matchWhiteSpaceDelimnatedWords(cb, - new WordListener() { - public void word(int start, int end) { - String fStringValue = cb.subSequence(start, end).toString(); - doubleList.add(Double.valueOf(fStringValue)); - } - } - ); - - return generateArrayFromList(doubleList); - } - - public final void convertToCharacters(Object data, StringBuffer s) { - if (!(data instanceof double[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotDouble")); - } - - final double[] fdata = (double[])data; - - convertToCharactersFromDoubleArray(fdata, s); - } - - - public final void decodeFromBytesToDoubleArray(double[] data, int fstart, byte[] b, int start, int length) { - final int size = length / DOUBLE_SIZE; - for (int i = 0; i < size; i++) { - final long bits = - ((long)(b[start++] & 0xFF) << 56) | - ((long)(b[start++] & 0xFF) << 48) | - ((long)(b[start++] & 0xFF) << 40) | - ((long)(b[start++] & 0xFF) << 32) | - ((long)(b[start++] & 0xFF) << 24) | - ((long)(b[start++] & 0xFF) << 16) | - ((long)(b[start++] & 0xFF) << 8) | - (long)(b[start++] & 0xFF); - data[fstart++] = Double.longBitsToDouble(bits); - } - } - - public final double[] decodeFromInputStreamToDoubleArray(InputStream s) throws IOException { - final List doubleList = new ArrayList(); - final byte[] b = new byte[DOUBLE_SIZE]; - - while (true) { - int n = s.read(b); - if (n != DOUBLE_SIZE) { - if (n == -1) { - break; - } - - while(n != DOUBLE_SIZE) { - final int m = s.read(b, n, DOUBLE_SIZE - n); - if (m == -1) { - throw new EOFException(); - } - n += m; - } - } - - final long bits = - ((long)(b[0] & 0xFF) << 56) | - ((long)(b[1] & 0xFF) << 48) | - ((long)(b[2] & 0xFF) << 40) | - ((long)(b[3] & 0xFF) << 32) | - ((b[4] & 0xFF) << 24) | - ((b[5] & 0xFF) << 16) | - ((b[6] & 0xFF) << 8) | - (b[7] & 0xFF); - - doubleList.add(Double.valueOf(Double.longBitsToDouble(bits))); - } - - return generateArrayFromList(doubleList); - } - - - public final void encodeToOutputStreamFromDoubleArray(double[] fdata, OutputStream s) throws IOException { - for (int i = 0; i < fdata.length; i++) { - final long bits = Double.doubleToLongBits(fdata[i]); - s.write((int)((bits >>> 56) & 0xFF)); - s.write((int)((bits >>> 48) & 0xFF)); - s.write((int)((bits >>> 40) & 0xFF)); - s.write((int)((bits >>> 32) & 0xFF)); - s.write((int)((bits >>> 24) & 0xFF)); - s.write((int)((bits >>> 16) & 0xFF)); - s.write((int)((bits >>> 8) & 0xFF)); - s.write((int)(bits & 0xFF)); - } - } - - public final void encodeToBytes(Object array, int astart, int alength, byte[] b, int start) { - encodeToBytesFromDoubleArray((double[])array, astart, alength, b, start); - } - - public final void encodeToBytesFromDoubleArray(double[] fdata, int fstart, int flength, byte[] b, int start) { - final int fend = fstart + flength; - for (int i = fstart; i < fend; i++) { - final long bits = Double.doubleToLongBits(fdata[i]); - b[start++] = (byte)((bits >>> 56) & 0xFF); - b[start++] = (byte)((bits >>> 48) & 0xFF); - b[start++] = (byte)((bits >>> 40) & 0xFF); - b[start++] = (byte)((bits >>> 32) & 0xFF); - b[start++] = (byte)((bits >>> 24) & 0xFF); - b[start++] = (byte)((bits >>> 16) & 0xFF); - b[start++] = (byte)((bits >>> 8) & 0xFF); - b[start++] = (byte)(bits & 0xFF); - } - } - - - public final void convertToCharactersFromDoubleArray(double[] fdata, StringBuffer s) { - final int end = fdata.length - 1; - for (int i = 0; i <= end; i++) { - s.append(Double.toString(fdata[i])); - if (i != end) { - s.append(' '); - } - } - } - - - public final double[] generateArrayFromList(List array) { - double[] fdata = new double[array.size()]; - for (int i = 0; i < fdata.length; i++) { - fdata[i] = ((Double)array.get(i)).doubleValue(); - } - - return fdata; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/FloatEncodingAlgorithm.java 2018-01-30 20:36:43.000000000 -0500 +++ /dev/null 2018-01-30 20:36:43.000000000 -0500 @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.CharBuffer; -import java.util.ArrayList; -import java.util.List; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - - - -public class FloatEncodingAlgorithm extends IEEE754FloatingPointEncodingAlgorithm { - - public final int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException { - if (octetLength % FLOAT_SIZE != 0) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance(). - getString("message.lengthNotMultipleOfFloat", new Object[]{Integer.valueOf(FLOAT_SIZE)})); - } - - return octetLength / FLOAT_SIZE; - } - - public int getOctetLengthFromPrimitiveLength(int primitiveLength) { - return primitiveLength * FLOAT_SIZE; - } - - public final Object decodeFromBytes(byte[] b, int start, int length) throws EncodingAlgorithmException { - float[] data = new float[getPrimtiveLengthFromOctetLength(length)]; - decodeFromBytesToFloatArray(data, 0, b, start, length); - - return data; - } - - public final Object decodeFromInputStream(InputStream s) throws IOException { - return decodeFromInputStreamToFloatArray(s); - } - - - public void encodeToOutputStream(Object data, OutputStream s) throws IOException { - if (!(data instanceof float[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotFloat")); - } - - final float[] fdata = (float[])data; - - encodeToOutputStreamFromFloatArray(fdata, s); - } - - public final Object convertFromCharacters(char[] ch, int start, int length) { - final CharBuffer cb = CharBuffer.wrap(ch, start, length); - final List floatList = new ArrayList(); - - matchWhiteSpaceDelimnatedWords(cb, - new WordListener() { - public void word(int start, int end) { - String fStringValue = cb.subSequence(start, end).toString(); - floatList.add(Float.valueOf(fStringValue)); - } - } - ); - - return generateArrayFromList(floatList); - } - - public final void convertToCharacters(Object data, StringBuffer s) { - if (!(data instanceof float[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotFloat")); - } - - final float[] fdata = (float[])data; - - convertToCharactersFromFloatArray(fdata, s); - } - - - public final void decodeFromBytesToFloatArray(float[] data, int fstart, byte[] b, int start, int length) { - final int size = length / FLOAT_SIZE; - for (int i = 0; i < size; i++) { - final int bits = ((b[start++] & 0xFF) << 24) | - ((b[start++] & 0xFF) << 16) | - ((b[start++] & 0xFF) << 8) | - (b[start++] & 0xFF); - data[fstart++] = Float.intBitsToFloat(bits); - } - } - - public final float[] decodeFromInputStreamToFloatArray(InputStream s) throws IOException { - final List floatList = new ArrayList(); - final byte[] b = new byte[FLOAT_SIZE]; - - while (true) { - int n = s.read(b); - if (n != 4) { - if (n == -1) { - break; - } - - while(n != 4) { - final int m = s.read(b, n, FLOAT_SIZE - n); - if (m == -1) { - throw new EOFException(); - } - n += m; - } - } - - final int bits = ((b[0] & 0xFF) << 24) | - ((b[1] & 0xFF) << 16) | - ((b[2] & 0xFF) << 8) | - (b[3] & 0xFF); - floatList.add(Float.valueOf(Float.intBitsToFloat(bits))); - } - - return generateArrayFromList(floatList); - } - - - public final void encodeToOutputStreamFromFloatArray(float[] fdata, OutputStream s) throws IOException { - for (int i = 0; i < fdata.length; i++) { - final int bits = Float.floatToIntBits(fdata[i]); - s.write((bits >>> 24) & 0xFF); - s.write((bits >>> 16) & 0xFF); - s.write((bits >>> 8) & 0xFF); - s.write(bits & 0xFF); - } - } - - public final void encodeToBytes(Object array, int astart, int alength, byte[] b, int start) { - encodeToBytesFromFloatArray((float[])array, astart, alength, b, start); - } - - public final void encodeToBytesFromFloatArray(float[] fdata, int fstart, int flength, byte[] b, int start) { - final int fend = fstart + flength; - for (int i = fstart; i < fend; i++) { - final int bits = Float.floatToIntBits(fdata[i]); - b[start++] = (byte)((bits >>> 24) & 0xFF); - b[start++] = (byte)((bits >>> 16) & 0xFF); - b[start++] = (byte)((bits >>> 8) & 0xFF); - b[start++] = (byte)(bits & 0xFF); - } - } - - - public final void convertToCharactersFromFloatArray(float[] fdata, StringBuffer s) { - final int end = fdata.length - 1; - for (int i = 0; i <= end; i++) { - s.append(Float.toString(fdata[i])); - if (i != end) { - s.append(' '); - } - } - } - - - public final float[] generateArrayFromList(List array) { - float[] fdata = new float[array.size()]; - for (int i = 0; i < fdata.length; i++) { - fdata[i] = ((Float)array.get(i)).floatValue(); - } - - return fdata; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/HexadecimalEncodingAlgorithm.java 2018-01-30 20:36:44.000000000 -0500 +++ /dev/null 2018-01-30 20:36:44.000000000 -0500 @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class HexadecimalEncodingAlgorithm extends BuiltInEncodingAlgorithm { - private static final char NIBBLE_TO_HEXADECIMAL_TABLE[] = - { '0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F' }; - - private static final int HEXADECIMAL_TO_NIBBLE_TABLE[] = { - /*'0'*/ 0, - /*'1'*/ 1, - /*'2'*/ 2, - /*'3'*/ 3, - /*'4'*/ 4, - /*'5'*/ 5, - /*'6'*/ 6, - /*'7'*/ 7, - /*'8'*/ 8, - /*'9'*/ 9, -1, -1, -1, -1, -1, -1, -1, - /*'A'*/ 10, - /*'B'*/ 11, - /*'C'*/ 12, - /*'D'*/ 13, - /*'E'*/ 14, - /*'F'*/ 15, - /*'G'-'Z'*/-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, - /*'[' - '`'*/ -1, -1, -1, -1, -1, -1, - /*'a'*/ 10, - /*'b'*/ 11, - /*'c'*/ 12, - /*'d'*/ 13, - /*'e'*/ 14, - /*'f'*/ 15 }; - - public final Object decodeFromBytes(byte[] b, int start, int length) throws EncodingAlgorithmException { - final byte[] data = new byte[length]; - System.arraycopy(b, start, data, 0, length); - return data; - } - - public final Object decodeFromInputStream(InputStream s) throws IOException { - throw new UnsupportedOperationException(CommonResourceBundle.getInstance().getString("message.notImplemented")); - } - - - public void encodeToOutputStream(Object data, OutputStream s) throws IOException { - if (!(data instanceof byte[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotByteArray")); - } - - s.write((byte[])data); - } - - public final Object convertFromCharacters(char[] ch, int start, int length) { - if (length == 0) { - return new byte[0]; - } - - StringBuilder encodedValue = removeWhitespace(ch, start, length); - int encodedLength = encodedValue.length(); - if (encodedLength == 0) { - return new byte[0]; - } - - int valueLength = encodedValue.length() / 2; - byte[] value = new byte[valueLength]; - - int encodedIdx = 0; - for (int i = 0; i < valueLength; ++i) { - int nibble1 = HEXADECIMAL_TO_NIBBLE_TABLE[encodedValue.charAt(encodedIdx++) - '0']; - int nibble2 = HEXADECIMAL_TO_NIBBLE_TABLE[encodedValue.charAt(encodedIdx++) - '0']; - value[i] = (byte) ((nibble1 << 4) | nibble2); - } - - return value; - } - - public final void convertToCharacters(Object data, StringBuffer s) { - if (data == null) { - return; - } - final byte[] value = (byte[]) data; - if (value.length == 0) { - return; - } - - s.ensureCapacity(value.length * 2); - for (int i = 0; i < value.length; ++i) { - s.append(NIBBLE_TO_HEXADECIMAL_TABLE[(value[i] >>> 4) & 0xf]); - s.append(NIBBLE_TO_HEXADECIMAL_TABLE[value[i] & 0xf]); - } - } - - - - public final int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException { - return octetLength * 2; - } - - public int getOctetLengthFromPrimitiveLength(int primitiveLength) { - return primitiveLength / 2; - } - - public final void encodeToBytes(Object array, int astart, int alength, byte[] b, int start) { - System.arraycopy((byte[])array, astart, b, start, alength); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/IEEE754FloatingPointEncodingAlgorithm.java 2018-01-30 20:36:45.000000000 -0500 +++ /dev/null 2018-01-30 20:36:45.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -public abstract class IEEE754FloatingPointEncodingAlgorithm extends BuiltInEncodingAlgorithm { - public final static int FLOAT_SIZE = 4; - public final static int DOUBLE_SIZE = 8; - - public final static int FLOAT_MAX_CHARACTER_SIZE = 14; - public final static int DOUBLE_MAX_CHARACTER_SIZE = 24; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/IntEncodingAlgorithm.java 2018-01-30 20:36:46.000000000 -0500 +++ /dev/null 2018-01-30 20:36:46.000000000 -0500 @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.CharBuffer; -import java.util.ArrayList; -import java.util.List; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - - - -public class IntEncodingAlgorithm extends IntegerEncodingAlgorithm { - - public final int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException { - if (octetLength % INT_SIZE != 0) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance(). - getString("message.lengthNotMultipleOfInt", new Object[]{Integer.valueOf(INT_SIZE)})); - } - - return octetLength / INT_SIZE; - } - - public int getOctetLengthFromPrimitiveLength(int primitiveLength) { - return primitiveLength * INT_SIZE; - } - - public final Object decodeFromBytes(byte[] b, int start, int length) throws EncodingAlgorithmException { - int[] data = new int[getPrimtiveLengthFromOctetLength(length)]; - decodeFromBytesToIntArray(data, 0, b, start, length); - - return data; - } - - public final Object decodeFromInputStream(InputStream s) throws IOException { - return decodeFromInputStreamToIntArray(s); - } - - - public void encodeToOutputStream(Object data, OutputStream s) throws IOException { - if (!(data instanceof int[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotIntArray")); - } - - final int[] idata = (int[])data; - - encodeToOutputStreamFromIntArray(idata, s); - } - - - public final Object convertFromCharacters(char[] ch, int start, int length) { - final CharBuffer cb = CharBuffer.wrap(ch, start, length); - final List integerList = new ArrayList(); - - matchWhiteSpaceDelimnatedWords(cb, - new WordListener() { - public void word(int start, int end) { - String iStringValue = cb.subSequence(start, end).toString(); - integerList.add(Integer.valueOf(iStringValue)); - } - } - ); - - return generateArrayFromList(integerList); - } - - public final void convertToCharacters(Object data, StringBuffer s) { - if (!(data instanceof int[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotIntArray")); - } - - final int[] idata = (int[])data; - - convertToCharactersFromIntArray(idata, s); - } - - - public final void decodeFromBytesToIntArray(int[] idata, int istart, byte[] b, int start, int length) { - final int size = length / INT_SIZE; - for (int i = 0; i < size; i++) { - idata[istart++] = ((b[start++] & 0xFF) << 24) | - ((b[start++] & 0xFF) << 16) | - ((b[start++] & 0xFF) << 8) | - (b[start++] & 0xFF); - } - } - - public final int[] decodeFromInputStreamToIntArray(InputStream s) throws IOException { - final List integerList = new ArrayList(); - final byte[] b = new byte[INT_SIZE]; - - while (true) { - int n = s.read(b); - if (n != 4) { - if (n == -1) { - break; - } - - while(n != 4) { - final int m = s.read(b, n, INT_SIZE - n); - if (m == -1) { - throw new EOFException(); - } - n += m; - } - } - - final int i = ((b[0] & 0xFF) << 24) | - ((b[1] & 0xFF) << 16) | - ((b[2] & 0xFF) << 8) | - (b[3] & 0xFF); - integerList.add(Integer.valueOf(i)); - } - - return generateArrayFromList(integerList); - } - - - public final void encodeToOutputStreamFromIntArray(int[] idata, OutputStream s) throws IOException { - for (int i = 0; i < idata.length; i++) { - final int bits = idata[i]; - s.write((bits >>> 24) & 0xFF); - s.write((bits >>> 16) & 0xFF); - s.write((bits >>> 8) & 0xFF); - s.write(bits & 0xFF); - } - } - - public final void encodeToBytes(Object array, int astart, int alength, byte[] b, int start) { - encodeToBytesFromIntArray((int[])array, astart, alength, b, start); - } - - public final void encodeToBytesFromIntArray(int[] idata, int istart, int ilength, byte[] b, int start) { - final int iend = istart + ilength; - for (int i = istart; i < iend; i++) { - final int bits = idata[i]; - b[start++] = (byte)((bits >>> 24) & 0xFF); - b[start++] = (byte)((bits >>> 16) & 0xFF); - b[start++] = (byte)((bits >>> 8) & 0xFF); - b[start++] = (byte)(bits & 0xFF); - } - } - - - public final void convertToCharactersFromIntArray(int[] idata, StringBuffer s) { - final int end = idata.length - 1; - for (int i = 0; i <= end; i++) { - s.append(Integer.toString(idata[i])); - if (i != end) { - s.append(' '); - } - } - } - - - public final int[] generateArrayFromList(List array) { - int[] idata = new int[array.size()]; - for (int i = 0; i < idata.length; i++) { - idata[i] = ((Integer)array.get(i)).intValue(); - } - - return idata; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/IntegerEncodingAlgorithm.java 2018-01-30 20:36:46.000000000 -0500 +++ /dev/null 2018-01-30 20:36:47.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -public abstract class IntegerEncodingAlgorithm extends BuiltInEncodingAlgorithm { - public final static int SHORT_SIZE = 2; - public final static int INT_SIZE = 4; - public final static int LONG_SIZE = 8; - - public final static int SHORT_MAX_CHARACTER_SIZE = 6; - public final static int INT_MAX_CHARACTER_SIZE = 11; - public final static int LONG_MAX_CHARACTER_SIZE = 20; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/LongEncodingAlgorithm.java 2018-01-30 20:36:47.000000000 -0500 +++ /dev/null 2018-01-30 20:36:47.000000000 -0500 @@ -1,211 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.CharBuffer; -import java.util.ArrayList; -import java.util.List; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - - -public class LongEncodingAlgorithm extends IntegerEncodingAlgorithm { - - public int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException { - if (octetLength % LONG_SIZE != 0) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance(). - getString("message.lengthNotMultipleOfLong", new Object[]{Integer.valueOf(LONG_SIZE)})); - } - - return octetLength / LONG_SIZE; - } - - public int getOctetLengthFromPrimitiveLength(int primitiveLength) { - return primitiveLength * LONG_SIZE; - } - - public final Object decodeFromBytes(byte[] b, int start, int length) throws EncodingAlgorithmException { - long[] data = new long[getPrimtiveLengthFromOctetLength(length)]; - decodeFromBytesToLongArray(data, 0, b, start, length); - - return data; - } - - public final Object decodeFromInputStream(InputStream s) throws IOException { - return decodeFromInputStreamToIntArray(s); - } - - - public void encodeToOutputStream(Object data, OutputStream s) throws IOException { - if (!(data instanceof long[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotLongArray")); - } - - final long[] ldata = (long[])data; - - encodeToOutputStreamFromLongArray(ldata, s); - } - - - public Object convertFromCharacters(char[] ch, int start, int length) { - final CharBuffer cb = CharBuffer.wrap(ch, start, length); - final List longList = new ArrayList(); - - matchWhiteSpaceDelimnatedWords(cb, - new WordListener() { - public void word(int start, int end) { - String lStringValue = cb.subSequence(start, end).toString(); - longList.add(Long.valueOf(lStringValue)); - } - } - ); - - return generateArrayFromList(longList); - } - - public void convertToCharacters(Object data, StringBuffer s) { - if (!(data instanceof long[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotLongArray")); - } - - final long[] ldata = (long[])data; - - convertToCharactersFromLongArray(ldata, s); - } - - - public final void decodeFromBytesToLongArray(long[] ldata, int istart, byte[] b, int start, int length) { - final int size = length / LONG_SIZE; - for (int i = 0; i < size; i++) { - ldata[istart++] = - ((long)(b[start++] & 0xFF) << 56) | - ((long)(b[start++] & 0xFF) << 48) | - ((long)(b[start++] & 0xFF) << 40) | - ((long)(b[start++] & 0xFF) << 32) | - ((long)(b[start++] & 0xFF) << 24) | - ((long)(b[start++] & 0xFF) << 16) | - ((long)(b[start++] & 0xFF) << 8) | - (long)(b[start++] & 0xFF); - } - } - - public final long[] decodeFromInputStreamToIntArray(InputStream s) throws IOException { - final List longList = new ArrayList(); - final byte[] b = new byte[LONG_SIZE]; - - while (true) { - int n = s.read(b); - if (n != LONG_SIZE) { - if (n == -1) { - break; - } - - while(n != LONG_SIZE) { - final int m = s.read(b, n, LONG_SIZE - n); - if (m == -1) { - throw new EOFException(); - } - n += m; - } - } - - final long l = - (((long) b[0] << 56) + - ((long) (b[1] & 0xFF) << 48) + - ((long) (b[2] & 0xFF) << 40) + - ((long) (b[3] & 0xFF) << 32) + - ((long) (b[4] & 0xFF) << 24) + - ((b[5] & 0xFF) << 16) + - ((b[6] & 0xFF) << 8) + - ((b[7] & 0xFF) << 0)); - - longList.add(Long.valueOf(l)); - } - - return generateArrayFromList(longList); - } - - - public final void encodeToOutputStreamFromLongArray(long[] ldata, OutputStream s) throws IOException { - for (int i = 0; i < ldata.length; i++) { - final long bits = ldata[i]; - s.write((int)((bits >>> 56) & 0xFF)); - s.write((int)((bits >>> 48) & 0xFF)); - s.write((int)((bits >>> 40) & 0xFF)); - s.write((int)((bits >>> 32) & 0xFF)); - s.write((int)((bits >>> 24) & 0xFF)); - s.write((int)((bits >>> 16) & 0xFF)); - s.write((int)((bits >>> 8) & 0xFF)); - s.write((int)(bits & 0xFF)); - } - } - - public final void encodeToBytes(Object array, int astart, int alength, byte[] b, int start) { - encodeToBytesFromLongArray((long[])array, astart, alength, b, start); - } - - public final void encodeToBytesFromLongArray(long[] ldata, int lstart, int llength, byte[] b, int start) { - final int lend = lstart + llength; - for (int i = lstart; i < lend; i++) { - final long bits = ldata[i]; - b[start++] = (byte)((bits >>> 56) & 0xFF); - b[start++] = (byte)((bits >>> 48) & 0xFF); - b[start++] = (byte)((bits >>> 40) & 0xFF); - b[start++] = (byte)((bits >>> 32) & 0xFF); - b[start++] = (byte)((bits >>> 24) & 0xFF); - b[start++] = (byte)((bits >>> 16) & 0xFF); - b[start++] = (byte)((bits >>> 8) & 0xFF); - b[start++] = (byte)(bits & 0xFF); - } - } - - - public final void convertToCharactersFromLongArray(long[] ldata, StringBuffer s) { - final int end = ldata.length - 1; - for (int i = 0; i <= end; i++) { - s.append(Long.toString(ldata[i])); - if (i != end) { - s.append(' '); - } - } - } - - - public final long[] generateArrayFromList(List array) { - long[] ldata = new long[array.size()]; - for (int i = 0; i < ldata.length; i++) { - ldata[i] = ((Long)array.get(i)).longValue(); - } - - return ldata; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/ShortEncodingAlgorithm.java 2018-01-30 20:36:48.000000000 -0500 +++ /dev/null 2018-01-30 20:36:48.000000000 -0500 @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import java.io.EOFException; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.CharBuffer; -import java.util.ArrayList; -import java.util.List; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - - -/** - * An encoder for handling Short values. Suppports the builtin SHORT encoder. - * - * @author Alan Hudson - * @author Paul Sandoz - */ -public class ShortEncodingAlgorithm extends IntegerEncodingAlgorithm { - - public final int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException { - if (octetLength % SHORT_SIZE != 0) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance(). - getString("message.lengthNotMultipleOfShort", new Object[]{Integer.valueOf(SHORT_SIZE)})); - } - - return octetLength / SHORT_SIZE; - } - - public int getOctetLengthFromPrimitiveLength(int primitiveLength) { - return primitiveLength * SHORT_SIZE; - } - - public final Object decodeFromBytes(byte[] b, int start, int length) throws EncodingAlgorithmException { - short[] data = new short[getPrimtiveLengthFromOctetLength(length)]; - decodeFromBytesToShortArray(data, 0, b, start, length); - - return data; - } - - public final Object decodeFromInputStream(InputStream s) throws IOException { - return decodeFromInputStreamToShortArray(s); - } - - - public void encodeToOutputStream(Object data, OutputStream s) throws IOException { - if (!(data instanceof short[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotShortArray")); - } - - final short[] idata = (short[])data; - - encodeToOutputStreamFromShortArray(idata, s); - } - - - public final Object convertFromCharacters(char[] ch, int start, int length) { - final CharBuffer cb = CharBuffer.wrap(ch, start, length); - final List shortList = new ArrayList(); - - matchWhiteSpaceDelimnatedWords(cb, - new WordListener() { - public void word(int start, int end) { - String iStringValue = cb.subSequence(start, end).toString(); - shortList.add(Short.valueOf(iStringValue)); - } - } - ); - - return generateArrayFromList(shortList); - } - - public final void convertToCharacters(Object data, StringBuffer s) { - if (!(data instanceof short[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotShortArray")); - } - - final short[] idata = (short[])data; - - convertToCharactersFromShortArray(idata, s); - } - - - public final void decodeFromBytesToShortArray(short[] sdata, int istart, byte[] b, int start, int length) { - final int size = length / SHORT_SIZE; - for (int i = 0; i < size; i++) { - sdata[istart++] = (short) (((b[start++] & 0xFF) << 8) | - (b[start++] & 0xFF)); - } - } - - public final short[] decodeFromInputStreamToShortArray(InputStream s) throws IOException { - final List shortList = new ArrayList(); - final byte[] b = new byte[SHORT_SIZE]; - - while (true) { - int n = s.read(b); - if (n != 2) { - if (n == -1) { - break; - } - - while(n != 2) { - final int m = s.read(b, n, SHORT_SIZE - n); - if (m == -1) { - throw new EOFException(); - } - n += m; - } - } - - final int i = ((b[0] & 0xFF) << 8) | - (b[1] & 0xFF); - shortList.add(Short.valueOf((short)i)); - } - - return generateArrayFromList(shortList); - } - - - public final void encodeToOutputStreamFromShortArray(short[] idata, OutputStream s) throws IOException { - for (int i = 0; i < idata.length; i++) { - final int bits = idata[i]; - s.write((bits >>> 8) & 0xFF); - s.write(bits & 0xFF); - } - } - - public final void encodeToBytes(Object array, int astart, int alength, byte[] b, int start) { - encodeToBytesFromShortArray((short[])array, astart, alength, b, start); - } - - public final void encodeToBytesFromShortArray(short[] sdata, int istart, int ilength, byte[] b, int start) { - final int iend = istart + ilength; - for (int i = istart; i < iend; i++) { - final short bits = sdata[i]; - b[start++] = (byte)((bits >>> 8) & 0xFF); - b[start++] = (byte)(bits & 0xFF); - } - } - - - public final void convertToCharactersFromShortArray(short[] sdata, StringBuffer s) { - final int end = sdata.length - 1; - for (int i = 0; i <= end; i++) { - s.append(Short.toString(sdata[i])); - if (i != end) { - s.append(' '); - } - } - } - - - public final short[] generateArrayFromList(List array) { - short[] sdata = new short[array.size()]; - for (int i = 0; i < sdata.length; i++) { - sdata[i] = ((Short)array.get(i)).shortValue(); - } - - return sdata; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/algorithm/UUIDEncodingAlgorithm.java 2018-01-30 20:36:49.000000000 -0500 +++ /dev/null 2018-01-30 20:36:49.000000000 -0500 @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.algorithm; - -import java.util.ArrayList; -import java.util.List; -import java.nio.CharBuffer; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class UUIDEncodingAlgorithm extends LongEncodingAlgorithm { - - public final int getPrimtiveLengthFromOctetLength(int octetLength) throws EncodingAlgorithmException { - if (octetLength % (LONG_SIZE * 2) != 0) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance(). - getString("message.lengthNotMultipleOfUUID",new Object[]{Integer.valueOf(LONG_SIZE * 2)})); - } - - return octetLength / LONG_SIZE; - } - - public final Object convertFromCharacters(char[] ch, int start, int length) { - final CharBuffer cb = CharBuffer.wrap(ch, start, length); - final List longList = new ArrayList(); - - matchWhiteSpaceDelimnatedWords(cb, - new WordListener() { - public void word(int start, int end) { - String uuidValue = cb.subSequence(start, end).toString(); - fromUUIDString(uuidValue); - longList.add(Long.valueOf(_msb)); - longList.add(Long.valueOf(_lsb)); - } - } - ); - - return generateArrayFromList(longList); - } - - public final void convertToCharacters(Object data, StringBuffer s) { - if (!(data instanceof long[])) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.dataNotLongArray")); - } - - final long[] ldata = (long[])data; - - final int end = ldata.length - 2; - for (int i = 0; i <= end; i += 2) { - s.append(toUUIDString(ldata[i], ldata[i + 1])); - if (i != end) { - s.append(' '); - } - } - } - - - private long _msb; - private long _lsb; - - final void fromUUIDString(String name) { - String[] components = name.split("-"); - if (components.length != 5) - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.invalidUUID", new Object[]{name})); - - for (int i=0; i<5; i++) - components[i] = "0x"+components[i]; - - _msb = Long.parseLong(components[0], 16); - _msb <<= 16; - _msb |= Long.parseLong(components[1], 16); - _msb <<= 16; - _msb |= Long.parseLong(components[2], 16); - - _lsb = Long.parseLong(components[3], 16); - _lsb <<= 48; - _lsb |= Long.parseLong(components[4], 16); - } - - final String toUUIDString(long msb, long lsb) { - return (digits(msb >> 32, 8) + "-" + - digits(msb >> 16, 4) + "-" + - digits(msb, 4) + "-" + - digits(lsb >> 48, 4) + "-" + - digits(lsb, 12)); - } - - final String digits(long val, int digits) { - long hi = 1L << (digits * 4); - return Long.toHexString(hi | (val & (hi - 1))).substring(1); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/alphabet/BuiltInRestrictedAlphabets.java 2018-01-30 20:36:49.000000000 -0500 +++ /dev/null 2018-01-30 20:36:49.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.alphabet; - -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.org.jvnet.fastinfoset.RestrictedAlphabet; - -public final class BuiltInRestrictedAlphabets { - public final static char[][] table = - new char[EncodingConstants.RESTRICTED_ALPHABET_BUILTIN_END + 1][]; - - static { - table[RestrictedAlphabet.NUMERIC_CHARACTERS_INDEX] = RestrictedAlphabet.NUMERIC_CHARACTERS.toCharArray(); - table[RestrictedAlphabet.DATE_TIME_CHARACTERS_INDEX] = RestrictedAlphabet.DATE_TIME_CHARACTERS.toCharArray(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/dom/DOMDocumentParser.java 2018-01-30 20:36:50.000000000 -0500 +++ /dev/null 2018-01-30 20:36:50.000000000 -0500 @@ -1,1057 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.dom; - -import com.sun.xml.internal.fastinfoset.Decoder; -import com.sun.xml.internal.fastinfoset.DecoderStateTables; -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.algorithm.BuiltInEncodingAlgorithmFactory; -import com.sun.xml.internal.fastinfoset.util.CharArray; -import com.sun.xml.internal.fastinfoset.util.CharArrayString; -import java.io.IOException; -import java.io.InputStream; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; -import com.sun.xml.internal.fastinfoset.util.DuplicateAttributeVerifier; -import org.w3c.dom.Text; - -/** - * The Fast Infoset DOM parser. - *

- * Instantiate this parser to parse a fast infoset document in accordance - * with the DOM API. - * - */ -public class DOMDocumentParser extends Decoder { - protected Document _document; - - protected Node _currentNode; - - protected Element _currentElement; - - protected Attr[] _namespaceAttributes = new Attr[16]; - - protected int _namespaceAttributesIndex; - - protected int[] _namespacePrefixes = new int[16]; - - protected int _namespacePrefixesIndex; - - /** - * Parse a fast infoset document into a {@link Document} instance. - *

- * {@link Node}s will be created and appended to the {@link Document} - * instance. - * - * @param d the {@link Document} instance. - * @param s the input stream containing the fast infoset document. - */ - public void parse(Document d, InputStream s) throws FastInfosetException, IOException { - _currentNode = _document = d; - _namespaceAttributesIndex = 0; - - parse(s); - } - - protected final void parse(InputStream s) throws FastInfosetException, IOException { - setInputStream(s); - parse(); - } - - protected void resetOnError() { - _namespacePrefixesIndex = 0; - - if (_v == null) { - _prefixTable.clearCompletely(); - } - _duplicateAttributeVerifier.clear(); - } - - protected final void parse() throws FastInfosetException, IOException { - try { - reset(); - decodeHeader(); - processDII(); - } catch (RuntimeException e) { - resetOnError(); - // Wrap runtime exception - throw new FastInfosetException(e); - } catch (FastInfosetException e) { - resetOnError(); - throw e; - } catch (IOException e) { - resetOnError(); - throw e; - } - } - - protected final void processDII() throws FastInfosetException, IOException { - _b = read(); - if (_b > 0) { - processDIIOptionalProperties(); - } - - // Decode one Document Type II, Comment IIs, PI IIs and one EII - boolean firstElementHasOccured = false; - boolean documentTypeDeclarationOccured = false; - while(!_terminate || !firstElementHasOccured) { - _b = read(); - switch(DecoderStateTables.DII(_b)) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b], false); - firstElementHasOccured = true; - break; - case DecoderStateTables.EII_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b & EncodingConstants.INTEGER_3RD_BIT_SMALL_MASK], true); - firstElementHasOccured = true; - break; - case DecoderStateTables.EII_INDEX_MEDIUM: - processEII(decodeEIIIndexMedium(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - firstElementHasOccured = true; - break; - case DecoderStateTables.EII_INDEX_LARGE: - processEII(decodeEIIIndexLarge(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - firstElementHasOccured = true; - break; - case DecoderStateTables.EII_LITERAL: - { - final QualifiedName qn = processLiteralQualifiedName( - _b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _elementNameTable.getNext()); - _elementNameTable.add(qn); - processEII(qn, (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - firstElementHasOccured = true; - break; - } - case DecoderStateTables.EII_NAMESPACES: - processEIIWithNamespaces(); - firstElementHasOccured = true; - break; - case DecoderStateTables.DOCUMENT_TYPE_DECLARATION_II: - { - if (documentTypeDeclarationOccured) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.secondOccurenceOfDTDII")); - } - documentTypeDeclarationOccured = true; - - String system_identifier = ((_b & EncodingConstants.DOCUMENT_TYPE_SYSTEM_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : null; - String public_identifier = ((_b & EncodingConstants.DOCUMENT_TYPE_PUBLIC_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : null; - - _b = read(); - while (_b == EncodingConstants.PROCESSING_INSTRUCTION) { - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - if (_addToTable) { - _v.otherString.add(new CharArray(_charBuffer, 0, _charBufferLength, true)); - } - break; - case NISTRING_ENCODING_ALGORITHM: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.processingIIWithEncodingAlgorithm")); - case NISTRING_INDEX: - break; - case NISTRING_EMPTY_STRING: - break; - } - _b = read(); - } - if ((_b & EncodingConstants.TERMINATOR) != EncodingConstants.TERMINATOR) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.processingInstructionIIsNotTerminatedCorrectly")); - } - if (_b == EncodingConstants.DOUBLE_TERMINATOR) { - _terminate = true; - } - - _notations.clear(); - _unparsedEntities.clear(); - /* - * TODO - * Report All events associated with DTD, PIs, notations etc - */ - break; - } - case DecoderStateTables.COMMENT_II: - processCommentII(); - break; - case DecoderStateTables.PROCESSING_INSTRUCTION_II: - processProcessingII(); - break; - case DecoderStateTables.TERMINATOR_DOUBLE: - _doubleTerminate = true; - case DecoderStateTables.TERMINATOR_SINGLE: - _terminate = true; - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingDII")); - } - } - - // Decode any remaining Comment IIs, PI IIs - while(!_terminate) { - _b = read(); - switch(DecoderStateTables.DII(_b)) { - case DecoderStateTables.COMMENT_II: - processCommentII(); - break; - case DecoderStateTables.PROCESSING_INSTRUCTION_II: - processProcessingII(); - break; - case DecoderStateTables.TERMINATOR_DOUBLE: - _doubleTerminate = true; - case DecoderStateTables.TERMINATOR_SINGLE: - _terminate = true; - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingDII")); - } - } - - } - - protected final void processDIIOptionalProperties() throws FastInfosetException, IOException { - // Optimize for the most common case - if (_b == EncodingConstants.DOCUMENT_INITIAL_VOCABULARY_FLAG) { - decodeInitialVocabulary(); - return; - } - - if ((_b & EncodingConstants.DOCUMENT_ADDITIONAL_DATA_FLAG) > 0) { - decodeAdditionalData(); - /* - * TODO - * how to report the additional data? - */ - } - - if ((_b & EncodingConstants.DOCUMENT_INITIAL_VOCABULARY_FLAG) > 0) { - decodeInitialVocabulary(); - } - - if ((_b & EncodingConstants.DOCUMENT_NOTATIONS_FLAG) > 0) { - decodeNotations(); - // TODO Report notations - } - - if ((_b & EncodingConstants.DOCUMENT_UNPARSED_ENTITIES_FLAG) > 0) { - decodeUnparsedEntities(); - // TODO Report unparsed entities - } - - if ((_b & EncodingConstants.DOCUMENT_CHARACTER_ENCODING_SCHEME) > 0) { - /*String version = */decodeCharacterEncodingScheme(); - /* - * TODO - * how to report the character encoding scheme? - */ - } - - if ((_b & EncodingConstants.DOCUMENT_STANDALONE_FLAG) > 0) { - /*boolean standalone = (*/read()/* > 0) ? true : false*/ ; - /* - * TODO - * how to report the standalone flag? - */ - } - - if ((_b & EncodingConstants.DOCUMENT_VERSION_FLAG) > 0) { - decodeVersion(); - /* - * TODO - * how to report the document version? - */ - } - } - - protected final void processEII(QualifiedName name, boolean hasAttributes) throws FastInfosetException, IOException { - if (_prefixTable._currentInScope[name.prefixIndex] != name.namespaceNameIndex) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.qnameOfEIINotInScope")); - } - - final Node parentCurrentNode = _currentNode; - - _currentNode = _currentElement = createElement(name.namespaceName, name.qName, name.localName); - - if (_namespaceAttributesIndex > 0) { - for (int i = 0; i < _namespaceAttributesIndex; i++) { - _currentElement.setAttributeNode(_namespaceAttributes[i]); - _namespaceAttributes[i] = null; - } - _namespaceAttributesIndex = 0; - } - - if (hasAttributes) { - processAIIs(); - } - - parentCurrentNode.appendChild(_currentElement); - - while(!_terminate) { - _b = read(); - switch(DecoderStateTables.EII(_b)) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b], false); - break; - case DecoderStateTables.EII_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b & EncodingConstants.INTEGER_3RD_BIT_SMALL_MASK], true); - break; - case DecoderStateTables.EII_INDEX_MEDIUM: - processEII(decodeEIIIndexMedium(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - break; - case DecoderStateTables.EII_INDEX_LARGE: - processEII(decodeEIIIndexLarge(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - break; - case DecoderStateTables.EII_LITERAL: - { - final QualifiedName qn = processLiteralQualifiedName( - _b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _elementNameTable.getNext()); - _elementNameTable.add(qn); - processEII(qn, (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - break; - } - case DecoderStateTables.EII_NAMESPACES: - processEIIWithNamespaces(); - break; - case DecoderStateTables.CII_UTF8_SMALL_LENGTH: - { - _octetBufferLength = (_b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK) - + 1; - appendOrCreateTextData(processUtf8CharacterString()); - break; - } - case DecoderStateTables.CII_UTF8_MEDIUM_LENGTH: - { - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT; - appendOrCreateTextData(processUtf8CharacterString()); - break; - } - case DecoderStateTables.CII_UTF8_LARGE_LENGTH: - { - _octetBufferLength = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength += EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - appendOrCreateTextData(processUtf8CharacterString()); - break; - } - case DecoderStateTables.CII_UTF16_SMALL_LENGTH: - { - _octetBufferLength = (_b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK) - + 1; - String v = decodeUtf16StringAsString(); - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - appendOrCreateTextData(v); - break; - } - case DecoderStateTables.CII_UTF16_MEDIUM_LENGTH: - { - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT; - String v = decodeUtf16StringAsString(); - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - appendOrCreateTextData(v); - break; - } - case DecoderStateTables.CII_UTF16_LARGE_LENGTH: - { - _octetBufferLength = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength += EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - String v = decodeUtf16StringAsString(); - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - appendOrCreateTextData(v); - break; - } - case DecoderStateTables.CII_RA: - { - final boolean addToTable = (_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0; - - // Decode resitricted alphabet integer - _identifier = (_b & 0x02) << 6; - _b = read(); - _identifier |= (_b & 0xFC) >> 2; - - decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(_b); - - String v = decodeRestrictedAlphabetAsString(); - if (addToTable) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - appendOrCreateTextData(v); - break; - } - case DecoderStateTables.CII_EA: - { - final boolean addToTable = (_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0; - // Decode encoding algorithm integer - _identifier = (_b & 0x02) << 6; - _b = read(); - _identifier |= (_b & 0xFC) >> 2; - - decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(_b); - final String s = convertEncodingAlgorithmDataToCharacters(false); - if (addToTable) { - _characterContentChunkTable.add(s.toCharArray(), s.length()); - } - appendOrCreateTextData(s); - break; - } - case DecoderStateTables.CII_INDEX_SMALL: - { - final String s = _characterContentChunkTable.getString(_b & EncodingConstants.INTEGER_4TH_BIT_SMALL_MASK); - - appendOrCreateTextData(s); - break; - } - case DecoderStateTables.CII_INDEX_MEDIUM: - { - final int index = (((_b & EncodingConstants.INTEGER_4TH_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_4TH_BIT_SMALL_LIMIT; - final String s = _characterContentChunkTable.getString(index); - - appendOrCreateTextData(s); - break; - } - case DecoderStateTables.CII_INDEX_LARGE: - { - int index = ((_b & EncodingConstants.INTEGER_4TH_BIT_LARGE_MASK) << 16) | - (read() << 8) | - read(); - index += EncodingConstants.INTEGER_4TH_BIT_MEDIUM_LIMIT; - final String s = _characterContentChunkTable.getString(index); - - appendOrCreateTextData(s); - break; - } - case DecoderStateTables.CII_INDEX_LARGE_LARGE: - { - int index = (read() << 16) | - (read() << 8) | - read(); - index += EncodingConstants.INTEGER_4TH_BIT_LARGE_LIMIT; - final String s = _characterContentChunkTable.getString(index); - - appendOrCreateTextData(s); - break; - } - case DecoderStateTables.COMMENT_II: - processCommentII(); - break; - case DecoderStateTables.PROCESSING_INSTRUCTION_II: - processProcessingII(); - break; - case DecoderStateTables.UNEXPANDED_ENTITY_REFERENCE_II: - { - String entity_reference_name = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - - String system_identifier = ((_b & EncodingConstants.UNEXPANDED_ENTITY_SYSTEM_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : null; - String public_identifier = ((_b & EncodingConstants.UNEXPANDED_ENTITY_PUBLIC_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : null; - - // TODO create Node - break; - } - case DecoderStateTables.TERMINATOR_DOUBLE: - _doubleTerminate = true; - case DecoderStateTables.TERMINATOR_SINGLE: - _terminate = true; - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingEII")); - } - } - - _terminate = _doubleTerminate; - _doubleTerminate = false; - - _currentNode = parentCurrentNode; - } - - private void appendOrCreateTextData(String textData) { - Node lastChild = _currentNode.getLastChild(); - if (lastChild instanceof Text) { - ((Text) lastChild).appendData(textData); - } else { - _currentNode.appendChild( - _document.createTextNode(textData)); - } - } - - private final String processUtf8CharacterString() throws FastInfosetException, IOException { - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.ensureSize(_octetBufferLength); - final int charactersOffset = _characterContentChunkTable._arrayIndex; - decodeUtf8StringAsCharBuffer(_characterContentChunkTable._array, charactersOffset); - _characterContentChunkTable.add(_charBufferLength); - return _characterContentChunkTable.getString(_characterContentChunkTable._cachedIndex); - } else { - decodeUtf8StringAsCharBuffer(); - return new String(_charBuffer, 0, _charBufferLength); - } - } - - protected final void processEIIWithNamespaces() throws FastInfosetException, IOException { - final boolean hasAttributes = (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0; - - if (++_prefixTable._declarationId == Integer.MAX_VALUE) { - _prefixTable.clearDeclarationIds(); - } - - String prefix; - Attr a = null; - final int start = _namespacePrefixesIndex; - int b = read(); - while ((b & EncodingConstants.NAMESPACE_ATTRIBUTE_MASK) == EncodingConstants.NAMESPACE_ATTRIBUTE) { - if (_namespaceAttributesIndex == _namespaceAttributes.length) { - final Attr[] newNamespaceAttributes = new Attr[_namespaceAttributesIndex * 3 / 2 + 1]; - System.arraycopy(_namespaceAttributes, 0, newNamespaceAttributes, 0, _namespaceAttributesIndex); - _namespaceAttributes = newNamespaceAttributes; - } - - if (_namespacePrefixesIndex == _namespacePrefixes.length) { - final int[] namespaceAIIs = new int[_namespacePrefixesIndex * 3 / 2 + 1]; - System.arraycopy(_namespacePrefixes, 0, namespaceAIIs, 0, _namespacePrefixesIndex); - _namespacePrefixes = namespaceAIIs; - } - - - switch (b & EncodingConstants.NAMESPACE_ATTRIBUTE_PREFIX_NAME_MASK) { - // no prefix, no namespace - // Undeclaration of default namespace - case 0: - a = createAttribute( - EncodingConstants.XMLNS_NAMESPACE_NAME, - EncodingConstants.XMLNS_NAMESPACE_PREFIX, - EncodingConstants.XMLNS_NAMESPACE_PREFIX); - a.setValue(""); - - _prefixIndex = _namespaceNameIndex = _namespacePrefixes[_namespacePrefixesIndex++] = -1; - break; - // no prefix, namespace - // Declaration of default namespace - case 1: - a = createAttribute( - EncodingConstants.XMLNS_NAMESPACE_NAME, - EncodingConstants.XMLNS_NAMESPACE_PREFIX, - EncodingConstants.XMLNS_NAMESPACE_PREFIX); - a.setValue(decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName(false)); - - _prefixIndex = _namespacePrefixes[_namespacePrefixesIndex++] = -1; - break; - // prefix, no namespace - // Undeclaration of namespace - case 2: - prefix = decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix(false); - a = createAttribute( - EncodingConstants.XMLNS_NAMESPACE_NAME, - createQualifiedNameString(prefix), - prefix); - a.setValue(""); - - _namespaceNameIndex = -1; - _namespacePrefixes[_namespacePrefixesIndex++] = _prefixIndex; - break; - // prefix, namespace - // Declaration of prefixed namespace - case 3: - prefix = decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix(true); - a = createAttribute( - EncodingConstants.XMLNS_NAMESPACE_NAME, - createQualifiedNameString(prefix), - prefix); - a.setValue(decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName(true)); - - _namespacePrefixes[_namespacePrefixesIndex++] = _prefixIndex; - break; - } - - _prefixTable.pushScope(_prefixIndex, _namespaceNameIndex); - - _namespaceAttributes[_namespaceAttributesIndex++] = a; - - b = read(); - } - if (b != EncodingConstants.TERMINATOR) { - throw new IOException(CommonResourceBundle.getInstance().getString("message.EIInamespaceNameNotTerminatedCorrectly")); - } - final int end = _namespacePrefixesIndex; - - _b = read(); - switch(DecoderStateTables.EII(_b)) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b], hasAttributes); - break; - case DecoderStateTables.EII_INDEX_MEDIUM: - processEII(decodeEIIIndexMedium(), hasAttributes); - break; - case DecoderStateTables.EII_INDEX_LARGE: - processEII(decodeEIIIndexLarge(), hasAttributes); - break; - case DecoderStateTables.EII_LITERAL: - { - final QualifiedName qn = processLiteralQualifiedName( - _b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _elementNameTable.getNext()); - _elementNameTable.add(qn); - processEII(qn, hasAttributes); - break; - } - default: - throw new IOException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingEIIAfterAIIs")); - } - - for (int i = start; i < end; i++) { - _prefixTable.popScope(_namespacePrefixes[i]); - } - _namespacePrefixesIndex = start; - - } - - protected final QualifiedName processLiteralQualifiedName(int state, QualifiedName q) - throws FastInfosetException, IOException { - if (q == null) q = new QualifiedName(); - - switch (state) { - // no prefix, no namespace - case 0: - return q.set( - null, - null, - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - -1, - -1, - _identifier, - null); - // no prefix, namespace - case 1: - return q.set( - null, - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(false), - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - -1, - _namespaceNameIndex, - _identifier, - null); - // prefix, no namespace - case 2: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.qNameMissingNamespaceName")); - // prefix, namespace - case 3: - return q.set( - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix(true), - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(true), - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - _prefixIndex, - _namespaceNameIndex, - _identifier, - _charBuffer); - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingEII")); - } - } - - protected final QualifiedName processLiteralQualifiedName(int state) - throws FastInfosetException, IOException { - switch (state) { - // no prefix, no namespace - case 0: - return new QualifiedName( - null, - null, - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - -1, - -1, - _identifier, - null); - // no prefix, namespace - case 1: - return new QualifiedName( - null, - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(false), - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - -1, - _namespaceNameIndex, - _identifier, - null); - // prefix, no namespace - case 2: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.qNameMissingNamespaceName")); - // prefix, namespace - case 3: - return new QualifiedName( - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix(true), - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(true), - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - _prefixIndex, - _namespaceNameIndex, - _identifier, - _charBuffer); - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingEII")); - } - } - - protected final void processAIIs() throws FastInfosetException, IOException { - QualifiedName name; - int b; - String value; - - if (++_duplicateAttributeVerifier._currentIteration == Integer.MAX_VALUE) { - _duplicateAttributeVerifier.clear(); - } - - do { - // AII qualified name - b = read(); - switch (DecoderStateTables.AII(b)) { - case DecoderStateTables.AII_INDEX_SMALL: - name = _attributeNameTable._array[b]; - break; - case DecoderStateTables.AII_INDEX_MEDIUM: - { - final int i = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - name = _attributeNameTable._array[i]; - break; - } - case DecoderStateTables.AII_INDEX_LARGE: - { - final int i = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - name = _attributeNameTable._array[i]; - break; - } - case DecoderStateTables.AII_LITERAL: - name = processLiteralQualifiedName( - b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _attributeNameTable.getNext()); - name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE); - _attributeNameTable.add(name); - break; - case DecoderStateTables.AII_TERMINATOR_DOUBLE: - _doubleTerminate = true; - case DecoderStateTables.AII_TERMINATOR_SINGLE: - _terminate = true; - // AIIs have finished break out of loop - continue; - default: - throw new IOException(CommonResourceBundle.getInstance().getString("message.decodingAIIs")); - } - - if (name.prefixIndex > 0 && _prefixTable._currentInScope[name.prefixIndex] != name.namespaceNameIndex) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.AIIqNameNotInScope")); - } - - _duplicateAttributeVerifier.checkForDuplicateAttribute(name.attributeHash, name.attributeId); - - Attr a = createAttribute( - name.namespaceName, - name.qName, - name.localName); - - // [normalized value] of AII - - b = read(); - switch(DecoderStateTables.NISTRING(b)) { - case DecoderStateTables.NISTRING_UTF8_SMALL_LENGTH: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_MASK) + 1; - value = decodeUtf8StringAsString(); - if (addToTable) { - _attributeValueTable.add(value); - } - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_UTF8_MEDIUM_LENGTH: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT; - value = decodeUtf8StringAsString(); - if (addToTable) { - _attributeValueTable.add(value); - } - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_UTF8_LARGE_LENGTH: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - final int length = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength = length + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - value = decodeUtf8StringAsString(); - if (addToTable) { - _attributeValueTable.add(value); - } - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_UTF16_SMALL_LENGTH: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_MASK) + 1; - value = decodeUtf16StringAsString(); - if (addToTable) { - _attributeValueTable.add(value); - } - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_UTF16_MEDIUM_LENGTH: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT; - value = decodeUtf16StringAsString(); - if (addToTable) { - _attributeValueTable.add(value); - } - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_UTF16_LARGE_LENGTH: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - final int length = (read() << 24) | - (read() << 16) | - (read() << 8) | - read(); - _octetBufferLength = length + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - value = decodeUtf16StringAsString(); - if (addToTable) { - _attributeValueTable.add(value); - } - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_RA: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - // Decode resitricted alphabet integer - _identifier = (b & 0x0F) << 4; - b = read(); - _identifier |= (b & 0xF0) >> 4; - - decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(b); - - value = decodeRestrictedAlphabetAsString(); - if (addToTable) { - _attributeValueTable.add(value); - } - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_EA: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - _identifier = (b & 0x0F) << 4; - b = read(); - _identifier |= (b & 0xF0) >> 4; - - decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(b); - value = convertEncodingAlgorithmDataToCharacters(true); - if (addToTable) { - _attributeValueTable.add(value); - } - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_INDEX_SMALL: - value = _attributeValueTable._array[b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK]; - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - case DecoderStateTables.NISTRING_INDEX_MEDIUM: - { - final int index = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - value = _attributeValueTable._array[index]; - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_INDEX_LARGE: - { - final int index = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - value = _attributeValueTable._array[index]; - - a.setValue(value); - _currentElement.setAttributeNode(a); - break; - } - case DecoderStateTables.NISTRING_EMPTY: - a.setValue(""); - _currentElement.setAttributeNode(a); - break; - default: - throw new IOException(CommonResourceBundle.getInstance().getString("message.decodingAIIValue")); - } - - } while (!_terminate); - - // Reset duplication attribute verfifier - _duplicateAttributeVerifier._poolCurrent = _duplicateAttributeVerifier._poolHead; - - _terminate = _doubleTerminate; - _doubleTerminate = false; - } - - protected final void processCommentII() throws FastInfosetException, IOException { - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - { - final String s = new String(_charBuffer, 0, _charBufferLength); - if (_addToTable) { - _v.otherString.add(new CharArrayString(s, false)); - } - - _currentNode.appendChild(_document.createComment(s)); - break; - } - case NISTRING_ENCODING_ALGORITHM: - throw new IOException(CommonResourceBundle.getInstance().getString("message.commentIIAlgorithmNotSupported")); - case NISTRING_INDEX: - { - final String s = _v.otherString.get(_integer).toString(); - - _currentNode.appendChild(_document.createComment(s)); - break; - } - case NISTRING_EMPTY_STRING: - _currentNode.appendChild(_document.createComment("")); - break; - } - } - - protected final void processProcessingII() throws FastInfosetException, IOException { - final String target = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - { - final String data = new String(_charBuffer, 0, _charBufferLength); - if (_addToTable) { - _v.otherString.add(new CharArrayString(data, false)); - } - - _currentNode.appendChild(_document.createProcessingInstruction(target, data)); - break; - } - case NISTRING_ENCODING_ALGORITHM: - throw new IOException(CommonResourceBundle.getInstance().getString("message.processingIIWithEncodingAlgorithm")); - case NISTRING_INDEX: - { - final String data = _v.otherString.get(_integer).toString(); - - _currentNode.appendChild(_document.createProcessingInstruction(target, data)); - break; - } - case NISTRING_EMPTY_STRING: - _currentNode.appendChild(_document.createProcessingInstruction(target, "")); - break; - } - } - - protected Element createElement(String namespaceName, String qName, String localName) { - return _document.createElementNS(namespaceName, qName); - } - - protected Attr createAttribute(String namespaceName, String qName, String localName) { - return _document.createAttributeNS(namespaceName, qName); - } - - protected String convertEncodingAlgorithmDataToCharacters(boolean isAttributeValue) throws FastInfosetException, IOException { - StringBuffer buffer = new StringBuffer(); - if (_identifier < EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - Object array = BuiltInEncodingAlgorithmFactory.getAlgorithm(_identifier). - decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength); - BuiltInEncodingAlgorithmFactory.getAlgorithm(_identifier).convertToCharacters(array, buffer); - } else if (_identifier == EncodingAlgorithmIndexes.CDATA) { - if (!isAttributeValue) { - // Set back buffer position to start of encoded string - _octetBufferOffset -= _octetBufferLength; - return decodeUtf8StringAsString(); - } - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.CDATAAlgorithmNotSupported")); - } else if (_identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - final String URI = _v.encodingAlgorithm.get(_identifier - EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START); - final EncodingAlgorithm ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI); - if (ea != null) { - final Object data = ea.decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength); - ea.convertToCharacters(data, buffer); - } else { - throw new EncodingAlgorithmException( - CommonResourceBundle.getInstance().getString("message.algorithmDataCannotBeReported")); - } - } - return buffer.toString(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/dom/DOMDocumentSerializer.java 2018-01-30 20:36:51.000000000 -0500 +++ /dev/null 2018-01-30 20:36:51.000000000 -0500 @@ -1,353 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.dom; - -import com.sun.xml.internal.fastinfoset.Encoder; -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.util.NamespaceContextImplementation; -import com.sun.xml.internal.fastinfoset.util.LocalNameQualifiedNamesMap; -import java.io.IOException; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * The Fast Infoset DOM serializer. - *

- * Instantiate this serializer to serialize a fast infoset document in accordance - * with the DOM API. - * - */ -public class DOMDocumentSerializer extends Encoder { - - /** - * Serialize a {@link Node}. - * - * @param n the node to serialize. - */ - public final void serialize(Node n) throws IOException { - switch (n.getNodeType()) { - case Node.DOCUMENT_NODE: - serialize((Document)n); - break; - case Node.ELEMENT_NODE: - serializeElementAsDocument(n); - break; - case Node.COMMENT_NODE: - serializeComment(n); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - serializeProcessingInstruction(n); - break; - } - } - - /** - * Serialize a {@link Document}. - * - * @param d the document to serialize. - */ - public final void serialize(Document d) throws IOException { - reset(); - encodeHeader(false); - encodeInitialVocabulary(); - - final NodeList nl = d.getChildNodes(); - for (int i = 0; i < nl.getLength(); i++) { - final Node n = nl.item(i); - switch (n.getNodeType()) { - case Node.ELEMENT_NODE: - serializeElement(n); - break; - case Node.COMMENT_NODE: - serializeComment(n); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - serializeProcessingInstruction(n); - break; - } - } - encodeDocumentTermination(); - } - - protected final void serializeElementAsDocument(Node e) throws IOException { - reset(); - encodeHeader(false); - encodeInitialVocabulary(); - - serializeElement(e); - - encodeDocumentTermination(); - } - -// protected Node[] _namespaceAttributes = new Node[4]; - - // map which will hold all current scope prefixes and associated attributes - // Collection of populated namespace available for current scope - protected NamespaceContextImplementation _namespaceScopeContext = new NamespaceContextImplementation(); - protected Node[] _attributes = new Node[32]; - - protected final void serializeElement(Node e) throws IOException { - encodeTermination(); - - int attributesSize = 0; - - _namespaceScopeContext.pushContext(); - - if (e.hasAttributes()) { - /* - * Split the attribute nodes into namespace attributes - * or normal attributes. - */ - final NamedNodeMap nnm = e.getAttributes(); - for (int i = 0; i < nnm.getLength(); i++) { - final Node a = nnm.item(i); - final String namespaceURI = a.getNamespaceURI(); - if (namespaceURI != null && namespaceURI.equals("http://www.w3.org/2000/xmlns/")) { - String attrPrefix = a.getLocalName(); - String attrNamespace = a.getNodeValue(); - if (attrPrefix == "xmlns" || attrPrefix.equals("xmlns")) { - attrPrefix = ""; - } - _namespaceScopeContext.declarePrefix(attrPrefix, attrNamespace); - } else { - if (attributesSize == _attributes.length) { - final Node[] attributes = new Node[attributesSize * 3 / 2 + 1]; - System.arraycopy(_attributes, 0, attributes, 0, attributesSize); - _attributes = attributes; - } - _attributes[attributesSize++] = a; - - String attrNamespaceURI = a.getNamespaceURI(); - String attrPrefix = a.getPrefix(); - if (attrPrefix != null && !_namespaceScopeContext.getNamespaceURI(attrPrefix).equals(attrNamespaceURI)) { - _namespaceScopeContext.declarePrefix(attrPrefix, attrNamespaceURI); - } - } - } - } - - String elementNamespaceURI = e.getNamespaceURI(); - String elementPrefix = e.getPrefix(); - if (elementPrefix == null) elementPrefix = ""; - if (elementNamespaceURI != null && - !_namespaceScopeContext.getNamespaceURI(elementPrefix).equals(elementNamespaceURI)) { - _namespaceScopeContext.declarePrefix(elementPrefix, elementNamespaceURI); - } - - if (!_namespaceScopeContext.isCurrentContextEmpty()) { - if (attributesSize > 0) { - write(EncodingConstants.ELEMENT | EncodingConstants.ELEMENT_NAMESPACES_FLAG | - EncodingConstants.ELEMENT_ATTRIBUTE_FLAG); - } else { - write(EncodingConstants.ELEMENT | EncodingConstants.ELEMENT_NAMESPACES_FLAG); - } - - for (int i = _namespaceScopeContext.getCurrentContextStartIndex(); - i < _namespaceScopeContext.getCurrentContextEndIndex(); i++) { - - String prefix = _namespaceScopeContext.getPrefix(i); - String uri = _namespaceScopeContext.getNamespaceURI(i); - encodeNamespaceAttribute(prefix, uri); - } - write(EncodingConstants.TERMINATOR); - _b = 0; - } else { - _b = (attributesSize > 0) ? EncodingConstants.ELEMENT | EncodingConstants.ELEMENT_ATTRIBUTE_FLAG : - EncodingConstants.ELEMENT; - } - - String namespaceURI = elementNamespaceURI; -// namespaceURI = (namespaceURI == null) ? _namespaceScopeContext.getNamespaceURI("") : namespaceURI; - namespaceURI = (namespaceURI == null) ? "" : namespaceURI; - encodeElement(namespaceURI, e.getNodeName(), e.getLocalName()); - - if (attributesSize > 0) { - // Serialize the attributes - for (int i = 0; i < attributesSize; i++) { - final Node a = _attributes[i]; - _attributes[i] = null; - namespaceURI = a.getNamespaceURI(); - namespaceURI = (namespaceURI == null) ? "" : namespaceURI; - encodeAttribute(namespaceURI, a.getNodeName(), a.getLocalName()); - - final String value = a.getNodeValue(); - final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length()); - encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false); - } - - _b = EncodingConstants.TERMINATOR; - _terminate = true; - } - - if (e.hasChildNodes()) { - // Serialize the children - final NodeList nl = e.getChildNodes(); - for (int i = 0; i < nl.getLength(); i++) { - final Node n = nl.item(i); - switch (n.getNodeType()) { - case Node.ELEMENT_NODE: - serializeElement(n); - break; - case Node.TEXT_NODE: - serializeText(n); - break; - case Node.CDATA_SECTION_NODE: - serializeCDATA(n); - break; - case Node.COMMENT_NODE: - serializeComment(n); - break; - case Node.PROCESSING_INSTRUCTION_NODE: - serializeProcessingInstruction(n); - break; - } - } - } - encodeElementTermination(); - _namespaceScopeContext.popContext(); - } - - - protected final void serializeText(Node t) throws IOException { - final String text = t.getNodeValue(); - - final int length = (text != null) ? text.length() : 0; - if (length == 0) { - return; - } else if (length < _charBuffer.length) { - text.getChars(0, length, _charBuffer, 0); - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(_charBuffer, 0, length)) return; - - encodeTermination(); - encodeCharacters(_charBuffer, 0, length); - } else { - final char ch[] = text.toCharArray(); - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(ch, 0, length)) return; - - encodeTermination(); - encodeCharactersNoClone(ch, 0, length); - } - } - - protected final void serializeCDATA(Node t) throws IOException { - final String text = t.getNodeValue(); - - final int length = (text != null) ? text.length() : 0; - if (length == 0) { - return; - } else { - final char ch[] = text.toCharArray(); - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(ch, 0, length)) return; - - encodeTermination(); - try { - encodeCIIBuiltInAlgorithmDataAsCDATA(ch, 0, length); - } catch (FastInfosetException e) { - throw new IOException(""); - } - } - } - - protected final void serializeComment(Node c) throws IOException { - if (getIgnoreComments()) return; - - encodeTermination(); - - final String comment = c.getNodeValue(); - - final int length = (comment != null) ? comment.length() : 0; - if (length == 0) { - encodeComment(_charBuffer, 0, 0); - } else if (length < _charBuffer.length) { - comment.getChars(0, length, _charBuffer, 0); - encodeComment(_charBuffer, 0, length); - } else { - final char ch[] = comment.toCharArray(); - encodeCommentNoClone(ch, 0, length); - } - } - - protected final void serializeProcessingInstruction(Node pi) throws IOException { - if (getIgnoreProcesingInstructions()) return; - - encodeTermination(); - - final String target = pi.getNodeName(); - final String data = pi.getNodeValue(); - encodeProcessingInstruction(target, data); - } - - protected final void encodeElement(String namespaceURI, String qName, String localName) throws IOException { - LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(qName); - if (entry._valueIndex > 0) { - final QualifiedName[] names = entry._value; - for (int i = 0; i < entry._valueIndex; i++) { - if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) { - encodeNonZeroIntegerOnThirdBit(names[i].index); - return; - } - } - } - - // Was DOM node created using an NS-aware call? - if (localName != null) { - encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefixFromQualifiedName(qName), - localName, entry); - } else { - encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, "", qName, entry); - } - } - - protected final void encodeAttribute(String namespaceURI, String qName, String localName) throws IOException { - LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(qName); - if (entry._valueIndex > 0) { - final QualifiedName[] names = entry._value; - for (int i = 0; i < entry._valueIndex; i++) { - if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) { - encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index); - return; - } - } - } - - // Was DOM node created using an NS-aware call? - if (localName != null) { - encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefixFromQualifiedName(qName), - localName, entry); - } else { - encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, "", qName, entry); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/org/apache/xerces/util/XMLChar.java 2018-01-30 20:36:51.000000000 -0500 +++ /dev/null 2018-01-30 20:36:52.000000000 -0500 @@ -1,1094 +0,0 @@ -/* - * reserved comment block - * DO NOT REMOVE OR ALTER! - */ - /* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -/* - * The Apache Software License, Version 1.1 - * - * - * Copyright (c) 1999-2004 The Apache Software Foundation. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * 3. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Xerces" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation and was - * originally based on software copyright (c) 1999, International - * Business Machines, Inc., http://www.apache.org. For more - * information on the Apache Software Foundation, please see - * . - */ - -package com.sun.xml.internal.fastinfoset.org.apache.xerces.util; - -import java.util.Arrays; - -/** - * This class defines the basic XML character properties. The data - * in this class can be used to verify that a character is a valid - * XML character or if the character is a space, name start, or name - * character. - *

- * A series of convenience methods are supplied to ease the burden - * of the developer. Because inlining the checks can improve per - * character performance, the tables of character properties are - * public. Using the character as an index into the CHARS - * array and applying the appropriate mask flag (e.g. - * MASK_VALID), yields the same results as calling the - * convenience methods. There is one exception: check the comments - * for the isValid method for details. - * - * @author Glenn Marcy, IBM - * @author Andy Clark, IBM - * @author Eric Ye, IBM - * @author Arnaud Le Hors, IBM - * @author Michael Glavassevich, IBM - * @author Rahul Srivastava, Sun Microsystems Inc. - * - * @version $Id: XMLChar.java,v 1.2 2006-03-16 16:22:16 sandoz Exp $ - */ -public class XMLChar { - - // - // Constants - // - - /** Character flags. */ - private static final byte[] CHARS = new byte[1 << 16]; - - /** Valid character mask. */ - public static final int MASK_VALID = 0x01; - - /** Space character mask. */ - public static final int MASK_SPACE = 0x02; - - /** Name start character mask. */ - public static final int MASK_NAME_START = 0x04; - - /** Name character mask. */ - public static final int MASK_NAME = 0x08; - - /** Pubid character mask. */ - public static final int MASK_PUBID = 0x10; - - /** - * Content character mask. Special characters are those that can - * be considered the start of markup, such as '<' and '&'. - * The various newline characters are considered special as well. - * All other valid XML characters can be considered content. - *

- * This is an optimization for the inner loop of character scanning. - */ - public static final int MASK_CONTENT = 0x20; - - /** NCName start character mask. */ - public static final int MASK_NCNAME_START = 0x40; - - /** NCName character mask. */ - public static final int MASK_NCNAME = 0x80; - - // - // Static initialization - // - - static { - - // Initializing the Character Flag Array - // Code generated by: XMLCharGenerator. - - CHARS[9] = 35; - CHARS[10] = 19; - CHARS[13] = 19; - CHARS[32] = 51; - CHARS[33] = 49; - CHARS[34] = 33; - Arrays.fill(CHARS, 35, 38, (byte) 49 ); // Fill 3 of value (byte) 49 - CHARS[38] = 1; - Arrays.fill(CHARS, 39, 45, (byte) 49 ); // Fill 6 of value (byte) 49 - Arrays.fill(CHARS, 45, 47, (byte) -71 ); // Fill 2 of value (byte) -71 - CHARS[47] = 49; - Arrays.fill(CHARS, 48, 58, (byte) -71 ); // Fill 10 of value (byte) -71 - CHARS[58] = 61; - CHARS[59] = 49; - CHARS[60] = 1; - CHARS[61] = 49; - CHARS[62] = 33; - Arrays.fill(CHARS, 63, 65, (byte) 49 ); // Fill 2 of value (byte) 49 - Arrays.fill(CHARS, 65, 91, (byte) -3 ); // Fill 26 of value (byte) -3 - Arrays.fill(CHARS, 91, 93, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[93] = 1; - CHARS[94] = 33; - CHARS[95] = -3; - CHARS[96] = 33; - Arrays.fill(CHARS, 97, 123, (byte) -3 ); // Fill 26 of value (byte) -3 - Arrays.fill(CHARS, 123, 183, (byte) 33 ); // Fill 60 of value (byte) 33 - CHARS[183] = -87; - Arrays.fill(CHARS, 184, 192, (byte) 33 ); // Fill 8 of value (byte) 33 - Arrays.fill(CHARS, 192, 215, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[215] = 33; - Arrays.fill(CHARS, 216, 247, (byte) -19 ); // Fill 31 of value (byte) -19 - CHARS[247] = 33; - Arrays.fill(CHARS, 248, 306, (byte) -19 ); // Fill 58 of value (byte) -19 - Arrays.fill(CHARS, 306, 308, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 308, 319, (byte) -19 ); // Fill 11 of value (byte) -19 - Arrays.fill(CHARS, 319, 321, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 321, 329, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[329] = 33; - Arrays.fill(CHARS, 330, 383, (byte) -19 ); // Fill 53 of value (byte) -19 - CHARS[383] = 33; - Arrays.fill(CHARS, 384, 452, (byte) -19 ); // Fill 68 of value (byte) -19 - Arrays.fill(CHARS, 452, 461, (byte) 33 ); // Fill 9 of value (byte) 33 - Arrays.fill(CHARS, 461, 497, (byte) -19 ); // Fill 36 of value (byte) -19 - Arrays.fill(CHARS, 497, 500, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 500, 502, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 502, 506, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 506, 536, (byte) -19 ); // Fill 30 of value (byte) -19 - Arrays.fill(CHARS, 536, 592, (byte) 33 ); // Fill 56 of value (byte) 33 - Arrays.fill(CHARS, 592, 681, (byte) -19 ); // Fill 89 of value (byte) -19 - Arrays.fill(CHARS, 681, 699, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 699, 706, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 706, 720, (byte) 33 ); // Fill 14 of value (byte) 33 - Arrays.fill(CHARS, 720, 722, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 722, 768, (byte) 33 ); // Fill 46 of value (byte) 33 - Arrays.fill(CHARS, 768, 838, (byte) -87 ); // Fill 70 of value (byte) -87 - Arrays.fill(CHARS, 838, 864, (byte) 33 ); // Fill 26 of value (byte) 33 - Arrays.fill(CHARS, 864, 866, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 866, 902, (byte) 33 ); // Fill 36 of value (byte) 33 - CHARS[902] = -19; - CHARS[903] = -87; - Arrays.fill(CHARS, 904, 907, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[907] = 33; - CHARS[908] = -19; - CHARS[909] = 33; - Arrays.fill(CHARS, 910, 930, (byte) -19 ); // Fill 20 of value (byte) -19 - CHARS[930] = 33; - Arrays.fill(CHARS, 931, 975, (byte) -19 ); // Fill 44 of value (byte) -19 - CHARS[975] = 33; - Arrays.fill(CHARS, 976, 983, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 983, 986, (byte) 33 ); // Fill 3 of value (byte) 33 - CHARS[986] = -19; - CHARS[987] = 33; - CHARS[988] = -19; - CHARS[989] = 33; - CHARS[990] = -19; - CHARS[991] = 33; - CHARS[992] = -19; - CHARS[993] = 33; - Arrays.fill(CHARS, 994, 1012, (byte) -19 ); // Fill 18 of value (byte) -19 - Arrays.fill(CHARS, 1012, 1025, (byte) 33 ); // Fill 13 of value (byte) 33 - Arrays.fill(CHARS, 1025, 1037, (byte) -19 ); // Fill 12 of value (byte) -19 - CHARS[1037] = 33; - Arrays.fill(CHARS, 1038, 1104, (byte) -19 ); // Fill 66 of value (byte) -19 - CHARS[1104] = 33; - Arrays.fill(CHARS, 1105, 1117, (byte) -19 ); // Fill 12 of value (byte) -19 - CHARS[1117] = 33; - Arrays.fill(CHARS, 1118, 1154, (byte) -19 ); // Fill 36 of value (byte) -19 - CHARS[1154] = 33; - Arrays.fill(CHARS, 1155, 1159, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 1159, 1168, (byte) 33 ); // Fill 9 of value (byte) 33 - Arrays.fill(CHARS, 1168, 1221, (byte) -19 ); // Fill 53 of value (byte) -19 - Arrays.fill(CHARS, 1221, 1223, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1223, 1225, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1225, 1227, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1227, 1229, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1229, 1232, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 1232, 1260, (byte) -19 ); // Fill 28 of value (byte) -19 - Arrays.fill(CHARS, 1260, 1262, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1262, 1270, (byte) -19 ); // Fill 8 of value (byte) -19 - Arrays.fill(CHARS, 1270, 1272, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1272, 1274, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1274, 1329, (byte) 33 ); // Fill 55 of value (byte) 33 - Arrays.fill(CHARS, 1329, 1367, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 1367, 1369, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[1369] = -19; - Arrays.fill(CHARS, 1370, 1377, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 1377, 1415, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 1415, 1425, (byte) 33 ); // Fill 10 of value (byte) 33 - Arrays.fill(CHARS, 1425, 1442, (byte) -87 ); // Fill 17 of value (byte) -87 - CHARS[1442] = 33; - Arrays.fill(CHARS, 1443, 1466, (byte) -87 ); // Fill 23 of value (byte) -87 - CHARS[1466] = 33; - Arrays.fill(CHARS, 1467, 1470, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[1470] = 33; - CHARS[1471] = -87; - CHARS[1472] = 33; - Arrays.fill(CHARS, 1473, 1475, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[1475] = 33; - CHARS[1476] = -87; - Arrays.fill(CHARS, 1477, 1488, (byte) 33 ); // Fill 11 of value (byte) 33 - Arrays.fill(CHARS, 1488, 1515, (byte) -19 ); // Fill 27 of value (byte) -19 - Arrays.fill(CHARS, 1515, 1520, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 1520, 1523, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 1523, 1569, (byte) 33 ); // Fill 46 of value (byte) 33 - Arrays.fill(CHARS, 1569, 1595, (byte) -19 ); // Fill 26 of value (byte) -19 - Arrays.fill(CHARS, 1595, 1600, (byte) 33 ); // Fill 5 of value (byte) 33 - CHARS[1600] = -87; - Arrays.fill(CHARS, 1601, 1611, (byte) -19 ); // Fill 10 of value (byte) -19 - Arrays.fill(CHARS, 1611, 1619, (byte) -87 ); // Fill 8 of value (byte) -87 - Arrays.fill(CHARS, 1619, 1632, (byte) 33 ); // Fill 13 of value (byte) 33 - Arrays.fill(CHARS, 1632, 1642, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 1642, 1648, (byte) 33 ); // Fill 6 of value (byte) 33 - CHARS[1648] = -87; - Arrays.fill(CHARS, 1649, 1720, (byte) -19 ); // Fill 71 of value (byte) -19 - Arrays.fill(CHARS, 1720, 1722, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1722, 1727, (byte) -19 ); // Fill 5 of value (byte) -19 - CHARS[1727] = 33; - Arrays.fill(CHARS, 1728, 1743, (byte) -19 ); // Fill 15 of value (byte) -19 - CHARS[1743] = 33; - Arrays.fill(CHARS, 1744, 1748, (byte) -19 ); // Fill 4 of value (byte) -19 - CHARS[1748] = 33; - CHARS[1749] = -19; - Arrays.fill(CHARS, 1750, 1765, (byte) -87 ); // Fill 15 of value (byte) -87 - Arrays.fill(CHARS, 1765, 1767, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 1767, 1769, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[1769] = 33; - Arrays.fill(CHARS, 1770, 1774, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 1774, 1776, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 1776, 1786, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 1786, 2305, (byte) 33 ); // Fill 519 of value (byte) 33 - Arrays.fill(CHARS, 2305, 2308, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2308] = 33; - Arrays.fill(CHARS, 2309, 2362, (byte) -19 ); // Fill 53 of value (byte) -19 - Arrays.fill(CHARS, 2362, 2364, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2364] = -87; - CHARS[2365] = -19; - Arrays.fill(CHARS, 2366, 2382, (byte) -87 ); // Fill 16 of value (byte) -87 - Arrays.fill(CHARS, 2382, 2385, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2385, 2389, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 2389, 2392, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2392, 2402, (byte) -19 ); // Fill 10 of value (byte) -19 - Arrays.fill(CHARS, 2402, 2404, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2404, 2406, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2406, 2416, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2416, 2433, (byte) 33 ); // Fill 17 of value (byte) 33 - Arrays.fill(CHARS, 2433, 2436, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2436] = 33; - Arrays.fill(CHARS, 2437, 2445, (byte) -19 ); // Fill 8 of value (byte) -19 - Arrays.fill(CHARS, 2445, 2447, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2447, 2449, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2449, 2451, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2451, 2473, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2473] = 33; - Arrays.fill(CHARS, 2474, 2481, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2481] = 33; - CHARS[2482] = -19; - Arrays.fill(CHARS, 2483, 2486, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2486, 2490, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 2490, 2492, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2492] = -87; - CHARS[2493] = 33; - Arrays.fill(CHARS, 2494, 2501, (byte) -87 ); // Fill 7 of value (byte) -87 - Arrays.fill(CHARS, 2501, 2503, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2503, 2505, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2505, 2507, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2507, 2510, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2510, 2519, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[2519] = -87; - Arrays.fill(CHARS, 2520, 2524, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2524, 2526, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2526] = 33; - Arrays.fill(CHARS, 2527, 2530, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2530, 2532, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2532, 2534, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2534, 2544, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2544, 2546, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2546, 2562, (byte) 33 ); // Fill 16 of value (byte) 33 - CHARS[2562] = -87; - Arrays.fill(CHARS, 2563, 2565, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2565, 2571, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 2571, 2575, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2575, 2577, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2577, 2579, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2579, 2601, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2601] = 33; - Arrays.fill(CHARS, 2602, 2609, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2609] = 33; - Arrays.fill(CHARS, 2610, 2612, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2612] = 33; - Arrays.fill(CHARS, 2613, 2615, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2615] = 33; - Arrays.fill(CHARS, 2616, 2618, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2618, 2620, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2620] = -87; - CHARS[2621] = 33; - Arrays.fill(CHARS, 2622, 2627, (byte) -87 ); // Fill 5 of value (byte) -87 - Arrays.fill(CHARS, 2627, 2631, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2631, 2633, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2633, 2635, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2635, 2638, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2638, 2649, (byte) 33 ); // Fill 11 of value (byte) 33 - Arrays.fill(CHARS, 2649, 2653, (byte) -19 ); // Fill 4 of value (byte) -19 - CHARS[2653] = 33; - CHARS[2654] = -19; - Arrays.fill(CHARS, 2655, 2662, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 2662, 2674, (byte) -87 ); // Fill 12 of value (byte) -87 - Arrays.fill(CHARS, 2674, 2677, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2677, 2689, (byte) 33 ); // Fill 12 of value (byte) 33 - Arrays.fill(CHARS, 2689, 2692, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2692] = 33; - Arrays.fill(CHARS, 2693, 2700, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2700] = 33; - CHARS[2701] = -19; - CHARS[2702] = 33; - Arrays.fill(CHARS, 2703, 2706, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[2706] = 33; - Arrays.fill(CHARS, 2707, 2729, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2729] = 33; - Arrays.fill(CHARS, 2730, 2737, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2737] = 33; - Arrays.fill(CHARS, 2738, 2740, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2740] = 33; - Arrays.fill(CHARS, 2741, 2746, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 2746, 2748, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2748] = -87; - CHARS[2749] = -19; - Arrays.fill(CHARS, 2750, 2758, (byte) -87 ); // Fill 8 of value (byte) -87 - CHARS[2758] = 33; - Arrays.fill(CHARS, 2759, 2762, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2762] = 33; - Arrays.fill(CHARS, 2763, 2766, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2766, 2784, (byte) 33 ); // Fill 18 of value (byte) 33 - CHARS[2784] = -19; - Arrays.fill(CHARS, 2785, 2790, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 2790, 2800, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2800, 2817, (byte) 33 ); // Fill 17 of value (byte) 33 - Arrays.fill(CHARS, 2817, 2820, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[2820] = 33; - Arrays.fill(CHARS, 2821, 2829, (byte) -19 ); // Fill 8 of value (byte) -19 - Arrays.fill(CHARS, 2829, 2831, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2831, 2833, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2833, 2835, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2835, 2857, (byte) -19 ); // Fill 22 of value (byte) -19 - CHARS[2857] = 33; - Arrays.fill(CHARS, 2858, 2865, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[2865] = 33; - Arrays.fill(CHARS, 2866, 2868, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2868, 2870, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2870, 2874, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 2874, 2876, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[2876] = -87; - CHARS[2877] = -19; - Arrays.fill(CHARS, 2878, 2884, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 2884, 2887, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2887, 2889, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2889, 2891, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 2891, 2894, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 2894, 2902, (byte) 33 ); // Fill 8 of value (byte) 33 - Arrays.fill(CHARS, 2902, 2904, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 2904, 2908, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2908, 2910, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2910] = 33; - Arrays.fill(CHARS, 2911, 2914, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2914, 2918, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 2918, 2928, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 2928, 2946, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 2946, 2948, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[2948] = 33; - Arrays.fill(CHARS, 2949, 2955, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 2955, 2958, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2958, 2961, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[2961] = 33; - Arrays.fill(CHARS, 2962, 2966, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 2966, 2969, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2969, 2971, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[2971] = 33; - CHARS[2972] = -19; - CHARS[2973] = 33; - Arrays.fill(CHARS, 2974, 2976, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2976, 2979, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2979, 2981, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 2981, 2984, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2984, 2987, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 2987, 2990, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 2990, 2998, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[2998] = 33; - Arrays.fill(CHARS, 2999, 3002, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 3002, 3006, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3006, 3011, (byte) -87 ); // Fill 5 of value (byte) -87 - Arrays.fill(CHARS, 3011, 3014, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 3014, 3017, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3017] = 33; - Arrays.fill(CHARS, 3018, 3022, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3022, 3031, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[3031] = -87; - Arrays.fill(CHARS, 3032, 3047, (byte) 33 ); // Fill 15 of value (byte) 33 - Arrays.fill(CHARS, 3047, 3056, (byte) -87 ); // Fill 9 of value (byte) -87 - Arrays.fill(CHARS, 3056, 3073, (byte) 33 ); // Fill 17 of value (byte) 33 - Arrays.fill(CHARS, 3073, 3076, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3076] = 33; - Arrays.fill(CHARS, 3077, 3085, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3085] = 33; - Arrays.fill(CHARS, 3086, 3089, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3089] = 33; - Arrays.fill(CHARS, 3090, 3113, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[3113] = 33; - Arrays.fill(CHARS, 3114, 3124, (byte) -19 ); // Fill 10 of value (byte) -19 - CHARS[3124] = 33; - Arrays.fill(CHARS, 3125, 3130, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 3130, 3134, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3134, 3141, (byte) -87 ); // Fill 7 of value (byte) -87 - CHARS[3141] = 33; - Arrays.fill(CHARS, 3142, 3145, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3145] = 33; - Arrays.fill(CHARS, 3146, 3150, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3150, 3157, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 3157, 3159, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3159, 3168, (byte) 33 ); // Fill 9 of value (byte) 33 - Arrays.fill(CHARS, 3168, 3170, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3170, 3174, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3174, 3184, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3184, 3202, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 3202, 3204, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[3204] = 33; - Arrays.fill(CHARS, 3205, 3213, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3213] = 33; - Arrays.fill(CHARS, 3214, 3217, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3217] = 33; - Arrays.fill(CHARS, 3218, 3241, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[3241] = 33; - Arrays.fill(CHARS, 3242, 3252, (byte) -19 ); // Fill 10 of value (byte) -19 - CHARS[3252] = 33; - Arrays.fill(CHARS, 3253, 3258, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 3258, 3262, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3262, 3269, (byte) -87 ); // Fill 7 of value (byte) -87 - CHARS[3269] = 33; - Arrays.fill(CHARS, 3270, 3273, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3273] = 33; - Arrays.fill(CHARS, 3274, 3278, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3278, 3285, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 3285, 3287, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3287, 3294, (byte) 33 ); // Fill 7 of value (byte) 33 - CHARS[3294] = -19; - CHARS[3295] = 33; - Arrays.fill(CHARS, 3296, 3298, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3298, 3302, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3302, 3312, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3312, 3330, (byte) 33 ); // Fill 18 of value (byte) 33 - Arrays.fill(CHARS, 3330, 3332, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[3332] = 33; - Arrays.fill(CHARS, 3333, 3341, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3341] = 33; - Arrays.fill(CHARS, 3342, 3345, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3345] = 33; - Arrays.fill(CHARS, 3346, 3369, (byte) -19 ); // Fill 23 of value (byte) -19 - CHARS[3369] = 33; - Arrays.fill(CHARS, 3370, 3386, (byte) -19 ); // Fill 16 of value (byte) -19 - Arrays.fill(CHARS, 3386, 3390, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3390, 3396, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 3396, 3398, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3398, 3401, (byte) -87 ); // Fill 3 of value (byte) -87 - CHARS[3401] = 33; - Arrays.fill(CHARS, 3402, 3406, (byte) -87 ); // Fill 4 of value (byte) -87 - Arrays.fill(CHARS, 3406, 3415, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[3415] = -87; - Arrays.fill(CHARS, 3416, 3424, (byte) 33 ); // Fill 8 of value (byte) 33 - Arrays.fill(CHARS, 3424, 3426, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3426, 3430, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3430, 3440, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3440, 3585, (byte) 33 ); // Fill 145 of value (byte) 33 - Arrays.fill(CHARS, 3585, 3631, (byte) -19 ); // Fill 46 of value (byte) -19 - CHARS[3631] = 33; - CHARS[3632] = -19; - CHARS[3633] = -87; - Arrays.fill(CHARS, 3634, 3636, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3636, 3643, (byte) -87 ); // Fill 7 of value (byte) -87 - Arrays.fill(CHARS, 3643, 3648, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 3648, 3654, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 3654, 3663, (byte) -87 ); // Fill 9 of value (byte) -87 - CHARS[3663] = 33; - Arrays.fill(CHARS, 3664, 3674, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3674, 3713, (byte) 33 ); // Fill 39 of value (byte) 33 - Arrays.fill(CHARS, 3713, 3715, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3715] = 33; - CHARS[3716] = -19; - Arrays.fill(CHARS, 3717, 3719, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3719, 3721, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3721] = 33; - CHARS[3722] = -19; - Arrays.fill(CHARS, 3723, 3725, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[3725] = -19; - Arrays.fill(CHARS, 3726, 3732, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 3732, 3736, (byte) -19 ); // Fill 4 of value (byte) -19 - CHARS[3736] = 33; - Arrays.fill(CHARS, 3737, 3744, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[3744] = 33; - Arrays.fill(CHARS, 3745, 3748, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[3748] = 33; - CHARS[3749] = -19; - CHARS[3750] = 33; - CHARS[3751] = -19; - Arrays.fill(CHARS, 3752, 3754, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3754, 3756, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3756] = 33; - Arrays.fill(CHARS, 3757, 3759, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[3759] = 33; - CHARS[3760] = -19; - CHARS[3761] = -87; - Arrays.fill(CHARS, 3762, 3764, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 3764, 3770, (byte) -87 ); // Fill 6 of value (byte) -87 - CHARS[3770] = 33; - Arrays.fill(CHARS, 3771, 3773, (byte) -87 ); // Fill 2 of value (byte) -87 - CHARS[3773] = -19; - Arrays.fill(CHARS, 3774, 3776, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3776, 3781, (byte) -19 ); // Fill 5 of value (byte) -19 - CHARS[3781] = 33; - CHARS[3782] = -87; - CHARS[3783] = 33; - Arrays.fill(CHARS, 3784, 3790, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 3790, 3792, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 3792, 3802, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3802, 3864, (byte) 33 ); // Fill 62 of value (byte) 33 - Arrays.fill(CHARS, 3864, 3866, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3866, 3872, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 3872, 3882, (byte) -87 ); // Fill 10 of value (byte) -87 - Arrays.fill(CHARS, 3882, 3893, (byte) 33 ); // Fill 11 of value (byte) 33 - CHARS[3893] = -87; - CHARS[3894] = 33; - CHARS[3895] = -87; - CHARS[3896] = 33; - CHARS[3897] = -87; - Arrays.fill(CHARS, 3898, 3902, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3902, 3904, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 3904, 3912, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[3912] = 33; - Arrays.fill(CHARS, 3913, 3946, (byte) -19 ); // Fill 33 of value (byte) -19 - Arrays.fill(CHARS, 3946, 3953, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 3953, 3973, (byte) -87 ); // Fill 20 of value (byte) -87 - CHARS[3973] = 33; - Arrays.fill(CHARS, 3974, 3980, (byte) -87 ); // Fill 6 of value (byte) -87 - Arrays.fill(CHARS, 3980, 3984, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 3984, 3990, (byte) -87 ); // Fill 6 of value (byte) -87 - CHARS[3990] = 33; - CHARS[3991] = -87; - CHARS[3992] = 33; - Arrays.fill(CHARS, 3993, 4014, (byte) -87 ); // Fill 21 of value (byte) -87 - Arrays.fill(CHARS, 4014, 4017, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4017, 4024, (byte) -87 ); // Fill 7 of value (byte) -87 - CHARS[4024] = 33; - CHARS[4025] = -87; - Arrays.fill(CHARS, 4026, 4256, (byte) 33 ); // Fill 230 of value (byte) 33 - Arrays.fill(CHARS, 4256, 4294, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 4294, 4304, (byte) 33 ); // Fill 10 of value (byte) 33 - Arrays.fill(CHARS, 4304, 4343, (byte) -19 ); // Fill 39 of value (byte) -19 - Arrays.fill(CHARS, 4343, 4352, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[4352] = -19; - CHARS[4353] = 33; - Arrays.fill(CHARS, 4354, 4356, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4356] = 33; - Arrays.fill(CHARS, 4357, 4360, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[4360] = 33; - CHARS[4361] = -19; - CHARS[4362] = 33; - Arrays.fill(CHARS, 4363, 4365, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4365] = 33; - Arrays.fill(CHARS, 4366, 4371, (byte) -19 ); // Fill 5 of value (byte) -19 - Arrays.fill(CHARS, 4371, 4412, (byte) 33 ); // Fill 41 of value (byte) 33 - CHARS[4412] = -19; - CHARS[4413] = 33; - CHARS[4414] = -19; - CHARS[4415] = 33; - CHARS[4416] = -19; - Arrays.fill(CHARS, 4417, 4428, (byte) 33 ); // Fill 11 of value (byte) 33 - CHARS[4428] = -19; - CHARS[4429] = 33; - CHARS[4430] = -19; - CHARS[4431] = 33; - CHARS[4432] = -19; - Arrays.fill(CHARS, 4433, 4436, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4436, 4438, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 4438, 4441, (byte) 33 ); // Fill 3 of value (byte) 33 - CHARS[4441] = -19; - Arrays.fill(CHARS, 4442, 4447, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 4447, 4450, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[4450] = 33; - CHARS[4451] = -19; - CHARS[4452] = 33; - CHARS[4453] = -19; - CHARS[4454] = 33; - CHARS[4455] = -19; - CHARS[4456] = 33; - CHARS[4457] = -19; - Arrays.fill(CHARS, 4458, 4461, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4461, 4463, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 4463, 4466, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 4466, 4468, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4468] = 33; - CHARS[4469] = -19; - Arrays.fill(CHARS, 4470, 4510, (byte) 33 ); // Fill 40 of value (byte) 33 - CHARS[4510] = -19; - Arrays.fill(CHARS, 4511, 4520, (byte) 33 ); // Fill 9 of value (byte) 33 - CHARS[4520] = -19; - Arrays.fill(CHARS, 4521, 4523, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[4523] = -19; - Arrays.fill(CHARS, 4524, 4526, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 4526, 4528, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 4528, 4535, (byte) 33 ); // Fill 7 of value (byte) 33 - Arrays.fill(CHARS, 4535, 4537, (byte) -19 ); // Fill 2 of value (byte) -19 - CHARS[4537] = 33; - CHARS[4538] = -19; - CHARS[4539] = 33; - Arrays.fill(CHARS, 4540, 4547, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 4547, 4587, (byte) 33 ); // Fill 40 of value (byte) 33 - CHARS[4587] = -19; - Arrays.fill(CHARS, 4588, 4592, (byte) 33 ); // Fill 4 of value (byte) 33 - CHARS[4592] = -19; - Arrays.fill(CHARS, 4593, 4601, (byte) 33 ); // Fill 8 of value (byte) 33 - CHARS[4601] = -19; - Arrays.fill(CHARS, 4602, 7680, (byte) 33 ); // Fill 3078 of value (byte) 33 - Arrays.fill(CHARS, 7680, 7836, (byte) -19 ); // Fill 156 of value (byte) -19 - Arrays.fill(CHARS, 7836, 7840, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 7840, 7930, (byte) -19 ); // Fill 90 of value (byte) -19 - Arrays.fill(CHARS, 7930, 7936, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 7936, 7958, (byte) -19 ); // Fill 22 of value (byte) -19 - Arrays.fill(CHARS, 7958, 7960, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 7960, 7966, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 7966, 7968, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 7968, 8006, (byte) -19 ); // Fill 38 of value (byte) -19 - Arrays.fill(CHARS, 8006, 8008, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8008, 8014, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 8014, 8016, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8016, 8024, (byte) -19 ); // Fill 8 of value (byte) -19 - CHARS[8024] = 33; - CHARS[8025] = -19; - CHARS[8026] = 33; - CHARS[8027] = -19; - CHARS[8028] = 33; - CHARS[8029] = -19; - CHARS[8030] = 33; - Arrays.fill(CHARS, 8031, 8062, (byte) -19 ); // Fill 31 of value (byte) -19 - Arrays.fill(CHARS, 8062, 8064, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8064, 8117, (byte) -19 ); // Fill 53 of value (byte) -19 - CHARS[8117] = 33; - Arrays.fill(CHARS, 8118, 8125, (byte) -19 ); // Fill 7 of value (byte) -19 - CHARS[8125] = 33; - CHARS[8126] = -19; - Arrays.fill(CHARS, 8127, 8130, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 8130, 8133, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[8133] = 33; - Arrays.fill(CHARS, 8134, 8141, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 8141, 8144, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 8144, 8148, (byte) -19 ); // Fill 4 of value (byte) -19 - Arrays.fill(CHARS, 8148, 8150, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 8150, 8156, (byte) -19 ); // Fill 6 of value (byte) -19 - Arrays.fill(CHARS, 8156, 8160, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 8160, 8173, (byte) -19 ); // Fill 13 of value (byte) -19 - Arrays.fill(CHARS, 8173, 8178, (byte) 33 ); // Fill 5 of value (byte) 33 - Arrays.fill(CHARS, 8178, 8181, (byte) -19 ); // Fill 3 of value (byte) -19 - CHARS[8181] = 33; - Arrays.fill(CHARS, 8182, 8189, (byte) -19 ); // Fill 7 of value (byte) -19 - Arrays.fill(CHARS, 8189, 8400, (byte) 33 ); // Fill 211 of value (byte) 33 - Arrays.fill(CHARS, 8400, 8413, (byte) -87 ); // Fill 13 of value (byte) -87 - Arrays.fill(CHARS, 8413, 8417, (byte) 33 ); // Fill 4 of value (byte) 33 - CHARS[8417] = -87; - Arrays.fill(CHARS, 8418, 8486, (byte) 33 ); // Fill 68 of value (byte) 33 - CHARS[8486] = -19; - Arrays.fill(CHARS, 8487, 8490, (byte) 33 ); // Fill 3 of value (byte) 33 - Arrays.fill(CHARS, 8490, 8492, (byte) -19 ); // Fill 2 of value (byte) -19 - Arrays.fill(CHARS, 8492, 8494, (byte) 33 ); // Fill 2 of value (byte) 33 - CHARS[8494] = -19; - Arrays.fill(CHARS, 8495, 8576, (byte) 33 ); // Fill 81 of value (byte) 33 - Arrays.fill(CHARS, 8576, 8579, (byte) -19 ); // Fill 3 of value (byte) -19 - Arrays.fill(CHARS, 8579, 12293, (byte) 33 ); // Fill 3714 of value (byte) 33 - CHARS[12293] = -87; - CHARS[12294] = 33; - CHARS[12295] = -19; - Arrays.fill(CHARS, 12296, 12321, (byte) 33 ); // Fill 25 of value (byte) 33 - Arrays.fill(CHARS, 12321, 12330, (byte) -19 ); // Fill 9 of value (byte) -19 - Arrays.fill(CHARS, 12330, 12336, (byte) -87 ); // Fill 6 of value (byte) -87 - CHARS[12336] = 33; - Arrays.fill(CHARS, 12337, 12342, (byte) -87 ); // Fill 5 of value (byte) -87 - Arrays.fill(CHARS, 12342, 12353, (byte) 33 ); // Fill 11 of value (byte) 33 - Arrays.fill(CHARS, 12353, 12437, (byte) -19 ); // Fill 84 of value (byte) -19 - Arrays.fill(CHARS, 12437, 12441, (byte) 33 ); // Fill 4 of value (byte) 33 - Arrays.fill(CHARS, 12441, 12443, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 12443, 12445, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 12445, 12447, (byte) -87 ); // Fill 2 of value (byte) -87 - Arrays.fill(CHARS, 12447, 12449, (byte) 33 ); // Fill 2 of value (byte) 33 - Arrays.fill(CHARS, 12449, 12539, (byte) -19 ); // Fill 90 of value (byte) -19 - CHARS[12539] = 33; - Arrays.fill(CHARS, 12540, 12543, (byte) -87 ); // Fill 3 of value (byte) -87 - Arrays.fill(CHARS, 12543, 12549, (byte) 33 ); // Fill 6 of value (byte) 33 - Arrays.fill(CHARS, 12549, 12589, (byte) -19 ); // Fill 40 of value (byte) -19 - Arrays.fill(CHARS, 12589, 19968, (byte) 33 ); // Fill 7379 of value (byte) 33 - Arrays.fill(CHARS, 19968, 40870, (byte) -19 ); // Fill 20902 of value (byte) -19 - Arrays.fill(CHARS, 40870, 44032, (byte) 33 ); // Fill 3162 of value (byte) 33 - Arrays.fill(CHARS, 44032, 55204, (byte) -19 ); // Fill 11172 of value (byte) -19 - Arrays.fill(CHARS, 55204, 55296, (byte) 33 ); // Fill 92 of value (byte) 33 - Arrays.fill(CHARS, 57344, 65534, (byte) 33 ); // Fill 8190 of value (byte) 33 - - } // () - - // - // Public static methods - // - - /** - * Returns true if the specified character is a supplemental character. - * - * @param c The character to check. - */ - public static boolean isSupplemental(int c) { - return (c >= 0x10000 && c <= 0x10FFFF); - } - - /** - * Returns true the supplemental character corresponding to the given - * surrogates. - * - * @param h The high surrogate. - * @param l The low surrogate. - */ - public static int supplemental(char h, char l) { - return (h - 0xD800) * 0x400 + (l - 0xDC00) + 0x10000; - } - - /** - * Returns the high surrogate of a supplemental character - * - * @param c The supplemental character to "split". - */ - public static char highSurrogate(int c) { - return (char) (((c - 0x00010000) >> 10) + 0xD800); - } - - /** - * Returns the low surrogate of a supplemental character - * - * @param c The supplemental character to "split". - */ - public static char lowSurrogate(int c) { - return (char) (((c - 0x00010000) & 0x3FF) + 0xDC00); - } - - /** - * Returns whether the given character is a high surrogate - * - * @param c The character to check. - */ - public static boolean isHighSurrogate(int c) { - return (0xD800 <= c && c <= 0xDBFF); - } - - /** - * Returns whether the given character is a low surrogate - * - * @param c The character to check. - */ - public static boolean isLowSurrogate(int c) { - return (0xDC00 <= c && c <= 0xDFFF); - } - - - /** - * Returns true if the specified character is valid. This method - * also checks the surrogate character range from 0x10000 to 0x10FFFF. - *

- * If the program chooses to apply the mask directly to the - * CHARS array, then they are responsible for checking - * the surrogate character range. - * - * @param c The character to check. - */ - public static boolean isValid(int c) { - return (c < 0x10000 && (CHARS[c] & MASK_VALID) != 0) || - (0x10000 <= c && c <= 0x10FFFF); - } // isValid(int):boolean - - /** - * Returns true if the specified character is invalid. - * - * @param c The character to check. - */ - public static boolean isInvalid(int c) { - return !isValid(c); - } // isInvalid(int):boolean - - /** - * Returns true if the specified character can be considered content. - * - * @param c The character to check. - */ - public static boolean isContent(int c) { - return (c < 0x10000 && (CHARS[c] & MASK_CONTENT) != 0) || - (0x10000 <= c && c <= 0x10FFFF); - } // isContent(int):boolean - - /** - * Returns true if the specified character can be considered markup. - * Markup characters include '<', '&', and '%'. - * - * @param c The character to check. - */ - public static boolean isMarkup(int c) { - return c == '<' || c == '&' || c == '%'; - } // isMarkup(int):boolean - - /** - * Returns true if the specified character is a space character - * as defined by production [3] in the XML 1.0 specification. - * - * @param c The character to check. - */ - public static boolean isSpace(int c) { - return c <= 0x20 && (CHARS[c] & MASK_SPACE) != 0; - } // isSpace(int):boolean - - /** - * Returns true if the specified character is a valid name start - * character as defined by production [5] in the XML 1.0 - * specification. - * - * @param c The character to check. - */ - public static boolean isNameStart(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NAME_START) != 0; - } // isNameStart(int):boolean - - /** - * Returns true if the specified character is a valid name - * character as defined by production [4] in the XML 1.0 - * specification. - * - * @param c The character to check. - */ - public static boolean isName(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NAME) != 0; - } // isName(int):boolean - - /** - * Returns true if the specified character is a valid NCName start - * character as defined by production [4] in Namespaces in XML - * recommendation. - * - * @param c The character to check. - */ - public static boolean isNCNameStart(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NCNAME_START) != 0; - } // isNCNameStart(int):boolean - - /** - * Returns true if the specified character is a valid NCName - * character as defined by production [5] in Namespaces in XML - * recommendation. - * - * @param c The character to check. - */ - public static boolean isNCName(int c) { - return c < 0x10000 && (CHARS[c] & MASK_NCNAME) != 0; - } // isNCName(int):boolean - - /** - * Returns true if the specified character is a valid Pubid - * character as defined by production [13] in the XML 1.0 - * specification. - * - * @param c The character to check. - */ - public static boolean isPubid(int c) { - return c < 0x10000 && (CHARS[c] & MASK_PUBID) != 0; - } // isPubid(int):boolean - - /* - * [5] Name ::= (Letter | '_' | ':') (NameChar)* - */ - /** - * Check to see if a string is a valid Name according to [5] - * in the XML 1.0 Recommendation - * - * @param name string to check - * @return true if name is a valid Name - */ - public static boolean isValidName(String name) { - if (name.length() == 0) - return false; - char ch = name.charAt(0); - if( isNameStart(ch) == false) - return false; - for (int i = 1; i < name.length(); i++ ) { - ch = name.charAt(i); - if( isName( ch ) == false ){ - return false; - } - } - return true; - } // isValidName(String):boolean - - - /* - * from the namespace rec - * [4] NCName ::= (Letter | '_') (NCNameChar)* - */ - /** - * Check to see if a string is a valid NCName according to [4] - * from the XML Namespaces 1.0 Recommendation - * - * @param ncName string to check - * @return true if name is a valid NCName - */ - public static boolean isValidNCName(String ncName) { - if (ncName.length() == 0) - return false; - char ch = ncName.charAt(0); - if( isNCNameStart(ch) == false) - return false; - for (int i = 1; i < ncName.length(); i++ ) { - ch = ncName.charAt(i); - if( isNCName( ch ) == false ){ - return false; - } - } - return true; - } // isValidNCName(String):boolean - - /* - * [7] Nmtoken ::= (NameChar)+ - */ - /** - * Check to see if a string is a valid Nmtoken according to [7] - * in the XML 1.0 Recommendation - * - * @param nmtoken string to check - * @return true if nmtoken is a valid Nmtoken - */ - public static boolean isValidNmtoken(String nmtoken) { - if (nmtoken.length() == 0) - return false; - for (int i = 0; i < nmtoken.length(); i++ ) { - char ch = nmtoken.charAt(i); - if( ! isName( ch ) ){ - return false; - } - } - return true; - } // isValidName(String):boolean - - - - - - // encodings - - /** - * Returns true if the encoding name is a valid IANA encoding. - * This method does not verify that there is a decoder available - * for this encoding, only that the characters are valid for an - * IANA encoding name. - * - * @param ianaEncoding The IANA encoding name. - */ - public static boolean isValidIANAEncoding(String ianaEncoding) { - if (ianaEncoding != null) { - int length = ianaEncoding.length(); - if (length > 0) { - char c = ianaEncoding.charAt(0); - if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z')) { - for (int i = 1; i < length; i++) { - c = ianaEncoding.charAt(i); - if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && - (c < '0' || c > '9') && c != '.' && c != '_' && - c != '-') { - return false; - } - } - return true; - } - } - } - return false; - } // isValidIANAEncoding(String):boolean - - /** - * Returns true if the encoding name is a valid Java encoding. - * This method does not verify that there is a decoder available - * for this encoding, only that the characters are valid for an - * Java encoding name. - * - * @param javaEncoding The Java encoding name. - */ - public static boolean isValidJavaEncoding(String javaEncoding) { - if (javaEncoding != null) { - int length = javaEncoding.length(); - if (length > 0) { - for (int i = 1; i < length; i++) { - char c = javaEncoding.charAt(i); - if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && - (c < '0' || c > '9') && c != '.' && c != '_' && - c != '-') { - return false; - } - } - return true; - } - } - return false; - } // isValidIANAEncoding(String):boolean - - -} // class XMLChar --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/resources/ResourceBundle.properties 2018-01-30 20:36:52.000000000 -0500 +++ /dev/null 2018-01-30 20:36:52.000000000 -0500 @@ -1,207 +0,0 @@ -# -# Copyright (c) 2012, 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. -# -# THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. -# - -# Sample ResourceBundle properties file -message.optinalValues = Optional values (other than initial vocabulary) of DII not supported -message.noExternalVocabularies=No external vocabularies registered -message.externalVocabularyNotRegistered=External vocabulary referenced by "{0}" is not registered" - -message.illegalState=Illegal state for decoding of EncodedCharacterString -message.missingNamespace=Name surrogate prefix is present when namespace name is absent -message.IIsNotTerminatedCorrectly=Notation IIs not terminated correctly -message.unparsedEntities=Unparsed entities not terminated correctly -message.decodingNotSupported=Document version with encoding algorithm decoding not supported -message.qNameMissingNamespaceName=Literal qualified name with prefix but no namespace name -message.decodingEII=Illegal state when decoding literal qualified name of EII - -message.decodingNonIdentifyingString=Illegal state whendecoding non identifying string -message.decodingOctets=Illegal state when decoding octets -message.decodingIdentifyingString=Illegal state when decoding identifying string on first bit -message.prefixIllegal=The literal identifying string for the \"xml\" prefix is illegal -message.xmlns=The prefix \"xmlns\" cannot be bound to any namespace explicitly -message.wrongNamespaceName=\"xml\" prefix with a namespace name other than XML namespace name -message.missingNamespaceName=\"xml\" prefix without an XML namespace name -message.decodingIdentifyingStringForPrefix=Illegal state when decoding identifying string for prefix on first bit -message.xmlnsConnotBeBoundToPrefix=The namespace \"http://www.w3.org/2000/xmlns/\" cannot be bound to any prfix explicitly -message.illegalNamespaceName=The literal identifying string for the \"http://www.w3.org/XML/1998/namespace\" namespace name is illegal -message.namespaceWithoutPrefix=The XML namespace is not allowed without the XML prefix -message.decodingForNamespaceName=Illegal state when decoding identifying string for namespace name on first bit -message.decodingNonEmptyOctet=Illegal state when decoding non empty octet string on second bit -message.decodingIndexOnSecondBit=Illegal state when decoding index on second bit -message.notFIDocument=Input stream is not a fast infoset document -message.alphabetNotPresent=Restricted alphabet not present for identifier {0} -message.alphabetIdentifiersReserved=Restricted alphabet identifiers 2 up to and including 31 are reserved for future use -message.alphabetMustContain2orMoreChars=Restricted Alphabet must contain 2 or more characters -message.alphabetIncorrectlyTerminated=Restricted alphabet incorrectly terminated -message.fullBytesNotRead=Full bytes not read -message.deliminatorTooSmall=Length deliminator too small -message.UTF8Encoded=Illegal state for UTF-8 encoded string -message.UTF8EncodedNCName=Illegal state for UTF-8 encoded NCName -message.EOF=Unexpeceted EOF - -#encoder -message.restrictedAlphabetNotPresent=Restricted alphabet not present in restricted alphabet table -message.namespaceURINotIndexed=namespace URI of local name not indexed\: {0} -message.prefixNotIndexed=prefix of local name not indexed\: {0} -message.EncodingAlgorithmURI=Encoding algorithm URI '{0}' not a member of the encoding algorithm table -message.nullEncodingAlgorithmURI=Null encoding algorithm URI present with data that is not byte[] -message.CDATA=CDATA -message.UnsupportedBuiltInAlgorithm=Unsupported built-in encoding algorithm\: {0} - -message.identifiers10to31Reserved=Encoding algorithm identifiers 10 up to and including 31 are reserved for future use -message.characterOutofAlphabetRange=Character(s) not in restricted alphabet range -message.integerMaxSize=Integer > {0} - - -#com.sun.xml.internal.fastinfoset.algorithm -message.notImplemented=Not implemented -message.dataNotByteArray='data' not an instance of byte[] -message.dataNotBoolean='data' not an instance of boolean[] -message.unusedBits4=The number of unused bits is too large (should be < 4) -message.unusedBits8=The number of unused bits is too large (should be < 8) -message.lengthIsNotMultipleOfDouble='length' is not a multiple of {0} bytes correspond to the size of the IEEE 754 floating-point \"single format\" -message.dataNotDouble='data' not an instance of double[] -message.lengthNotMultipleOfFloat='length' is not a multiple of {0} bytes correspond to the size of the IEEE 754 floating-point \"single format\" -message.dataNotFloat='data' not an instance of float[] -message.lengthNotMultipleOfInt='length' is not a multiple of {0} bytes correspond to the size of the 'int' primitive type -message.dataNotIntArray='data' not an instance of int[] -message.lengthNotMultipleOfLong='length' is not a multiple of {0} bytes correspond to the size of the 'long' primitive type -message.dataNotLongArray='data' not an instance of long[] -message.lengthNotMultipleOfShort='length' is not a multiple of {0} bytes correspond to the size of the 'short' primitive type -message.dataNotShortArray='data' not an instance of short[] -message.lengthNotMultipleOfUUID='length' is not a multiple of {0} bytes correspond to the size of the 'UUID' primitive type -message.invalidUUID=Invalid UUID string\: {0} - -#com.sun.xml.internal.fastinfoset.dom - - - -message.algorithmDataCannotBeReported=Document contains application-defined encoding algorithm data that cannot be reported - -message.CDATAAlgorithmNotSupported=CDATA encoding algorithm not supported for attribute values - -message.commentIIAlgorithmNotSupported=Comment II with encoding algorithm decoding not supported - -message.decodingAIIValue=Illegal state when decoding AII value - -message.AIIqNameNotInScope=Qualified name of AII not in scope - -message.decodingAIIs=Illegal state when decoding AIIs - -message.IllegalStateDecodingEIIAfterAIIs=Illegal state when decoding EII after the namespace AIIs - -message.EIInamespaceNameNotTerminatedCorrectly=Namespace names of EII not terminated correctly - -message.IllegalStateDecodingEII=Illegal state when decoding a child of an EII - -message.addToTableNotSupported=Add to table not supported for Encoding algorithms - -message.qnameOfEIINotInScope=Qualified name of EII not in scope - -message.IllegalStateDecodingDII=Illegal state when decoding a child of a DII - -message.processingInstructionIIsNotTerminatedCorrectly=Processing instruction IIs of Document Type Declaraion II not terminated correctly - -message.processingIIWithEncodingAlgorithm=Processing II with encoding algorithm decoding not supported - -message.secondOccurenceOfDTDII=A second occurence of a Document Type Declaration II is present - -#com.sun.xml.internal.fastinfoset.sax -message.URINotPresent=URI not present for encoding algorithm identifier {0} -message.algorithmNotRegistered=Encoding algorithm not registered for URI {0} -message.featureNotSupported=Feature not supported\: {0} -message.propertyNotRecognized=Property not recognized\: -message.inputSource=InputSource must include a byte stream or a system ID -message.qNameOfEIINotInScope=Qualified name of EII not in scope -message.unsupportedAlgorithm=Unsupported built-in encoding algorithm\: {0} -message.processingInstructionTargetIsEmpty=processingInstruction\: Target is empty - -#com.sun.xml.internal.fastinfoset.stax -message.StAX2SAXReader=StAX2SAXReader does not support event {0} - -message.noMoreEvents=No more events to report (EOF). -message.eventTypeNotMatch=Event type {0} specified did not match with current parser event -message.namespaceURINotMatch=Namespace URI {0} specified did not match with current namespace URI -message.localNameNotMatch=LocalName {0} specified did not match with current local name -message.mustBeOnSTARTELEMENT=parser must be on START_ELEMENT to read next text -message.unexpectedEOF=unexpected end of document when reading element text content - -message.getElementTextExpectTextOnly=getElementText() function expects text only element but START_ELEMENT was encountered. -message.unexpectedEventType=Unexpected event type {0} -message.expectedStartOrEnd=expected start or end tag -message.nullPrefix=Prefix cannot be null. -message.invalidCallingGetAttributeValue=Method getAttributeValue() called in invalid state - -message.invalidCallingGetNamespaceCount=Method getNamespaceCount() called in invalid state -message.invalidCallingGetNamespacePrefix=Method getNamespacePrefix() called in invalid state -message.InvalidStateForText=Invalid state for text -message.invalidCallingGetName=Method getName() called in invalid state -message.invalidCallingGetLocalName=Method getLocalName() called in invalid state -message.invalidCallingGetNamespaceURI=Method getNamespaceURI() called in invalid state -message.invalidCallingGetPrefix=Method getPrefix() called in invalid state -message.invalidCallingGetPITarget=Method getPITarget() called in invalid state -message.invalidCallingGetPIData=Method getPIData() called in invalid state - - -message.mustBeOnSTART_ELEMENT=parser must be on START_ELEMENT to read next text. -message.END_ELEMENTnotFound=Can not find END_ELEMENT. -message.startOrEndNotFound=Can not find start or end element. -message.noMoreItems=no more items to return -message.nullPropertyName=Property name can not be null. - -message.validationNotSupported=This implementation does not support validation -message.externalEntities=This implementation does not resolve external entities -message.propertyNotSupported=Property {0} is not supported -message.noElement=No element. -message.nullXMLEventAllocator=XMLEvent Allocator may not be null - -message.nullEventReader=Event reader can not be null -message.eventTypeNotSupported=Event type\: {0} not supported. -message.URIUnbound=URI ''{0}'' is unbound for this attribute -message.attributeWritingNotAllowed=Current state does not allow attribute writing - -#com.sun.xml.internal.fastinfoset.stax.event -message.charactersCast=cannnot cast {0} to Characters -message.endElementCase=cannnot cast {0} to EndElement -message.startElementCase=cannnot cast {0} to StartElement -message.nullReader=Reader cannot be null - -#com.sun.xml.internal.fastinfoset.tools -message.AttributeValueHolderExpected=Object o is not an AttributeValueHolder -message.optinalFileNotSpecified=An optional input file and optional output file must be specified - -#com.sun.xml.internal.fastinfoset.util - -message.illegalClass=Illegal class\: {0} -message.arrayMaxCapacity=Array has reached maximum capacity -message.maxNumberOfCharacters=Maximum number of characters is reached -message.duplicateAttribute=Duplicate attribute present -message.emptyIterator=The Iterator is empty. -message.illegalInitialCapacity=Illegal initial capacity\: {0} -message.illegalLoadFactor=Illegal load factor\: {0} -message.duplicateNamespaceAttribute=Duplicate namespace attribute entry -message.readonlyList=The list is read-only. Content can not be changed. --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/sax/AttributesHolder.java 2018-01-30 20:36:53.000000000 -0500 +++ /dev/null 2018-01-30 20:36:53.000000000 -0500 @@ -1,295 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.sax; - -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.algorithm.BuiltInEncodingAlgorithmFactory; -import java.io.IOException; -import java.util.Map; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; - -import com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmAttributes; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class AttributesHolder implements EncodingAlgorithmAttributes { - private static final int DEFAULT_CAPACITY = 8; - - private Map _registeredEncodingAlgorithms; - - private int _attributeCount; - - private QualifiedName[] _names; - private String[] _values; - - private String[] _algorithmURIs; - private int[] _algorithmIds; - private Object[] _algorithmData; - - public AttributesHolder() { - _names = new QualifiedName[DEFAULT_CAPACITY]; - _values = new String[DEFAULT_CAPACITY]; - - _algorithmURIs = new String[DEFAULT_CAPACITY]; - _algorithmIds = new int[DEFAULT_CAPACITY]; - _algorithmData = new Object[DEFAULT_CAPACITY]; - } - - public AttributesHolder(Map registeredEncodingAlgorithms) { - this(); - _registeredEncodingAlgorithms = registeredEncodingAlgorithms; - } - - // org.xml.sax.Attributes - - public final int getLength() { - return _attributeCount; - } - - public final String getLocalName(int index) { - return _names[index].localName; - } - - public final String getQName(int index) { - return _names[index].getQNameString(); - } - - public final String getType(int index) { - return "CDATA"; - } - - public final String getURI(int index) { - return _names[index].namespaceName; - } - - public final String getValue(int index) { - final String value = _values[index]; - if (value != null) { - return value; - } - - if (_algorithmData[index] == null || - (_algorithmIds[index] >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START && - _registeredEncodingAlgorithms == null)) { - return null; - } - - try { - return _values[index] = convertEncodingAlgorithmDataToString( - _algorithmIds[index], - _algorithmURIs[index], - _algorithmData[index]).toString(); - } catch (IOException e) { - return null; - } catch (FastInfosetException e) { - return null; - } - } - - public final int getIndex(String qName) { - int i = qName.indexOf(':'); - String prefix = ""; - String localName = qName; - if (i >= 0) { - prefix = qName.substring(0, i); - localName = qName.substring(i + 1); - } - - for (i = 0; i < _attributeCount; i++) { - QualifiedName name = _names[i]; - if (localName.equals(name.localName) && - prefix.equals(name.prefix)) { - return i; - } - } - return -1; - } - - public final String getType(String qName) { - int index = getIndex(qName); - if (index >= 0) { - return "CDATA"; - } else { - return null; - } - } - - public final String getValue(String qName) { - int index = getIndex(qName); - if (index >= 0) { - return _values[index]; - } else { - return null; - } - } - - public final int getIndex(String uri, String localName) { - for (int i = 0; i < _attributeCount; i++) { - QualifiedName name = _names[i]; - if (localName.equals(name.localName) && - uri.equals(name.namespaceName)) { - return i; - } - } - return -1; - } - - public final String getType(String uri, String localName) { - int index = getIndex(uri, localName); - if (index >= 0) { - return "CDATA"; - } else { - return null; - } - } - - public final String getValue(String uri, String localName) { - int index = getIndex(uri, localName); - if (index >= 0) { - return _values[index]; - } else { - return null; - } - } - - public final void clear() { - for (int i = 0; i < _attributeCount; i++) { - _values[i] = null; - _algorithmData[i] = null; - } - _attributeCount = 0; - } - - // EncodingAlgorithmAttributes - - public final String getAlgorithmURI(int index) { - return _algorithmURIs[index]; - } - - public final int getAlgorithmIndex(int index) { - return _algorithmIds[index]; - } - - public final Object getAlgorithmData(int index) { - return _algorithmData[index]; - } - - public String getAlpababet(int index) { - return null; - } - - public boolean getToIndex(int index) { - return false; - } - - // ----- - - public final void addAttribute(QualifiedName name, String value) { - if (_attributeCount == _names.length) { - resize(); - } - _names[_attributeCount] = name; - _values[_attributeCount++] = value; - } - - public final void addAttributeWithAlgorithmData(QualifiedName name, String URI, int id, Object data) { - if (_attributeCount == _names.length) { - resize(); - } - _names[_attributeCount] = name; - _values[_attributeCount] = null; - - _algorithmURIs[_attributeCount] = URI; - _algorithmIds[_attributeCount] = id; - _algorithmData[_attributeCount++] = data; - } - - public final QualifiedName getQualifiedName(int index) { - return _names[index]; - } - - public final String getPrefix(int index) { - return _names[index].prefix; - } - - private final void resize() { - final int newLength = _attributeCount * 3 / 2 + 1; - - QualifiedName[] names = new QualifiedName[newLength]; - String[] values = new String[newLength]; - - String[] algorithmURIs = new String[newLength]; - int[] algorithmIds = new int[newLength]; - Object[] algorithmData = new Object[newLength]; - - System.arraycopy(_names, 0, names, 0, _attributeCount); - System.arraycopy(_values, 0, values, 0, _attributeCount); - - System.arraycopy(_algorithmURIs, 0, algorithmURIs, 0, _attributeCount); - System.arraycopy(_algorithmIds, 0, algorithmIds, 0, _attributeCount); - System.arraycopy(_algorithmData, 0, algorithmData, 0, _attributeCount); - - _names = names; - _values = values; - - _algorithmURIs = algorithmURIs; - _algorithmIds = algorithmIds; - _algorithmData = algorithmData; - } - - private final StringBuffer convertEncodingAlgorithmDataToString(int identifier, String URI, Object data) throws FastInfosetException, IOException { - EncodingAlgorithm ea = null; - if (identifier < EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - ea = BuiltInEncodingAlgorithmFactory.getAlgorithm(identifier); - } else if (identifier == EncodingAlgorithmIndexes.CDATA) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.CDATAAlgorithmNotSupported")); - } else if (identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - if (URI == null) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.URINotPresent") + identifier); - } - - ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI); - if (ea == null) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.algorithmNotRegistered") + URI); - } - } else { - // Reserved built-in algorithms for future use - // TODO should use sax property to decide if event will be - // reported, allows for support through handler if required. - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.identifiers10to31Reserved")); - } - - final StringBuffer sb = new StringBuffer(); - ea.convertToCharacters(data, sb); - return sb; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/sax/Features.java 2018-01-30 20:36:54.000000000 -0500 +++ /dev/null 2018-01-30 20:36:54.000000000 -0500 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.sax; - -public class Features { - public static final String NAMESPACES_FEATURE = - "http://xml.org/sax/features/namespaces"; - public static final String NAMESPACE_PREFIXES_FEATURE = - "http://xml.org/sax/features/namespace-prefixes"; - public static final String STRING_INTERNING_FEATURE = - "http://xml.org/sax/features/string-interning"; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/sax/Properties.java 2018-01-30 20:36:55.000000000 -0500 +++ /dev/null 2018-01-30 20:36:55.000000000 -0500 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.sax; - -public class Properties { - public static final String LEXICAL_HANDLER_PROPERTY = - "http://xml.org/sax/properties/lexical-handler"; - public static final String DTD_DECLARATION_HANDLER_PROPERTY = - "http://xml.org/sax/properties/declaration-handler"; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/sax/SAXDocumentParser.java 2018-01-30 20:36:56.000000000 -0500 +++ /dev/null 2018-01-30 20:36:56.000000000 -0500 @@ -1,1791 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.sax; - -import com.sun.xml.internal.fastinfoset.Decoder; -import com.sun.xml.internal.fastinfoset.DecoderStateTables; -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.algorithm.BuiltInEncodingAlgorithmFactory; -import com.sun.xml.internal.fastinfoset.algorithm.BuiltInEncodingAlgorithmState; -import com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmContentHandler; -import com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetReader; -import com.sun.xml.internal.org.jvnet.fastinfoset.sax.PrimitiveTypeContentHandler; -import com.sun.xml.internal.fastinfoset.util.CharArray; -import com.sun.xml.internal.fastinfoset.util.CharArrayString; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Map; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import org.xml.sax.ContentHandler; -import org.xml.sax.DTDHandler; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXNotSupportedException; -import org.xml.sax.SAXParseException; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.DefaultHandler; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; -import java.util.logging.Level; -import java.util.logging.Logger; -import org.xml.sax.ext.DeclHandler; - -/** - * The Fast Infoset SAX parser. - *

- * Instantiate this parser to parse a fast infoset document in accordance - * with the SAX API. - * - *

- * More than one fast infoset document may be decoded from the - * {@link java.io.InputStream}. - */ -public class SAXDocumentParser extends Decoder implements FastInfosetReader { - private static final Logger logger = Logger.getLogger(SAXDocumentParser.class.getName()); - - /* - * Empty lexical handler used by default to report - * lexical-based events - */ - private static final class LexicalHandlerImpl implements LexicalHandler { - public void comment(char[] ch, int start, int end) { } - - public void startDTD(String name, String publicId, String systemId) { } - public void endDTD() { } - - public void startEntity(String name) { } - public void endEntity(String name) { } - - public void startCDATA() { } - public void endCDATA() { } - }; - - /* - * Empty DTD declaration handler used by default to report - * DTD declaration-based events - */ - private static final class DeclHandlerImpl implements DeclHandler { - public void elementDecl(String name, String model) throws SAXException { - } - - public void attributeDecl(String eName, String aName, - String type, String mode, String value) throws SAXException { - } - - public void internalEntityDecl(String name, - String value) throws SAXException { - } - - public void externalEntityDecl(String name, - String publicId, String systemId) throws SAXException { - } - } - - /** - * SAX Namespace attributes features - */ - protected boolean _namespacePrefixesFeature = false; - - /** - * Reference to entity resolver. - */ - protected EntityResolver _entityResolver; - - /** - * Reference to dtd handler. - */ - protected DTDHandler _dtdHandler; - - /** - * Reference to content handler. - */ - protected ContentHandler _contentHandler; - - /** - * Reference to error handler. - */ - protected ErrorHandler _errorHandler; - - /** - * Reference to lexical handler. - */ - protected LexicalHandler _lexicalHandler; - - /** - * Reference to DTD declaration handler. - */ - protected DeclHandler _declHandler; - - protected EncodingAlgorithmContentHandler _algorithmHandler; - - protected PrimitiveTypeContentHandler _primitiveHandler; - - protected BuiltInEncodingAlgorithmState builtInAlgorithmState = - new BuiltInEncodingAlgorithmState(); - - protected AttributesHolder _attributes; - - protected int[] _namespacePrefixes = new int[16]; - - protected int _namespacePrefixesIndex; - - protected boolean _clearAttributes = false; - - /** Creates a new instance of DocumetParser2 */ - public SAXDocumentParser() { - DefaultHandler handler = new DefaultHandler(); - _attributes = new AttributesHolder(_registeredEncodingAlgorithms); - - _entityResolver = handler; - _dtdHandler = handler; - _contentHandler = handler; - _errorHandler = handler; - _lexicalHandler = new LexicalHandlerImpl(); - _declHandler = new DeclHandlerImpl(); - } - - protected void resetOnError() { - _clearAttributes = false; - _attributes.clear(); - _namespacePrefixesIndex = 0; - - if (_v != null) { - _v.prefix.clearCompletely(); - } - _duplicateAttributeVerifier.clear(); - } - - // XMLReader interface - - public boolean getFeature(String name) - throws SAXNotRecognizedException, SAXNotSupportedException { - if (name.equals(Features.NAMESPACES_FEATURE)) { - return true; - } else if (name.equals(Features.NAMESPACE_PREFIXES_FEATURE)) { - return _namespacePrefixesFeature; - } else if (name.equals(Features.STRING_INTERNING_FEATURE) || - name.equals(FastInfosetReader.STRING_INTERNING_PROPERTY)) { - return getStringInterning(); - } else { - throw new SAXNotRecognizedException( - CommonResourceBundle.getInstance().getString("message.featureNotSupported") + name); - } - } - - public void setFeature(String name, boolean value) - throws SAXNotRecognizedException, SAXNotSupportedException { - if (name.equals(Features.NAMESPACES_FEATURE)) { - if (value == false) { - throw new SAXNotSupportedException(name + ":" + value); - } - } else if (name.equals(Features.NAMESPACE_PREFIXES_FEATURE)) { - _namespacePrefixesFeature = value; - } else if (name.equals(Features.STRING_INTERNING_FEATURE) || - name.equals(FastInfosetReader.STRING_INTERNING_PROPERTY)) { - setStringInterning(value); - } else { - throw new SAXNotRecognizedException( - CommonResourceBundle.getInstance().getString("message.featureNotSupported") + name); - } - } - - public Object getProperty(String name) - throws SAXNotRecognizedException, SAXNotSupportedException { - if (name.equals(Properties.LEXICAL_HANDLER_PROPERTY)) { - return getLexicalHandler(); - } else if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) { - return getDeclHandler(); - } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) { - return getExternalVocabularies(); - } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) { - return getRegisteredEncodingAlgorithms(); - } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) { - return getEncodingAlgorithmContentHandler(); - } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) { - return getPrimitiveTypeContentHandler(); - } else { - throw new SAXNotRecognizedException(CommonResourceBundle.getInstance(). - getString("message.propertyNotRecognized", new Object[]{name})); - } - } - - public void setProperty(String name, Object value) - throws SAXNotRecognizedException, SAXNotSupportedException { - if (name.equals(Properties.LEXICAL_HANDLER_PROPERTY)) { - if (value instanceof LexicalHandler) { - setLexicalHandler((LexicalHandler)value); - } else { - throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY); - } - } else if (name.equals(Properties.DTD_DECLARATION_HANDLER_PROPERTY)) { - if (value instanceof DeclHandler) { - setDeclHandler((DeclHandler)value); - } else { - throw new SAXNotSupportedException(Properties.LEXICAL_HANDLER_PROPERTY); - } - } else if (name.equals(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY)) { - if (value instanceof Map) { - setExternalVocabularies((Map)value); - } else { - throw new SAXNotSupportedException(FastInfosetReader.EXTERNAL_VOCABULARIES_PROPERTY); - } - } else if (name.equals(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY)) { - if (value instanceof Map) { - setRegisteredEncodingAlgorithms((Map)value); - } else { - throw new SAXNotSupportedException(FastInfosetReader.REGISTERED_ENCODING_ALGORITHMS_PROPERTY); - } - } else if (name.equals(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY)) { - if (value instanceof EncodingAlgorithmContentHandler) { - setEncodingAlgorithmContentHandler((EncodingAlgorithmContentHandler)value); - } else { - throw new SAXNotSupportedException(FastInfosetReader.ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY); - } - } else if (name.equals(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY)) { - if (value instanceof PrimitiveTypeContentHandler) { - setPrimitiveTypeContentHandler((PrimitiveTypeContentHandler)value); - } else { - throw new SAXNotSupportedException(FastInfosetReader.PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY); - } - } else if (name.equals(FastInfosetReader.BUFFER_SIZE_PROPERTY)) { - if (value instanceof Integer) { - setBufferSize(((Integer)value).intValue()); - } else { - throw new SAXNotSupportedException(FastInfosetReader.BUFFER_SIZE_PROPERTY); - } - } else { - throw new SAXNotRecognizedException(CommonResourceBundle.getInstance(). - getString("message.propertyNotRecognized", new Object[]{name})); - } - } - - public void setEntityResolver(EntityResolver resolver) { - _entityResolver = resolver; - } - - public EntityResolver getEntityResolver() { - return _entityResolver; - } - - public void setDTDHandler(DTDHandler handler) { - _dtdHandler = handler; - } - - public DTDHandler getDTDHandler() { - return _dtdHandler; - } - public void setContentHandler(ContentHandler handler) { - _contentHandler = handler; - } - - public ContentHandler getContentHandler() { - return _contentHandler; - } - - public void setErrorHandler(ErrorHandler handler) { - _errorHandler = handler; - } - - public ErrorHandler getErrorHandler() { - return _errorHandler; - } - - public void parse(InputSource input) throws IOException, SAXException { - try { - InputStream s = input.getByteStream(); - if (s == null) { - String systemId = input.getSystemId(); - if (systemId == null) { - throw new SAXException(CommonResourceBundle.getInstance().getString("message.inputSource")); - } - parse(systemId); - } else { - parse(s); - } - } catch (FastInfosetException e) { - logger.log(Level.FINE, "parsing error", e); - throw new SAXException(e); - } - } - - public void parse(String systemId) throws IOException, SAXException { - try { - systemId = SystemIdResolver.getAbsoluteURI(systemId); - parse(new URL(systemId).openStream()); - } catch (FastInfosetException e) { - logger.log(Level.FINE, "parsing error", e); - throw new SAXException(e); - } - } - - - - - // FastInfosetReader - - public final void parse(InputStream s) throws IOException, FastInfosetException, SAXException { - setInputStream(s); - parse(); - } - - public void setLexicalHandler(LexicalHandler handler) { - _lexicalHandler = handler; - } - - public LexicalHandler getLexicalHandler() { - return _lexicalHandler; - } - - public void setDeclHandler(DeclHandler handler) { - _declHandler = handler; - } - - public DeclHandler getDeclHandler() { - return _declHandler; - } - - public void setEncodingAlgorithmContentHandler(EncodingAlgorithmContentHandler handler) { - _algorithmHandler = handler; - } - - public EncodingAlgorithmContentHandler getEncodingAlgorithmContentHandler() { - return _algorithmHandler; - } - - public void setPrimitiveTypeContentHandler(PrimitiveTypeContentHandler handler) { - _primitiveHandler = handler; - } - - public PrimitiveTypeContentHandler getPrimitiveTypeContentHandler() { - return _primitiveHandler; - } - - - - - public final void parse() throws FastInfosetException, IOException { - if (_octetBuffer.length < _bufferSize) { - _octetBuffer = new byte[_bufferSize]; - } - - try { - reset(); - decodeHeader(); - if (_parseFragments) - processDIIFragment(); - else - processDII(); - } catch (RuntimeException e) { - try { - _errorHandler.fatalError(new SAXParseException(e.getClass().getName(), null, e)); - } catch (Exception ee) { - } - resetOnError(); - // Wrap runtime exception - throw new FastInfosetException(e); - } catch (FastInfosetException e) { - try { - _errorHandler.fatalError(new SAXParseException(e.getClass().getName(), null, e)); - } catch (Exception ee) { - } - resetOnError(); - throw e; - } catch (IOException e) { - try { - _errorHandler.fatalError(new SAXParseException(e.getClass().getName(), null, e)); - } catch (Exception ee) { - } - resetOnError(); - throw e; - } - } - - protected final void processDII() throws FastInfosetException, IOException { - try { - _contentHandler.startDocument(); - } catch (SAXException e) { - throw new FastInfosetException("processDII", e); - } - - _b = read(); - if (_b > 0) { - processDIIOptionalProperties(); - } - - // Decode one Document Type II, Comment IIs, PI IIs and one EII - boolean firstElementHasOccured = false; - boolean documentTypeDeclarationOccured = false; - while(!_terminate || !firstElementHasOccured) { - _b = read(); - switch(DecoderStateTables.DII(_b)) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b], false); - firstElementHasOccured = true; - break; - case DecoderStateTables.EII_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b & EncodingConstants.INTEGER_3RD_BIT_SMALL_MASK], true); - firstElementHasOccured = true; - break; - case DecoderStateTables.EII_INDEX_MEDIUM: - processEII(decodeEIIIndexMedium(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - firstElementHasOccured = true; - break; - case DecoderStateTables.EII_INDEX_LARGE: - processEII(decodeEIIIndexLarge(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - firstElementHasOccured = true; - break; - case DecoderStateTables.EII_LITERAL: - { - final QualifiedName qn = decodeLiteralQualifiedName( - _b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _elementNameTable.getNext()); - _elementNameTable.add(qn); - processEII(qn, (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - firstElementHasOccured = true; - break; - } - case DecoderStateTables.EII_NAMESPACES: - processEIIWithNamespaces(); - firstElementHasOccured = true; - break; - case DecoderStateTables.DOCUMENT_TYPE_DECLARATION_II: - { - if (documentTypeDeclarationOccured) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.secondOccurenceOfDTDII")); - } - documentTypeDeclarationOccured = true; - - String system_identifier = ((_b & EncodingConstants.DOCUMENT_TYPE_SYSTEM_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - String public_identifier = ((_b & EncodingConstants.DOCUMENT_TYPE_PUBLIC_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - - _b = read(); - while (_b == EncodingConstants.PROCESSING_INSTRUCTION) { - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - if (_addToTable) { - _v.otherString.add(new CharArray(_charBuffer, 0, _charBufferLength, true)); - } - break; - case NISTRING_ENCODING_ALGORITHM: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.processingIIWithEncodingAlgorithm")); - case NISTRING_INDEX: - break; - case NISTRING_EMPTY_STRING: - break; - } - _b = read(); - } - if ((_b & EncodingConstants.TERMINATOR) != EncodingConstants.TERMINATOR) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.processingInstructionIIsNotTerminatedCorrectly")); - } - if (_b == EncodingConstants.DOUBLE_TERMINATOR) { - _terminate = true; - } - - if (_notations != null) _notations.clear(); - if (_unparsedEntities != null) _unparsedEntities.clear(); - /* - * TODO - * Report All events associated with DTD, PIs, notations etc - */ - break; - } - case DecoderStateTables.COMMENT_II: - processCommentII(); - break; - case DecoderStateTables.PROCESSING_INSTRUCTION_II: - processProcessingII(); - break; - case DecoderStateTables.TERMINATOR_DOUBLE: - _doubleTerminate = true; - case DecoderStateTables.TERMINATOR_SINGLE: - _terminate = true; - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingDII")); - } - } - - // Decode any remaining Comment IIs, PI IIs - while(!_terminate) { - _b = read(); - switch(DecoderStateTables.DII(_b)) { - case DecoderStateTables.COMMENT_II: - processCommentII(); - break; - case DecoderStateTables.PROCESSING_INSTRUCTION_II: - processProcessingII(); - break; - case DecoderStateTables.TERMINATOR_DOUBLE: - _doubleTerminate = true; - case DecoderStateTables.TERMINATOR_SINGLE: - _terminate = true; - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingDII")); - } - } - - try { - _contentHandler.endDocument(); - } catch (SAXException e) { - throw new FastInfosetException("processDII", e); - } - } - - protected final void processDIIFragment() throws FastInfosetException, IOException { - try { - _contentHandler.startDocument(); - } catch (SAXException e) { - throw new FastInfosetException("processDII", e); - } - - _b = read(); - if (_b > 0) { - processDIIOptionalProperties(); - } - - while(!_terminate) { - _b = read(); - switch(DecoderStateTables.EII(_b)) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b], false); - break; - case DecoderStateTables.EII_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b & EncodingConstants.INTEGER_3RD_BIT_SMALL_MASK], true); - break; - case DecoderStateTables.EII_INDEX_MEDIUM: - processEII(decodeEIIIndexMedium(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - break; - case DecoderStateTables.EII_INDEX_LARGE: - processEII(decodeEIIIndexLarge(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - break; - case DecoderStateTables.EII_LITERAL: - { - final QualifiedName qn = decodeLiteralQualifiedName( - _b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _elementNameTable.getNext()); - _elementNameTable.add(qn); - processEII(qn, (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - break; - } - case DecoderStateTables.EII_NAMESPACES: - processEIIWithNamespaces(); - break; - case DecoderStateTables.CII_UTF8_SMALL_LENGTH: - _octetBufferLength = (_b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK) - + 1; - processUtf8CharacterString(); - break; - case DecoderStateTables.CII_UTF8_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT; - processUtf8CharacterString(); - break; - case DecoderStateTables.CII_UTF8_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - processUtf8CharacterString(); - break; - case DecoderStateTables.CII_UTF16_SMALL_LENGTH: - _octetBufferLength = (_b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK) - + 1; - decodeUtf16StringAsCharBuffer(); - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - try { - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - case DecoderStateTables.CII_UTF16_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT; - decodeUtf16StringAsCharBuffer(); - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - try { - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - case DecoderStateTables.CII_UTF16_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - decodeUtf16StringAsCharBuffer(); - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - try { - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - case DecoderStateTables.CII_RA: - { - final boolean addToTable = (_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0; - - // Decode resitricted alphabet integer - _identifier = (_b & 0x02) << 6; - _b = read(); - _identifier |= (_b & 0xFC) >> 2; - - decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(_b); - - decodeRestrictedAlphabetAsCharBuffer(); - - if (addToTable) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - try { - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.CII_EA: - { - final boolean addToTable = (_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0; - - // Decode encoding algorithm integer - _identifier = (_b & 0x02) << 6; - _b = read(); - _identifier |= (_b & 0xFC) >> 2; - - decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(_b); - - processCIIEncodingAlgorithm(addToTable); - break; - } - case DecoderStateTables.CII_INDEX_SMALL: - { - final int index = _b & EncodingConstants.INTEGER_4TH_BIT_SMALL_MASK; - try { - _contentHandler.characters(_characterContentChunkTable._array, - _characterContentChunkTable._offset[index], - _characterContentChunkTable._length[index]); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.CII_INDEX_MEDIUM: - { - final int index = (((_b & EncodingConstants.INTEGER_4TH_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_4TH_BIT_SMALL_LIMIT; - try { - _contentHandler.characters(_characterContentChunkTable._array, - _characterContentChunkTable._offset[index], - _characterContentChunkTable._length[index]); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.CII_INDEX_LARGE: - { - final int index = (((_b & EncodingConstants.INTEGER_4TH_BIT_LARGE_MASK) << 16) | - (read() << 8) | - read()) - + EncodingConstants.INTEGER_4TH_BIT_MEDIUM_LIMIT; - - try { - _contentHandler.characters(_characterContentChunkTable._array, - _characterContentChunkTable._offset[index], - _characterContentChunkTable._length[index]); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.CII_INDEX_LARGE_LARGE: - { - final int index = ((read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.INTEGER_4TH_BIT_LARGE_LIMIT; - - try { - _contentHandler.characters(_characterContentChunkTable._array, - _characterContentChunkTable._offset[index], - _characterContentChunkTable._length[index]); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.COMMENT_II: - processCommentII(); - break; - case DecoderStateTables.PROCESSING_INSTRUCTION_II: - processProcessingII(); - break; - case DecoderStateTables.UNEXPANDED_ENTITY_REFERENCE_II: - { - String entity_reference_name = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - - String system_identifier = ((_b & EncodingConstants.UNEXPANDED_ENTITY_SYSTEM_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - String public_identifier = ((_b & EncodingConstants.UNEXPANDED_ENTITY_PUBLIC_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - - try { - /* - * TODO - * Need to verify if the skippedEntity method: - * http://java.sun.com/j2se/1.4.2/docs/api/org/xml/sax/ContentHandler.html#skippedEntity(java.lang.String) - * is the correct method to call. It appears so but a more extensive - * check is necessary. - */ - _contentHandler.skippedEntity(entity_reference_name); - } catch (SAXException e) { - throw new FastInfosetException("processUnexpandedEntityReferenceII", e); - } - break; - } - case DecoderStateTables.TERMINATOR_DOUBLE: - _doubleTerminate = true; - case DecoderStateTables.TERMINATOR_SINGLE: - _terminate = true; - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingEII")); - } - } - - try { - _contentHandler.endDocument(); - } catch (SAXException e) { - throw new FastInfosetException("processDII", e); - } - } - - protected final void processDIIOptionalProperties() throws FastInfosetException, IOException { - // Optimize for the most common case - if (_b == EncodingConstants.DOCUMENT_INITIAL_VOCABULARY_FLAG) { - decodeInitialVocabulary(); - return; - } - - if ((_b & EncodingConstants.DOCUMENT_ADDITIONAL_DATA_FLAG) > 0) { - decodeAdditionalData(); - /* - * TODO - * how to report the additional data? - */ - } - - if ((_b & EncodingConstants.DOCUMENT_INITIAL_VOCABULARY_FLAG) > 0) { - decodeInitialVocabulary(); - } - - if ((_b & EncodingConstants.DOCUMENT_NOTATIONS_FLAG) > 0) { - decodeNotations(); - /* - try { - _dtdHandler.notationDecl(name, public_identifier, system_identifier); - } catch (SAXException e) { - throw new IOException("NotationsDeclarationII"); - } - */ - } - - if ((_b & EncodingConstants.DOCUMENT_UNPARSED_ENTITIES_FLAG) > 0) { - decodeUnparsedEntities(); - /* - try { - _dtdHandler.unparsedEntityDecl(name, public_identifier, system_identifier, notation_name); - } catch (SAXException e) { - throw new IOException("UnparsedEntitiesII"); - } - */ - } - - if ((_b & EncodingConstants.DOCUMENT_CHARACTER_ENCODING_SCHEME) > 0) { - /*String characterEncodingScheme = */decodeCharacterEncodingScheme(); - /* - * TODO - * how to report the character encoding scheme? - */ - } - - if ((_b & EncodingConstants.DOCUMENT_STANDALONE_FLAG) > 0) { - /*boolean standalone = (*/read()/* > 0) ? true : false*/ ; - /* - * TODO - * how to report the standalone flag? - */ - } - - if ((_b & EncodingConstants.DOCUMENT_VERSION_FLAG) > 0) { - decodeVersion(); - /* - * TODO - * how to report the standalone flag? - */ - } - } - - protected final void processEII(QualifiedName name, boolean hasAttributes) throws FastInfosetException, IOException { - if (_prefixTable._currentInScope[name.prefixIndex] != name.namespaceNameIndex) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.qNameOfEIINotInScope")); - } - - if (hasAttributes) { - processAIIs(); - } - - try { - _contentHandler.startElement(name.namespaceName, name.localName, name.qName, _attributes); - } catch (SAXException e) { - logger.log(Level.FINE, "processEII error", e); - throw new FastInfosetException("processEII", e); - } - - if (_clearAttributes) { - _attributes.clear(); - _clearAttributes = false; - } - - while(!_terminate) { - _b = read(); - switch(DecoderStateTables.EII(_b)) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b], false); - break; - case DecoderStateTables.EII_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b & EncodingConstants.INTEGER_3RD_BIT_SMALL_MASK], true); - break; - case DecoderStateTables.EII_INDEX_MEDIUM: - processEII(decodeEIIIndexMedium(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - break; - case DecoderStateTables.EII_INDEX_LARGE: - processEII(decodeEIIIndexLarge(), (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - break; - case DecoderStateTables.EII_LITERAL: - { - final QualifiedName qn = decodeLiteralQualifiedName( - _b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _elementNameTable.getNext()); - _elementNameTable.add(qn); - processEII(qn, (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - break; - } - case DecoderStateTables.EII_NAMESPACES: - processEIIWithNamespaces(); - break; - case DecoderStateTables.CII_UTF8_SMALL_LENGTH: - _octetBufferLength = (_b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK) - + 1; - processUtf8CharacterString(); - break; - case DecoderStateTables.CII_UTF8_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT; - processUtf8CharacterString(); - break; - case DecoderStateTables.CII_UTF8_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - processUtf8CharacterString(); - break; - case DecoderStateTables.CII_UTF16_SMALL_LENGTH: - _octetBufferLength = (_b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK) - + 1; - decodeUtf16StringAsCharBuffer(); - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - try { - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - case DecoderStateTables.CII_UTF16_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT; - decodeUtf16StringAsCharBuffer(); - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - try { - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - case DecoderStateTables.CII_UTF16_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - decodeUtf16StringAsCharBuffer(); - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - try { - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - case DecoderStateTables.CII_RA: - { - final boolean addToTable = (_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0; - - // Decode resitricted alphabet integer - _identifier = (_b & 0x02) << 6; - _b = read(); - _identifier |= (_b & 0xFC) >> 2; - - decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(_b); - - decodeRestrictedAlphabetAsCharBuffer(); - - if (addToTable) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - - try { - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.CII_EA: - { - final boolean addToTable = (_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0; - // Decode encoding algorithm integer - _identifier = (_b & 0x02) << 6; - _b = read(); - _identifier |= (_b & 0xFC) >> 2; - - decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(_b); - - processCIIEncodingAlgorithm(addToTable); - break; - } - case DecoderStateTables.CII_INDEX_SMALL: - { - final int index = _b & EncodingConstants.INTEGER_4TH_BIT_SMALL_MASK; - try { - _contentHandler.characters(_characterContentChunkTable._array, - _characterContentChunkTable._offset[index], - _characterContentChunkTable._length[index]); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.CII_INDEX_MEDIUM: - { - final int index = (((_b & EncodingConstants.INTEGER_4TH_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_4TH_BIT_SMALL_LIMIT; - try { - _contentHandler.characters(_characterContentChunkTable._array, - _characterContentChunkTable._offset[index], - _characterContentChunkTable._length[index]); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.CII_INDEX_LARGE: - { - final int index = (((_b & EncodingConstants.INTEGER_4TH_BIT_LARGE_MASK) << 16) | - (read() << 8) | - read()) - + EncodingConstants.INTEGER_4TH_BIT_MEDIUM_LIMIT; - - try { - _contentHandler.characters(_characterContentChunkTable._array, - _characterContentChunkTable._offset[index], - _characterContentChunkTable._length[index]); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.CII_INDEX_LARGE_LARGE: - { - final int index = ((read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.INTEGER_4TH_BIT_LARGE_LIMIT; - - try { - _contentHandler.characters(_characterContentChunkTable._array, - _characterContentChunkTable._offset[index], - _characterContentChunkTable._length[index]); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - break; - } - case DecoderStateTables.COMMENT_II: - processCommentII(); - break; - case DecoderStateTables.PROCESSING_INSTRUCTION_II: - processProcessingII(); - break; - case DecoderStateTables.UNEXPANDED_ENTITY_REFERENCE_II: - { - String entity_reference_name = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - - String system_identifier = ((_b & EncodingConstants.UNEXPANDED_ENTITY_SYSTEM_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - String public_identifier = ((_b & EncodingConstants.UNEXPANDED_ENTITY_PUBLIC_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - - try { - /* - * TODO - * Need to verify if the skippedEntity method: - * http://java.sun.com/j2se/1.4.2/docs/api/org/xml/sax/ContentHandler.html#skippedEntity(java.lang.String) - * is the correct method to call. It appears so but a more extensive - * check is necessary. - */ - _contentHandler.skippedEntity(entity_reference_name); - } catch (SAXException e) { - throw new FastInfosetException("processUnexpandedEntityReferenceII", e); - } - break; - } - case DecoderStateTables.TERMINATOR_DOUBLE: - _doubleTerminate = true; - case DecoderStateTables.TERMINATOR_SINGLE: - _terminate = true; - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingEII")); - } - } - - _terminate = _doubleTerminate; - _doubleTerminate = false; - - try { - _contentHandler.endElement(name.namespaceName, name.localName, name.qName); - } catch (SAXException e) { - throw new FastInfosetException("processEII", e); - } - } - - private final void processUtf8CharacterString() throws FastInfosetException, IOException { - if ((_b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.ensureSize(_octetBufferLength); - final int charactersOffset = _characterContentChunkTable._arrayIndex; - decodeUtf8StringAsCharBuffer(_characterContentChunkTable._array, charactersOffset); - _characterContentChunkTable.add(_charBufferLength); - try { - _contentHandler.characters(_characterContentChunkTable._array, charactersOffset, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - } else { - decodeUtf8StringAsCharBuffer(); - try { - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCII", e); - } - } - } - - protected final void processEIIWithNamespaces() throws FastInfosetException, IOException { - final boolean hasAttributes = (_b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0; - - _clearAttributes = (_namespacePrefixesFeature) ? true : false; - - if (++_prefixTable._declarationId == Integer.MAX_VALUE) { - _prefixTable.clearDeclarationIds(); - } - - String prefix = "", namespaceName = ""; - final int start = _namespacePrefixesIndex; - int b = read(); - while ((b & EncodingConstants.NAMESPACE_ATTRIBUTE_MASK) == EncodingConstants.NAMESPACE_ATTRIBUTE) { - if (_namespacePrefixesIndex == _namespacePrefixes.length) { - final int[] namespaceAIIs = new int[_namespacePrefixesIndex * 3 / 2 + 1]; - System.arraycopy(_namespacePrefixes, 0, namespaceAIIs, 0, _namespacePrefixesIndex); - _namespacePrefixes = namespaceAIIs; - } - - switch (b & EncodingConstants.NAMESPACE_ATTRIBUTE_PREFIX_NAME_MASK) { - // no prefix, no namespace - // Undeclaration of default namespace - case 0: - prefix = namespaceName = ""; - _namespaceNameIndex = _prefixIndex = _namespacePrefixes[_namespacePrefixesIndex++] = -1; - break; - // no prefix, namespace - // Declaration of default namespace - case 1: - prefix = ""; - namespaceName = decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName(false); - - _prefixIndex = _namespacePrefixes[_namespacePrefixesIndex++] = -1; - break; - // prefix, no namespace - // Undeclaration of namespace - case 2: - prefix = decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix(false); - namespaceName = ""; - - _namespaceNameIndex = -1; - _namespacePrefixes[_namespacePrefixesIndex++] = _prefixIndex; - break; - // prefix, namespace - // Declaration of prefixed namespace - case 3: - prefix = decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix(true); - namespaceName = decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName(true); - - _namespacePrefixes[_namespacePrefixesIndex++] = _prefixIndex; - break; - } - - _prefixTable.pushScope(_prefixIndex, _namespaceNameIndex); - - if (_namespacePrefixesFeature) { - // Add the namespace delcaration as an attribute - if (prefix != "") { - _attributes.addAttribute(new QualifiedName( - EncodingConstants.XMLNS_NAMESPACE_PREFIX, - EncodingConstants.XMLNS_NAMESPACE_NAME, - prefix), - namespaceName); - } else { - _attributes.addAttribute(EncodingConstants.DEFAULT_NAMESPACE_DECLARATION, - namespaceName); - } - } - - try { - _contentHandler.startPrefixMapping(prefix, namespaceName); - } catch (SAXException e) { - throw new IOException("processStartNamespaceAII"); - } - - b = read(); - } - if (b != EncodingConstants.TERMINATOR) { - throw new IOException(CommonResourceBundle.getInstance().getString("message.EIInamespaceNameNotTerminatedCorrectly")); - } - final int end = _namespacePrefixesIndex; - - _b = read(); - switch(DecoderStateTables.EII(_b)) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[_b], hasAttributes); - break; - case DecoderStateTables.EII_INDEX_MEDIUM: - processEII(decodeEIIIndexMedium(), hasAttributes); - break; - case DecoderStateTables.EII_INDEX_LARGE: - processEII(decodeEIIIndexLarge(), hasAttributes); - break; - case DecoderStateTables.EII_LITERAL: - { - final QualifiedName qn = decodeLiteralQualifiedName( - _b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _elementNameTable.getNext()); - _elementNameTable.add(qn); - processEII(qn, hasAttributes); - break; - } - default: - throw new IOException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingEIIAfterAIIs")); - } - - try { - for (int i = end - 1; i >= start; i--) { - final int prefixIndex = _namespacePrefixes[i]; - _prefixTable.popScope(prefixIndex); - prefix = (prefixIndex > 0) ? _prefixTable.get(prefixIndex - 1) : - (prefixIndex == -1) ? "" : EncodingConstants.XML_NAMESPACE_PREFIX; - _contentHandler.endPrefixMapping(prefix); - } - _namespacePrefixesIndex = start; - } catch (SAXException e) { - throw new IOException("processStartNamespaceAII"); - } - } - - protected final void processAIIs() throws FastInfosetException, IOException { - QualifiedName name; - int b; - String value; - - _clearAttributes = true; - - if (++_duplicateAttributeVerifier._currentIteration == Integer.MAX_VALUE) { - _duplicateAttributeVerifier.clear(); - } - - do { - // AII qualified name - b = read(); - switch (DecoderStateTables.AII(b)) { - case DecoderStateTables.AII_INDEX_SMALL: - name = _attributeNameTable._array[b]; - break; - case DecoderStateTables.AII_INDEX_MEDIUM: - { - final int i = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - name = _attributeNameTable._array[i]; - break; - } - case DecoderStateTables.AII_INDEX_LARGE: - { - final int i = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - name = _attributeNameTable._array[i]; - break; - } - case DecoderStateTables.AII_LITERAL: - name = decodeLiteralQualifiedName( - b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _attributeNameTable.getNext()); - name.createAttributeValues(_duplicateAttributeVerifier.MAP_SIZE); - _attributeNameTable.add(name); - break; - case DecoderStateTables.AII_TERMINATOR_DOUBLE: - _doubleTerminate = true; - case DecoderStateTables.AII_TERMINATOR_SINGLE: - _terminate = true; - // AIIs have finished break out of loop - continue; - default: - throw new IOException(CommonResourceBundle.getInstance().getString("message.decodingAIIs")); - } - - if (name.prefixIndex > 0 && _prefixTable._currentInScope[name.prefixIndex] != name.namespaceNameIndex) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.AIIqNameNotInScope")); - } - - _duplicateAttributeVerifier.checkForDuplicateAttribute(name.attributeHash, name.attributeId); - - // [normalized value] of AII - - b = read(); - switch(DecoderStateTables.NISTRING(b)) { - case DecoderStateTables.NISTRING_UTF8_SMALL_LENGTH: - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_MASK) + 1; - value = decodeUtf8StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF8_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT; - value = decodeUtf8StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF8_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - value = decodeUtf8StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF16_SMALL_LENGTH: - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_MASK) + 1; - value = decodeUtf16StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF16_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT; - value = decodeUtf16StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF16_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - value = decodeUtf16StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_RA: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - // Decode resitricted alphabet integer - _identifier = (b & 0x0F) << 4; - b = read(); - _identifier |= (b & 0xF0) >> 4; - - decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(b); - - value = decodeRestrictedAlphabetAsString(); - if (addToTable) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - } - case DecoderStateTables.NISTRING_EA: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - - _identifier = (b & 0x0F) << 4; - b = read(); - _identifier |= (b & 0xF0) >> 4; - - decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(b); - - processAIIEncodingAlgorithm(name, addToTable); - break; - } - case DecoderStateTables.NISTRING_INDEX_SMALL: - _attributes.addAttribute(name, - _attributeValueTable._array[b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK]); - break; - case DecoderStateTables.NISTRING_INDEX_MEDIUM: - { - final int index = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - - _attributes.addAttribute(name, - _attributeValueTable._array[index]); - break; - } - case DecoderStateTables.NISTRING_INDEX_LARGE: - { - final int index = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - - _attributes.addAttribute(name, - _attributeValueTable._array[index]); - break; - } - case DecoderStateTables.NISTRING_EMPTY: - _attributes.addAttribute(name, ""); - break; - default: - throw new IOException(CommonResourceBundle.getInstance().getString("message.decodingAIIValue")); - } - - } while (!_terminate); - - // Reset duplication attribute verfifier - _duplicateAttributeVerifier._poolCurrent = _duplicateAttributeVerifier._poolHead; - - _terminate = _doubleTerminate; - _doubleTerminate = false; - } - - protected final void processCommentII() throws FastInfosetException, IOException { - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - if (_addToTable) { - _v.otherString.add(new CharArray(_charBuffer, 0, _charBufferLength, true)); - } - - try { - _lexicalHandler.comment(_charBuffer, 0, _charBufferLength); - } catch (SAXException e) { - throw new FastInfosetException("processCommentII", e); - } - break; - case NISTRING_ENCODING_ALGORITHM: - throw new IOException(CommonResourceBundle.getInstance().getString("message.commentIIAlgorithmNotSupported")); - case NISTRING_INDEX: - final CharArray ca = _v.otherString.get(_integer); - - try { - _lexicalHandler.comment(ca.ch, ca.start, ca.length); - } catch (SAXException e) { - throw new FastInfosetException("processCommentII", e); - } - break; - case NISTRING_EMPTY_STRING: - try { - _lexicalHandler.comment(_charBuffer, 0, 0); - } catch (SAXException e) { - throw new FastInfosetException("processCommentII", e); - } - break; - } - } - - protected final void processProcessingII() throws FastInfosetException, IOException { - final String target = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - final String data = new String(_charBuffer, 0, _charBufferLength); - if (_addToTable) { - _v.otherString.add(new CharArrayString(data)); - } - try { - _contentHandler.processingInstruction(target, data); - } catch (SAXException e) { - throw new FastInfosetException("processProcessingII", e); - } - break; - case NISTRING_ENCODING_ALGORITHM: - throw new IOException(CommonResourceBundle.getInstance().getString("message.processingIIWithEncodingAlgorithm")); - case NISTRING_INDEX: - try { - _contentHandler.processingInstruction(target, _v.otherString.get(_integer).toString()); - } catch (SAXException e) { - throw new FastInfosetException("processProcessingII", e); - } - break; - case NISTRING_EMPTY_STRING: - try { - _contentHandler.processingInstruction(target, ""); - } catch (SAXException e) { - throw new FastInfosetException("processProcessingII", e); - } - break; - } - } - - protected final void processCIIEncodingAlgorithm(boolean addToTable) throws FastInfosetException, IOException { - if (_identifier < EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - if (_primitiveHandler != null) { - processCIIBuiltInEncodingAlgorithmAsPrimitive(); - } else if (_algorithmHandler != null) { - Object array = processBuiltInEncodingAlgorithmAsObject(); - - try { - _algorithmHandler.object(null, _identifier, array); - } catch (SAXException e) { - throw new FastInfosetException(e); - } - } else { - StringBuffer buffer = new StringBuffer(); - processBuiltInEncodingAlgorithmAsCharacters(buffer); - - try { - _contentHandler.characters(buffer.toString().toCharArray(), 0, buffer.length()); - } catch (SAXException e) { - throw new FastInfosetException(e); - } - } - - if (addToTable) { - StringBuffer buffer = new StringBuffer(); - processBuiltInEncodingAlgorithmAsCharacters(buffer); - _characterContentChunkTable.add(buffer.toString().toCharArray(), buffer.length()); - } - } else if (_identifier == EncodingAlgorithmIndexes.CDATA) { - // Set back buffer position to start of encoded string - _octetBufferOffset -= _octetBufferLength; - decodeUtf8StringIntoCharBuffer(); - - try { - _lexicalHandler.startCDATA(); - _contentHandler.characters(_charBuffer, 0, _charBufferLength); - _lexicalHandler.endCDATA(); - } catch (SAXException e) { - throw new FastInfosetException(e); - } - - if (addToTable) { - _characterContentChunkTable.add(_charBuffer, _charBufferLength); - } - } else if (_identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START && _algorithmHandler != null) { - final String URI = _v.encodingAlgorithm.get(_identifier - EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START); - if (URI == null) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance(). - getString("message.URINotPresent", new Object[]{Integer.valueOf(_identifier)})); - } - - final EncodingAlgorithm ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI); - if (ea != null) { - final Object data = ea.decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength); - try { - _algorithmHandler.object(URI, _identifier, data); - } catch (SAXException e) { - throw new FastInfosetException(e); - } - } else { - try { - _algorithmHandler.octets(URI, _identifier, _octetBuffer, _octetBufferStart, _octetBufferLength); - } catch (SAXException e) { - throw new FastInfosetException(e); - } - } - if (addToTable) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.addToTableNotSupported")); - } - } else if (_identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - // TODO should have property to ignore - throw new EncodingAlgorithmException( - CommonResourceBundle.getInstance().getString("message.algorithmDataCannotBeReported")); - } else { - // Reserved built-in algorithms for future use - // TODO should use sax property to decide if event will be - // reported, allows for support through handler if required. - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.identifiers10to31Reserved")); - } - } - - protected final void processCIIBuiltInEncodingAlgorithmAsPrimitive() throws FastInfosetException, IOException { - try { - int length; - switch(_identifier) { - case EncodingAlgorithmIndexes.HEXADECIMAL: - case EncodingAlgorithmIndexes.BASE64: - _primitiveHandler.bytes(_octetBuffer, _octetBufferStart, _octetBufferLength); - break; - case EncodingAlgorithmIndexes.SHORT: - length = BuiltInEncodingAlgorithmFactory.shortEncodingAlgorithm. - getPrimtiveLengthFromOctetLength(_octetBufferLength); - if (length > builtInAlgorithmState.shortArray.length) { - final short[] array = new short[length * 3 / 2 + 1]; - System.arraycopy(builtInAlgorithmState.shortArray, 0, - array, 0, builtInAlgorithmState.shortArray.length); - builtInAlgorithmState.shortArray = array; - } - - BuiltInEncodingAlgorithmFactory.shortEncodingAlgorithm. - decodeFromBytesToShortArray(builtInAlgorithmState.shortArray, 0, - _octetBuffer, _octetBufferStart, _octetBufferLength); - _primitiveHandler.shorts(builtInAlgorithmState.shortArray, 0, length); - break; - case EncodingAlgorithmIndexes.INT: - length = BuiltInEncodingAlgorithmFactory.intEncodingAlgorithm. - getPrimtiveLengthFromOctetLength(_octetBufferLength); - if (length > builtInAlgorithmState.intArray.length) { - final int[] array = new int[length * 3 / 2 + 1]; - System.arraycopy(builtInAlgorithmState.intArray, 0, - array, 0, builtInAlgorithmState.intArray.length); - builtInAlgorithmState.intArray = array; - } - - BuiltInEncodingAlgorithmFactory.intEncodingAlgorithm. - decodeFromBytesToIntArray(builtInAlgorithmState.intArray, 0, - _octetBuffer, _octetBufferStart, _octetBufferLength); - _primitiveHandler.ints(builtInAlgorithmState.intArray, 0, length); - break; - case EncodingAlgorithmIndexes.LONG: - length = BuiltInEncodingAlgorithmFactory.longEncodingAlgorithm. - getPrimtiveLengthFromOctetLength(_octetBufferLength); - if (length > builtInAlgorithmState.longArray.length) { - final long[] array = new long[length * 3 / 2 + 1]; - System.arraycopy(builtInAlgorithmState.longArray, 0, - array, 0, builtInAlgorithmState.longArray.length); - builtInAlgorithmState.longArray = array; - } - - BuiltInEncodingAlgorithmFactory.longEncodingAlgorithm. - decodeFromBytesToLongArray(builtInAlgorithmState.longArray, 0, - _octetBuffer, _octetBufferStart, _octetBufferLength); - _primitiveHandler.longs(builtInAlgorithmState.longArray, 0, length); - break; - case EncodingAlgorithmIndexes.BOOLEAN: - length = BuiltInEncodingAlgorithmFactory.booleanEncodingAlgorithm. - getPrimtiveLengthFromOctetLength(_octetBufferLength, _octetBuffer[_octetBufferStart] & 0xFF); - if (length > builtInAlgorithmState.booleanArray.length) { - final boolean[] array = new boolean[length * 3 / 2 + 1]; - System.arraycopy(builtInAlgorithmState.booleanArray, 0, - array, 0, builtInAlgorithmState.booleanArray.length); - builtInAlgorithmState.booleanArray = array; - } - - BuiltInEncodingAlgorithmFactory.booleanEncodingAlgorithm. - decodeFromBytesToBooleanArray( - builtInAlgorithmState.booleanArray, 0, length, - _octetBuffer, _octetBufferStart, _octetBufferLength); - _primitiveHandler.booleans(builtInAlgorithmState.booleanArray, 0, length); - break; - case EncodingAlgorithmIndexes.FLOAT: - length = BuiltInEncodingAlgorithmFactory.floatEncodingAlgorithm. - getPrimtiveLengthFromOctetLength(_octetBufferLength); - if (length > builtInAlgorithmState.floatArray.length) { - final float[] array = new float[length * 3 / 2 + 1]; - System.arraycopy(builtInAlgorithmState.floatArray, 0, - array, 0, builtInAlgorithmState.floatArray.length); - builtInAlgorithmState.floatArray = array; - } - - BuiltInEncodingAlgorithmFactory.floatEncodingAlgorithm. - decodeFromBytesToFloatArray(builtInAlgorithmState.floatArray, 0, - _octetBuffer, _octetBufferStart, _octetBufferLength); - _primitiveHandler.floats(builtInAlgorithmState.floatArray, 0, length); - break; - case EncodingAlgorithmIndexes.DOUBLE: - length = BuiltInEncodingAlgorithmFactory.doubleEncodingAlgorithm. - getPrimtiveLengthFromOctetLength(_octetBufferLength); - if (length > builtInAlgorithmState.doubleArray.length) { - final double[] array = new double[length * 3 / 2 + 1]; - System.arraycopy(builtInAlgorithmState.doubleArray, 0, - array, 0, builtInAlgorithmState.doubleArray.length); - builtInAlgorithmState.doubleArray = array; - } - - BuiltInEncodingAlgorithmFactory.doubleEncodingAlgorithm. - decodeFromBytesToDoubleArray(builtInAlgorithmState.doubleArray, 0, - _octetBuffer, _octetBufferStart, _octetBufferLength); - _primitiveHandler.doubles(builtInAlgorithmState.doubleArray, 0, length); - break; - case EncodingAlgorithmIndexes.UUID: - length = BuiltInEncodingAlgorithmFactory.uuidEncodingAlgorithm. - getPrimtiveLengthFromOctetLength(_octetBufferLength); - if (length > builtInAlgorithmState.longArray.length) { - final long[] array = new long[length * 3 / 2 + 1]; - System.arraycopy(builtInAlgorithmState.longArray, 0, - array, 0, builtInAlgorithmState.longArray.length); - builtInAlgorithmState.longArray = array; - } - - BuiltInEncodingAlgorithmFactory.uuidEncodingAlgorithm. - decodeFromBytesToLongArray(builtInAlgorithmState.longArray, 0, - _octetBuffer, _octetBufferStart, _octetBufferLength); - _primitiveHandler.uuids(builtInAlgorithmState.longArray, 0, length); - break; - case EncodingAlgorithmIndexes.CDATA: - throw new UnsupportedOperationException("CDATA"); - default: - throw new FastInfosetException(CommonResourceBundle.getInstance(). - getString("message.unsupportedAlgorithm", new Object[]{Integer.valueOf(_identifier)})); - } - } catch (SAXException e) { - throw new FastInfosetException(e); - } - } - - - protected final void processAIIEncodingAlgorithm(QualifiedName name, boolean addToTable) throws FastInfosetException, IOException { - if (_identifier < EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - if (_primitiveHandler != null || _algorithmHandler != null) { - Object data = processBuiltInEncodingAlgorithmAsObject(); - _attributes.addAttributeWithAlgorithmData(name, null, _identifier, data); - } else { - StringBuffer buffer = new StringBuffer(); - processBuiltInEncodingAlgorithmAsCharacters(buffer); - _attributes.addAttribute(name, buffer.toString()); - } - } else if (_identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START && _algorithmHandler != null) { - final String URI = _v.encodingAlgorithm.get(_identifier - EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START); - if (URI == null) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance(). - getString("message.URINotPresent", new Object[]{Integer.valueOf(_identifier)})); - } - - final EncodingAlgorithm ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI); - if (ea != null) { - final Object data = ea.decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength); - _attributes.addAttributeWithAlgorithmData(name, URI, _identifier, data); - } else { - final byte[] data = new byte[_octetBufferLength]; - System.arraycopy(_octetBuffer, _octetBufferStart, data, 0, _octetBufferLength); - _attributes.addAttributeWithAlgorithmData(name, URI, _identifier, data); - } - } else if (_identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - // TODO should have property to ignore - throw new EncodingAlgorithmException( - CommonResourceBundle.getInstance().getString("message.algorithmDataCannotBeReported")); - } else if (_identifier == EncodingAlgorithmIndexes.CDATA) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.CDATAAlgorithmNotSupported")); - } else { - // Reserved built-in algorithms for future use - // TODO should use sax property to decide if event will be - // reported, allows for support through handler if required. - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.identifiers10to31Reserved")); - } - - if (addToTable) { - _attributeValueTable.add(_attributes.getValue(_attributes.getIndex(name.qName))); - } - } - - protected final void processBuiltInEncodingAlgorithmAsCharacters(StringBuffer buffer) throws FastInfosetException, IOException { - // TODO not very efficient, need to reuse buffers - Object array = BuiltInEncodingAlgorithmFactory.getAlgorithm(_identifier). - decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength); - - BuiltInEncodingAlgorithmFactory.getAlgorithm(_identifier).convertToCharacters(array, buffer); - } - - protected final Object processBuiltInEncodingAlgorithmAsObject() throws FastInfosetException, IOException { - return BuiltInEncodingAlgorithmFactory.getAlgorithm(_identifier). - decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/sax/SAXDocumentSerializer.java 2018-01-30 20:36:56.000000000 -0500 +++ /dev/null 2018-01-30 20:36:56.000000000 -0500 @@ -1,597 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.sax; - -import com.sun.xml.internal.fastinfoset.Encoder; -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetWriter; -import com.sun.xml.internal.fastinfoset.util.LocalNameQualifiedNamesMap; -import java.io.IOException; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import com.sun.xml.internal.org.jvnet.fastinfoset.RestrictedAlphabet; -import com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmAttributes; -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -/** - * The Fast Infoset SAX serializer. - *

- * Instantiate this serializer to serialize a fast infoset document in accordance - * with the SAX API. - *

- * This utilizes the SAX API in a reverse manner to that of parsing. It is the - * responsibility of the client to call the appropriate event methods on the - * SAX handlers, and to ensure that such a sequence of methods calls results - * in the production well-formed fast infoset documents. The - * SAXDocumentSerializer performs no well-formed checks. - * - *

- * More than one fast infoset document may be encoded to the - * {@link java.io.OutputStream}. - */ -public class SAXDocumentSerializer extends Encoder implements FastInfosetWriter { - protected boolean _elementHasNamespaces = false; - - protected boolean _charactersAsCDATA = false; - - protected SAXDocumentSerializer(boolean v) { - super(v); - } - - public SAXDocumentSerializer() { - } - - - public void reset() { - super.reset(); - - _elementHasNamespaces = false; - _charactersAsCDATA = false; - } - - // ContentHandler - - public final void startDocument() throws SAXException { - try { - reset(); - encodeHeader(false); - encodeInitialVocabulary(); - } catch (IOException e) { - throw new SAXException("startDocument", e); - } - } - - public final void endDocument() throws SAXException { - try { - encodeDocumentTermination(); - } catch (IOException e) { - throw new SAXException("endDocument", e); - } - } - - public void startPrefixMapping(String prefix, String uri) throws SAXException { - try { - if (_elementHasNamespaces == false) { - encodeTermination(); - - // Mark the current buffer position to flag attributes if necessary - mark(); - _elementHasNamespaces = true; - - // Write out Element byte with namespaces - write(EncodingConstants.ELEMENT | EncodingConstants.ELEMENT_NAMESPACES_FLAG); - } - - encodeNamespaceAttribute(prefix, uri); - } catch (IOException e) { - throw new SAXException("startElement", e); - } - } - - public final void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - // TODO consider using buffer for encoding of attributes, then pre-counting is not necessary - final int attributeCount = (atts != null && atts.getLength() > 0) - ? countAttributes(atts) : 0; - try { - if (_elementHasNamespaces) { - _elementHasNamespaces = false; - - if (attributeCount > 0) { - // Flag the marked byte with attributes - _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG; - } - resetMark(); - - write(EncodingConstants.TERMINATOR); - - _b = 0; - } else { - encodeTermination(); - - _b = EncodingConstants.ELEMENT; - if (attributeCount > 0) { - _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG; - } - } - - encodeElement(namespaceURI, qName, localName); - - if (attributeCount > 0) { - encodeAttributes(atts); - } - } catch (IOException e) { - throw new SAXException("startElement", e); - } catch (FastInfosetException e) { - throw new SAXException("startElement", e); - } - } - - public final void endElement(String namespaceURI, String localName, String qName) throws SAXException { - try { - encodeElementTermination(); - } catch (IOException e) { - throw new SAXException("endElement", e); - } - } - - public final void characters(char[] ch, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(ch, start, length)) return; - - try { - encodeTermination(); - - if (!_charactersAsCDATA) { - encodeCharacters(ch, start, length); - } else { - encodeCIIBuiltInAlgorithmDataAsCDATA(ch, start, length); - } - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public final void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { - if (getIgnoreWhiteSpaceTextContent()) return; - - characters(ch, start, length); - } - - public final void processingInstruction(String target, String data) throws SAXException { - try { - if (getIgnoreProcesingInstructions()) return; - - if (target.length() == 0) { - throw new SAXException(CommonResourceBundle.getInstance(). - getString("message.processingInstructionTargetIsEmpty")); - } - encodeTermination(); - - encodeProcessingInstruction(target, data); - } catch (IOException e) { - throw new SAXException("processingInstruction", e); - } - } - - public final void setDocumentLocator(org.xml.sax.Locator locator) { - } - - public final void skippedEntity(String name) throws SAXException { - } - - - - // LexicalHandler - - public final void comment(char[] ch, int start, int length) throws SAXException { - try { - if (getIgnoreComments()) return; - - encodeTermination(); - - encodeComment(ch, start, length); - } catch (IOException e) { - throw new SAXException("startElement", e); - } - } - - public final void startCDATA() throws SAXException { - _charactersAsCDATA = true; - } - - public final void endCDATA() throws SAXException { - _charactersAsCDATA = false; - } - - public final void startDTD(String name, String publicId, String systemId) throws SAXException { - if (getIgnoreDTD()) return; - - try { - encodeTermination(); - - encodeDocumentTypeDeclaration(publicId, systemId); - encodeElementTermination(); - } catch (IOException e) { - throw new SAXException("startDTD", e); - } - } - - public final void endDTD() throws SAXException { - } - - public final void startEntity(String name) throws SAXException { - } - - public final void endEntity(String name) throws SAXException { - } - - - // EncodingAlgorithmContentHandler - - public final void octets(String URI, int id, byte[] b, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - encodeNonIdentifyingStringOnThirdBit(URI, id, b, start, length); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public final void object(String URI, int id, Object data) throws SAXException { - try { - encodeTermination(); - - encodeNonIdentifyingStringOnThirdBit(URI, id, data); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - - // PrimitiveTypeContentHandler - - public final void bytes(byte[] b, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - encodeCIIOctetAlgorithmData(EncodingAlgorithmIndexes.BASE64, b, start, length); - } catch (IOException e) { - throw new SAXException(e); - } - } - - public final void shorts(short[] s, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - encodeCIIBuiltInAlgorithmData(EncodingAlgorithmIndexes.SHORT, s, start, length); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public final void ints(int[] i, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - encodeCIIBuiltInAlgorithmData(EncodingAlgorithmIndexes.INT, i, start, length); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public final void longs(long[] l, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - encodeCIIBuiltInAlgorithmData(EncodingAlgorithmIndexes.LONG, l, start, length); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public final void booleans(boolean[] b, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - encodeCIIBuiltInAlgorithmData(EncodingAlgorithmIndexes.BOOLEAN, b, start, length); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public final void floats(float[] f, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - encodeCIIBuiltInAlgorithmData(EncodingAlgorithmIndexes.FLOAT, f, start, length); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public final void doubles(double[] d, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - encodeCIIBuiltInAlgorithmData(EncodingAlgorithmIndexes.DOUBLE, d, start, length); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public void uuids(long[] msblsb, int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - encodeCIIBuiltInAlgorithmData(EncodingAlgorithmIndexes.UUID, msblsb, start, length); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - - // RestrictedAlphabetContentHandler - - public void numericCharacters(char ch[], int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - final boolean addToTable = isCharacterContentChunkLengthMatchesLimit(length); - encodeNumericFourBitCharacters(ch, start, length, addToTable); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public void dateTimeCharacters(char ch[], int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - final boolean addToTable = isCharacterContentChunkLengthMatchesLimit(length); - encodeDateTimeFourBitCharacters(ch, start, length, addToTable); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - public void alphabetCharacters(String alphabet, char ch[], int start, int length) throws SAXException { - if (length <= 0) { - return; - } - - try { - encodeTermination(); - - final boolean addToTable = isCharacterContentChunkLengthMatchesLimit(length); - encodeAlphabetCharacters(alphabet, ch, start, length, addToTable); - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - // ExtendedContentHandler - - public void characters(char[] ch, int start, int length, boolean index) throws SAXException { - if (length <= 0) { - return; - } - - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(ch, start, length)) return; - - try { - encodeTermination(); - - if (!_charactersAsCDATA) { - encodeNonIdentifyingStringOnThirdBit(ch, start, length, _v.characterContentChunk, index, true); - } else { - encodeCIIBuiltInAlgorithmDataAsCDATA(ch, start, length); - } - } catch (IOException e) { - throw new SAXException(e); - } catch (FastInfosetException e) { - throw new SAXException(e); - } - } - - - - protected final int countAttributes(Attributes atts) { - // Count attributes ignoring any in the XMLNS namespace - // Note, such attributes may be produced when transforming from a DOM node - int count = 0; - for (int i = 0; i < atts.getLength(); i++) { - final String uri = atts.getURI(i); - if (uri == "http://www.w3.org/2000/xmlns/" || uri.equals("http://www.w3.org/2000/xmlns/")) { - continue; - } - count++; - } - return count; - } - - protected void encodeAttributes(Attributes atts) throws IOException, FastInfosetException { - boolean addToTable; - boolean mustBeAddedToTable; - String value; - if (atts instanceof EncodingAlgorithmAttributes) { - final EncodingAlgorithmAttributes eAtts = (EncodingAlgorithmAttributes)atts; - Object data; - String alphabet; - for (int i = 0; i < eAtts.getLength(); i++) { - if (encodeAttribute(atts.getURI(i), atts.getQName(i), atts.getLocalName(i))) { - data = eAtts.getAlgorithmData(i); - // If data is null then there is no algorithm data - if (data == null) { - value = eAtts.getValue(i); - addToTable = isAttributeValueLengthMatchesLimit(value.length()); - mustBeAddedToTable = eAtts.getToIndex(i); - - alphabet = eAtts.getAlpababet(i); - if (alphabet == null) { - encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, mustBeAddedToTable); - } else if (alphabet == RestrictedAlphabet.DATE_TIME_CHARACTERS) { - encodeDateTimeNonIdentifyingStringOnFirstBit( - value, addToTable, mustBeAddedToTable); - } else if (alphabet == RestrictedAlphabet.NUMERIC_CHARACTERS) { - encodeNumericNonIdentifyingStringOnFirstBit( - value, addToTable, mustBeAddedToTable); - } else { - encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, mustBeAddedToTable); - } - } else { - encodeNonIdentifyingStringOnFirstBit(eAtts.getAlgorithmURI(i), - eAtts.getAlgorithmIndex(i), data); - } - } - } - } else { - for (int i = 0; i < atts.getLength(); i++) { - if (encodeAttribute(atts.getURI(i), atts.getQName(i), atts.getLocalName(i))) { - value = atts.getValue(i); - addToTable = isAttributeValueLengthMatchesLimit(value.length()); - encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false); - } - } - } - _b = EncodingConstants.TERMINATOR; - _terminate = true; - } - - protected void encodeElement(String namespaceURI, String qName, String localName) throws IOException { - LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(qName); - if (entry._valueIndex > 0) { - QualifiedName[] names = entry._value; - for (int i = 0; i < entry._valueIndex; i++) { - final QualifiedName n = names[i]; - if ((namespaceURI == n.namespaceName || namespaceURI.equals(n.namespaceName))) { - encodeNonZeroIntegerOnThirdBit(names[i].index); - return; - } - } - } - - encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefixFromQualifiedName(qName), - localName, entry); - } - - protected boolean encodeAttribute(String namespaceURI, String qName, String localName) throws IOException { - LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(qName); - if (entry._valueIndex > 0) { - QualifiedName[] names = entry._value; - for (int i = 0; i < entry._valueIndex; i++) { - if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) { - encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index); - return true; - } - } - } - - return encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefixFromQualifiedName(qName), - localName, entry); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/sax/SAXDocumentSerializerWithPrefixMapping.java 2018-01-30 20:36:57.000000000 -0500 +++ /dev/null 2018-01-30 20:36:57.000000000 -0500 @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.sax; - -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.util.KeyIntMap; -import com.sun.xml.internal.fastinfoset.util.LocalNameQualifiedNamesMap; -import com.sun.xml.internal.fastinfoset.util.StringIntMap; -import java.io.IOException; -import java.util.HashMap; -import org.xml.sax.SAXException; -import java.util.Map; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import com.sun.xml.internal.org.jvnet.fastinfoset.RestrictedAlphabet; -import com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmAttributes; -import org.xml.sax.Attributes; - -/** - * The Fast Infoset SAX serializer that maps prefixes to user specified prefixes - * that are specified in a namespace URI to prefix map. - *

- * This serializer will not preserve the original prefixes and this serializer - * should not be used when prefixes need to be preserved, such as the case - * when there are qualified names in content. - *

- * A namespace URI to prefix map is utilized such that the prefixes - * in the map are utilized rather than the prefixes specified in - * the qualified name for elements and attributes. - *

- * Any namespace declarations with a namespace URI that is not present in - * the map are added. - *

- */ -public class SAXDocumentSerializerWithPrefixMapping extends SAXDocumentSerializer { - protected Map _namespaceToPrefixMapping; - protected Map _prefixToPrefixMapping; - protected String _lastCheckedNamespace; - protected String _lastCheckedPrefix; - - protected StringIntMap _declaredNamespaces; - - public SAXDocumentSerializerWithPrefixMapping(Map namespaceToPrefixMapping) { - // Use the local name to look up elements/attributes - super(true); - _namespaceToPrefixMapping = new HashMap(namespaceToPrefixMapping); - _prefixToPrefixMapping = new HashMap(); - - // Empty prefix - _namespaceToPrefixMapping.put("", ""); - // 'xml' prefix - _namespaceToPrefixMapping.put(EncodingConstants.XML_NAMESPACE_NAME, EncodingConstants.XML_NAMESPACE_PREFIX); - - _declaredNamespaces = new StringIntMap(4); - } - - public final void startPrefixMapping(String prefix, String uri) throws SAXException { - try { - if (_elementHasNamespaces == false) { - encodeTermination(); - - // Mark the current buffer position to flag attributes if necessary - mark(); - _elementHasNamespaces = true; - - // Write out Element byte with namespaces - write(EncodingConstants.ELEMENT | EncodingConstants.ELEMENT_NAMESPACES_FLAG); - - _declaredNamespaces.clear(); - _declaredNamespaces.obtainIndex(uri); - } else { - if (_declaredNamespaces.obtainIndex(uri) != KeyIntMap.NOT_PRESENT) { - final String p = getPrefix(uri); - if (p != null) { - _prefixToPrefixMapping.put(prefix, p); - } - return; - } - } - - final String p = getPrefix(uri); - if (p != null) { - encodeNamespaceAttribute(p, uri); - _prefixToPrefixMapping.put(prefix, p); - } else { - putPrefix(uri, prefix); - encodeNamespaceAttribute(prefix, uri); - } - - } catch (IOException e) { - throw new SAXException("startElement", e); - } - } - - protected final void encodeElement(String namespaceURI, String qName, String localName) throws IOException { - LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName); - if (entry._valueIndex > 0) { - if (encodeElementMapEntry(entry, namespaceURI)) return; - // Check the entry is a member of the read only map - if (_v.elementName.isQNameFromReadOnlyMap(entry._value[0])) { - entry = _v.elementName.obtainDynamicEntry(localName); - if (entry._valueIndex > 0) { - if (encodeElementMapEntry(entry, namespaceURI)) return; - } - } - } - - encodeLiteralElementQualifiedNameOnThirdBit(namespaceURI, getPrefix(namespaceURI), - localName, entry); - } - - protected boolean encodeElementMapEntry(LocalNameQualifiedNamesMap.Entry entry, String namespaceURI) throws IOException { - QualifiedName[] names = entry._value; - for (int i = 0; i < entry._valueIndex; i++) { - if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) { - encodeNonZeroIntegerOnThirdBit(names[i].index); - return true; - } - } - return false; - } - - - protected final void encodeAttributes(Attributes atts) throws IOException, FastInfosetException { - boolean addToTable; - boolean mustToBeAddedToTable; - String value; - if (atts instanceof EncodingAlgorithmAttributes) { - final EncodingAlgorithmAttributes eAtts = (EncodingAlgorithmAttributes)atts; - Object data; - String alphabet; - for (int i = 0; i < eAtts.getLength(); i++) { - final String uri = atts.getURI(i); - if (encodeAttribute(uri, atts.getQName(i), atts.getLocalName(i))) { - data = eAtts.getAlgorithmData(i); - // If data is null then there is no algorithm data - if (data == null) { - value = eAtts.getValue(i); - addToTable = isAttributeValueLengthMatchesLimit(value.length()); - mustToBeAddedToTable = eAtts.getToIndex(i); - alphabet = eAtts.getAlpababet(i); - if (alphabet == null) { - if (uri == "http://www.w3.org/2001/XMLSchema-instance" || - uri.equals("http://www.w3.org/2001/XMLSchema-instance")) { - value = convertQName(value); - } - encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, mustToBeAddedToTable); - } else if (alphabet == RestrictedAlphabet.DATE_TIME_CHARACTERS) { - encodeDateTimeNonIdentifyingStringOnFirstBit( - value, addToTable, mustToBeAddedToTable); - } else if (alphabet == RestrictedAlphabet.NUMERIC_CHARACTERS) { - encodeNumericNonIdentifyingStringOnFirstBit( - value, addToTable, mustToBeAddedToTable); - } else { - encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, mustToBeAddedToTable); - } - } else { - encodeNonIdentifyingStringOnFirstBit(eAtts.getAlgorithmURI(i), - eAtts.getAlgorithmIndex(i), data); - } - } - } - } else { - for (int i = 0; i < atts.getLength(); i++) { - final String uri = atts.getURI(i); - if (encodeAttribute(atts.getURI(i), atts.getQName(i), atts.getLocalName(i))) { - value = atts.getValue(i); - addToTable = isAttributeValueLengthMatchesLimit(value.length()); - - if (uri == "http://www.w3.org/2001/XMLSchema-instance" || - uri.equals("http://www.w3.org/2001/XMLSchema-instance")) { - value = convertQName(value); - } - encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false); - } - } - } - _b = EncodingConstants.TERMINATOR; - _terminate = true; - } - - private String convertQName(String qName) { - int i = qName.indexOf(':'); - String prefix = ""; - String localName = qName; - if (i != -1) { - prefix = qName.substring(0, i); - localName = qName.substring(i + 1); - } - - String p = (String)_prefixToPrefixMapping.get(prefix); - if (p != null) { - if (p.length() == 0) - return localName; - else - return p + ":" + localName; - } else { - return qName; - } - } - - protected final boolean encodeAttribute(String namespaceURI, String qName, String localName) throws IOException { - LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName); - if (entry._valueIndex > 0) { - if (encodeAttributeMapEntry(entry, namespaceURI)) return true; - // Check the entry is a member of the read only map - if (_v.attributeName.isQNameFromReadOnlyMap(entry._value[0])) { - entry = _v.attributeName.obtainDynamicEntry(localName); - if (entry._valueIndex > 0) { - if (encodeAttributeMapEntry(entry, namespaceURI)) return true; - } - } - } - - return encodeLiteralAttributeQualifiedNameOnSecondBit(namespaceURI, getPrefix(namespaceURI), - localName, entry); - } - - protected boolean encodeAttributeMapEntry(LocalNameQualifiedNamesMap.Entry entry, String namespaceURI) throws IOException { - QualifiedName[] names = entry._value; - for (int i = 0; i < entry._valueIndex; i++) { - if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) { - encodeNonZeroIntegerOnSecondBitFirstBitZero(names[i].index); - return true; - } - } - return false; - } - - protected final String getPrefix(String namespaceURI) { - if (_lastCheckedNamespace == namespaceURI) return _lastCheckedPrefix; - - _lastCheckedNamespace = namespaceURI; - return _lastCheckedPrefix = (String)_namespaceToPrefixMapping.get(namespaceURI); - } - - protected final void putPrefix(String namespaceURI, String prefix) { - _namespaceToPrefixMapping.put(namespaceURI, prefix); - - _lastCheckedNamespace = namespaceURI; - _lastCheckedPrefix = prefix; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/sax/SystemIdResolver.java 2018-01-30 20:36:58.000000000 -0500 +++ /dev/null 2018-01-30 20:36:58.000000000 -0500 @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.sax; - -import java.io.*; - -public class SystemIdResolver { - - public SystemIdResolver() { - } - - public static String getAbsoluteURIFromRelative(String localPath) { - if (localPath == null || localPath.length() == 0) { - return ""; - } - - String absolutePath = localPath; - if (!isAbsolutePath(localPath)) { - try { - absolutePath = getAbsolutePathFromRelativePath(localPath); - } - catch (SecurityException se) { - return "file:" + localPath; - } - } - - String urlString; - if (null != absolutePath) { - urlString = absolutePath.startsWith(File.separator) ? - ("file://" + absolutePath) : - ("file:///" + absolutePath); - } - else { - urlString = "file:" + localPath; - } - - return replaceChars(urlString); - } - - private static String getAbsolutePathFromRelativePath(String relativePath) { - return new File(relativePath).getAbsolutePath(); - } - - public static boolean isAbsoluteURI(String systemId) { - if (systemId == null) { - return false; - } - - if (isWindowsAbsolutePath(systemId)) { - return false; - } - - final int fragmentIndex = systemId.indexOf('#'); - final int queryIndex = systemId.indexOf('?'); - final int slashIndex = systemId.indexOf('/'); - final int colonIndex = systemId.indexOf(':'); - - int index = systemId.length() -1; - if (fragmentIndex > 0) { - index = fragmentIndex; - } - if (queryIndex > 0 && queryIndex < index) { - index = queryIndex; - } - if (slashIndex > 0 && slashIndex 0) && (colonIndex < index); - } - - public static boolean isAbsolutePath(String systemId) { - if(systemId == null) - return false; - final File file = new File(systemId); - return file.isAbsolute(); - - } - - private static boolean isWindowsAbsolutePath(String systemId) { - if(!isAbsolutePath(systemId)) - return false; - if (systemId.length() > 2 - && systemId.charAt(1) == ':' - && Character.isLetter(systemId.charAt(0)) - && (systemId.charAt(2) == '\\' || systemId.charAt(2) == '/')) - return true; - else - return false; - } - - private static String replaceChars(String str) { - StringBuffer buf = new StringBuffer(str); - int length = buf.length(); - for (int i = 0; i < length; i++) { - char currentChar = buf.charAt(i); - // Replace space with "%20" - if (currentChar == ' ') { - buf.setCharAt(i, '%'); - buf.insert(i+1, "20"); - length = length + 2; - i = i + 2; - } - // Replace backslash with forward slash - else if (currentChar == '\\') { - buf.setCharAt(i, '/'); - } - } - - return buf.toString(); - } - - public static String getAbsoluteURI(String systemId) { - String absoluteURI = systemId; - if (isAbsoluteURI(systemId)) { - if (systemId.startsWith("file:")) { - String str = systemId.substring(5); - - if (str != null && str.startsWith("/")) { - if (str.startsWith("///") || !str.startsWith("//")) { - int secondColonIndex = systemId.indexOf(':', 5); - if (secondColonIndex > 0) { - String localPath = systemId.substring(secondColonIndex-1); - try { - if (!isAbsolutePath(localPath)) - absoluteURI = systemId.substring(0, secondColonIndex-1) + - getAbsolutePathFromRelativePath(localPath); - } - catch (SecurityException se) { - return systemId; - } - } - } - } - else { - return getAbsoluteURIFromRelative(systemId.substring(5)); - } - - return replaceChars(absoluteURI); - } - else { - return systemId; - } - } - else { - return getAbsoluteURIFromRelative(systemId); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/EventLocation.java 2018-01-30 20:36:59.000000000 -0500 +++ /dev/null 2018-01-30 20:36:59.000000000 -0500 @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax; - -import javax.xml.stream.Location; - - -public class EventLocation implements Location{ - String _systemId = null; - String _publicId = null; - int _column = -1; - int _line = -1; - int _charOffset = -1; - - EventLocation() { - } - - //explicitly create a nil location - public static Location getNilLocation() { - return new EventLocation(); - } - /** - * Return the line number where the current event ends, - * returns -1 if none is available. - * @return the current line number - */ - public int getLineNumber(){ - return _line; - } - /** - * Return the column number where the current event ends, - * returns -1 if none is available. - * @return the current column number - */ - public int getColumnNumber() { - return _column; - } - - /** - * Return the byte or character offset into the input source this location - * is pointing to. If the input source is a file or a byte stream then - * this is the byte offset into that stream, but if the input source is - * a character media then the offset is the character offset. - * Returns -1 if there is no offset available. - * @return the current offset - */ - public int getCharacterOffset(){ - return _charOffset; - } - - /** - * Returns the public ID of the XML - * @return the public ID, or null if not available - */ - public String getPublicId(){ - return _publicId; - } - - /** - * Returns the system ID of the XML - * @return the system ID, or null if not available - */ - public String getSystemId(){ - return _systemId; - } - - public void setLineNumber(int line) { - _line = line; - } - public void setColumnNumber(int col) { - _column = col; - } - public void setCharacterOffset(int offset) { - _charOffset = offset; - } - public void setPublicId(String id) { - _publicId = id; - } - public void setSystemId(String id) { - _systemId = id; - } - - public String toString(){ - StringBuffer sbuffer = new StringBuffer() ; - sbuffer.append("Line number = " + _line); - sbuffer.append("\n") ; - sbuffer.append("Column number = " + _column); - sbuffer.append("\n") ; - sbuffer.append("System Id = " + _systemId); - sbuffer.append("\n") ; - sbuffer.append("Public Id = " + _publicId); - sbuffer.append("\n") ; - sbuffer.append("CharacterOffset = " + _charOffset); - sbuffer.append("\n") ; - return sbuffer.toString(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/StAXDocumentParser.java 2018-01-30 20:36:59.000000000 -0500 +++ /dev/null 2018-01-30 20:36:59.000000000 -0500 @@ -1,1878 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax; - -import com.sun.xml.internal.fastinfoset.Decoder; -import com.sun.xml.internal.fastinfoset.DecoderStateTables; -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.OctetBufferListener; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.algorithm.BuiltInEncodingAlgorithmFactory; -import com.sun.xml.internal.fastinfoset.sax.AttributesHolder; -import com.sun.xml.internal.fastinfoset.util.CharArray; -import com.sun.xml.internal.fastinfoset.util.CharArrayString; -import java.io.IOException; -import java.io.InputStream; -import java.util.Iterator; -import java.util.NoSuchElementException; -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 com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; -import com.sun.xml.internal.fastinfoset.org.apache.xerces.util.XMLChar; -import com.sun.xml.internal.fastinfoset.util.DuplicateAttributeVerifier; -import java.util.logging.Level; -import java.util.logging.Logger; -import com.sun.xml.internal.org.jvnet.fastinfoset.stax.FastInfosetStreamReader; - -/** - * The Fast Infoset StAX parser. - *

- * Instantiate this parser to parse a fast infoset document in accordance - * with the StAX API. - * - *

- * More than one fast infoset document may be decoded from the - * {@link java.io.InputStream}. - */ -public class StAXDocumentParser extends Decoder - implements XMLStreamReader, FastInfosetStreamReader, OctetBufferListener { - private static final Logger logger = Logger.getLogger(StAXDocumentParser.class.getName()); - - protected static final int INTERNAL_STATE_START_DOCUMENT = 0; - protected static final int INTERNAL_STATE_START_ELEMENT_TERMINATE = 1; - protected static final int INTERNAL_STATE_SINGLE_TERMINATE_ELEMENT_WITH_NAMESPACES = 2; - protected static final int INTERNAL_STATE_DOUBLE_TERMINATE_ELEMENT = 3; - protected static final int INTERNAL_STATE_END_DOCUMENT = 4; - protected static final int INTERNAL_STATE_VOID = -1; - - protected int _internalState; - - /** - * Current event - */ - protected int _eventType; - - /** - * Stack of qualified names and namespaces - */ - protected QualifiedName[] _qNameStack = new QualifiedName[32]; - protected int[] _namespaceAIIsStartStack = new int[32]; - protected int[] _namespaceAIIsEndStack = new int[32]; - protected int _stackCount = -1; - - protected String[] _namespaceAIIsPrefix = new String[32]; - protected String[] _namespaceAIIsNamespaceName = new String[32]; - protected int[] _namespaceAIIsPrefixIndex = new int[32]; - protected int _namespaceAIIsIndex; - - /** - * Namespaces associated with START_ELEMENT or END_ELEMENT - */ - protected int _currentNamespaceAIIsStart; - protected int _currentNamespaceAIIsEnd; - - /** - * Qualified name associated with START_ELEMENT or END_ELEMENT. - */ - protected QualifiedName _qualifiedName; - - /** - * List of attributes - */ - protected AttributesHolder _attributes = new AttributesHolder(); - - protected boolean _clearAttributes = false; - - /** - * Characters associated with event. - */ - protected char[] _characters; - protected int _charactersOffset; - - protected String _algorithmURI; - protected int _algorithmId; - protected boolean _isAlgorithmDataCloned; - protected byte[] _algorithmData; - protected int _algorithmDataOffset; - protected int _algorithmDataLength; - - /** - * State for processing instruction - */ - protected String _piTarget; - protected String _piData; - - protected NamespaceContextImpl _nsContext = new NamespaceContextImpl(); - - protected String _characterEncodingScheme; - - protected StAXManager _manager; - - public StAXDocumentParser() { - reset(); - _manager = new StAXManager(StAXManager.CONTEXT_READER); - } - - public StAXDocumentParser(InputStream s) { - this(); - setInputStream(s); - _manager = new StAXManager(StAXManager.CONTEXT_READER); - } - - public StAXDocumentParser(InputStream s, StAXManager manager) { - this(s); - _manager = manager; - } - - @Override - public void setInputStream(InputStream s) { - super.setInputStream(s); - reset(); - } - - @Override - public void reset() { - super.reset(); - if (_internalState != INTERNAL_STATE_START_DOCUMENT && - _internalState != INTERNAL_STATE_END_DOCUMENT) { - - for (int i = _namespaceAIIsIndex - 1; i >= 0; i--) { - _prefixTable.popScopeWithPrefixEntry(_namespaceAIIsPrefixIndex[i]); - } - - _stackCount = -1; - - _namespaceAIIsIndex = 0; - _characters = null; - _algorithmData = null; - } - - _characterEncodingScheme = "UTF-8"; - _eventType = START_DOCUMENT; - _internalState = INTERNAL_STATE_START_DOCUMENT; - } - - protected void resetOnError() { - super.reset(); - - if (_v != null) { - _prefixTable.clearCompletely(); - } - _duplicateAttributeVerifier.clear(); - - _stackCount = -1; - - _namespaceAIIsIndex = 0; - _characters = null; - _algorithmData = null; - - _eventType = START_DOCUMENT; - _internalState = INTERNAL_STATE_START_DOCUMENT; - } - - // -- XMLStreamReader Interface ------------------------------------------- - - public Object getProperty(java.lang.String name) - throws java.lang.IllegalArgumentException { - if (_manager != null) { - return _manager.getProperty(name); - } - return null; - } - - public int next() throws XMLStreamException { - try { - if (_internalState != INTERNAL_STATE_VOID) { - switch (_internalState) { - case INTERNAL_STATE_START_DOCUMENT: - decodeHeader(); - processDII(); - - _internalState = INTERNAL_STATE_VOID; - break; - case INTERNAL_STATE_START_ELEMENT_TERMINATE: - if (_currentNamespaceAIIsEnd > 0) { - for (int i = _currentNamespaceAIIsEnd - 1; i >= _currentNamespaceAIIsStart; i--) { - _prefixTable.popScopeWithPrefixEntry(_namespaceAIIsPrefixIndex[i]); - } - _namespaceAIIsIndex = _currentNamespaceAIIsStart; - } - - // Pop information off the stack - popStack(); - - _internalState = INTERNAL_STATE_VOID; - return _eventType = END_ELEMENT; - case INTERNAL_STATE_SINGLE_TERMINATE_ELEMENT_WITH_NAMESPACES: - // Undeclare namespaces - for (int i = _currentNamespaceAIIsEnd - 1; i >= _currentNamespaceAIIsStart; i--) { - _prefixTable.popScopeWithPrefixEntry(_namespaceAIIsPrefixIndex[i]); - } - _namespaceAIIsIndex = _currentNamespaceAIIsStart; - _internalState = INTERNAL_STATE_VOID; - break; - case INTERNAL_STATE_DOUBLE_TERMINATE_ELEMENT: - // Undeclare namespaces - if (_currentNamespaceAIIsEnd > 0) { - for (int i = _currentNamespaceAIIsEnd - 1; i >= _currentNamespaceAIIsStart; i--) { - _prefixTable.popScopeWithPrefixEntry(_namespaceAIIsPrefixIndex[i]); - } - _namespaceAIIsIndex = _currentNamespaceAIIsStart; - } - - if (_stackCount == -1) { - _internalState = INTERNAL_STATE_END_DOCUMENT; - return _eventType = END_DOCUMENT; - } - - // Pop information off the stack - popStack(); - - _internalState = (_currentNamespaceAIIsEnd > 0) ? - INTERNAL_STATE_SINGLE_TERMINATE_ELEMENT_WITH_NAMESPACES : - INTERNAL_STATE_VOID; - return _eventType = END_ELEMENT; - case INTERNAL_STATE_END_DOCUMENT: - throw new NoSuchElementException(CommonResourceBundle.getInstance().getString("message.noMoreEvents")); - } - } - - // Reset internal state - _characters = null; - _algorithmData = null; - _currentNamespaceAIIsEnd = 0; - - // Process information item - final int b = read(); - switch(DecoderStateTables.EII(b)) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[b], false); - return _eventType; - case DecoderStateTables.EII_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[b & EncodingConstants.INTEGER_3RD_BIT_SMALL_MASK], true); - return _eventType; - case DecoderStateTables.EII_INDEX_MEDIUM: - processEII(processEIIIndexMedium(b), (b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - return _eventType; - case DecoderStateTables.EII_INDEX_LARGE: - processEII(processEIIIndexLarge(b), (b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - return _eventType; - case DecoderStateTables.EII_LITERAL: - { - final QualifiedName qn = processLiteralQualifiedName( - b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _elementNameTable.getNext()); - _elementNameTable.add(qn); - processEII(qn, (b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - return _eventType; - } - case DecoderStateTables.EII_NAMESPACES: - processEIIWithNamespaces((b & EncodingConstants.ELEMENT_ATTRIBUTE_FLAG) > 0); - return _eventType; - case DecoderStateTables.CII_UTF8_SMALL_LENGTH: - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK) - + 1; - processUtf8CharacterString(b); - return _eventType = CHARACTERS; - case DecoderStateTables.CII_UTF8_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT; - processUtf8CharacterString(b); - return _eventType = CHARACTERS; - case DecoderStateTables.CII_UTF8_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - processUtf8CharacterString(b); - return _eventType = CHARACTERS; - case DecoderStateTables.CII_UTF16_SMALL_LENGTH: - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_MASK) - + 1; - processUtf16CharacterString(b); - return _eventType = CHARACTERS; - case DecoderStateTables.CII_UTF16_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_SMALL_LIMIT; - processUtf16CharacterString(b); - return _eventType = CHARACTERS; - case DecoderStateTables.CII_UTF16_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_7TH_BIT_MEDIUM_LIMIT; - processUtf16CharacterString(b); - return _eventType = CHARACTERS; - case DecoderStateTables.CII_RA: - { - final boolean addToTable = (b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0; - - _identifier = (b & 0x02) << 6; - final int b2 = read(); - _identifier |= (b2 & 0xFC) >> 2; - - decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(b2); - - decodeRestrictedAlphabetAsCharBuffer(); - - if (addToTable) { - _charactersOffset = _characterContentChunkTable.add(_charBuffer, _charBufferLength); - _characters = _characterContentChunkTable._array; - } else { - _characters = _charBuffer; - _charactersOffset = 0; - } - return _eventType = CHARACTERS; - } - case DecoderStateTables.CII_EA: - { - final boolean addToTable = (b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0; - // Decode encoding algorithm integer - _algorithmId = (b & 0x02) << 6; - final int b2 = read(); - _algorithmId |= (b2 & 0xFC) >> 2; - - decodeOctetsOnSeventhBitOfNonIdentifyingStringOnThirdBit(b2); - processCIIEncodingAlgorithm(addToTable); - - if (_algorithmId == EncodingAlgorithmIndexes.CDATA) { - return _eventType = CDATA; - } - - return _eventType = CHARACTERS; - } - case DecoderStateTables.CII_INDEX_SMALL: - { - final int index = b & EncodingConstants.INTEGER_4TH_BIT_SMALL_MASK; - _characterContentChunkTable._cachedIndex = index; - - _characters = _characterContentChunkTable._array; - _charactersOffset = _characterContentChunkTable._offset[index]; - _charBufferLength = _characterContentChunkTable._length[index]; - return _eventType = CHARACTERS; - } - case DecoderStateTables.CII_INDEX_MEDIUM: - { - final int index = (((b & EncodingConstants.INTEGER_4TH_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_4TH_BIT_SMALL_LIMIT; - _characterContentChunkTable._cachedIndex = index; - - _characters = _characterContentChunkTable._array; - _charactersOffset = _characterContentChunkTable._offset[index]; - _charBufferLength = _characterContentChunkTable._length[index]; - return _eventType = CHARACTERS; - } - case DecoderStateTables.CII_INDEX_LARGE: - { - final int index = (((b & EncodingConstants.INTEGER_4TH_BIT_LARGE_MASK) << 16) | - (read() << 8) | - read()) - + EncodingConstants.INTEGER_4TH_BIT_MEDIUM_LIMIT; - _characterContentChunkTable._cachedIndex = index; - - _characters = _characterContentChunkTable._array; - _charactersOffset = _characterContentChunkTable._offset[index]; - _charBufferLength = _characterContentChunkTable._length[index]; - return _eventType = CHARACTERS; - } - case DecoderStateTables.CII_INDEX_LARGE_LARGE: - { - final int index = ((read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.INTEGER_4TH_BIT_LARGE_LIMIT; - _characterContentChunkTable._cachedIndex = index; - - _characters = _characterContentChunkTable._array; - _charactersOffset = _characterContentChunkTable._offset[index]; - _charBufferLength = _characterContentChunkTable._length[index]; - return _eventType = CHARACTERS; - } - case DecoderStateTables.COMMENT_II: - processCommentII(); - return _eventType; - case DecoderStateTables.PROCESSING_INSTRUCTION_II: - processProcessingII(); - return _eventType; - case DecoderStateTables.UNEXPANDED_ENTITY_REFERENCE_II: - { - processUnexpandedEntityReference(b); - // Skip the reference - return next(); - } - case DecoderStateTables.TERMINATOR_DOUBLE: - if (_stackCount != -1) { - // Pop information off the stack - popStack(); - - _internalState = INTERNAL_STATE_DOUBLE_TERMINATE_ELEMENT; - return _eventType = END_ELEMENT; - } - - _internalState = INTERNAL_STATE_END_DOCUMENT; - return _eventType = END_DOCUMENT; - case DecoderStateTables.TERMINATOR_SINGLE: - if (_stackCount != -1) { - // Pop information off the stack - popStack(); - - if (_currentNamespaceAIIsEnd > 0) { - _internalState = INTERNAL_STATE_SINGLE_TERMINATE_ELEMENT_WITH_NAMESPACES; - } - return _eventType = END_ELEMENT; - } - - _internalState = INTERNAL_STATE_END_DOCUMENT; - return _eventType = END_DOCUMENT; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingEII")); - } - } catch (IOException e) { - resetOnError(); - logger.log(Level.FINE, "next() exception", e); - throw new XMLStreamException(e); - } catch (FastInfosetException e) { - resetOnError(); - logger.log(Level.FINE, "next() exception", e); - throw new XMLStreamException(e); - } catch (RuntimeException e) { - resetOnError(); - logger.log(Level.FINE, "next() exception", e); - throw e; - } - } - - private final void processUtf8CharacterString(final int b) throws IOException { - if ((b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _characterContentChunkTable.ensureSize(_octetBufferLength); - _characters = _characterContentChunkTable._array; - _charactersOffset = _characterContentChunkTable._arrayIndex; - decodeUtf8StringAsCharBuffer(_characterContentChunkTable._array, _charactersOffset); - _characterContentChunkTable.add(_charBufferLength); - } else { - decodeUtf8StringAsCharBuffer(); - _characters = _charBuffer; - _charactersOffset = 0; - } - } - - private final void processUtf16CharacterString(final int b) throws IOException { - decodeUtf16StringAsCharBuffer(); - if ((b & EncodingConstants.CHARACTER_CHUNK_ADD_TO_TABLE_FLAG) > 0) { - _charactersOffset = _characterContentChunkTable.add(_charBuffer, _charBufferLength); - _characters = _characterContentChunkTable._array; - } else { - _characters = _charBuffer; - _charactersOffset = 0; - } - } - - private void popStack() { - // Pop information off the stack - _qualifiedName = _qNameStack[_stackCount]; - _currentNamespaceAIIsStart = _namespaceAIIsStartStack[_stackCount]; - _currentNamespaceAIIsEnd = _namespaceAIIsEndStack[_stackCount]; - _qNameStack[_stackCount--] = null; - } - - /** Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event. - * If the namespaceURI is null it is not checked for equality, if the localName is null it is not checked for equality. - * @param type the event type - * @param namespaceURI the uri of the event, may be null - * @param localName the localName of the event, may be null - * @throws XMLStreamException if the required values are not matched. - */ - public final void require(int type, String namespaceURI, String localName) - throws XMLStreamException { - if( type != _eventType) - throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.eventTypeNotMatch", new Object[]{getEventTypeString(type)})); - if( namespaceURI != null && !namespaceURI.equals(getNamespaceURI()) ) - throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.namespaceURINotMatch", new Object[]{namespaceURI})); - if(localName != null && !localName.equals(getLocalName())) - throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.localNameNotMatch", new Object[]{localName})); - } - - /** Reads the content of a text-only element. Precondition: - * the current event is START_ELEMENT. Postcondition: - * The current event is the corresponding END_ELEMENT. - * @throws XMLStreamException if the current event is not a START_ELEMENT or if - * a non text element is encountered - */ - public final String getElementText() throws XMLStreamException { - - if(getEventType() != START_ELEMENT) { - throw new XMLStreamException( - CommonResourceBundle.getInstance().getString("message.mustBeOnSTARTELEMENT"), getLocation()); - } - //current is StartElement, move to the next - next(); - return getElementText(true); - } - /** - * @param startElementRead flag if start element has already been read - */ - public final String getElementText(boolean startElementRead) throws XMLStreamException { - if (!startElementRead) { - throw new XMLStreamException( - CommonResourceBundle.getInstance().getString("message.mustBeOnSTARTELEMENT"), getLocation()); - } - int eventType = getEventType(); - StringBuilder content = new StringBuilder(); - while(eventType != END_ELEMENT ) { - if(eventType == CHARACTERS - || eventType == CDATA - || eventType == SPACE - || eventType == ENTITY_REFERENCE) { - content.append(getText()); - } else if(eventType == PROCESSING_INSTRUCTION - || eventType == COMMENT) { - // skipping - } else if(eventType == END_DOCUMENT) { - throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.unexpectedEOF")); - } else if(eventType == START_ELEMENT) { - throw new XMLStreamException( - CommonResourceBundle.getInstance().getString("message.getElementTextExpectTextOnly"), getLocation()); - } else { - throw new XMLStreamException( - CommonResourceBundle.getInstance().getString("message.unexpectedEventType")+ getEventTypeString(eventType), getLocation()); - } - eventType = next(); - } - return content.toString(); - } - - /** Skips any white space (isWhiteSpace() returns true), COMMENT, - * or PROCESSING_INSTRUCTION, - * until a START_ELEMENT or END_ELEMENT is reached. - * If other than white space characters, COMMENT, PROCESSING_INSTRUCTION, START_ELEMENT, END_ELEMENT - * are encountered, an exception is thrown. This method should - * be used when processing element-only content seperated by white space. - * This method should - * be used when processing element-only content because - * the parser is not able to recognize ignorable whitespace if - * then DTD is missing or not interpreted. - * @return the event type of the element read - * @throws XMLStreamException if the current event is not white space - */ - public final int nextTag() throws XMLStreamException { - next(); - return nextTag(true); - } - /** if the current tag has already read, such as in the case EventReader's - * peek() has been called, the current cursor should not move before the loop - */ - public final int nextTag(boolean currentTagRead) throws XMLStreamException { - int eventType = getEventType(); - if (!currentTagRead) { - eventType = next(); - } - while((eventType == CHARACTERS && isWhiteSpace()) // skip whitespace - || (eventType == CDATA && isWhiteSpace()) - || eventType == SPACE - || eventType == PROCESSING_INSTRUCTION - || eventType == COMMENT) { - eventType = next(); - } - if (eventType != START_ELEMENT && eventType != END_ELEMENT) { - throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.expectedStartOrEnd"), getLocation()); - } - return eventType; - } - - public final boolean hasNext() throws XMLStreamException { - return (_eventType != END_DOCUMENT); - } - - public void close() throws XMLStreamException { - try { - super.closeIfRequired(); - } catch (IOException ex) { - } - } - - public final String getNamespaceURI(String prefix) { - String namespace = getNamespaceDecl(prefix); - if (namespace == null) { - if (prefix == null) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.nullPrefix")); - } - return null; // unbound - } - return namespace; - } - - public final boolean isStartElement() { - return (_eventType == START_ELEMENT); - } - - public final boolean isEndElement() { - return (_eventType == END_ELEMENT); - } - - public final boolean isCharacters() { - return (_eventType == CHARACTERS); - } - - /** - * Returns true if the cursor points to a character data event that consists of all whitespace - * Application calling this method needs to cache the value and avoid calling this method again - * for the same event. - * @return true if the cursor points to all whitespace, false otherwise - */ - public final boolean isWhiteSpace() { - if(isCharacters() || (_eventType == CDATA)){ - char [] ch = this.getTextCharacters(); - int start = this.getTextStart(); - int length = this.getTextLength(); - for (int i = start; i < start + length; i++){ - if(!XMLChar.isSpace(ch[i])){ - return false; - } - } - return true; - } - return false; - } - - public final String getAttributeValue(String namespaceURI, String localName) { - if (_eventType != START_ELEMENT) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue")); - } - - if (localName == null) - throw new IllegalArgumentException(); - - // Search for the attributes in _attributes - if (namespaceURI != null) { - for (int i = 0; i < _attributes.getLength(); i++) { - if (_attributes.getLocalName(i).equals(localName) && - _attributes.getURI(i).equals(namespaceURI)) { - return _attributes.getValue(i); - } - } - } else { - for (int i = 0; i < _attributes.getLength(); i++) { - if (_attributes.getLocalName(i).equals(localName)) { - return _attributes.getValue(i); - } - } - } - - return null; - } - - public final int getAttributeCount() { - if (_eventType != START_ELEMENT) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue")); - } - - return _attributes.getLength(); - } - - public final javax.xml.namespace.QName getAttributeName(int index) { - if (_eventType != START_ELEMENT) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue")); - } - return _attributes.getQualifiedName(index).getQName(); - } - - public final String getAttributeNamespace(int index) { - if (_eventType != START_ELEMENT) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue")); - } - - return _attributes.getURI(index); - } - - public final String getAttributeLocalName(int index) { - if (_eventType != START_ELEMENT) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue")); - } - return _attributes.getLocalName(index); - } - - public final String getAttributePrefix(int index) { - if (_eventType != START_ELEMENT) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue")); - } - return _attributes.getPrefix(index); - } - - public final String getAttributeType(int index) { - if (_eventType != START_ELEMENT) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue")); - } - return _attributes.getType(index); - } - - public final String getAttributeValue(int index) { - if (_eventType != START_ELEMENT) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue")); - } - return _attributes.getValue(index); - } - - public final boolean isAttributeSpecified(int index) { - return false; // non-validating parser - } - - public final int getNamespaceCount() { - if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) { - return (_currentNamespaceAIIsEnd > 0) ? (_currentNamespaceAIIsEnd - _currentNamespaceAIIsStart) : 0; - } else { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetNamespaceCount")); - } - } - - public final String getNamespacePrefix(int index) { - if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) { - return _namespaceAIIsPrefix[_currentNamespaceAIIsStart + index]; - } else { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetNamespacePrefix")); - } - } - - public final String getNamespaceURI(int index) { - if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) { - return _namespaceAIIsNamespaceName[_currentNamespaceAIIsStart + index]; - } else { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetNamespacePrefix")); - } - } - - public final NamespaceContext getNamespaceContext() { - return _nsContext; - } - - public final int getEventType() { - return _eventType; - } - - public final String getText() { - if (_characters == null) { - checkTextState(); - } - - if (_characters == _characterContentChunkTable._array) { - return _characterContentChunkTable.getString(_characterContentChunkTable._cachedIndex); - } else { - return new String(_characters, _charactersOffset, _charBufferLength); - } - } - - public final char[] getTextCharacters() { - if (_characters == null) { - checkTextState(); - } - - return _characters; - } - - public final int getTextStart() { - if (_characters == null) { - checkTextState(); - } - - return _charactersOffset; - } - - public final int getTextLength() { - if (_characters == null) { - checkTextState(); - } - - return _charBufferLength; - } - - public final int getTextCharacters(int sourceStart, char[] target, - int targetStart, int length) throws XMLStreamException { - if (_characters == null) { - checkTextState(); - } - - try { - int bytesToCopy = Math.min(_charBufferLength, length); - System.arraycopy(_characters, _charactersOffset + sourceStart, - target, targetStart, bytesToCopy); - return bytesToCopy; - } catch (IndexOutOfBoundsException e) { - throw new XMLStreamException(e); - } - } - - protected final void checkTextState() { - if (_algorithmData == null) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.InvalidStateForText")); - } - - try { - convertEncodingAlgorithmDataToCharacters(); - } catch (Exception e) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.InvalidStateForText")); - } - } - - public final String getEncoding() { - return _characterEncodingScheme; - } - - public final boolean hasText() { - return (_characters != null); - } - - public final Location getLocation() { - //location should be created in next() - //returns a nil location for now - return EventLocation.getNilLocation(); - } - - public final QName getName() { - if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) { - return _qualifiedName.getQName(); - } else { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetName")); - } - } - - public final String getLocalName() { - if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) { - return _qualifiedName.localName; - } else { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetLocalName")); - } - } - - public final boolean hasName() { - return (_eventType == START_ELEMENT || _eventType == END_ELEMENT); - } - - public final String getNamespaceURI() { - if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) { - return _qualifiedName.namespaceName; - } else { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetNamespaceURI")); - } - } - - public final String getPrefix() { - if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) { - return _qualifiedName.prefix; - } else { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetPrefix")); - } - } - - public final String getVersion() { - return null; - } - - public final boolean isStandalone() { - return false; - } - - public final boolean standaloneSet() { - return false; - } - - public final String getCharacterEncodingScheme() { - return null; - } - - public final String getPITarget() { - if (_eventType != PROCESSING_INSTRUCTION) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetPITarget")); - } - - return _piTarget; - } - - public final String getPIData() { - if (_eventType != PROCESSING_INSTRUCTION) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetPIData")); - } - - return _piData; - } - - - - - public final String getNameString() { - if (_eventType == START_ELEMENT || _eventType == END_ELEMENT) { - return _qualifiedName.getQNameString(); - } else { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetName")); - } - } - - public final String getAttributeNameString(int index) { - if (_eventType != START_ELEMENT) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.invalidCallingGetAttributeValue")); - } - return _attributes.getQualifiedName(index).getQNameString(); - } - - - public final String getTextAlgorithmURI() { - return _algorithmURI; - } - - public final int getTextAlgorithmIndex() { - return _algorithmId; - } - - public final boolean hasTextAlgorithmBytes() { - return _algorithmData != null; - } - - - /** - * Returns the byte[], which represents text algorithms. - * @deprecated was deprecated due to security reasons. Now the method return cloned byte[]. - * - * @return - */ - public final byte[] getTextAlgorithmBytes() { - // Do not return the actual _algorithmData due to security reasons -// return _algorithmData; - if (_algorithmData == null) { - return null; - } - - final byte[] algorithmData = new byte[_algorithmData.length]; - System.arraycopy(_algorithmData, 0, algorithmData, 0, _algorithmData.length); - return algorithmData; - } - - public final byte[] getTextAlgorithmBytesClone() { - if (_algorithmData == null) { - return null; - } - - byte[] algorithmData = new byte[_algorithmDataLength]; - System.arraycopy(_algorithmData, _algorithmDataOffset, algorithmData, 0, _algorithmDataLength); - return algorithmData; - } - - public final int getTextAlgorithmStart() { - return _algorithmDataOffset; - } - - public final int getTextAlgorithmLength() { - return _algorithmDataLength; - } - - public final int getTextAlgorithmBytes(int sourceStart, byte[] target, - int targetStart, int length) throws XMLStreamException { - try { - System.arraycopy(_algorithmData, sourceStart, target, - targetStart, length); - return length; - } catch (IndexOutOfBoundsException e) { - throw new XMLStreamException(e); - } - } - - // FastInfosetStreamReader impl - - public final int peekNext() throws XMLStreamException { - try { - switch(DecoderStateTables.EII(peek(this))) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - case DecoderStateTables.EII_AIIS_INDEX_SMALL: - case DecoderStateTables.EII_INDEX_MEDIUM: - case DecoderStateTables.EII_INDEX_LARGE: - case DecoderStateTables.EII_LITERAL: - case DecoderStateTables.EII_NAMESPACES: - return START_ELEMENT; - case DecoderStateTables.CII_UTF8_SMALL_LENGTH: - case DecoderStateTables.CII_UTF8_MEDIUM_LENGTH: - case DecoderStateTables.CII_UTF8_LARGE_LENGTH: - case DecoderStateTables.CII_UTF16_SMALL_LENGTH: - case DecoderStateTables.CII_UTF16_MEDIUM_LENGTH: - case DecoderStateTables.CII_UTF16_LARGE_LENGTH: - case DecoderStateTables.CII_RA: - case DecoderStateTables.CII_EA: - case DecoderStateTables.CII_INDEX_SMALL: - case DecoderStateTables.CII_INDEX_MEDIUM: - case DecoderStateTables.CII_INDEX_LARGE: - case DecoderStateTables.CII_INDEX_LARGE_LARGE: - return CHARACTERS; - case DecoderStateTables.COMMENT_II: - return COMMENT; - case DecoderStateTables.PROCESSING_INSTRUCTION_II: - return PROCESSING_INSTRUCTION; - case DecoderStateTables.UNEXPANDED_ENTITY_REFERENCE_II: - return ENTITY_REFERENCE; - case DecoderStateTables.TERMINATOR_DOUBLE: - case DecoderStateTables.TERMINATOR_SINGLE: - return (_stackCount != -1) ? END_ELEMENT : END_DOCUMENT; - default: - throw new FastInfosetException( - CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingEII")); - } - } catch (IOException e) { - throw new XMLStreamException(e); - } catch (FastInfosetException e) { - throw new XMLStreamException(e); - } - } - - public void onBeforeOctetBufferOverwrite() { - if (_algorithmData != null) { - _algorithmData = getTextAlgorithmBytesClone(); - _algorithmDataOffset = 0; - _isAlgorithmDataCloned = true; - } - } - - // Faster access methods without checks - - public final int accessNamespaceCount() { - return (_currentNamespaceAIIsEnd > 0) ? (_currentNamespaceAIIsEnd - _currentNamespaceAIIsStart) : 0; - } - - public final String accessLocalName() { - return _qualifiedName.localName; - } - - public final String accessNamespaceURI() { - return _qualifiedName.namespaceName; - } - - public final String accessPrefix() { - return _qualifiedName.prefix; - } - - public final char[] accessTextCharacters() { - if (_characters == null) return null; - - // we return a cloned version of _characters - final char[] clonedCharacters = new char[_characters.length]; - System.arraycopy(_characters, 0, clonedCharacters, 0, _characters.length); - return clonedCharacters; - } - - public final int accessTextStart() { - return _charactersOffset; - } - - public final int accessTextLength() { - return _charBufferLength; - } - - // - - protected final void processDII() throws FastInfosetException, IOException { - final int b = read(); - if (b > 0) { - processDIIOptionalProperties(b); - } - } - - protected final void processDIIOptionalProperties(int b) throws FastInfosetException, IOException { - // Optimize for the most common case - if (b == EncodingConstants.DOCUMENT_INITIAL_VOCABULARY_FLAG) { - decodeInitialVocabulary(); - return; - } - - if ((b & EncodingConstants.DOCUMENT_ADDITIONAL_DATA_FLAG) > 0) { - decodeAdditionalData(); - /* - * TODO - * how to report the additional data? - */ - } - - if ((b & EncodingConstants.DOCUMENT_INITIAL_VOCABULARY_FLAG) > 0) { - decodeInitialVocabulary(); - } - - if ((b & EncodingConstants.DOCUMENT_NOTATIONS_FLAG) > 0) { - decodeNotations(); - /* - try { - _dtdHandler.notationDecl(name, public_identifier, system_identifier); - } catch (SAXException e) { - throw new IOException("NotationsDeclarationII"); - } - */ - } - - if ((b & EncodingConstants.DOCUMENT_UNPARSED_ENTITIES_FLAG) > 0) { - decodeUnparsedEntities(); - /* - try { - _dtdHandler.unparsedEntityDecl(name, public_identifier, system_identifier, notation_name); - } catch (SAXException e) { - throw new IOException("UnparsedEntitiesII"); - } - */ - } - - if ((b & EncodingConstants.DOCUMENT_CHARACTER_ENCODING_SCHEME) > 0) { - _characterEncodingScheme = decodeCharacterEncodingScheme(); - } - - if ((b & EncodingConstants.DOCUMENT_STANDALONE_FLAG) > 0) { - boolean standalone = (read() > 0) ? true : false ; - /* - * TODO - * how to report the standalone flag? - */ - } - - if ((b & EncodingConstants.DOCUMENT_VERSION_FLAG) > 0) { - decodeVersion(); - /* - * TODO - * how to report the standalone flag? - */ - } - } - - - protected final void resizeNamespaceAIIs() { - final String[] namespaceAIIsPrefix = new String[_namespaceAIIsIndex * 2]; - System.arraycopy(_namespaceAIIsPrefix, 0, namespaceAIIsPrefix, 0, _namespaceAIIsIndex); - _namespaceAIIsPrefix = namespaceAIIsPrefix; - - final String[] namespaceAIIsNamespaceName = new String[_namespaceAIIsIndex * 2]; - System.arraycopy(_namespaceAIIsNamespaceName, 0, namespaceAIIsNamespaceName, 0, _namespaceAIIsIndex); - _namespaceAIIsNamespaceName = namespaceAIIsNamespaceName; - - final int[] namespaceAIIsPrefixIndex = new int[_namespaceAIIsIndex * 2]; - System.arraycopy(_namespaceAIIsPrefixIndex, 0, namespaceAIIsPrefixIndex, 0, _namespaceAIIsIndex); - _namespaceAIIsPrefixIndex = namespaceAIIsPrefixIndex; - } - - protected final void processEIIWithNamespaces(boolean hasAttributes) throws FastInfosetException, IOException { - if (++_prefixTable._declarationId == Integer.MAX_VALUE) { - _prefixTable.clearDeclarationIds(); - } - - _currentNamespaceAIIsStart = _namespaceAIIsIndex; - String prefix = "", namespaceName = ""; - int b = read(); - while ((b & EncodingConstants.NAMESPACE_ATTRIBUTE_MASK) == EncodingConstants.NAMESPACE_ATTRIBUTE) { - if (_namespaceAIIsIndex == _namespaceAIIsPrefix.length) { - resizeNamespaceAIIs(); - } - - switch (b & EncodingConstants.NAMESPACE_ATTRIBUTE_PREFIX_NAME_MASK) { - // no prefix, no namespace - // Undeclaration of default namespace - case 0: - prefix = namespaceName = - _namespaceAIIsPrefix[_namespaceAIIsIndex] = - _namespaceAIIsNamespaceName[_namespaceAIIsIndex] = ""; - - _namespaceNameIndex = _prefixIndex = _namespaceAIIsPrefixIndex[_namespaceAIIsIndex++] = -1; - break; - // no prefix, namespace - // Declaration of default namespace - case 1: - prefix = _namespaceAIIsPrefix[_namespaceAIIsIndex] = ""; - namespaceName = _namespaceAIIsNamespaceName[_namespaceAIIsIndex] = - decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName(false); - - _prefixIndex = _namespaceAIIsPrefixIndex[_namespaceAIIsIndex++] = -1; - break; - // prefix, no namespace - // Undeclaration of namespace - case 2: - prefix = _namespaceAIIsPrefix[_namespaceAIIsIndex] = - decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix(false); - namespaceName = _namespaceAIIsNamespaceName[_namespaceAIIsIndex] = ""; - - _namespaceNameIndex = -1; - _namespaceAIIsPrefixIndex[_namespaceAIIsIndex++] = _prefixIndex; - break; - // prefix, namespace - // Declaration of prefixed namespace - case 3: - prefix = _namespaceAIIsPrefix[_namespaceAIIsIndex] = - decodeIdentifyingNonEmptyStringOnFirstBitAsPrefix(true); - namespaceName = _namespaceAIIsNamespaceName[_namespaceAIIsIndex] = - decodeIdentifyingNonEmptyStringOnFirstBitAsNamespaceName(true); - - _namespaceAIIsPrefixIndex[_namespaceAIIsIndex++] = _prefixIndex; - break; - } - - // Push namespace declarations onto the stack - _prefixTable.pushScopeWithPrefixEntry(prefix, namespaceName, _prefixIndex, _namespaceNameIndex); - - b = read(); - } - if (b != EncodingConstants.TERMINATOR) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.EIInamespaceNameNotTerminatedCorrectly")); - } - _currentNamespaceAIIsEnd = _namespaceAIIsIndex; - - b = read(); - switch(DecoderStateTables.EII(b)) { - case DecoderStateTables.EII_NO_AIIS_INDEX_SMALL: - processEII(_elementNameTable._array[b], hasAttributes); - break; - case DecoderStateTables.EII_INDEX_MEDIUM: - processEII(processEIIIndexMedium(b), hasAttributes); - break; - case DecoderStateTables.EII_INDEX_LARGE: - processEII(processEIIIndexLarge(b), hasAttributes); - break; - case DecoderStateTables.EII_LITERAL: - { - final QualifiedName qn = processLiteralQualifiedName( - b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _elementNameTable.getNext()); - _elementNameTable.add(qn); - processEII(qn, hasAttributes); - break; - } - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.IllegalStateDecodingEIIAfterAIIs")); - } - } - - protected final void processEII(QualifiedName name, boolean hasAttributes) throws FastInfosetException, IOException { - if (_prefixTable._currentInScope[name.prefixIndex] != name.namespaceNameIndex) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.qnameOfEIINotInScope")); - } - - _eventType = START_ELEMENT; - _qualifiedName = name; - - if (_clearAttributes) { - _attributes.clear(); - _clearAttributes = false; - } - - if (hasAttributes) { - processAIIs(); - } - - // Push element holder onto the stack - _stackCount++; - if (_stackCount == _qNameStack.length) { - QualifiedName[] qNameStack = new QualifiedName[_qNameStack.length * 2]; - System.arraycopy(_qNameStack, 0, qNameStack, 0, _qNameStack.length); - _qNameStack = qNameStack; - - int[] namespaceAIIsStartStack = new int[_namespaceAIIsStartStack.length * 2]; - System.arraycopy(_namespaceAIIsStartStack, 0, namespaceAIIsStartStack, 0, _namespaceAIIsStartStack.length); - _namespaceAIIsStartStack = namespaceAIIsStartStack; - - int[] namespaceAIIsEndStack = new int[_namespaceAIIsEndStack.length * 2]; - System.arraycopy(_namespaceAIIsEndStack, 0, namespaceAIIsEndStack, 0, _namespaceAIIsEndStack.length); - _namespaceAIIsEndStack = namespaceAIIsEndStack; - } - _qNameStack[_stackCount] = _qualifiedName; - _namespaceAIIsStartStack[_stackCount] = _currentNamespaceAIIsStart; - _namespaceAIIsEndStack[_stackCount] = _currentNamespaceAIIsEnd; - } - - protected final void processAIIs() throws FastInfosetException, IOException { - QualifiedName name; - int b; - String value; - - if (++_duplicateAttributeVerifier._currentIteration == Integer.MAX_VALUE) { - _duplicateAttributeVerifier.clear(); - } - - _clearAttributes = true; - boolean terminate = false; - do { - // AII qualified name - b = read(); - switch (DecoderStateTables.AII(b)) { - case DecoderStateTables.AII_INDEX_SMALL: - name = _attributeNameTable._array[b]; - break; - case DecoderStateTables.AII_INDEX_MEDIUM: - { - final int i = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - name = _attributeNameTable._array[i]; - break; - } - case DecoderStateTables.AII_INDEX_LARGE: - { - final int i = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - name = _attributeNameTable._array[i]; - break; - } - case DecoderStateTables.AII_LITERAL: - name = processLiteralQualifiedName( - b & EncodingConstants.LITERAL_QNAME_PREFIX_NAMESPACE_NAME_MASK, - _attributeNameTable.getNext()); - name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE); - _attributeNameTable.add(name); - break; - case DecoderStateTables.AII_TERMINATOR_DOUBLE: - _internalState = INTERNAL_STATE_START_ELEMENT_TERMINATE; - case DecoderStateTables.AII_TERMINATOR_SINGLE: - terminate = true; - // AIIs have finished break out of loop - continue; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingAIIs")); - } - - // [normalized value] of AII - - if (name.prefixIndex > 0 && _prefixTable._currentInScope[name.prefixIndex] != name.namespaceNameIndex) { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.AIIqNameNotInScope")); - } - - _duplicateAttributeVerifier.checkForDuplicateAttribute(name.attributeHash, name.attributeId); - - b = read(); - switch(DecoderStateTables.NISTRING(b)) { - case DecoderStateTables.NISTRING_UTF8_SMALL_LENGTH: - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_MASK) + 1; - value = decodeUtf8StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF8_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT; - value = decodeUtf8StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF8_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - value = decodeUtf8StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF16_SMALL_LENGTH: - _octetBufferLength = (b & EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_MASK) + 1; - value = decodeUtf16StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF16_MEDIUM_LENGTH: - _octetBufferLength = read() + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_SMALL_LIMIT; - value = decodeUtf16StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_UTF16_LARGE_LENGTH: - _octetBufferLength = ((read() << 24) | - (read() << 16) | - (read() << 8) | - read()) - + EncodingConstants.OCTET_STRING_LENGTH_5TH_BIT_MEDIUM_LIMIT; - value = decodeUtf16StringAsString(); - if ((b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - case DecoderStateTables.NISTRING_RA: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - // Decode resitricted alphabet integer - _identifier = (b & 0x0F) << 4; - b = read(); - _identifier |= (b & 0xF0) >> 4; - - decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(b); - - value = decodeRestrictedAlphabetAsString(); - if (addToTable) { - _attributeValueTable.add(value); - } - - _attributes.addAttribute(name, value); - break; - } - case DecoderStateTables.NISTRING_EA: - { - final boolean addToTable = (b & EncodingConstants.NISTRING_ADD_TO_TABLE_FLAG) > 0; - // Decode encoding algorithm integer - _identifier = (b & 0x0F) << 4; - b = read(); - _identifier |= (b & 0xF0) >> 4; - - decodeOctetsOnFifthBitOfNonIdentifyingStringOnFirstBit(b); - processAIIEncodingAlgorithm(name, addToTable); - break; - } - case DecoderStateTables.NISTRING_INDEX_SMALL: - _attributes.addAttribute(name, - _attributeValueTable._array[b & EncodingConstants.INTEGER_2ND_BIT_SMALL_MASK]); - break; - case DecoderStateTables.NISTRING_INDEX_MEDIUM: - { - final int index = (((b & EncodingConstants.INTEGER_2ND_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_SMALL_LIMIT; - - _attributes.addAttribute(name, - _attributeValueTable._array[index]); - break; - } - case DecoderStateTables.NISTRING_INDEX_LARGE: - { - final int index = (((b & EncodingConstants.INTEGER_2ND_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_2ND_BIT_MEDIUM_LIMIT; - - _attributes.addAttribute(name, - _attributeValueTable._array[index]); - break; - } - case DecoderStateTables.NISTRING_EMPTY: - _attributes.addAttribute(name, ""); - break; - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingAIIValue")); - } - - } while (!terminate); - - // Reset duplication attribute verfifier - _duplicateAttributeVerifier._poolCurrent = _duplicateAttributeVerifier._poolHead; - } - - protected final QualifiedName processEIIIndexMedium(int b) throws FastInfosetException, IOException { - final int i = (((b & EncodingConstants.INTEGER_3RD_BIT_MEDIUM_MASK) << 8) | read()) - + EncodingConstants.INTEGER_3RD_BIT_SMALL_LIMIT; - return _elementNameTable._array[i]; - } - - protected final QualifiedName processEIIIndexLarge(int b) throws FastInfosetException, IOException { - int i; - if ((b & EncodingConstants.INTEGER_3RD_BIT_LARGE_LARGE_FLAG) == 0x20) { - // EII large index - i = (((b & EncodingConstants.INTEGER_3RD_BIT_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_3RD_BIT_MEDIUM_LIMIT; - } else { - // EII large large index - i = (((read() & EncodingConstants.INTEGER_3RD_BIT_LARGE_LARGE_MASK) << 16) | (read() << 8) | read()) - + EncodingConstants.INTEGER_3RD_BIT_LARGE_LIMIT; - } - return _elementNameTable._array[i]; - } - - protected final QualifiedName processLiteralQualifiedName(int state, QualifiedName q) - throws FastInfosetException, IOException { - if (q == null) q = new QualifiedName(); - - switch (state) { - // no prefix, no namespace - case 0: - return q.set( - "", - "", - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - "", - 0, - -1, - -1, - _identifier); - // no prefix, namespace - case 1: - return q.set( - "", - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(false), - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - "", - 0, - -1, - _namespaceNameIndex, - _identifier); - // prefix, no namespace - case 2: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.qNameMissingNamespaceName")); - // prefix, namespace - case 3: - return q.set( - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsPrefix(true), - decodeIdentifyingNonEmptyStringIndexOnFirstBitAsNamespaceName(true), - decodeIdentifyingNonEmptyStringOnFirstBit(_v.localName), - "", - 0, - _prefixIndex, - _namespaceNameIndex, - _identifier); - default: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.decodingEII")); - } - } - - protected final void processCommentII() throws FastInfosetException, IOException { - _eventType = COMMENT; - - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - if (_addToTable) { - _v.otherString.add(new CharArray(_charBuffer, 0, _charBufferLength, true)); - } - - _characters = _charBuffer; - _charactersOffset = 0; - break; - case NISTRING_ENCODING_ALGORITHM: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.commentIIAlgorithmNotSupported")); - case NISTRING_INDEX: - final CharArray ca = _v.otherString.get(_integer); - - _characters = ca.ch; - _charactersOffset = ca.start; - _charBufferLength = ca.length; - break; - case NISTRING_EMPTY_STRING: - _characters = _charBuffer; - _charactersOffset = 0; - _charBufferLength = 0; - break; - } - } - - protected final void processProcessingII() throws FastInfosetException, IOException { - _eventType = PROCESSING_INSTRUCTION; - - _piTarget = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - - switch(decodeNonIdentifyingStringOnFirstBit()) { - case NISTRING_STRING: - _piData = new String(_charBuffer, 0, _charBufferLength); - if (_addToTable) { - _v.otherString.add(new CharArrayString(_piData)); - } - break; - case NISTRING_ENCODING_ALGORITHM: - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.processingIIWithEncodingAlgorithm")); - case NISTRING_INDEX: - _piData = _v.otherString.get(_integer).toString(); - break; - case NISTRING_EMPTY_STRING: - _piData = ""; - break; - } - } - - protected final void processUnexpandedEntityReference(final int b) throws FastInfosetException, IOException { - _eventType = ENTITY_REFERENCE; - - /* - * TODO - * How does StAX report such events? - */ - String entity_reference_name = decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherNCName); - - String system_identifier = ((b & EncodingConstants.UNEXPANDED_ENTITY_SYSTEM_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - String public_identifier = ((b & EncodingConstants.UNEXPANDED_ENTITY_PUBLIC_IDENTIFIER_FLAG) > 0) - ? decodeIdentifyingNonEmptyStringOnFirstBit(_v.otherURI) : ""; - - if (logger.isLoggable(Level.FINEST)) { - logger.log(Level.FINEST, "processUnexpandedEntityReference: entity_reference_name={0} system_identifier={1}public_identifier={2}", - new Object[]{entity_reference_name, system_identifier, public_identifier}); - } - } - - protected final void processCIIEncodingAlgorithm(boolean addToTable) throws FastInfosetException, IOException { - _algorithmData = _octetBuffer; - _algorithmDataOffset = _octetBufferStart; - _algorithmDataLength = _octetBufferLength; - _isAlgorithmDataCloned = false; - - if (_algorithmId >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - _algorithmURI = _v.encodingAlgorithm.get(_algorithmId - EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START); - if (_algorithmURI == null) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.URINotPresent", new Object[]{Integer.valueOf(_identifier)})); - } - } else if (_algorithmId > EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - // Reserved built-in algorithms for future use - // TODO should use sax property to decide if event will be - // reported, allows for support through handler if required. - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.identifiers10to31Reserved")); - } - - if (addToTable) { - convertEncodingAlgorithmDataToCharacters(); - _characterContentChunkTable.add(_characters, _characters.length); - } - } - - protected final void processAIIEncodingAlgorithm(QualifiedName name, boolean addToTable) throws FastInfosetException, IOException { - EncodingAlgorithm ea = null; - String URI = null; - if (_identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - URI = _v.encodingAlgorithm.get(_identifier - EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START); - if (URI == null) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.URINotPresent", new Object[]{Integer.valueOf(_identifier)})); - } else if (_registeredEncodingAlgorithms != null) { - ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI); - } - } else if (_identifier >= EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - if (_identifier == EncodingAlgorithmIndexes.CDATA) { - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.CDATAAlgorithmNotSupported")); - } - - // Reserved built-in algorithms for future use - // TODO should use sax property to decide if event will be - // reported, allows for support through handler if required. - throw new EncodingAlgorithmException(CommonResourceBundle.getInstance().getString("message.identifiers10to31Reserved")); - } else { - ea = BuiltInEncodingAlgorithmFactory.getAlgorithm(_identifier); - } - - Object algorithmData; - - if (ea != null) { - algorithmData = ea.decodeFromBytes(_octetBuffer, _octetBufferStart, - _octetBufferLength); - } else { - final byte[] data = new byte[_octetBufferLength]; - System.arraycopy(_octetBuffer, _octetBufferStart, data, 0, - _octetBufferLength); - algorithmData = data; - } - - _attributes.addAttributeWithAlgorithmData(name, URI, _identifier, - algorithmData); - if (addToTable) { - _attributeValueTable.add(_attributes.getValue(_attributes.getIndex(name.qName))); - } - } - - protected final void convertEncodingAlgorithmDataToCharacters() throws FastInfosetException, IOException { - StringBuffer buffer = new StringBuffer(); - if (_algorithmId == EncodingAlgorithmIndexes.BASE64) { - convertBase64AlorithmDataToCharacters(buffer); - } else if (_algorithmId < EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - Object array = BuiltInEncodingAlgorithmFactory.getAlgorithm(_algorithmId). - decodeFromBytes(_algorithmData, _algorithmDataOffset, _algorithmDataLength); - BuiltInEncodingAlgorithmFactory.getAlgorithm(_algorithmId).convertToCharacters(array, buffer); - } else if (_algorithmId == EncodingAlgorithmIndexes.CDATA) { - _octetBufferOffset -= _octetBufferLength; - decodeUtf8StringIntoCharBuffer(); - - _characters = _charBuffer; - _charactersOffset = 0; - return; - } else if (_algorithmId >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - final EncodingAlgorithm ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(_algorithmURI); - if (ea != null) { - final Object data = ea.decodeFromBytes(_octetBuffer, _octetBufferStart, _octetBufferLength); - ea.convertToCharacters(data, buffer); - } else { - throw new EncodingAlgorithmException( - CommonResourceBundle.getInstance().getString("message.algorithmDataCannotBeReported")); - } - } - - _characters = new char[buffer.length()]; - buffer.getChars(0, buffer.length(), _characters, 0); - _charactersOffset = 0; - _charBufferLength = _characters.length; - } - - /* If base64 data comes is chunks, bytes, which were cut to align 3, - * from prev. base64 chunk are stored in this buffer */ - private byte[] base64TaleBytes = new byte[3]; - private int base64TaleLength; - /* - * Method converts _algorithmData to base64 encoded String - * Counts with base64 data coming in chunks, aligning input chunks by 3, - * avoiding double cloning, happening after possible peek, peek2 cloning by Base64 algorithm - */ - protected void convertBase64AlorithmDataToCharacters(StringBuffer buffer) throws EncodingAlgorithmException, IOException { - // How much new came data was serialized with prev. tale - int afterTaleOffset = 0; - - if (base64TaleLength > 0) { - // Serialize tale left from prev. chunk - int bytesToCopy = Math.min(3 - base64TaleLength, _algorithmDataLength); - System.arraycopy(_algorithmData, _algorithmDataOffset, base64TaleBytes, base64TaleLength, bytesToCopy); - if (base64TaleLength + bytesToCopy == 3) { - base64DecodeWithCloning(buffer, base64TaleBytes, 0, 3); - } else if (!isBase64Follows()) { - // End of text was read to temp array - base64DecodeWithCloning(buffer, base64TaleBytes, 0, base64TaleLength + bytesToCopy); - return; - } else { - // If the end of chunk fit to tmp array, but next chunk is expected - base64TaleLength += bytesToCopy; - return; - } - - afterTaleOffset = bytesToCopy; - base64TaleLength = 0; - } - - int taleBytesRemaining = isBase64Follows() ? (_algorithmDataLength - afterTaleOffset) % 3 : 0; - - if (_isAlgorithmDataCloned) { - base64DecodeWithoutCloning(buffer, _algorithmData, _algorithmDataOffset + afterTaleOffset, - _algorithmDataLength - afterTaleOffset - taleBytesRemaining); - } else { - base64DecodeWithCloning(buffer, _algorithmData, _algorithmDataOffset + afterTaleOffset, - _algorithmDataLength - afterTaleOffset - taleBytesRemaining); - } - - if (taleBytesRemaining > 0) { - System.arraycopy(_algorithmData, _algorithmDataOffset + _algorithmDataLength - taleBytesRemaining, - base64TaleBytes, 0, taleBytesRemaining); - base64TaleLength = taleBytesRemaining; - } - } - - /* - * Encodes incoming data to Base64 string. - * Method performs additional input data cloning - */ - private void base64DecodeWithCloning(StringBuffer dstBuffer, byte[] data, int offset, int length) throws EncodingAlgorithmException { - Object array = BuiltInEncodingAlgorithmFactory.base64EncodingAlgorithm. - decodeFromBytes(data, offset, length); - BuiltInEncodingAlgorithmFactory.base64EncodingAlgorithm.convertToCharacters(array, dstBuffer); - } - - /* - * Encodes incoming data to Base64 string. - * Avoids input data cloning - */ - private void base64DecodeWithoutCloning(StringBuffer dstBuffer, byte[] data, int offset, int length) throws EncodingAlgorithmException { - BuiltInEncodingAlgorithmFactory.base64EncodingAlgorithm.convertToCharacters(data, offset, length, dstBuffer); - } - - - /* - * Looks ahead in InputStream, whether next data is Base64 chunk - */ - public boolean isBase64Follows() throws IOException { - // Process information item - int b = peek(this); - switch (DecoderStateTables.EII(b)) { - case DecoderStateTables.CII_EA: - int algorithmId = (b & 0x02) << 6; - int b2 = peek2(this); - algorithmId |= (b2 & 0xFC) >> 2; - - return algorithmId == EncodingAlgorithmIndexes.BASE64; - default: - return false; - } - } - - protected class NamespaceContextImpl implements NamespaceContext { - public final String getNamespaceURI(String prefix) { - return _prefixTable.getNamespaceFromPrefix(prefix); - } - - public final String getPrefix(String namespaceURI) { - return _prefixTable.getPrefixFromNamespace(namespaceURI); - } - - public final Iterator getPrefixes(String namespaceURI) { - return _prefixTable.getPrefixesFromNamespace(namespaceURI); - } - } - - public final String getNamespaceDecl(String prefix) { - return _prefixTable.getNamespaceFromPrefix(prefix); - } - - public final String getURI(String prefix) { - return getNamespaceDecl(prefix); - } - - public final Iterator getPrefixes() { - return _prefixTable.getPrefixes(); - } - - public final AttributesHolder getAttributesHolder() { - return _attributes; - } - - public final void setManager(StAXManager manager) { - _manager = manager; - } - - final static String getEventTypeString(int eventType) { - switch (eventType){ - case START_ELEMENT: - return "START_ELEMENT"; - case END_ELEMENT: - return "END_ELEMENT"; - case PROCESSING_INSTRUCTION: - return "PROCESSING_INSTRUCTION"; - case CHARACTERS: - return "CHARACTERS"; - case COMMENT: - return "COMMENT"; - case START_DOCUMENT: - return "START_DOCUMENT"; - case END_DOCUMENT: - return "END_DOCUMENT"; - case ENTITY_REFERENCE: - return "ENTITY_REFERENCE"; - case ATTRIBUTE: - return "ATTRIBUTE"; - case DTD: - return "DTD"; - case CDATA: - return "CDATA"; - } - return "UNKNOWN_EVENT_TYPE"; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/StAXDocumentSerializer.java 2018-01-30 20:37:00.000000000 -0500 +++ /dev/null 2018-01-30 20:37:00.000000000 -0500 @@ -1,856 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax; - -import com.sun.xml.internal.fastinfoset.Encoder; -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.util.NamespaceContextImplementation; -import java.io.IOException; -import java.io.OutputStream; -import java.util.EmptyStackException; -import javax.xml.namespace.NamespaceContext; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.util.LocalNameQualifiedNamesMap; -import com.sun.xml.internal.org.jvnet.fastinfoset.stax.LowLevelFastInfosetStreamWriter; - -/** - * The Fast Infoset StAX serializer. - *

- * Instantiate this serializer to serialize a fast infoset document in accordance - * with the StAX API. - * - *

- * More than one fast infoset document may be encoded to the - * {@link java.io.OutputStream}. - */ -public class StAXDocumentSerializer extends Encoder - implements XMLStreamWriter, LowLevelFastInfosetStreamWriter { - protected StAXManager _manager; - - protected String _encoding; - /** - * Local name of current element. - */ - protected String _currentLocalName; - - /** - * Namespace of current element. - */ - protected String _currentUri; - - /** - * Prefix of current element. - */ - protected String _currentPrefix; - - /** - * This flag indicates when there is a pending start element event. - */ - protected boolean _inStartElement = false; - - /** - * This flag indicates if the current element is empty. - */ - protected boolean _isEmptyElement = false; - - /** - * List of attributes qnames and values defined in the current element. - */ - protected String[] _attributesArray = new String[4 * 16]; - protected int _attributesArrayIndex = 0; - - protected boolean[] _nsSupportContextStack = new boolean[32]; - protected int _stackCount = -1; - - /** - * Mapping between uris and prefixes. - */ - protected NamespaceContextImplementation _nsContext = - new NamespaceContextImplementation(); - - /** - * List of namespaces defined in the current element. - */ - protected String[] _namespacesArray = new String[2 * 8]; - protected int _namespacesArrayIndex = 0; - - public StAXDocumentSerializer() { - super(true); - _manager = new StAXManager(StAXManager.CONTEXT_WRITER); - } - - public StAXDocumentSerializer(OutputStream outputStream) { - super(true); - setOutputStream(outputStream); - _manager = new StAXManager(StAXManager.CONTEXT_WRITER); - } - - public StAXDocumentSerializer(OutputStream outputStream, StAXManager manager) { - super(true); - setOutputStream(outputStream); - _manager = manager; - } - - public void reset() { - super.reset(); - - _attributesArrayIndex = 0; - _namespacesArrayIndex = 0; - - _nsContext.reset(); - _stackCount = -1; - - _currentUri = _currentPrefix = null; - _currentLocalName = null; - - _inStartElement = _isEmptyElement = false; - } - - // -- XMLStreamWriter Interface ------------------------------------------- - - public void writeStartDocument() throws XMLStreamException { - writeStartDocument("finf", "1.0"); - } - - public void writeStartDocument(String version) throws XMLStreamException { - writeStartDocument("finf", version); - } - - public void writeStartDocument(String encoding, String version) - throws XMLStreamException - { - reset(); - - try { - encodeHeader(false); - encodeInitialVocabulary(); - } catch (IOException e) { - throw new XMLStreamException(e); - } - } - - public void writeEndDocument() throws XMLStreamException { - try { - - // terminate all elements not terminated - // by writeEndElement - for(;_stackCount >= 0; _stackCount--) { - writeEndElement(); - } - - encodeDocumentTermination(); - } - catch (IOException e) { - throw new XMLStreamException(e); - } - } - - public void close() throws XMLStreamException { - reset(); - } - - public void flush() throws XMLStreamException { - try { - _s.flush(); - } - catch (IOException e) { - throw new XMLStreamException(e); - } - } - - public void writeStartElement(String localName) - throws XMLStreamException - { - // TODO is it necessary for FI to obtain the default namespace in scope? - writeStartElement("", localName, ""); - } - - public void writeStartElement(String namespaceURI, String localName) - throws XMLStreamException - { - writeStartElement("", localName, namespaceURI); - } - - public void writeStartElement(String prefix, String localName, - String namespaceURI) throws XMLStreamException - { - encodeTerminationAndCurrentElement(false); - - _inStartElement = true; - _isEmptyElement = false; - - _currentLocalName = localName; - _currentPrefix = prefix; - _currentUri = namespaceURI; - - _stackCount++; - if (_stackCount == _nsSupportContextStack.length) { - boolean[] nsSupportContextStack = new boolean[_stackCount * 2]; - System.arraycopy(_nsSupportContextStack, 0, nsSupportContextStack, 0, _nsSupportContextStack.length); - _nsSupportContextStack = nsSupportContextStack; - } - - _nsSupportContextStack[_stackCount] = false; - } - - public void writeEmptyElement(String localName) - throws XMLStreamException - { - writeEmptyElement("", localName, ""); - } - - public void writeEmptyElement(String namespaceURI, String localName) - throws XMLStreamException - { - writeEmptyElement("", localName, namespaceURI); - } - - public void writeEmptyElement(String prefix, String localName, - String namespaceURI) throws XMLStreamException - { - encodeTerminationAndCurrentElement(false); - - _isEmptyElement = _inStartElement = true; - - _currentLocalName = localName; - _currentPrefix = prefix; - _currentUri = namespaceURI; - - _stackCount++; - if (_stackCount == _nsSupportContextStack.length) { - boolean[] nsSupportContextStack = new boolean[_stackCount * 2]; - System.arraycopy(_nsSupportContextStack, 0, nsSupportContextStack, 0, _nsSupportContextStack.length); - _nsSupportContextStack = nsSupportContextStack; - } - - _nsSupportContextStack[_stackCount] = false; - } - - public void writeEndElement() throws XMLStreamException { - if (_inStartElement) { - encodeTerminationAndCurrentElement(false); - } - - try { - encodeElementTermination(); - if (_nsSupportContextStack[_stackCount--] == true) { - _nsContext.popContext(); - } - } - catch (IOException e) { - throw new XMLStreamException(e); - } - catch (EmptyStackException e) { - throw new XMLStreamException(e); - } - } - - - public void writeAttribute(String localName, String value) - throws XMLStreamException - { - writeAttribute("", "", localName, value); - } - - public void writeAttribute(String namespaceURI, String localName, - String value) throws XMLStreamException - { - String prefix = ""; - - // Find prefix for attribute, ignoring default namespace - if (namespaceURI.length() > 0) { - prefix = _nsContext.getNonDefaultPrefix(namespaceURI); - - // Undeclared prefix or ignorable default ns? - if (prefix == null || prefix.length() == 0) { - // Workaround for BUG in SAX NamespaceSupport helper - // which incorrectly defines namespace declaration URI - if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME || - namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) { - // TODO - // Need to check carefully the rule for the writing of - // namespaces in StAX. Is it safe to ignore such - // attributes, as declarations will be made using the - // writeNamespace method - return; - } - throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI})); - } - } - writeAttribute(prefix, namespaceURI, localName, value); - } - - public void writeAttribute(String prefix, String namespaceURI, - String localName, String value) throws XMLStreamException - { - if (!_inStartElement) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed")); - } - - // TODO - // Need to check carefully the rule for the writing of - // namespaces in StAX. Is it safe to ignore such - // attributes, as declarations will be made using the - // writeNamespace method - if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME || - namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) { - return; - } - - if (_attributesArrayIndex == _attributesArray.length) { - final String[] attributesArray = new String[_attributesArrayIndex * 2]; - System.arraycopy(_attributesArray, 0, attributesArray, 0, _attributesArrayIndex); - _attributesArray = attributesArray; - } - - _attributesArray[_attributesArrayIndex++] = namespaceURI; - _attributesArray[_attributesArrayIndex++] = prefix; - _attributesArray[_attributesArrayIndex++] = localName; - _attributesArray[_attributesArrayIndex++] = value; - } - - public void writeNamespace(String prefix, String namespaceURI) - throws XMLStreamException - { - if (prefix == null || prefix.length() == 0 || prefix.equals(EncodingConstants.XMLNS_NAMESPACE_PREFIX)) { - writeDefaultNamespace(namespaceURI); - } - else { - if (!_inStartElement) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed")); - } - - if (_namespacesArrayIndex == _namespacesArray.length) { - final String[] namespacesArray = new String[_namespacesArrayIndex * 2]; - System.arraycopy(_namespacesArray, 0, namespacesArray, 0, _namespacesArrayIndex); - _namespacesArray = namespacesArray; - } - - _namespacesArray[_namespacesArrayIndex++] = prefix; - _namespacesArray[_namespacesArrayIndex++] = namespaceURI; - setPrefix(prefix, namespaceURI); - } - } - - public void writeDefaultNamespace(String namespaceURI) - throws XMLStreamException - { - if (!_inStartElement) { - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed")); - } - - if (_namespacesArrayIndex == _namespacesArray.length) { - final String[] namespacesArray = new String[_namespacesArrayIndex * 2]; - System.arraycopy(_namespacesArray, 0, namespacesArray, 0, _namespacesArrayIndex); - _namespacesArray = namespacesArray; - } - - _namespacesArray[_namespacesArrayIndex++] = ""; - _namespacesArray[_namespacesArrayIndex++] = namespaceURI; - setPrefix("", namespaceURI); - } - - public void writeComment(String data) throws XMLStreamException { - try { - if (getIgnoreComments()) return; - - encodeTerminationAndCurrentElement(true); - - // TODO: avoid array copy here - encodeComment(data.toCharArray(), 0, data.length()); - } - catch (IOException e) { - throw new XMLStreamException(e); - } - } - - public void writeProcessingInstruction(String target) - throws XMLStreamException - { - writeProcessingInstruction(target, ""); - } - - public void writeProcessingInstruction(String target, String data) - throws XMLStreamException - { - try { - if (getIgnoreProcesingInstructions()) return; - - encodeTerminationAndCurrentElement(true); - - encodeProcessingInstruction(target, data); - } - catch (IOException e) { - throw new XMLStreamException(e); - } - } - - public void writeCData(String text) throws XMLStreamException { - try { - final int length = text.length(); - if (length == 0) { - return; - } else if (length < _charBuffer.length) { - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(text)) return; - - // Warning: this method must be called before any state - // is modified, such as the _charBuffer contents, - // so the characters of text cannot be copied to _charBuffer - // before this call - encodeTerminationAndCurrentElement(true); - - text.getChars(0, length, _charBuffer, 0); - encodeCIIBuiltInAlgorithmDataAsCDATA(_charBuffer, 0, length); - } else { - final char ch[] = text.toCharArray(); - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(ch, 0, length)) return; - - encodeTerminationAndCurrentElement(true); - - encodeCIIBuiltInAlgorithmDataAsCDATA(ch, 0, length); - } - } catch (Exception e) { - throw new XMLStreamException(e); - } - } - - public void writeDTD(String dtd) throws XMLStreamException { - throw new UnsupportedOperationException(CommonResourceBundle.getInstance().getString("message.notImplemented")); - } - - public void writeEntityRef(String name) throws XMLStreamException { - throw new UnsupportedOperationException(CommonResourceBundle.getInstance().getString("message.notImplemented")); - } - - public void writeCharacters(String text) throws XMLStreamException { - try { - final int length = text.length(); - if (length == 0) { - return; - } else if (length < _charBuffer.length) { - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(text)) return; - - // Warning: this method must be called before any state - // is modified, such as the _charBuffer contents, - // so the characters of text cannot be copied to _charBuffer - // before this call - encodeTerminationAndCurrentElement(true); - - text.getChars(0, length, _charBuffer, 0); - encodeCharacters(_charBuffer, 0, length); - } else { - final char ch[] = text.toCharArray(); - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(ch, 0, length)) return; - - encodeTerminationAndCurrentElement(true); - - encodeCharactersNoClone(ch, 0, length); - } - } - catch (IOException e) { - throw new XMLStreamException(e); - } - } - - public void writeCharacters(char[] text, int start, int len) - throws XMLStreamException - { - try { - if (len <= 0) { - return; - } - - if (getIgnoreWhiteSpaceTextContent() && - isWhiteSpace(text, start, len)) return; - - encodeTerminationAndCurrentElement(true); - - encodeCharacters(text, start, len); - } - catch (IOException e) { - throw new XMLStreamException(e); - } - } - - public String getPrefix(String uri) throws XMLStreamException { - return _nsContext.getPrefix(uri); - } - - public void setPrefix(String prefix, String uri) - throws XMLStreamException - { - if (_stackCount > -1 && _nsSupportContextStack[_stackCount] == false) { - _nsSupportContextStack[_stackCount] = true; - _nsContext.pushContext(); - } - - _nsContext.declarePrefix(prefix, uri); - } - - public void setDefaultNamespace(String uri) throws XMLStreamException { - setPrefix("", uri); - } - - /** - * Sets the current namespace context for prefix and uri bindings. - * This context becomes the root namespace context for writing and - * will replace the current root namespace context. Subsequent calls - * to setPrefix and setDefaultNamespace will bind namespaces using - * the context passed to the method as the root context for resolving - * namespaces. This method may only be called once at the start of - * the document. It does not cause the namespaces to be declared. - * If a namespace URI to prefix mapping is found in the namespace - * context it is treated as declared and the prefix may be used - * by the StreamWriter. - * @param context the namespace context to use for this writer, may not be null - * @throws XMLStreamException - */ - public void setNamespaceContext(NamespaceContext context) - throws XMLStreamException - { - throw new UnsupportedOperationException("setNamespaceContext"); - } - - public NamespaceContext getNamespaceContext() { - return _nsContext; - } - - public Object getProperty(java.lang.String name) - throws IllegalArgumentException - { - if (_manager != null) { - return _manager.getProperty(name); - } - return null; - } - - public void setManager(StAXManager manager) { - _manager = manager; - } - - public void setEncoding(String encoding) { - _encoding = encoding; - } - - - public void writeOctets(byte[] b, int start, int len) - throws XMLStreamException - { - try { - if (len == 0) { - return; - } - - encodeTerminationAndCurrentElement(true); - - encodeCIIOctetAlgorithmData(EncodingAlgorithmIndexes.BASE64, b, start, len); - } - catch (IOException e) { - throw new XMLStreamException(e); - } - } - - protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException { - try { - encodeTermination(); - - if (_inStartElement) { - - _b = EncodingConstants.ELEMENT; - if (_attributesArrayIndex > 0) { - _b |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG; - } - - // Encode namespace decls associated with this element - if (_namespacesArrayIndex > 0) { - write(_b | EncodingConstants.ELEMENT_NAMESPACES_FLAG); - for (int i = 0; i < _namespacesArrayIndex;) { - encodeNamespaceAttribute(_namespacesArray[i++], _namespacesArray[i++]); - } - _namespacesArrayIndex = 0; - - write(EncodingConstants.TERMINATOR); - - _b = 0; - } - - // If element's prefix is empty - apply default scope namespace - if (_currentPrefix.length() == 0) { - if (_currentUri.length() == 0) { - _currentUri = _nsContext.getNamespaceURI(""); - } else { - String tmpPrefix = getPrefix(_currentUri); - if (tmpPrefix != null) { - _currentPrefix = tmpPrefix; - } - } - } - - encodeElementQualifiedNameOnThirdBit(_currentUri, _currentPrefix, _currentLocalName); - - for (int i = 0; i < _attributesArrayIndex;) { - encodeAttributeQualifiedNameOnSecondBit( - _attributesArray[i++], _attributesArray[i++], _attributesArray[i++]); - - final String value = _attributesArray[i]; - _attributesArray[i++] = null; - final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length()); - encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false); - - _b = EncodingConstants.TERMINATOR; - _terminate = true; - } - _attributesArrayIndex = 0; - _inStartElement = false; - - if (_isEmptyElement) { - encodeElementTermination(); - if (_nsSupportContextStack[_stackCount--] == true) { - _nsContext.popContext(); - } - - _isEmptyElement = false; - } - - if (terminateAfter) { - encodeTermination(); - } - } - } catch (IOException e) { - throw new XMLStreamException(e); - } - } - - - // LowLevelFastInfosetSerializer - - public final void initiateLowLevelWriting() throws XMLStreamException { - encodeTerminationAndCurrentElement(false); - } - - public final int getNextElementIndex() { - return _v.elementName.getNextIndex(); - } - - public final int getNextAttributeIndex() { - return _v.attributeName.getNextIndex(); - } - - public final int getLocalNameIndex() { - return _v.localName.getIndex(); - } - - public final int getNextLocalNameIndex() { - return _v.localName.getNextIndex(); - } - - public final void writeLowLevelTerminationAndMark() throws IOException { - encodeTermination(); - mark(); - } - - public final void writeLowLevelStartElementIndexed(int type, int index) throws IOException { - _b = type; - encodeNonZeroIntegerOnThirdBit(index); - } - - public final boolean writeLowLevelStartElement(int type, String prefix, String localName, - String namespaceURI) throws IOException { - final boolean isIndexed = encodeElement(type, namespaceURI, prefix, localName); - - if (!isIndexed) - encodeLiteral(type | EncodingConstants.ELEMENT_LITERAL_QNAME_FLAG, - namespaceURI, prefix, localName); - - return isIndexed; - } - - public final void writeLowLevelStartNamespaces() throws IOException { - write(EncodingConstants.ELEMENT | EncodingConstants.ELEMENT_NAMESPACES_FLAG); - } - - public final void writeLowLevelNamespace(String prefix, String namespaceName) - throws IOException { - encodeNamespaceAttribute(prefix, namespaceName); - } - - public final void writeLowLevelEndNamespaces() throws IOException { - write(EncodingConstants.TERMINATOR); - } - - public final void writeLowLevelStartAttributes() throws IOException { - if (hasMark()) { - _octetBuffer[_markIndex] |= EncodingConstants.ELEMENT_ATTRIBUTE_FLAG; - resetMark(); - } - } - - public final void writeLowLevelAttributeIndexed(int index) throws IOException { - encodeNonZeroIntegerOnSecondBitFirstBitZero(index); - } - - public final boolean writeLowLevelAttribute(String prefix, String namespaceURI, String localName) throws IOException { - final boolean isIndexed = encodeAttribute(namespaceURI, prefix, localName); - - if (!isIndexed) - encodeLiteral(EncodingConstants.ATTRIBUTE_LITERAL_QNAME_FLAG, - namespaceURI, prefix, localName); - - return isIndexed; - } - - public final void writeLowLevelAttributeValue(String value) throws IOException - { - final boolean addToTable = isAttributeValueLengthMatchesLimit(value.length()); - encodeNonIdentifyingStringOnFirstBit(value, _v.attributeValue, addToTable, false); - } - - public final void writeLowLevelStartNameLiteral(int type, String prefix, byte[] utf8LocalName, - String namespaceURI) throws IOException { - encodeLiteralHeader(type, namespaceURI, prefix); - encodeNonZeroOctetStringLengthOnSecondBit(utf8LocalName.length); - write(utf8LocalName, 0, utf8LocalName.length); - } - - public final void writeLowLevelStartNameLiteral(int type, String prefix, int localNameIndex, - String namespaceURI) throws IOException { - encodeLiteralHeader(type, namespaceURI, prefix); - encodeNonZeroIntegerOnSecondBitFirstBitOne(localNameIndex); - } - - public final void writeLowLevelEndStartElement() throws IOException { - if (hasMark()) { - resetMark(); - } else { - // Terminate the attributes - _b = EncodingConstants.TERMINATOR; - _terminate = true; - } - } - - public final void writeLowLevelEndElement() throws IOException { - encodeElementTermination(); - } - - public final void writeLowLevelText(char[] text, int length) throws IOException { - if (length == 0) - return; - - encodeTermination(); - - encodeCharacters(text, 0, length); - } - - public final void writeLowLevelText(String text) throws IOException { - final int length = text.length(); - if (length == 0) - return; - - encodeTermination(); - - if (length < _charBuffer.length) { - text.getChars(0, length, _charBuffer, 0); - encodeCharacters(_charBuffer, 0, length); - } else { - final char ch[] = text.toCharArray(); - encodeCharactersNoClone(ch, 0, length); - } - } - - public final void writeLowLevelOctets(byte[] octets, int length) throws IOException { - if (length == 0) - return; - - encodeTermination(); - - encodeCIIOctetAlgorithmData(EncodingAlgorithmIndexes.BASE64, octets, 0, length); - } - - private boolean encodeElement(int type, String namespaceURI, String prefix, String localName) throws IOException { - final LocalNameQualifiedNamesMap.Entry entry = _v.elementName.obtainEntry(localName); - for (int i = 0; i < entry._valueIndex; i++) { - final QualifiedName name = entry._value[i]; - if ((prefix == name.prefix || prefix.equals(name.prefix)) - && (namespaceURI == name.namespaceName || namespaceURI.equals(name.namespaceName))) { - _b = type; - encodeNonZeroIntegerOnThirdBit(name.index); - return true; - } - } - - entry.addQualifiedName(new QualifiedName(prefix, namespaceURI, localName, "", _v.elementName.getNextIndex())); - return false; - } - - private boolean encodeAttribute(String namespaceURI, String prefix, String localName) throws IOException { - final LocalNameQualifiedNamesMap.Entry entry = _v.attributeName.obtainEntry(localName); - for (int i = 0; i < entry._valueIndex; i++) { - final QualifiedName name = entry._value[i]; - if ((prefix == name.prefix || prefix.equals(name.prefix)) - && (namespaceURI == name.namespaceName || namespaceURI.equals(name.namespaceName))) { - encodeNonZeroIntegerOnSecondBitFirstBitZero(name.index); - return true; - } - } - - entry.addQualifiedName(new QualifiedName(prefix, namespaceURI, localName, "", _v.attributeName.getNextIndex())); - return false; - } - - private void encodeLiteralHeader(int type, String namespaceURI, String prefix) throws IOException { - if (namespaceURI != "") { - type |= EncodingConstants.LITERAL_QNAME_NAMESPACE_NAME_FLAG; - if (prefix != "") - type |= EncodingConstants.LITERAL_QNAME_PREFIX_FLAG; - - write(type); - if (prefix != "") - encodeNonZeroIntegerOnSecondBitFirstBitOne(_v.prefix.get(prefix)); - encodeNonZeroIntegerOnSecondBitFirstBitOne(_v.namespaceName.get(namespaceURI)); - } else - write(type); - } - - private void encodeLiteral(int type, String namespaceURI, String prefix, String localName) throws IOException { - encodeLiteralHeader(type, namespaceURI, prefix); - - final int localNameIndex = _v.localName.obtainIndex(localName); - if (localNameIndex == -1) { - encodeNonEmptyOctetStringOnSecondBit(localName); - } else - encodeNonZeroIntegerOnSecondBitFirstBitOne(localNameIndex); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/StAXManager.java 2018-01-30 20:37:01.000000000 -0500 +++ /dev/null 2018-01-30 20:37:01.000000000 -0500 @@ -1,128 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax; - -import java.util.HashMap; -import javax.xml.stream.XMLInputFactory; -import javax.xml.stream.XMLOutputFactory; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class StAXManager { - protected static final String STAX_NOTATIONS = "javax.xml.stream.notations"; - protected static final String STAX_ENTITIES = "javax.xml.stream.entities"; - - HashMap features = new HashMap(); - - public static final int CONTEXT_READER = 1; - public static final int CONTEXT_WRITER = 2; - - - /** Creates a new instance of StAXManager */ - public StAXManager() { - } - - public StAXManager(int context) { - switch(context){ - case CONTEXT_READER:{ - initConfigurableReaderProperties(); - break; - } - case CONTEXT_WRITER:{ - initWriterProps(); - break; - } - } - } - - public StAXManager(StAXManager manager){ - - HashMap properties = manager.getProperties(); - features.putAll(properties); - } - - private HashMap getProperties(){ - return features ; - } - - private void initConfigurableReaderProperties(){ - //spec v1.0 default values - features.put(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE); - features.put(XMLInputFactory.IS_VALIDATING, Boolean.FALSE); - features.put(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE); - features.put(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.TRUE); - features.put(XMLInputFactory.IS_COALESCING, Boolean.FALSE); - features.put(XMLInputFactory.SUPPORT_DTD, Boolean.FALSE); - features.put(XMLInputFactory.REPORTER, null); - features.put(XMLInputFactory.RESOLVER, null); - features.put(XMLInputFactory.ALLOCATOR, null); - features.put(STAX_NOTATIONS,null ); - } - - private void initWriterProps(){ - features.put(XMLOutputFactory.IS_REPAIRING_NAMESPACES , Boolean.FALSE); - } - - /** - * public void reset(){ - * features.clear() ; - * } - */ - public boolean containsProperty(String property){ - return features.containsKey(property) ; - } - - public Object getProperty(String name){ - checkProperty(name); - return features.get(name); - } - - public void setProperty(String name, Object value){ - checkProperty(name); - if (name.equals(XMLInputFactory.IS_VALIDATING) && - Boolean.TRUE.equals(value)){ - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.validationNotSupported") + - CommonResourceBundle.getInstance().getString("support_validation")); - } else if (name.equals(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES) && - Boolean.TRUE.equals(value)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.externalEntities") + - CommonResourceBundle.getInstance().getString("resolve_external_entities_")); - } - features.put(name,value); - - } - - public void checkProperty(String name) { - if (!features.containsKey(name)) - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.propertyNotSupported", new Object[]{name})); - } - - public String toString(){ - return features.toString(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/AttributeBase.java 2018-01-30 20:37:01.000000000 -0500 +++ /dev/null 2018-01-30 20:37:02.000000000 -0500 @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events; - -import javax.xml.namespace.QName; -import javax.xml.stream.events.Attribute; - - - -public class AttributeBase extends EventBase implements Attribute - -{ - //an Attribute consists of a qualified name and value - private QName _QName; - private String _value; - - private String _attributeType = null; - //A flag indicating whether this attribute was actually specified in the start-tag - //of its element or was defaulted from the schema. - private boolean _specified = false; - - public AttributeBase(){ - super(ATTRIBUTE); - } - - public AttributeBase(String name, String value) { - super(ATTRIBUTE); - _QName = new QName(name); - _value = value; - } - - public AttributeBase(QName qname, String value) { - _QName = qname; - _value = value; - } - - public AttributeBase(String prefix, String localName, String value) { - this(prefix, null,localName, value, null); - } - - public AttributeBase(String prefix, String namespaceURI, String localName, - String value, String attributeType) { - if (prefix == null) prefix = ""; - _QName = new QName(namespaceURI, localName,prefix); - _value = value; - _attributeType = (attributeType == null) ? "CDATA":attributeType; - } - - - public void setName(QName name){ - _QName = name ; - } - - /** - * Returns the QName for this attribute - */ - public QName getName() { - return _QName; - } - - public void setValue(String value){ - _value = value; - } - - public String getLocalName() { - return _QName.getLocalPart(); - } - /** - * Gets the normalized value of this attribute - */ - public String getValue() { - return _value; - } - - public void setAttributeType(String attributeType){ - _attributeType = attributeType ; - } - - /** - * Gets the type of this attribute, default is - * the String "CDATA" - * @return the type as a String, default is "CDATA" - */ - public String getDTDType() { - return _attributeType; - } - - - /** - * A flag indicating whether this attribute was actually - * specified in the start-tag of its element, or was defaulted from the schema. - * @return returns true if this was specified in the start element - */ - public boolean isSpecified() { - return _specified ; - } - - public void setSpecified(boolean isSpecified){ - _specified = isSpecified ; - } - - - public String toString() { - String prefix = _QName.getPrefix(); - if (!Util.isEmptyString(prefix)) - return prefix + ":" + _QName.getLocalPart() + "='" + _value + "'"; - - return _QName.getLocalPart() + "='" + _value + "'"; - } - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/CharactersEvent.java 2018-01-30 20:37:02.000000000 -0500 +++ /dev/null 2018-01-30 20:37:02.000000000 -0500 @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events ; - -import com.sun.xml.internal.fastinfoset.org.apache.xerces.util.XMLChar; -import javax.xml.stream.events.Characters; - - -public class CharactersEvent extends EventBase implements Characters { - private String _text; - private boolean isCData=false; - private boolean isSpace=false; - private boolean isIgnorable=false; - private boolean needtoCheck = true; - - public CharactersEvent() { - super(CHARACTERS); - } - /** - * - * @param data Character Data. - */ - public CharactersEvent(String data) { - super(CHARACTERS); - _text = data; - } - - /** - * - * @param data Character Data. - * @param isCData true if is CData - */ - public CharactersEvent(String data, boolean isCData) { - super(CHARACTERS); - _text = data; - this.isCData = isCData; - } - - /** - * Get the character data of this event - */ - public String getData() { - return _text; - } - - public void setData(String data){ - _text = data; - } - - /** - * - * @return boolean returns true if the data is CData - */ - public boolean isCData() { - return isCData; - } - - /** - * - * @return String return the String representation of this event. - */ - public String toString() { - if(isCData) - return ""; - else - return _text; - } - - /** - * Return true if this is ignorableWhiteSpace. If - * this event is ignorableWhiteSpace its event type will - * be SPACE. - * @return boolean true if this is ignorableWhiteSpace. - */ - public boolean isIgnorableWhiteSpace() { - return isIgnorable; - } - - /** - * Returns true if this set of Characters are all whitespace. Whitspace inside a document - * is reported as CHARACTERS. This method allows checking of CHARACTERS events to see - * if they are composed of only whitespace characters - * @return boolean true if this set of Characters are all whitespace - */ - public boolean isWhiteSpace() { - //no synchronization checks made. - if(needtoCheck){ - checkWhiteSpace(); - needtoCheck = false; - } - return isSpace; - } - - public void setSpace(boolean isSpace) { - this.isSpace = isSpace; - needtoCheck = false; - } - public void setIgnorable(boolean isIgnorable){ - this.isIgnorable = isIgnorable; - setEventType(SPACE); - } - private void checkWhiteSpace(){ - //refer to xerces XMLChar - if(!Util.isEmptyString(_text)){ - isSpace = true; - for(int i=0;i<_text.length();i++){ - if(!XMLChar.isSpace(_text.charAt(i))){ - isSpace = false; - break; - } - } - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/CommentEvent.java 2018-01-30 20:37:03.000000000 -0500 +++ /dev/null 2018-01-30 20:37:03.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events ; - - -import javax.xml.stream.events.Comment; - -public class CommentEvent extends EventBase implements Comment { - - /* String data for this event */ - private String _text; - - public CommentEvent() { - super(COMMENT); - } - - public CommentEvent(String text) { - this(); - _text = text; - } - - - /** - * @return String String representation of this event - */ - public String toString() { - return ""; - } - - /** - * Return the string data of the comment, returns empty string if it - * does not exist - */ - public String getText() { - return _text ; - } - - public void setText(String text) { - _text = text; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/DTDEvent.java 2018-01-30 20:37:04.000000000 -0500 +++ /dev/null 2018-01-30 20:37:04.000000000 -0500 @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events; - -import java.util.List; - -import javax.xml.stream.events.DTD; -import javax.xml.stream.events.EntityDeclaration; -import javax.xml.stream.events.NotationDeclaration; - -/** - * DTDEvent. Notations and Entities are not used - */ -public class DTDEvent extends EventBase implements DTD{ - - private String _dtd; - private List _notations; - private List _entities; - - /** Creates a new instance of DTDEvent */ - public DTDEvent() { - setEventType(DTD); - } - - public DTDEvent(String dtd){ - setEventType(DTD); - _dtd = dtd; - } - - /** - * Returns the entire Document Type Declaration as a string, including - * the internal DTD subset. - * This may be null if there is not an internal subset. - * If it is not null it must return the entire - * Document Type Declaration which matches the doctypedecl - * production in the XML 1.0 specification - */ - public String getDocumentTypeDeclaration() { - return _dtd; - } - public void setDTD(String dtd){ - _dtd = dtd; - } - - /** - * Return a List containing the general entities, - * both external and internal, declared in the DTD. - * This list must contain EntityDeclaration events. - * @see EntityDeclaration - * @return an unordered list of EntityDeclaration events - */ - public List getEntities() { - return _entities; - } - - /** - * Return a List containing the notations declared in the DTD. - * This list must contain NotationDeclaration events. - * @see NotationDeclaration - * @return an unordered list of NotationDeclaration events - */ - public List getNotations() { - return _notations; - } - - /** - *Returns an implementation defined representation of the DTD. - * This method may return null if no representation is available. - * - */ - public Object getProcessedDTD() { - return null; - } - - public void setEntities(List entites){ - _entities = entites; - } - - public void setNotations(List notations){ - _notations = notations; - } - - public String toString(){ - return _dtd ; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/EmptyIterator.java 2018-01-30 20:37:05.000000000 -0500 +++ /dev/null 2018-01-30 20:37:05.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events; -import java.util.Iterator; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; -import java.util.NoSuchElementException; - - -public class EmptyIterator implements Iterator { - public static final EmptyIterator instance = new EmptyIterator(); - /** Creates a new instance of EmptyIterator */ - private EmptyIterator() { - } - public static EmptyIterator getInstance() { - return instance; - } - public boolean hasNext() { - return false; - } - public Object next() throws NoSuchElementException { - throw new NoSuchElementException(); - } - public void remove() { - throw new UnsupportedOperationException(CommonResourceBundle.getInstance().getString("message.emptyIterator")); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/EndDocumentEvent.java 2018-01-30 20:37:06.000000000 -0500 +++ /dev/null 2018-01-30 20:37:06.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events ; - -import javax.xml.stream.events.EndDocument; - - -public class EndDocumentEvent extends EventBase implements EndDocument { - - public EndDocumentEvent() { - super(END_DOCUMENT); - } - - public String toString() { - return ""; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/EndElementEvent.java 2018-01-30 20:37:06.000000000 -0500 +++ /dev/null 2018-01-30 20:37:06.000000000 -0500 @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events ; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.xml.namespace.QName; -import javax.xml.stream.events.EndElement; -import javax.xml.stream.events.Namespace; - -import com.sun.xml.internal.fastinfoset.stax.events.EmptyIterator; - - -public class EndElementEvent extends EventBase implements EndElement { - - List _namespaces = null; - QName _qname ; - - public void reset() { - if (_namespaces != null) _namespaces.clear(); - } - - public EndElementEvent() { - setEventType(END_ELEMENT); - } - - public EndElementEvent(String prefix, String namespaceURI, String localpart) { - _qname = getQName(namespaceURI,localpart,prefix); - setEventType(END_ELEMENT); - } - - public EndElementEvent(QName qname) { - _qname = qname; - setEventType(END_ELEMENT); - } - - /** - * Get the name of this event - * @return the qualified name of this event - */ - public QName getName() { - return _qname; - } - - public void setName(QName qname) { - _qname = qname; - } - - - /** Returns an Iterator of namespaces that have gone out - * of scope. Returns an empty iterator if no namespaces have gone - * out of scope. - * @return an Iterator over Namespace interfaces, or an - * empty iterator - */ - public Iterator getNamespaces() { - if(_namespaces != null) - return _namespaces.iterator(); - return EmptyIterator.getInstance(); - } - - public void addNamespace(Namespace namespace){ - if (_namespaces == null) { - _namespaces = new ArrayList(); - } - _namespaces.add(namespace); - } - - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append(""); - return sb.toString(); - } - - - private String nameAsString() { - if("".equals(_qname.getNamespaceURI())) - return _qname.getLocalPart(); - if(_qname.getPrefix() != null) - return "['" + _qname.getNamespaceURI() + "']:" + _qname.getPrefix() + ":" + _qname.getLocalPart(); - else - return "['" + _qname.getNamespaceURI() + "']:" + _qname.getLocalPart(); - } - private QName getQName(String uri, String localPart, String prefix){ - QName qn = null; - if(prefix != null && uri != null) - qn = new QName(uri, localPart, prefix); - else if(prefix == null && uri != null) - qn = new QName(uri, localPart); - else if(prefix == null && uri == null) - qn = new QName(localPart); - return qn; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/EntityDeclarationImpl.java 2018-01-30 20:37:07.000000000 -0500 +++ /dev/null 2018-01-30 20:37:07.000000000 -0500 @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events; - -import javax.xml.stream.events.EntityDeclaration; - - -public class EntityDeclarationImpl extends EventBase implements EntityDeclaration { - private String _publicId; - private String _systemId; - private String _baseURI; - private String _entityName; - private String _replacement; - private String _notationName; - - /** Creates a new instance of EntityDeclarationImpl */ - public EntityDeclarationImpl() { - init(); - } - - public EntityDeclarationImpl(String entityName , String replacement){ - init(); - _entityName = entityName; - _replacement = replacement; - } - - /** - * The entity's public identifier, or null if none was given - * @return the public ID for this declaration or null - */ - public String getPublicId(){ - return _publicId; - } - - /** - * The entity's system identifier. - * @return the system ID for this declaration or null - */ - public String getSystemId(){ - return _systemId; - } - - /** - * The entity's name - * @return the name, may not be null - */ - public String getName(){ - return _entityName; - } - - /** - * The name of the associated notation. - * @return the notation name - */ - public String getNotationName() { - return _notationName; - } - - /** - * The replacement text of the entity. - * This method will only return non-null - * if this is an internal entity. - * @return null or the replacment text - */ - public String getReplacementText() { - return _replacement; - } - - /** - * Get the base URI for this reference - * or null if this information is not available - * @return the base URI or null - */ - public String getBaseURI() { - return _baseURI; - } - - public void setPublicId(String publicId) { - _publicId = publicId; - } - - public void setSystemId(String systemId) { - _systemId = systemId; - } - - public void setBaseURI(String baseURI) { - _baseURI = baseURI; - } - - public void setName(String entityName){ - _entityName = entityName; - } - - public void setReplacementText(String replacement){ - _replacement = replacement; - } - - public void setNotationName(String notationName){ - _notationName = notationName; - } - - protected void init(){ - setEventType(ENTITY_DECLARATION); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/EntityReferenceEvent.java 2018-01-30 20:37:08.000000000 -0500 +++ /dev/null 2018-01-30 20:37:08.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events ; - -import javax.xml.stream.events.EntityDeclaration; -import javax.xml.stream.events.EntityReference; - - -public class EntityReferenceEvent extends EventBase implements EntityReference { - private EntityDeclaration _entityDeclaration ; - private String _entityName; - - public EntityReferenceEvent() { - init(); - } - - public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) { - init(); - _entityName = entityName; - _entityDeclaration = entityDeclaration; - } - - /** - * The name of the entity - * @return the entity's name, may not be null - */ - public String getName() { - return _entityName; - } - - /** - * Return the declaration of this entity. - */ - public EntityDeclaration getDeclaration(){ - return _entityDeclaration ; - } - - public void setName(String name){ - _entityName = name; - } - - public void setDeclaration(EntityDeclaration declaration) { - _entityDeclaration = declaration ; - } - - public String toString() { - String text = _entityDeclaration.getReplacementText(); - if(text == null) - text = ""; - return "&" + getName() + ";='" + text + "'"; - } - - protected void init() { - setEventType(ENTITY_REFERENCE); - } - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/EventBase.java 2018-01-30 20:37:09.000000000 -0500 +++ /dev/null 2018-01-30 20:37:09.000000000 -0500 @@ -1,220 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events ; - -import javax.xml.stream.Location; -import javax.xml.stream.events.XMLEvent; -import javax.xml.stream.events.Characters; -import javax.xml.stream.events.EndElement; -import javax.xml.stream.events.StartElement; -import javax.xml.namespace.QName; -import java.io.Writer; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - - -public abstract class EventBase implements XMLEvent { - - /* Event type this event corresponds to */ - protected int _eventType; - protected Location _location = null; - - public EventBase() { - - } - - public EventBase(int eventType) { - _eventType = eventType; - } - - /** - * Returns an integer code for this event. - */ - public int getEventType() { - return _eventType; - } - - protected void setEventType(int eventType){ - _eventType = eventType; - } - - - public boolean isStartElement() { - return _eventType == START_ELEMENT; - } - - public boolean isEndElement() { - return _eventType == END_ELEMENT; - } - - public boolean isEntityReference() { - return _eventType == ENTITY_REFERENCE; - } - - public boolean isProcessingInstruction() { - return _eventType == PROCESSING_INSTRUCTION; - } - - public boolean isStartDocument() { - return _eventType == START_DOCUMENT; - } - - public boolean isEndDocument() { - return _eventType == END_DOCUMENT; - } - - /** - * Return the location of this event. The Location - * returned from this method is non-volatile and - * will retain its information. - * @see javax.xml.stream.Location - */ - public Location getLocation(){ - return _location; - } - - public void setLocation(Location loc){ - _location = loc; - } - public String getSystemId() { - if(_location == null ) - return ""; - else - return _location.getSystemId(); - } - - /** Returns this event as Characters, may result in - * a class cast exception if this event is not Characters. - */ - public Characters asCharacters() { - if (isCharacters()) { - return (Characters)this; - } else - throw new ClassCastException(CommonResourceBundle.getInstance().getString("message.charactersCast", new Object[]{getEventTypeString()})); - } - - /** Returns this event as an end element event, may result in - * a class cast exception if this event is not a end element. - */ - public EndElement asEndElement() { - if (isEndElement()) { - return (EndElement)this; - } else - throw new ClassCastException(CommonResourceBundle.getInstance().getString("message.endElementCase", new Object[]{getEventTypeString()})); - } - - /** - * Returns this event as a start element event, may result in - * a class cast exception if this event is not a start element. - */ - public StartElement asStartElement() { - if (isStartElement()) { - return (StartElement)this; - } else - throw new ClassCastException(CommonResourceBundle.getInstance().getString("message.startElementCase", new Object[]{getEventTypeString()})); - } - - /** - * This method is provided for implementations to provide - * optional type information about the associated event. - * It is optional and will return null if no information - * is available. - */ - public QName getSchemaType() { - return null; - } - - /** A utility function to check if this event is an Attribute. - * @see javax.xml.stream.events.Attribute - */ - public boolean isAttribute() { - return _eventType == ATTRIBUTE; - } - - /** A utility function to check if this event is Characters. - * @see javax.xml.stream.events.Characters - */ - public boolean isCharacters() { - return _eventType == CHARACTERS; - } - - /** A utility function to check if this event is a Namespace. - * @see javax.xml.stream.events.Namespace - */ - public boolean isNamespace() { - return _eventType == NAMESPACE; - } - - - /** - * This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters. - * No indentation or whitespace should be outputted. - * - * Any user defined event type SHALL have this method - * called when being written to on an output stream. - * Built in Event types MUST implement this method, - * but implementations MAY choose not call these methods - * for optimizations reasons when writing out built in - * Events to an output stream. - * The output generated MUST be equivalent in terms of the - * infoset expressed. - * - * @param writer The writer that will output the data - * @throws XMLStreamException if there is a fatal error writing the event - */ - public void writeAsEncodedUnicode(Writer writer) throws javax.xml.stream.XMLStreamException { - } - - private String getEventTypeString() { - switch (_eventType){ - case START_ELEMENT: - return "StartElementEvent"; - case END_ELEMENT: - return "EndElementEvent"; - case PROCESSING_INSTRUCTION: - return "ProcessingInstructionEvent"; - case CHARACTERS: - return "CharacterEvent"; - case COMMENT: - return "CommentEvent"; - case START_DOCUMENT: - return "StartDocumentEvent"; - case END_DOCUMENT: - return "EndDocumentEvent"; - case ENTITY_REFERENCE: - return "EntityReferenceEvent"; - case ATTRIBUTE: - return "AttributeBase"; - case DTD: - return "DTDEvent"; - case CDATA: - return "CDATA"; - } - return "UNKNOWN_EVENT_TYPE"; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/NamespaceBase.java 2018-01-30 20:37:09.000000000 -0500 +++ /dev/null 2018-01-30 20:37:09.000000000 -0500 @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events; - -import javax.xml.namespace.QName; -import javax.xml.stream.events.Namespace; - - -public class NamespaceBase extends AttributeBase implements Namespace{ - //J2SE1.5.0 javax.xml.XMLConstants - static final String DEFAULT_NS_PREFIX = ""; - static final String XML_NS_URI = "http://www.w3.org/XML/1998/namespace"; - static final String XML_NS_PREFIX = "xml"; - static final String XMLNS_ATTRIBUTE_NS_URI = "http://www.w3.org/2000/xmlns/"; - static final String XMLNS_ATTRIBUTE = "xmlns"; - static final String W3C_XML_SCHEMA_NS_URI = "http://www.w3.org/2001/XMLSchema"; - static final String W3C_XML_SCHEMA_INSTANCE_NS_URI = "http://www.w3.org/2001/XMLSchema-instance"; - - //is this namespace default declaration? - private boolean defaultDeclaration = false; - - /** a namespace attribute has a form: xmlns:NCName="URI reference" */ - public NamespaceBase(String namespaceURI) { - super(XMLNS_ATTRIBUTE, "", namespaceURI); - setEventType(NAMESPACE); - } - - /** - * Create a new Namespace - * @param prefix prefix of a namespace is the local name for an attribute - * @param namespaceURI the uri reference of a namespace is the value for an attribute - */ - public NamespaceBase(String prefix, String namespaceURI){ - super(XMLNS_ATTRIBUTE, prefix, namespaceURI); - setEventType(NAMESPACE); - if (Util.isEmptyString(prefix)) { - defaultDeclaration=true; - } - } - - void setPrefix(String prefix){ - if(prefix == null) - setName(new QName(XMLNS_ATTRIBUTE_NS_URI,DEFAULT_NS_PREFIX,XMLNS_ATTRIBUTE)); - else// new QName(uri, localpart, prefix) - setName(new QName(XMLNS_ATTRIBUTE_NS_URI,prefix,XMLNS_ATTRIBUTE)); - } - - public String getPrefix() { - if (defaultDeclaration) return ""; - return super.getLocalName(); - } - - - /** - * set Namespace URI reference (xmlns:prefix = "uri") - * @param uri the uri reference of a namespace is the value for an attribute - */ - void setNamespaceURI(String uri) { - setValue(uri); - } - public String getNamespaceURI() { - return getValue(); - } - - - public boolean isNamespace(){ - return true; - } - - public boolean isDefaultNamespaceDeclaration() { - return defaultDeclaration; - } - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/ProcessingInstructionEvent.java 2018-01-30 20:37:10.000000000 -0500 +++ /dev/null 2018-01-30 20:37:10.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events ; - -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.events.ProcessingInstruction; - - -public class ProcessingInstructionEvent extends EventBase implements ProcessingInstruction { - - private String targetName; - private String _data; - - public ProcessingInstructionEvent() { - init(); - } - - public ProcessingInstructionEvent(String targetName, String data) { - this.targetName = targetName; - _data = data; - init(); - } - - protected void init() { - setEventType(XMLStreamConstants.PROCESSING_INSTRUCTION); - } - - public String getTarget() { - return targetName; - } - - public void setTarget(String targetName) { - this.targetName = targetName; - } - - public void setData(String data) { - _data = data; - } - - public String getData() { - return _data; - } - - public String toString() { - if(_data != null && targetName != null) - return ""; - if(targetName != null) - return ""; - if(_data != null) - return ""; - else - return ""; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/ReadIterator.java 2018-01-30 20:37:11.000000000 -0500 +++ /dev/null 2018-01-30 20:37:11.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events; - -import java.util.Iterator; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class ReadIterator implements Iterator { - - Iterator iterator = EmptyIterator.getInstance(); - - public ReadIterator(){ - } - - public ReadIterator(Iterator iterator){ - if (iterator != null) { - this.iterator = iterator; - } - } - - public boolean hasNext() { - return iterator.hasNext(); - } - - public Object next() { - return iterator.next(); - } - - public void remove() { - throw new UnsupportedOperationException(CommonResourceBundle.getInstance().getString("message.readonlyList")); - } - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/StAXEventAllocatorBase.java 2018-01-30 20:37:12.000000000 -0500 +++ /dev/null 2018-01-30 20:37:12.000000000 -0500 @@ -1,225 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events; - -import javax.xml.stream.XMLEventFactory; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.events.Namespace; -import javax.xml.stream.events.XMLEvent; -import javax.xml.stream.util.XMLEventAllocator; -import javax.xml.stream.util.XMLEventConsumer; - -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -/** - * allows a user to register a way to allocate events given an XMLStreamReader. - * The XMLEventAllocator can be set on an XMLInputFactory - * using the property "javax.xml.stream.allocator" - * - * This base class uses EventFactory to create events as recommended in the JavaDoc of XMLEventAllocator. - * However, creating new object per each event reduces performance. The implementation of - * EventReader therefore will set the Allocator to StAXEventAllocator which implements the - * Allocate methods without creating new objects. - * - * The spec for the first Allocate method states that it must NOT modify the state of the Reader - * while the second MAY. For consistency, both Allocate methods in this implementation will - * NOT modify the state. - * - */ -public class StAXEventAllocatorBase implements XMLEventAllocator { - XMLEventFactory factory; - - /** Creates a new instance of XMLEventAllocator */ - public StAXEventAllocatorBase() { - if (System.getProperty("javax.xml.stream.XMLEventFactory")==null) { - System.setProperty("javax.xml.stream.XMLEventFactory", - "com.sun.xml.internal.fastinfoset.stax.factory.StAXEventFactory"); - } - factory = XMLEventFactory.newInstance(); - } - - // ---------------------methods defined by XMLEventAllocator-----------------// - - /** - * This method creates an instance of the XMLEventAllocator. This - * allows the XMLInputFactory to allocate a new instance per reader. - */ - public XMLEventAllocator newInstance() { - return new StAXEventAllocatorBase(); - } - - /** - * This method allocates an event given the current state of the XMLStreamReader. - * If this XMLEventAllocator does not have a one-to-one mapping between reader state - * and events this method will return null. - * @param streamReader The XMLStreamReader to allocate from - * @return the event corresponding to the current reader state - */ - public XMLEvent allocate(XMLStreamReader streamReader) throws XMLStreamException { - if(streamReader == null ) - throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.nullReader")); - return getXMLEvent(streamReader); - } - - /** - * This method allocates an event or set of events given the current state of - * the XMLStreamReader and adds the event or set of events to the consumer that - * was passed in. - * @param streamReader The XMLStreamReader to allocate from - * @param consumer The XMLEventConsumer to add to. - */ - public void allocate(XMLStreamReader streamReader, XMLEventConsumer consumer) throws XMLStreamException { - consumer.add(getXMLEvent(streamReader)); - - } - // ---------------------end of methods defined by XMLEventAllocator-----------------// - - - XMLEvent getXMLEvent(XMLStreamReader reader){ - XMLEvent event = null; - //returns the current event - int eventType = reader.getEventType(); - //this needs to be set before creating events - factory.setLocation(reader.getLocation()); - switch(eventType){ - - case XMLEvent.START_ELEMENT: - { - StartElementEvent startElement = (StartElementEvent)factory.createStartElement(reader.getPrefix(), - reader.getNamespaceURI(), reader.getLocalName()); - - addAttributes(startElement,reader); - addNamespaces(startElement, reader); - //need to fix it along with the Reader - //setNamespaceContext(startElement,reader); - event = startElement; - break; - } - case XMLEvent.END_ELEMENT: - { - EndElementEvent endElement = (EndElementEvent)factory.createEndElement( - reader.getPrefix(), reader.getNamespaceURI(), reader.getLocalName()); - addNamespaces(endElement,reader); - event = endElement ; - break; - } - case XMLEvent.PROCESSING_INSTRUCTION: - { - event = factory.createProcessingInstruction(reader.getPITarget(),reader.getPIData()); - break; - } - case XMLEvent.CHARACTERS: - { - if (reader.isWhiteSpace()) - event = factory.createSpace(reader.getText()); - else - event = factory.createCharacters(reader.getText()); - - break; - } - case XMLEvent.COMMENT: - { - event = factory.createComment(reader.getText()); - break; - } - case XMLEvent.START_DOCUMENT: - { - StartDocumentEvent docEvent = (StartDocumentEvent)factory.createStartDocument( - reader.getVersion(), reader.getEncoding(), reader.isStandalone()); - if(reader.getCharacterEncodingScheme() != null){ - docEvent.setDeclaredEncoding(true); - }else{ - docEvent.setDeclaredEncoding(false); - } - event = docEvent ; - break; - } - case XMLEvent.END_DOCUMENT:{ - EndDocumentEvent endDocumentEvent = new EndDocumentEvent() ; - event = endDocumentEvent ; - break; - } - case XMLEvent.ENTITY_REFERENCE:{ - event = factory.createEntityReference(reader.getLocalName(), - new EntityDeclarationImpl(reader.getLocalName(),reader.getText())); - break; - - } - case XMLEvent.ATTRIBUTE:{ - event = null ; - break; - } - case XMLEvent.DTD:{ - event = factory.createDTD(reader.getText()); - break; - } - case XMLEvent.CDATA:{ - event = factory.createCData(reader.getText()); - break; - } - case XMLEvent.SPACE:{ - event = factory.createSpace(reader.getText()); - break; - } - } - return event ; - } - - //use event.addAttribute instead of addAttributes to avoid creating another list - protected void addAttributes(StartElementEvent event,XMLStreamReader streamReader){ - AttributeBase attr = null; - for(int i=0; i"; - else - s = s + " standalone='no'?>"; - } else { - s = s + "?>"; - } - return s; - } - - public boolean isStartDocument() { - return true; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/StartElementEvent.java 2018-01-30 20:37:15.000000000 -0500 +++ /dev/null 2018-01-30 20:37:15.000000000 -0500 @@ -1,260 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events ; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.xml.namespace.NamespaceContext; -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.events.Attribute; -import javax.xml.stream.events.Namespace; -import javax.xml.stream.events.StartElement; - - -public class StartElementEvent extends EventBase implements StartElement { - - private Map _attributes; - private List _namespaces; - private NamespaceContext _context = null; - private QName _qname; - - public void reset() { - if (_attributes != null) _attributes.clear(); - if (_namespaces != null) _namespaces.clear(); - if (_context != null) _context = null; - } - - public StartElementEvent() { - init(); - } - - public StartElementEvent(String prefix, String uri, String localpart) { - init(); - if (uri == null) uri = ""; - if (prefix == null) prefix =""; - _qname = new QName(uri, localpart, prefix); - setEventType(START_ELEMENT); - } - - public StartElementEvent(QName qname) { - init(); - _qname = qname; - } - - public StartElementEvent(StartElement startelement) { - this(startelement.getName()); - addAttributes(startelement.getAttributes()); - addNamespaces(startelement.getNamespaces()); - } - - protected void init() { - setEventType(XMLStreamConstants.START_ELEMENT); - _attributes = new HashMap(); - _namespaces = new ArrayList(); - } - - // ---------------------methods defined by StartElement-----------------// - /** - * Get the name of this event - * @return the qualified name of this event - */ - public QName getName() { - return _qname; - } - /** - * Returns an Iterator of non-namespace declared attributes - * returns an empty iterator if there are no attributes. The - * iterator must contain only implementations of the javax.xml.stream.Attribute - * interface. Attributes are fundamentally unordered and may not be reported - * in any order. - * - * @return a readonly Iterator over Attribute interfaces, or an - * empty iterator - */ - public Iterator getAttributes() { - if(_attributes != null){ - Collection coll = _attributes.values(); - return new ReadIterator(coll.iterator()); - } - return EmptyIterator.getInstance(); - } - - /** - * Returns an Iterator of namespaces declared on this element. - * This Iterator does not contain previously declared namespaces - * unless they appear on the current START_ELEMENT. - * Therefore this list may contain redeclared namespaces and duplicate namespace - * declarations. Use the getNamespaceContext() method to get the - * current context of namespace declarations. - * - *

The iterator must contain only implementations of the - * javax.xml.stream.Namespace interface. - * - *

A Namespace is an Attribute. One - * can iterate over a list of namespaces as a list of attributes. - * However this method returns only the list of namespaces - * declared on this START_ELEMENT and does not - * include the attributes declared on this START_ELEMENT. - * - * @return a readonly Iterator over Namespace interfaces, or an - * empty iterator if there are no namespaces. - * - */ - public Iterator getNamespaces() { - if(_namespaces != null){ - return new ReadIterator(_namespaces.iterator()); - } - return EmptyIterator.getInstance(); - } - - /** - * Returns the attribute referred to by this name - * @param qname the qname of the desired name - * @return the attribute corresponding to the name value or null - */ - public Attribute getAttributeByName(QName qname) { - if(qname == null) - return null; - return (Attribute)_attributes.get(qname); - } - - /** Gets a read-only namespace context. If no context is - * available this method will return an empty namespace context. - * The NamespaceContext contains information about all namespaces - * in scope for this StartElement. - * - * @return the current namespace context - */ - public NamespaceContext getNamespaceContext() { - return _context; - } -// ---------------------end of methods defined by StartElement-----------------// - - public void setName(QName qname) { - this._qname = qname; - } - - - public String getNamespace(){ - return _qname.getNamespaceURI(); - } - - /** - * Gets the value that the prefix is bound to in the - * context of this element. Returns null if - * the prefix is not bound in this context - * @param prefix the prefix to lookup - * @return the uri bound to the prefix or null - */ - public String getNamespaceURI(String prefix) { - //first check if the URI was supplied when creating this startElement event - if( getNamespace() != null ) return getNamespace(); - //else check the namespace context - if(_context != null) - return _context.getNamespaceURI(prefix); - return null; - } - - public String toString() { - final StringBuilder sb = new StringBuilder(64); - - sb.append('<').append(nameAsString()); - - if(_attributes != null){ - Iterator it = this.getAttributes(); - Attribute attr = null; - while(it.hasNext()){ - attr = (Attribute)it.next(); - sb.append(' ').append(attr.toString()); - } - } - - if(_namespaces != null){ - Iterator it = _namespaces.iterator(); - Namespace attr = null; - while(it.hasNext()){ - attr = (Namespace)it.next(); - sb.append(' ').append(attr.toString()); - } - } - sb.append('>'); - return sb.toString(); - } - - /** Return this event as String - * @return String Event returned as string. - */ - public String nameAsString() { - if("".equals(_qname.getNamespaceURI())) - return _qname.getLocalPart(); - if(_qname.getPrefix() != null) - return "['" + _qname.getNamespaceURI() + "']:" + _qname.getPrefix() + ":" + _qname.getLocalPart(); - else - return "['" + _qname.getNamespaceURI() + "']:" + _qname.getLocalPart(); - } - - - public void setNamespaceContext(NamespaceContext context) { - _context = context; - } - - public void addAttribute(Attribute attr){ - _attributes.put(attr.getName(),attr); - } - - public void addAttributes(Iterator attrs){ - if(attrs != null) { - while(attrs.hasNext()){ - Attribute attr = (Attribute)attrs.next(); - _attributes.put(attr.getName(),attr); - } - } - } - - public void addNamespace(Namespace namespace){ - if(namespace != null) { - _namespaces.add(namespace); - } - } - - public void addNamespaces(Iterator namespaces){ - if(namespaces != null) { - while(namespaces.hasNext()){ - Namespace namespace = (Namespace)namespaces.next(); - _namespaces.add(namespace); - } - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/Util.java 2018-01-30 20:37:16.000000000 -0500 +++ /dev/null 2018-01-30 20:37:16.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events; - -import javax.xml.stream.XMLStreamConstants; - -/** A Utility class for the StAX Events implementation. - */ -public class Util { - - /** - * A string is empty if it's null or contains nothing - * - * @param s The string to check. - */ - public static boolean isEmptyString(String s) { - if (s != null && !s.equals("")) - return false; - else - return true; - } - - public final static String getEventTypeString(int eventType) { - switch (eventType){ - case XMLStreamConstants.START_ELEMENT: - return "START_ELEMENT"; - case XMLStreamConstants.END_ELEMENT: - return "END_ELEMENT"; - case XMLStreamConstants.PROCESSING_INSTRUCTION: - return "PROCESSING_INSTRUCTION"; - case XMLStreamConstants.CHARACTERS: - return "CHARACTERS"; - case XMLStreamConstants.COMMENT: - return "COMMENT"; - case XMLStreamConstants.START_DOCUMENT: - return "START_DOCUMENT"; - case XMLStreamConstants.END_DOCUMENT: - return "END_DOCUMENT"; - case XMLStreamConstants.ENTITY_REFERENCE: - return "ENTITY_REFERENCE"; - case XMLStreamConstants.ATTRIBUTE: - return "ATTRIBUTE"; - case XMLStreamConstants.DTD: - return "DTD"; - case XMLStreamConstants.CDATA: - return "CDATA"; - } - return "UNKNOWN_EVENT_TYPE"; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/events/XMLConstants.java 2018-01-30 20:37:17.000000000 -0500 +++ /dev/null 2018-01-30 20:37:17.000000000 -0500 @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.events; - - -public class XMLConstants { - - public static final String ENCODING = "UTF-8"; - public static final String XMLVERSION = "1.0"; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/factory/StAXEventFactory.java 2018-01-30 20:37:18.000000000 -0500 +++ /dev/null 2018-01-30 20:37:18.000000000 -0500 @@ -1,342 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.factory; - -import javax.xml.namespace.QName; -import javax.xml.namespace.NamespaceContext; -import javax.xml.stream.Location; -import javax.xml.stream.XMLEventFactory; -import javax.xml.stream.events.*; -import java.util.Iterator; -import com.sun.xml.internal.fastinfoset.stax.events.*; - - -public class StAXEventFactory extends XMLEventFactory { - Location location = null; - - /** Creates a new instance of StAXEventFactory */ - public StAXEventFactory() { - } - /** - * This method allows setting of the Location on each event that - * is created by this factory. The values are copied by value into - * the events created by this factory. To reset the location - * information set the location to null. - * @param location the location to set on each event created - */ - public void setLocation(Location location) { - this.location = location; - } - - /** - * Create a new Attribute - * @param prefix the prefix of this attribute, may not be null - * @param namespaceURI the attribute value is set to this value, may not be null - * @param localName the local name of the XML name of the attribute, localName cannot be null - * @param value the attribute value to set, may not be null - * @return the Attribute with specified values - */ - public Attribute createAttribute(String prefix, String namespaceURI, String localName, String value) { - AttributeBase attr = new AttributeBase(prefix, namespaceURI, localName, value, null); - if(location != null)attr.setLocation(location); - return attr; - } - - /** - * Create a new Attribute - * @param localName the local name of the XML name of the attribute, localName cannot be null - * @param value the attribute value to set, may not be null - * @return the Attribute with specified values - */ - public Attribute createAttribute(String localName, String value) { - AttributeBase attr = new AttributeBase(localName, value); - if(location != null)attr.setLocation(location); - return attr; - } - - public Attribute createAttribute(QName name, String value) { - AttributeBase attr = new AttributeBase(name, value); - if(location != null)attr.setLocation(location); - return attr; - } - - /** - * Create a new default Namespace - * @param namespaceURI the default namespace uri - * @return the Namespace with the specified value - */ - public Namespace createNamespace(String namespaceURI) { - NamespaceBase event = new NamespaceBase(namespaceURI); - if(location != null)event.setLocation(location); - return event; - } - - /** - * Create a new Namespace - * @param prefix the prefix of this namespace, may not be null - * @param namespaceURI the attribute value is set to this value, may not be null - * @return the Namespace with the specified values - */ - public Namespace createNamespace(String prefix, String namespaceURI) { - NamespaceBase event = new NamespaceBase(prefix, namespaceURI); - if(location != null)event.setLocation(location); - return event; - } - - /** - * Create a new StartElement. - * @param name the qualified name of the attribute, may not be null - * @param attributes an optional unordered set of objects that - * implement Attribute to add to the new StartElement, may be null - * @param namespaces an optional unordered set of objects that - * implement Namespace to add to the new StartElement, may be null - * @return an instance of the requested StartElement - */ - public StartElement createStartElement(QName name, Iterator attributes, Iterator namespaces) { - return createStartElement(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), attributes, namespaces); - } - - public StartElement createStartElement(String prefix, String namespaceUri, String localName) { - StartElementEvent event = new StartElementEvent(prefix, namespaceUri, localName); - if(location != null)event.setLocation(location); - return event; - } - - public StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator attributes, Iterator namespaces) { - return createStartElement(prefix, namespaceUri, localName, attributes, namespaces, null); - } - - public StartElement createStartElement(String prefix, String namespaceUri, String localName, Iterator attributes, Iterator namespaces, NamespaceContext context) { - StartElementEvent elem = new StartElementEvent(prefix, namespaceUri, localName); - elem.addAttributes(attributes); - elem.addNamespaces(namespaces); - elem.setNamespaceContext(context); - if(location != null)elem.setLocation(location); - return elem; - } - - /** - * Create a new EndElement - * @param name the qualified name of the EndElement - * @param namespaces an optional unordered set of objects that - * implement Namespace that have gone out of scope, may be null - * @return an instance of the requested EndElement - */ - public EndElement createEndElement(QName name, Iterator namespaces) { - return createEndElement(name.getPrefix(), name.getNamespaceURI(), name.getLocalPart(), namespaces); - } - - /** - * Create a new EndElement - * @param namespaceUri the uri of the QName of the new StartElement - * @param localName the local name of the QName of the new StartElement - * @param prefix the prefix of the QName of the new StartElement - * @return an instance of the requested EndElement - */ - public EndElement createEndElement(String prefix, String namespaceUri, String localName) { - EndElementEvent event = new EndElementEvent(prefix, namespaceUri, localName); - if(location != null)event.setLocation(location); - return event; - } - - /** - * Create a new EndElement - * @param namespaceUri the uri of the QName of the new StartElement - * @param localName the local name of the QName of the new StartElement - * @param prefix the prefix of the QName of the new StartElement - * @param namespaces an unordered set of objects that implement - * Namespace that have gone out of scope, may be null - * @return an instance of the requested EndElement - */ - public EndElement createEndElement(String prefix, String namespaceUri, String localName, Iterator namespaces) { - - EndElementEvent event = new EndElementEvent(prefix, namespaceUri, localName); - if(namespaces!=null){ - while(namespaces.hasNext()) - event.addNamespace((Namespace)namespaces.next()); - } - if(location != null)event.setLocation(location); - return event; - } - - /** - * Create a Characters event, this method does not check if the content - * is all whitespace. To create a space event use #createSpace(String) - * @param content the string to create - * @return a Characters event - */ - public Characters createCharacters(String content) { - CharactersEvent charEvent = new CharactersEvent(content); - if(location != null)charEvent.setLocation(location); - return charEvent; - } - - /** - * Create a Characters event with the CData flag set to true - * @param content the string to create - * @return a Characters event - */ - public Characters createCData(String content) { - CharactersEvent charEvent = new CharactersEvent(content, true); - if(location != null)charEvent.setLocation(location); - return charEvent; - } - - /** - * Create a Characters event with the isSpace flag set to true - * @param content the content of the space to create - * @return a Characters event - */ - public Characters createSpace(String content) { - CharactersEvent event = new CharactersEvent(content); - event.setSpace(true); - if(location != null)event.setLocation(location); - return event; - } - /** - * Create an ignorable space - * @param content the space to create - * @return a Characters event - */ - public Characters createIgnorableSpace(String content) { - CharactersEvent event = new CharactersEvent(content, false); - event.setSpace(true); - event.setIgnorable(true); - if(location != null)event.setLocation(location); - return event; - } - /** - * Creates a new instance of a StartDocument event - * @return a StartDocument event - */ - public StartDocument createStartDocument() { - StartDocumentEvent event = new StartDocumentEvent(); - if(location != null)event.setLocation(location); - return event; - } - - /** - * Creates a new instance of a StartDocument event - * - * @param encoding the encoding style - * @return a StartDocument event - */ - public StartDocument createStartDocument(String encoding) { - StartDocumentEvent event = new StartDocumentEvent(encoding); - if(location != null)event.setLocation(location); - return event; - } - - /** - * Creates a new instance of a StartDocument event - * - * @param encoding the encoding style - * @param version the XML version - * @return a StartDocument event - */ - public StartDocument createStartDocument(String encoding, String version) { - StartDocumentEvent event = new StartDocumentEvent(encoding, version); - if(location != null)event.setLocation(location); - return event; - } - - /** - * Creates a new instance of a StartDocument event - * - * @param encoding the encoding style - * @param version the XML version - * @param standalone the status of standalone may be set to "true" or "false" - * @return a StartDocument event - */ - public StartDocument createStartDocument(String encoding, String version, boolean standalone) { - StartDocumentEvent event = new StartDocumentEvent(encoding, version); - event.setStandalone(standalone); - if(location != null)event.setLocation(location); - return event; - } - - public EndDocument createEndDocument() { - EndDocumentEvent event =new EndDocumentEvent(); - if(location != null)event.setLocation(location); - return event; - } - - /** Creates a new instance of a EntityReference event - * - * @param name The name of the reference - * @param entityDeclaration the declaration for the event - * @return an EntityReference event - */ - public EntityReference createEntityReference(String name, EntityDeclaration entityDeclaration) { - EntityReferenceEvent event = new EntityReferenceEvent(name, entityDeclaration); - if(location != null)event.setLocation(location); - return event; - } - - /** - * Create a comment - * @param text The text of the comment - * a Comment event - */ - public Comment createComment(String text) { - CommentEvent charEvent = new CommentEvent(text); - if(location != null)charEvent.setLocation(location); - return charEvent; - } - - /** - * Create a document type definition event - * This string contains the entire document type declaration that matches - * the doctypedecl in the XML 1.0 specification - * @param dtd the text of the document type definition - * @return a DTD event - */ - public DTD createDTD(String dtd) { - DTDEvent dtdEvent = new DTDEvent(dtd); - if(location != null)dtdEvent.setLocation(location); - return dtdEvent; - } - - - /** - * Create a processing instruction - * @param target The target of the processing instruction - * @param data The text of the processing instruction - * @return a ProcessingInstruction event - */ - public ProcessingInstruction createProcessingInstruction(String target, String data) { - ProcessingInstructionEvent event = new ProcessingInstructionEvent(target, data); - if(location != null)event.setLocation(location); - return event; - } - - - - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/factory/StAXInputFactory.java 2018-01-30 20:37:18.000000000 -0500 +++ /dev/null 2018-01-30 20:37:18.000000000 -0500 @@ -1,256 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.factory; - -import com.sun.xml.internal.fastinfoset.stax.*; -import com.sun.xml.internal.fastinfoset.stax.events.StAXEventReader; -import com.sun.xml.internal.fastinfoset.stax.events.StAXFilteredEvent; -import com.sun.xml.internal.fastinfoset.stax.util.StAXFilteredParser; -import com.sun.xml.internal.fastinfoset.tools.XML_SAX_FI; - -import java.io.InputStream; -import java.io.Reader; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; - -import javax.xml.stream.*; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.util.XMLEventAllocator ; -import javax.xml.transform.Source; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class StAXInputFactory extends XMLInputFactory { - //List of supported properties and default values. - private StAXManager _manager = new StAXManager(StAXManager.CONTEXT_READER) ; - - public StAXInputFactory() { - } - - public static XMLInputFactory newInstance() { - return XMLInputFactory.newInstance(); - } - - /** - * Create a new XMLStreamReader from a reader - * @param xmlfile the XML data to read from - * @throws XMLStreamException - */ - public XMLStreamReader createXMLStreamReader(Reader xmlfile) throws XMLStreamException { - return getXMLStreamReader(xmlfile); - } - - public XMLStreamReader createXMLStreamReader(InputStream s) throws XMLStreamException { - return new StAXDocumentParser(s, _manager); - } - - public XMLStreamReader createXMLStreamReader(String systemId, Reader xmlfile) throws XMLStreamException { - return getXMLStreamReader(xmlfile); - } - - public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException { - return null; - } - - public XMLStreamReader createXMLStreamReader(String systemId, InputStream inputstream) throws XMLStreamException { - return createXMLStreamReader(inputstream); - } - - - public XMLStreamReader createXMLStreamReader(InputStream inputstream, String encoding) throws XMLStreamException { - return createXMLStreamReader(inputstream); - } - - - XMLStreamReader getXMLStreamReader(String systemId, InputStream inputstream, String encoding) - throws XMLStreamException{ - return createXMLStreamReader(inputstream); - - } - - /** - * @param inputstream - * @throws XMLStreamException - * @return - */ - XMLStreamReader getXMLStreamReader(Reader xmlfile) - throws XMLStreamException{ - - ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); - BufferedOutputStream bufferedStream = new BufferedOutputStream(byteStream); - StAXDocumentParser sr = null; - try { - XML_SAX_FI convertor = new XML_SAX_FI(); - convertor.convert(xmlfile, bufferedStream); - - ByteArrayInputStream byteInputStream = new ByteArrayInputStream(byteStream.toByteArray()); - InputStream document = new BufferedInputStream(byteInputStream); - sr = new StAXDocumentParser(); - sr.setInputStream(document); - sr.setManager(_manager); - return sr; - //return new StAXDocumentParser(document, _manager); - } catch (Exception e) { - return null; - } - - } - - - /** - * @param inputstream - * @throws XMLStreamException - * @return XMLEventReader - */ - public XMLEventReader createXMLEventReader(InputStream inputstream) throws XMLStreamException { - return new StAXEventReader(createXMLStreamReader(inputstream)); - } - - public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException { - return new StAXEventReader(createXMLStreamReader(reader)); - } - - public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException { - return new StAXEventReader(createXMLStreamReader(source)); - } - - public XMLEventReader createXMLEventReader(String systemId, InputStream inputstream) throws XMLStreamException { - return new StAXEventReader(createXMLStreamReader(systemId, inputstream)); - } - - public XMLEventReader createXMLEventReader(java.io.InputStream stream, String encoding) throws XMLStreamException { - return new StAXEventReader(createXMLStreamReader(stream, encoding)); - } - - public XMLEventReader createXMLEventReader(String systemId, Reader reader) throws XMLStreamException { - return new StAXEventReader(createXMLStreamReader(systemId, reader)); - } - - /** Create a new XMLEventReader from an XMLStreamReader. After being used - * to construct the XMLEventReader instance returned from this method - * the XMLStreamReader must not be used. - * @param streamReader the XMLStreamReader to read from (may not be modified) - * @return a new XMLEventReader - * @throws XMLStreamException - */ - public XMLEventReader createXMLEventReader(XMLStreamReader streamReader) throws XMLStreamException { - return new StAXEventReader(streamReader); - } - - public XMLEventAllocator getEventAllocator() { - return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR); - } - - public XMLReporter getXMLReporter() { - return (XMLReporter)_manager.getProperty(XMLInputFactory.REPORTER); - } - - public XMLResolver getXMLResolver() { - Object object = _manager.getProperty(XMLInputFactory.RESOLVER); - return (XMLResolver)object; - //return (XMLResolver)_manager.getProperty(XMLInputFactory.RESOLVER); - } - - public void setXMLReporter(XMLReporter xmlreporter) { - _manager.setProperty(XMLInputFactory.REPORTER, xmlreporter); - } - - public void setXMLResolver(XMLResolver xmlresolver) { - _manager.setProperty(XMLInputFactory.RESOLVER, xmlresolver); - } - - /** Create a filtered event reader that wraps the filter around the event reader - * @param reader the event reader to wrap - * @param filter the filter to apply to the event reader - * @throws XMLStreamException - */ - public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException { - return new StAXFilteredEvent(reader, filter); - } - - /** Create a filtered reader that wraps the filter around the reader - * @param reader the reader to filter - * @param filter the filter to apply to the reader - * @throws XMLStreamException - */ - public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException { - - if( reader != null && filter != null ) - return new StAXFilteredParser(reader,filter); - - return null; - } - - - - /** Get the value of a feature/property from the underlying implementation - * @param name The name of the property (may not be null) - * @return The value of the property - * @throws IllegalArgumentException if the property is not supported - */ - public Object getProperty(String name) throws IllegalArgumentException { - if(name == null){ - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.nullPropertyName")); - } - if(_manager.containsProperty(name)) - return _manager.getProperty(name); - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.propertyNotSupported", new Object[]{name})); - } - - /** Query the set of Properties that this factory supports. - * - * @param name The name of the property (may not be null) - * @return true if the property is supported and false otherwise - */ - public boolean isPropertySupported(String name) { - if(name == null) - return false ; - else - return _manager.containsProperty(name); - } - - /** Set a user defined event allocator for events - * @param allocator the user defined allocator - */ - public void setEventAllocator(XMLEventAllocator allocator) { - _manager.setProperty(XMLInputFactory.ALLOCATOR, allocator); - } - - /** Allows the user to set specific feature/property on the underlying implementation. The underlying implementation - * is not required to support every setting of every property in the specification and may use IllegalArgumentException - * to signal that an unsupported property may not be set with the specified value. - * @param name The name of the property (may not be null) - * @param value The value of the property - * @throws IllegalArgumentException if the property is not supported - */ - public void setProperty(String name, Object value) throws IllegalArgumentException { - _manager.setProperty(name,value); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/factory/StAXOutputFactory.java 2018-01-30 20:37:19.000000000 -0500 +++ /dev/null 2018-01-30 20:37:19.000000000 -0500 @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.factory; - -import com.sun.xml.internal.fastinfoset.stax.*; -import com.sun.xml.internal.fastinfoset.stax.events.StAXEventWriter; -import javax.xml.transform.Result; -import javax.xml.stream.XMLOutputFactory ; -import javax.xml.stream.XMLEventWriter; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.stream.XMLStreamException; -import javax.xml.transform.stream.StreamResult; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.io.OutputStream; -import java.io.Writer; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class StAXOutputFactory extends XMLOutputFactory { - - //List of supported properties and default values. - private StAXManager _manager = null ; - - /** Creates a new instance of StAXOutputFactory */ - public StAXOutputFactory() { - _manager = new StAXManager(StAXManager.CONTEXT_WRITER); - } - - public XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException { - return new StAXEventWriter(createXMLStreamWriter(result)); - } - - public XMLEventWriter createXMLEventWriter(Writer writer) throws XMLStreamException { - return new StAXEventWriter(createXMLStreamWriter(writer)); - } - - public XMLEventWriter createXMLEventWriter(OutputStream outputStream) throws XMLStreamException { - return new StAXEventWriter(createXMLStreamWriter(outputStream)); - } - - public XMLEventWriter createXMLEventWriter(OutputStream outputStream, String encoding) throws XMLStreamException { - return new StAXEventWriter(createXMLStreamWriter(outputStream, encoding)); - } - - public XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException { - if (result instanceof StreamResult) { - StreamResult streamResult = (StreamResult) result; - if (streamResult.getWriter() != null) { - return createXMLStreamWriter(streamResult.getWriter()); - } else if (streamResult.getOutputStream() != null) { - return createXMLStreamWriter(streamResult.getOutputStream()); - } else if (streamResult.getSystemId() != null) { - FileWriter writer = null; - boolean isError = true; - - try { - writer = new FileWriter(new File(streamResult.getSystemId())); - final XMLStreamWriter streamWriter = createXMLStreamWriter(writer); - isError = false; - - return streamWriter; - } catch (IOException ie) { - throw new XMLStreamException(ie); - } finally { - if (isError && writer != null) { - try { - writer.close(); - } catch (IOException ignored) { - } - } - } - } - } else { - FileWriter writer = null; - boolean isError = true; - - try { - //xxx: should we be using FileOutputStream - nb. - writer = new FileWriter(new File(result.getSystemId())); - final XMLStreamWriter streamWriter = createXMLStreamWriter(writer); - isError = false; - - return streamWriter; - } catch (IOException ie) { - throw new XMLStreamException(ie); - } finally { - if (isError && writer != null) { - try { - writer.close(); - } catch (IOException ignored) { - } - } - } - } - throw new java.lang.UnsupportedOperationException(); - } - - /** this is assumed that user wants to write the file in xml format - * - */ - public XMLStreamWriter createXMLStreamWriter(Writer writer) throws XMLStreamException { - throw new java.lang.UnsupportedOperationException(); - } - - public XMLStreamWriter createXMLStreamWriter(OutputStream outputStream) throws XMLStreamException { - return new StAXDocumentSerializer(outputStream, new StAXManager(_manager)); - } - - public XMLStreamWriter createXMLStreamWriter(OutputStream outputStream, String encoding) throws XMLStreamException { - StAXDocumentSerializer serializer = new StAXDocumentSerializer(outputStream, new StAXManager(_manager)); - serializer.setEncoding(encoding); - return serializer; - } - - public Object getProperty(String name) throws java.lang.IllegalArgumentException { - if(name == null){ - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.propertyNotSupported", new Object[]{null})); - } - if(_manager.containsProperty(name)) - return _manager.getProperty(name); - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.propertyNotSupported", new Object[]{name})); - } - - public boolean isPropertySupported(String name) { - if(name == null) - return false ; - else - return _manager.containsProperty(name); - } - - public void setProperty(String name, Object value) throws java.lang.IllegalArgumentException { - _manager.setProperty(name,value); - - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/util/StAXFilteredParser.java 2018-01-30 20:37:20.000000000 -0500 +++ /dev/null 2018-01-30 20:37:20.000000000 -0500 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.util; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.StreamFilter; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - - -public class StAXFilteredParser extends StAXParserWrapper { - private StreamFilter _filter; - - /** Creates a new instance of StAXFilteredParser */ - public StAXFilteredParser() { - } - public StAXFilteredParser(XMLStreamReader reader, StreamFilter filter) { - super(reader); - _filter = filter; - } - - public void setFilter(StreamFilter filter) { - _filter = filter; - } - - public int next() throws XMLStreamException - { - if (hasNext()) - return super.next(); - throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.noMoreItems")); - } - - public boolean hasNext() throws XMLStreamException - { - while (super.hasNext()) { - if (_filter.accept(getReader())) return true; - super.next(); - } - return false; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/stax/util/StAXParserWrapper.java 2018-01-30 20:37:20.000000000 -0500 +++ /dev/null 2018-01-30 20:37:20.000000000 -0500 @@ -1,236 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.stax.util; - -import javax.xml.namespace.QName; -import javax.xml.namespace.NamespaceContext; - -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.Location; -import javax.xml.stream.XMLStreamException; - - -public class StAXParserWrapper implements XMLStreamReader{ - private XMLStreamReader _reader; - - /** Creates a new instance of StAXParserWrapper */ - public StAXParserWrapper() { - } - - public StAXParserWrapper(XMLStreamReader reader) { - _reader = reader; - } - public void setReader(XMLStreamReader reader) { - _reader = reader; - } - public XMLStreamReader getReader() { - return _reader; - } - - public int next() throws XMLStreamException - { - return _reader.next(); - } - - public int nextTag() throws XMLStreamException - { - return _reader.nextTag(); - } - - public String getElementText() throws XMLStreamException - { - return _reader.getElementText(); - } - - public void require(int type, String namespaceURI, String localName) throws XMLStreamException - { - _reader.require(type,namespaceURI,localName); - } - - public boolean hasNext() throws XMLStreamException - { - return _reader.hasNext(); - } - - public void close() throws XMLStreamException - { - _reader.close(); - } - - public String getNamespaceURI(String prefix) - { - return _reader.getNamespaceURI(prefix); - } - - public NamespaceContext getNamespaceContext() { - return _reader.getNamespaceContext(); - } - - public boolean isStartElement() { - return _reader.isStartElement(); - } - - public boolean isEndElement() { - return _reader.isEndElement(); - } - - public boolean isCharacters() { - return _reader.isCharacters(); - } - - public boolean isWhiteSpace() { - return _reader.isWhiteSpace(); - } - - public QName getAttributeName(int index) { - return _reader.getAttributeName(index); - } - - public int getTextCharacters(int sourceStart, char[] target, int targetStart, - int length) throws XMLStreamException - { - return _reader.getTextCharacters(sourceStart, target, targetStart, length); - } - - public String getAttributeValue(String namespaceUri, - String localName) - { - return _reader.getAttributeValue(namespaceUri,localName); - } - public int getAttributeCount() { - return _reader.getAttributeCount(); - } - public String getAttributePrefix(int index) { - return _reader.getAttributePrefix(index); - } - public String getAttributeNamespace(int index) { - return _reader.getAttributeNamespace(index); - } - public String getAttributeLocalName(int index) { - return _reader.getAttributeLocalName(index); - } - public String getAttributeType(int index) { - return _reader.getAttributeType(index); - } - public String getAttributeValue(int index) { - return _reader.getAttributeValue(index); - } - public boolean isAttributeSpecified(int index) { - return _reader.isAttributeSpecified(index); - } - - public int getNamespaceCount() { - return _reader.getNamespaceCount(); - } - public String getNamespacePrefix(int index) { - return _reader.getNamespacePrefix(index); - } - public String getNamespaceURI(int index) { - return _reader.getNamespaceURI(index); - } - - public int getEventType() { - return _reader.getEventType(); - } - - public String getText() { - return _reader.getText(); - } - - public char[] getTextCharacters() { - return _reader.getTextCharacters(); - } - - public int getTextStart() { - return _reader.getTextStart(); - } - - public int getTextLength() { - return _reader.getTextLength(); - } - - public String getEncoding() { - return _reader.getEncoding(); - } - - public boolean hasText() { - return _reader.hasText(); - } - - public Location getLocation() { - return _reader.getLocation(); - } - - public QName getName() { - return _reader.getName(); - } - - public String getLocalName() { - return _reader.getLocalName(); - } - - public boolean hasName() { - return _reader.hasName(); - } - - public String getNamespaceURI() { - return _reader.getNamespaceURI(); - } - - public String getPrefix() { - return _reader.getPrefix(); - } - - public String getVersion() { - return _reader.getVersion(); - } - - public boolean isStandalone() { - return _reader.isStandalone(); - } - - public boolean standaloneSet() { - return _reader.standaloneSet(); - } - - public String getCharacterEncodingScheme() { - return _reader.getCharacterEncodingScheme(); - } - - public String getPITarget() { - return _reader.getPITarget(); - } - - public String getPIData() { - return _reader.getPIData(); - } - - public Object getProperty(String name) { - return _reader.getProperty(name); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/FI_DOM_Or_XML_DOM_SAX_SAXEvent.java 2018-01-30 20:37:21.000000000 -0500 +++ /dev/null 2018-01-30 20:37:21.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.fastinfoset.Decoder; -import com.sun.xml.internal.fastinfoset.dom.DOMDocumentParser; -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXResult; -import org.w3c.dom.Document; - -public class FI_DOM_Or_XML_DOM_SAX_SAXEvent extends TransformInputOutput { - - public void parse(InputStream document, OutputStream events, String workingDirectory) throws Exception { - if (!document.markSupported()) { - document = new BufferedInputStream(document); - } - - document.mark(4); - boolean isFastInfosetDocument = Decoder.isFastInfosetDocument(document); - document.reset(); - - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - DocumentBuilder db = dbf.newDocumentBuilder(); - - Document d; - if (isFastInfosetDocument) { - d = db.newDocument(); - DOMDocumentParser ddp = new DOMDocumentParser(); - ddp.parse(d, document); - } else { - if (workingDirectory != null) { - db.setEntityResolver(createRelativePathResolver(workingDirectory)); - } - d = db.parse(document); - } - - SAXEventSerializer ses = new SAXEventSerializer(events); - - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer t = tf.newTransformer(); - t.transform(new DOMSource(d), new SAXResult(ses)); - } - - public void parse(InputStream document, OutputStream events) throws Exception { - parse(document, events, null); - } - - public static void main(String[] args) throws Exception { - FI_DOM_Or_XML_DOM_SAX_SAXEvent p = new FI_DOM_Or_XML_DOM_SAX_SAXEvent(); - p.parse(args); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/FI_SAX_Or_XML_SAX_DOM_SAX_SAXEvent.java 2018-01-30 20:37:22.000000000 -0500 +++ /dev/null 2018-01-30 20:37:22.000000000 -0500 @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.fastinfoset.Decoder; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.transform.sax.SAXSource; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetSource; -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamSource; -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; - -public class FI_SAX_Or_XML_SAX_DOM_SAX_SAXEvent extends TransformInputOutput { - - public FI_SAX_Or_XML_SAX_DOM_SAX_SAXEvent() { - } - - public void parse(InputStream document, OutputStream events, String workingDirectory) throws Exception { - if (!document.markSupported()) { - document = new BufferedInputStream(document); - } - - document.mark(4); - boolean isFastInfosetDocument = Decoder.isFastInfosetDocument(document); - document.reset(); - - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer t = tf.newTransformer(); - DOMResult dr = new DOMResult(); - - if (isFastInfosetDocument) { - t.transform(new FastInfosetSource(document), dr); - } else if (workingDirectory != null) { - SAXParser parser = getParser(); - XMLReader reader = parser.getXMLReader(); - reader.setEntityResolver(createRelativePathResolver(workingDirectory)); - SAXSource source = new SAXSource(reader, new InputSource(document)); - - t.transform(source, dr); - } else { - t.transform(new StreamSource(document), dr); - } - - SAXEventSerializer ses = new SAXEventSerializer(events); - t.transform(new DOMSource(dr.getNode()), new SAXResult(ses)); - } - - public void parse(InputStream document, OutputStream events) throws Exception { - parse(document, events, null); - } - - private SAXParser getParser() { - SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); - saxParserFactory.setNamespaceAware(true); - try { - return saxParserFactory.newSAXParser(); - } catch (Exception e) { - return null; - } - } - - public static void main(String[] args) throws Exception { - FI_SAX_Or_XML_SAX_DOM_SAX_SAXEvent p = new FI_SAX_Or_XML_SAX_DOM_SAX_SAXEvent(); - p.parse(args); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/FI_SAX_Or_XML_SAX_SAXEvent.java 2018-01-30 20:37:23.000000000 -0500 +++ /dev/null 2018-01-30 20:37:23.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.fastinfoset.Decoder; -import com.sun.xml.internal.fastinfoset.sax.SAXDocumentParser; -import com.sun.xml.internal.fastinfoset.sax.Properties; -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; - -public class FI_SAX_Or_XML_SAX_SAXEvent extends TransformInputOutput { - - public FI_SAX_Or_XML_SAX_SAXEvent() { - } - - public void parse(InputStream document, OutputStream events, String workingDirectory) throws Exception { - if (!document.markSupported()) { - document = new BufferedInputStream(document); - } - - document.mark(4); - boolean isFastInfosetDocument = Decoder.isFastInfosetDocument(document); - document.reset(); - - if (isFastInfosetDocument) { - SAXDocumentParser parser = new SAXDocumentParser(); - SAXEventSerializer ses = new SAXEventSerializer(events); - parser.setContentHandler(ses); - parser.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, ses); - parser.parse(document); - } else { - SAXParserFactory parserFactory = SAXParserFactory.newInstance(); - parserFactory.setNamespaceAware(true); - SAXParser parser = parserFactory.newSAXParser(); - SAXEventSerializer ses = new SAXEventSerializer(events); - - XMLReader reader = parser.getXMLReader(); - reader.setProperty("http://xml.org/sax/properties/lexical-handler", ses); - reader.setContentHandler(ses); - if (workingDirectory != null) { - reader.setEntityResolver(createRelativePathResolver(workingDirectory)); - } - reader.parse(new InputSource(document)); - } - } - - public void parse(InputStream document, OutputStream events) throws Exception { - parse(document, events, null); - } - - public static void main(String[] args) throws Exception { - FI_SAX_Or_XML_SAX_SAXEvent p = new FI_SAX_Or_XML_SAX_SAXEvent(); - p.parse(args); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/FI_SAX_XML.java 2018-01-30 20:37:23.000000000 -0500 +++ /dev/null 2018-01-30 20:37:23.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetSource; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.stream.StreamResult; - -public class FI_SAX_XML extends TransformInputOutput { - - public FI_SAX_XML() { - } - - public void parse(InputStream finf, OutputStream xml) throws Exception { - Transformer tx = TransformerFactory.newInstance().newTransformer(); - tx.transform(new FastInfosetSource(finf), new StreamResult(xml)); - } - - public static void main(String[] args) throws Exception { - FI_SAX_XML p = new FI_SAX_XML(); - p.parse(args); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/FI_StAX_SAX_Or_XML_SAX_SAXEvent.java 2018-01-30 20:37:24.000000000 -0500 +++ /dev/null 2018-01-30 20:37:24.000000000 -0500 @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.fastinfoset.Decoder; -import com.sun.xml.internal.fastinfoset.sax.Properties; -import com.sun.xml.internal.fastinfoset.stax.StAXDocumentParser; -import java.io.BufferedInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import com.sun.xml.internal.fastinfoset.tools.StAX2SAXReader; - -public class FI_StAX_SAX_Or_XML_SAX_SAXEvent extends TransformInputOutput { - - public FI_StAX_SAX_Or_XML_SAX_SAXEvent() { - } - - public void parse(InputStream document, OutputStream events) throws Exception { - if (!document.markSupported()) { - document = new BufferedInputStream(document); - } - - document.mark(4); - boolean isFastInfosetDocument = Decoder.isFastInfosetDocument(document); - document.reset(); - - if (isFastInfosetDocument) { - StAXDocumentParser parser = new StAXDocumentParser(); - parser.setInputStream(document); - SAXEventSerializer ses = new SAXEventSerializer(events); - StAX2SAXReader reader = new StAX2SAXReader(parser, ses); - reader.setLexicalHandler(ses); - reader.adapt(); - } else { - SAXParserFactory parserFactory = SAXParserFactory.newInstance(); - parserFactory.setNamespaceAware(true); - SAXParser parser = parserFactory.newSAXParser(); - SAXEventSerializer ses = new SAXEventSerializer(events); - parser.setProperty(Properties.LEXICAL_HANDLER_PROPERTY, ses); - parser.parse(document, ses); - } - } - - public static void main(String[] args) throws Exception { - FI_StAX_SAX_Or_XML_SAX_SAXEvent p = new FI_StAX_SAX_Or_XML_SAX_SAXEvent(); - p.parse(args); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/PrintTable.java 2018-01-30 20:37:25.000000000 -0500 +++ /dev/null 2018-01-30 20:37:25.000000000 -0500 @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.fastinfoset.QualifiedName; -import java.io.File; - -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; - -import com.sun.xml.internal.fastinfoset.util.CharArrayArray; -import com.sun.xml.internal.fastinfoset.util.ContiguousCharArrayArray; -import com.sun.xml.internal.fastinfoset.util.PrefixArray; -import com.sun.xml.internal.fastinfoset.util.QualifiedNameArray; -import com.sun.xml.internal.fastinfoset.util.StringArray; -import com.sun.xml.internal.fastinfoset.vocab.ParserVocabulary; - - -public class PrintTable { - - /** Creates a new instance of PrintTable */ - public PrintTable() { - } - - public static void printVocabulary(ParserVocabulary vocabulary) { - printArray("Attribute Name Table", vocabulary.attributeName); - printArray("Attribute Value Table", vocabulary.attributeValue); - printArray("Character Content Chunk Table", vocabulary.characterContentChunk); - printArray("Element Name Table", vocabulary.elementName); - printArray("Local Name Table", vocabulary.localName); - printArray("Namespace Name Table", vocabulary.namespaceName); - printArray("Other NCName Table", vocabulary.otherNCName); - printArray("Other String Table", vocabulary.otherString); - printArray("Other URI Table", vocabulary.otherURI); - printArray("Prefix Table", vocabulary.prefix); - } - - public static void printArray(String title, StringArray a) { - System.out.println(title); - - for (int i = 0; i < a.getSize(); i++) { - System.out.println("" + (i + 1) + ": " + a.getArray()[i]); - } - } - - public static void printArray(String title, PrefixArray a) { - System.out.println(title); - - for (int i = 0; i < a.getSize(); i++) { - System.out.println("" + (i + 1) + ": " + a.getArray()[i]); - } - } - - public static void printArray(String title, CharArrayArray a) { - System.out.println(title); - - for (int i = 0; i < a.getSize(); i++) { - System.out.println("" + (i + 1) + ": " + a.getArray()[i]); - } - } - - public static void printArray(String title, ContiguousCharArrayArray a) { - System.out.println(title); - - for (int i = 0; i < a.getSize(); i++) { - System.out.println("" + (i + 1) + ": " + a.getString(i)); - } - } - - public static void printArray(String title, QualifiedNameArray a) { - System.out.println(title); - - for (int i = 0; i < a.getSize(); i++) { - QualifiedName name = a.getArray()[i]; - System.out.println("" + (name.index + 1) + ": " + - "{" + name.namespaceName + "}" + - name.prefix + ":" + name.localName); - } - } - - /** - * @param args the command line arguments - */ - public static void main(String[] args) { - try { - SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); - saxParserFactory.setNamespaceAware(true); - - SAXParser saxParser = saxParserFactory.newSAXParser(); - - ParserVocabulary referencedVocabulary = new ParserVocabulary(); - - VocabularyGenerator vocabularyGenerator = new VocabularyGenerator(referencedVocabulary); - File f = new File(args[0]); - saxParser.parse(f, vocabularyGenerator); - - printVocabulary(referencedVocabulary); - } catch (Exception e) { - e.printStackTrace(); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/SAX2StAXWriter.java 2018-01-30 20:37:26.000000000 -0500 +++ /dev/null 2018-01-30 20:37:26.000000000 -0500 @@ -1,201 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.fastinfoset.QualifiedName; -import java.util.ArrayList; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import org.xml.sax.Attributes; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.DefaultHandler; - -public class SAX2StAXWriter extends DefaultHandler implements LexicalHandler { - private static final Logger logger = Logger.getLogger(SAX2StAXWriter.class.getName()); - - /** - * XML stream writer where events are pushed. - */ - XMLStreamWriter _writer; - - /** - * List of namespace decl for upcoming element. - */ - ArrayList _namespaces = new ArrayList(); - - public SAX2StAXWriter(XMLStreamWriter writer) { - _writer = writer; - } - - public XMLStreamWriter getWriter() { - return _writer; - } - - public void startDocument() throws SAXException { - try { - _writer.writeStartDocument(); - } - catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - public void endDocument() throws SAXException { - try { - _writer.writeEndDocument(); - _writer.flush(); - } - catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - public void characters(char[] ch, int start, int length) - throws SAXException - { - try { - _writer.writeCharacters(ch, start, length); - } - catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - public void startElement(String namespaceURI, String localName, - String qName, Attributes atts) throws SAXException - { - try { - int k = qName.indexOf(':'); - String prefix = (k > 0) ? qName.substring(0, k) : ""; - _writer.writeStartElement(prefix, localName, namespaceURI); - - int length = _namespaces.size(); - for (int i = 0; i < length; i++) { - QualifiedName nsh = (QualifiedName) _namespaces.get(i); - _writer.writeNamespace(nsh.prefix, nsh.namespaceName); - } - _namespaces.clear(); - - length = atts.getLength(); - for (int i = 0; i < length; i++) { - _writer.writeAttribute(atts.getURI(i), - atts.getLocalName(i), - atts.getValue(i)); - } - } - catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - public void endElement(String namespaceURI, String localName, - String qName) throws SAXException - { - try { - _writer.writeEndElement(); - } - catch (XMLStreamException e) { - logger.log(Level.FINE, "Exception on endElement", e); - throw new SAXException(e); - } - } - - public void startPrefixMapping(String prefix, String uri) - throws SAXException - { - // Commented as in StAX NS are declared for current element? - // now _writer.setPrefix() is invoked in _writer.writeNamespace() -// try { -// _writer.setPrefix(prefix, uri); - _namespaces.add(new QualifiedName(prefix, uri)); -// } -// catch (XMLStreamException e) { -// throw new SAXException(e); -// } - } - - public void endPrefixMapping(String prefix) throws SAXException { - } - - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException - { - characters(ch, start, length); - } - - public void processingInstruction(String target, String data) - throws SAXException - { - try { - _writer.writeProcessingInstruction(target, data); - } - catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - public void setDocumentLocator(Locator locator) { - } - - public void skippedEntity(String name) throws SAXException { - } - - public void comment(char[] ch, int start, int length) - throws SAXException - { - try { - _writer.writeComment(new String(ch, start, length)); - } - catch (XMLStreamException e) { - throw new SAXException(e); - } - } - - public void endCDATA() throws SAXException { - } - - public void endDTD() throws SAXException { - } - - public void endEntity(String name) throws SAXException { - } - - public void startCDATA() throws SAXException { - } - - public void startDTD(String name, String publicId, String systemId) throws SAXException { - } - - public void startEntity(String name) throws SAXException { - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/SAXEventSerializer.java 2018-01-30 20:37:26.000000000 -0500 +++ /dev/null 2018-01-30 20:37:26.000000000 -0500 @@ -1,423 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.ArrayList; -import java.util.List; -import java.util.Stack; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.DefaultHandler; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class SAXEventSerializer extends DefaultHandler - implements LexicalHandler { - - private Writer _writer; - private boolean _charactersAreCDATA; - private StringBuffer _characters; - - private Stack _namespaceStack = new Stack(); - protected List _namespaceAttributes; - - public SAXEventSerializer(OutputStream s) throws IOException { - _writer = new OutputStreamWriter(s); - _charactersAreCDATA = false; - } - - // -- ContentHandler interface --------------------------------------- - - public void startDocument() throws SAXException { - try { - _writer.write("\n"); - _writer.write("\n"); - _writer.flush(); - } - catch (IOException e) { - throw new SAXException(e); - } - } - - public void endDocument() throws SAXException { - try { - _writer.write("\n"); - _writer.write(""); - _writer.flush(); - _writer.close(); - } - catch (IOException e) { - throw new SAXException(e); - } - } - - - public void startPrefixMapping(String prefix, String uri) - throws SAXException - { - if (_namespaceAttributes == null) { - _namespaceAttributes = new ArrayList(); - } - - String qName = (prefix.length() == 0) ? "xmlns" : "xmlns" + prefix; - AttributeValueHolder attribute = new AttributeValueHolder( - qName, - prefix, - uri, - null, - null); - _namespaceAttributes.add(attribute); - } - - public void endPrefixMapping(String prefix) - throws SAXException - { - /* - try { - outputCharacters(); - - _writer.write("\n"); - _writer.flush(); - } - catch (IOException e) { - throw new SAXException(e); - } - */ - } - - public void startElement(String uri, String localName, - String qName, Attributes attributes) - throws SAXException - { - try { - outputCharacters(); - - if (_namespaceAttributes != null) { - - AttributeValueHolder[] attrsHolder = new AttributeValueHolder[0]; - attrsHolder = (AttributeValueHolder[])_namespaceAttributes.toArray(attrsHolder); - - // Sort attributes - quicksort(attrsHolder, 0, attrsHolder.length - 1); - - for (int i = 0; i < attrsHolder.length; i++) { - _writer.write("\n"); - _writer.flush(); - } - - _namespaceStack.push(attrsHolder); - _namespaceAttributes = null; - } else { - _namespaceStack.push(null); - } - - AttributeValueHolder[] attrsHolder = - new AttributeValueHolder[attributes.getLength()]; - for (int i = 0; i < attributes.getLength(); i++) { - attrsHolder[i] = new AttributeValueHolder( - attributes.getQName(i), - attributes.getLocalName(i), - attributes.getURI(i), - attributes.getType(i), - attributes.getValue(i)); - } - - // Sort attributes - quicksort(attrsHolder, 0, attrsHolder.length - 1); - - int attributeCount = 0; - for (int i = 0; i < attrsHolder.length; i++) { - if (attrsHolder[i].uri.equals("http://www.w3.org/2000/xmlns/")) { - // Ignore XMLNS attributes - continue; - } - attributeCount++; - } - - if (attributeCount == 0) { - _writer.write("\n"); - return; - } - - _writer.write("\n"); - - // Serialize attributes as children - for (int i = 0; i < attrsHolder.length; i++) { - if (attrsHolder[i].uri.equals("http://www.w3.org/2000/xmlns/")) { - // Ignore XMLNS attributes - continue; - } - _writer.write( - " \n"); - } - - _writer.write("\n"); - _writer.flush(); - } - catch (IOException e) { - throw new SAXException(e); - } - } - - public void endElement(String uri, String localName, String qName) - throws SAXException - { - try { - outputCharacters(); - - _writer.write("\n"); - _writer.flush(); - - // Write out the end prefix here rather than waiting - // for the explicit events - AttributeValueHolder[] attrsHolder = (AttributeValueHolder[])_namespaceStack.pop(); - if (attrsHolder != null) { - for (int i = 0; i < attrsHolder.length; i++) { - _writer.write("\n"); - _writer.flush(); - } - } - - } - catch (IOException e) { - throw new SAXException(e); - } - } - - public void characters(char[] ch, int start, int length) - throws SAXException - { - if (length == 0) { - return; - } - - if (_characters == null) { - _characters = new StringBuffer(); - } - - // Coalesce multiple character events - _characters.append(ch, start, length); - - /* - try { - _writer.write("" + - (_charactersAreCDATA ? "" : "") + - "\n"); - _writer.flush(); - } - catch (IOException e) { - throw new SAXException(e); - } - */ - } - - private void outputCharacters() throws SAXException { - if (_characters == null) { - return; - } - - try { - _writer.write("" + - (_charactersAreCDATA ? "" : "") + - "\n"); - _writer.flush(); - - _characters = null; - } catch (IOException e) { - throw new SAXException(e); - } - } - - public void ignorableWhitespace(char[] ch, int start, int length) - throws SAXException - { - // Report ignorable ws as characters (assumes validation off) - characters(ch, start, length); - } - - public void processingInstruction(String target, String data) - throws SAXException - { - try { - outputCharacters(); - - _writer.write("\n"); - _writer.flush(); - } - catch (IOException e) { - throw new SAXException(e); - } - } - - // -- LexicalHandler interface --------------------------------------- - - public void startDTD(String name, String publicId, String systemId) - throws SAXException { - // Not implemented - } - - public void endDTD() - throws SAXException { - // Not implemented - } - - public void startEntity(String name) - throws SAXException { - // Not implemented - } - - public void endEntity(String name) - throws SAXException { - // Not implemented - } - - public void startCDATA() - throws SAXException { - _charactersAreCDATA = true; - } - - public void endCDATA() - throws SAXException { - _charactersAreCDATA = false; - } - - public void comment(char[] ch, int start, int length) - throws SAXException - { - try { - outputCharacters(); - - _writer.write("" + - new String(ch, start, length) + - "\n"); - _writer.flush(); - } - catch (IOException e) { - throw new SAXException(e); - } - } - - // -- Utility methods ------------------------------------------------ - - private void quicksort(AttributeValueHolder[] attrs, int p, int r) { - while (p < r) { - final int q = partition(attrs, p, r); - quicksort(attrs, p, q); - p = q + 1; - } - } - - private int partition(AttributeValueHolder[] attrs, int p, int r) { - AttributeValueHolder x = attrs[(p + r) >>> 1]; - int i = p - 1; - int j = r + 1; - while (true) { - while (x.compareTo(attrs[--j]) < 0); - while (x.compareTo(attrs[++i]) > 0); - if (i < j) { - final AttributeValueHolder t = attrs[i]; - attrs[i] = attrs[j]; - attrs[j] = t; - } - else { - return j; - } - } - } - - public static class AttributeValueHolder implements Comparable { - public final String qName; - public final String localName; - public final String uri; - public final String type; - public final String value; - - public AttributeValueHolder(String qName, - String localName, - String uri, - String type, - String value) - { - this.qName = qName; - this.localName = localName; - this.uri = uri; - this.type = type; - this.value = value; - } - - public int compareTo(Object o) { - try { - return qName.compareTo(((AttributeValueHolder) o).qName); - } catch (Exception e) { - throw new RuntimeException(CommonResourceBundle.getInstance().getString("message.AttributeValueHolderExpected")); - } - } - - @Override - public boolean equals(Object o) { - try { - return (o instanceof AttributeValueHolder) && - qName.equals(((AttributeValueHolder) o).qName); - } catch (Exception e) { - throw new RuntimeException(CommonResourceBundle.getInstance().getString("message.AttributeValueHolderExpected")); - } - } - - @Override - public int hashCode() { - int hash = 7; - hash = 97 * hash + (this.qName != null ? this.qName.hashCode() : 0); - return hash; - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/StAX2SAXReader.java 2018-01-30 20:37:27.000000000 -0500 +++ /dev/null 2018-01-30 20:37:27.000000000 -0500 @@ -1,171 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import javax.xml.namespace.QName; -import javax.xml.stream.XMLStreamConstants; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamReader; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.AttributesImpl; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class StAX2SAXReader { - - /** - * Content handler where events are pushed. - */ - ContentHandler _handler; - - /** - * Lexical handler to report lexical events. - */ - LexicalHandler _lexicalHandler; - - /** - * XML stream reader where events are pulled. - */ - XMLStreamReader _reader; - - public StAX2SAXReader(XMLStreamReader reader, ContentHandler handler) { - _handler = handler; - _reader = reader; - } - - public StAX2SAXReader(XMLStreamReader reader) { - _reader = reader; - } - - public void setContentHandler(ContentHandler handler) { - _handler = handler; - } - - public void setLexicalHandler(LexicalHandler lexicalHandler) { - _lexicalHandler = lexicalHandler; - } - - public void adapt() throws XMLStreamException, SAXException { - QName qname; - String prefix, localPart; - AttributesImpl attrs = new AttributesImpl(); - char[] buffer; - int nsc; - int nat; - - _handler.startDocument(); - - try { - - while (_reader.hasNext()) { - int event = _reader.next(); - - - switch(event) { - case XMLStreamConstants.START_ELEMENT: { - // Report namespace events first - nsc = _reader.getNamespaceCount(); - for (int i = 0; i < nsc; i++) { - _handler.startPrefixMapping(_reader.getNamespacePrefix(i), - _reader.getNamespaceURI(i)); - } - - // Collect list of attributes - attrs.clear(); - nat = _reader.getAttributeCount(); - for (int i = 0; i < nat; i++) { - QName q = _reader.getAttributeName(i); - String qName = _reader.getAttributePrefix(i); - if (qName == null || qName == "") { - qName = q.getLocalPart(); - } else { - qName = qName + ":" + q.getLocalPart(); - } - attrs.addAttribute(_reader.getAttributeNamespace(i), - q.getLocalPart(), - qName, - _reader.getAttributeType(i), - _reader.getAttributeValue(i)); - } - - // Report start element - qname = _reader.getName(); - prefix = qname.getPrefix(); - localPart = qname.getLocalPart(); - - _handler.startElement(_reader.getNamespaceURI(), - localPart, - (prefix.length() > 0) ? - (prefix + ":" + localPart) : localPart, - attrs); - break; - } - case XMLStreamConstants.END_ELEMENT: { - // Report end element - qname = _reader.getName(); - prefix = qname.getPrefix(); - localPart = qname.getLocalPart(); - - _handler.endElement(_reader.getNamespaceURI(), - localPart, - (prefix.length() > 0) ? - (prefix + ":" + localPart) : localPart); - - // Report end namespace events - nsc = _reader.getNamespaceCount(); - for (int i = 0; i < nsc; i++) { - _handler.endPrefixMapping(_reader.getNamespacePrefix(i)); - } - break; - } - case XMLStreamConstants.CHARACTERS: - _handler.characters(_reader.getTextCharacters(), _reader.getTextStart(), _reader.getTextLength()); - break; - case XMLStreamConstants.COMMENT: - _lexicalHandler.comment(_reader.getTextCharacters(), _reader.getTextStart(), _reader.getTextLength()); - break; - case XMLStreamConstants.PROCESSING_INSTRUCTION: - _handler.processingInstruction(_reader.getPITarget(), _reader.getPIData()); - break; - case XMLStreamConstants.END_DOCUMENT: - break; - default: - throw new RuntimeException(CommonResourceBundle.getInstance().getString("message.StAX2SAXReader", new Object[]{Integer.valueOf(event)})); - } // switch - } - } - catch (XMLStreamException e) { - _handler.endDocument(); // flush whatever we have - throw e; - } - - _handler.endDocument(); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/TransformInputOutput.java 2018-01-30 20:37:28.000000000 -0500 +++ /dev/null 2018-01-30 20:37:28.000000000 -0500 @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; -import java.net.URI; -import java.net.URISyntaxException; -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - -public abstract class TransformInputOutput { - - /** Creates a new instance of TransformInputOutput */ - public TransformInputOutput() { - } - - public void parse(String[] args) throws Exception { - InputStream in = null; - OutputStream out = null; - if (args.length == 0) { - in = new BufferedInputStream(System.in); - out = new BufferedOutputStream(System.out); - } else if (args.length == 1) { - in = new BufferedInputStream(new FileInputStream(args[0])); - out = new BufferedOutputStream(System.out); - } else if (args.length == 2) { - in = new BufferedInputStream(new FileInputStream(args[0])); - out = new BufferedOutputStream(new FileOutputStream(args[1])); - } else { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.optinalFileNotSpecified")); - } - - parse(in, out); - } - - abstract public void parse(InputStream in, OutputStream out) throws Exception; - - // parse alternative with current working directory parameter - // is used to process xml documents, which have external imported entities - public void parse(InputStream in, OutputStream out, String workingDirectory) throws Exception { - throw new UnsupportedOperationException(); - } - - private static URI currentJavaWorkingDirectory; - static { - currentJavaWorkingDirectory = new File(System.getProperty("user.dir")).toURI(); - } - - protected static EntityResolver createRelativePathResolver(final String workingDirectory) { - return new EntityResolver() { - public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { - if (systemId != null && systemId.startsWith("file:/")) { - URI workingDirectoryURI = new File(workingDirectory).toURI(); - URI workingFile; - try { - // Construction new File(new URI(String)).toURI() is used to be sure URI has correct representation without redundant '/' - workingFile = convertToNewWorkingDirectory(currentJavaWorkingDirectory, workingDirectoryURI, new File(new URI(systemId)).toURI()); - return new InputSource(workingFile.toString()); - } catch (URISyntaxException ex) { - //Should not get here - } - } - return null; - } - }; - } - - private static URI convertToNewWorkingDirectory(URI oldwd, URI newwd, URI file) throws IOException, URISyntaxException { - String oldwdStr = oldwd.toString(); - String newwdStr = newwd.toString(); - String fileStr = file.toString(); - - String cmpStr = null; - // In simpliest case /file.xml - do it faster - if (fileStr.startsWith(oldwdStr) && (cmpStr = fileStr.substring(oldwdStr.length())).indexOf('/') == -1) { - return new URI(newwdStr + '/' + cmpStr); - } - - String[] oldwdSplit = oldwdStr.split("/"); - String[] newwdSplit = newwdStr.split("/"); - String[] fileSplit = fileStr.split("/"); - - int diff; - for (diff = 0; diff < oldwdSplit.length && diff < fileSplit.length; diff++) { - if (!oldwdSplit[diff].equals(fileSplit[diff])) { - break; - } - } - - int diffNew; - for(diffNew=0; diffNew diff) { - return file; - } - - int elemsToSub = oldwdSplit.length - diff; - StringBuffer resultStr = new StringBuffer(100); - for(int i=0; i 0) { - QualifiedName[] names = entry._value; - for (int i = 0; i < entry._valueIndex; i++) { - if ((namespaceURI == names[i].namespaceName || namespaceURI.equals(names[i].namespaceName))) { - return; - } - } - } - - String prefix = getPrefixFromQualifiedName(qName); - - int namespaceURIIndex = -1; - int prefixIndex = -1; - int localNameIndex = -1; - if (namespaceURI.length() > 0) { - namespaceURIIndex = _serializerVocabulary.namespaceName.get(namespaceURI); - if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) { - throw new SAXException(CommonResourceBundle.getInstance(). - getString("message.namespaceURINotIndexed", new Object[]{Integer.valueOf(namespaceURIIndex)})); - } - - if (prefix.length() > 0) { - prefixIndex = _serializerVocabulary.prefix.get(prefix); - if (prefixIndex == KeyIntMap.NOT_PRESENT) { - throw new SAXException(CommonResourceBundle.getInstance(). - getString("message.prefixNotIndexed", new Object[]{Integer.valueOf(prefixIndex)})); - } - } - } - - localNameIndex = _serializerVocabulary.localName.obtainIndex(localName); - if (localNameIndex == KeyIntMap.NOT_PRESENT) { - _parserVocabulary.localName.add(localName); - localNameIndex = _parserVocabulary.localName.getSize() - 1; - } - QualifiedName name = new QualifiedName(prefix, namespaceURI, localName, m.getNextIndex(), - prefixIndex, namespaceURIIndex, localNameIndex); - if (isAttribute) { - name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE); - } - entry.addQualifiedName(name); - a.add(name); - - v.add(name.getQName()); - } - - public static String getPrefixFromQualifiedName(String qName) { - int i = qName.indexOf(':'); - String prefix = ""; - if (i != -1) { - prefix = qName.substring(0, i); - } - return prefix; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/XML_DOM_FI.java 2018-01-30 20:37:29.000000000 -0500 +++ /dev/null 2018-01-30 20:37:29.000000000 -0500 @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.fastinfoset.dom.DOMDocumentSerializer; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import org.w3c.dom.Document; - -public class XML_DOM_FI extends TransformInputOutput { - - public XML_DOM_FI() { - } - - public void parse(InputStream document, OutputStream finf, String workingDirectory) throws Exception { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - DocumentBuilder db = dbf.newDocumentBuilder(); - if (workingDirectory != null) { - db.setEntityResolver(createRelativePathResolver(workingDirectory)); - } - Document d = db.parse(document); - - DOMDocumentSerializer s = new DOMDocumentSerializer(); - s.setOutputStream(finf); - s.serialize(d); - } - - public void parse(InputStream document, OutputStream finf) throws Exception { - parse(document, finf, null); - } - - public static void main(String[] args) throws Exception { - XML_DOM_FI p = new XML_DOM_FI(); - p.parse(args); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/XML_DOM_SAX_FI.java 2018-01-30 20:37:30.000000000 -0500 +++ /dev/null 2018-01-30 20:37:30.000000000 -0500 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetResult; -import java.io.InputStream; -import java.io.OutputStream; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; - -import org.w3c.dom.Document; - -public class XML_DOM_SAX_FI extends TransformInputOutput { - - public XML_DOM_SAX_FI() { - } - - public void parse(InputStream document, OutputStream finf, String workingDirectory) throws Exception { - DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); - dbf.setNamespaceAware(true); - DocumentBuilder db = dbf.newDocumentBuilder(); - if (workingDirectory != null) { - db.setEntityResolver(createRelativePathResolver(workingDirectory)); - } - Document d = db.parse(document); - - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer t = tf.newTransformer(); - t.transform(new DOMSource(d), new FastInfosetResult(finf)); - } - - public void parse(InputStream document, OutputStream finf) throws Exception { - parse(document, finf, null); - } - - public static void main(String[] args) throws Exception { - XML_DOM_SAX_FI p = new XML_DOM_SAX_FI(); - p.parse(args); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/XML_SAX_FI.java 2018-01-30 20:37:31.000000000 -0500 +++ /dev/null 2018-01-30 20:37:31.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.fastinfoset.sax.SAXDocumentSerializer; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import java.io.Reader; -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; - -public class XML_SAX_FI extends TransformInputOutput { - - public XML_SAX_FI() { - } - - public void parse(InputStream xml, OutputStream finf, String workingDirectory) throws Exception { - SAXParser saxParser = getParser(); - SAXDocumentSerializer documentSerializer = getSerializer(finf); - - XMLReader reader = saxParser.getXMLReader(); - reader.setProperty("http://xml.org/sax/properties/lexical-handler", documentSerializer); - reader.setContentHandler(documentSerializer); - - if (workingDirectory != null) { - reader.setEntityResolver(createRelativePathResolver(workingDirectory)); - } - reader.parse(new InputSource(xml)); - } - - public void parse(InputStream xml, OutputStream finf) throws Exception { - parse(xml, finf, null); - } - - public void convert(Reader reader, OutputStream finf) throws Exception { - InputSource is = new InputSource(reader); - - SAXParser saxParser = getParser(); - SAXDocumentSerializer documentSerializer = getSerializer(finf); - - saxParser.setProperty("http://xml.org/sax/properties/lexical-handler", documentSerializer); - saxParser.parse(is, documentSerializer); - } - - private SAXParser getParser() { - SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); - saxParserFactory.setNamespaceAware(true); - try { - return saxParserFactory.newSAXParser(); - } catch (Exception e) { - return null; - } - } - - private SAXDocumentSerializer getSerializer(OutputStream finf) { - SAXDocumentSerializer documentSerializer = new SAXDocumentSerializer(); - documentSerializer.setOutputStream(finf); - return documentSerializer; - } - - public static void main(String[] args) throws Exception { - XML_SAX_FI s = new XML_SAX_FI(); - s.parse(args); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/tools/XML_SAX_StAX_FI.java 2018-01-30 20:37:32.000000000 -0500 +++ /dev/null 2018-01-30 20:37:32.000000000 -0500 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.tools; - -import com.sun.xml.internal.fastinfoset.stax.StAXDocumentSerializer; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.parsers.SAXParser; -import javax.xml.parsers.SAXParserFactory; -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; - -public class XML_SAX_StAX_FI extends TransformInputOutput { - - public XML_SAX_StAX_FI() { - } - - public void parse(InputStream xml, OutputStream finf, String workingDirectory) throws Exception { - StAXDocumentSerializer documentSerializer = new StAXDocumentSerializer(); - documentSerializer.setOutputStream(finf); - - SAX2StAXWriter saxTostax = new SAX2StAXWriter(documentSerializer); - - SAXParserFactory saxParserFactory = SAXParserFactory.newInstance(); - saxParserFactory.setNamespaceAware(true); - SAXParser saxParser = saxParserFactory.newSAXParser(); - - XMLReader reader = saxParser.getXMLReader(); - reader.setProperty("http://xml.org/sax/properties/lexical-handler", saxTostax); - reader.setContentHandler(saxTostax); - - if (workingDirectory != null) { - reader.setEntityResolver(createRelativePathResolver(workingDirectory)); - } - reader.parse(new InputSource(xml)); - - xml.close(); - finf.close(); - } - - public void parse(InputStream xml, OutputStream finf) throws Exception { - parse(xml, finf, null); - } - - public static void main(String[] args) throws Exception { - XML_SAX_StAX_FI s = new XML_SAX_StAX_FI(); - s.parse(args); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/CharArray.java 2018-01-30 20:37:32.000000000 -0500 +++ /dev/null 2018-01-30 20:37:32.000000000 -0500 @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -public class CharArray implements CharSequence { - public char[] ch; - public int start; - public int length; - - protected int _hash; - - protected CharArray() { - } - - public CharArray(char[] _ch, int _start, int _length, boolean copy) { - set(_ch, _start, _length, copy); - } - - public final void set(char[] _ch, int _start, int _length, boolean copy) { - if (copy) { - ch = new char[_length]; - start = 0; - length = _length; - System.arraycopy(_ch, _start, ch, 0, _length); - } else { - ch = _ch; - start = _start; - length = _length; - } - _hash = 0; - } - - public final void cloneArray() { - char[] _ch = new char[length]; - System.arraycopy(ch, start, _ch, 0, length); - ch = _ch; - start = 0; - } - - public String toString() { - return new String(ch, start, length); - } - - public int hashCode() { - if (_hash == 0) { - // Same hash code algorithm as used for String - // s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] - for (int i = start; i < start + length; i++) { - _hash = 31*_hash + ch[i]; - } - } - return _hash; - } - - public static final int hashCode(char[] ch, int start, int length) { - // Same hash code algorithm as used for String - // s[0]*31^(n-1) + s[1]*31^(n-2) + ... + s[n-1] - int hash = 0; - for (int i = start; i < start + length; i++) { - hash = 31*hash + ch[i]; - } - - return hash; - } - - public final boolean equalsCharArray(CharArray cha) { - if (this == cha) { - return true; - } - - if (length == cha.length) { - int n = length; - int i = start; - int j = cha.start; - while (n-- != 0) { - if (ch[i++] != cha.ch[j++]) - return false; - } - return true; - } - - return false; - } - - public final boolean equalsCharArray(char[] ch, int start, int length) { - if (this.length == length) { - int n = this.length; - int i = this.start; - int j = start; - while (n-- != 0) { - if (this.ch[i++] != ch[j++]) - return false; - } - return true; - } - - return false; - } - - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof CharArray) { - CharArray cha = (CharArray)obj; - if (length == cha.length) { - int n = length; - int i = start; - int j = cha.start; - while (n-- != 0) { - if (ch[i++] != cha.ch[j++]) - return false; - } - return true; - } - } - return false; - } - - // CharSequence interface - - public final int length() { - return length; - } - - public final char charAt(int index) { - return ch[start + index]; - } - - public final CharSequence subSequence(int start, int end) { - return new CharArray(ch, this.start + start, end - start, false); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/CharArrayArray.java 2018-01-30 20:37:33.000000000 -0500 +++ /dev/null 2018-01-30 20:37:33.000000000 -0500 @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class CharArrayArray extends ValueArray { - - private CharArray[] _array; - - private CharArrayArray _readOnlyArray; - - public CharArrayArray(int initialCapacity, int maximumCapacity) { - _array = new CharArray[initialCapacity]; - _maximumCapacity = maximumCapacity; - } - - public CharArrayArray() { - this(DEFAULT_CAPACITY, MAXIMUM_CAPACITY); - } - - public final void clear() { - for (int i = 0; i < _size; i++) { - _array[i] = null; - } - _size = 0; - } - - /** - * Returns cloned version of internal CharArray[]. - * @return cloned version of internal CharArray[]. - */ - public final CharArray[] getArray() { - if (_array == null) return null; - - final CharArray[] clonedArray = new CharArray[_array.length]; - System.arraycopy(_array, 0, clonedArray, 0, _array.length); - return clonedArray; - } - - public final void setReadOnlyArray(ValueArray readOnlyArray, boolean clear) { - if (!(readOnlyArray instanceof CharArrayArray)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.illegalClass", new Object[]{readOnlyArray})); - } - - setReadOnlyArray((CharArrayArray)readOnlyArray, clear); - } - - public final void setReadOnlyArray(CharArrayArray readOnlyArray, boolean clear) { - if (readOnlyArray != null) { - _readOnlyArray = readOnlyArray; - _readOnlyArraySize = readOnlyArray.getSize(); - - if (clear) { - clear(); - } - } - } - - public final CharArray get(int i) { - if (_readOnlyArray == null) { - return _array[i]; - } else { - if (i < _readOnlyArraySize) { - return _readOnlyArray.get(i); - } else { - return _array[i - _readOnlyArraySize]; - } - } - } - - public final void add(CharArray s) { - if (_size == _array.length) { - resize(); - } - - _array[_size++] = s; - } - - protected final void resize() { - if (_size == _maximumCapacity) { - throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.arrayMaxCapacity")); - } - - int newSize = _size * 3 / 2 + 1; - if (newSize > _maximumCapacity) { - newSize = _maximumCapacity; - } - - final CharArray[] newArray = new CharArray[newSize]; - System.arraycopy(_array, 0, newArray, 0, _size); - _array = newArray; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/CharArrayIntMap.java 2018-01-30 20:37:34.000000000 -0500 +++ /dev/null 2018-01-30 20:37:34.000000000 -0500 @@ -1,228 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class CharArrayIntMap extends KeyIntMap { - - private CharArrayIntMap _readOnlyMap; - - // Total character count of Map - protected int _totalCharacterCount; - - static class Entry extends BaseEntry { - final char[] _ch; - final int _start; - final int _length; - Entry _next; - - public Entry(char[] ch, int start, int length, int hash, int value, Entry next) { - super(hash, value); - _ch = ch; - _start = start; - _length = length; - _next = next; - } - - public final boolean equalsCharArray(char[] ch, int start, int length) { - if (_length == length) { - int n = _length; - int i = _start; - int j = start; - while (n-- != 0) { - if (_ch[i++] != ch[j++]) - return false; - } - return true; - } - - return false; - } - - } - - private Entry[] _table; - - public CharArrayIntMap(int initialCapacity, float loadFactor) { - super(initialCapacity, loadFactor); - - _table = new Entry[_capacity]; - } - - public CharArrayIntMap(int initialCapacity) { - this(initialCapacity, DEFAULT_LOAD_FACTOR); - } - - public CharArrayIntMap() { - this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR); - } - - public final void clear() { - for (int i = 0; i < _table.length; i++) { - _table[i] = null; - } - _size = 0; - _totalCharacterCount = 0; - } - - public final void setReadOnlyMap(KeyIntMap readOnlyMap, boolean clear) { - if (!(readOnlyMap instanceof CharArrayIntMap)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.illegalClass", new Object[]{readOnlyMap})); - } - - setReadOnlyMap((CharArrayIntMap)readOnlyMap, clear); - } - - public final void setReadOnlyMap(CharArrayIntMap readOnlyMap, boolean clear) { - _readOnlyMap = readOnlyMap; - if (_readOnlyMap != null) { - _readOnlyMapSize = _readOnlyMap.size(); - - if (clear) { - clear(); - } - } else { - _readOnlyMapSize = 0; - } - } - - /** - * Method returns an index of the passed character buffer in - * CharArrayIntMap. - * - * @return index of character buffer in CharArrayIntMap, - * otherwise NOT_PRESENT. - */ - public final int get(char[] ch, int start, int length) { - final int hash = hashHash(CharArray.hashCode(ch, start, length)); - return get(ch, start, length, hash); - } - - /** - * Method returns an index of the passed character buffer in - * CharArrayIntMap. If character buffer is not in - * CharArrayIntMap - it will be added. - * - * @return index of character buffer in CharArrayIntMap, or - * NOT_PRESENT if character buffer was just added. - */ - public final int obtainIndex(char[] ch, int start, int length, boolean clone) { - final int hash = hashHash(CharArray.hashCode(ch, start, length)); - - if (_readOnlyMap != null) { - final int index = _readOnlyMap.get(ch, start, length, hash); - if (index != -1) { - return index; - } - } - - final int tableIndex = indexFor(hash, _table.length); - for (Entry e = _table[tableIndex]; e != null; e = e._next) { - if (e._hash == hash && e.equalsCharArray(ch, start, length)) { - return e._value; - } - } - - if (clone) { - char[] chClone = new char[length]; - System.arraycopy(ch, start, chClone, 0, length); - - ch = chClone; - start = 0; - } - - addEntry(ch, start, length, hash, _size + _readOnlyMapSize, tableIndex); - return NOT_PRESENT; - } - - public final int getTotalCharacterCount() { - return _totalCharacterCount; - } - - private final int get(char[] ch, int start, int length, int hash) { - if (_readOnlyMap != null) { - final int i = _readOnlyMap.get(ch, start, length, hash); - if (i != -1) { - return i; - } - } - - final int tableIndex = indexFor(hash, _table.length); - for (Entry e = _table[tableIndex]; e != null; e = e._next) { - if (e._hash == hash && e.equalsCharArray(ch, start, length)) { - return e._value; - } - } - - return NOT_PRESENT; - } - - private final void addEntry(char[] ch, int start, int length, int hash, int value, int bucketIndex) { - Entry e = _table[bucketIndex]; - _table[bucketIndex] = new Entry(ch, start, length, hash, value, e); - _totalCharacterCount += length; - if (_size++ >= _threshold) { - resize(2 * _table.length); - } - } - - private final void resize(int newCapacity) { - _capacity = newCapacity; - Entry[] oldTable = _table; - int oldCapacity = oldTable.length; - if (oldCapacity == MAXIMUM_CAPACITY) { - _threshold = Integer.MAX_VALUE; - return; - } - - Entry[] newTable = new Entry[_capacity]; - transfer(newTable); - _table = newTable; - _threshold = (int)(_capacity * _loadFactor); - } - - private final void transfer(Entry[] newTable) { - Entry[] src = _table; - int newCapacity = newTable.length; - for (int j = 0; j < src.length; j++) { - Entry e = src[j]; - if (e != null) { - src[j] = null; - do { - Entry next = e._next; - int i = indexFor(e._hash, newCapacity); - e._next = newTable[i]; - newTable[i] = e; - e = next; - } while (e != null); - } - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/CharArrayString.java 2018-01-30 20:37:35.000000000 -0500 +++ /dev/null 2018-01-30 20:37:35.000000000 -0500 @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -public class CharArrayString extends CharArray { - protected String _s; - - public CharArrayString(String s) { - this(s, true); - } - - public CharArrayString(String s, boolean createArray) { - _s = s; - if (createArray) { - ch = _s.toCharArray(); - start = 0; - length = ch.length; - } - } - - public String toString() { - return _s; - } - - public int hashCode() { - return _s.hashCode(); - } - - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (obj instanceof CharArrayString) { - CharArrayString chas = (CharArrayString)obj; - return _s.equals(chas._s); - } else if (obj instanceof CharArray) { - CharArray cha = (CharArray)obj; - if (length == cha.length) { - int n = length; - int i = start; - int j = cha.start; - while (n-- != 0) { - if (ch[i++] != cha.ch[j++]) - return false; - } - return true; - } - } - return false; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/ContiguousCharArrayArray.java 2018-01-30 20:37:35.000000000 -0500 +++ /dev/null 2018-01-30 20:37:36.000000000 -0500 @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class ContiguousCharArrayArray extends ValueArray { - public static final int INITIAL_CHARACTER_SIZE = 512; - public static final int MAXIMUM_CHARACTER_SIZE = Integer.MAX_VALUE; - - protected int _maximumCharacterSize; - - public int[] _offset; - public int[] _length; - - public char[] _array; - public int _arrayIndex; - public int _readOnlyArrayIndex; - - private String[] _cachedStrings; - - public int _cachedIndex; - - private ContiguousCharArrayArray _readOnlyArray; - - public ContiguousCharArrayArray(int initialCapacity, int maximumCapacity, - int initialCharacterSize, int maximumCharacterSize) { - _offset = new int[initialCapacity]; - _length = new int[initialCapacity]; - _array = new char[initialCharacterSize]; - _maximumCapacity = maximumCapacity; - _maximumCharacterSize = maximumCharacterSize; - } - - public ContiguousCharArrayArray() { - this(DEFAULT_CAPACITY, MAXIMUM_CAPACITY, - INITIAL_CHARACTER_SIZE, MAXIMUM_CHARACTER_SIZE); - } - - public final void clear() { - _arrayIndex = _readOnlyArrayIndex; - _size = _readOnlyArraySize; - - if (_cachedStrings != null) { - for (int i = _readOnlyArraySize; i < _cachedStrings.length; i++) { - _cachedStrings[i] = null; - } - } - } - - public final int getArrayIndex() { - return _arrayIndex; - } - - public final void setReadOnlyArray(ValueArray readOnlyArray, boolean clear) { - if (!(readOnlyArray instanceof ContiguousCharArrayArray)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance().getString("message.illegalClass", new Object[]{readOnlyArray})); - } - - setReadOnlyArray((ContiguousCharArrayArray)readOnlyArray, clear); - } - - public final void setReadOnlyArray(ContiguousCharArrayArray readOnlyArray, boolean clear) { - if (readOnlyArray != null) { - _readOnlyArray = readOnlyArray; - _readOnlyArraySize = readOnlyArray.getSize(); - _readOnlyArrayIndex = readOnlyArray.getArrayIndex(); - - if (clear) { - clear(); - } - - _array = getCompleteCharArray(); - _offset = getCompleteOffsetArray(); - _length = getCompleteLengthArray(); - _size = _readOnlyArraySize; - _arrayIndex = _readOnlyArrayIndex; - } - } - - public final char[] getCompleteCharArray() { - if (_readOnlyArray == null) { - if (_array == null) return null; - - // Return cloned version of internal _array - final char[] clonedArray = new char[_array.length]; - System.arraycopy(_array, 0, clonedArray, 0, _array.length); - return clonedArray; -// return _array; - } else { - final char[] ra = _readOnlyArray.getCompleteCharArray(); - final char[] a = new char[_readOnlyArrayIndex + _array.length]; - System.arraycopy(ra, 0, a, 0, _readOnlyArrayIndex); - return a; - } - } - - public final int[] getCompleteOffsetArray() { - if (_readOnlyArray == null) { - if (_offset == null) return null; - - // Return cloned version of internal _offset - final int[] clonedArray = new int[_offset.length]; - System.arraycopy(_offset, 0, clonedArray, 0, _offset.length); - return clonedArray; -// return _offset; - } else { - final int[] ra = _readOnlyArray.getCompleteOffsetArray(); - final int[] a = new int[_readOnlyArraySize + _offset.length]; - System.arraycopy(ra, 0, a, 0, _readOnlyArraySize); - return a; - } - } - - public final int[] getCompleteLengthArray() { - if (_readOnlyArray == null) { - if (_length == null) return null; - - // Return cloned version of internal _length - final int[] clonedArray = new int[_length.length]; - System.arraycopy(_length, 0, clonedArray, 0, _length.length); - return clonedArray; -// return _length; - } else { - final int[] ra = _readOnlyArray.getCompleteLengthArray(); - final int[] a = new int[_readOnlyArraySize + _length.length]; - System.arraycopy(ra, 0, a, 0, _readOnlyArraySize); - return a; - } - } - - public final String getString(int i) { - if (_cachedStrings != null && i < _cachedStrings.length) { - final String s = _cachedStrings[i]; - return (s != null) ? s : (_cachedStrings[i] = new String(_array, _offset[i], _length[i])); - } - - final String[] newCachedStrings = new String[_offset.length]; - if (_cachedStrings != null && i >= _cachedStrings.length) { - System.arraycopy(_cachedStrings, 0, newCachedStrings, 0, _cachedStrings.length); - } - _cachedStrings = newCachedStrings; - - return _cachedStrings[i] = new String(_array, _offset[i], _length[i]); - } - - public final void ensureSize(int l) { - if (_arrayIndex + l >= _array.length) { - resizeArray(_arrayIndex + l); - } - } - - public final void add(int l) { - if (_size == _offset.length) { - resize(); - } - - _cachedIndex = _size; - _offset[_size] = _arrayIndex; - _length[_size++] = l; - - _arrayIndex += l; - } - - public final int add(char[] c, int l) { - if (_size == _offset.length) { - resize(); - } - - final int oldArrayIndex = _arrayIndex; - final int arrayIndex = oldArrayIndex + l; - - _cachedIndex = _size; - _offset[_size] = oldArrayIndex; - _length[_size++] = l; - - if (arrayIndex >= _array.length) { - resizeArray(arrayIndex); - } - - System.arraycopy(c, 0, _array, oldArrayIndex, l); - - _arrayIndex = arrayIndex; - return oldArrayIndex; - } - - protected final void resize() { - if (_size == _maximumCapacity) { - throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.arrayMaxCapacity")); - } - - int newSize = _size * 3 / 2 + 1; - if (newSize > _maximumCapacity) { - newSize = _maximumCapacity; - } - - final int[] offset = new int[newSize]; - System.arraycopy(_offset, 0, offset, 0, _size); - _offset = offset; - - final int[] length = new int[newSize]; - System.arraycopy(_length, 0, length, 0, _size); - _length = length; - } - - protected final void resizeArray(int requestedSize) { - if (_arrayIndex == _maximumCharacterSize) { - throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.maxNumberOfCharacters")); - } - - int newSize = requestedSize * 3 / 2 + 1; - if (newSize > _maximumCharacterSize) { - newSize = _maximumCharacterSize; - } - - final char[] array = new char[newSize]; - System.arraycopy(_array, 0, array, 0, _arrayIndex); - _array = array; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/DuplicateAttributeVerifier.java 2018-01-30 20:37:36.000000000 -0500 +++ /dev/null 2018-01-30 20:37:36.000000000 -0500 @@ -1,124 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - - -public class DuplicateAttributeVerifier { - public static final int MAP_SIZE = 256; - - public int _currentIteration; - - public static class Entry { - private int iteration; - private int value; - - private Entry hashNext; - - private Entry poolNext; - } - - private Entry[] _map; - - public final Entry _poolHead; - public Entry _poolCurrent; - private Entry _poolTail; - - - public DuplicateAttributeVerifier() { - _poolTail = _poolHead = new Entry(); - } - - public final void clear() { - _currentIteration = 0; - - Entry e = _poolHead; - while (e != null) { - e.iteration = 0; - e = e.poolNext; - } - - reset(); - } - - public final void reset() { - _poolCurrent = _poolHead; - if (_map == null) { - _map = new Entry[MAP_SIZE]; - } - } - - private final void increasePool(int capacity) { - if (_map == null) { - _map = new Entry[MAP_SIZE]; - _poolCurrent = _poolHead; - } else { - final Entry tail = _poolTail; - for (int i = 0; i < capacity; i++) { - final Entry e = new Entry(); - _poolTail.poolNext = e; - _poolTail = e; - } - - _poolCurrent = tail.poolNext; - } - } - - public final void checkForDuplicateAttribute(int hash, int value) throws FastInfosetException { - if (_poolCurrent == null) { - increasePool(16); - } - - // Get next free entry - final Entry newEntry = _poolCurrent; - _poolCurrent = _poolCurrent.poolNext; - - final Entry head = _map[hash]; - if (head == null || head.iteration < _currentIteration) { - newEntry.hashNext = null; - _map[hash] = newEntry; - newEntry.iteration = _currentIteration; - newEntry.value = value; - } else { - Entry e = head; - do { - if (e.value == value) { - reset(); - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.duplicateAttribute")); - } - } while ((e = e.hashNext) != null); - - newEntry.hashNext = head; - _map[hash] = newEntry; - newEntry.iteration = _currentIteration; - newEntry.value = value; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/FixedEntryStringIntMap.java 2018-01-30 20:37:37.000000000 -0500 +++ /dev/null 2018-01-30 20:37:37.000000000 -0500 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class FixedEntryStringIntMap extends StringIntMap { - - private Entry _fixedEntry; - - public FixedEntryStringIntMap(String fixedEntry, int initialCapacity, float loadFactor) { - super(initialCapacity, loadFactor); - - // Add the fixed entry - final int hash = hashHash(fixedEntry.hashCode()); - final int tableIndex = indexFor(hash, _table.length); - _table[tableIndex] = _fixedEntry = new Entry(fixedEntry, hash, _index++, null); - if (_size++ >= _threshold) { - resize(2 * _table.length); - } - } - - public FixedEntryStringIntMap(String fixedEntry, int initialCapacity) { - this(fixedEntry, initialCapacity, DEFAULT_LOAD_FACTOR); - } - - public FixedEntryStringIntMap(String fixedEntry) { - this(fixedEntry, DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR); - } - - public final void clear() { - for (int i = 0; i < _table.length; i++) { - _table[i] = null; - } - _lastEntry = NULL_ENTRY; - - if (_fixedEntry != null) { - final int tableIndex = indexFor(_fixedEntry._hash, _table.length); - _table[tableIndex] = _fixedEntry; - _fixedEntry._next = null; - _size = 1; - _index = _readOnlyMapSize + 1; - } else { - _size = 0; - _index = _readOnlyMapSize; - } - } - - public final void setReadOnlyMap(KeyIntMap readOnlyMap, boolean clear) { - if (!(readOnlyMap instanceof FixedEntryStringIntMap)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.illegalClass", new Object[]{readOnlyMap})); - } - - setReadOnlyMap((FixedEntryStringIntMap)readOnlyMap, clear); - } - - public final void setReadOnlyMap(FixedEntryStringIntMap readOnlyMap, boolean clear) { - _readOnlyMap = readOnlyMap; - if (_readOnlyMap != null) { - readOnlyMap.removeFixedEntry(); - _readOnlyMapSize = readOnlyMap.size(); - _index = _readOnlyMapSize + _size; - if (clear) { - clear(); - } - } else { - _readOnlyMapSize = 0; - } - } - - private final void removeFixedEntry() { - if (_fixedEntry != null) { - final int tableIndex = indexFor(_fixedEntry._hash, _table.length); - final Entry firstEntry = _table[tableIndex]; - if (firstEntry == _fixedEntry) { - _table[tableIndex] = _fixedEntry._next; - } else { - Entry previousEntry = firstEntry; - while (previousEntry._next != _fixedEntry) { - previousEntry = previousEntry._next; - } - previousEntry._next = _fixedEntry._next; - } - - _fixedEntry = null; - _size--; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/KeyIntMap.java 2018-01-30 20:37:38.000000000 -0500 +++ /dev/null 2018-01-30 20:37:38.000000000 -0500 @@ -1,136 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public abstract class KeyIntMap { - public static final int NOT_PRESENT = -1; - - /** - * The default initial capacity - MUST be a power of two. - */ - static final int DEFAULT_INITIAL_CAPACITY = 16; - - /** - * The maximum capacity, used if a higher value is implicitly specified - * by either of the constructors with arguments. - * MUST be a power of two <= 1<<30. - */ - static final int MAXIMUM_CAPACITY = 1 << 20; - - /** - * The load factor used when none specified in constructor. - **/ - static final float DEFAULT_LOAD_FACTOR = 0.75f; - - int _readOnlyMapSize; - - /** - * The number of key-value mappings contained in this identity hash map. - */ - int _size; - - int _capacity; - - /** - * The next size value at which to resize (capacity * load factor). - */ - int _threshold; - - /** - * The load factor for the hash table. - */ - final float _loadFactor; - - static class BaseEntry { - final int _hash; - final int _value; - - public BaseEntry(int hash, int value) { - _hash = hash; - _value = value; - } - } - - public KeyIntMap(int initialCapacity, float loadFactor) { - if (initialCapacity < 0) - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.illegalInitialCapacity", new Object[]{Integer.valueOf(initialCapacity)})); - if (initialCapacity > MAXIMUM_CAPACITY) - initialCapacity = MAXIMUM_CAPACITY; - if (loadFactor <= 0 || Float.isNaN(loadFactor)) - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.illegalLoadFactor", new Object[]{Float.valueOf(loadFactor)})); - - // Find a power of 2 >= initialCapacity - if (initialCapacity != DEFAULT_INITIAL_CAPACITY) { - _capacity = 1; - while (_capacity < initialCapacity) - _capacity <<= 1; - - _loadFactor = loadFactor; - _threshold = (int)(_capacity * _loadFactor); - } else { - _capacity = DEFAULT_INITIAL_CAPACITY; - _loadFactor = DEFAULT_LOAD_FACTOR; - _threshold = (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); - } - } - - public KeyIntMap(int initialCapacity) { - this(initialCapacity, DEFAULT_LOAD_FACTOR); - } - - public KeyIntMap() { - _capacity = DEFAULT_INITIAL_CAPACITY; - _loadFactor = DEFAULT_LOAD_FACTOR; - _threshold = (int)(DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); - } - - public final int size() { - return _size + _readOnlyMapSize; - } - - public abstract void clear(); - - public abstract void setReadOnlyMap(KeyIntMap readOnlyMap, boolean clear); - - - public static final int hashHash(int h) { - h += ~(h << 9); - h ^= (h >>> 14); - h += (h << 4); - h ^= (h >>> 10); - return h; - } - - public static final int indexFor(int h, int length) { - return h & (length-1); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/LocalNameQualifiedNamesMap.java 2018-01-30 20:37:38.000000000 -0500 +++ /dev/null 2018-01-30 20:37:38.000000000 -0500 @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class LocalNameQualifiedNamesMap extends KeyIntMap { - - private LocalNameQualifiedNamesMap _readOnlyMap; - - private int _index; - - public static class Entry { - final String _key; - final int _hash; - public QualifiedName[] _value; - public int _valueIndex; - Entry _next; - - public Entry(String key, int hash, Entry next) { - _key = key; - _hash = hash; - _next = next; - _value = new QualifiedName[1]; - } - - public void addQualifiedName(QualifiedName name) { - if (_valueIndex < _value.length) { - _value[_valueIndex++] = name; - } else if (_valueIndex == _value.length) { - QualifiedName[] newValue = new QualifiedName[_valueIndex * 3 / 2 + 1]; - System.arraycopy(_value, 0, newValue, 0, _valueIndex); - _value = newValue; - _value[_valueIndex++] = name; - } - } - } - - private Entry[] _table; - - public LocalNameQualifiedNamesMap(int initialCapacity, float loadFactor) { - super(initialCapacity, loadFactor); - - _table = new Entry[_capacity]; - } - - public LocalNameQualifiedNamesMap(int initialCapacity) { - this(initialCapacity, DEFAULT_LOAD_FACTOR); - } - - public LocalNameQualifiedNamesMap() { - this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR); - } - - public final void clear() { - for (int i = 0; i < _table.length; i++) { - _table[i] = null; - } - _size = 0; - - if (_readOnlyMap != null) { - _index = _readOnlyMap.getIndex(); - } else { - _index = 0; - } - } - - public final void setReadOnlyMap(KeyIntMap readOnlyMap, boolean clear) { - if (!(readOnlyMap instanceof LocalNameQualifiedNamesMap)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.illegalClass", new Object[]{readOnlyMap})); - } - - setReadOnlyMap((LocalNameQualifiedNamesMap)readOnlyMap, clear); - } - - public final void setReadOnlyMap(LocalNameQualifiedNamesMap readOnlyMap, boolean clear) { - _readOnlyMap = readOnlyMap; - if (_readOnlyMap != null) { - _readOnlyMapSize = _readOnlyMap.size(); - _index = _readOnlyMap.getIndex(); - if (clear) { - clear(); - } - } else { - _readOnlyMapSize = 0; - _index = 0; - } - } - - public final boolean isQNameFromReadOnlyMap(QualifiedName name) { - return (_readOnlyMap != null && name.index <= _readOnlyMap.getIndex()); - } - - public final int getNextIndex() { - return _index++; - } - - public final int getIndex() { - return _index; - } - - public final Entry obtainEntry(String key) { - final int hash = hashHash(key.hashCode()); - - if (_readOnlyMap != null) { - final Entry entry = _readOnlyMap.getEntry(key, hash); - if (entry != null) { - return entry; - } - } - - final int tableIndex = indexFor(hash, _table.length); - for (Entry e = _table[tableIndex]; e != null; e = e._next) { - if (e._hash == hash && eq(key, e._key)) { - return e; - } - } - - return addEntry(key, hash, tableIndex); - } - - public final Entry obtainDynamicEntry(String key) { - final int hash = hashHash(key.hashCode()); - - final int tableIndex = indexFor(hash, _table.length); - for (Entry e = _table[tableIndex]; e != null; e = e._next) { - if (e._hash == hash && eq(key, e._key)) { - return e; - } - } - - return addEntry(key, hash, tableIndex); - } - - private final Entry getEntry(String key, int hash) { - if (_readOnlyMap != null) { - final Entry entry = _readOnlyMap.getEntry(key, hash); - if (entry != null) { - return entry; - } - } - - final int tableIndex = indexFor(hash, _table.length); - for (Entry e = _table[tableIndex]; e != null; e = e._next) { - if (e._hash == hash && eq(key, e._key)) { - return e; - } - } - - return null; - } - - - private final Entry addEntry(String key, int hash, int bucketIndex) { - Entry e = _table[bucketIndex]; - _table[bucketIndex] = new Entry(key, hash, e); - e = _table[bucketIndex]; - if (_size++ >= _threshold) { - resize(2 * _table.length); - } - - return e; - } - - private final void resize(int newCapacity) { - _capacity = newCapacity; - Entry[] oldTable = _table; - int oldCapacity = oldTable.length; - if (oldCapacity == MAXIMUM_CAPACITY) { - _threshold = Integer.MAX_VALUE; - return; - } - - Entry[] newTable = new Entry[_capacity]; - transfer(newTable); - _table = newTable; - _threshold = (int)(_capacity * _loadFactor); - } - - private final void transfer(Entry[] newTable) { - Entry[] src = _table; - int newCapacity = newTable.length; - for (int j = 0; j < src.length; j++) { - Entry e = src[j]; - if (e != null) { - src[j] = null; - do { - Entry next = e._next; - int i = indexFor(e._hash, newCapacity); - e._next = newTable[i]; - newTable[i] = e; - e = next; - } while (e != null); - } - } - } - - private final boolean eq(String x, String y) { - return x == y || x.equals(y); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/NamespaceContextImplementation.java 2018-01-30 20:37:39.000000000 -0500 +++ /dev/null 2018-01-30 20:37:39.000000000 -0500 @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import javax.xml.namespace.NamespaceContext; - -/** - * - * @author Paul.Sandoz@Sun.Com - */ -final public class NamespaceContextImplementation implements NamespaceContext { - private static int DEFAULT_SIZE = 8; - - private String[] prefixes = new String[DEFAULT_SIZE]; - private String[] namespaceURIs = new String[DEFAULT_SIZE]; - private int namespacePosition; - - private int[] contexts = new int[DEFAULT_SIZE]; - private int contextPosition; - - private int currentContext; - - public NamespaceContextImplementation() { - prefixes[0] = "xml"; - namespaceURIs[0] = "http://www.w3.org/XML/1998/namespace"; - prefixes[1] = "xmlns"; - namespaceURIs[1] = "http://www.w3.org/2000/xmlns/"; - - currentContext = namespacePosition = 2; - } - - - public String getNamespaceURI(String prefix) { - if (prefix == null) throw new IllegalArgumentException(); - -// prefix = prefix.intern(); - - for (int i = namespacePosition - 1; i >= 0; i--) { - final String declaredPrefix = prefixes[i]; - if (declaredPrefix.equals(prefix)) { - return namespaceURIs[i]; - } - } - - return ""; - } - - public String getPrefix(String namespaceURI) { - if (namespaceURI == null) throw new IllegalArgumentException(); - - // namespaceURI = namespaceURI.intern(); - - for (int i = namespacePosition - 1; i >= 0; i--) { - final String declaredNamespaceURI = namespaceURIs[i]; - if (declaredNamespaceURI.equals(namespaceURI)) { - final String declaredPrefix = prefixes[i]; - - // Check if prefix is out of scope - boolean isOutOfScope = false; - for (int j = i + 1; j < namespacePosition; j++) - if (declaredPrefix.equals(prefixes[j])) { - isOutOfScope = true; - break; - } - - if (!isOutOfScope) { - return declaredPrefix; - } - } - } - - return null; - } - - public String getNonDefaultPrefix(String namespaceURI) { - if (namespaceURI == null) throw new IllegalArgumentException(); - - // namespaceURI = namespaceURI.intern(); - - for (int i = namespacePosition - 1; i >= 0; i--) { - final String declaredNamespaceURI = namespaceURIs[i]; - if (declaredNamespaceURI.equals(namespaceURI) && - prefixes[i].length() > 0){ - final String declaredPrefix = prefixes[i]; - - // Check if prefix is out of scope - for (++i; i < namespacePosition; i++) - if (declaredPrefix.equals(prefixes[i])) - return null; - - return declaredPrefix; - } - } - - return null; - } - - public Iterator getPrefixes(String namespaceURI) { - if (namespaceURI == null) throw new IllegalArgumentException(); - - // namespaceURI = namespaceURI.intern(); - - List l = new ArrayList(); - - NAMESPACE_LOOP: for (int i = namespacePosition - 1; i >= 0; i--) { - final String declaredNamespaceURI = namespaceURIs[i]; - if (declaredNamespaceURI.equals(namespaceURI)) { - final String declaredPrefix = prefixes[i]; - - // Check if prefix is out of scope - for (int j = i + 1; j < namespacePosition; j++) - if (declaredPrefix.equals(prefixes[j])) - continue NAMESPACE_LOOP; - - l.add(declaredPrefix); - } - } - - return l.iterator(); - } - - - public String getPrefix(int index) { - return prefixes[index]; - } - - public String getNamespaceURI(int index) { - return namespaceURIs[index]; - } - - public int getCurrentContextStartIndex() { - return currentContext; - } - - public int getCurrentContextEndIndex() { - return namespacePosition; - } - - public boolean isCurrentContextEmpty() { - return currentContext == namespacePosition; - } - - public void declarePrefix(String prefix, String namespaceURI) { - prefix = prefix.intern(); - namespaceURI = namespaceURI.intern(); - - // Ignore the "xml" or "xmlns" declarations - if (prefix == "xml" || prefix == "xmlns") - return; - - // Replace any previous declaration - for (int i = currentContext; i < namespacePosition; i++) { - final String declaredPrefix = prefixes[i]; - if (declaredPrefix == prefix) { - prefixes[i] = prefix; - namespaceURIs[i] = namespaceURI; - return; - } - } - - if (namespacePosition == namespaceURIs.length) - resizeNamespaces(); - - // Add new declaration - prefixes[namespacePosition] = prefix; - namespaceURIs[namespacePosition++] = namespaceURI; - } - - private void resizeNamespaces() { - final int newLength = namespaceURIs.length * 3 / 2 + 1; - - String[] newPrefixes = new String[newLength]; - System.arraycopy(prefixes, 0, newPrefixes, 0, prefixes.length); - prefixes = newPrefixes; - - String[] newNamespaceURIs = new String[newLength]; - System.arraycopy(namespaceURIs, 0, newNamespaceURIs, 0, namespaceURIs.length); - namespaceURIs = newNamespaceURIs; - } - - public void pushContext() { - if (contextPosition == contexts.length) - resizeContexts(); - - contexts[contextPosition++] = currentContext = namespacePosition; - } - - private void resizeContexts() { - int[] newContexts = new int[contexts.length * 3 / 2 + 1]; - System.arraycopy(contexts, 0, newContexts, 0, contexts.length); - contexts = newContexts; - } - - public void popContext() { - if (contextPosition > 0) { - namespacePosition = currentContext = contexts[--contextPosition]; - } - } - - public void reset() { - currentContext = namespacePosition = 2; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/PrefixArray.java 2018-01-30 20:37:40.000000000 -0500 +++ /dev/null 2018-01-30 20:37:40.000000000 -0500 @@ -1,518 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; -import java.util.Iterator; -import java.util.NoSuchElementException; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; - -public class PrefixArray extends ValueArray { - public static final int PREFIX_MAP_SIZE = 64; - - private int _initialCapacity; - - public String[] _array; - - private PrefixArray _readOnlyArray; - - private static class PrefixEntry { - private PrefixEntry next; - private int prefixId; - } - - private PrefixEntry[] _prefixMap = new PrefixEntry[PREFIX_MAP_SIZE]; - - private PrefixEntry _prefixPool; - - private static class NamespaceEntry { - private NamespaceEntry next; - private int declarationId; - private int namespaceIndex; - - private String prefix; - private String namespaceName; - private int prefixEntryIndex; - } - - private NamespaceEntry _namespacePool; - - private NamespaceEntry[] _inScopeNamespaces; - - public int[] _currentInScope; - - public int _declarationId; - - public PrefixArray(int initialCapacity, int maximumCapacity) { - _initialCapacity = initialCapacity; - _maximumCapacity = maximumCapacity; - - _array = new String[initialCapacity]; - // Sizes of _inScopeNamespaces and _currentInScope need to be two - // greater than _array because 0 represents the empty string and - // 1 represents the xml prefix - _inScopeNamespaces = new NamespaceEntry[initialCapacity + 2]; - _currentInScope = new int[initialCapacity + 2]; - - increaseNamespacePool(initialCapacity); - increasePrefixPool(initialCapacity); - - initializeEntries(); - } - - public PrefixArray() { - this(DEFAULT_CAPACITY, MAXIMUM_CAPACITY); - } - - private final void initializeEntries() { - _inScopeNamespaces[0] = _namespacePool; - _namespacePool = _namespacePool.next; - _inScopeNamespaces[0].next = null; - _inScopeNamespaces[0].prefix = ""; - _inScopeNamespaces[0].namespaceName = ""; - _inScopeNamespaces[0].namespaceIndex = _currentInScope[0] = 0; - - int index = KeyIntMap.indexFor(KeyIntMap.hashHash(_inScopeNamespaces[0].prefix.hashCode()), _prefixMap.length); - _prefixMap[index] = _prefixPool; - _prefixPool = _prefixPool.next; - _prefixMap[index].next = null; - _prefixMap[index].prefixId = 0; - - - _inScopeNamespaces[1] = _namespacePool; - _namespacePool = _namespacePool.next; - _inScopeNamespaces[1].next = null; - _inScopeNamespaces[1].prefix = EncodingConstants.XML_NAMESPACE_PREFIX; - _inScopeNamespaces[1].namespaceName = EncodingConstants.XML_NAMESPACE_NAME; - _inScopeNamespaces[1].namespaceIndex = _currentInScope[1] = 1; - - index = KeyIntMap.indexFor(KeyIntMap.hashHash(_inScopeNamespaces[1].prefix.hashCode()), _prefixMap.length); - if (_prefixMap[index] == null) { - _prefixMap[index] = _prefixPool; - _prefixPool = _prefixPool.next; - _prefixMap[index].next = null; - } else { - final PrefixEntry e = _prefixMap[index]; - _prefixMap[index] = _prefixPool; - _prefixPool = _prefixPool.next; - _prefixMap[index].next = e; - } - _prefixMap[index].prefixId = 1; - } - - private final void increaseNamespacePool(int capacity) { - if (_namespacePool == null) { - _namespacePool = new NamespaceEntry(); - } - - for (int i = 0; i < capacity; i++) { - NamespaceEntry ne = new NamespaceEntry(); - ne.next = _namespacePool; - _namespacePool = ne; - } - } - - private final void increasePrefixPool(int capacity) { - if (_prefixPool == null) { - _prefixPool = new PrefixEntry(); - } - - for (int i = 0; i < capacity; i++) { - PrefixEntry pe = new PrefixEntry(); - pe.next = _prefixPool; - _prefixPool = pe; - } - } - - public int countNamespacePool() { - int i = 0; - NamespaceEntry e = _namespacePool; - while (e != null) { - i++; - e = e.next; - } - return i; - } - - public int countPrefixPool() { - int i = 0; - PrefixEntry e = _prefixPool; - while (e != null) { - i++; - e = e.next; - } - return i; - } - - public final void clear() { - for (int i = _readOnlyArraySize; i < _size; i++) { - _array[i] = null; - } - _size = _readOnlyArraySize; - } - - public final void clearCompletely() { - _prefixPool = null; - _namespacePool = null; - - for (int i = 0; i < _size + 2; i++) { - _currentInScope[i] = 0; - _inScopeNamespaces[i] = null; - } - - for (int i = 0; i < _prefixMap.length; i++) { - _prefixMap[i] = null; - } - - increaseNamespacePool(_initialCapacity); - increasePrefixPool(_initialCapacity); - - initializeEntries(); - - _declarationId = 0; - - clear(); - } - - /** - * Returns cloned version of internal String[]. - * @return cloned version of internal String[]. - */ - public final String[] getArray() { - if (_array == null) return null; - - final String[] clonedArray = new String[_array.length]; - System.arraycopy(_array, 0, clonedArray, 0, _array.length); - return clonedArray; - } - - public final void setReadOnlyArray(ValueArray readOnlyArray, boolean clear) { - if (!(readOnlyArray instanceof PrefixArray)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.illegalClass", new Object[]{readOnlyArray})); - } - - setReadOnlyArray((PrefixArray)readOnlyArray, clear); - } - - public final void setReadOnlyArray(PrefixArray readOnlyArray, boolean clear) { - if (readOnlyArray != null) { - _readOnlyArray = readOnlyArray; - _readOnlyArraySize = readOnlyArray.getSize(); - - clearCompletely(); - - // Resize according to size of read only arrays - _inScopeNamespaces = new NamespaceEntry[_readOnlyArraySize + _inScopeNamespaces.length]; - _currentInScope = new int[_readOnlyArraySize + _currentInScope.length]; - // Intialize first two entries - initializeEntries(); - - if (clear) { - clear(); - } - - _array = getCompleteArray(); - _size = _readOnlyArraySize; - } - } - - public final String[] getCompleteArray() { - if (_readOnlyArray == null) { - // Return cloned version of internal _array - return getArray(); -// return _array; - } else { - final String[] ra = _readOnlyArray.getCompleteArray(); - final String[] a = new String[_readOnlyArraySize + _array.length]; - System.arraycopy(ra, 0, a, 0, _readOnlyArraySize); - return a; - } - } - - public final String get(int i) { - return _array[i]; - } - - public final int add(String s) { - if (_size == _array.length) { - resize(); - } - - _array[_size++] = s; - return _size; - } - - protected final void resize() { - if (_size == _maximumCapacity) { - throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.arrayMaxCapacity")); - } - - int newSize = _size * 3 / 2 + 1; - if (newSize > _maximumCapacity) { - newSize = _maximumCapacity; - } - - final String[] newArray = new String[newSize]; - System.arraycopy(_array, 0, newArray, 0, _size); - _array = newArray; - - newSize += 2; - final NamespaceEntry[] newInScopeNamespaces = new NamespaceEntry[newSize]; - System.arraycopy(_inScopeNamespaces, 0, newInScopeNamespaces, 0, _inScopeNamespaces.length); - _inScopeNamespaces = newInScopeNamespaces; - - final int[] newCurrentInScope = new int[newSize]; - System.arraycopy(_currentInScope, 0, newCurrentInScope, 0, _currentInScope.length); - _currentInScope = newCurrentInScope; - } - - public final void clearDeclarationIds() { - for (int i = 0; i < _size; i++) { - final NamespaceEntry e = _inScopeNamespaces[i]; - if (e != null) { - e.declarationId = 0; - } - } - - _declarationId = 1; - } - - public final void pushScope(int prefixIndex, int namespaceIndex) throws FastInfosetException { - if (_namespacePool == null) { - increaseNamespacePool(16); - } - - final NamespaceEntry e = _namespacePool; - _namespacePool = e.next; - - final NamespaceEntry current = _inScopeNamespaces[++prefixIndex]; - if (current == null) { - e.declarationId = _declarationId; - e.namespaceIndex = _currentInScope[prefixIndex] = ++namespaceIndex; - e.next = null; - - _inScopeNamespaces[prefixIndex] = e; - } else if (current.declarationId < _declarationId) { - e.declarationId = _declarationId; - e.namespaceIndex = _currentInScope[prefixIndex] = ++namespaceIndex; - e.next = current; - - current.declarationId = 0; - _inScopeNamespaces[prefixIndex] = e; - } else { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.duplicateNamespaceAttribute")); - } - } - - public final void pushScopeWithPrefixEntry(String prefix, String namespaceName, - int prefixIndex, int namespaceIndex) throws FastInfosetException { - if (_namespacePool == null) { - increaseNamespacePool(16); - } - if (_prefixPool == null) { - increasePrefixPool(16); - } - - final NamespaceEntry e = _namespacePool; - _namespacePool = e.next; - - final NamespaceEntry current = _inScopeNamespaces[++prefixIndex]; - if (current == null) { - e.declarationId = _declarationId; - e.namespaceIndex = _currentInScope[prefixIndex] = ++namespaceIndex; - e.next = null; - - _inScopeNamespaces[prefixIndex] = e; - } else if (current.declarationId < _declarationId) { - e.declarationId = _declarationId; - e.namespaceIndex = _currentInScope[prefixIndex] = ++namespaceIndex; - e.next = current; - - current.declarationId = 0; - _inScopeNamespaces[prefixIndex] = e; - } else { - throw new FastInfosetException(CommonResourceBundle.getInstance().getString("message.duplicateNamespaceAttribute")); - } - - final PrefixEntry p = _prefixPool; - _prefixPool = _prefixPool.next; - p.prefixId = prefixIndex; - - e.prefix = prefix; - e.namespaceName = namespaceName; - e.prefixEntryIndex = KeyIntMap.indexFor(KeyIntMap.hashHash(prefix.hashCode()), _prefixMap.length); - - final PrefixEntry pCurrent = _prefixMap[e.prefixEntryIndex]; - p.next = pCurrent; - _prefixMap[e.prefixEntryIndex] = p; - } - - public final void popScope(int prefixIndex) { - final NamespaceEntry e = _inScopeNamespaces[++prefixIndex]; - _inScopeNamespaces[prefixIndex] = e.next; - _currentInScope[prefixIndex] = (e.next != null) ? e.next.namespaceIndex : 0; - - e.next = _namespacePool; - _namespacePool = e; - } - - public final void popScopeWithPrefixEntry(int prefixIndex) { - final NamespaceEntry e = _inScopeNamespaces[++prefixIndex]; - - _inScopeNamespaces[prefixIndex] = e.next; - _currentInScope[prefixIndex] = (e.next != null) ? e.next.namespaceIndex : 0; - - e.prefix = e.namespaceName = null; - e.next = _namespacePool; - _namespacePool = e; - - PrefixEntry current = _prefixMap[e.prefixEntryIndex]; - if (current.prefixId == prefixIndex) { - _prefixMap[e.prefixEntryIndex] = current.next; - current.next = _prefixPool; - _prefixPool = current; - } else { - PrefixEntry prev = current; - current = current.next; - while (current != null) { - if (current.prefixId == prefixIndex) { - prev.next = current.next; - current.next = _prefixPool; - _prefixPool = current; - break; - } - prev = current; - current = current.next; - } - } - } - - public final String getNamespaceFromPrefix(String prefix) { - final int index = KeyIntMap.indexFor(KeyIntMap.hashHash(prefix.hashCode()), _prefixMap.length); - PrefixEntry pe = _prefixMap[index]; - while (pe != null) { - final NamespaceEntry ne = _inScopeNamespaces[pe.prefixId]; - if (prefix == ne.prefix || prefix.equals(ne.prefix)) { - return ne.namespaceName; - } - pe = pe.next; - } - - return null; - } - - public final String getPrefixFromNamespace(String namespaceName) { - int position = 0; - while (++position < _size + 2) { - final NamespaceEntry ne = _inScopeNamespaces[position]; - if (ne != null && namespaceName.equals(ne.namespaceName)) { - return ne.prefix; - } - } - - return null; - } - - public final Iterator getPrefixes() { - return new Iterator() { - int _position = 1; - NamespaceEntry _ne = _inScopeNamespaces[_position]; - - public boolean hasNext() { - return _ne != null; - } - - public Object next() { - if (_position == _size + 2) { - throw new NoSuchElementException(); - } - - final String prefix = _ne.prefix; - moveToNext(); - return prefix; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - private final void moveToNext() { - while (++_position < _size + 2) { - _ne = _inScopeNamespaces[_position]; - if (_ne != null) { - return; - } - } - _ne = null; - } - - }; - } - - public final Iterator getPrefixesFromNamespace(final String namespaceName) { - return new Iterator() { - String _namespaceName = namespaceName; - int _position = 0; - NamespaceEntry _ne; - - { - moveToNext(); - } - - public boolean hasNext() { - return _ne != null; - } - - public Object next() { - if (_position == _size + 2) { - throw new NoSuchElementException(); - } - - final String prefix = _ne.prefix; - moveToNext(); - return prefix; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - private final void moveToNext() { - while (++_position < _size + 2) { - _ne = _inScopeNamespaces[_position]; - if (_ne != null && _namespaceName.equals(_ne.namespaceName)) { - return; - } - } - _ne = null; - } - }; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/QualifiedNameArray.java 2018-01-30 20:37:41.000000000 -0500 +++ /dev/null 2018-01-30 20:37:41.000000000 -0500 @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class QualifiedNameArray extends ValueArray { - - public QualifiedName[] _array; - - private QualifiedNameArray _readOnlyArray; - - public QualifiedNameArray(int initialCapacity, int maximumCapacity) { - _array = new QualifiedName[initialCapacity]; - _maximumCapacity = maximumCapacity; - } - - public QualifiedNameArray() { - this(DEFAULT_CAPACITY, MAXIMUM_CAPACITY); - } - - public final void clear() { - _size = _readOnlyArraySize; - } - - /** - * Returns cloned version of internal QualifiedName[]. - * @return cloned version of internal QualifiedName[]. - */ - public final QualifiedName[] getArray() { - if (_array == null) return null; - - final QualifiedName[] clonedArray = new QualifiedName[_array.length]; - System.arraycopy(_array, 0, clonedArray, 0, _array.length); - return clonedArray; - } - - public final void setReadOnlyArray(ValueArray readOnlyArray, boolean clear) { - if (!(readOnlyArray instanceof QualifiedNameArray)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.illegalClass", new Object[]{readOnlyArray})); - } - - setReadOnlyArray((QualifiedNameArray)readOnlyArray, clear); - } - - public final void setReadOnlyArray(QualifiedNameArray readOnlyArray, boolean clear) { - if (readOnlyArray != null) { - _readOnlyArray = readOnlyArray; - _readOnlyArraySize = readOnlyArray.getSize(); - - if (clear) { - clear(); - } - - _array = getCompleteArray(); - _size = _readOnlyArraySize; - } - } - - public final QualifiedName[] getCompleteArray() { - if (_readOnlyArray == null) { - // Return cloned version of internal _array - return getArray(); -// return _array; - } else { - final QualifiedName[] ra = _readOnlyArray.getCompleteArray(); - final QualifiedName[] a = new QualifiedName[_readOnlyArraySize + _array.length]; - System.arraycopy(ra, 0, a, 0, _readOnlyArraySize); - return a; - } - } - - public final QualifiedName getNext() { - return (_size == _array.length) ? null : _array[_size]; - } - - public final void add(QualifiedName s) { - if (_size == _array.length) { - resize(); - } - - _array[_size++] = s; - } - - protected final void resize() { - if (_size == _maximumCapacity) { - throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.arrayMaxCapacity")); - } - - int newSize = _size * 3 / 2 + 1; - if (newSize > _maximumCapacity) { - newSize = _maximumCapacity; - } - - final QualifiedName[] newArray = new QualifiedName[newSize]; - System.arraycopy(_array, 0, newArray, 0, _size); - _array = newArray; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/StringArray.java 2018-01-30 20:37:41.000000000 -0500 +++ /dev/null 2018-01-30 20:37:42.000000000 -0500 @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class StringArray extends ValueArray { - - public String[] _array; - - private StringArray _readOnlyArray; - - private boolean _clear; - - public StringArray(int initialCapacity, int maximumCapacity, boolean clear) { - _array = new String[initialCapacity]; - _maximumCapacity = maximumCapacity; - _clear = clear; - } - - public StringArray() { - this(DEFAULT_CAPACITY, MAXIMUM_CAPACITY, false); - } - - public final void clear() { - if (_clear) for (int i = _readOnlyArraySize; i < _size; i++) { - _array[i] = null; - } - _size = _readOnlyArraySize; - } - - /** - * Returns cloned version of internal String[]. - * @return cloned version of internal String[]. - */ - public final String[] getArray() { - if (_array == null) return null; - - final String[] clonedArray = new String[_array.length]; - System.arraycopy(_array, 0, clonedArray, 0, _array.length); - return clonedArray; - } - - public final void setReadOnlyArray(ValueArray readOnlyArray, boolean clear) { - if (!(readOnlyArray instanceof StringArray)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.illegalClass", new Object[]{readOnlyArray})); - } - - setReadOnlyArray((StringArray)readOnlyArray, clear); - } - - public final void setReadOnlyArray(StringArray readOnlyArray, boolean clear) { - if (readOnlyArray != null) { - _readOnlyArray = readOnlyArray; - _readOnlyArraySize = readOnlyArray.getSize(); - - if (clear) { - clear(); - } - - _array = getCompleteArray(); - _size = _readOnlyArraySize; - } - } - - public final String[] getCompleteArray() { - if (_readOnlyArray == null) { - // Return cloned version of internal _array - return getArray(); -// return _array; - } else { - final String[] ra = _readOnlyArray.getCompleteArray(); - final String[] a = new String[_readOnlyArraySize + _array.length]; - System.arraycopy(ra, 0, a, 0, _readOnlyArraySize); - return a; - } - } - - public final String get(int i) { - return _array[i]; - } - - public final int add(String s) { - if (_size == _array.length) { - resize(); - } - - _array[_size++] = s; - return _size; - } - - protected final void resize() { - if (_size == _maximumCapacity) { - throw new ValueArrayResourceException(CommonResourceBundle.getInstance().getString("message.arrayMaxCapacity")); - } - - int newSize = _size * 3 / 2 + 1; - if (newSize > _maximumCapacity) { - newSize = _maximumCapacity; - } - - final String[] newArray = new String[newSize]; - System.arraycopy(_array, 0, newArray, 0, _size); - _array = newArray; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/StringIntMap.java 2018-01-30 20:37:42.000000000 -0500 +++ /dev/null 2018-01-30 20:37:42.000000000 -0500 @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; - -public class StringIntMap extends KeyIntMap { - protected static final Entry NULL_ENTRY = new Entry(null, 0, -1, null); - - protected StringIntMap _readOnlyMap; - - protected static class Entry extends BaseEntry { - final String _key; - Entry _next; - - public Entry(String key, int hash, int value, Entry next) { - super(hash, value); - _key = key; - _next = next; - } - } - - protected Entry _lastEntry = NULL_ENTRY; - - protected Entry[] _table; - - protected int _index; - - // Total character count of Map - protected int _totalCharacterCount; - - public StringIntMap(int initialCapacity, float loadFactor) { - super(initialCapacity, loadFactor); - - _table = new Entry[_capacity]; - } - - public StringIntMap(int initialCapacity) { - this(initialCapacity, DEFAULT_LOAD_FACTOR); - } - - public StringIntMap() { - this(DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR); - } - - public void clear() { - for (int i = 0; i < _table.length; i++) { - _table[i] = null; - } - _lastEntry = NULL_ENTRY; - _size = 0; - _index = _readOnlyMapSize; - _totalCharacterCount = 0; - } - - public void setReadOnlyMap(KeyIntMap readOnlyMap, boolean clear) { - if (!(readOnlyMap instanceof StringIntMap)) { - throw new IllegalArgumentException(CommonResourceBundle.getInstance(). - getString("message.illegalClass", new Object[]{readOnlyMap})); - } - - setReadOnlyMap((StringIntMap)readOnlyMap, clear); - } - - public final void setReadOnlyMap(StringIntMap readOnlyMap, boolean clear) { - _readOnlyMap = readOnlyMap; - if (_readOnlyMap != null) { - _readOnlyMapSize = _readOnlyMap.size(); - _index = _size + _readOnlyMapSize; - - if (clear) { - clear(); - } - } else { - _readOnlyMapSize = 0; - _index = _size; - } - } - - public final int getNextIndex() { - return _index++; - } - - public final int getIndex() { - return _index; - } - - public final int obtainIndex(String key) { - final int hash = hashHash(key.hashCode()); - - if (_readOnlyMap != null) { - final int index = _readOnlyMap.get(key, hash); - if (index != -1) { - return index; - } - } - - final int tableIndex = indexFor(hash, _table.length); - for (Entry e = _table[tableIndex]; e != null; e = e._next) { - if (e._hash == hash && eq(key, e._key)) { - return e._value; - } - } - - addEntry(key, hash, tableIndex); - return NOT_PRESENT; - } - - public final void add(String key) { - final int hash = hashHash(key.hashCode()); - final int tableIndex = indexFor(hash, _table.length); - addEntry(key, hash, tableIndex); - } - - public final int get(String key) { - if (key == _lastEntry._key) - return _lastEntry._value; - - return get(key, hashHash(key.hashCode())); - } - - public final int getTotalCharacterCount() { - return _totalCharacterCount; - } - - private final int get(String key, int hash) { - if (_readOnlyMap != null) { - final int i = _readOnlyMap.get(key, hash); - if (i != -1) { - return i; - } - } - - final int tableIndex = indexFor(hash, _table.length); - for (Entry e = _table[tableIndex]; e != null; e = e._next) { - if (e._hash == hash && eq(key, e._key)) { - _lastEntry = e; - return e._value; - } - } - - return NOT_PRESENT; - } - - - private final void addEntry(String key, int hash, int bucketIndex) { - Entry e = _table[bucketIndex]; - _table[bucketIndex] = new Entry(key, hash, _index++, e); - _totalCharacterCount += key.length(); - if (_size++ >= _threshold) { - resize(2 * _table.length); - } - } - - protected final void resize(int newCapacity) { - _capacity = newCapacity; - Entry[] oldTable = _table; - int oldCapacity = oldTable.length; - if (oldCapacity == MAXIMUM_CAPACITY) { - _threshold = Integer.MAX_VALUE; - return; - } - - Entry[] newTable = new Entry[_capacity]; - transfer(newTable); - _table = newTable; - _threshold = (int)(_capacity * _loadFactor); - } - - private final void transfer(Entry[] newTable) { - Entry[] src = _table; - int newCapacity = newTable.length; - for (int j = 0; j < src.length; j++) { - Entry e = src[j]; - if (e != null) { - src[j] = null; - do { - Entry next = e._next; - int i = indexFor(e._hash, newCapacity); - e._next = newTable[i]; - newTable[i] = e; - e = next; - } while (e != null); - } - } - } - - private final boolean eq(String x, String y) { - return x == y || x.equals(y); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/ValueArray.java 2018-01-30 20:37:43.000000000 -0500 +++ /dev/null 2018-01-30 20:37:43.000000000 -0500 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -public abstract class ValueArray { - public static final int DEFAULT_CAPACITY = 10; - public static final int MAXIMUM_CAPACITY = Integer.MAX_VALUE; - - protected int _size; - - protected int _readOnlyArraySize; - - protected int _maximumCapacity; - - public int getSize() { - return _size; - } - - public int getMaximumCapacity() { - return _maximumCapacity; - } - - public void setMaximumCapacity(int maximumCapacity) { - _maximumCapacity = maximumCapacity; - } - - public abstract void setReadOnlyArray(ValueArray array, boolean clear); - - public abstract void clear(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/util/ValueArrayResourceException.java 2018-01-30 20:37:44.000000000 -0500 +++ /dev/null 2018-01-30 20:37:44.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.util; - -public class ValueArrayResourceException extends RuntimeException { - - public ValueArrayResourceException() { - } - - public ValueArrayResourceException(String message) { - super(message); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/vocab/ParserVocabulary.java 2018-01-30 20:37:45.000000000 -0500 +++ /dev/null 2018-01-30 20:37:45.000000000 -0500 @@ -1,294 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.vocab; - -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.util.CharArray; -import com.sun.xml.internal.fastinfoset.util.CharArrayArray; -import com.sun.xml.internal.fastinfoset.util.ContiguousCharArrayArray; -import com.sun.xml.internal.fastinfoset.util.DuplicateAttributeVerifier; -import com.sun.xml.internal.fastinfoset.util.FixedEntryStringIntMap; -import com.sun.xml.internal.fastinfoset.util.KeyIntMap; -import com.sun.xml.internal.fastinfoset.util.PrefixArray; -import com.sun.xml.internal.fastinfoset.util.QualifiedNameArray; -import com.sun.xml.internal.fastinfoset.util.StringArray; -import com.sun.xml.internal.fastinfoset.util.StringIntMap; -import com.sun.xml.internal.fastinfoset.util.ValueArray; -import java.util.Iterator; -import javax.xml.namespace.QName; - -public class ParserVocabulary extends Vocabulary { - public static final String IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS_PEOPERTY = - "com.sun.xml.internal.fastinfoset.vocab.ParserVocabulary.IdentifyingStringTable.maximumItems"; - public static final String NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS_PEOPERTY = - "com.sun.xml.internal.fastinfoset.vocab.ParserVocabulary.NonIdentifyingStringTable.maximumItems"; - public static final String NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS_PEOPERTY = - "com.sun.xml.internal.fastinfoset.vocab.ParserVocabulary.NonIdentifyingStringTable.maximumCharacters"; - - protected static final int IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS = - getIntegerValueFromProperty(IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS_PEOPERTY); - protected static final int NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS = - getIntegerValueFromProperty(NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS_PEOPERTY); - protected static final int NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS = - getIntegerValueFromProperty(NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS_PEOPERTY); - - private static int getIntegerValueFromProperty(String property) { - String value = System.getProperty(property); - if (value == null) { - return Integer.MAX_VALUE; - } - - try { - return Math.max(Integer.parseInt(value), ValueArray.DEFAULT_CAPACITY); - } catch (NumberFormatException e) { - return Integer.MAX_VALUE; - } - } - - public final CharArrayArray restrictedAlphabet = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, 256); - public final StringArray encodingAlgorithm = new StringArray(ValueArray.DEFAULT_CAPACITY, 256, true); - - public final StringArray namespaceName; - public final PrefixArray prefix; - public final StringArray localName; - public final StringArray otherNCName ; - public final StringArray otherURI; - public final StringArray attributeValue; - public final CharArrayArray otherString; - - public final ContiguousCharArrayArray characterContentChunk; - - public final QualifiedNameArray elementName; - public final QualifiedNameArray attributeName; - - public final ValueArray[] tables = new ValueArray[12]; - - protected SerializerVocabulary _readOnlyVocabulary; - - /** Creates a new instance of ParserVocabulary */ - public ParserVocabulary() { - namespaceName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false); - prefix = new PrefixArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS); - localName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false); - otherNCName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false); - otherURI = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true); - attributeValue = new StringArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true); - otherString = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS); - - characterContentChunk = new ContiguousCharArrayArray(ValueArray.DEFAULT_CAPACITY, - NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, - ContiguousCharArrayArray.INITIAL_CHARACTER_SIZE, - NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS); - - elementName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS); - attributeName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS); - - tables[RESTRICTED_ALPHABET] = restrictedAlphabet; - tables[ENCODING_ALGORITHM] = encodingAlgorithm; - tables[PREFIX] = prefix; - tables[NAMESPACE_NAME] = namespaceName; - tables[LOCAL_NAME] = localName; - tables[OTHER_NCNAME] = otherNCName; - tables[OTHER_URI] = otherURI; - tables[ATTRIBUTE_VALUE] = attributeValue; - tables[OTHER_STRING] = otherString; - tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk; - tables[ELEMENT_NAME] = elementName; - tables[ATTRIBUTE_NAME] = attributeName; - } - - - public ParserVocabulary(com.sun.xml.internal.org.jvnet.fastinfoset.Vocabulary v) { - this(); - - convertVocabulary(v); - } - - void setReadOnlyVocabulary(ParserVocabulary readOnlyVocabulary, boolean clear) { - for (int i = 0; i < tables.length; i++) { - tables[i].setReadOnlyArray(readOnlyVocabulary.tables[i], clear); - } - } - - public void setInitialVocabulary(ParserVocabulary initialVocabulary, boolean clear) { - setExternalVocabularyURI(null); - setInitialReadOnlyVocabulary(true); - setReadOnlyVocabulary(initialVocabulary, clear); - } - - public void setReferencedVocabulary(String referencedVocabularyURI, ParserVocabulary referencedVocabulary, boolean clear) { - if (!referencedVocabularyURI.equals(getExternalVocabularyURI())) { - setInitialReadOnlyVocabulary(false); - setExternalVocabularyURI(referencedVocabularyURI); - setReadOnlyVocabulary(referencedVocabulary, clear); - } - } - - public void clear() { - for (int i = 0; i < tables.length; i++) { - tables[i].clear(); - } - } - - private void convertVocabulary(com.sun.xml.internal.org.jvnet.fastinfoset.Vocabulary v) { - final StringIntMap prefixMap = new FixedEntryStringIntMap( - EncodingConstants.XML_NAMESPACE_PREFIX, 8); - final StringIntMap namespaceNameMap = new FixedEntryStringIntMap( - EncodingConstants.XML_NAMESPACE_NAME, 8); - final StringIntMap localNameMap = new StringIntMap(); - - addToTable(v.restrictedAlphabets.iterator(), restrictedAlphabet); - addToTable(v.encodingAlgorithms.iterator(), encodingAlgorithm); - addToTable(v.prefixes.iterator(), prefix, prefixMap); - addToTable(v.namespaceNames.iterator(), namespaceName, namespaceNameMap); - addToTable(v.localNames.iterator(), localName, localNameMap); - addToTable(v.otherNCNames.iterator(), otherNCName); - addToTable(v.otherURIs.iterator(), otherURI); - addToTable(v.attributeValues.iterator(), attributeValue); - addToTable(v.otherStrings.iterator(), otherString); - addToTable(v.characterContentChunks.iterator(), characterContentChunk); - addToTable(v.elements.iterator(), elementName, false, - prefixMap, namespaceNameMap, localNameMap); - addToTable(v.attributes.iterator(), attributeName, true, - prefixMap, namespaceNameMap, localNameMap); - } - - private void addToTable(Iterator i, StringArray a) { - while (i.hasNext()) { - addToTable((String)i.next(), a, null); - } - } - - private void addToTable(Iterator i, StringArray a, StringIntMap m) { - while (i.hasNext()) { - addToTable((String)i.next(), a, m); - } - } - - private void addToTable(String s, StringArray a, StringIntMap m) { - if (s.length() == 0) { - return; - } - - if (m != null) m.obtainIndex(s); - a.add(s); - } - - private void addToTable(Iterator i, PrefixArray a, StringIntMap m) { - while (i.hasNext()) { - addToTable((String)i.next(), a, m); - } - } - - private void addToTable(String s, PrefixArray a, StringIntMap m) { - if (s.length() == 0) { - return; - } - - if (m != null) m.obtainIndex(s); - a.add(s); - } - - private void addToTable(Iterator i, ContiguousCharArrayArray a) { - while (i.hasNext()) { - addToTable((String)i.next(), a); - } - } - - private void addToTable(String s, ContiguousCharArrayArray a) { - if (s.length() == 0) { - return; - } - - char[] c = s.toCharArray(); - a.add(c, c.length); - } - - private void addToTable(Iterator i, CharArrayArray a) { - while (i.hasNext()) { - addToTable((String)i.next(), a); - } - } - - private void addToTable(String s, CharArrayArray a) { - if (s.length() == 0) { - return; - } - - char[] c = s.toCharArray(); - a.add(new CharArray(c, 0, c.length, false)); - } - - private void addToTable(Iterator i, QualifiedNameArray a, - boolean isAttribute, - StringIntMap prefixMap, StringIntMap namespaceNameMap, - StringIntMap localNameMap) { - while (i.hasNext()) { - addToNameTable((QName)i.next(), a, isAttribute, - prefixMap, namespaceNameMap, localNameMap); - } - } - - private void addToNameTable(QName n, QualifiedNameArray a, - boolean isAttribute, - StringIntMap prefixMap, StringIntMap namespaceNameMap, - StringIntMap localNameMap) { - int namespaceURIIndex = -1; - int prefixIndex = -1; - if (n.getNamespaceURI().length() > 0) { - namespaceURIIndex = namespaceNameMap.obtainIndex(n.getNamespaceURI()); - if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) { - namespaceURIIndex = namespaceName.getSize(); - namespaceName.add(n.getNamespaceURI()); - } - - if (n.getPrefix().length() > 0) { - prefixIndex = prefixMap.obtainIndex(n.getPrefix()); - if (prefixIndex == KeyIntMap.NOT_PRESENT) { - prefixIndex = prefix.getSize(); - prefix.add(n.getPrefix()); - } - } - } - - int localNameIndex = localNameMap.obtainIndex(n.getLocalPart()); - if (localNameIndex == KeyIntMap.NOT_PRESENT) { - localNameIndex = localName.getSize(); - localName.add(n.getLocalPart()); - } - - QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(), - a.getSize(), - prefixIndex, namespaceURIIndex, localNameIndex); - if (isAttribute) { - name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE); - } - a.add(name); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/vocab/SerializerVocabulary.java 2018-01-30 20:37:45.000000000 -0500 +++ /dev/null 2018-01-30 20:37:45.000000000 -0500 @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.vocab; - -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.QualifiedName; -import com.sun.xml.internal.fastinfoset.util.CharArrayIntMap; -import com.sun.xml.internal.fastinfoset.util.FixedEntryStringIntMap; -import com.sun.xml.internal.fastinfoset.util.KeyIntMap; -import com.sun.xml.internal.fastinfoset.util.LocalNameQualifiedNamesMap; -import com.sun.xml.internal.fastinfoset.util.StringIntMap; -import java.util.Iterator; -import javax.xml.namespace.QName; - -public class SerializerVocabulary extends Vocabulary { - public final StringIntMap restrictedAlphabet; - public final StringIntMap encodingAlgorithm; - - public final StringIntMap namespaceName; - public final StringIntMap prefix; - public final StringIntMap localName; - public final StringIntMap otherNCName; - public final StringIntMap otherURI; - public final StringIntMap attributeValue; - public final CharArrayIntMap otherString; - - public final CharArrayIntMap characterContentChunk; - - public final LocalNameQualifiedNamesMap elementName; - public final LocalNameQualifiedNamesMap attributeName; - - public final KeyIntMap[] tables = new KeyIntMap[12]; - - protected boolean _useLocalNameAsKey; - - protected SerializerVocabulary _readOnlyVocabulary; - - public SerializerVocabulary() { - tables[RESTRICTED_ALPHABET] = restrictedAlphabet = new StringIntMap(4); - tables[ENCODING_ALGORITHM] = encodingAlgorithm = new StringIntMap(4); - tables[PREFIX] = prefix = new FixedEntryStringIntMap(EncodingConstants.XML_NAMESPACE_PREFIX, 8); - tables[NAMESPACE_NAME] = namespaceName = new FixedEntryStringIntMap(EncodingConstants.XML_NAMESPACE_NAME, 8); - tables[LOCAL_NAME] = localName = new StringIntMap(); - tables[OTHER_NCNAME] = otherNCName = new StringIntMap(4); - tables[OTHER_URI] = otherURI = new StringIntMap(4); - tables[ATTRIBUTE_VALUE] = attributeValue = new StringIntMap(); - tables[OTHER_STRING] = otherString = new CharArrayIntMap(4); - tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk = new CharArrayIntMap(); - tables[ELEMENT_NAME] = elementName = new LocalNameQualifiedNamesMap(); - tables[ATTRIBUTE_NAME] = attributeName = new LocalNameQualifiedNamesMap(); - } - - public SerializerVocabulary(com.sun.xml.internal.org.jvnet.fastinfoset.Vocabulary v, - boolean useLocalNameAsKey) { - this(); - - _useLocalNameAsKey = useLocalNameAsKey; - convertVocabulary(v); - } - - public SerializerVocabulary getReadOnlyVocabulary() { - return _readOnlyVocabulary; - } - - protected void setReadOnlyVocabulary(SerializerVocabulary readOnlyVocabulary, - boolean clear) { - for (int i = 0; i < tables.length; i++) { - tables[i].setReadOnlyMap(readOnlyVocabulary.tables[i], clear); - } - } - - public void setInitialVocabulary(SerializerVocabulary initialVocabulary, - boolean clear) { - setExternalVocabularyURI(null); - setInitialReadOnlyVocabulary(true); - setReadOnlyVocabulary(initialVocabulary, clear); - } - - public void setExternalVocabulary(String externalVocabularyURI, - SerializerVocabulary externalVocabulary, boolean clear) { - setInitialReadOnlyVocabulary(false); - setExternalVocabularyURI(externalVocabularyURI); - setReadOnlyVocabulary(externalVocabulary, clear); - } - - public void clear() { - for (int i = 0; i < tables.length; i++) { - tables[i].clear(); - } - } - - private void convertVocabulary(com.sun.xml.internal.org.jvnet.fastinfoset.Vocabulary v) { - addToTable(v.restrictedAlphabets.iterator(), restrictedAlphabet); - addToTable(v.encodingAlgorithms.iterator(), encodingAlgorithm); - addToTable(v.prefixes.iterator(), prefix); - addToTable(v.namespaceNames.iterator(), namespaceName); - addToTable(v.localNames.iterator(), localName); - addToTable(v.otherNCNames.iterator(), otherNCName); - addToTable(v.otherURIs.iterator(), otherURI); - addToTable(v.attributeValues.iterator(), attributeValue); - addToTable(v.otherStrings.iterator(), otherString); - addToTable(v.characterContentChunks.iterator(), characterContentChunk); - addToTable(v.elements.iterator(), elementName); - addToTable(v.attributes.iterator(), attributeName); - } - - private void addToTable(Iterator i, StringIntMap m) { - while (i.hasNext()) { - addToTable((String)i.next(), m); - } - } - - private void addToTable(String s, StringIntMap m) { - if (s.length() == 0) { - return; - } - - m.obtainIndex(s); - } - - private void addToTable(Iterator i, CharArrayIntMap m) { - while (i.hasNext()) { - addToTable((String)i.next(), m); - } - } - - private void addToTable(String s, CharArrayIntMap m) { - if (s.length() == 0) { - return; - } - - char[] c = s.toCharArray(); - m.obtainIndex(c, 0, c.length, false); - } - - private void addToTable(Iterator i, LocalNameQualifiedNamesMap m) { - while (i.hasNext()) { - addToNameTable((QName)i.next(), m); - } - } - - private void addToNameTable(QName n, LocalNameQualifiedNamesMap m) { - int namespaceURIIndex = -1; - int prefixIndex = -1; - if (n.getNamespaceURI().length() > 0) { - namespaceURIIndex = namespaceName.obtainIndex(n.getNamespaceURI()); - if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) { - namespaceURIIndex = namespaceName.get(n.getNamespaceURI()); - } - - if (n.getPrefix().length() > 0) { - prefixIndex = prefix.obtainIndex(n.getPrefix()); - if (prefixIndex == KeyIntMap.NOT_PRESENT) { - prefixIndex = prefix.get(n.getPrefix()); - } - } - } - - int localNameIndex = localName.obtainIndex(n.getLocalPart()); - if (localNameIndex == KeyIntMap.NOT_PRESENT) { - localNameIndex = localName.get(n.getLocalPart()); - } - - QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(), - m.getNextIndex(), - prefixIndex, namespaceURIIndex, localNameIndex); - - LocalNameQualifiedNamesMap.Entry entry = null; - if (_useLocalNameAsKey) { - entry = m.obtainEntry(n.getLocalPart()); - } else { - String qName = (prefixIndex == -1) - ? n.getLocalPart() - : n.getPrefix() + ":" + n.getLocalPart(); - entry = m.obtainEntry(qName); - } - - entry.addQualifiedName(name); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/fastinfoset/vocab/Vocabulary.java 2018-01-30 20:37:46.000000000 -0500 +++ /dev/null 2018-01-30 20:37:46.000000000 -0500 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.fastinfoset.vocab; - - -public abstract class Vocabulary { - public static final int RESTRICTED_ALPHABET = 0; - public static final int ENCODING_ALGORITHM = 1; - public static final int PREFIX = 2; - public static final int NAMESPACE_NAME = 3; - public static final int LOCAL_NAME = 4; - public static final int OTHER_NCNAME = 5; - public static final int OTHER_URI = 6; - public static final int ATTRIBUTE_VALUE = 7; - public static final int OTHER_STRING = 8; - public static final int CHARACTER_CONTENT_CHUNK = 9; - public static final int ELEMENT_NAME = 10; - public static final int ATTRIBUTE_NAME = 11; - - protected boolean _hasInitialReadOnlyVocabulary; - - protected String _referencedVocabularyURI; - - public boolean hasInitialVocabulary() { - return _hasInitialReadOnlyVocabulary; - } - - protected void setInitialReadOnlyVocabulary(boolean hasInitialReadOnlyVocabulary) { - _hasInitialReadOnlyVocabulary = hasInitialReadOnlyVocabulary; - } - - public boolean hasExternalVocabulary() { - return _referencedVocabularyURI != null; - } - - public String getExternalVocabularyURI() { - return _referencedVocabularyURI; - } - - protected void setExternalVocabularyURI(String referencedVocabularyURI) { - _referencedVocabularyURI = referencedVocabularyURI; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/EncodingAlgorithm.java 2018-01-30 20:37:47.000000000 -0500 +++ /dev/null 2018-01-30 20:37:47.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -public interface EncodingAlgorithm { - - public Object decodeFromBytes(byte[] b, int start, int length) throws EncodingAlgorithmException; - - public Object decodeFromInputStream(InputStream s) throws EncodingAlgorithmException, IOException; - - - public void encodeToOutputStream(Object data, OutputStream s) throws EncodingAlgorithmException, IOException; - - - public Object convertFromCharacters(char[] ch, int start, int length) throws EncodingAlgorithmException; - - public void convertToCharacters(Object data, StringBuffer s) throws EncodingAlgorithmException; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/EncodingAlgorithmException.java 2018-01-30 20:37:48.000000000 -0500 +++ /dev/null 2018-01-30 20:37:48.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -public class EncodingAlgorithmException extends FastInfosetException { - - public EncodingAlgorithmException(String message) { - super(message); - } - - public EncodingAlgorithmException(String message, Exception e) { - super(message, e); - } - - public EncodingAlgorithmException(Exception e) { - super(e); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/EncodingAlgorithmIndexes.java 2018-01-30 20:37:48.000000000 -0500 +++ /dev/null 2018-01-30 20:37:48.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -/** - * The indexes of built-in encoding algorithms. - * - *

The indexes of the built-in encoding algorithms are specified - * in ITU-T Rec. X.891 | ISO/IEC 24824-1 (Fast Infoset), clause - * 10. The indexes start from 0 instead of 1 as specified.

- * - * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmContentHandler - * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmAttributes - */ -public final class EncodingAlgorithmIndexes { - public static final int HEXADECIMAL = 0; - public static final int BASE64 = 1; - public static final int SHORT = 2; - public static final int INT = 3; - public static final int LONG = 4; - public static final int BOOLEAN = 5; - public static final int FLOAT = 6; - public static final int DOUBLE = 7; - public static final int UUID = 8; - public static final int CDATA = 9; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/ExternalVocabulary.java 2018-01-30 20:37:49.000000000 -0500 +++ /dev/null 2018-01-30 20:37:49.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -/** - * An external vocabulary. - *

- * An external vocabulary has a URI that refers to a vocabulary. - * - * @author Paul.Sandoz@Sun.Com - */ -public class ExternalVocabulary { - - /** - * A URI that refers to the external vocabulary. - */ - public final String URI; - - /** - * The vocabulary that is refered to by the URI. - */ - public final Vocabulary vocabulary; - - public ExternalVocabulary(String URI, Vocabulary vocabulary) { - if (URI == null || vocabulary == null) { - throw new IllegalArgumentException(); - } - - this.URI = URI; - this.vocabulary = vocabulary; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/FastInfosetException.java 2018-01-30 20:37:50.000000000 -0500 +++ /dev/null 2018-01-30 20:37:50.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -public class FastInfosetException extends Exception { - - public FastInfosetException(String message) { - super(message); - } - - public FastInfosetException(String message, Exception e) { - super(message, e); - } - - public FastInfosetException(Exception e) { - super(e); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/FastInfosetParser.java 2018-01-30 20:37:51.000000000 -0500 +++ /dev/null 2018-01-30 20:37:51.000000000 -0500 @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -import java.util.Map; - -/** - * A general interface for parsers of fast infoset documents. - * - *

- * This interface contains common methods that are not specific to any - * API associated with the parsing of fast infoset documents. - * - * @author Paul.Sandoz@Sun.Com - */ -public interface FastInfosetParser { - /** - * The property name to be used for getting and setting the string - * interning property of a parser. - * - */ - public static final String STRING_INTERNING_PROPERTY = - "http://jvnet.org/fastinfoset/parser/properties/string-interning"; - - /** - * The property name to be used for getting and setting the buffer size - * of a parser. - */ - public static final String BUFFER_SIZE_PROPERTY = - "http://jvnet.org/fastinfoset/parser/properties/buffer-size"; - - /** - * The property name to be used for getting and setting the - * Map containing encoding algorithms. - * - */ - public static final String REGISTERED_ENCODING_ALGORITHMS_PROPERTY = - "http://jvnet.org/fastinfoset/parser/properties/registered-encoding-algorithms"; - - /** - * The property name to be used for getting and setting the - * Map containing external vocabularies. - * - */ - public static final String EXTERNAL_VOCABULARIES_PROPERTY = - "http://jvnet.org/fastinfoset/parser/properties/external-vocabularies"; - - /** - * The property name to be used for getting and setting the - * flag, which will indicate whether underlying Parser's - * input stream should be really closed - */ - public static final String FORCE_STREAM_CLOSE_PROPERTY = - "http://jvnet.org/fastinfoset/parser/properties/force-stream-close"; - - /** - * Set the string interning property. - * - *

If the string interning property is set to true then - * String objects instantiated for [namespace name], [prefix] - * and [local name] infoset properties will be interned using the method - * {@link String#intern()}. - * - * @param stringInterning The string interning property. - */ - public void setStringInterning(boolean stringInterning); - - /** - * Return the string interning property. - * - * @return The string interning property. - */ - public boolean getStringInterning(); - - /** - * Set the buffer size. - * - *

The size of the buffer for parsing is set using this - * method. Requests for sizes smaller then the current size will be ignored. - * Otherwise the buffer will be resized when the next parse is performed.

- * - * @param bufferSize The requested buffer size. - */ - public void setBufferSize(int bufferSize); - - - /** - * Get the buffer size. - * - * @return The buffer size. - */ - public int getBufferSize(); - - - /** - * Sets the set of registered encoding algorithms. - * - * @param algorithms The set of registered algorithms. - */ - public void setRegisteredEncodingAlgorithms(Map algorithms); - - /** - * Gets the set of registered encoding algorithms. - * - * @return The set of registered algorithms. - */ - public Map getRegisteredEncodingAlgorithms(); - - /** - * Set the map of referenced external vocabularies. - *

- * The map (but not the keys and values) be cloned. - * - * @param referencedVocabualries the map of URI to vocabulary. - */ - public void setExternalVocabularies(Map referencedVocabualries); - - /** - * Get the map of referenced external vocabularies. - * - * @return the map of URI to vocabulary. - * @deprecated - * The map returned will not be the same instance and contain - * the same entries as the map set by {@link #setExternalVocabularies} - * method. - */ - public Map getExternalVocabularies(); - - /** - * Set the parse fragments property. - * - *

If the parse fragments property is set to true then - * fragments of an XML infoset may be parsed. - * - * @param parseFragments The parse fragments property. - */ - public void setParseFragments(boolean parseFragments); - - /** - * Return the parse fragments property. - * - * @return The parse fragments property. - */ - public boolean getParseFragments(); - - /** - * Set the force stream close property. - * - *

If the force stream property is set to true then - * Parser's underlying InputStream will be closed. - * - * @param needForceStreamClose The force stream close property. - */ - public void setForceStreamClose(boolean needForceStreamClose); - - /** - * Return the force stream close property. - * - * @return The force stream close property. - */ - public boolean getForceStreamClose(); - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/FastInfosetResult.java 2018-01-30 20:37:52.000000000 -0500 +++ /dev/null 2018-01-30 20:37:52.000000000 -0500 @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -import java.io.OutputStream; -import org.xml.sax.ContentHandler; -import org.xml.sax.ext.LexicalHandler; -import javax.xml.transform.sax.SAXResult; -import com.sun.xml.internal.fastinfoset.sax.SAXDocumentSerializer; - -/** - * A JAXP Result implementation that supports the serialization to fast - * infoset documents for use by applications that expect a Result. - * - *

The derivation of FIResult from SAXResult is an implementation - * detail.

- * - *

This implementation is designed for interoperation with JAXP and is not - * not designed with performance in mind. It is recommended that for performant - * interoperation alternative serializer specific solutions be used.

- * - *

General applications shall not call the following methods: - *

    - *
  • setHandler
  • - *
  • setLexicalHandler
  • - *
  • setSystemId
  • - *
- *

- */ -public class FastInfosetResult extends SAXResult { - - OutputStream _outputStream; - - public FastInfosetResult(OutputStream outputStream) { - _outputStream = outputStream; - } - - public ContentHandler getHandler() { - ContentHandler handler = super.getHandler(); - if (handler == null) { - handler = new SAXDocumentSerializer(); - setHandler(handler); - } - ((SAXDocumentSerializer) handler).setOutputStream(_outputStream); - return handler; - } - - public LexicalHandler getLexicalHandler() { - return (LexicalHandler) getHandler(); - } - - public OutputStream getOutputStream() { - return _outputStream; - } - - public void setOutputStream(OutputStream outputStream) { - _outputStream = outputStream; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/FastInfosetSerializer.java 2018-01-30 20:37:52.000000000 -0500 +++ /dev/null 2018-01-30 20:37:53.000000000 -0500 @@ -1,362 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -import java.io.OutputStream; -import java.util.Map; - -/** - * A general interface for serializers of fast infoset documents. - * - *

- * This interface contains common methods that are not specific to any - * API associated with the serialization of XML Infoset to fast infoset - * documents. - * - * @author Paul.Sandoz@Sun.Com - */ -public interface FastInfosetSerializer { - /** - * The feature to ignore the document type declaration and the - * internal subset. - *

- * The default value is false. If true a serializer shall ignore document - * type declaration and the internal subset. - */ - public static final String IGNORE_DTD_FEATURE = - "http://jvnet.org/fastinfoset/serializer/feature/ignore/DTD"; - - /** - * The feature to ignore comments. - *

- * The default value is false. If true a serializer shall ignore comments - * and shall not serialize them. - */ - public static final String IGNORE_COMMENTS_FEATURE = - "http://jvnet.org/fastinfoset/serializer/feature/ignore/comments"; - - /** - * The feature to ignore processing instructions. - *

- * The default value is false. If true a serializer shall ignore processing - * instructions and shall not serialize them. - */ - public static final String IGNORE_PROCESSING_INSTRUCTIONS_FEATURE = - "http://jvnet.org/fastinfoset/serializer/feature/ignore/processingInstructions"; - - /** - * The feature to ignore text content that consists completely of white - * space characters. - *

- * The default value is false. If true a serializer shall ignore text - * content that consists completely of white space characters. - */ - public static final String IGNORE_WHITE_SPACE_TEXT_CONTENT_FEATURE = - "http://jvnet.org/fastinfoset/serializer/feature/ignore/whiteSpaceTextContent"; - - /** - * The property name to be used for getting and setting the buffer size - * of a parser. - */ - public static final String BUFFER_SIZE_PROPERTY = - "http://jvnet.org/fastinfoset/parser/properties/buffer-size"; - - /** - * The property name to be used for getting and setting the - * Map containing encoding algorithms. - * - */ - public static final String REGISTERED_ENCODING_ALGORITHMS_PROPERTY = - "http://jvnet.org/fastinfoset/parser/properties/registered-encoding-algorithms"; - - /** - * The property name to be used for getting and setting the - * Map containing external vocabularies. - * - */ - public static final String EXTERNAL_VOCABULARIES_PROPERTY = - "http://jvnet.org/fastinfoset/parser/properties/external-vocabularies"; - - /** - * The default minimum size of the character content chunks, - * that will be indexed. - */ - public final static int MIN_CHARACTER_CONTENT_CHUNK_SIZE = 0; - - /** - * The default maximum size of the character content chunks, - * that will be indexed. - */ - public final static int MAX_CHARACTER_CONTENT_CHUNK_SIZE = 32; - - /** - * The default value for limit on the size of indexed Map for attribute values - * Limit is measured in bytes not in number of entries - */ - public static final int CHARACTER_CONTENT_CHUNK_MAP_MEMORY_CONSTRAINT = Integer.MAX_VALUE; - - /** - * The default minimum size of the attribute values, that will be indexed. - */ - public final static int MIN_ATTRIBUTE_VALUE_SIZE = 0; - - /** - * The default maximum size of the attribute values, that will be indexed. - */ - public final static int MAX_ATTRIBUTE_VALUE_SIZE = 32; - - /** - * The default value for limit on the size of indexed Map for attribute values - * Limit is measured in bytes not in number of entries - */ - public static final int ATTRIBUTE_VALUE_MAP_MEMORY_CONSTRAINT = Integer.MAX_VALUE; - - /** - * The character encoding scheme string for UTF-8. - */ - public static final String UTF_8 = "UTF-8"; - - /** - * The character encoding scheme string for UTF-16BE. - */ - public static final String UTF_16BE = "UTF-16BE"; - - /** - * Set the {@link #IGNORE_DTD_FEATURE}. - * @param ignoreDTD true if the feature shall be ignored. - */ - public void setIgnoreDTD(boolean ignoreDTD); - - /** - * Get the {@link #IGNORE_DTD_FEATURE}. - * @return true if the feature is ignored, false otherwise. - */ - public boolean getIgnoreDTD(); - - /** - * Set the {@link #IGNORE_COMMENTS_FEATURE}. - * @param ignoreComments true if the feature shall be ignored. - */ - public void setIgnoreComments(boolean ignoreComments); - - /** - * Get the {@link #IGNORE_COMMENTS_FEATURE}. - * @return true if the feature is ignored, false otherwise. - */ - public boolean getIgnoreComments(); - - /** - * Set the {@link #IGNORE_PROCESSING_INSTRUCTIONS_FEATURE}. - * @param ignoreProcesingInstructions true if the feature shall be ignored. - */ - public void setIgnoreProcesingInstructions(boolean ignoreProcesingInstructions); - - /** - * Get the {@link #IGNORE_PROCESSING_INSTRUCTIONS_FEATURE}. - * @return true if the feature is ignored, false otherwise. - */ - public boolean getIgnoreProcesingInstructions(); - - /** - * Set the {@link #IGNORE_WHITE_SPACE_TEXT_CONTENT_FEATURE}. - * @param ignoreWhiteSpaceTextContent true if the feature shall be ignored. - */ - public void setIgnoreWhiteSpaceTextContent(boolean ignoreWhiteSpaceTextContent); - - /** - * Get the {@link #IGNORE_WHITE_SPACE_TEXT_CONTENT_FEATURE}. - * @return true if the feature is ignored, false otherwise. - */ - public boolean getIgnoreWhiteSpaceTextContent(); - - /** - * Sets the character encoding scheme. - * - * The character encoding can be either UTF-8 or UTF-16BE for the - * the encoding of chunks of CIIs, the [normalized value] - * property of attribute information items, comment information - * items and processing instruction information items. - * - * @param characterEncodingScheme The set of registered algorithms. - */ - public void setCharacterEncodingScheme(String characterEncodingScheme); - - /** - * Gets the character encoding scheme. - * - * @return The character encoding scheme. - */ - public String getCharacterEncodingScheme(); - - /** - * Sets the set of registered encoding algorithms. - * - * @param algorithms The set of registered algorithms. - */ - public void setRegisteredEncodingAlgorithms(Map algorithms); - - /** - * Gets the set of registered encoding algorithms. - * - * @return The set of registered algorithms. - */ - public Map getRegisteredEncodingAlgorithms(); - - /** - * Gets the minimum size of character content chunks - * that will be indexed. - * - * @return The minimum character content chunk size. - */ - public int getMinCharacterContentChunkSize(); - - /** - * Sets the minimum size of character content chunks - * that will be indexed. - * - * @param size the minimum character content chunk size. - */ - public void setMinCharacterContentChunkSize(int size); - - /** - * Gets the maximum size of character content chunks - * that might be indexed. - * - * @return The maximum character content chunk size. - */ - public int getMaxCharacterContentChunkSize(); - - /** - * Sets the maximum size of character content chunks - * that might be indexed. - * - * @param size the maximum character content chunk size. - */ - public void setMaxCharacterContentChunkSize(int size); - - /** - * Gets the limit on the memory size, allocated for indexed character - * content chunks. - * - * @return the limit on the memory size, allocated for indexed character - * content chunks. - */ - public int getCharacterContentChunkMapMemoryLimit(); - - /** - * Sets the limit on the memory size, allocated for indexed character - * content chunks. - * - * @param size the limit on the memory size, allocated for indexed character - * content chunks. - */ - public void setCharacterContentChunkMapMemoryLimit(int size); - - /** - * Gets the minimum size of attribute values - * that will be indexed. - * - * @return The minimum attribute values size. - */ - public int getMinAttributeValueSize(); - - /** - * Sets the minimum size of attribute values - * that will be indexed. - * - * @param size the minimum attribute values size. - */ - public void setMinAttributeValueSize(int size); - - /** - * Gets the maximum size of attribute values - * that will be indexed. - * - * @return The maximum attribute values size. - */ - public int getMaxAttributeValueSize(); - - /** - * Sets the maximum size of attribute values - * that will be indexed. - * - * @param size the maximum attribute values size. - */ - public void setMaxAttributeValueSize(int size); - - /** - * Gets the limit on the memory size of Map of attribute values - * that will be indexed. - * - * @return The attribute value size limit. - */ - public int getAttributeValueMapMemoryLimit(); - - /** - * Sets the limit on the memory size of Map of attribute values - * that will be indexed. - * - * @param size The attribute value size limit. Any value less - * that a length of size limit will be indexed. - */ - public void setAttributeValueMapMemoryLimit(int size); - - /** - * Set the external vocabulary that shall be used when serializing. - * - * @param v the vocabulary. - */ - public void setExternalVocabulary(ExternalVocabulary v); - - /** - * Set the application data to be associated with the serializer vocabulary. - * - * @param data the application data. - */ - public void setVocabularyApplicationData(VocabularyApplicationData data); - - /** - * Get the application data associated with the serializer vocabulary. - * - * @return the application data. - */ - public VocabularyApplicationData getVocabularyApplicationData(); - - /** - * Reset the serializer for reuse serializing another XML infoset. - */ - public void reset(); - - /** - * Set the OutputStream to serialize the XML infoset to a - * fast infoset document. - * - * @param s the OutputStream where the fast infoset document is written to. - */ - public void setOutputStream(OutputStream s); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/FastInfosetSource.java 2018-01-30 20:37:53.000000000 -0500 +++ /dev/null 2018-01-30 20:37:53.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -import java.io.InputStream; - -import javax.xml.transform.sax.SAXSource; - -import org.xml.sax.InputSource; -import org.xml.sax.XMLReader; - -import com.sun.xml.internal.fastinfoset.sax.SAXDocumentParser; - -/** - * A JAXP Source implementation that supports the parsing fast - * infoset document for use by applications that expect a Source. - * - *

The derivation of FISource from SAXSource is an implementation - * detail.

- * - *

This implementation is designed for interoperation with JAXP and is not - * not designed with performance in mind. It is recommended that for performant - * interoperation alternative parser specific solutions be used.

- * - *

Applications shall obey the following restrictions: - *

    - *
  • The setXMLReader and setInputSource shall not be called.
  • - *
  • The XMLReader object obtained by the getXMLReader method shall - * be used only for parsing the InputSource object returned by - * the getInputSource method.
  • - *
  • The InputSource object obtained by the getInputSource method shall - * be used only for being parsed by the XMLReader object returned by - * the getXMLReader method.
  • - *
- *

- */ -public class FastInfosetSource extends SAXSource { - - public FastInfosetSource(InputStream inputStream) { - super(new InputSource(inputStream)); - } - - public XMLReader getXMLReader() { - XMLReader reader = super.getXMLReader(); - if (reader == null) { - reader = new SAXDocumentParser(); - setXMLReader(reader); - } - ((SAXDocumentParser) reader).setInputStream(getInputStream()); - return reader; - } - - public InputStream getInputStream() { - return getInputSource().getByteStream(); - } - - public void setInputStream(InputStream inputStream) { - setInputSource(new InputSource(inputStream)); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/RestrictedAlphabet.java 2018-01-30 20:37:54.000000000 -0500 +++ /dev/null 2018-01-30 20:37:54.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -public final class RestrictedAlphabet { - - public static final String NUMERIC_CHARACTERS = "0123456789-+.E "; - - public static final int NUMERIC_CHARACTERS_INDEX = 0; - - public static final String DATE_TIME_CHARACTERS = "0123456789-:TZ "; - - public static final int DATE_TIME_CHARACTERS_INDEX = 1; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/Vocabulary.java 2018-01-30 20:37:55.000000000 -0500 +++ /dev/null 2018-01-30 20:37:55.000000000 -0500 @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -import java.util.LinkedHashSet; -import java.util.Set; - -/** - * A canonical representation of a vocabulary. - *

- * Each vocabulary table is represented as a Set. A vocabulary table entry is - * represented as an item in the Set. - *

- * The 1st item contained in a Set is assigned the smallest index value, - * n say (where n >= 0). The 2nd item is assigned an index value of n + 1. The kth - * item is assigned an index value of n + (k - 1). - *

- * A Fast Infoset parser/serializer implementation will tranform the canonical - * representation of a Vocabulary instance into a more optimal form suitable - * for the efficient usage according to the API implemented by the parsers and - * serialziers. - */ -public class Vocabulary { - /** - * The restricted alphabet table, containing String objects. - */ - public final Set restrictedAlphabets = new LinkedHashSet(); - - /** - * The encoding algorithm table, containing String objects. - */ - public final Set encodingAlgorithms = new LinkedHashSet(); - - /** - * The prefix table, containing String objects. - */ - public final Set prefixes = new LinkedHashSet(); - - /** - * The namespace name table, containing String objects. - */ - public final Set namespaceNames = new LinkedHashSet(); - - /** - * The local name table, containing String objects. - */ - public final Set localNames = new LinkedHashSet(); - - /** - * The "other NCName" table, containing String objects. - */ - public final Set otherNCNames = new LinkedHashSet(); - - /** - * The "other URI" table, containing String objects. - */ - public final Set otherURIs = new LinkedHashSet(); - - /** - * The "attribute value" table, containing String objects. - */ - public final Set attributeValues = new LinkedHashSet(); - - /** - * The "other string" table, containing String objects. - */ - public final Set otherStrings = new LinkedHashSet(); - - /** - * The "character content chunk" table, containing String objects. - */ - public final Set characterContentChunks = new LinkedHashSet(); - - /** - * The element table, containing QName objects. - */ - public final Set elements = new LinkedHashSet(); - - /** - * The attribute table, containing QName objects. - */ - public final Set attributes = new LinkedHashSet(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/VocabularyApplicationData.java 2018-01-30 20:37:55.000000000 -0500 +++ /dev/null 2018-01-30 20:37:55.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset; - -/** - * Application data that can be associated with a vocabulary. - *

- * The application will implement this inteface and provide - * application specific functionality related to a vocabulary. - * - * @author Paul.Sandoz@Sun.Com - */ -public interface VocabularyApplicationData { - /** - * Clear the vocabulary application data. - *

- * This method will be invoked when a parser or serializer clears - * the vocabulary. - */ - public void clear(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/sax/EncodingAlgorithmAttributes.java 2018-01-30 20:37:56.000000000 -0500 +++ /dev/null 2018-01-30 20:37:56.000000000 -0500 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.sax; - -import org.xml.sax.Attributes; - - -/** - * Interface for a list of XML attributes that may contain encoding algorithm - * data. - *

- * Implementations shall ensure that the {@link Attributes#getValue(int)} method - * correctly returns a String object even if the attribute is represented - * as algorithm data. - *

- * If an attribute has algorithm data then the {@link #getAlgorithmData} method - * shall return a non null value. - * - * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetReader - * @see org.xml.sax.XMLReader - */ -public interface EncodingAlgorithmAttributes extends Attributes { - - /** - * Return the URI of the encoding algorithm. - * - *

If the algorithm data corresponds to a built-in encoding algorithm - * then the null is returned.

- * - *

If the algorithm data corresponds to an application-defined encoding - * algorithm then the URI of the algorithm is returned.

- * - *

If {@link #getAlgorithmData(int)} returns null then the result of - * this method is undefined.

- * - * @param index The attribute index (zero-based). - * @return The URI. If the index is out of range then null is returned. - */ - public String getAlgorithmURI(int index); - - /** - * Return the index of the encoding algorithm. - * - *

If {@link #getAlgorithmData(int)} returns null then the result of - * this method is undefined.

- * - * @param index The attribute index (zero-based). - * @return The algorithm index. If index is out of range then -1 is returned. - * @see com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes - */ - public int getAlgorithmIndex(int index); - - /** - * Return the data of the encoding algorithm. - * - *

If the algorithm data corresponds to a built-in encoding algorithm - * then an Object corresponding to the Java primitive type is returned.

- * - *

If the algorithm data corresponds to an application-defined encoding - * algorithm then an Object that is an instance of byte[] - * is returned if there is no EncodingAlgorithm registered for the - * application-defined encoding algorithm URI. Otherwise, an Object produced - * from the registeredEncodingAlgorithm is returned.

- * - *

If there no encoding algorithm data associated an attribute then - * null is returned.

- * - * @param index The attribute index (zero-based). - * @return The data. If the index is out of range then null is returned. - */ - public Object getAlgorithmData(int index); - - /** - * Return the alphabet associated with the attribute value. - * - * @param index The attribute index (zero-based). - * @return The alphabet. - * If the index is out of range then null is returned. - * If there is is no alphabet then null is returned. - */ - public String getAlpababet(int index); - - /** - * Return the whether the attribute value should be indexed or not. - * - * @param index The attribute index (zero-based). - * @return True if attribute value should be indexed, otherwise false. - */ - public boolean getToIndex(int index); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/sax/EncodingAlgorithmContentHandler.java 2018-01-30 20:37:57.000000000 -0500 +++ /dev/null 2018-01-30 20:37:57.000000000 -0500 @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.sax; - -import org.xml.sax.SAXException; - -/** - * SAX2 extention handler to receive notification of encoding algorithm data. - * - *

This is an optional extension handler for SAX2. XML readers are not - * required to recognize this handler, and it is not part of core-only - * SAX2 distributions.

- * - *

This interface may be used with with a Fast Infoset - * SAX parser to receive notification of encoding algorithm data specified - * in ITU-T Rec. X.891 | ISO/IEC 24824-1 (Fast Infoset) clause 10 and for - * application defined encoding algorithms specified as part of the - * initial vocabulary of a fast infoset document.

- * - *

To set the EncodingAlgorithmContentHandler for an XML reader, use the - * {@link org.xml.sax.XMLReader#setProperty setProperty} method - * with the property name - * URI TO BE DEFINED - * and an object implementing this interface (or null) as the value. - * If the reader does not report primitive data types, it will throw a - * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}

- * - *

To set the EncodingAlgorithmContentHandler for an Fast Infoset reader, use - * {@link com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetReader#setEncodingAlgorithmContentHandler - * setEncodingAlgorithmContentHandler} method.

- * - * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.PrimitiveTypeContentHandler - * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetReader - * @see org.xml.sax.XMLReader - */ -public interface EncodingAlgorithmContentHandler { - /** - * Receive notification of encoding algorithm data as an array - * of byte. - * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing encoding algorithm data.

- * - *

The Parser will call the method of this interface to report each - * encoding algorithm data. Parsers MUST return all contiguous - * characters in a single chunk

- * - *

Parsers may return all contiguous bytes in a single chunk, or - * they may split it into several chunks providing that the length of - * each chunk is of the required length to successfully apply the - * encoding algorithm to the chunk.

- * - * @param URI the URI of the encoding algorithm - * @param algorithm the encoding algorithm index - * @param b the array of byte - * @param start the start position in the array - * @param length the number of byte to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes - */ - public void octets(String URI, int algorithm, byte[] b, int start, int length) throws SAXException; - - /** - * Receive notification of encoding algorithm data as an object. - * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing encoding algorithm data that is converted from an - * array of byte to an object more suitable for processing.

- * - * @param URI the URI of the encoding algorithm - * @param algorithm the encoding algorithm index - * @param o the encoding algorithm object - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes - */ - public void object(String URI, int algorithm, Object o) throws SAXException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/sax/ExtendedContentHandler.java 2018-01-30 20:37:57.000000000 -0500 +++ /dev/null 2018-01-30 20:37:58.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.sax; - -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; - -public interface ExtendedContentHandler extends ContentHandler { - - /** - * Receive notification of character data. - * - * @param ch the characters from the XML document - * @param start the start position in the array - * @param length the number of characters to read from the array - * @param index true if the characters are indexed, otherwise false. - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - * @see ContentHandler#characters - */ - public void characters(char[] ch, int start, int length, boolean index) throws SAXException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/sax/FastInfosetReader.java 2018-01-30 20:37:58.000000000 -0500 +++ /dev/null 2018-01-30 20:37:58.000000000 -0500 @@ -1,255 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.sax; - -import java.io.IOException; -import java.io.InputStream; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetParser; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.xml.sax.ext.DeclHandler; -import org.xml.sax.ext.LexicalHandler; - -/** - * Interface for reading an Fast Infoset document using callbacks. - * - *

FastInfosetReader is the interface that a Fast Infoset parser's - * SAX2 driver must implement. This interface allows an application to - * to register Fast Infoset specific event handlers for encoding algorithms.

- * - *

The reception of encoding algorithm events is determined by - * the registration of: - *

    - *
  • A {@link PrimitiveTypeContentHandler}, for the recieving of events, - * associated with built-in encoding algorithms, for decoded data that - * can be reported as Java primitive types.
  • - *
  • A {@link EncodingAlgorithmContentHandler}, for the recieving of events, - * associated with built-in and application-defined encoding algorithms, for - * decoded data that can be reported as an array of octets or as a Java - * Object.
  • - *
  • {@link com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm} implementations, for - * the receiving of events, associated with application defined algorithms. - * for decoded data that shall be reported as a Java Object by way of the - * registered EncodingAlgorithmContentHandler.
  • - *
- *

- * - *

The reporting of element content events for built-in algorithms - * is determimed by the following: - *

    - *
  • If a PrimitiveContentHandler is registered then decoded data is reported - * as Java primitive types using the corresponding methods on the PrimitiveContentHandler - * interface.
  • - *
  • If a PrimitiveContentHandler is not registered and a - * EncodingAlgorithmContentHandler is registered then decoded data is reported - * as Java Objects using {@link EncodingAlgorithmContentHandler#object(String, int, Object)}. - * An Object shall correspond to the Java primitive type that - * would otherwise be reported using the PrimitiveContentHandler.
  • - *
  • If neither is registered then then decoded data is reported as characters.
  • - *
- *

- * - *

The reporting of element content events for application-defined algorithms - * is determimed by the following: - *

    - *
  • If an EncodingAlgorithmContentHandler is registered and there is no - * EncodingAlgorithm registered for an application-defined encoding algorithm - * then decoded data for such an algoroithm is reported as an array of octets - * using {@link EncodingAlgorithmContentHandler#octets(String, int, byte[], int, int)}; - * otherwise
  • - *
  • If there is an EncodingAlgorithm registered for the application-defined - * encoding algorithm then the decoded data is reported as a Java Object, - * returned by decoding according to the EncodingAlgorithm, using - * {@link EncodingAlgorithmContentHandler#object(String, int, Object)}.
  • - *
- *

- * - *

The reporting of attribute values for encoding algorithms is achieved using - * {@link EncodingAlgorithmAttributes} that extends {@link org.xml.sax.Attributes}. - * The registered ContentHandler may cast the attr paramter of the - * {@link org.xml.sax.ContentHandler#startElement(String, String, String, org.xml.sax.Attributes)} - * to the EncodingAlgorithmAttributes interface to access to encoding algorithm information. - *

- * - *

The reporting of attribute values for built-in algorithms - * is determimed by the following: - *

    - *
  • If a PrimitiveContentHandler or EncodingAlgorithmContentHandler is - * registered then decoded data is reported as Java Objects corresponding - * to the Java primitive types. The Java Objects may be obtained using - * {@link EncodingAlgorithmAttributes#getAlgorithmData(int)}. - *
  • If neither is registered then then decoded data is reported as characters.
  • - *
- *

- * - *

The reporting of attribute values for application-defined algorithms - * is determimed by the following: - *

    - *
  • If an EncodingAlgorithmContentHandler is registered and there is no - * EncodingAlgorithm registered for an application-defined encoding algorithm - * then decoded data for such an algoroithm is reported as Java Object, - * that is an instance of byte[], - * using {@link EncodingAlgorithmAttributes#getAlgorithmData(int)}; - * otherwise
  • - *
  • If there is an EncodingAlgorithm registered for the application-defined - * encoding algorithm then the decoded data is reported as a Java Object, - * returned by decoding according to the EncodingAlgorithm, using - * {@link EncodingAlgorithmAttributes#getAlgorithmData(int)}.
  • - *
- *

- * - * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.PrimitiveTypeContentHandler - * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmContentHandler - * @see org.xml.sax.XMLReader - * @see org.xml.sax.ContentHandler - */ -public interface FastInfosetReader extends XMLReader, FastInfosetParser { - /** - * The property name to be used for getting and setting the - * EncodingAlgorithmContentHandler. - * - */ - public static final String ENCODING_ALGORITHM_CONTENT_HANDLER_PROPERTY = - "http://jvnet.org/fastinfoset/sax/properties/encoding-algorithm-content-handler"; - - /** - * The property name to be used for getting and setting the - * PrimtiveTypeContentHandler. - * - */ - public static final String PRIMITIVE_TYPE_CONTENT_HANDLER_PROPERTY = - "http://jvnet.org/fastinfoset/sax/properties/primitive-type-content-handler"; - - /** - * Parse a fast infoset document from an InputStream. - * - *

The application can use this method to instruct the Fast Infoset - * reader to begin parsing a fast infoset document from a byte stream.

- * - *

Applications may not invoke this method while a parse is in progress - * (they should create a new XMLReader instead for each nested XML document). - * Once a parse is complete, an application may reuse the same - * FastInfosetReader object, possibly with a different byte stream.

- * - *

During the parse, the FastInfosetReader will provide information about - * the fast infoset document through the registered event handlers.

- * - *

This method is synchronous: it will not return until parsing has ended. - * If a client application wants to terminate parsing early, it should throw - * an exception.

- * - * @param s The byte stream to parse from. - */ - public void parse(InputStream s) throws IOException, FastInfosetException, SAXException; - - /** - * Allow an application to register a lexical handler. - * - *

Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.

- * - * @param handler The lexical handler. - * @see #getLexicalHandler - */ - public void setLexicalHandler(LexicalHandler handler); - - /** - * Return the current lexical handler. - * - * @return The current lexical handler, or null if none - * has been registered. - * @see #setLexicalHandler - */ - public LexicalHandler getLexicalHandler(); - - /** - * Allow an application to register a DTD declaration handler. - * - *

Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.

- * - * @param handler The DTD declaration handler. - * @see #getLexicalHandler - */ - public void setDeclHandler(DeclHandler handler); - - /** - * Return the current DTD declaration handler. - * - * @return The current DTD declaration handler, or null if none - * has been registered. - * @see #setLexicalHandler - */ - public DeclHandler getDeclHandler(); - - /** - * Allow an application to register an encoding algorithm handler. - * - *

Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.

- * - * @param handler The encoding algorithm handler. - * @see #getEncodingAlgorithmContentHandler - */ - public void setEncodingAlgorithmContentHandler(EncodingAlgorithmContentHandler handler); - - /** - * Return the current encoding algorithm handler. - * - * @return The current encoding algorithm handler, or null if none - * has been registered. - * @see #setEncodingAlgorithmContentHandler - */ - public EncodingAlgorithmContentHandler getEncodingAlgorithmContentHandler(); - - /** - * Allow an application to register a primitive type handler. - * - *

Applications may register a new or different handler in the - * middle of a parse, and the SAX parser must begin using the new - * handler immediately.

- * - * @param handler The primitive type handler. - * @see #getPrimitiveTypeContentHandler - */ - public void setPrimitiveTypeContentHandler(PrimitiveTypeContentHandler handler); - - - /** - * Return the current primitive type handler. - * - * @return The current primitive type handler, or null if none - * has been registered. - * @see #setPrimitiveTypeContentHandler - */ - public PrimitiveTypeContentHandler getPrimitiveTypeContentHandler(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/sax/FastInfosetWriter.java 2018-01-30 20:37:59.000000000 -0500 +++ /dev/null 2018-01-30 20:37:59.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.sax; - -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetSerializer; -import org.xml.sax.ContentHandler; -import org.xml.sax.ext.LexicalHandler; - -public interface FastInfosetWriter extends ContentHandler, LexicalHandler, - EncodingAlgorithmContentHandler, PrimitiveTypeContentHandler, - RestrictedAlphabetContentHandler, ExtendedContentHandler, - FastInfosetSerializer { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/sax/PrimitiveTypeContentHandler.java 2018-01-30 20:37:59.000000000 -0500 +++ /dev/null 2018-01-30 20:38:00.000000000 -0500 @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.sax; - -import org.xml.sax.SAXException; - -/** - * SAX2 extention handler to receive notification of character data as - * primtive types. - * - *

This is an optional extension handler for SAX2. XML readers are not - * required to recognize this handler, and it is not part of core-only - * SAX2 distributions.

- * - *

This interface may be used with with a Fast Infoset - * SAX parser to receive notification of data encoded using the - * following built-in encoding algorithms specified in ITU-T Rec. X.891 | ISO/IEC 24824-1 - * (Fast Infoset), clause 10: "boolean", "base64", "short", "int", "long", - * "float", "double" and "uuid" encoding algorithms.

- * - *

To set the PrimitiveTypeContentHandler for an XML reader, use the - * {@link org.xml.sax.XMLReader#setProperty setProperty} method - * with the property name - * URI TO BE DEFINED - * and an object implementing this interface (or null) as the value. - * If the reader does not report primitive data types, it will throw a - * {@link org.xml.sax.SAXNotRecognizedException SAXNotRecognizedException}

- * - *

To set the PrimitiveTypeContentHandler for an Fast Infoset reader, use - * {@link com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetReader#setPrimitiveTypeContentHandler - * setPrimitiveTypeContentHandler} method.

- - *

The Parser will call methods of this interface to report each - * chunk of character data that has been converted to an array of primitive - * types, for example an array of integer or an array of float. Parsers may - * return all contiguous primtive types in a single chunk, or they may split - * it into several chunks

- * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmContentHandler - * @see com.sun.xml.internal.org.jvnet.fastinfoset.sax.FastInfosetReader - * @see org.xml.sax.XMLReader - */ -public interface PrimitiveTypeContentHandler { - /** - * Receive notification of character data as an array of boolean. - * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing data encoded using the "boolean" encoding - * algorithm, see subclause 10.7

. - * - * @param b the array of boolean - * @param start the start position in the array - * @param length the number of boolean to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void booleans(boolean [] b, int start, int length) throws SAXException; - - /** - * Receive notification of character data as an array of byte. - * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing data encoded using the "base64" encoding - * algorithm, see subclause 10.3, or the "hexadecimal" encoding - * algorithm, see subclause 10.2. - * - *

Such a notification may occur for binary data that would - * normally require base 64 encoding and reported as character data - * using the {@link org.xml.sax.ContentHandler#characters characters} - * method

. - * - * @param b the array of byte - * @param start the start position in the array - * @param length the number of byte to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void bytes(byte[] b, int start, int length) throws SAXException; - - /** - * Receive notification of character data as an array of short. - * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing data encoded using the "short" encoding - * algorithm, see subclause 10.4

. - * - * @param s the array of short - * @param start the start position in the array - * @param length the number of short to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void shorts(short[] s, int start, int length) throws SAXException; - - /** - * Receive notification of character data as an array of int. - * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing data encoded using the "int" encoding - * algorithm, see subclause 10.5

. - * - * @param i the array of int - * @param start the start position in the array - * @param length the number of int to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void ints(int [] i, int start, int length) throws SAXException; - - /** - * Receive notification of character data as an array of long. - * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing data encoded using the "long" encoding - * algorithm, see subclause 10.6

. - * - * @param l the array of long - * @param start the start position in the array - * @param length the number of long to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void longs(long [] l, int start, int length) throws SAXException; - - /** - * Receive notification of character data as an array of float. - * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing data encoded using the "float" encoding - * algorithm, see subclause 10.8

. - * - * @param f the array of float - * @param start the start position in the array - * @param length the number of float to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void floats(float [] f, int start, int length) throws SAXException; - - /** - * Receive notification of character data as an array of double. - * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing data encoded using the "double" encoding - * algorithm, see subclause 10.9

. - * - * @param d the array of double - * @param start the start position in the array - * @param length the number of double to read from the array - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void doubles(double [] d, int start, int length) throws SAXException; - - /** - * Receive notification of character data as an two array of UUID. - * - *

The application must not attempt to read from the array - * outside of the specified range.

- * - *

Such notifications will occur for a Fast Infoset SAX parser - * when processing data encoded using the "uuid" encoding - * algorithm, see subclause 10.10

. - * - * @param msblsb the array of long containing pairs of most signficant - * bits and least significant bits of the UUIDs - * @param start the start position in the array - * @param length the number of long to read from the array. This will - * be twice the number of UUIDs, which are pairs of two long values - * @throws org.xml.sax.SAXException any SAX exception, possibly - * wrapping another exception - */ - public void uuids(long[] msblsb, int start, int length) throws SAXException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/sax/RestrictedAlphabetContentHandler.java 2018-01-30 20:38:00.000000000 -0500 +++ /dev/null 2018-01-30 20:38:00.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.sax; - -import org.xml.sax.SAXException; - -public interface RestrictedAlphabetContentHandler { - - public void numericCharacters(char ch[], int start, int length) throws SAXException; - - public void dateTimeCharacters(char ch[], int start, int length) throws SAXException; - - public void alphabetCharacters(String alphabet, char ch[], int start, int length) throws SAXException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/sax/helpers/EncodingAlgorithmAttributesImpl.java 2018-01-30 20:38:01.000000000 -0500 +++ /dev/null 2018-01-30 20:38:01.000000000 -0500 @@ -1,604 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.sax.helpers; - -import com.sun.xml.internal.fastinfoset.CommonResourceBundle; -import com.sun.xml.internal.fastinfoset.EncodingConstants; -import com.sun.xml.internal.fastinfoset.algorithm.BuiltInEncodingAlgorithmFactory; -import java.io.IOException; -import java.util.Map; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithm; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmException; -import com.sun.xml.internal.org.jvnet.fastinfoset.EncodingAlgorithmIndexes; -import com.sun.xml.internal.org.jvnet.fastinfoset.FastInfosetException; -import com.sun.xml.internal.org.jvnet.fastinfoset.sax.EncodingAlgorithmAttributes; -import org.xml.sax.Attributes; - -/** - * Default implementation of the {@link EncodingAlgorithmAttributes} interface. - * - *

This class provides a default implementation of the SAX2 - * {@link EncodingAlgorithmAttributes} interface, with the - * addition of manipulators so that the list can be modified or - * reused.

- * - *

There are two typical uses of this class:

- * - *
    - *
  1. to take a persistent snapshot of an EncodingAlgorithmAttributes object - * in a {@link org.xml.sax.ContentHandler#startElement startElement} event; or
  2. - *
  3. to construct or modify an EncodingAlgorithmAttributes object in a SAX2 - * driver or filter.
  4. - *
- */ -public class EncodingAlgorithmAttributesImpl implements EncodingAlgorithmAttributes { - private static final int DEFAULT_CAPACITY = 8; - - private static final int URI_OFFSET = 0; - private static final int LOCALNAME_OFFSET = 1; - private static final int QNAME_OFFSET = 2; - private static final int TYPE_OFFSET = 3; - private static final int VALUE_OFFSET = 4; - private static final int ALGORITHMURI_OFFSET = 5; - - private static final int SIZE = 6; - - private Map _registeredEncodingAlgorithms; - - private int _length; - - private String[] _data; - - private int[] _algorithmIds; - - private Object[] _algorithmData; - - private String[] _alphabets; - - private boolean[] _toIndex; - - /** - * Construct a new, empty EncodingAlgorithmAttributesImpl object. - */ - public EncodingAlgorithmAttributesImpl() { - this(null, null); - } - - /** - * Copy an existing Attributes object. - * - *

This constructor is especially useful inside a - * {@link org.xml.sax.ContentHandler#startElement startElement} event.

- * - * @param attributes The existing Attributes object. - */ - public EncodingAlgorithmAttributesImpl(Attributes attributes) { - this(null, attributes); - } - - /** - * Use registered encoding algorithms and copy an existing Attributes object. - * - *

This constructor is especially useful inside a - * {@link org.xml.sax.ContentHandler#startElement startElement} event.

- * - * @param registeredEncodingAlgorithms - * The registeredEncodingAlgorithms encoding algorithms. - * @param attributes The existing Attributes object. - */ - public EncodingAlgorithmAttributesImpl(Map registeredEncodingAlgorithms, - Attributes attributes) { - _data = new String[DEFAULT_CAPACITY * SIZE]; - _algorithmIds = new int[DEFAULT_CAPACITY]; - _algorithmData = new Object[DEFAULT_CAPACITY]; - _alphabets = new String[DEFAULT_CAPACITY]; - _toIndex = new boolean[DEFAULT_CAPACITY]; - - _registeredEncodingAlgorithms = registeredEncodingAlgorithms; - - if (attributes != null) { - if (attributes instanceof EncodingAlgorithmAttributes) { - setAttributes((EncodingAlgorithmAttributes)attributes); - } else { - setAttributes(attributes); - } - } - } - - /** - * Clear the attribute list for reuse. - * - */ - public final void clear() { - for (int i = 0; i < _length; i++) { - _data[i * SIZE + VALUE_OFFSET] = null; - _algorithmData[i] = null; - } - _length = 0; - } - - /** - * Add an attribute to the end of the list. - * - *

For the sake of speed, this method does no checking - * to see if the attribute is already in the list: that is - * the responsibility of the application.

- * - * @param URI The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified (prefixed) name, or the empty string - * if qualified names are not available. - * @param type The attribute type as a string. - * @param value The attribute value. - */ - public void addAttribute(String URI, String localName, String qName, - String type, String value) { - if (_length >= _algorithmData.length) { - resize(); - } - - int i = _length * SIZE; - _data[i++] = replaceNull(URI); - _data[i++] = replaceNull(localName); - _data[i++] = replaceNull(qName); - _data[i++] = replaceNull(type); - _data[i++] = replaceNull(value); - _toIndex[_length] = false; - _alphabets[_length] = null; - - _length++; - } - - /** - * Add an attribute to the end of the list. - * - *

For the sake of speed, this method does no checking - * to see if the attribute is already in the list: that is - * the responsibility of the application.

- * - * @param URI The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified (prefixed) name, or the empty string - * if qualified names are not available. - * @param type The attribute type as a string. - * @param value The attribute value. - * @param index True if attribute should be indexed. - * @param alphabet The alphabet associated with the attribute value, - * may be null if there is no associated alphabet. - */ - public void addAttribute(String URI, String localName, String qName, - String type, String value, boolean index, String alphabet) { - if (_length >= _algorithmData.length) { - resize(); - } - - int i = _length * SIZE; - _data[i++] = replaceNull(URI); - _data[i++] = replaceNull(localName); - _data[i++] = replaceNull(qName); - _data[i++] = replaceNull(type); - _data[i++] = replaceNull(value); - _toIndex[_length] = index; - _alphabets[_length] = alphabet; - - _length++; - } - - /** - * Add an attribute with built in algorithm data to the end of the list. - * - *

For the sake of speed, this method does no checking - * to see if the attribute is already in the list: that is - * the responsibility of the application.

- * - * @param URI The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified (prefixed) name, or the empty string - * if qualified names are not available. - * @param builtInAlgorithmID The built in algorithm ID. - * @param algorithmData The built in algorithm data. - */ - public void addAttributeWithBuiltInAlgorithmData(String URI, String localName, String qName, - int builtInAlgorithmID, Object algorithmData) { - if (_length >= _algorithmData.length) { - resize(); - } - - int i = _length * SIZE; - _data[i++] = replaceNull(URI); - _data[i++] = replaceNull(localName); - _data[i++] = replaceNull(qName); - _data[i++] = "CDATA"; - _data[i++] = ""; - _data[i++] = null; - _algorithmIds[_length] = builtInAlgorithmID; - _algorithmData[_length] = algorithmData; - _toIndex[_length] = false; - _alphabets[_length] = null; - - _length++; - } - - /** - * Add an attribute with algorithm data to the end of the list. - * - *

For the sake of speed, this method does no checking - * to see if the attribute is already in the list: that is - * the responsibility of the application.

- * - * @param URI The Namespace URI, or the empty string if - * none is available or Namespace processing is not - * being performed. - * @param localName The local name, or the empty string if - * Namespace processing is not being performed. - * @param qName The qualified (prefixed) name, or the empty string - * if qualified names are not available. - * @param algorithmURI The algorithm URI, or null if a built in algorithm - * @param algorithmID The algorithm ID. - * @param algorithmData The algorithm data. - */ - public void addAttributeWithAlgorithmData(String URI, String localName, String qName, - String algorithmURI, int algorithmID, Object algorithmData) { - if (_length >= _algorithmData.length) { - resize(); - } - - int i = _length * SIZE; - _data[i++] = replaceNull(URI); - _data[i++] = replaceNull(localName); - _data[i++] = replaceNull(qName); - _data[i++] = "CDATA"; - _data[i++] = ""; - _data[i++] = algorithmURI; - _algorithmIds[_length] = algorithmID; - _algorithmData[_length] = algorithmData; - _toIndex[_length] = false; - _alphabets[_length] = null; - - _length++; - } - - /** - * Replace an attribute value with algorithm data. - * - *

For the sake of speed, this method does no checking - * to see if the attribute is already in the list: that is - * the responsibility of the application.

- * - * @param index The index of the attribute whose value is to be replaced - * @param algorithmURI The algorithm URI, or null if a built in algorithm - * @param algorithmID The algorithm ID. - * @param algorithmData The algorithm data. - */ - public void replaceWithAttributeAlgorithmData(int index, - String algorithmURI, int algorithmID, Object algorithmData) { - if (index < 0 || index >= _length) return; - - int i = index * SIZE; - _data[i + VALUE_OFFSET] = null; - _data[i + ALGORITHMURI_OFFSET] = algorithmURI; - _algorithmIds[index] = algorithmID; - _algorithmData[index] = algorithmData; - _toIndex[index] = false; - _alphabets[index] = null; - } - - /** - * Copy an entire Attributes object. - * - * @param atts The attributes to copy. - */ - public void setAttributes(Attributes atts) { - _length = atts.getLength(); - if (_length > 0) { - - if (_length >= _algorithmData.length) { - resizeNoCopy(); - } - - int index = 0; - for (int i = 0; i < _length; i++) { - _data[index++] = atts.getURI(i); - _data[index++] = atts.getLocalName(i); - _data[index++] = atts.getQName(i); - _data[index++] = atts.getType(i); - _data[index++] = atts.getValue(i); - index++; - _toIndex[i] = false; - _alphabets[i] = null; - } - } - } - - /** - * Copy an entire EncodingAlgorithmAttributes object. - * - * @param atts The attributes to copy. - */ - public void setAttributes(EncodingAlgorithmAttributes atts) { - _length = atts.getLength(); - if (_length > 0) { - - if (_length >= _algorithmData.length) { - resizeNoCopy(); - } - - int index = 0; - for (int i = 0; i < _length; i++) { - _data[index++] = atts.getURI(i); - _data[index++] = atts.getLocalName(i); - _data[index++] = atts.getQName(i); - _data[index++] = atts.getType(i); - _data[index++] = atts.getValue(i); - _data[index++] = atts.getAlgorithmURI(i); - _algorithmIds[i] = atts.getAlgorithmIndex(i); - _algorithmData[i] = atts.getAlgorithmData(i); - _toIndex[i] = false; - _alphabets[i] = null; - } - } - } - - // org.xml.sax.Attributes - - public final int getLength() { - return _length; - } - - public final String getLocalName(int index) { - if (index >= 0 && index < _length) { - return _data[index * SIZE + LOCALNAME_OFFSET]; - } else { - return null; - } - } - - public final String getQName(int index) { - if (index >= 0 && index < _length) { - return _data[index * SIZE + QNAME_OFFSET]; - } else { - return null; - } - } - - public final String getType(int index) { - if (index >= 0 && index < _length) { - return _data[index * SIZE + TYPE_OFFSET]; - } else { - return null; - } - } - - public final String getURI(int index) { - if (index >= 0 && index < _length) { - return _data[index * SIZE + URI_OFFSET]; - } else { - return null; - } - } - - public final String getValue(int index) { - if (index >= 0 && index < _length) { - final String value = _data[index * SIZE + VALUE_OFFSET]; - if (value != null) return value; - } else { - return null; - } - - if (_algorithmData[index] == null || _registeredEncodingAlgorithms == null) { - return null; - } - - try { - return _data[index * SIZE + VALUE_OFFSET] = convertEncodingAlgorithmDataToString( - _algorithmIds[index], - _data[index * SIZE + ALGORITHMURI_OFFSET], - _algorithmData[index]).toString(); - } catch (IOException e) { - return null; - } catch (FastInfosetException e) { - return null; - } - } - - public final int getIndex(String qName) { - for (int index = 0; index < _length; index++) { - if (qName.equals(_data[index * SIZE + QNAME_OFFSET])) { - return index; - } - } - return -1; - } - - public final String getType(String qName) { - int index = getIndex(qName); - if (index >= 0) { - return _data[index * SIZE + TYPE_OFFSET]; - } else { - return null; - } - } - - public final String getValue(String qName) { - int index = getIndex(qName); - if (index >= 0) { - return getValue(index); - } else { - return null; - } - } - - public final int getIndex(String uri, String localName) { - for (int index = 0; index < _length; index++) { - if (localName.equals(_data[index * SIZE + LOCALNAME_OFFSET]) && - uri.equals(_data[index * SIZE + URI_OFFSET])) { - return index; - } - } - return -1; - } - - public final String getType(String uri, String localName) { - int index = getIndex(uri, localName); - if (index >= 0) { - return _data[index * SIZE + TYPE_OFFSET]; - } else { - return null; - } - } - - public final String getValue(String uri, String localName) { - int index = getIndex(uri, localName); - if (index >= 0) { - return getValue(index); - } else { - return null; - } - } - - // EncodingAlgorithmAttributes - - public final String getAlgorithmURI(int index) { - if (index >= 0 && index < _length) { - return _data[index * SIZE + ALGORITHMURI_OFFSET]; - } else { - return null; - } - } - - public final int getAlgorithmIndex(int index) { - if (index >= 0 && index < _length) { - return _algorithmIds[index]; - } else { - return -1; - } - } - - public final Object getAlgorithmData(int index) { - if (index >= 0 && index < _length) { - return _algorithmData[index]; - } else { - return null; - } - } - - // ExtendedAttributes - - public final String getAlpababet(int index) { - if (index >= 0 && index < _length) { - return _alphabets[index]; - } else { - return null; - } - } - - public final boolean getToIndex(int index) { - if (index >= 0 && index < _length) { - return _toIndex[index]; - } else { - return false; - } - } - - // ----- - - private final String replaceNull(String s) { - return (s != null) ? s : ""; - } - - private final void resizeNoCopy() { - final int newLength = _length * 3 / 2 + 1; - - _data = new String[newLength * SIZE]; - _algorithmIds = new int[newLength]; - _algorithmData = new Object[newLength]; - } - - private final void resize() { - final int newLength = _length * 3 / 2 + 1; - - String[] data = new String[newLength * SIZE]; - int[] algorithmIds = new int[newLength]; - Object[] algorithmData = new Object[newLength]; - String[] alphabets = new String[newLength]; - boolean[] toIndex = new boolean[newLength]; - - System.arraycopy(_data, 0, data, 0, _length * SIZE); - System.arraycopy(_algorithmIds, 0, algorithmIds, 0, _length); - System.arraycopy(_algorithmData, 0, algorithmData, 0, _length); - System.arraycopy(_alphabets, 0, alphabets, 0, _length); - System.arraycopy(_toIndex, 0, toIndex, 0, _length); - - _data = data; - _algorithmIds = algorithmIds; - _algorithmData = algorithmData; - _alphabets = alphabets; - _toIndex = toIndex; - } - - private final StringBuffer convertEncodingAlgorithmDataToString( - int identifier, String URI, Object data) throws FastInfosetException, IOException { - EncodingAlgorithm ea = null; - if (identifier < EncodingConstants.ENCODING_ALGORITHM_BUILTIN_END) { - ea = BuiltInEncodingAlgorithmFactory.getAlgorithm(identifier); - } else if (identifier == EncodingAlgorithmIndexes.CDATA) { - throw new EncodingAlgorithmException( - CommonResourceBundle.getInstance().getString("message.CDATAAlgorithmNotSupported")); - } else if (identifier >= EncodingConstants.ENCODING_ALGORITHM_APPLICATION_START) { - if (URI == null) { - throw new EncodingAlgorithmException( - CommonResourceBundle.getInstance().getString("message.URINotPresent") + identifier); - } - - ea = (EncodingAlgorithm)_registeredEncodingAlgorithms.get(URI); - if (ea == null) { - throw new EncodingAlgorithmException( - CommonResourceBundle.getInstance().getString("message.algorithmNotRegistered") + URI); - } - } else { - // Reserved built-in algorithms for future use - // TODO should use sax property to decide if event will be - // reported, allows for support through handler if required. - throw new EncodingAlgorithmException( - CommonResourceBundle.getInstance().getString("message.identifiers10to31Reserved")); - } - - final StringBuffer sb = new StringBuffer(); - ea.convertToCharacters(data, sb); - return sb; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/sax/helpers/FastInfosetDefaultHandler.java 2018-01-30 20:38:02.000000000 -0500 +++ /dev/null 2018-01-30 20:38:02.000000000 -0500 @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.sax.helpers; - -import com.sun.xml.internal.org.jvnet.fastinfoset.sax.*; -import org.xml.sax.SAXException; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.DefaultHandler; - -/** - * Default base class for SAX event handlers of a {@link FastInfosetReader}. - *

- * This class is available as a convenience for applications: it provides - * default implementations for all of the callbacks of the following: - *

    - *
  • {@link DefaultHandler}
  • - *
  • {@link LexicalHandler}
  • - *
  • {@link EncodingAlgorithmContentHandler}
  • - *
  • {@link PrimitiveTypeContentHandler}
  • - *
- * Application writers can extend this class when they need to implement only - * part of an interface; parser writers can instantiate this class to provide - * default handlers when the application has not supplied its own. - */ -public class FastInfosetDefaultHandler extends DefaultHandler implements - LexicalHandler, EncodingAlgorithmContentHandler, PrimitiveTypeContentHandler { - - // LexicalHandler - - public void comment(char[] ch, int start, int length) throws SAXException { - } - - public void startCDATA() throws SAXException { - } - - public void endCDATA() throws SAXException { - } - - public void startDTD(String name, String publicId, String systemId) throws SAXException { - } - - public void endDTD() throws SAXException { - } - - public void startEntity(String name) throws SAXException { - } - - public void endEntity(String name) throws SAXException { - } - - - // EncodingAlgorithmContentHandler - - public void octets(String URI, int algorithm, byte[] b, int start, int length) throws SAXException { - } - - public void object(String URI, int algorithm, Object o) throws SAXException { - } - - - // PrimitiveTypeContentHandler - - public void booleans(boolean[] b, int start, int length) throws SAXException { - } - - public void bytes(byte[] b, int start, int length) throws SAXException { - } - - public void shorts(short[] s, int start, int length) throws SAXException { - } - - public void ints(int[] i, int start, int length) throws SAXException { - } - - public void longs(long[] l, int start, int length) throws SAXException { - } - - public void floats(float[] f, int start, int length) throws SAXException { - } - - public void doubles(double[] d, int start, int length) throws SAXException { - } - - public void uuids(long[] msblsb, int start, int length) throws SAXException { - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/stax/FastInfosetStreamReader.java 2018-01-30 20:38:02.000000000 -0500 +++ /dev/null 2018-01-30 20:38:02.000000000 -0500 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.stax; - -import javax.xml.stream.XMLStreamException; - -/** - * Fast Infoset Stream Reader. - *

- * This interface provides additional optimized methods to that of - * {@link javax.xml.stream.XMLStreamReader}. - */ -public interface FastInfosetStreamReader { - /** - * Peek at the next event. - * - * @return the event, which will be the same as that returned from - * {@link #next}. - */ - public int peekNext() throws XMLStreamException; - - // Faster access methods without checks - - public int accessNamespaceCount(); - - public String accessLocalName(); - - public String accessNamespaceURI(); - - public String accessPrefix(); - - /** - * Returns a cloned char[] representation of the internal char[] buffer. - * So be careful, when using this method due to possible performance and - * memory inefficiency. - * - * @return a cloned char[] representation of the internal char[] buffer. - */ - public char[] accessTextCharacters(); - - public int accessTextStart(); - - public int accessTextLength(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/fastinfoset/stax/LowLevelFastInfosetStreamWriter.java 2018-01-30 20:38:03.000000000 -0500 +++ /dev/null 2018-01-30 20:38:03.000000000 -0500 @@ -1,205 +0,0 @@ -/* - * Copyright (c) 2004, 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. - * - * THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC. - */ - -package com.sun.xml.internal.org.jvnet.fastinfoset.stax; - -import java.io.IOException; -import javax.xml.stream.XMLStreamException; - -/** - * Low level Fast Infoset stream writer. - *

- * This interface provides additional stream-based serialization methods for the - * case where an application is in specific control of the serialization - * process and has the knowledge to call the LowLevel methods in the required - * order. - *

- * For example, the application may be able to perform efficient information - * to indexing mapping and to provide certain information in UTF-8 encoded form. - *

- * These methods may be used in conjuction with {@link javax.xml.stream.XMLStreamWriter} - * as long as an element fragment written using the efficient streaming methods - * are self-contained and no sub-fragment is written using methods from - * {@link javax.xml.stream.XMLStreamWriter}. - *

- * The required call sequence is as follows: - *

- * CALLSEQUENCE    := {@link #startDocument startDocument}
- *                    initiateLowLevelWriting ELEMENT
- *                    {@link #endDocument endDocument}
- *                 |  initiateLowLevelWriting ELEMENT   // for fragment
- *
- * ELEMENT         := writeLowLevelTerminationAndMark
- *                    NAMESPACES?
- *                    ELEMENT_NAME
- *                    ATTRIBUTES?
- *                    writeLowLevelEndStartElement
- *                    CONTENTS
- *                    writeLowLevelEndElement
- *
- * NAMESPACES      := writeLowLevelStartNamespaces
- *                    writeLowLevelNamespace*
- *                    writeLowLevelEndNamespaces
- *
- * ELEMENT_NAME    := writeLowLevelStartElementIndexed
- *                 |  writeLowLevelStartNameLiteral
- *                 |  writeLowLevelStartElement
- *
- * ATTRUBUTES      := writeLowLevelStartAttributes
- *                   (ATTRIBUTE_NAME writeLowLevelAttributeValue)*
- *
- * ATTRIBUTE_NAME  := writeLowLevelAttributeIndexed
- *                 |  writeLowLevelStartNameLiteral
- *                 |  writeLowLevelAttribute
- *
- *
- * CONTENTS      := (ELEMENT | writeLowLevelText writeLowLevelOctets)*
- * 
- *

- * Some methods defer to the application for the mapping of information - * to indexes. - */ -public interface LowLevelFastInfosetStreamWriter { - /** - * Initiate low level writing of an element fragment. - *

- * This method must be invoked before other low level method. - */ - public void initiateLowLevelWriting() - throws XMLStreamException; - - /** - * Get the next index to apply to an Element Information Item. - *

- * This will increment the next obtained index such that: - *

-     * i = w.getNextElementIndex();
-     * j = w.getNextElementIndex();
-     * i == j + 1;
-     * 
- * @return the index. - */ - public int getNextElementIndex(); - - /** - * Get the next index to apply to an Attribute Information Item. - * This will increment the next obtained index such that: - *
-     * i = w.getNextAttributeIndex();
-     * j = w.getNextAttributeIndex();
-     * i == j + 1;
-     * 
- * @return the index. - */ - public int getNextAttributeIndex(); - - /** - * Get the current index that was applied to an [local name] of an - * Element or Attribute Information Item. - * - * @return the index. - */ - public int getLocalNameIndex(); - - /** - * Get the next index to apply to an [local name] of an Element or Attribute - * Information Item. - * This will increment the next obtained index such that: - *
-     * i = w.getNextLocalNameIndex();
-     * j = w.getNextLocalNameIndex();
-     * i == j + 1;
-     * 
- * @return the index. - */ - public int getNextLocalNameIndex(); - - public void writeLowLevelTerminationAndMark() - throws IOException; - - public void writeLowLevelStartElementIndexed(int type, int index) - throws IOException; - - /** - * Write the start of an element. - * - * @return true if element is indexed, otherwise false. - */ - public boolean writeLowLevelStartElement(int type, - String prefix, String localName, String namespaceURI) - throws IOException; - - public void writeLowLevelStartNamespaces() - throws IOException; - - public void writeLowLevelNamespace(String prefix, String namespaceName) - throws IOException; - - public void writeLowLevelEndNamespaces() - throws IOException; - - public void writeLowLevelStartAttributes() - throws IOException; - - public void writeLowLevelAttributeIndexed(int index) - throws IOException; - - /** - * Write an attribute. - * - * @return true if attribute is indexed, otherwise false. - */ - public boolean writeLowLevelAttribute( - String prefix, String namespaceURI, String localName) - throws IOException; - - public void writeLowLevelAttributeValue(String value) - throws IOException; - - public void writeLowLevelStartNameLiteral(int type, - String prefix, byte[] utf8LocalName, String namespaceURI) - throws IOException; - - public void writeLowLevelStartNameLiteral(int type, - String prefix, int localNameIndex, String namespaceURI) - throws IOException; - - public void writeLowLevelEndStartElement() - throws IOException; - - public void writeLowLevelEndElement() - throws IOException; - - public void writeLowLevelText(char[] text, int length) - throws IOException; - - public void writeLowLevelText(String text) - throws IOException; - - public void writeLowLevelOctets(byte[] octets, int length) - throws IOException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/ASCIIUtility.java 2018-01-30 20:38:04.000000000 -0500 +++ /dev/null 2018-01-30 20:38:04.000000000 -0500 @@ -1,118 +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. - */ - -/* FROM mail.jar */ -package com.sun.xml.internal.org.jvnet.mimepull; - -final class ASCIIUtility { - - // Private constructor so that this class is not instantiated - private ASCIIUtility() { } - - /** - * Convert the bytes within the specified range of the given byte - * array into a signed integer in the given radix . The range extends - * from start till, but not including end.

- * - * Based on java.lang.Integer.parseInt() - */ - public static int parseInt(byte[] b, int start, int end, int radix) - throws NumberFormatException { - if (b == null) { - throw new NumberFormatException("null"); - } - - int result = 0; - boolean negative = false; - int i = start; - int limit; - int multmin; - int digit; - - if (end > start) { - if (b[i] == '-') { - negative = true; - limit = Integer.MIN_VALUE; - i++; - } else { - limit = -Integer.MAX_VALUE; - } - multmin = limit / radix; - if (i < end) { - digit = Character.digit((char)b[i++], radix); - if (digit < 0) { - throw new NumberFormatException( - "illegal number: " + toString(b, start, end) - ); - } else { - result = -digit; - } - } - while (i < end) { - // Accumulating negatively avoids surprises near MAX_VALUE - digit = Character.digit((char)b[i++], radix); - if (digit < 0) { - throw new NumberFormatException("illegal number"); - } - if (result < multmin) { - throw new NumberFormatException("illegal number"); - } - result *= radix; - if (result < limit + digit) { - throw new NumberFormatException("illegal number"); - } - result -= digit; - } - } else { - throw new NumberFormatException("illegal number"); - } - if (negative) { - if (i > start + 1) { - return result; - } else { /* Only got "-" */ - throw new NumberFormatException("illegal number"); - } - } else { - return -result; - } - } - - /** - * Convert the bytes within the specified range of the given byte - * array into a String. The range extends from start - * till, but not including end.

- */ - public static String toString(byte[] b, int start, int end) { - int size = end - start; - char[] theChars = new char[size]; - - for (int i = 0, j = start; i < size; ) { - theChars[i++] = (char)(b[j++]&0xff); - } - - return new String(theChars); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/BASE64DecoderStream.java 2018-01-30 20:38:04.000000000 -0500 +++ /dev/null 2018-01-30 20:38:04.000000000 -0500 @@ -1,485 +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. - */ - -/* FROM mail.jar */ -package com.sun.xml.internal.org.jvnet.mimepull; - -import java.io.*; - -/** - * This class implements a BASE64 Decoder. It is implemented as - * a FilterInputStream, so one can just wrap this class around - * any input stream and read bytes from this filter. The decoding - * is done as the bytes are read out. - * - * @author John Mani - * @author Bill Shannon - */ - -final class BASE64DecoderStream extends FilterInputStream { - // buffer of decoded bytes for single byte reads - private byte[] buffer = new byte[3]; - private int bufsize = 0; // size of the cache - private int index = 0; // index into the cache - - // buffer for almost 8K of typical 76 chars + CRLF lines, - // used by getByte method. this buffer contains encoded bytes. - private byte[] input_buffer = new byte[78*105]; - private int input_pos = 0; - private int input_len = 0;; - - private boolean ignoreErrors = false; - - /** - * Create a BASE64 decoder that decodes the specified input stream. - * The System property mail.mime.base64.ignoreerrors - * controls whether errors in the encoded data cause an exception - * or are ignored. The default is false (errors cause exception). - * - * @param in the input stream - */ - public BASE64DecoderStream(InputStream in) { - super(in); - // default to false - ignoreErrors = PropUtil.getBooleanSystemProperty( - "mail.mime.base64.ignoreerrors", false); - } - - /** - * Create a BASE64 decoder that decodes the specified input stream. - * - * @param in the input stream - * @param ignoreErrors ignore errors in encoded data? - */ - public BASE64DecoderStream(InputStream in, boolean ignoreErrors) { - super(in); - this.ignoreErrors = ignoreErrors; - } - - /** - * Read the next decoded byte from this input stream. The byte - * is returned as an int in the range 0 - * to 255. If no byte is available because the end of - * the stream has been reached, the value -1 is returned. - * This method blocks until input data is available, the end of the - * stream is detected, or an exception is thrown. - * - * @return next byte of data, or -1 if the end of the - * stream is reached. - * @exception IOException if an I/O error occurs. - * @see java.io.FilterInputStream#in - */ - @Override - public int read() throws IOException { - if (index >= bufsize) { - bufsize = decode(buffer, 0, buffer.length); - if (bufsize <= 0) { - return -1; - } - index = 0; // reset index into buffer - } - return buffer[index++] & 0xff; // Zero off the MSB - } - - /** - * Reads up to len decoded bytes of data from this input stream - * into an array of bytes. This method blocks until some input is - * available. - *

- * - * @param buf the buffer into which the data is read. - * @param off the start offset of the data. - * @param len the maximum number of bytes read. - * @return the total number of bytes read into the buffer, or - * -1 if there is no more data because the end of - * the stream has been reached. - * @exception IOException if an I/O error occurs. - */ - @Override - public int read(byte[] buf, int off, int len) throws IOException { - // empty out single byte read buffer - int off0 = off; - while (index < bufsize && len > 0) { - buf[off++] = buffer[index++]; - len--; - } - if (index >= bufsize) { - bufsize = index = 0; - } - - int bsize = (len / 3) * 3; // round down to multiple of 3 bytes - if (bsize > 0) { - int size = decode(buf, off, bsize); - off += size; - len -= size; - - if (size != bsize) { // hit EOF? - if (off == off0) { - return -1; - } else { - return off - off0; - } - } - } - - // finish up with a partial read if necessary - for (; len > 0; len--) { - int c = read(); - if (c == -1) { - break; - } - buf[off++] = (byte)c; - } - - if (off == off0) { - return -1; - } else { - return off - off0; - } - } - - /** - * Skips over and discards n bytes of data from this stream. - */ - @Override - public long skip(long n) throws IOException { - long skipped = 0; - while (n-- > 0 && read() >= 0) { - skipped++; - } - return skipped; - } - - /** - * Tests if this input stream supports marks. Currently this class - * does not support marks - */ - @Override - public boolean markSupported() { - return false; // Maybe later .. - } - - /** - * Returns the number of bytes that can be read from this input - * stream without blocking. However, this figure is only - * a close approximation in case the original encoded stream - * contains embedded CRLFs; since the CRLFs are discarded, not decoded - */ - @Override - public int available() throws IOException { - // This is only an estimate, since in.available() - // might include CRLFs too .. - return ((in.available() * 3)/4 + (bufsize-index)); - } - - /** - * This character array provides the character to value map - * based on RFC1521. - */ - private final static char pem_array[] = { - 'A','B','C','D','E','F','G','H', // 0 - 'I','J','K','L','M','N','O','P', // 1 - 'Q','R','S','T','U','V','W','X', // 2 - 'Y','Z','a','b','c','d','e','f', // 3 - 'g','h','i','j','k','l','m','n', // 4 - 'o','p','q','r','s','t','u','v', // 5 - 'w','x','y','z','0','1','2','3', // 6 - '4','5','6','7','8','9','+','/' // 7 - }; - - private final static byte pem_convert_array[] = new byte[256]; - - static { - for (int i = 0; i < 255; i++) { - pem_convert_array[i] = -1; - } - for (int i = 0; i < pem_array.length; i++) { - pem_convert_array[pem_array[i]] = (byte)i; - } - } - - /** - * The decoder algorithm. Most of the complexity here is dealing - * with error cases. Returns the number of bytes decoded, which - * may be zero. Decoding is done by filling an int with 4 6-bit - * values by shifting them in from the bottom and then extracting - * 3 8-bit bytes from the int by shifting them out from the bottom. - * - * @param outbuf the buffer into which to put the decoded bytes - * @param pos position in the buffer to start filling - * @param len the number of bytes to fill - * @return the number of bytes filled, always a multiple - * of three, and may be zero - * @exception IOException if the data is incorrectly formatted - */ - private int decode(byte[] outbuf, int pos, int len) throws IOException { - int pos0 = pos; - while (len >= 3) { - /* - * We need 4 valid base64 characters before we start decoding. - * We skip anything that's not a valid base64 character (usually - * just CRLF). - */ - int got = 0; - int val = 0; - while (got < 4) { - int i = getByte(); - if (i == -1 || i == -2) { - boolean atEOF; - if (i == -1) { - if (got == 0) { - return pos - pos0; - } - if (!ignoreErrors) { - throw new DecodingException( - "BASE64Decoder: Error in encoded stream: " + - "needed 4 valid base64 characters " + - "but only got " + got + " before EOF" + - recentChars()); - } - atEOF = true; // don't read any more - } else { // i == -2 - // found a padding character, we're at EOF - // XXX - should do something to make EOF "sticky" - if (got < 2 && !ignoreErrors) { - throw new DecodingException( - "BASE64Decoder: Error in encoded stream: " + - "needed at least 2 valid base64 characters," + - " but only got " + got + - " before padding character (=)" + - recentChars()); - } - - // didn't get any characters before padding character? - if (got == 0) { - return pos - pos0; - } - atEOF = false; // need to keep reading - } - - // pad partial result with zeroes - - // how many bytes will we produce on output? - // (got always < 4, so size always < 3) - int size = got - 1; - if (size == 0) { - size = 1; - } - - // handle the one padding character we've seen - got++; - val <<= 6; - - while (got < 4) { - if (!atEOF) { - // consume the rest of the padding characters, - // filling with zeroes - i = getByte(); - if (i == -1) { - if (!ignoreErrors) { - throw new DecodingException( - "BASE64Decoder: Error in encoded " + - "stream: hit EOF while looking for " + - "padding characters (=)" + - recentChars()); - } - } else if (i != -2) { - if (!ignoreErrors) { - throw new DecodingException( - "BASE64Decoder: Error in encoded " + - "stream: found valid base64 " + - "character after a padding character " + - "(=)" + recentChars()); - } - } - } - val <<= 6; - got++; - } - - // now pull out however many valid bytes we got - val >>= 8; // always skip first one - if (size == 2) { - outbuf[pos + 1] = (byte)(val & 0xff); - } - val >>= 8; - outbuf[pos] = (byte)(val & 0xff); - // len -= size; // not needed, return below - pos += size; - return pos - pos0; - } else { - // got a valid byte - val <<= 6; - got++; - val |= i; - } - } - - // read 4 valid characters, now extract 3 bytes - outbuf[pos + 2] = (byte)(val & 0xff); - val >>= 8; - outbuf[pos + 1] = (byte)(val & 0xff); - val >>= 8; - outbuf[pos] = (byte)(val & 0xff); - len -= 3; - pos += 3; - } - return pos - pos0; - } - - /** - * Read the next valid byte from the input stream. - * Buffer lots of data from underlying stream in input_buffer, - * for efficiency. - * - * @return the next byte, -1 on EOF, or -2 if next byte is '=' - * (padding at end of encoded data) - */ - private int getByte() throws IOException { - int c; - do { - if (input_pos >= input_len) { - try { - input_len = in.read(input_buffer); - } catch (EOFException ex) { - return -1; - } - if (input_len <= 0) { - return -1; - } - input_pos = 0; - } - // get the next byte in the buffer - c = input_buffer[input_pos++] & 0xff; - // is it a padding byte? - if (c == '=') { - return -2; - } - // no, convert it - c = pem_convert_array[c]; - // loop until we get a legitimate byte - } while (c == -1); - return c; - } - - /** - * Return the most recent characters, for use in an error message. - */ - private String recentChars() { - // reach into the input buffer and extract up to 10 - // recent characters, to help in debugging. - StringBuilder errstr = new StringBuilder(); - int nc = input_pos > 10 ? 10 : input_pos; - if (nc > 0) { - errstr.append(", the ").append(nc).append(" most recent characters were: \""); - for (int k = input_pos - nc; k < input_pos; k++) { - char c = (char)(input_buffer[k] & 0xff); - switch (c) { - case '\r': errstr.append("\\r"); break; - case '\n': errstr.append("\\n"); break; - case '\t': errstr.append("\\t"); break; - default: - if (c >= ' ' && c < 0177) { - errstr.append(c); - } else { - errstr.append("\\").append((int)c); - } - } - } - errstr.append("\""); - } - return errstr.toString(); - } - - /** - * Base64 decode a byte array. No line breaks are allowed. - * This method is suitable for short strings, such as those - * in the IMAP AUTHENTICATE protocol, but not to decode the - * entire content of a MIME part. - * - * NOTE: inbuf may only contain valid base64 characters. - * Whitespace is not ignored. - */ - public static byte[] decode(byte[] inbuf) { - int size = (inbuf.length / 4) * 3; - if (size == 0) { - return inbuf; - } - - if (inbuf[inbuf.length - 1] == '=') { - size--; - if (inbuf[inbuf.length - 2] == '=') { - size--; - } - } - byte[] outbuf = new byte[size]; - - int inpos = 0, outpos = 0; - size = inbuf.length; - while (size > 0) { - int val; - int osize = 3; - val = pem_convert_array[inbuf[inpos++] & 0xff]; - val <<= 6; - val |= pem_convert_array[inbuf[inpos++] & 0xff]; - val <<= 6; - if (inbuf[inpos] != '=') { - val |= pem_convert_array[inbuf[inpos++] & 0xff]; - } else { - osize--; - } - val <<= 6; - if (inbuf[inpos] != '=') { - val |= pem_convert_array[inbuf[inpos++] & 0xff]; - } else { - osize--; - } - if (osize > 2) { - outbuf[outpos + 2] = (byte)(val & 0xff); - } - val >>= 8; - if (osize > 1) { - outbuf[outpos + 1] = (byte)(val & 0xff); - } - val >>= 8; - outbuf[outpos] = (byte)(val & 0xff); - outpos += osize; - size -= 4; - } - return outbuf; - } - - /*** begin TEST program *** - public static void main(String argv[]) throws Exception { - FileInputStream infile = new FileInputStream(argv[0]); - BASE64DecoderStream decoder = new BASE64DecoderStream(infile); - int c; - - while ((c = decoder.read()) != -1) - System.out.print((char)c); - System.out.flush(); - } - *** end TEST program ***/ -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/Chunk.java 2018-01-30 20:38:05.000000000 -0500 +++ /dev/null 2018-01-30 20:38:05.000000000 -0500 @@ -1,51 +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.org.jvnet.mimepull; - -import java.nio.ByteBuffer; - -/** - * @author Kohsuke Kawaguchi - */ -final class Chunk { - volatile Chunk next; - volatile Data data; - - public Chunk(Data data) { - this.data = data; - } - - /** - * Creates a new chunk and adds to linked list. - * - * @param dataHead of the linked list - * @param buf MIME part partial data - * @return created chunk - */ - public Chunk createNext(DataHead dataHead, ByteBuffer buf) { - return next = new Chunk(data.createNext(dataHead, buf)); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/ChunkInputStream.java 2018-01-30 20:38:06.000000000 -0500 +++ /dev/null 2018-01-30 20:38:06.000000000 -0500 @@ -1,100 +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.org.jvnet.mimepull; - -import java.io.InputStream; -import java.io.IOException; - -/** - * Constructs a InputStream from a linked list of {@link Chunk}s. - * - * @author Kohsuke Kawaguchi - * @author Jitendra Kotamraju - */ -final class ChunkInputStream extends InputStream { - Chunk current; - int offset; - int len; - final MIMEMessage msg; - final MIMEPart part; - byte[] buf; - - public ChunkInputStream(MIMEMessage msg, MIMEPart part, Chunk startPos) { - this.current = startPos; - len = current.data.size(); - buf = current.data.read(); - this.msg = msg; - this.part = part; - } - - @Override - public int read(byte b[], int off, int sz) throws IOException { - if (!fetch()) { - return -1; - } - - sz = Math.min(sz, len-offset); - System.arraycopy(buf,offset,b,off,sz); - return sz; - } - - public int read() throws IOException { - if (!fetch()) { - return -1; - } - return (buf[offset++] & 0xff); - } - - /** - * Gets to the next chunk if we are done with the current one. - * @return - */ - private boolean fetch() { - if (current == null) { - throw new IllegalStateException("Stream already closed"); - } - while(offset==len) { - while(!part.parsed && current.next == null) { - msg.makeProgress(); - } - current = current.next; - - if (current == null) { - return false; - } - this.offset = 0; - this.buf = current.data.read(); - this.len = current.data.size(); - } - return true; - } - - @Override - public void close() throws IOException { - super.close(); - current = null; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/CleanUpExecutorFactory.java 2018-01-30 20:38:06.000000000 -0500 +++ /dev/null 2018-01-30 20:38:06.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.mimepull; - -import java.util.concurrent.ScheduledExecutorService; - -public abstract class CleanUpExecutorFactory { - private static final String DEFAULT_PROPERTY_NAME = CleanUpExecutorFactory.class - .getName(); - - protected CleanUpExecutorFactory() { - } - - public static CleanUpExecutorFactory newInstance() { - try { - return (CleanUpExecutorFactory) FactoryFinder.find(DEFAULT_PROPERTY_NAME); - } catch (RuntimeException e) { - return null; - } catch (Exception e) { - return null; - } - } - - public abstract ScheduledExecutorService getScheduledExecutorService(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/Data.java 2018-01-30 20:38:07.000000000 -0500 +++ /dev/null 2018-01-30 20:38:07.000000000 -0500 @@ -1,71 +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.org.jvnet.mimepull; - -import java.nio.ByteBuffer; - -/** - * @author Kohsuke Kawaguchi - * @author Jitendra Kotamraju - */ -interface Data { - - /** - * size of the chunk given by the parser - * - * @return size of the chunk - */ - int size(); - - /** - * TODO: should the return type be ByteBuffer ?? - * Return part's partial data. The data is read only. - * - * @return a byte array which contains {#size()} bytes. The returned - * array may be larger than {#size()} bytes and contains data - * from offset 0. - */ - byte[] read(); - - /** - * Write this partial data to a file - * - * @param file to which the data needs to be written - * @return file pointer before the write operation(at which the data is - * written from) - */ - long writeTo(DataFile file); - - /** - * Factory method to create a Data. The implementation could - * be file based one or memory based one. - * - * @param dataHead start of the linked list of data objects - * @param buf contains partial content for a part - * @return Data - */ - Data createNext(DataHead dataHead, ByteBuffer buf); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/DataFile.java 2018-01-30 20:38:08.000000000 -0500 +++ /dev/null 2018-01-30 20:38:08.000000000 -0500 @@ -1,84 +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.org.jvnet.mimepull; - -import java.io.*; - -/** - * Use {@link RandomAccessFile} for concurrent access of read - * and write partial part's content. - * - * @author Kohsuke Kawaguchi - * @author Jitendra Kotamraju - */ -final class DataFile { - private WeakDataFile weak; - private long writePointer; - - DataFile(File file) { - writePointer=0; - weak = new WeakDataFile(this, file); - } - - /** - * - */ - void close() { - weak.close(); - } - - /** - * Read data from the given file pointer position. - * - * @param pointer read position - * @param buf that needs to be filled - * @param offset the start offset of the data. - * @param length of data that needs to be read - */ - synchronized void read(long pointer, byte[] buf, int offset, int length ) { - weak.read(pointer, buf, offset, length); - } - - void renameTo(File f) { - weak.renameTo(f); - } - - /** - * Write data to the file - * - * @param data that needs to written to a file - * @param offset start offset in the data - * @param length no bytes to write - * @return file pointer before the write operation(or at which the - * data is written) - */ - synchronized long writeTo(byte[] data, int offset, int length) { - long temp = writePointer; - writePointer = weak.writeTo(writePointer, data, offset, length); - return temp; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/DataHead.java 2018-01-30 20:38:08.000000000 -0500 +++ /dev/null 2018-01-30 20:38:08.000000000 -0500 @@ -1,276 +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.org.jvnet.mimepull; - -import java.io.*; -import java.nio.ByteBuffer; - -/** - * Represents an attachment part in a MIME message. MIME message parsing is done - * lazily using a pull parser, so the part may not have all the data. {@link #read} - * and {@link #readOnce} may trigger the actual parsing the message. In fact, - * parsing of an attachment part may be triggered by calling {@link #read} methods - * on some other attachment parts. All this happens behind the scenes so the - * application developer need not worry about these details. - * - * @author Jitendra Kotamraju - */ -final class DataHead { - - /** - * Linked list to keep the part's content - */ - volatile Chunk head, tail; - - /** - * If the part is stored in a file, non-null. - */ - DataFile dataFile; - - private final MIMEPart part; - - boolean readOnce; - volatile long inMemory; - - /** - * Used only for debugging. This records where readOnce() is called. - */ - private Throwable consumedAt; - - DataHead(MIMEPart part) { - this.part = part; - } - - void addBody(ByteBuffer buf) { - synchronized(this) { - inMemory += buf.limit(); - } - if (tail != null) { - tail = tail.createNext(this, buf); - } else { - head = tail = new Chunk(new MemoryData(buf, part.msg.config)); - } - } - - void doneParsing() { - } - - void moveTo(File f) { - if (dataFile != null) { - dataFile.renameTo(f); - } else { - try { - OutputStream os = new FileOutputStream(f); - try { - InputStream in = readOnce(); - byte[] buf = new byte[8192]; - int len; - while((len=in.read(buf)) != -1) { - os.write(buf, 0, len); - } - } finally { - if (os != null) { - os.close(); - } - } - } catch(IOException ioe) { - throw new MIMEParsingException(ioe); - } - } - } - - void close() { - head = tail = null; - if (dataFile != null) { - dataFile.close(); - } - } - - - /** - * Can get the attachment part's content multiple times. That means - * the full content needs to be there in memory or on the file system. - * Calling this method would trigger parsing for the part's data. So - * do not call this unless it is required(otherwise, just wrap MIMEPart - * into a object that returns InputStream for e.g DataHandler) - * - * @return data for the part's content - */ - public InputStream read() { - if (readOnce) { - throw new IllegalStateException("readOnce() is called before, read() cannot be called later."); - } - - // Trigger parsing for the part - while(tail == null) { - if (!part.msg.makeProgress()) { - throw new IllegalStateException("No such MIME Part: "+part); - } - } - - if (head == null) { - throw new IllegalStateException("Already read. Probably readOnce() is called before."); - } - return new ReadMultiStream(); - } - - /** - * Used for an assertion. Returns true when readOnce() is not already called. - * or otherwise throw an exception. - * - *

- * Calling this method also marks the stream as 'consumed' - * - * @return true if readOnce() is not called before - */ - @SuppressWarnings("ThrowableInitCause") - private boolean unconsumed() { - if (consumedAt != null) { - AssertionError error = new AssertionError("readOnce() is already called before. See the nested exception from where it's called."); - error.initCause(consumedAt); - throw error; - } - consumedAt = new Exception().fillInStackTrace(); - return true; - } - - /** - * Can get the attachment part's content only once. The content - * will be lost after the method. Content data is not be stored - * on the file system or is not kept in the memory for the - * following case: - * - Attachement parts contents are accessed sequentially - * - * In general, take advantage of this when the data is used only - * once. - * - * @return data for the part's content - */ - public InputStream readOnce() { - assert unconsumed(); - if (readOnce) { - throw new IllegalStateException("readOnce() is called before. It can only be called once."); - } - readOnce = true; - // Trigger parsing for the part - while(tail == null) { - if (!part.msg.makeProgress() && tail == null) { - throw new IllegalStateException("No such Part: "+part); - } - } - InputStream in = new ReadOnceStream(); - head = null; - return in; - } - - class ReadMultiStream extends InputStream { - Chunk current; - int offset; - int len; - byte[] buf; - boolean closed; - - public ReadMultiStream() { - this.current = head; - len = current.data.size(); - buf = current.data.read(); - } - - @Override - public int read(byte b[], int off, int sz) throws IOException { - if (!fetch()) { - return -1; - } - - sz = Math.min(sz, len-offset); - System.arraycopy(buf,offset,b,off,sz); - offset += sz; - return sz; - } - - @Override - public int read() throws IOException { - if (!fetch()) { - return -1; - } - return (buf[offset++] & 0xff); - } - - void adjustInMemoryUsage() { - // Nothing to do in this case. - } - - /** - * Gets to the next chunk if we are done with the current one. - * @return true if any data available - * @throws IOException when i/o error - */ - private boolean fetch() throws IOException { - if (closed) { - throw new IOException("Stream already closed"); - } - if (current == null) { - return false; - } - - while(offset==len) { - while(!part.parsed && current.next == null) { - part.msg.makeProgress(); - } - current = current.next; - - if (current == null) { - return false; - } - adjustInMemoryUsage(); - this.offset = 0; - this.buf = current.data.read(); - this.len = current.data.size(); - } - return true; - } - - @Override - public void close() throws IOException { - super.close(); - current = null; - closed = true; - } - } - - final class ReadOnceStream extends ReadMultiStream { - - @Override - void adjustInMemoryUsage() { - synchronized(DataHead.this) { - inMemory -= current.data.size(); // adjust current memory usage - } - } - - } - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/DecodingException.java 2018-01-30 20:38:09.000000000 -0500 +++ /dev/null 2018-01-30 20:38:09.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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. - */ - -/* FROM mail.jar */ -package com.sun.xml.internal.org.jvnet.mimepull; - -import java.io.IOException; - -/** - * A special IOException that indicates a failure to decode data due - * to an error in the formatting of the data. This allows applications - * to distinguish decoding errors from other I/O errors. - * - * @author Bill Shannon - */ - -public final class DecodingException extends IOException { - - /** - * Constructs a {@code DecodingException} with the specified detail message. - * - * @param message - * The detail message - */ - public DecodingException(String message) { - super(message); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/FactoryFinder.java 2018-01-30 20:38:10.000000000 -0500 +++ /dev/null 2018-01-30 20:38:10.000000000 -0500 @@ -1,93 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.mimepull; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.nio.charset.StandardCharsets; -import java.util.logging.Level; -import java.util.logging.Logger; - -class FactoryFinder { - - private static ClassLoader cl = FactoryFinder.class.getClassLoader(); - - static Object find(String factoryId) throws ClassNotFoundException, - InstantiationException, IllegalAccessException { - String systemProp = System.getProperty(factoryId); - if (systemProp != null) { - return newInstance(systemProp); - } - - String providerName = findJarServiceProviderName(factoryId); - if (providerName != null && providerName.trim().length() > 0) { - return newInstance(providerName); - } - - return null; - } - - static Object newInstance(String className) throws ClassNotFoundException, - InstantiationException, IllegalAccessException { - Class providerClass = cl.loadClass(className); - Object instance = providerClass.newInstance(); - return instance; - } - - private static String findJarServiceProviderName(String factoryId) { - String serviceId = "META-INF/services/" + factoryId; - InputStream is; - is = cl.getResourceAsStream(serviceId); - - if (is == null) { - return null; - } - - String factoryClassName; - BufferedReader rd = null; - try { - rd = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8)); - try { - factoryClassName = rd.readLine(); - } catch (IOException x) { - return null; - } - } finally { - if (rd != null) { - try { - rd.close(); - } catch (IOException ex) { - Logger.getLogger(FactoryFinder.class.getName()).log(Level.INFO, null, ex); - } - } - } - - return factoryClassName; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/FileData.java 2018-01-30 20:38:10.000000000 -0500 +++ /dev/null 2018-01-30 20:38:10.000000000 -0500 @@ -1,78 +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.org.jvnet.mimepull; - -import java.nio.ByteBuffer; - -/** - * Keeps the Part's partial content data in a file. - * - * @author Kohsuke Kawaguchi - * @author Jitendra Kotamraju - */ -final class FileData implements Data { - private final DataFile file; - private final long pointer; // read position - private final int length; - - FileData(DataFile file, ByteBuffer buf) { - this(file, file.writeTo(buf.array(), 0, buf.limit()), buf.limit()); - } - - FileData(DataFile file, long pointer, int length) { - this.file = file; - this.pointer = pointer; - this.length = length; - } - - @Override - public byte[] read() { - byte[] buf = new byte[length]; - file.read(pointer, buf, 0, length); - return buf; - } - - /* - * This shouldn't be called - */ - @Override - public long writeTo(DataFile file) { - throw new IllegalStateException(); - } - - @Override - public int size() { - return length; - } - - /* - * Always create FileData - */ - @Override - public Data createNext(DataHead dataHead, ByteBuffer buf) { - return new FileData(file, buf); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/FinalArrayList.java 2018-01-30 20:38:11.000000000 -0500 +++ /dev/null 2018-01-30 20:38:11.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.mimepull; - -import java.util.ArrayList; -import java.util.Collection; - -/** - * {@link java.util.ArrayList} with the final keyword. - * - *

- * This gives HotSpot a better hint that all methods can be inlined. - * - * @author Kohsuke Kawaguchi - */ -final class FinalArrayList extends ArrayList { - - private static final long serialVersionUID = 7996571518730043311L; - - public FinalArrayList(int initialCapacity) { - super(initialCapacity); - } - - public FinalArrayList() { - } - - public FinalArrayList(Collection ts) { - super(ts); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/Header.java 2018-01-30 20:38:12.000000000 -0500 +++ /dev/null 2018-01-30 20:38:12.000000000 -0500 @@ -1,49 +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.org.jvnet.mimepull; - -/** - * The Header class stores a name/value pair to represent headers. - * - * @author John Mani - */ - -public interface Header { - - /** - * Returns the name of this header. - * - * @return name of the header - */ - String getName(); - - /** - * Returns the value of this header. - * - * @return value of the header - */ - String getValue(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/InternetHeaders.java 2018-01-30 20:38:12.000000000 -0500 +++ /dev/null 2018-01-30 20:38:13.000000000 -0500 @@ -1,244 +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.org.jvnet.mimepull; - -import java.io.IOException; -import java.util.NoSuchElementException; -import java.util.List; - -/** - * InternetHeaders is a utility class that manages RFC822 style - * headers. Given an RFC822 format message stream, it reads lines - * until the blank line that indicates end of header. The input stream - * is positioned at the start of the body. The lines are stored - * within the object and can be extracted as either Strings or - * {@link Header} objects.

- *

- * This class is mostly intended for service providers. MimeMessage - * and MimeBody use this class for holding their headers.

- *

- *


A note on RFC822 and MIME headers

- *

- * RFC822 and MIME header fields must contain only - * US-ASCII characters. If a header contains non US-ASCII characters, - * it must be encoded as per the rules in RFC 2047. The MimeUtility - * class provided in this package can be used to to achieve this. - * Callers of the setHeader, addHeader, and - * addHeaderLine methods are responsible for enforcing - * the MIME requirements for the specified headers. In addition, these - * header fields must be folded (wrapped) before being sent if they - * exceed the line length limitation for the transport (1000 bytes for - * SMTP). Received headers may have been folded. The application is - * responsible for folding and unfolding headers as appropriate.

- * - * @author John Mani - * @author Bill Shannon - */ -final class InternetHeaders { - - private final FinalArrayList headers = new FinalArrayList(); - - /** - * Read and parse the given RFC822 message stream till the - * blank line separating the header from the body. Store the - * header lines inside this InternetHeaders object.

- *

- * Note that the header lines are added into this InternetHeaders - * object, so any existing headers in this object will not be - * affected. - * - * @param lis RFC822 input stream - */ - InternetHeaders(MIMEParser.LineInputStream lis) { - // Read header lines until a blank line. It is valid - // to have BodyParts with no header lines. - String line; - String prevline = null; // the previous header line, as a string - // a buffer to accumulate the header in, when we know it's needed - StringBuilder lineBuffer = new StringBuilder(); - - try { - //while ((line = lis.readLine()) != null) { - do { - line = lis.readLine(); - if (line != null && - (line.startsWith(" ") || line.startsWith("\t"))) { - // continuation of header - if (prevline != null) { - lineBuffer.append(prevline); - prevline = null; - } - lineBuffer.append("\r\n"); - lineBuffer.append(line); - } else { - // new header - if (prevline != null) { - addHeaderLine(prevline); - } else if (lineBuffer.length() > 0) { - // store previous header first - addHeaderLine(lineBuffer.toString()); - lineBuffer.setLength(0); - } - prevline = line; - } - } while (line != null && line.length() > 0); - } catch (IOException ioex) { - throw new MIMEParsingException("Error in input stream", ioex); - } - } - - /** - * Return all the values for the specified header. The - * values are String objects. Returns null - * if no headers with the specified name exist. - * - * @param name header name - * @return array of header values, or null if none - */ - List getHeader(String name) { - // XXX - should we just step through in index order? - FinalArrayList v = new FinalArrayList(); // accumulate return values - - int len = headers.size(); - for( int i=0; i getAllHeaders() { - return headers; // conceptually it should be read-only, but for performance reason I'm not wrapping it here - } - - /** - * Add an RFC822 header line to the header store. - * If the line starts with a space or tab (a continuation line), - * add it to the last header line in the list.

- *

- * Note that RFC822 headers can only contain US-ASCII characters - * - * @param line raw RFC822 header line - */ - void addHeaderLine(String line) { - try { - char c = line.charAt(0); - if (c == ' ' || c == '\t') { - Hdr h = (Hdr) headers.get(headers.size() - 1); - h.line += "\r\n" + line; - } else { - headers.add(new Hdr(line)); - } - } catch (StringIndexOutOfBoundsException e) { - // line is empty, ignore it - } catch (NoSuchElementException e) { - // XXX - vector is empty? - } - } - -} - -/* - * A private utility class to represent an individual header. - */ - -class Hdr implements Header { - - String name; // the canonicalized (trimmed) name of this header - // XXX - should name be stored in lower case? - String line; // the entire RFC822 header "line" - - /* - * Constructor that takes a line and splits out - * the header name. - */ - Hdr(String l) { - int i = l.indexOf(':'); - if (i < 0) { - // should never happen - name = l.trim(); - } else { - name = l.substring(0, i).trim(); - } - line = l; - } - - /* - * Constructor that takes a header name and value. - */ - Hdr(String n, String v) { - name = n; - line = n + ": " + v; - } - - /* - * Return the "name" part of the header line. - */ - @Override - public String getName() { - return name; - } - - /* - * Return the "value" part of the header line. - */ - @Override - public String getValue() { - int i = line.indexOf(':'); - if (i < 0) { - return line; - } - - int j; - if (name.equalsIgnoreCase("Content-Description")) { - // Content-Description should retain the folded whitespace after header unfolding - - // rf. RFC2822 section 2.2.3, rf. RFC2822 section 3.2.3 - for (j = i + 1; j < line.length(); j++) { - char c = line.charAt(j); - if (!(/*c == ' ' ||*/c == '\t' || c == '\r' || c == '\n')) { - break; - } - } - } else { - // skip whitespace after ':' - for (j = i + 1; j < line.length(); j++) { - char c = line.charAt(j); - if (!(c == ' ' || c == '\t' || c == '\r' || c == '\n')) { - break; - } - } - } - return line.substring(j); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/LineInputStream.java 2018-01-30 20:38:13.000000000 -0500 +++ /dev/null 2018-01-30 20:38:13.000000000 -0500 @@ -1,140 +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. - */ - -/* FROM mail.jar */ -package com.sun.xml.internal.org.jvnet.mimepull; - -import java.io.*; - -/** - * This class is to support reading CRLF terminated lines that - * contain only US-ASCII characters from an input stream. Provides - * functionality that is similar to the deprecated - * DataInputStream.readLine(). Expected use is to read - * lines as String objects from a RFC822 stream. - * - * It is implemented as a FilterInputStream, so one can just wrap - * this class around any input stream and read bytes from this filter. - * - * @author John Mani - */ - -final class LineInputStream extends FilterInputStream { - - private char[] lineBuffer = null; // reusable byte buffer - private static int MAX_INCR = 1024*1024; // 1MB - - public LineInputStream(InputStream in) { - super(in); - } - - /** - * Read a line containing only ASCII characters from the input - * stream. A line is terminated by a CR or NL or CR-NL sequence. - * A common error is a CR-CR-NL sequence, which will also terminate - * a line. - * The line terminator is not returned as part of the returned - * String. Returns null if no data is available.

- * - * This class is similar to the deprecated - * DataInputStream.readLine() - */ - public String readLine() throws IOException { - //InputStream in = this.in; - char[] buf = lineBuffer; - - if (buf == null) { - buf = lineBuffer = new char[128]; - } - - int c1; - int room = buf.length; - int offset = 0; - - while ((c1 = in.read()) != -1) { - if (c1 == '\n') { - break; - } else if (c1 == '\r') { - // Got CR, is the next char NL ? - boolean twoCRs = false; - if (in.markSupported()) { - in.mark(2); - } - int c2 = in.read(); - if (c2 == '\r') { // discard extraneous CR - twoCRs = true; - c2 = in.read(); - } - if (c2 != '\n') { - /* - * If the stream supports it (which we hope will always - * be the case), reset to after the first CR. Otherwise, - * we wrap a PushbackInputStream around the stream so we - * can unread the characters we don't need. The only - * problem with that is that the caller might stop - * reading from this LineInputStream, throw it away, - * and then start reading from the underlying stream. - * If that happens, the pushed back characters will be - * lost forever. - */ - if (in.markSupported()) { - in.reset(); - } else { - if (!(in instanceof PushbackInputStream)) { - in /*= this.in*/ = new PushbackInputStream(in, 2); - } - if (c2 != -1) { - ((PushbackInputStream)in).unread(c2); - } - if (twoCRs) { - ((PushbackInputStream)in).unread('\r'); - } - } - } - break; // outa here. - } - - // Not CR, NL or CR-NL ... - // .. Insert the byte into our byte buffer - if (--room < 0) { // No room, need to grow. - if (buf.length < MAX_INCR) { - buf = new char[buf.length * 2]; - } else { - buf = new char[buf.length + MAX_INCR]; - } - room = buf.length - offset - 1; - System.arraycopy(lineBuffer, 0, buf, 0, offset); - lineBuffer = buf; - } - buf[offset++] = (char)c1; - } - - if ((c1 == -1) && (offset == 0)) { - return null; - } - - return String.copyValueOf(buf, 0, offset); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEConfig.java 2018-01-30 20:38:14.000000000 -0500 +++ /dev/null 2018-01-30 20:38:14.000000000 -0500 @@ -1,155 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.mimepull; - -import java.io.File; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Configuration for MIME message parsing and storing. - * - * @author Jitendra Kotamraju - */ -public class MIMEConfig { - - private static final int DEFAULT_CHUNK_SIZE = 8192; - private static final long DEFAULT_MEMORY_THRESHOLD = 1048576L; - private static final String DEFAULT_FILE_PREFIX = "MIME"; - - private static final Logger LOGGER = Logger.getLogger(MIMEConfig.class.getName()); - - // Parses the entire message eagerly - boolean parseEagerly; - - // Approximate Chunk size - int chunkSize; - - // Maximum in-memory data per attachment - long memoryThreshold; - - // temp Dir to store large files - File tempDir; - String prefix; - String suffix; - - private MIMEConfig(boolean parseEagerly, int chunkSize, - long inMemoryThreshold, String dir, String prefix, String suffix) { - this.parseEagerly = parseEagerly; - this.chunkSize = chunkSize; - this.memoryThreshold = inMemoryThreshold; - this.prefix = prefix; - this.suffix = suffix; - setDir(dir); - } - - public MIMEConfig() { - this(false, DEFAULT_CHUNK_SIZE, DEFAULT_MEMORY_THRESHOLD, null, - DEFAULT_FILE_PREFIX, null); - } - - boolean isParseEagerly() { - return parseEagerly; - } - - public void setParseEagerly(boolean parseEagerly) { - this.parseEagerly = parseEagerly; - } - - int getChunkSize() { - return chunkSize; - } - - void setChunkSize(int chunkSize) { - this.chunkSize = chunkSize; - } - - long getMemoryThreshold() { - return memoryThreshold; - } - - /** - * If the attachment is greater than the threshold, it is - * written to the disk. - * - * @param memoryThreshold no of bytes per attachment - * if -1, then the whole attachment is kept in memory - */ - public void setMemoryThreshold(long memoryThreshold) { - this.memoryThreshold = memoryThreshold; - } - - boolean isOnlyMemory() { - return memoryThreshold == -1L; - } - - File getTempDir() { - return tempDir; - } - - String getTempFilePrefix() { - return prefix; - } - - String getTempFileSuffix() { - return suffix; - } - - /** - * @param directory - * temp directory - */ - public final void setDir(String directory) { - if (tempDir == null && directory != null && !directory.equals("")) { - tempDir = new File(directory); - } - } - - /** - * Validates if it can create temporary files. Otherwise, it stores - * attachment contents in memory. - */ - public void validate() { - if (!isOnlyMemory()) { - try { - File tempFile = (tempDir == null) - ? File.createTempFile(prefix, suffix) - : File.createTempFile(prefix, suffix, tempDir); - boolean deleted = tempFile.delete(); - if (!deleted) { - if (LOGGER.isLoggable(Level.INFO)) { - LOGGER.log(Level.INFO, "File {0} was not deleted", tempFile.getAbsolutePath()); - } - } - } catch(RuntimeException e) { - memoryThreshold = -1L; // whole attachment will be in-memory - } catch(Exception e) { - memoryThreshold = -1L; // whole attachment will be in-memory - } - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEEvent.java 2018-01-30 20:38:15.000000000 -0500 +++ /dev/null 2018-01-30 20:38:15.000000000 -0500 @@ -1,117 +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.org.jvnet.mimepull; - -import java.nio.ByteBuffer; - -/** - * @author Jitendra Kotamraju - */ -abstract class MIMEEvent { - - enum EVENT_TYPE {START_MESSAGE, START_PART, HEADERS, CONTENT, END_PART, END_MESSAGE} - - /** - * Returns a event for parser's current cursor location in the MIME message. - * - *

- * {@link EVENT_TYPE#START_MESSAGE} and {@link EVENT_TYPE#START_MESSAGE} events - * are generated only once. - * - *

- * {@link EVENT_TYPE#START_PART}, {@link EVENT_TYPE#END_PART}, {@link EVENT_TYPE#HEADERS} - * events are generated only once for each attachment part. - * - *

- * {@link EVENT_TYPE#CONTENT} event may be generated more than once for an attachment - * part. - * - * @return event type - */ - abstract EVENT_TYPE getEventType(); - - static final StartMessage START_MESSAGE = new StartMessage(); - static final StartPart START_PART = new StartPart(); - static final EndPart END_PART = new EndPart(); - static final EndMessage END_MESSAGE = new EndMessage(); - - static final class StartMessage extends MIMEEvent { - EVENT_TYPE getEventType() { - return EVENT_TYPE.START_MESSAGE; - } - } - - static final class StartPart extends MIMEEvent { - EVENT_TYPE getEventType() { - return EVENT_TYPE.START_PART; - } - } - - static final class EndPart extends MIMEEvent { - EVENT_TYPE getEventType () { - return EVENT_TYPE.END_PART; - } - } - - static final class Headers extends MIMEEvent { - InternetHeaders ih; - - Headers(InternetHeaders ih) { - this.ih = ih; - } - - EVENT_TYPE getEventType() { - return EVENT_TYPE.HEADERS; - } - - InternetHeaders getHeaders() { - return ih; - } - } - - static final class Content extends MIMEEvent { - private final ByteBuffer buf; - - Content(ByteBuffer buf) { - this.buf = buf; - } - - EVENT_TYPE getEventType() { - return EVENT_TYPE.CONTENT; - } - - ByteBuffer getData() { - return buf; - } - } - - static final class EndMessage extends MIMEEvent { - EVENT_TYPE getEventType() { - return EVENT_TYPE.END_MESSAGE; - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEMessage.java 2018-01-30 20:38:15.000000000 -0500 +++ /dev/null 2018-01-30 20:38:15.000000000 -0500 @@ -1,280 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.mimepull; - -import java.io.Closeable; -import java.io.IOException; -import java.io.InputStream; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; -import java.nio.ByteBuffer; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Represents MIME message. MIME message parsing is done lazily using a - * pull parser. - * - * @author Jitendra Kotamraju - */ -public class MIMEMessage implements Closeable { - - private static final Logger LOGGER = Logger.getLogger(MIMEMessage.class.getName()); - - MIMEConfig config; - - private final InputStream in; - private final Iterator it; - private boolean parsed; // true when entire message is parsed - private MIMEPart currentPart; - private int currentIndex; - - private final List partsList = new ArrayList(); - private final Map partsMap = new HashMap(); - - /** - * @see #MIMEMessage(InputStream, String, MIMEConfig) - * - * @param in MIME message stream - * @param boundary the separator for parts(pass it without --) - */ - public MIMEMessage(InputStream in, String boundary) { - this(in, boundary, new MIMEConfig()); - } - - /** - * Creates a MIME message from the content's stream. The content stream - * is closed when EOF is reached. - * - * @param in MIME message stream - * @param boundary the separator for parts(pass it without --) - * @param config various configuration parameters - */ - public MIMEMessage(InputStream in, String boundary, MIMEConfig config) { - this.in = in; - this.config = config; - MIMEParser parser = new MIMEParser(in, boundary, config); - it = parser.iterator(); - - if (config.isParseEagerly()) { - parseAll(); - } - } - - /** - * Gets all the attachments by parsing the entire MIME message. Avoid - * this if possible since it is an expensive operation. - * - * @return list of attachments. - */ - public List getAttachments() { - if (!parsed) { - parseAll(); - } - return partsList; - } - - /** - * Creates nth attachment lazily. It doesn't validate - * if the message has so many attachments. To - * do the validation, the message needs to be parsed. - * The parsing of the message is done lazily and is done - * while reading the bytes of the part. - * - * @param index sequential order of the part. starts with zero. - * @return attachemnt part - */ - public MIMEPart getPart(int index) { - LOGGER.log(Level.FINE, "index={0}", index); - MIMEPart part = (index < partsList.size()) ? partsList.get(index) : null; - if (parsed && part == null) { - throw new MIMEParsingException("There is no " + index + " attachment part "); - } - if (part == null) { - // Parsing will done lazily and will be driven by reading the part - part = new MIMEPart(this); - partsList.add(index, part); - } - LOGGER.log(Level.FINE, "Got attachment at index={0} attachment={1}", new Object[] {index, part}); - return part; - } - - /** - * Creates a lazy attachment for a given Content-ID. It doesn't validate - * if the message contains an attachment with the given Content-ID. To - * do the validation, the message needs to be parsed. The parsing of the - * message is done lazily and is done while reading the bytes of the part. - * - * @param contentId Content-ID of the part, expects Content-ID without {@code <, >} - * @return attachemnt part - */ - public MIMEPart getPart(String contentId) { - LOGGER.log(Level.FINE, "Content-ID={0}", contentId); - MIMEPart part = getDecodedCidPart(contentId); - if (parsed && part == null) { - throw new MIMEParsingException("There is no attachment part with Content-ID = " + contentId); - } - if (part == null) { - // Parsing is done lazily and is driven by reading the part - part = new MIMEPart(this, contentId); - partsMap.put(contentId, part); - } - LOGGER.log(Level.FINE, "Got attachment for Content-ID={0} attachment={1}", new Object[] {contentId, part}); - return part; - } - - // this is required for Indigo interop, it writes content-id without escaping - private MIMEPart getDecodedCidPart(String cid) { - MIMEPart part = partsMap.get(cid); - if (part == null) { - if (cid.indexOf('%') != -1) { - try { - String tempCid = URLDecoder.decode(cid, "utf-8"); - part = partsMap.get(tempCid); - } catch (UnsupportedEncodingException ue) { - // Ignore it - } - } - } - return part; - } - - /** - * Parses the whole MIME message eagerly - */ - public final void parseAll() { - while (makeProgress()) { - // Nothing to do - } - } - - /** - * Closes all parsed {@link com.sun.xml.internal.org.jvnet.mimepull.MIMEPart parts}. - * This method is safe to call even if parsing of message failed. - * - *

Does not throw {@link com.sun.xml.internal.org.jvnet.mimepull.MIMEParsingException} if an - * error occurred during closing a MIME part. The exception (if any) is - * still logged. - */ - @Override - public void close() { - close(partsList); - close(partsMap.values()); - } - - private void close(final Collection parts) { - for (final MIMEPart part : parts) { - try { - part.close(); - } catch (final MIMEParsingException closeError) { - LOGGER.log(Level.FINE, "Exception during closing MIME part", closeError); - } - } - } - - /** - * Parses the MIME message in a pull fashion. - * - * @return false if the parsing is completed. - */ - public synchronized boolean makeProgress() { - if (!it.hasNext()) { - return false; - } - - MIMEEvent event = it.next(); - - switch (event.getEventType()) { - case START_MESSAGE: - LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_MESSAGE); - break; - - case START_PART: - LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_PART); - break; - - case HEADERS: - LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.HEADERS); - MIMEEvent.Headers headers = (MIMEEvent.Headers) event; - InternetHeaders ih = headers.getHeaders(); - List cids = ih.getHeader("content-id"); - String cid = (cids != null) ? cids.get(0) : currentIndex + ""; - if (cid.length() > 2 && cid.charAt(0) == '<') { - cid = cid.substring(1, cid.length() - 1); - } - MIMEPart listPart = (currentIndex < partsList.size()) ? partsList.get(currentIndex) : null; - MIMEPart mapPart = getDecodedCidPart(cid); - if (listPart == null && mapPart == null) { - currentPart = getPart(cid); - partsList.add(currentIndex, currentPart); - } else if (listPart == null) { - currentPart = mapPart; - partsList.add(currentIndex, mapPart); - } else if (mapPart == null) { - currentPart = listPart; - currentPart.setContentId(cid); - partsMap.put(cid, currentPart); - } else if (listPart != mapPart) { - throw new MIMEParsingException("Created two different attachments using Content-ID and index"); - } - currentPart.setHeaders(ih); - break; - - case CONTENT: - LOGGER.log(Level.FINER, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.CONTENT); - MIMEEvent.Content content = (MIMEEvent.Content) event; - ByteBuffer buf = content.getData(); - currentPart.addBody(buf); - break; - - case END_PART: - LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_PART); - currentPart.doneParsing(); - ++currentIndex; - break; - - case END_MESSAGE: - LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_MESSAGE); - parsed = true; - try { - in.close(); - } catch (IOException ioe) { - throw new MIMEParsingException(ioe); - } - break; - - default: - throw new MIMEParsingException("Unknown Parser state = " + event.getEventType()); - } - return true; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEParser.java 2018-01-30 20:38:16.000000000 -0500 +++ /dev/null 2018-01-30 20:38:16.000000000 -0500 @@ -1,507 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.mimepull; - -import java.io.InputStream; -import java.io.IOException; -import java.util.*; -import java.util.logging.Logger; -import java.nio.ByteBuffer; -import java.util.logging.Level; - -/** - * Pull parser for the MIME messages. Applications can use pull API to continue - * the parsing MIME messages lazily. - * - *

- * for e.g.:
- * 

- * - * MIMEParser parser = ... - * Iterator it = parser.iterator(); - * while(it.hasNext()) { - * MIMEEvent event = it.next(); - * ... - * } - *

- * - * @author Jitendra Kotamraju - */ -class MIMEParser implements Iterable { - - private static final Logger LOGGER = Logger.getLogger(MIMEParser.class.getName()); - - private static final String HEADER_ENCODING = "ISO8859-1"; - - // Actually, the grammar doesn't support whitespace characters - // after boundary. But the mail implementation checks for it. - // We will only check for these many whitespace characters after boundary - private static final int NO_LWSP = 1000; - private enum STATE {START_MESSAGE, SKIP_PREAMBLE, START_PART, HEADERS, BODY, END_PART, END_MESSAGE} - private STATE state = STATE.START_MESSAGE; - - private final InputStream in; - private final byte[] bndbytes; - private final int bl; - private final MIMEConfig config; - private final int[] bcs = new int[128]; // BnM algo: Bad Character Shift table - private final int[] gss; // BnM algo : Good Suffix Shift table - - /** - * Have we parsed the data from our InputStream yet? - */ - private boolean parsed; - - /* - * Read and process body partsList until we see the - * terminating boundary line (or EOF). - */ - private boolean done = false; - - private boolean eof; - private final int capacity; - private byte[] buf; - private int len; - private boolean bol; // beginning of the line - - /* - * Parses the MIME content. At the EOF, it also closes input stream - */ - MIMEParser(InputStream in, String boundary, MIMEConfig config) { - this.in = in; - this.bndbytes = getBytes("--"+boundary); - bl = bndbytes.length; - this.config = config; - gss = new int[bl]; - compileBoundaryPattern(); - - // \r\n + boundary + "--\r\n" + lots of LWSP - capacity = config.chunkSize+2+bl+4+NO_LWSP; - createBuf(capacity); - } - - /** - * Returns iterator for the parsing events. Use the iterator to advance - * the parsing. - * - * @return iterator for parsing events - */ - @Override - public Iterator iterator() { - return new MIMEEventIterator(); - } - - class MIMEEventIterator implements Iterator { - - @Override - public boolean hasNext() { - return !parsed; - } - - @Override - public MIMEEvent next() { - - if (parsed) { - throw new NoSuchElementException(); - } - - switch(state) { - case START_MESSAGE : - if (LOGGER.isLoggable(Level.FINER)) {LOGGER.log(Level.FINER, "MIMEParser state={0}", STATE.START_MESSAGE);} - state = STATE.SKIP_PREAMBLE; - return MIMEEvent.START_MESSAGE; - - case SKIP_PREAMBLE : - if (LOGGER.isLoggable(Level.FINER)) {LOGGER.log(Level.FINER, "MIMEParser state={0}", STATE.SKIP_PREAMBLE);} - skipPreamble(); - // fall through - case START_PART : - if (LOGGER.isLoggable(Level.FINER)) {LOGGER.log(Level.FINER, "MIMEParser state={0}", STATE.START_PART);} - state = STATE.HEADERS; - return MIMEEvent.START_PART; - - case HEADERS : - if (LOGGER.isLoggable(Level.FINER)) {LOGGER.log(Level.FINER, "MIMEParser state={0}", STATE.HEADERS);} - InternetHeaders ih = readHeaders(); - state = STATE.BODY; - bol = true; - return new MIMEEvent.Headers(ih); - - case BODY : - if (LOGGER.isLoggable(Level.FINER)) {LOGGER.log(Level.FINER, "MIMEParser state={0}", STATE.BODY);} - ByteBuffer buf = readBody(); - bol = false; - return new MIMEEvent.Content(buf); - - case END_PART : - if (LOGGER.isLoggable(Level.FINER)) {LOGGER.log(Level.FINER, "MIMEParser state={0}", STATE.END_PART);} - if (done) { - state = STATE.END_MESSAGE; - } else { - state = STATE.START_PART; - } - return MIMEEvent.END_PART; - - case END_MESSAGE : - if (LOGGER.isLoggable(Level.FINER)) {LOGGER.log(Level.FINER, "MIMEParser state={0}", STATE.END_MESSAGE);} - parsed = true; - return MIMEEvent.END_MESSAGE; - - default : - throw new MIMEParsingException("Unknown Parser state = "+state); - } - } - - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - } - - /** - * Collects the headers for the current part by parsing mesage stream. - * - * @return headers for the current part - */ - private InternetHeaders readHeaders() { - if (!eof) { - fillBuf(); - } - return new InternetHeaders(new LineInputStream()); - } - - /** - * Reads and saves the part of the current attachment part's content. - * At the end of this method, buf should have the remaining data - * at index 0. - * - * @return a chunk of the part's content - * - */ - private ByteBuffer readBody() { - if (!eof) { - fillBuf(); - } - int start = match(buf, 0, len); // matches boundary - if (start == -1) { - // No boundary is found - assert eof || len >= config.chunkSize; - int chunkSize = eof ? len : config.chunkSize; - if (eof) { - done = true; - throw new MIMEParsingException("Reached EOF, but there is no closing MIME boundary."); - } - return adjustBuf(chunkSize, len-chunkSize); - } - // Found boundary. - // Is it at the start of a line ? - int chunkLen = start; - if (bol && start == 0) { - // nothing to do - } else if (start > 0 && (buf[start-1] == '\n' || buf[start-1] =='\r')) { - --chunkLen; - if (buf[start-1] == '\n' && start >1 && buf[start-2] == '\r') { - --chunkLen; - } - } else { - return adjustBuf(start+1, len-start-1); // boundary is not at beginning of a line - } - - if (start+bl+1 < len && buf[start+bl] == '-' && buf[start+bl+1] == '-') { - state = STATE.END_PART; - done = true; - return adjustBuf(chunkLen, 0); - } - - // Consider all the whitespace in boundary+whitespace+"\r\n" - int lwsp = 0; - for(int i=start+bl; i < len && (buf[i] == ' ' || buf[i] == '\t'); i++) { - ++lwsp; - } - - // Check for \n or \r\n in boundary+whitespace+"\n" or boundary+whitespace+"\r\n" - if (start+bl+lwsp < len && buf[start+bl+lwsp] == '\n') { - state = STATE.END_PART; - return adjustBuf(chunkLen, len-start-bl-lwsp-1); - } else if (start+bl+lwsp+1 < len && buf[start+bl+lwsp] == '\r' && buf[start+bl+lwsp+1] == '\n') { - state = STATE.END_PART; - return adjustBuf(chunkLen, len-start-bl-lwsp-2); - } else if (start+bl+lwsp+1 < len) { - return adjustBuf(chunkLen+1, len-chunkLen-1); // boundary string in a part data - } else if (eof) { - done = true; - throw new MIMEParsingException("Reached EOF, but there is no closing MIME boundary."); - } - - // Some more data needed to determine if it is indeed a proper boundary - return adjustBuf(chunkLen, len-chunkLen); - } - - /** - * Returns a chunk from the original buffer. A new buffer is - * created with the remaining bytes. - * - * @param chunkSize create a chunk with these many bytes - * @param remaining bytes from the end of the buffer that need to be copied to - * the beginning of the new buffer - * @return chunk - */ - private ByteBuffer adjustBuf(int chunkSize, int remaining) { - assert buf != null; - assert chunkSize >= 0; - assert remaining >= 0; - - byte[] temp = buf; - // create a new buf and adjust it without this chunk - createBuf(remaining); - System.arraycopy(temp, len-remaining, buf, 0, remaining); - len = remaining; - - return ByteBuffer.wrap(temp, 0, chunkSize); - } - - private void createBuf(int min) { - buf = new byte[min < capacity ? capacity : min]; - } - - /** - * Skips the preamble to find the first attachment part - */ - private void skipPreamble() { - - while(true) { - if (!eof) { - fillBuf(); - } - int start = match(buf, 0, len); // matches boundary - if (start == -1) { - // No boundary is found - if (eof) { - throw new MIMEParsingException("Missing start boundary"); - } else { - adjustBuf(len-bl+1, bl-1); - continue; - } - } - - if (start > config.chunkSize) { - adjustBuf(start, len-start); - continue; - } - // Consider all the whitespace boundary+whitespace+"\r\n" - int lwsp = 0; - for(int i=start+bl; i < len && (buf[i] == ' ' || buf[i] == '\t'); i++) { - ++lwsp; - } - // Check for \n or \r\n - if (start+bl+lwsp < len && (buf[start+bl+lwsp] == '\n' || buf[start+bl+lwsp] == '\r') ) { - if (buf[start+bl+lwsp] == '\n') { - adjustBuf(start+bl+lwsp+1, len-start-bl-lwsp-1); - break; - } else if (start+bl+lwsp+1 < len && buf[start+bl+lwsp+1] == '\n') { - adjustBuf(start+bl+lwsp+2, len-start-bl-lwsp-2); - break; - } - } - adjustBuf(start+1, len-start-1); - } - if (LOGGER.isLoggable(Level.FINE)) {LOGGER.log(Level.FINE, "Skipped the preamble. buffer len={0}", len);} - } - - private static byte[] getBytes(String s) { - char [] chars= s.toCharArray(); - int size = chars.length; - byte[] bytes = new byte[size]; - - for (int i = 0; i < size;) { - bytes[i] = (byte) chars[i++]; - } - return bytes; - } - - /** - * Boyer-Moore search method. Copied from java.util.regex.Pattern.java - * - * Pre calculates arrays needed to generate the bad character - * shift and the good suffix shift. Only the last seven bits - * are used to see if chars match; This keeps the tables small - * and covers the heavily used ASCII range, but occasionally - * results in an aliased match for the bad character shift. - */ - private void compileBoundaryPattern() { - int i, j; - - // Precalculate part of the bad character shift - // It is a table for where in the pattern each - // lower 7-bit value occurs - for (i = 0; i < bndbytes.length; i++) { - bcs[bndbytes[i]&0x7F] = i + 1; - } - - // Precalculate the good suffix shift - // i is the shift amount being considered -NEXT: for (i = bndbytes.length; i > 0; i--) { - // j is the beginning index of suffix being considered - for (j = bndbytes.length - 1; j >= i; j--) { - // Testing for good suffix - if (bndbytes[j] == bndbytes[j-i]) { - // src[j..len] is a good suffix - gss[j-1] = i; - } else { - // No match. The array has already been - // filled up with correct values before. - continue NEXT; - } - } - // This fills up the remaining of optoSft - // any suffix can not have larger shift amount - // then its sub-suffix. Why??? - while (j > 0) { - gss[--j] = i; - } - } - // Set the guard value because of unicode compression - gss[bndbytes.length -1] = 1; - } - - /** - * Finds the boundary in the given buffer using Boyer-Moore algo. - * Copied from java.util.regex.Pattern.java - * - * @param mybuf boundary to be searched in this mybuf - * @param off start index in mybuf - * @param len number of bytes in mybuf - * - * @return -1 if there is no match or index where the match starts - */ - private int match(byte[] mybuf, int off, int len) { - int last = len - bndbytes.length; - - // Loop over all possible match positions in text -NEXT: while (off <= last) { - // Loop over pattern from right to left - for (int j = bndbytes.length - 1; j >= 0; j--) { - byte ch = mybuf[off+j]; - if (ch != bndbytes[j]) { - // Shift search to the right by the maximum of the - // bad character shift and the good suffix shift - off += Math.max(j + 1 - bcs[ch&0x7F], gss[j]); - continue NEXT; - } - } - // Entire pattern matched starting at off - return off; - } - return -1; - } - - /** - * Fills the remaining buf to the full capacity - */ - private void fillBuf() { - if (LOGGER.isLoggable(Level.FINER)) {LOGGER.log(Level.FINER, "Before fillBuf() buffer len={0}", len);} - assert !eof; - while(len < buf.length) { - int read; - try { - read = in.read(buf, len, buf.length-len); - } catch(IOException ioe) { - throw new MIMEParsingException(ioe); - } - if (read == -1) { - eof = true; - try { - if (LOGGER.isLoggable(Level.FINE)) {LOGGER.fine("Closing the input stream.");} - in.close(); - } catch(IOException ioe) { - throw new MIMEParsingException(ioe); - } - break; - } else { - len += read; - } - } - if (LOGGER.isLoggable(Level.FINER)) {LOGGER.log(Level.FINER, "After fillBuf() buffer len={0}", len);} - } - - private void doubleBuf() { - byte[] temp = new byte[2*len]; - System.arraycopy(buf, 0, temp, 0, len); - buf = temp; - if (!eof) { - fillBuf(); - } - } - - class LineInputStream { - private int offset; - - /* - * Read a line containing only ASCII characters from the input - * stream. A line is terminated by a CR or NL or CR-NL sequence. - * A common error is a CR-CR-NL sequence, which will also terminate - * a line. - * The line terminator is not returned as part of the returned - * String. Returns null if no data is available.

- * - * This class is similar to the deprecated - * DataInputStream.readLine() - */ - public String readLine() throws IOException { - - int hdrLen = 0; - int lwsp = 0; - while(offset+hdrLen < len) { - if (buf[offset+hdrLen] == '\n') { - lwsp = 1; - break; - } - if (offset+hdrLen+1 == len) { - doubleBuf(); - } - if (offset+hdrLen+1 >= len) { // No more data in the stream - assert eof; - return null; - } - if (buf[offset+hdrLen] == '\r' && buf[offset+hdrLen+1] == '\n') { - lwsp = 2; - break; - } - ++hdrLen; - } - if (hdrLen == 0) { - adjustBuf(offset+lwsp, len-offset-lwsp); - return null; - } - - String hdr = new String(buf, offset, hdrLen, HEADER_ENCODING); - offset += hdrLen+lwsp; - return hdr; - } - - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEParsingException.java 2018-01-30 20:38:17.000000000 -0500 +++ /dev/null 2018-01-30 20:38:17.000000000 -0500 @@ -1,89 +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.org.jvnet.mimepull; - -/** - * @author Jitendra Kotamraju - */ - -/** - * The MIMEParsingException class is the base - * exception class for all MIME message parsing exceptions. - * - */ - -public class MIMEParsingException extends java.lang.RuntimeException { - - /** - * Constructs a new exception with null as its - * detail message. The cause is not initialized. - */ - public MIMEParsingException() { - super(); - } - - /** - * Constructs a new exception with the specified detail - * message. The cause is not initialized. - * - * @param message The detail message which is later - * retrieved using the getMessage method - */ - public MIMEParsingException(String message) { - super(message); - } - - /** - * Constructs a new exception with the specified detail - * message and cause. - * - * @param message The detail message which is later retrieved - * using the getMessage method - * @param cause The cause which is saved for the later - * retrieval throw by the getCause method - */ - public MIMEParsingException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Constructs a new WebServiceException with the specified cause - * and a detail message of - * {@code (cause==null ? null : cause.toString())} - * (which typically contains the - * class and detail message of {@code cause}). - * - * @param cause The cause which is saved for the later - * retrieval throw by the getCause method. - * (A {@code null} value is permitted, and - * indicates that the cause is nonexistent or - * unknown.) - */ - public MIMEParsingException(Throwable cause) { - super(cause); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MIMEPart.java 2018-01-30 20:38:18.000000000 -0500 +++ /dev/null 2018-01-30 20:38:18.000000000 -0500 @@ -1,271 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.mimepull; - -import java.io.Closeable; -import java.io.File; -import java.io.InputStream; -import java.nio.ByteBuffer; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Represents an attachment part in a MIME message. MIME message parsing is done - * lazily using a pull parser, so the part may not have all the data. {@link #read} - * and {@link #readOnce} may trigger the actual parsing the message. In fact, - * parsing of an attachment part may be triggered by calling {@link #read} methods - * on some other attachment parts. All this happens behind the scenes so the - * application developer need not worry about these details. - * - * @author Jitendra Kotamraju, Martin Grebac - */ -public class MIMEPart implements Closeable { - - private static final Logger LOGGER = Logger.getLogger(MIMEPart.class.getName()); - - private volatile boolean closed; - private volatile InternetHeaders headers; - private volatile String contentId; - private String contentType; - private String contentTransferEncoding; - - volatile boolean parsed; // part is parsed or not - final MIMEMessage msg; - private final DataHead dataHead; - - private final Object lock = new Object(); - - MIMEPart(MIMEMessage msg) { - this.msg = msg; - this.dataHead = new DataHead(this); - } - - MIMEPart(MIMEMessage msg, String contentId) { - this(msg); - this.contentId = contentId; - } - - /** - * Can get the attachment part's content multiple times. That means - * the full content needs to be there in memory or on the file system. - * Calling this method would trigger parsing for the part's data. So - * do not call this unless it is required(otherwise, just wrap MIMEPart - * into a object that returns InputStream for e.g DataHandler) - * - * @return data for the part's content - */ - public InputStream read() { - InputStream is = null; - try { - is = MimeUtility.decode(dataHead.read(), contentTransferEncoding); - } catch (DecodingException ex) { //ignore - if (LOGGER.isLoggable(Level.WARNING)) { - LOGGER.log(Level.WARNING, null, ex); - } - } - return is; - } - - /** - * Cleans up any resources that are held by this part (for e.g. deletes - * the temp file that is used to serve this part's content). After - * calling this, one shouldn't call {@link #read()} or {@link #readOnce()} - */ - @Override - public void close() { - if (!closed) { - synchronized (lock) { - if (!closed) { - dataHead.close(); - closed = true; - } - } - } - } - - /** - * Can get the attachment part's content only once. The content - * will be lost after the method. Content data is not be stored - * on the file system or is not kept in the memory for the - * following case: - * - Attachement parts contents are accessed sequentially - * - * In general, take advantage of this when the data is used only - * once. - * - * @return data for the part's content - */ - public InputStream readOnce() { - InputStream is = null; - try { - is = MimeUtility.decode(dataHead.readOnce(), contentTransferEncoding); - } catch (DecodingException ex) { //ignore - if (LOGGER.isLoggable(Level.WARNING)) { - LOGGER.log(Level.WARNING, null, ex); - } - } - return is; - } - - public void moveTo(File f) { - dataHead.moveTo(f); - } - - /** - * Returns Content-ID MIME header for this attachment part - * - * @return Content-ID of the part - */ - public String getContentId() { - if (contentId == null) { - getHeaders(); - } - return contentId; - } - - /** - * Returns Content-Transfer-Encoding MIME header for this attachment part - * - * @return Content-Transfer-Encoding of the part - */ - public String getContentTransferEncoding() { - if (contentTransferEncoding == null) { - getHeaders(); - } - return contentTransferEncoding; - } - - /** - * Returns Content-Type MIME header for this attachment part - * - * @return Content-Type of the part - */ - public String getContentType() { - if (contentType == null) { - getHeaders(); - } - return contentType; - } - - private void getHeaders() { - // Trigger parsing for the part headers - while(headers == null) { - if (!msg.makeProgress()) { - if (headers == null) { - throw new IllegalStateException("Internal Error. Didn't get Headers even after complete parsing."); - } - } - } - } - - /** - * Return all the values for the specified header. - * Returns null if no headers with the - * specified name exist. - * - * @param name header name - * @return list of header values, or null if none - */ - public List getHeader(String name) { - getHeaders(); - assert headers != null; - return headers.getHeader(name); - } - - /** - * Return all the headers - * - * @return list of Header objects - */ - public List getAllHeaders() { - getHeaders(); - assert headers != null; - return headers.getAllHeaders(); - } - - /** - * Callback to set headers - * - * @param headers MIME headers for the part - */ - void setHeaders(InternetHeaders headers) { - this.headers = headers; - List ct = getHeader("Content-Type"); - this.contentType = (ct == null) ? "application/octet-stream" : ct.get(0); - List cte = getHeader("Content-Transfer-Encoding"); - this.contentTransferEncoding = (cte == null) ? "binary" : cte.get(0); - } - - /** - * Callback to notify that there is a partial content for the part - * - * @param buf content data for the part - */ - void addBody(ByteBuffer buf) { - dataHead.addBody(buf); - } - - /** - * Callback to indicate that parsing is done for this part - * (no more update events for this part) - */ - void doneParsing() { - parsed = true; - dataHead.doneParsing(); - } - - /** - * Callback to set Content-ID for this part - * @param cid Content-ID of the part - */ - void setContentId(String cid) { - this.contentId = cid; - } - - /** - * Callback to set Content-Transfer-Encoding for this part - * @param cte Content-Transfer-Encoding of the part - */ - void setContentTransferEncoding(String cte) { - this.contentTransferEncoding = cte; - } - - /** - * Return {@code true} if this part has already been closed, {@code false} otherwise. - * - * @return {@code true} if this part has already been closed, {@code false} otherwise. - */ - public boolean isClosed() { - return closed; - } - - @Override - public String toString() { - return "Part="+contentId+":"+contentTransferEncoding; - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MemoryData.java 2018-01-30 20:38:18.000000000 -0500 +++ /dev/null 2018-01-30 20:38:18.000000000 -0500 @@ -1,104 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.mimepull; - -import java.nio.ByteBuffer; -import java.io.File; -import java.io.IOException; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Keeps the Part's partial content data in memory. - * - * @author Kohsuke Kawaguchi - * @author Jitendra Kotamraju - */ -final class MemoryData implements Data { - private static final Logger LOGGER = Logger.getLogger(MemoryData.class.getName()); - - private final byte[] data; - private final int len; - private final MIMEConfig config; - - MemoryData(ByteBuffer buf, MIMEConfig config) { - data = buf.array(); - len = buf.limit(); - this.config = config; - } - - // size of the chunk given by the parser - @Override - public int size() { - return len; - } - - @Override - public byte[] read() { - return data; - } - - @Override - public long writeTo(DataFile file) { - return file.writeTo(data, 0, len); - } - - /** - * - * @param dataHead - * @param buf - * @return - */ - @Override - public Data createNext(DataHead dataHead, ByteBuffer buf) { - if (!config.isOnlyMemory() && dataHead.inMemory >= config.memoryThreshold) { - try { - String prefix = config.getTempFilePrefix(); - String suffix = config.getTempFileSuffix(); - File tempFile = TempFiles.createTempFile(prefix, suffix, config.getTempDir()); - // delete the temp file when VM exits as a last resort for file clean up - tempFile.deleteOnExit(); - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile); - } - dataHead.dataFile = new DataFile(tempFile); - } catch (IOException ioe) { - throw new MIMEParsingException(ioe); - } - - if (dataHead.head != null) { - for (Chunk c = dataHead.head; c != null; c = c.next) { - long pointer = c.data.writeTo(dataHead.dataFile); - c.data = new FileData(dataHead.dataFile, pointer, len); - } - } - return new FileData(dataHead.dataFile, buf); - } else { - return new MemoryData(buf, config); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/MimeUtility.java 2018-01-30 20:38:19.000000000 -0500 +++ /dev/null 2018-01-30 20:38:19.000000000 -0500 @@ -1,171 +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.org.jvnet.mimepull; - -import java.io.*; - - -/** - * This is a utility class that provides various MIME related - * functionality.

- * - * There are a set of methods to encode and decode MIME headers as - * per RFC 2047. Note that, in general, these methods are - * not needed when using methods such as - * setSubject and setRecipients; JavaMail - * will automatically encode and decode data when using these "higher - * level" methods. The methods below are only needed when maniuplating - * raw MIME headers using setHeader and getHeader - * methods. A brief description on handling such headers is given below:

- * - * RFC 822 mail headers must contain only US-ASCII - * characters. Headers that contain non US-ASCII characters must be - * encoded so that they contain only US-ASCII characters. Basically, - * this process involves using either BASE64 or QP to encode certain - * characters. RFC 2047 describes this in detail.

- * - * In Java, Strings contain (16 bit) Unicode characters. ASCII is a - * subset of Unicode (and occupies the range 0 - 127). A String - * that contains only ASCII characters is already mail-safe. If the - * String contains non US-ASCII characters, it must be encoded. An - * additional complexity in this step is that since Unicode is not - * yet a widely used charset, one might want to first charset-encode - * the String into another charset and then do the transfer-encoding. - *

- * Note that to get the actual bytes of a mail-safe String (say, - * for sending over SMTP), one must do - *

- *
- *      byte[] bytes = string.getBytes("iso-8859-1");
- *
- * 

- * - * The setHeader and addHeader methods - * on MimeMessage and MimeBodyPart assume that the given header values - * are Unicode strings that contain only US-ASCII characters. Hence - * the callers of those methods must insure that the values they pass - * do not contain non US-ASCII characters. The methods in this class - * help do this.

- * - * The getHeader family of methods on MimeMessage and - * MimeBodyPart return the raw header value. These might be encoded - * as per RFC 2047, and if so, must be decoded into Unicode Strings. - * The methods in this class help to do this.

- * - * Several System properties control strict conformance to the MIME - * spec. Note that these are not session properties but must be set - * globally as System properties.

- * - * The mail.mime.decodetext.strict property controls - * decoding of MIME encoded words. The MIME spec requires that encoded - * words start at the beginning of a whitespace separated word. Some - * mailers incorrectly include encoded words in the middle of a word. - * If the mail.mime.decodetext.strict System property is - * set to "false", an attempt will be made to decode these - * illegal encoded words. The default is true.

- * - * The mail.mime.encodeeol.strict property controls the - * choice of Content-Transfer-Encoding for MIME parts that are not of - * type "text". Often such parts will contain textual data for which - * an encoding that allows normal end of line conventions is appropriate. - * In rare cases, such a part will appear to contain entirely textual - * data, but will require an encoding that preserves CR and LF characters - * without change. If the mail.mime.encodeeol.strict - * System property is set to "true", such an encoding will - * be used when necessary. The default is false.

- * - * In addition, the mail.mime.charset System property can - * be used to specify the default MIME charset to use for encoded words - * and text parts that don't otherwise specify a charset. Normally, the - * default MIME charset is derived from the default Java charset, as - * specified in the file.encoding System property. Most - * applications will have no need to explicitly set the default MIME - * charset. In cases where the default MIME charset to be used for - * mail messages is different than the charset used for files stored on - * the system, this property should be set.

- * - * The current implementation also supports the following System property. - *

- * The mail.mime.ignoreunknownencoding property controls - * whether unknown values in the Content-Transfer-Encoding - * header, as passed to the decode method, cause an exception. - * If set to "true", unknown values are ignored and 8bit - * encoding is assumed. Otherwise, unknown values cause a MessagingException - * to be thrown. - * - * @author John Mani - * @author Bill Shannon - */ - -/* FROM mail.jar */ -final class MimeUtility { - - // This class cannot be instantiated - private MimeUtility() { } - - private static final boolean ignoreUnknownEncoding = - PropUtil.getBooleanSystemProperty( - "mail.mime.ignoreunknownencoding", false); - - /** - * Decode the given input stream. The Input stream returned is - * the decoded input stream. All the encodings defined in RFC 2045 - * are supported here. They include "base64", "quoted-printable", - * "7bit", "8bit", and "binary". In addition, "uuencode" is also - * supported.

- * - * In the current implementation, if the - * mail.mime.ignoreunknownencoding system property is set to - * "true", unknown encoding values are ignored and the - * original InputStream is returned. - * - * @param is input stream - * @param encoding the encoding of the stream. - * @return decoded input stream. - * @exception MessagingException if the encoding is unknown - */ - public static InputStream decode(InputStream is, String encoding) - throws DecodingException { - if (encoding.equalsIgnoreCase("base64")) - return new BASE64DecoderStream(is); - else if (encoding.equalsIgnoreCase("quoted-printable")) - return new QPDecoderStream(is); - else if (encoding.equalsIgnoreCase("uuencode") || - encoding.equalsIgnoreCase("x-uuencode") || - encoding.equalsIgnoreCase("x-uue")) - return new UUDecoderStream(is); - else if (encoding.equalsIgnoreCase("binary") || - encoding.equalsIgnoreCase("7bit") || - encoding.equalsIgnoreCase("8bit")) - return is; - else { - if (!ignoreUnknownEncoding) { - throw new DecodingException("Unknown encoding: " + encoding); - } - return is; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/PropUtil.java 2018-01-30 20:38:20.000000000 -0500 +++ /dev/null 2018-01-30 20:38:20.000000000 -0500 @@ -1,110 +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. - */ - -/* FROM mail.jar */ -package com.sun.xml.internal.org.jvnet.mimepull; - -import java.util.*; - -/** - * Utilities to make it easier to get property values. - * Properties can be strings or type-specific value objects. - * - * @author Bill Shannon - */ -final class PropUtil { - - // No one should instantiate this class. - private PropUtil() { - } - - /** - * Get a boolean valued System property. - */ - public static boolean getBooleanSystemProperty(String name, boolean def) { - try { - return getBoolean(getProp(System.getProperties(), name), def); - } catch (SecurityException sex) { - // fall through... - } - - /* - * If we can't get the entire System Properties object because - * of a SecurityException, just ask for the specific property. - */ - try { - String value = System.getProperty(name); - if (value == null) { - return def; - } - if (def) { - return !value.equalsIgnoreCase("false"); - } else { - return value.equalsIgnoreCase("true"); - } - } catch (SecurityException sex) { - return def; - } - } - - /** - * Get the value of the specified property. - * If the "get" method returns null, use the getProperty method, - * which might cascade to a default Properties object. - */ - private static Object getProp(Properties props, String name) { - Object val = props.get(name); - if (val != null) { - return val; - } else { - return props.getProperty(name); - } - } - - /** - * Interpret the value object as a boolean, - * returning def if unable. - */ - private static boolean getBoolean(Object value, boolean def) { - if (value == null) { - return def; - } - if (value instanceof String) { - /* - * If the default is true, only "false" turns it off. - * If the default is false, only "true" turns it on. - */ - if (def) { - return !((String)value).equalsIgnoreCase("false"); - } else { - return ((String)value).equalsIgnoreCase("true"); - } - } - if (value instanceof Boolean) { - return ((Boolean)value).booleanValue(); - } - return def; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/QPDecoderStream.java 2018-01-30 20:38:21.000000000 -0500 +++ /dev/null 2018-01-30 20:38:21.000000000 -0500 @@ -1,207 +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. - */ - -/* FROM mail.jar */ -package com.sun.xml.internal.org.jvnet.mimepull; - -import java.io.*; - -/** - * This class implements a QP Decoder. It is implemented as - * a FilterInputStream, so one can just wrap this class around - * any input stream and read bytes from this filter. The decoding - * is done as the bytes are read out. - * - * @author John Mani - */ - -final class QPDecoderStream extends FilterInputStream { - private byte[] ba = new byte[2]; - private int spaces = 0; - - /** - * Create a Quoted Printable decoder that decodes the specified - * input stream. - * @param in the input stream - */ - public QPDecoderStream(InputStream in) { - super(new PushbackInputStream(in, 2)); // pushback of size=2 - } - - /** - * Read the next decoded byte from this input stream. The byte - * is returned as an int in the range 0 - * to 255. If no byte is available because the end of - * the stream has been reached, the value -1 is returned. - * This method blocks until input data is available, the end of the - * stream is detected, or an exception is thrown. - * - * @return the next byte of data, or -1 if the end of the - * stream is reached. - * @exception IOException if an I/O error occurs. - */ - @Override - public int read() throws IOException { - if (spaces > 0) { - // We have cached space characters, return one - spaces--; - return ' '; - } - - int c = in.read(); - - if (c == ' ') { - // Got space, keep reading till we get a non-space char - while ((c = in.read()) == ' ') { - spaces++; - } - - if (c == '\r' || c == '\n' || c == -1) { - spaces = 0; - } else { - // The non-space char is NOT CR/LF, the spaces are valid. - ((PushbackInputStream)in).unread(c); - c = ' '; - } - return c; // return either or - } - else if (c == '=') { - // QP Encoded atom. Decode the next two bytes - int a = in.read(); - - if (a == '\n') { - /* Hmm ... not really confirming QP encoding, but lets - * allow this as a LF terminated encoded line .. and - * consider this a soft linebreak and recurse to fetch - * the next char. - */ - return read(); - } else if (a == '\r') { - // Expecting LF. This forms a soft linebreak to be ignored. - int b = in.read(); - if (b != '\n') { - ((PushbackInputStream)in).unread(b); - } - return read(); - } else if (a == -1) { - // Not valid QP encoding, but we be nice and tolerant here ! - return -1; - } else { - ba[0] = (byte)a; - ba[1] = (byte)in.read(); - try { - return ASCIIUtility.parseInt(ba, 0, 2, 16); - } catch (NumberFormatException nex) { - /* - System.err.println( - "Illegal characters in QP encoded stream: " + - ASCIIUtility.toString(ba, 0, 2) - ); - */ - - ((PushbackInputStream)in).unread(ba); - return c; - } - } - } - return c; - } - - /** - * Reads up to len decoded bytes of data from this input stream - * into an array of bytes. This method blocks until some input is - * available. - *

- * - * @param buf the buffer into which the data is read. - * @param off the start offset of the data. - * @param len the maximum number of bytes read. - * @return the total number of bytes read into the buffer, or - * -1 if there is no more data because the end of - * the stream has been reached. - * @exception IOException if an I/O error occurs. - */ - @Override - public int read(byte[] buf, int off, int len) throws IOException { - int i, c; - for (i = 0; i < len; i++) { - if ((c = read()) == -1) { - if (i == 0) { - i = -1; // return -1 , NOT 0. - } - break; - } - buf[off+i] = (byte)c; - } - return i; - } - - /** - * Skips over and discards n bytes of data from this stream. - */ - @Override - public long skip(long n) throws IOException { - long skipped = 0; - while (n-- > 0 && read() >= 0) { - skipped++; - } - return skipped; - } - - /** - * Tests if this input stream supports marks. Currently this class - * does not support marks - */ - @Override - public boolean markSupported() { - return false; - } - - /** - * Returns the number of bytes that can be read from this input - * stream without blocking. The QP algorithm does not permit - * a priori knowledge of the number of bytes after decoding, so - * this method just invokes the available method - * of the original input stream. - */ - @Override - public int available() throws IOException { - // This is bogus ! We don't really know how much - // bytes are available *after* decoding - return in.available(); - } - - /**** begin TEST program - public static void main(String argv[]) throws Exception { - FileInputStream infile = new FileInputStream(argv[0]); - QPDecoderStream decoder = new QPDecoderStream(infile); - int c; - - while ((c = decoder.read()) != -1) - System.out.print((char)c); - System.out.println(); - } - *** end TEST program ****/ -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/TempFiles.java 2018-01-30 20:38:21.000000000 -0500 +++ /dev/null 2018-01-30 20:38:21.000000000 -0500 @@ -1,144 +0,0 @@ -/* - * Copyright (c) 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.org.jvnet.mimepull; - -import java.io.File; -import java.io.IOException; -import java.lang.reflect.Array; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Helper utility to support jdk <= jdk1.6. After jdk1.6 EOL reflection can be removed and API can be used directly. - */ -class TempFiles { - - private static final Logger LOGGER = Logger.getLogger(TempFiles.class.getName()); - - private static final Class CLASS_FILES; - private static final Class CLASS_PATH; - private static final Class CLASS_FILE_ATTRIBUTE; - private static final Class CLASS_FILE_ATTRIBUTES; - private static final Method METHOD_FILE_TO_PATH; - private static final Method METHOD_FILES_CREATE_TEMP_FILE; - private static final Method METHOD_FILES_CREATE_TEMP_FILE_WITHPATH; - - private static final Method METHOD_PATH_TO_FILE; - - private static boolean useJdk6API; - - static { - useJdk6API = isJdk6(); - - CLASS_FILES = safeGetClass("java.nio.file.Files"); - CLASS_PATH = safeGetClass("java.nio.file.Path"); - CLASS_FILE_ATTRIBUTE = safeGetClass("java.nio.file.attribute.FileAttribute"); - CLASS_FILE_ATTRIBUTES = safeGetClass("[Ljava.nio.file.attribute.FileAttribute;"); - METHOD_FILE_TO_PATH = safeGetMethod(File.class, "toPath"); - METHOD_FILES_CREATE_TEMP_FILE = safeGetMethod(CLASS_FILES, "createTempFile", String.class, String.class, CLASS_FILE_ATTRIBUTES); - METHOD_FILES_CREATE_TEMP_FILE_WITHPATH = safeGetMethod(CLASS_FILES, "createTempFile", CLASS_PATH, String.class, String.class, CLASS_FILE_ATTRIBUTES); - METHOD_PATH_TO_FILE = safeGetMethod(CLASS_PATH, "toFile"); - } - - private static boolean isJdk6() { - String javaVersion = System.getProperty("java.version"); - LOGGER.log(Level.FINEST, "Detected java version = {0}", javaVersion); - return javaVersion.startsWith("1.6."); - } - - private static Class safeGetClass(String className) { - // it is jdk 6 or something failed already before - if (useJdk6API) return null; - try { - return Class.forName(className); - } catch (ClassNotFoundException e) { - LOGGER.log(Level.SEVERE, "Exception cought", e); - LOGGER.log(Level.WARNING, "Class {0} not found. Temp files will be created using old java.io API.", className); - useJdk6API = true; - return null; - } - } - - private static Method safeGetMethod(Class clazz, String methodName, Class... parameterTypes) { - // it is jdk 6 or something failed already before - if (useJdk6API) return null; - try { - return clazz.getMethod(methodName, parameterTypes); - } catch (NoSuchMethodException e) { - LOGGER.log(Level.SEVERE, "Exception cought", e); - LOGGER.log(Level.WARNING, "Method {0} not found. Temp files will be created using old java.io API.", methodName); - useJdk6API = true; - return null; - } - } - - - static Object toPath(File f) throws InvocationTargetException, IllegalAccessException { - return METHOD_FILE_TO_PATH.invoke(f); - } - - static File toFile(Object path) throws InvocationTargetException, IllegalAccessException { - return (File) METHOD_PATH_TO_FILE.invoke(path); - } - - static File createTempFile(String prefix, String suffix, File dir) throws IOException { - - if (useJdk6API) { - LOGGER.log(Level.FINEST, "Jdk6 detected, temp file (prefix:{0}, suffix:{1}) being created using old java.io API.", new Object[]{prefix, suffix}); - return File.createTempFile(prefix, suffix, dir); - - } else { - - try { - if (dir != null) { - Object path = toPath(dir); - LOGGER.log(Level.FINEST, "Temp file (path: {0}, prefix:{1}, suffix:{2}) being created using NIO API.", new Object[]{dir.getAbsolutePath(), prefix, suffix}); - return toFile(METHOD_FILES_CREATE_TEMP_FILE_WITHPATH.invoke(null, path, prefix, suffix, Array.newInstance(CLASS_FILE_ATTRIBUTE, 0))); - } else { - LOGGER.log(Level.FINEST, "Temp file (prefix:{0}, suffix:{1}) being created using NIO API.", new Object[]{prefix, suffix}); - return toFile(METHOD_FILES_CREATE_TEMP_FILE.invoke(null, prefix, suffix, Array.newInstance(CLASS_FILE_ATTRIBUTE, 0))); - } - - } catch (IllegalAccessException e) { - LOGGER.log(Level.SEVERE, "Exception caught", e); - LOGGER.log(Level.WARNING, "Error invoking java.nio API, temp file (path: {0}, prefix:{1}, suffix:{2}) being created using old java.io API.", - new Object[]{dir != null ? dir.getAbsolutePath() : null, prefix, suffix}); - return File.createTempFile(prefix, suffix, dir); - - } catch (InvocationTargetException e) { - LOGGER.log(Level.SEVERE, "Exception caught", e); - LOGGER.log(Level.WARNING, "Error invoking java.nio API, temp file (path: {0}, prefix:{1}, suffix:{2}) being created using old java.io API.", - new Object[]{dir != null ? dir.getAbsolutePath() : null, prefix, suffix}); - return File.createTempFile(prefix, suffix, dir); - } - } - - } - - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/UUDecoderStream.java 2018-01-30 20:38:22.000000000 -0500 +++ /dev/null 2018-01-30 20:38:22.000000000 -0500 @@ -1,357 +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. - */ - -/* FROM mail.jar */ -package com.sun.xml.internal.org.jvnet.mimepull; - -import java.io.*; - -/** - * This class implements a UUDecoder. It is implemented as - * a FilterInputStream, so one can just wrap this class around - * any input stream and read bytes from this filter. The decoding - * is done as the bytes are read out. - * - * @author John Mani - * @author Bill Shannon - */ - -final class UUDecoderStream extends FilterInputStream { - private String name; - private int mode; - - private byte[] buffer = new byte[45]; // max decoded chars in a line = 45 - private int bufsize = 0; // size of the cache - private int index = 0; // index into the cache - private boolean gotPrefix = false; - private boolean gotEnd = false; - private LineInputStream lin; - private boolean ignoreErrors; - private boolean ignoreMissingBeginEnd; - private String readAhead; - - /** - * Create a UUdecoder that decodes the specified input stream. - * The System property mail.mime.uudecode.ignoreerrors - * controls whether errors in the encoded data cause an exception - * or are ignored. The default is false (errors cause exception). - * The System property mail.mime.uudecode.ignoremissingbeginend - * controls whether a missing begin or end line cause an exception - * or are ignored. The default is false (errors cause exception). - * @param in the input stream - */ - public UUDecoderStream(InputStream in) { - super(in); - lin = new LineInputStream(in); - // default to false - ignoreErrors = PropUtil.getBooleanSystemProperty( - "mail.mime.uudecode.ignoreerrors", false); - // default to false - ignoreMissingBeginEnd = PropUtil.getBooleanSystemProperty( - "mail.mime.uudecode.ignoremissingbeginend", false); - } - - /** - * Create a UUdecoder that decodes the specified input stream. - * @param in the input stream - * @param ignoreErrors ignore errors? - * @param ignoreMissingBeginEnd ignore missing begin or end? - */ - public UUDecoderStream(InputStream in, boolean ignoreErrors, - boolean ignoreMissingBeginEnd) { - super(in); - lin = new LineInputStream(in); - this.ignoreErrors = ignoreErrors; - this.ignoreMissingBeginEnd = ignoreMissingBeginEnd; - } - - /** - * Read the next decoded byte from this input stream. The byte - * is returned as an int in the range 0 - * to 255. If no byte is available because the end of - * the stream has been reached, the value -1 is returned. - * This method blocks until input data is available, the end of the - * stream is detected, or an exception is thrown. - * - * @return next byte of data, or -1 if the end of - * stream is reached. - * @exception IOException if an I/O error occurs. - * @see java.io.FilterInputStream#in - */ - @Override - public int read() throws IOException { - if (index >= bufsize) { - readPrefix(); - if (!decode()) { - return -1; - } - index = 0; // reset index into buffer - } - return buffer[index++] & 0xff; // return lower byte - } - - @Override - public int read(byte[] buf, int off, int len) throws IOException { - int i, c; - for (i = 0; i < len; i++) { - if ((c = read()) == -1) { - if (i == 0) {// At end of stream, so we should - i = -1; // return -1, NOT 0. - } - break; - } - buf[off+i] = (byte)c; - } - return i; - } - - @Override - public boolean markSupported() { - return false; - } - - @Override - public int available() throws IOException { - // This is only an estimate, since in.available() - // might include CRLFs too .. - return ((in.available() * 3)/4 + (bufsize-index)); - } - - /** - * Get the "name" field from the prefix. This is meant to - * be the pathname of the decoded file - * - * @return name of decoded file - * @exception IOException if an I/O error occurs. - */ - public String getName() throws IOException { - readPrefix(); - return name; - } - - /** - * Get the "mode" field from the prefix. This is the permission - * mode of the source file. - * - * @return permission mode of source file - * @exception IOException if an I/O error occurs. - */ - public int getMode() throws IOException { - readPrefix(); - return mode; - } - - /** - * UUencoded streams start off with the line: - * "begin " - * Search for this prefix and gobble it up. - */ - private void readPrefix() throws IOException { - if (gotPrefix) { - return; - } - - mode = 0666; // defaults, overridden below - name = "encoder.buf"; // same default used by encoder - String line; - for (;;) { - // read till we get the prefix: "begin MODE FILENAME" - line = lin.readLine(); // NOTE: readLine consumes CRLF pairs too - if (line == null) { - if (!ignoreMissingBeginEnd) { - throw new DecodingException("UUDecoder: Missing begin"); - } - // at EOF, fake it - gotPrefix = true; - gotEnd = true; - break; - } - if (line.regionMatches(false, 0, "begin", 0, 5)) { - try { - mode = Integer.parseInt(line.substring(6,9)); - } catch (NumberFormatException ex) { - if (!ignoreErrors) { - throw new DecodingException( - "UUDecoder: Error in mode: " + ex.toString()); - } - } - if (line.length() > 10) { - name = line.substring(10); - } else { - if (!ignoreErrors) { - throw new DecodingException( - "UUDecoder: Missing name: " + line); - } - } - gotPrefix = true; - break; - } else if (ignoreMissingBeginEnd && line.length() != 0) { - int count = line.charAt(0); - count = (count - ' ') & 0x3f; - int need = ((count * 8)+5)/6; - if (need == 0 || line.length() >= need + 1) { - /* - * Looks like a legitimate encoded line. - * Pretend we saw the "begin" line and - * save this line for later processing in - * decode(). - */ - readAhead = line; - gotPrefix = true; // fake it - break; - } - } - } - } - - private boolean decode() throws IOException { - - if (gotEnd) { - return false; - } - bufsize = 0; - int count = 0; - String line; - for (;;) { - /* - * If we ignored a missing "begin", the first line - * will be saved in readAhead. - */ - if (readAhead != null) { - line = readAhead; - readAhead = null; - } else { - line = lin.readLine(); - } - - /* - * Improperly encoded data sometimes omits the zero length - * line that starts with a space character, we detect the - * following "end" line here. - */ - if (line == null) { - if (!ignoreMissingBeginEnd) { - throw new DecodingException( - "UUDecoder: Missing end at EOF"); - } - gotEnd = true; - return false; - } - if (line.equals("end")) { - gotEnd = true; - return false; - } - if (line.length() == 0) { - continue; - } - count = line.charAt(0); - if (count < ' ') { - if (!ignoreErrors) { - throw new DecodingException( - "UUDecoder: Buffer format error"); - } - continue; - } - - /* - * The first character in a line is the number of original (not - * the encoded atoms) characters in the line. Note that all the - * code below has to handle the character that indicates - * end of encoded stream. - */ - count = (count - ' ') & 0x3f; - - if (count == 0) { - line = lin.readLine(); - if (line == null || !line.equals("end")) { - if (!ignoreMissingBeginEnd) { - throw new DecodingException( - "UUDecoder: Missing End after count 0 line"); - } - } - gotEnd = true; - return false; - } - - int need = ((count * 8)+5)/6; -//System.out.println("count " + count + ", need " + need + ", len " + line.length()); - if (line.length() < need + 1) { - if (!ignoreErrors) { - throw new DecodingException( - "UUDecoder: Short buffer error"); - } - continue; - } - - // got a line we're committed to, break out and decode it - break; - } - - int i = 1; - byte a, b; - /* - * A correct uuencoder always encodes 3 characters at a time, even - * if there aren't 3 characters left. But since some people out - * there have broken uuencoders we handle the case where they - * don't include these "unnecessary" characters. - */ - while (bufsize < count) { - // continue decoding until we get 'count' decoded chars - a = (byte)((line.charAt(i++) - ' ') & 0x3f); - b = (byte)((line.charAt(i++) - ' ') & 0x3f); - buffer[bufsize++] = (byte)(((a << 2) & 0xfc) | ((b >>> 4) & 3)); - - if (bufsize < count) { - a = b; - b = (byte)((line.charAt(i++) - ' ') & 0x3f); - buffer[bufsize++] = - (byte)(((a << 4) & 0xf0) | ((b >>> 2) & 0xf)); - } - - if (bufsize < count) { - a = b; - b = (byte)((line.charAt(i++) - ' ') & 0x3f); - buffer[bufsize++] = (byte)(((a << 6) & 0xc0) | (b & 0x3f)); - } - } - return true; - } - - /*** begin TEST program ***** - public static void main(String argv[]) throws Exception { - FileInputStream infile = new FileInputStream(argv[0]); - UUDecoderStream decoder = new UUDecoderStream(infile); - int c; - - try { - while ((c = decoder.read()) != -1) - System.out.write(c); - System.out.flush(); - } catch (Exception e) { - e.printStackTrace(); - } - } - **** end TEST program ****/ -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/mimepull/WeakDataFile.java 2018-01-30 20:38:23.000000000 -0500 +++ /dev/null 2018-01-30 20:38:23.000000000 -0500 @@ -1,182 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.mimepull; - -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardCopyOption; -import java.util.concurrent.TimeUnit; - -import java.io.File; -import java.io.IOException; -import java.io.RandomAccessFile; -import java.lang.ref.ReferenceQueue; -import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.ScheduledExecutorService; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Removing files based on this - * article - * - * @author Jitendra Kotamraju - */ -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(); - private final File file; - 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()); - } - ScheduledExecutorService scheduler = executorFactory.getScheduledExecutorService(); - scheduler.scheduleWithFixedDelay(new CleanupRunnable(), delay, delay, TimeUnit.SECONDS); - hasCleanUpExecutor = true; - } - } - - WeakDataFile(DataFile df, File file) { - super(df, refQueue); - refList.add(this); - this.file = file; - try { - raf = new RandomAccessFile(file, "rw"); - } catch(IOException ioe) { - throw new MIMEParsingException(ioe); - } - if (!hasCleanUpExecutor) { - drainRefQueueBounded(); - } - } - - synchronized void read(long pointer, byte[] buf, int offset, int length ) { - try { - raf.seek(pointer); - raf.readFully(buf, offset, length); - } catch(IOException ioe) { - throw new MIMEParsingException(ioe); - } - } - - synchronized long writeTo(long pointer, byte[] data, int offset, int length) { - try { - raf.seek(pointer); - raf.write(data, offset, length); - return raf.getFilePointer(); // Update pointer for next write - } catch(IOException ioe) { - throw new MIMEParsingException(ioe); - } - } - - void close() { - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "Deleting file = {0}", file.getName()); - } - refList.remove(this); - try { - raf.close(); - boolean deleted = file.delete(); - if (!deleted) { - if (LOGGER.isLoggable(Level.INFO)) { - LOGGER.log(Level.INFO, "File {0} was not deleted", file.getAbsolutePath()); - } - } - } catch(IOException ioe) { - throw new MIMEParsingException(ioe); - } - } - - void renameTo(File f) { - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "Moving file={0} to={1}", new Object[]{file, f}); - } - refList.remove(this); - try { - raf.close(); - Path target = Files.move(file.toPath(), f.toPath(), StandardCopyOption.REPLACE_EXISTING); - boolean renamed = f.toPath().equals(target); - if (!renamed) { - if (LOGGER.isLoggable(Level.INFO)) { - throw new MIMEParsingException("File " + file.getAbsolutePath() + - " was not moved to " + f.getAbsolutePath()); - } - } - } catch(IOException ioe) { - throw new MIMEParsingException(ioe); - } - - } - - static void drainRefQueueBounded() { - WeakDataFile weak; - while (( weak = (WeakDataFile) refQueue.poll()) != null ) { - if (LOGGER.isLoggable(Level.FINE)) { - LOGGER.log(Level.FINE, "Cleaning file = {0} from reference queue.", weak.file); - } - 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/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/Base64Data.java 2018-01-30 20:38:24.000000000 -0500 +++ /dev/null 2018-01-30 20:38:24.000000000 -0500 @@ -1,547 +0,0 @@ -/* - * 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; - -import javax.activation.DataHandler; -import javax.activation.DataSource; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import java.util.logging.Level; -import java.util.logging.Logger; - -// for testing method -//import com.sun.xml.internal.stream.writers.XMLStreamWriterImpl; -//import java.io.FileNotFoundException; -//import java.io.FileWriter; -//import javax.activation.FileDataSource; - -/** - * Binary data represented as base64-encoded string - * in XML. - * - *

- * Used in conjunction with {@link XMLStreamReaderEx} - * and {@link XMLStreamWriterEx}. - * - * @author Kohsuke Kawaguchi, Martin Grebac - */ -public class Base64Data implements CharSequence, Cloneable { - - // either dataHandler or (data,dataLen,mimeType?) must be present - // (note that having both is allowed) - - private DataHandler dataHandler; - private byte[] data; - private String hrefCid; - - /** - * Length of the valid data in {@link #data}. - */ - private int dataLen; - /** - * True if {@link #data} can be cloned by reference - * if Base64Data instance is cloned. - */ - private boolean dataCloneByRef; - /** - * Optional MIME type of {@link #data}. - * - * Unused when {@link #dataHandler} is set. - * Use {@link DataHandler#getContentType()} in that case. - */ - private String mimeType; - - /** - * Default constructor - */ - public Base64Data() { - } - - private static final Logger logger = Logger.getLogger(Base64Data.class.getName()); - - /** - * Clone constructor - * @param that needs to be cloned - */ - public Base64Data(Base64Data that) { - that.get(); - if (that.dataCloneByRef) { - this.data = that.data; - } else { - this.data = new byte[that.dataLen]; - System.arraycopy(that.data, 0, this.data, 0, that.dataLen); - } - - this.dataCloneByRef = true; - this.dataLen = that.dataLen; - this.dataHandler = null; - this.mimeType = that.mimeType; - } - - /** - * Fills in the data object by a portion of the byte[]. - * - * @param data actual data - * @param len - * data[0] to data[len-1] are treated as the data. - * @param mimeType MIME type - * @param cloneByRef - * true if data[] can be cloned by reference - */ - public void set(byte[] data, int len, String mimeType, boolean cloneByRef) { - this.data = data; - this.dataLen = len; - this.dataCloneByRef = cloneByRef; - this.dataHandler = null; - this.mimeType = mimeType; - } - - /** - * Fills in the data object by a portion of the byte[]. - * - * @param data actual data bytes - * @param len - * data[0] to data[len-1] are treated as the data. - * @param mimeType MIME type - */ - public void set(byte[] data, int len, String mimeType) { - set(data,len,mimeType,false); - } - - /** - * Fills in the data object by the byte[] of the exact length. - * - * @param data - * this buffer may be owned directly by the unmarshaleld JAXB object. - * @param mimeType MIME type - */ - public void set(byte[] data,String mimeType) { - set(data,data.length,mimeType,false); - } - - /** - * Fills in the data object by a {@link DataHandler}. - * - * @param data DataHandler for the data - */ - public void set(DataHandler data) { - assert data!=null; - this.dataHandler = data; - this.data = null; - } - - /** - * Gets the raw data. If the returned DataHandler is {@link StreamingDataHandler}, - * callees may need to downcast to take advantage of its capabilities. - * - * @see StreamingDataHandler - * @return DataHandler for the data - */ - public DataHandler getDataHandler() { - if(dataHandler==null){ - dataHandler = new Base64StreamingDataHandler(new Base64DataSource()); - } else if (!(dataHandler instanceof StreamingDataHandler)) { - dataHandler = new FilterDataHandler(dataHandler); - } - return dataHandler; - } - - private final class Base64DataSource implements DataSource { - public String getContentType() { - return getMimeType(); - } - - public InputStream getInputStream() { - return new ByteArrayInputStream(data,0,dataLen); - } - - public String getName() { - return null; - } - - public OutputStream getOutputStream() { - throw new UnsupportedOperationException(); - } - - } - - private final class Base64StreamingDataHandler extends StreamingDataHandler { - - Base64StreamingDataHandler(DataSource source) { - super(source); - } - - public InputStream readOnce() throws IOException { - return getDataSource().getInputStream(); - } - - public void moveTo(File dst) throws IOException { - FileOutputStream fout = new FileOutputStream(dst); - try { - fout.write(data, 0, dataLen); - } finally { - fout.close(); - } - } - - public void close() throws IOException { - // nothing to do - } - } - - private static final class FilterDataHandler extends StreamingDataHandler { - - FilterDataHandler(DataHandler dh) { - super(dh.getDataSource()); - } - - public InputStream readOnce() throws IOException { - return getDataSource().getInputStream(); - } - - public void moveTo(File dst) throws IOException { - byte[] buf = new byte[8192]; - InputStream in = null; - OutputStream out = null; - try { - in = getDataSource().getInputStream(); - out = new FileOutputStream(dst); - while (true) { - int amountRead = in.read(buf); - if (amountRead == -1) { - break; - } - out.write(buf, 0, amountRead); - } - } finally { - if (in != null) { - try { - in.close(); - } catch(IOException ioe) { - // nothing to do - } - } - if (out != null) { - try { - out.close(); - } catch(IOException ioe) { - // nothing to do - } - } - } - } - - public void close() throws IOException { - // nothing to do - } - } - - /** - * Gets the byte[] of the exact length. - * - * @return byte[] for data - */ - public byte[] getExact() { - get(); - if(dataLen!=data.length) { - byte[] buf = new byte[dataLen]; - System.arraycopy(data,0,buf,0,dataLen); - data = buf; - } - return data; - } - - /** - * Gets the data as an {@link InputStream}. - * - * @return data as InputStream - * @throws IOException if i/o error occurs - */ - public InputStream getInputStream() throws IOException { - if(dataHandler!=null) { - return dataHandler.getInputStream(); - } else { - return new ByteArrayInputStream(data,0,dataLen); - } - } - - /** - * Returns false if this object only has {@link DataHandler} and therefore - * {@link #get()} operation is likely going to be expensive. - * - * @return false if it has only DataHandler - */ - public boolean hasData() { - return data!=null; - } - - /** - * Gets the raw data. The size of the byte array maybe larger than the actual length. - * - * @return data as byte[], the array may be larger - */ - public byte[] get() { - if(data==null) { - try { - ByteArrayOutputStreamEx baos = new ByteArrayOutputStreamEx(1024); - InputStream is = dataHandler.getDataSource().getInputStream(); - baos.readFrom(is); - is.close(); - data = baos.getBuffer(); - dataLen = baos.size(); - dataCloneByRef = true; - } catch (IOException e) { - // TODO: report the error to the unmarshaller - dataLen = 0; // recover by assuming length-0 data - } - } - return data; - } - - /** - * Gets the length of the binary data counted in bytes. - * - * Note that if this object encapsulates {@link DataHandler}, - * this method would have to read the whole thing into {@code byte[]} - * just to count the length, because {@link DataHandler} - * doesn't easily expose the length. - * - * @return no of bytes - */ - public int getDataLen() { - get(); - return dataLen; - } - - public String getMimeType() { - if (mimeType==null) { - return "application/octet-stream"; - } - return mimeType; - } - - /** - * Gets the number of characters needed to represent - * this binary data in the base64 encoding. - */ - public int length() { - // for each 3 bytes you use 4 chars - // if the remainder is 1 or 2 there will be 4 more - get(); // fill in the buffer if necessary - return ((dataLen+2)/3)*4; - } - - /** - * Encode this binary data in the base64 encoding - * and returns the character at the specified position. - */ - public char charAt(int index) { - // we assume that the length() method is called before this method - // (otherwise how would the caller know that the index is valid?) - // so we assume that the byte[] is already populated - - int offset = index%4; - int base = (index/4)*3; - - byte b1,b2; - - switch(offset) { - case 0: - return Base64Encoder.encode(data[base]>>2); - case 1: - if (base+1>4)&0xF)); - case 2: - if (base+1>6)&0x3)); - } else { - return '='; - } - case 3: - if(base+2>2); - buf[ptr++] = encode(((input[i])&0x3)<<4); - buf[ptr++] = '='; - buf[ptr++] = '='; - break; - case 2: - buf[ptr++] = encode(input[i]>>2); - buf[ptr++] = encode( - ((input[i]&0x3)<<4) | - ((input[i+1]>>4)&0xF)); - buf[ptr++] = encode((input[i+1]&0xF)<<2); - buf[ptr++] = '='; - break; - default: - buf[ptr++] = encode(input[i]>>2); - buf[ptr++] = encode( - ((input[i]&0x3)<<4) | - ((input[i+1]>>4)&0xF)); - buf[ptr++] = encode( - ((input[i+1]&0xF)<<2)| - ((input[i+2]>>6)&0x3)); - buf[ptr++] = encode(input[i+2]&0x3F); - break; - } - } - return ptr; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/Base64EncoderStream.java 2018-01-30 20:38:26.000000000 -0500 +++ /dev/null 2018-01-30 20:38:26.000000000 -0500 @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2011, 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.org.jvnet.staxex; - -import java.io.*; -import java.util.logging.Level; -import java.util.logging.Logger; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -// for testing method -//import com.sun.xml.internal.stream.writers.XMLStreamWriterImpl; - -/** - * This class implements a BASE64 Encoder. It is implemented as - * a FilterOutputStream, so one can just wrap this class around - * any output stream and write bytes into this filter. The Encoding - * is done as the bytes are written out. - * - * @author John Mani - * @author Bill Shannon - * @author Martin Grebac - */ - -public class Base64EncoderStream extends FilterOutputStream { - private byte[] buffer; // cache of bytes that are yet to be encoded - private int bufsize = 0; // size of the cache - - private XMLStreamWriter outWriter; - - public Base64EncoderStream(OutputStream out) { - super(out); - buffer = new byte[3]; - } - - /** - * Create a BASE64 encoder that encodes the specified input stream - */ - public Base64EncoderStream(XMLStreamWriter outWriter, OutputStream out) { - super(out); - buffer = new byte[3]; - this.outWriter = outWriter; - } - - /** - * Encodes len bytes from the specified - * byte array starting at offset off to - * this output stream. - * - * @param b the data. - * @param off the start offset in the data. - * @param len the number of bytes to write. - * @exception IOException if an I/O error occurs. - */ - @Override - public void write(byte[] b, int off, int len) throws IOException { - for (int i = 0; i < len; i++) - write(b[off + i]); - } - - /** - * Encodes b.length bytes to this output stream. - * @param b the data to be written. - * @exception IOException if an I/O error occurs. - */ - @Override - public void write(byte[] b) throws IOException { - write(b, 0, b.length); - } - - /** - * Encodes the specified byte to this output stream. - * @param c the byte. - * @exception IOException if an I/O error occurs. - */ - @Override - public void write(int c) throws IOException { - buffer[bufsize++] = (byte)c; - if (bufsize == 3) { // Encoding unit = 3 bytes - encode(); - bufsize = 0; - } - } - - /** - * Flushes this output stream and forces any buffered output bytes - * to be encoded out to the stream. - * @exception IOException if an I/O error occurs. - */ - @Override - public void flush() throws IOException { - if (bufsize > 0) { // If there's unencoded characters in the buffer .. - encode(); // .. encode them - bufsize = 0; - } - out.flush(); - try { - outWriter.flush(); - } catch (XMLStreamException ex) { - Logger.getLogger(Base64EncoderStream.class.getName()).log(Level.SEVERE, null, ex); - throw new IOException(ex); - } - } - - /** - * Forces any buffered output bytes to be encoded out to the stream - * and closes this output stream - */ - @Override - public void close() throws IOException { - flush(); - out.close(); - } - - /** This array maps the characters to their 6 bit values */ - private final static char pem_array[] = { - 'A','B','C','D','E','F','G','H', // 0 - 'I','J','K','L','M','N','O','P', // 1 - 'Q','R','S','T','U','V','W','X', // 2 - 'Y','Z','a','b','c','d','e','f', // 3 - 'g','h','i','j','k','l','m','n', // 4 - 'o','p','q','r','s','t','u','v', // 5 - 'w','x','y','z','0','1','2','3', // 6 - '4','5','6','7','8','9','+','/' // 7 - }; - - private void encode() throws IOException { - byte a, b, c; - char[] buf = new char[4]; - if (bufsize == 1) { - a = buffer[0]; - b = 0; - c = 0; - buf[0] = pem_array[(a >>> 2) & 0x3F]; - buf[1] = pem_array[((a << 4) & 0x30) + ((b >>> 4) & 0xf)]; - buf[2] = '='; // pad character - buf[3] = '='; // pad character - } else if (bufsize == 2) { - a = buffer[0]; - b = buffer[1]; - c = 0; - buf[0] = pem_array[(a >>> 2) & 0x3F]; - buf[1] = pem_array[((a << 4) & 0x30) + ((b >>> 4) & 0xf)]; - buf[2] = pem_array[((b << 2) & 0x3c) + ((c >>> 6) & 0x3)]; - buf[3] = '='; // pad character - } else { - a = buffer[0]; - b = buffer[1]; - c = buffer[2]; - buf[0] = pem_array[(a >>> 2) & 0x3F]; - buf[1] = pem_array[((a << 4) & 0x30) + ((b >>> 4) & 0xf)]; - buf[2] = pem_array[((b << 2) & 0x3c) + ((c >>> 6) & 0x3)]; - buf[3] = pem_array[c & 0x3F]; - } - try { - outWriter.writeCharacters(buf, 0, 4); - } catch (XMLStreamException ex) { - Logger.getLogger(Base64EncoderStream.class.getName()).log(Level.SEVERE, null, ex); - throw new IOException(ex); - } - } - -// public static void main(String argv[]) throws Exception { -// FileInputStream infile = new FileInputStream(new File(argv[0])); -// StringWriter sw = new StringWriter(); -// XMLStreamWriterImpl wi = new XMLStreamWriterImpl(sw, null); -// ByteArrayOutputStream baos = new ByteArrayOutputStream(); -// Base64EncoderStream encoder = new Base64EncoderStream(wi, baos); -// int c; -// -// while ((c = infile.read()) != -1) -// encoder.write(c); -// encoder.close(); -// -// System.out.println("SW: " + sw.toString()); -// System.out.println("BAOS: " + baos.toString()); -// -// } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/BinaryText.java 2018-01-30 20:38:27.000000000 -0500 +++ /dev/null 2018-01-30 20:38:27.000000000 -0500 @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2013, 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; - -/** - * BinaryText represents a MTOM attachment. - * - * @author shih-chang.chen@oracle.com - */ -public interface BinaryText { - public String getHref(); - public DataHandler getDataHandler(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/ByteArrayOutputStreamEx.java 2018-01-30 20:38:27.000000000 -0500 +++ /dev/null 2018-01-30 20:38:27.000000000 -0500 @@ -1,70 +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.org.jvnet.staxex; - -import java.io.ByteArrayOutputStream; -import java.io.InputStream; -import java.io.IOException; - -/** - * {@link ByteArrayOutputStream} with access to its raw buffer. - * - * @author Kohsuke Kawaguchi - */ -final class ByteArrayOutputStreamEx extends ByteArrayOutputStream { - public ByteArrayOutputStreamEx() { - } - - public ByteArrayOutputStreamEx(int size) { - super(size); - } - - public void set(Base64Data dt,String mimeType) { - dt.set(buf,count,mimeType); - } - - public byte[] getBuffer() { - return buf; - } - - /** - * Reads the given {@link InputStream} completely into the buffer. - */ - public void readFrom(InputStream is) throws IOException { - while(true) { - if(count==buf.length) { - // realllocate - byte[] data = new byte[buf.length*2]; - System.arraycopy(buf,0,data,0,buf.length); - buf = data; - } - - int sz = is.read(buf,count,buf.length-count); - if(sz<0) return; - count += sz; - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/MtomEnabled.java 2018-01-30 20:38:28.000000000 -0500 +++ /dev/null 2018-01-30 20:38:28.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * 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); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/NamespaceContextEx.java 2018-01-30 20:38:29.000000000 -0500 +++ /dev/null 2018-01-30 20:38:29.000000000 -0500 @@ -1,96 +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.org.jvnet.staxex; - -import javax.xml.namespace.NamespaceContext; -import java.util.Iterator; - -/** - * Extended {@link NamespaceContext}. - * - * @author Kohsuke Kawaguchi - * @author Paul Sandoz - */ -public interface NamespaceContextEx extends NamespaceContext, Iterable { - - /** - * Iterates all the in-scope namespace bindings. - * - *

- * This method enumerates all the active in-scope namespace bindings. - * This does not include implicit bindings, such as - * {@code "xml"->"http://www.w3.org/XML/1998/namespace"} - * or {@code ""->""} (the implicit default namespace URI.) - * - *

- * The returned iterator may not include the same prefix more than once. - * For example, the returned iterator may only contain {@code f=ns2} - * if the document is as follows and this method is used at the bar element. - * - *

{@code
-     * 
-     *   
-     *     ...
-     * }
- * - *

- * The iteration may be done in no particular order. - * - * @return - * may return an empty iterator, but never null. - */ - Iterator iterator(); - - /** - * Prefix to namespace URI binding. - */ - interface Binding { - /** - * Gets the prefix. - * - *

- * The default namespace URI is represented by using an - * empty string "", not null. - * - * @return - * never null. String like "foo", "ns12", or "". - */ - String getPrefix(); - - /** - * Gets the namespace URI. - * - *

- * The empty namespace URI is represented by using - * an empty string "", not null. - * - * @return - * never null. String like "http://www.w3.org/XML/1998/namespace", - * "urn:oasis:names:specification:docbook:dtd:xml:4.1.2", or "". - */ - String getNamespaceURI(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/StAxSOAPBody.java 2018-01-30 20:38:30.000000000 -0500 +++ /dev/null 2018-01-30 20:38:30.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2013, 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.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 - */ - 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 XMLStreamException - */ - public String getPayloadAttributeValue(String localName) throws XMLStreamException; - - /** - * Retrieve payload attribute value without materializing its contents - * @param qName - * @return - * @throws XMLStreamException - */ - public String getPayloadAttributeValue(QName qName) throws XMLStreamException; - - public void materialize() throws XMLStreamException; - } - - public void setPayload(Payload src) throws XMLStreamException; - - public Payload getPayload()throws XMLStreamException; - - public boolean hasStaxPayload(); - } --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/StreamingDataHandler.java 2018-01-30 20:38:31.000000000 -0500 +++ /dev/null 2018-01-30 20:38:31.000000000 -0500 @@ -1,154 +0,0 @@ -/* - * 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 - * 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.activation.DataSource; -import java.io.BufferedInputStream; -import java.io.Closeable; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - -/** - * {@link DataHandler} extended to offer better buffer management - * in a streaming environment. - * - *

- * {@link DataHandler} is used commonly as a data format across - * multiple systems (such as JAXB/WS.) Unfortunately, {@link DataHandler} - * has the semantics of "read as many times as you want", so this makes - * it difficult for involving parties to handle a BLOB in a streaming fashion. - * - *

- * {@link StreamingDataHandler} solves this problem by offering methods - * that enable faster bulk "consume once" read operation. - * - * @author Jitendra Kotamraju - */ -public abstract class StreamingDataHandler extends DataHandler implements Closeable { - - private String hrefCid; - - public StreamingDataHandler(Object o, String s) { - super(o, s); - } - - public StreamingDataHandler(URL url) { - super(url); - } - - public StreamingDataHandler(DataSource dataSource) { - super(dataSource); - } - - /** - * Works like {@link #getInputStream()} except that this method - * can be invoked only once. - * - *

- * This is used as a signal from the caller that there will - * be no further {@link #getInputStream()} invocation nor - * {@link #readOnce()} invocation on this object (which would - * result in {@link IOException}.) - * - *

- * When {@link DataHandler} is backed by a streaming BLOB - * (such as an attachment in a web service read from the network), - * this allows the callee to avoid unnecessary buffering. - * - *

- * Note that it is legal to call {@link #getInputStream()} - * multiple times and then call {@link #readOnce()} afterward. - * Streams created such a way can be read in any order — - * there's no requirement that streams created earlier must be read - * first. - * - * @return - * always non-null. Represents the content of this BLOB. - * The returned stream is generally not buffered, so for - * better performance read in a big batch or wrap this into - * {@link BufferedInputStream}. - * @throws IOException - * if any i/o error - */ - public abstract InputStream readOnce() throws IOException; - - /** - * Obtains the BLOB into a specified file. - * - *

- * Semantically, this method is roughly equivalent to the following - * code, except that the actual implementation is likely to be a lot faster. - * - *

-     * InputStream i = getInputStream();
-     * OutputStream o = new FileOutputStream(dst);
-     * int ch;
-     * while((ch=i.read())!=-1)  o.write(ch);
-     * i.close();
-     * o.close();
-     * 
- * - *

- * The main motivation behind this method is that often - * {@link DataHandler} that reads data from a streaming source - * will use a temporary file as a data store to hold data - * (think of commons-fileupload.) In such case this method - * can be as fast as calling {@link File#renameTo(File)}. - * - *

- * This method shouldn't be called when there are any - * open streams. - * - *

- * After this method is invoked, {@link #readOnce()} and - * {@link #getInputStream()} will simply open the destination - * file you've specified as an argument. So if you further - * move the file or delete this file, those methods will - * behave in undefined fashion. For a simliar reason, - * calling this method multiple times will cause - * undefined behavior. - */ - public abstract void moveTo(File dst) throws IOException; - - /** - * Releases any resources associated with this DataHandler. - * (such as an attachment in a web service read from a temp - * file will be deleted.) After calling this method, it is - * illegal to call any other methods. - */ - public abstract void close() throws IOException; - - public String getHrefCid() { - return hrefCid; - } - - public void setHrefCid(final String cid) { - this.hrefCid = cid; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/XMLStreamReaderEx.java 2018-01-30 20:38:31.000000000 -0500 +++ /dev/null 2018-01-30 20:38:31.000000000 -0500 @@ -1,185 +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.org.jvnet.staxex; - -import javax.xml.stream.XMLStreamReader; -import javax.xml.stream.XMLStreamException; - -/** - * {@link XMLStreamReader} extended for reading binary data. - * - *

- * Some producer of infoset (in particular, such as FastInfoset, - * XOP decoder), uses a native format that enables efficient - * treatment of binary data. For ordinary infoset consumer - * (that just uses {@link XMLStreamReader}, those binary data - * will just look like base64-encoded string, but this interface - * allows consumers of such infoset to access this raw binary data. - * Such infoset producer may choose to implement this additoinal - * interface, to expose this functionality. - * - *

- * Consumers that are capable of using this interface can query - * {@link XMLStreamReader} if it supports this by simply downcasting - * it to this interface like this: - * - *

- * XMLStreamReader reader = ...;
- * if( reader instanceof XMLStreamReaderEx ) {
- *   // this reader supports binary data exchange
- *   ...
- * } else {
- *   // noop
- *   ...
- * }
- * 
- * - *

- * Also note that it is also allowed for the infoset producer - * to implement this interface in such a way that {@link #getPCDATA()} - * always delegate to {@link #getText()}, although it's not desirable. - * - *

- * This interface is a private contract between such producers - * and consumers to allow them to exchange binary data without - * converting it to base64. - * - * @see XMLStreamWriterEx - * @author Kohsuke Kawaguchi - * @author Paul Sandoz - */ -public interface XMLStreamReaderEx extends XMLStreamReader { - ///** - // * Works like {@link XMLStreamReader#getText()} - // * but returns text as {@link DataSource}. - // * - // *

- // * This method can be invoked whenever {@link XMLStreamReader#getText()} - // * can be invoked. Invoking this method means the caller is assuming - // * that the text is (conceptually) base64-encoded binary data. - // * - // *

- // * This abstraction is necessary to treat XOP as infoset encoding. - // * That is, you can either access the XOP-attached binary through - // * {@link XMLStreamReader#getText()} (in which case you'll see the - // * base64 encoded string), or you can access it as a binary data - // * directly by using this method. - // * - // *

- // * Note that even if you are reading from non XOP-aware {@link XMLStreamReader}, - // * this method must be still supported; if the reader is pointing - // * to a text, this method is responsible for decoding base64 and - // * producing a {@link DataHandler} with "application/octet-stream" - // * as the content type. - // * - // * @return - // * always non-null valid object. - // * Invocations of this method may return the same object as long - // * as the {@link XMLStreamReader#next()} method is not used, - // * but otherwise {@link DataSource} object returned from this method - // * is considered to be owned by the client, and therefore it shouldn't - // * be reused by the implementation of this method. - // * - // *

- // * The returned {@link DataSource} is read-only, and the caller - // * must not invoke {@link DataSource#getOutputStream()}. - // * - // * @throws IllegalStateException - // * if the parser is not pointing at characters infoset item. - // * @throws XMLStreamException - // * if the parser points to text but text is not base64-encoded text, - // * or if some other parsing error occurs (such as if the {@code } - // * points to a non-existing attachment.) - // * - // *

- // * It is also OK for this method to return successfully, only to fail - // * during an {@link InputStream} is read from {@link DataSource}. - // */ - //DataSource getTextAsDataHandler() throws XMLStreamException; - - ///** - // * Works like {@link XMLStreamReader#getText()} - // * but returns text as {@link byte[]}. - // * - // *

- // * The contract of this method is mostly the same as - // * {@link #getTextAsDataHandler()}, except that this - // * method returns the binary datas as an exact-size byte[]. - // * - // *

- // * This method is also not capable of reporting the content type - // * of this binary data, even if it is available to the parser. - // * - // * @see #getTextAsDataHandler() - // */ - //byte[] getTextAsByteArray() throws XMLStreamException; - - /** - * Works like {@link #getText()} - * but hides the actual data representation. - * - * @return - * The {@link CharSequence} that represents the - * character infoset items at the current position. - * - *

- * The {@link CharSequence} is normally a {@link String}, - * but can be any other {@link CharSequence} implementation. - * For binary data, however, use of {@link Base64Data} is - * recommended (so that the consumer interested in seeing it - * as binary data may take advantage of mor efficient - * data representation.) - * - *

- * The object returned from this method belongs to the parser, - * and its content is guaranteed to be the same only until - * the {@link #next()} method is invoked. - * - * @throws IllegalStateException - * if the parser is not pointing at characters infoset item. - * - * TODO: - * fix the dependency to JAXB internal class. - */ - CharSequence getPCDATA() throws XMLStreamException; - - /** - * {@inheritDoc} - */ - NamespaceContextEx getNamespaceContext(); - - /** - * Works like {@link #getElementText()} but trims the leading - * and trailing whitespace. - * - *

- * The parser can often do this more efficiently than - * {@code getElementText().trim()}. - * - * @see #getElementText() - */ - String getElementTextTrim() throws XMLStreamException; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/XMLStreamWriterEx.java 2018-01-30 20:38:32.000000000 -0500 +++ /dev/null 2018-01-30 20:38:32.000000000 -0500 @@ -1,154 +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.org.jvnet.staxex; - -import javax.activation.DataHandler; -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import java.io.OutputStream; - -/** - * {@link XMLStreamWriter} extended to support XOP. - * - *

- * Some infoset serializer (such as XOP encoder, FastInfoset) uses a format - * that can represent binary data more efficiently than base64 encoding. - * Such infoset serializer may choose to implement this interface, to allow - * the caller to pass in binary data more efficiently without first converting - * it to binary data. - * - *

- * Callers capable of using this interface can see if the serializer supports - * it by simply downcasting {@link XMLStreamWriter} to {@link XMLStreamWriterEx}. - * - *

TODO

- *
    - *
  1. - * Add methods to write other primitive types, such as hex and integers - * (and arrays of). - * A textual implementation would write characters in accordance - * to the canonical lexical definitions specified in W3C XML Schema: datatypes. - * A MTOM implementation would write characters except for the case where octets - * that would otherwise be base64 encoded when using the textual implementation. - * A Fast Infoset implementation would encoded binary data the primitive types in - * binary form. - *
  2. - * Consider renaming writeBinary to writeBytesAsBase64 to be consistent with - * infoset abstraction. - *
  3. - * Add the ability to writeStart and writeEnd on attributes so that the same - * methods for writing primitive types (and characters, which will require new methods) - * can be used for writing attribute values as well as element content. - *
- * - * @see XMLStreamReaderEx - * @author Kohsuke Kawaguchi - * @author Paul Sandoz - */ -public interface XMLStreamWriterEx extends XMLStreamWriter { - - /** - * Write the binary data. - * - *

- * Conceptually (infoset-wise), this produces the base64-encoded binary data on the - * output. But this allows implementations like FastInfoset or XOP to do the smart - * thing. - * - *

- * The use of this method has some restriction to support XOP. Namely, this method - * must be invoked as a sole content of an element. - * - *

- * (data,start,len) triplet identifies the binary data to be written. - * After the method invocation, the callee owns the buffer. - * - * @param contentType - * this mandatory parameter identifies the MIME type of the binary data. - * If the MIME type isn't known by the caller, "application/octet-stream" can - * be always used to indicate "I don't know." Never null. - */ - void writeBinary(byte[] data, int start, int len, String contentType) throws XMLStreamException; - - /** - * Writes the binary data. - * - *

- * This method works like the {@link #writeBinary(byte[], int, int, String)} method, - * except that it takes the binary data in the form of {@link DataHandler}, which - * contains a MIME type ({@link DataHandler#getContentType()} as well as the payload - * {@link DataHandler#getInputStream()}. - * - * @param data - * always non-null. After this method call, the callee owns the data handler. - */ - void writeBinary(DataHandler data) throws XMLStreamException; - - /** - * Writes the binary data. - * - *

- * This version of the writeBinary method allows the caller to produce - * the binary data by writing it to {@link OutputStream}. - * - *

- * It is the caller's responsibility to write and close - * a stream before it invokes any other methods on {@link XMLStreamWriter}. - * - * TODO: experimental. appreciate feedback - * @param contentType - * See the content-type parameter of - * {@link #writeBinary(byte[], int, int, String)}. Must not be null. - * - * @return - * always return a non-null {@link OutputStream}. - */ - OutputStream writeBinary(String contentType) throws XMLStreamException; - - /** - * Writes like {@link #writeCharacters(String)} but hides - * actual data format. - * - * @param data - * The {@link CharSequence} that represents the - * character infoset items to be written. - * - *

- * The {@link CharSequence} is normally a {@link String}, - * but can be any other {@link CharSequence} implementation. - * For binary data, however, use of {@link Base64Data} is - * recommended (so that the consumer interested in seeing it - * as binary data may take advantage of mor efficient - * data representation.) - * - */ - void writePCDATA(CharSequence data) throws XMLStreamException; - - /** - * {@inheritDoc} - */ - NamespaceContextEx getNamespaceContext(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/util/DOMStreamReader.java 2018-01-30 20:38:33.000000000 -0500 +++ /dev/null 2018-01-30 20:38:33.000000000 -0500 @@ -1,895 +0,0 @@ -/* - * 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; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/util/DummyLocation.java 2018-01-30 20:38:34.000000000 -0500 +++ /dev/null 2018-01-30 20:38:34.000000000 -0500 @@ -1,55 +0,0 @@ -/* - * 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; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/util/FinalArrayList.java 2018-01-30 20:38:35.000000000 -0500 +++ /dev/null 2018-01-30 20:38:35.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * 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); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/util/MtomStreamWriter.java 2018-01-30 20:38:35.000000000 -0500 +++ /dev/null 2018-01-30 20:38:35.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * 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(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/org/jvnet/staxex/util/XMLStreamReaderToXMLStreamWriter.java 2018-01-30 20:38:36.000000000 -0500 +++ /dev/null 2018-01-30 20:38:36.000000000 -0500 @@ -1,297 +0,0 @@ -/* - * 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( - fixNull(in.getNamespacePrefix(i)), //StAX reader will return null for default NS - 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/java.xml.bind/share/classes/com/sun/xml/internal/txw2/Attribute.java 2018-01-30 20:38:37.000000000 -0500 +++ /dev/null 2018-01-30 20:38:37.000000000 -0500 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -/** - * @author Kohsuke Kawaguchi - */ -final class Attribute { - final String nsUri; - final String localName; - - /** - * Attributes of an element form a linked list. - */ - Attribute next; - - /** - * Attribute value that potentially contains dummy prefixes. - */ - final StringBuilder value = new StringBuilder(); - - Attribute(String nsUri, String localName) { - assert nsUri!=null && localName!=null; - - this.nsUri = nsUri; - this.localName = localName; - } - - boolean hasName( String nsUri, String localName ) { - return this.localName.equals(localName) && this.nsUri.equals(nsUri); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/Cdata.java 2018-01-30 20:38:38.000000000 -0500 +++ /dev/null 2018-01-30 20:38:38.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -/** - * CDATA section. - * - * @author Kohsuke Kawaguchi - */ -final class Cdata extends Text { - Cdata(Document document, NamespaceResolver nsResolver, Object obj) { - super(document, nsResolver, obj); - } - - void accept(ContentVisitor visitor) { - visitor.onCdata(buffer); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/Comment.java 2018-01-30 20:38:38.000000000 -0500 +++ /dev/null 2018-01-30 20:38:38.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -/** - * Comment. - * - * @author Kohsuke Kawaguchi - */ -final class Comment extends Content { - /** - * The text to be writtten. - */ - private final StringBuilder buffer = new StringBuilder(); - - public Comment(Document document, NamespaceResolver nsResolver, Object obj) { - document.writeValue(obj,nsResolver,buffer); - } - - boolean concludesPendingStartTag() { - return false; - } - - void accept(ContentVisitor visitor) { - visitor.onComment(buffer); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/ContainerElement.java 2018-01-30 20:38:39.000000000 -0500 +++ /dev/null 2018-01-30 20:38:39.000000000 -0500 @@ -1,376 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -import com.sun.xml.internal.txw2.annotation.XmlAttribute; -import com.sun.xml.internal.txw2.annotation.XmlElement; -import com.sun.xml.internal.txw2.annotation.XmlNamespace; -import com.sun.xml.internal.txw2.annotation.XmlValue; -import com.sun.xml.internal.txw2.annotation.XmlCDATA; - -import javax.xml.namespace.QName; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; - -/** - * Dynamically implements {@link TypedXmlWriter} interfaces. - * - * @author Kohsuke Kawaguchi - */ -final class ContainerElement implements InvocationHandler, TypedXmlWriter { - - final Document document; - - /** - * Initially, point to the start tag token, but - * once we know we are done with the start tag, we will reset it to null - * so that the token sequence can be GC-ed. - */ - StartTag startTag; - final EndTag endTag = new EndTag(); - - /** - * Namespace URI of this element. - */ - private final String nsUri; - - /** - * When this element can accept more child content, this value - * is non-null and holds the last child {@link Content}. - * - * If this element is committed, this parameter is null. - */ - private Content tail; - - /** - * Uncommitted {@link ContainerElement}s form a doubly-linked list, - * so that the parent can close them recursively. - */ - private ContainerElement prevOpen; - private ContainerElement nextOpen; - private final ContainerElement parent; - private ContainerElement lastOpenChild; - - /** - * Set to true if the start eleent is blocked. - */ - private boolean blocked; - - public ContainerElement(Document document,ContainerElement parent,String nsUri, String localName) { - this.parent = parent; - this.document = document; - this.nsUri = nsUri; - this.startTag = new StartTag(this,nsUri,localName); - tail = startTag; - - if(isRoot()) - document.setFirstContent(startTag); - } - - private boolean isRoot() { - return parent==null; - } - - private boolean isCommitted() { - return tail==null; - } - - public Document getDocument() { - return document; - } - - boolean isBlocked() { - return blocked && !isCommitted(); - } - - public void block() { - blocked = true; - } - - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - if(method.getDeclaringClass()==TypedXmlWriter.class || method.getDeclaringClass()==Object.class) { - // forward to myself - try { - return method.invoke(this,args); - } catch (InvocationTargetException e) { - throw e.getTargetException(); - } - } - - XmlAttribute xa = method.getAnnotation(XmlAttribute.class); - XmlValue xv = method.getAnnotation(XmlValue.class); - XmlElement xe = method.getAnnotation(XmlElement.class); - - - if(xa!=null) { - if(xv!=null || xe!=null) - throw new IllegalAnnotationException(method.toString()); - - addAttribute(xa,method,args); - return proxy; // allow method chaining - } - if(xv!=null) { - if(xe!=null) - throw new IllegalAnnotationException(method.toString()); - - _pcdata(args); - return proxy; // allow method chaining - } - - return addElement(xe,method,args); - } - - /** - * Writes an attribute. - */ - private void addAttribute(XmlAttribute xa, Method method, Object[] args) { - assert xa!=null; - - checkStartTag(); - - String localName = xa.value(); - if(xa.value().length()==0) - localName = method.getName(); - - _attribute(xa.ns(),localName,args); - } - - private void checkStartTag() { - if(startTag==null) - throw new IllegalStateException("start tag has already been written"); - } - - /** - * Writes a new element. - */ - private Object addElement(XmlElement e, Method method, Object[] args) { - Class rt = method.getReturnType(); - - // the last precedence: default name - String nsUri = "##default"; - String localName = method.getName(); - - if(e!=null) { - // then the annotation on this method - if(e.value().length()!=0) - localName = e.value(); - nsUri = e.ns(); - } - - if(nsUri.equals("##default")) { - // look for the annotation on the declaring class - Class c = method.getDeclaringClass(); - XmlElement ce = c.getAnnotation(XmlElement.class); - if(ce!=null) { - nsUri = ce.ns(); - } - - if(nsUri.equals("##default")) - // then default to the XmlNamespace - nsUri = getNamespace(c.getPackage()); - } - - - - if(rt==Void.TYPE) { - // leaf element with just a value - - boolean isCDATA = method.getAnnotation(XmlCDATA.class)!=null; - - StartTag st = new StartTag(document,nsUri,localName); - addChild(st); - for( Object arg : args ) { - Text text; - if(isCDATA) text = new Cdata(document,st,arg); - else text = new Pcdata(document,st,arg); - addChild(text); - } - addChild(new EndTag()); - return null; - } - if(TypedXmlWriter.class.isAssignableFrom(rt)) { - // sub writer - return _element(nsUri,localName,(Class)rt); - } - - throw new IllegalSignatureException("Illegal return type: "+rt); - } - - /** - * Decides the namespace URI of the given package. - */ - private String getNamespace(Package pkg) { - if(pkg==null) return ""; - - String nsUri; - XmlNamespace ns = pkg.getAnnotation(XmlNamespace.class); - if(ns!=null) - nsUri = ns.value(); - else - nsUri = ""; - return nsUri; - } - - /** - * Appends this child object to the tail. - */ - private void addChild(Content child) { - tail.setNext(document,child); - tail = child; - } - - public void commit() { - commit(true); - } - - public void commit(boolean includingAllPredecessors) { - _commit(includingAllPredecessors); - document.flush(); - } - - private void _commit(boolean includingAllPredecessors) { - if(isCommitted()) return; - - addChild(endTag); - if(isRoot()) - addChild(new EndDocument()); - tail = null; - - // _commit predecessors if so told - if(includingAllPredecessors) { - for( ContainerElement e=this; e!=null; e=e.parent ) { - while(e.prevOpen!=null) { - e.prevOpen._commit(false); - // e.prevOpen should change as a result of committing it. - } - } - } - - // _commit all children recursively - while(lastOpenChild!=null) - lastOpenChild._commit(false); - - // remove this node from the link - if(parent!=null) { - if(parent.lastOpenChild==this) { - assert nextOpen==null : "this must be the last one"; - parent.lastOpenChild = prevOpen; - } else { - assert nextOpen.prevOpen==this; - nextOpen.prevOpen = this.prevOpen; - } - if(prevOpen!=null) { - assert prevOpen.nextOpen==this; - prevOpen.nextOpen = this.nextOpen; - } - } - - this.nextOpen = null; - this.prevOpen = null; - } - - public void _attribute(String localName, Object value) { - _attribute("",localName,value); - } - - public void _attribute(String nsUri, String localName, Object value) { - checkStartTag(); - startTag.addAttribute(nsUri,localName,value); - } - - public void _attribute(QName attributeName, Object value) { - _attribute(attributeName.getNamespaceURI(),attributeName.getLocalPart(),value); - } - - public void _namespace(String uri) { - _namespace(uri,false); - } - - public void _namespace(String uri, String prefix) { - if(prefix==null) - throw new IllegalArgumentException(); - checkStartTag(); - startTag.addNamespaceDecl(uri,prefix,false); - } - - public void _namespace(String uri, boolean requirePrefix) { - checkStartTag(); - startTag.addNamespaceDecl(uri,null,requirePrefix); - } - - public void _pcdata(Object value) { - // we need to allow this method even when startTag has already been completed. - // checkStartTag(); - addChild(new Pcdata(document,startTag,value)); - } - - public void _cdata(Object value) { - addChild(new Cdata(document,startTag,value)); - } - - public void _comment(Object value) throws UnsupportedOperationException { - addChild(new Comment(document,startTag,value)); - } - - public T _element(String localName, Class contentModel) { - return _element(nsUri,localName,contentModel); - } - - public T _element(QName tagName, Class contentModel) { - return _element(tagName.getNamespaceURI(),tagName.getLocalPart(),contentModel); - } - - public T _element(Class contentModel) { - return _element(TXW.getTagName(contentModel),contentModel); - } - - public T _cast(Class facadeType) { - return facadeType.cast(Proxy.newProxyInstance(facadeType.getClassLoader(),new Class[]{facadeType},this)); - } - - public T _element(String nsUri, String localName, Class contentModel) { - ContainerElement child = new ContainerElement(document,this,nsUri,localName); - addChild(child.startTag); - tail = child.endTag; - - // update uncommitted link list - if(lastOpenChild!=null) { - assert lastOpenChild.parent==this; - - assert child.prevOpen==null; - assert child.nextOpen==null; - child.prevOpen = lastOpenChild; - assert lastOpenChild.nextOpen==null; - lastOpenChild.nextOpen = child; - } - - this.lastOpenChild = child; - - return child._cast(contentModel); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/Content.java 2018-01-30 20:38:40.000000000 -0500 +++ /dev/null 2018-01-30 20:38:40.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -/** - * @author Kohsuke Kawaguchi - */ -abstract class Content { - private Content next; - - /** - * Returns null if the next token has not decided yet. - */ - final Content getNext() { - return next; - } - - /** - * - * @param doc - * A {@link Content} object is so light-weight that - * it doesn't even remember what document it belongs to. - * So the caller needs to "remind" a {@link Content} - * who its owner is. - */ - final void setNext(Document doc,Content next) { - assert next!=null; - assert this.next==null : "next of "+this+" is already set to "+this.next; - this.next = next; - doc.run(); - } - - /** - * Returns true if this content is ready to be committed. - */ - boolean isReadyToCommit() { - return true; - } - - /** - * Returns true if this {@link Content} can guarantee that - * no more new namespace decls is necessary for the currently - * pending start tag. - */ - abstract boolean concludesPendingStartTag(); - - /** - * Accepts a visitor. - */ - abstract void accept(ContentVisitor visitor); - - /** - * Called when this content is written to the output. - */ - public void written() { - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/ContentVisitor.java 2018-01-30 20:38:41.000000000 -0500 +++ /dev/null 2018-01-30 20:38:41.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -/** - * Visits {@link Content}. - * - * @author Kohsuke Kawaguchi - */ -interface ContentVisitor { - void onStartDocument(); - - void onEndDocument(); - - void onEndTag(); - - void onPcdata(StringBuilder buffer); - - void onCdata(StringBuilder buffer); - - void onStartTag(String nsUri, String localName, Attribute attributes, NamespaceDecl namespaces); - - void onComment(StringBuilder buffer); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/DatatypeWriter.java 2018-01-30 20:38:42.000000000 -0500 +++ /dev/null 2018-01-30 20:38:42.000000000 -0500 @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -import java.util.AbstractList; -import java.util.Collections; -import java.util.List; -import javax.xml.namespace.QName; - -/** - * Pluggable datatype writer. - * - * @author Kohsuke Kawaguchi - */ -public interface DatatypeWriter

{ - - /** - * Gets the Java class that this writer can write. - * - * @return - * must not be null. Must be the same value always. - */ - Class
getType(); - - /** - * Prints the given datatype object and appends that result - * into the given buffer. - * - * @param dt - * the datatype object to be printed. - * @param resolver - * allows the converter to declare additional namespace prefixes. - */ - void print(DT dt, NamespaceResolver resolver, StringBuilder buf); - - static final List> BUILTIN = Collections.unmodifiableList(new AbstractList() { - - private DatatypeWriter[] BUILTIN_ARRAY = new DatatypeWriter[] { - new DatatypeWriter() { - public Class getType() { - return String.class; - } - public void print(String s, NamespaceResolver resolver, StringBuilder buf) { - buf.append(s); - } - }, - new DatatypeWriter() { - public Class getType() { - return Integer.class; - } - public void print(Integer i, NamespaceResolver resolver, StringBuilder buf) { - buf.append(i); - } - }, - new DatatypeWriter() { - public Class getType() { - return Float.class; - } - public void print(Float f, NamespaceResolver resolver, StringBuilder buf) { - buf.append(f); - } - }, - new DatatypeWriter() { - public Class getType() { - return Double.class; - } - public void print(Double d, NamespaceResolver resolver, StringBuilder buf) { - buf.append(d); - } - }, - new DatatypeWriter() { - public Class getType() { - return QName.class; - } - public void print(QName qn, NamespaceResolver resolver, StringBuilder buf) { - String p = resolver.getPrefix(qn.getNamespaceURI()); - if(p.length()!=0) - buf.append(p).append(':'); - buf.append(qn.getLocalPart()); - } - } - }; - - public DatatypeWriter get(int n) { - return BUILTIN_ARRAY[n]; - } - - public int size() { - return BUILTIN_ARRAY.length; - } - }); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/Document.java 2018-01-30 20:38:43.000000000 -0500 +++ /dev/null 2018-01-30 20:38:43.000000000 -0500 @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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.txw2; - -import com.sun.xml.internal.txw2.output.XmlSerializer; - -import java.util.Map; -import java.util.HashMap; - -/** - * Coordinates the entire writing process. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public final class Document { - - private final XmlSerializer out; - - /** - * Set to true once we invoke {@link XmlSerializer#startDocument()}. - * - *

- * This is so that we can defer the writing as much as possible. - */ - private boolean started=false; - - /** - * Currently active writer. - * - *

- * This points to the last written token. - */ - private Content current = null; - - private final Map datatypeWriters = new HashMap(); - - /** - * Used to generate unique namespace prefix. - */ - private int iota = 1; - - /** - * Used to keep track of in-scope namespace bindings declared in ancestors. - */ - private final NamespaceSupport inscopeNamespace = new NamespaceSupport(); - - /** - * Remembers the namespace declarations of the last unclosed start tag, - * so that we can fix up dummy prefixes in {@link Pcdata}. - */ - private NamespaceDecl activeNamespaces; - - - Document(XmlSerializer out) { - this.out = out; - for( DatatypeWriter dw : DatatypeWriter.BUILTIN ) - datatypeWriters.put(dw.getType(),dw); - } - - void flush() { - out.flush(); - } - - void setFirstContent(Content c) { - assert current==null; - current = new StartDocument(); - current.setNext(this,c); - } - - /** - * Defines additional user object {@code ->} string conversion logic. - * - *

- * Applications can add their own {@link DatatypeWriter} so that - * application-specific objects can be turned into {@link String} - * for output. - * - * @param dw - * The {@link DatatypeWriter} to be added. Must not be null. - */ - public void addDatatypeWriter( DatatypeWriter dw ) { - datatypeWriters.put(dw.getType(),dw); - } - - /** - * Performs the output as much as possible - */ - void run() { - while(true) { - Content next = current.getNext(); - if(next==null || !next.isReadyToCommit()) - return; - next.accept(visitor); - next.written(); - current = next; - } - } - - /** - * Appends the given object to the end of the given buffer. - * - * @param nsResolver - * use - */ - void writeValue( Object obj, NamespaceResolver nsResolver, StringBuilder buf ) { - if(obj==null) - throw new IllegalArgumentException("argument contains null"); - - if(obj instanceof Object[]) { - for( Object o : (Object[])obj ) - writeValue(o,nsResolver,buf); - return; - } - if(obj instanceof Iterable) { - for( Object o : (Iterable)obj ) - writeValue(o,nsResolver,buf); - return; - } - - if(buf.length()>0) - buf.append(' '); - - Class c = obj.getClass(); - while(c!=null) { - DatatypeWriter dw = datatypeWriters.get(c); - if(dw!=null) { - dw.print(obj,nsResolver,buf); - return; - } - c = c.getSuperclass(); - } - - // if nothing applies, just use toString - buf.append(obj); - } - - // I wanted to hide those write method from users - private final ContentVisitor visitor = new ContentVisitor() { - public void onStartDocument() { - // the startDocument token is used as the sentry, so this method shall never - // be called. - // out.startDocument() is invoked when we write the start tag of the root element. - throw new IllegalStateException(); - } - - public void onEndDocument() { - out.endDocument(); - } - - public void onEndTag() { - out.endTag(); - inscopeNamespace.popContext(); - activeNamespaces = null; - } - - public void onPcdata(StringBuilder buffer) { - if(activeNamespaces!=null) - buffer = fixPrefix(buffer); - out.text(buffer); - } - - public void onCdata(StringBuilder buffer) { - if(activeNamespaces!=null) - buffer = fixPrefix(buffer); - out.cdata(buffer); - } - - public void onComment(StringBuilder buffer) { - if(activeNamespaces!=null) - buffer = fixPrefix(buffer); - out.comment(buffer); - } - - public void onStartTag(String nsUri, String localName, Attribute attributes, NamespaceDecl namespaces) { - assert nsUri!=null; - assert localName!=null; - - activeNamespaces = namespaces; - - if(!started) { - started = true; - out.startDocument(); - } - - inscopeNamespace.pushContext(); - - // declare the explicitly bound namespaces - for( NamespaceDecl ns=namespaces; ns!=null; ns=ns.next ) { - ns.declared = false; // reset this flag - - if(ns.prefix!=null) { - String uri = inscopeNamespace.getURI(ns.prefix); - if(uri!=null && uri.equals(ns.uri)) - ; // already declared - else { - // declare this new binding - inscopeNamespace.declarePrefix(ns.prefix,ns.uri); - ns.declared = true; - } - } - } - - // then use in-scope namespace to assign prefixes to others - for( NamespaceDecl ns=namespaces; ns!=null; ns=ns.next ) { - if(ns.prefix==null) { - if(inscopeNamespace.getURI("").equals(ns.uri)) - ns.prefix=""; - else { - String p = inscopeNamespace.getPrefix(ns.uri); - if(p==null) { - // assign a new one - while(inscopeNamespace.getURI(p=newPrefix())!=null) - ; - ns.declared = true; - inscopeNamespace.declarePrefix(p,ns.uri); - } - ns.prefix = p; - } - } - } - - // the first namespace decl must be the one for the element - assert namespaces.uri.equals(nsUri); - assert namespaces.prefix!=null : "a prefix must have been all allocated"; - out.beginStartTag(nsUri,localName,namespaces.prefix); - - // declare namespaces - for( NamespaceDecl ns=namespaces; ns!=null; ns=ns.next ) { - if(ns.declared) - out.writeXmlns( ns.prefix, ns.uri ); - } - - // writeBody attributes - for( Attribute a=attributes; a!=null; a=a.next) { - String prefix; - if(a.nsUri.length()==0) prefix=""; - else prefix=inscopeNamespace.getPrefix(a.nsUri); - out.writeAttribute( a.nsUri, a.localName, prefix, fixPrefix(a.value) ); - } - - out.endStartTag(nsUri,localName,namespaces.prefix); - } - }; - - /** - * Used by {@link #newPrefix()}. - */ - private final StringBuilder prefixSeed = new StringBuilder("ns"); - - private int prefixIota = 0; - - /** - * Allocates a new unique prefix. - */ - private String newPrefix() { - prefixSeed.setLength(2); - prefixSeed.append(++prefixIota); - return prefixSeed.toString(); - } - - /** - * Replaces dummy prefixes in the value to the real ones - * by using {@link #activeNamespaces}. - * - * @return - * the buffer passed as the {@code buf} parameter. - */ - private StringBuilder fixPrefix(StringBuilder buf) { - assert activeNamespaces!=null; - - int i; - int len=buf.length(); - for(i=0;i - * This module, both source code and documentation, is in the - * Public Domain, and comes with NO WARRANTY. - * See http://www.saxproject.org - * for further information. - * - * - *

This class encapsulates the logic of Namespace processing: it - * tracks the declarations currently in force for each context and - * automatically processes qualified XML names into their Namespace - * parts; it can also be used in reverse for generating XML qnames - * from Namespaces.

- * - *

Namespace support objects are reusable, but the reset method - * must be invoked between each session.

- * - *

Here is a simple session:

- * - *
- * String parts[] = new String[3];
- * NamespaceSupport support = new NamespaceSupport();
- *
- * support.pushContext();
- * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
- * support.declarePrefix("dc", "http://www.purl.org/dc#");
- *
- * parts = support.processName("p", parts, false);
- * System.out.println("Namespace URI: " + parts[0]);
- * System.out.println("Local name: " + parts[1]);
- * System.out.println("Raw name: " + parts[2]);
- *
- * parts = support.processName("dc:title", parts, false);
- * System.out.println("Namespace URI: " + parts[0]);
- * System.out.println("Local name: " + parts[1]);
- * System.out.println("Raw name: " + parts[2]);
- *
- * support.popContext();
- * 
- * - *

Note that this class is optimized for the use case where most - * elements do not contain Namespace declarations: if the same - * prefix/URI mapping is repeated for each context (for example), this - * class will be somewhat less efficient.

- * - *

Although SAX drivers (parsers) may choose to use this class to - * implement namespace handling, they are not required to do so. - * Applications must track namespace information themselves if they - * want to use namespace information. - * - * @since SAX 2.0 - * @author David Megginson - * @version 2.0.1 (sax2r2) - */ -final class NamespaceSupport -{ - - - //////////////////////////////////////////////////////////////////// - // Constants. - //////////////////////////////////////////////////////////////////// - - - /** - * The XML Namespace URI as a constant. - * The value is http://www.w3.org/XML/1998/namespace - * as defined in the "Namespaces in XML" * recommendation. - * - *

This is the Namespace URI that is automatically mapped - * to the "xml" prefix.

- */ - public final static String XMLNS = - "http://www.w3.org/XML/1998/namespace"; - - - /** - * The namespace declaration URI as a constant. - * The value is http://www.w3.org/xmlns/2000/, as defined - * in a backwards-incompatible erratum to the "Namespaces in XML" - * recommendation. Because that erratum postdated SAX2, SAX2 defaults - * to the original recommendation, and does not normally use this URI. - * - * - *

This is the Namespace URI that is optionally applied to - * xmlns and xmlns:* attributes, which are used to - * declare namespaces.

- * - * @since SAX 2.1alpha - * @see #setNamespaceDeclUris - * @see #isNamespaceDeclUris - */ - public final static String NSDECL = - "http://www.w3.org/xmlns/2000/"; - - - /** - * An empty enumeration. - */ - private final static Enumeration EMPTY_ENUMERATION = - new Vector().elements(); - - - //////////////////////////////////////////////////////////////////// - // Constructor. - //////////////////////////////////////////////////////////////////// - - - /** - * Create a new Namespace support object. - */ - public NamespaceSupport () - { - reset(); - } - - - - //////////////////////////////////////////////////////////////////// - // Context management. - //////////////////////////////////////////////////////////////////// - - - /** - * Reset this Namespace support object for reuse. - * - *

It is necessary to invoke this method before reusing the - * Namespace support object for a new session. If namespace - * declaration URIs are to be supported, that flag must also - * be set to a non-default value. - *

- * - * @see #setNamespaceDeclUris - */ - public void reset () - { - contexts = new Context[32]; - namespaceDeclUris = false; - contextPos = 0; - contexts[contextPos] = currentContext = new Context(); - currentContext.declarePrefix("xml", XMLNS); - } - - - /** - * Start a new Namespace context. - * The new context will automatically inherit - * the declarations of its parent context, but it will also keep - * track of which declarations were made within this context. - * - *

Event callback code should start a new context once per element. - * This means being ready to call this in either of two places. - * For elements that don't include namespace declarations, the - * ContentHandler.startElement() callback is the right place. - * For elements with such a declaration, it'd done in the first - * ContentHandler.startPrefixMapping() callback. - * A boolean flag can be used to - * track whether a context has been started yet. When either of - * those methods is called, it checks the flag to see if a new context - * needs to be started. If so, it starts the context and sets the - * flag. After ContentHandler.startElement() - * does that, it always clears the flag. - * - *

Normally, SAX drivers would push a new context at the beginning - * of each XML element. Then they perform a first pass over the - * attributes to process all namespace declarations, making - * ContentHandler.startPrefixMapping() callbacks. - * Then a second pass is made, to determine the namespace-qualified - * names for all attributes and for the element name. - * Finally all the information for the - * ContentHandler.startElement() callback is available, - * so it can then be made. - * - *

The Namespace support object always starts with a base context - * already in force: in this context, only the "xml" prefix is - * declared.

- * - * @see org.xml.sax.ContentHandler - * @see #popContext - */ - public void pushContext () - { - int max = contexts.length; - - contextPos++; - - // Extend the array if necessary - if (contextPos >= max) { - Context newContexts[] = new Context[max*2]; - System.arraycopy(contexts, 0, newContexts, 0, max); - max *= 2; - contexts = newContexts; - } - - // Allocate the context if necessary. - currentContext = contexts[contextPos]; - if (currentContext == null) { - contexts[contextPos] = currentContext = new Context(); - } - - // Set the parent, if any. - if (contextPos > 0) { - currentContext.setParent(contexts[contextPos - 1]); - } - } - - - /** - * Revert to the previous Namespace context. - * - *

Normally, you should pop the context at the end of each - * XML element. After popping the context, all Namespace prefix - * mappings that were previously in force are restored.

- * - *

You must not attempt to declare additional Namespace - * prefixes after popping a context, unless you push another - * context first.

- * - * @see #pushContext - */ - public void popContext () - { - contexts[contextPos].clear(); - contextPos--; - if (contextPos < 0) { - throw new EmptyStackException(); - } - currentContext = contexts[contextPos]; - } - - - - //////////////////////////////////////////////////////////////////// - // Operations within a context. - //////////////////////////////////////////////////////////////////// - - - /** - * Declare a Namespace prefix. All prefixes must be declared - * before they are referenced. For example, a SAX driver (parser) - * would scan an element's attributes - * in two passes: first for namespace declarations, - * then a second pass using {@link #processName processName()} to - * interpret prefixes against (potentially redefined) prefixes. - * - *

This method declares a prefix in the current Namespace - * context; the prefix will remain in force until this context - * is popped, unless it is shadowed in a descendant context.

- * - *

To declare the default element Namespace, use the empty string as - * the prefix.

- * - *

Note that there is an asymmetry in this library: {@link - * #getPrefix getPrefix} will not return the "" prefix, - * even if you have declared a default element namespace. - * To check for a default namespace, - * you have to look it up explicitly using {@link #getURI getURI}. - * This asymmetry exists to make it easier to look up prefixes - * for attribute names, where the default prefix is not allowed.

- * - * @param prefix The prefix to declare, or the empty string to - * indicate the default element namespace. This may never have - * the value "xml" or "xmlns". - * @param uri The Namespace URI to associate with the prefix. - * @return true if the prefix was legal, false otherwise - * - * @see #processName - * @see #getURI - * @see #getPrefix - */ - public boolean declarePrefix (String prefix, String uri) - { - if (prefix.equals("xml") || prefix.equals("xmlns")) { - return false; - } else { - currentContext.declarePrefix(prefix, uri); - return true; - } - } - - - /** - * Process a raw XML qualified name, after all declarations in the - * current context have been handled by {@link #declarePrefix - * declarePrefix()}. - * - *

This method processes a raw XML qualified name in the - * current context by removing the prefix and looking it up among - * the prefixes currently declared. The return value will be the - * array supplied by the caller, filled in as follows:

- * - *
- *
parts[0]
- *
The Namespace URI, or an empty string if none is - * in use.
- *
parts[1]
- *
The local name (without prefix).
- *
parts[2]
- *
The original raw name.
- *
- * - *

All of the strings in the array will be internalized. If - * the raw name has a prefix that has not been declared, then - * the return value will be null.

- * - *

Note that attribute names are processed differently than - * element names: an unprefixed element name will receive the - * default Namespace (if any), while an unprefixed attribute name - * will not.

- * - * @param qName The XML qualified name to be processed. - * @param parts An array supplied by the caller, capable of - * holding at least three members. - * @param isAttribute A flag indicating whether this is an - * attribute name (true) or an element name (false). - * @return The supplied array holding three internalized strings - * representing the Namespace URI (or empty string), the - * local name, and the XML qualified name; or null if there - * is an undeclared prefix. - * @see #declarePrefix - * @see java.lang.String#intern */ - public String [] processName (String qName, String parts[], - boolean isAttribute) - { - String myParts[] = currentContext.processName(qName, isAttribute); - if (myParts == null) { - return null; - } else { - parts[0] = myParts[0]; - parts[1] = myParts[1]; - parts[2] = myParts[2]; - return parts; - } - } - - - /** - * Look up a prefix and get the currently-mapped Namespace URI. - * - *

This method looks up the prefix in the current context. - * Use the empty string ("") for the default Namespace.

- * - * @param prefix The prefix to look up. - * @return The associated Namespace URI, or null if the prefix - * is undeclared in this context. - * @see #getPrefix - * @see #getPrefixes - */ - public String getURI (String prefix) - { - return currentContext.getURI(prefix); - } - - - /** - * Return an enumeration of all prefixes whose declarations are - * active in the current context. - * This includes declarations from parent contexts that have - * not been overridden. - * - *

Note: if there is a default prefix, it will not be - * returned in this enumeration; check for the default prefix - * using the {@link #getURI getURI} with an argument of "".

- * - * @return An enumeration of prefixes (never empty). - * @see #getDeclaredPrefixes - * @see #getURI - */ - public Enumeration getPrefixes () - { - return currentContext.getPrefixes(); - } - - - /** - * Return one of the prefixes mapped to a Namespace URI. - * - *

If more than one prefix is currently mapped to the same - * URI, this method will make an arbitrary selection; if you - * want all of the prefixes, use the {@link #getPrefixes} - * method instead.

- * - *

Note: this will never return the empty (default) prefix; - * to check for a default prefix, use the {@link #getURI getURI} - * method with an argument of "".

- * - * @param uri the namespace URI - * @return one of the prefixes currently mapped to the URI supplied, - * or null if none is mapped or if the URI is assigned to - * the default namespace - * @see #getPrefixes(java.lang.String) - * @see #getURI - */ - public String getPrefix (String uri) - { - return currentContext.getPrefix(uri); - } - - - /** - * Return an enumeration of all prefixes for a given URI whose - * declarations are active in the current context. - * This includes declarations from parent contexts that have - * not been overridden. - * - *

This method returns prefixes mapped to a specific Namespace - * URI. The xml: prefix will be included. If you want only one - * prefix that's mapped to the Namespace URI, and you don't care - * which one you get, use the {@link #getPrefix getPrefix} - * method instead.

- * - *

Note: the empty (default) prefix is never included - * in this enumeration; to check for the presence of a default - * Namespace, use the {@link #getURI getURI} method with an - * argument of "".

- * - * @param uri The Namespace URI. - * @return An enumeration of prefixes (never empty). - * @see #getPrefix - * @see #getDeclaredPrefixes - * @see #getURI - */ - public Enumeration getPrefixes (String uri) - { - Vector prefixes = new Vector(); - Enumeration allPrefixes = getPrefixes(); - while (allPrefixes.hasMoreElements()) { - String prefix = (String)allPrefixes.nextElement(); - if (uri.equals(getURI(prefix))) { - prefixes.addElement(prefix); - } - } - return prefixes.elements(); - } - - - /** - * Return an enumeration of all prefixes declared in this context. - * - *

The empty (default) prefix will be included in this - * enumeration; note that this behaviour differs from that of - * {@link #getPrefix} and {@link #getPrefixes}.

- * - * @return An enumeration of all prefixes declared in this - * context. - * @see #getPrefixes - * @see #getURI - */ - public Enumeration getDeclaredPrefixes () - { - return currentContext.getDeclaredPrefixes(); - } - - /** - * Controls whether namespace declaration attributes are placed - * into the {@link #NSDECL NSDECL} namespace - * by {@link #processName processName()}. This may only be - * changed before any contexts have been pushed. - * - * @since SAX 2.1alpha - * - * @exception IllegalStateException when attempting to set this - * after any context has been pushed. - */ - public void setNamespaceDeclUris (boolean value) - { - if (contextPos != 0) - throw new IllegalStateException (); - if (value == namespaceDeclUris) - return; - namespaceDeclUris = value; - if (value) - currentContext.declarePrefix ("xmlns", NSDECL); - else { - contexts[contextPos] = currentContext = new Context(); - currentContext.declarePrefix("xml", XMLNS); - } - } - - /** - * Returns true if namespace declaration attributes are placed into - * a namespace. This behavior is not the default. - * - * @since SAX 2.1alpha - */ - public boolean isNamespaceDeclUris () - { return namespaceDeclUris; } - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - private Context contexts[]; - private Context currentContext; - private int contextPos; - private boolean namespaceDeclUris; - - - //////////////////////////////////////////////////////////////////// - // Internal classes. - //////////////////////////////////////////////////////////////////// - - /** - * Internal class for a single Namespace context. - * - *

This module caches and reuses Namespace contexts, - * so the number allocated - * will be equal to the element depth of the document, not to the total - * number of elements (i.e. 5-10 rather than tens of thousands). - * Also, data structures used to represent contexts are shared when - * possible (child contexts without declarations) to further reduce - * the amount of memory that's consumed. - *

- */ - final class Context { - - /** - * Create the root-level Namespace context. - */ - Context () - { - copyTables(); - } - - - /** - * (Re)set the parent of this Namespace context. - * The context must either have been freshly constructed, - * or must have been cleared. - * - * @param context The parent Namespace context object. - */ - void setParent (Context parent) - { - this.parent = parent; - declarations = null; - prefixTable = parent.prefixTable; - uriTable = parent.uriTable; - elementNameTable = parent.elementNameTable; - attributeNameTable = parent.attributeNameTable; - defaultNS = parent.defaultNS; - declSeen = false; - } - - /** - * Makes associated state become collectible, - * invalidating this context. - * {@link #setParent} must be called before - * this context may be used again. - */ - void clear () - { - parent = null; - prefixTable = null; - uriTable = null; - elementNameTable = null; - attributeNameTable = null; - defaultNS = ""; - } - - - /** - * Declare a Namespace prefix for this context. - * - * @param prefix The prefix to declare. - * @param uri The associated Namespace URI. - * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix - */ - void declarePrefix (String prefix, String uri) - { - // Lazy processing... -// if (!declsOK) -// throw new IllegalStateException ( -// "can't declare any more prefixes in this context"); - if (!declSeen) { - copyTables(); - } - if (declarations == null) { - declarations = new Vector(); - } - - prefix = prefix.intern(); - uri = uri.intern(); - if ("".equals(prefix)) { - defaultNS = uri; - } else { - prefixTable.put(prefix, uri); - uriTable.put(uri, prefix); // may wipe out another prefix - } - declarations.addElement(prefix); - } - - - /** - * Process an XML qualified name in this context. - * - * @param qName The XML qualified name. - * @param isAttribute true if this is an attribute name. - * @return An array of three strings containing the - * URI part (or empty string), the local part, - * and the raw name, all internalized, or null - * if there is an undeclared prefix. - * @see org.xml.sax.helpers.NamespaceSupport#processName - */ - String [] processName (String qName, boolean isAttribute) - { - String name[]; - Hashtable table; - - // Select the appropriate table. - if (isAttribute) { - table = attributeNameTable; - } else { - table = elementNameTable; - } - - // Start by looking in the cache, and - // return immediately if the name - // is already known in this content - name = (String[])table.get(qName); - if (name != null) { - return name; - } - - // We haven't seen this name in this - // context before. Maybe in the parent - // context, but we can't assume prefix - // bindings are the same. - name = new String[3]; - name[2] = qName.intern(); - int index = qName.indexOf(':'); - - - // No prefix. - if (index == -1) { - if (isAttribute) { - if (qName == "xmlns" && namespaceDeclUris) - name[0] = NSDECL; - else - name[0] = ""; - } else { - name[0] = defaultNS; - } - name[1] = name[2]; - } - - // Prefix - else { - String prefix = qName.substring(0, index); - String local = qName.substring(index+1); - String uri; - if ("".equals(prefix)) { - uri = defaultNS; - } else { - uri = (String)prefixTable.get(prefix); - } - if (uri == null - || (!isAttribute && "xmlns".equals (prefix))) { - return null; - } - name[0] = uri; - name[1] = local.intern(); - } - - // Save in the cache for future use. - // (Could be shared with parent context...) - table.put(name[2], name); - return name; - } - - - /** - * Look up the URI associated with a prefix in this context. - * - * @param prefix The prefix to look up. - * @return The associated Namespace URI, or null if none is - * declared. - * @see org.xml.sax.helpers.NamespaceSupport#getURI - */ - String getURI (String prefix) - { - if ("".equals(prefix)) { - return defaultNS; - } else if (prefixTable == null) { - return null; - } else { - return (String)prefixTable.get(prefix); - } - } - - - /** - * Look up one of the prefixes associated with a URI in this context. - * - *

Since many prefixes may be mapped to the same URI, - * the return value may be unreliable.

- * - * @param uri The URI to look up. - * @return The associated prefix, or null if none is declared. - * @see org.xml.sax.helpers.NamespaceSupport#getPrefix - */ - String getPrefix (String uri) { - if (uriTable != null) { - String uriPrefix = (String)uriTable.get(uri); - if (uriPrefix == null) return null; - String verifyNamespace = (String) prefixTable.get(uriPrefix); - if (uri.equals(verifyNamespace)) { - return uriPrefix; - } - } - return null; - } - - - /** - * Return an enumeration of prefixes declared in this context. - * - * @return An enumeration of prefixes (possibly empty). - * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes - */ - Enumeration getDeclaredPrefixes () - { - if (declarations == null) { - return EMPTY_ENUMERATION; - } else { - return declarations.elements(); - } - } - - - /** - * Return an enumeration of all prefixes currently in force. - * - *

The default prefix, if in force, is not - * returned, and will have to be checked for separately.

- * - * @return An enumeration of prefixes (never empty). - * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes - */ - Enumeration getPrefixes () - { - if (prefixTable == null) { - return EMPTY_ENUMERATION; - } else { - return prefixTable.keys(); - } - } - - - - //////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////// - - - /** - * Copy on write for the internal tables in this context. - * - *

This class is optimized for the normal case where most - * elements do not contain Namespace declarations.

- */ - private void copyTables () - { - if (prefixTable != null) { - prefixTable = (Hashtable)prefixTable.clone(); - } else { - prefixTable = new Hashtable(); - } - if (uriTable != null) { - uriTable = (Hashtable)uriTable.clone(); - } else { - uriTable = new Hashtable(); - } - elementNameTable = new Hashtable(); - attributeNameTable = new Hashtable(); - declSeen = true; - } - - - - //////////////////////////////////////////////////////////////// - // Protected state. - //////////////////////////////////////////////////////////////// - - Hashtable prefixTable; - Hashtable uriTable; - Hashtable elementNameTable; - Hashtable attributeNameTable; - String defaultNS = ""; - - - - //////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////// - - private Vector declarations = null; - private boolean declSeen = false; - private Context parent = null; - } -} - -// end of NamespaceSupport.java --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/Pcdata.java 2018-01-30 20:38:49.000000000 -0500 +++ /dev/null 2018-01-30 20:38:49.000000000 -0500 @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -/** - * PCDATA. - * - * @author Kohsuke Kawaguchi - */ -final class Pcdata extends Text { - Pcdata(Document document, NamespaceResolver nsResolver, Object obj) { - super(document, nsResolver, obj); - } - - void accept(ContentVisitor visitor) { - visitor.onPcdata(buffer); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/StartDocument.java 2018-01-30 20:38:49.000000000 -0500 +++ /dev/null 2018-01-30 20:38:50.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -/** - * @author Kohsuke Kawaguchi - */ -final class StartDocument extends Content { - boolean concludesPendingStartTag() { - return true; - } - - void accept(ContentVisitor visitor) { - visitor.onStartDocument(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/StartTag.java 2018-01-30 20:38:50.000000000 -0500 +++ /dev/null 2018-01-30 20:38:50.000000000 -0500 @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -import javax.xml.namespace.QName; - - -/** - * Start tag. - * - *

- * This object implements {@link NamespaceResolver} for attribute values. - * - * @author Kohsuke Kawaguchi - */ -class StartTag extends Content implements NamespaceResolver { - /** - * Tag name of the element. - * - *

- * This field is also used as a flag to indicate - * whether the start tag has been written. - * This field is initially set to non-null, and - * then reset to null when it's written. - */ - private String uri; - // but we keep the local name non-null so that - // we can diagnose an error - private final String localName; - - private Attribute firstAtt; - private Attribute lastAtt; - - /** - * If this {@link StartTag} has the parent {@link ContainerElement}, - * that value. Otherwise null. - */ - private ContainerElement owner; - - /** - * Explicitly given namespace declarations on this element. - * - *

- * Additional namespace declarations might be necessary to - * generate child {@link QName}s and attributes. - */ - private NamespaceDecl firstNs; - private NamespaceDecl lastNs; - - final Document document; - - public StartTag(ContainerElement owner, String uri, String localName) { - this(owner.document,uri,localName); - this.owner = owner; - } - - public StartTag(Document document, String uri, String localName) { - assert uri!=null; - assert localName!=null; - - this.uri = uri; - this.localName = localName; - this.document = document; - - // TODO: think about a better way to maintain namespace decls. - // this requires at least one NamespaceDecl per start tag, - // which is rather expensive. - addNamespaceDecl(uri,null,false); - } - - public void addAttribute(String nsUri, String localName, Object arg) { - checkWritable(); - - // look for the existing ones - Attribute a; - for(a=firstAtt; a!=null; a=a.next) { - if(a.hasName(nsUri,localName)) { - break; - } - } - - // if not found, declare a new one - if(a==null) { - a = new Attribute(nsUri,localName); - if(lastAtt==null) { - assert firstAtt==null; - firstAtt = lastAtt = a; - } else { - assert firstAtt!=null; - lastAtt.next = a; - lastAtt = a; - } - if(nsUri.length()>0) - addNamespaceDecl(nsUri,null,true); - } - - document.writeValue(arg,this,a.value); - } - - /** - * Declares a new namespace URI on this tag. - * - * @param uri - * namespace URI to be bound. Can be empty, but must not be null. - * @param prefix - * If non-null and non-empty, this prefix is bound to the URI - * on this element. If empty, then the runtime will still try to - * use the URI as the default namespace, but it may fail to do so - * because of the constraints in the XML. - *

- * If this parameter is null, the runtime will allocate an unique prefix. - * @param requirePrefix - * Used only when the prefix parameter is null. If true, this indicates - * that the non-empty prefix must be assigned to this URI. If false, - * then this URI might be used as the default namespace. - *

- * Normally you just need to set it to false. - */ - public NamespaceDecl addNamespaceDecl(String uri, String prefix,boolean requirePrefix) { - checkWritable(); - - if(uri==null) - throw new IllegalArgumentException(); - if(uri.length()==0) { - if(requirePrefix) - throw new IllegalArgumentException("The empty namespace cannot have a non-empty prefix"); - if(prefix!=null && prefix.length()>0) - throw new IllegalArgumentException("The empty namespace can be only bound to the empty prefix"); - prefix = ""; - } - - // check for the duplicate - for(NamespaceDecl n=firstNs; n!=null; n=n.next) { - if(uri.equals(n.uri)) { - if(prefix==null) { - // reuse this binding - n.requirePrefix |= requirePrefix; - return n; - } - if(n.prefix==null) { - // reuse this binding - n.prefix = prefix; - n.requirePrefix |= requirePrefix; - return n; - } - if(prefix.equals(n.prefix)) { - // reuse this binding - n.requirePrefix |= requirePrefix; - return n; - } - } - if(prefix!=null && n.prefix!=null && n.prefix.equals(prefix)) - throw new IllegalArgumentException( - "Prefix '"+prefix+"' is already bound to '"+n.uri+'\''); - } - - NamespaceDecl ns = new NamespaceDecl(document.assignNewId(),uri,prefix,requirePrefix); - if(lastNs==null) { - assert firstNs==null; - firstNs = lastNs = ns; - } else { - assert firstNs!=null; - lastNs.next = ns; - lastNs = ns; - } - return ns; - } - - /** - * Throws an error if the start tag has already been committed. - */ - private void checkWritable() { - if(isWritten()) - throw new IllegalStateException( - "The start tag of "+this.localName+" has already been written. " + - "If you need out of order writing, see the TypedXmlWriter.block method"); - } - - /** - * Returns true if this start tag has already been written. - */ - boolean isWritten() { - return uri==null; - } - - /** - * A {@link StartTag} can be only written after - * we are sure that all the necessary namespace declarations are given. - */ - boolean isReadyToCommit() { - if(owner!=null && owner.isBlocked()) - return false; - - for( Content c=getNext(); c!=null; c=c.getNext() ) - if(c.concludesPendingStartTag()) - return true; - - return false; - } - - public void written() { - firstAtt = lastAtt = null; - uri = null; - if(owner!=null) { - assert owner.startTag==this; - owner.startTag = null; - } - } - - boolean concludesPendingStartTag() { - return true; - } - - void accept(ContentVisitor visitor) { - visitor.onStartTag(uri,localName,firstAtt,firstNs); - } - - public String getPrefix(String nsUri) { - NamespaceDecl ns = addNamespaceDecl(nsUri,null,false); - if(ns.prefix!=null) - // if the prefix has already been declared, use it. - return ns.prefix; - return ns.dummyPrefix; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/TXW.java 2018-01-30 20:38:51.000000000 -0500 +++ /dev/null 2018-01-30 20:38:51.000000000 -0500 @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -import com.sun.xml.internal.txw2.output.XmlSerializer; -import com.sun.xml.internal.txw2.output.TXWSerializer; -import com.sun.xml.internal.txw2.annotation.XmlElement; -import com.sun.xml.internal.txw2.annotation.XmlNamespace; - -import javax.xml.namespace.QName; - -/** - * Entry point to TXW. - * - * @author Kohsuke Kawaguchi - */ -public abstract class TXW { - private TXW() {} // no instanciation please - - - /*package*/ static QName getTagName( Class c ) { - String localName=""; - String nsUri="##default"; - - XmlElement xe = c.getAnnotation(XmlElement.class); - if(xe!=null) { - localName = xe.value(); - nsUri = xe.ns(); - } - - if(localName.length()==0) { - localName = c.getName(); - int idx = localName.lastIndexOf('.'); - if(idx>=0) - localName = localName.substring(idx+1); - - localName = Character.toLowerCase(localName.charAt(0))+localName.substring(1); - } - - if(nsUri.equals("##default")) { - Package pkg = c.getPackage(); - if(pkg!=null) { - XmlNamespace xn = pkg.getAnnotation(XmlNamespace.class); - if(xn!=null) - nsUri = xn.value(); - } - } - if(nsUri.equals("##default")) - nsUri = ""; - - return new QName(nsUri,localName); - } - - /** - * Creates a new {@link TypedXmlWriter} to write a new instance of a document. - * - * @param rootElement - * The {@link TypedXmlWriter} interface that declares the content model of the root element. - * This interface must have {@link XmlElement} annotation on it to designate the tag name - * of the root element. - * @param out - * The target of the writing. - */ - public static T create( Class rootElement, XmlSerializer out ) { - if (out instanceof TXWSerializer) { - TXWSerializer txws = (TXWSerializer) out; - return txws.txw._element(rootElement); - } - - Document doc = new Document(out); - QName n = getTagName(rootElement); - return new ContainerElement(doc,null,n.getNamespaceURI(),n.getLocalPart())._cast(rootElement); - } - - /** - * Creates a new {@link TypedXmlWriter} to write a new instance of a document. - * - *

- * Similar to the other method, but this version allows the caller to set the - * tag name at the run-time. - * - * @param tagName - * The tag name of the root document. - * - * @see #create(Class,XmlSerializer) - */ - public static T create( QName tagName, Class rootElement, XmlSerializer out ) { - if (out instanceof TXWSerializer) { - TXWSerializer txws = (TXWSerializer) out; - return txws.txw._element(tagName,rootElement); - } - return new ContainerElement(new Document(out),null,tagName.getNamespaceURI(),tagName.getLocalPart())._cast(rootElement); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/Text.java 2018-01-30 20:38:52.000000000 -0500 +++ /dev/null 2018-01-30 20:38:52.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -/** - * {@link Pcdata} or {@link Cdata}. - * - * @author Kohsuke Kawaguchi - */ -abstract class Text extends Content { - /** - * The text to be writtten. - */ - protected final StringBuilder buffer = new StringBuilder(); - - protected Text(Document document, NamespaceResolver nsResolver, Object obj) { - document.writeValue(obj,nsResolver,buffer); - } - - boolean concludesPendingStartTag() { - return false; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/TxwException.java 2018-01-30 20:38:52.000000000 -0500 +++ /dev/null 2018-01-30 20:38:52.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -/** - * Signals errors in the TXW processing. - */ -public class TxwException extends RuntimeException { - public TxwException(String message) { - super(message); - } - - public TxwException(Throwable cause) { - super(cause); - } - - public TxwException(String message, Throwable cause) { - super(message, cause); - } - - private static final long serialVersionUID = 1L; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/TypedXmlWriter.java 2018-01-30 20:38:53.000000000 -0500 +++ /dev/null 2018-01-30 20:38:53.000000000 -0500 @@ -1,266 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2; - -import com.sun.xml.internal.txw2.annotation.XmlElement; -import com.sun.xml.internal.txw2.output.XmlSerializer; - -import javax.xml.namespace.QName; - -/** - * Defines common operations for all typed XML writers. - * Root of all typed XML writer interfaces. - * - *

- * This interface defines a series of methods to allow client applications - * to write arbitrary well-formed documents. - * - * @author Kohsuke Kawaguchi - */ -public interface TypedXmlWriter { - /** - * Commits this element (and all its descendants) to the output. - * - *

- * Short for {@code _commit(true)}. - */ - void commit(); - - /** - * Commits this element (and all its descendants) to the output. - * - *

- * Once a writer is committed, nothing can be added to it further. - * Committing allows TXW to output a part of the document even - * if the rest has not yet been written. - * - * @param includingAllPredecessors - * if false, this operation will _commit this writer and all its - * descendants writers. If true, in addition to those writers, - * this operation will close all the writers before this writer - * in the document order. - */ - void commit(boolean includingAllPredecessors); - - /** - * Blocks the writing of the start tag so that - * new attributes can be added even after child - * elements are appended. - * - *

- * This blocks the output at the token before the start tag until - * the {@link #commit()} method is called to _commit this element. - * - *

- * For more information, see the TXW documentation. - */ - void block(); - - /** - * Gets the {@link Document} object that this writer is writing to. - * - * @return - * always non-null. - */ - Document getDocument(); - - /** - * Adds an attribute of the given name and the value. - * - *

- * Short for

_attribute("",localName,value);
- * - * @see #_attribute(String, String, Object) - */ - void _attribute( String localName, Object value ); - - /** - * Adds an attribute of the given name and the value. - * - *

- * Short for

_attribute(new QName(nsUri,localName),value);
- * - * @see #_attribute(QName, Object) - */ - void _attribute( String nsUri, String localName, Object value ); - - /** - * Adds an attribute of the given name and the value. - * - * @param attributeName - * must not be null. - * @param value - * value of the attribute. - * must not be null. - * See the documentation for the conversion rules. - */ - void _attribute( QName attributeName, Object value ); - - /** - * Declares a new namespace URI on this element. - * - *

- * The runtime system will assign an unique prefix for the URI. - * - * @param uri - * can be empty, but must not be null. - */ - void _namespace( String uri ); - - /** - * Declares a new namespace URI on this element to - * a specific prefix. - * - * @param uri - * can be empty, but must not be null. - * @param prefix - * If non-empty, this prefix is bound to the URI - * on this element. If empty, then the runtime will still try to - * use the URI as the default namespace, but it may fail to do so - * because of the constraints in the XML. - * - * @throws IllegalArgumentException - * if the same prefix is already declared on this element. - */ - void _namespace( String uri, String prefix ); - - /** - * Declares a new namespace URI on this element. - * - *

- * The runtime system will assign an unique prefix for the URI. - * - * @param uri - * can be empty, but must not be null. - * @param requirePrefix - * if false, this method behaves just like {@link #_namespace(String)}. - * if true, this guarantees that the URI is bound to a non empty prefix. - */ - void _namespace( String uri, boolean requirePrefix ); - - /** - * Appends text data. - * - * @param value - * must not be null. - * See the documentation for the conversion rules. - */ - void _pcdata( Object value ); - - /** - * Appends CDATA section. - * - * @param value - * must not be null. - * See the documentation for the conversion rules. - */ - void _cdata( Object value ); - - /** - * Appends a comment. - * - * @param value - * must not be null. - * See the documentation for the conversion rules. - * - * @throws UnsupportedOperationException - * if the underlying {@link XmlSerializer} does not support - * writing comments, this exception can be thrown. - */ - void _comment( Object value ) throws UnsupportedOperationException; - - /** - * Appends a new child element. - * - *

- * Short for

_element(URI of this element,localName,contentModel);
- * - *

- * The namespace URI will be inherited from the parent element. - * - * @see #_element(String, String, Class) - */ - T _element( String localName, Class contentModel ); - - /** - * Appends a new child element. - * - *

- * The newly created child element is appended at the end of the children. - * - * @param nsUri - * The namespace URI of the newly created element. - * @param localName - * The local name of the newly created element. - * @param contentModel - * The typed XML writer interface used to write the children of - * the new child element. - * - * @return - * always return non-null {@link TypedXmlWriter} that can be used - * to write the contents of the newly created child element. - */ - T _element( String nsUri, String localName, Class contentModel ); - - /** - * Appends a new child element. - * - *

- * Short for

_element(tagName.getNamespaceURI(),tagName.getLocalPart(),contentModel);
- * - * @see #_element(String, String, Class) - */ - T _element( QName tagName, Class contentModel ); - - /** - * Appends a new child element. - * - *

- * This version of the _element method requires the T class to be - * annotated with {@link XmlElement} annotation. The element name will be - * taken from there. - * - * @see #_element(String, String, Class) - */ - T _element( Class contentModel ); - - /** - * Returns a different interface for this typed XML Writer. - * - *

- * Semantically, this operation is a 'cast' --- it returns the same underlying - * writer in a different interface. The returned new writer and the current writer - * will write to the same element. - * - *

- * But this is different from Java's ordinary cast because the returned object - * is not always the same as the current object. - * - * @return - * always return non-null. - */ - T _cast( Class targetInterface ); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/annotation/XmlAttribute.java 2018-01-30 20:38:54.000000000 -0500 +++ /dev/null 2018-01-30 20:38:54.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.annotation; - -import com.sun.xml.internal.txw2.TypedXmlWriter; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Specifies that the invocation of the method will produce an attribute. - * - *

- * The method signature has to match the form {@code R foo(DT1,DT2,..)} - * - *

- * R is either {@code void} or the type to which the interface that declares - * this method is assignable. In the case of the latter, the method will return - * {@code this} object, allowing you to chain the multiple attribute method - * invocations like {@link StringBuffer}. - * - *

- * DTi must be datatype objects. - * - *

- * When this method is called, a new attribute is added to the current element, - * whose value is whitespace-separated text from each of the datatype objects. - * - * @author Kohsuke Kawaguchi - */ -@Retention(RUNTIME) -@Target({METHOD}) -public @interface XmlAttribute { - /** - * The local name of the attribute. - * - *

- * If left unspecified, the method name is used as the attribute name. - * - */ - String value() default ""; - - /** - * The namespace URI of the attribute. - */ - String ns() default ""; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/annotation/XmlCDATA.java 2018-01-30 20:38:55.000000000 -0500 +++ /dev/null 2018-01-30 20:38:55.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.METHOD; - -/** - * Used along with {@link XmlElement} to write a CDATA section, - * instead of the normal PCDATA. - * - * @author Kohsuke Kawaguchi - */ -@Retention(RUNTIME) -@Target({METHOD}) -public @interface XmlCDATA { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/annotation/XmlElement.java 2018-01-30 20:38:56.000000000 -0500 +++ /dev/null 2018-01-30 20:38:56.000000000 -0500 @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.annotation; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.TXW; -import com.sun.xml.internal.txw2.output.XmlSerializer; - -import javax.xml.namespace.QName; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.METHOD; - -/** - * Specifies the name of the XML element. - * - *

Used on method

- *

- * When used on methods declared on interfaces that derive - * from {@link TypedXmlWriter}, it specifies that the invocation - * of the method will produce an element of the specified name. - * - *

- * The method signature has to match one of the following patterns. - * - *

- *
Child writer: {@code TW foo()}
- *
TW must be an interface derived from {@link TypedXmlWriter}. - * When this method is called, a new child element is started, - * and its content can be written by using the returned {@code TW} - * object. This child element will be ended when its _commit method - * is called. - *
Leaf element: {@code void foo(DT1,DT2,...)}
- *
DTi must be datatype objects. - * When this method is called, a new child element is started, - * followed by the whitespace-separated text data from each of - * the datatype objects, followed by the end tag. - *
- * - *

Used on interface

- *

- * When used on interfaces that derive from {@link TypedXmlWriter}, - * it associates an element name with that interface. This name is - * used in a few places, such as in {@link TXW#create(Class,XmlSerializer)} - * and {@link TypedXmlWriter#_element(Class)}. - * - * - * @author Kohsuke Kawaguchi - */ -@Retention(RUNTIME) -@Target({METHOD,TYPE}) -public @interface XmlElement { - /** - * The local name of the element. - */ - String value() default ""; - - /** - * The namespace URI of this element. - * - *

- * If the annotation is on an interface and this paramter is left unspecified, - * then the namespace URI is taken from {@link XmlNamespace} annotation on - * the package that the interface is in. If {@link XmlNamespace} annotation - * doesn't exist, the namespace URI will be "". - * - *

- * If the annotation is on a method and this parameter is left unspecified, - * then the namespace URI is the same as the namespace URI of the writer interface. - */ - String ns() default "##default"; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/annotation/XmlNamespace.java 2018-01-30 20:38:56.000000000 -0500 +++ /dev/null 2018-01-30 20:38:56.000000000 -0500 @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.annotation; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.PACKAGE; -import com.sun.xml.internal.txw2.TypedXmlWriter; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Declares the namespace URI of the {@link TypedXmlWriter}s - * in a package. - * - *

- * This annotation is placed on a package. When specified, - * it sets the default value of the namespace URI for - * all the elements ({@link XmlElement}s) in the given package. - * - * @author Kohsuke Kawaguchi - */ -@Retention(RUNTIME) -@Target({PACKAGE}) -public @interface XmlNamespace { - /** - * The namespace URI. - */ - String value(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/annotation/XmlValue.java 2018-01-30 20:38:57.000000000 -0500 +++ /dev/null 2018-01-30 20:38:57.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.annotation; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Specifies that the invocation of the method will produce a text - * - *

- * The method signature has to match the form {@code R foo(DT1,DT2,..)} - * - *

- * R is either {@code void} or the type to which the interface that declares - * this method is assignable. In the case of the latter, the method will return - * {@code this} object, allowing you to chain the multiple method - * invocations like {@link StringBuffer}. - * - *

- * DTi must be datatype objects. - * - *

- * When this method is called, whitespace-separated text data - * is added from each of the datatype objects. - * - * @author Kohsuke Kawaguchi - */ -@Retention(RUNTIME) -@Target({METHOD}) -public @interface XmlValue { -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/annotation/package.html 2018-01-30 20:38:58.000000000 -0500 +++ /dev/null 2018-01-30 20:38:58.000000000 -0500 @@ -1,51 +0,0 @@ - - - - - - -

- Defines a set of annotations that can be used on TypedXmlWriter interfaces. - -

Package-level Annotation

-

- {@link XmlNamespace} can be used on a package to designate the namespace URI for the - whole package. - -

Interface Annotation

-

- {@link XmlElement} can be used on TypedXmlWriter-derived interfaces to associate - a tag name to that interface. - -

Method Annotations

-

- {@link XmlElement}, {@link XmlAttribute}, or {@link XmlValue} can be used on a method - declared on a TypedXmLWriter-derived interface. Those annotations are mutually-exclusive. - See their javadoc for details. If none of the above three annotations are specified, - {@link XmlElement} is assumed. - - - --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/CharacterEscapeHandler.java 2018-01-30 20:38:59.000000000 -0500 +++ /dev/null 2018-01-30 20:38:59.000000000 -0500 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import java.io.IOException; -import java.io.Writer; - -/** - * Performs character escaping and write the result - * to the output. - * - * @since 1.0.1 - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public interface CharacterEscapeHandler { - - /** - * @param ch The array of characters. - * @param start The starting position. - * @param length The number of characters to use. - * @param isAttVal true if this is an attribute value literal. - */ - void escape( char ch[], int start, int length, boolean isAttVal, Writer out ) throws IOException; - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/DataWriter.java 2018-01-30 20:39:00.000000000 -0500 +++ /dev/null 2018-01-30 20:39:00.000000000 -0500 @@ -1,374 +0,0 @@ -/* - * Copyright (c) 2005, 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. - */ - -//@@3RD PARTY CODE@@ - -// DataWriter.java - XML writer for data-oriented files. - -package com.sun.xml.internal.txw2.output; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; - -import java.io.Writer; -import java.util.Stack; - - -/** - * Write data- or field-oriented XML. - * - *

This filter pretty-prints field-oriented XML without mixed content. - * all added indentation and newlines will be passed on down - * the filter chain (if any).

- * - *

In general, all whitespace in an XML document is potentially - * significant, so a general-purpose XML writing tool like the - * {@link XMLWriter} class cannot - * add newlines or indentation.

- * - *

There is, however, a large class of XML documents where information - * is strictly fielded: each element contains either character data - * or other elements, but not both. For this special case, it is possible - * for a writing tool to provide automatic indentation and newlines - * without requiring extra work from the user. Note that this class - * will likely not yield appropriate results for document-oriented - * XML like XHTML pages, which mix character data and elements together.

- * - *

This writer will automatically place each start tag on a new line, - * optionally indented if an indent step is provided (by default, there - * is no indentation). If an element contains other elements, the end - * tag will also appear on a new line with leading indentation. Consider, - * for example, the following code:

- * - *
- * DataWriter w = new DataWriter();
- *
- * w.setIndentStep(2);
- * w.startDocument();
- * w.startElement("Person");
- * w.dataElement("name", "Jane Smith");
- * w.dataElement("date-of-birth", "1965-05-23");
- * w.dataElement("citizenship", "US");
- * w.endElement("Person");
- * w.endDocument();
- * 
- * - *

This code will produce the following document:

- * - *
{@code
- * 
- *
- * 
- *   Jane Smith
- *   1965-05-23
- *   US
- * 
- * }
- * - *

This class inherits from {@link XMLWriter}, - * and provides all of the same support for Namespaces.

- * - * @since 1.0 - * @author David Megginson, david@megginson.com - * @version 0.2 - * @see XMLWriter - */ -public class DataWriter extends XMLWriter -{ - - - - //////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////// - - - /** - * Create a new data writer for the specified output. - * - * @param writer The character stream where the XML document - * will be written. - * @param encoding - * If non-null string is specified, it is written as a part - * of the XML declaration. - */ - public DataWriter ( Writer writer, String encoding, CharacterEscapeHandler _escapeHandler ) - { - super(writer,encoding,_escapeHandler); - } - - - public DataWriter (Writer writer, String encoding ) { - this( writer, encoding, DumbEscapeHandler.theInstance ); - } - - public DataWriter (Writer writer) { - this( writer, null, DumbEscapeHandler.theInstance ); - } - - - - //////////////////////////////////////////////////////////////////// - // Accessors and setters. - //////////////////////////////////////////////////////////////////// - - - /** - * Return the current indent step. - * - *

Return the current indent step: each start tag will be - * indented by this number of spaces times the number of - * ancestors that the element has.

- * - * @return The number of spaces in each indentation step, - * or 0 or less for no indentation. - * @see #setIndentStep(int) - * - * @deprecated - * Only return the length of the indent string. - */ - public int getIndentStep () - { - return indentStep.length(); - } - - - /** - * Set the current indent step. - * - * @param indentStep The new indent step (0 or less for no - * indentation). - * @see #getIndentStep() - * - * @deprecated - * Should use the version that takes string. - */ - public void setIndentStep (int indentStep) - { - StringBuilder s = new StringBuilder(); - for( ; indentStep>0; indentStep-- ) s.append(' '); - setIndentStep(s.toString()); - } - - public void setIndentStep(String s) { - this.indentStep = s; - } - - - - //////////////////////////////////////////////////////////////////// - // Override methods from XMLWriter. - //////////////////////////////////////////////////////////////////// - - - /** - * Reset the writer so that it can be reused. - * - *

This method is especially useful if the writer failed - * with an exception the last time through.

- * - * @see XMLWriter#reset() - */ - public void reset () - { - depth = 0; - state = SEEN_NOTHING; - stateStack = new Stack(); - super.reset(); - } - - - /** - * Write a start tag. - * - *

Each tag will begin on a new line, and will be - * indented by the current indent step times the number - * of ancestors that the element has.

- * - *

The newline and indentation will be passed on down - * the filter chain through regular characters events.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param qName The element's qualified (prefixed) name. - * @param atts The element's attribute list. - * @exception org.xml.sax.SAXException If there is an error - * writing the start tag, or if a filter further - * down the chain raises an exception. - * @see XMLWriter#startElement(String, String, String, Attributes) - */ - public void startElement (String uri, String localName, - String qName, Attributes atts) - throws SAXException - { - stateStack.push(SEEN_ELEMENT); - state = SEEN_NOTHING; - if (depth > 0) { - super.characters("\n"); - } - doIndent(); - super.startElement(uri, localName, qName, atts); - depth++; - } - - - /** - * Write an end tag. - * - *

If the element has contained other elements, the tag - * will appear indented on a new line; otherwise, it will - * appear immediately following whatever came before.

- * - *

The newline and indentation will be passed on down - * the filter chain through regular characters events.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param qName The element's qualified (prefixed) name. - * @exception org.xml.sax.SAXException If there is an error - * writing the end tag, or if a filter further - * down the chain raises an exception. - * @see XMLWriter#endElement(String, String, String) - */ - public void endElement (String uri, String localName, String qName) - throws SAXException - { - depth--; - if (state == SEEN_ELEMENT) { - super.characters("\n"); - doIndent(); - } - super.endElement(uri, localName, qName); - state = stateStack.pop(); - } - - -// /** -// * Write a empty element tag. -// * -// *

Each tag will appear on a new line, and will be -// * indented by the current indent step times the number -// * of ancestors that the element has.

-// * -// *

The newline and indentation will be passed on down -// * the filter chain through regular characters events.

-// * -// * @param uri The element's Namespace URI. -// * @param localName The element's local name. -// * @param qName The element's qualified (prefixed) name. -// * @param atts The element's attribute list. -// * @exception org.xml.sax.SAXException If there is an error -// * writing the empty tag, or if a filter further -// * down the chain raises an exception. -// * @see XMLWriter#emptyElement(String, String, String, Attributes) -// */ -// public void emptyElement (String uri, String localName, -// String qName, Attributes atts) -// throws SAXException -// { -// state = SEEN_ELEMENT; -// if (depth > 0) { -// super.characters("\n"); -// } -// doIndent(); -// super.emptyElement(uri, localName, qName, atts); -// } - - - /** - * Write a sequence of characters. - * - * @param ch The characters to write. - * @param start The starting position in the array. - * @param length The number of characters to use. - * @exception org.xml.sax.SAXException If there is an error - * writing the characters, or if a filter further - * down the chain raises an exception. - * @see XMLWriter#characters(char[], int, int) - */ - public void characters (char ch[], int start, int length) - throws SAXException - { - state = SEEN_DATA; - super.characters(ch, start, length); - } - - public void comment(char ch[], int start, int length) throws SAXException { - if (depth > 0) { - super.characters("\n"); - } - doIndent(); - super.comment(ch,start,length); - } - - - - //////////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Print indentation for the current level. - * - * @exception org.xml.sax.SAXException If there is an error - * writing the indentation characters, or if a filter - * further down the chain raises an exception. - */ - private void doIndent () - throws SAXException - { - if (depth > 0) { - char[] ch = indentStep.toCharArray(); - for( int i=0; i': - out.write(">"); - break; - case '\"': - if (isAttVal) { - out.write("""); - } else { - out.write('\"'); - } - break; - default: - if (ch[i] > '\u007f') { - out.write("&#"); - out.write(Integer.toString(ch[i])); - out.write(';'); - } else { - out.write(ch[i]); - } - } - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/DumpSerializer.java 2018-01-30 20:39:03.000000000 -0500 +++ /dev/null 2018-01-30 20:39:03.000000000 -0500 @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import java.io.PrintStream; - -/** - * Shows the call sequence of {@link XmlSerializer} methods. - * - * Useful for debugging and learning how TXW works. - * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public class DumpSerializer implements XmlSerializer { - private final PrintStream out; - - public DumpSerializer(PrintStream out) { - this.out = out; - } - - public void beginStartTag(String uri, String localName, String prefix) { - out.println('<'+prefix+':'+localName); - } - - public void writeAttribute(String uri, String localName, String prefix, StringBuilder value) { - out.println('@'+prefix+':'+localName+'='+value); - } - - public void writeXmlns(String prefix, String uri) { - out.println("xmlns:"+prefix+'='+uri); - } - - public void endStartTag(String uri, String localName, String prefix) { - out.println('>'); - } - - public void endTag() { - out.println(""); - } - - public void text(StringBuilder text) { - out.println(text); - } - - public void cdata(StringBuilder text) { - out.println(""); - } - - public void comment(StringBuilder comment) { - out.println(""); - } - - public void startDocument() { - out.println(""); - } - - public void endDocument() { - out.println("done"); - } - - public void flush() { - out.println("flush"); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/IndentingXMLFilter.java 2018-01-30 20:39:03.000000000 -0500 +++ /dev/null 2018-01-30 20:39:03.000000000 -0500 @@ -1,312 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.XMLFilterImpl; - -import java.util.Stack; - -/** - * {@link XMLFilterImpl} that does indentation to SAX events. - * - * @author Kohsuke Kawaguchi - */ -public class IndentingXMLFilter extends XMLFilterImpl implements LexicalHandler { - private LexicalHandler lexical; - - public IndentingXMLFilter() { - } - - public IndentingXMLFilter(ContentHandler handler) { - setContentHandler(handler); - } - - public IndentingXMLFilter(ContentHandler handler, LexicalHandler lexical) { - setContentHandler(handler); - setLexicalHandler(lexical); - } - - public LexicalHandler getLexicalHandler() { - return lexical; - } - - public void setLexicalHandler(LexicalHandler lexical) { - this.lexical = lexical; - } - - - /** - * Return the current indent step. - * - *

Return the current indent step: each start tag will be - * indented by this number of spaces times the number of - * ancestors that the element has.

- * - * @return The number of spaces in each indentation step, - * or 0 or less for no indentation. - * @see #setIndentStep(int) - * - * @deprecated - * Only return the length of the indent string. - */ - public int getIndentStep () - { - return indentStep.length(); - } - - - /** - * Set the current indent step. - * - * @param indentStep The new indent step (0 or less for no - * indentation). - * @see #getIndentStep() - * - * @deprecated - * Should use the version that takes string. - */ - public void setIndentStep (int indentStep) - { - StringBuilder s = new StringBuilder(); - for( ; indentStep>0; indentStep-- ) s.append(' '); - setIndentStep(s.toString()); - } - - public void setIndentStep(String s) { - this.indentStep = s; - } - - - - //////////////////////////////////////////////////////////////////// - // Override methods from XMLWriter. - //////////////////////////////////////////////////////////////////// - - /** - * Write a start tag. - * - *

Each tag will begin on a new line, and will be - * indented by the current indent step times the number - * of ancestors that the element has.

- * - *

The newline and indentation will be passed on down - * the filter chain through regular characters events.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param qName The element's qualified (prefixed) name. - * @param atts The element's attribute list. - * @exception org.xml.sax.SAXException If there is an error - * writing the start tag, or if a filter further - * down the chain raises an exception. - * @see XMLWriter#startElement(String, String, String,Attributes) - */ - public void startElement (String uri, String localName, - String qName, Attributes atts) - throws SAXException { - stateStack.push(SEEN_ELEMENT); - state = SEEN_NOTHING; - if (depth > 0) { - writeNewLine(); - } - doIndent(); - super.startElement(uri, localName, qName, atts); - depth++; - } - - private void writeNewLine() throws SAXException { - super.characters(NEWLINE,0,NEWLINE.length); - } - - private static final char[] NEWLINE = {'\n'}; - - - /** - * Write an end tag. - * - *

If the element has contained other elements, the tag - * will appear indented on a new line; otherwise, it will - * appear immediately following whatever came before.

- * - *

The newline and indentation will be passed on down - * the filter chain through regular characters events.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param qName The element's qualified (prefixed) name. - * @exception org.xml.sax.SAXException If there is an error - * writing the end tag, or if a filter further - * down the chain raises an exception. - * @see XMLWriter#endElement(String, String, String) - */ - public void endElement (String uri, String localName, String qName) - throws SAXException - { - depth--; - if (state == SEEN_ELEMENT) { - writeNewLine(); - doIndent(); - } - super.endElement(uri, localName, qName); - state = stateStack.pop(); - } - - -// /** -// * Write a empty element tag. -// * -// *

Each tag will appear on a new line, and will be -// * indented by the current indent step times the number -// * of ancestors that the element has.

-// * -// *

The newline and indentation will be passed on down -// * the filter chain through regular characters events.

-// * -// * @param uri The element's Namespace URI. -// * @param localName The element's local name. -// * @param qName The element's qualified (prefixed) name. -// * @param atts The element's attribute list. -// * @exception org.xml.sax.SAXException If there is an error -// * writing the empty tag, or if a filter further -// * down the chain raises an exception. -// * @see XMLWriter#emptyElement(String, String, String, Attributes) -// */ -// public void emptyElement (String uri, String localName, -// String qName, Attributes atts) -// throws SAXException -// { -// state = SEEN_ELEMENT; -// if (depth > 0) { -// super.characters("\n"); -// } -// doIndent(); -// super.emptyElement(uri, localName, qName, atts); -// } - - - /** - * Write a sequence of characters. - * - * @param ch The characters to write. - * @param start The starting position in the array. - * @param length The number of characters to use. - * @exception org.xml.sax.SAXException If there is an error - * writing the characters, or if a filter further - * down the chain raises an exception. - * @see XMLWriter#characters(char[], int, int) - */ - public void characters (char ch[], int start, int length) - throws SAXException - { - state = SEEN_DATA; - super.characters(ch, start, length); - } - - public void comment(char ch[], int start, int length) throws SAXException { - if (depth > 0) { - writeNewLine(); - } - doIndent(); - if(lexical!=null) - lexical.comment(ch,start,length); - } - - public void startDTD(String name, String publicId, String systemId) throws SAXException { - if(lexical!=null) - lexical.startDTD(name, publicId, systemId); - } - - public void endDTD() throws SAXException { - if(lexical!=null) - lexical.endDTD(); - } - - public void startEntity(String name) throws SAXException { - if(lexical!=null) - lexical.startEntity(name); - } - - public void endEntity(String name) throws SAXException { - if(lexical!=null) - lexical.endEntity(name); - } - - public void startCDATA() throws SAXException { - if(lexical!=null) - lexical.startCDATA(); - } - - public void endCDATA() throws SAXException { - if(lexical!=null) - lexical.endCDATA(); - } - - //////////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Print indentation for the current level. - * - * @exception org.xml.sax.SAXException If there is an error - * writing the indentation characters, or if a filter - * further down the chain raises an exception. - */ - private void doIndent () - throws SAXException - { - if (depth > 0) { - char[] ch = indentStep.toCharArray(); - for( int i=0; i stateStack = new Stack(); - - private String indentStep = ""; - private int depth = 0; -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/IndentingXMLStreamWriter.java 2018-01-30 20:39:04.000000000 -0500 +++ /dev/null 2018-01-30 20:39:04.000000000 -0500 @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; -import java.util.Stack; - -/** - * @author Kohsuke Kawaguchi - */ -public class IndentingXMLStreamWriter extends DelegatingXMLStreamWriter { - private final static Object SEEN_NOTHING = new Object(); - private final static Object SEEN_ELEMENT = new Object(); - private final static Object SEEN_DATA = new Object(); - - private Object state = SEEN_NOTHING; - private Stack stateStack = new Stack(); - - private String indentStep = " "; - private int depth = 0; - - public IndentingXMLStreamWriter(XMLStreamWriter writer) { - super(writer); - } - - /** - * Return the current indent step. - * - *

Return the current indent step: each start tag will be - * indented by this number of spaces times the number of - * ancestors that the element has.

- * - * @return The number of spaces in each indentation step, - * or 0 or less for no indentation. - * @see #setIndentStep(int) - * - * @deprecated - * Only return the length of the indent string. - */ - public int getIndentStep() { - return indentStep.length(); - } - - - /** - * Set the current indent step. - * - * @param indentStep The new indent step (0 or less for no - * indentation). - * @see #getIndentStep() - * - * @deprecated - * Should use the version that takes string. - */ - public void setIndentStep(int indentStep) { - StringBuilder s = new StringBuilder(); - for (; indentStep > 0; indentStep--) s.append(' '); - setIndentStep(s.toString()); - } - - public void setIndentStep(String s) { - this.indentStep = s; - } - - private void onStartElement() throws XMLStreamException { - stateStack.push(SEEN_ELEMENT); - state = SEEN_NOTHING; - if (depth > 0) { - super.writeCharacters("\n"); - } - doIndent(); - depth++; - } - - private void onEndElement() throws XMLStreamException { - depth--; - if (state == SEEN_ELEMENT) { - super.writeCharacters("\n"); - doIndent(); - } - state = stateStack.pop(); - } - - private void onEmptyElement() throws XMLStreamException { - state = SEEN_ELEMENT; - if (depth > 0) { - super.writeCharacters("\n"); - } - doIndent(); - } - - /** - * Print indentation for the current level. - * - * @exception org.xml.sax.SAXException If there is an error - * writing the indentation characters, or if a filter - * further down the chain raises an exception. - */ - private void doIndent() throws XMLStreamException { - if (depth > 0) { - for (int i = 0; i < depth; i++) - super.writeCharacters(indentStep); - } - } - - - public void writeStartDocument() throws XMLStreamException { - super.writeStartDocument(); - super.writeCharacters("\n"); - } - - public void writeStartDocument(String version) throws XMLStreamException { - super.writeStartDocument(version); - super.writeCharacters("\n"); - } - - public void writeStartDocument(String encoding, String version) throws XMLStreamException { - super.writeStartDocument(encoding, version); - super.writeCharacters("\n"); - } - - public void writeStartElement(String localName) throws XMLStreamException { - onStartElement(); - super.writeStartElement(localName); - } - - public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException { - onStartElement(); - super.writeStartElement(namespaceURI, localName); - } - - public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { - onStartElement(); - super.writeStartElement(prefix, localName, namespaceURI); - } - - public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException { - onEmptyElement(); - super.writeEmptyElement(namespaceURI, localName); - } - - public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException { - onEmptyElement(); - super.writeEmptyElement(prefix, localName, namespaceURI); - } - - public void writeEmptyElement(String localName) throws XMLStreamException { - onEmptyElement(); - super.writeEmptyElement(localName); - } - - public void writeEndElement() throws XMLStreamException { - onEndElement(); - super.writeEndElement(); - } - - public void writeCharacters(String text) throws XMLStreamException { - state = SEEN_DATA; - super.writeCharacters(text); - } - - public void writeCharacters(char[] text, int start, int len) throws XMLStreamException { - state = SEEN_DATA; - super.writeCharacters(text, start, len); - } - - public void writeCData(String data) throws XMLStreamException { - state = SEEN_DATA; - super.writeCData(data); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/ResultFactory.java 2018-01-30 20:39:05.000000000 -0500 +++ /dev/null 2018-01-30 20:39:05.000000000 -0500 @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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.txw2.output; - -import javax.xml.transform.Result; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamResult; - -/** - * Factory for producing XmlSerializers for various Result types. - * - * @author Ryan.Shoemaker@Sun.COM - */ -public abstract class ResultFactory { - - /** - * Do not instanciate. - */ - private ResultFactory() {} - - /** - * Factory method for producing {@link XmlSerializer} from {@link javax.xml.transform.Result}. - * - * This method supports {@link javax.xml.transform.sax.SAXResult}, - * {@link javax.xml.transform.stream.StreamResult}, and {@link javax.xml.transform.dom.DOMResult}. - * - * @param result the Result that will receive output from the XmlSerializer - * @return an implementation of XmlSerializer that will produce output on the supplied Result - */ - public static XmlSerializer createSerializer(Result result) { - if (result instanceof SAXResult) - return new SaxSerializer((SAXResult) result); - if (result instanceof DOMResult) - return new DomSerializer((DOMResult) result); - if (result instanceof StreamResult) - return new StreamSerializer((StreamResult) result); - if (result instanceof TXWResult) - return new TXWSerializer(((TXWResult)result).getWriter()); - - throw new UnsupportedOperationException("Unsupported Result type: " + result.getClass().getName()); - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/SaxSerializer.java 2018-01-30 20:39:06.000000000 -0500 +++ /dev/null 2018-01-30 20:39:06.000000000 -0500 @@ -1,213 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import com.sun.xml.internal.txw2.TxwException; -import org.xml.sax.ContentHandler; -import org.xml.sax.SAXException; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.AttributesImpl; - -import javax.xml.transform.sax.SAXResult; -import java.util.Stack; - -/** - * {@link XmlSerializer} for {@link SAXResult} and {@link ContentHandler}. - * - * @author Ryan.Shoemaker@Sun.COM - */ -public class SaxSerializer implements XmlSerializer { - - private final ContentHandler writer; - private final LexicalHandler lexical; - - public SaxSerializer(ContentHandler handler) { - this(handler,null,true); - } - - /** - * Creates an {@link XmlSerializer} that writes SAX events. - * - *

- * Sepcifying a non-null {@link LexicalHandler} allows applications - * to write comments and CDATA sections. - */ - public SaxSerializer(ContentHandler handler,LexicalHandler lex) { - this(handler, lex, true); - } - - public SaxSerializer(ContentHandler handler,LexicalHandler lex, boolean indenting) { - if(!indenting) { - writer = handler; - lexical = lex; - } else { - IndentingXMLFilter indenter = new IndentingXMLFilter(handler, lex); - writer = indenter; - lexical = indenter; - } - } - - public SaxSerializer(SAXResult result) { - this(result.getHandler(),result.getLexicalHandler()); - } - - - // XmlSerializer implementation - - public void startDocument() { - try { - writer.startDocument(); - } catch (SAXException e) { - throw new TxwException(e); - } - } - - // namespace prefix bindings - // add in #writeXmlns and fired in #endStartTag - private final Stack prefixBindings = new Stack(); - - public void writeXmlns(String prefix, String uri) { - // defend against parsers that pass null in for "xmlns" prefix - if (prefix == null) { - prefix = ""; - } - - if (prefix.equals("xml")) { - return; - } - - prefixBindings.add(uri); - prefixBindings.add(prefix); - } - - // element stack - private final Stack elementBindings = new Stack(); - - public void beginStartTag(String uri, String localName, String prefix) { - // save element bindings for #endTag - elementBindings.add(getQName(prefix, localName)); - elementBindings.add(localName); - elementBindings.add(uri); - } - - // attribute storage - // attrs are buffered in #writeAttribute and sent to the content - // handler in #endStartTag - private final AttributesImpl attrs = new AttributesImpl(); - - public void writeAttribute(String uri, String localName, String prefix, StringBuilder value) { - attrs.addAttribute(uri, - localName, - getQName(prefix, localName), - "CDATA", - value.toString()); - } - - public void endStartTag(String uri, String localName, String prefix) { - try { - while (prefixBindings.size() != 0) { - writer.startPrefixMapping(prefixBindings.pop(), // prefix - prefixBindings.pop() // uri - ); - } - - writer.startElement(uri, - localName, - getQName(prefix, localName), - attrs); - - attrs.clear(); - } catch (SAXException e) { - throw new TxwException(e); - } - } - - public void endTag() { - try { - writer.endElement(elementBindings.pop(), // uri - elementBindings.pop(), // localName - elementBindings.pop() // qname - ); - } catch (SAXException e) { - throw new TxwException(e); - } - } - - public void text(StringBuilder text) { - try { - writer.characters(text.toString().toCharArray(), 0, text.length()); - } catch (SAXException e) { - throw new TxwException(e); - } - } - - public void cdata(StringBuilder text) { - if(lexical==null) - throw new UnsupportedOperationException("LexicalHandler is needed to write PCDATA"); - - try { - lexical.startCDATA(); - text(text); - lexical.endCDATA(); - } catch (SAXException e) { - throw new TxwException(e); - } - } - - public void comment(StringBuilder comment) { - try { - if(lexical==null) - throw new UnsupportedOperationException("LexicalHandler is needed to write comments"); - else - lexical.comment(comment.toString().toCharArray(), 0, comment.length() ); - } catch (SAXException e) { - throw new TxwException(e); - } - } - - public void endDocument() { - try { - writer.endDocument(); - } catch (SAXException e) { - throw new TxwException(e); - } - } - - public void flush() { - // noop - } - - // other methods - private static String getQName(String prefix, String localName) { - final String qName; - if (prefix == null || prefix.length() == 0) - qName = localName; - else - qName = prefix + ':' + localName; - - return qName; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/StaxSerializer.java 2018-01-30 20:39:06.000000000 -0500 +++ /dev/null 2018-01-30 20:39:06.000000000 -0500 @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import com.sun.xml.internal.txw2.TxwException; - -import javax.xml.stream.XMLStreamException; -import javax.xml.stream.XMLStreamWriter; - -/** - * XML serializer for StAX XMLStreamWriter. - * - * TODO: add support for XMLEventWriter (if it makes sense) - * - * @author Ryan.Shoemaker@Sun.COM - */ - -public class StaxSerializer implements XmlSerializer { - private final XMLStreamWriter out; - - public StaxSerializer(XMLStreamWriter writer) { - this(writer,true); - } - - public StaxSerializer(XMLStreamWriter writer, boolean indenting) { - if(indenting) - writer = new IndentingXMLStreamWriter(writer); - this.out = writer; - } - - public void startDocument() { - try { - out.writeStartDocument(); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } - - public void beginStartTag(String uri, String localName, String prefix) { - try { - out.writeStartElement(prefix, localName, uri); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } - - public void writeAttribute(String uri, String localName, String prefix, StringBuilder value) { - try { - out.writeAttribute(prefix, uri, localName, value.toString()); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } - - public void writeXmlns(String prefix, String uri) { - try { - if (prefix.length() == 0) { - out.setDefaultNamespace(uri); - } else { - out.setPrefix(prefix, uri); - } - - // this method handles "", null, and "xmlns" prefixes properly - out.writeNamespace(prefix, uri); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } - - public void endStartTag(String uri, String localName, String prefix) { - // NO-OP - } - - public void endTag() { - try { - out.writeEndElement(); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } - - public void text(StringBuilder text) { - try { - out.writeCharacters(text.toString()); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } - - public void cdata(StringBuilder text) { - try { - out.writeCData(text.toString()); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } - - public void comment(StringBuilder comment) { - try { - out.writeComment(comment.toString()); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } - - public void endDocument() { - try { - out.writeEndDocument(); - out.flush(); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } - - public void flush() { - try { - out.flush(); - } catch (XMLStreamException e) { - throw new TxwException(e); - } - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/StreamSerializer.java 2018-01-30 20:39:07.000000000 -0500 +++ /dev/null 2018-01-30 20:39:07.000000000 -0500 @@ -1,194 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import com.sun.xml.internal.txw2.TxwException; - -import javax.xml.transform.stream.StreamResult; -import java.io.BufferedWriter; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.io.UnsupportedEncodingException; - -/** - * {@link XmlSerializer} for {@link javax.xml.transform.stream.StreamResult}. - * - * @author Ryan.Shoemaker@Sun.COM - */ -public class StreamSerializer implements XmlSerializer { - - // delegate to SaxSerializer - private final SaxSerializer serializer; - - private final XMLWriter writer; - - public StreamSerializer(OutputStream out) { - this(createWriter(out)); - } - - public StreamSerializer(OutputStream out,String encoding) throws UnsupportedEncodingException { - this(createWriter(out,encoding)); - } - - public StreamSerializer(Writer out) { - this(new StreamResult(out)); - } - - public StreamSerializer(StreamResult streamResult) { - // if this method opened a stream, let it close it - final OutputStream[] autoClose = new OutputStream[1]; - - if (streamResult.getWriter() != null) - writer = createWriter(streamResult.getWriter()); - else if (streamResult.getOutputStream() != null) - writer = createWriter(streamResult.getOutputStream()); - else if (streamResult.getSystemId() != null) { - String fileURL = streamResult.getSystemId(); - - fileURL = convertURL(fileURL); - - try { - FileOutputStream fos = new FileOutputStream(fileURL); - autoClose[0] = fos; - writer = createWriter(fos); - } catch (IOException e) { - throw new TxwException(e); - } - } else - throw new IllegalArgumentException(); - - // now delegate to the SaxSerializer - serializer = new SaxSerializer(writer,writer,false) { - public void endDocument() { - super.endDocument(); - if(autoClose[0]!=null) { - try { - autoClose[0].close(); - } catch (IOException e) { - throw new TxwException(e); - } - autoClose[0] = null; - } - } - }; - } - - private StreamSerializer(XMLWriter writer) { - this.writer = writer; - // now delegate to the SaxSerializer - serializer = new SaxSerializer(writer,writer,false); - } - - private String convertURL(String url) { - url = url.replace('\\', '/'); - url = url.replaceAll("//","/"); - url = url.replaceAll("//","/"); - if (url.startsWith("file:/")) { - if (url.substring(6).indexOf(":") > 0) - url = url.substring(6); - else - url = url.substring(5); - } // otherwise assume that it's a file name - return url; - } - - // XmlSerializer api's - delegate to SaxSerializer - public void startDocument() { - serializer.startDocument(); - } - - public void beginStartTag(String uri, String localName, String prefix) { - serializer.beginStartTag(uri, localName, prefix); - } - - public void writeAttribute(String uri, String localName, String prefix, StringBuilder value) { - serializer.writeAttribute(uri, localName, prefix, value); - } - - public void writeXmlns(String prefix, String uri) { - serializer.writeXmlns(prefix, uri); - } - - public void endStartTag(String uri, String localName, String prefix) { - serializer.endStartTag(uri, localName, prefix); - } - - public void endTag() { - serializer.endTag(); - } - - public void text(StringBuilder text) { - serializer.text(text); - } - - public void cdata(StringBuilder text) { - serializer.cdata(text); - } - - public void comment(StringBuilder comment) { - serializer.comment(comment); - } - - public void endDocument() { - serializer.endDocument(); - } - - public void flush() { - serializer.flush(); - try { - writer.flush(); - } catch (IOException e) { - throw new TxwException(e); - } - } - - // other supporting code - private static XMLWriter createWriter(Writer w) { - // buffering improves the performance - DataWriter dw = new DataWriter(new BufferedWriter(w)); - dw.setIndentStep(" "); - return dw; - } - - private static XMLWriter createWriter(OutputStream os, String encoding) throws UnsupportedEncodingException { - XMLWriter writer = createWriter(new OutputStreamWriter(os,encoding)); - writer.setEncoding(encoding); - return writer; - } - - private static XMLWriter createWriter(OutputStream os) { - try { - return createWriter(os,"UTF-8"); - } catch (UnsupportedEncodingException e) { - // UTF-8 is supported on all platforms. - throw new Error(e); - } - } - -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/TXWResult.java 2018-01-30 20:39:08.000000000 -0500 +++ /dev/null 2018-01-30 20:39:08.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import com.sun.xml.internal.txw2.TypedXmlWriter; - -import javax.xml.transform.Result; - -/** - * Allow you to wrap {@link TypedXmlWriter} into a {@link Result} - * so that it can be passed to {@link ResultFactory}. - * - *

- * This class doesn't extend from known {@link Result} type, - * so it won't work elsewhere. - * - * @author Kohsuke Kawaguchi - */ -public class TXWResult implements Result { - private String systemId; - - private TypedXmlWriter writer; - - public TXWResult(TypedXmlWriter writer) { - this.writer = writer; - } - - public TypedXmlWriter getWriter() { - return writer; - } - - public void setWriter(TypedXmlWriter writer) { - this.writer = writer; - } - - public String getSystemId() { - return systemId; - } - - public void setSystemId(String systemId) { - this.systemId = systemId; - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/TXWSerializer.java 2018-01-30 20:39:09.000000000 -0500 +++ /dev/null 2018-01-30 20:39:09.000000000 -0500 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import com.sun.xml.internal.txw2.TypedXmlWriter; -import com.sun.xml.internal.txw2.TXW; - -/** - * Dummpy implementation to pass through {@link TypedXmlWriter} - * to {@link TXW} - * - * @author Kohsuke Kawaguchi - */ -public final class TXWSerializer implements XmlSerializer { - public final TypedXmlWriter txw; - - public TXWSerializer(TypedXmlWriter txw) { - this.txw = txw; - } - - public void startDocument() { - throw new UnsupportedOperationException(); - } - - public void endDocument() { - throw new UnsupportedOperationException(); - } - - public void beginStartTag(String uri, String localName, String prefix) { - throw new UnsupportedOperationException(); - } - - public void writeAttribute(String uri, String localName, String prefix, StringBuilder value) { - throw new UnsupportedOperationException(); - } - - public void writeXmlns(String prefix, String uri) { - throw new UnsupportedOperationException(); - } - - public void endStartTag(String uri, String localName, String prefix) { - throw new UnsupportedOperationException(); - } - - public void endTag() { - throw new UnsupportedOperationException(); - } - - public void text(StringBuilder text) { - throw new UnsupportedOperationException(); - } - - public void cdata(StringBuilder text) { - throw new UnsupportedOperationException(); - } - - public void comment(StringBuilder comment) { - throw new UnsupportedOperationException(); - } - - public void flush() { - throw new UnsupportedOperationException(); - } -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/XMLWriter.java 2018-01-30 20:39:09.000000000 -0500 +++ /dev/null 2018-01-30 20:39:09.000000000 -0500 @@ -1,1075 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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. - */ - -// @@3RD PARTY CODE@@ - -// XMLWriter.java - serialize an XML document. -// Written by David Megginson, david@megginson.com -// NO WARRANTY! This class is in the public domain. - -// Id: XMLWriter.java,v 1.5 2000/09/17 01:08:16 david Exp - -package com.sun.xml.internal.txw2.output; - -import org.xml.sax.Attributes; -import org.xml.sax.SAXException; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.AttributesImpl; -import org.xml.sax.helpers.XMLFilterImpl; - -import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - - -/** - * Filter to write an XML document from a SAX event stream. - * - *

This class can be used by itself or as part of a SAX event - * stream: it takes as input a series of SAX2 ContentHandler - * events and uses the information in those events to write - * an XML document. Since this class is a filter, it can also - * pass the events on down a filter chain for further processing - * (you can use the XMLWriter to take a snapshot of the current - * state at any point in a filter chain), and it can be - * used directly as a ContentHandler for a SAX2 XMLReader.

- * - *

The client creates a document by invoking the methods for - * standard SAX2 events, always beginning with the - * {@link #startDocument startDocument} method and ending with - * the {@link #endDocument endDocument} method. There are convenience - * methods provided so that clients to not have to create empty - * attribute lists or provide empty strings as parameters; for - * example, the method invocation

- * - *
- * w.startElement("foo");
- * 
- * - *

is equivalent to the regular SAX2 ContentHandler method

- * - *
- * w.startElement("", "foo", "", new AttributesImpl());
- * 
- * - *

Except that it is more efficient because it does not allocate - * a new empty attribute list each time. The following code will send - * a simple XML document to standard output:

- * - *
- * XMLWriter w = new XMLWriter();
- *
- * w.startDocument();
- * w.startElement("greeting");
- * w.characters("Hello, world!");
- * w.endElement("greeting");
- * w.endDocument();
- * 
- * - *

The resulting document will look like this:

- * - *
{@code
- *  
- *
- * Hello, world!
- * }
- * - *

In fact, there is an even simpler convenience method, - * dataElement, designed for writing elements that - * contain only character data, so the code to generate the - * document could be shortened to

- * - *
- * XMLWriter w = new XMLWriter();
- *
- * w.startDocument();
- * w.dataElement("greeting", "Hello, world!");
- * w.endDocument();
- * 
- * - *

Whitespace

- * - *

According to the XML Recommendation, all whitespace - * in an XML document is potentially significant to an application, - * so this class never adds newlines or indentation. If you - * insert three elements in a row, as in

- * - *
- * w.dataElement("item", "1");
- * w.dataElement("item", "2");
- * w.dataElement("item", "3");
- * 
- * - *

you will end up with

- * - *
{@code
- * 133
- * }
- * - *

You need to invoke one of the characters methods - * explicitly to add newlines or indentation. Alternatively, you - * can use {@link DataWriter}, which - * is derived from this class -- it is optimized for writing - * purely data-oriented (or field-oriented) XML, and does automatic - * linebreaks and indentation (but does not support mixed content - * properly).

- * - * - *

Namespace Support

- * - *

The writer contains extensive support for XML Namespaces, so that - * a client application does not have to keep track of prefixes and - * supply xmlns attributes. By default, the XML writer will - * generate Namespace declarations in the form _NS1, _NS2, etc., wherever - * they are needed, as in the following example:

- * - *
- * w.startDocument();
- * w.emptyElement("http://www.foo.com/ns/", "foo");
- * w.endDocument();
- * 
- * - *

The resulting document will look like this:

- * - *
{@code
- * 
- *
- * <_NS1:foo xmlns:_NS1="http://www.foo.com/ns/"/>
- * }
- * - *

In many cases, document authors will prefer to choose their - * own prefixes rather than using the (ugly) default names. The - * XML writer allows two methods for selecting prefixes:

- * - *
    - *
  1. the qualified name
  2. - *
  3. the {@link #startPrefixMapping(String, String)} method.
  4. - *
- * - *

Whenever the XML writer finds a new Namespace URI, it checks - * to see if a qualified (prefixed) name is also available; if so - * it attempts to use the name's prefix (as long as the prefix is - * not already in use for another Namespace URI).

- * - *

Before writing a document, the client can also pre-map a prefix - * to a Namespace URI with the setPrefix method:

- * - *
- * w.setPrefix("http://www.foo.com/ns/", "foo");
- * w.startDocument();
- * w.emptyElement("http://www.foo.com/ns/", "foo");
- * w.endDocument();
- * 
- * - *

The resulting document will look like this:

- * - *
{@code
- * 
- *
- * 
- * }
- * - *

The default Namespace simply uses an empty string as the prefix:

- * - *
- * w.setPrefix("http://www.foo.com/ns/", "");
- * w.startDocument();
- * w.emptyElement("http://www.foo.com/ns/", "foo");
- * w.endDocument();
- * 
- * - *

The resulting document will look like this:

- * - *
{@code
- * 
- *
- * 
- * }
- * - *

By default, the XML writer will not declare a Namespace until - * it is actually used. Sometimes, this approach will create - * a large number of Namespace declarations, as in the following - * example:

- * - *
{@code
- * 
- *
- * 
- *  
- *   A Dark Night
- *   Jane Smith
- *   2000-09-09
- *  
- * 
- * }
- * - *

The "rdf" prefix is declared only once, because the RDF Namespace - * is used by the root element and can be inherited by all of its - * descendants; the "dc" prefix, on the other hand, is declared three - * times, because no higher element uses the Namespace. To solve this - * problem, you can instruct the XML writer to predeclare Namespaces - * on the root element even if they are not used there:

- * - *
- * w.forceNSDecl("http://www.purl.org/dc/");
- * 
- * - *

Now, the "dc" prefix will be declared on the root element even - * though it's not needed there, and can be inherited by its - * descendants:

- * - *
{@code
- * 
- *
- * 
- *  
- *   A Dark Night
- *   Jane Smith
- *   2000-09-09
- *  
- * 
- * }
- * - *

This approach is also useful for declaring Namespace prefixes - * that be used by qualified names appearing in attribute values or - * character data.

- * - * @author David Megginson, david@megginson.com - * @version 0.2 - * @since JAXB 1.0 - * @see org.xml.sax.XMLFilter - * @see org.xml.sax.ContentHandler - */ -public class XMLWriter extends XMLFilterImpl implements LexicalHandler -{ - //////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////// - - - - - /** - * Create a new XML writer. - * - *

Write to the writer provided.

- * - * @param writer - * The output destination, or null to use standard output. - * @param encoding - * If non-null string is specified, it is written as a part - * of the XML declaration. - */ - public XMLWriter (Writer writer, String encoding, CharacterEscapeHandler _escapeHandler ) - { - init(writer,encoding); - this.escapeHandler = _escapeHandler; - } - - public XMLWriter (Writer writer, String encoding ) { - this( writer, encoding, DumbEscapeHandler.theInstance ); - } - - - - /** - * Internal initialization method. - * - *

All of the public constructors invoke this method. - * - * @param writer The output destination, or null to use - * standard output. - */ - private void init (Writer writer,String encoding) - { - setOutput(writer,encoding); - } - - - - //////////////////////////////////////////////////////////////////// - // Public methods. - //////////////////////////////////////////////////////////////////// - - - /** - * Reset the writer. - * - *

This method is especially useful if the writer throws an - * exception before it is finished, and you want to reuse the - * writer for a new document. It is usually a good idea to - * invoke {@link #flush flush} before resetting the writer, - * to make sure that no output is lost.

- * - *

This method is invoked automatically by the - * {@link #startDocument startDocument} method before writing - * a new document.

- * - *

Note: this method will not - * clear the prefix or URI information in the writer or - * the selected output writer.

- * - * @see #flush() - */ - public void reset () - { - elementLevel = 0; - startTagIsClosed = true; - } - - - /** - * Flush the output. - * - *

This method flushes the output stream. It is especially useful - * when you need to make certain that the entire document has - * been written to output but do not want to _commit the output - * stream.

- * - *

This method is invoked automatically by the - * {@link #endDocument endDocument} method after writing a - * document.

- * - * @see #reset() - */ - public void flush () - throws IOException - { - output.flush(); - } - - - /** - * Set a new output destination for the document. - * - * @param writer The output destination, or null to use - * standard output. - * @see #flush() - */ - public void setOutput (Writer writer,String _encoding) - { - if (writer == null) { - output = new OutputStreamWriter(System.out); - } else { - output = writer; - } - encoding = _encoding; - } - - public void setEncoding(String encoding) { - this.encoding = encoding; - } - - /** - * Set whether the writer should print out the XML declaration - * ({@code }). - *

- * This option is set to true by default. - */ - public void setXmlDecl( boolean _writeXmlDecl ) { - this.writeXmlDecl = _writeXmlDecl; - } - - /** - * Sets the header string. - * - * This string will be written right after the xml declaration - * without any escaping. Useful for generating a boiler-plate - * DOCTYPE decl, PIs, and comments. - * - * @param _header - * passing null will work as if the empty string is passed. - */ - public void setHeader( String _header ) { - this.header = _header; - } - - - private final HashMap locallyDeclaredPrefix = new HashMap(); - public void startPrefixMapping( String prefix, String uri ) throws SAXException { - locallyDeclaredPrefix.put(prefix,uri); - } - - - //////////////////////////////////////////////////////////////////// - // Methods from org.xml.sax.ContentHandler. - //////////////////////////////////////////////////////////////////// - - /** - * Write the XML declaration at the beginning of the document. - * - * Pass the event on down the filter chain for further processing. - * - * @exception org.xml.sax.SAXException If there is an error - * writing the XML declaration, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#startDocument() - */ - public void startDocument () - throws SAXException - { - try { - reset(); - - if(writeXmlDecl) { - String e=""; - if(encoding!=null) - e = " encoding=\""+encoding+"\""; - - write("\n"); - } - - if(header!=null) - write(header); - - super.startDocument(); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - /** - * Write a newline at the end of the document. - * - * Pass the event on down the filter chain for further processing. - * - * @exception org.xml.sax.SAXException If there is an error - * writing the newline, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#endDocument() - */ - public void endDocument () - throws SAXException - { - try { - if (!startTagIsClosed) { - write("/>"); - startTagIsClosed = true; - } - write('\n'); - super.endDocument(); - try { - flush(); - } catch (IOException e) { - throw new SAXException(e); - } - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - /** - * Write a start tag. - * - * Pass the event on down the filter chain for further processing. - * - * @param uri The Namespace URI, or the empty string if none - * is available. - * @param localName The element's local (unprefixed) name (required). - * @param qName The element's qualified (prefixed) name, or the - * empty string is none is available. This method will - * use the qName as a template for generating a prefix - * if necessary, but it is not guaranteed to use the - * same qName. - * @param atts The element's attribute list (must not be null). - * @exception org.xml.sax.SAXException If there is an error - * writing the start tag, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) - */ - public void startElement (String uri, String localName, - String qName, Attributes atts) - throws SAXException - { - try { - if (!startTagIsClosed) { - write(">"); - } - elementLevel++; -// nsSupport.pushContext(); - - write('<'); - writeName(uri, localName, qName, true); - writeAttributes(atts); - - // declare namespaces specified by the startPrefixMapping methods - if(!locallyDeclaredPrefix.isEmpty()) { - Iterator itr = locallyDeclaredPrefix.entrySet().iterator(); - while(itr.hasNext()) { - Map.Entry e = (Map.Entry)itr.next(); - String p = (String)e.getKey(); - String u = (String)e.getValue(); - if (u == null) { - u = ""; - } - write(' '); - if ("".equals(p)) { - write("xmlns=\""); - } else { - write("xmlns:"); - write(p); - write("=\""); - } - char ch[] = u.toCharArray(); - writeEsc(ch, 0, ch.length, true); - write('\"'); - } - locallyDeclaredPrefix.clear(); // clear the contents - } - -// if (elementLevel == 1) { -// forceNSDecls(); -// } -// writeNSDecls(); - super.startElement(uri, localName, qName, atts); - startTagIsClosed = false; - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - /** - * Write an end tag. - * - * Pass the event on down the filter chain for further processing. - * - * @param uri The Namespace URI, or the empty string if none - * is available. - * @param localName The element's local (unprefixed) name (required). - * @param qName The element's qualified (prefixed) name, or the - * empty string is none is available. This method will - * use the qName as a template for generating a prefix - * if necessary, but it is not guaranteed to use the - * same qName. - * @exception org.xml.sax.SAXException If there is an error - * writing the end tag, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) - */ - public void endElement (String uri, String localName, String qName) - throws SAXException - { - try { - if (startTagIsClosed) { - write("'); - } else { - write("/>"); - startTagIsClosed = true; - } - if (elementLevel == 1) { - write('\n'); - } - super.endElement(uri, localName, qName); -// nsSupport.popContext(); - elementLevel--; - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - /** - * Write character data. - * - * Pass the event on down the filter chain for further processing. - * - * @param ch The array of characters to write. - * @param start The starting position in the array. - * @param len The number of characters to write. - * @exception org.xml.sax.SAXException If there is an error - * writing the characters, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#characters(char[], int, int) - */ - public void characters (char ch[], int start, int len) - throws SAXException - { - try { - if (!startTagIsClosed) { - write('>'); - startTagIsClosed = true; - } - if(inCDATA) - output.write(ch,start,len); - else - writeEsc(ch, start, len, false); - super.characters(ch, start, len); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - /** - * Write ignorable whitespace. - * - * Pass the event on down the filter chain for further processing. - * - * @param ch The array of characters to write. - * @param start The starting position in the array. - * @param length The number of characters to write. - * @exception org.xml.sax.SAXException If there is an error - * writing the whitespace, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) - */ - public void ignorableWhitespace (char ch[], int start, int length) - throws SAXException - { - try { - writeEsc(ch, start, length, false); - super.ignorableWhitespace(ch, start, length); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - - /** - * Write a processing instruction. - * - * Pass the event on down the filter chain for further processing. - * - * @param target The PI target. - * @param data The PI data. - * @exception org.xml.sax.SAXException If there is an error - * writing the PI, or if a handler further down - * the filter chain raises an exception. - * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) - */ - public void processingInstruction (String target, String data) - throws SAXException - { - try { - if (!startTagIsClosed) { - write('>'); - startTagIsClosed = true; - } - write(""); - if (elementLevel < 1) { - write('\n'); - } - super.processingInstruction(target, data); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Convenience methods. - //////////////////////////////////////////////////////////////////// - - - - /** - * Start a new element without a qname or attributes. - * - *

This method will provide a default empty attribute - * list and an empty string for the qualified name. - * It invokes {@link - * #startElement(String, String, String, Attributes)} - * directly.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @exception org.xml.sax.SAXException If there is an error - * writing the start tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - */ - public void startElement (String uri, String localName) - throws SAXException - { - startElement(uri, localName, "", EMPTY_ATTS); - } - - - /** - * Start a new element without a qname, attributes or a Namespace URI. - * - *

This method will provide an empty string for the - * Namespace URI, and empty string for the qualified name, - * and a default empty attribute list. It invokes - * #startElement(String, String, String, Attributes)} - * directly.

- * - * @param localName The element's local name. - * @exception org.xml.sax.SAXException If there is an error - * writing the start tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - */ - public void startElement (String localName) - throws SAXException - { - startElement("", localName, "", EMPTY_ATTS); - } - - - /** - * End an element without a qname. - * - *

This method will supply an empty string for the qName. - * It invokes {@link #endElement(String, String, String)} - * directly.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @exception org.xml.sax.SAXException If there is an error - * writing the end tag, or if a handler further down - * the filter chain raises an exception. - * @see #endElement(String, String, String) - */ - public void endElement (String uri, String localName) - throws SAXException - { - endElement(uri, localName, ""); - } - - - /** - * End an element without a Namespace URI or qname. - * - *

This method will supply an empty string for the qName - * and an empty string for the Namespace URI. - * It invokes {@link #endElement(String, String, String)} - * directly.

- * - * @param localName The element's local name. - * @exception org.xml.sax.SAXException If there is an error - * writing the end tag, or if a handler further down - * the filter chain raises an exception. - * @see #endElement(String, String, String) - */ - public void endElement (String localName) - throws SAXException - { - endElement("", localName, ""); - } - - - /** - * Write an element with character data content. - * - *

This is a convenience method to write a complete element - * with character data content, including the start tag - * and end tag.

- * - *

This method invokes - * {@link #startElement(String, String, String, Attributes)}, - * followed by - * {@link #characters(String)}, followed by - * {@link #endElement(String, String, String)}.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param qName The element's default qualified name. - * @param atts The element's attributes. - * @param content The character data content. - * @exception org.xml.sax.SAXException If there is an error - * writing the empty tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - * @see #characters(String) - * @see #endElement(String, String, String) - */ - public void dataElement (String uri, String localName, - String qName, Attributes atts, - String content) - throws SAXException - { - startElement(uri, localName, qName, atts); - characters(content); - endElement(uri, localName, qName); - } - - - /** - * Write an element with character data content but no attributes. - * - *

This is a convenience method to write a complete element - * with character data content, including the start tag - * and end tag. This method provides an empty string - * for the qname and an empty attribute list.

- * - *

This method invokes - * {@link #startElement(String, String, String, Attributes)}, - * followed by - * {@link #characters(String)}, followed by - * {@link #endElement(String, String, String)}.

- * - * @param uri The element's Namespace URI. - * @param localName The element's local name. - * @param content The character data content. - * @exception org.xml.sax.SAXException If there is an error - * writing the empty tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - * @see #characters(String) - * @see #endElement(String, String, String) - */ - public void dataElement (String uri, String localName, String content) - throws SAXException - { - dataElement(uri, localName, "", EMPTY_ATTS, content); - } - - - /** - * Write an element with character data content but no attributes or Namespace URI. - * - *

This is a convenience method to write a complete element - * with character data content, including the start tag - * and end tag. The method provides an empty string for the - * Namespace URI, and empty string for the qualified name, - * and an empty attribute list.

- * - *

This method invokes - * {@link #startElement(String, String, String, Attributes)}, - * followed by - * {@link #characters(String)}, followed by - * {@link #endElement(String, String, String)}.

- * - * @param localName The element's local name. - * @param content The character data content. - * @exception org.xml.sax.SAXException If there is an error - * writing the empty tag, or if a handler further down - * the filter chain raises an exception. - * @see #startElement(String, String, String, Attributes) - * @see #characters(String) - * @see #endElement(String, String, String) - */ - public void dataElement (String localName, String content) - throws SAXException - { - dataElement("", localName, "", EMPTY_ATTS, content); - } - - - /** - * Write a string of character data, with XML escaping. - * - *

This is a convenience method that takes an XML - * String, converts it to a character array, then invokes - * {@link #characters(char[], int, int)}.

- * - * @param data The character data. - * @exception org.xml.sax.SAXException If there is an error - * writing the string, or if a handler further down - * the filter chain raises an exception. - * @see #characters(char[], int, int) - */ - public void characters (String data) throws SAXException { - try { - if (!startTagIsClosed) { - write('>'); - startTagIsClosed = true; - } - char ch[] = data.toCharArray(); - characters(ch, 0, ch.length); - } catch( IOException e ) { - throw new SAXException(e); - } - } - - - public void startDTD(String name, String publicId, String systemId) throws SAXException { - } - - public void endDTD() throws SAXException { - } - - public void startEntity(String name) throws SAXException { - } - - public void endEntity(String name) throws SAXException { - } - - public void startCDATA() throws SAXException { - try { - if (!startTagIsClosed) { - write('>'); - startTagIsClosed = true; - } - write(""); - } catch (IOException e) { - throw new SAXException(e); - } - } - - public void comment(char ch[], int start, int length) throws SAXException { - try { - output.write(""); - } catch (IOException e) { - throw new SAXException(e); - } - } - - - - //////////////////////////////////////////////////////////////////// - // Internal methods. - //////////////////////////////////////////////////////////////////// - - - - - /** - * Write a raw character. - * - * @param c The character to write. - */ - private void write (char c) throws IOException { - output.write(c); - } - - - /** - * Write a raw string. - */ - private void write (String s) throws IOException { - output.write(s); - } - - - /** - * Write out an attribute list, escaping values. - * - * The names will have prefixes added to them. - * - * @param atts The attribute list to write. - * @exception SAXException If there is an error writing - * the attribute list, this method will throw an - * IOException wrapped in a SAXException. - */ - private void writeAttributes (Attributes atts) throws IOException, SAXException { - int len = atts.getLength(); - for (int i = 0; i < len; i++) { - char ch[] = atts.getValue(i).toCharArray(); - write(' '); - writeName(atts.getURI(i), atts.getLocalName(i), - atts.getQName(i), false); - write("=\""); - writeEsc(ch, 0, ch.length, true); - write('"'); - } - } - - - /** - * Write an array of data characters with escaping. - * - * @param ch The array of characters. - * @param start The starting position. - * @param length The number of characters to use. - * @param isAttVal true if this is an attribute value literal. - * @exception SAXException If there is an error writing - * the characters, this method will throw an - * IOException wrapped in a SAXException. - */ - private void writeEsc (char ch[], int start, - int length, boolean isAttVal) - throws SAXException, IOException - { - escapeHandler.escape(ch, start, length, isAttVal, output); - } - - - /** - * Write an element or attribute name. - * - * @param uri The Namespace URI. - * @param localName The local name. - * @param qName The prefixed name, if available, or the empty string. - * @param isElement true if this is an element name, false if it - * is an attribute name. - */ - private void writeName (String uri, String localName, - String qName, boolean isElement) - throws IOException - { - write(qName); - } - - - - //////////////////////////////////////////////////////////////////// - // Constants. - //////////////////////////////////////////////////////////////////// - - private final Attributes EMPTY_ATTS = new AttributesImpl(); - - - - //////////////////////////////////////////////////////////////////// - // Internal state. - //////////////////////////////////////////////////////////////////// - - private boolean inCDATA = false; - private int elementLevel = 0; - private Writer output; - private String encoding; - private boolean writeXmlDecl = true; - /** - * This string will be written right after the xml declaration - * without any escaping. Useful for generating a boiler-plate DOCTYPE decl - * , PIs, and comments. - */ - private String header=null; - - private final CharacterEscapeHandler escapeHandler; - - private boolean startTagIsClosed = true; -} - -// end of XMLWriter.java --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/XmlSerializer.java 2018-01-30 20:39:10.000000000 -0500 +++ /dev/null 2018-01-30 20:39:10.000000000 -0500 @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2005, 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.xml.internal.txw2.output; - -import com.sun.xml.internal.txw2.TypedXmlWriter; - - -/** - * Low-level typeless XML writer driven from {@link TypedXmlWriter}. - * - *

- * Applications can use one of the predefined implementations to - * send TXW output to the desired location/format, or they can - * choose to implement this interface for custom output. - * - *

- * One {@link XmlSerializer} instance is responsible for writing - * one XML document. - * - *

Call Sequence

- * TXW calls methods on this interface in the following order: - * - *
- * WHOLE_SEQUENCE := startDocument ELEMENT endDocument
- * ELEMENT := beginStartTag writeXmlns* writeAttribute* endStartTag CONTENT endTag
- * CONTENT := (text|ELEMENT)*
- * 
- * - *

- * TXW maintains all the in-scope namespace bindings and prefix allocation. - * The {@link XmlSerializer} implementation should just use the prefix - * specified. - *

- * - * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - */ -public interface XmlSerializer { - /** - * The first method to be called. - */ - void startDocument(); - - /** - * Begins writing a start tag. - * - * @param uri - * the namespace URI of the element. Can be empty but never be null. - * @param prefix - * the prefix that should be used for this element. Can be empty, - * but never null. - */ - void beginStartTag(String uri,String localName,String prefix); - - /** - * Writes an attribute. - * - * @param value - * The value of the attribute. It's the callee's responsibility to - * escape special characters (such as <, >, and &) in this buffer. - * - * @param uri - * the namespace URI of the attribute. Can be empty but never be null. - * @param prefix - * the prefix that should be used for this attribute. Can be empty, - * but never null. - */ - void writeAttribute(String uri,String localName,String prefix,StringBuilder value); - - /** - * Writes a namespace declaration. - * - * @param uri - * the namespace URI to be declared. Can be empty but never be null. - * @param prefix - * the prefix that is allocated. Can be empty but never be null. - */ - void writeXmlns(String prefix,String uri); - - /** - * Completes the start tag. - * - * @param uri - * the namespace URI of the element. Can be empty but never be null. - * @param prefix - * the prefix that should be used for this element. Can be empty, - * but never null. - */ - void endStartTag(String uri,String localName,String prefix); - - /** - * Writes an end tag. - */ - void endTag(); - - /** - * Writes PCDATA. - * - * @param text - * The character data to be written. It's the callee's responsibility to - * escape special characters (such as <, >, and &) in this buffer. - */ - void text(StringBuilder text); - - /** - * Writes CDATA. - */ - void cdata(StringBuilder text); - - /** - * Writes a comment. - * - * @throws UnsupportedOperationException - * if the writer doesn't support writing a comment, it can throw this exception. - */ - void comment(StringBuilder comment); - - /** - * The last method to be called. - */ - void endDocument(); - - /** - * Flush the buffer. - * - * This method is called when applications invoke {@link TypedXmlWriter#commit(boolean)} - * method. If the implementation performs any buffering, it should flush the buffer. - */ - void flush(); -} --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/package.html 2018-01-30 20:39:11.000000000 -0500 +++ /dev/null 2018-01-30 20:39:11.000000000 -0500 @@ -1,34 +0,0 @@ - - - - - - -

- Defines XmlSerializer and its built-in implementations. - - - --- old/src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/package.html 2018-01-30 20:39:12.000000000 -0500 +++ /dev/null 2018-01-30 20:39:12.000000000 -0500 @@ -1,34 +0,0 @@ - - - - - - -

- TXW runtime. - - - --- old/src/java.xml.bind/share/classes/javax/xml/bind/Binder.java 2018-01-30 20:39:13.000000000 -0500 +++ /dev/null 2018-01-30 20:39:13.000000000 -0500 @@ -1,421 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind; - -import org.w3c.dom.Node; - -import javax.xml.validation.Schema; - -/** - * Enable synchronization between XML infoset nodes and JAXB objects - * representing same XML document. - * - *

- * An instance of this class maintains the association between XML nodes of - * an infoset preserving view and a JAXB representation of an XML document. - * Navigation between the two views is provided by the methods - * {@link #getXMLNode(Object)} and {@link #getJAXBNode(Object)}. - * - *

- * Modifications can be made to either the infoset preserving view or the - * JAXB representation of the document while the other view remains - * unmodified. The binder is able to synchronize the changes made in the - * modified view back into the other view using the appropriate - * Binder update methods, {@link #updateXML(Object, Object)} or - * {@link #updateJAXB(Object)}. - * - *

- * A typical usage scenario is the following: - *

    - *
  • load XML document into an XML infoset representation
  • - *
  • {@link #unmarshal(Object)} XML infoset view to JAXB view. - * (Note to conserve resources, it is possible to only unmarshal a - * subtree of the XML infoset view to the JAXB view.)
  • - *
  • application access/updates JAXB view of XML document.
  • - *
  • {@link #updateXML(Object)} synchronizes modifications to JAXB view - * back into the XML infoset view. Update operation preserves as - * much of original XML infoset as possible (i.e. comments, PI, ...)
  • - *
- * - *

- * A Binder instance is created using the factory method - * {@link JAXBContext#createBinder()} or {@link JAXBContext#createBinder(Class)}. - * - *

- * The template parameter, XmlNode, is the - * root interface/class for the XML infoset preserving representation. - * A Binder implementation is required to minimally support - * an XmlNode value of org.w3c.dom.Node.class. - * A Binder implementation can support alternative XML infoset - * preserving representations. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * Joseph Fialli - * - * @since 1.6, JAXB 2.0 - */ -public abstract class Binder { - /** - * Unmarshal XML infoset view to a JAXB object tree. - * - *

- * This method is similar to {@link Unmarshaller#unmarshal(Node)} - * with the addition of maintaining the association between XML nodes - * and the produced JAXB objects, enabling future update operations, - * {@link #updateXML(Object, Object)} or {@link #updateJAXB(Object)}. - * - *

- * When {@link #getSchema()} is non-null, xmlNode - * and its descendants is validated during this operation. - * - *

- * This method throws {@link UnmarshalException} when the Binder's - * {@link JAXBContext} does not have a mapping for the XML element name - * or the type, specifiable via {@code @xsi:type}, of {@code xmlNode} - * to a JAXB mapped class. The method {@link #unmarshal(Object, Class)} - * enables an application to specify the JAXB mapped class that - * the {@code xmlNode} should be mapped to. - * - * @param xmlNode - * the document/element to unmarshal XML data from. - * - * @return - * the newly created root object of the JAXB object tree. - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Binder} is unable to perform the XML to Java - * binding. - * @throws IllegalArgumentException - * If the node parameter is null - */ - public abstract Object unmarshal( XmlNode xmlNode ) throws JAXBException; - - /** - * Unmarshal XML root element by provided {@code declaredType} - * to a JAXB object tree. - * - *

- * Implements Unmarshal by Declared Type - * - *

- * This method is similar to {@link Unmarshaller#unmarshal(Node, Class)} - * with the addition of maintaining the association between XML nodes - * and the produced JAXB objects, enabling future update operations, - * {@link #updateXML(Object, Object)} or {@link #updateJAXB(Object)}. - * - *

- * When {@link #getSchema()} is non-null, xmlNode - * and its descendants is validated during this operation. - * - * @param xmlNode - * the document/element to unmarshal XML data from. - * @param declaredType - * appropriate JAXB mapped class to hold {@code node}'s XML data. - * - * @return - * JAXB Element representation - * of {@code node} - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Binder} is unable to perform the XML to Java - * binding. - * @throws IllegalArgumentException - * If any of the input parameters are null - * @since 1.6, JAXB 2.0 - */ - public abstract JAXBElement - unmarshal( XmlNode xmlNode, Class declaredType ) - throws JAXBException; - - /** - * Marshal a JAXB object tree to a new XML document. - * - *

- * This method is similar to {@link Marshaller#marshal(Object, Node)} - * with the addition of maintaining the association between JAXB objects - * and the produced XML nodes, - * enabling future update operations such as - * {@link #updateXML(Object, Object)} or {@link #updateJAXB(Object)}. - * - *

- * When {@link #getSchema()} is non-null, the marshalled - * xml content is validated during this operation. - * - * @param jaxbObject - * The content tree to be marshalled. - * @param xmlNode - * The parameter must be a Node that accepts children. - * - * @throws JAXBException - * If any unexpected problem occurs during the marshalling. - * @throws MarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Binder} is unable to marshal {@code jaxbObject} (or any - * object reachable from {@code jaxbObject}). - * - * @throws IllegalArgumentException - * If any of the method parameters are null - */ - public abstract void marshal( Object jaxbObject, XmlNode xmlNode ) throws JAXBException; - - /** - * Gets the XML element associated with the given JAXB object. - * - *

- * Once a JAXB object tree is associated with an XML fragment, - * this method enables navigation between the two trees. - * - *

- * An association between an XML element and a JAXB object is - * established by the bind methods and the update methods. - * Note that this association is partial; not all XML elements - * have associated JAXB objects, and not all JAXB objects have - * associated XML elements. - * - * @param jaxbObject An instance that is reachable from a prior - * call to a bind or update method that returned - * a JAXB object tree. - * - * @return - * null if the specified JAXB object is not known to this - * {@link Binder}, or if it is not associated with an - * XML element. - * - * @throws IllegalArgumentException - * If the jaxbObject parameter is null - */ - public abstract XmlNode getXMLNode( Object jaxbObject ); - - /** - * Gets the JAXB object associated with the given XML element. - * - *

- * Once a JAXB object tree is associated with an XML fragment, - * this method enables navigation between the two trees. - * - *

- * An association between an XML element and a JAXB object is - * established by the unmarshal, marshal and update methods. - * Note that this association is partial; not all XML elements - * have associated JAXB objects, and not all JAXB objects have - * associated XML elements. - * - * @return - * null if the specified XML node is not known to this - * {@link Binder}, or if it is not associated with a - * JAXB object. - * - * @throws IllegalArgumentException - * If the node parameter is null - */ - public abstract Object getJAXBNode( XmlNode xmlNode ); - - /** - * Takes an JAXB object and updates - * its associated XML node and its descendants. - * - *

- * This is a convenience method of: - *

-     * updateXML( jaxbObject, getXMLNode(jaxbObject));
-     * 
- * - * @throws JAXBException - * If any unexpected problem occurs updating corresponding XML content. - * @throws IllegalArgumentException - * If the jaxbObject parameter is null - */ - public abstract XmlNode updateXML( Object jaxbObject ) throws JAXBException; - - /** - * Changes in JAXB object tree are updated in its associated XML parse tree. - * - *

- * This operation can be thought of as an "in-place" marshalling. - * The difference is that instead of creating a whole new XML tree, - * this operation updates an existing tree while trying to preserve - * the XML as much as possible. - * - *

- * For example, unknown elements/attributes in XML that were not bound - * to JAXB will be left untouched (whereas a marshalling operation - * would create a new tree that doesn't contain any of those.) - * - *

- * As a side-effect, this operation updates the association between - * XML nodes and JAXB objects. - * - * @param jaxbObject root of potentially modified JAXB object tree - * @param xmlNode root of update target XML parse tree - * - * @return - * Returns the updated XML node. Typically, this is the same - * node you passed in as xmlNode, but it maybe - * a different object, for example when the tag name of the object - * has changed. - * - * @throws JAXBException - * If any unexpected problem occurs updating corresponding XML content. - * @throws IllegalArgumentException - * If any of the input parameters are null - */ - public abstract XmlNode updateXML( Object jaxbObject, XmlNode xmlNode ) throws JAXBException; - - /** - * Takes an XML node and updates its associated JAXB object and its descendants. - * - *

- * This operation can be thought of as an "in-place" unmarshalling. - * The difference is that instead of creating a whole new JAXB tree, - * this operation updates an existing tree, reusing as much JAXB objects - * as possible. - * - *

- * As a side-effect, this operation updates the association between - * XML nodes and JAXB objects. - * - * @return - * Returns the updated JAXB object. Typically, this is the same - * object that was returned from earlier - * {@link #marshal(Object,Object)} or - * {@link #updateJAXB(Object)} method invocation, - * but it maybe - * a different object, for example when the name of the XML - * element has changed. - * - * @throws JAXBException - * If any unexpected problem occurs updating corresponding JAXB mapped content. - * @throws IllegalArgumentException - * If node parameter is null - */ - public abstract Object updateJAXB( XmlNode xmlNode ) throws JAXBException; - - - /** - * Specifies whether marshal, unmarshal and update methods - * performs validation on their XML content. - * - * @param schema set to null to disable validation. - * - * @see Unmarshaller#setSchema(Schema) - */ - public abstract void setSchema( Schema schema ); - - /** - * Gets the last {@link Schema} object (including null) set by the - * {@link #setSchema(Schema)} method. - * - * @return the Schema object for validation or null if not present - */ - public abstract Schema getSchema(); - - /** - * Allow an application to register a {@code ValidationEventHandler}. - *

- * The {@code ValidationEventHandler} will be called by the JAXB Provider - * if any validation errors are encountered during calls to any of the - * Binder unmarshal, marshal and update methods. - * - *

- * Calling this method with a null parameter will cause the Binder - * to revert back to the default default event handler. - * - * @param handler the validation event handler - * @throws JAXBException if an error was encountered while setting the - * event handler - */ - public abstract void setEventHandler( ValidationEventHandler handler ) throws JAXBException; - - /** - * Return the current event handler or the default event handler if one - * hasn't been set. - * - * @return the current ValidationEventHandler or the default event handler - * if it hasn't been set - * @throws JAXBException if an error was encountered while getting the - * current event handler - */ - public abstract ValidationEventHandler getEventHandler() throws JAXBException; - - /** - * - * Set the particular property in the underlying implementation of - * {@code Binder}. This method can only be used to set one of - * the standard JAXB defined unmarshal/marshal properties - * or a provider specific property for binder, unmarshal or marshal. - * Attempting to set an undefined property will result in - * a PropertyException being thrown. See - * Supported Unmarshal Properties - * and - * Supported Marshal Properties. - * - * @param name the name of the property to be set. This value can either - * be specified using one of the constant fields or a user - * supplied string. - * @param value the value of the property to be set - * - * @throws PropertyException when there is an error processing the given - * property or value - * @throws IllegalArgumentException - * If the name parameter is null - */ - abstract public void setProperty( String name, Object value ) throws PropertyException; - - - /** - * Get the particular property in the underlying implementation of - * {@code Binder}. This method can only - * be used to get one of - * the standard JAXB defined unmarshal/marshal properties - * or a provider specific property for binder, unmarshal or marshal. - * Attempting to get an undefined property will result in - * a PropertyException being thrown. See - * Supported Unmarshal Properties - * and - * Supported Marshal Properties. - * - * @param name the name of the property to retrieve - * @return the value of the requested property - * - * @throws PropertyException - * when there is an error retrieving the given property or value - * property name - * @throws IllegalArgumentException - * If the name parameter is null - */ - abstract public Object getProperty( String name ) throws PropertyException; - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/ContextFinder.java 2018-01-30 20:39:13.000000000 -0500 +++ /dev/null 2018-01-30 20:39:13.000000000 -0500 @@ -1,657 +0,0 @@ -/* - * Copyright (c) 2003, 2017, 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 javax.xml.bind; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.net.URL; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.util.Map; -import java.util.Properties; -import java.util.StringTokenizer; -import java.util.logging.ConsoleHandler; -import java.util.logging.Level; -import java.util.logging.Logger; - - -/** - * This class is package private and therefore is not exposed as part of the - * JAXB API. - * - * This code is designed to implement the JAXB 1.0 spec pluggability feature - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
- * @see JAXBContext - */ -class ContextFinder { - - /** - * When JAXB is in J2SE, rt.jar has to have a JAXB implementation. - * However, rt.jar cannot have META-INF/services/javax.xml.bind.JAXBContext - * because if it has, it will take precedence over any file that applications have - * in their jar files. - * - *

- * When the user bundles his own JAXB implementation, we'd like to use it, and we - * want the platform default to be used only when there's no other JAXB provider. - * - *

- * For this reason, we have to hard-code the class name into the API. - */ - private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory"; - - // previous value of JAXBContext.JAXB_CONTEXT_FACTORY, using also this to ensure backwards compatibility - private static final String JAXB_CONTEXT_FACTORY_DEPRECATED = "javax.xml.bind.context.factory"; - - private static final Logger logger; - - static { - logger = Logger.getLogger("javax.xml.bind"); - try { - if (AccessController.doPrivileged(new GetPropertyAction("jaxb.debug")) != null) { - // disconnect the logger from a bigger framework (if any) - // and take the matters into our own hands - logger.setUseParentHandlers(false); - logger.setLevel(Level.ALL); - ConsoleHandler handler = new ConsoleHandler(); - handler.setLevel(Level.ALL); - logger.addHandler(handler); - } else { - // don't change the setting of this logger - // to honor what other frameworks - // have done on configurations. - } - } catch (Throwable t) { - // just to be extra safe. in particular System.getProperty may throw - // SecurityException. - } - } - - private static ServiceLoaderUtil.ExceptionHandler EXCEPTION_HANDLER = - new ServiceLoaderUtil.ExceptionHandler() { - @Override - public JAXBException createException(Throwable throwable, String message) { - return new JAXBException(message, throwable); - } - }; - - /** - * If the {@link InvocationTargetException} wraps an exception that shouldn't be wrapped, - * throw the wrapped exception. Otherwise returns exception to be wrapped for further processing. - */ - private static Throwable handleInvocationTargetException(InvocationTargetException x) throws JAXBException { - Throwable t = x.getTargetException(); - if (t != null) { - if (t instanceof JAXBException) - // one of our exceptions, just re-throw - throw (JAXBException) t; - if (t instanceof RuntimeException) - // avoid wrapping exceptions unnecessarily - throw (RuntimeException) t; - if (t instanceof Error) - throw (Error) t; - return t; - } - return x; - } - - - /** - * Determine if two types (JAXBContext in this case) will generate a ClassCastException. - * - * For example, (targetType)originalType - * - * @param originalType - * The Class object of the type being cast - * @param targetType - * The Class object of the type that is being cast to - * @return JAXBException to be thrown. - */ - private static JAXBException handleClassCastException(Class originalType, Class targetType) { - final URL targetTypeURL = which(targetType); - - return new JAXBException(Messages.format(Messages.ILLEGAL_CAST, - // we don't care where the impl class is, we want to know where JAXBContext lives in the impl - // class' ClassLoader - getClassClassLoader(originalType).getResource("javax/xml/bind/JAXBContext.class"), - targetTypeURL)); - } - - /** - * Create an instance of a class using the specified ClassLoader - */ - static JAXBContext newInstance(String contextPath, - Class[] contextPathClasses, - String className, - ClassLoader classLoader, - Map properties) throws JAXBException { - - try { - Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader); - return newInstance(contextPath, contextPathClasses, spFactory, classLoader, properties); - } catch (ClassNotFoundException x) { - throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), x); - - } catch (RuntimeException | JAXBException x) { - // avoid wrapping RuntimeException to JAXBException, - // because it indicates a bug in this code. - // JAXBException re-thrown as is - throw x; - } catch (Exception x) { - // can't catch JAXBException because the method is hidden behind - // reflection. Root element collisions detected in the call to - // createContext() are reported as JAXBExceptions - just re-throw it - // some other type of exception - just wrap it - throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, className, x), x); - } - } - - static JAXBContext newInstance(String contextPath, - Class[] contextPathClasses, - Class spFactory, - ClassLoader classLoader, - Map properties) throws JAXBException { - - try { - - ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, spFactory); - - /* - * javax.xml.bind.context.factory points to a class which has a - * static method called 'createContext' that - * returns a javax.xml.JAXBContext. - */ - - Object context = null; - - // first check the method that takes Map as the third parameter. - // this is added in 2.0. - try { - Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class, Map.class); - // any failure in invoking this method would be considered fatal - Object obj = instantiateProviderIfNecessary(spFactory); - context = m.invoke(obj, contextPath, classLoader, properties); - } catch (NoSuchMethodException ignored) { - // it's not an error for the provider not to have this method. - } - - if (context == null) { - // try the old method that doesn't take properties. compatible with 1.0. - // it is an error for an implementation not to have both forms of the createContext method. - Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class); - Object obj = instantiateProviderIfNecessary(spFactory); - // any failure in invoking this method would be considered fatal - context = m.invoke(obj, contextPath, classLoader); - } - - if (!(context instanceof JAXBContext)) { - // the cast would fail, so generate an exception with a nice message - throw handleClassCastException(context.getClass(), JAXBContext.class); - } - - return (JAXBContext) context; - } catch (InvocationTargetException x) { - // throw if it is exception not to be wrapped - // otherwise, wrap with a JAXBException - Throwable e = handleInvocationTargetException(x); - throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, spFactory, e), e); - - } catch (Exception x) { - // can't catch JAXBException because the method is hidden behind - // reflection. Root element collisions detected in the call to - // createContext() are reported as JAXBExceptions - just re-throw it - // some other type of exception - just wrap it - throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, spFactory, x), x); - } - } - - private static Object instantiateProviderIfNecessary(final Class implClass) throws JAXBException { - try { - if (JAXBContextFactory.class.isAssignableFrom(implClass)) { - return AccessController.doPrivileged(new PrivilegedExceptionAction() { - @Override - public Object run() throws Exception { - return implClass.newInstance(); - } - }); - } - return null; - } catch (PrivilegedActionException x) { - Throwable e = (x.getCause() == null) ? x : x.getCause(); - throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, implClass, e), e); - } - } - - /** - * Create an instance of a class using the thread context ClassLoader - */ - static JAXBContext newInstance(Class[] classes, Map properties, String className) throws JAXBException { - - Class spi; - try { - spi = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, getContextClassLoader()); - } catch (ClassNotFoundException e) { - throw new JAXBException(Messages.format(Messages.DEFAULT_PROVIDER_NOT_FOUND), e); - } - - if (logger.isLoggable(Level.FINE)) { - // extra check to avoid costly which operation if not logged - logger.log(Level.FINE, "loaded {0} from {1}", new Object[]{className, which(spi)}); - } - - return newInstance(classes, properties, spi); - } - - static JAXBContext newInstance(Class[] classes, - Map properties, - Class spFactory) throws JAXBException { - try { - ModuleUtil.delegateAddOpensToImplModule(classes, spFactory); - - Method m = spFactory.getMethod("createContext", Class[].class, Map.class); - Object obj = instantiateProviderIfNecessary(spFactory); - Object context = m.invoke(obj, classes, properties); - if (!(context instanceof JAXBContext)) { - // the cast would fail, so generate an exception with a nice message - throw handleClassCastException(context.getClass(), JAXBContext.class); - } - return (JAXBContext) context; - - } catch (NoSuchMethodException | IllegalAccessException e) { - throw new JAXBException(e); - } catch (InvocationTargetException e) { - // throw if it is exception not to be wrapped - // otherwise, wrap with a JAXBException - Throwable x = handleInvocationTargetException(e); - - throw new JAXBException(x); - } - } - - static JAXBContext find(String factoryId, - String contextPath, - ClassLoader classLoader, - Map properties) throws JAXBException { - - if (contextPath == null || contextPath.isEmpty()) { - // no context is specified - throw new JAXBException(Messages.format(Messages.NO_PACKAGE_IN_CONTEXTPATH)); - } - - //ModuleUtil is mr-jar class, scans context path for jaxb classes on jdk9 and higher - Class[] contextPathClasses = ModuleUtil.getClassesFromContextPath(contextPath, classLoader); - - //first try with classloader#getResource - String factoryClassName = jaxbProperties(contextPath, classLoader, factoryId); - if (factoryClassName == null && contextPathClasses != null) { - //try with class#getResource - factoryClassName = jaxbProperties(contextPathClasses, factoryId); - } - - if (factoryClassName != null) { - return newInstance(contextPath, contextPathClasses, factoryClassName, classLoader, properties); - } - - - String factoryName = classNameFromSystemProperties(); - if (factoryName != null) return newInstance(contextPath, contextPathClasses, factoryName, classLoader, properties); - - JAXBContextFactory obj = ServiceLoaderUtil.firstByServiceLoader( - JAXBContextFactory.class, logger, EXCEPTION_HANDLER); - - if (obj != null) { - ModuleUtil.delegateAddOpensToImplModule(contextPathClasses, obj.getClass()); - return obj.createContext(contextPath, classLoader, properties); - } - - // to ensure backwards compatibility - factoryName = firstByServiceLoaderDeprecated(JAXBContext.class, classLoader); - if (factoryName != null) return newInstance(contextPath, contextPathClasses, factoryName, classLoader, properties); - - Class ctxFactory = (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader( - "javax.xml.bind.JAXBContext", logger); - - if (ctxFactory != null) { - return newInstance(contextPath, contextPathClasses, ctxFactory, classLoader, properties); - } - - // else no provider found - logger.fine("Trying to create the platform default provider"); - return newInstance(contextPath, contextPathClasses, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties); - } - - static JAXBContext find(Class[] classes, Map properties) throws JAXBException { - - // search for jaxb.properties in the class loader of each class first - logger.fine("Searching jaxb.properties"); - for (final Class c : classes) { - // this classloader is used only to load jaxb.properties, so doing this should be safe. - // this is possible for primitives, arrays, and classes that are - // loaded by poorly implemented ClassLoaders - if (c.getPackage() == null) continue; - - // TODO: do we want to optimize away searching the same package? org.Foo, org.Bar, com.Baz - // classes from the same package might come from different class loades, so it might be a bad idea - // TODO: it's easier to look things up from the class - // c.getResourceAsStream("jaxb.properties"); - - URL jaxbPropertiesUrl = getResourceUrl(c, "jaxb.properties"); - - if (jaxbPropertiesUrl != null) { - - String factoryClassName = - classNameFromPackageProperties( - jaxbPropertiesUrl, - JAXBContext.JAXB_CONTEXT_FACTORY, JAXB_CONTEXT_FACTORY_DEPRECATED); - - return newInstance(classes, properties, factoryClassName); - } - - } - - String factoryClassName = classNameFromSystemProperties(); - if (factoryClassName != null) return newInstance(classes, properties, factoryClassName); - - JAXBContextFactory factory = - ServiceLoaderUtil.firstByServiceLoader(JAXBContextFactory.class, logger, EXCEPTION_HANDLER); - - if (factory != null) { - ModuleUtil.delegateAddOpensToImplModule(classes, factory.getClass()); - return factory.createContext(classes, properties); - } - - // to ensure backwards compatibility - String className = firstByServiceLoaderDeprecated(JAXBContext.class, getContextClassLoader()); - if (className != null) return newInstance(classes, properties, className); - - logger.fine("Trying to create the platform default provider"); - Class ctxFactoryClass = - (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader("javax.xml.bind.JAXBContext", logger); - - if (ctxFactoryClass != null) { - return newInstance(classes, properties, ctxFactoryClass); - } - - // else no provider found - logger.fine("Trying to create the platform default provider"); - return newInstance(classes, properties, PLATFORM_DEFAULT_FACTORY_CLASS); - } - - - /** - * first factoryId should be the preferred one, - * more of those can be provided to support backwards compatibility - */ - private static String classNameFromPackageProperties(URL packagePropertiesUrl, - String ... factoryIds) throws JAXBException { - - logger.log(Level.FINE, "Trying to locate {0}", packagePropertiesUrl.toString()); - Properties props = loadJAXBProperties(packagePropertiesUrl); - for(String factoryId : factoryIds) { - if (props.containsKey(factoryId)) { - return props.getProperty(factoryId); - } - } - //Factory key not found - String propertiesUrl = packagePropertiesUrl.toExternalForm(); - String packageName = propertiesUrl.substring(0, propertiesUrl.indexOf("/jaxb.properties")); - throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryIds[0])); - } - - private static String classNameFromSystemProperties() throws JAXBException { - - String factoryClassName = getSystemProperty(JAXBContext.JAXB_CONTEXT_FACTORY); - if (factoryClassName != null) { - return factoryClassName; - } - // leave this here to assure compatibility - factoryClassName = getDeprecatedSystemProperty(JAXB_CONTEXT_FACTORY_DEPRECATED); - if (factoryClassName != null) { - return factoryClassName; - } - // leave this here to assure compatibility - factoryClassName = getDeprecatedSystemProperty(JAXBContext.class.getName()); - if (factoryClassName != null) { - return factoryClassName; - } - return null; - } - - private static String getDeprecatedSystemProperty(String property) { - String value = getSystemProperty(property); - if (value != null) { - logger.log(Level.WARNING, "Using non-standard property: {0}. Property {1} should be used instead.", - new Object[] {property, JAXBContext.JAXB_CONTEXT_FACTORY}); - } - return value; - } - - private static String getSystemProperty(String property) { - logger.log(Level.FINE, "Checking system property {0}", property); - String value = AccessController.doPrivileged(new GetPropertyAction(property)); - if (value != null) { - logger.log(Level.FINE, " found {0}", value); - } else { - logger.log(Level.FINE, " not found"); - } - return value; - } - - private static Properties loadJAXBProperties(URL url) throws JAXBException { - - try { - Properties props; - logger.log(Level.FINE, "loading props from {0}", url); - props = new Properties(); - InputStream is = url.openStream(); - props.load(is); - is.close(); - return props; - } catch (IOException ioe) { - logger.log(Level.FINE, "Unable to load " + url.toString(), ioe); - throw new JAXBException(ioe.toString(), ioe); - } - } - - /** - * If run on JPMS package containing resource must be open unconditionally. - * - * @param classLoader classloader to load resource with - * @param resourceName qualified name of the resource - * @return resource url if found - */ - private static URL getResourceUrl(ClassLoader classLoader, String resourceName) { - URL url; - if (classLoader == null) - url = ClassLoader.getSystemResource(resourceName); - else - url = classLoader.getResource(resourceName); - return url; - } - - private static URL getResourceUrl(Class clazz, String resourceName) { - return clazz.getResource(resourceName); - } - - - /** - * Search the given ClassLoader for an instance of the specified class and - * return a string representation of the URL that points to the resource. - * - * @param clazz - * The class to search for - * @param loader - * The ClassLoader to search. If this parameter is null, then the - * system class loader will be searched - * @return - * the URL for the class or null if it wasn't found - */ - static URL which(Class clazz, ClassLoader loader) { - - String classnameAsResource = clazz.getName().replace('.', '/') + ".class"; - - if (loader == null) { - loader = getSystemClassLoader(); - } - - return loader.getResource(classnameAsResource); - } - - /** - * Get the URL for the Class from it's ClassLoader. - * - * Convenience method for {@link #which(Class, ClassLoader)}. - * - * Equivalent to calling: which(clazz, clazz.getClassLoader()) - * - * @param clazz - * The class to search for - * @return - * the URL for the class or null if it wasn't found - */ - static URL which(Class clazz) { - return which(clazz, getClassClassLoader(clazz)); - } - - @SuppressWarnings("unchecked") - private static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - @Override - public java.lang.Object run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - - @SuppressWarnings("unchecked") - private static ClassLoader getClassClassLoader(final Class c) { - if (System.getSecurityManager() == null) { - return c.getClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - @Override - public java.lang.Object run() { - return c.getClassLoader(); - } - }); - } - } - - private static ClassLoader getSystemClassLoader() { - if (System.getSecurityManager() == null) { - return ClassLoader.getSystemClassLoader(); - } else { - return (ClassLoader) java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - @Override - public java.lang.Object run() { - return ClassLoader.getSystemClassLoader(); - } - }); - } - } - - // ServiceLoaderUtil.firstByServiceLoaderDeprecated should be used instead. - @Deprecated - static String firstByServiceLoaderDeprecated(Class spiClass, - ClassLoader classLoader) throws JAXBException { - - final String jaxbContextFQCN = spiClass.getName(); - - logger.fine("Searching META-INF/services"); - - // search META-INF services next - BufferedReader r = null; - final String resource = "META-INF/services/" + jaxbContextFQCN; - try { - final InputStream resourceStream = - (classLoader == null) ? - ClassLoader.getSystemResourceAsStream(resource) : - classLoader.getResourceAsStream(resource); - - if (resourceStream != null) { - r = new BufferedReader(new InputStreamReader(resourceStream, "UTF-8")); - String factoryClassName = r.readLine(); - if (factoryClassName != null) { - factoryClassName = factoryClassName.trim(); - } - r.close(); - logger.log(Level.FINE, "Configured factorty class:{0}", factoryClassName); - return factoryClassName; - } else { - logger.log(Level.FINE, "Unable to load:{0}", resource); - return null; - } - } catch (IOException e) { - throw new JAXBException(e); - } finally { - try { - if (r != null) { - r.close(); - } - } catch (IOException ex) { - logger.log(Level.SEVERE, "Unable to close resource: " + resource, ex); - } - } - } - - private static String jaxbProperties(String contextPath, ClassLoader classLoader, String factoryId) throws JAXBException { - String[] packages = contextPath.split(":"); - - for (String pkg : packages) { - String pkgUrl = pkg.replace('.', '/'); - URL jaxbPropertiesUrl = getResourceUrl(classLoader, pkgUrl + "/jaxb.properties"); - if (jaxbPropertiesUrl != null) { - return classNameFromPackageProperties(jaxbPropertiesUrl, - factoryId, JAXB_CONTEXT_FACTORY_DEPRECATED); - } - } - return null; - } - - private static String jaxbProperties(Class[] classesFromContextPath, String factoryId) throws JAXBException { - for (Class c : classesFromContextPath) { - URL jaxbPropertiesUrl = getResourceUrl(c, "jaxb.properties"); - if (jaxbPropertiesUrl != null) { - return classNameFromPackageProperties(jaxbPropertiesUrl, factoryId, JAXB_CONTEXT_FACTORY_DEPRECATED); - } - } - return null; - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/DataBindingException.java 2018-01-30 20:39:14.000000000 -0500 +++ /dev/null 2018-01-30 20:39:14.000000000 -0500 @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2006, 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 javax.xml.bind; - -/** - * Exception that represents a failure in a JAXB operation. - * - *

- * This exception differs from {@link JAXBException} in that - * this is an unchecked exception, while {@code JAXBException} - * is a checked exception. - * - * @see JAXB - * @since 1.6, JAXB 2.1 - */ -public class DataBindingException extends RuntimeException { - public DataBindingException(String message, Throwable cause) { - super(message, cause); - } - - public DataBindingException(Throwable cause) { - super(cause); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/DatatypeConverter.java 2018-01-30 20:39:15.000000000 -0500 +++ /dev/null 2018-01-30 20:39:15.000000000 -0500 @@ -1,695 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -import javax.xml.namespace.NamespaceContext; - -/** - *

- * The javaType binding declaration can be used to customize the binding of - * an XML schema datatype to a Java datatype. Customizations can involve - * writing a parse and print method for parsing and printing lexical - * representations of a XML schema datatype respectively. However, writing - * parse and print methods requires knowledge of the lexical representations ( - * XML Schema Part2: Datatypes - * specification ) and hence may be difficult to write. - *

- *

- * This class makes it easier to write parse and print methods. It defines - * static parse and print methods that provide access to a JAXB provider's - * implementation of parse and print methods. These methods are invoked by - * custom parse and print methods. For example, the binding of xsd:dateTime - * to a long can be customized using parse and print methods as follows: - *

- *
- *    // Customized parse method
- *    public long myParseCal( String dateTimeString ) {
- *        java.util.Calendar cal = DatatypeConverter.parseDateTime(dateTimeString);
- *        long longval = convert_calendar_to_long(cal); //application specific
- *        return longval;
- *    }
- *
- *    // Customized print method
- *    public String myPrintCal( Long longval ) {
- *        java.util.Calendar cal = convert_long_to_calendar(longval) ; //application specific
- *        String dateTimeString = DatatypeConverter.printDateTime(cal);
- *        return dateTimeString;
- *    }
- *    
- *
- *

- * There is a static parse and print method corresponding to each parse and - * print method respectively in the {@link DatatypeConverterInterface - * DatatypeConverterInterface}. - *

- * The static methods defined in the class can also be used to specify - * a parse or a print method in a javaType binding declaration. - *

- *

- * JAXB Providers are required to call the - * {@link #setDatatypeConverter(DatatypeConverterInterface) - * setDatatypeConverter} api at some point before the first marshal or unmarshal - * operation (perhaps during the call to JAXBContext.newInstance). This step is - * necessary to configure the converter that should be used to perform the - * print and parse functionality. - *

- * - *

- * A print method for a XML schema datatype can output any lexical - * representation that is valid with respect to the XML schema datatype. - * If an error is encountered during conversion, then an IllegalArgumentException, - * or a subclass of IllegalArgumentException must be thrown by the method. - *

- * - * @author
  • Sekhar Vajjhala, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems Inc.
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Ryan Shoemaker,Sun Microsystems Inc.
- * @see DatatypeConverterInterface - * @see ParseConversionEvent - * @see PrintConversionEvent - * @since 1.6, JAXB 1.0 - */ - -final public class DatatypeConverter { - - // delegate to this instance of DatatypeConverter - private static volatile DatatypeConverterInterface theConverter = null; - - private final static JAXBPermission SET_DATATYPE_CONVERTER_PERMISSION = - new JAXBPermission("setDatatypeConverter"); - - private DatatypeConverter() { - // private constructor - } - - /** - * This method is for JAXB provider use only. - *

- * JAXB Providers are required to call this method at some point before - * allowing any of the JAXB client marshal or unmarshal operations to - * occur. This is necessary to configure the datatype converter that - * should be used to perform the print and parse conversions. - * - *

- * Calling this api repeatedly will have no effect - the - * DatatypeConverterInterface instance passed into the first invocation is - * the one that will be used from then on. - * - * @param converter an instance of a class that implements the - * DatatypeConverterInterface class - this parameter must not be null. - * @throws IllegalArgumentException if the parameter is null - * @throws SecurityException - * If the {@link SecurityManager} in charge denies the access to - * set the datatype converter. - * @see JAXBPermission - */ - public static void setDatatypeConverter( DatatypeConverterInterface converter ) { - if( converter == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.CONVERTER_MUST_NOT_BE_NULL ) ); - } else if( theConverter == null ) { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkPermission(SET_DATATYPE_CONVERTER_PERMISSION); - theConverter = converter; - } - } - - private static synchronized void initConverter() { - theConverter = new DatatypeConverterImpl(); - } - - /** - *

- * Convert the lexical XSD string argument into a String value. - * @param lexicalXSDString - * A string containing a lexical representation of - * xsd:string. - * @return - * A String value represented by the string argument. - */ - public static String parseString( String lexicalXSDString ) { - if (theConverter == null) initConverter(); - return theConverter.parseString( lexicalXSDString ); - } - - /** - *

- * Convert the string argument into a BigInteger value. - * @param lexicalXSDInteger - * A string containing a lexical representation of - * xsd:integer. - * @return - * A BigInteger value represented by the string argument. - * @throws NumberFormatException lexicalXSDInteger is not a valid string representation of a {@link java.math.BigInteger} value. - */ - public static java.math.BigInteger parseInteger( String lexicalXSDInteger ) { - if (theConverter == null) initConverter(); - return theConverter.parseInteger( lexicalXSDInteger ); - } - - /** - *

- * Convert the string argument into an int value. - * @param lexicalXSDInt - * A string containing a lexical representation of - * xsd:int. - * @return - * A int value represented by the string argument. - * @throws NumberFormatException lexicalXSDInt is not a valid string representation of an int value. - */ - public static int parseInt( String lexicalXSDInt ) { - if (theConverter == null) initConverter(); - return theConverter.parseInt( lexicalXSDInt ); - } - - /** - *

- * Converts the string argument into a long value. - * @param lexicalXSDLong - * A string containing lexical representation of - * xsd:long. - * @return - * A long value represented by the string argument. - * @throws NumberFormatException lexicalXSDLong is not a valid string representation of a long value. - */ - public static long parseLong( String lexicalXSDLong ) { - if (theConverter == null) initConverter(); - return theConverter.parseLong( lexicalXSDLong ); - } - - /** - *

- * Converts the string argument into a short value. - * @param lexicalXSDShort - * A string containing lexical representation of - * xsd:short. - * @return - * A short value represented by the string argument. - * @throws NumberFormatException lexicalXSDShort is not a valid string representation of a short value. - */ - public static short parseShort( String lexicalXSDShort ) { - if (theConverter == null) initConverter(); - return theConverter.parseShort( lexicalXSDShort ); - } - - /** - *

- * Converts the string argument into a BigDecimal value. - * @param lexicalXSDDecimal - * A string containing lexical representation of - * xsd:decimal. - * @return - * A BigDecimal value represented by the string argument. - * @throws NumberFormatException lexicalXSDDecimal is not a valid string representation of {@link java.math.BigDecimal}. - */ - public static java.math.BigDecimal parseDecimal( String lexicalXSDDecimal ) { - if (theConverter == null) initConverter(); - return theConverter.parseDecimal( lexicalXSDDecimal ); - } - - /** - *

- * Converts the string argument into a float value. - * @param lexicalXSDFloat - * A string containing lexical representation of - * xsd:float. - * @return - * A float value represented by the string argument. - * @throws NumberFormatException lexicalXSDFloat is not a valid string representation of a float value. - */ - public static float parseFloat( String lexicalXSDFloat ) { - if (theConverter == null) initConverter(); - return theConverter.parseFloat( lexicalXSDFloat ); - } - - /** - *

- * Converts the string argument into a double value. - * @param lexicalXSDDouble - * A string containing lexical representation of - * xsd:double. - * @return - * A double value represented by the string argument. - * @throws NumberFormatException lexicalXSDDouble is not a valid string representation of a double value. - */ - public static double parseDouble( String lexicalXSDDouble ) { - if (theConverter == null) initConverter(); - return theConverter.parseDouble( lexicalXSDDouble ); - } - - /** - *

- * Converts the string argument into a boolean value. - * @param lexicalXSDBoolean - * A string containing lexical representation of - * xsd:boolean. - * @return - * A boolean value represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:boolean. - */ - public static boolean parseBoolean( String lexicalXSDBoolean ) { - if (theConverter == null) initConverter(); - return theConverter.parseBoolean( lexicalXSDBoolean ); - } - - /** - *

- * Converts the string argument into a byte value. - * @param lexicalXSDByte - * A string containing lexical representation of - * xsd:byte. - * @return - * A byte value represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:byte. - */ - public static byte parseByte( String lexicalXSDByte ) { - if (theConverter == null) initConverter(); - return theConverter.parseByte( lexicalXSDByte ); - } - - /** - *

- * Converts the string argument into a byte value. - * - *

- * String parameter {@code lexicalXSDQname} must conform to lexical value space specifed at - * XML Schema Part 2:Datatypes specification:QNames - * - * @param lexicalXSDQName - * A string containing lexical representation of xsd:QName. - * @param nsc - * A namespace context for interpreting a prefix within a QName. - * @return - * A QName value represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to XML Schema Part 2 specification or - * if namespace prefix of {@code lexicalXSDQname} is not bound to a URI in NamespaceContext {@code nsc}. - */ - public static javax.xml.namespace.QName parseQName( String lexicalXSDQName, - NamespaceContext nsc) { - if (theConverter == null) initConverter(); - return theConverter.parseQName( lexicalXSDQName, nsc ); - } - - /** - *

- * Converts the string argument into a Calendar value. - * @param lexicalXSDDateTime - * A string containing lexical representation of - * xsd:datetime. - * @return - * A Calendar object represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:dateTime. - */ - public static java.util.Calendar parseDateTime( String lexicalXSDDateTime ) { - if (theConverter == null) initConverter(); - return theConverter.parseDateTime( lexicalXSDDateTime ); - } - - /** - *

- * Converts the string argument into an array of bytes. - * @param lexicalXSDBase64Binary - * A string containing lexical representation - * of xsd:base64Binary. - * @return - * An array of bytes represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:base64Binary - */ - public static byte[] parseBase64Binary( String lexicalXSDBase64Binary ) { - if (theConverter == null) initConverter(); - return theConverter.parseBase64Binary( lexicalXSDBase64Binary ); - } - - /** - *

- * Converts the string argument into an array of bytes. - * @param lexicalXSDHexBinary - * A string containing lexical representation of - * xsd:hexBinary. - * @return - * An array of bytes represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:hexBinary. - */ - public static byte[] parseHexBinary( String lexicalXSDHexBinary ) { - if (theConverter == null) initConverter(); - return theConverter.parseHexBinary( lexicalXSDHexBinary ); - } - - /** - *

- * Converts the string argument into a long value. - * @param lexicalXSDUnsignedInt - * A string containing lexical representation - * of xsd:unsignedInt. - * @return - * A long value represented by the string argument. - * @throws NumberFormatException if string parameter can not be parsed into a {@code long} value. - */ - public static long parseUnsignedInt( String lexicalXSDUnsignedInt ) { - if (theConverter == null) initConverter(); - return theConverter.parseUnsignedInt( lexicalXSDUnsignedInt ); - } - - /** - *

- * Converts the string argument into an int value. - * @param lexicalXSDUnsignedShort - * A string containing lexical - * representation of xsd:unsignedShort. - * @return - * An int value represented by the string argument. - * @throws NumberFormatException if string parameter can not be parsed into an {@code int} value. - */ - public static int parseUnsignedShort( String lexicalXSDUnsignedShort ) { - if (theConverter == null) initConverter(); - return theConverter.parseUnsignedShort( lexicalXSDUnsignedShort ); - } - - /** - *

- * Converts the string argument into a Calendar value. - * @param lexicalXSDTime - * A string containing lexical representation of - * xsd:time. - * @return - * A Calendar value represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Time. - */ - public static java.util.Calendar parseTime( String lexicalXSDTime ) { - if (theConverter == null) initConverter(); - return theConverter.parseTime( lexicalXSDTime ); - } - /** - *

- * Converts the string argument into a Calendar value. - * @param lexicalXSDDate - * A string containing lexical representation of - * xsd:Date. - * @return - * A Calendar value represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Date. - */ - public static java.util.Calendar parseDate( String lexicalXSDDate ) { - if (theConverter == null) initConverter(); - return theConverter.parseDate( lexicalXSDDate ); - } - - /** - *

- * Return a string containing the lexical representation of the - * simple type. - * @param lexicalXSDAnySimpleType - * A string containing lexical - * representation of the simple type. - * @return - * A string containing the lexical representation of the - * simple type. - */ - public static String parseAnySimpleType( String lexicalXSDAnySimpleType ) { - if (theConverter == null) initConverter(); - return theConverter.parseAnySimpleType( lexicalXSDAnySimpleType ); - } - /** - *

- * Converts the string argument into a string. - * @param val - * A string value. - * @return - * A string containing a lexical representation of xsd:string. - */ - // also indicate the print methods produce a lexical - // representation for given Java datatypes. - - public static String printString( String val ) { - if (theConverter == null) initConverter(); - return theConverter.printString( val ); - } - - /** - *

- * Converts a BigInteger value into a string. - * @param val - * A BigInteger value - * @return - * A string containing a lexical representation of xsd:integer - * @throws IllegalArgumentException {@code val} is null. - */ - public static String printInteger( java.math.BigInteger val ) { - if (theConverter == null) initConverter(); - return theConverter.printInteger( val ); - } - - /** - *

- * Converts an int value into a string. - * @param val - * An int value - * @return - * A string containing a lexical representation of xsd:int - */ - public static String printInt( int val ) { - if (theConverter == null) initConverter(); - return theConverter.printInt( val ); - } - - /** - *

- * Converts A long value into a string. - * @param val - * A long value - * @return - * A string containing a lexical representation of xsd:long - */ - public static String printLong( long val ) { - if (theConverter == null) initConverter(); - return theConverter.printLong( val ); - } - - /** - *

- * Converts a short value into a string. - * @param val - * A short value - * @return - * A string containing a lexical representation of xsd:short - */ - public static String printShort( short val ) { - if (theConverter == null) initConverter(); - return theConverter.printShort( val ); - } - - /** - *

- * Converts a BigDecimal value into a string. - * @param val - * A BigDecimal value - * @return - * A string containing a lexical representation of xsd:decimal - * @throws IllegalArgumentException {@code val} is null. - */ - public static String printDecimal( java.math.BigDecimal val ) { - if (theConverter == null) initConverter(); - return theConverter.printDecimal( val ); - } - - /** - *

- * Converts a float value into a string. - * @param val - * A float value - * @return - * A string containing a lexical representation of xsd:float - */ - public static String printFloat( float val ) { - if (theConverter == null) initConverter(); - return theConverter.printFloat( val ); - } - - /** - *

- * Converts a double value into a string. - * @param val - * A double value - * @return - * A string containing a lexical representation of xsd:double - */ - public static String printDouble( double val ) { - if (theConverter == null) initConverter(); - return theConverter.printDouble( val ); - } - - /** - *

- * Converts a boolean value into a string. - * @param val - * A boolean value - * @return - * A string containing a lexical representation of xsd:boolean - */ - public static String printBoolean( boolean val ) { - if (theConverter == null) initConverter(); - return theConverter.printBoolean( val ); - } - - /** - *

- * Converts a byte value into a string. - * @param val - * A byte value - * @return - * A string containing a lexical representation of xsd:byte - */ - public static String printByte( byte val ) { - if (theConverter == null) initConverter(); - return theConverter.printByte( val ); - } - - /** - *

- * Converts a QName instance into a string. - * @param val - * A QName value - * @param nsc - * A namespace context for interpreting a prefix within a QName. - * @return - * A string containing a lexical representation of QName - * @throws IllegalArgumentException if {@code val} is null or - * if {@code nsc} is non-null or {@code nsc.getPrefix(nsprefixFromVal)} is null. - */ - public static String printQName( javax.xml.namespace.QName val, - NamespaceContext nsc ) { - if (theConverter == null) initConverter(); - return theConverter.printQName( val, nsc ); - } - - /** - *

- * Converts a Calendar value into a string. - * @param val - * A Calendar value - * @return - * A string containing a lexical representation of xsd:dateTime - * @throws IllegalArgumentException if {@code val} is null. - */ - public static String printDateTime( java.util.Calendar val ) { - if (theConverter == null) initConverter(); - return theConverter.printDateTime( val ); - } - - /** - *

- * Converts an array of bytes into a string. - * @param val - * An array of bytes - * @return - * A string containing a lexical representation of xsd:base64Binary - * @throws IllegalArgumentException if {@code val} is null. - */ - public static String printBase64Binary( byte[] val ) { - if (theConverter == null) initConverter(); - return theConverter.printBase64Binary( val ); - } - - /** - *

- * Converts an array of bytes into a string. - * @param val - * An array of bytes - * @return - * A string containing a lexical representation of xsd:hexBinary - * @throws IllegalArgumentException if {@code val} is null. - */ - public static String printHexBinary( byte[] val ) { - if (theConverter == null) initConverter(); - return theConverter.printHexBinary( val ); - } - - /** - *

- * Converts a long value into a string. - * @param val - * A long value - * @return - * A string containing a lexical representation of xsd:unsignedInt - */ - public static String printUnsignedInt( long val ) { - if (theConverter == null) initConverter(); - return theConverter.printUnsignedInt( val ); - } - - /** - *

- * Converts an int value into a string. - * @param val - * An int value - * @return - * A string containing a lexical representation of xsd:unsignedShort - */ - public static String printUnsignedShort( int val ) { - if (theConverter == null) initConverter(); - return theConverter.printUnsignedShort( val ); - } - - /** - *

- * Converts a Calendar value into a string. - * @param val - * A Calendar value - * @return - * A string containing a lexical representation of xsd:time - * @throws IllegalArgumentException if {@code val} is null. - */ - public static String printTime( java.util.Calendar val ) { - if (theConverter == null) initConverter(); - return theConverter.printTime( val ); - } - - /** - *

- * Converts a Calendar value into a string. - * @param val - * A Calendar value - * @return - * A string containing a lexical representation of xsd:date - * @throws IllegalArgumentException if {@code val} is null. - */ - public static String printDate( java.util.Calendar val ) { - if (theConverter == null) initConverter(); - return theConverter.printDate( val ); - } - - /** - *

- * Converts a string value into a string. - * @param val - * A string value - * @return - * A string containing a lexical representation of xsd:AnySimpleType - */ - public static String printAnySimpleType( String val ) { - if (theConverter == null) initConverter(); - return theConverter.printAnySimpleType( val ); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/DatatypeConverterImpl.java 2018-01-30 20:39:16.000000000 -0500 +++ /dev/null 2018-01-30 20:39:16.000000000 -0500 @@ -1,1042 +0,0 @@ -/* - * Copyright (c) 2007, 2015, 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 javax.xml.bind; - -import java.math.BigDecimal; -import java.math.BigInteger; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.TimeZone; - -import javax.xml.namespace.QName; -import javax.xml.namespace.NamespaceContext; -import javax.xml.datatype.DatatypeFactory; -import javax.xml.datatype.DatatypeConfigurationException; - -/** - * This class is the JAXB RI's default implementation of the - * {@link DatatypeConverterInterface}. - * - *

- * When client applications specify the use of the static print/parse - * methods in {@link DatatypeConverter}, it will delegate - * to this class. - * - *

- * This class is responsible for whitespace normalization. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
- * @since JAXB 2.1 - */ -final class DatatypeConverterImpl implements DatatypeConverterInterface { - - /** - * To avoid re-creating instances, we cache one instance. - */ - public static final DatatypeConverterInterface theInstance = new DatatypeConverterImpl(); - - protected DatatypeConverterImpl() { - } - - public String parseString(String lexicalXSDString) { - return lexicalXSDString; - } - - public BigInteger parseInteger(String lexicalXSDInteger) { - return _parseInteger(lexicalXSDInteger); - } - - public static BigInteger _parseInteger(CharSequence s) { - return new BigInteger(removeOptionalPlus(WhiteSpaceProcessor.trim(s)).toString()); - } - - public String printInteger(BigInteger val) { - return _printInteger(val); - } - - public static String _printInteger(BigInteger val) { - return val.toString(); - } - - public int parseInt(String s) { - return _parseInt(s); - } - - /** - * Faster but less robust String->int conversion. - * - * Note that: - *
    - *
  1. XML Schema allows '+', but {@link Integer#valueOf(String)} is not. - *
  2. XML Schema allows leading and trailing (but not in-between) whitespaces. - * {@link Integer#valueOf(String)} doesn't allow any. - *
- */ - public static int _parseInt(CharSequence s) { - int len = s.length(); - int sign = 1; - - int r = 0; - - for (int i = 0; i < len; i++) { - char ch = s.charAt(i); - if (WhiteSpaceProcessor.isWhiteSpace(ch)) { - // skip whitespace - } else if ('0' <= ch && ch <= '9') { - r = r * 10 + (ch - '0'); - } else if (ch == '-') { - sign = -1; - } else if (ch == '+') { - // noop - } else { - throw new NumberFormatException("Not a number: " + s); - } - } - - return r * sign; - } - - public long parseLong(String lexicalXSLong) { - return _parseLong(lexicalXSLong); - } - - public static long _parseLong(CharSequence s) { - return Long.parseLong(removeOptionalPlus(WhiteSpaceProcessor.trim(s)).toString()); - } - - public short parseShort(String lexicalXSDShort) { - return _parseShort(lexicalXSDShort); - } - - public static short _parseShort(CharSequence s) { - return (short) _parseInt(s); - } - - public String printShort(short val) { - return _printShort(val); - } - - public static String _printShort(short val) { - return String.valueOf(val); - } - - public BigDecimal parseDecimal(String content) { - return _parseDecimal(content); - } - - public static BigDecimal _parseDecimal(CharSequence content) { - content = WhiteSpaceProcessor.trim(content); - - if (content.length() <= 0) { - return null; - } - - return new BigDecimal(content.toString()); - - // from purely XML Schema perspective, - // this implementation has a problem, since - // in xs:decimal "1.0" and "1" is equal whereas the above - // code will return different values for those two forms. - // - // the code was originally using com.sun.msv.datatype.xsd.NumberType.load, - // but a profiling showed that the process of normalizing "1.0" into "1" - // could take non-trivial time. - // - // also, from the user's point of view, one might be surprised if - // 1 (not 1.0) is returned from "1.000" - } - - public float parseFloat(String lexicalXSDFloat) { - return _parseFloat(lexicalXSDFloat); - } - - public static float _parseFloat(CharSequence _val) { - String s = WhiteSpaceProcessor.trim(_val).toString(); - /* Incompatibilities of XML Schema's float "xfloat" and Java's float "jfloat" - - * jfloat.valueOf ignores leading and trailing whitespaces, - whereas this is not allowed in xfloat. - * jfloat.valueOf allows "float type suffix" (f, F) to be - appended after float literal (e.g., 1.52e-2f), whereare - this is not the case of xfloat. - - gray zone - --------- - * jfloat allows ".523". And there is no clear statement that mentions - this case in xfloat. Although probably this is allowed. - * - */ - - if (s.equals("NaN")) { - return Float.NaN; - } - if (s.equals("INF")) { - return Float.POSITIVE_INFINITY; - } - if (s.equals("-INF")) { - return Float.NEGATIVE_INFINITY; - } - - if (s.length() == 0 - || !isDigitOrPeriodOrSign(s.charAt(0)) - || !isDigitOrPeriodOrSign(s.charAt(s.length() - 1))) { - throw new NumberFormatException(); - } - - // these screening process is necessary due to the wobble of Float.valueOf method - return Float.parseFloat(s); - } - - public String printFloat(float v) { - return _printFloat(v); - } - - public static String _printFloat(float v) { - if (Float.isNaN(v)) { - return "NaN"; - } - if (v == Float.POSITIVE_INFINITY) { - return "INF"; - } - if (v == Float.NEGATIVE_INFINITY) { - return "-INF"; - } - return String.valueOf(v); - } - - public double parseDouble(String lexicalXSDDouble) { - return _parseDouble(lexicalXSDDouble); - } - - public static double _parseDouble(CharSequence _val) { - String val = WhiteSpaceProcessor.trim(_val).toString(); - - if (val.equals("NaN")) { - return Double.NaN; - } - if (val.equals("INF")) { - return Double.POSITIVE_INFINITY; - } - if (val.equals("-INF")) { - return Double.NEGATIVE_INFINITY; - } - - if (val.length() == 0 - || !isDigitOrPeriodOrSign(val.charAt(0)) - || !isDigitOrPeriodOrSign(val.charAt(val.length() - 1))) { - throw new NumberFormatException(val); - } - - - // these screening process is necessary due to the wobble of Float.valueOf method - return Double.parseDouble(val); - } - - public boolean parseBoolean(String lexicalXSDBoolean) { - Boolean b = _parseBoolean(lexicalXSDBoolean); - return (b == null) ? false : b.booleanValue(); - } - - public static Boolean _parseBoolean(CharSequence literal) { - if (literal == null) { - return null; - } - - int i = 0; - int len = literal.length(); - char ch; - boolean value = false; - - if (literal.length() <= 0) { - return null; - } - - do { - ch = literal.charAt(i++); - } while (WhiteSpaceProcessor.isWhiteSpace(ch) && i < len); - - int strIndex = 0; - - switch (ch) { - case '1': - value = true; - break; - case '0': - value = false; - break; - case 't': - String strTrue = "rue"; - do { - ch = literal.charAt(i++); - } while ((strTrue.charAt(strIndex++) == ch) && i < len && strIndex < 3); - - if (strIndex == 3) { - value = true; - } else { - return false; - } -// throw new IllegalArgumentException("String \"" + literal + "\" is not valid boolean value."); - - break; - case 'f': - String strFalse = "alse"; - do { - ch = literal.charAt(i++); - } while ((strFalse.charAt(strIndex++) == ch) && i < len && strIndex < 4); - - - if (strIndex == 4) { - value = false; - } else { - return false; - } -// throw new IllegalArgumentException("String \"" + literal + "\" is not valid boolean value."); - - break; - } - - if (i < len) { - do { - ch = literal.charAt(i++); - } while (WhiteSpaceProcessor.isWhiteSpace(ch) && i < len); - } - - if (i == len) { - return value; - } else { - return null; - } -// throw new IllegalArgumentException("String \"" + literal + "\" is not valid boolean value."); - } - - public String printBoolean(boolean val) { - return val ? "true" : "false"; - } - - public static String _printBoolean(boolean val) { - return val ? "true" : "false"; - } - - public byte parseByte(String lexicalXSDByte) { - return _parseByte(lexicalXSDByte); - } - - public static byte _parseByte(CharSequence literal) { - return (byte) _parseInt(literal); - } - - public String printByte(byte val) { - return _printByte(val); - } - - public static String _printByte(byte val) { - return String.valueOf(val); - } - - public QName parseQName(String lexicalXSDQName, NamespaceContext nsc) { - return _parseQName(lexicalXSDQName, nsc); - } - - /** - * @return null if fails to convert. - */ - public static QName _parseQName(CharSequence text, NamespaceContext nsc) { - int length = text.length(); - - // trim whitespace - int start = 0; - while (start < length && WhiteSpaceProcessor.isWhiteSpace(text.charAt(start))) { - start++; - } - - int end = length; - while (end > start && WhiteSpaceProcessor.isWhiteSpace(text.charAt(end - 1))) { - end--; - } - - if (end == start) { - throw new IllegalArgumentException("input is empty"); - } - - - String uri; - String localPart; - String prefix; - - // search ':' - int idx = start + 1; // no point in searching the first char. that's not valid. - while (idx < end && text.charAt(idx) != ':') { - idx++; - } - - if (idx == end) { - uri = nsc.getNamespaceURI(""); - localPart = text.subSequence(start, end).toString(); - prefix = ""; - } else { - // Prefix exists, check everything - prefix = text.subSequence(start, idx).toString(); - localPart = text.subSequence(idx + 1, end).toString(); - uri = nsc.getNamespaceURI(prefix); - // uri can never be null according to javadoc, - // but some users reported that there are implementations that return null. - if (uri == null || uri.length() == 0) // crap. the NamespaceContext interface is broken. - // error: unbound prefix - { - throw new IllegalArgumentException("prefix " + prefix + " is not bound to a namespace"); - } - } - - return new QName(uri, localPart, prefix); - } - - public Calendar parseDateTime(String lexicalXSDDateTime) { - return _parseDateTime(lexicalXSDDateTime); - } - - public static GregorianCalendar _parseDateTime(CharSequence s) { - String val = WhiteSpaceProcessor.trim(s).toString(); - return datatypeFactory.newXMLGregorianCalendar(val).toGregorianCalendar(); - } - - public String printDateTime(Calendar val) { - return _printDateTime(val); - } - - public static String _printDateTime(Calendar val) { - return CalendarFormatter.doFormat("%Y-%M-%DT%h:%m:%s%z", val); - } - - public byte[] parseBase64Binary(String lexicalXSDBase64Binary) { - return _parseBase64Binary(lexicalXSDBase64Binary); - } - - public byte[] parseHexBinary(String s) { - final int len = s.length(); - - // "111" is not a valid hex encoding. - if (len % 2 != 0) { - throw new IllegalArgumentException("hexBinary needs to be even-length: " + s); - } - - byte[] out = new byte[len / 2]; - - for (int i = 0; i < len; i += 2) { - int h = hexToBin(s.charAt(i)); - int l = hexToBin(s.charAt(i + 1)); - if (h == -1 || l == -1) { - throw new IllegalArgumentException("contains illegal character for hexBinary: " + s); - } - - out[i / 2] = (byte) (h * 16 + l); - } - - return out; - } - - private static int hexToBin(char ch) { - if ('0' <= ch && ch <= '9') { - return ch - '0'; - } - if ('A' <= ch && ch <= 'F') { - return ch - 'A' + 10; - } - if ('a' <= ch && ch <= 'f') { - return ch - 'a' + 10; - } - return -1; - } - private static final char[] hexCode = "0123456789ABCDEF".toCharArray(); - - public String printHexBinary(byte[] data) { - StringBuilder r = new StringBuilder(data.length * 2); - for (byte b : data) { - r.append(hexCode[(b >> 4) & 0xF]); - r.append(hexCode[(b & 0xF)]); - } - return r.toString(); - } - - public long parseUnsignedInt(String lexicalXSDUnsignedInt) { - return _parseLong(lexicalXSDUnsignedInt); - } - - public String printUnsignedInt(long val) { - return _printLong(val); - } - - public int parseUnsignedShort(String lexicalXSDUnsignedShort) { - return _parseInt(lexicalXSDUnsignedShort); - } - - public Calendar parseTime(String lexicalXSDTime) { - return datatypeFactory.newXMLGregorianCalendar(lexicalXSDTime).toGregorianCalendar(); - } - - public String printTime(Calendar val) { - return CalendarFormatter.doFormat("%h:%m:%s%z", val); - } - - public Calendar parseDate(String lexicalXSDDate) { - return datatypeFactory.newXMLGregorianCalendar(lexicalXSDDate).toGregorianCalendar(); - } - - public String printDate(Calendar val) { - return _printDate(val); - } - - public static String _printDate(Calendar val) { - return CalendarFormatter.doFormat((new StringBuilder("%Y-%M-%D").append("%z")).toString(),val); - } - - public String parseAnySimpleType(String lexicalXSDAnySimpleType) { - return lexicalXSDAnySimpleType; -// return (String)SimpleURType.theInstance._createValue( lexicalXSDAnySimpleType, null ); - } - - public String printString(String val) { -// return StringType.theInstance.convertToLexicalValue( val, null ); - return val; - } - - public String printInt(int val) { - return _printInt(val); - } - - public static String _printInt(int val) { - return String.valueOf(val); - } - - public String printLong(long val) { - return _printLong(val); - } - - public static String _printLong(long val) { - return String.valueOf(val); - } - - public String printDecimal(BigDecimal val) { - return _printDecimal(val); - } - - public static String _printDecimal(BigDecimal val) { - return val.toPlainString(); - } - - public String printDouble(double v) { - return _printDouble(v); - } - - public static String _printDouble(double v) { - if (Double.isNaN(v)) { - return "NaN"; - } - if (v == Double.POSITIVE_INFINITY) { - return "INF"; - } - if (v == Double.NEGATIVE_INFINITY) { - return "-INF"; - } - return String.valueOf(v); - } - - public String printQName(QName val, NamespaceContext nsc) { - return _printQName(val, nsc); - } - - public static String _printQName(QName val, NamespaceContext nsc) { - // Double-check - String qname; - String prefix = nsc.getPrefix(val.getNamespaceURI()); - String localPart = val.getLocalPart(); - - if (prefix == null || prefix.length() == 0) { // be defensive - qname = localPart; - } else { - qname = prefix + ':' + localPart; - } - - return qname; - } - - public String printBase64Binary(byte[] val) { - return _printBase64Binary(val); - } - - public String printUnsignedShort(int val) { - return String.valueOf(val); - } - - public String printAnySimpleType(String val) { - return val; - } - - /** - * Just return the string passed as a parameter but - * installs an instance of this class as the DatatypeConverter - * implementation. Used from static fixed value initializers. - */ - public static String installHook(String s) { - DatatypeConverter.setDatatypeConverter(theInstance); - return s; - } -// base64 decoder - private static final byte[] decodeMap = initDecodeMap(); - private static final byte PADDING = 127; - - private static byte[] initDecodeMap() { - byte[] map = new byte[128]; - int i; - for (i = 0; i < 128; i++) { - map[i] = -1; - } - - for (i = 'A'; i <= 'Z'; i++) { - map[i] = (byte) (i - 'A'); - } - for (i = 'a'; i <= 'z'; i++) { - map[i] = (byte) (i - 'a' + 26); - } - for (i = '0'; i <= '9'; i++) { - map[i] = (byte) (i - '0' + 52); - } - map['+'] = 62; - map['/'] = 63; - map['='] = PADDING; - - return map; - } - - /** - * computes the length of binary data speculatively. - * - *

- * Our requirement is to create byte[] of the exact length to store the binary data. - * If we do this in a straight-forward way, it takes two passes over the data. - * Experiments show that this is a non-trivial overhead (35% or so is spent on - * the first pass in calculating the length.) - * - *

- * So the approach here is that we compute the length speculatively, without looking - * at the whole contents. The obtained speculative value is never less than the - * actual length of the binary data, but it may be bigger. So if the speculation - * goes wrong, we'll pay the cost of reallocation and buffer copying. - * - *

- * If the base64 text is tightly packed with no indentation nor illegal char - * (like what most web services produce), then the speculation of this method - * will be correct, so we get the performance benefit. - */ - private static int guessLength(String text) { - final int len = text.length(); - - // compute the tail '=' chars - int j = len - 1; - for (; j >= 0; j--) { - byte code = decodeMap[text.charAt(j)]; - if (code == PADDING) { - continue; - } - if (code == -1) // most likely this base64 text is indented. go with the upper bound - { - return text.length() / 4 * 3; - } - break; - } - - j++; // text.charAt(j) is now at some base64 char, so +1 to make it the size - int padSize = len - j; - if (padSize > 2) // something is wrong with base64. be safe and go with the upper bound - { - return text.length() / 4 * 3; - } - - // so far this base64 looks like it's unindented tightly packed base64. - // take a chance and create an array with the expected size - return text.length() / 4 * 3 - padSize; - } - - /** - * @param text - * base64Binary data is likely to be long, and decoding requires - * each character to be accessed twice (once for counting length, another - * for decoding.) - * - * A benchmark showed that taking {@link String} is faster, presumably - * because JIT can inline a lot of string access (with data of 1K chars, it was twice as fast) - */ - public static byte[] _parseBase64Binary(String text) { - final int buflen = guessLength(text); - final byte[] out = new byte[buflen]; - int o = 0; - - final int len = text.length(); - int i; - - final byte[] quadruplet = new byte[4]; - int q = 0; - - // convert each quadruplet to three bytes. - for (i = 0; i < len; i++) { - char ch = text.charAt(i); - byte v = decodeMap[ch]; - - if (v != -1) { - quadruplet[q++] = v; - } - - if (q == 4) { - // quadruplet is now filled. - out[o++] = (byte) ((quadruplet[0] << 2) | (quadruplet[1] >> 4)); - if (quadruplet[2] != PADDING) { - out[o++] = (byte) ((quadruplet[1] << 4) | (quadruplet[2] >> 2)); - } - if (quadruplet[3] != PADDING) { - out[o++] = (byte) ((quadruplet[2] << 6) | (quadruplet[3])); - } - q = 0; - } - } - - if (buflen == o) // speculation worked out to be OK - { - return out; - } - - // we overestimated, so need to create a new buffer - byte[] nb = new byte[o]; - System.arraycopy(out, 0, nb, 0, o); - return nb; - } - private static final char[] encodeMap = initEncodeMap(); - - private static char[] initEncodeMap() { - char[] map = new char[64]; - int i; - for (i = 0; i < 26; i++) { - map[i] = (char) ('A' + i); - } - for (i = 26; i < 52; i++) { - map[i] = (char) ('a' + (i - 26)); - } - for (i = 52; i < 62; i++) { - map[i] = (char) ('0' + (i - 52)); - } - map[62] = '+'; - map[63] = '/'; - - return map; - } - - public static char encode(int i) { - return encodeMap[i & 0x3F]; - } - - public static byte encodeByte(int i) { - return (byte) encodeMap[i & 0x3F]; - } - - public static String _printBase64Binary(byte[] input) { - return _printBase64Binary(input, 0, input.length); - } - - public static String _printBase64Binary(byte[] input, int offset, int len) { - char[] buf = new char[((len + 2) / 3) * 4]; - int ptr = _printBase64Binary(input, offset, len, buf, 0); - assert ptr == buf.length; - return new String(buf); - } - - /** - * Encodes a byte array into a char array by doing base64 encoding. - * - * The caller must supply a big enough buffer. - * - * @return - * the value of {@code ptr+((len+2)/3)*4}, which is the new offset - * in the output buffer where the further bytes should be placed. - */ - public static int _printBase64Binary(byte[] input, int offset, int len, char[] buf, int ptr) { - // encode elements until only 1 or 2 elements are left to encode - int remaining = len; - int i; - for (i = offset;remaining >= 3; remaining -= 3, i += 3) { - buf[ptr++] = encode(input[i] >> 2); - buf[ptr++] = encode( - ((input[i] & 0x3) << 4) - | ((input[i + 1] >> 4) & 0xF)); - buf[ptr++] = encode( - ((input[i + 1] & 0xF) << 2) - | ((input[i + 2] >> 6) & 0x3)); - buf[ptr++] = encode(input[i + 2] & 0x3F); - } - // encode when exactly 1 element (left) to encode - if (remaining == 1) { - buf[ptr++] = encode(input[i] >> 2); - buf[ptr++] = encode(((input[i]) & 0x3) << 4); - buf[ptr++] = '='; - buf[ptr++] = '='; - } - // encode when exactly 2 elements (left) to encode - if (remaining == 2) { - buf[ptr++] = encode(input[i] >> 2); - buf[ptr++] = encode(((input[i] & 0x3) << 4) - | ((input[i + 1] >> 4) & 0xF)); - buf[ptr++] = encode((input[i + 1] & 0xF) << 2); - buf[ptr++] = '='; - } - return ptr; - } - - /** - * Encodes a byte array into another byte array by first doing base64 encoding - * then encoding the result in ASCII. - * - * The caller must supply a big enough buffer. - * - * @return - * the value of {@code ptr+((len+2)/3)*4}, which is the new offset - * in the output buffer where the further bytes should be placed. - */ - public static int _printBase64Binary(byte[] input, int offset, int len, byte[] out, int ptr) { - byte[] buf = out; - int remaining = len; - int i; - for (i=offset; remaining >= 3; remaining -= 3, i += 3 ) { - buf[ptr++] = encodeByte(input[i]>>2); - buf[ptr++] = encodeByte( - ((input[i]&0x3)<<4) | - ((input[i+1]>>4)&0xF)); - buf[ptr++] = encodeByte( - ((input[i+1]&0xF)<<2)| - ((input[i+2]>>6)&0x3)); - buf[ptr++] = encodeByte(input[i+2]&0x3F); - } - // encode when exactly 1 element (left) to encode - if (remaining == 1) { - buf[ptr++] = encodeByte(input[i]>>2); - buf[ptr++] = encodeByte(((input[i])&0x3)<<4); - buf[ptr++] = '='; - buf[ptr++] = '='; - } - // encode when exactly 2 elements (left) to encode - if (remaining == 2) { - buf[ptr++] = encodeByte(input[i]>>2); - buf[ptr++] = encodeByte( - ((input[i]&0x3)<<4) | - ((input[i+1]>>4)&0xF)); - buf[ptr++] = encodeByte((input[i+1]&0xF)<<2); - buf[ptr++] = '='; - } - - return ptr; - } - - private static CharSequence removeOptionalPlus(CharSequence s) { - int len = s.length(); - - if (len <= 1 || s.charAt(0) != '+') { - return s; - } - - s = s.subSequence(1, len); - char ch = s.charAt(0); - if ('0' <= ch && ch <= '9') { - return s; - } - if ('.' == ch) { - return s; - } - - throw new NumberFormatException(); - } - - private static boolean isDigitOrPeriodOrSign(char ch) { - if ('0' <= ch && ch <= '9') { - return true; - } - if (ch == '+' || ch == '-' || ch == '.') { - return true; - } - return false; - } - private static final DatatypeFactory datatypeFactory; - - static { - try { - datatypeFactory = DatatypeFactory.newInstance(); - } catch (DatatypeConfigurationException e) { - throw new Error(e); - } - } - - private static final class CalendarFormatter { - - public static String doFormat(String format, Calendar cal) throws IllegalArgumentException { - int fidx = 0; - int flen = format.length(); - StringBuilder buf = new StringBuilder(); - - while (fidx < flen) { - char fch = format.charAt(fidx++); - - if (fch != '%') { // not a meta character - buf.append(fch); - continue; - } - - // seen meta character. we don't do error check against the format - switch (format.charAt(fidx++)) { - case 'Y': // year - formatYear(cal, buf); - break; - - case 'M': // month - formatMonth(cal, buf); - break; - - case 'D': // days - formatDays(cal, buf); - break; - - case 'h': // hours - formatHours(cal, buf); - break; - - case 'm': // minutes - formatMinutes(cal, buf); - break; - - case 's': // parse seconds. - formatSeconds(cal, buf); - break; - - case 'z': // time zone - formatTimeZone(cal, buf); - break; - - default: - // illegal meta character. impossible. - throw new InternalError(); - } - } - - return buf.toString(); - } - - private static void formatYear(Calendar cal, StringBuilder buf) { - int year = cal.get(Calendar.YEAR); - - String s; - if (year <= 0) // negative value - { - s = Integer.toString(1 - year); - } else // positive value - { - s = Integer.toString(year); - } - - while (s.length() < 4) { - s = '0' + s; - } - if (year <= 0) { - s = '-' + s; - } - - buf.append(s); - } - - private static void formatMonth(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.MONTH) + 1, buf); - } - - private static void formatDays(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.DAY_OF_MONTH), buf); - } - - private static void formatHours(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.HOUR_OF_DAY), buf); - } - - private static void formatMinutes(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.MINUTE), buf); - } - - private static void formatSeconds(Calendar cal, StringBuilder buf) { - formatTwoDigits(cal.get(Calendar.SECOND), buf); - if (cal.isSet(Calendar.MILLISECOND)) { // milliseconds - int n = cal.get(Calendar.MILLISECOND); - if (n != 0) { - String ms = Integer.toString(n); - while (ms.length() < 3) { - ms = '0' + ms; // left 0 paddings. - } - buf.append('.'); - buf.append(ms); - } - } - } - - /** formats time zone specifier. */ - private static void formatTimeZone(Calendar cal, StringBuilder buf) { - TimeZone tz = cal.getTimeZone(); - - if (tz == null) { - return; - } - - // otherwise print out normally. - int offset = tz.getOffset(cal.getTime().getTime()); - - if (offset == 0) { - buf.append('Z'); - return; - } - - if (offset >= 0) { - buf.append('+'); - } else { - buf.append('-'); - offset *= -1; - } - - offset /= 60 * 1000; // offset is in milli-seconds - - formatTwoDigits(offset / 60, buf); - buf.append(':'); - formatTwoDigits(offset % 60, buf); - } - - /** formats Integer into two-character-wide string. */ - private static void formatTwoDigits(int n, StringBuilder buf) { - // n is always non-negative. - if (n < 10) { - buf.append('0'); - } - buf.append(n); - } - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/DatatypeConverterInterface.java 2018-01-30 20:39:16.000000000 -0500 +++ /dev/null 2018-01-30 20:39:16.000000000 -0500 @@ -1,484 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -/** - *

- * The DatatypeConverterInterface is for JAXB provider use only. A - * JAXB provider must supply a class that implements this interface. - * JAXB Providers are required to call the - * {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) - * DatatypeConverter.setDatatypeConverter} api at - * some point before the first marshal or unmarshal operation (perhaps during - * the call to JAXBContext.newInstance). This step is necessary to configure - * the converter that should be used to perform the print and parse - * functionality. Calling this api repeatedly will have no effect - the - * DatatypeConverter instance passed into the first invocation is the one that - * will be used from then on. - * - *

- * This interface defines the parse and print methods. There is one - * parse and print method for each XML schema datatype specified in the - * the default binding Table 5-1 in the JAXB specification. - * - *

- * The parse and print methods defined here are invoked by the static parse - * and print methods defined in the {@link DatatypeConverter DatatypeConverter} - * class. - * - *

- * A parse method for a XML schema datatype must be capable of converting any - * lexical representation of the XML schema datatype ( specified by the - * XML Schema Part2: Datatypes - * specification into a value in the value space of the XML schema datatype. - * If an error is encountered during conversion, then an IllegalArgumentException - * or a subclass of IllegalArgumentException must be thrown by the method. - * - *

- * A print method for a XML schema datatype can output any lexical - * representation that is valid with respect to the XML schema datatype. - * If an error is encountered during conversion, then an IllegalArgumentException, - * or a subclass of IllegalArgumentException must be thrown by the method. - * - *

- * The prefix xsd: is used to refer to XML schema datatypes - * XML Schema Part2: Datatypes - * specification. - * - * @author

    - *
  • Sekhar Vajjhala, Sun Microsystems, Inc.
  • - *
  • Joe Fialli, Sun Microsystems Inc.
  • - *
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • - *
  • Ryan Shoemaker,Sun Microsystems Inc.
  • - *
- * @see DatatypeConverter - * @see ParseConversionEvent - * @see PrintConversionEvent - * @since 1.6, JAXB 1.0 - */ - -public interface DatatypeConverterInterface { - /** - * Convert the string argument into a string. - * @param lexicalXSDString - * A lexical representation of the XML Schema datatype xsd:string - * @return - * A string that is the same as the input string. - */ - public String parseString( String lexicalXSDString ); - - /** - * Convert the string argument into a BigInteger value. - * @param lexicalXSDInteger - * A string containing a lexical representation of - * xsd:integer. - * @return - * A BigInteger value represented by the string argument. - * @throws NumberFormatException {@code lexicalXSDInteger} is not a valid string representation of a {@link java.math.BigInteger} value. - */ - public java.math.BigInteger parseInteger( String lexicalXSDInteger ); - - /** - * Convert the string argument into an int value. - * @param lexicalXSDInt - * A string containing a lexical representation of - * xsd:int. - * @return - * An int value represented byte the string argument. - * @throws NumberFormatException {@code lexicalXSDInt} is not a valid string representation of an {@code int} value. - */ - public int parseInt( String lexicalXSDInt ); - - /** - * Converts the string argument into a long value. - * @param lexicalXSDLong - * A string containing lexical representation of - * xsd:long. - * @return - * A long value represented by the string argument. - * @throws NumberFormatException {@code lexicalXSDLong} is not a valid string representation of a {@code long} value. - */ - public long parseLong( String lexicalXSDLong ); - - /** - * Converts the string argument into a short value. - * @param lexicalXSDShort - * A string containing lexical representation of - * xsd:short. - * @return - * A short value represented by the string argument. - * @throws NumberFormatException {@code lexicalXSDShort} is not a valid string representation of a {@code short} value. - */ - public short parseShort( String lexicalXSDShort ); - - /** - * Converts the string argument into a BigDecimal value. - * @param lexicalXSDDecimal - * A string containing lexical representation of - * xsd:decimal. - * @return - * A BigDecimal value represented by the string argument. - * @throws NumberFormatException {@code lexicalXSDDecimal} is not a valid string representation of {@link java.math.BigDecimal}. - */ - public java.math.BigDecimal parseDecimal( String lexicalXSDDecimal ); - - /** - * Converts the string argument into a float value. - * @param lexicalXSDFloat - * A string containing lexical representation of - * xsd:float. - * @return - * A float value represented by the string argument. - * @throws NumberFormatException {@code lexicalXSDFloat} is not a valid string representation of a {@code float} value. - */ - public float parseFloat( String lexicalXSDFloat ); - - /** - * Converts the string argument into a double value. - * @param lexicalXSDDouble - * A string containing lexical representation of - * xsd:double. - * @return - * A double value represented by the string argument. - * @throws NumberFormatException {@code lexicalXSDDouble} is not a valid string representation of a {@code double} value. - */ - public double parseDouble( String lexicalXSDDouble ); - - /** - * Converts the string argument into a boolean value. - * @param lexicalXSDBoolean - * A string containing lexical representation of - * xsd:boolean. - * @return - * A boolean value represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:boolean. - */ - public boolean parseBoolean( String lexicalXSDBoolean ); - - /** - * Converts the string argument into a byte value. - * @param lexicalXSDByte - * A string containing lexical representation of - * xsd:byte. - * @return - * A byte value represented by the string argument. - * @throws NumberFormatException {@code lexicalXSDByte} does not contain a parseable byte. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:byte. - */ - public byte parseByte( String lexicalXSDByte ); - - /** - * Converts the string argument into a QName value. - * - *

- * String parameter {@code lexicalXSDQname} must conform to lexical value space specifed at - * XML Schema Part 2:Datatypes specification:QNames - * - * @param lexicalXSDQName - * A string containing lexical representation of xsd:QName. - * @param nsc - * A namespace context for interpreting a prefix within a QName. - * @return - * A QName value represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to XML Schema Part 2 specification or - * if namespace prefix of {@code lexicalXSDQname} is not bound to a URI in NamespaceContext {@code nsc}. - */ - public javax.xml.namespace.QName parseQName( String lexicalXSDQName, - javax.xml.namespace.NamespaceContext nsc); - - /** - * Converts the string argument into a Calendar value. - * @param lexicalXSDDateTime - * A string containing lexical representation of - * xsd:datetime. - * @return - * A Calendar object represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:dateTime. - */ - public java.util.Calendar parseDateTime( String lexicalXSDDateTime ); - - /** - * Converts the string argument into an array of bytes. - * @param lexicalXSDBase64Binary - * A string containing lexical representation - * of xsd:base64Binary. - * @return - * An array of bytes represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:base64Binary - */ - public byte[] parseBase64Binary( String lexicalXSDBase64Binary ); - - /** - * Converts the string argument into an array of bytes. - * @param lexicalXSDHexBinary - * A string containing lexical representation of - * xsd:hexBinary. - * @return - * An array of bytes represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:hexBinary. - */ - public byte[] parseHexBinary( String lexicalXSDHexBinary ); - - /** - * Converts the string argument into a long value. - * @param lexicalXSDUnsignedInt - * A string containing lexical representation - * of xsd:unsignedInt. - * @return - * A long value represented by the string argument. - * @throws NumberFormatException if string parameter can not be parsed into a {@code long} value. - */ - public long parseUnsignedInt( String lexicalXSDUnsignedInt ); - - /** - * Converts the string argument into an int value. - * @param lexicalXSDUnsignedShort - * A string containing lexical - * representation of xsd:unsignedShort. - * @return - * An int value represented by the string argument. - * @throws NumberFormatException if string parameter can not be parsed into an {@code int} value. - */ - public int parseUnsignedShort( String lexicalXSDUnsignedShort ); - - /** - * Converts the string argument into a Calendar value. - * @param lexicalXSDTime - * A string containing lexical representation of - * xsd:Time. - * @return - * A Calendar value represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Time. - */ - public java.util.Calendar parseTime( String lexicalXSDTime ); - - /** - * Converts the string argument into a Calendar value. - * @param lexicalXSDDate - * A string containing lexical representation of - * xsd:Date. - * @return - * A Calendar value represented by the string argument. - * @throws IllegalArgumentException if string parameter does not conform to lexical value space defined in XML Schema Part 2: Datatypes for xsd:Date. - */ - public java.util.Calendar parseDate( String lexicalXSDDate ); - - /** - * Return a string containing the lexical representation of the - * simple type. - * @param lexicalXSDAnySimpleType - * A string containing lexical - * representation of the simple type. - * @return - * A string containing the lexical representation of the - * simple type. - */ - public String parseAnySimpleType( String lexicalXSDAnySimpleType ); - - /** - * Converts the string argument into a string. - * @param val - * A string value. - * @return - * A string containing a lexical representation of xsd:string - */ - public String printString( String val ); - - /** - * Converts a BigInteger value into a string. - * @param val - * A BigInteger value - * @return - * A string containing a lexical representation of xsd:integer - * @throws IllegalArgumentException {@code val} is null. - */ - public String printInteger( java.math.BigInteger val ); - - /** - * Converts an int value into a string. - * @param val - * An int value - * @return - * A string containing a lexical representation of xsd:int - */ - public String printInt( int val ); - - - /** - * Converts a long value into a string. - * @param val - * A long value - * @return - * A string containing a lexical representation of xsd:long - */ - public String printLong( long val ); - - /** - * Converts a short value into a string. - * @param val - * A short value - * @return - * A string containing a lexical representation of xsd:short - */ - public String printShort( short val ); - - /** - * Converts a BigDecimal value into a string. - * @param val - * A BigDecimal value - * @return - * A string containing a lexical representation of xsd:decimal - * @throws IllegalArgumentException {@code val} is null. - */ - public String printDecimal( java.math.BigDecimal val ); - - /** - * Converts a float value into a string. - * @param val - * A float value - * @return - * A string containing a lexical representation of xsd:float - */ - public String printFloat( float val ); - - /** - * Converts a double value into a string. - * @param val - * A double value - * @return - * A string containing a lexical representation of xsd:double - */ - public String printDouble( double val ); - - /** - * Converts a boolean value into a string. - * @param val - * A boolean value - * @return - * A string containing a lexical representation of xsd:boolean - */ - public String printBoolean( boolean val ); - - /** - * Converts a byte value into a string. - * @param val - * A byte value - * @return - * A string containing a lexical representation of xsd:byte - */ - public String printByte( byte val ); - - /** - * Converts a QName instance into a string. - * @param val - * A QName value - * @param nsc - * A namespace context for interpreting a prefix within a QName. - * @return - * A string containing a lexical representation of QName - * @throws IllegalArgumentException if {@code val} is null or - * if {@code nsc} is non-null or {@code nsc.getPrefix(nsprefixFromVal)} is null. - */ - public String printQName( javax.xml.namespace.QName val, - javax.xml.namespace.NamespaceContext nsc ); - - /** - * Converts a Calendar value into a string. - * @param val - * A Calendar value - * @return - * A string containing a lexical representation of xsd:dateTime - * @throws IllegalArgumentException if {@code val} is null. - */ - public String printDateTime( java.util.Calendar val ); - - /** - * Converts an array of bytes into a string. - * @param val - * an array of bytes - * @return - * A string containing a lexical representation of xsd:base64Binary - * @throws IllegalArgumentException if {@code val} is null. - */ - public String printBase64Binary( byte[] val ); - - /** - * Converts an array of bytes into a string. - * @param val - * an array of bytes - * @return - * A string containing a lexical representation of xsd:hexBinary - * @throws IllegalArgumentException if {@code val} is null. - */ - public String printHexBinary( byte[] val ); - - /** - * Converts a long value into a string. - * @param val - * A long value - * @return - * A string containing a lexical representation of xsd:unsignedInt - */ - public String printUnsignedInt( long val ); - - /** - * Converts an int value into a string. - * @param val - * An int value - * @return - * A string containing a lexical representation of xsd:unsignedShort - */ - public String printUnsignedShort( int val ); - - /** - * Converts a Calendar value into a string. - * @param val - * A Calendar value - * @return - * A string containing a lexical representation of xsd:time - * @throws IllegalArgumentException if {@code val} is null. - */ - public String printTime( java.util.Calendar val ); - - /** - * Converts a Calendar value into a string. - * @param val - * A Calendar value - * @return - * A string containing a lexical representation of xsd:date - * @throws IllegalArgumentException if {@code val} is null. - */ - public String printDate( java.util.Calendar val ); - - /** - * Converts a string value into a string. - * @param val - * A string value - * @return - * A string containing a lexical representation of xsd:AnySimpleType - */ - public String printAnySimpleType( String val ); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/Element.java 2018-01-30 20:39:17.000000000 -0500 +++ /dev/null 2018-01-30 20:39:17.000000000 -0500 @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -/** - * This is an element marker interface. - * - * Under certain circumstances, it is necessary for the binding compiler to - * generate derived java content classes that implement this interface. In - * those cases, client applications must supply element instances rather than - * types of elements. For more detail, see section 5.7 "Element Declaration" - * and 5.7.1 "Bind to Java Element Interface" of the specification. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @since 1.6, JAXB 1.0 - */ - -public interface Element { -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/GetPropertyAction.java 2018-01-30 20:39:18.000000000 -0500 +++ /dev/null 2018-01-30 20:39:18.000000000 -0500 @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2006, 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 javax.xml.bind; - -import java.security.PrivilegedAction; - -/** - * {@link PrivilegedAction} that gets the system property value. - * @author Kohsuke Kawaguchi - */ -final class GetPropertyAction implements PrivilegedAction { - private final String propertyName; - - public GetPropertyAction(String propertyName) { - this.propertyName = propertyName; - } - - public String run() { - return System.getProperty(propertyName); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/JAXB.java 2018-01-30 20:39:19.000000000 -0500 +++ /dev/null 2018-01-30 20:39:19.000000000 -0500 @@ -1,629 +0,0 @@ -/* - * Copyright (c) 2006, 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 javax.xml.bind; - -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.namespace.QName; -import javax.xml.transform.Result; -import javax.xml.transform.Source; -import javax.xml.transform.stream.StreamResult; -import javax.xml.transform.stream.StreamSource; -import java.beans.Introspector; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.io.Reader; -import java.io.Writer; -import java.lang.ref.WeakReference; -import java.net.HttpURLConnection; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.net.URLConnection; - -/** - * Class that defines convenience methods for common, simple use of JAXB. - * - *

- * Methods defined in this class are convenience methods that combine several basic operations - * in the {@link JAXBContext}, {@link Unmarshaller}, and {@link Marshaller}. - * - * They are designed - * to be the prefered methods for developers new to JAXB. They have - * the following characterstics: - * - *

    - *
  1. Generally speaking, the performance is not necessarily optimal. - * It is expected that people who need to write performance - * critical code will use the rest of the JAXB API directly. - *
  2. Errors that happen during the processing is wrapped into - * {@link DataBindingException} (which will have {@link JAXBException} - * as its {@link Throwable#getCause() cause}. It is expected that - * people who prefer the checked exception would use - * the rest of the JAXB API directly. - *
- * - *

- * In addition, the {@code unmarshal} methods have the following characteristic: - * - *

    - *
  1. Schema validation is not performed on the input XML. - * The processing will try to continue even if there - * are errors in the XML, as much as possible. Only as - * the last resort, this method fails with {@link DataBindingException}. - *
- * - *

- * Similarly, the {@code marshal} methods have the following characteristic: - *

    - *
  1. The processing will try to continue even if the Java object tree - * does not meet the validity requirement. Only as - * the last resort, this method fails with {@link DataBindingException}. - *
- * - * - *

- * All the methods on this class require non-null arguments to all parameters. - * The {@code unmarshal} methods either fail with an exception or return - * a non-null value. - * - * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.1 - */ -public final class JAXB { - /** - * No instanciation is allowed. - */ - private JAXB() {} - - /** - * To improve the performance, we'll cache the last {@link JAXBContext} used. - */ - private static final class Cache { - final Class type; - final JAXBContext context; - - public Cache(Class type) throws JAXBException { - this.type = type; - this.context = JAXBContext.newInstance(type); - } - } - - /** - * Cache. We don't want to prevent the {@link Cache#type} from GC-ed, - * hence {@link WeakReference}. - */ - private static volatile WeakReference cache; - - /** - * Obtains the {@link JAXBContext} from the given type, - * by using the cache if possible. - * - *

- * We don't use locks to control access to {@link #cache}, but this code - * should be thread-safe thanks to the immutable {@link Cache} and {@code volatile}. - */ - private static JAXBContext getContext(Class type) throws JAXBException { - WeakReference c = cache; - if(c!=null) { - Cache d = c.get(); - if(d!=null && d.type==type) - return d.context; - } - - // overwrite the cache - Cache d = new Cache(type); - cache = new WeakReference(d); - - return d.context; - } - - /** - * Reads in a Java object tree from the given XML input. - * - * @param xml - * Reads the entire file as XML. - */ - public static T unmarshal( File xml, Class type ) { - try { - JAXBElement item = getContext(type).createUnmarshaller().unmarshal(new StreamSource(xml), type); - return item.getValue(); - } catch (JAXBException e) { - throw new DataBindingException(e); - } - } - - /** - * Reads in a Java object tree from the given XML input. - * - * @param xml - * The resource pointed by the URL is read in its entirety. - */ - public static T unmarshal( URL xml, Class type ) { - try { - JAXBElement item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); - return item.getValue(); - } catch (JAXBException e) { - throw new DataBindingException(e); - } catch (IOException e) { - throw new DataBindingException(e); - } - } - - /** - * Reads in a Java object tree from the given XML input. - * - * @param xml - * The URI is {@link URI#toURL() turned into URL} and then - * follows the handling of {@code URL}. - */ - public static T unmarshal( URI xml, Class type ) { - try { - JAXBElement item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); - return item.getValue(); - } catch (JAXBException e) { - throw new DataBindingException(e); - } catch (IOException e) { - throw new DataBindingException(e); - } - } - - /** - * Reads in a Java object tree from the given XML input. - * - * @param xml - * The string is first interpreted as an absolute {@code URI}. - * If it's not {@link URI#isAbsolute() a valid absolute URI}, - * then it's interpreted as a {@code File} - */ - public static T unmarshal( String xml, Class type ) { - try { - JAXBElement item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); - return item.getValue(); - } catch (JAXBException e) { - throw new DataBindingException(e); - } catch (IOException e) { - throw new DataBindingException(e); - } - } - - /** - * Reads in a Java object tree from the given XML input. - * - * @param xml - * The entire stream is read as an XML infoset. - * Upon a successful completion, the stream will be closed by this method. - */ - public static T unmarshal( InputStream xml, Class type ) { - try { - JAXBElement item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); - return item.getValue(); - } catch (JAXBException e) { - throw new DataBindingException(e); - } catch (IOException e) { - throw new DataBindingException(e); - } - } - - /** - * Reads in a Java object tree from the given XML input. - * - * @param xml - * The character stream is read as an XML infoset. - * The encoding declaration in the XML will be ignored. - * Upon a successful completion, the stream will be closed by this method. - */ - public static T unmarshal( Reader xml, Class type ) { - try { - JAXBElement item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); - return item.getValue(); - } catch (JAXBException e) { - throw new DataBindingException(e); - } catch (IOException e) { - throw new DataBindingException(e); - } - } - - /** - * Reads in a Java object tree from the given XML input. - * - * @param xml - * The XML infoset that the {@link Source} represents is read. - */ - public static T unmarshal( Source xml, Class type ) { - try { - JAXBElement item = getContext(type).createUnmarshaller().unmarshal(toSource(xml), type); - return item.getValue(); - } catch (JAXBException e) { - throw new DataBindingException(e); - } catch (IOException e) { - throw new DataBindingException(e); - } - } - - - - /** - * Creates {@link Source} from various XML representation. - * See {@link #unmarshal} for the conversion rules. - */ - private static Source toSource(Object xml) throws IOException { - if(xml==null) - throw new IllegalArgumentException("no XML is given"); - - if (xml instanceof String) { - try { - xml=new URI((String)xml); - } catch (URISyntaxException e) { - xml=new File((String)xml); - } - } - if (xml instanceof File) { - File file = (File) xml; - return new StreamSource(file); - } - if (xml instanceof URI) { - URI uri = (URI) xml; - xml=uri.toURL(); - } - if (xml instanceof URL) { - URL url = (URL) xml; - return new StreamSource(url.toExternalForm()); - } - if (xml instanceof InputStream) { - InputStream in = (InputStream) xml; - return new StreamSource(in); - } - if (xml instanceof Reader) { - Reader r = (Reader) xml; - return new StreamSource(r); - } - if (xml instanceof Source) { - return (Source) xml; - } - throw new IllegalArgumentException("I don't understand how to handle "+xml.getClass()); - } - - /** - * Writes a Java object tree to XML and store it to the specified location. - * - * @param jaxbObject - * The Java object to be marshalled into XML. If this object is - * a {@link JAXBElement}, it will provide the root tag name and - * the body. If this object has {@link XmlRootElement} - * on its class definition, that will be used as the root tag name - * and the given object will provide the body. Otherwise, - * the root tag name is {@link Introspector#decapitalize(String) infered} from - * {@link Class#getSimpleName() the short class name}. - * This parameter must not be null. - * - * @param xml - * XML will be written to this file. If it already exists, - * it will be overwritten. - * - * @throws DataBindingException - * If the operation fails, such as due to I/O error, unbindable classes. - */ - public static void marshal( Object jaxbObject, File xml ) { - _marshal(jaxbObject,xml); - } - - /** - * Writes a Java object tree to XML and store it to the specified location. - * - * @param jaxbObject - * The Java object to be marshalled into XML. If this object is - * a {@link JAXBElement}, it will provide the root tag name and - * the body. If this object has {@link XmlRootElement} - * on its class definition, that will be used as the root tag name - * and the given object will provide the body. Otherwise, - * the root tag name is {@link Introspector#decapitalize(String) infered} from - * {@link Class#getSimpleName() the short class name}. - * This parameter must not be null. - * - * @param xml - * The XML will be {@link URLConnection#getOutputStream() sent} to the - * resource pointed by this URL. Note that not all {@code URL}s support - * such operation, and exact semantics depends on the {@code URL} - * implementations. In case of {@link HttpURLConnection HTTP URLs}, - * this will perform HTTP POST. - * - * @throws DataBindingException - * If the operation fails, such as due to I/O error, unbindable classes. - */ - public static void marshal( Object jaxbObject, URL xml ) { - _marshal(jaxbObject,xml); - } - - /** - * Writes a Java object tree to XML and store it to the specified location. - * - * @param jaxbObject - * The Java object to be marshalled into XML. If this object is - * a {@link JAXBElement}, it will provide the root tag name and - * the body. If this object has {@link XmlRootElement} - * on its class definition, that will be used as the root tag name - * and the given object will provide the body. Otherwise, - * the root tag name is {@link Introspector#decapitalize(String) infered} from - * {@link Class#getSimpleName() the short class name}. - * This parameter must not be null. - * - * @param xml - * The URI is {@link URI#toURL() turned into URL} and then - * follows the handling of {@code URL}. See above. - * - * @throws DataBindingException - * If the operation fails, such as due to I/O error, unbindable classes. - */ - public static void marshal( Object jaxbObject, URI xml ) { - _marshal(jaxbObject,xml); - } - - /** - * Writes a Java object tree to XML and store it to the specified location. - * - * @param jaxbObject - * The Java object to be marshalled into XML. If this object is - * a {@link JAXBElement}, it will provide the root tag name and - * the body. If this object has {@link XmlRootElement} - * on its class definition, that will be used as the root tag name - * and the given object will provide the body. Otherwise, - * the root tag name is {@link Introspector#decapitalize(String) infered} from - * {@link Class#getSimpleName() the short class name}. - * This parameter must not be null. - * - * @param xml - * The string is first interpreted as an absolute {@code URI}. - * If it's not {@link URI#isAbsolute() a valid absolute URI}, - * then it's interpreted as a {@code File} - * - * @throws DataBindingException - * If the operation fails, such as due to I/O error, unbindable classes. - */ - public static void marshal( Object jaxbObject, String xml ) { - _marshal(jaxbObject,xml); - } - - /** - * Writes a Java object tree to XML and store it to the specified location. - * - * @param jaxbObject - * The Java object to be marshalled into XML. If this object is - * a {@link JAXBElement}, it will provide the root tag name and - * the body. If this object has {@link XmlRootElement} - * on its class definition, that will be used as the root tag name - * and the given object will provide the body. Otherwise, - * the root tag name is {@link Introspector#decapitalize(String) infered} from - * {@link Class#getSimpleName() the short class name}. - * This parameter must not be null. - * - * @param xml - * The XML will be sent to the given {@link OutputStream}. - * Upon a successful completion, the stream will be closed by this method. - * - * @throws DataBindingException - * If the operation fails, such as due to I/O error, unbindable classes. - */ - public static void marshal( Object jaxbObject, OutputStream xml ) { - _marshal(jaxbObject,xml); - } - - /** - * Writes a Java object tree to XML and store it to the specified location. - * - * @param jaxbObject - * The Java object to be marshalled into XML. If this object is - * a {@link JAXBElement}, it will provide the root tag name and - * the body. If this object has {@link XmlRootElement} - * on its class definition, that will be used as the root tag name - * and the given object will provide the body. Otherwise, - * the root tag name is {@link Introspector#decapitalize(String) infered} from - * {@link Class#getSimpleName() the short class name}. - * This parameter must not be null. - * - * @param xml - * The XML will be sent as a character stream to the given {@link Writer}. - * Upon a successful completion, the stream will be closed by this method. - * - * @throws DataBindingException - * If the operation fails, such as due to I/O error, unbindable classes. - */ - public static void marshal( Object jaxbObject, Writer xml ) { - _marshal(jaxbObject,xml); - } - - /** - * Writes a Java object tree to XML and store it to the specified location. - * - * @param jaxbObject - * The Java object to be marshalled into XML. If this object is - * a {@link JAXBElement}, it will provide the root tag name and - * the body. If this object has {@link XmlRootElement} - * on its class definition, that will be used as the root tag name - * and the given object will provide the body. Otherwise, - * the root tag name is {@link Introspector#decapitalize(String) infered} from - * {@link Class#getSimpleName() the short class name}. - * This parameter must not be null. - * - * @param xml - * The XML will be sent to the {@link Result} object. - * - * @throws DataBindingException - * If the operation fails, such as due to I/O error, unbindable classes. - */ - public static void marshal( Object jaxbObject, Result xml ) { - _marshal(jaxbObject,xml); - } - - /** - * Writes a Java object tree to XML and store it to the specified location. - * - *

- * This method is a convenience method that combines several basic operations - * in the {@link JAXBContext} and {@link Marshaller}. This method is designed - * to be the prefered method for developers new to JAXB. This method - * has the following characterstics: - * - *

    - *
  1. Generally speaking, the performance is not necessarily optimal. - * It is expected that those people who need to write performance - * critical code will use the rest of the JAXB API directly. - *
  2. Errors that happen during the processing is wrapped into - * {@link DataBindingException} (which will have {@link JAXBException} - * as its {@link Throwable#getCause() cause}. It is expected that - * those people who prefer the checked exception would use - * the rest of the JAXB API directly. - *
- * - * @param jaxbObject - * The Java object to be marshalled into XML. If this object is - * a {@link JAXBElement}, it will provide the root tag name and - * the body. If this object has {@link XmlRootElement} - * on its class definition, that will be used as the root tag name - * and the given object will provide the body. Otherwise, - * the root tag name is {@link Introspector#decapitalize(String) infered} from - * {@link Class#getSimpleName() the short class name}. - * This parameter must not be null. - * - * @param xml - * Represents the receiver of XML. Objects of the following types are allowed. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
TypeOperation
{@link File}XML will be written to this file. If it already exists, - * it will be overwritten.
{@link URL}The XML will be {@link URLConnection#getOutputStream() sent} to the - * resource pointed by this URL. Note that not all {@code URL}s support - * such operation, and exact semantics depends on the {@code URL} - * implementations. In case of {@link HttpURLConnection HTTP URLs}, - * this will perform HTTP POST.
{@link URI}The URI is {@link URI#toURL() turned into URL} and then - * follows the handling of {@code URL}. See above.
{@link String}The string is first interpreted as an absolute {@code URI}. - * If it's not {@link URI#isAbsolute() a valid absolute URI}, - * then it's interpreted as a {@code File}
{@link OutputStream}The XML will be sent to the given {@link OutputStream}. - * Upon a successful completion, the stream will be closed by this method.
{@link Writer}The XML will be sent as a character stream to the given {@link Writer}. - * Upon a successful completion, the stream will be closed by this method.
{@link Result}The XML will be sent to the {@link Result} object.
- * - * @throws DataBindingException - * If the operation fails, such as due to I/O error, unbindable classes. - */ - private static void _marshal( Object jaxbObject, Object xml ) { - try { - JAXBContext context; - - if(jaxbObject instanceof JAXBElement) { - context = getContext(((JAXBElement)jaxbObject).getDeclaredType()); - } else { - Class clazz = jaxbObject.getClass(); - XmlRootElement r = clazz.getAnnotation(XmlRootElement.class); - context = getContext(clazz); - if(r==null) { - // we need to infer the name - jaxbObject = new JAXBElement(new QName(inferName(clazz)),clazz,jaxbObject); - } - } - - Marshaller m = context.createMarshaller(); - m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true); - m.marshal(jaxbObject, toResult(xml)); - } catch (JAXBException e) { - throw new DataBindingException(e); - } catch (IOException e) { - throw new DataBindingException(e); - } - } - - private static String inferName(Class clazz) { - return Introspector.decapitalize(clazz.getSimpleName()); - } - - /** - * Creates {@link Result} from various XML representation. - * See {@link #_marshal(Object,Object)} for the conversion rules. - */ - private static Result toResult(Object xml) throws IOException { - if(xml==null) - throw new IllegalArgumentException("no XML is given"); - - if (xml instanceof String) { - try { - xml=new URI((String)xml); - } catch (URISyntaxException e) { - xml=new File((String)xml); - } - } - if (xml instanceof File) { - File file = (File) xml; - return new StreamResult(file); - } - if (xml instanceof URI) { - URI uri = (URI) xml; - xml=uri.toURL(); - } - if (xml instanceof URL) { - URL url = (URL) xml; - URLConnection con = url.openConnection(); - con.setDoOutput(true); - con.setDoInput(false); - con.connect(); - return new StreamResult(con.getOutputStream()); - } - if (xml instanceof OutputStream) { - OutputStream os = (OutputStream) xml; - return new StreamResult(os); - } - if (xml instanceof Writer) { - Writer w = (Writer)xml; - return new StreamResult(w); - } - if (xml instanceof Result) { - return (Result) xml; - } - throw new IllegalArgumentException("I don't understand how to handle "+xml.getClass()); - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContext.java 2018-01-30 20:39:19.000000000 -0500 +++ /dev/null 2018-01-30 20:39:19.000000000 -0500 @@ -1,834 +0,0 @@ -/* - * Copyright (c) 2003, 2017, 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 javax.xml.bind; - -import org.w3c.dom.Node; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Collections; -import java.util.Map; -import java.util.Properties; - -/** - * The {@code JAXBContext} class provides the client's entry point to the - * JAXB API. It provides an abstraction for managing the XML/Java binding - * information necessary to implement the JAXB binding framework operations: - * unmarshal, marshal and validate. - * - *

A client application normally obtains new instances of this class using - * one of these two styles for newInstance methods, although there are other - * specialized forms of the method available: - * - *

    - *
  • {@link #newInstance(String, ClassLoader) JAXBContext.newInstance( "com.acme.foo:com.acme.bar" )}
    - * The JAXBContext instance is initialized from a list of colon - * separated Java package names. Each java package contains - * JAXB mapped classes, schema-derived classes and/or user annotated - * classes. Additionally, the java package may contain JAXB package annotations - * that must be processed. (see JLS, Section 7.4.1 "Named Packages"). - *
  • - *
  • {@link #newInstance(Class...) JAXBContext.newInstance( com.acme.foo.Foo.class )}
    - * The JAXBContext instance is initialized with class(es) - * passed as parameter(s) and classes that are statically reachable from - * these class(es). See {@link #newInstance(Class...)} for details. - *
  • - *
- * - *

- * The following JAXB 1.0 requirement is only required for schema to - * java interface/implementation binding. It does not apply to JAXB annotated - * classes. JAXB Providers must generate a {@code jaxb.properties} file in - * each package containing schema derived classes. The property file must - * contain a property named {@code javax.xml.bind.context.factory} whose - * value is the name of the class that implements the {@code createContext} - * APIs. - * - *

- * The class supplied by the provider does not have to be assignable to - * {@code javax.xml.bind.JAXBContext}, it simply has to provide a class that - * implements the {@code createContext} APIs. - * - *

- * In addition, the provider must call the - * {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) - * DatatypeConverter.setDatatypeConverter} api prior to any client - * invocations of the marshal and unmarshal methods. This is necessary to - * configure the datatype converter that will be used during these operations. - * - * - *

Unmarshalling

- *

- * The {@link Unmarshaller} class provides the client application the ability - * to convert XML data into a tree of Java content objects. - * The unmarshal method allows for - * any global XML element declared in the schema to be unmarshalled as - * the root of an instance document. - * Additionally, the unmarshal method allows for an unrecognized root element that - * has an xsi:type attribute's value that references a type definition declared in - * the schema to be unmarshalled as the root of an instance document. - * The {@code JAXBContext} object - * allows the merging of global elements and type definitions across a set of schemas (listed - * in the {@code contextPath}). Since each schema in the schema set can belong - * to distinct namespaces, the unification of schemas to an unmarshalling - * context must be namespace independent. This means that a client - * application is able to unmarshal XML documents that are instances of - * any of the schemas listed in the {@code contextPath}. For example: - * - *

- *      JAXBContext jc = JAXBContext.newInstance( "com.acme.foo:com.acme.bar" );
- *      Unmarshaller u = jc.createUnmarshaller();
- *      FooObject fooObj = (FooObject)u.unmarshal( new File( "foo.xml" ) ); // ok
- *      BarObject barObj = (BarObject)u.unmarshal( new File( "bar.xml" ) ); // ok
- *      BazObject bazObj = (BazObject)u.unmarshal( new File( "baz.xml" ) ); // error, "com.acme.baz" not in contextPath
- * 
- * - *

- * The client application may also generate Java content trees explicitly rather - * than unmarshalling existing XML data. For all JAXB-annotated value classes, - * an application can create content using constructors. - * For schema-derived interface/implementation classes and for the - * creation of elements that are not bound to a JAXB-annotated - * class, an application needs to have access and knowledge about each of - * the schema derived {@code ObjectFactory} classes that exist in each of - * java packages contained in the {@code contextPath}. For each schema - * derived java class, there is a static factory method that produces objects - * of that type. For example, - * assume that after compiling a schema, you have a package {@code com.acme.foo} - * that contains a schema derived interface named {@code PurchaseOrder}. In - * order to create objects of that type, the client application would use the - * factory method like this: - * - *

- *       com.acme.foo.PurchaseOrder po =
- *           com.acme.foo.ObjectFactory.createPurchaseOrder();
- * 
- * - *

- * Once the client application has an instance of the the schema derived object, - * it can use the mutator methods to set content on it. - * - *

- * For more information on the generated {@code ObjectFactory} classes, see - * Section 4.2 Java Package of the specification. - * - *

- * The provider must generate a class in each - * package that contains all of the necessary object factory methods for that - * package named ObjectFactory as well as the static - * {@code newInstance( javaContentInterface )} method - * - *

Marshalling

- *

- * The {@link Marshaller} class provides the client application the ability - * to convert a Java content tree back into XML data. There is no difference - * between marshalling a content tree that is created manually using the factory - * methods and marshalling a content tree that is the result an {@code unmarshal} - * operation. Clients can marshal a java content tree back to XML data - * to a {@code java.io.OutputStream} or a {@code java.io.Writer}. The - * marshalling process can alternatively produce SAX2 event streams to a - * registered {@code ContentHandler} or produce a DOM Node object. - * Client applications have control over the output encoding as well as - * whether or not to marshal the XML data as a complete document or - * as a fragment. - * - *

- * Here is a simple example that unmarshals an XML document and then marshals - * it back out: - * - *

- *        JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *
- *        // unmarshal from foo.xml
- *        Unmarshaller u = jc.createUnmarshaller();
- *        FooObject fooObj = (FooObject)u.unmarshal( new File( "foo.xml" ) );
- *
- *        // marshal to System.out
- *        Marshaller m = jc.createMarshaller();
- *        m.marshal( fooObj, System.out );
- * 
- * - * - *

Validation

- *

- * Validation has been changed significantly since JAXB 1.0. The {@link Validator} - * class has been deprecated and made optional. This means that you are advised - * not to use this class and, in fact, it may not even be available depending on - * your JAXB provider. JAXB 1.0 client applications that rely on {@code Validator} - * will still work properly when deployed with the JAXB 1.0 runtime system. - * - * In JAXB 2.0, the {@link Unmarshaller} has included convenince methods that expose - * the JAXP 1.3 {@link javax.xml.validation} framework. Please refer to the - * {@link Unmarshaller#setSchema(javax.xml.validation.Schema)} API for more - * information. - * - * - *

JAXB Runtime Binding Framework Compatibility

- *

- * The following JAXB 1.0 restriction only applies to binding schema to - * interfaces/implementation classes. - * Since this binding does not require a common runtime system, a JAXB - * client application must not attempt to mix runtime objects ({@code JAXBContext, - * Marshaller}, etc. ) from different providers. This does not - * mean that the client application isn't portable, it simply means that a - * client has to use a runtime system provided by the same provider that was - * used to compile the schema. - * - * - *

Discovery of JAXB implementation

- *

- * To create an instance of {@link JAXBContext}, one of {@code JAXBContext.newInstance(...)} methods is invoked. After - * JAX-B implementation is discovered, call is delegated to appropriate provider's method {@code createContext(...)} - * passing parameters from the original call. - *

- * JAX-B implementation discovery happens each time {@code JAXBContext.newInstance} is invoked. If there is no user - * specific configuration provided, default JAX-B provider must be returned. - *

- * Implementation discovery consists of following steps: - * - *

    - * - *
  1. - * Packages/classes explicitly passed in to the {@link #newInstance} method are processed in the order they are - * specified, until {@code jaxb.properties} file is looked up in its package, by using the associated classloader — - * this is {@link Class#getClassLoader() the owner class loader} for a {@link Class} argument, and for a package - * the specified {@link ClassLoader}. - * - *

    - * If such a resource is discovered, it is {@link Properties#load(InputStream) loaded} as a property file, and - * the value of the {@link #JAXB_CONTEXT_FACTORY} key will be assumed to be the provider factory class. If no value - * found, {@code "javax.xml.bind.context.factory"} is used as a key for backwards compatibility reasons. This class is - * then loaded by the associated class loader discussed above. - * - *

    - * This phase of the look up allows some packages to force the use of a certain JAXB implementation. - * (For example, perhaps the schema compiler has generated some vendor extension in the code.) - * - *

    - * This configuration method is deprecated. - * - *

  2. - * If the system property {@link #JAXB_CONTEXT_FACTORY} exists, then its value is assumed to be the provider - * factory class. If no such property exists, properties {@code "javax.xml.bind.context.factory"} and - * {@code "javax.xml.bind.JAXBContext"} are checked too (in this order), for backwards compatibility reasons. This phase - * of the look up enables per-JVM override of the JAXB implementation. - * - *
  3. - * Provider of {@link javax.xml.bind.JAXBContextFactory} is loaded using the service-provider loading - * facilities, defined by the {@link java.util.ServiceLoader} class, to attempt - * to locate and load an implementation of the service using the {@linkplain - * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}: the service-provider loading facility - * will use the {@linkplain java.lang.Thread#getContextClassLoader() current thread's context class loader} - * to attempt to load the context factory. If the context class loader is null, the - * {@linkplain ClassLoader#getSystemClassLoader() system class loader} will be used. - *
    - * In case of {@link java.util.ServiceConfigurationError service - * configuration error} a {@link javax.xml.bind.JAXBException} will be thrown. - * - *
  4. - * Look for resource {@code /META-INF/services/javax.xml.bind.JAXBContext} using provided class loader. - * Methods without class loader parameter use {@code Thread.currentThread().getContextClassLoader()}. - * If such a resource exists, its content is assumed to be the provider factory class. - * - * This configuration method is deprecated. - * - *
  5. - * Finally, if all the steps above fail, then the rest of the look up is unspecified. That said, - * the recommended behavior is to simply look for some hard-coded platform default JAXB implementation. - * This phase of the look up is so that Java SE can have its own JAXB implementation as the last resort. - *
- * - *

- * Once the provider factory class is discovered, context creation is delegated to one of its - * {@code createContext(...)} methods. - * - * For backward compatibility reasons, there are two ways how to implement provider factory class: - *

    - *
  1. the class is implementation of {@link javax.xml.bind.JAXBContextFactory}. It must also implement no-arg - * constructor. If discovered in other step then 3, new instance using no-arg constructor is created first. - * After that, appropriate instance method is invoked on this instance. - *
  2. the class is not implementation of interface above and then it is mandated to implement the following - * static method signatures: - *
    - *
    - * public static JAXBContext createContext(
    - *                                      String contextPath,
    - *                                      ClassLoader classLoader,
    - *                                      Map<String,Object> properties ) throws JAXBException
    - *
    - * public static JAXBContext createContext(
    - *                                      Class[] classes,
    - *                                      Map<String,Object> properties ) throws JAXBException
    - * 
    - * In this scenario, appropriate static method is used instead of instance method. This approach is incompatible - * with {@link java.util.ServiceLoader} so it can't be used with step 3. - *
- *

- * There is no difference in behavior of given method {@code createContext(...)} regardless of whether it uses approach - * 1 (JAXBContextFactory) or 2 (no interface, static methods). - * - * @apiNote - * Service discovery method using resource {@code /META-INF/services/javax.xml.bind.JAXBContext} (described in step 4) - * is supported only to allow backwards compatibility, it is strongly recommended to migrate to standard - * {@link java.util.ServiceLoader} mechanism (described in step 3). The difference here is the resource name, which - * doesn't match service's type name. - *

- * Also using providers implementing interface {@link JAXBContextFactory} is preferred over using ones defining - * static methods, same as {@link JAXBContext#JAXB_CONTEXT_FACTORY} property is preferred over property - * {@code "javax.xml.bind.context.factory"} - * - * @implNote - * Within the last step, if Glassfish AS environment detected, its specific service loader is used to find factory class. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
  • - *
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • - *
  • Joe Fialli, Sun Microsystems, Inc.
- * - * @see Marshaller - * @see Unmarshaller - * @see S 7.4.1 "Named Packages" - * in Java Language Specification - * - * @since 1.6, JAXB 1.0 - */ -public abstract class JAXBContext { - - /** - * The name of the property that contains the name of the class capable - * of creating new {@code JAXBContext} objects. - */ - public static final String JAXB_CONTEXT_FACTORY = "javax.xml.bind.JAXBContextFactory"; - - protected JAXBContext() { - } - - - /** - * Create a new instance of a {@code JAXBContext} class. - * - *

- * This is a convenience method to invoke the - * {@link #newInstance(String,ClassLoader)} method with - * the context class loader of the current thread. - * - * @throws JAXBException if an error was encountered while creating the - * {@code JAXBContext} such as - *

    - *
  1. failure to locate either ObjectFactory.class or jaxb.index in the packages
  2. - *
  3. an ambiguity among global elements contained in the contextPath
  4. - *
  5. failure to locate a value for the context factory provider property
  6. - *
  7. mixing schema derived packages from different providers on the same contextPath
  8. - *
  9. packages are not open to {@code java.xml.bind} module
  10. - *
- */ - public static JAXBContext newInstance( String contextPath ) - throws JAXBException { - - //return newInstance( contextPath, JAXBContext.class.getClassLoader() ); - return newInstance( contextPath, getContextClassLoader()); - } - - /** - * Create a new instance of a {@code JAXBContext} class. - * - *

- * The client application must supply a context path which is a list of - * colon (':', \u005Cu003A) separated java package names that contain - * schema-derived classes and/or fully qualified JAXB-annotated classes. - * Schema-derived - * code is registered with the JAXBContext by the - * ObjectFactory.class generated per package. - * Alternatively than being listed in the context path, programmer - * annotated JAXB mapped classes can be listed in a - * {@code jaxb.index} resource file, format described below. - * Note that a java package can contain both schema-derived classes and - * user annotated JAXB classes. Additionally, the java package may - * contain JAXB package annotations that must be processed. (see JLS, - * Section 7.4.1 "Named Packages"). - *

- * - *

- * Every package listed on the contextPath must meet one or both of the - * following conditions otherwise a {@code JAXBException} will be thrown: - *

- *
    - *
  1. it must contain ObjectFactory.class
  2. - *
  3. it must contain jaxb.index
  4. - *
- * - *

- * Format for jaxb.index - *

- * The file contains a newline-separated list of class names. - * Space and tab characters, as well as blank - * lines, are ignored. The comment character - * is '#' (0x23); on each line all characters following the first comment - * character are ignored. The file must be encoded in UTF-8. Classes that - * are reachable, as defined in {@link #newInstance(Class...)}, from the - * listed classes are also registered with JAXBContext. - *

- * Constraints on class name occuring in a {@code jaxb.index} file are: - *

    - *
  • Must not end with ".class".
  • - *
  • Class names are resolved relative to package containing - * {@code jaxb.index} file. Only classes occuring directly in package - * containing {@code jaxb.index} file are allowed.
  • - *
  • Fully qualified class names are not allowed. - * A qualified class name,relative to current package, - * is only allowed to specify a nested or inner class.
  • - *
- * - *

- * To maintain compatibility with JAXB 1.0 schema to java - * interface/implementation binding, enabled by schema customization - * {@code }, - * the JAXB provider will ensure that each package on the context path - * has a {@code jaxb.properties} file which contains a value for the - * {@code javax.xml.bind.context.factory} property and that all values - * resolve to the same provider. This requirement does not apply to - * JAXB annotated classes. - * - *

- * If there are any global XML element name collisions across the various - * packages listed on the {@code contextPath}, a {@code JAXBException} - * will be thrown. - * - *

- * Mixing generated interface/impl bindings from multiple JAXB Providers - * in the same context path may result in a {@code JAXBException} - * being thrown. - * - *

- * The steps involved in discovering the JAXB implementation is discussed in the class javadoc. - * - * @param contextPath - * List of java package names that contain schema - * derived class and/or java to schema (JAXB-annotated) - * mapped classes. - * Packages in {@code contextPath} that are in named modules must be - * {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module. - * @param classLoader - * This class loader will be used to locate the implementation - * classes. - * - * @return a new instance of a {@code JAXBContext} - * @throws JAXBException if an error was encountered while creating the - * {@code JAXBContext} such as - *

    - *
  1. failure to locate either ObjectFactory.class or jaxb.index in the packages
  2. - *
  3. an ambiguity among global elements contained in the contextPath
  4. - *
  5. failure to locate a value for the context factory provider property
  6. - *
  7. mixing schema derived packages from different providers on the same contextPath
  8. - *
  9. packages are not open to {@code java.xml.bind} module
  10. - *
- */ - public static JAXBContext newInstance( String contextPath, ClassLoader classLoader ) throws JAXBException { - - return newInstance(contextPath,classLoader,Collections.emptyMap()); - } - - /** - * Create a new instance of a {@code JAXBContext} class. - * - *

- * This is mostly the same as {@link JAXBContext#newInstance(String, ClassLoader)}, - * but this version allows you to pass in provider-specific properties to configure - * the instantiation of {@link JAXBContext}. - * - *

- * The interpretation of properties is up to implementations. Implementations must - * throw {@code JAXBException} if it finds properties that it doesn't understand. - * - * @param contextPath - * List of java package names that contain schema - * derived class and/or java to schema (JAXB-annotated) - * mapped classes. - * Packages in {@code contextPath} that are in named modules must be - * {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module. - * @param classLoader - * This class loader will be used to locate the implementation classes. - * @param properties - * provider-specific properties. Can be null, which means the same thing as passing - * in an empty map. - * - * @return a new instance of a {@code JAXBContext} - * @throws JAXBException if an error was encountered while creating the - * {@code JAXBContext} such as - *

    - *
  1. failure to locate either ObjectFactory.class or jaxb.index in the packages
  2. - *
  3. an ambiguity among global elements contained in the contextPath
  4. - *
  5. failure to locate a value for the context factory provider property
  6. - *
  7. mixing schema derived packages from different providers on the same contextPath
  8. - *
  9. packages are not open to {@code java.xml.bind} module
  10. - *
- * @since 1.6, JAXB 2.0 - */ - public static JAXBContext newInstance( String contextPath, - ClassLoader classLoader, - Map properties ) throws JAXBException { - - return ContextFinder.find( - /* The default property name according to the JAXB spec */ - JAXB_CONTEXT_FACTORY, - - /* the context path supplied by the client app */ - contextPath, - - /* class loader to be used */ - classLoader, - properties ); - } - -// TODO: resurrect this once we introduce external annotations -// /** -// * Create a new instance of a {@code JAXBContext} class. -// * -// *

-// * The client application must supply a list of classes that the new -// * context object needs to recognize. -// * -// * Not only the new context will recognize all the classes specified, -// * but it will also recognize any classes that are directly/indirectly -// * referenced statically from the specified classes. -// * -// * For example, in the following Java code, if you do -// * {@code newInstance(Foo.class)}, the newly created {@link JAXBContext} -// * will recognize both {@code Foo} and {@code Bar}, but not {@code Zot}: -// *

-//     * class Foo {
-//     *      Bar b;
-//     * }
-//     * class Bar { int x; }
-//     * class Zot extends Bar { int y; }
-//     * 
-// * -// * Therefore, a typical client application only needs to specify the -// * top-level classes, but it needs to be careful. -// * -// * TODO: if we are to define other mechanisms, refer to them. -// * -// * @param externalBindings -// * list of external binding files. Can be null or empty if none is used. -// * when specified, those files determine how the classes are bound. -// * -// * @param classesToBeBound -// * list of java classes to be recognized by the new {@link JAXBContext}. -// * Can be empty, in which case a {@link JAXBContext} that only knows about -// * spec-defined classes will be returned. -// * -// * @return -// * A new instance of a {@code JAXBContext}. -// * -// * @throws JAXBException -// * if an error was encountered while creating the -// * {@code JAXBContext}, such as (but not limited to): -// *
    -// *
  1. No JAXB implementation was discovered -// *
  2. Classes use JAXB annotations incorrectly -// *
  3. Classes have colliding annotations (i.e., two classes with the same type name) -// *
  4. Specified external bindings are incorrect -// *
  5. The JAXB implementation was unable to locate -// * provider-specific out-of-band information (such as additional -// * files generated at the development time.) -// *
-// * -// * @throws IllegalArgumentException -// * if the parameter contains {@code null} (i.e., {@code newInstance(null);}) -// * -// * @since JAXB 2.0 -// */ -// public static JAXBContext newInstance( Source[] externalBindings, Class... classesToBeBound ) -// throws JAXBException { -// -// // empty class list is not an error, because the context will still include -// // spec-specified classes like String and Integer. -// // if(classesToBeBound.length==0) -// // throw new IllegalArgumentException(); -// -// // but it is an error to have nulls in it. -// for( int i=classesToBeBound.length-1; i>=0; i-- ) -// if(classesToBeBound[i]==null) -// throw new IllegalArgumentException(); -// -// return ContextFinder.find(externalBindings,classesToBeBound); -// } - - /** - * Create a new instance of a {@code JAXBContext} class. - * - *

- * The client application must supply a list of classes that the new - * context object needs to recognize. - * - * Not only the new context will recognize all the classes specified, - * but it will also recognize any classes that are directly/indirectly - * referenced statically from the specified classes. Subclasses of - * referenced classes nor {@code @XmlTransient} referenced classes - * are not registered with JAXBContext. - * - * For example, in the following Java code, if you do - * {@code newInstance(Foo.class)}, the newly created {@link JAXBContext} - * will recognize both {@code Foo} and {@code Bar}, but not {@code Zot} or {@code FooBar}: - *

-     * class Foo {
-     *      @XmlTransient FooBar c;
-     *      Bar b;
-     * }
-     * class Bar { int x; }
-     * class Zot extends Bar { int y; }
-     * class FooBar { }
-     * 
- * - * Therefore, a typical client application only needs to specify the - * top-level classes, but it needs to be careful. - * - *

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

- * The steps involved in discovering the JAXB implementation is discussed in the class javadoc. - * - * @param classesToBeBound - * List of java classes to be recognized by the new {@link JAXBContext}. - * Classes in {@code classesToBeBound} that are in named modules must be in a package - * that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module. - * Can be empty, in which case a {@link JAXBContext} that only knows about - * spec-defined classes will be returned. - * - * @return - * A new instance of a {@code JAXBContext}. - * - * @throws JAXBException - * if an error was encountered while creating the - * {@code JAXBContext}, such as (but not limited to): - *

    - *
  1. No JAXB implementation was discovered - *
  2. Classes use JAXB annotations incorrectly - *
  3. Classes have colliding annotations (i.e., two classes with the same type name) - *
  4. The JAXB implementation was unable to locate - * provider-specific out-of-band information (such as additional - * files generated at the development time.) - *
  5. {@code classesToBeBound} are not open to {@code java.xml.bind} module - *
- * - * @throws IllegalArgumentException - * if the parameter contains {@code null} (i.e., {@code newInstance(null);}) - * - * @since 1.6, JAXB 2.0 - */ - public static JAXBContext newInstance( Class ... classesToBeBound ) - throws JAXBException { - - return newInstance(classesToBeBound,Collections.emptyMap()); - } - - /** - * Create a new instance of a {@code JAXBContext} class. - * - *

- * An overloading of {@link JAXBContext#newInstance(Class...)} - * to configure 'properties' for this instantiation of {@link JAXBContext}. - * - *

- * The interpretation of properties is up to implementations. Implementations must - * throw {@code JAXBException} if it finds properties that it doesn't understand. - * - * @param classesToBeBound - * List of java classes to be recognized by the new {@link JAXBContext}. - * Classes in {@code classesToBeBound} that are in named modules must be in a package - * that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module. - * Can be empty, in which case a {@link JAXBContext} that only knows about - * spec-defined classes will be returned. - * @param properties - * provider-specific properties. Can be null, which means the same thing as passing - * in an empty map. - * - * @return - * A new instance of a {@code JAXBContext}. - * - * @throws JAXBException - * if an error was encountered while creating the - * {@code JAXBContext}, such as (but not limited to): - *

    - *
  1. No JAXB implementation was discovered - *
  2. Classes use JAXB annotations incorrectly - *
  3. Classes have colliding annotations (i.e., two classes with the same type name) - *
  4. The JAXB implementation was unable to locate - * provider-specific out-of-band information (such as additional - * files generated at the development time.) - *
  5. {@code classesToBeBound} are not open to {@code java.xml.bind} module - *
- * - * @throws IllegalArgumentException - * if the parameter contains {@code null} (i.e., {@code newInstance(null,someMap);}) - * - * @since 1.6, JAXB 2.0 - */ - public static JAXBContext newInstance( Class[] classesToBeBound, Map properties ) - throws JAXBException { - - if (classesToBeBound == null) { - throw new IllegalArgumentException(); - } - - // but it is an error to have nulls in it. - for (int i = classesToBeBound.length - 1; i >= 0; i--) { - if (classesToBeBound[i] == null) { - throw new IllegalArgumentException(); - } - } - - return ContextFinder.find(classesToBeBound,properties); - } - - /** - * Create an {@code Unmarshaller} object that can be used to convert XML - * data into a java content tree. - * - * @return an {@code Unmarshaller} object - * - * @throws JAXBException if an error was encountered while creating the - * {@code Unmarshaller} object - */ - public abstract Unmarshaller createUnmarshaller() throws JAXBException; - - - /** - * Create a {@code Marshaller} object that can be used to convert a - * java content tree into XML data. - * - * @return a {@code Marshaller} object - * - * @throws JAXBException if an error was encountered while creating the - * {@code Marshaller} object - */ - public abstract Marshaller createMarshaller() throws JAXBException; - - - /** - * {@link Validator} has been made optional and deprecated in JAXB 2.0. Please - * refer to the javadoc for {@link Validator} for more detail. - *

- * Create a {@code Validator} object that can be used to validate a - * java content tree against its source schema. - * - * @return a {@code Validator} object - * - * @throws JAXBException if an error was encountered while creating the - * {@code Validator} object - * @deprecated since JAXB2.0 - */ - @Deprecated - public abstract Validator createValidator() throws JAXBException; - - /** - * Creates a {@code Binder} object that can be used for - * associative/in-place unmarshalling/marshalling. - * - * @param domType select the DOM API to use by passing in its DOM Node class. - * - * @return always a new valid {@code Binder} object. - * - * @throws UnsupportedOperationException - * if DOM API corresponding to {@code domType} is not supported by - * the implementation. - * - * @since 1.6, JAXB 2.0 - */ - public Binder createBinder(Class domType) { - // to make JAXB 1.0 implementations work, this method must not be - // abstract - throw new UnsupportedOperationException(); - } - - /** - * Creates a {@code Binder} for W3C DOM. - * - * @return always a new valid {@code Binder} object. - * - * @since 1.6, JAXB 2.0 - */ - public Binder createBinder() { - return createBinder(Node.class); - } - - /** - * Creates a {@code JAXBIntrospector} object that can be used to - * introspect JAXB objects. - * - * @return - * always return a non-null valid {@code JAXBIntrospector} object. - * - * @throws UnsupportedOperationException - * Calling this method on JAXB 1.0 implementations will throw - * an UnsupportedOperationException. - * - * @since 1.6, JAXB 2.0 - */ - public JAXBIntrospector createJAXBIntrospector() { - // to make JAXB 1.0 implementations work, this method must not be - // abstract - throw new UnsupportedOperationException(); - } - - /** - * Generates the schema documents for this context. - * - * @param outputResolver - * this object controls the output to which schemas - * will be sent. - * - * @throws IOException - * if {@link SchemaOutputResolver} throws an {@link IOException}. - * - * @throws UnsupportedOperationException - * Calling this method on JAXB 1.0 implementations will throw - * an UnsupportedOperationException. - * - * @since 1.6, JAXB 2.0 - */ - public void generateSchema(SchemaOutputResolver outputResolver) throws IOException { - // to make JAXB 1.0 implementations work, this method must not be - // abstract - throw new UnsupportedOperationException(); - } - - private static ClassLoader getContextClassLoader() { - if (System.getSecurityManager() == null) { - return Thread.currentThread().getContextClassLoader(); - } else { - return java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public ClassLoader run() { - return Thread.currentThread().getContextClassLoader(); - } - }); - } - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/JAXBContextFactory.java 2018-01-30 20:39:20.000000000 -0500 +++ /dev/null 2018-01-30 20:39:20.000000000 -0500 @@ -1,118 +0,0 @@ -/* - * Copyright (c) 2015, 2017, 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 javax.xml.bind; - -import java.util.Map; - -/** - *

Factory that creates new JAXBContext instances. - * - * JAXBContextFactory can be located using {@link java.util.ServiceLoader#load(Class)} - * - * @since 9, JAXB 2.3 - */ -public interface JAXBContextFactory { - - /** - *

- * Create a new instance of a {@code JAXBContext} class. - * - *

- * For semantics see {@link javax.xml.bind.JAXBContext#newInstance(Class[], java.util.Map)} - * - * @param classesToBeBound - * List of java classes to be recognized by the new {@link JAXBContext}. - * Classes in {@code classesToBeBound} that are in named modules must be in a package - * that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module. - * Can be empty, in which case a {@link JAXBContext} that only knows about - * spec-defined classes will be returned. - * @param properties - * provider-specific properties. Can be null, which means the same thing as passing - * in an empty map. - * - * @return - * A new instance of a {@code JAXBContext}. - * - * @throws JAXBException - * if an error was encountered while creating the - * {@code JAXBContext}, such as (but not limited to): - *

    - *
  1. No JAXB implementation was discovered - *
  2. Classes use JAXB annotations incorrectly - *
  3. Classes have colliding annotations (i.e., two classes with the same type name) - *
  4. The JAXB implementation was unable to locate - * provider-specific out-of-band information (such as additional - * files generated at the development time.) - *
  5. {@code classesToBeBound} are not open to {@code java.xml.bind} module - *
- * - * @throws IllegalArgumentException - * if the parameter contains {@code null} (i.e., {@code newInstance(null,someMap);}) - * - * @since 9, JAXB 2.3 - */ - JAXBContext createContext(Class[] classesToBeBound, - Map properties ) throws JAXBException; - - /** - *

- * Create a new instance of a {@code JAXBContext} class. - * - *

- * For semantics see {@link javax.xml.bind.JAXBContext#newInstance(String, ClassLoader, java.util.Map)} - * - *

- * The interpretation of properties is up to implementations. Implementations must - * throw {@code JAXBException} if it finds properties that it doesn't understand. - * - * @param contextPath - * List of java package names that contain schema derived classes. - * Classes in {@code classesToBeBound} that are in named modules must be in a package - * that is {@linkplain java.lang.Module#isOpen open} to at least the {@code java.xml.bind} module. - * @param classLoader - * This class loader will be used to locate the implementation classes. - * @param properties - * provider-specific properties. Can be null, which means the same thing as passing - * in an empty map. - * - * @return a new instance of a {@code JAXBContext} - * @throws JAXBException if an error was encountered while creating the - * {@code JAXBContext} such as - *

    - *
  1. failure to locate either ObjectFactory.class or jaxb.index in the packages
  2. - *
  3. an ambiguity among global elements contained in the contextPath
  4. - *
  5. failure to locate a value for the context factory provider property
  6. - *
  7. mixing schema derived packages from different providers on the same contextPath
  8. - *
  9. packages are not open to {@code java.xml.bind} module
  10. - *
- * - * @since 9, JAXB 2.3 - */ - JAXBContext createContext(String contextPath, - ClassLoader classLoader, - Map properties ) throws JAXBException; - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/JAXBElement.java 2018-01-30 20:39:21.000000000 -0500 +++ /dev/null 2018-01-30 20:39:21.000000000 -0500 @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind; - -import javax.xml.namespace.QName; -import java.io.Serializable; - -/** - *

JAXB representation of an Xml Element.

- * - *

This class represents information about an Xml Element from both the element - * declaration within a schema and the element instance value within an xml document - * with the following properties - *

    - *
  • element's xml tag {@code name}
  • - *
  • {@code value} represents the element instance's atttribute(s) and content model
  • - *
  • element declaration's {@code declaredType} ({@code xs:element @type} attribute)
  • - *
  • {@code scope} of element declaration
  • - *
  • boolean {@code nil} property. (element instance's {@code xsi:nil} attribute)
  • - *
- * - *

The {@code declaredType} and {@code scope} property are the - * JAXB class binding for the xml type definition. - *

- * - *

{@code Scope} is either {@link GlobalScope} or the Java class representing the - * complex type definition containing the schema element declaration. - *

- * - *

There is a property constraint that if {@code value} is {@code null}, - * then {@code nil} must be {@code true}. The converse is not true to enable - * representing a nil element with attribute(s). If {@code nil} is true, it is possible - * that {@code value} is non-null so it can hold the value of the attributes - * associated with a nil element. - *

- * - * @author Kohsuke Kawaguchi, Joe Fialli - * @since 1.6, JAXB 2.0 - */ - -public class JAXBElement implements Serializable { - - /** xml element tag name */ - final protected QName name; - - /** Java datatype binding for xml element declaration's type. */ - final protected Class declaredType; - - /** Scope of xml element declaration representing this xml element instance. - * Can be one of the following values: - * - {@link GlobalScope} for global xml element declaration. - * - local element declaration has a scope set to the Java class - * representation of complex type defintion containing - * xml element declaration. - */ - final protected Class scope; - - /** xml element value. - Represents content model and attributes of an xml element instance. */ - protected T value; - - /** true iff the xml element instance has xsi:nil="true". */ - protected boolean nil = false; - - /** - * Designates global scope for an xml element. - */ - public static final class GlobalScope {} - - /** - *

Construct an xml element instance.

- * - * @param name Java binding of xml element tag name - * @param declaredType Java binding of xml element declaration's type - * @param scope - * Java binding of scope of xml element declaration. - * Passing null is the same as passing {@code GlobalScope.class} - * @param value - * Java instance representing xml element's value. - * @see #getScope() - * @see #isTypeSubstituted() - */ - public JAXBElement(QName name, - Class declaredType, - Class scope, - T value) { - if(declaredType==null || name==null) - throw new IllegalArgumentException(); - this.declaredType = declaredType; - if(scope==null) scope = GlobalScope.class; - this.scope = scope; - this.name = name; - setValue(value); - } - - /** - * Construct an xml element instance. - * - * This is just a convenience method for {@code new JAXBElement(name,declaredType,GlobalScope.class,value)} - */ - public JAXBElement(QName name, Class declaredType, T value ) { - this(name,declaredType,GlobalScope.class,value); - } - - /** - * Returns the Java binding of the xml element declaration's type attribute. - */ - public Class getDeclaredType() { - return declaredType; - } - - /** - * Returns the xml element tag name. - */ - public QName getName() { - return name; - } - - /** - *

Set the content model and attributes of this xml element.

- * - *

When this property is set to {@code null}, {@code isNil()} must by {@code true}. - * Details of constraint are described at {@link #isNil()}.

- * - * @see #isTypeSubstituted() - */ - public void setValue(T t) { - this.value = t; - } - - /** - *

Return the content model and attribute values for this element.

- * - *

See {@link #isNil()} for a description of a property constraint when - * this value is {@code null}

- */ - public T getValue() { - return value; - } - - /** - * Returns scope of xml element declaration. - * - * @see #isGlobalScope() - * @return {@code GlobalScope.class} if this element is of global scope. - */ - public Class getScope() { - return scope; - } - - /** - *

Returns {@code true} iff this element instance content model - * is nil.

- * - *

This property always returns {@code true} when {@link #getValue()} is null. - * Note that the converse is not true, when this property is {@code true}, - * {@link #getValue()} can contain a non-null value for attribute(s). It is - * valid for a nil xml element to have attribute(s).

- */ - public boolean isNil() { - return (value == null) || nil; - } - - /** - *

Set whether this element has nil content.

- * - * @see #isNil() - */ - public void setNil(boolean value) { - this.nil = value; - } - - /* Convenience methods - * (Not necessary but they do unambiguously conceptualize - * the rationale behind this class' fields.) - */ - - /** - * Returns true iff this xml element declaration is global. - */ - public boolean isGlobalScope() { - return this.scope == GlobalScope.class; - } - - /** - * Returns true iff this xml element instance's value has a different - * type than xml element declaration's declared type. - */ - public boolean isTypeSubstituted() { - if(value==null) return false; - return value.getClass() != declaredType; - } - - private static final long serialVersionUID = 1L; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/JAXBException.java 2018-01-30 20:39:22.000000000 -0500 +++ /dev/null 2018-01-30 20:39:22.000000000 -0500 @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2003, 2015, 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 javax.xml.bind; - -import java.io.PrintWriter; - -/** - * This is the root exception class for all JAXB exceptions. - * - * @author
  • Ryan Shoemaker, Sun Microsystems, Inc.
- * @see JAXBContext - * @see Marshaller - * @see Unmarshaller - * @since 1.6, JAXB 1.0 - */ -public class JAXBException extends Exception { - - /** - * Vendor specific error code - * - */ - private String errorCode; - - /** - * Exception reference - * - */ - private volatile Throwable linkedException; - - static final long serialVersionUID = -5621384651494307979L; - - /** - * Construct a JAXBException with the specified detail message. The - * errorCode and linkedException will default to null. - * - * @param message a description of the exception - */ - public JAXBException(String message) { - this( message, null, null ); - } - - /** - * Construct a JAXBException with the specified detail message and vendor - * specific errorCode. The linkedException will default to null. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - */ - public JAXBException(String message, String errorCode) { - this( message, errorCode, null ); - } - - /** - * Construct a JAXBException with a linkedException. The detail message and - * vendor specific errorCode will default to null. - * - * @param exception the linked exception - */ - public JAXBException(Throwable exception) { - this( null, null, exception ); - } - - /** - * Construct a JAXBException with the specified detail message and - * linkedException. The errorCode will default to null. - * - * @param message a description of the exception - * @param exception the linked exception - */ - public JAXBException(String message, Throwable exception) { - this( message, null, exception ); - } - - /** - * Construct a JAXBException with the specified detail message, vendor - * specific errorCode, and linkedException. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - * @param exception the linked exception - */ - public JAXBException(String message, String errorCode, Throwable exception) { - super( message ); - this.errorCode = errorCode; - this.linkedException = exception; - } - - /** - * Get the vendor specific error code - * - * @return a string specifying the vendor specific error code - */ - public String getErrorCode() { - return this.errorCode; - } - - /** - * Get the linked exception - * - * @return the linked Exception, null if none exists - */ - public Throwable getLinkedException() { - return linkedException; - } - - /** - * Add a linked Exception. - * - * @param exception the linked Exception (A null value is permitted and - * indicates that the linked exception does not exist or - * is unknown). - */ - public void setLinkedException( Throwable exception ) { - this.linkedException = exception; - } - - /** - * Returns a short description of this JAXBException. - * - */ - public String toString() { - return linkedException == null ? - super.toString() : - super.toString() + "\n - with linked exception:\n[" + - linkedException.toString()+ "]"; - } - - /** - * Prints this JAXBException and its stack trace (including the stack trace - * of the linkedException if it is non-null) to the PrintStream. - * - * @param s PrintStream to use for output - */ - public void printStackTrace( java.io.PrintStream s ) { - super.printStackTrace(s); - } - - /** - * Prints this JAXBException and its stack trace (including the stack trace - * of the linkedException if it is non-null) to {@code System.err}. - * - */ - public void printStackTrace() { - super.printStackTrace(); - } - - /** - * Prints this JAXBException and its stack trace (including the stack trace - * of the linkedException if it is non-null) to the PrintWriter. - * - * @param s PrintWriter to use for output - */ - public void printStackTrace(PrintWriter s) { - super.printStackTrace(s); - } - - @Override - public Throwable getCause() { - return linkedException; - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/JAXBIntrospector.java 2018-01-30 20:39:22.000000000 -0500 +++ /dev/null 2018-01-30 20:39:22.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind; -import javax.xml.namespace.QName; - -/** - * Provide access to JAXB xml binding data for a JAXB object. - * - *

- * Intially, the intent of this class is to just conceptualize how - * a JAXB application developer can access xml binding information, - * independent if binding model is java to schema or schema to java. - * Since accessing the XML element name related to a JAXB element is - * a highly requested feature, demonstrate access to this - * binding information. - * - * The factory method to get a JAXBIntrospector instance is - * {@link JAXBContext#createJAXBIntrospector()}. - * - * @see JAXBContext#createJAXBIntrospector() - * @since 1.6, JAXB 2.0 - */ -public abstract class JAXBIntrospector { - - /** - *

Return true if object represents a JAXB element.

- *

Parameter object is a JAXB element for following cases: - *

    - *
  1. It is an instance of javax.xml.bind.JAXBElement.
  2. - *
  3. The class of object is annotated with - * @XmlRootElement. - *
  4. - *
- * - * @see #getElementName(Object) - */ - public abstract boolean isElement(Object object); - - /** - *

Get xml element qname for jaxbElement.

- * - * @param jaxbElement is an object that {@link #isElement(Object)} returned true. - * - * @return xml element qname associated with jaxbElement; - * null if jaxbElement is not a JAXB Element. - */ - public abstract QName getElementName(Object jaxbElement); - - /** - *

Get the element value of a JAXB element.

- * - *

Convenience method to abstract whether working with either - * a javax.xml.bind.JAXBElement instance or an instance of - * {@code @XmlRootElement} annotated Java class.

- * - * @param jaxbElement object that #isElement(Object) returns true. - * - * @return The element value of the jaxbElement. - */ - public static Object getValue(Object jaxbElement) { - if (jaxbElement instanceof JAXBElement) { - return ((JAXBElement)jaxbElement).getValue(); - } else { - // assume that class of this instance is - // annotated with @XmlRootElement. - return jaxbElement; - } - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/JAXBPermission.java 2018-01-30 20:39:23.000000000 -0500 +++ /dev/null 2018-01-30 20:39:23.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2007, 2017, 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 javax.xml.bind; - -import java.security.BasicPermission; - -/** - * This class is for JAXB permissions. A {@code JAXBPermission} - * contains a name (also referred to as a "target name") but - * no actions list; you either have the named permission - * or you don't. - * - *

- * The target name is the name of the JAXB permission (see below). - * - *

- * The following table lists all the possible {@code JAXBPermission} target names, - * and for each provides a description of what the permission allows - * and a discussion of the risks of granting code the permission. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Permission target name, what the permission allows, and associated risks"
Permission Target NameWhat the Permission AllowsRisks of Allowing this Permission
setDatatypeConverter - * Allows the code to set VM-wide {@link DatatypeConverterInterface} - * via {@link DatatypeConverter#setDatatypeConverter(DatatypeConverterInterface) the setDatatypeConverter method} - * that all the methods on {@link DatatypeConverter} uses. - * - * Malicious code can set {@link DatatypeConverterInterface}, which has - * VM-wide singleton semantics, before a genuine JAXB implementation sets one. - * This allows malicious code to gain access to objects that it may otherwise - * not have access to, such as {@link java.awt.Frame#getFrames()} that belongs to - * another application running in the same JVM. - *
- * - * @see java.security.BasicPermission - * @see java.security.Permission - * @see java.security.Permissions - * @see java.security.PermissionCollection - * @see java.lang.SecurityManager - * - * @author Joe Fialli - * @since 1.7, JAXB 2.2 - */ - -/* code was borrowed originally from java.lang.RuntimePermission. */ -public final class JAXBPermission extends BasicPermission { - /** - * Creates a new JAXBPermission with the specified name. - * - * @param name - * The name of the JAXBPermission. As of 2.2 only "setDatatypeConverter" - * is defined. - */ - public JAXBPermission(String name) { - super(name); - } - - private static final long serialVersionUID = 1L; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/MarshalException.java 2018-01-30 20:39:24.000000000 -0500 +++ /dev/null 2018-01-30 20:39:24.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -/** - * This exception indicates that an error has occurred while performing - * a marshal operation that the provider is unable to recover from. - * - *

- * The {@code ValidationEventHandler} can cause this exception to be thrown - * during the marshal operations. See - * {@link ValidationEventHandler#handleEvent(ValidationEvent) - * ValidationEventHandler.handleEvent(ValidationEvent)}. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
- * @see JAXBException - * @see Marshaller - * @since 1.6, JAXB 1.0 - */ -public class MarshalException extends JAXBException { - - /** - * Construct a MarshalException with the specified detail message. The - * errorCode and linkedException will default to null. - * - * @param message a description of the exception - */ - public MarshalException( String message ) { - this( message, null, null ); - } - - /** - * Construct a MarshalException with the specified detail message and vendor - * specific errorCode. The linkedException will default to null. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - */ - public MarshalException( String message, String errorCode ) { - this( message, errorCode, null ); - } - - /** - * Construct a MarshalException with a linkedException. The detail message and - * vendor specific errorCode will default to null. - * - * @param exception the linked exception - */ - public MarshalException( Throwable exception ) { - this( null, null, exception ); - } - - /** - * Construct a MarshalException with the specified detail message and - * linkedException. The errorCode will default to null. - * - * @param message a description of the exception - * @param exception the linked exception - */ - public MarshalException( String message, Throwable exception ) { - this( message, null, exception ); - } - - /** - * Construct a MarshalException with the specified detail message, vendor - * specific errorCode, and linkedException. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - * @param exception the linked exception - */ - public MarshalException( String message, String errorCode, Throwable exception ) { - super( message, errorCode, exception ); - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/Marshaller.java 2018-01-30 20:39:24.000000000 -0500 +++ /dev/null 2018-01-30 20:39:25.000000000 -0500 @@ -1,822 +0,0 @@ -/* - * Copyright (c) 2003, 2017, 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 javax.xml.bind; - -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.attachment.AttachmentMarshaller; -import javax.xml.validation.Schema; -import java.io.File; - -/** - *

- * The {@code Marshaller} class is responsible for governing the process - * of serializing Java content trees back into XML data. It provides the basic - * marshalling methods: - * - *

- * Assume the following setup code for all following code fragments: - *

- *
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *       Object element = u.unmarshal( new File( "foo.xml" ) );
- *       Marshaller m = jc.createMarshaller();
- *    
- *
- * - *

- * Marshalling to a File: - *

- *
- *       OutputStream os = new FileOutputStream( "nosferatu.xml" );
- *       m.marshal( element, os );
- *    
- *
- * - *

- * Marshalling to a SAX ContentHandler: - *

- *
- *       // assume MyContentHandler instanceof ContentHandler
- *       m.marshal( element, new MyContentHandler() );
- *    
- *
- * - *

- * Marshalling to a DOM Node: - *

- *
- *       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- *       dbf.setNamespaceAware(true);
- *       DocumentBuilder db = dbf.newDocumentBuilder();
- *       Document doc = db.newDocument();
- *
- *       m.marshal( element, doc );
- *    
- *
- * - *

- * Marshalling to a java.io.OutputStream: - *

- *
- *       m.marshal( element, System.out );
- *    
- *
- * - *

- * Marshalling to a java.io.Writer: - *

- *
- *       m.marshal( element, new PrintWriter( System.out ) );
- *    
- *
- * - *

- * Marshalling to a javax.xml.transform.SAXResult: - *

- *
- *       // assume MyContentHandler instanceof ContentHandler
- *       SAXResult result = new SAXResult( new MyContentHandler() );
- *
- *       m.marshal( element, result );
- *    
- *
- * - *

- * Marshalling to a javax.xml.transform.DOMResult: - *

- *
- *       DOMResult result = new DOMResult();
- *
- *       m.marshal( element, result );
- *    
- *
- * - *

- * Marshalling to a javax.xml.transform.StreamResult: - *

- *
- *       StreamResult result = new StreamResult( System.out );
- *
- *       m.marshal( element, result );
- *    
- *
- * - *

- * Marshalling to a javax.xml.stream.XMLStreamWriter: - *

- *
- *       XMLStreamWriter xmlStreamWriter =
- *           XMLOutputFactory.newInstance().createXMLStreamWriter( ... );
- *
- *       m.marshal( element, xmlStreamWriter );
- *    
- *
- * - *

- * Marshalling to a javax.xml.stream.XMLEventWriter: - *

- *
- *       XMLEventWriter xmlEventWriter =
- *           XMLOutputFactory.newInstance().createXMLEventWriter( ... );
- *
- *       m.marshal( element, xmlEventWriter );
- *    
- *
- * - *

- * - * Marshalling content tree rooted by a JAXB element
- *

- * The first parameter of the overloaded - * {@code Marshaller.marshal(java.lang.Object, ...)} methods must be a - * JAXB element as computed by - * {@link JAXBIntrospector#isElement(java.lang.Object)}; - * otherwise, a {@code Marshaller.marshal} method must throw a - * {@link MarshalException}. There exist two mechanisms - * to enable marshalling an instance that is not a JAXB element. - * One method is to wrap the instance as a value of a {@link JAXBElement}, - * and pass the wrapper element as the first parameter to - * a {@code Marshaller.marshal} method. For java to schema binding, it - * is also possible to simply annotate the instance's class with - * @{@link XmlRootElement}. - *
- * - *

- * Encoding
- *

- * By default, the Marshaller will use UTF-8 encoding when generating XML data - * to a {@code java.io.OutputStream}, or a {@code java.io.Writer}. Use the - * {@link #setProperty(String,Object) setProperty} API to change the output - * encoding used during these marshal operations. Client applications are - * expected to supply a valid character encoding name as defined in the - * W3C XML 1.0 - * Recommendation and supported by your Java Platform. - *
- * - *

- * Validation and Well-Formedness
- *

- *

- * Client applications are not required to validate the Java content tree prior - * to calling any of the marshal API's. Furthermore, there is no requirement - * that the Java content tree be valid with respect to its original schema in - * order to marshal it back into XML data. Different JAXB Providers will - * support marshalling invalid Java content trees at varying levels, however - * all JAXB Providers must be able to marshal a valid content tree back to - * XML data. A JAXB Provider must throw a {@code MarshalException} when it - * is unable to complete the marshal operation due to invalid content. Some - * JAXB Providers will fully allow marshalling invalid content, others will fail - * on the first validation error. - *

- * Even when schema validation is not explictly enabled for the marshal operation, - * it is possible that certain types of validation events will be detected - * during the operation. Validation events will be reported to the registered - * event handler. If the client application has not registered an event handler - * prior to invoking one of the marshal API's, then events will be delivered to - * a default event handler which will terminate the marshal operation after - * encountering the first error or fatal error. Note that for JAXB 2.0 and - * later versions, {@link javax.xml.bind.helpers.DefaultValidationEventHandler} is - * no longer used. - * - *

- * - *

- * - * Supported Properties
- *

- *

- * All JAXB Providers are required to support the following set of properties. - * Some providers may support additional properties. - *

- *
{@code jaxb.encoding} - value must be a java.lang.String
- *
The output encoding to use when marshalling the XML data. The - * Marshaller will use "UTF-8" by default if this property is not - * specified.
- *
{@code jaxb.formatted.output} - value must be a java.lang.Boolean
- *
This property controls whether or not the Marshaller will format - * the resulting XML data with line breaks and indentation. A - * true value for this property indicates human readable indented - * xml data, while a false value indicates unformatted xml data. - * The Marshaller will default to false (unformatted) if this - * property is not specified.
- *
{@code jaxb.schemaLocation} - value must be a java.lang.String
- *
This property allows the client application to specify an - * xsi:schemaLocation attribute in the generated XML data. The format of - * the schemaLocation attribute value is discussed in an easy to - * understand, non-normative form in - * Section 5.6 - * of the W3C XML Schema Part 0: Primer and specified in - * - * Section 2.6 of the W3C XML Schema Part 1: Structures.
- *
{@code jaxb.noNamespaceSchemaLocation} - value must be a java.lang.String
- *
This property allows the client application to specify an - * xsi:noNamespaceSchemaLocation attribute in the generated XML - * data. The format of the schemaLocation attribute value is discussed in - * an easy to understand, non-normative form in - * Section 5.6 - * of the W3C XML Schema Part 0: Primer and specified in - * - * Section 2.6 of the W3C XML Schema Part 1: Structures.
- *
{@code jaxb.fragment} - value must be a java.lang.Boolean
- *
This property determines whether or not document level events will be - * generated by the Marshaller. If the property is not specified, the - * default is {@code false}. This property has different implications depending - * on which marshal api you are using - when this property is set to true:
- *
    - *
  • {@link #marshal(Object,org.xml.sax.ContentHandler) marshal(Object,ContentHandler)} - the Marshaller won't - * invoke {@link org.xml.sax.ContentHandler#startDocument()} and - * {@link org.xml.sax.ContentHandler#endDocument()}.
  • - *
  • {@link #marshal(Object,org.w3c.dom.Node) marshal(Object,Node)} - the property has no effect on this - * API.
  • - *
  • {@link #marshal(Object,java.io.OutputStream) marshal(Object,OutputStream)} - the Marshaller won't - * generate an xml declaration.
  • - *
  • {@link #marshal(Object,java.io.Writer) marshal(Object,Writer)} - the Marshaller won't - * generate an xml declaration.
  • - *
  • {@link #marshal(Object,javax.xml.transform.Result) marshal(Object,Result)} - depends on the kind of - * Result object, see semantics for Node, ContentHandler, and Stream APIs
  • - *
  • {@link #marshal(Object,javax.xml.stream.XMLEventWriter) marshal(Object,XMLEventWriter)} - the - * Marshaller will not generate {@link javax.xml.stream.events.XMLEvent#START_DOCUMENT} and - * {@link javax.xml.stream.events.XMLEvent#END_DOCUMENT} events.
  • - *
  • {@link #marshal(Object,javax.xml.stream.XMLStreamWriter) marshal(Object,XMLStreamWriter)} - the - * Marshaller will not generate {@link javax.xml.stream.events.XMLEvent#START_DOCUMENT} and - * {@link javax.xml.stream.events.XMLEvent#END_DOCUMENT} events.
  • - *
- *
- *
- *
- * - *

- * - * Marshal Event Callbacks
- *

- * "The {@link Marshaller} provides two styles of callback mechanisms - * that allow application specific processing during key points in the - * unmarshalling process. In 'class defined' event callbacks, application - * specific code placed in JAXB mapped classes is triggered during - * marshalling. 'External listeners' allow for centralized processing - * of marshal events in one callback method rather than by type event callbacks. - * - *

- * Class defined event callback methods allow any JAXB mapped class to specify - * its own specific callback methods by defining methods with the following method signatures: - *

- *
- *   // Invoked by Marshaller after it has created an instance of this object.
- *   boolean beforeMarshal(Marshaller);
- *
- *   // Invoked by Marshaller after it has marshalled all properties of this object.
- *   void afterMarshal(Marshaller);
- * 
- *
- * The class defined event callback methods should be used when the callback method requires - * access to non-public methods and/or fields of the class. - *

- * The external listener callback mechanism enables the registration of a {@link Listener} - * instance with a {@link Marshaller#setListener(Listener)}. The external listener receives all callback events, - * allowing for more centralized processing than per class defined callback methods. - *

- * The 'class defined' and external listener event callback methods are independent of each other, - * both can be called for one event. The invocation ordering when both listener callback methods exist is - * defined in {@link Listener#beforeMarshal(Object)} and {@link Listener#afterMarshal(Object)}. - *

- * An event callback method throwing an exception terminates the current marshal process. - *

- * - * @author
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see JAXBContext - * @see Validator - * @see Unmarshaller - * @since 1.6, JAXB 1.0 - */ -public interface Marshaller { - - /** - * The name of the property used to specify the output encoding in - * the marshalled XML data. - */ - public static final String JAXB_ENCODING = - "jaxb.encoding"; - - /** - * The name of the property used to specify whether or not the marshalled - * XML data is formatted with linefeeds and indentation. - */ - public static final String JAXB_FORMATTED_OUTPUT = - "jaxb.formatted.output"; - - /** - * The name of the property used to specify the xsi:schemaLocation - * attribute value to place in the marshalled XML output. - */ - public static final String JAXB_SCHEMA_LOCATION = - "jaxb.schemaLocation"; - - /** - * The name of the property used to specify the - * xsi:noNamespaceSchemaLocation attribute value to place in the marshalled - * XML output. - */ - public static final String JAXB_NO_NAMESPACE_SCHEMA_LOCATION = - "jaxb.noNamespaceSchemaLocation"; - - /** - * The name of the property used to specify whether or not the marshaller - * will generate document level events (ie calling startDocument or endDocument). - */ - public static final String JAXB_FRAGMENT = - "jaxb.fragment"; - - /** - * Marshal the content tree rooted at {@code jaxbElement} into the specified - * {@code javax.xml.transform.Result}. - * - *

- * All JAXB Providers must at least support - * {@link javax.xml.transform.dom.DOMResult}, - * {@link javax.xml.transform.sax.SAXResult}, and - * {@link javax.xml.transform.stream.StreamResult}. It can - * support other derived classes of {@code Result} as well. - * - * @param jaxbElement - * The root of content tree to be marshalled. - * @param result - * XML will be sent to this Result - * - * @throws JAXBException - * If any unexpected problem occurs during the marshalling. - * @throws MarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See - * Marshalling a JAXB element. - * @throws IllegalArgumentException - * If any of the method parameters are null - */ - public void marshal( Object jaxbElement, javax.xml.transform.Result result ) - throws JAXBException; - - /** - * Marshal the content tree rooted at {@code jaxbElement} into an output stream. - * - * @param jaxbElement - * The root of content tree to be marshalled. - * @param os - * XML will be added to this stream. - * - * @throws JAXBException - * If any unexpected problem occurs during the marshalling. - * @throws MarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See - * Marshalling a JAXB element. - * @throws IllegalArgumentException - * If any of the method parameters are null - */ - public void marshal( Object jaxbElement, java.io.OutputStream os ) - throws JAXBException; - - /** - * Marshal the content tree rooted at {@code jaxbElement} into a file. - * - * @param jaxbElement - * The root of content tree to be marshalled. - * @param output - * File to be written. If this file already exists, it will be overwritten. - * - * @throws JAXBException - * If any unexpected problem occurs during the marshalling. - * @throws MarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See - * Marshalling a JAXB element. - * @throws IllegalArgumentException - * If any of the method parameters are null - * @since 1.6, JAXB 2.1 - */ - public void marshal( Object jaxbElement, File output ) - throws JAXBException; - - /** - * Marshal the content tree rooted at {@code jaxbElement} into a Writer. - * - * @param jaxbElement - * The root of content tree to be marshalled. - * @param writer - * XML will be sent to this writer. - * - * @throws JAXBException - * If any unexpected problem occurs during the marshalling. - * @throws MarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See - * Marshalling a JAXB element. - * @throws IllegalArgumentException - * If any of the method parameters are null - */ - public void marshal( Object jaxbElement, java.io.Writer writer ) - throws JAXBException; - - /** - * Marshal the content tree rooted at {@code jaxbElement} into SAX2 events. - * - * @param jaxbElement - * The root of content tree to be marshalled. - * @param handler - * XML will be sent to this handler as SAX2 events. - * - * @throws JAXBException - * If any unexpected problem occurs during the marshalling. - * @throws MarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See - * Marshalling a JAXB element. - * @throws IllegalArgumentException - * If any of the method parameters are null - */ - public void marshal( Object jaxbElement, org.xml.sax.ContentHandler handler ) - throws JAXBException; - - /** - * Marshal the content tree rooted at {@code jaxbElement} into a DOM tree. - * - * @param jaxbElement - * The content tree to be marshalled. - * @param node - * DOM nodes will be added as children of this node. - * This parameter must be a Node that accepts children - * ({@link org.w3c.dom.Document}, - * {@link org.w3c.dom.DocumentFragment}, or - * {@link org.w3c.dom.Element}) - * - * @throws JAXBException - * If any unexpected problem occurs during the marshalling. - * @throws MarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See - * Marshalling a JAXB element. - * @throws IllegalArgumentException - * If any of the method parameters are null - */ - public void marshal( Object jaxbElement, org.w3c.dom.Node node ) - throws JAXBException; - - /** - * Marshal the content tree rooted at {@code jaxbElement} into a - * {@link javax.xml.stream.XMLStreamWriter}. - * - * @param jaxbElement - * The content tree to be marshalled. - * @param writer - * XML will be sent to this writer. - * - * @throws JAXBException - * If any unexpected problem occurs during the marshalling. - * @throws MarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See - * Marshalling a JAXB element. - * @throws IllegalArgumentException - * If any of the method parameters are null - * @since 1.6, JAXB 2.0 - */ - public void marshal( Object jaxbElement, javax.xml.stream.XMLStreamWriter writer ) - throws JAXBException; - - /** - * Marshal the content tree rooted at {@code jaxbElement} into a - * {@link javax.xml.stream.XMLEventWriter}. - * - * @param jaxbElement - * The content tree rooted at jaxbElement to be marshalled. - * @param writer - * XML will be sent to this writer. - * - * @throws JAXBException - * If any unexpected problem occurs during the marshalling. - * @throws MarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Marshaller} is unable to marshal {@code jaxbElement} (or any - * object reachable from {@code jaxbElement}). See - * Marshalling a JAXB element. - * @throws IllegalArgumentException - * If any of the method parameters are null - * @since 1.6, JAXB 2.0 - */ - public void marshal( Object jaxbElement, javax.xml.stream.XMLEventWriter writer ) - throws JAXBException; - - /** - * Get a DOM tree view of the content tree(Optional). - * - * If the returned DOM tree is updated, these changes are also - * visible in the content tree. - * Use {@link #marshal(Object, org.w3c.dom.Node)} to force - * a deep copy of the content tree to a DOM representation. - * - * @param contentTree - JAXB Java representation of XML content - * - * @return the DOM tree view of the contentTree - * - * @throws UnsupportedOperationException - * If the JAXB provider implementation does not support a - * DOM view of the content tree - * - * @throws IllegalArgumentException - * If any of the method parameters are null - * - * @throws JAXBException - * If any unexpected problem occurs - * - */ - public org.w3c.dom.Node getNode( java.lang.Object contentTree ) - throws JAXBException; - - /** - * Set the particular property in the underlying implementation of - * {@code Marshaller}. This method can only be used to set one of - * the standard JAXB defined properties above or a provider specific - * property. Attempting to set an undefined property will result in - * a PropertyException being thrown. See - * Supported Properties. - * - * @param name the name of the property to be set. This value can either - * be specified using one of the constant fields or a user - * supplied string. - * @param value the value of the property to be set - * - * @throws PropertyException when there is an error processing the given - * property or value - * @throws IllegalArgumentException - * If the name parameter is null - */ - public void setProperty( String name, Object value ) - throws PropertyException; - - /** - * Get the particular property in the underlying implementation of - * {@code Marshaller}. This method can only be used to get one of - * the standard JAXB defined properties above or a provider specific - * property. Attempting to get an undefined property will result in - * a PropertyException being thrown. See - * Supported Properties. - * - * @param name the name of the property to retrieve - * @return the value of the requested property - * - * @throws PropertyException - * when there is an error retrieving the given property or value - * property name - * @throws IllegalArgumentException - * If the name parameter is null - */ - public Object getProperty( String name ) throws PropertyException; - - /** - * Allow an application to register a validation event handler. - *

- * The validation event handler will be called by the JAXB Provider if any - * validation errors are encountered during calls to any of the marshal - * API's. If the client application does not register a validation event - * handler before invoking one of the marshal methods, then validation - * events will be handled by the default event handler which will terminate - * the marshal operation after the first error or fatal error is encountered. - *

- * Calling this method with a null parameter will cause the Marshaller - * to revert back to the default default event handler. - * - * @param handler the validation event handler - * @throws JAXBException if an error was encountered while setting the - * event handler - */ - public void setEventHandler( ValidationEventHandler handler ) - throws JAXBException; - - /** - * Return the current event handler or the default event handler if one - * hasn't been set. - * - * @return the current ValidationEventHandler or the default event handler - * if it hasn't been set - * @throws JAXBException if an error was encountered while getting the - * current event handler - */ - public ValidationEventHandler getEventHandler() - throws JAXBException; - - - - /** - * Associates a configured instance of {@link XmlAdapter} with this marshaller. - * - *

- * This is a convenience method that invokes {@code setAdapter(adapter.getClass(),adapter);}. - * - * @see #setAdapter(Class,XmlAdapter) - * @throws IllegalArgumentException - * if the adapter parameter is null. - * @throws UnsupportedOperationException - * if invoked agains a JAXB 1.0 implementation. - * @since 1.6, JAXB 2.0 - */ - public void setAdapter( XmlAdapter adapter ); - - /** - * Associates a configured instance of {@link XmlAdapter} with this marshaller. - * - *

- * Every marshaller internally maintains a - * {@link java.util.Map}<{@link Class},{@link XmlAdapter}>, - * which it uses for marshalling classes whose fields/methods are annotated - * with {@link javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter}. - * - *

- * This method allows applications to use a configured instance of {@link XmlAdapter}. - * When an instance of an adapter is not given, a marshaller will create - * one by invoking its default constructor. - * - * @param type - * The type of the adapter. The specified instance will be used when - * {@link javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value()} - * refers to this type. - * @param adapter - * The instance of the adapter to be used. If null, it will un-register - * the current adapter set for this type. - * @throws IllegalArgumentException - * if the type parameter is null. - * @throws UnsupportedOperationException - * if invoked agains a JAXB 1.0 implementation. - * @since 1.6, JAXB 2.0 - */ - public void setAdapter( Class type, A adapter ); - - /** - * Gets the adapter associated with the specified type. - * - * This is the reverse operation of the {@link #setAdapter} method. - * - * @throws IllegalArgumentException - * if the type parameter is null. - * @throws UnsupportedOperationException - * if invoked agains a JAXB 1.0 implementation. - * @since 1.6, JAXB 2.0 - */ - public A getAdapter( Class type ); - - - /** - *

Associate a context that enables binary data within an XML document - * to be transmitted as XML-binary optimized attachment. - * The attachment is referenced from the XML document content model - * by content-id URIs(cid) references stored within the xml document. - * - * @throws IllegalStateException if attempt to concurrently call this - * method during a marshal operation. - */ - void setAttachmentMarshaller(AttachmentMarshaller am); - - AttachmentMarshaller getAttachmentMarshaller(); - - /** - * Specify the JAXP 1.3 {@link javax.xml.validation.Schema Schema} - * object that should be used to validate subsequent marshal operations - * against. Passing null into this method will disable validation. - * - *

- * This method allows the caller to validate the marshalled XML as it's marshalled. - * - *

- * Initially this property is set to {@code null}. - * - * @param schema Schema object to validate marshal operations against or null to disable validation - * @throws UnsupportedOperationException could be thrown if this method is - * invoked on an Marshaller created from a JAXBContext referencing - * JAXB 1.0 mapped classes - * @since 1.6, JAXB 2.0 - */ - public void setSchema( Schema schema ); - - /** - * Get the JAXP 1.3 {@link javax.xml.validation.Schema Schema} object - * being used to perform marshal-time validation. If there is no - * Schema set on the marshaller, then this method will return null - * indicating that marshal-time validation will not be performed. - * - * @return the Schema object being used to perform marshal-time - * validation or null if not present. - * @throws UnsupportedOperationException could be thrown if this method is - * invoked on an Marshaller created from a JAXBContext referencing - * JAXB 1.0 mapped classes - * @since 1.6, JAXB 2.0 - */ - public Schema getSchema(); - - /** - *

- * Register an instance of an implementation of this class with a {@link Marshaller} to externally listen - * for marshal events. - *

- *

- * This class enables pre and post processing of each marshalled object. - * The event callbacks are called when marshalling from an instance that maps to an xml element or - * complex type definition. The event callbacks are not called when marshalling from an instance of a - * Java datatype that represents a simple type definition. - *

- *

- * External listener is one of two different mechanisms for defining marshal event callbacks. - * See Marshal Event Callbacks for an overview. - * - * @see Marshaller#setListener(Listener) - * @see Marshaller#getListener() - * @since 1.6, JAXB 2.0 - */ - public static abstract class Listener { - /** - *

- * Callback method invoked before marshalling from {@code source} to XML. - *

- *

- * This method is invoked just before marshalling process starts to marshal {@code source}. - * Note that if the class of {@code source} defines its own {@code beforeMarshal} method, - * the class specific callback method is invoked just before this method is invoked. - * - * @param source instance of JAXB mapped class prior to marshalling from it. - */ - public void beforeMarshal(Object source) { - } - - /** - *

- * Callback method invoked after marshalling {@code source} to XML. - *

- *

- * This method is invoked after {@code source} and all its descendants have been marshalled. - * Note that if the class of {@code source} defines its own {@code afterMarshal} method, - * the class specific callback method is invoked just before this method is invoked. - * - * @param source instance of JAXB mapped class after marshalling it. - */ - public void afterMarshal(Object source) { - } - } - - /** - *

- * Register marshal event callback {@link Listener} with this {@link Marshaller}. - * - *

- * There is only one Listener per Marshaller. Setting a Listener replaces the previous set Listener. - * One can unregister current Listener by setting listener to {@code null}. - * - * @param listener an instance of a class that implements {@link Listener} - * @since 1.6, JAXB 2.0 - */ - public void setListener(Listener listener); - - /** - *

Return {@link Listener} registered with this {@link Marshaller}. - * - * @return registered {@link Listener} or {@code null} - * if no Listener is registered with this Marshaller. - * @since 1.6, JAXB 2.0 - */ - public Listener getListener(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/Messages.java 2018-01-30 20:39:25.000000000 -0500 +++ /dev/null 2018-01-30 20:39:25.000000000 -0500 @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2003, 2017, 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 javax.xml.bind; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Formats error messages. - */ -class Messages -{ - static String format( String property ) { - return format( property, null ); - } - - static String format( String property, Object arg1 ) { - return format( property, new Object[]{arg1} ); - } - - static String format( String property, Object arg1, Object arg2 ) { - return format( property, new Object[]{arg1,arg2} ); - } - - static String format( String property, Object arg1, Object arg2, Object arg3 ) { - return format( property, new Object[]{arg1,arg2,arg3} ); - } - - // add more if necessary. - - /** Loads a string resource and formats it with specified arguments. */ - static String format( String property, Object[] args ) { - String text = ResourceBundle.getBundle(Messages.class.getName()).getString(property); - return MessageFormat.format(text,args); - } - -// -// -// Message resources -// -// - static final String PROVIDER_NOT_FOUND = // 1 arg - "ContextFinder.ProviderNotFound"; - - static final String DEFAULT_PROVIDER_NOT_FOUND = // 0 args - "ContextFinder.DefaultProviderNotFound"; - - static final String COULD_NOT_INSTANTIATE = // 2 args - "ContextFinder.CouldNotInstantiate"; - - static final String CANT_FIND_PROPERTIES_FILE = // 1 arg - "ContextFinder.CantFindPropertiesFile"; - - static final String CANT_MIX_PROVIDERS = // 0 args - "ContextFinder.CantMixProviders"; - - static final String MISSING_PROPERTY = // 2 args - "ContextFinder.MissingProperty"; - - static final String NO_PACKAGE_IN_CONTEXTPATH = // 0 args - "ContextFinder.NoPackageInContextPath"; - - static final String NAME_VALUE = // 2 args - "PropertyException.NameValue"; - - static final String CONVERTER_MUST_NOT_BE_NULL = // 0 args - "DatatypeConverter.ConverterMustNotBeNull"; - - static final String ILLEGAL_CAST = // 2 args - "JAXBContext.IllegalCast"; - - static final String ERROR_LOAD_CLASS = // 2 args - "ContextFinder.ErrorLoadClass"; - - static final String JAXB_CLASSES_NOT_OPEN = // 1 arg - "JAXBClasses.notOpen"; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/Messages.properties 2018-01-30 20:39:26.000000000 -0500 +++ /dev/null 2018-01-30 20:39:26.000000000 -0500 @@ -1,62 +0,0 @@ -# -# Copyright (c) 2003, 2017, 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. -# - -ContextFinder.ProviderNotFound = \ - Provider {0} not found - -ContextFinder.DefaultProviderNotFound = \ - Implementation of JAXB-API has not been found on module path or classpath. - -ContextFinder.CouldNotInstantiate = \ - Provider {0} could not be instantiated: {1} - -ContextFinder.CantFindPropertiesFile = \ - Unable to locate jaxb.properties for package {0} - -ContextFinder.CantMixProviders = \ - You may not mix JAXB Providers on the context path - -ContextFinder.MissingProperty = \ - jaxb.properties in package {0} does not contain the {1} property. - -ContextFinder.NoPackageInContextPath = \ - No package name is given - -ContextFinder.ErrorLoadClass = \ - Error loading class {0} listed in {1}, make sure that entries are accessable \ - on CLASSPATH and of the form ClassName or OuterClass.InnerClass \ - not ClassName.class or fully.qualified.ClassName - -PropertyException.NameValue = \ - name: {0} value: {1} - -DatatypeConverter.ConverterMustNotBeNull = \ - The DatatypeConverterInterface parameter must not be null - -JAXBContext.IllegalCast = \ - ClassCastException: attempting to cast {0} to {1}. Please make sure that you are specifying the proper ClassLoader. - -JAXBClasses.notOpen = \ - Package {0} with JAXB class {1} defined in a module {2} must be open to at least java.xml.bind module. --- old/src/java.xml.bind/share/classes/javax/xml/bind/ModuleUtil.java 2018-01-30 20:39:27.000000000 -0500 +++ /dev/null 2018-01-30 20:39:27.000000000 -0500 @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2017, 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 javax.xml.bind; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.Module; -import java.util.ArrayList; -import java.util.List; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Propagates openness of JAXB annottated classess packages to JAXB impl module. - * - * @author Roman Grigoriadi - */ -class ModuleUtil { - - private static Logger logger = Logger.getLogger("javax.xml.bind"); - - /** - * Resolves classes from context path. - * Only one class per package is needed to access its {@link java.lang.Module} - */ - static Class[] getClassesFromContextPath(String contextPath, ClassLoader classLoader) throws JAXBException { - List classes = new ArrayList<>(); - if (contextPath == null || contextPath.isEmpty()){ - return classes.toArray(new Class[]{}); - } - - String [] tokens = contextPath.split(":"); - for (String pkg : tokens){ - - // look for ObjectFactory and load it - final Class o; - try { - o = classLoader.loadClass(pkg+".ObjectFactory"); - classes.add(o); - continue; - } catch (ClassNotFoundException e) { - // not necessarily an error - } - - // look for jaxb.index and load the list of classes - try { - final Class firstByJaxbIndex = findFirstByJaxbIndex(pkg, classLoader); - if (firstByJaxbIndex != null) { - classes.add(firstByJaxbIndex); - } - } catch (IOException e) { - throw new JAXBException(e); - } - } - - if (logger.isLoggable(Level.FINE)) { - logger.log(Level.FINE, "Resolved classes from context path: {0}", classes); - } - return classes.toArray(new Class[]{}); - } - - /** - * Find first class in package by {@code jaxb.index} file. - */ - static Class findFirstByJaxbIndex(String pkg, ClassLoader classLoader) throws IOException, JAXBException { - final String resource = pkg.replace('.', '/') + "/jaxb.index"; - final InputStream resourceAsStream = classLoader.getResourceAsStream(resource); - - if (resourceAsStream == null) { - return null; - } - - BufferedReader in = - new BufferedReader(new InputStreamReader(resourceAsStream, "UTF-8")); - try { - String className = in.readLine(); - while (className != null) { - className = className.trim(); - if (className.startsWith("#") || (className.length() == 0)) { - className = in.readLine(); - continue; - } - - try { - return classLoader.loadClass(pkg + '.' + className); - } catch (ClassNotFoundException e) { - throw new JAXBException(Messages.format(Messages.ERROR_LOAD_CLASS, className, pkg), e); - } - - } - } finally { - in.close(); - } - return null; - } - - /** - * Implementation may be defined in other module than {@code java.xml.bind}. In that case openness - * {@linkplain Module#isOpen open} of classes should be delegated to implementation module. - * - * @param classes used to resolve module for {@linkplain Module#addOpens(String, Module)} - * @param factorySPI used to resolve {@link Module} of the implementation. - * - * @throws JAXBException if ony of a classes package is not open to {@code java.xml.bind} module. - */ - static void delegateAddOpensToImplModule(Class[] classes, Class factorySPI) throws JAXBException { - final Module implModule = factorySPI.getModule(); - - Module jaxbModule = JAXBContext.class.getModule(); - - for (Class cls : classes) { - final Module classModule = cls.getModule(); - final String packageName = cls.getPackageName(); - //no need for unnamed - if (!classModule.isNamed()) { - continue; - } - //report error if they are not open to java.xml.bind - if (!classModule.isOpen(packageName, jaxbModule)) { - throw new JAXBException(Messages.format(Messages.JAXB_CLASSES_NOT_OPEN, - packageName, cls.getName(), classModule.getName())); - } - //propagate openness to impl module - classModule.addOpens(packageName, implModule); - if (logger.isLoggable(Level.FINE)) { - logger.log(Level.FINE, "Propagating openness of package {0} in {1} to {2}.", - new String[]{ packageName, classModule.getName(), implModule.getName() }); - } - } - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/NotIdentifiableEvent.java 2018-01-30 20:39:27.000000000 -0500 +++ /dev/null 2018-01-30 20:39:27.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -/** - * This event indicates that a problem was encountered resolving an ID/IDREF. - * - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see Validator - * @see ValidationEventHandler - * @since 1.6, JAXB 1.0 - */ -public interface NotIdentifiableEvent extends ValidationEvent { - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/ParseConversionEvent.java 2018-01-30 20:39:28.000000000 -0500 +++ /dev/null 2018-01-30 20:39:28.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind; - -/** - * This event indicates that a problem was encountered while converting a - * string from the XML data into a value of the target Java data type. - * - * @author
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see ValidationEvent - * @see ValidationEventHandler - * @see Unmarshaller - * @since 1.6, JAXB 1.0 - */ -public interface ParseConversionEvent extends ValidationEvent { - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/PrintConversionEvent.java 2018-01-30 20:39:29.000000000 -0500 +++ /dev/null 2018-01-30 20:39:29.000000000 -0500 @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind; - -/** - * This event indicates that a problem was encountered while converting data - * from the Java content tree into its lexical representation. - * - * @author
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see ValidationEvent - * @see ValidationEventHandler - * @see Marshaller - * @since 1.6, JAXB 1.0 - */ -public interface PrintConversionEvent extends ValidationEvent { - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/PropertyException.java 2018-01-30 20:39:29.000000000 -0500 +++ /dev/null 2018-01-30 20:39:29.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind; - - - -/** - * This exception indicates that an error was encountered while getting or - * setting a property. - * - * @author
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see JAXBContext - * @see Validator - * @see Unmarshaller - * @since 1.6, JAXB 1.0 - */ -public class PropertyException extends JAXBException { - - /** - * Construct a PropertyException with the specified detail message. The - * errorCode and linkedException will default to null. - * - * @param message a description of the exception - */ - public PropertyException(String message) { - super(message); - } - - /** - * Construct a PropertyException with the specified detail message and - * vendor specific errorCode. The linkedException will default to null. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - */ - public PropertyException(String message, String errorCode) { - super(message, errorCode); - } - - /** - * Construct a PropertyException with a linkedException. The detail - * message and vendor specific errorCode will default to null. - * - * @param exception the linked exception - */ - public PropertyException(Throwable exception) { - super(exception); - } - - /** - * Construct a PropertyException with the specified detail message and - * linkedException. The errorCode will default to null. - * - * @param message a description of the exception - * @param exception the linked exception - */ - public PropertyException(String message, Throwable exception) { - super(message, exception); - } - - /** - * Construct a PropertyException with the specified detail message, vendor - * specific errorCode, and linkedException. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - * @param exception the linked exception - */ - public PropertyException( - String message, - String errorCode, - Throwable exception) { - super(message, errorCode, exception); - } - - /** - * Construct a PropertyException whose message field is set based on the - * name of the property and value.toString(). - * - * @param name the name of the property related to this exception - * @param value the value of the property related to this exception - */ - public PropertyException(String name, Object value) { - super( Messages.format( Messages.NAME_VALUE, - name, - value.toString() ) ); - } - - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/SchemaOutputResolver.java 2018-01-30 20:39:30.000000000 -0500 +++ /dev/null 2018-01-30 20:39:30.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.xml.bind; - -import javax.xml.transform.Result; -import java.io.IOException; - -/** - * Controls where a JAXB implementation puts the generates - * schema files. - * - *

- * An implementation of this abstract class has to be provided by the calling - * application to generate schemas. - * - *

- * This is a class, not an interface so as to allow future versions to evolve - * without breaking the compatibility. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * @since 1.6 - */ -public abstract class SchemaOutputResolver { - /** - * Decides where the schema file (of the given namespace URI) - * will be written, and return it as a {@link Result} object. - * - *

- * This method is called only once for any given namespace. - * IOW, all the components in one namespace is always written - * into the same schema document. - * - * @param namespaceUri - * The namespace URI that the schema declares. - * Can be the empty string, but never be null. - * @param suggestedFileName - * A JAXB implementation generates an unique file name (like "schema1.xsd") - * for the convenience of the callee. This name can be - * used for the file name of the schema, or the callee can just - * ignore this name and come up with its own name. - * This is just a hint. - * - * @return - * a {@link Result} object that encapsulates the actual destination - * of the schema. - * - * If the {@link Result} object has a system ID, it must be an - * absolute system ID. Those system IDs are relativized by the caller and used - * for {@literal } statements. - * - * If the {@link Result} object does not have a system ID, a schema - * for the namespace URI is generated but it won't be explicitly - * {@literal }ed from other schemas. - * - * If {@code null} is returned, the schema generation for this - * namespace URI will be skipped. - */ - public abstract Result createOutput( String namespaceUri, String suggestedFileName ) throws IOException; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/ServiceLoaderUtil.java 2018-01-30 20:39:31.000000000 -0500 +++ /dev/null 2018-01-30 20:39:31.000000000 -0500 @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2015, 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 javax.xml.bind; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Iterator; -import java.util.ServiceLoader; -import java.util.logging.Level; -import java.util.logging.Logger; - -/** - * Shared ServiceLoader/FactoryFinder Utils shared among SAAJ, JAXB and JAXWS - * - this class must be duplicated to all those projects, but it's - * basically generic code and we want to have it everywhere same. - * - * @author Miroslav.Kos@oracle.com - */ -class ServiceLoaderUtil { - - private static final String OSGI_SERVICE_LOADER_CLASS_NAME = "com.sun.org.glassfish.hk2.osgiresourcelocator.ServiceLoader"; - private static final String OSGI_SERVICE_LOADER_METHOD_NAME = "lookupProviderClasses"; - - static P firstByServiceLoader(Class

spiClass, - Logger logger, - ExceptionHandler handler) throws T { - // service discovery - try { - ServiceLoader

serviceLoader = ServiceLoader.load(spiClass); - - for (P impl : serviceLoader) { - logger.fine("ServiceProvider loading Facility used; returning object [" + - impl.getClass().getName() + "]"); - - return impl; - } - } catch (Throwable t) { - throw handler.createException(t, "Error while searching for service [" + spiClass.getName() + "]"); - } - return null; - } - - static Object lookupUsingOSGiServiceLoader(String factoryId, Logger logger) { - - try { - // Use reflection to avoid having any dependendcy on ServiceLoader class - Class serviceClass = Class.forName(factoryId); - Class target = Class.forName(OSGI_SERVICE_LOADER_CLASS_NAME); - Method m = target.getMethod(OSGI_SERVICE_LOADER_METHOD_NAME, Class.class); - Iterator iter = ((Iterable) m.invoke(null, serviceClass)).iterator(); - if (iter.hasNext()) { - Object next = iter.next(); - logger.fine("Found implementation using OSGi facility; returning object [" + - next.getClass().getName() + "]."); - return next; - } else { - return null; - } - } catch (IllegalAccessException | - InvocationTargetException | - ClassNotFoundException | - NoSuchMethodException ignored) { - - logger.log(Level.FINE, "Unable to find from OSGi: [" + factoryId + "]", ignored); - return null; - } - } - - static void checkPackageAccess(String className) { - // make sure that the current thread has an access to the package of the given name. - SecurityManager s = System.getSecurityManager(); - if (s != null) { - int i = className.lastIndexOf('.'); - if (i != -1) { - s.checkPackageAccess(className.substring(0, i)); - } - } - } - - static Class nullSafeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException { - if (classLoader == null) { - return Class.forName(className); - } else { - return classLoader.loadClass(className); - } - } - - // Returns instance of required class. It checks package access (security) - // unless it is defaultClassname. It means if you are trying to instantiate - // default implementation (fallback), pass the class name to both first and second parameter. - static Object newInstance(String className, - String defaultImplClassName, - final ExceptionHandler handler) throws T { - try { - return safeLoadClass(className, defaultImplClassName, contextClassLoader(handler)).newInstance(); - } catch (ClassNotFoundException x) { - throw handler.createException(x, "Provider " + className + " not found"); - } catch (Exception x) { - throw handler.createException(x, "Provider " + className + " could not be instantiated: " + x); - } - } - - static Class safeLoadClass(String className, - String defaultImplClassName, - ClassLoader classLoader) throws ClassNotFoundException { - - try { - checkPackageAccess(className); - } catch (SecurityException se) { - // anyone can access the platform default factory class without permission - if (defaultImplClassName != null && defaultImplClassName.equals(className)) { - return Class.forName(className); - } - // not platform default implementation ... - throw se; - } - return nullSafeLoadClass(className, classLoader); - } - - static ClassLoader contextClassLoader(ExceptionHandler exceptionHandler) throws Exception { - try { - return Thread.currentThread().getContextClassLoader(); - } catch (Exception x) { - throw exceptionHandler.createException(x, x.toString()); - } - } - - static abstract class ExceptionHandler { - - public abstract T createException(Throwable throwable, String message); - - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/TypeConstraintException.java 2018-01-30 20:39:32.000000000 -0500 +++ /dev/null 2018-01-30 20:39:32.000000000 -0500 @@ -1,184 +0,0 @@ -/* - * Copyright (c) 2003, 2015, 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 javax.xml.bind; - -/** - * This exception indicates that a violation of a dynamically checked type - * constraint was detected. - * - *

- * This exception can be thrown by the generated setter methods of the schema - * derived Java content classes. However, since fail-fast validation is - * an optional feature for JAXB Providers to support, not all setter methods - * will throw this exception when a type constraint is violated. - * - *

- * If this exception is throw while invoking a fail-fast setter, the value of - * the property is guaranteed to remain unchanged, as if the setter were never - * called. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see ValidationEvent - * @since 1.6, JAXB 1.0 - */ - -public class TypeConstraintException extends java.lang.RuntimeException { - - /** - * Vendor specific error code - * - */ - private String errorCode; - - /** - * Exception reference - * - */ - private volatile Throwable linkedException; - - static final long serialVersionUID = -3059799699420143848L; - - /** - * Construct a TypeConstraintException with the specified detail message. The - * errorCode and linkedException will default to null. - * - * @param message a description of the exception - */ - public TypeConstraintException(String message) { - this( message, null, null ); - } - - /** - * Construct a TypeConstraintException with the specified detail message and vendor - * specific errorCode. The linkedException will default to null. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - */ - public TypeConstraintException(String message, String errorCode) { - this( message, errorCode, null ); - } - - /** - * Construct a TypeConstraintException with a linkedException. The detail message and - * vendor specific errorCode will default to null. - * - * @param exception the linked exception - */ - public TypeConstraintException(Throwable exception) { - this( null, null, exception ); - } - - /** - * Construct a TypeConstraintException with the specified detail message and - * linkedException. The errorCode will default to null. - * - * @param message a description of the exception - * @param exception the linked exception - */ - public TypeConstraintException(String message, Throwable exception) { - this( message, null, exception ); - } - - /** - * Construct a TypeConstraintException with the specified detail message, - * vendor specific errorCode, and linkedException. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - * @param exception the linked exception - */ - public TypeConstraintException(String message, String errorCode, Throwable exception) { - super( message ); - this.errorCode = errorCode; - this.linkedException = exception; - } - - /** - * Get the vendor specific error code - * - * @return a string specifying the vendor specific error code - */ - public String getErrorCode() { - return this.errorCode; - } - - /** - * Get the linked exception - * - * @return the linked Exception, null if none exists - */ - public Throwable getLinkedException() { - return linkedException; - } - - /** - * Add a linked Exception. - * - * @param exception the linked Exception (A null value is permitted and - * indicates that the linked exception does not exist or - * is unknown). - */ - public void setLinkedException( Throwable exception ) { - this.linkedException = exception; - } - - /** - * Returns a short description of this TypeConstraintException. - * - */ - public String toString() { - return linkedException == null ? - super.toString() : - super.toString() + "\n - with linked exception:\n[" + - linkedException.toString()+ "]"; - } - - /** - * Prints this TypeConstraintException and its stack trace (including the stack trace - * of the linkedException if it is non-null) to the PrintStream. - * - * @param s PrintStream to use for output - */ - public void printStackTrace( java.io.PrintStream s ) { - if( linkedException != null ) { - linkedException.printStackTrace(s); - s.println("--------------- linked to ------------------"); - } - - super.printStackTrace(s); - } - - /** - * Prints this TypeConstraintException and its stack trace (including the stack trace - * of the linkedException if it is non-null) to {@code System.err}. - * - */ - public void printStackTrace() { - printStackTrace(System.err); - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/UnmarshalException.java 2018-01-30 20:39:32.000000000 -0500 +++ /dev/null 2018-01-30 20:39:32.000000000 -0500 @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -/** - * This exception indicates that an error has occurred while performing - * an unmarshal operation that prevents the JAXB Provider from completing - * the operation. - * - *

- * The {@code ValidationEventHandler} can cause this exception to be thrown - * during the unmarshal operations. See - * {@link ValidationEventHandler#handleEvent(ValidationEvent) - * ValidationEventHandler.handleEvent(ValidationEvent)}. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
- * @see JAXBException - * @see Unmarshaller - * @see ValidationEventHandler - * @since 1.6, JAXB 1.0 - */ -public class UnmarshalException extends JAXBException { - - /** - * Construct an UnmarshalException with the specified detail message. The - * errorCode and linkedException will default to null. - * - * @param message a description of the exception - */ - public UnmarshalException( String message ) { - this( message, null, null ); - } - - /** - * Construct an UnmarshalException with the specified detail message and vendor - * specific errorCode. The linkedException will default to null. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - */ - public UnmarshalException( String message, String errorCode ) { - this( message, errorCode, null ); - } - - /** - * Construct an UnmarshalException with a linkedException. The detail message and - * vendor specific errorCode will default to null. - * - * @param exception the linked exception - */ - public UnmarshalException( Throwable exception ) { - this( null, null, exception ); - } - - /** - * Construct an UnmarshalException with the specified detail message and - * linkedException. The errorCode will default to null. - * - * @param message a description of the exception - * @param exception the linked exception - */ - public UnmarshalException( String message, Throwable exception ) { - this( message, null, exception ); - } - - /** - * Construct an UnmarshalException with the specified detail message, vendor - * specific errorCode, and linkedException. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - * @param exception the linked exception - */ - public UnmarshalException( String message, String errorCode, Throwable exception ) { - super( message, errorCode, exception ); - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/Unmarshaller.java 2018-01-30 20:39:33.000000000 -0500 +++ /dev/null 2018-01-30 20:39:33.000000000 -0500 @@ -1,1140 +0,0 @@ -/* - * Copyright (c) 2003, 2017, 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 javax.xml.bind; - -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.attachment.AttachmentUnmarshaller; -import javax.xml.validation.Schema; -import java.io.Reader; - -/** - * The {@code Unmarshaller} class governs the process of deserializing XML - * data into newly created Java content trees, optionally validating the XML - * data as it is unmarshalled. It provides an overloading of unmarshal methods - * for many different input kinds. - * - *

- * Unmarshalling from a File: - *

- *
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *       Object o = u.unmarshal( new File( "nosferatu.xml" ) );
- *    
- *
- * - * - *

- * Unmarshalling from an InputStream: - *

- *
- *       InputStream is = new FileInputStream( "nosferatu.xml" );
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *       Object o = u.unmarshal( is );
- *    
- *
- * - *

- * Unmarshalling from a URL: - *

- *
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *       URL url = new URL( "http://beaker.east/nosferatu.xml" );
- *       Object o = u.unmarshal( url );
- *    
- *
- * - *

- * Unmarshalling from a StringBuffer using a - * {@code javax.xml.transform.stream.StreamSource}: - *

- *
{@code
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *       StringBuffer xmlStr = new StringBuffer( "..." );
- *       Object o = u.unmarshal( new StreamSource( new StringReader( xmlStr.toString() ) ) );
- *    }
- *
- * - *

- * Unmarshalling from a {@code org.w3c.dom.Node}: - *

- *
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *
- *       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- *       dbf.setNamespaceAware(true);
- *       DocumentBuilder db = dbf.newDocumentBuilder();
- *       Document doc = db.parse(new File( "nosferatu.xml"));
-
- *       Object o = u.unmarshal( doc );
- *    
- *
- * - *

- * Unmarshalling from a {@code javax.xml.transform.sax.SAXSource} using a - * client specified validating SAX2.0 parser: - *

- *
- *       // configure a validating SAX2.0 parser (Xerces2)
- *       static final String JAXP_SCHEMA_LANGUAGE =
- *           "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
- *       static final String JAXP_SCHEMA_LOCATION =
- *           "http://java.sun.com/xml/jaxp/properties/schemaSource";
- *       static final String W3C_XML_SCHEMA =
- *           "http://www.w3.org/2001/XMLSchema";
- *
- *       System.setProperty( "javax.xml.parsers.SAXParserFactory",
- *                           "org.apache.xerces.jaxp.SAXParserFactoryImpl" );
- *
- *       SAXParserFactory spf = SAXParserFactory.newInstance();
- *       spf.setNamespaceAware(true);
- *       spf.setValidating(true);
- *       SAXParser saxParser = spf.newSAXParser();
- *
- *       try {
- *           saxParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
- *           saxParser.setProperty(JAXP_SCHEMA_LOCATION, "http://....");
- *       } catch (SAXNotRecognizedException x) {
- *           // exception handling omitted
- *       }
- *
- *       XMLReader xmlReader = saxParser.getXMLReader();
- *       SAXSource source =
- *           new SAXSource( xmlReader, new InputSource( "http://..." ) );
- *
- *       // Setup JAXB to unmarshal
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *       ValidationEventCollector vec = new ValidationEventCollector();
- *       u.setEventHandler( vec );
- *
- *       // turn off the JAXB provider's default validation mechanism to
- *       // avoid duplicate validation
- *       u.setValidating( false )
- *
- *       // unmarshal
- *       Object o = u.unmarshal( source );
- *
- *       // check for events
- *       if( vec.hasEvents() ) {
- *          // iterate over events
- *       }
- *    
- *
- * - *

- * Unmarshalling from a StAX XMLStreamReader: - *

- *
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *
- *       javax.xml.stream.XMLStreamReader xmlStreamReader =
- *           javax.xml.stream.XMLInputFactory().newInstance().createXMLStreamReader( ... );
- *
- *       Object o = u.unmarshal( xmlStreamReader );
- *    
- *
- * - *

- * Unmarshalling from a StAX XMLEventReader: - *

- *
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *
- *       javax.xml.stream.XMLEventReader xmlEventReader =
- *           javax.xml.stream.XMLInputFactory().newInstance().createXMLEventReader( ... );
- *
- *       Object o = u.unmarshal( xmlEventReader );
- *    
- *
- * - *

- * - * Unmarshalling XML Data
- *

- * Unmarshalling can deserialize XML data that represents either an entire XML document - * or a subtree of an XML document. Typically, it is sufficient to use the - * unmarshalling methods described by - * Unmarshal root element that is declared globally. - * These unmarshal methods utilize {@link JAXBContext}'s mapping of global XML element - * declarations and type definitions to JAXB mapped classes to initiate the - * unmarshalling of the root element of XML data. When the {@link JAXBContext}'s - * mappings are not sufficient to unmarshal the root element of XML data, - * the application can assist the unmarshalling process by using the - * unmarshal by declaredType methods. - * These methods are useful for unmarshalling XML data where - * the root element corresponds to a local element declaration in the schema. - *
- * - *
- * An unmarshal method never returns null. If the unmarshal process is unable to unmarshal - * the root of XML content to a JAXB mapped object, a fatal error is reported that - * terminates processing by throwing JAXBException. - *
- * - *

- * - * Unmarshal a root element that is globally declared
- *

- * The unmarshal methods that do not have an {@code declaredType} parameter use - * {@link JAXBContext} to unmarshal the root element of an XML data. The {@link JAXBContext} - * instance is the one that was used to create this {@code Unmarshaller}. The {@link JAXBContext} - * instance maintains a mapping of globally declared XML element and type definition names to - * JAXB mapped classes. The unmarshal method checks if {@link JAXBContext} has a mapping - * from the root element's XML name and/or {@code @xsi:type} to a JAXB mapped class. If it does, it umarshalls the - * XML data using the appropriate JAXB mapped class. Note that when the root element name is unknown and the root - * element has an {@code @xsi:type}, the XML data is unmarshalled - * using that JAXB mapped class as the value of a {@link JAXBElement}. - * When the {@link JAXBContext} object does not have a mapping for the root element's name - * nor its {@code @xsi:type}, if it exists, - * then the unmarshal operation will abort immediately by throwing a {@link UnmarshalException - * UnmarshalException}. This exception scenario can be worked around by using the unmarshal by - * declaredType methods described in the next subsection. - *
- * - *

- * - * Unmarshal by Declared Type
- *

- * The unmarshal methods with a {@code declaredType} parameter enable an - * application to deserialize a root element of XML data, even when - * there is no mapping in {@link JAXBContext} of the root element's XML name. - * The unmarshaller unmarshals the root element using the application provided - * mapping specified as the {@code declaredType} parameter. - * Note that even when the root element's element name is mapped by {@link JAXBContext}, - * the {@code declaredType} parameter overrides that mapping for - * deserializing the root element when using these unmarshal methods. - * Additionally, when the root element of XML data has an {@code xsi:type} attribute and - * that attribute's value references a type definition that is mapped - * to a JAXB mapped class by {@link JAXBContext}, that the root - * element's {@code xsi:type} attribute takes - * precedence over the unmarshal methods {@code declaredType} parameter. - * These methods always return a {@code JAXBElement} - * instance. The table below shows how the properties of the returned JAXBElement - * instance are set. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Unmarshal By Declared Type returned JAXBElement
JAXBElement PropertyValue
name{@code xml element name}
value{@code instanceof declaredType}
declaredTypeunmarshal method {@code declaredType} parameter
scope{@code null} (actual scope is unknown)
- *
- * - *

- * The following is an example of - * unmarshal by declaredType method. - *

- * Unmarshal by declaredType from a {@code org.w3c.dom.Node}: - *

- *
{@code
- *       Schema fragment for example
- *       
- *          ...<\xs:complexType>
- *          
- *          
- *              
- *                 
- *                    
- *                    
- *                    ...
- *                 
- *              
- *          
- *       
- *
- *       JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
- *       Unmarshaller u = jc.createUnmarshaller();
- *
- *       DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- *       dbf.setNamespaceAware(true);
- *       DocumentBuilder db = dbf.newDocumentBuilder();
- *       Document doc = db.parse(new File( "nosferatu.xml"));
- *       Element  fooSubtree = ...; // traverse DOM till reach xml element foo, constrained by a
- *                                  // local element declaration in schema.
- *
- *       // FooType is the JAXB mapping of the type of local element declaration foo.
- *       JAXBElement foo = u.unmarshal( fooSubtree, FooType.class);
- *    }
- *
- * - *

- * Support for SAX2.0 Compliant Parsers
- *

- * A client application has the ability to select the SAX2.0 compliant parser - * of their choice. If a SAX parser is not selected, then the JAXB Provider's - * default parser will be used. Even though the JAXB Provider's default parser - * is not required to be SAX2.0 compliant, all providers are required to allow - * a client application to specify their own SAX2.0 parser. Some providers may - * require the client application to specify the SAX2.0 parser at schema compile - * time. See {@link #unmarshal(javax.xml.transform.Source) unmarshal(Source)} - * for more detail. - *
- * - *

- * Validation and Well-Formedness
- *

- *

- * A client application can enable or disable JAXP 1.3 validation - * mechanism via the {@code setSchema(javax.xml.validation.Schema)} API. - * Sophisticated clients can specify their own validating SAX 2.0 compliant - * parser and bypass the JAXP 1.3 validation mechanism using the - * {@link #unmarshal(javax.xml.transform.Source) unmarshal(Source)} API. - * - *

- * Since unmarshalling invalid XML content is defined in JAXB 2.0, - * the Unmarshaller default validation event handler was made more lenient - * than in JAXB 1.0. When schema-derived code generated - * by JAXB 1.0 binding compiler is registered with {@link JAXBContext}, - * the default unmarshal validation handler is - * {@link javax.xml.bind.helpers.DefaultValidationEventHandler} and it - * terminates the marshal operation after encountering either a fatal error or an error. - * For a JAXB 2.0 client application, there is no explicitly defined default - * validation handler and the default event handling only - * terminates the unmarshal operation after encountering a fatal error. - * - *

- * - *

- * - * Supported Properties
- *

- *

- * There currently are not any properties required to be supported by all - * JAXB Providers on Unmarshaller. However, some providers may support - * their own set of provider specific properties. - *

- * - *

- * - * Unmarshal Event Callbacks
- *

- * The {@link Unmarshaller} provides two styles of callback mechanisms - * that allow application specific processing during key points in the - * unmarshalling process. In 'class defined' event callbacks, application - * specific code placed in JAXB mapped classes is triggered during - * unmarshalling. 'External listeners' allow for centralized processing - * of unmarshal events in one callback method rather than by type event callbacks. - *

- * 'Class defined' event callback methods allow any JAXB mapped class to specify - * its own specific callback methods by defining methods with the following method signature: - *

- *
- *   // This method is called immediately after the object is created and before the unmarshalling of this
- *   // object begins. The callback provides an opportunity to initialize JavaBean properties prior to unmarshalling.
- *   void beforeUnmarshal(Unmarshaller, Object parent);
- *
- *   //This method is called after all the properties (except IDREF) are unmarshalled for this object,
- *   //but before this object is set to the parent object.
- *   void afterUnmarshal(Unmarshaller, Object parent);
- * 
- *
- * The class defined callback methods should be used when the callback method requires - * access to non-public methods and/or fields of the class. - *

- * The external listener callback mechanism enables the registration of a {@link Listener} - * instance with an {@link Unmarshaller#setListener(Listener)}. The external listener receives all callback events, - * allowing for more centralized processing than per class defined callback methods. The external listener - * receives events when unmarshalling process is marshalling to a JAXB element or to JAXB mapped class. - *

- * The 'class defined' and external listener event callback methods are independent of each other, - * both can be called for one event. The invocation ordering when both listener callback methods exist is - * defined in {@link Listener#beforeUnmarshal(Object, Object)} and {@link Listener#afterUnmarshal(Object, Object)}. -*

- * An event callback method throwing an exception terminates the current unmarshal process. - * - *

- * - * @author
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see JAXBContext - * @see Marshaller - * @see Validator - * @since 1.6, JAXB 1.0 - */ -public interface Unmarshaller { - - /** - * Unmarshal XML data from the specified file and return the resulting - * content tree. - * - *

- * Implements Unmarshal Global Root Element. - * - * @param f the file to unmarshal XML data from - * @return the newly created root object of the java content tree - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If the file parameter is null - */ - public Object unmarshal( java.io.File f ) throws JAXBException; - - /** - * Unmarshal XML data from the specified InputStream and return the - * resulting content tree. Validation event location information may - * be incomplete when using this form of the unmarshal API. - * - *

- * Implements Unmarshal Global Root Element. - * - * @param is the InputStream to unmarshal XML data from - * @return the newly created root object of the java content tree - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If the InputStream parameter is null - */ - public Object unmarshal( java.io.InputStream is ) throws JAXBException; - - /** - * Unmarshal XML data from the specified Reader and return the - * resulting content tree. Validation event location information may - * be incomplete when using this form of the unmarshal API, - * because a Reader does not provide the system ID. - * - *

- * Implements Unmarshal Global Root Element. - * - * @param reader the Reader to unmarshal XML data from - * @return the newly created root object of the java content tree - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If the InputStream parameter is null - * @since 1.6, JAXB 2.0 - */ - public Object unmarshal( Reader reader ) throws JAXBException; - - /** - * Unmarshal XML data from the specified URL and return the resulting - * content tree. - * - *

- * Implements Unmarshal Global Root Element. - * - * @param url the url to unmarshal XML data from - * @return the newly created root object of the java content tree - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If the URL parameter is null - */ - public Object unmarshal( java.net.URL url ) throws JAXBException; - - /** - * Unmarshal XML data from the specified SAX InputSource and return the - * resulting content tree. - * - *

- * Implements Unmarshal Global Root Element. - * - * @param source the input source to unmarshal XML data from - * @return the newly created root object of the java content tree - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If the InputSource parameter is null - */ - public Object unmarshal( org.xml.sax.InputSource source ) throws JAXBException; - - /** - * Unmarshal global XML data from the specified DOM tree and return the resulting - * content tree. - * - *

- * Implements Unmarshal Global Root Element. - * - * @param node - * the document/element to unmarshal XML data from. - * The caller must support at least Document and Element. - * @return the newly created root object of the java content tree - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If the Node parameter is null - * @see #unmarshal(org.w3c.dom.Node, Class) - */ - public Object unmarshal( org.w3c.dom.Node node ) throws JAXBException; - - /** - * Unmarshal XML data by JAXB mapped {@code declaredType} - * and return the resulting content tree. - * - *

- * Implements Unmarshal by Declared Type - * - * @param node - * the document/element to unmarshal XML data from. - * The caller must support at least Document and Element. - * @param declaredType - * appropriate JAXB mapped class to hold {@code node}'s XML data. - * - * @return JAXB Element representation of {@code node} - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If any parameter is null - * @since 1.6, JAXB 2.0 - */ - public JAXBElement unmarshal( org.w3c.dom.Node node, Class declaredType ) throws JAXBException; - - /** - * Unmarshal XML data from the specified XML Source and return the - * resulting content tree. - * - *

- * Implements Unmarshal Global Root Element. - * - *

- * - * SAX 2.0 Parser Pluggability - *

- * A client application can choose not to use the default parser mechanism - * supplied with their JAXB provider. Any SAX 2.0 compliant parser can be - * substituted for the JAXB provider's default mechanism. To do so, the - * client application must properly configure a {@code SAXSource} containing - * an {@code XMLReader} implemented by the SAX 2.0 parser provider. If the - * {@code XMLReader} has an {@code org.xml.sax.ErrorHandler} registered - * on it, it will be replaced by the JAXB Provider so that validation errors - * can be reported via the {@code ValidationEventHandler} mechanism of - * JAXB. If the {@code SAXSource} does not contain an {@code XMLReader}, - * then the JAXB provider's default parser mechanism will be used. - *

- * This parser replacement mechanism can also be used to replace the JAXB - * provider's unmarshal-time validation engine. The client application - * must properly configure their SAX 2.0 compliant parser to perform - * validation (as shown in the example above). Any {@code SAXParserExceptions} - * encountered by the parser during the unmarshal operation will be - * processed by the JAXB provider and converted into JAXB - * {@code ValidationEvent} objects which will be reported back to the - * client via the {@code ValidationEventHandler} registered with the - * {@code Unmarshaller}. Note: specifying a substitute validating - * SAX 2.0 parser for unmarshalling does not necessarily replace the - * validation engine used by the JAXB provider for performing on-demand - * validation. - *

- * The only way for a client application to specify an alternate parser - * mechanism to be used during unmarshal is via the - * {@code unmarshal(SAXSource)} API. All other forms of the unmarshal - * method (File, URL, Node, etc) will use the JAXB provider's default - * parser and validator mechanisms. - * - * @param source the XML Source to unmarshal XML data from (providers are - * only required to support SAXSource, DOMSource, and StreamSource) - * @return the newly created root object of the java content tree - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If the Source parameter is null - * @see #unmarshal(javax.xml.transform.Source, Class) - */ - public Object unmarshal( javax.xml.transform.Source source ) - throws JAXBException; - - - /** - * Unmarshal XML data from the specified XML Source by {@code declaredType} and return the - * resulting content tree. - * - *

- * Implements Unmarshal by Declared Type - * - *

- * See SAX 2.0 Parser Pluggability - * - * @param source the XML Source to unmarshal XML data from (providers are - * only required to support SAXSource, DOMSource, and StreamSource) - * @param declaredType - * appropriate JAXB mapped class to hold {@code source}'s xml root element - * @return Java content rooted by JAXB Element - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If any parameter is null - * @since 1.6, JAXB 2.0 - */ - public JAXBElement unmarshal( javax.xml.transform.Source source, Class declaredType ) - throws JAXBException; - - /** - * Unmarshal XML data from the specified pull parser and return the - * resulting content tree. - * - *

- * Implements Unmarshal Global Root Element. - * - *

- * This method assumes that the parser is on a START_DOCUMENT or - * START_ELEMENT event. Unmarshalling will be done from this - * start event to the corresponding end event. If this method - * returns successfully, the {@code reader} will be pointing at - * the token right after the end event. - * - * @param reader - * The parser to be read. - * @return - * the newly created root object of the java content tree. - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If the {@code reader} parameter is null - * @throws IllegalStateException - * If {@code reader} is not pointing to a START_DOCUMENT or - * START_ELEMENT event. - * @since 1.6, JAXB 2.0 - * @see #unmarshal(javax.xml.stream.XMLStreamReader, Class) - */ - public Object unmarshal( javax.xml.stream.XMLStreamReader reader ) - throws JAXBException; - - /** - * Unmarshal root element to JAXB mapped {@code declaredType} - * and return the resulting content tree. - * - *

- * This method implements unmarshal by declaredType. - *

- * This method assumes that the parser is on a START_DOCUMENT or - * START_ELEMENT event. Unmarshalling will be done from this - * start event to the corresponding end event. If this method - * returns successfully, the {@code reader} will be pointing at - * the token right after the end event. - * - * @param reader - * The parser to be read. - * @param declaredType - * appropriate JAXB mapped class to hold {@code reader}'s START_ELEMENT XML data. - * - * @return content tree rooted by JAXB Element representation - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If any parameter is null - * @since 1.6, JAXB 2.0 - */ - public JAXBElement unmarshal( javax.xml.stream.XMLStreamReader reader, Class declaredType ) throws JAXBException; - - /** - * Unmarshal XML data from the specified pull parser and return the - * resulting content tree. - * - *

- * This method is an Unmarshal Global Root method. - * - *

- * This method assumes that the parser is on a START_DOCUMENT or - * START_ELEMENT event. Unmarshalling will be done from this - * start event to the corresponding end event. If this method - * returns successfully, the {@code reader} will be pointing at - * the token right after the end event. - * - * @param reader - * The parser to be read. - * @return - * the newly created root object of the java content tree. - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If the {@code reader} parameter is null - * @throws IllegalStateException - * If {@code reader} is not pointing to a START_DOCUMENT or - * START_ELEMENT event. - * @since 1.6, JAXB 2.0 - * @see #unmarshal(javax.xml.stream.XMLEventReader, Class) - */ - public Object unmarshal( javax.xml.stream.XMLEventReader reader ) - throws JAXBException; - - /** - * Unmarshal root element to JAXB mapped {@code declaredType} - * and return the resulting content tree. - * - *

- * This method implements unmarshal by declaredType. - * - *

- * This method assumes that the parser is on a START_DOCUMENT or - * START_ELEMENT event. Unmarshalling will be done from this - * start event to the corresponding end event. If this method - * returns successfully, the {@code reader} will be pointing at - * the token right after the end event. - * - * @param reader - * The parser to be read. - * @param declaredType - * appropriate JAXB mapped class to hold {@code reader}'s START_ELEMENT XML data. - * - * @return content tree rooted by JAXB Element representation - * - * @throws JAXBException - * If any unexpected errors occur while unmarshalling - * @throws UnmarshalException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Unmarshaller} is unable to perform the XML to Java - * binding. See Unmarshalling XML Data - * @throws IllegalArgumentException - * If any parameter is null - * @since 1.6, JAXB 2.0 - */ - public JAXBElement unmarshal( javax.xml.stream.XMLEventReader reader, Class declaredType ) throws JAXBException; - - /** - * Get an unmarshaller handler object that can be used as a component in - * an XML pipeline. - * - *

- * The JAXB Provider can return the same handler object for multiple - * invocations of this method. In other words, this method does not - * necessarily create a new instance of {@code UnmarshallerHandler}. If the - * application needs to use more than one {@code UnmarshallerHandler}, it - * should create more than one {@code Unmarshaller}. - * - * @return the unmarshaller handler object - * @see UnmarshallerHandler - */ - public UnmarshallerHandler getUnmarshallerHandler(); - - /** - * Specifies whether or not the default validation mechanism of the - * {@code Unmarshaller} should validate during unmarshal operations. - * By default, the {@code Unmarshaller} does not validate. - *

- * This method may only be invoked before or after calling one of the - * unmarshal methods. - *

- * This method only controls the JAXB Provider's default unmarshal-time - * validation mechanism - it has no impact on clients that specify their - * own validating SAX 2.0 compliant parser. Clients that specify their - * own unmarshal-time validation mechanism may wish to turn off the JAXB - * Provider's default validation mechanism via this API to avoid "double - * validation". - *

- * This method is deprecated as of JAXB 2.0 - please use the new - * {@link #setSchema(javax.xml.validation.Schema)} API. - * - * @param validating true if the Unmarshaller should validate during - * unmarshal, false otherwise - * @throws JAXBException if an error occurred while enabling or disabling - * validation at unmarshal time - * @throws UnsupportedOperationException could be thrown if this method is - * invoked on an Unmarshaller created from a JAXBContext referencing - * JAXB 2.0 mapped classes - * @deprecated since JAXB2.0, please see {@link #setSchema(javax.xml.validation.Schema)} - */ - public void setValidating( boolean validating ) - throws JAXBException; - - /** - * Indicates whether or not the {@code Unmarshaller} is configured to - * validate during unmarshal operations. - *

- * This API returns the state of the JAXB Provider's default unmarshal-time - * validation mechanism. - *

- * This method is deprecated as of JAXB 2.0 - please use the new - * {@link #getSchema()} API. - * - * @return true if the Unmarshaller is configured to validate during - * unmarshal operations, false otherwise - * @throws JAXBException if an error occurs while retrieving the validating - * flag - * @throws UnsupportedOperationException could be thrown if this method is - * invoked on an Unmarshaller created from a JAXBContext referencing - * JAXB 2.0 mapped classes - * @deprecated since JAXB2.0, please see {@link #getSchema()} - */ - public boolean isValidating() - throws JAXBException; - - /** - * Allow an application to register a {@code ValidationEventHandler}. - *

- * The {@code ValidationEventHandler} will be called by the JAXB Provider - * if any validation errors are encountered during calls to any of the - * unmarshal methods. If the client application does not register a - * {@code ValidationEventHandler} before invoking the unmarshal methods, - * then {@code ValidationEvents} will be handled by the default event - * handler which will terminate the unmarshal operation after the first - * error or fatal error is encountered. - *

- * Calling this method with a null parameter will cause the Unmarshaller - * to revert back to the default event handler. - * - * @param handler the validation event handler - * @throws JAXBException if an error was encountered while setting the - * event handler - */ - public void setEventHandler( ValidationEventHandler handler ) - throws JAXBException; - - /** - * Return the current event handler or the default event handler if one - * hasn't been set. - * - * @return the current ValidationEventHandler or the default event handler - * if it hasn't been set - * @throws JAXBException if an error was encountered while getting the - * current event handler - */ - public ValidationEventHandler getEventHandler() - throws JAXBException; - - /** - * Set the particular property in the underlying implementation of - * {@code Unmarshaller}. This method can only be used to set one of - * the standard JAXB defined properties above or a provider specific - * property. Attempting to set an undefined property will result in - * a PropertyException being thrown. See - * Supported Properties. - * - * @param name the name of the property to be set. This value can either - * be specified using one of the constant fields or a user - * supplied string. - * @param value the value of the property to be set - * - * @throws PropertyException when there is an error processing the given - * property or value - * @throws IllegalArgumentException - * If the name parameter is null - */ - public void setProperty( String name, Object value ) - throws PropertyException; - - /** - * Get the particular property in the underlying implementation of - * {@code Unmarshaller}. This method can only be used to get one of - * the standard JAXB defined properties above or a provider specific - * property. Attempting to get an undefined property will result in - * a PropertyException being thrown. See - * Supported Properties. - * - * @param name the name of the property to retrieve - * @return the value of the requested property - * - * @throws PropertyException - * when there is an error retrieving the given property or value - * property name - * @throws IllegalArgumentException - * If the name parameter is null - */ - public Object getProperty( String name ) throws PropertyException; - - /** - * Specify the JAXP 1.3 {@link javax.xml.validation.Schema Schema} - * object that should be used to validate subsequent unmarshal operations - * against. Passing null into this method will disable validation. - *

- * This method replaces the deprecated {@link #setValidating(boolean) setValidating(boolean)} - * API. - * - *

- * Initially this property is set to {@code null}. - * - * @param schema Schema object to validate unmarshal operations against or null to disable validation - * @throws UnsupportedOperationException could be thrown if this method is - * invoked on an Unmarshaller created from a JAXBContext referencing - * JAXB 1.0 mapped classes - * @since 1.6, JAXB 2.0 - */ - public void setSchema( javax.xml.validation.Schema schema ); - - /** - * Get the JAXP 1.3 {@link javax.xml.validation.Schema Schema} object - * being used to perform unmarshal-time validation. If there is no - * Schema set on the unmarshaller, then this method will return null - * indicating that unmarshal-time validation will not be performed. - *

- * This method provides replacement functionality for the deprecated - * {@link #isValidating()} API as well as access to the Schema object. - * To determine if the Unmarshaller has validation enabled, simply - * test the return type for null: - *

{@code
-     *   boolean isValidating = u.getSchema()!=null;
-     * }
- * - * @return the Schema object being used to perform unmarshal-time - * validation or null if not present - * @throws UnsupportedOperationException could be thrown if this method is - * invoked on an Unmarshaller created from a JAXBContext referencing - * JAXB 1.0 mapped classes - * @since 1.6, JAXB 2.0 - */ - public javax.xml.validation.Schema getSchema(); - - /** - * Associates a configured instance of {@link XmlAdapter} with this unmarshaller. - * - *

- * This is a convenience method that invokes {@code setAdapter(adapter.getClass(),adapter);}. - * - * @see #setAdapter(Class,XmlAdapter) - * @throws IllegalArgumentException - * if the adapter parameter is null. - * @throws UnsupportedOperationException - * if invoked agains a JAXB 1.0 implementation. - * @since 1.6, JAXB 2.0 - */ - public void setAdapter( XmlAdapter adapter ); - - /** - * Associates a configured instance of {@link XmlAdapter} with this unmarshaller. - * - *

- * Every unmarshaller internally maintains a - * {@link java.util.Map}<{@link Class},{@link XmlAdapter}>, - * which it uses for unmarshalling classes whose fields/methods are annotated - * with {@link javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter}. - * - *

- * This method allows applications to use a configured instance of {@link XmlAdapter}. - * When an instance of an adapter is not given, an unmarshaller will create - * one by invoking its default constructor. - * - * @param type - * The type of the adapter. The specified instance will be used when - * {@link javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter#value()} - * refers to this type. - * @param adapter - * The instance of the adapter to be used. If null, it will un-register - * the current adapter set for this type. - * @throws IllegalArgumentException - * if the type parameter is null. - * @throws UnsupportedOperationException - * if invoked agains a JAXB 1.0 implementation. - * @since 1.6, JAXB 2.0 - */ - public void setAdapter( Class type, A adapter ); - - /** - * Gets the adapter associated with the specified type. - * - * This is the reverse operation of the {@link #setAdapter} method. - * - * @throws IllegalArgumentException - * if the type parameter is null. - * @throws UnsupportedOperationException - * if invoked agains a JAXB 1.0 implementation. - * @since 1.6, JAXB 2.0 - */ - public A getAdapter( Class type ); - - /** - *

Associate a context that resolves cid's, content-id URIs, to - * binary data passed as attachments.

- *

Unmarshal time validation, enabled via {@link #setSchema(Schema)}, - * must be supported even when unmarshaller is performing XOP processing. - *

- * - * @throws IllegalStateException if attempt to concurrently call this - * method during a unmarshal operation. - */ - void setAttachmentUnmarshaller(AttachmentUnmarshaller au); - - AttachmentUnmarshaller getAttachmentUnmarshaller(); - - /** - *

- * Register an instance of an implementation of this class with {@link Unmarshaller} to externally listen - * for unmarshal events. - *

- *

- * This class enables pre and post processing of an instance of a JAXB mapped class - * as XML data is unmarshalled into it. The event callbacks are called when unmarshalling - * XML content into a JAXBElement instance or a JAXB mapped class that represents a complex type definition. - * The event callbacks are not called when unmarshalling to an instance of a - * Java datatype that represents a simple type definition. - *

- *

- * External listener is one of two different mechanisms for defining unmarshal event callbacks. - * See Unmarshal Event Callbacks for an overview. - *

- * (@link #setListener(Listener)} - * (@link #getListener()} - * - * @since 1.6, JAXB 2.0 - */ - public static abstract class Listener { - /** - *

- * Callback method invoked before unmarshalling into {@code target}. - *

- *

- * This method is invoked immediately after {@code target} was created and - * before the unmarshalling of this object begins. Note that - * if the class of {@code target} defines its own {@code beforeUnmarshal} method, - * the class specific callback method is invoked before this method is invoked. - * - * @param target non-null instance of JAXB mapped class prior to unmarshalling into it. - * @param parent instance of JAXB mapped class that will eventually reference {@code target}. - * {@code null} when {@code target} is root element. - */ - public void beforeUnmarshal(Object target, Object parent) { - } - - /** - *

- * Callback method invoked after unmarshalling XML data into {@code target}. - *

- *

- * This method is invoked after all the properties (except IDREF) - * are unmarshalled into {@code target}, - * but before {@code target} is set into its {@code parent} object. - * Note that if the class of {@code target} defines its own {@code afterUnmarshal} method, - * the class specific callback method is invoked before this method is invoked. - * - * @param target non-null instance of JAXB mapped class prior to unmarshalling into it. - * @param parent instance of JAXB mapped class that will reference {@code target}. - * {@code null} when {@code target} is root element. - */ - public void afterUnmarshal(Object target, Object parent) { - } - } - - /** - *

- * Register unmarshal event callback {@link Listener} with this {@link Unmarshaller}. - * - *

- * There is only one Listener per Unmarshaller. Setting a Listener replaces the previous set Listener. - * One can unregister current Listener by setting listener to {@code null}. - * - * @param listener provides unmarshal event callbacks for this {@link Unmarshaller} - * @since 1.6, JAXB 2.0 - */ - public void setListener(Listener listener); - - /** - *

Return {@link Listener} registered with this {@link Unmarshaller}. - * - * @return registered {@link Listener} or {@code null} - * if no Listener is registered with this Unmarshaller. - * @since 1.6, JAXB 2.0 - */ - public Listener getListener(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/UnmarshallerHandler.java 2018-01-30 20:39:34.000000000 -0500 +++ /dev/null 2018-01-30 20:39:34.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -import org.xml.sax.ContentHandler; - -/** - * Unmarshaller implemented as SAX ContentHandler. - * - *

- * Applications can use this interface to use their JAXB provider as a component - * in an XML pipeline. For example: - * - *

- *       JAXBContext context = JAXBContext.newInstance( "org.acme.foo" );
- *
- *       Unmarshaller unmarshaller = context.createUnmarshaller();
- *
- *       UnmarshallerHandler unmarshallerHandler = unmarshaller.getUnmarshallerHandler();
- *
- *       SAXParserFactory spf = SAXParserFactory.newInstance();
- *       spf.setNamespaceAware( true );
- *
- *       XMLReader xmlReader = spf.newSAXParser().getXMLReader();
- *       xmlReader.setContentHandler( unmarshallerHandler );
- *       xmlReader.parse(new InputSource( new FileInputStream( XML_FILE ) ) );
- *
- *       MyObject myObject= (MyObject)unmarshallerHandler.getResult();
- * 
- * - *

- * This interface is reusable: even if the user fails to unmarshal - * an object, s/he can still start a new round of unmarshalling. - * - * @author

  • Kohsuke KAWAGUCHI, Sun Microsystems, Inc.
- * @see Unmarshaller#getUnmarshallerHandler() - * @since 1.6, JAXB 1.0 - */ -public interface UnmarshallerHandler extends ContentHandler -{ - /** - * Obtains the unmarshalled result. - * - * This method can be called only after this handler - * receives the endDocument SAX event. - * - * @exception IllegalStateException - * if this method is called before this handler - * receives the endDocument event. - * - * @exception JAXBException - * if there is any unmarshalling error. - * Note that the implementation is allowed to throw SAXException - * during the parsing when it finds an error. - * - * @return - * always return a non-null valid object which was unmarshalled. - */ - Object getResult() throws JAXBException, IllegalStateException; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEvent.java 2018-01-30 20:39:35.000000000 -0500 +++ /dev/null 2018-01-30 20:39:35.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 javax.xml.bind; - -/** - * This event indicates that a problem was encountered while validating the - * incoming XML data during an unmarshal operation, while performing - * on-demand validation of the Java content tree, or while marshalling the - * Java content tree back to XML data. - * - * @author
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see Validator - * @see ValidationEventHandler - * @since 1.6, JAXB 1.0 - */ -public interface ValidationEvent { - - /** - * Conditions that are not errors or fatal errors as defined by the - * XML 1.0 recommendation - */ - public static final int WARNING = 0; - - /** - * Conditions that correspond to the definition of "error" in section - * 1.2 of the W3C XML 1.0 Recommendation - */ - public static final int ERROR = 1; - - /** - * Conditions that correspond to the definition of "fatal error" in section - * 1.2 of the W3C XML 1.0 Recommendation - */ - public static final int FATAL_ERROR = 2; - - /** - * Retrieve the severity code for this warning/error. - * - *

- * Must be one of {@code ValidationEvent.WARNING}, - * {@code ValidationEvent.ERROR}, or {@code ValidationEvent.FATAL_ERROR}. - * - * @return the severity code for this warning/error - */ - public int getSeverity(); - - /** - * Retrieve the text message for this warning/error. - * - * @return the text message for this warning/error or null if one wasn't set - */ - public String getMessage(); - - /** - * Retrieve the linked exception for this warning/error. - * - * @return the linked exception for this warning/error or null if one - * wasn't set - */ - public Throwable getLinkedException(); - - /** - * Retrieve the locator for this warning/error. - * - * @return the locator that indicates where the warning/error occurred - */ - public ValidationEventLocator getLocator(); - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEventHandler.java 2018-01-30 20:39:35.000000000 -0500 +++ /dev/null 2018-01-30 20:39:35.000000000 -0500 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -/** - * A basic event handler interface for validation errors. - * - *

- * If an application needs to implement customized event handling, it must - * implement this interface and then register it with either the - * {@link Unmarshaller#setEventHandler(ValidationEventHandler) Unmarshaller}, - * the {@link Validator#setEventHandler(ValidationEventHandler) Validator}, or - * the {@link Marshaller#setEventHandler(ValidationEventHandler) Marshaller}. - * The JAXB Provider will then report validation errors and warnings encountered - * during the unmarshal, marshal, and validate operations to these event - * handlers. - * - *

- * If the {@code handleEvent} method throws an unchecked runtime exception, - * the JAXB Provider must treat that as if the method returned false, effectively - * terminating whatever operation was in progress at the time (unmarshal, - * validate, or marshal). - * - *

- * Modifying the Java content tree within your event handler is undefined - * by the specification and may result in unexpected behaviour. - * - *

- * Failing to return false from the {@code handleEvent} method after - * encountering a fatal error is undefined by the specification and may result - * in unexpected behavior. - * - *

- * Default Event Handler - *

- * See: Validator javadocs - *
- * - * @author
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • - *
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • - *
  • Joe Fialli, Sun Microsystems, Inc.
- * @see Unmarshaller - * @see Validator - * @see Marshaller - * @see ValidationEvent - * @see javax.xml.bind.util.ValidationEventCollector - * @since 1.6, JAXB 1.0 - */ -public interface ValidationEventHandler { - /** - * Receive notification of a validation warning or error. - * - * The ValidationEvent will have a - * {@link ValidationEventLocator ValidationEventLocator} embedded in it that - * indicates where the error or warning occurred. - * - *

- * If an unchecked runtime exception is thrown from this method, the JAXB - * provider will treat it as if the method returned false and interrupt - * the current unmarshal, validate, or marshal operation. - * - * @param event the encapsulated validation event information. It is a - * provider error if this parameter is null. - * @return true if the JAXB Provider should attempt to continue the current - * unmarshal, validate, or marshal operation after handling this - * warning/error, false if the provider should terminate the current - * operation with the appropriate {@code UnmarshalException}, - * {@code ValidationException}, or {@code MarshalException}. - * @throws IllegalArgumentException if the event object is null. - */ - public boolean handleEvent( ValidationEvent event ); - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/ValidationEventLocator.java 2018-01-30 20:39:36.000000000 -0500 +++ /dev/null 2018-01-30 20:39:36.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -/** - * Encapsulate the location of a ValidationEvent. - * - *

- * The {@code ValidationEventLocator} indicates where the {@code ValidationEvent} - * occurred. Different fields will be set depending on the type of - * validation that was being performed when the error or warning was detected. - * For example, on-demand validation would produce locators that contained - * references to objects in the Java content tree while unmarshal-time - * validation would produce locators containing information appropriate to the - * source of the XML data (file, url, Node, etc). - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
  • - *
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • - *
  • Joe Fialli, Sun Microsystems, Inc.
- * @see Validator - * @see ValidationEvent - * @since 1.6, JAXB 1.0 - */ -public interface ValidationEventLocator { - - /** - * Return the name of the XML source as a URL if available - * - * @return the name of the XML source as a URL or null if unavailable - */ - public java.net.URL getURL(); - - /** - * Return the byte offset if available - * - * @return the byte offset into the input source or -1 if unavailable - */ - public int getOffset(); - - /** - * Return the line number if available - * - * @return the line number or -1 if unavailable - */ - public int getLineNumber(); - - /** - * Return the column number if available - * - * @return the column number or -1 if unavailable - */ - public int getColumnNumber(); - - /** - * Return a reference to the object in the Java content tree if available - * - * @return a reference to the object in the Java content tree or null if - * unavailable - */ - public java.lang.Object getObject(); - - /** - * Return a reference to the DOM Node if available - * - * @return a reference to the DOM Node or null if unavailable - */ - public org.w3c.dom.Node getNode(); - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/ValidationException.java 2018-01-30 20:39:37.000000000 -0500 +++ /dev/null 2018-01-30 20:39:37.000000000 -0500 @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -/** - * This exception indicates that an error has occurred while performing - * a validate operation. - * - *

- * The {@code ValidationEventHandler} can cause this exception to be thrown - * during the validate operations. See - * {@link ValidationEventHandler#handleEvent(ValidationEvent) - * ValidationEventHandler.handleEvent(ValidationEvent)}. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
- * @see JAXBException - * @see Validator - * @since 1.6, JAXB 1.0 - */ -public class ValidationException extends JAXBException { - - /** - * Construct an ValidationException with the specified detail message. The - * errorCode and linkedException will default to null. - * - * @param message a description of the exception - */ - public ValidationException(String message) { - this( message, null, null ); - } - - /** - * Construct an ValidationException with the specified detail message and vendor - * specific errorCode. The linkedException will default to null. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - */ - public ValidationException(String message, String errorCode) { - this( message, errorCode, null ); - } - - /** - * Construct an ValidationException with a linkedException. The detail message and - * vendor specific errorCode will default to null. - * - * @param exception the linked exception - */ - public ValidationException(Throwable exception) { - this( null, null, exception ); - } - - /** - * Construct an ValidationException with the specified detail message and - * linkedException. The errorCode will default to null. - * - * @param message a description of the exception - * @param exception the linked exception - */ - public ValidationException(String message, Throwable exception) { - this( message, null, exception ); - } - - /** - * Construct an ValidationException with the specified detail message, vendor - * specific errorCode, and linkedException. - * - * @param message a description of the exception - * @param errorCode a string specifying the vendor specific error code - * @param exception the linked exception - */ - public ValidationException(String message, String errorCode, Throwable exception) { - super( message, errorCode, exception ); - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/Validator.java 2018-01-30 20:39:38.000000000 -0500 +++ /dev/null 2018-01-30 20:39:38.000000000 -0500 @@ -1,285 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind; - -/** - * As of JAXB 2.0, this class is deprecated and optional. - *

- * The {@code Validator} class is responsible for controlling the validation - * of content trees during runtime. - * - *

- * - * Three Forms of Validation
- *

- *
- *
Unmarshal-Time Validation
- *
This form of validation enables a client application to receive - * information about validation errors and warnings detected while - * unmarshalling XML data into a Java content tree and is completely - * orthogonal to the other types of validation. To enable or disable - * it, see the javadoc for - * {@link Unmarshaller#setValidating(boolean) Unmarshaller.setValidating}. - * All JAXB 1.0 Providers are required to support this operation. - *
- * - *
On-Demand Validation
- *
This form of validation enables a client application to receive - * information about validation errors and warnings detected in the - * Java content tree. At any point, client applications can call - * the {@link Validator#validate(Object) Validator.validate} method - * on the Java content tree (or any sub-tree of it). All JAXB 1.0 - * Providers are required to support this operation. - *
- * - *
Fail-Fast Validation
- *
This form of validation enables a client application to receive - * immediate feedback about modifications to the Java content tree - * that violate type constraints on Java Properties as defined in - * the specification. JAXB Providers are not required support - * this type of validation. Of the JAXB Providers that do support - * this type of validation, some may require you to decide at schema - * compile time whether or not a client application will be allowed - * to request fail-fast validation at runtime. - *
- *
- *
- * - *

- * The {@code Validator} class is responsible for managing On-Demand Validation. - * The {@code Unmarshaller} class is responsible for managing Unmarshal-Time - * Validation during the unmarshal operations. Although there is no formal - * method of enabling validation during the marshal operations, the - * {@code Marshaller} may detect errors, which will be reported to the - * {@code ValidationEventHandler} registered on it. - * - *

- * - * Using the Default EventHandler
- *

- * If the client application does not set an event handler on their - * {@code Validator}, {@code Unmarshaller}, or {@code Marshaller} prior to - * calling the validate, unmarshal, or marshal methods, then a default event - * handler will receive notification of any errors or warnings encountered. - * The default event handler will cause the current operation to halt after - * encountering the first error or fatal error (but will attempt to continue - * after receiving warnings). - *
- * - *

- * - * Handling Validation Events
- *

- * There are three ways to handle events encountered during the unmarshal, - * validate, and marshal operations: - *
- *
Use the default event handler
- *
The default event handler will be used if you do not specify one - * via the {@code setEventHandler} API's on {@code Validator}, - * {@code Unmarshaller}, or {@code Marshaller}. - *
- * - *
Implement and register a custom event handler
- *
Client applications that require sophisticated event processing - * can implement the {@code ValidationEventHandler} interface and - * register it with the {@code Unmarshaller} and/or - * {@code Validator}. - *
- * - *
Use the {@link javax.xml.bind.util.ValidationEventCollector ValidationEventCollector} - * utility
- *
For convenience, a specialized event handler is provided that - * simply collects any {@code ValidationEvent} objects created - * during the unmarshal, validate, and marshal operations and - * returns them to the client application as a - * {@code java.util.Collection}. - *
- *
- *
- * - *

- * Validation and Well-Formedness
- *

- *

- * Validation events are handled differently depending on how the client - * application is configured to process them as described in the previous - * section. However, there are certain cases where a JAXB Provider indicates - * that it is no longer able to reliably detect and report errors. In these - * cases, the JAXB Provider will set the severity of the ValidationEvent to - * FATAL_ERROR to indicate that the unmarshal, validate, or marshal operations - * should be terminated. The default event handler and - * {@code ValidationEventCollector} utility class must terminate processing - * after being notified of a fatal error. Client applications that supply their - * own {@code ValidationEventHandler} should also terminate processing after - * being notified of a fatal error. If not, unexpected behaviour may occur. - *

- * - *

- * - * Supported Properties
- *

- *

- * There currently are not any properties required to be supported by all - * JAXB Providers on Validator. However, some providers may support - * their own set of provider specific properties. - *

- * - * - * @author
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see JAXBContext - * @see Unmarshaller - * @see ValidationEventHandler - * @see ValidationEvent - * @see javax.xml.bind.util.ValidationEventCollector - * @since 1.6, JAXB 1.0 - * @deprecated since JAXB 2.0 - */ -public interface Validator { - - /** - * Allow an application to register a validation event handler. - *

- * The validation event handler will be called by the JAXB Provider if any - * validation errors are encountered during calls to - * {@link #validate(Object) validate}. If the client application does not - * register a validation event handler before invoking the validate method, - * then validation events will be handled by the default event handler which - * will terminate the validate operation after the first error or fatal error - * is encountered. - *

- * Calling this method with a null parameter will cause the Validator - * to revert back to the default default event handler. - * - * @param handler the validation event handler - * @throws JAXBException if an error was encountered while setting the - * event handler - * @deprecated since JAXB2.0 - */ - public void setEventHandler( ValidationEventHandler handler ) - throws JAXBException; - - /** - * Return the current event handler or the default event handler if one - * hasn't been set. - * - * @return the current ValidationEventHandler or the default event handler - * if it hasn't been set - * @throws JAXBException if an error was encountered while getting the - * current event handler - * @deprecated since JAXB2.0 - */ - public ValidationEventHandler getEventHandler() - throws JAXBException; - - /** - * Validate the Java content tree starting at {@code subrootObj}. - *

- * Client applications can use this method to validate Java content trees - * on-demand at runtime. This method can be used to validate any arbitrary - * subtree of the Java content tree. Global constraint checking will not - * be performed as part of this operation (i.e. ID/IDREF constraints). - * - * @param subrootObj the obj to begin validation at - * @throws JAXBException if any unexpected problem occurs during validation - * @throws ValidationException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Validator} is unable to validate the content tree rooted - * at {@code subrootObj} - * @throws IllegalArgumentException - * If the subrootObj parameter is null - * @return true if the subtree rooted at {@code subrootObj} is valid, false - * otherwise - * @deprecated since JAXB2.0 - */ - public boolean validate( Object subrootObj ) throws JAXBException; - - /** - * Validate the Java content tree rooted at {@code rootObj}. - *

- * Client applications can use this method to validate Java content trees - * on-demand at runtime. This method is used to validate an entire Java - * content tree. Global constraint checking will be performed as - * part of this operation (i.e. ID/IDREF constraints). - * - * @param rootObj the root obj to begin validation at - * @throws JAXBException if any unexpected problem occurs during validation - * @throws ValidationException - * If the {@link ValidationEventHandler ValidationEventHandler} - * returns false from its {@code handleEvent} method or the - * {@code Validator} is unable to validate the content tree rooted - * at {@code rootObj} - * @throws IllegalArgumentException - * If the rootObj parameter is null - * @return true if the tree rooted at {@code rootObj} is valid, false - * otherwise - * @deprecated since JAXB2.0 - */ - public boolean validateRoot( Object rootObj ) throws JAXBException; - - /** - * Set the particular property in the underlying implementation of - * {@code Validator}. This method can only be used to set one of - * the standard JAXB defined properties above or a provider specific - * property. Attempting to set an undefined property will result in - * a PropertyException being thrown. See - * Supported Properties. - * - * @param name the name of the property to be set. This value can either - * be specified using one of the constant fields or a user - * supplied string. - * @param value the value of the property to be set - * - * @throws PropertyException when there is an error processing the given - * property or value - * @throws IllegalArgumentException - * If the name parameter is null - * @deprecated since JAXB2.0 - */ - public void setProperty( String name, Object value ) - throws PropertyException; - - /** - * Get the particular property in the underlying implementation of - * {@code Validator}. This method can only be used to get one of - * the standard JAXB defined properties above or a provider specific - * property. Attempting to get an undefined property will result in - * a PropertyException being thrown. See - * Supported Properties. - * - * @param name the name of the property to retrieve - * @return the value of the requested property - * - * @throws PropertyException - * when there is an error retrieving the given property or value - * property name - * @throws IllegalArgumentException - * If the name parameter is null - * @deprecated since JAXB2.0 - */ - public Object getProperty( String name ) throws PropertyException; - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/WhiteSpaceProcessor.java 2018-01-30 20:39:39.000000000 -0500 +++ /dev/null 2018-01-30 20:39:39.000000000 -0500 @@ -1,198 +0,0 @@ -/* - * Copyright (c) 2007, 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 javax.xml.bind; - -/** - * Processes white space normalization. - * - * @since 1.0 - */ -abstract class WhiteSpaceProcessor { - -// benchmarking (see test/src/ReplaceTest.java in the CVS Attic) -// showed that this code is slower than the current code. -// -// public static String replace(String text) { -// final int len = text.length(); -// StringBuffer result = new StringBuffer(len); -// -// for (int i = 0; i < len; i++) { -// char ch = text.charAt(i); -// if (isWhiteSpace(ch)) -// result.append(' '); -// else -// result.append(ch); -// } -// -// return result.toString(); -// } - - public static String replace(String text) { - return replace( (CharSequence)text ).toString(); - } - - /** - * @since 2.0 - */ - public static CharSequence replace(CharSequence text) { - int i=text.length()-1; - - // look for the first whitespace char. - while( i>=0 && !isWhiteSpaceExceptSpace(text.charAt(i)) ) - i--; - - if( i<0 ) - // no such whitespace. replace(text)==text. - return text; - - // we now know that we need to modify the text. - // allocate a char array to do it. - StringBuilder buf = new StringBuilder(text); - - buf.setCharAt(i--,' '); - for( ; i>=0; i-- ) - if( isWhiteSpaceExceptSpace(buf.charAt(i))) - buf.setCharAt(i,' '); - - return new String(buf); - } - - /** - * Equivalent of {@link String#trim()}. - * @since 2.0 - */ - public static CharSequence trim(CharSequence text) { - int len = text.length(); - int start = 0; - - while( startstart && isWhiteSpace(text.charAt(end)) ) - end--; - - if(start==0 && end==len-1) - return text; // no change - else - return text.subSequence(start,end+1); - } - - public static String collapse(String text) { - return collapse( (CharSequence)text ).toString(); - } - - /** - * This is usually the biggest processing bottleneck. - * - * @since 2.0 - */ - public static CharSequence collapse(CharSequence text) { - int len = text.length(); - - // most of the texts are already in the collapsed form. - // so look for the first whitespace in the hope that we will - // never see it. - int s=0; - while(s 0 && result.charAt(len - 1) == ' ') - result.setLength(len - 1); - // whitespaces are already collapsed, - // so all we have to do is to remove the last one character - // if it's a whitespace. - - return result; - } - - /** - * Returns true if the specified string is all whitespace. - */ - public static final boolean isWhiteSpace(CharSequence s) { - for( int i=s.length()-1; i>=0; i-- ) - if(!isWhiteSpace(s.charAt(i))) - return false; - return true; - } - - /** returns true if the specified char is a white space character. */ - public static final boolean isWhiteSpace(char ch) { - // most of the characters are non-control characters. - // so check that first to quickly return false for most of the cases. - if( ch>0x20 ) return false; - - // other than we have to do four comparisons. - return ch == 0x9 || ch == 0xA || ch == 0xD || ch == 0x20; - } - - /** - * Returns true if the specified char is a white space character - * but not 0x20. - */ - protected static final boolean isWhiteSpaceExceptSpace(char ch) { - // most of the characters are non-control characters. - // so check that first to quickly return false for most of the cases. - if( ch>=0x20 ) return false; - - // other than we have to do four comparisons. - return ch == 0x9 || ch == 0xA || ch == 0xD; - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/DomHandler.java 2018-01-30 20:39:39.000000000 -0500 +++ /dev/null 2018-01-30 20:39:39.000000000 -0500 @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.annotation; - -import javax.xml.bind.ValidationEventHandler; -import javax.xml.transform.Result; -import javax.xml.transform.Source; - -/** - * Converts an element (and its descendants) - * from/to DOM (or similar) representation. - * - *

- * Implementations of this interface will be used in conjunction with - * {@link XmlAnyElement} annotation to map an element of XML into a representation - * of infoset such as W3C DOM. - * - *

- * Implementations hide how a portion of XML is converted into/from such - * DOM-like representation, allowing JAXB providers to work with arbitrary - * such library. - * - *

- * This interface is intended to be implemented by library writers - * and consumed by JAXB providers. None of those methods are intended to - * be called from applications. - * - * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.0 - */ -public interface DomHandler { - /** - * When a JAXB provider needs to unmarshal a part of a document into an - * infoset representation, it first calls this method to create a - * {@link Result} object. - * - *

- * A JAXB provider will then send a portion of the XML - * into the given result. Such a portion always form a subtree - * of the whole XML document rooted at an element. - * - * @param errorHandler - * if any error happens between the invocation of this method - * and the invocation of {@link #getElement(Result)}, they - * must be reported to this handler. - * - * The caller must provide a non-null error handler. - * - * The {@link Result} object created from this method - * may hold a reference to this error handler. - * - * @return - * null if the operation fails. The error must have been reported - * to the error handler. - */ - ResultT createUnmarshaller( ValidationEventHandler errorHandler ); - - /** - * Once the portion is sent to the {@link Result}. This method is called - * by a JAXB provider to obtain the unmarshalled element representation. - * - *

- * Multiple invocations of this method may return different objects. - * This method can be invoked only when the whole sub-tree are fed - * to the {@link Result} object. - * - * @param rt - * The {@link Result} object created by {@link #createUnmarshaller(ValidationEventHandler)}. - * - * @return - * null if the operation fails. The error must have been reported - * to the error handler. - */ - ElementT getElement(ResultT rt); - - /** - * This method is called when a JAXB provider needs to marshal an element - * to XML. - * - *

- * If non-null, the returned {@link Source} must contain a whole document - * rooted at one element, which will then be weaved into a bigger document - * that the JAXB provider is marshalling. - * - * @param errorHandler - * Receives any errors happened during the process of converting - * an element into a {@link Source}. - * - * The caller must provide a non-null error handler. - * - * @return - * null if there was an error. The error should have been reported - * to the handler. - */ - Source marshal( ElementT n, ValidationEventHandler errorHandler ); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/W3CDomHandler.java 2018-01-30 20:39:40.000000000 -0500 +++ /dev/null 2018-01-30 20:39:40.000000000 -0500 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.annotation; - -import org.w3c.dom.Document; -import org.w3c.dom.DocumentFragment; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import javax.xml.bind.ValidationEventHandler; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.transform.Source; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.dom.DOMSource; - -/** - * {@link DomHandler} implementation for W3C DOM (org.w3c.dom package.) - * - * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.0 - */ -public class W3CDomHandler implements DomHandler { - - private DocumentBuilder builder; - - /** - * Default constructor. - * - * It is up to a JAXB provider to decide which DOM implementation - * to use or how that is configured. - */ - public W3CDomHandler() { - this.builder = null; - } - - /** - * Constructor that allows applications to specify which DOM implementation - * to be used. - * - * @param builder - * must not be null. JAXB uses this {@link DocumentBuilder} to create - * a new element. - */ - public W3CDomHandler(DocumentBuilder builder) { - if(builder==null) - throw new IllegalArgumentException(); - this.builder = builder; - } - - public DocumentBuilder getBuilder() { - return builder; - } - - public void setBuilder(DocumentBuilder builder) { - this.builder = builder; - } - - public DOMResult createUnmarshaller(ValidationEventHandler errorHandler) { - if(builder==null) - return new DOMResult(); - else - return new DOMResult(builder.newDocument()); - } - - public Element getElement(DOMResult r) { - // JAXP spec is ambiguous about what really happens in this case, - // so work defensively - Node n = r.getNode(); - if( n instanceof Document ) { - return ((Document)n).getDocumentElement(); - } - if( n instanceof Element ) - return (Element)n; - if( n instanceof DocumentFragment ) - return (Element)n.getChildNodes().item(0); - - // if the result object contains something strange, - // it is not a user problem, but it is a JAXB provider's problem. - // That's why we throw a runtime exception. - throw new IllegalStateException(n.toString()); - } - - public Source marshal(Element element, ValidationEventHandler errorHandler) { - return new DOMSource(element); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAccessOrder.java 2018-01-30 20:39:41.000000000 -0500 +++ /dev/null 2018-01-30 20:39:41.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.annotation; - -/** - * Used by XmlAccessorOrder to control the ordering of properties and - * fields in a JAXB bound class. - * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - * @see XmlAccessorOrder - */ - -public enum XmlAccessOrder { - /** - * The ordering of fields and properties in a class is undefined. - */ - UNDEFINED, - /** - * The ordering of fields and properties in a class is in - * alphabetical order as determined by the - * method java.lang.String.compareTo(String anotherString). - */ - ALPHABETICAL -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAccessType.java 2018-01-30 20:39:42.000000000 -0500 +++ /dev/null 2018-01-30 20:39:42.000000000 -0500 @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.annotation; - - - -/** - * Used by XmlAccessorType to control serialization of fields or - * properties. - * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - * @see XmlAccessorType - */ - -public enum XmlAccessType { - /** - * Every getter/setter pair in a JAXB-bound class will be automatically - * bound to XML, unless annotated by {@link XmlTransient}. - * - * Fields are bound to XML only when they are explicitly annotated - * by some of the JAXB annotations. - */ - PROPERTY, - /** - * Every non static, non transient field in a JAXB-bound class will be automatically - * bound to XML, unless annotated by {@link XmlTransient}. - * - * Getter/setter pairs are bound to XML only when they are explicitly annotated - * by some of the JAXB annotations. - */ - FIELD, - /** - * Every public getter/setter pair and every public field will be - * automatically bound to XML, unless annotated by {@link XmlTransient}. - * - * Fields or getter/setter pairs that are private, protected, or - * defaulted to package-only access are bound to XML only when they are - * explicitly annotated by the appropriate JAXB annotations. - */ - PUBLIC_MEMBER, - /** - * None of the fields or properties is bound to XML unless they - * are specifically annotated with some of the JAXB annotations. - */ - NONE -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAccessorOrder.java 2018-01-30 20:39:42.000000000 -0500 +++ /dev/null 2018-01-30 20:39:43.000000000 -0500 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.annotation; - -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.lang.annotation.Target; -import java.lang.annotation.Retention; -import java.lang.annotation.Inherited; - -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - *

Controls the ordering of fields and properties in a class.

- * - *

Usage

- * - *

{@code @XmlAccessorOrder} annotation can be used with the following - * program elements:

- * - *
    - *
  • package
  • - *
  • a top level class
  • - *
- * - *

See "Package Specification" in {@code javax.xml.bind} package javadoc for - * additional common information.

- * - *

The effective {@link XmlAccessOrder} on a class is determined - * as follows: - * - *

    - *
  • If there is a {@code @XmlAccessorOrder} on a class, then - * it is used.
  • - *
  • Otherwise, if a {@code @XmlAccessorOrder} exists on one of - * its super classes, then it is inherited (by the virtue of - * {@link Inherited}) - *
  • Otherwise, the {@code @XmlAccessorOrder} on the package - * of the class is used, if it's there. - *
  • Otherwise {@link XmlAccessOrder#UNDEFINED}. - *
- * - *

This annotation can be used with the following annotations: - * {@link XmlType}, {@link XmlRootElement}, {@link XmlAccessorType}, - * {@link XmlSchema}, {@link XmlSchemaType}, {@link XmlSchemaTypes}, - * , {@link XmlJavaTypeAdapter}. It can also be used with the - * following annotations at the package level: {@link XmlJavaTypeAdapter}. - * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - * @see XmlAccessOrder - */ - -@Inherited @Retention(RUNTIME) @Target({PACKAGE, TYPE}) -public @interface XmlAccessorOrder { - XmlAccessOrder value() default XmlAccessOrder.UNDEFINED; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAccessorType.java 2018-01-30 20:39:43.000000000 -0500 +++ /dev/null 2018-01-30 20:39:43.000000000 -0500 @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.annotation; - -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.lang.annotation.Target; -import java.lang.annotation.Retention; -import java.lang.annotation.Inherited; - -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - *

Controls whether fields or Javabean properties are serialized by default.

- * - *

Usage

- * - *

{@code @XmlAccessorType} annotation can be used with the following program elements:

- * - *
    - *
  • package
  • - *
  • a top level class
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *

This annotation provides control over the default serialization - * of properties and fields in a class. - * - *

The annotation {@code @XmlAccessorType} on a package applies to - * all classes in the package. The following inheritance - * semantics apply: - * - *

    - *
  • If there is a {@code @XmlAccessorType} on a class, then it - * is used.
  • - *
  • Otherwise, if a {@code @XmlAccessorType} exists on one of - * its super classes, then it is inherited. - *
  • Otherwise, the {@code @XmlAccessorType} on a package is - * inherited. - *
- *

Defaulting Rules:

- * - *

By default, if {@code @XmlAccessorType} on a package is absent, - * then the following package level annotation is assumed.

- *
- *   @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
- * 
- *

By default, if {@code @XmlAccessorType} on a class is absent, - * and none of its super classes is annotated with - * {@code @XmlAccessorType}, then the following default on the class - * is assumed:

- *
- *   @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
- * 
- *

This annotation can be used with the following annotations: - * {@link XmlType}, {@link XmlRootElement}, {@link XmlAccessorOrder}, - * {@link XmlSchema}, {@link XmlSchemaType}, {@link XmlSchemaTypes}, - * , {@link XmlJavaTypeAdapter}. It can also be used with the - * following annotations at the package level: {@link XmlJavaTypeAdapter}. - * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - * @see XmlAccessType - */ - -@Inherited @Retention(RUNTIME) @Target({PACKAGE, TYPE}) -public @interface XmlAccessorType { - - /** - * Specifies whether fields or properties are serialized. - * - * @see XmlAccessType - */ - XmlAccessType value() default XmlAccessType.PUBLIC_MEMBER; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyAttribute.java 2018-01-30 20:39:44.000000000 -0500 +++ /dev/null 2018-01-30 20:39:44.000000000 -0500 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.xml.bind.annotation; - -import javax.xml.namespace.QName; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import java.util.Map; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; - -/** - *

- * Maps a JavaBean property to a map of wildcard attributes. - * - *

Usage

- *

- * The {@code @XmlAnyAttribute} annotation can be used with the - * following program elements: - *

    - *
  • JavaBean property
  • - *
  • non static, non transient field
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - * The usage is subject to the following constraints: - *
    - *
  • At most one field or property in a class can be annotated - * with {@code @XmlAnyAttribute}.
  • - *
  • The type of the property or the field must {@code java.util.Map}
  • - *
- * - *

- * While processing attributes to be unmarshalled into a value class, - * each attribute that is not statically associated with another - * JavaBean property, via {@link XmlAttribute}, is entered into the - * wildcard attribute map represented by - * {@link Map}<{@link QName},{@link Object}>. The attribute QName is the - * map's key. The key's value is the String value of the attribute. - * - * @author Kohsuke Kawaguchi, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({FIELD,METHOD}) -public @interface XmlAnyAttribute { -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAnyElement.java 2018-01-30 20:39:45.000000000 -0500 +++ /dev/null 2018-01-30 20:39:45.000000000 -0500 @@ -1,287 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.xml.bind.annotation; - -import org.w3c.dom.Element; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import java.util.List; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Maps a JavaBean property to XML infoset representation and/or JAXB element. - * - *

- * This annotation serves as a "catch-all" property while unmarshalling - * xml content into a instance of a JAXB annotated class. It typically - * annotates a multi-valued JavaBean property, but it can occur on - * single value JavaBean property. During unmarshalling, each xml element - * that does not match a static @XmlElement or @XmlElementRef - * annotation for the other JavaBean properties on the class, is added to this - * "catch-all" property. - * - *

Usages:

- *
- * @XmlAnyElement
- * public {@link Element}[] others;
- *
- * // Collection of {@link Element} or JAXB elements.
- * @XmlAnyElement(lax="true")
- * public {@link Object}[] others;
- *
- * @XmlAnyElement
- * private List<{@link Element}> nodes;
- *
- * @XmlAnyElement
- * private {@link Element} node;
- * 
- * - *

Restriction usage constraints

- *

- * This annotation is mutually exclusive with - * {@link XmlElement}, {@link XmlAttribute}, {@link XmlValue}, - * {@link XmlElements}, {@link XmlID}, and {@link XmlIDREF}. - * - *

- * There can be only one {@link XmlAnyElement} annotated JavaBean property - * in a class and its super classes. - * - *

Relationship to other annotations

- *

- * This annotation can be used with {@link XmlJavaTypeAdapter}, so that users - * can map their own data structure to DOM, which in turn can be composed - * into XML. - * - *

- * This annotation can be used with {@link XmlMixed} like this: - *

- * // List of java.lang.String or DOM nodes.
- * @XmlAnyElement @XmlMixed
- * List<Object> others;
- * 
- * - * - *

Schema To Java example

- * - * The following schema would produce the following Java class: - *
{@code
- * 
- *   
- *     
- *     
- *     
- *   
- * 
- * }
- * - *
- * class Foo {
- *   int a;
- *   int b;
- *   @{@link XmlAnyElement}
- *   List<Element> any;
- * }
- * 
- * - * It can unmarshal instances like - * - *
{@code
- * 
- *   1
- *     // this will be bound to DOM, because unmarshalling is orderless
- *   3
- *   
- *   5     // this will be bound to DOM, because the annotation doesn't remember namespaces.
- * 
- * }
- * - * - * - * The following schema would produce the following Java class: - *
{@code
- * 
- *   
- *   
- *     
- *       
- *       
- *     
- *   
- * 
- * }
- * - *
- * class Bar extends Foo {
- *   int c;
- *   // Foo.getAny() also represents wildcard content for type definition bar.
- * }
- * 
- * - * - * It can unmarshal instances like - * - *
{@code
- * 
- *   1
- *     // this will be bound to DOM, because unmarshalling is orderless
- *   3
- *   
- *   5     // this now goes to Bar.c
- *     // this will go to Foo.any
- * 
- * }
- * - * - * - * - *

Using {@link XmlAnyElement} with {@link XmlElementRef}

- *

- * The {@link XmlAnyElement} annotation can be used with {@link XmlElementRef}s to - * designate additional elements that can participate in the content tree. - * - *

- * The following schema would produce the following Java class: - *

{@code
- * 
- *   
- *     
- *     
- *     
- *   
- * 
- * }
- * - *
- * class Foo {
- *   @{@link XmlAnyElement}(lax="true")
- *   @{@link XmlElementRefs}({
- *     @{@link XmlElementRef}(name="a", type="JAXBElement.class")
- *     @{@link XmlElementRef}(name="b", type="JAXBElement.class")
- *   })
- *   {@link List}<{@link Object}> others;
- * }
- *
- * @XmlRegistry
- * class ObjectFactory {
- *   ...
- *   @XmlElementDecl(name = "a", namespace = "", scope = Foo.class)
- *   {@link JAXBElement}<Integer> createFooA( Integer i ) { ... }
- *
- *   @XmlElementDecl(name = "b", namespace = "", scope = Foo.class)
- *   {@link JAXBElement}<Integer> createFooB( Integer i ) { ... }
- * 
- * - * It can unmarshal instances like - * - *
- *{@code }
- *{@code   1}     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
- *{@code   }  // this will unmarshal to a DOM {@link Element}.
- *{@code   3}     // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
- *{@code }
- * 
- * - * - * - * - *

W3C XML Schema "lax" wildcard emulation

- * The lax element of the annotation enables the emulation of the "lax" wildcard semantics. - * For example, when the Java source code is annotated like this: - *
- * @{@link XmlRootElement}
- * class Foo {
- *   @XmlAnyElement(lax=true)
- *   public {@link Object}[] others;
- * }
- * 
- * then the following document will unmarshal like this: - *
{@code
- * 
- *   
- *   
- * 
- *
- * Foo foo = unmarshal();
- * // 1 for 'unknown', another for 'foo'
- * assert foo.others.length==2;
- * // 'unknown' unmarshals to a DOM element
- * assert foo.others[0] instanceof Element;
- * // because of lax=true, the 'foo' element eagerly
- * // unmarshals to a Foo object.
- * assert foo.others[1] instanceof Foo;
- * }
- * - * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({FIELD,METHOD}) -public @interface XmlAnyElement { - - /** - * Controls the unmarshaller behavior when it sees elements - * known to the current {@link JAXBContext}. - * - *

When false

- *

- * If false, all the elements that match the property will be unmarshalled - * to DOM, and the property will only contain DOM elements. - * - *

When true

- *

- * If true, when an element matches a property marked with {@link XmlAnyElement} - * is known to {@link JAXBContext} (for example, there's a class with - * {@link XmlRootElement} that has the same tag name, or there's - * {@link XmlElementDecl} that has the same tag name), - * the unmarshaller will eagerly unmarshal this element to the JAXB object, - * instead of unmarshalling it to DOM. Additionally, if the element is - * unknown but it has a known xsi:type, the unmarshaller eagerly unmarshals - * the element to a {@link JAXBElement}, with the unknown element name and - * the JAXBElement value is set to an instance of the JAXB mapping of the - * known xsi:type. - * - *

- * As a result, after the unmarshalling, the property can become heterogeneous; - * it can have both DOM nodes and some JAXB objects at the same time. - * - *

- * This can be used to emulate the "lax" wildcard semantics of the W3C XML Schema. - */ - boolean lax() default false; - - /** - * Specifies the {@link DomHandler} which is responsible for actually - * converting XML from/to a DOM-like data structure. - */ - Class value() default W3CDomHandler.class; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttachmentRef.java 2018-01-30 20:39:45.000000000 -0500 +++ /dev/null 2018-01-30 20:39:46.000000000 -0500 @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.xml.bind.annotation; - -import javax.activation.DataHandler; -import static java.lang.annotation.ElementType.*; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - * Marks a field/property that its XML form is a uri reference to mime content. - * The mime content is optimally stored out-of-line as an attachment. - * - * A field/property must always map to the {@link DataHandler} class. - * - *

Usage

- *
- * @{@link XmlRootElement}
- * class Foo {
- *   @{@link XmlAttachmentRef}
- *   @{@link XmlAttribute}
- *   {@link DataHandler} data;
- *
- *   @{@link XmlAttachmentRef}
- *   @{@link XmlElement}
- *   {@link DataHandler} body;
- * }
- * 
- * The above code maps to the following XML: - *
{@code
- * 
- *   
- *     
- *       
- *     
- *     
- *   
- * 
- * }
- * - *

- * The above binding supports WS-I AP 1.0 WS-I Attachments Profile Version 1.0. - * - * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({FIELD,METHOD,PARAMETER}) -public @interface XmlAttachmentRef { -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlAttribute.java 2018-01-30 20:39:46.000000000 -0500 +++ /dev/null 2018-01-30 20:39:46.000000000 -0500 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - *

- * Maps a JavaBean property to a XML attribute. - * - *

Usage

- *

- * The {@code @XmlAttribute} annotation can be used with the - * following program elements: - *

    - *
  • JavaBean property
  • - *
  • field
  • - *
- * - *

A static final field is mapped to a XML fixed attribute. - * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - * The usage is subject to the following constraints: - *
    - *
  • If type of the field or the property is a collection - * type, then the collection item type must be mapped to schema - * simple type. - *
    - *     // Examples
    - *     @XmlAttribute List<Integer> items; //legal
    - *     @XmlAttribute List<Bar> foo; // illegal if Bar does not map to a schema simple type
    - * 
    - *
  • - *
  • If the type of the field or the property is a non - * collection type, then the type of the property or field - * must map to a simple schema type. - *
    - *     // Examples
    - *     @XmlAttribute int foo; // legal
    - *     @XmlAttribute Foo foo; // illegal if Foo does not map to a schema simple type
    - * 
    - *
  • - *
  • This annotation can be used with the following annotations: - * {@link XmlID}, - * {@link XmlIDREF}, - * {@link XmlList}, - * {@link XmlSchemaType}, - * {@link XmlValue}, - * {@link XmlAttachmentRef}, - * {@link XmlMimeType}, - * {@link XmlInlineBinaryData}, - * {@link javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter}.
  • - *
- * - *

Example 1: Map a JavaBean property to an XML attribute.

- *
- *     //Example: Code fragment
- *     public class USPrice {
- *         @XmlAttribute
- *         public java.math.BigDecimal getPrice() {...} ;
- *         public void setPrice(java.math.BigDecimal ) {...};
- *     }
- * {@code
- *
- *     
- *     
- *       
- *       
- *       
- *     
- * }
- * - *

Example 2: Map a JavaBean property to an XML attribute with anonymous type.

- * See Example 7 in @{@link XmlType}. - * - *

Example 3: Map a JavaBean collection property to an XML attribute.

- *
- *     // Example: Code fragment
- *     class Foo {
- *         ...
- *         @XmlAttribute List<Integer> items;
- *     }
- * {@code
- *
- *     
- *     
- *       ...
- *       
- *         
- *           
- *         
- *     
- *
- * }
- * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @see XmlType - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({FIELD, METHOD}) -public @interface XmlAttribute { - /** - * Name of the XML Schema attribute. By default, the XML Schema - * attribute name is derived from the JavaBean property name. - * - */ - String name() default "##default"; - - /** - * Specifies if the XML Schema attribute is optional or - * required. If true, then the JavaBean property is mapped to a - * XML Schema attribute that is required. Otherwise it is mapped - * to a XML Schema attribute that is optional. - * - */ - boolean required() default false; - - /** - * Specifies the XML target namespace of the XML Schema - * attribute. - * - */ - String namespace() default "##default" ; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElement.java 2018-01-30 20:39:47.000000000 -0500 +++ /dev/null 2018-01-30 20:39:47.000000000 -0500 @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.*; - -/** - * Maps a JavaBean property to a XML element derived from property name. - * - *

Usage - *

- * {@code @XmlElement} annotation can be used with the following program - * elements: - *

    - *
  • a JavaBean property
  • - *
  • non static, non transient field
  • - *
  • within {@link XmlElements} - *
- * - * The usage is subject to the following constraints: - *
    - *
  • This annotation can be used with following annotations: - * {@link XmlID}, - * {@link XmlIDREF}, - * {@link XmlList}, - * {@link XmlSchemaType}, - * {@link XmlValue}, - * {@link XmlAttachmentRef}, - * {@link XmlMimeType}, - * {@link XmlInlineBinaryData}, - * {@link XmlElementWrapper}, - * {@link XmlJavaTypeAdapter}
  • - *
  • if the type of JavaBean property is a collection type of - * array, an indexed property, or a parameterized list, and - * this annotation is used with {@link XmlElements} then, - * {@code @XmlElement.type()} must be DEFAULT.class since the - * collection item type is already known.
  • - *
- * - *

- * A JavaBean property, when annotated with @XmlElement annotation - * is mapped to a local element in the XML Schema complex type to - * which the containing class is mapped. - * - *

- * Example 1: Map a public non static non final field to local - * element - *

- *     //Example: Code fragment
- *     public class USPrice {
- *        {@literal @}XmlElement(name="itemprice")
- *         public java.math.BigDecimal price;
- *     }
- * {@code
- *
- *     
- *     
- *       
- *         
- *       
- *     
- *   }
- *

- * - * Example 2: Map a field to a nillable element. - *

- *     //Example: Code fragment
- *     public class USPrice {
- *        {@literal @}XmlElement(nillable=true)
- *         public java.math.BigDecimal price;
- *     }
- * {@code
- *
- *     
- *     
- *       
- *         
- *       
- *     
- *   }
- *

- * Example 3: Map a field to a nillable, required element. - *

- *     //Example: Code fragment
- *     public class USPrice {
- *        {@literal @}XmlElement(nillable=true, required=true)
- *         public java.math.BigDecimal price;
- *     }
- * {@code
- *
- *     
- *     
- *       
- *         
- *       
- *     
- *   }
- * - *

Example 4: Map a JavaBean property to an XML element - * with anonymous type.

- *

- * See Example 6 in @{@link XmlType}. - * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({FIELD, METHOD, PARAMETER}) -public @interface XmlElement { - /** - * Name of the XML Schema element. - *

If the value is "##default", then element name is derived from the - * JavaBean property name. - */ - String name() default "##default"; - - /** - * Customize the element declaration to be nillable. - *

If nillable() is true, then the JavaBean property is - * mapped to a XML Schema nillable element declaration. - */ - boolean nillable() default false; - - /** - * Customize the element declaration to be required. - *

If required() is true, then Javabean property is mapped to - * an XML schema element declaration with minOccurs="1". - * maxOccurs is "1" for a single valued property and "unbounded" - * for a multivalued property. - *

If required() is false, then the Javabean property is mapped - * to XML Schema element declaration with minOccurs="0". - * maxOccurs is "1" for a single valued property and "unbounded" - * for a multivalued property. - */ - - boolean required() default false; - - /** - * XML target namespace of the XML Schema element. - *

- * If the value is "##default", then the namespace is determined - * as follows: - *

    - *
  1. - * If the enclosing package has {@link XmlSchema} annotation, - * and its {@link XmlSchema#elementFormDefault() elementFormDefault} - * is {@link XmlNsForm#QUALIFIED QUALIFIED}, then the namespace of - * the enclosing class. - * - *
  2. - * Otherwise {@literal ''} (which produces unqualified element in the default - * namespace. - *
- */ - String namespace() default "##default"; - - /** - * Default value of this element. - * - *

- * The

'\u0000'
value specified as a default of this annotation element - * is used as a poor-man's substitute for null to allow implementations - * to recognize the 'no default value' state. - */ - String defaultValue() default "\u0000"; - - /** - * The Java class being referenced. - */ - Class type() default DEFAULT.class; - - /** - * Used in {@link XmlElement#type()} to - * signal that the type be inferred from the signature - * of the property. - */ - static final class DEFAULT {} -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementDecl.java 2018-01-30 20:39:48.000000000 -0500 +++ /dev/null 2018-01-30 20:39:48.000000000 -0500 @@ -1,217 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.METHOD; - -/** - * Maps a factory method to a XML element. - * - *

Usage

- * - * The annotation creates a mapping between an XML schema element - * declaration and a element factory method that returns a - * JAXBElement instance representing the element - * declaration. Typically, the element factory method is generated - * (and annotated) from a schema into the ObjectFactory class in a - * Java package that represents the binding of the element - * declaration's target namespace. Thus, while the annotation syntax - * allows @XmlElementDecl to be used on any method, semantically - * its use is restricted to annotation of element factory method. - * - * The usage is subject to the following constraints: - * - *
    - *
  • The class containing the element factory method annotated - * with @XmlElementDecl must be marked with {@link - * XmlRegistry}.
  • - *
  • The element factory method must take one parameter - * assignable to {@link Object}.
  • - *
- * - *

Example 1: Annotation on a factory method - *

- *     // Example: code fragment
- *     @XmlRegistry
- *     class ObjectFactory {
- *         @XmlElementDecl(name="foo")
- *         JAXBElement<String> createFoo(String s) { ... }
- *     }
- * 
- *
 {@code
- *
- *     
- *     string
- *
- *     // Example: code fragment corresponding to XML input
- *     JAXBElement o =
- *     (JAXBElement)unmarshaller.unmarshal(aboveDocument);
- *     // print JAXBElement instance to show values
- *     System.out.println(o.getName());   // prints  "{}foo"
- *     System.out.println(o.getValue());  // prints  "string"
- *     System.out.println(o.getValue().getClass()); // prints "java.lang.String"
- *
- *     
- *     
- * }
- * - *

Example 2: Element declaration with non local scope - *

- * The following example illustrates the use of scope annotation - * parameter in binding of element declaration in schema derived - * code. - *

- * The following example may be replaced in a future revision of - * this javadoc. - * - *

{@code
- *     
- *     
- *       
- *         
- *           
- *           
- *         
- *       
- *       
- *     
- * }
- *
- *     // Example: expected default binding
- *     class Pea {
- *         @XmlElementRefs({
- *             @XmlElementRef(name="foo",type=JAXBElement.class)
- *             @XmlElementRef(name="bar",type=JAXBElement.class)
- *         })
- *         List<JAXBElement<String>> fooOrBar;
- *     }
- *
- *     @XmlRegistry
- *     class ObjectFactory {
- *         @XmlElementDecl(scope=Pea.class,name="foo")
- *         JAXBElement<String> createPeaFoo(String s);
- *
- *         @XmlElementDecl(scope=Pea.class,name="bar")
- *         JAXBElement<String> createPeaBar(String s);
- *
- *         @XmlElementDecl(name="foo")
- *         JAXBElement<Integer> createFoo(Integer i);
- *     }
- *
- * 
- * Without scope createFoo and createPeaFoo would become ambiguous - * since both of them map to a XML schema element with the same local - * name "foo". - * - * @see XmlRegistry - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({METHOD}) -public @interface XmlElementDecl { - /** - * scope of the mapping. - * - *

- * If this is not {@link XmlElementDecl.GLOBAL}, then this element - * declaration mapping is only active within the specified class. - */ - Class scope() default GLOBAL.class; - - /** - * namespace name of the XML element. - *

- * If the value is "##default", then the value is the namespace - * name for the package of the class containing this factory method. - * - * @see #name() - */ - String namespace() default "##default"; - - /** - * local name of the XML element. - * - *

- * Note to reviewers: There is no default name; since - * the annotation is on a factory method, it is not clear that the - * method name can be derived from the factory method name. - * @see #namespace() - */ - String name(); - - /** - * namespace name of a substitution group's head XML element. - *

- * This specifies the namespace name of the XML element whose local - * name is specified by {@code substitutionHeadName()}. - *

- * If {@code susbtitutionHeadName()} is "", then this - * value can only be "##default". But the value is ignored since - * since this element is not part of susbtitution group when the - * value of {@code susbstitutionHeadName()} is "". - *

- * If {@code susbtitutionHeadName()} is not "" and the value is - * "##default", then the namespace name is the namespace name to - * which the package of the containing class, marked with {@link - * XmlRegistry }, is mapped. - *

- * If {@code susbtitutionHeadName()} is not "" and the value is - * not "##default", then the value is the namespace name. - * - * @see #substitutionHeadName() - */ - String substitutionHeadNamespace() default "##default"; - - /** - * XML local name of a substitution group's head element. - *

- * If the value is "", then this element is not part of any - * substitution group. - * - * @see #substitutionHeadNamespace() - */ - String substitutionHeadName() default ""; - - /** - * Default value of this element. - * - *

- * The

'\u0000'
value specified as a default of this annotation element - * is used as a poor-man's substitute for null to allow implementations - * to recognize the 'no default value' state. - */ - String defaultValue() default "\u0000"; - - /** - * Used in {@link XmlElementDecl#scope()} to - * signal that the declaration is in the global scope. - */ - public final class GLOBAL {} -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRef.java 2018-01-30 20:39:49.000000000 -0500 +++ /dev/null 2018-01-30 20:39:49.000000000 -0500 @@ -1,291 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; - -/** - *

- * Maps a JavaBean property to a XML element derived from property's type. - *

- * Usage - *

- * {@code @XmlElementRef} annotation can be used with a - * JavaBean property or from within {@link XmlElementRefs} - *

- * This annotation dynamically associates an XML element name with the JavaBean - * property. When a JavaBean property is annotated with {@link - * XmlElement}, the XML element name is statically derived from the - * JavaBean property name. However, when this annotation is used, the - * XML element name is derived from the instance of the type of the - * JavaBean property at runtime. - * - *

XML Schema substitution group support

- * XML Schema allows a XML document author to use XML element names - * that were not statically specified in the content model of a - * schema using substitution groups. Schema derived code provides - * support for substitution groups using an element property, - * (section 5.5.5, "Element Property" of JAXB 2.0 specification). An - * element property method signature is of the form: - *
{@code
- *     public void setTerm(JAXBElement);
- *     public JAXBElement getTerm();
- * }
- *

- * An element factory method annotated with {@link XmlElementDecl} is - * used to create a {@code JAXBElement} instance, containing an XML - * element name. The presence of {@code @XmlElementRef} annotation on an - * element property indicates that the element name from {@code JAXBElement} - * instance be used instead of deriving an XML element name from the - * JavaBean property name. - * - *

- * The usage is subject to the following constraints: - *

    - *
  • If the collection item type (for collection property) or - * property type (for single valued property) is - * {@link javax.xml.bind.JAXBElement}, then - * {@code @XmlElementRef.name()} and {@code @XmlElementRef.namespace()} must - * point an element factory method with an @XmlElementDecl - * annotation in a class annotated with @XmlRegistry (usually - * ObjectFactory class generated by the schema compiler) : - *
      - *
    • @XmlElementDecl.name() must equal @XmlElementRef.name()
    • - *
    • @XmlElementDecl.namespace() must equal @XmlElementRef.namespace().
    • - *
    - *
  • - *
  • If the collection item type (for collection property) or - * property type (for single valued property) is not - * {@link javax.xml.bind.JAXBElement}, then the type referenced by the - * property or field must be annotated with {@link XmlRootElement}.
  • - *
  • This annotation can be used with the following annotations: - * {@link XmlElementWrapper}, {@link XmlJavaTypeAdapter}. - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *

Example 1: Ant Task Example

- * The following Java class hierarchy models an Ant build - * script. An Ant task corresponds to a class in the class - * hierarchy. The XML element name of an Ant task is indicated by the - * @XmlRootElement annotation on its corresponding class. - *
- *     @XmlRootElement(name="target")
- *     class Target {
- *         // The presence of @XmlElementRef indicates that the XML
- *         // element name will be derived from the @XmlRootElement
- *         // annotation on the type (for e.g. "jar" for JarTask).
- *         @XmlElementRef
- *         List<Task> tasks;
- *     }
- *
- *     abstract class Task {
- *     }
- *
- *     @XmlRootElement(name="jar")
- *     class JarTask extends Task {
- *         ...
- *     }
- *
- *     @XmlRootElement(name="javac")
- *     class JavacTask extends Task {
- *         ...
- *     }
- * {@code
- *
- *     
- *     
- *     
- *       
- *         
- *           
- *           
- *         
- *       
- *     
- *
- * }
- *

- * Thus the following code fragment: - *

- *     Target target = new Target();
- *     target.tasks.add(new JarTask());
- *     target.tasks.add(new JavacTask());
- *     marshal(target);
- * 
- * will produce the following XML output: - *
{@code
- *     
- *       
- *         ....
- *       
- *       
- *         ....
- *       
- *     
- * }
- *

- * It is not an error to have a class that extends {@code Task} - * that doesn't have {@link XmlRootElement}. But they can't show up in an - * XML instance (because they don't have XML element names). - * - *

Example 2: XML Schema Susbstitution group support - *

The following example shows the annotations for XML Schema - * substitution groups. The annotations and the ObjectFactory are - * derived from the schema. - * - *

- *     @XmlElement
- *     class Math {
- *         //  The value of {@link #type()}is
- *         //  JAXBElement.class , which indicates the XML
- *         //  element name ObjectFactory - in general a class marked
- *         //  with @XmlRegistry. (See ObjectFactory below)
- *         //
- *         //  The {@link #name()} is "operator", a pointer to a
- *         // factory method annotated with a
- *         //  {@link XmlElementDecl} with the name "operator". Since
- *         //  "operator" is the head of a substitution group that
- *         //  contains elements "add" and "sub" elements, "operator"
- *         //  element can be substituted in an instance document by
- *         //  elements "add" or "sub". At runtime, JAXBElement
- *         //  instance contains the element name that has been
- *         //  substituted in the XML document.
- *         //
- *         @XmlElementRef(type=JAXBElement.class,name="operator")
- *         JAXBElement<? extends Operator> term;
- *     }
- *
- *     @XmlRegistry
- *     class ObjectFactory {
- *         @XmlElementDecl(name="operator")
- *         JAXBElement<Operator> createOperator(Operator o) {...}
- *         @XmlElementDecl(name="add",substitutionHeadName="operator")
- *         JAXBElement<Operator> createAdd(Operator o) {...}
- *         @XmlElementDecl(name="sub",substitutionHeadName="operator")
- *         JAXBElement<Operator> createSub(Operator o) {...}
- *     }
- *
- *     class Operator {
- *         ...
- *     }
- * 
- *

- * Thus, the following code fragment - *

- *     Math m = new Math();
- *     m.term = new ObjectFactory().createAdd(new Operator());
- *     marshal(m);
- * 
- * will produce the following XML output: - *
{@code
- *     
- *       ...
- *     
- * }
- * - * - * @author
  • Kohsuke Kawaguchi, Sun Microsystems,Inc.
  • Sekhar Vajjhala, Sun Microsystems, Inc.
- * @see XmlElementRefs - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({FIELD,METHOD}) -public @interface XmlElementRef { - /** - * The Java type being referenced. - *

- * If the value is DEFAULT.class, the type is inferred from the - * the type of the JavaBean property. - */ - Class type() default DEFAULT.class; - - /** - * This parameter and {@link #name()} are used to determine the - * XML element for the JavaBean property. - * - *

If {@code type()} is {@code JAXBElement.class} , then - * {@code namespace()} and {@code name()} - * point to a factory method with {@link XmlElementDecl}. The XML - * element name is the element name from the factory method's - * {@link XmlElementDecl} annotation or if an element from its - * substitution group (of which it is a head element) has been - * substituted in the XML document, then the element name is from the - * {@link XmlElementDecl} on the substituted element. - * - *

If {@link #type()} is not {@code JAXBElement.class}, then - * the XML element name is the XML element name statically - * associated with the type using the annotation {@link - * XmlRootElement} on the type. If the type is not annotated with - * an {@link XmlElementDecl}, then it is an error. - * - *

If {@code type()} is not {@code JAXBElement.class}, then - * this value must be "". - * - */ - String namespace() default ""; - /** - * - * @see #namespace() - */ - String name() default "##default"; - - /** - * Used in {@link XmlElementRef#type()} to - * signal that the type be inferred from the signature - * of the property. - */ - static final class DEFAULT {} - - /** - * Customize the element declaration to be required. - *

- * If required() is true, then Javabean property is mapped to - * an XML schema element declaration with minOccurs="1". - * maxOccurs is "1" for a single valued property and "unbounded" - * for a multivalued property. - * - *

- * If required() is false, then the Javabean property is mapped - * to XML Schema element declaration with minOccurs="0". - * maxOccurs is "1" for a single valued property and "unbounded" - * for a multivalued property. - * - *

- * For compatibility with JAXB 2.1, this property defaults to {@code true}, - * despite the fact that {@link XmlElement#required()} defaults to false. - * - * @since 1.7, JAXB 2.2 - */ - boolean required() default true; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementRefs.java 2018-01-30 20:39:49.000000000 -0500 +++ /dev/null 2018-01-30 20:39:49.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind.annotation; - -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Marks a property that refers to classes with {@link XmlElement} - * or JAXBElement. - * - *

- * Compared to an element property (property with {@link XmlElement} - * annotation), a reference property has a different substitution semantics. - * When a sub-class is assigned to a property, an element property produces - * the same tag name with @xsi:type, whereas a reference property produces - * a different tag name (the tag name that's on the the sub-class.) - * - *

This annotation can be used with the following annotations: - * {@link XmlJavaTypeAdapter}, {@link XmlElementWrapper}. - * - * @author

  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Sekhar Vajjhala, Sun Microsystems, Inc.
- * - * @see XmlElementWrapper - * @see XmlElementRef - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({FIELD,METHOD}) -public @interface XmlElementRefs { - XmlElementRef[] value(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElementWrapper.java 2018-01-30 20:39:50.000000000 -0500 +++ /dev/null 2018-01-30 20:39:50.000000000 -0500 @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.xml.bind.annotation; - -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Generates a wrapper element around XML representation. - * - * This is primarily intended to be used to produce a wrapper - * XML element around collections. The annotation therefore supports - * two forms of serialization shown below. - * - *
{@code
- *    //Example: code fragment
- *      int[] names;
- *
- *    // XML Serialization Form 1 (Unwrapped collection)
- *     ... 
- *     ... 
- *
- *    // XML Serialization Form 2 ( Wrapped collection )
- *    
- *        value-of-item 
- *        value-of-item 
- *       ....
- *    
- * }
- * - *

The two serialized XML forms allow a null collection to be - * represented either by absence or presence of an element with a - * nillable attribute. - * - *

Usage

- *

- * The {@code @XmlElementWrapper} annotation can be used with the - * following program elements: - *

    - *
  • JavaBean property
  • - *
  • non static, non transient field
  • - *
- * - *

The usage is subject to the following constraints: - *

    - *
  • The property must be a collection property
  • - *
  • This annotation can be used with the following annotations: - * {@link XmlElement}, - * {@link XmlElements}, - * {@link XmlElementRef}, - * {@link XmlElementRefs}, - * {@link XmlJavaTypeAdapter}.
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - * @author
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Sekhar Vajjhala, Sun Microsystems, Inc.
- * @see XmlElement - * @see XmlElements - * @see XmlElementRef - * @see XmlElementRefs - * @since 1.6, JAXB 2.0 - * - */ - -@Retention(RUNTIME) @Target({FIELD, METHOD}) -public @interface XmlElementWrapper { - /** - * Name of the XML wrapper element. By default, the XML wrapper - * element name is derived from the JavaBean property name. - */ - String name() default "##default"; - - /** - * XML target namespace of the XML wrapper element. - *

- * If the value is "##default", then the namespace is determined - * as follows: - *

    - *
  1. - * If the enclosing package has {@link XmlSchema} annotation, - * and its {@link XmlSchema#elementFormDefault() elementFormDefault} - * is {@link XmlNsForm#QUALIFIED QUALIFIED}, then the namespace of - * the enclosing class. - * - *
  2. - * Otherwise "" (which produces unqualified element in the default - * namespace. - *
- */ - String namespace() default "##default"; - - /** - * If true, the absence of the collection is represented by - * using {@code xsi:nil='true'}. Otherwise, it is represented by - * the absence of the element. - */ - boolean nillable() default false; - - /** - * Customize the wrapper element declaration to be required. - * - *

- * If required() is true, then the corresponding generated - * XML schema element declaration will have {@code minOccurs="1"}, - * to indicate that the wrapper element is always expected. - * - *

- * Note that this only affects the schema generation, and - * not the unmarshalling or marshalling capability. This is - * simply a mechanism to let users express their application constraints - * better. - * - * @since 1.6, JAXB 2.1 - */ - boolean required() default false; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlElements.java 2018-01-30 20:39:51.000000000 -0500 +++ /dev/null 2018-01-30 20:39:51.000000000 -0500 @@ -1,180 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - *

- * A container for multiple @{@link XmlElement} annotations. - * - * Multiple annotations of the same type are not allowed on a program - * element. This annotation therefore serves as a container annotation - * for multiple @XmlElements as follows: - * - *

- * @XmlElements({ @XmlElement(...),@XmlElement(...) })
- * 
- * - *

The {@code @XmlElements} annotation can be used with the - * following program elements:

- *
    - *
  • a JavaBean property
  • - *
  • non static, non transient field
  • - *
- * - * This annotation is intended for annotation a JavaBean collection - * property (e.g. List). - * - *

Usage

- * - *

The usage is subject to the following constraints: - *

    - *
  • This annotation can be used with the following - * annotations: @{@link XmlIDREF}, @{@link XmlElementWrapper}.
  • - *
  • If @XmlIDREF is also specified on the JavaBean property, - * then each @XmlElement.type() must contain a JavaBean - * property annotated with {@code @XmlID}.
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *
- * - *

Example 1: Map to a list of elements

- *
- *
- *    // Mapped code fragment
- *    public class Foo {
- *        @XmlElements(
- *            @XmlElement(name="A", type=Integer.class),
- *            @XmlElement(name="B", type=Float.class)
- *         )
- *         public List items;
- *    }
- * {@code
- *
- *    
- *    ...
- *     1 
- *     2.5 
- *    ...
- *
- *    
- *    
- *      
- *        
- *          
- *          
- *        
- *      
- *    
- *
- * }
- * - *

Example 2: Map to a list of elements wrapped with another element - *

- *
- *
- *    // Mapped code fragment
- *    public class Foo {
- *        @XmlElementWrapper(name="bar")
- *        @XmlElements(
- *            @XmlElement(name="A", type=Integer.class),
- *            @XmlElement(name="B", type=Float.class)
- *        }
- *        public List items;
- *    }
- * {@code
- *
- *    
- *    
- *      
- *        
- *          
- *            
- *              
- *              
- *            
- *          
- *        
- *      
- *    
- * }
- * - *

Example 3: Change element name based on type using an adapter. - *

- *
- *    class Foo {
- *       @XmlJavaTypeAdapter(QtoPAdapter.class)
- *       @XmlElements({
- *           @XmlElement(name="A",type=PX.class),
- *           @XmlElement(name="B",type=PY.class)
- *       })
- *       Q bar;
- *    }
- *
- *    @XmlType abstract class P {...}
- *    @XmlType(name="PX") class PX extends P {...}
- *    @XmlType(name="PY") class PY extends P {...}
- * {@code
- *
- *    
- *    
- *      
- *        
- *          
- *            
- *              
- *              
- *            
- *          
- *        
- *      
- *    
- * }
- * - * @author
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Sekhar Vajjhala, Sun Microsystems, Inc.
- * @see XmlElement - * @see XmlElementRef - * @see XmlElementRefs - * @see XmlJavaTypeAdapter - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) @Target({FIELD,METHOD}) -public @interface XmlElements { - /** - * Collection of @{@link XmlElement} annotations - */ - XmlElement[] value(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnum.java 2018-01-30 20:39:52.000000000 -0500 +++ /dev/null 2018-01-30 20:39:52.000000000 -0500 @@ -1,75 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind.annotation; - -import static java.lang.annotation.ElementType.TYPE; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - *

- * Maps an enum type {@link Enum} to XML representation. - * - *

This annotation, together with {@link XmlEnumValue} provides a - * mapping of enum type to XML representation. - * - *

Usage

- *

- * The {@code @XmlEnum} annotation can be used with the - * following program elements: - *

    - *
  • enum type
  • - *
- * - *

The usage is subject to the following constraints: - *

    - *
  • This annotation can be used the following other annotations: - * {@link XmlType}, - * {@link XmlRootElement}
  • - *
- *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information

- * - *

An enum type is mapped to a schema simple type with enumeration - * facets. The schema type is derived from the Java type to which - * {@code @XmlEnum.value()}. Each enum constant {@code @XmlEnumValue} - * must have a valid lexical representation for the type - * {@code @XmlEnum.value()}. - * - *

Examples: See examples in {@link XmlEnumValue} - * - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({TYPE}) -public @interface XmlEnum { - /** - * Java type that is mapped to a XML simple type. - * - */ - Class value() default String.class; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlEnumValue.java 2018-01-30 20:39:52.000000000 -0500 +++ /dev/null 2018-01-30 20:39:52.000000000 -0500 @@ -1,126 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; - -/** - * Maps an enum constant in {@link Enum} type to XML representation. - * - *

Usage

- * - *

The {@code @XmlEnumValue} annotation can be used with the - * following program elements: - *

    - *
  • enum constant
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *

This annotation, together with {@link XmlEnum} provides a - * mapping of enum type to XML representation. - * - *

An enum type is mapped to a schema simple type with enumeration - * facets. The schema type is derived from the Java type specified in - * {@code @XmlEnum.value()}. Each enum constant {@code @XmlEnumValue} - * must have a valid lexical representation for the type - * {@code @XmlEnum.value()} - * - *

In the absence of this annotation, {@link Enum#name()} is used - * as the XML representation. - * - *

Example 1: Map enum constant name {@literal ->} enumeration facet

- *
- *     //Example: Code fragment
- *     @XmlEnum(String.class)
- *     public enum Card { CLUBS, DIAMONDS, HEARTS, SPADES }
- * {@code
- *
- *     
- *     
- *       
- *         
- *         
- *         
- *         
- *     
- * }
- * - *

Example 2: Map enum constant name(value) {@literal ->} enumeration facet

- *
- *     //Example: code fragment
- *     @XmlType
- *     @XmlEnum(Integer.class)
- *     public enum Coin {
- *         @XmlEnumValue("1") PENNY(1),
- *         @XmlEnumValue("5") NICKEL(5),
- *         @XmlEnumValue("10") DIME(10),
- *         @XmlEnumValue("25") QUARTER(25) }
- * {@code
- *
- *     
- *     
- *       
- *         
- *         
- *         
- *         
- *       
- *     
- * }
- * - *

Example 3: Map enum constant name {@literal ->} enumeration facet

- * - *
- *     //Code fragment
- *     @XmlType
- *     @XmlEnum(Integer.class)
- *     public enum Code {
- *         @XmlEnumValue("1") ONE,
- *         @XmlEnumValue("2") TWO;
- *     }
- * {@code
- *
- *     
- *     
- *       
- *         
- *         
- *       
- *     
- * }
- * - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({FIELD}) -public @interface XmlEnumValue { - String value(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlID.java 2018-01-30 20:39:53.000000000 -0500 +++ /dev/null 2018-01-30 20:39:53.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Target; -import java.lang.annotation.Retention; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - *

- * Maps a JavaBean property to XML ID. - * - *

- * To preserve referential integrity of an object graph across XML - * serialization followed by a XML deserialization, requires an object - * reference to be marshalled by reference or containment - * appropriately. Annotations {@code @XmlID} and {@code @XmlIDREF} - * together allow a customized mapping of a JavaBean property's - * type by containment or reference. - * - *

Usage

- * The {@code @XmlID} annotation can be used with the following - * program elements: - *
    - *
  • a JavaBean property
  • - *
  • non static, non transient field
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - * The usage is subject to the following constraints: - *
    - *
  • At most one field or property in a class can be annotated - * with {@code @XmlID}.
  • - *
  • The JavaBean property's type must be {@code java.lang.String}.
  • - *
  • The only other mapping annotations that can be used - * with {@code @XmlID} - * are: {@code @XmlElement} and {@code @XmlAttribute}.
  • - *
- * - *

Example: Map a JavaBean property's type to {@code xs:ID}

- *
- *    // Example: code fragment
- *    public class Customer {
- *        @XmlAttribute
- *        @XmlID
- *        public String getCustomerID();
- *        public void setCustomerID(String id);
- *        .... other properties not shown
- *    }
- * {@code
- *
- *    
- *    
- *      
- *        
- *          ....
- *        
- *        
- *      
- *    
- * }
- * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @see XmlIDREF - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({FIELD, METHOD}) -public @interface XmlID { } --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlIDREF.java 2018-01-30 20:39:54.000000000 -0500 +++ /dev/null 2018-01-30 20:39:54.000000000 -0500 @@ -1,254 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Target; -import java.lang.annotation.Retention; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - *

- * Maps a JavaBean property to XML IDREF. - * - *

- * To preserve referential integrity of an object graph across XML - * serialization followed by a XML deserialization, requires an object - * reference to be marshaled by reference or containment - * appropriately. Annotations {@code @XmlID} and {@code @XmlIDREF} - * together allow a customized mapping of a JavaBean property's - * type by containment or reference. - * - *

Usage

- * The {@code @XmlIDREF} annotation can be used with the following - * program elements: - *
    - *
  • a JavaBean property
  • - *
  • non static, non transient field
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *

The usage is subject to the following constraints: - *

    - * - *
  • If the type of the field or property is a collection type, - * then the collection item type must contain a property or - * field annotated with {@code @XmlID}.
  • - *
  • If the field or property is single valued, then the type of - * the property or field must contain a property or field - * annotated with {@code @XmlID}. - *

    Note: If the collection item type or the type of the - * property (for non collection type) is java.lang.Object, then - * the instance must contain a property/field annotated with - * {@code @XmlID} attribute. - *

  • - *
  • This annotation can be used with the following annotations: - * {@link XmlElement}, {@link XmlAttribute}, {@link XmlList}, - * and {@link XmlElements}.
  • - * - *
- *

Example: Map a JavaBean property to {@code xs:IDREF} - * (i.e. by reference rather than by containment)

- *
- *
- *   //EXAMPLE: Code fragment
- *   public class Shipping {
- *       @XmlIDREF public Customer getCustomer();
- *       public void setCustomer(Customer customer);
- *       ....
- *    }
- * {@code
- *
- *   
- *   
- *     
- *       
- *         
- *         ....
- *       
- *     
- *   
- *
- * }
- * - * - *

Example 2: The following is a complete example of - * containment versus reference. - * - *

- *    // By default, Customer maps to complex type {@code xs:Customer}
- *    public class Customer {
- *
- *        // map JavaBean property type to {@code xs:ID}
- *        @XmlID public String getCustomerID();
- *        public void setCustomerID(String id);
- *
- *        // .... other properties not shown
- *    }
- *
- *
- *   // By default, Invoice maps to a complex type {@code xs:Invoice}
- *   public class Invoice {
- *
- *       // map by reference
- *       @XmlIDREF public Customer getCustomer();
- *       public void setCustomer(Customer customer);
- *
- *      // .... other properties not shown here
- *   }
- *
- *   // By default, Shipping maps to complex type {@code xs:Shipping}
- *   public class Shipping {
- *
- *       // map by reference
- *       @XmlIDREF public Customer getCustomer();
- *       public void setCustomer(Customer customer);
- *   }
- *
- *   // at least one class must reference Customer by containment;
- *   // Customer instances won't be marshalled.
- *   @XmlElement(name="CustomerData")
- *   public class CustomerData {
- *       // map reference to Customer by containment by default.
- *       public Customer getCustomer();
- *
- *       // maps reference to Shipping by containment by default.
- *       public Shipping getShipping();
- *
- *       // maps reference to Invoice by containment by default.
- *       public Invoice getInvoice();
- *   }
- * {@code
- *
- *   
- *
- *   
- *     
- *       
- *         
- *         ....
- *       
- *     
- *   
- *
- *   
- *     
- *       
- *         
- *         ....
- *       
- *     
- *   
- *
- *   
- *     
- *       
- *         ....
- *       
- *       
- *     
- *   
- *
- *   
- *     
- *       
- *         
- *         
- *         
- *       
- *     
- *   
- *
- *   
- *
- *   
- *    
- *       
- *           ....
- *       
- *
- *       
- *           ....
- *       
- *
- *       
- *           ....
- *       
- *   
- *
- * }
- * - *

Example 3: Mapping List to repeating element of type IDREF - *

- *     // Code fragment
- *     public class Shipping {
- *         @XmlIDREF
- *         @XmlElement(name="Alice")
- *             public List customers;
- *     }
- * {@code
- *
- *     
- *     
- *       
- *         
- *           
- *         
- *       
- *     
- * }
- * - *

Example 4: Mapping a List to a list of elements of type IDREF. - *

- *     //Code fragment
- *     public class Shipping {
- *         @XmlIDREF
- *         @XmlElements(
- *             @XmlElement(name="Alice", type="Customer.class")
- *              @XmlElement(name="John", type="InternationalCustomer.class")
- *         public List customers;
- *     }
- * {@code
- *
- *     
- *     
- *       
- *         
- *           
- *           
- *         
- *       
- *     
- * }
- * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @see XmlID - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({FIELD, METHOD}) -public @interface XmlIDREF {} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlInlineBinaryData.java 2018-01-30 20:39:55.000000000 -0500 +++ /dev/null 2018-01-30 20:39:55.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.TYPE; - -import javax.xml.transform.Source; -import javax.xml.bind.attachment.AttachmentMarshaller; -import javax.activation.DataHandler; - -/** - * Disable consideration of XOP encoding for datatypes that are bound to - * base64-encoded binary data in XML. - * - *

- * When XOP encoding is enabled as described in {@link AttachmentMarshaller#isXOPPackage()}, - * this annotation disables datatypes such as {@link java.awt.Image} or {@link Source} - * or {@code byte[]} that are bound to base64-encoded binary from being considered for - * XOP encoding. If a JAXB property is annotated with this annotation or if - * the JAXB property's base type is annotated with this annotation, - * neither - * {@link AttachmentMarshaller#addMtomAttachment(DataHandler, String, String)} - * nor - * {@link AttachmentMarshaller#addMtomAttachment(byte[], int, int, String, String, String)} is - * ever called for the property. The binary data will always be inlined. - * - * @author Joseph Fialli - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({FIELD,METHOD,TYPE}) -public @interface XmlInlineBinaryData { -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlList.java 2018-01-30 20:39:56.000000000 -0500 +++ /dev/null 2018-01-30 20:39:56.000000000 -0500 @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; - -/** - * Used to map a property to a list simple type. - * - *

Usage

- *

- * The {@code @XmlList} annotation can be used with the - * following program elements: - *

    - *
  • JavaBean property
  • - *
  • field
  • - *
- * - *

- * When a collection property is annotated just with @XmlElement, - * each item in the collection will be wrapped by an element. - * For example, - * - *

- * @XmlRootElement
- * class Foo {
- *     @XmlElement
- *     List<String> data;
- * }
- * 
- * - * would produce XML like this: - * - *
{@code
- * 
- *   abc
- *   def
- * 
- * }
- * - * @XmlList annotation, on the other hand, allows multiple values to be - * represented as whitespace-separated tokens in a single element. For example, - * - *
- * @XmlRootElement
- * class Foo {
- *     @XmlElement
- *     @XmlList
- *     List<String> data;
- * }
- * 
- * - * the above code will produce XML like this: - * - *
{@code
- * 
- *   abc def
- * 
- * }
- * - *

This annotation can be used with the following annotations: - * {@link XmlElement}, - * {@link XmlAttribute}, - * {@link XmlValue}, - * {@link XmlIDREF}. - *

    - *
  • The use of {@code @XmlList} with {@link XmlValue} while - * allowed, is redundant since {@link XmlList} maps a - * collection type to a simple schema type that derives by - * list just as {@link XmlValue} would.
  • - * - *
  • The use of {@code @XmlList} with {@link XmlAttribute} while - * allowed, is redundant since {@link XmlList} maps a - * collection type to a simple schema type that derives by - * list just as {@link XmlAttribute} would.
  • - *
- * - * @author
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Sekhar Vajjhala, Sun Microsystems, Inc.
- * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) @Target({FIELD,METHOD,PARAMETER}) -public @interface XmlList { -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMimeType.java 2018-01-30 20:39:56.000000000 -0500 +++ /dev/null 2018-01-30 20:39:56.000000000 -0500 @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; - -import javax.xml.transform.Source; - -/** - * Associates the MIME type that controls the XML representation of the property. - * - *

- * This annotation is used in conjunction with datatypes such as - * {@link java.awt.Image} or {@link Source} that are bound to base64-encoded binary in XML. - * - *

- * If a property that has this annotation has a sibling property bound to - * the xmime:contentType attribute, and if in the instance the property has a value, - * the value of the attribute takes precedence and that will control the marshalling. - * - * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({FIELD,METHOD,PARAMETER}) -public @interface XmlMimeType { - /** - * The textual representation of the MIME type, - * such as "image/jpeg" "image/*", "text/xml; charset=iso-8859-1" and so on. - */ - String value(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlMixed.java 2018-01-30 20:39:57.000000000 -0500 +++ /dev/null 2018-01-30 20:39:57.000000000 -0500 @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; - -import org.w3c.dom.Element; -import javax.xml.bind.JAXBElement; - -/** - *

- * Annotate a JavaBean multi-valued property to support mixed content. - * - *

- * The usage is subject to the following constraints: - *

    - *
  • can be used with @XmlElementRef, @XmlElementRefs or @XmlAnyElement
  • - *
- *

- * The following can be inserted into @XmlMixed annotated multi-valued property - *

    - *
  • XML text information items are added as values of java.lang.String.
  • - *
  • Children element information items are added as instances of - * {@link JAXBElement} or instances with a class that is annotated with - * @XmlRootElement.
  • - *
  • Unknown content that is not be bound to a JAXB mapped class is inserted - * as {@link Element}. (Assumes property annotated with @XmlAnyElement)
  • - *
- * - * Below is an example of binding and creation of mixed content. - *
{@code
- *
- *  
- *  
- *    
- *      
- *      
- *      
- *      
- *    
- *  
- *  
- *
- * // Schema-derived Java code:
- * // (Only annotations relevant to mixed content are shown below,
- * //  others are omitted.)
- * import java.math.BigInteger;
- * public class ObjectFactory {
- *      // element instance factories
- *      JAXBElement createLetterBody(LetterBody value);
- *      JAXBElement     createLetterBodyName(String value);
- *      JAXBElement createLetterBodyQuantity(BigInteger value);
- *      JAXBElement     createLetterBodyProductName(String value);
- *      // type instance factory
- *      LetterBody createLetterBody();
- * }
- * }
- *
- * public class LetterBody {
- *      // Mixed content can contain instances of Element classes
- *      // Name, Quantity and ProductName. Text data is represented as
- *      // java.util.String for text.
- *      @XmlMixed
- *      @XmlElementRefs({
- *              @XmlElementRef(name="productName", type=JAXBElement.class),
- *              @XmlElementRef(name="quantity", type=JAXBElement.class),
- *              @XmlElementRef(name="name", type=JAXBElement.class)})
- *      List getContent(){...}
- * }
- * 
- * The following is an XML instance document with mixed content - *
{@code
- * 
- * Dear Mr.Robert Smith
- * Your order of 1 Baby
- * Monitor shipped from our warehouse. ....
- * 
- * }
- * that can be constructed using following JAXB API calls. - *
{@code
- * LetterBody lb = ObjectFactory.createLetterBody();
- * JAXBElement lbe = ObjectFactory.createLetterBody(lb);
- * List gcl = lb.getContent();  //add mixed content to general content property.
- * gcl.add("Dear Mr.");  // add text information item as a String.
- *
- * // add child element information item
- * gcl.add(ObjectFactory.createLetterBodyName("Robert Smith"));
- * gcl.add("Your order of "); // add text information item as a String
- *
- * // add children element information items
- * gcl.add(ObjectFactory.
- *                      createLetterBodyQuantity(new BigInteger("1")));
- * gcl.add(ObjectFactory.createLetterBodyProductName("Baby Monitor"));
- * gcl.add("shipped from our warehouse");  // add text information item
- * }
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({FIELD,METHOD}) -public @interface XmlMixed { -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlNs.java 2018-01-30 20:39:58.000000000 -0500 +++ /dev/null 2018-01-30 20:39:58.000000000 -0500 @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - *

- * Associates a namespace prefix with a XML namespace URI. - * - *

Usage

- *

{@code @XmlNs} annotation is intended for use from other - * program annotations. - * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *

Example:See {@code XmlSchema} annotation type for an example. - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({}) -public @interface XmlNs { - /** - * Namespace prefix - */ - String prefix(); - - /** - * Namespace URI - */ - String namespaceURI(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlNsForm.java 2018-01-30 20:39:59.000000000 -0500 +++ /dev/null 2018-01-30 20:39:59.000000000 -0500 @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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 javax.xml.bind.annotation; - -/** - * Enumeration of XML Schema namespace qualifications. - * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *

Usage - *

- * The namespace qualification values are used in the annotations - * defined in this packge. The enumeration values are mapped as follows: - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Mapping of enumeration values
Enum ValueXML Schema Value
UNQUALIFIEDunqualified
QUALIFIEDqualified
UNSETnamespace qualification attribute is absent from the - * XML Schema fragment
- * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - */ -public enum XmlNsForm {UNQUALIFIED, QUALIFIED, UNSET} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRegistry.java 2018-01-30 20:39:59.000000000 -0500 +++ /dev/null 2018-01-30 20:39:59.000000000 -0500 @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Marks a class that has {@link XmlElementDecl}s. - * - * @author

  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Sekhar Vajjhala, Sun Microsystems, Inc.
- * @since 1.6, JAXB 2.0 - * @see XmlElementDecl - */ -@Retention(RUNTIME) -@Target({TYPE}) -public @interface XmlRegistry { -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlRootElement.java 2018-01-30 20:40:00.000000000 -0500 +++ /dev/null 2018-01-30 20:40:00.000000000 -0500 @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.TYPE; - -/** - * Maps a class or an enum type to an XML element. - * - *

Usage

- *

- * The @XmlRootElement annotation can be used with the following program - * elements: - *

    - *
  • a top level class
  • - *
  • an enum type
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *

- * When a top level class or an enum type is annotated with the - * @XmlRootElement annotation, then its value is represented - * as XML element in an XML document. - * - *

This annotation can be used with the following annotations: - * {@link XmlType}, {@link XmlEnum}, {@link XmlAccessorType}, - * {@link XmlAccessorOrder}. - *

- - *

- * Example 1: Associate an element with XML Schema type - *

- *     // Example: Code fragment
- *     @XmlRootElement
- *     class Point {
- *        int x;
- *        int y;
- *        Point(int _x,int _y) {x=_x;y=_y;}
- *     }
- * 
- * - *
- *     //Example: Code fragment corresponding to XML output
- *     marshal( new Point(3,5), System.out);
- * 
- * - *
{@code
- *
- *     
- *     
- *        3 
- *        5 
- *     
- * }
- * - * The annotation causes an global element declaration to be produced - * in the schema. The global element declaration is associated with - * the XML schema type to which the class is mapped. - * - *
{@code
- *
- *     
- *     
- *     
- *       
- *         
- *         
- *       
- *     
- * }
- * - *

- * - * Example 2: Orthogonality to type inheritance - * - *

- * An element declaration annotated on a type is not inherited by its - * derived types. The following example shows this. - *

- *     // Example: Code fragment
- *     @XmlRootElement
- *     class Point3D extends Point {
- *         int z;
- *         Point3D(int _x,int _y,int _z) {super(_x,_y);z=_z;}
- *     }
- *
- *     //Example: Code fragment corresponding to XML output *
- *     marshal( new Point3D(3,5,0), System.out );
- * {@code
- *
- *     
- *     
- *     
- *       3
- *       5
- *       0
- *     
- *
- *     
- *     
- *     
- *       
- *         
- *           
- *             
- *           
- *         
- *       
- *     
- * }
- * - * Example 3: Associate a global element with XML Schema type - * to which the class is mapped. - *
- *     //Example: Code fragment
- *     @XmlRootElement(name="PriceElement")
- *     public class USPrice {
- *         @XmlElement
- *         public java.math.BigDecimal price;
- *     }
- * {@code
- *
- *     
- *     
- *     
- *       
- *         
- *       
- *     
- * }
- * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) -@Target({TYPE}) -public @interface XmlRootElement { - /** - * namespace name of the XML element. - *

- * If the value is "##default", then the XML namespace name is derived - * from the package of the class ( {@link XmlSchema} ). If the - * package is unnamed, then the XML namespace is the default empty - * namespace. - */ - String namespace() default "##default"; - - /** - * local name of the XML element. - *

- * If the value is "##default", then the name is derived from the - * class name. - * - */ - String name() default "##default"; - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchema.java 2018-01-30 20:40:01.000000000 -0500 +++ /dev/null 2018-01-30 20:40:01.000000000 -0500 @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - *

Maps a package name to a XML namespace.

- * - *

Usage

- *

- * The XmlSchema annotation can be used with the following program - * elements: - *

    - *
  • package
  • - *
- * - *

- * This is a package level annotation and follows the recommendations - * and restrictions contained in JSR 175, section III, "Annotations". - * Thus the usage is subject to the following constraints and - * recommendations. - *

    - *
  • There can only be one package declaration as noted in JSR - * 175, section III, "Annotations".
  • - *
  • JSR 175 recommends package-info.java for package level - * annotations. JAXB Providers that follow this recommendation - * will allow the package level annotations to be defined in - * package-info.java. - *
- * - *

Example 1: Customize name of XML namespace to which - * package is mapped.

- * - *
- *    @javax.xml.bind.annotation.XmlSchema (
- *      namespace = "http://www.example.com/MYPO1"
- *    )
- * {@code
- *
- *    
- *    
- *    
- * }
- * - *

Example 2: Customize namespace prefix, namespace URI - * mapping

- * - *
- *    // Package level annotation
- *    @javax.xml.bind.annotation.XmlSchema (
- *      xmlns = {
- *        @javax.xml.bind.annotation.XmlNs(prefix = "po",
- *                   namespaceURI="http://www.example.com/myPO1"),
- *
- *        @javax.xml.bind.annotation.XmlNs(prefix="xs",
- *                   namespaceURI="http://www.w3.org/2001/XMLSchema")
- *      }
- *    )
- * {@code
- *
- *    
- *    
- *
- * }
- * - *

Example 3: Customize elementFormDefault

- *
- *    @javax.xml.bind.annotation.XmlSchema (
- *      elementFormDefault=XmlNsForm.UNQUALIFIED
- *      ...
- *    )
- * {@code
- *
- *    
- *    
- *
- * }
- - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target(PACKAGE) -public @interface XmlSchema { - - /** - * Customize the namespace URI, prefix associations. By default, - * the namespace prefixes for a XML namespace are generated by a - * JAXB Provider in an implementation dependent way. - */ - XmlNs[] xmlns() default {}; - - /** - * Name of the XML namespace. - */ - String namespace() default ""; - - /** - * Namespace qualification for elements. By default, element - * default attribute will be absent from the XML Schema fragment. - */ - XmlNsForm elementFormDefault() default XmlNsForm.UNSET; - - /** - * Namespace qualification for attributes. By default, - * attributesFormDefault will be absent from the XML Schema fragment. - */ - XmlNsForm attributeFormDefault() default XmlNsForm.UNSET; - - /** - * Indicates that this namespace (specified by {@link #namespace()}) - * has a schema already available exeternally, available at this location. - * - *

- * This instructs the JAXB schema generators to simply refer to - * the pointed schema, as opposed to generating components into the schema. - * This schema is assumed to match what would be otherwise produced - * by the schema generator (same element names, same type names...) - * - *

- * This feature is intended to be used when a set of the Java classes - * is originally generated from an existing schema, hand-written to - * match externally defined schema, or the generated schema is modified - * manually. - * - *

- * Value could be any absolute URI, like {@code http://example.org/some.xsd}. - * It is also possible to specify the empty string, to indicate - * that the schema is externally available but the location is - * unspecified (and thus it's the responsibility of the reader of the generate - * schema to locate it.) Finally, the default value of this property - * {@code "##generate"} indicates that the schema generator is going - * to generate components for this namespace (as it did in JAXB 2.0.) - * - *

- * Multiple {@link XmlSchema} annotations on multiple packages are allowed - * to govern the same {@link #namespace()}. In such case, all of them - * must have the same {@link #location()} values. - * - * - *

Note to implementor

- *

- * More precisely, the value must be either {@code ""}, {@code "##generate"}, or - * - * a valid lexical representation of {@code xs:anyURI} that begins - * with {@code :}. - * - *

- * A schema generator is expected to generate a corresponding - * {@code } (or - * no {@code schemaLocation} attribute at all if the empty string is specified.) - * However, the schema generator is allowed to use a different value in - * the {@code schemaLocation} attribute (including not generating - * such attribute), for example so that the user can specify a local - * copy of the resource through the command line interface. - * - * @since 1.6, JAXB 2.1 - */ - String location() default NO_LOCATION; - - /** - * The default value of the {@link #location()} attribute, - * which indicates that the schema generator will generate - * components in this namespace. - */ - // the actual value is chosen because ## is not a valid - // sequence in xs:anyURI. - static final String NO_LOCATION = "##generate"; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaType.java 2018-01-30 20:40:02.000000000 -0500 +++ /dev/null 2018-01-30 20:40:02.000000000 -0500 @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PACKAGE; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - -/** - * Maps a Java type to a simple schema built-in type. - * - *

Usage

- *

- * {@code @XmlSchemaType} annotation can be used with the following program - * elements: - *

    - *
  • a JavaBean property
  • - *
  • field
  • - *
  • package
  • - *
- * - *

{@code @XmlSchemaType} annotation defined for Java type - * applies to all references to the Java type from a property/field. - * A {@code @XmlSchemaType} annotation specified on the - * property/field overrides the {@code @XmlSchemaType} annotation - * specified at the package level. - * - *

This annotation can be used with the following annotations: - * {@link XmlElement}, {@link XmlAttribute}. - *

- * Example 1: Customize mapping of XMLGregorianCalendar on the - * field. - * - *

- *     //Example: Code fragment
- *     public class USPrice {
- *         @XmlElement
- *         @XmlSchemaType(name="date")
- *         public XMLGregorianCalendar date;
- *     }
- * {@code
- *
- *     
- *     
- *       
- *         
- *       
- *     
- * }
- * - *

Example 2: Customize mapping of XMLGregorianCalendar at package - * level

- *
- *     package foo;
- *     @javax.xml.bind.annotation.XmlSchemaType(
- *          name="date", type=javax.xml.datatype.XMLGregorianCalendar.class)
- *     }
- * 
- * - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({FIELD,METHOD,PACKAGE}) -public @interface XmlSchemaType { - String name(); - String namespace() default "http://www.w3.org/2001/XMLSchema"; - /** - * If this annotation is used at the package level, then value of - * the type() must be specified. - */ - - Class type() default DEFAULT.class; - - /** - * Used in {@link XmlSchemaType#type()} to - * signal that the type be inferred from the signature - * of the property. - */ - - static final class DEFAULT {} - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSchemaTypes.java 2018-01-30 20:40:02.000000000 -0500 +++ /dev/null 2018-01-30 20:40:02.000000000 -0500 @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.annotation; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.PACKAGE; -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - *

- * A container for multiple @{@link XmlSchemaType} annotations. - * - *

Multiple annotations of the same type are not allowed on a program - * element. This annotation therefore serves as a container annotation - * for multiple @XmlSchemaType annotations as follows: - * - *

- * @XmlSchemaTypes({ @XmlSchemaType(...), @XmlSchemaType(...) })
- * 
- *

The {@code @XmlSchemaTypes} annnotation can be used to - * define {@link XmlSchemaType} for different types at the - * package level. - * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - * @author
  • Sekhar Vajjhala, Sun Microsystems, Inc.
- * @see XmlSchemaType - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) @Target({PACKAGE}) -public @interface XmlSchemaTypes { - /** - * Collection of @{@link XmlSchemaType} annotations - */ - XmlSchemaType[] value(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlSeeAlso.java 2018-01-30 20:40:03.000000000 -0500 +++ /dev/null 2018-01-30 20:40:03.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2006, 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 javax.xml.bind.annotation; - -import javax.xml.bind.JAXBContext; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - * Instructs JAXB to also bind other classes when binding this class. - * - *

- * Java makes it impractical/impossible to list all sub-classes of - * a given class. This often gets in a way of JAXB users, as it JAXB - * cannot automatically list up the classes that need to be known - * to {@link JAXBContext}. - * - *

- * For example, with the following class definitions: - * - *

- * class Animal {}
- * class Dog extends Animal {}
- * class Cat extends Animal {}
- * 
- * - *

- * The user would be required to create {@link JAXBContext} as - * {@code JAXBContext.newInstance(Dog.class,Cat.class)} - * ({@code Animal} will be automatically picked up since {@code Dog} - * and {@code Cat} refers to it.) - * - *

- * {@link XmlSeeAlso} annotation would allow you to write: - *

- * @XmlSeeAlso({Dog.class,Cat.class})
- * class Animal {}
- * class Dog extends Animal {}
- * class Cat extends Animal {}
- * 
- * - *

- * This would allow you to do {@code JAXBContext.newInstance(Animal.class)}. - * By the help of this annotation, JAXB implementations will be able to - * correctly bind {@code Dog} and {@code Cat}. - * - * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.1 - */ -@Target({ElementType.TYPE}) -@Retention(RUNTIME) -public @interface XmlSeeAlso { - Class[] value(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlTransient.java 2018-01-30 20:40:04.000000000 -0500 +++ /dev/null 2018-01-30 20:40:04.000000000 -0500 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Target; -import java.lang.annotation.Retention; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - *

- * Prevents the mapping of a JavaBean property/type to XML representation. - *

- * The {@code @XmlTransient} annotation is useful for resolving name - * collisions between a JavaBean property name and a field name or - * preventing the mapping of a field/property. A name collision can - * occur when the decapitalized JavaBean property name and a field - * name are the same. If the JavaBean property refers to the field, - * then the name collision can be resolved by preventing the - * mapping of either the field or the JavaBean property using the - * {@code @XmlTransient} annotation. - * - *

- * When placed on a class, it indicates that the class shouldn't be mapped - * to XML by itself. Properties on such class will be mapped to XML along - * with its derived classes, as if the class is inlined. - * - *

Usage

- *

The {@code @XmlTransient} annotation can be used with the following - * program elements: - *

    - *
  • a JavaBean property
  • - *
  • field
  • - *
  • class
  • - *
- * - *

{@code @XmlTransient} is mutually exclusive with all other - * JAXB defined annotations.

- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *

Example: Resolve name collision between JavaBean property and - * field name

- * - *
- *   // Example: Code fragment
- *   public class USAddress {
- *
- *       // The field name "name" collides with the property name
- *       // obtained by bean decapitalization of getName() below
- *       @XmlTransient public String name;
- *
- *       String getName() {..};
- *       String setName() {..};
- *   }
- *
- * {@code
- *
- *   
- *   
- *     
- *       
- *     
- *   
- * }
- * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({FIELD, METHOD, TYPE}) -public @interface XmlTransient {} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlType.java 2018-01-30 20:40:05.000000000 -0500 +++ /dev/null 2018-01-30 20:40:05.000000000 -0500 @@ -1,456 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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 javax.xml.bind.annotation; - -import static java.lang.annotation.ElementType.TYPE; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - *

- * Maps a class or an enum type to a XML Schema type. - * - *

Usage

- *

The {@code @XmlType} annnotation can be used with the following program - * elements: - *

    - *
  • a top level class
  • - *
  • an enum type
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - *

Mapping a Class

- *

- * A class maps to a XML Schema type. A class is a data container for - * values represented by properties and fields. A schema type is a - * data container for values represented by schema components within a - * schema type's content model (e.g. model groups, attributes etc). - *

To be mapped, a class must either have a public no-arg - * constructor or a static no-arg factory method. The static factory - * method can be specified in {@code factoryMethod()} and - * {@code factoryClass()} annotation elements. The static factory - * method or the no-arg constructor is used during unmarshalling to - * create an instance of this class. If both are present, the static - * factory method overrides the no-arg constructor. - *

- * A class maps to either a XML Schema complex type or a XML Schema simple - * type. The XML Schema type is derived based on the - * mapping of JavaBean properties and fields contained within the - * class. The schema type to which the class is mapped can either be - * named or anonymous. A class can be mapped to an anonymous schema - * type by annotating the class with {@code @XmlType(name="")}. - *

- * Either a global element, local element or a local attribute can be - * associated with an anonymous type as follows: - *

    - *
  • global element: A global element of an anonymous - * type can be derived by annotating the class with @{@link - * XmlRootElement}. See Example 3 below.
  • - * - *
  • local element: A JavaBean property that references - * a class annotated with @XmlType(name="") and is mapped to the - * element associated with the anonymous type. See Example 4 - * below.
  • - * - *
  • attribute: A JavaBean property that references - * a class annotated with @XmlType(name="") and is mapped to the - * attribute associated with the anonymous type. See Example 5 below.
  • - *
- * Mapping to XML Schema Complex Type - *
    - *
  • If class is annotated with {@code @XmlType(name="") }, it - * is mapped to an anonymous type otherwise, the class name maps - * to a complex type name. The {@code XmlName()} annotation element - * can be used to customize the name.
  • - * - *
  • Properties and fields that are mapped to elements are mapped to a - * content model within a complex type. The annotation element - * {@code propOrder()} can be used to customize the content model to be - * {@code xs:all} or {@code xs:sequence}. It is used for specifying - * the order of XML elements in {@code xs:sequence}.
  • - * - *
  • Properties and fields can be mapped to attributes within the - * complex type.
  • - * - *
  • The targetnamespace of the XML Schema type can be customized - * using the annotation element {@code namespace()}.
  • - *
- * - *

- * Mapping class to XML Schema simple type - *

- * A class can be mapped to a XML Schema simple type using the - * {@code @XmlValue} annotation. For additional details and examples, - * see @{@link XmlValue} annotation type. - *

- * The following table shows the mapping of the class to a XML Schema - * complex type or simple type. The notational symbols used in the table are: - *

    - *
  • {@literal ->} : represents a mapping
  • - *
  • [x]+ : one or more occurrences of x
  • - *
  • [ {@code @XmlValue} property ]: JavaBean property annotated with - * {@code @XmlValue}
  • - *
  • X : don't care - *
- *
- * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
TargetpropOrderClassBodyComplexTypeSimpleType
Class{}[property]+ {@literal ->} elementscomplexcontent
xs:all
Classnon empty[property]+ {@literal ->} elementscomplexcontent
xs:sequence
ClassXno property {@literal ->} elementcomplexcontent
empty sequence
ClassX1 [{@code @XmlValue} property] {@literal &&}
[property]+ {@literal ->} attributes
simplecontent
ClassX1 [{@code @XmlValue} property] {@literal &&}
no properties {@literal ->} attribute
simpletype
- *
- * - *

Mapping an enum type

- * - * An enum type maps to a XML schema simple type with enumeration - * facets. The following annotation elements are ignored since they - * are not meaningful: {@code propOrder()} , {@code factoryMethod()} , - * {@code factoryClass()} . - * - *

Usage with other annotations

- *

This annotation can be used with the following annotations: - * {@link XmlRootElement}, {@link XmlAccessorOrder}, {@link XmlAccessorType}, - * {@link XmlEnum}. However, {@link - * XmlAccessorOrder} and {@link XmlAccessorType} are ignored when this - * annotation is used on an enum type. - * - *

Example 1: Map a class to a complex type with - * xs:sequence with a customized ordering of JavaBean properties. - *

- * - *
- *   @XmlType(propOrder={"street", "city" , "state", "zip", "name" })
- *   public class USAddress {
- *     String getName() {..};
- *     void setName(String) {..};
- *
- *     String getStreet() {..};
- *     void setStreet(String) {..};
- *
- *     String getCity() {..};
- *     void setCity(String) {..};
- *
- *     String getState() {..};
- *     void setState(String) {..};
- *
- *     java.math.BigDecimal getZip() {..};
- *     void setZip(java.math.BigDecimal) {..};
- *   }
- * {@code
- *
- *   
- *   
- *     
- *       
- *       
- *       
- *       
- *       
- *     
- *   
- * }
- *

Example 2: Map a class to a complex type with - * xs:all

- *
- * @XmlType(propOrder={})
- * public class USAddress { ...}
- * {@code
- *
- * 
- * 
- *   
- *     
- *     
- *     
- *     
- *     
- *   
- * 
- *}
- *

Example 3: Map a class to a global element with an - * anonymous type. - *

- *
- *   @XmlRootElement
- *   @XmlType(name="")
- *   public class USAddress { ...}
- * {@code
- *
- *   
- *   
- *     
- *       
- *         
- *         
- *         
- *         
- *         
- *       
- *     
- *   
- * }
- * - *

Example 4: Map a property to a local element with - * anonymous type. - *

- *   //Example: Code fragment
- *   public class Invoice {
- *       USAddress addr;
- *           ...
- *       }
- *
- *   @XmlType(name="")
- *   public class USAddress { ... }
- *   }
- * {@code
- *
- *   
- *   
- *     
- *       
- *         
- *           
- *           
- *           
- *           
- *           
- *         
- *       ...
- *     
- *   
- * }
- * - *

Example 5: Map a property to an attribute with - * anonymous type. - * - *

- *
- *     //Example: Code fragment
- *     public class Item {
- *         public String name;
- *         @XmlAttribute
- *         public USPrice price;
- *     }
- *
- *     // map class to anonymous simple type.
- *     @XmlType(name="")
- *     public class USPrice {
- *         @XmlValue
- *         public java.math.BigDecimal price;
- *     }
- * {@code
- *
- *     
- *     
- *       
- *         
- *         
- *           
- *             
- *           
- *         
- *       
- *     
- * }
- * - *

Example 6: Define a factoryClass and factoryMethod - * - *

- *      @XmlType(name="USAddressType", factoryClass=USAddressFactory.class,
- *      factoryMethod="getUSAddress")
- *      public class USAddress {
- *
- *          private String city;
- *          private String name;
- *          private String state;
- *          private String street;
- *          private int    zip;
- *
- *      public USAddress(String name, String street, String city,
- *          String state, int zip) {
- *          this.name = name;
- *          this.street = street;
- *          this.city = city;
- *          this.state = state;
- *          this.zip = zip;
- *      }
- *  }
- *
- *  public class USAddressFactory {
- *      public static USAddress getUSAddress(){
- *       return new USAddress("Mark Baker", "23 Elm St",
- *          "Dayton", "OH", 90952);
- *  }
- *
- * 
- * - *

Example 7: Define factoryMethod and use the default factoryClass - * - *

- *      @XmlType(name="USAddressType", factoryMethod="getNewInstance")
- *      public class USAddress {
- *
- *          private String city;
- *          private String name;
- *          private String state;
- *          private String street;
- *          private int    zip;
- *
- *          private USAddress() {}
- *
- *          public static USAddress getNewInstance(){
- *              return new USAddress();
- *          }
- *      }
- * 
- * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @see XmlElement - * @see XmlAttribute - * @see XmlValue - * @see XmlSchema - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({TYPE}) -public @interface XmlType { - /** - * Name of the XML Schema type which the class is mapped. - */ - String name() default "##default" ; - - /** - * Specifies the order for XML Schema elements when class is - * mapped to a XML Schema complex type. - * - *

Refer to the table for how the propOrder affects the - * mapping of class

- * - *

The propOrder is a list of names of JavaBean properties in - * the class. Each name in the list is the name of a Java - * identifier of the JavaBean property. The order in which - * JavaBean properties are listed is the order of XML Schema - * elements to which the JavaBean properties are mapped.

- *

All of the JavaBean properties being mapped to XML Schema elements - * must be listed. - *

A JavaBean property or field listed in propOrder must not - * be transient or annotated with {@code @XmlTransient}. - *

The default ordering of JavaBean properties is determined - * by @{@link XmlAccessorOrder}. - */ - String[] propOrder() default {""}; - - /** - * Name of the target namespace of the XML Schema type. By - * default, this is the target namespace to which the package - * containing the class is mapped. - */ - String namespace() default "##default" ; - - /** - * Class containing a no-arg factory method for creating an - * instance of this class. The default is this class. - * - *

If {@code factoryClass} is DEFAULT.class and - * {@code factoryMethod} is "", then there is no static factory - * method. - * - *

If {@code factoryClass} is DEFAULT.class and - * {@code factoryMethod} is not "", then - * {@code factoryMethod} is the name of a static factory method - * in this class. - * - *

If {@code factoryClass} is not DEFAULT.class, then - * {@code factoryMethod} must not be "" and must be the name of - * a static factory method specified in {@code factoryClass}. - */ - Class factoryClass() default DEFAULT.class; - - /** - * Used in {@link XmlType#factoryClass()} to - * signal that either factory mehod is not used or - * that it's in the class with this {@link XmlType} itself. - */ - static final class DEFAULT {} - - /** - * Name of a no-arg factory method in the class specified in - * {@code factoryClass} factoryClass(). - * - */ - String factoryMethod() default ""; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/XmlValue.java 2018-01-30 20:40:05.000000000 -0500 +++ /dev/null 2018-01-30 20:40:05.000000000 -0500 @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation; - -import java.lang.annotation.Target; -import java.lang.annotation.Retention; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - *

- * Enables mapping a class to a XML Schema complex type with a - * simpleContent or a XML Schema simple type. - *

- * - *

- * Usage: - *

- * The {@code @XmlValue} annotation can be used with the following program - * elements: - *

    - *
  • a JavaBean property.
  • - *
  • non static, non transient field.
  • - *
- * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - * The usage is subject to the following usage constraints: - *
    - *
  • At most one field or property can be annotated with the - * {@code @XmlValue} annotation.
  • - * - *
  • {@code @XmlValue} can be used with the following - * annotations: {@link XmlList}. However this is redundant since - * {@link XmlList} maps a type to a simple schema type that derives by - * list just as {@link XmlValue} would.
  • - * - *
  • If the type of the field or property is a collection type, - * then the collection item type must map to a simple schema - * type.
  • - * - *
  • If the type of the field or property is not a collection - * type, then the type must map to a XML Schema simple type.
  • - * - *
- *

- * If the annotated JavaBean property is the sole class member being - * mapped to XML Schema construct, then the class is mapped to a - * simple type. - * - * If there are additional JavaBean properties (other than the - * JavaBean property annotated with {@code @XmlValue} annotation) - * that are mapped to XML attributes, then the class is mapped to a - * complex type with simpleContent. - *

- * - *

Example 1: Map a class to XML Schema simpleType

- * - *
- *
- *     // Example 1: Code fragment
- *     public class USPrice {
- *         @XmlValue
- *         public java.math.BigDecimal price;
- *     }
- * {@code
- *
- *     
- *     
- *       
- *     
- *
- * }
- * - *

Example 2: Map a class to XML Schema complexType with - * with simpleContent.

- * - *
- *
- *   // Example 2: Code fragment
- *   public class InternationalPrice {
- *       @XmlValue
- *       public java.math.BigDecimal price;
- *
- *       @XmlAttribute
- *       public String currency;
- *   }
- * {@code
- *
- *   
- *   
- *     
- *       
- *         
- *       
- *     
- *   
- *
- * }
- * - * @author Sekhar Vajjhala, Sun Microsystems, Inc. - * @see XmlType - * @since 1.6, JAXB 2.0 - */ - -@Retention(RUNTIME) @Target({FIELD, METHOD}) -public @interface XmlValue {} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/CollapsedStringAdapter.java 2018-01-30 20:40:06.000000000 -0500 +++ /dev/null 2018-01-30 20:40:06.000000000 -0500 @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation.adapters; - - - -/** - * Built-in {@link XmlAdapter} to handle {@code xs:token} and its derived types. - * - *

- * This adapter removes leading and trailing whitespaces, then truncate any - * sequence of tab, CR, LF, and SP by a single whitespace character ' '. - * - * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.0 - */ -public class CollapsedStringAdapter extends XmlAdapter { - /** - * Removes leading and trailing whitespaces of the string - * given as the parameter, then truncate any - * sequence of tab, CR, LF, and SP by a single whitespace character ' '. - */ - public String unmarshal(String text) { - if(text==null) return null; // be defensive - - int len = text.length(); - - // most of the texts are already in the collapsed form. - // so look for the first whitespace in the hope that we will - // never see it. - int s=0; - while(s 0 && result.charAt(len - 1) == ' ') - result.setLength(len - 1); - // whitespaces are already collapsed, - // so all we have to do is to remove the last one character - // if it's a whitespace. - - return result.toString(); - } - - /** - * No-op. - * - * Just return the same string given as the parameter. - */ - public String marshal(String s) { - return s; - } - - - /** returns true if the specified char is a white space character. */ - protected static boolean isWhiteSpace(char ch) { - // most of the characters are non-control characters. - // so check that first to quickly return false for most of the cases. - if( ch>0x20 ) return false; - - // other than we have to do four comparisons. - return ch == 0x9 || ch == 0xA || ch == 0xD || ch == 0x20; - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/HexBinaryAdapter.java 2018-01-30 20:40:07.000000000 -0500 +++ /dev/null 2018-01-30 20:40:07.000000000 -0500 @@ -1,49 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind.annotation.adapters; - -import javax.xml.bind.DatatypeConverter; - -/** - * {@link XmlAdapter} for {@code xs:hexBinary}. - * - *

- * This {@link XmlAdapter} binds {@code byte[]} to the hexBinary representation in XML. - * - * @author Kohsuke Kawaguchi - * @since 1.6, JAXB 2.0 - */ -public final class HexBinaryAdapter extends XmlAdapter { - public byte[] unmarshal(String s) { - if(s==null) return null; - return DatatypeConverter.parseHexBinary(s); - } - - public String marshal(byte[] bytes) { - if(bytes==null) return null; - return DatatypeConverter.printHexBinary(bytes); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/NormalizedStringAdapter.java 2018-01-30 20:40:08.000000000 -0500 +++ /dev/null 2018-01-30 20:40:08.000000000 -0500 @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind.annotation.adapters; - - - -/** - * {@link XmlAdapter} to handle {@code xs:normalizedString}. - * - *

- * Replaces any tab, CR, and LF by a whitespace character ' ', - * as specified in the whitespace facet 'replace' - * - * @author Kohsuke Kawaguchi, Martin Grebac - * @since 1.6, JAXB 2.0 - */ -public final class NormalizedStringAdapter extends XmlAdapter { - /** - * Replace any tab, CR, and LF by a whitespace character ' ', - * as specified in the whitespace facet 'replace' - */ - public String unmarshal(String text) { - if(text==null) return null; // be defensive - - int i=text.length()-1; - - // look for the first whitespace char. - while( i>=0 && !isWhiteSpaceExceptSpace(text.charAt(i)) ) - i--; - - if( i<0 ) - // no such whitespace. replace(text)==text. - return text; - - // we now know that we need to modify the text. - // allocate a char array to do it. - char[] buf = text.toCharArray(); - - buf[i--] = ' '; - for( ; i>=0; i-- ) - if( isWhiteSpaceExceptSpace(buf[i])) - buf[i] = ' '; - - return new String(buf); - } - - /** - * No-op. - * - * Just return the same string given as the parameter. - */ - public String marshal(String s) { - return s; - } - - - /** - * Returns true if the specified char is a white space character - * but not 0x20. - */ - protected static boolean isWhiteSpaceExceptSpace(char ch) { - // most of the characters are non-control characters. - // so check that first to quickly return false for most of the cases. - if( ch>=0x20 ) return false; - - // other than we have to do four comparisons. - return ch == 0x9 || ch == 0xA || ch == 0xD; - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlAdapter.java 2018-01-30 20:40:08.000000000 -0500 +++ /dev/null 2018-01-30 20:40:08.000000000 -0500 @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation.adapters; - -/** - * Adapts a Java type for custom marshaling. - * - *

Usage:

- * - *

- * Some Java types do not map naturally to an XML representation, for - * example {@code HashMap} or other non JavaBean classes. Conversely, - * an XML representation may map to a Java type but an application may - * choose to access the XML representation using another Java - * type. For example, the schema to Java binding rules bind - * xs:DateTime by default to XmlGregorianCalendar. But an application - * may desire to bind xs:DateTime to a custom type, - * MyXmlGregorianCalendar, for example. In both cases, there is a - * mismatch between bound type , used by an application to - * access XML content and the value type, that is mapped to an - * XML representation. - * - *

- * This abstract class defines methods for adapting a bound type to a value - * type or vice versa. The methods are invoked by the JAXB binding - * framework during marshaling and unmarshalling: - * - *

    - *
  • XmlAdapter.marshal(...): During marshalling, JAXB - * binding framework invokes XmlAdapter.marshal(..) to adapt a - * bound type to value type, which is then marshaled to XML - * representation.
  • - * - *
  • XmlAdapter.unmarshal(...): During unmarshalling, - * JAXB binding framework first unmarshals XML representation - * to a value type and then invokes XmlAdapter.unmarshal(..) to - * adapt the value type to a bound type.
  • - *
- * - * Writing an adapter therefore involves the following steps: - * - *
    - *
  • Write an adapter that implements this abstract class.
  • - *
  • Install the adapter using the annotation {@link - * XmlJavaTypeAdapter}
  • - *
- * - *

Example: Customized mapping of {@code HashMap}

- *

The following example illustrates the use of - * {@code @XmlAdapter} and {@code @XmlJavaTypeAdapter} to - * customize the mapping of a {@code HashMap}. - * - *

Step 1: Determine the desired XML representation for HashMap. - * - *

{@code
- *     
- *         this is a value
- *         this is another value
- *         ...
- *     
- * }
- * - *

Step 2: Determine the schema definition that the - * desired XML representation shown above should follow. - * - *

{@code
- *
- *     
- *       
- *         
- *       
- *     
- *
- *     
- *       
- *         
- *           
- *         
- *       
- *     
- *
- * }
- * - *

Step 3: Write value types that can generate the above - * schema definition. - * - *

- *     public class MyHashMapType {
- *         List<MyHashMapEntryType> entry;
- *     }
- *
- *     public class MyHashMapEntryType {
- *         @XmlAttribute
- *         public Integer key;
- *
- *         @XmlValue
- *         public String value;
- *     }
- * 
- * - *

Step 4: Write the adapter that adapts the value type, - * MyHashMapType to a bound type, HashMap, used by the application. - * - *

{@code
- *     public final class MyHashMapAdapter extends
- *                        XmlAdapter { ... }
- *
- * }
- * - *

Step 5: Use the adapter. - * - *

- *     public class Foo {
- *         @XmlJavaTypeAdapter(MyHashMapAdapter.class)
- *         HashMap hashmap;
- *         ...
- *     }
- * 
- * - * The above code fragment will map to the following schema: - * - *
{@code
- *     
- *       
- *         
- *       
- *     
- * }
- * - * @param - * The type that JAXB doesn't know how to handle. An adapter is written - * to allow this type to be used as an in-memory representation through - * the {@code ValueType}. - * @param - * The type that JAXB knows how to handle out of the box. - * - * @author
  • Sekhar Vajjhala, Sun Microsystems Inc.
  • Kohsuke Kawaguchi, Sun Microsystems Inc.
- * @see XmlJavaTypeAdapter - * @since 1.6, JAXB 2.0 - */ -public abstract class XmlAdapter { - - /** - * Do-nothing constructor for the derived classes. - */ - protected XmlAdapter() {} - - /** - * Convert a value type to a bound type. - * - * @param v - * The value to be converted. Can be null. - * @throws Exception - * if there's an error during the conversion. The caller is responsible for - * reporting the error to the user through {@link javax.xml.bind.ValidationEventHandler}. - */ - public abstract BoundType unmarshal(ValueType v) throws Exception; - - /** - * Convert a bound type to a value type. - * - * @param v - * The value to be convereted. Can be null. - * @throws Exception - * if there's an error during the conversion. The caller is responsible for - * reporting the error to the user through {@link javax.xml.bind.ValidationEventHandler}. - */ - public abstract ValueType marshal(BoundType v) throws Exception; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapter.java 2018-01-30 20:40:09.000000000 -0500 +++ /dev/null 2018-01-30 20:40:09.000000000 -0500 @@ -1,116 +0,0 @@ -/* - * Copyright (c) 2004, 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 javax.xml.bind.annotation.adapters; - -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlElementRefs; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlSchemaType; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlSchema; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlSchemaTypes; -import java.lang.annotation.Target; -import java.lang.annotation.Retention; - -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.TYPE; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.ElementType.PACKAGE; - - -/** - * Use an adapter that implements {@link XmlAdapter} for custom marshaling. - * - *

Usage:

- * - *

The {@code @XmlJavaTypeAdapter} annotation can be used with the - * following program elements: - *

    - *
  • a JavaBean property
  • - *
  • field
  • - *
  • parameter
  • - *
  • package
  • - *
  • from within {@link XmlJavaTypeAdapters}
  • - *
- * - *

When {@code @XmlJavaTypeAdapter} annotation is defined on a - * class, it applies to all references to the class. - *

When {@code @XmlJavaTypeAdapter} annotation is defined at the - * package level it applies to all references from within the package - * to {@code @XmlJavaTypeAdapter.type()}. - *

When {@code @XmlJavaTypeAdapter} annotation is defined on the - * field, property or parameter, then the annotation applies to the - * field, property or the parameter only. - *

A {@code @XmlJavaTypeAdapter} annotation on a field, property - * or parameter overrides the {@code @XmlJavaTypeAdapter} annotation - * associated with the class being referenced by the field, property - * or parameter. - *

A {@code @XmlJavaTypeAdapter} annotation on a class overrides - * the {@code @XmlJavaTypeAdapter} annotation specified at the - * package level for that class. - * - *

This annotation can be used with the following other annotations: - * {@link XmlElement}, {@link XmlAttribute}, {@link XmlElementRef}, - * {@link XmlElementRefs}, {@link XmlAnyElement}. This can also be - * used at the package level with the following annotations: - * {@link XmlAccessorType}, {@link XmlSchema}, {@link XmlSchemaType}, - * {@link XmlSchemaTypes}. - * - *

Example: See example in {@link XmlAdapter} - * - * @author

  • Sekhar Vajjhala, Sun Microsystems Inc.
  • Kohsuke Kawaguchi, Sun Microsystems Inc.
- * @since 1.6, JAXB 2.0 - * @see XmlAdapter - */ - -@Retention(RUNTIME) @Target({PACKAGE,FIELD,METHOD,TYPE,PARAMETER}) -public @interface XmlJavaTypeAdapter { - /** - * Points to the class that converts a value type to a bound type or vice versa. - * See {@link XmlAdapter} for more details. - */ - Class value(); - - /** - * If this annotation is used at the package level, then value of - * the type() must be specified. - */ - - Class type() default DEFAULT.class; - - /** - * Used in {@link XmlJavaTypeAdapter#type()} to - * signal that the type be inferred from the signature - * of the field, property, parameter or the class. - */ - - static final class DEFAULT {} - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/XmlJavaTypeAdapters.java 2018-01-30 20:40:10.000000000 -0500 +++ /dev/null 2018-01-30 20:40:10.000000000 -0500 @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2004, 2015, 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 javax.xml.bind.annotation.adapters; - -import static java.lang.annotation.ElementType.PACKAGE; -import java.lang.annotation.Retention; -import static java.lang.annotation.RetentionPolicy.RUNTIME; -import java.lang.annotation.Target; - -/** - *

- * A container for multiple @{@link XmlJavaTypeAdapter} annotations. - * - *

Multiple annotations of the same type are not allowed on a program - * element. This annotation therefore serves as a container annotation - * for multiple @XmlJavaTypeAdapter as follows: - * - *

- * @XmlJavaTypeAdapters ({ @XmlJavaTypeAdapter(...),@XmlJavaTypeAdapter(...) })
- * 
- * - *

The {@code @XmlJavaTypeAdapters} annotation is useful for - * defining {@link XmlJavaTypeAdapter} annotations for different types - * at the package level. - * - *

See "Package Specification" in javax.xml.bind.package javadoc for - * additional common information.

- * - * @author
  • Sekhar Vajjhala, Sun Microsystems, Inc.
- * @see XmlJavaTypeAdapter - * @since 1.6, JAXB 2.0 - */ -@Retention(RUNTIME) @Target({PACKAGE}) -public @interface XmlJavaTypeAdapters { - /** - * Collection of @{@link XmlJavaTypeAdapter} annotations - */ - XmlJavaTypeAdapter[] value(); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/adapters/package-info.java 2018-01-30 20:40:11.000000000 -0500 +++ /dev/null 2018-01-30 20:40:11.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2004, 2017, 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. - */ - -/** - * {@link javax.xml.bind.annotation.adapters.XmlAdapter} and its spec-defined - * sub-classes to allow arbitrary Java classes to be used with JAXB. - * - *

Package Specification

- * - * - * - *

Related Documentation

- * - * For overviews, tutorials, examples, guides, and tool documentation, - * please see: - * - * - * @see JAXB Website - */ -package javax.xml.bind.annotation.adapters; --- old/src/java.xml.bind/share/classes/javax/xml/bind/annotation/package.html 2018-01-30 20:40:11.000000000 -0500 +++ /dev/null 2018-01-30 20:40:11.000000000 -0500 @@ -1,208 +0,0 @@ - - - - - - - - - - - -

- Defines annotations for customizing Java program elements to XML Schema mapping. - -

Package Specification

-

The following table shows the JAXB mapping annotations - that can be associated with each program element.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Program ElementJAXB annotation
Package - -
Class - -
Enum type - -
JavaBean Property/field - -
Parameter - -
-

Terminology

-

- JavaBean property and field: For the purposes of - mapping, there is no semantic difference between a field and - a JavaBean property. Thus, an annotation that can be applied - to a JavaBean property can always be applied to a - field. Hence in the Javadoc documentation, for brevity, the - term JavaBean property or property is used to mean either JavaBean - property or a field. Where required, both are explicitly - mentioned. -

- top level class: For the purpose of mapping, there is - no semantic difference between a top level class and a - static nested class. Thus, an annotation that can be applied - to a top level class, can always be applied to a nested - static class. Hence in the Javadoc documentation, for - brevity, the term "top level class" or just class is used to - mean either a top level class or a nested static - class. -

- mapping annotation:A JAXB 2.0 defined program - annotation based on the JSR 175 programming annotation - facility. -

Common Usage Constraints

-

The following usage constraints are defined here since - they apply to more than annotation: -

    -
  • For a property, a given annotation can be applied to - either read or write property but not both.
  • - -
  • A property name must be different from any other - property name in any of the super classes of the - class being mapped.
  • - -
  • A mapped field name or the decapitalized name of a - mapped property must be unique within a class.
  • -
-

Notations

- Namespace prefixes -

The following namespace prefixes are used in the XML Schema - fragments in this package. - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PrefixNamespaceNotes
xshttp://www.w3.org/2001/XMLSchemaNamespace of XML Schema namespace
refhttp://ws-i.org/profiles/basic/1.1/xsdNamespace for swaref schema component
xsihttp://www.w3.org/2001/XMLSchema-instanceXML Schema namespace for instances
- - - @since 1.6, JAXB 2.0 - - - - --- old/src/java.xml.bind/share/classes/javax/xml/bind/attachment/AttachmentMarshaller.java 2018-01-30 20:40:12.000000000 -0500 +++ /dev/null 2018-01-30 20:40:12.000000000 -0500 @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.xml.bind.attachment; - -import javax.activation.DataHandler; -import javax.xml.bind.Marshaller; - -/** - *

Enable JAXB marshalling to optimize storage of binary data. - * - *

This API enables an efficient cooperative creation of optimized - * binary data formats between a JAXB marshalling process and a MIME-based package - * processor. A JAXB implementation marshals the root body of a MIME-based package, - * delegating the creation of referenceable MIME parts to - * the MIME-based package processor that implements this abstraction. - * - *

XOP processing is enabled when {@link #isXOPPackage()} is true. - * See {@link #addMtomAttachment(DataHandler, String, String)} for details. - * - * - *

WS-I Attachment Profile 1.0 is supported by - * {@link #addSwaRefAttachment(DataHandler)} being called by the - * marshaller for each JAXB property related to - * {http://ws-i.org/profiles/basic/1.1/xsd}swaRef. - * - * - * @author Marc Hadley - * @author Kohsuke Kawaguchi - * @author Joseph Fialli - * @since 1.6, JAXB 2.0 - * - * @see Marshaller#setAttachmentMarshaller(AttachmentMarshaller) - * - * @see XML-binary Optimized Packaging - * @see WS-I Attachments Profile Version 1.0. - */ -public abstract class AttachmentMarshaller { - - /** - *

Consider MIME content {@code data} for optimized binary storage as an attachment. - * - *

- * This method is called by JAXB marshal process when {@link #isXOPPackage()} is - * {@code true}, for each element whose datatype is "base64Binary", as described in - * Step 3 in - * Creating XOP Packages. - * - *

- * The method implementor determines whether {@code data} shall be attached separately - * or inlined as base64Binary data. If the implementation chooses to optimize the storage - * of the binary data as a MIME part, it is responsible for attaching {@code data} to the - * MIME-based package, and then assigning an unique content-id, cid, that identifies - * the MIME part within the MIME message. This method returns the cid, - * which enables the JAXB marshaller to marshal a XOP element that refers to that cid in place - * of marshalling the binary data. When the method returns null, the JAXB marshaller - * inlines {@code data} as base64binary data. - * - *

- * The caller of this method is required to meet the following constraint. - * If the element infoset item containing {@code data} has the attribute - * {@code xmime:contentType} or if the JAXB property/field representing - * {@code data} is annotated with a known MIME type, - * {@code data.getContentType()} should be set to that MIME type. - * - *

- * The {@code elementNamespace} and {@code elementLocalName} - * parameters provide the - * context that contains the binary data. This information could - * be used by the MIME-based package processor to determine if the - * binary data should be inlined or optimized as an attachment. - * - * @param data - * represents the data to be attached. Must be non-null. - * @param elementNamespace - * the namespace URI of the element that encloses the base64Binary data. - * Can be empty but never null. - * @param elementLocalName - * The local name of the element. Always a non-null valid string. - * - * @return - * a valid content-id URI (see RFC 2387) that identifies the attachment containing {@code data}. - * Otherwise, null if the attachment was not added and should instead be inlined in the message. - * - * @see XML-binary Optimized Packaging - * @see Describing Media Content of Binary Data in XML - */ - public abstract String addMtomAttachment(DataHandler data, String elementNamespace, String elementLocalName); - - /** - *

Consider binary {@code data} for optimized binary storage as an attachment. - * - *

Since content type is not known, the attachment's MIME content type must be set to "application/octet-stream". - * - *

- * The {@code elementNamespace} and {@code elementLocalName} - * parameters provide the - * context that contains the binary data. This information could - * be used by the MIME-based package processor to determine if the - * binary data should be inlined or optimized as an attachment. - * - * @param data - * represents the data to be attached. Must be non-null. The actual data region is - * specified by {@code (data,offset,length)} tuple. - * - * @param offset - * The offset within the array of the first byte to be read; - * must be non-negative and no larger than array.length - * - * @param length - * The number of bytes to be read from the given array; - * must be non-negative and no larger than array.length - * - * @param mimeType - * If the data has an associated MIME type known to JAXB, that is passed - * as this parameter. If none is known, "application/octet-stream". - * This parameter may never be null. - * - * @param elementNamespace - * the namespace URI of the element that encloses the base64Binary data. - * Can be empty but never null. - * - * @param elementLocalName - * The local name of the element. Always a non-null valid string. - * - * @return content-id URI, cid, to the attachment containing - * {@code data} or null if data should be inlined. - * - * @see #addMtomAttachment(DataHandler, String, String) - */ - public abstract String addMtomAttachment(byte[] data, int offset, int length, String mimeType, String elementNamespace, String elementLocalName); - - /** - *

Read-only property that returns true if JAXB marshaller should enable XOP creation. - * - *

This value must not change during the marshalling process. When this - * value is true, the {@code addMtomAttachment(...)} method - * is invoked when the appropriate binary datatypes are encountered by - * the marshal process. - * - *

Marshaller.marshal() must throw IllegalStateException if this value is {@code true} - * and the XML content to be marshalled violates Step 1 in - * Creating XOP Pacakges - * http://www.w3.org/TR/2005/REC-xop10-20050125/#creating_xop_packages. - * "Ensure the Original XML Infoset contains no element information item with a - * [namespace name] of "http://www.w3.org/2004/08/xop/include" and a [local name] of Include" - * - *

When this method returns true and during the marshal process - * at least one call to {@code addMtomAttachment(...)} returns - * a content-id, the MIME-based package processor must label the - * root part with the application/xop+xml media type as described in - * Step 5 of - * Creating XOP Pacakges. - * - * @return true when MIME context is a XOP Package. - */ - public boolean isXOPPackage() { return false; } - - /** - *

Add MIME {@code data} as an attachment and return attachment's content-id, cid. - * - *

- * This method is called by JAXB marshal process for each element/attribute typed as - * {http://ws-i.org/profiles/basic/1.1/xsd}swaRef. The MIME-based package processor - * implementing this method is responsible for attaching the specified data to a - * MIME attachment, and generating a content-id, cid, that uniquely identifies the attachment - * within the MIME-based package. - * - *

Caller inserts the returned content-id, cid, into the XML content being marshalled. - * - * @param data - * represents the data to be attached. Must be non-null. - * @return - * must be a valid URI used as cid. Must satisfy Conformance Requirement R2928 from - * WS-I Attachments Profile Version 1.0. - */ - public abstract String addSwaRefAttachment(DataHandler data); -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/attachment/AttachmentUnmarshaller.java 2018-01-30 20:40:13.000000000 -0500 +++ /dev/null 2018-01-30 20:40:13.000000000 -0500 @@ -1,138 +0,0 @@ -/* - * Copyright (c) 2005, 2017, 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 javax.xml.bind.attachment; - -import javax.activation.DataHandler; - -/** - *

Enables JAXB unmarshalling of a root document containing optimized binary data formats.

- * - *

This API enables an efficient cooperative processing of optimized - * binary data formats between a JAXB 2.0 implementation and MIME-based package - * processor (MTOM/XOP and WS-I AP 1.0). JAXB unmarshals the body of a package, delegating the - * understanding of the packaging format being used to a MIME-based - * package processor that implements this abstract class.

- * - *

This abstract class identifies if a package requires XOP processing, {@link #isXOPPackage()} - * and provides retrieval of binary content stored as attachments by content-id.

- * - *

Identifying the content-id, cid, to pass to {@code getAttachment*(String cid)}

- * - * - * @author Marc Hadley - * @author Kohsuke Kawaguchi - * @author Joseph Fialli - * - * @since 1.6, JAXB 2.0 - * - * @see javax.xml.bind.Unmarshaller#setAttachmentUnmarshaller(AttachmentUnmarshaller) - * - * @see XML-binary Optimized Packaging - * @see WS-I Attachments Profile Version 1.0. - * @see Describing Media Content of Binary Data in XML - */ -public abstract class AttachmentUnmarshaller { - /** - *

Lookup MIME content by content-id, {@code cid}, and return as a {@link DataHandler}.

- * - *

The returned {@code DataHandler} instance must be configured - * to meet the following required mapping constaint. - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - * - *
Required Mappings between MIME and Java Types
MIME TypeJava Type
{@code DataHandler.getContentType()}{@code instanceof DataHandler.getContent()}
image/gifjava.awt.Image
image/jpegjava.awt.Image
text/xml or application/xmljavax.xml.transform.Source
- * Note that it is allowable to support additional mappings. - * - * @param cid It is expected to be a valid lexical form of the XML Schema - * {@code xs:anyURI} datatype. If {@link #isXOPPackage()}{@code ==true}, - * it must be a valid URI per the {@code cid:} URI scheme (see RFC 2387) - * - * @return - * a {@link DataHandler} that represents the MIME attachment. - * - * @throws IllegalArgumentException if the attachment for the given cid is not found. - */ - public abstract DataHandler getAttachmentAsDataHandler(String cid); - - /** - *

Retrieve the attachment identified by content-id, {@code cid}, as a {@code byte[]}. - * - * @param cid It is expected to be a valid lexical form of the XML Schema - * {@code xs:anyURI} datatype. If {@link #isXOPPackage()}{@code ==true}, - * it must be a valid URI per the {@code cid:} URI scheme (see RFC 2387) - * - * @return byte[] representation of attachment identified by cid. - * - * @throws IllegalArgumentException if the attachment for the given cid is not found. - */ - public abstract byte[] getAttachmentAsByteArray(String cid); - - /** - *

Read-only property that returns true if JAXB unmarshaller needs to perform XOP processing.

- * - *

This method returns {@code true} when the constraints specified - * in Identifying XOP Documents are met. - * This value must not change during the unmarshalling process.

- * - * @return true when MIME context is a XOP Document. - */ - public boolean isXOPPackage() { return false; } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/attachment/package.html 2018-01-30 20:40:14.000000000 -0500 +++ /dev/null 2018-01-30 20:40:14.000000000 -0500 @@ -1,68 +0,0 @@ - - - - - - - - - - - -

- This package is implemented by a MIME-based package processor that - enables the interpretation and creation of optimized binary data - within an MIME-based package format. - -

- Soap MTOM[1], XOP([2][3]) and WS-I AP[4] standardize approaches to - optimized transmission of binary datatypes as an attachment. - To optimally support these standards within a message passing - environment, this package enables an integrated solution between - a MIME-based package processor and JAXB unmarshall/marshal processes. - -

Package Specification

- - - -

Related Standards

- - - - - @since JAXB 2.0 - - - - --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/AbstractMarshallerImpl.java 2018-01-30 20:40:14.000000000 -0500 +++ /dev/null 2018-01-30 20:40:14.000000000 -0500 @@ -1,495 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.helpers; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.bind.PropertyException; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.attachment.AttachmentMarshaller; -import javax.xml.stream.XMLEventWriter; -import javax.xml.stream.XMLStreamWriter; -import javax.xml.transform.dom.DOMResult; -import javax.xml.transform.sax.SAXResult; -import javax.xml.transform.stream.StreamResult; -import javax.xml.validation.Schema; -import java.io.UnsupportedEncodingException; -import java.io.File; -import java.io.OutputStream; -import java.io.FileOutputStream; -import java.io.BufferedOutputStream; -import java.io.IOException; -// J2SE1.4 feature -// import java.nio.charset.Charset; -// import java.nio.charset.UnsupportedCharsetException; - -/** - * Partial default {@code Marshaller} implementation. - * - *

- * This class provides a partial default implementation for the - * {@link javax.xml.bind.Marshaller} interface. - * - *

- * The only methods that a JAXB Provider has to implement are - * {@link Marshaller#marshal(Object, javax.xml.transform.Result) marshal(Object, javax.xml.transform.Result)}, - * {@link Marshaller#marshal(Object, javax.xml.transform.Result) marshal(Object, javax.xml.stream.XMLStreamWriter)}, and - * {@link Marshaller#marshal(Object, javax.xml.transform.Result) marshal(Object, javax.xml.stream.XMLEventWriter)}. - * - * @author

  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
- * @see javax.xml.bind.Marshaller - * @since 1.6, JAXB 1.0 - */ -public abstract class AbstractMarshallerImpl implements Marshaller -{ - /** handler that will be used to process errors and warnings during marshal */ - private ValidationEventHandler eventHandler = - new DefaultValidationEventHandler(); - - //J2SE1.4 feature - //private Charset encoding = null; - - /** store the value of the encoding property. */ - private String encoding = "UTF-8"; - - /** store the value of the schemaLocation property. */ - private String schemaLocation = null; - - /** store the value of the noNamespaceSchemaLocation property. */ - private String noNSSchemaLocation = null; - - /** store the value of the formattedOutput property. */ - private boolean formattedOutput = false; - - /** store the value of the fragment property. */ - private boolean fragment = false; - - public final void marshal( Object obj, java.io.OutputStream os ) - throws JAXBException { - - checkNotNull( obj, "obj", os, "os" ); - marshal( obj, new StreamResult(os) ); - } - - public void marshal(Object jaxbElement, File output) throws JAXBException { - checkNotNull(jaxbElement, "jaxbElement", output, "output" ); - try { - OutputStream os = new BufferedOutputStream(new FileOutputStream(output)); - try { - marshal( jaxbElement, new StreamResult(os) ); - } finally { - os.close(); - } - } catch (IOException e) { - throw new JAXBException(e); - } - } - - public final void marshal( Object obj, java.io.Writer w ) - throws JAXBException { - - checkNotNull( obj, "obj", w, "writer" ); - marshal( obj, new StreamResult(w) ); - } - - public final void marshal( Object obj, org.xml.sax.ContentHandler handler ) - throws JAXBException { - - checkNotNull( obj, "obj", handler, "handler" ); - marshal( obj, new SAXResult(handler) ); - } - - public final void marshal( Object obj, org.w3c.dom.Node node ) - throws JAXBException { - - checkNotNull( obj, "obj", node, "node" ); - marshal( obj, new DOMResult(node) ); - } - - /** - * By default, the getNode method is unsupported and throw - * an {@link java.lang.UnsupportedOperationException}. - * - * Implementations that choose to support this method must - * override this method. - */ - public org.w3c.dom.Node getNode( Object obj ) throws JAXBException { - - checkNotNull( obj, "obj", Boolean.TRUE, "foo" ); - - throw new UnsupportedOperationException(); - } - - /** - * Convenience method for getting the current output encoding. - * - * @return the current encoding or "UTF-8" if it hasn't been set. - */ - protected String getEncoding() { - return encoding; - } - - /** - * Convenience method for setting the output encoding. - * - * @param encoding a valid encoding as specified in the Marshaller class - * documentation - */ - protected void setEncoding( String encoding ) { - this.encoding = encoding; - } - - /** - * Convenience method for getting the current schemaLocation. - * - * @return the current schemaLocation or null if it hasn't been set - */ - protected String getSchemaLocation() { - return schemaLocation; - } - - /** - * Convenience method for setting the schemaLocation. - * - * @param location the schemaLocation value - */ - protected void setSchemaLocation( String location ) { - schemaLocation = location; - } - - /** - * Convenience method for getting the current noNamespaceSchemaLocation. - * - * @return the current noNamespaceSchemaLocation or null if it hasn't - * been set - */ - protected String getNoNSSchemaLocation() { - return noNSSchemaLocation; - } - - /** - * Convenience method for setting the noNamespaceSchemaLocation. - * - * @param location the noNamespaceSchemaLocation value - */ - protected void setNoNSSchemaLocation( String location ) { - noNSSchemaLocation = location; - } - - /** - * Convenience method for getting the formatted output flag. - * - * @return the current value of the formatted output flag or false if - * it hasn't been set. - */ - protected boolean isFormattedOutput() { - return formattedOutput; - } - - /** - * Convenience method for setting the formatted output flag. - * - * @param v value of the formatted output flag. - */ - protected void setFormattedOutput( boolean v ) { - formattedOutput = v; - } - - - /** - * Convenience method for getting the fragment flag. - * - * @return the current value of the fragment flag or false if - * it hasn't been set. - */ - protected boolean isFragment() { - return fragment; - } - - /** - * Convenience method for setting the fragment flag. - * - * @param v value of the fragment flag. - */ - protected void setFragment( boolean v ) { - fragment = v; - } - - - static String[] aliases = { - "UTF-8", "UTF8", - "UTF-16", "Unicode", - "UTF-16BE", "UnicodeBigUnmarked", - "UTF-16LE", "UnicodeLittleUnmarked", - "US-ASCII", "ASCII", - "TIS-620", "TIS620", - - // taken from the project-X parser - "ISO-10646-UCS-2", "Unicode", - - "EBCDIC-CP-US", "cp037", - "EBCDIC-CP-CA", "cp037", - "EBCDIC-CP-NL", "cp037", - "EBCDIC-CP-WT", "cp037", - - "EBCDIC-CP-DK", "cp277", - "EBCDIC-CP-NO", "cp277", - "EBCDIC-CP-FI", "cp278", - "EBCDIC-CP-SE", "cp278", - - "EBCDIC-CP-IT", "cp280", - "EBCDIC-CP-ES", "cp284", - "EBCDIC-CP-GB", "cp285", - "EBCDIC-CP-FR", "cp297", - - "EBCDIC-CP-AR1", "cp420", - "EBCDIC-CP-HE", "cp424", - "EBCDIC-CP-BE", "cp500", - "EBCDIC-CP-CH", "cp500", - - "EBCDIC-CP-ROECE", "cp870", - "EBCDIC-CP-YU", "cp870", - "EBCDIC-CP-IS", "cp871", - "EBCDIC-CP-AR2", "cp918", - - // IANA also defines two that JDK 1.2 doesn't handle: - // EBCDIC-CP-GR --> CP423 - // EBCDIC-CP-TR --> CP905 - }; - - /** - * Gets the corresponding Java encoding name from an IANA name. - * - * This method is a helper method for the derived class to convert - * encoding names. - * - * @exception UnsupportedEncodingException - * If this implementation couldn't find the Java encoding name. - */ - protected String getJavaEncoding( String encoding ) throws UnsupportedEncodingException { - try { - "1".getBytes(encoding); - return encoding; - } catch( UnsupportedEncodingException e ) { - // try known alias - for( int i=0; i void setAdapter(Class type, A adapter) { - throw new UnsupportedOperationException(); - } - - public A getAdapter(Class type) { - throw new UnsupportedOperationException(); - } - - public void setAttachmentMarshaller(AttachmentMarshaller am) { - throw new UnsupportedOperationException(); - } - - public AttachmentMarshaller getAttachmentMarshaller() { - throw new UnsupportedOperationException(); - } - - public void setListener(Listener listener) { - throw new UnsupportedOperationException(); - } - - public Listener getListener() { - throw new UnsupportedOperationException(); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/AbstractUnmarshallerImpl.java 2018-01-30 20:40:15.000000000 -0500 +++ /dev/null 2018-01-30 20:40:15.000000000 -0500 @@ -1,425 +0,0 @@ -/* - * Copyright (c) 2003, 2016, 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 javax.xml.bind.helpers; - -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.XMLReader; -import org.w3c.dom.Node; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.PropertyException; -import javax.xml.bind.UnmarshalException; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import javax.xml.bind.attachment.AttachmentUnmarshaller; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.parsers.SAXParserFactory; -import javax.xml.stream.XMLEventReader; -import javax.xml.stream.XMLStreamReader; -import javax.xml.transform.Source; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.sax.SAXSource; -import javax.xml.transform.stream.StreamSource; -import javax.xml.validation.Schema; -import java.io.*; -import java.net.URL; - -/** - * Partial default {@code Unmarshaller} implementation. - * - *

- * This class provides a partial default implementation for the - * {@link javax.xml.bind.Unmarshaller}interface. - * - *

- * A JAXB Provider has to implement five methods (getUnmarshallerHandler, - * unmarshal(Node), unmarshal(XMLReader,InputSource), - * unmarshal(XMLStreamReader), and unmarshal(XMLEventReader). - * - * @author

    - *
  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • - *
- * @see javax.xml.bind.Unmarshaller - * @since 1.6, JAXB 1.0 - */ -public abstract class AbstractUnmarshallerImpl implements Unmarshaller -{ - /** handler that will be used to process errors and warnings during unmarshal */ - private ValidationEventHandler eventHandler = - new DefaultValidationEventHandler(); - - /** whether or not the unmarshaller will validate */ - protected boolean validating = false; - - /** - * XMLReader that will be used to parse a document. - */ - private XMLReader reader = null; - - /** - * Obtains a configured XMLReader. - * - * This method is used when the client-specified - * {@link SAXSource} object doesn't have XMLReader. - * - * {@link Unmarshaller} is not re-entrant, so we will - * only use one instance of XMLReader. - */ - protected XMLReader getXMLReader() throws JAXBException { - if(reader==null) { - try { - SAXParserFactory parserFactory; - parserFactory = SAXParserFactory.newInstance(); - parserFactory.setNamespaceAware(true); - // there is no point in asking a validation because - // there is no guarantee that the document will come with - // a proper schemaLocation. - parserFactory.setValidating(false); - reader = parserFactory.newSAXParser().getXMLReader(); - } catch( ParserConfigurationException e ) { - throw new JAXBException(e); - } catch( SAXException e ) { - throw new JAXBException(e); - } - } - return reader; - } - - public Object unmarshal( Source source ) throws JAXBException { - if( source == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "source" ) ); - } - - if(source instanceof SAXSource) - return unmarshal( (SAXSource)source ); - if(source instanceof StreamSource) - return unmarshal( streamSourceToInputSource((StreamSource)source)); - if(source instanceof DOMSource) - return unmarshal( ((DOMSource)source).getNode() ); - - // we don't handle other types of Source - throw new IllegalArgumentException(); - } - - // use the client specified XMLReader contained in the SAXSource. - private Object unmarshal( SAXSource source ) throws JAXBException { - - XMLReader r = source.getXMLReader(); - if( r == null ) - r = getXMLReader(); - - return unmarshal( r, source.getInputSource() ); - } - - /** - * Unmarshals an object by using the specified XMLReader and the InputSource. - * - * The callee should call the setErrorHandler method of the XMLReader - * so that errors are passed to the client-specified ValidationEventHandler. - */ - protected abstract Object unmarshal( XMLReader reader, InputSource source ) throws JAXBException; - - public final Object unmarshal( InputSource source ) throws JAXBException { - if( source == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "source" ) ); - } - - return unmarshal( getXMLReader(), source ); - } - - - private Object unmarshal( String url ) throws JAXBException { - return unmarshal( new InputSource(url) ); - } - - public final Object unmarshal( URL url ) throws JAXBException { - if( url == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "url" ) ); - } - - return unmarshal( url.toExternalForm() ); - } - - public final Object unmarshal( File f ) throws JAXBException { - if( f == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "file" ) ); - } - - try { - return unmarshal(new BufferedInputStream(new FileInputStream(f))); - } catch( FileNotFoundException e ) { - throw new IllegalArgumentException(e.getMessage()); - } - } - - public final Object unmarshal( java.io.InputStream is ) - throws JAXBException { - - if( is == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "is" ) ); - } - - InputSource isrc = new InputSource( is ); - return unmarshal( isrc ); - } - - public final Object unmarshal( Reader reader ) throws JAXBException { - if( reader == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "reader" ) ); - } - - InputSource isrc = new InputSource( reader ); - return unmarshal( isrc ); - } - - - private static InputSource streamSourceToInputSource( StreamSource ss ) { - InputSource is = new InputSource(); - is.setSystemId( ss.getSystemId() ); - is.setByteStream( ss.getInputStream() ); - is.setCharacterStream( ss.getReader() ); - - return is; - } - - - /** - * Indicates whether or not the Unmarshaller is configured to validate - * during unmarshal operations. - *

- * Note: I named this method isValidating() to stay in-line - * with JAXP, as opposed to naming it getValidating(). - * - * @return true if the Unmarshaller is configured to validate during - * unmarshal operations, false otherwise - * @throws JAXBException if an error occurs while retrieving the validating - * flag - */ - public boolean isValidating() throws JAXBException { - return validating; - } - - /** - * Allow an application to register a validation event handler. - *

- * The validation event handler will be called by the JAXB Provider if any - * validation errors are encountered during calls to any of the - * {@code unmarshal} methods. If the client application does not register - * a validation event handler before invoking the unmarshal methods, then - * all validation events will be silently ignored and may result in - * unexpected behaviour. - * - * @param handler the validation event handler - * @throws JAXBException if an error was encountered while setting the - * event handler - */ - public void setEventHandler(ValidationEventHandler handler) - throws JAXBException { - - if( handler == null ) { - eventHandler = new DefaultValidationEventHandler(); - } else { - eventHandler = handler; - } - } - - /** - * Specifies whether or not the Unmarshaller should validate during - * unmarshal operations. By default, the {@code Unmarshaller} does - * not validate. - *

- * This method may only be invoked before or after calling one of the - * unmarshal methods. - * - * @param validating true if the Unmarshaller should validate during - * unmarshal, false otherwise - * @throws JAXBException if an error occurred while enabling or disabling - * validation at unmarshal time - */ - public void setValidating(boolean validating) throws JAXBException { - this.validating = validating; - } - - /** - * Return the current event handler or the default event handler if one - * hasn't been set. - * - * @return the current ValidationEventHandler or the default event handler - * if it hasn't been set - * @throws JAXBException if an error was encountered while getting the - * current event handler - */ - public ValidationEventHandler getEventHandler() throws JAXBException { - return eventHandler; - } - - - /** - * Creates an UnmarshalException from a SAXException. - * - * This is an utility method provided for the derived classes. - * - *

- * When a provider-implemented ContentHandler wants to throw a - * JAXBException, it needs to wrap the exception by a SAXException. - * If the unmarshaller implementation blindly wrap SAXException - * by JAXBException, such an exception will be a JAXBException - * wrapped by a SAXException wrapped by another JAXBException. - * This is silly. - * - *

- * This method checks the nested exception of SAXException - * and reduce those excessive wrapping. - * - * @return the resulting UnmarshalException - */ - protected UnmarshalException createUnmarshalException( SAXException e ) { - // check the nested exception to see if it's an UnmarshalException - Exception nested = e.getException(); - if(nested instanceof UnmarshalException) - return (UnmarshalException)nested; - - if(nested instanceof RuntimeException) - // typically this is an unexpected exception, - // just throw it rather than wrap it, so that the full stack - // trace can be displayed. - throw (RuntimeException)nested; - - - // otherwise simply wrap it - if(nested!=null) - return new UnmarshalException(nested); - else - return new UnmarshalException(e); - } - - /** - * Default implementation of the setProperty method always - * throws PropertyException since there are no required - * properties. If a provider needs to handle additional - * properties, it should override this method in a derived class. - */ - public void setProperty( String name, Object value ) - throws PropertyException { - - if( name == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) ); - } - - throw new PropertyException(name, value); - } - - /** - * Default implementation of the getProperty method always - * throws PropertyException since there are no required - * properties. If a provider needs to handle additional - * properties, it should override this method in a derived class. - */ - public Object getProperty( String name ) - throws PropertyException { - - if( name == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "name" ) ); - } - - throw new PropertyException(name); - } - - public Object unmarshal(XMLEventReader reader) throws JAXBException { - - throw new UnsupportedOperationException(); - } - - public Object unmarshal(XMLStreamReader reader) throws JAXBException { - - throw new UnsupportedOperationException(); - } - - public JAXBElement unmarshal(Node node, Class expectedType) throws JAXBException { - throw new UnsupportedOperationException(); - } - - public JAXBElement unmarshal(Source source, Class expectedType) throws JAXBException { - throw new UnsupportedOperationException(); - } - - public JAXBElement unmarshal(XMLStreamReader reader, Class expectedType) throws JAXBException { - throw new UnsupportedOperationException(); - } - - public JAXBElement unmarshal(XMLEventReader reader, Class expectedType) throws JAXBException { - throw new UnsupportedOperationException(); - } - - public void setSchema(Schema schema) { - throw new UnsupportedOperationException(); - } - - public Schema getSchema() { - throw new UnsupportedOperationException(); - } - - public void setAdapter(XmlAdapter adapter) { - if(adapter==null) - throw new IllegalArgumentException(); - setAdapter((Class)adapter.getClass(),adapter); - } - - public void setAdapter(Class type, A adapter) { - throw new UnsupportedOperationException(); - } - - public A getAdapter(Class type) { - throw new UnsupportedOperationException(); - } - - public void setAttachmentUnmarshaller(AttachmentUnmarshaller au) { - throw new UnsupportedOperationException(); - } - - public AttachmentUnmarshaller getAttachmentUnmarshaller() { - throw new UnsupportedOperationException(); - } - - public void setListener(Listener listener) { - throw new UnsupportedOperationException(); - } - - public Listener getListener() { - throw new UnsupportedOperationException(); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/DefaultValidationEventHandler.java 2018-01-30 20:40:16.000000000 -0500 +++ /dev/null 2018-01-30 20:40:16.000000000 -0500 @@ -1,131 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.helpers; - -import org.w3c.dom.Node; - -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.ValidationEventHandler; -import javax.xml.bind.ValidationEventLocator; -import java.net.URL; - -/** - *

- * JAXB 1.0 only default validation event handler. This is the default - * handler for all objects created from a JAXBContext that is managing - * schema-derived code generated by a JAXB 1.0 binding compiler. - * - *

- * This handler causes the unmarshal and validate operations to fail on the first - * error or fatal error. - * - *

- * This handler is not the default handler for JAXB mapped classes following - * JAXB 2.0 or later versions. Default validation event handling has changed - * and is specified in {@link javax.xml.bind.Unmarshaller} and - * {@link javax.xml.bind.Marshaller}. - * - * @author

- * @see javax.xml.bind.Unmarshaller - * @see javax.xml.bind.Validator - * @see javax.xml.bind.ValidationEventHandler - * @since 1.6, JAXB 1.0 - */ -public class DefaultValidationEventHandler implements ValidationEventHandler { - - public boolean handleEvent( ValidationEvent event ) { - - if( event == null ) { - throw new IllegalArgumentException(); - } - - // calculate the severity prefix and return value - String severity = null; - boolean retVal = false; - switch ( event.getSeverity() ) { - case ValidationEvent.WARNING: - severity = Messages.format( Messages.WARNING ); - retVal = true; // continue after warnings - break; - case ValidationEvent.ERROR: - severity = Messages.format( Messages.ERROR ); - retVal = false; // terminate after errors - break; - case ValidationEvent.FATAL_ERROR: - severity = Messages.format( Messages.FATAL_ERROR ); - retVal = false; // terminate after fatal errors - break; - default: - assert false : - Messages.format( Messages.UNRECOGNIZED_SEVERITY, - event.getSeverity() ); - } - - // calculate the location message - String location = getLocation( event ); - - System.out.println( - Messages.format( Messages.SEVERITY_MESSAGE, - severity, - event.getMessage(), - location ) ); - - // fail on the first error or fatal error - return retVal; - } - - /** - * Calculate a location message for the event - * - */ - private String getLocation(ValidationEvent event) { - StringBuffer msg = new StringBuffer(); - - ValidationEventLocator locator = event.getLocator(); - - if( locator != null ) { - - URL url = locator.getURL(); - Object obj = locator.getObject(); - Node node = locator.getNode(); - int line = locator.getLineNumber(); - - if( url!=null || line!=-1 ) { - msg.append( "line " + line ); - if( url!=null ) - msg.append( " of " + url ); - } else if( obj != null ) { - msg.append( " obj: " + obj.toString() ); - } else if( node != null ) { - msg.append( " node: " + node.toString() ); - } - } else { - msg.append( Messages.format( Messages.LOCATION_UNAVAILABLE ) ); - } - - return msg.toString(); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/Messages.java 2018-01-30 20:40:17.000000000 -0500 +++ /dev/null 2018-01-30 20:40:17.000000000 -0500 @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.helpers; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Formats error messages. - */ -class Messages -{ - static String format( String property ) { - return format( property, null ); - } - - static String format( String property, Object arg1 ) { - return format( property, new Object[]{arg1} ); - } - - static String format( String property, Object arg1, Object arg2 ) { - return format( property, new Object[]{arg1,arg2} ); - } - - static String format( String property, Object arg1, Object arg2, Object arg3 ) { - return format( property, new Object[]{arg1,arg2,arg3} ); - } - - // add more if necessary. - - /** Loads a string resource and formats it with specified arguments. */ - static String format( String property, Object[] args ) { - String text = ResourceBundle.getBundle(Messages.class.getName()).getString(property); - return MessageFormat.format(text,args); - } - -// -// -// Message resources -// -// - static final String INPUTSTREAM_NOT_NULL = // 0 args - "AbstractUnmarshallerImpl.ISNotNull"; - - static final String MUST_BE_BOOLEAN = // 1 arg - "AbstractMarshallerImpl.MustBeBoolean"; - - static final String MUST_BE_STRING = // 1 arg - "AbstractMarshallerImpl.MustBeString"; - - static final String SEVERITY_MESSAGE = // 3 args - "DefaultValidationEventHandler.SeverityMessage"; - - static final String LOCATION_UNAVAILABLE = // 0 args - "DefaultValidationEventHandler.LocationUnavailable"; - - static final String UNRECOGNIZED_SEVERITY = // 1 arg - "DefaultValidationEventHandler.UnrecognizedSeverity"; - - static final String WARNING = // 0 args - "DefaultValidationEventHandler.Warning"; - - static final String ERROR = // 0 args - "DefaultValidationEventHandler.Error"; - - static final String FATAL_ERROR = // 0 args - "DefaultValidationEventHandler.FatalError"; - - static final String ILLEGAL_SEVERITY = // 0 args - "ValidationEventImpl.IllegalSeverity"; - - static final String MUST_NOT_BE_NULL = // 1 arg - "Shared.MustNotBeNull"; -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/Messages.properties 2018-01-30 20:40:17.000000000 -0500 +++ /dev/null 2018-01-30 20:40:17.000000000 -0500 @@ -1,59 +0,0 @@ -# -# Copyright (c) 2003, 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. -# - -AbstractUnmarshallerImpl.ISNotNull = \ - InputStream can not be null - -AbstractMarshallerImpl.MustBeBoolean = \ - {0} must be boolean - -AbstractMarshallerImpl.MustBeString = \ - {0} must be a String - - -DefaultValidationEventHandler.SeverityMessage = \ - DefaultValidationEventHandler: {0} {1} \n\ -\ \ \ \ \ Location: {2} - -DefaultValidationEventHandler.LocationUnavailable = \ - unavailable - -DefaultValidationEventHandler.UnrecognizedSeverity = \ - Unrecognized event severity field "{0}" - -DefaultValidationEventHandler.Warning = \ - [WARNING]: - -DefaultValidationEventHandler.Error = \ - [ERROR]: - -DefaultValidationEventHandler.FatalError = \ - [FATAL_ERROR]: - -ValidationEventImpl.IllegalSeverity = \ - Illegal severity - -Shared.MustNotBeNull = \ - {0} parameter must not be null --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/NotIdentifiableEventImpl.java 2018-01-30 20:40:18.000000000 -0500 +++ /dev/null 2018-01-30 20:40:18.000000000 -0500 @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.helpers; - -import javax.xml.bind.ValidationEventLocator; - -/** - * Default implementation of the NotIdentifiableEvent interface. - * - *

- * JAXB providers are allowed to use whatever class that implements - * the ValidationEvent interface. This class is just provided for a - * convenience. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
- * @see javax.xml.bind.NotIdentifiableEvent - * @see javax.xml.bind.Validator - * @see javax.xml.bind.ValidationEventHandler - * @see javax.xml.bind.ValidationEvent - * @see javax.xml.bind.ValidationEventLocator - * @since 1.6, JAXB 1.0 - */ -public class NotIdentifiableEventImpl - extends ValidationEventImpl - implements javax.xml.bind.NotIdentifiableEvent { - - /** - * Create a new NotIdentifiableEventImpl. - * - * @param _severity The severity value for this event. Must be one of - * ValidationEvent.WARNING, ValidationEvent.ERROR, or - * ValidationEvent.FATAL_ERROR - * @param _message The text message for this event - may be null. - * @param _locator The locator object for this event - may be null. - * @throws IllegalArgumentException if an illegal severity field is supplied - */ - public NotIdentifiableEventImpl( int _severity, String _message, - ValidationEventLocator _locator) { - - super(_severity, _message, _locator); - } - - /** - * Create a new NotIdentifiableEventImpl. - * - * @param _severity The severity value for this event. Must be one of - * ValidationEvent.WARNING, ValidationEvent.ERROR, or - * ValidationEvent.FATAL_ERROR - * @param _message The text message for this event - may be null. - * @param _locator The locator object for this event - may be null. - * @param _linkedException An optional linked exception that may provide - * additional information about the event - may be null. - * @throws IllegalArgumentException if an illegal severity field is supplied - */ - public NotIdentifiableEventImpl( int _severity, String _message, - ValidationEventLocator _locator, - Throwable _linkedException) { - - super(_severity, _message, _locator, _linkedException); - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/ParseConversionEventImpl.java 2018-01-30 20:40:19.000000000 -0500 +++ /dev/null 2018-01-30 20:40:19.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.helpers; - -import javax.xml.bind.ParseConversionEvent; -import javax.xml.bind.ValidationEventLocator; - -/** - * Default implementation of the ParseConversionEvent interface. - * - *

- * JAXB providers are allowed to use whatever class that implements - * the ValidationEvent interface. This class is just provided for a - * convenience. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
- * @see javax.xml.bind.ParseConversionEvent - * @see javax.xml.bind.Validator - * @see javax.xml.bind.ValidationEventHandler - * @see javax.xml.bind.ValidationEvent - * @see javax.xml.bind.ValidationEventLocator - * @since 1.6, JAXB 1.0 - */ -public class ParseConversionEventImpl - extends ValidationEventImpl - implements ParseConversionEvent { - - /** - * Create a new ParseConversionEventImpl. - * - * @param _severity The severity value for this event. Must be one of - * ValidationEvent.WARNING, ValidationEvent.ERROR, or - * ValidationEvent.FATAL_ERROR - * @param _message The text message for this event - may be null. - * @param _locator The locator object for this event - may be null. - * @throws IllegalArgumentException if an illegal severity field is supplied - */ - public ParseConversionEventImpl( int _severity, String _message, - ValidationEventLocator _locator) { - - super(_severity, _message, _locator); - } - - /** - * Create a new ParseConversionEventImpl. - * - * @param _severity The severity value for this event. Must be one of - * ValidationEvent.WARNING, ValidationEvent.ERROR, or - * ValidationEvent.FATAL_ERROR - * @param _message The text message for this event - may be null. - * @param _locator The locator object for this event - may be null. - * @param _linkedException An optional linked exception that may provide - * additional information about the event - may be null. - * @throws IllegalArgumentException if an illegal severity field is supplied - */ - public ParseConversionEventImpl( int _severity, String _message, - ValidationEventLocator _locator, - Throwable _linkedException) { - - super(_severity, _message, _locator, _linkedException); - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/PrintConversionEventImpl.java 2018-01-30 20:40:20.000000000 -0500 +++ /dev/null 2018-01-30 20:40:20.000000000 -0500 @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.helpers; - -import javax.xml.bind.PrintConversionEvent; -import javax.xml.bind.ValidationEventLocator; - -/** - * Default implementation of the PrintConversionEvent interface. - * - *

- * JAXB providers are allowed to use whatever class that implements - * the ValidationEvent interface. This class is just provided for a - * convenience. - * - * @author

  • Ryan Shoemaker, Sun Microsystems, Inc.
- * @see javax.xml.bind.PrintConversionEvent - * @see javax.xml.bind.Validator - * @see javax.xml.bind.ValidationEventHandler - * @see javax.xml.bind.ValidationEvent - * @see javax.xml.bind.ValidationEventLocator - * @since 1.6, JAXB 1.0 - */ -public class PrintConversionEventImpl - extends ValidationEventImpl - implements PrintConversionEvent { - - /** - * Create a new PrintConversionEventImpl. - * - * @param _severity The severity value for this event. Must be one of - * ValidationEvent.WARNING, ValidationEvent.ERROR, or - * ValidationEvent.FATAL_ERROR - * @param _message The text message for this event - may be null. - * @param _locator The locator object for this event - may be null. - * @throws IllegalArgumentException if an illegal severity field is supplied - */ - public PrintConversionEventImpl( int _severity, String _message, - ValidationEventLocator _locator) { - - super(_severity, _message, _locator); - } - - /** - * Create a new PrintConversionEventImpl. - * - * @param _severity The severity value for this event. Must be one of - * ValidationEvent.WARNING, ValidationEvent.ERROR, or - * ValidationEvent.FATAL_ERROR - * @param _message The text message for this event - may be null. - * @param _locator The locator object for this event - may be null. - * @param _linkedException An optional linked exception that may provide - * additional information about the event - may be null. - * @throws IllegalArgumentException if an illegal severity field is supplied - */ - public PrintConversionEventImpl( int _severity, String _message, - ValidationEventLocator _locator, - Throwable _linkedException) { - - super(_severity, _message, _locator, _linkedException); - } - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/ValidationEventImpl.java 2018-01-30 20:40:20.000000000 -0500 +++ /dev/null 2018-01-30 20:40:21.000000000 -0500 @@ -1,175 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.helpers; - -import java.text.MessageFormat; - -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.ValidationEventLocator; - -/** - * Default implementation of the ValidationEvent interface. - * - *

- * JAXB providers are allowed to use whatever class that implements - * the ValidationEvent interface. This class is just provided for a - * convenience. - * - * @author

  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
- * @see javax.xml.bind.Validator - * @see javax.xml.bind.ValidationEventHandler - * @see javax.xml.bind.ValidationEvent - * @see javax.xml.bind.ValidationEventLocator - * @since 1.6, JAXB 1.0 - */ -public class ValidationEventImpl implements ValidationEvent -{ - - /** - * Create a new ValidationEventImpl. - * - * @param _severity The severity value for this event. Must be one of - * ValidationEvent.WARNING, ValidationEvent.ERROR, or - * ValidationEvent.FATAL_ERROR - * @param _message The text message for this event - may be null. - * @param _locator The locator object for this event - may be null. - * @throws IllegalArgumentException if an illegal severity field is supplied - */ - public ValidationEventImpl( int _severity, String _message, - ValidationEventLocator _locator ) { - - this(_severity,_message,_locator,null); - } - - /** - * Create a new ValidationEventImpl. - * - * @param _severity The severity value for this event. Must be one of - * ValidationEvent.WARNING, ValidationEvent.ERROR, or - * ValidationEvent.FATAL_ERROR - * @param _message The text message for this event - may be null. - * @param _locator The locator object for this event - may be null. - * @param _linkedException An optional linked exception that may provide - * additional information about the event - may be null. - * @throws IllegalArgumentException if an illegal severity field is supplied - */ - public ValidationEventImpl( int _severity, String _message, - ValidationEventLocator _locator, - Throwable _linkedException ) { - - setSeverity( _severity ); - this.message = _message; - this.locator = _locator; - this.linkedException = _linkedException; - } - - private int severity; - private String message; - private Throwable linkedException; - private ValidationEventLocator locator; - - public int getSeverity() { - return severity; - } - - - /** - * Set the severity field of this event. - * - * @param _severity Must be one of ValidationEvent.WARNING, - * ValidationEvent.ERROR, or ValidationEvent.FATAL_ERROR. - * @throws IllegalArgumentException if an illegal severity field is supplied - */ - public void setSeverity( int _severity ) { - - if( _severity != ValidationEvent.WARNING && - _severity != ValidationEvent.ERROR && - _severity != ValidationEvent.FATAL_ERROR ) { - throw new IllegalArgumentException( - Messages.format( Messages.ILLEGAL_SEVERITY ) ); - } - - this.severity = _severity; - } - - public String getMessage() { - return message; - } - /** - * Set the message field of this event. - * - * @param _message String message - may be null. - */ - public void setMessage( String _message ) { - this.message = _message; - } - - public Throwable getLinkedException() { - return linkedException; - } - /** - * Set the linked exception field of this event. - * - * @param _linkedException Optional linked exception - may be null. - */ - public void setLinkedException( Throwable _linkedException ) { - this.linkedException = _linkedException; - } - - public ValidationEventLocator getLocator() { - return locator; - } - /** - * Set the locator object for this event. - * - * @param _locator The locator - may be null. - */ - public void setLocator( ValidationEventLocator _locator ) { - this.locator = _locator; - } - - /** - * Returns a string representation of this object in a format - * helpful to debugging. - * - * @see Object#equals(Object) - */ - public String toString() { - String s; - switch(getSeverity()) { - case WARNING: s="WARNING";break; - case ERROR: s="ERROR";break; - case FATAL_ERROR: s="FATAL_ERROR";break; - default: s=String.valueOf(getSeverity());break; - } - return MessageFormat.format("[severity={0},message={1},locator={2}]", - new Object[]{ - s, - getMessage(), - getLocator() - }); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/ValidationEventLocatorImpl.java 2018-01-30 20:40:21.000000000 -0500 +++ /dev/null 2018-01-30 20:40:21.000000000 -0500 @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.helpers; - -import java.net.URL; -import java.net.MalformedURLException; -import java.text.MessageFormat; - -import javax.xml.bind.ValidationEventLocator; -import org.w3c.dom.Node; -import org.xml.sax.Locator; -import org.xml.sax.SAXParseException; - -/** - * Default implementation of the ValidationEventLocator interface. - * - *

- * JAXB providers are allowed to use whatever class that implements - * the ValidationEventLocator interface. This class is just provided for a - * convenience. - * - * @author

  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
- * @see javax.xml.bind.Validator - * @see javax.xml.bind.ValidationEventHandler - * @see javax.xml.bind.ValidationEvent - * @see javax.xml.bind.ValidationEventLocator - * @since 1.6, JAXB 1.0 - */ -public class ValidationEventLocatorImpl implements ValidationEventLocator -{ - /** - * Creates an object with all fields unavailable. - */ - public ValidationEventLocatorImpl() { - } - - /** - * Constructs an object from an org.xml.sax.Locator. - * - * The object's ColumnNumber, LineNumber, and URL become available from the - * values returned by the locator's getColumnNumber(), getLineNumber(), and - * getSystemId() methods respectively. Node, Object, and Offset are not - * available. - * - * @param loc the SAX Locator object that will be used to populate this - * event locator. - * @throws IllegalArgumentException if the Locator is null - */ - public ValidationEventLocatorImpl( Locator loc ) { - if( loc == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "loc" ) ); - } - - this.url = toURL(loc.getSystemId()); - this.columnNumber = loc.getColumnNumber(); - this.lineNumber = loc.getLineNumber(); - } - - /** - * Constructs an object from the location information of a SAXParseException. - * - * The object's ColumnNumber, LineNumber, and URL become available from the - * values returned by the locator's getColumnNumber(), getLineNumber(), and - * getSystemId() methods respectively. Node, Object, and Offset are not - * available. - * - * @param e the SAXParseException object that will be used to populate this - * event locator. - * @throws IllegalArgumentException if the SAXParseException is null - */ - public ValidationEventLocatorImpl( SAXParseException e ) { - if( e == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "e" ) ); - } - - this.url = toURL(e.getSystemId()); - this.columnNumber = e.getColumnNumber(); - this.lineNumber = e.getLineNumber(); - } - - /** - * Constructs an object that points to a DOM Node. - * - * The object's Node becomes available. ColumnNumber, LineNumber, Object, - * Offset, and URL are not available. - * - * @param _node the DOM Node object that will be used to populate this - * event locator. - * @throws IllegalArgumentException if the Node is null - */ - public ValidationEventLocatorImpl(Node _node) { - if( _node == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "_node" ) ); - } - - this.node = _node; - } - - /** - * Constructs an object that points to a JAXB content object. - * - * The object's Object becomes available. ColumnNumber, LineNumber, Node, - * Offset, and URL are not available. - * - * @param _object the Object that will be used to populate this - * event locator. - * @throws IllegalArgumentException if the Object is null - */ - public ValidationEventLocatorImpl(Object _object) { - if( _object == null ) { - throw new IllegalArgumentException( - Messages.format( Messages.MUST_NOT_BE_NULL, "_object" ) ); - } - - this.object = _object; - } - - /** Converts a system ID to an URL object. */ - private static URL toURL( String systemId ) { - try { - return new URL(systemId); - } catch( MalformedURLException e ) { - // TODO: how should we handle system id here? - return null; // for now - } - } - - private URL url = null; - private int offset = -1; - private int lineNumber = -1; - private int columnNumber = -1; - private Object object = null; - private Node node = null; - - - /** - * @see javax.xml.bind.ValidationEventLocator#getURL() - */ - public URL getURL() { - return url; - } - - /** - * Set the URL field on this event locator. Null values are allowed. - * - * @param _url the url - */ - public void setURL( URL _url ) { - this.url = _url; - } - - /** - * @see javax.xml.bind.ValidationEventLocator#getOffset() - */ - public int getOffset() { - return offset; - } - - /** - * Set the offset field on this event locator. - * - * @param _offset the offset - */ - public void setOffset( int _offset ) { - this.offset = _offset; - } - - /** - * @see javax.xml.bind.ValidationEventLocator#getLineNumber() - */ - public int getLineNumber() { - return lineNumber; - } - - /** - * Set the lineNumber field on this event locator. - * - * @param _lineNumber the line number - */ - public void setLineNumber( int _lineNumber ) { - this.lineNumber = _lineNumber; - } - - /** - * @see javax.xml.bind.ValidationEventLocator#getColumnNumber() - */ - public int getColumnNumber() { - return columnNumber; - } - - /** - * Set the columnNumber field on this event locator. - * - * @param _columnNumber the column number - */ - public void setColumnNumber( int _columnNumber ) { - this.columnNumber = _columnNumber; - } - - /** - * @see javax.xml.bind.ValidationEventLocator#getObject() - */ - public Object getObject() { - return object; - } - - /** - * Set the Object field on this event locator. Null values are allowed. - * - * @param _object the java content object - */ - public void setObject( Object _object ) { - this.object = _object; - } - - /** - * @see javax.xml.bind.ValidationEventLocator#getNode() - */ - public Node getNode() { - return node; - } - - /** - * Set the Node field on this event locator. Null values are allowed. - * - * @param _node the Node - */ - public void setNode( Node _node ) { - this.node = _node; - } - - /** - * Returns a string representation of this object in a format - * helpful to debugging. - * - * @see Object#equals(Object) - */ - public String toString() { - return MessageFormat.format("[node={0},object={1},url={2},line={3},col={4},offset={5}]", - getNode(), - getObject(), - getURL(), - String.valueOf(getLineNumber()), - String.valueOf(getColumnNumber()), - String.valueOf(getOffset())); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/helpers/package-info.java 2018-01-30 20:40:22.000000000 -0500 +++ /dev/null 2018-01-30 20:40:22.000000000 -0500 @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * JAXB Provider Use Only: Provides partial default implementations for - * some of the javax.xml.bind interfaces. - * - *

- * JAXB Providers can extend these classes and implement the abstract - * methods. - * - *

Package Specification

- * - *
- * - *

Related Documentation

- *

- * For overviews, tutorials, examples, guides, and tool documentation, - * please see: - *

- * - * @see JAXB Website - */ -package javax.xml.bind.helpers; --- old/src/java.xml.bind/share/classes/javax/xml/bind/package-info.java 2018-01-30 20:40:23.000000000 -0500 +++ /dev/null 2018-01-30 20:40:23.000000000 -0500 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * Provides a runtime binding framework for client applications including - * unmarshalling, marshalling, and validation capabilities. - *

- *

- * JAXBContext is the client-entry point to the runtime binding - * framework. - *

- *

- *

Package Specification

- *

- *

- *

- *

Related Documentation

- *

- * For overviews, tutorials, examples, guides, and tool documentation, - * please see: - *

- * - * @see JAXB Website - */ -package javax.xml.bind; --- old/src/java.xml.bind/share/classes/javax/xml/bind/package.html 2018-01-30 20:40:24.000000000 -0500 +++ /dev/null 2018-01-30 20:40:24.000000000 -0500 @@ -1,65 +0,0 @@ - - - - - - - - - - - -

- Provides a runtime binding framework for client applications including - unmarshalling, marshalling, and validation capabilities. - -

- JAXBContext is the client-entry point to the runtime binding - framework. - - -

Package Specification

- - - -

Related Documentation

- - For overviews, tutorials, examples, guides, and tool documentation, - please see: - - - - - - - - --- old/src/java.xml.bind/share/classes/javax/xml/bind/util/JAXBResult.java 2018-01-30 20:40:24.000000000 -0500 +++ /dev/null 2018-01-30 20:40:25.000000000 -0500 @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.util; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; -import javax.xml.bind.UnmarshallerHandler; -import javax.xml.transform.sax.SAXResult; - -/** - * JAXP {@link javax.xml.transform.Result} implementation - * that unmarshals a JAXB object. - * - *

- * This utility class is useful to combine JAXB with - * other Java/XML technologies. - * - *

- * The following example shows how to use JAXB to unmarshal a document - * resulting from an XSLT transformation. - * - *

- *
- *       JAXBResult result = new JAXBResult(
- *         JAXBContext.newInstance("org.acme.foo") );
- *
- *       // set up XSLT transformation
- *       TransformerFactory tf = TransformerFactory.newInstance();
- *       Transformer t = tf.newTransformer(new StreamSource("test.xsl"));
- *
- *       // run transformation
- *       t.transform(new StreamSource("document.xml"),result);
- *
- *       // obtain the unmarshalled content tree
- *       Object o = result.getResult();
- *    
- *
- * - *

- * The fact that JAXBResult derives from SAXResult is an implementation - * detail. Thus in general applications are strongly discouraged from - * accessing methods defined on SAXResult. - * - *

- * In particular it shall never attempt to call the setHandler, - * setLexicalHandler, and setSystemId methods. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * @since 1.6 - */ -public class JAXBResult extends SAXResult { - - /** - * Creates a new instance that uses the specified - * JAXBContext to unmarshal. - * - * @param context The JAXBContext that will be used to create the - * necessary Unmarshaller. This parameter must not be null. - * @exception JAXBException if an error is encountered while creating the - * JAXBResult or if the context parameter is null. - */ - public JAXBResult( JAXBContext context ) throws JAXBException { - this( ( context == null ) ? assertionFailed() : context.createUnmarshaller() ); - } - - /** - * Creates a new instance that uses the specified - * Unmarshaller to unmarshal an object. - * - *

- * This JAXBResult object will use the specified Unmarshaller - * instance. It is the caller's responsibility not to use the - * same Unmarshaller for other purposes while it is being - * used by this object. - * - *

- * The primary purpose of this method is to allow the client - * to configure Unmarshaller. Unless you know what you are doing, - * it's easier and safer to pass a JAXBContext. - * - * @param _unmarshaller the unmarshaller. This parameter must not be null. - * @throws JAXBException if an error is encountered while creating the - * JAXBResult or the Unmarshaller parameter is null. - */ - public JAXBResult( Unmarshaller _unmarshaller ) throws JAXBException { - if( _unmarshaller == null ) - throw new JAXBException( - Messages.format( Messages.RESULT_NULL_UNMARSHALLER ) ); - - this.unmarshallerHandler = _unmarshaller.getUnmarshallerHandler(); - - super.setHandler(unmarshallerHandler); - } - - /** - * Unmarshaller that will be used to unmarshal - * the input documents. - */ - private final UnmarshallerHandler unmarshallerHandler; - - /** - * Gets the unmarshalled object created by the transformation. - * - * @return - * Always return a non-null object. - * - * @exception IllegalStateException - * if this method is called before an object is unmarshalled. - * - * @exception JAXBException - * if there is any unmarshalling error. - * Note that the implementation is allowed to throw SAXException - * during the parsing when it finds an error. - */ - public Object getResult() throws JAXBException { - return unmarshallerHandler.getResult(); - } - - /** - * Hook to throw exception from the middle of a contructor chained call - * to this - */ - private static Unmarshaller assertionFailed() throws JAXBException { - throw new JAXBException( Messages.format( Messages.RESULT_NULL_CONTEXT ) ); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/util/JAXBSource.java 2018-01-30 20:40:25.000000000 -0500 +++ /dev/null 2018-01-30 20:40:25.000000000 -0500 @@ -1,273 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.util; - -import org.xml.sax.ContentHandler; -import org.xml.sax.DTDHandler; -import org.xml.sax.EntityResolver; -import org.xml.sax.ErrorHandler; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXNotRecognizedException; -import org.xml.sax.SAXParseException; -import org.xml.sax.XMLReader; -import org.xml.sax.ext.LexicalHandler; -import org.xml.sax.helpers.XMLFilterImpl; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Marshaller; -import javax.xml.transform.sax.SAXSource; -import org.xml.sax.XMLFilter; - -/** - * JAXP {@link javax.xml.transform.Source} implementation - * that marshals a JAXB-generated object. - * - *

- * This utility class is useful to combine JAXB with - * other Java/XML technologies. - * - *

- * The following example shows how to use JAXB to marshal a document - * for transformation by XSLT. - * - *

- *
- *       MyObject o = // get JAXB content tree
- *
- *       // jaxbContext is a JAXBContext object from which 'o' is created.
- *       JAXBSource source = new JAXBSource( jaxbContext, o );
- *
- *       // set up XSLT transformation
- *       TransformerFactory tf = TransformerFactory.newInstance();
- *       Transformer t = tf.newTransformer(new StreamSource("test.xsl"));
- *
- *       // run transformation
- *       t.transform(source,new StreamResult(System.out));
- *    
- *
- * - *

- * The fact that JAXBSource derives from SAXSource is an implementation - * detail. Thus in general applications are strongly discouraged from - * accessing methods defined on SAXSource. In particular, - * the setXMLReader and setInputSource methods shall never be called. - * The XMLReader object obtained by the getXMLReader method shall - * be used only for parsing the InputSource object returned by - * the getInputSource method. - * - *

- * Similarly the InputSource object obtained by the getInputSource - * method shall be used only for being parsed by the XMLReader object - * returned by the getXMLReader. - * - * @author - * Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com) - * @since 1.6 - */ -public class JAXBSource extends SAXSource { - - /** - * Creates a new {@link javax.xml.transform.Source} for the given content object. - * - * @param context - * JAXBContext that was used to create - * contentObject. This context is used - * to create a new instance of marshaller and must not be null. - * @param contentObject - * An instance of a JAXB-generated class, which will be - * used as a {@link javax.xml.transform.Source} (by marshalling it into XML). It must - * not be null. - * @throws JAXBException if an error is encountered while creating the - * JAXBSource or if either of the parameters are null. - */ - public JAXBSource( JAXBContext context, Object contentObject ) - throws JAXBException { - - this( - ( context == null ) ? - assertionFailed( Messages.format( Messages.SOURCE_NULL_CONTEXT ) ) : - context.createMarshaller(), - - ( contentObject == null ) ? - assertionFailed( Messages.format( Messages.SOURCE_NULL_CONTENT ) ) : - contentObject); - } - - /** - * Creates a new {@link javax.xml.transform.Source} for the given content object. - * - * @param marshaller - * A marshaller instance that will be used to marshal - * contentObject into XML. This must be - * created from a JAXBContext that was used to build - * contentObject and must not be null. - * @param contentObject - * An instance of a JAXB-generated class, which will be - * used as a {@link javax.xml.transform.Source} (by marshalling it into XML). It must - * not be null. - * @throws JAXBException if an error is encountered while creating the - * JAXBSource or if either of the parameters are null. - */ - public JAXBSource( Marshaller marshaller, Object contentObject ) - throws JAXBException { - - if( marshaller == null ) - throw new JAXBException( - Messages.format( Messages.SOURCE_NULL_MARSHALLER ) ); - - if( contentObject == null ) - throw new JAXBException( - Messages.format( Messages.SOURCE_NULL_CONTENT ) ); - - this.marshaller = marshaller; - this.contentObject = contentObject; - - super.setXMLReader(pseudoParser); - // pass a dummy InputSource. We don't care - super.setInputSource(new InputSource()); - } - - private final Marshaller marshaller; - private final Object contentObject; - - // this object will pretend as an XMLReader. - // no matter what parameter is specified to the parse method, - // it just parse the contentObject. - private final XMLReader pseudoParser = new XMLReader() { - public boolean getFeature(String name) throws SAXNotRecognizedException { - if(name.equals("http://xml.org/sax/features/namespaces")) - return true; - if(name.equals("http://xml.org/sax/features/namespace-prefixes")) - return false; - throw new SAXNotRecognizedException(name); - } - - public void setFeature(String name, boolean value) throws SAXNotRecognizedException { - if(name.equals("http://xml.org/sax/features/namespaces") && value) - return; - if(name.equals("http://xml.org/sax/features/namespace-prefixes") && !value) - return; - throw new SAXNotRecognizedException(name); - } - - public Object getProperty(String name) throws SAXNotRecognizedException { - if( "http://xml.org/sax/properties/lexical-handler".equals(name) ) { - return lexicalHandler; - } - throw new SAXNotRecognizedException(name); - } - - public void setProperty(String name, Object value) throws SAXNotRecognizedException { - if( "http://xml.org/sax/properties/lexical-handler".equals(name) ) { - this.lexicalHandler = (LexicalHandler)value; - return; - } - throw new SAXNotRecognizedException(name); - } - - private LexicalHandler lexicalHandler; - - // we will store this value but never use it by ourselves. - private EntityResolver entityResolver; - public void setEntityResolver(EntityResolver resolver) { - this.entityResolver = resolver; - } - public EntityResolver getEntityResolver() { - return entityResolver; - } - - private DTDHandler dtdHandler; - public void setDTDHandler(DTDHandler handler) { - this.dtdHandler = handler; - } - public DTDHandler getDTDHandler() { - return dtdHandler; - } - - // SAX allows ContentHandler to be changed during the parsing, - // but JAXB doesn't. So this repeater will sit between those - // two components. - private XMLFilter repeater = new XMLFilterImpl(); - - public void setContentHandler(ContentHandler handler) { - repeater.setContentHandler(handler); - } - public ContentHandler getContentHandler() { - return repeater.getContentHandler(); - } - - private ErrorHandler errorHandler; - public void setErrorHandler(ErrorHandler handler) { - this.errorHandler = handler; - } - public ErrorHandler getErrorHandler() { - return errorHandler; - } - - public void parse(InputSource input) throws SAXException { - parse(); - } - - public void parse(String systemId) throws SAXException { - parse(); - } - - public void parse() throws SAXException { - // parses a content object by using the given marshaller - // SAX events will be sent to the repeater, and the repeater - // will further forward it to an appropriate component. - try { - marshaller.marshal( contentObject, (XMLFilterImpl)repeater ); - } catch( JAXBException e ) { - // wrap it to a SAXException - SAXParseException se = - new SAXParseException( e.getMessage(), - null, null, -1, -1, e ); - - // if the consumer sets an error handler, it is our responsibility - // to notify it. - if(errorHandler!=null) - errorHandler.fatalError(se); - - // this is a fatal error. Even if the error handler - // returns, we will abort anyway. - throw se; - } - } - }; - - /** - * Hook to throw exception from the middle of a contructor chained call - * to this - */ - private static Marshaller assertionFailed( String message ) - throws JAXBException { - - throw new JAXBException( message ); - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/util/Messages.java 2018-01-30 20:40:26.000000000 -0500 +++ /dev/null 2018-01-30 20:40:26.000000000 -0500 @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.util; - -import java.text.MessageFormat; -import java.util.ResourceBundle; - -/** - * Formats error messages. - */ -class Messages -{ - static String format( String property ) { - return format( property, null ); - } - - static String format( String property, Object arg1 ) { - return format( property, new Object[]{arg1} ); - } - - static String format( String property, Object arg1, Object arg2 ) { - return format( property, new Object[]{arg1,arg2} ); - } - - static String format( String property, Object arg1, Object arg2, Object arg3 ) { - return format( property, new Object[]{arg1,arg2,arg3} ); - } - - // add more if necessary. - - /** Loads a string resource and formats it with specified arguments. */ - static String format( String property, Object[] args ) { - String text = ResourceBundle.getBundle(Messages.class.getName()).getString(property); - return MessageFormat.format(text,args); - } - -// -// -// Message resources -// -// - static final String UNRECOGNIZED_SEVERITY = // 1 arg - "ValidationEventCollector.UnrecognizedSeverity"; - - static final String RESULT_NULL_CONTEXT = // 0 args - "JAXBResult.NullContext"; - - static final String RESULT_NULL_UNMARSHALLER = // 0 arg - "JAXBResult.NullUnmarshaller"; - - static final String SOURCE_NULL_CONTEXT = // 0 args - "JAXBSource.NullContext"; - - static final String SOURCE_NULL_CONTENT = // 0 arg - "JAXBSource.NullContent"; - - static final String SOURCE_NULL_MARSHALLER = // 0 arg - "JAXBSource.NullMarshaller"; - -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/util/Messages.properties 2018-01-30 20:40:27.000000000 -0500 +++ /dev/null 2018-01-30 20:40:27.000000000 -0500 @@ -1,42 +0,0 @@ -# -# Copyright (c) 2003, 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. -# - -ValidationEventCollector.UnrecognizedSeverity = \ - Unrecognized event severity field "{0}" - -JAXBResult.NullContext = \ - JAXBContext can not be null - -JAXBResult.NullUnmarshaller = \ - Unmarshaller can not be null - -JAXBSource.NullContext = \ - JAXBContext can not be null - -JAXBSource.NullContent = \ - Content object can not be null - -JAXBSource.NullMarshaller = \ - Marshaller can not be null --- old/src/java.xml.bind/share/classes/javax/xml/bind/util/ValidationEventCollector.java 2018-01-30 20:40:28.000000000 -0500 +++ /dev/null 2018-01-30 20:40:28.000000000 -0500 @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2003, 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 javax.xml.bind.util; - -import javax.xml.bind.ValidationEvent; -import javax.xml.bind.ValidationEventHandler; -import java.util.ArrayList; -import java.util.List; - -/** - * {@link javax.xml.bind.ValidationEventHandler ValidationEventHandler} - * implementation that collects all events. - * - *

- * To use this class, create a new instance and pass it to the setEventHandler - * method of the Validator, Unmarshaller, Marshaller class. After the call to - * validate or unmarshal completes, call the getEvents method to retrieve all - * the reported errors and warnings. - * - * @author

  • Kohsuke Kawaguchi, Sun Microsystems, Inc.
  • Ryan Shoemaker, Sun Microsystems, Inc.
  • Joe Fialli, Sun Microsystems, Inc.
- * @see javax.xml.bind.Validator - * @see javax.xml.bind.ValidationEventHandler - * @see javax.xml.bind.ValidationEvent - * @see javax.xml.bind.ValidationEventLocator - * @since 1.6, JAXB 1.0 - */ -public class ValidationEventCollector implements ValidationEventHandler -{ - private final List events = new ArrayList(); - - /** - * Return an array of ValidationEvent objects containing a copy of each of - * the collected errors and warnings. - * - * @return - * a copy of all the collected errors and warnings or an empty array - * if there weren't any - */ - public ValidationEvent[] getEvents() { - return events.toArray(new ValidationEvent[events.size()]); - } - - /** - * Clear all collected errors and warnings. - */ - public void reset() { - events.clear(); - } - - /** - * Returns true if this event collector contains at least one - * ValidationEvent. - * - * @return true if this event collector contains at least one - * ValidationEvent, false otherwise - */ - public boolean hasEvents() { - return !events.isEmpty(); - } - - public boolean handleEvent( ValidationEvent event ) { - events.add(event); - - boolean retVal = true; - switch( event.getSeverity() ) { - case ValidationEvent.WARNING: - retVal = true; // continue validation - break; - case ValidationEvent.ERROR: - retVal = true; // continue validation - break; - case ValidationEvent.FATAL_ERROR: - retVal = false; // halt validation - break; - default: - _assert( false, - Messages.format( Messages.UNRECOGNIZED_SEVERITY, - event.getSeverity() ) ); - break; - } - - return retVal; - } - - private static void _assert( boolean b, String msg ) { - if( !b ) { - throw new InternalError( msg ); - } - } -} --- old/src/java.xml.bind/share/classes/javax/xml/bind/util/package-info.java 2018-01-30 20:40:29.000000000 -0500 +++ /dev/null 2018-01-30 20:40:29.000000000 -0500 @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2017, 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. - */ - -/** - * Useful client utility classes. - * - *

Package Specification

- * - * - * - *

Related Documentation

- *

- * For overviews, tutorials, examples, guides, and tool documentation, - * please see: - *

- * - * @see JAXB Website - */ -package javax.xml.bind.util; --- old/src/java.xml.bind/share/classes/module-info.java 2018-01-30 20:40:29.000000000 -0500 +++ /dev/null 2018-01-30 20:40:30.000000000 -0500 @@ -1,155 +0,0 @@ -/* - * Copyright (c) 2014, 2017, 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. - */ - -/** - * Defines the Java Architecture for XML Binding (JAXB) API. - * - *

This module is upgradeable. - * - * @uses javax.xml.bind.JAXBContextFactory - * - * @moduleGraph - * @since 9 - */ -@Deprecated(since="9", forRemoval=true) -module java.xml.bind { - requires java.compiler; - requires java.desktop; - requires java.logging; - requires jdk.unsupported; - - requires transitive java.activation; - requires transitive java.xml; - - exports javax.xml.bind; - exports javax.xml.bind.annotation; - exports javax.xml.bind.annotation.adapters; - exports javax.xml.bind.attachment; - exports javax.xml.bind.helpers; - exports javax.xml.bind.util; - - exports com.sun.istack.internal to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.istack.internal.localization to - java.xml.ws, - jdk.xml.ws; - exports com.sun.istack.internal.logging to - java.xml.ws, - jdk.xml.ws; - exports com.sun.xml.internal.bind to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.bind.annotation to - jdk.xml.bind; - exports com.sun.xml.internal.bind.api to - java.xml.ws, - jdk.xml.bind; - exports com.sun.xml.internal.bind.api.impl to - java.xml.ws, - jdk.xml.bind; - exports com.sun.xml.internal.bind.marshaller to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.bind.unmarshaller to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.bind.util to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.bind.v2 to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.bind.v2.model.annotation to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.bind.v2.model.core to - jdk.xml.bind; - exports com.sun.xml.internal.bind.v2.model.impl to - jdk.xml.bind; - exports com.sun.xml.internal.bind.v2.model.nav to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - opens com.sun.xml.internal.bind.v2.model.nav to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.bind.v2.model.runtime to - java.xml.ws; - exports com.sun.xml.internal.bind.v2.model.util to - jdk.xml.bind; - exports com.sun.xml.internal.bind.v2.runtime to - java.xml.ws, - jdk.xml.bind; - exports com.sun.xml.internal.bind.v2.runtime.unmarshaller to - java.xml.ws; - exports com.sun.xml.internal.bind.v2.schemagen to - java.xml.ws, - jdk.xml.bind; - exports com.sun.xml.internal.bind.v2.schemagen.episode to - jdk.xml.bind; - exports com.sun.xml.internal.bind.v2.schemagen.xmlschema to - java.xml.ws; - exports com.sun.xml.internal.bind.v2.util to - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.fastinfoset to - java.xml.ws; - exports com.sun.xml.internal.fastinfoset.stax to - java.xml.ws; - exports com.sun.xml.internal.fastinfoset.vocab to - java.xml.ws; - exports com.sun.xml.internal.org.jvnet.fastinfoset to - java.xml.ws; - exports com.sun.xml.internal.org.jvnet.mimepull to - java.xml.ws; - exports com.sun.xml.internal.org.jvnet.staxex to - java.xml.ws; - exports com.sun.xml.internal.org.jvnet.staxex.util to - java.xml.ws; - exports com.sun.xml.internal.txw2 to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.txw2.annotation to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - exports com.sun.xml.internal.txw2.output to - java.xml.ws, - jdk.xml.bind, - jdk.xml.ws; - - uses javax.xml.bind.JAXBContextFactory; - -} --- old/src/java.xml.ws.annotation/share/classes/javax/annotation/Generated.java 2018-01-30 20:40:30.000000000 -0500 +++ /dev/null 2018-01-30 20:40:30.000000000 -0500 @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.annotation; -import java.lang.annotation.*; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - * The Generated annotation is used to mark source code that has been generated. - * It can also be used to differentiate user written code from generated code - * in a single file. When used, the value element must have the name of the - * code generator. The recommended convention is to use the fully qualified - * name of the code generator in the value field . - *

For example: com.company.package.classname. - * The date element is used to indicate the date the source was generated. - * The date element must follow the ISO 8601 standard. For example the date - * element would have the following value 2001-07-04T12:08:56.235-0700 - * which represents 2001-07-04 12:08:56 local time in the U.S. Pacific - * Time time zone.

- *

The comment element is a place holder for any comments that the code - * generator may want to include in the generated code.

- * - * @since 1.6, Common Annotations 1.0 - */ - -@Documented -@Retention(SOURCE) -@Target({PACKAGE, TYPE, ANNOTATION_TYPE, METHOD, CONSTRUCTOR, FIELD, - LOCAL_VARIABLE, PARAMETER}) -public @interface Generated { - /** - * The value element MUST have the name of the code generator. - * The recommended convention is to use the fully qualified name of the - * code generator. For example: com.acme.generator.CodeGen. - */ - String[] value(); - - /** - * Date when the source was generated. - */ - String date() default ""; - - /** - * A place holder for any comments that the code generator may want to - * include in the generated code. - */ - String comments() default ""; -} --- old/src/java.xml.ws.annotation/share/classes/javax/annotation/PostConstruct.java 2018-01-30 20:40:31.000000000 -0500 +++ /dev/null 2018-01-30 20:40:31.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.annotation; - -import java.lang.annotation.*; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - * The PostConstruct annotation is used on a method that needs to be executed - * after dependency injection is done to perform any initialization. This - * method MUST be invoked before the class is put into service. This - * annotation MUST be supported on all classes that support dependency - * injection. The method annotated with PostConstruct MUST be invoked even - * if the class does not request any resources to be injected. Only one - * method can be annotated with this annotation. The method on which the - * PostConstruct annotation is applied MUST fulfill all of the following - * criteria: - *
    - *
  • The method MUST NOT have any parameters except in the case of - * interceptors in which case it takes an InvocationContext object as - * defined by the Interceptors specification.
  • - *
  • The method defined on an interceptor class MUST HAVE one of the - * following signatures: - *

    - * void <METHOD>(InvocationContext) - *

    - * Object <METHOD>(InvocationContext) throws Exception - *

    - * Note: A PostConstruct interceptor method must not throw application - * exceptions, but it may be declared to throw checked exceptions including - * the java.lang.Exception if the same interceptor method interposes on - * business or timeout methods in addition to lifecycle events. If a - * PostConstruct interceptor method returns a value, it is ignored by - * the container. - *

  • - *
  • The method defined on a non-interceptor class MUST HAVE the - * following signature: - *

    - * void <METHOD>() - *

  • - *
  • The method on which PostConstruct is applied MAY be public, protected, - * package private or private.
  • - *
  • The method MUST NOT be static except for the application client.
  • - *
  • The method MAY be final.
  • - *
  • If the method throws an unchecked exception the class MUST NOT be put into - * service except in the case of EJBs where the EJB can handle exceptions and - * even recover from them.
- * - * @see javax.annotation.PreDestroy - * @see javax.annotation.Resource - * @since 1.6, Common Annotations 1.0 - */ -@Documented -@Retention (RUNTIME) -@Target(METHOD) -public @interface PostConstruct { -} --- old/src/java.xml.ws.annotation/share/classes/javax/annotation/PreDestroy.java 2018-01-30 20:40:32.000000000 -0500 +++ /dev/null 2018-01-30 20:40:32.000000000 -0500 @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2005, 2015, 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 javax.annotation; - -import java.lang.annotation.*; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - * The PreDestroy annotation is used on methods as a callback notification to - * signal that the instance is in the process of being removed by the - * container. The method annotated with PreDestroy is typically used to - * release resources that it has been holding. This annotation MUST be - * supported by all container managed objects that support PostConstruct - * except the application client container in Java EE 5. The method on which - * the PreDestroy annotation is applied MUST fulfill all of the following - * criteria: - *
    - *
  • The method MUST NOT have any parameters except in the case of - * interceptors in which case it takes an InvocationContext object as - * defined by the Interceptors specification.
  • - *
  • The method defined on an interceptor class MUST HAVE one of the - * following signatures: - *

    - * void <METHOD>(InvocationContext) - *

    - * Object <METHOD>(InvocationContext) throws Exception - *

    - * Note: A PreDestroy interceptor method must not throw application - * exceptions, but it may be declared to throw checked exceptions including - * the java.lang.Exception if the same interceptor method interposes on - * business or timeout methods in addition to lifecycle events. If a - * PreDestroy interceptor method returns a value, it is ignored by - * the container. - *

  • - *
  • The method defined on a non-interceptor class MUST HAVE the - * following signature: - *

    - * void <METHOD>() - *

  • - *
  • The method on which PreDestroy is applied MAY be public, protected, - * package private or private.
  • - *
  • The method MUST NOT be static.
  • - *
  • The method MAY be final.
  • - *
  • If the method throws an unchecked exception it is ignored except in the - * case of EJBs where the EJB can handle exceptions.
  • - *
- * - * @see javax.annotation.PostConstruct - * @see javax.annotation.Resource - * @since 1.6, Common Annotations 1.0 - */ - -@Documented -@Retention (RUNTIME) -@Target(METHOD) -public @interface PreDestroy { -} --- old/src/java.xml.ws.annotation/share/classes/javax/annotation/Resource.java 2018-01-30 20:40:33.000000000 -0500 +++ /dev/null 2018-01-30 20:40:33.000000000 -0500 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.annotation; - -import java.lang.annotation.*; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - * The Resource annotation marks a resource that is needed - * by the application. This annotation may be applied to an - * application component class, or to fields or methods of the - * component class. When the annotation is applied to a - * field or method, the container will inject an instance - * of the requested resource into the application component - * when the component is initialized. If the annotation is - * applied to the component class, the annotation declares a - * resource that the application will look up at runtime.

- * - * Even though this annotation is not marked Inherited, deployment - * tools are required to examine all superclasses of any component - * class to discover all uses of this annotation in all superclasses. - * All such annotation instances specify resources that are needed - * by the application component. Note that this annotation may - * appear on private fields and methods of superclasses; the container - * is required to perform injection in these cases as well. - * - * @since 1.6, Common Annotations 1.0 - */ -@Target({TYPE, FIELD, METHOD}) -@Retention(RUNTIME) -public @interface Resource { - /** - * The JNDI name of the resource. For field annotations, - * the default is the field name. For method annotations, - * the default is the JavaBeans property name corresponding - * to the method. For class annotations, there is no default - * and this must be specified. - */ - String name() default ""; - - /** - * The name of the resource that the reference points to. It can - * link to any compatible resource using the global JNDI names. - * - * @since 1.7, Common Annotations 1.1 - */ - - String lookup() default ""; - - /** - * The Java type of the resource. For field annotations, - * the default is the type of the field. For method annotations, - * the default is the type of the JavaBeans property. - * For class annotations, there is no default and this must be - * specified. - */ - Class type() default java.lang.Object.class; - - /** - * The two possible authentication types for a resource. - */ - enum AuthenticationType { - CONTAINER, - APPLICATION - } - - /** - * The authentication type to use for this resource. - * This may be specified for resources representing a - * connection factory of any supported type, and must - * not be specified for resources of other types. - */ - AuthenticationType authenticationType() default AuthenticationType.CONTAINER; - - /** - * Indicates whether this resource can be shared between - * this component and other components. - * This may be specified for resources representing a - * connection factory of any supported type, and must - * not be specified for resources of other types. - */ - boolean shareable() default true; - - /** - * A product specific name that this resource should be mapped to. - * The name of this resource, as defined by the name - * element or defaulted, is a name that is local to the application - * component using the resource. (It's a name in the JNDI - * java:comp/env namespace.) Many application servers - * provide a way to map these local names to names of resources - * known to the application server. This mapped name is often a - * global JNDI name, but may be a name of any form.

- * - * Application servers are not required to support any particular - * form or type of mapped name, nor the ability to use mapped names. - * The mapped name is product-dependent and often installation-dependent. - * No use of a mapped name is portable. - */ - String mappedName() default ""; - - /** - * Description of this resource. The description is expected - * to be in the default language of the system on which the - * application is deployed. The description can be presented - * to the Deployer to help in choosing the correct resource. - */ - String description() default ""; -} --- old/src/java.xml.ws.annotation/share/classes/javax/annotation/Resources.java 2018-01-30 20:40:34.000000000 -0500 +++ /dev/null 2018-01-30 20:40:34.000000000 -0500 @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2005, 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 javax.annotation; -import java.lang.annotation.*; -import static java.lang.annotation.ElementType.*; -import static java.lang.annotation.RetentionPolicy.*; - -/** - * This class is used to allow multiple resources declarations. - * - * @see javax.annotation.Resource - * @since 1.6, Common Annotations 1.0 - */ - -@Documented -@Retention(RUNTIME) -@Target(TYPE) -public @interface Resources { - /** - * Array used for multiple resource declarations. - */ - Resource[] value(); -} --- old/src/java.xml.ws.annotation/share/classes/module-info.java 2018-01-30 20:40:35.000000000 -0500 +++ /dev/null 2018-01-30 20:40:35.000000000 -0500 @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2014, 2017, 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. - */ - -/** - * Defines a subset of the Common Annotations API to support programs running - * on the Java SE Platform. - * - *

This module is upgradeable. - * - * @moduleGraph - * @since 9 - */ -@Deprecated(since="9", forRemoval=true) -module java.xml.ws.annotation { - exports javax.annotation; -} - --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/EnvelopeStyle.java 2018-01-30 20:40:35.000000000 -0500 +++ /dev/null 2018-01-30 20:40:36.000000000 -0500 @@ -1,111 +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.oracle.webservices.internal.api; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import javax.xml.ws.http.HTTPBinding; -import javax.xml.ws.soap.SOAPBinding; -import javax.xml.ws.spi.WebServiceFeatureAnnotation; - -/** - * The EnvelopeStyle annotation is used to specify the message envelope style(s) - * for a web service endpoint implementation class. To smooth the migration from - * the BindingType annotation to this EnvelopeStyle annotation, each of the - * styles is mapped to a binding identifier defined in JAX-WS specification. - * Though a binding identifier includes both the envelope style and transport, - * an envelope style defined herein does NOT imply or mandate any transport protocol - * to be use together; HTTP is the default transport. An implementation may - * chose to support other transport with any of the envelope styles. - * - * This annotation may be overriden programmatically or via deployment - * descriptors, depending on the platform in use. - * - * @author shih-chang.chen@oracle.com - */ -@WebServiceFeatureAnnotation(id="", bean=com.oracle.webservices.internal.api.EnvelopeStyleFeature.class) -@Retention(RetentionPolicy.RUNTIME) -public @interface EnvelopeStyle { - - /** - * The envelope styles. If not specified, the default is the SOAP 1.1. - * - * @return The enveloping styles - */ - Style[] style() default { Style.SOAP11 }; - - public enum Style { - - /** - * SOAP1.1. For JAX-WS, this is mapped from: - * javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING - */ - SOAP11(SOAPBinding.SOAP11HTTP_BINDING), - - /** - * SOAP1.2. For JAX-WS, this is mapped from: - * javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING - */ - SOAP12(SOAPBinding.SOAP12HTTP_BINDING), - - /** - * The raw XML. For JAX-WS, this is mapped from: - * javax.xml.ws.http.HTTPBinding.HTTP_BINDING - */ - XML(HTTPBinding.HTTP_BINDING); - - /** - * The BindingID used by the BindingType annotation. - */ - public final String bindingId; - - private Style(String id) { - bindingId = id; - } - - /** - * Checks if the style is SOAP 1.1. - * - * @return true if the style is SOAP 1.1. - */ - public boolean isSOAP11() { return this.equals(SOAP11); } - - /** - * Checks if the style is SOAP 1.2. - * - * @return true if the style is SOAP 1.2. - */ - public boolean isSOAP12() { return this.equals(SOAP12); } - - /** - * Checks if the style is XML. - * - * @return true if the style is XML. - */ - public boolean isXML() { return this.equals(XML); } - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/EnvelopeStyleFeature.java 2018-01-30 20:40:36.000000000 -0500 +++ /dev/null 2018-01-30 20:40:36.000000000 -0500 @@ -1,45 +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.oracle.webservices.internal.api; - -import javax.xml.ws.WebServiceFeature; - -public class EnvelopeStyleFeature extends WebServiceFeature { - - private EnvelopeStyle.Style[] styles; - - public EnvelopeStyleFeature(EnvelopeStyle.Style... s) { - styles = s; - } - - public EnvelopeStyle.Style[] getStyles() { - return styles; - } - - public String getID() { - return EnvelopeStyleFeature.class.getName(); - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/databinding/Databinding.java 2018-01-30 20:40:37.000000000 -0500 +++ /dev/null 2018-01-30 20:40:37.000000000 -0500 @@ -1,247 +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.oracle.webservices.internal.api.databinding; - -import java.lang.reflect.Method; -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.transform.Source; -import javax.xml.ws.WebServiceFeature; - -import org.xml.sax.EntityResolver; - -import com.oracle.webservices.internal.api.message.MessageContext; - -/** - * {@code Databinding} is the entry point for all the WebService Databinding - * functionality. Primarily, a Databinding is to serialize/deserialize an - * XML(SOAP) message to/from a JAVA method invocation and return which are - * represented as JavaCallInfo instances. A WSDLGenerator can - * be created from a Databinding object to genreate WSDL representation of - * a JAVA service endpoint interface. - *

- *

- * The supported databinding modes(flavors) are: - *
    - *
  • "toplink.jaxb"
  • - *
  • "glassfish.jaxb"
  • - *
- *
Following is an example that creates a {@code Databinding} which - * provides the operations to serialize/deserialize a JavaCallInfo to/from a - * SOAP message:
- * - *
- * DatabindingFactory factory = DatabindingFactory.newInstance();
- * Databinding.Builder builder = factory.createBuilder(seiClass, endpointClass);
- * Databinding databinding = builder.build();
- * 
- * - *
- * - * @see com.oracle.webservices.internal.api.databinding.DatabindingFactory - * - * @author shih-chang.chen@oracle.com - */ -public interface Databinding { - - /** - * Creates a new instance of a JavaCallInfo. - * - * @param method The JAVA method - * @param args The parameter objects - * - * @return New instance of a JavaCallInfo - */ - JavaCallInfo createJavaCallInfo(Method method, Object[] args); - - /** - * Serializes a JavaCallInfo instance representing a JAVA method call to a - * request XML(SOAP) message. - * - * @param call The JavaCallInfo representing a method call - * - * @return The request XML(SOAP) message - */ - MessageContext serializeRequest(JavaCallInfo call); - - /** - * Deserializes a response XML(SOAP) message to a JavaCallInfo instance - * representing the return value or exception of a JAVA method call. - * - * @param message The response message - * @param call The JavaCallInfo instance to be updated - * - * @return The JavaCallInfo updated with the return value or exception of a - * JAVA method call - */ - JavaCallInfo deserializeResponse(MessageContext message, JavaCallInfo call); - - /** - * Deserializes a request XML(SOAP) message to a JavaCallInfo instance - * representing a JAVA method call. - * - * @param message The request message - * - * @return The JavaCallInfo representing a method call - */ - JavaCallInfo deserializeRequest(MessageContext message); - - /** - * Serializes a JavaCallInfo instance representing the return value or - * exception of a JAVA method call to a response XML(SOAP) message. - * - * @param call The JavaCallInfo representing the return value or exception - * of a JAVA method call - * - * @return The response XML(SOAP) message - */ - MessageContext serializeResponse(JavaCallInfo call); - - /** - * Gets the MessageContextFactory - * - * @return The MessageContextFactory - */ -//Wait for WLS/src1212 - wls.jaxrpc wrapper -// MessageContextFactory getMessageContextFactory(); - - /** - * {@code Databinding.Builder}, created from the DatabindingFactory, is used to - * configure how a Databinding instance is to be built from this builder. - * - * @see com.oracle.webservices.internal.api.databinding.DatabindingFactory - * @author shih-chang.chen@oracle.com - */ - public interface Builder { - - /** - * Sets the targetNamespace of the WSDL - * - * @param targetNamespace The targetNamespace to set - * - * @return this Builder instance - */ - Builder targetNamespace(String targetNamespace); - - /** - * Sets the service name of the WSDL - * - * @param serviceName The serviceName to set - * - * @return this Builder instance - */ - Builder serviceName(QName serviceName); - - /** - * Sets the port name of the WSDL - * - * @param portName The portName to set - * - * @return this Builder instance - */ - Builder portName(QName portName); - - /** - * @deprecated - no replacement - this was never implemented - * - * Sets the WSDL URL where the WSDL can be read from - * - * @param wsdlURL The wsdlURL to set - * - * @return this Builder instance - */ - Builder wsdlURL(URL wsdlURL); - - /** - * @deprecated - no replacement - this was never implemented - * - * Sets the WSDL Source where the WSDL can be read from - * - * @param wsdlSource The wsdlSource to set - * - * @return this Builder instance - */ - Builder wsdlSource(Source wsdlSource); - - /** - * @deprecated - no replacement - this was never implemented - * - * Sets the {@link EntityResolver} for reading the WSDL - * - * @param entityResolver The {@link EntityResolver} to set - * - * @return this Builder instance - */ - Builder entityResolver(EntityResolver entityResolver); - - /** - * Sets the ClassLoader which is used to load the service endpoint - * interface, implementation bean, and all the value types. If this - * value is not set, the default it uses contractClass.getClassLoader(). - * - * @param classLoader The classLoader to set - * - * @return this Builder instance - */ - Builder classLoader(ClassLoader classLoader); - - /** - * Sets A list of WebServiceFeatures - * - * @param features The list of WebServiceFeatures - * - * @return this Builder instance - */ - Builder feature(WebServiceFeature... features); - - /** - * Sets A property of the Databinding object to be created - * - * @param name The name of the property - * @param value The value of the property - * - * @return this Builder instance - */ - Builder property(String name, Object value); - - /** - * Builds a new Databinding instance - * - * @return The Builder instance - */ - Databinding build(); - - /** - * Creates the WSDLGenerator which can be used to generate the WSDL - * representation of the service endpoint interface of this Databinding - * object. - * - * @return WSDLGenerator The WSDLGenerator - */ - com.oracle.webservices.internal.api.databinding.WSDLGenerator createWSDLGenerator(); - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/databinding/DatabindingFactory.java 2018-01-30 20:40:38.000000000 -0500 +++ /dev/null 2018-01-30 20:40:38.000000000 -0500 @@ -1,105 +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.oracle.webservices.internal.api.databinding; - -import java.util.Map; - -/** - * {@code DatabindingFactory} is the entry point of all the WebService - * Databinding APIs. A DatabindingFactory instance can be used to create - * Databinding.Builder instances, and Databinding.Builder - * instances are used to configure and build Databinding instances. - *

- *

- *
- * Following is an example that creates a {@code Databinding} which provides the - * operations to serialize/deserialize a JavaCallInfo to/from a SOAP message:
- *
- * DatabindingFactory factory = DatabindingFactory.newInstance();
- * Databinding.Builder builder = factory.createBuilder(seiClass, endpointClass);
- * Databinding databinding = builder.build();
- * 
- *
- * - * @see com.oracle.webservices.internal.api.databinding.Databinding - * - * @author shih-chang.chen@oracle.com - */ -public abstract class DatabindingFactory { - - /** - * Creates a new instance of a Databinding.Builder which is - * initialized with the specified contractClass and endpointClass. The most - * importance initial states of a Builder object is the contract class which - * is also called "service endpoint interface" or "SEI" in JAX-WS and JAX-RPC, - * and the implementation bean class (endpointClass). The the implementation - * bean class (endpointClass) should be null if the Builder is to create - * the client side proxy databinding. - * - * @param contractClass The service endpoint interface class - * @param endpointClass The service implementation bean class - * - * @return New instance of a Databinding.Builder - */ - abstract public Databinding.Builder createBuilder(Class contractClass, Class endpointClass); - - /** - * Access properties on the DatabindingFactory instance. - * - * @return properties of this WsFactory - */ - abstract public Map properties(); - - /** - * The default implementation class name. - */ - static final String ImplClass = "com.sun.xml.internal.ws.db.DatabindingFactoryImpl"; - - /** - * Create a new instance of a DatabindingFactory. This static method - * creates a new factory instance. - * - * Once an application has obtained a reference to a DatabindingFactory - * it can use the factory to obtain and configure a Databinding.Builder - * to build a Databinding instances. - * - * @return New instance of a DatabindingFactory - */ - static public DatabindingFactory newInstance() { - try { - Class cls = Class.forName(ImplClass); - return convertIfNecessary(cls); - } catch (Exception e) { - e.printStackTrace(); - } - return null; - } - - @SuppressWarnings("deprecation") - private static DatabindingFactory convertIfNecessary(Class cls) throws InstantiationException, IllegalAccessException { - return (DatabindingFactory) cls.newInstance(); - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/databinding/DatabindingMode.java 2018-01-30 20:40:39.000000000 -0500 +++ /dev/null 2018-01-30 20:40:39.000000000 -0500 @@ -1,37 +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.oracle.webservices.internal.api.databinding; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -import javax.xml.ws.spi.WebServiceFeatureAnnotation; - -@WebServiceFeatureAnnotation(id="", bean=com.oracle.webservices.internal.api.databinding.DatabindingModeFeature.class) -@Retention(RetentionPolicy.RUNTIME) -public @interface DatabindingMode { - String value(); -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/databinding/DatabindingModeFeature.java 2018-01-30 20:40:39.000000000 -0500 +++ /dev/null 2018-01-30 20:40:40.000000000 -0500 @@ -1,77 +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.oracle.webservices.internal.api.databinding; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.ws.WebServiceFeature; - -public class DatabindingModeFeature extends WebServiceFeature implements com.sun.xml.internal.ws.api.ServiceSharedFeatureMarker { - /** - * Constant value identifying the DatabindingFeature - */ - static public final String ID = "http://jax-ws.java.net/features/databinding"; - - static public final String GLASSFISH_JAXB = "glassfish.jaxb"; - - //These constants should be defined in the corresponding plugin package -// static public final String ECLIPSELINK_JAXB = "eclipselink.jaxb"; -// static public final String ECLIPSELINK_SDO = "eclipselink.sdo"; -// static public final String TOPLINK_JAXB = "toplink.jaxb"; -// static public final String TOPLINK_SDO = "toplink.sdo"; - - private String mode; - private Map properties; - - public DatabindingModeFeature(String mode) { - super(); - this.mode = mode; - properties = new HashMap(); - } - - public String getMode() { - return mode; - } - - public String getID() { - return ID; - } - - public Map getProperties() { - return properties; - } - - public static Builder builder() { return new Builder(new DatabindingModeFeature(null)); } - - public final static class Builder { - final private DatabindingModeFeature o; - Builder(final DatabindingModeFeature x) { o = x; } - public DatabindingModeFeature build() { return o; } -// public DatabindingModeFeature build() { return (DatabindingModeFeature) FeatureValidator.validate(o); } - public Builder value(final String x) { o.mode = x; return this; } - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/databinding/ExternalMetadataFeature.java 2018-01-30 20:40:40.000000000 -0500 +++ /dev/null 2018-01-30 20:40:40.000000000 -0500 @@ -1,163 +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.oracle.webservices.internal.api.databinding; - -import com.sun.xml.internal.ws.api.databinding.MetadataReader; -import com.sun.xml.internal.ws.model.ExternalMetadataReader; - -import javax.xml.ws.WebServiceFeature; -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * WebServiceFeature allowing to define either on server or client side external xml descriptors replacing/supplementing - * WS metadata provided by class annotations. This can be useful if those annotations are missing (existing non-WS - * components) or if it is necessary to override those. - * - * @author Miroslav Kos (miroslav.kos at oracle.com) - */ -public class ExternalMetadataFeature extends WebServiceFeature { - - private static final String ID = "com.oracle.webservices.internal.api.databinding.ExternalMetadataFeature"; - - /** - * Enable this feature. Defaults to true. - */ - private boolean enabled = true; - - private List resourceNames; - private List files; - private MetadataReader reader; - - private ExternalMetadataFeature() { - } - - public void addResources(String... resourceNames) { - if (this.resourceNames == null) { - this.resourceNames = new ArrayList(); - } - Collections.addAll(this.resourceNames, resourceNames); - } - - public List getResourceNames() { return resourceNames; } - - public void addFiles(File... files) { - if (this.files == null) { - this.files = new ArrayList(); - } - Collections.addAll(this.files, files); - } - - public List getFiles() { return files; } - - public boolean isEnabled() { - return enabled; - } - - private void setEnabled(final boolean x) { - enabled = x; - } - - @Override - public String getID() { - return ID; - } - - public MetadataReader getMetadataReader(ClassLoader classLoader, boolean disableXmlSecurity) { - if (reader != null && enabled) return reader; - return enabled ? new ExternalMetadataReader(files, resourceNames, classLoader, true, disableXmlSecurity) : null; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ExternalMetadataFeature that = (ExternalMetadataFeature) o; - - if (enabled != that.enabled) return false; - if (files != null ? !files.equals(that.files) : that.files != null) return false; - if (resourceNames != null ? !resourceNames.equals(that.resourceNames) : that.resourceNames != null) - return false; - - return true; - } - - @Override - public int hashCode() { - int result = (enabled ? 1 : 0); - result = 31 * result + (resourceNames != null ? resourceNames.hashCode() : 0); - result = 31 * result + (files != null ? files.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "[" + getID() + - ", enabled=" + enabled + - ", resourceNames=" + resourceNames + - ", files=" + files + - ']'; - } - - public static Builder builder() { - return new Builder(new ExternalMetadataFeature()); - } - - public final static class Builder { - final private ExternalMetadataFeature o; - - Builder(final ExternalMetadataFeature x) { - o = x; - } - - public ExternalMetadataFeature build() { - return o; - } - - public Builder addResources(String... res) { - o.addResources(res); - return this; - } - - public Builder addFiles(File... files) { - o.addFiles(files); - return this; - } - - public Builder setEnabled(boolean enabled) { - o.setEnabled(enabled); - return this; - } - - public Builder setReader( MetadataReader r ) { - o.reader = r; - return this; - } - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/databinding/JavaCallInfo.java 2018-01-30 20:40:41.000000000 -0500 +++ /dev/null 2018-01-30 20:40:41.000000000 -0500 @@ -1,108 +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.oracle.webservices.internal.api.databinding; - -import java.lang.reflect.Method; - -/** - * On the client or service-requestor side, a JavaCallInfo object represents a - * method call on the service proxy to be serialized as a SOAP request message - * to be sent to the service. A SOAP response message returned to the service - * client is deserialized as an update to the JavaCallInfo object which is used - * to generated the request. - *

- *

- * On the server or service provider side, a SOAP request message is - * deserialized to a JavaCallInfo object which can be used to determine which - * method to call, and get the parameter values to call the back-end service - * implementation object. The return value or exception returned from the - * service implementation should be set to the JavaCallInfo object which then - * can be used to serialize to a A SOAP response or fault message to be sent - * back to the service client. - * - * @author shih-chang.chen@oracle.com - */ -public interface JavaCallInfo { - - /** - * Gets the method of this JavaCallInfo - * - * @return the method - */ - public Method getMethod(); - -// /** -// * Sets the method of this JavaCallInfo -// * -// * @param method The method to set -// */ -// public void setMethod(Method method); - - /** - * Gets the parameters of this JavaCallInfo - * - * @return The parameters - */ - public Object[] getParameters(); - -// /** -// * Sets the parameters of this JavaCallInfo -// * -// * @param parameters -// * the parameters to set -// */ -// public void setParameters(Object[] parameters); - - /** - * Gets the returnValue of this JavaCallInfo - * - * @return the returnValue - */ - public Object getReturnValue(); - - /** - * Sets the returnValue of this JavaCallInfo - * - * @param returnValue - * the returnValue to set - */ - public void setReturnValue(Object returnValue); - - /** - * Gets the exception of this JavaCallInfo - * - * @return the exception - */ - public Throwable getException(); - - /** - * Sets the exception of this JavaCallInfo - * - * @param exception - * the exception to set - */ - public void setException(Throwable exception); -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/databinding/WSDLGenerator.java 2018-01-30 20:40:42.000000000 -0500 +++ /dev/null 2018-01-30 20:40:42.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.webservices.internal.api.databinding; - -import java.io.File; - -/** - * WSDLGenerator is used to generate the WSDL representation of the service - * endpoint interface of the parent Databinding object. - */ -public interface WSDLGenerator { - - /** - * Sets the inlineSchema boolean. When the inlineSchema is true, the - * generated schema documents are embedded within the type element of - * the generated WSDL. When the inlineSchema is false, the generated - * schema documents are generated as standalone schema documents and - * imported into the generated WSDL. - * - * @param inline the inlineSchema boolean. - * @return - */ - WSDLGenerator inlineSchema(boolean inline); - - /** - * Sets A property of the WSDLGenerator - * - * @param name The name of the property - * @param value The value of the property - * - * @return this WSDLGenerator instance - */ - WSDLGenerator property(String name, Object value); - - /** - * Generates the WSDL using the wsdlResolver to output the generated - * documents. - * - * @param wsdlResolver The WSDLResolver - */ - void generate(com.oracle.webservices.internal.api.databinding.WSDLResolver wsdlResolver); - - /** - * Generates the WSDL into the file directory - * - * @param outputDir The output file directory - * @param name The file name of the main WSDL document - */ - void generate(File outputDir, String name); -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/databinding/WSDLResolver.java 2018-01-30 20:40:43.000000000 -0500 +++ /dev/null 2018-01-30 20:40:43.000000000 -0500 @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.webservices.internal.api.databinding; - -import javax.xml.transform.Result; -import javax.xml.ws.Holder; - -/** - * WSDLResolver is used by WSDLGenerator while generating WSDL and its associated - * documents. It is used to control what documents need to be generated and what - * documents need to be picked from metadata. If endpont's document metadata - * already contains some documents, their systemids may be used for wsdl:import, - * and schema:import. The suggested filenames are relative urls(for e.g: EchoSchema1.xsd) - * The Result object systemids are also relative urls(for e.g: AbsWsdl.wsdl). - * - * @author Jitendra Kotamraju - */ -public interface WSDLResolver { - /** - * Create a Result object into which concrete WSDL is to be generated. - * - * @return Result for the concrete WSDL - */ - public Result getWSDL(String suggestedFilename); - - /** - * Create a Result object into which abstract WSDL is to be generated. If the the - * abstract WSDL is already in metadata, it is not generated. - * - * Update filename if the suggested filename need to be changed in wsdl:import. - * This needs to be done if the metadata contains abstract WSDL, and that systemid - * needs to be reflected in concrete WSDL's wsdl:import - * - * @return null if abstract WSDL need not be generated - */ - public Result getAbstractWSDL(Holder filename); - - /** - * Create a Result object into which schema doc is to be generated. Typically if - * there is a schema doc for namespace in metadata, then it is not generated. - * - * Update filename if the suggested filename need to be changed in xsd:import. This - * needs to be done if the metadata contains the document, and that systemid - * needs to be reflected in some other document's xsd:import - * - * @return null if schema need not be generated - */ - public Result getSchemaOutput(String namespace, Holder filename); - -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/BaseDistributedPropertySet.java 2018-01-30 20:40:44.000000000 -0500 +++ /dev/null 2018-01-30 20:40:44.000000000 -0500 @@ -1,308 +0,0 @@ -/* - * 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.oracle.webservices.internal.api.message; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; -import com.sun.xml.internal.ws.api.message.Packet; -import com.sun.xml.internal.ws.client.RequestContext; -import com.sun.xml.internal.ws.client.ResponseContext; - -import javax.xml.ws.WebServiceContext; - -import java.util.AbstractMap; -import java.util.Map.Entry; -import java.util.HashSet; -import java.util.IdentityHashMap; -import java.util.Map; -import java.util.Set; - -/** - * {@link PropertySet} that combines properties exposed from multiple - * {@link PropertySet}s into one. - * - *

- * This implementation allows one {@link PropertySet} to assemble - * all properties exposed from other "satellite" {@link PropertySet}s. - * (A satellite may itself be a {@link DistributedPropertySet}, so - * in general this can form a tree.) - * - *

- * This is useful for JAX-WS because the properties we expose to the application - * are contributed by different pieces, and therefore we'd like each of them - * to have a separate {@link PropertySet} implementation that backs up - * the properties. For example, this allows FastInfoset to expose its - * set of properties to {@link RequestContext} by using a strongly-typed fields. - * - *

- * This is also useful for a client-side transport to expose a bunch of properties - * into {@link ResponseContext}. It simply needs to create a {@link PropertySet} - * object with methods for each property it wants to expose, and then add that - * {@link PropertySet} to {@link Packet}. This allows property values to be - * lazily computed (when actually asked by users), thus improving the performance - * of the typical case where property values are not asked. - * - *

- * A similar benefit applies on the server-side, for a transport to expose - * a bunch of properties to {@link WebServiceContext}. - * - *

- * To achieve these benefits, access to {@link DistributedPropertySet} is slower - * compared to {@link PropertySet} (such as get/set), while adding a satellite - * object is relatively fast. - * - * @author Kohsuke Kawaguchi - */ -public abstract class BaseDistributedPropertySet extends BasePropertySet implements DistributedPropertySet { - - /** - * All {@link PropertySet}s that are bundled into this {@link PropertySet}. - */ - private final Map, PropertySet> satellites - = new IdentityHashMap, PropertySet>(); - - private final Map viewthis; - - public BaseDistributedPropertySet() { - this.viewthis = super.createView(); - } - - @Override - public void addSatellite(@NotNull PropertySet satellite) { - addSatellite(satellite.getClass(), satellite); - } - - @Override - public void addSatellite(@NotNull Class keyClass, @NotNull PropertySet satellite) { - satellites.put(keyClass, satellite); - } - - @Override - public void removeSatellite(PropertySet satellite) { - satellites.remove(satellite.getClass()); - } - - public void copySatelliteInto(@NotNull DistributedPropertySet r) { - for (Map.Entry, PropertySet> entry : satellites.entrySet()) { - r.addSatellite(entry.getKey(), entry.getValue()); - } - } - - @Override - public void copySatelliteInto(MessageContext r) { - copySatelliteInto((DistributedPropertySet)r); - } - - @Override - public @Nullable T getSatellite(Class satelliteClass) { - T satellite = (T) satellites.get(satelliteClass); - if (satellite != null) { - return satellite; - } - - for (PropertySet child : satellites.values()) { - if (satelliteClass.isInstance(child)) { - return satelliteClass.cast(child); - } - - if (DistributedPropertySet.class.isInstance(child)) { - satellite = DistributedPropertySet.class.cast(child).getSatellite(satelliteClass); - if (satellite != null) { - return satellite; - } - } - } - return null; - } - - @Override - public Map, com.oracle.webservices.internal.api.message.PropertySet> getSatellites() { - return satellites; - } - - @Override - public Object get(Object key) { - // check satellites - for (PropertySet child : satellites.values()) { - if (child.supports(key)) { - return child.get(key); - } - } - - // otherwise it must be the master - return super.get(key); - } - - @Override - public Object put(String key, Object value) { - // check satellites - for (PropertySet child : satellites.values()) { - if(child.supports(key)) { - return child.put(key,value); - } - } - - // otherwise it must be the master - return super.put(key,value); - } - - @Override - public boolean containsKey(Object key) { - if (viewthis.containsKey(key)) - return true; - for (PropertySet child : satellites.values()) { - if (child.containsKey(key)) { - return true; - } - } - return false; - } - - @Override - public boolean supports(Object key) { - // check satellites - for (PropertySet child : satellites.values()) { - if (child.supports(key)) { - return true; - } - } - - return super.supports(key); - } - - @Override - public Object remove(Object key) { - // check satellites - for (PropertySet child : satellites.values()) { - if (child.supports(key)) { - return child.remove(key); - } - } - - return super.remove(key); - } - - @Override - protected void createEntrySet(Set> core) { - super.createEntrySet(core); - for (PropertySet child : satellites.values()) { - ((BasePropertySet) child).createEntrySet(core); - } - } - - protected Map asMapLocal() { - return viewthis; - } - - protected boolean supportsLocal(Object key) { - return super.supports(key); - } - - class DistributedMapView extends AbstractMap { - @Override - public Object get(Object key) { - for (PropertySet child : satellites.values()) { - if (child.supports(key)) { - return child.get(key); - } - } - - return viewthis.get(key); - } - - @Override - public int size() { - int size = viewthis.size(); - for (PropertySet child : satellites.values()) { - size += child.asMap().size(); - } - return size; - } - - @Override - public boolean containsKey(Object key) { - if (viewthis.containsKey(key)) - return true; - for (PropertySet child : satellites.values()) { - if (child.asMap().containsKey(key)) - return true; - } - return false; - } - - @Override - public Set> entrySet() { - Set> entries = new HashSet>(); - for (PropertySet child : satellites.values()) { - for (Entry entry : child.asMap().entrySet()) { - // the code below is here to avoid entries.addAll(child.asMap().entrySet()); which works differently on JDK6/7 - // see DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS - entries.add(new SimpleImmutableEntry(entry.getKey(), entry.getValue())); - } - } - for (Entry entry : viewthis.entrySet()) { - // the code below is here to avoid entries.addAll(child.asMap().entrySet()); which works differently on JDK6/7 - // see DMI_ENTRY_SETS_MAY_REUSE_ENTRY_OBJECTS - entries.add(new SimpleImmutableEntry(entry.getKey(), entry.getValue())); - } - - return entries; - } - - @Override - public Object put(String key, Object value) { - for (PropertySet child : satellites.values()) { - if (child.supports(key)) { - return child.put(key, value); - } - } - - return viewthis.put(key, value); - } - - @Override - public void clear() { - satellites.clear(); - viewthis.clear(); - } - - @Override - public Object remove(Object key) { - for (PropertySet child : satellites.values()) { - if (child.supports(key)) { - return child.remove(key); - } - } - - return viewthis.remove(key); - } - } - - @Override - protected Map createView() { - return new DistributedMapView(); - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/BasePropertySet.java 2018-01-30 20:40:45.000000000 -0500 +++ /dev/null 2018-01-30 20:40:45.000000000 -0500 @@ -1,548 +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.oracle.webservices.internal.api.message; - -import com.sun.istack.internal.NotNull; -import com.sun.istack.internal.Nullable; - -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.AbstractMap; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - - -/** - * A set of "properties" that can be accessed via strongly-typed fields - * as well as reflexibly through the property name. - * - * @author Kohsuke Kawaguchi - */ -@SuppressWarnings("SuspiciousMethodCalls") -public abstract class BasePropertySet implements PropertySet { - - /** - * Creates a new instance of TypedMap. - */ - protected BasePropertySet() { - } - - private Map mapView; - - /** - * Represents the list of strongly-typed known properties - * (keyed by property names.) - * - *

- * Just giving it an alias to make the use of this class more fool-proof. - */ - protected static class PropertyMap extends HashMap { - - // the entries are often being iterated through so performance can be improved - // by their caching instead of iterating through the original (immutable) map each time - transient PropertyMapEntry[] cachedEntries = null; - - PropertyMapEntry[] getPropertyMapEntries() { - if (cachedEntries == null) { - cachedEntries = createPropertyMapEntries(); - } - return cachedEntries; - } - - private PropertyMapEntry[] createPropertyMapEntries() { - final PropertyMapEntry[] modelEntries = new PropertyMapEntry[size()]; - int i = 0; - for (final Entry e : entrySet()) { - modelEntries[i++] = new PropertyMapEntry(e.getKey(), e.getValue()); - } - return modelEntries; - } - - } - - /** - * PropertyMapEntry represents a Map.Entry in the PropertyMap with more efficient access. - */ - static public class PropertyMapEntry { - public PropertyMapEntry(String k, Accessor v) { - key = k; value = v; - } - String key; - Accessor value; - } - - /** - * Map representing the Fields and Methods annotated with {@link PropertySet.Property}. - * Model of {@link PropertySet} class. - * - *

- * At the end of the derivation chain this method just needs to be implemented - * as: - * - *

-     * private static final PropertyMap model;
-     * static {
-     *   model = parse(MyDerivedClass.class);
-     * }
-     * protected PropertyMap getPropertyMap() {
-     *   return model;
-     * }
-     * 
- */ - protected abstract PropertyMap getPropertyMap(); - - /** - * This method parses a class for fields and methods with {@link PropertySet.Property}. - */ - protected static PropertyMap parse(final Class clazz) { - // make all relevant fields and methods accessible. - // this allows runtime to skip the security check, so they runs faster. - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public PropertyMap run() { - PropertyMap props = new PropertyMap(); - for (Class c=clazz; c!=null; c=c.getSuperclass()) { - for (Field f : c.getDeclaredFields()) { - Property cp = f.getAnnotation(Property.class); - if(cp!=null) { - for(String value : cp.value()) { - props.put(value, new FieldAccessor(f, value)); - } - } - } - for (Method m : c.getDeclaredMethods()) { - Property cp = m.getAnnotation(Property.class); - if(cp!=null) { - String name = m.getName(); - assert name.startsWith("get") || name.startsWith("is"); - - String setName = name.startsWith("is") ? "set"+name.substring(2) : // isFoo -> setFoo - 's' +name.substring(1); // getFoo -> setFoo - Method setter; - try { - setter = clazz.getMethod(setName,m.getReturnType()); - } catch (NoSuchMethodException e) { - setter = null; // no setter - } - for(String value : cp.value()) { - props.put(value, new MethodAccessor(m, setter, value)); - } - } - } - } - - return props; - } - }); - } - - /** - * Represents a typed property defined on a {@link PropertySet}. - */ - protected interface Accessor { - String getName(); - boolean hasValue(PropertySet props); - Object get(PropertySet props); - void set(PropertySet props, Object value); - } - - static final class FieldAccessor implements Accessor { - /** - * Field with the annotation. - */ - private final Field f; - - /** - * One of the values in {@link Property} annotation on {@link #f}. - */ - private final String name; - - protected FieldAccessor(Field f, String name) { - this.f = f; - f.setAccessible(true); - this.name = name; - } - - @Override - public String getName() { - return name; - } - - @Override - public boolean hasValue(PropertySet props) { - return get(props)!=null; - } - - @Override - public Object get(PropertySet props) { - try { - return f.get(props); - } catch (IllegalAccessException e) { - throw new AssertionError(); - } - } - - @Override - public void set(PropertySet props, Object value) { - try { - f.set(props,value); - } catch (IllegalAccessException e) { - throw new AssertionError(); - } - } - } - - static final class MethodAccessor implements Accessor { - /** - * Getter method. - */ - private final @NotNull Method getter; - /** - * Setter method. - * Some property is read-only. - */ - private final @Nullable Method setter; - - /** - * One of the values in {@link Property} annotation on {@link #getter}. - */ - private final String name; - - protected MethodAccessor(Method getter, Method setter, String value) { - this.getter = getter; - this.setter = setter; - this.name = value; - getter.setAccessible(true); - if (setter!=null) { - setter.setAccessible(true); - } - } - - @Override - public String getName() { - return name; - } - - @Override - public boolean hasValue(PropertySet props) { - return get(props)!=null; - } - - @Override - public Object get(PropertySet props) { - try { - return getter.invoke(props); - } catch (IllegalAccessException e) { - throw new AssertionError(); - } catch (InvocationTargetException e) { - handle(e); - return 0; // never reach here - } - } - - @Override - public void set(PropertySet props, Object value) { - if(setter==null) { - throw new ReadOnlyPropertyException(getName()); - } - try { - setter.invoke(props,value); - } catch (IllegalAccessException e) { - throw new AssertionError(); - } catch (InvocationTargetException e) { - handle(e); - } - } - - /** - * Since we don't expect the getter/setter to throw a checked exception, - * it should be possible to make the exception propagation transparent. - * That's what we are trying to do here. - */ - private Exception handle(InvocationTargetException e) { - Throwable t = e.getTargetException(); - if (t instanceof Error) { - throw (Error)t; - } - if (t instanceof RuntimeException) { - throw (RuntimeException)t; - } - throw new Error(e); - } - } - - - /** - * Class allowing to work with PropertySet object as with a Map; it doesn't only allow to read properties from - * the map but also to modify the map in a way it is in sync with original strongly typed fields. It also allows - * (if necessary) to store additional properties those can't be found in strongly typed fields. - * - * @see com.sun.xml.internal.ws.api.PropertySet#asMap() method - */ - final class MapView extends HashMap { - - // flag if it should allow store also different properties - // than the from strongly typed fields - boolean extensible; - - MapView(boolean extensible) { - super(getPropertyMap().getPropertyMapEntries().length); - this.extensible = extensible; - initialize(); - } - - public void initialize() { - // iterate (cached) array instead of map to speed things up ... - PropertyMapEntry[] entries = getPropertyMap().getPropertyMapEntries(); - for (PropertyMapEntry entry : entries) { - super.put(entry.key, entry.value); - } - } - - @Override - public Object get(Object key) { - Object o = super.get(key); - if (o instanceof Accessor) { - return ((Accessor) o).get(BasePropertySet.this); - } else { - return o; - } - } - - @Override - public Set> entrySet() { - Set> entries = new HashSet>(); - for (String key : keySet()) { - entries.add(new SimpleImmutableEntry(key, get(key))); - } - return entries; - } - - @Override - public Object put(String key, Object value) { - - Object o = super.get(key); - if (o != null && o instanceof Accessor) { - - Object oldValue = ((Accessor) o).get(BasePropertySet.this); - ((Accessor) o).set(BasePropertySet.this, value); - return oldValue; - - } else { - - if (extensible) { - return super.put(key, value); - } else { - throw new IllegalStateException("Unknown property [" + key + "] for PropertySet [" + - BasePropertySet.this.getClass().getName() + "]"); - } - } - } - - @Override - public void clear() { - for (String key : keySet()) { - remove(key); - } - } - - @Override - public Object remove(Object key) { - Object o; - o = super.get(key); - if (o instanceof Accessor) { - ((Accessor)o).set(BasePropertySet.this, null); - } - return super.remove(key); - } - } - - @Override - public boolean containsKey(Object key) { - Accessor sp = getPropertyMap().get(key); - if (sp != null) { - return sp.get(this) != null; - } - return false; - } - - /** - * Gets the name of the property. - * - * @param key - * This field is typed as {@link Object} to follow the {@link Map#get(Object)} - * convention, but if anything but {@link String} is passed, this method - * just returns null. - */ - @Override - public Object get(Object key) { - Accessor sp = getPropertyMap().get(key); - if (sp != null) { - return sp.get(this); - } - throw new IllegalArgumentException("Undefined property "+key); - } - - /** - * Sets a property. - * - *

Implementation Note

- * This method is slow. Code inside JAX-WS should define strongly-typed - * fields in this class and access them directly, instead of using this. - * - * @throws ReadOnlyPropertyException - * if the given key is an alias of a strongly-typed field, - * and if the name object given is not assignable to the field. - * - * @see Property - */ - @Override - public Object put(String key, Object value) { - Accessor sp = getPropertyMap().get(key); - if(sp!=null) { - Object old = sp.get(this); - sp.set(this,value); - return old; - } else { - throw new IllegalArgumentException("Undefined property "+key); - } - } - - /** - * Checks if this {@link PropertySet} supports a property of the given name. - */ - @Override - public boolean supports(Object key) { - return getPropertyMap().containsKey(key); - } - - @Override - public Object remove(Object key) { - Accessor sp = getPropertyMap().get(key); - if(sp!=null) { - Object old = sp.get(this); - sp.set(this,null); - return old; - } else { - throw new IllegalArgumentException("Undefined property "+key); - } - } - - /** - * Creates a {@link Map} view of this {@link PropertySet}. - * - *

- * This map is partially live, in the sense that values you set to it - * will be reflected to {@link PropertySet}. - * - *

- * However, this map may not pick up changes made - * to {@link PropertySet} after the view is created. - * - * @deprecated use newer implementation {@link PropertySet#asMap()} which produces - * readwrite {@link Map} - * - * @return - * always non-null valid instance. - */ - @Deprecated - @Override - public final Map createMapView() { - final Set> core = new HashSet>(); - createEntrySet(core); - - return new AbstractMap() { - @Override - public Set> entrySet() { - return core; - } - }; - } - - /** - * Creates a modifiable {@link Map} view of this {@link PropertySet}. - *

- * Changes done on this {@link Map} or on {@link PropertySet} object work in both directions - values made to - * {@link Map} are reflected to {@link PropertySet} and changes done using getters/setters on {@link PropertySet} - * object are automatically reflected in this {@link Map}. - *

- * If necessary, it also can hold other values (not present on {@link PropertySet}) - - * {@see PropertySet#mapAllowsAdditionalProperties} - * - * @return always non-null valid instance. - */ - @Override - public Map asMap() { - if (mapView == null) { - mapView = createView(); - } - return mapView; - } - - protected Map createView() { - return new MapView(mapAllowsAdditionalProperties()); - } - - /** - * Used when constructing the {@link MapView} for this object - it controls if the {@link MapView} servers only to - * access strongly typed values or allows also different values - * - * @return true if {@link Map} should allow also properties not defined as strongly typed fields - */ - protected boolean mapAllowsAdditionalProperties() { - return false; - } - - protected void createEntrySet(Set> core) { - for (final Entry e : getPropertyMap().entrySet()) { - core.add(new Entry() { - @Override - public String getKey() { - return e.getKey(); - } - - @Override - public Object getValue() { - return e.getValue().get(BasePropertySet.this); - } - - @Override - public Object setValue(Object value) { - Accessor acc = e.getValue(); - Object old = acc.get(BasePropertySet.this); - acc.set(BasePropertySet.this,value); - return old; - } - }); - } - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/ContentType.java 2018-01-30 20:40:45.000000000 -0500 +++ /dev/null 2018-01-30 20:40:45.000000000 -0500 @@ -1,78 +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.oracle.webservices.internal.api.message; - -//TODO Do we want to remove this implementation dependency? -import com.sun.xml.internal.ws.encoding.ContentTypeImpl; - -/** - * A Content-Type transport header that will be returned by {@link MessageContext#write(java.io.OutputStream)}. - * It will provide the Content-Type header and also take care of SOAP 1.1 SOAPAction header. - * - * @author Vivek Pandey - */ -public interface ContentType { - - /** - * Gives non-null Content-Type header value. - */ - public String getContentType(); - - /** - * Gives SOAPAction transport header value. It will be non-null only for SOAP 1.1 messages. In other cases - * it MUST be null. The SOAPAction transport header should be written out only when its non-null. - * - * @return It can be null, in that case SOAPAction header should be written. - */ - public String getSOAPActionHeader(); - - /** - * Controls the Accept transport header, if the transport supports it. - * Returning null means the transport need not add any new header. - * - *

- * We realize that this is not an elegant abstraction, but - * this would do for now. If another person comes and asks for - * a similar functionality, we'll define a real abstraction. - */ - public String getAcceptHeader(); - - static public class Builder { - private String contentType; - private String soapAction; - private String accept; - private String charset; - - public Builder contentType(String s) {contentType = s; return this; } - public Builder soapAction (String s) {soapAction = s; return this; } - public Builder accept (String s) {accept = s; return this; } - public Builder charset (String s) {charset = s; return this; } - public ContentType build() { - //TODO Do we want to remove this implementation dependency? - return new ContentTypeImpl(contentType, soapAction, accept, charset); - } - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/DistributedPropertySet.java 2018-01-30 20:40:46.000000000 -0500 +++ /dev/null 2018-01-30 20:40:46.000000000 -0500 @@ -1,81 +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.oracle.webservices.internal.api.message; - -import java.util.Map; - -import com.sun.istack.internal.Nullable; - -/** - * {@link PropertySet} that combines properties exposed from multiple - * {@link PropertySet}s into one. - * - *

- * This implementation allows one {@link PropertySet} to assemble - * all properties exposed from other "satellite" {@link PropertySet}s. - * (A satellite may itself be a {@link DistributedPropertySet}, so - * in general this can form a tree.) - * - *

- * This is useful for JAX-WS because the properties we expose to the application - * are contributed by different pieces, and therefore we'd like each of them - * to have a separate {@link PropertySet} implementation that backs up - * the properties. For example, this allows FastInfoset to expose its - * set of properties to {@link RequestContext} by using a strongly-typed fields. - * - *

- * This is also useful for a client-side transport to expose a bunch of properties - * into {@link ResponseContext}. It simply needs to create a {@link PropertySet} - * object with methods for each property it wants to expose, and then add that - * {@link PropertySet} to {@link Packet}. This allows property values to be - * lazily computed (when actually asked by users), thus improving the performance - * of the typical case where property values are not asked. - * - *

- * A similar benefit applies on the server-side, for a transport to expose - * a bunch of properties to {@link WebServiceContext}. - * - *

- * To achieve these benefits, access to {@link DistributedPropertySet} is slower - * compared to {@link PropertySet} (such as get/set), while adding a satellite - * object is relatively fast. - * - * @author Kohsuke Kawaguchi - */ -public interface DistributedPropertySet extends com.oracle.webservices.internal.api.message.PropertySet { - - public @Nullable T getSatellite(Class satelliteClass); - - public Map, com.oracle.webservices.internal.api.message.PropertySet> getSatellites(); - - public void addSatellite(com.oracle.webservices.internal.api.message.PropertySet satellite); - - public void addSatellite(Class keyClass, com.oracle.webservices.internal.api.message.PropertySet satellite); - - public void removeSatellite(com.oracle.webservices.internal.api.message.PropertySet satellite); - - public void copySatelliteInto(com.oracle.webservices.internal.api.message.MessageContext r); -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/MessageContext.java 2018-01-30 20:40:47.000000000 -0500 +++ /dev/null 2018-01-30 20:40:47.000000000 -0500 @@ -1,101 +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.oracle.webservices.internal.api.message; - -import java.io.IOException; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.nio.channels.WritableByteChannel; - -import javax.xml.soap.SOAPException; -import javax.xml.soap.SOAPMessage; - -/** - * MessageContext represents a container of a SOAP message and all the properties - * including the transport headers. - * - * MessageContext is a composite {@link PropertySet} that combines properties exposed from multiple - * {@link PropertySet}s into one. - * - *

- * This implementation allows one {@link PropertySet} to assemble - * all properties exposed from other "satellite" {@link PropertySet}s. - * (A satellite may itself be a {@link DistributedPropertySet}, so - * in general this can form a tree.) - * - * @author shih-chang.chen@oracle.com - */ -public interface MessageContext extends DistributedPropertySet { - /** - * Gets the SAAJ SOAPMessage representation of the SOAP message. - * - * @return The SOAPMessage - */ - SOAPMessage getAsSOAPMessage() throws SOAPException; - - /** - * Gets the SAAJ SOAPMessage representation of the SOAP message. - * @deprecated use getAsSOAPMessage - * @return The SOAPMessage - */ - SOAPMessage getSOAPMessage() throws SOAPException; - - /** - * Writes the XML infoset portion of this MessageContext - * (from <soap:Envelope> to </soap:Envelope>). - * - * @param out - * Must not be null. The caller is responsible for closing the stream, - * not the callee. - * - * @return - * The MIME content type of the encoded message (such as "application/xml"). - * This information is often ncessary by transport. - * - * @throws IOException - * if a {@link OutputStream} throws {@link IOException}. - */ - ContentType writeTo( OutputStream out ) throws IOException; - - /** - * The version of {@link #writeTo(OutputStream)} - * that writes to NIO {@link ByteBuffer}. - * - *

- * TODO: for the convenience of implementation, write - * an adapter that wraps {@link WritableByteChannel} to {@link OutputStream}. - */ -// ContentType writeTo( WritableByteChannel buffer ); - - /** - * Gets the Content-type of this message. For an out-bound message that this getContentType() - * method returns a null, the Content-Type can be determined only by calling the writeTo - * method to write the MessageContext to an OutputStream. - * - * @return The MIME content type of this message - */ - ContentType getContentType(); -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/MessageContextFactory.java 2018-01-30 20:40:48.000000000 -0500 +++ /dev/null 2018-01-30 20:40:48.000000000 -0500 @@ -1,136 +0,0 @@ -/* - * Copyright (c) 1997, 2015, 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.oracle.webservices.internal.api.message; - -import java.io.IOException; -import java.io.InputStream; - -import com.oracle.webservices.internal.api.EnvelopeStyle; -import com.sun.xml.internal.ws.api.SOAPVersion; // TODO leaking RI APIs -import com.sun.xml.internal.ws.util.ServiceFinder; - -import javax.xml.soap.MimeHeaders; -import javax.xml.soap.SOAPMessage; -import javax.xml.transform.Source; -import javax.xml.ws.WebServiceFeature; - -public abstract class MessageContextFactory -{ - private static final MessageContextFactory DEFAULT = new com.sun.xml.internal.ws.api.message.MessageContextFactory(new WebServiceFeature[0]); - - protected com.sun.xml.internal.ws.api.message.saaj.SAAJFactory saajFactory = null; - - protected abstract MessageContextFactory newFactory(WebServiceFeature ... f); - - public abstract MessageContext createContext(); - - public abstract MessageContext createContext(SOAPMessage m); - - public abstract MessageContext createContext(Source m); - - public abstract MessageContext createContext(Source m, EnvelopeStyle.Style envelopeStyle); - - public abstract MessageContext createContext(InputStream in, String contentType) throws IOException; - - /** - * @deprecated http://java.net/jira/browse/JAX_WS-1077 - */ - @Deprecated - public abstract MessageContext createContext(InputStream in, MimeHeaders headers) throws IOException; - - static public MessageContextFactory createFactory(WebServiceFeature ... f) { - return createFactory(null, f); - } - - static public MessageContextFactory createFactory(ClassLoader cl, WebServiceFeature ...f) { - for (MessageContextFactory factory : ServiceFinder.find(MessageContextFactory.class, cl)) { - MessageContextFactory newfac = factory.newFactory(f); - if (newfac != null) return newfac; - } - return new com.sun.xml.internal.ws.api.message.MessageContextFactory(f); - } - - @Deprecated - public abstract MessageContext doCreate(); - - @Deprecated - public abstract MessageContext doCreate(SOAPMessage m); - - //public abstract MessageContext doCreate(InputStream x); - - @Deprecated - public abstract MessageContext doCreate(Source x, SOAPVersion soapVersion); - - @Deprecated - public static MessageContext create(final ClassLoader... classLoader) { - return serviceFinder(classLoader, - new Creator() { - public MessageContext create(final MessageContextFactory f) { - return f.doCreate(); - } - }); - } - - @Deprecated - public static MessageContext create(final SOAPMessage m, final ClassLoader... classLoader) { - return serviceFinder(classLoader, - new Creator() { - public MessageContext create(final MessageContextFactory f) { - return f.doCreate(m); - } - }); - } - - @Deprecated - public static MessageContext create(final Source m, final SOAPVersion v, final ClassLoader... classLoader) { - return serviceFinder(classLoader, - new Creator() { - public MessageContext create(final MessageContextFactory f) { - return f.doCreate(m, v); - } - }); - } - - @Deprecated - private static MessageContext serviceFinder(final ClassLoader[] classLoader, final Creator creator) { - final ClassLoader cl = classLoader.length == 0 ? null : classLoader[0]; - for (MessageContextFactory factory : ServiceFinder.find(MessageContextFactory.class, cl)) { - final MessageContext messageContext = creator.create(factory); - if (messageContext != null) - return messageContext; - } - return creator.create(DEFAULT); - } - - @Deprecated - private static interface Creator { - public MessageContext create(MessageContextFactory f); - } - - public void setSAAJFactory(com.sun.xml.internal.ws.api.message.saaj.SAAJFactory saajFactory) { - this.saajFactory = saajFactory; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/PropertySet.java 2018-01-30 20:40:49.000000000 -0500 +++ /dev/null 2018-01-30 20:40:49.000000000 -0500 @@ -1,134 +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.oracle.webservices.internal.api.message; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; -import java.util.Map; - -import javax.xml.ws.handler.MessageContext; - -/** - * A set of "properties" that can be accessed via strongly-typed fields - * as well as reflexibly through the property name. - * - * @author Kohsuke Kawaguchi - */ -public interface PropertySet { - - /** - * Marks a field on {@link PropertySet} as a - * property of {@link MessageContext}. - * - *

- * To make the runtime processing easy, this annotation - * must be on a public field (since the property name - * can be set through {@link Map} anyway, you won't be - * losing abstraction by doing so.) - * - *

- * For similar reason, this annotation can be only placed - * on a reference type, not primitive type. - * - * @author Kohsuke Kawaguchi - */ - @Inherited - @Retention(RetentionPolicy.RUNTIME) - @Target({ElementType.FIELD,ElementType.METHOD}) - public @interface Property { - /** - * Name of the property. - */ - String[] value(); - } - - public boolean containsKey(Object key); - - /** - * Gets the name of the property. - * - * @param key - * This field is typed as {@link Object} to follow the {@link Map#get(Object)} - * convention, but if anything but {@link String} is passed, this method - * just returns null. - */ - public Object get(Object key); - - /** - * Sets a property. - * - *

Implementation Note

- * This method is slow. Code inside JAX-WS should define strongly-typed - * fields in this class and access them directly, instead of using this. - * - * @see Property - */ - public Object put(String key, Object value); - - /** - * Checks if this {@link PropertySet} supports a property of the given name. - */ - public boolean supports(Object key); - - public Object remove(Object key); - - /** - * Creates a {@link Map} view of this {@link PropertySet}. - * - *

- * This map is partially live, in the sense that values you set to it - * will be reflected to {@link PropertySet}. - * - *

- * However, this map may not pick up changes made - * to {@link PropertySet} after the view is created. - * - * @deprecated use newer implementation {@link com.sun.xml.internal.ws.api.PropertySet#asMap()} which produces - * readwrite {@link Map} - * - * @return - * always non-null valid instance. - */ - @Deprecated - public Map createMapView(); - - /** - * Creates a modifiable {@link Map} view of this {@link PropertySet}. - *

- * Changes done on this {@link Map} or on {@link PropertySet} object work in both directions - values made to - * {@link Map} are reflected to {@link PropertySet} and changes done using getters/setters on {@link PropertySet} - * object are automatically reflected in this {@link Map}. - *

- * If necessary, it also can hold other values (not present on {@link PropertySet}) - - * {@see PropertySet#mapAllowsAdditionalProperties} - * - * @return always non-null valid instance. - */ - public Map asMap(); -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/ReadOnlyPropertyException.java 2018-01-30 20:40:50.000000000 -0500 +++ /dev/null 2018-01-30 20:40:50.000000000 -0500 @@ -1,48 +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.oracle.webservices.internal.api.message; - -/** - * Used to indicate that {@link PropertySet#put(String, Object)} failed - * because a property is read-only. - * - * @author Kohsuke Kawaguchi - */ -public class ReadOnlyPropertyException extends IllegalArgumentException { - private final String propertyName; - - public ReadOnlyPropertyException(String propertyName) { - super(propertyName+" is a read-only property."); - this.propertyName = propertyName; - } - - /** - * Gets the name of the property that was read-only. - */ - public String getPropertyName() { - return propertyName; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/impl/encoding/StreamDecoderImpl.java 2018-01-30 20:40:51.000000000 -0500 +++ /dev/null 2018-01-30 20:40:51.000000000 -0500 @@ -1,52 +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.oracle.webservices.internal.impl.encoding; - -import java.io.IOException; -import java.io.InputStream; - -import javax.xml.stream.XMLStreamReader; - -import com.oracle.webservices.internal.impl.internalspi.encoding.StreamDecoder; - -import com.sun.xml.internal.ws.api.SOAPVersion; -import com.sun.xml.internal.ws.api.message.AttachmentSet; -import com.sun.xml.internal.ws.api.message.Message; -import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory; -import com.sun.xml.internal.ws.encoding.StreamSOAPCodec; -import com.sun.xml.internal.ws.streaming.TidyXMLStreamReader; - -public class StreamDecoderImpl implements StreamDecoder { - - @Override - public Message decode(InputStream in, String charset, - AttachmentSet att, SOAPVersion soapVersion) throws IOException { - XMLStreamReader reader = XMLStreamReaderFactory.create(null, in, charset, true); - reader = new TidyXMLStreamReader(reader, in); - return StreamSOAPCodec.decode(soapVersion, reader, att); - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/webservices/internal/impl/internalspi/encoding/StreamDecoder.java 2018-01-30 20:40:52.000000000 -0500 +++ /dev/null 2018-01-30 20:40:52.000000000 -0500 @@ -1,45 +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.oracle.webservices.internal.impl.internalspi.encoding; - -import java.io.IOException; -import java.io.InputStream; - -import com.sun.xml.internal.ws.api.SOAPVersion; -import com.sun.xml.internal.ws.api.message.AttachmentSet; -import com.sun.xml.internal.ws.api.message.Message; - -/** - * Decodes SOAPEnvelope read from an InputStream into a Message instance. - * This SPI allows for other implementations instead of the default, which is based on XMLStreamReader. - * - * @since 2.2.9 - */ -public interface StreamDecoder { - Message decode( - InputStream in, String charset, - AttachmentSet att, SOAPVersion soapVersion) throws IOException; -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/ExistingAnnotationsType.java 2018-01-30 20:40:52.000000000 -0500 +++ /dev/null 2018-01-30 20:40:53.000000000 -0500 @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlEnumValue; -import javax.xml.bind.annotation.XmlType; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for existing-annotations-type. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="existing-annotations-type">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="merge"/>
- *     <enumeration value="ignore"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "existing-annotations-type") -@XmlEnum -public enum ExistingAnnotationsType { - - @XmlEnumValue("merge") - MERGE("merge"), - @XmlEnumValue("ignore") - IGNORE("ignore"); - private final String value; - - ExistingAnnotationsType(String v) { - value = v; - } - - public String value() { - return value; - } - - public static ExistingAnnotationsType fromValue(String v) { - for (ExistingAnnotationsType c: ExistingAnnotationsType.values()) { - if (c.value.equals(v)) { - return c; - } - } - throw new IllegalArgumentException(v); - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/JavaMethod.java 2018-01-30 20:40:53.000000000 -0500 +++ /dev/null 2018-01-30 20:40:53.000000000 -0500 @@ -1,265 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlElementRefs; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <group ref="{http://xmlns.oracle.com/webservices/jaxws-databinding}method-annotation" maxOccurs="unbounded" minOccurs="0"/>
- *         <element name="java-params" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element ref="{http://xmlns.oracle.com/webservices/jaxws-databinding}java-param" maxOccurs="unbounded"/>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *       <attribute name="name" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <anyAttribute processContents='skip' namespace='##other'/>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "methodAnnotation", - "javaParams" -}) -@XmlRootElement(name = "java-method") -public class JavaMethod { - - @XmlElementRefs({ - @XmlElementRef(name = "web-endpoint", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlWebEndpoint.class, required = false), - @XmlElementRef(name = "oneway", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlOneway.class, required = false), - @XmlElementRef(name = "action", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlAction.class, required = false), - @XmlElementRef(name = "soap-binding", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlSOAPBinding.class, required = false), - @XmlElementRef(name = "web-result", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlWebResult.class, required = false), - @XmlElementRef(name = "web-method", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlWebMethod.class, required = false) - }) - @XmlAnyElement - protected List methodAnnotation; - @XmlElement(name = "java-params") - protected JavaMethod.JavaParams javaParams; - @XmlAttribute(name = "name", required = true) - protected String name; - @XmlAnyAttribute - private Map otherAttributes = new HashMap(); - - /** - * Gets the value of the methodAnnotation property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the methodAnnotation property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getMethodAnnotation().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link XmlWebEndpoint } - * {@link XmlOneway } - * {@link XmlAction } - * {@link XmlSOAPBinding } - * {@link XmlWebResult } - * {@link XmlWebMethod } - * {@link Element } - * - * - */ - public List getMethodAnnotation() { - if (methodAnnotation == null) { - methodAnnotation = new ArrayList(); - } - return this.methodAnnotation; - } - - /** - * Gets the value of the javaParams property. - * - * @return - * possible object is - * {@link JavaMethod.JavaParams } - * - */ - public JavaMethod.JavaParams getJavaParams() { - return javaParams; - } - - /** - * Sets the value of the javaParams property. - * - * @param value - * allowed object is - * {@link JavaMethod.JavaParams } - * - */ - public void setJavaParams(JavaMethod.JavaParams value) { - this.javaParams = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets a map that contains attributes that aren't bound to any typed property on this class. - * - *

- * the map is keyed by the name of the attribute and - * the value is the string value of the attribute. - * - * the map returned by this method is live, and you can add new attribute - * by updating the map directly. Because of this design, there's no setter. - * - * - * @return - * always non-null - */ - public Map getOtherAttributes() { - return otherAttributes; - } - - - /** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <sequence>
-     *         <element ref="{http://xmlns.oracle.com/webservices/jaxws-databinding}java-param" maxOccurs="unbounded"/>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "javaParam" - }) - public static class JavaParams { - - @XmlElement(name = "java-param", required = true) - protected List javaParam; - - /** - * Gets the value of the javaParam property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the javaParam property. - * - *

- * For example, to add a new item, do as follows: - *

-         *    getJavaParam().add(newItem);
-         * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link JavaParam } - * - * - */ - public List getJavaParam() { - if (javaParam == null) { - javaParam = new ArrayList(); - } - return this.javaParam; - } - - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/JavaParam.java 2018-01-30 20:40:54.000000000 -0500 +++ /dev/null 2018-01-30 20:40:54.000000000 -0500 @@ -1,153 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <group ref="{http://xmlns.oracle.com/webservices/jaxws-databinding}param-annotation" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="java-type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <anyAttribute processContents='skip' namespace='##other'/>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "paramAnnotation" -}) -@XmlRootElement(name = "java-param") -public class JavaParam { - - @XmlElementRef(name = "web-param", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlWebParam.class, required = false) - @XmlAnyElement - protected List paramAnnotation; - @XmlAttribute(name = "java-type") - protected String javaType; - @XmlAnyAttribute - private Map otherAttributes = new HashMap(); - - /** - * Gets the value of the paramAnnotation property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the paramAnnotation property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getParamAnnotation().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link XmlWebParam } - * {@link Element } - * - * - */ - public List getParamAnnotation() { - if (paramAnnotation == null) { - paramAnnotation = new ArrayList(); - } - return this.paramAnnotation; - } - - /** - * Gets the value of the javaType property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getJavaType() { - return javaType; - } - - /** - * Sets the value of the javaType property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setJavaType(String value) { - this.javaType = value; - } - - /** - * Gets a map that contains attributes that aren't bound to any typed property on this class. - * - *

- * the map is keyed by the name of the attribute and - * the value is the string value of the attribute. - * - * the map returned by this method is live, and you can add new attribute - * by updating the map directly. Because of this design, there's no setter. - * - * - * @return - * always non-null - */ - public Map getOtherAttributes() { - return otherAttributes; - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/JavaWsdlMappingType.java 2018-01-30 20:40:55.000000000 -0500 +++ /dev/null 2018-01-30 20:40:55.000000000 -0500 @@ -1,452 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import org.w3c.dom.Element; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAnyAttribute; -import javax.xml.bind.annotation.XmlAnyElement; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementRef; -import javax.xml.bind.annotation.XmlElementRefs; -import javax.xml.bind.annotation.XmlType; -import javax.xml.namespace.QName; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for java-wsdl-mapping-type complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType name="java-wsdl-mapping-type">
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element name="xml-schema-mapping" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <any maxOccurs="unbounded" minOccurs="0"/>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *         <group ref="{http://xmlns.oracle.com/webservices/jaxws-databinding}class-annotation" maxOccurs="unbounded" minOccurs="0"/>
- *         <element name="java-methods" minOccurs="0">
- *           <complexType>
- *             <complexContent>
- *               <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *                 <sequence>
- *                   <element ref="{http://xmlns.oracle.com/webservices/jaxws-databinding}java-method" maxOccurs="unbounded" minOccurs="0"/>
- *                 </sequence>
- *               </restriction>
- *             </complexContent>
- *           </complexType>
- *         </element>
- *       </sequence>
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="java-type-name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="existing-annotations" type="{http://xmlns.oracle.com/webservices/jaxws-databinding}existing-annotations-type" />
- *       <attribute name="databinding" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <anyAttribute processContents='skip' namespace='##other'/>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "java-wsdl-mapping-type", propOrder = { - "xmlSchemaMapping", - "classAnnotation", - "javaMethods" -}) -public class JavaWsdlMappingType { - - @XmlElement(name = "xml-schema-mapping") - protected JavaWsdlMappingType.XmlSchemaMapping xmlSchemaMapping; - @XmlElementRefs({ - @XmlElementRef(name = "web-service-client", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlWebServiceClient.class, required = false), - @XmlElementRef(name = "binding-type", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlBindingType.class, required = false), - @XmlElementRef(name = "web-service", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlWebService.class, required = false), - @XmlElementRef(name = "web-fault", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlWebFault.class, required = false), - @XmlElementRef(name = "service-mode", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlServiceMode.class, required = false), - @XmlElementRef(name = "mtom", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlMTOM.class, required = false), - @XmlElementRef(name = "handler-chain", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlHandlerChain.class, required = false), - @XmlElementRef(name = "soap-binding", namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", type = XmlSOAPBinding.class, required = false) - }) - @XmlAnyElement - protected List classAnnotation; - @XmlElement(name = "java-methods") - protected JavaWsdlMappingType.JavaMethods javaMethods; - @XmlAttribute(name = "name") - protected String name; - @XmlAttribute(name = "java-type-name") - protected String javaTypeName; - @XmlAttribute(name = "existing-annotations") - protected ExistingAnnotationsType existingAnnotations; - @XmlAttribute(name = "databinding") - protected String databinding; - @XmlAnyAttribute - private Map otherAttributes = new HashMap(); - - /** - * Gets the value of the xmlSchemaMapping property. - * - * @return - * possible object is - * {@link JavaWsdlMappingType.XmlSchemaMapping } - * - */ - public JavaWsdlMappingType.XmlSchemaMapping getXmlSchemaMapping() { - return xmlSchemaMapping; - } - - /** - * Sets the value of the xmlSchemaMapping property. - * - * @param value - * allowed object is - * {@link JavaWsdlMappingType.XmlSchemaMapping } - * - */ - public void setXmlSchemaMapping(JavaWsdlMappingType.XmlSchemaMapping value) { - this.xmlSchemaMapping = value; - } - - /** - * - * The class-annotation group defines the set of - * annotations applicable to the Java class - * declaration. - * Gets the value of the classAnnotation property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the classAnnotation property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getClassAnnotation().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link XmlWebServiceClient } - * {@link XmlBindingType } - * {@link XmlWebService } - * {@link XmlWebFault } - * {@link XmlServiceMode } - * {@link XmlMTOM } - * {@link XmlHandlerChain } - * {@link Element } - * {@link XmlSOAPBinding } - * - * - */ - public List getClassAnnotation() { - if (classAnnotation == null) { - classAnnotation = new ArrayList(); - } - return this.classAnnotation; - } - - /** - * Gets the value of the javaMethods property. - * - * @return - * possible object is - * {@link JavaWsdlMappingType.JavaMethods } - * - */ - public JavaWsdlMappingType.JavaMethods getJavaMethods() { - return javaMethods; - } - - /** - * Sets the value of the javaMethods property. - * - * @param value - * allowed object is - * {@link JavaWsdlMappingType.JavaMethods } - * - */ - public void setJavaMethods(JavaWsdlMappingType.JavaMethods value) { - this.javaMethods = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the javaTypeName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getJavaTypeName() { - return javaTypeName; - } - - /** - * Sets the value of the javaTypeName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setJavaTypeName(String value) { - this.javaTypeName = value; - } - - /** - * Gets the value of the classAnnotations property. - * - * @return - * possible object is - * {@link ExistingAnnotationsType } - * - */ - public ExistingAnnotationsType getExistingAnnotations() { - return existingAnnotations; - } - - /** - * Sets the value of the classAnnotations property. - * - * @param value - * allowed object is - * {@link ExistingAnnotationsType } - * - */ - public void setExistingAnnotations(ExistingAnnotationsType value) { - this.existingAnnotations = value; - } - - /** - * Gets the value of the databinding property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getDatabinding() { - return databinding; - } - - /** - * Sets the value of the databinding property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setDatabinding(String value) { - this.databinding = value; - } - - /** - * Gets a map that contains attributes that aren't bound to any typed property on this class. - * - *

- * the map is keyed by the name of the attribute and - * the value is the string value of the attribute. - * - * the map returned by this method is live, and you can add new attribute - * by updating the map directly. Because of this design, there's no setter. - * - * - * @return - * always non-null - */ - public Map getOtherAttributes() { - return otherAttributes; - } - - - /** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <sequence>
-     *         <element ref="{http://xmlns.oracle.com/webservices/jaxws-databinding}java-method" maxOccurs="unbounded" minOccurs="0"/>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "javaMethod" - }) - public static class JavaMethods { - - @XmlElement(name = "java-method") - protected List javaMethod; - - /** - * Gets the value of the javaMethod property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the javaMethod property. - * - *

- * For example, to add a new item, do as follows: - *

-         *    getJavaMethod().add(newItem);
-         * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link JavaMethod } - * - * - */ - public List getJavaMethod() { - if (javaMethod == null) { - javaMethod = new ArrayList(); - } - return this.javaMethod; - } - - } - - - /** - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

-     * <complexType>
-     *   <complexContent>
-     *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
-     *       <sequence>
-     *         <any maxOccurs="unbounded" minOccurs="0"/>
-     *       </sequence>
-     *     </restriction>
-     *   </complexContent>
-     * </complexType>
-     * 
- * - * - */ - @XmlAccessorType(XmlAccessType.FIELD) - @XmlType(name = "", propOrder = { - "any" - }) - public static class XmlSchemaMapping { - - @XmlAnyElement(lax = true) - protected List any; - - /** - * Gets the value of the any property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the any property. - * - *

- * For example, to add a new item, do as follows: - *

-         *    getAny().add(newItem);
-         * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link Object } - * - * - */ - public List getAny() { - if (any == null) { - any = new ArrayList(); - } - return this.any; - } - - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/ObjectFactory.java 2018-01-30 20:40:56.000000000 -0500 +++ /dev/null 2018-01-30 20:40:56.000000000 -0500 @@ -1,268 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.JAXBElement; -import javax.xml.bind.annotation.XmlElementDecl; -import javax.xml.bind.annotation.XmlRegistry; -import javax.xml.namespace.QName; - - -/** - * This object contains factory methods for each - * Java content interface and Java element interface - * generated in the com.sun.xml.internal.ws.ext2.java_wsdl package. - *

An ObjectFactory allows you to programatically - * construct new instances of the Java representation - * for XML content. The Java representation of XML - * content can consist of schema derived interfaces - * and classes representing the binding of schema - * type definitions, element declarations and model - * groups. Factory methods for each of these are - * provided in this class. - * - */ -@XmlRegistry -public class ObjectFactory { - - private final static QName _JavaWsdlMapping_QNAME = new QName("http://xmlns.oracle.com/webservices/jaxws-databinding", "java-wsdl-mapping"); - - /** - * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.sun.xml.internal.ws.ext2.java_wsdl - * - */ - public ObjectFactory() { - } - - /** - * Create an instance of {@link JavaMethod } - * - */ - public JavaMethod createJavaMethod() { - return new JavaMethod(); - } - - /** - * Create an instance of {@link JavaWsdlMappingType } - * - */ - public JavaWsdlMappingType createJavaWsdlMappingType() { - return new JavaWsdlMappingType(); - } - - /** - * Create an instance of {@link XmlWebEndpoint } - * - */ - public XmlWebEndpoint createWebEndpoint() { - return new XmlWebEndpoint(); - } - - /** - * Create an instance of {@link XmlMTOM } - * - */ - public XmlMTOM createMtom() { - return new XmlMTOM(); - } - - /** - * Create an instance of {@link XmlWebServiceClient } - * - */ - public XmlWebServiceClient createWebServiceClient() { - return new XmlWebServiceClient(); - } - - /** - * Create an instance of {@link XmlServiceMode } - * - */ - public XmlServiceMode createServiceMode() { - return new XmlServiceMode(); - } - - /** - * Create an instance of {@link XmlBindingType } - * - */ - public XmlBindingType createBindingType() { - return new XmlBindingType(); - } - - /** - * Create an instance of {@link XmlWebServiceRef } - * - */ - public XmlWebServiceRef createWebServiceRef() { - return new XmlWebServiceRef(); - } - - /** - * Create an instance of {@link JavaParam } - * - */ - public JavaParam createJavaParam() { - return new JavaParam(); - } - - /** - * Create an instance of {@link XmlWebParam } - * - */ - public XmlWebParam createWebParam() { - return new XmlWebParam(); - } - - /** - * Create an instance of {@link XmlWebMethod } - * - */ - public XmlWebMethod createWebMethod() { - return new XmlWebMethod(); - } - - /** - * Create an instance of {@link XmlWebResult } - * - */ - public XmlWebResult createWebResult() { - return new XmlWebResult(); - } - - /** - * Create an instance of {@link XmlOneway } - * - */ - public XmlOneway createOneway() { - return new XmlOneway(); - } - - /** - * Create an instance of {@link XmlSOAPBinding } - * - */ - public XmlSOAPBinding createSoapBinding() { - return new XmlSOAPBinding(); - } - - /** - * Create an instance of {@link XmlAction } - * - */ - public XmlAction createAction() { - return new XmlAction(); - } - - /** - * Create an instance of {@link XmlFaultAction } - * - */ - public XmlFaultAction createFaultAction() { - return new XmlFaultAction(); - } - - /** - * Create an instance of {@link JavaMethod.JavaParams } - * - */ - public JavaMethod.JavaParams createJavaMethodJavaParams() { - return new JavaMethod.JavaParams(); - } - - /** - * Create an instance of {@link XmlHandlerChain } - * - */ - public XmlHandlerChain createHandlerChain() { - return new XmlHandlerChain(); - } - - /** - * Create an instance of {@link XmlWebServiceProvider } - * - */ - public XmlWebServiceProvider createWebServiceProvider() { - return new XmlWebServiceProvider(); - } - - /** - * Create an instance of {@link XmlWebFault } - * - */ - public XmlWebFault createWebFault() { - return new XmlWebFault(); - } - - /** - * Create an instance of {@link XmlResponseWrapper } - * - */ - public XmlResponseWrapper createResponseWrapper() { - return new XmlResponseWrapper(); - } - - /** - * Create an instance of {@link XmlWebService } - * - */ - public XmlWebService createWebService() { - return new XmlWebService(); - } - - /** - * Create an instance of {@link XmlRequestWrapper } - * - */ - public XmlRequestWrapper createRequestWrapper() { - return new XmlRequestWrapper(); - } - - /** - * Create an instance of {@link JavaWsdlMappingType.XmlSchemaMapping } - * - */ - public JavaWsdlMappingType.XmlSchemaMapping createJavaWsdlMappingTypeXmlSchemaMapping() { - return new JavaWsdlMappingType.XmlSchemaMapping(); - } - - /** - * Create an instance of {@link JavaWsdlMappingType.JavaMethods } - * - */ - public JavaWsdlMappingType.JavaMethods createJavaWsdlMappingTypeJavaMethods() { - return new JavaWsdlMappingType.JavaMethods(); - } - - /** - * Create an instance of {@link JAXBElement }{@code <}{@link JavaWsdlMappingType }{@code >}} - * - */ - @XmlElementDecl(namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", name = "java-wsdl-mapping") - public JAXBElement createJavaWsdlMapping(JavaWsdlMappingType value) { - return new JAXBElement(_JavaWsdlMapping_QNAME, JavaWsdlMappingType.class, null, value); - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/SoapBindingParameterStyle.java 2018-01-30 20:40:57.000000000 -0500 +++ /dev/null 2018-01-30 20:40:57.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for soap-binding-parameter-style. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="soap-binding-parameter-style">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="BARE"/>
- *     <enumeration value="WRAPPED"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "soap-binding-parameter-style") -@XmlEnum -public enum SoapBindingParameterStyle { - - BARE, - WRAPPED; - - public String value() { - return name(); - } - - public static SoapBindingParameterStyle fromValue(String v) { - return valueOf(v); - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/SoapBindingStyle.java 2018-01-30 20:40:58.000000000 -0500 +++ /dev/null 2018-01-30 20:40:58.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for soap-binding-style. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="soap-binding-style">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="DOCUMENT"/>
- *     <enumeration value="RPC"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "soap-binding-style") -@XmlEnum -public enum SoapBindingStyle { - - DOCUMENT, - RPC; - - public String value() { - return name(); - } - - public static SoapBindingStyle fromValue(String v) { - return valueOf(v); - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/SoapBindingUse.java 2018-01-30 20:40:59.000000000 -0500 +++ /dev/null 2018-01-30 20:40:59.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for soap-binding-use. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="soap-binding-use">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="LITERAL"/>
- *     <enumeration value="ENCODED"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "soap-binding-use") -@XmlEnum -public enum SoapBindingUse { - - LITERAL, - ENCODED; - - public String value() { - return name(); - } - - public static SoapBindingUse fromValue(String v) { - return valueOf(v); - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/Util.java 2018-01-30 20:40:59.000000000 -0500 +++ /dev/null 2018-01-30 20:40:59.000000000 -0500 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; - -import com.sun.xml.internal.ws.model.RuntimeModelerException; - -/** - * Simple util to handle default values. - * - * @author miroslav.kos@oracle.com - */ -class Util { - - static String nullSafe(String value) { - return value == null ? "" : value; - } - - static T nullSafe(T value, T defaultValue) { - return value == null ? defaultValue : value; - } - - @SuppressWarnings("unchecked") - static T nullSafe(Enum value, T defaultValue) { - return value == null ? defaultValue : (T) T.valueOf(defaultValue.getClass(), value.toString()); - } - - public static Class findClass(String className) { - try { - return Class.forName(className); - } catch (ClassNotFoundException e) { - throw new RuntimeModelerException("runtime.modeler.external.metadata.generic", e); - } - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/WebParamMode.java 2018-01-30 20:41:00.000000000 -0500 +++ /dev/null 2018-01-30 20:41:00.000000000 -0500 @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlEnum; -import javax.xml.bind.annotation.XmlType; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for web-param-mode. - * - *

The following schema fragment specifies the expected content contained within this class. - *

- *

- * <simpleType name="web-param-mode">
- *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
- *     <enumeration value="IN"/>
- *     <enumeration value="OUT"/>
- *     <enumeration value="INOUT"/>
- *   </restriction>
- * </simpleType>
- * 
- * - */ -@XmlType(name = "web-param-mode") -@XmlEnum -public enum WebParamMode { - - IN, - OUT, - INOUT; - - public String value() { - return name(); - } - - public static WebParamMode fromValue(String v) { - return valueOf(v); - } - -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlAction.java 2018-01-30 20:41:01.000000000 -0500 +++ /dev/null 2018-01-30 20:41:01.000000000 -0500 @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.List; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *         <element ref="{http://xmlns.oracle.com/webservices/jaxws-databinding}fault-action" maxOccurs="unbounded" minOccurs="0"/>
- *       </sequence>
- *       <attribute name="input" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="output" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "", propOrder = { - "faultAction" -}) -@XmlRootElement(name = "action") -public class XmlAction implements javax.xml.ws.Action { - - @XmlElement(name = "fault-action") - protected List faultAction; - @XmlAttribute(name = "input") - protected String input; - @XmlAttribute(name = "output") - protected String output; - - /** - * Gets the value of the faultAction property. - * - *

- * This accessor method returns a reference to the live list, - * not a snapshot. Therefore any modification you make to the - * returned list will be present inside the JAXB object. - * This is why there is not a set method for the faultAction property. - * - *

- * For example, to add a new item, do as follows: - *

-     *    getFaultAction().add(newItem);
-     * 
- * - * - *

- * Objects of the following type(s) are allowed in the list - * {@link XmlFaultAction } - * - * - */ - public List getFaultAction() { - if (faultAction == null) { - faultAction = new ArrayList(); - } - return this.faultAction; - } - - /** - * Gets the value of the input property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getInput() { - return nullSafe(input); - } - - /** - * Sets the value of the input property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setInput(String value) { - this.input = value; - } - - /** - * Gets the value of the output property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOutput() { - return nullSafe(output); - } - - /** - * Sets the value of the output property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOutput(String value) { - this.output = value; - } - - @Override - public String input() { - return nullSafe(input); - } - - @Override - public String output() { - return nullSafe(output); - } - - @Override - public javax.xml.ws.FaultAction[] fault() { - return new javax.xml.ws.FaultAction[0]; - } - - @Override - public Class annotationType() { - return javax.xml.ws.Action.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlAddressing.java 2018-01-30 20:41:02.000000000 -0500 +++ /dev/null 2018-01-30 20:41:02.000000000 -0500 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import javax.xml.ws.soap.AddressingFeature; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "addressing") -public class XmlAddressing implements javax.xml.ws.soap.Addressing { - - @XmlAttribute(name = "enabled") - protected Boolean enabled; - - @XmlAttribute(name = "required") - protected Boolean required; - - public Boolean getEnabled() { - return enabled(); - } - - public void setEnabled(Boolean enabled) { - this.enabled = enabled; - } - - public Boolean getRequired() { - return required(); - } - - public void setRequired(Boolean required) { - this.required = required; - } - - @Override - public boolean enabled() { - return nullSafe(enabled, true); - } - - @Override - public boolean required() { - return nullSafe(required, false); - } - - @Override - public AddressingFeature.Responses responses() { - return AddressingFeature.Responses.ALL; - } - - @Override - public Class annotationType() { - return javax.xml.ws.soap.Addressing.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlBindingType.java 2018-01-30 20:41:02.000000000 -0500 +++ /dev/null 2018-01-30 20:41:02.000000000 -0500 @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "binding-type") -public class XmlBindingType implements javax.xml.ws.BindingType { - - @XmlAttribute(name = "value") - protected String value; - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - @Override - public String value() { - return nullSafe(value); - } - @Override - public Class annotationType() { - return javax.xml.ws.BindingType.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlFaultAction.java 2018-01-30 20:41:03.000000000 -0500 +++ /dev/null 2018-01-30 20:41:03.000000000 -0500 @@ -1,130 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.findClass; -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="className" use="required" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "fault-action") -public class XmlFaultAction implements javax.xml.ws.FaultAction { - - @XmlAttribute(name = "className", required = true) - protected String className; - @XmlAttribute(name = "value") - protected String value; - - /** - * Gets the value of the className property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getClassName() { - return className; - } - - /** - * Sets the value of the className property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setClassName(String value) { - this.className = value; - } - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return nullSafe(value); - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - @Override - @SuppressWarnings("unchecked") - public Class className() { - return (Class) findClass(className); - } - - @Override - public String value() { - return nullSafe(value); - } - - @Override - public Class annotationType() { - return javax.xml.ws.FaultAction.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlHandlerChain.java 2018-01-30 20:41:04.000000000 -0500 +++ /dev/null 2018-01-30 20:41:04.000000000 -0500 @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="file" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "handler-chain") -public class XmlHandlerChain implements javax.jws.HandlerChain { - - @XmlAttribute(name = "file") - protected String file; - - /** - * Gets the value of the file property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFile() { - return file; - } - - /** - * Sets the value of the file property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFile(String value) { - this.file = value; - } - - @Override - public String file() { - return nullSafe(file); - } - - @Override - public String name() { - return ""; // deprecated, so let's ignore it ... - } - - @Override - public Class annotationType() { - return javax.jws.HandlerChain.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlMTOM.java 2018-01-30 20:41:05.000000000 -0500 +++ /dev/null 2018-01-30 20:41:05.000000000 -0500 @@ -1,139 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import javax.xml.ws.soap.MTOM; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="enabled" type="{http://www.w3.org/2001/XMLSchema}boolean" default="true" />
- *       <attribute name="threshold" type="{http://www.w3.org/2001/XMLSchema}int" default="0" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "mtom") -public class XmlMTOM implements MTOM { - - @XmlAttribute(name = "enabled") - protected Boolean enabled; - @XmlAttribute(name = "threshold") - protected Integer threshold; - - /** - * Gets the value of the enabled property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public boolean isEnabled() { - if (enabled == null) { - return true; - } else { - return enabled; - } - } - - /** - * Sets the value of the enabled property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setEnabled(Boolean value) { - this.enabled = value; - } - - /** - * Gets the value of the threshold property. - * - * @return - * possible object is - * {@link Integer } - * - */ - public int getThreshold() { - if (threshold == null) { - return 0; - } else { - return threshold; - } - } - - /** - * Sets the value of the threshold property. - * - * @param value - * allowed object is - * {@link Integer } - * - */ - public void setThreshold(Integer value) { - this.threshold = value; - } - - @Override - public boolean enabled() { - return nullSafe(enabled, Boolean.TRUE); - } - - @Override - public int threshold() { - return nullSafe(threshold, 0); - } - - @Override - public Class annotationType() { - return MTOM.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlOneway.java 2018-01-30 20:41:05.000000000 -0500 +++ /dev/null 2018-01-30 20:41:06.000000000 -0500 @@ -1,64 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <sequence>
- *       </sequence>
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "oneway") -public class XmlOneway implements javax.jws.Oneway { - - @Override - public Class annotationType() { - return javax.jws.Oneway.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlRequestWrapper.java 2018-01-30 20:41:06.000000000 -0500 +++ /dev/null 2018-01-30 20:41:06.000000000 -0500 @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="local-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="target-namespace" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="class-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="part-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "request-wrapper") -public class XmlRequestWrapper implements javax.xml.ws.RequestWrapper { - - @XmlAttribute(name = "local-name") - protected String localName; - @XmlAttribute(name = "target-namespace") - protected String targetNamespace; - @XmlAttribute(name = "class-name") - protected String className; - @XmlAttribute(name = "part-name") - protected String partName; - - /** - * Gets the value of the localName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLocalName() { - if (localName == null) { - return ""; - } else { - return localName; - } - } - - /** - * Sets the value of the localName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLocalName(String value) { - this.localName = value; - } - - /** - * Gets the value of the targetNamespace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTargetNamespace() { - if (targetNamespace == null) { - return ""; - } else { - return targetNamespace; - } - } - - /** - * Sets the value of the targetNamespace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTargetNamespace(String value) { - this.targetNamespace = value; - } - - /** - * Gets the value of the className property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getClassName() { - if (className == null) { - return ""; - } else { - return className; - } - } - - /** - * Sets the value of the className property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setClassName(String value) { - this.className = value; - } - - public String getPartName() { - return partName; - } - - public void setPartName(String partName) { - this.partName = partName; - } - - @Override - public String localName() { - return nullSafe(localName); - } - - @Override - public String targetNamespace() { - return nullSafe(targetNamespace); - } - - @Override - public String className() { - return nullSafe(className); - } - - @Override - public String partName() { - return nullSafe(partName); - } - - @Override - public Class annotationType() { - return javax.xml.ws.RequestWrapper.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlResponseWrapper.java 2018-01-30 20:41:07.000000000 -0500 +++ /dev/null 2018-01-30 20:41:07.000000000 -0500 @@ -1,188 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="local-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="target-namespace" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="class-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="part-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "response-wrapper") -public class XmlResponseWrapper implements javax.xml.ws.ResponseWrapper { - - @XmlAttribute(name = "local-name") - protected String localName; - @XmlAttribute(name = "target-namespace") - protected String targetNamespace; - @XmlAttribute(name = "class-name") - protected String className; - @XmlAttribute(name = "part-name") - protected String partName; - - /** - * Gets the value of the localName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getLocalName() { - if (localName == null) { - return ""; - } else { - return localName; - } - } - - /** - * Sets the value of the localName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setLocalName(String value) { - this.localName = value; - } - - /** - * Gets the value of the targetNamespace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTargetNamespace() { - if (targetNamespace == null) { - return ""; - } else { - return targetNamespace; - } - } - - /** - * Sets the value of the targetNamespace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTargetNamespace(String value) { - this.targetNamespace = value; - } - - /** - * Gets the value of the className property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getClassName() { - if (className == null) { - return ""; - } else { - return className; - } - } - - /** - * Sets the value of the className property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setClassName(String value) { - this.className = value; - } - - public String getPartName() { - return partName; - } - - public void setPartName(String partName) { - this.partName = partName; - } - - @Override - public String localName() { - return nullSafe(localName); - } - - @Override - public String targetNamespace() { - return nullSafe(targetNamespace); - } - - @Override - public String className() { - return nullSafe(className); - } - - @Override - public String partName() { - return nullSafe(partName); - } - - @Override - public Class annotationType() { - return javax.xml.ws.ResponseWrapper.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlSOAPBinding.java 2018-01-30 20:41:08.000000000 -0500 +++ /dev/null 2018-01-30 20:41:08.000000000 -0500 @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="style" type="{http://xmlns.oracle.com/webservices/jaxws-databinding}soap-binding-style" default="DOCUMENT" />
- *       <attribute name="use" type="{http://xmlns.oracle.com/webservices/jaxws-databinding}soap-binding-use" default="LITERAL" />
- *       <attribute name="parameter-style" type="{http://xmlns.oracle.com/webservices/jaxws-databinding}soap-binding-parameter-style" default="WRAPPED" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "soap-binding") -public class XmlSOAPBinding implements javax.jws.soap.SOAPBinding { - - @XmlAttribute(name = "style") - protected SoapBindingStyle style; - @XmlAttribute(name = "use") - protected SoapBindingUse use; - @XmlAttribute(name = "parameter-style") - protected SoapBindingParameterStyle parameterStyle; - - /** - * Gets the value of the style property. - * - * @return - * possible object is - * {@link SoapBindingStyle } - * - */ - public SoapBindingStyle getStyle() { - if (style == null) { - return SoapBindingStyle.DOCUMENT; - } else { - return style; - } - } - - /** - * Sets the value of the style property. - * - * @param value - * allowed object is - * {@link SoapBindingStyle } - * - */ - public void setStyle(SoapBindingStyle value) { - this.style = value; - } - - /** - * Gets the value of the use property. - * - * @return - * possible object is - * {@link SoapBindingUse } - * - */ - public SoapBindingUse getUse() { - if (use == null) { - return SoapBindingUse.LITERAL; - } else { - return use; - } - } - - /** - * Sets the value of the use property. - * - * @param value - * allowed object is - * {@link SoapBindingUse } - * - */ - public void setUse(SoapBindingUse value) { - this.use = value; - } - - /** - * Gets the value of the parameterStyle property. - * - * @return - * possible object is - * {@link SoapBindingParameterStyle } - * - */ - public SoapBindingParameterStyle getParameterStyle() { - if (parameterStyle == null) { - return SoapBindingParameterStyle.WRAPPED; - } else { - return parameterStyle; - } - } - - /** - * Sets the value of the parameterStyle property. - * - * @param value - * allowed object is - * {@link SoapBindingParameterStyle } - * - */ - public void setParameterStyle(SoapBindingParameterStyle value) { - this.parameterStyle = value; - } - - @Override - public Style style() { - return nullSafe(style, Style.DOCUMENT); - } - - @Override - public Use use() { - return nullSafe(use, Use.LITERAL); - } - - @Override - public ParameterStyle parameterStyle() { - return nullSafe(parameterStyle, ParameterStyle.WRAPPED); - } - - @Override - public Class annotationType() { - return javax.jws.soap.SOAPBinding.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlServiceMode.java 2018-01-30 20:41:09.000000000 -0500 +++ /dev/null 2018-01-30 20:41:09.000000000 -0500 @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import javax.xml.ws.Service; - -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" default="PAYLOAD" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "service-mode") -public class XmlServiceMode implements javax.xml.ws.ServiceMode { - - @XmlAttribute(name = "value") - protected String value; - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - if (value == null) { - return "PAYLOAD"; - } else { - return value; - } - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - @Override - public Service.Mode value() { - return Service.Mode.valueOf(nullSafe(value, "PAYLOAD")); - } - - @Override - public Class annotationType() { - return javax.xml.ws.ServiceMode.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlWebEndpoint.java 2018-01-30 20:41:09.000000000 -0500 +++ /dev/null 2018-01-30 20:41:09.000000000 -0500 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "web-endpoint") -public class XmlWebEndpoint implements javax.xml.ws.WebEndpoint { - - @XmlAttribute(name = "name") - protected String name; - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - @Override - public String name() { - return nullSafe(name); - } - - @Override - public Class annotationType() { - return javax.xml.ws.WebEndpoint.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlWebFault.java 2018-01-30 20:41:10.000000000 -0500 +++ /dev/null 2018-01-30 20:41:10.000000000 -0500 @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="targetNamespace" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="faultBean" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "web-fault") -public class XmlWebFault implements javax.xml.ws.WebFault { - - @XmlAttribute(name = "name") - protected String name; - @XmlAttribute(name = "targetNamespace") - protected String targetNamespace; - @XmlAttribute(name = "faultBean") - protected String faultBean; - @XmlAttribute(name = "messageName") - protected String messageName; - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the targetNamespace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTargetNamespace() { - return targetNamespace; - } - - /** - * Sets the value of the targetNamespace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTargetNamespace(String value) { - this.targetNamespace = value; - } - - /** - * Gets the value of the faultBean property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getFaultBean() { - return faultBean; - } - - /** - * Sets the value of the faultBean property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setFaultBean(String value) { - this.faultBean = value; - } - - @Override - public String name() { - return nullSafe(name); - } - - @Override - public String targetNamespace() { - return nullSafe(targetNamespace); - } - - @Override - public String faultBean() { - return nullSafe(faultBean); - } - - @Override - public String messageName() { - return nullSafe(messageName); - } - - @Override - public Class annotationType() { - return javax.xml.ws.WebFault.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlWebMethod.java 2018-01-30 20:41:11.000000000 -0500 +++ /dev/null 2018-01-30 20:41:11.000000000 -0500 @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="action" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="exclude" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
- *       <attribute name="operation-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "web-method") -public class XmlWebMethod implements javax.jws.WebMethod { - - @XmlAttribute(name = "action") - protected String action; - @XmlAttribute(name = "exclude") - protected Boolean exclude; - @XmlAttribute(name = "operation-name") - protected String operationName; - - /** - * Gets the value of the action property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getAction() { - if (action == null) { - return ""; - } else { - return action; - } - } - - /** - * Sets the value of the action property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setAction(String value) { - this.action = value; - } - - /** - * Gets the value of the exclude property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public boolean isExclude() { - if (exclude == null) { - return false; - } else { - return exclude; - } - } - - /** - * Sets the value of the exclude property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setExclude(Boolean value) { - this.exclude = value; - } - - /** - * Gets the value of the operationName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getOperationName() { - if (operationName == null) { - return ""; - } else { - return operationName; - } - } - - /** - * Sets the value of the operationName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setOperationName(String value) { - this.operationName = value; - } - - @Override - public String operationName() { - return nullSafe(operationName); - } - - @Override - public String action() { - return nullSafe(action); - } - - @Override - public boolean exclude() { - return nullSafe(exclude, false); - } - - @Override - public Class annotationType() { - return javax.jws.WebMethod.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlWebParam.java 2018-01-30 20:41:12.000000000 -0500 +++ /dev/null 2018-01-30 20:41:12.000000000 -0500 @@ -1,244 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="header" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
- *       <attribute name="mode" type="{http://xmlns.oracle.com/webservices/jaxws-databinding}web-param-mode" default="IN" />
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="part-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="target-namespace" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "web-param") -public class XmlWebParam implements javax.jws.WebParam { - - @XmlAttribute(name = "header") - protected Boolean header; - @XmlAttribute(name = "mode") - protected WebParamMode mode; - @XmlAttribute(name = "name") - protected String name; - @XmlAttribute(name = "part-name") - protected String partName; - @XmlAttribute(name = "target-namespace") - protected String targetNamespace; - - /** - * Gets the value of the header property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public boolean isHeader() { - if (header == null) { - return false; - } else { - return header; - } - } - - /** - * Sets the value of the header property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setHeader(Boolean value) { - this.header = value; - } - - /** - * Gets the value of the mode property. - * - * @return - * possible object is - * {@link WebParamMode } - * - */ - public WebParamMode getMode() { - if (mode == null) { - return WebParamMode.IN; - } else { - return mode; - } - } - - /** - * Sets the value of the mode property. - * - * @param value - * allowed object is - * {@link WebParamMode } - * - */ - public void setMode(WebParamMode value) { - this.mode = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - if (name == null) { - return ""; - } else { - return name; - } - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the partName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPartName() { - if (partName == null) { - return ""; - } else { - return partName; - } - } - - /** - * Sets the value of the partName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPartName(String value) { - this.partName = value; - } - - /** - * Gets the value of the targetNamespace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTargetNamespace() { - if (targetNamespace == null) { - return ""; - } else { - return targetNamespace; - } - } - - /** - * Sets the value of the targetNamespace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTargetNamespace(String value) { - this.targetNamespace = value; - } - - @Override - public String name() { - return nullSafe(name); - } - - @Override - public String partName() { - return nullSafe(partName); - } - - @Override - public String targetNamespace() { - return nullSafe(targetNamespace); - } - - @Override - public Mode mode() { - return nullSafe(mode, Mode.IN); - } - - @Override - public boolean header() { - return nullSafe(header, false); - } - - @Override - public Class annotationType() { - return javax.jws.WebParam.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlWebResult.java 2018-01-30 20:41:12.000000000 -0500 +++ /dev/null 2018-01-30 20:41:12.000000000 -0500 @@ -1,208 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="header" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="part-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="target-namespace" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "web-result") -public class XmlWebResult implements javax.jws.WebResult { - - @XmlAttribute(name = "header") - protected Boolean header; - @XmlAttribute(name = "name") - protected String name; - @XmlAttribute(name = "part-name") - protected String partName; - @XmlAttribute(name = "target-namespace") - protected String targetNamespace; - - /** - * Gets the value of the header property. - * - * @return - * possible object is - * {@link Boolean } - * - */ - public boolean isHeader() { - if (header == null) { - return false; - } else { - return header; - } - } - - /** - * Sets the value of the header property. - * - * @param value - * allowed object is - * {@link Boolean } - * - */ - public void setHeader(Boolean value) { - this.header = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - if (name == null) { - return ""; - } else { - return name; - } - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the partName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPartName() { - if (partName == null) { - return ""; - } else { - return partName; - } - } - - /** - * Sets the value of the partName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPartName(String value) { - this.partName = value; - } - - /** - * Gets the value of the targetNamespace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTargetNamespace() { - if (targetNamespace == null) { - return ""; - } else { - return targetNamespace; - } - } - - /** - * Sets the value of the targetNamespace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTargetNamespace(String value) { - this.targetNamespace = value; - } - - @Override - public String name() { - return nullSafe(name); - } - - @Override - public String partName() { - return nullSafe(partName); - } - - @Override - public String targetNamespace() { - return nullSafe(targetNamespace); - } - - @Override - public boolean header() { - return nullSafe(header, false); - } - - @Override - public Class annotationType() { - return javax.jws.WebResult.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlWebService.java 2018-01-30 20:41:13.000000000 -0500 +++ /dev/null 2018-01-30 20:41:13.000000000 -0500 @@ -1,282 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="endpoint-interface" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="port-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="service-name" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="target-namespace" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *       <attribute name="wsdl-location" type="{http://www.w3.org/2001/XMLSchema}string" default="" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- * - * - */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "web-service") -public class XmlWebService implements javax.jws.WebService { - - @XmlAttribute(name = "endpoint-interface") - protected String endpointInterface; - @XmlAttribute(name = "name") - protected String name; - @XmlAttribute(name = "port-name") - protected String portName; - @XmlAttribute(name = "service-name") - protected String serviceName; - @XmlAttribute(name = "target-namespace") - protected String targetNamespace; - @XmlAttribute(name = "wsdl-location") - protected String wsdlLocation; - - /** - * Gets the value of the endpointInterface property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getEndpointInterface() { - if (endpointInterface == null) { - return ""; - } else { - return endpointInterface; - } - } - - /** - * Sets the value of the endpointInterface property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setEndpointInterface(String value) { - this.endpointInterface = value; - } - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - if (name == null) { - return ""; - } else { - return name; - } - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the portName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPortName() { - if (portName == null) { - return ""; - } else { - return portName; - } - } - - /** - * Sets the value of the portName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPortName(String value) { - this.portName = value; - } - - /** - * Gets the value of the serviceName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceName() { - if (serviceName == null) { - return ""; - } else { - return serviceName; - } - } - - /** - * Sets the value of the serviceName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceName(String value) { - this.serviceName = value; - } - - /** - * Gets the value of the targetNamespace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTargetNamespace() { - if (targetNamespace == null) { - return ""; - } else { - return targetNamespace; - } - } - - /** - * Sets the value of the targetNamespace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTargetNamespace(String value) { - this.targetNamespace = value; - } - - /** - * Gets the value of the wsdlLocation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWsdlLocation() { - if (wsdlLocation == null) { - return ""; - } else { - return wsdlLocation; - } - } - - /** - * Sets the value of the wsdlLocation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWsdlLocation(String value) { - this.wsdlLocation = value; - } - - @Override - public String name() { - return nullSafe(name); - } - - @Override - public String targetNamespace() { - return nullSafe(targetNamespace); - } - - @Override - public String serviceName() { - return nullSafe(serviceName); - } - - @Override - public String portName() { - return nullSafe(portName); - } - - @Override - public String wsdlLocation() { - return nullSafe(wsdlLocation); - } - - @Override - public String endpointInterface() { - return nullSafe(endpointInterface); - } - - @Override - public Class annotationType() { - return javax.jws.WebService.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlWebServiceClient.java 2018-01-30 20:41:14.000000000 -0500 +++ /dev/null 2018-01-30 20:41:14.000000000 -0500 @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="targetNamespace" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="wsdlLocation" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "web-service-client") -public class XmlWebServiceClient implements javax.xml.ws.WebServiceClient { - - @XmlAttribute(name = "name") - protected String name; - @XmlAttribute(name = "targetNamespace") - protected String targetNamespace; - @XmlAttribute(name = "wsdlLocation") - protected String wsdlLocation; - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the targetNamespace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTargetNamespace() { - return targetNamespace; - } - - /** - * Sets the value of the targetNamespace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTargetNamespace(String value) { - this.targetNamespace = value; - } - - /** - * Gets the value of the wsdlLocation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWsdlLocation() { - return wsdlLocation; - } - - /** - * Sets the value of the wsdlLocation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWsdlLocation(String value) { - this.wsdlLocation = value; - } - - @Override - public String name() { - return nullSafe(name); - } - - @Override - public String targetNamespace() { - return nullSafe(targetNamespace); - } - - @Override - public String wsdlLocation() { - return nullSafe(wsdlLocation); - } - - @Override - public Class annotationType() { - return javax.xml.ws.WebServiceClient.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlWebServiceProvider.java 2018-01-30 20:41:15.000000000 -0500 +++ /dev/null 2018-01-30 20:41:15.000000000 -0500 @@ -1,192 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="targetNamespace" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="serviceName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="portName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="wsdlLocation" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "web-service-provider") -public class XmlWebServiceProvider implements javax.xml.ws.WebServiceProvider { - - @XmlAttribute(name = "targetNamespace") - protected String targetNamespace; - @XmlAttribute(name = "serviceName") - protected String serviceName; - @XmlAttribute(name = "portName") - protected String portName; - @XmlAttribute(name = "wsdlLocation") - protected String wsdlLocation; - - /** - * Gets the value of the targetNamespace property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getTargetNamespace() { - return targetNamespace; - } - - /** - * Sets the value of the targetNamespace property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setTargetNamespace(String value) { - this.targetNamespace = value; - } - - /** - * Gets the value of the serviceName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getServiceName() { - return serviceName; - } - - /** - * Sets the value of the serviceName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setServiceName(String value) { - this.serviceName = value; - } - - /** - * Gets the value of the portName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getPortName() { - return portName; - } - - /** - * Sets the value of the portName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setPortName(String value) { - this.portName = value; - } - - /** - * Gets the value of the wsdlLocation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWsdlLocation() { - return wsdlLocation; - } - - /** - * Sets the value of the wsdlLocation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWsdlLocation(String value) { - this.wsdlLocation = value; - } - - @Override - public String wsdlLocation() { - return nullSafe(wsdlLocation); - } - - @Override - public String serviceName() { - return nullSafe(serviceName); - } - - @Override - public String targetNamespace() { - return nullSafe(targetNamespace); - } - - @Override - public String portName() { - return nullSafe(portName); - } - - @Override - public Class annotationType() { - return javax.xml.ws.WebServiceProvider.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/XmlWebServiceRef.java 2018-01-30 20:41:15.000000000 -0500 +++ /dev/null 2018-01-30 20:41:15.000000000 -0500 @@ -1,248 +0,0 @@ -/* - * Copyright (c) 2012, 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.oracle.xmlns.internal.webservices.jaxws_databinding; -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlType; -import javax.xml.ws.Service; -import java.lang.annotation.Annotation; - -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.findClass; -import static com.oracle.xmlns.internal.webservices.jaxws_databinding.Util.nullSafe; - - -/** - * This file was generated by JAXB-RI v2.2.6 and afterwards modified - * to implement appropriate Annotation - * - *

Java class for anonymous complex type. - * - *

The following schema fragment specifies the expected content contained within this class. - * - *

- * <complexType>
- *   <complexContent>
- *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="type" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="mappedName" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="value" type="{http://www.w3.org/2001/XMLSchema}string" />
- *       <attribute name="wsdlLocation" type="{http://www.w3.org/2001/XMLSchema}string" />
- *     </restriction>
- *   </complexContent>
- * </complexType>
- * 
- */ -@XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "") -@XmlRootElement(name = "web-service-ref") -public class XmlWebServiceRef implements javax.xml.ws.WebServiceRef { - - @XmlAttribute(name = "name") - protected String name; - @XmlAttribute(name = "type") - protected String type; - @XmlAttribute(name = "mappedName") - protected String mappedName; - @XmlAttribute(name = "value") - protected String value; - @XmlAttribute(name = "wsdlLocation") - protected String wsdlLocation; - @XmlAttribute(name = "lookup") - protected String lookup; - - /** - * Gets the value of the name property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getName() { - return name; - } - - /** - * Sets the value of the name property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setName(String value) { - this.name = value; - } - - /** - * Gets the value of the type property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getType() { - return type; - } - - /** - * Sets the value of the type property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setType(String value) { - this.type = value; - } - - /** - * Gets the value of the mappedName property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getMappedName() { - return mappedName; - } - - /** - * Sets the value of the mappedName property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setMappedName(String value) { - this.mappedName = value; - } - - /** - * Gets the value of the value property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getValue() { - return value; - } - - /** - * Sets the value of the value property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setValue(String value) { - this.value = value; - } - - /** - * Gets the value of the wsdlLocation property. - * - * @return - * possible object is - * {@link String } - * - */ - public String getWsdlLocation() { - return wsdlLocation; - } - - /** - * Sets the value of the wsdlLocation property. - * - * @param value - * allowed object is - * {@link String } - * - */ - public void setWsdlLocation(String value) { - this.wsdlLocation = value; - } - - public String getLookup() { - return lookup; - } - - public void setLookup(String lookup) { - this.lookup = lookup; - } - - @Override - public String name() { - return nullSafe(name); - } - - @Override - public Class type() { - if (type == null) { - return Object.class; - } - return findClass(type); - } - - @Override - public String mappedName() { - return nullSafe(mappedName); - } - - @Override - @SuppressWarnings("unchecked") - public Class value() { - if (value == null) { - return Service.class; - } - return (Class) findClass(value); - } - - @Override - public String wsdlLocation() { - return nullSafe(wsdlLocation); - } - - @Override - public String lookup() { - return nullSafe(lookup); - } - - @Override - public Class annotationType() { - return javax.xml.ws.WebServiceRef.class; - } -} --- old/src/java.xml.ws/share/classes/com/oracle/xmlns/internal/webservices/jaxws_databinding/package-info.java 2018-01-30 20:41:16.000000000 -0500 +++ /dev/null 2018-01-30 20:41:16.000000000 -0500 @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2012, 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. - */ - -// -// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.6-SNAPSHOT -// See http://java.sun.com/xml/jaxb -// Any modifications to this file will be lost upon recompilation of the source schema. -// Generated on: 2012.03.21 at 10:57:01 AM CET -// - -@javax.xml.bind.annotation.XmlSchema(namespace = "http://xmlns.oracle.com/webservices/jaxws-databinding", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) -package com.oracle.xmlns.internal.webservices.jaxws_databinding; --- old/src/java.xml.ws/share/classes/com/sun/org/glassfish/external/amx/AMX.java 2018-01-30 20:41:17.000000000 -0500 +++ /dev/null 2018-01-30 20:41:17.000000000 -0500 @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2009, 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.org.glassfish.external.amx; - -/** - Constants reflecting the AMX specification. - See https://glassfish.dev.java.net/nonav/v3/admin/planning/V3Changes/V3_AMX_SPI.html - */ -public final class AMX -{ - private AMX() - { - // do not instantiate - } - - /** Attribute yielding the ObjectName of the parent MBean */ - public static final String ATTR_PARENT = "Parent"; - - /** Attribute yielding the children as an ObjectName[] */ - public static final String ATTR_CHILDREN = "Children"; - - /** Attribute yielding the name of the MBean, - possibly differing from the name as found in the ObjectName via the - property {@link #NAME_KEY} */ - public static final String ATTR_NAME = "Name"; - - /** ObjectName property for the type */ - public static final String TYPE_KEY = "type"; - - /** ObjectName property for the name */ - public static final String NAME_KEY = "name"; - - /** Implied name for singletons when the name property is not present */ - public static final String NO_NAME = ""; - - /** - The ObjectName property key denoting the path of the parent MBean. - Serves to disambiguitate the ObjectName from others - that might have the same type and/or name elsewhere in the hierarchy. - */ - public static final String PARENT_PATH_KEY = "pp"; - - /** Prefix for AMX descriptor fields */ - public static final String DESC_PREFIX = "amx."; - - /** Prefix for AMX notification types */ - public static final String NOTIFICATION_PREFIX = DESC_PREFIX; - - /** - Descriptor value defined by JMX standard: whether the MBeanInfo is *invariant* (immutable is a misnomer). - */ - public static final String DESC_STD_IMMUTABLE_INFO = "immutableInfo"; - - /** - Descriptor value defined by JMX standard, the classname of the interface for the MBean. - Mainly advisory, since client code might not have access to the class. - */ - public static final String DESC_STD_INTERFACE_NAME = "interfaceName"; - - /** - Descriptor value: The generic AMX interface to be used if the class found in {@link #DESC_STD_INTERFACE_NAME} - cannot be loaded. The class specified here must reside in the amx-core - module eg com.sun.org.glassfish.admin.amx.core eg AMXProxy or AMXConfigProxy. - */ - public static final String DESC_GENERIC_INTERFACE_NAME = DESC_PREFIX + "genericInterfaceName"; - - /** - Descriptor value: whether the MBean is a singleton, in spite of having a name property in its ObjectName. - This is mainly for compatibility; named singletons are strongly discouraged. - */ - public static final String DESC_IS_SINGLETON = DESC_PREFIX + "isSingleton"; - - /** - Descriptor value: whether the MBean is a global singleton eg whether in the AMX domain - it can be looked up by its type and is the only MBean of that type. - */ - public static final String DESC_IS_GLOBAL_SINGLETON = DESC_PREFIX + "isGlobalSingleton"; - - /** - Descriptor value: Arbitrary string denoting the general classification of MBean. - Predefined values include "configuration", "monitoring", "jsr77", "utility", "other". - */ - public static final String DESC_GROUP = DESC_PREFIX + "group"; - - /** - Descriptor value: whether new children may be added by code other than the implementation responsible for the MBean; - this allows extension points within the hierarchy. - Adding a new child means registering an MBean with an ObjectName that implies parentage via the ancestry type=name pairs. - */ - public static final String DESC_SUPPORTS_ADOPTION = DESC_PREFIX + "supportsAdoption"; - - /** - Descriptor value: denotes the possible types of MBeans that children might be. If present, SHOULD include all possible and pre-known types. - An empty array indicates that child MBeans might exist, but their types cannot be predicted. - */ - public static final String DESC_SUB_TYPES = DESC_PREFIX + "subTypes"; - - /** - Group value indicating that the AMX is a configuration MBean. - */ - public static final String GROUP_CONFIGURATION = "configuration"; - /** - Group value indicating that the AMX represents a monitoring MBean. - */ - public static final String GROUP_MONITORING = "monitoring"; - /** - Group value indicating that the AMX is a utility MBean. - */ - public static final String GROUP_UTILITY = "utility"; - /** - Group value indicating that the AMX is a JSR 77 MBean - (J2EE Management) . - */ - public static final String GROUP_JSR77 = "jsr77"; - /** - Group value indicating that the AMX is not one - of the other types. - */ - public static final String GROUP_OTHER = "other"; -} --- old/src/java.xml.ws/share/classes/com/sun/org/glassfish/external/amx/AMXGlassfish.java 2018-01-30 20:41:18.000000000 -0500 +++ /dev/null 2018-01-30 20:41:18.000000000 -0500 @@ -1,318 +0,0 @@ -/* - * Copyright (c) 2009, 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.org.glassfish.external.amx; - -import javax.management.ObjectName; -import javax.management.MBeanServer; -import javax.management.MBeanServerConnection; - -import java.io.IOException; - - -/** - * AMX behavior specific to Glassfish V3. - */ -public final class AMXGlassfish -{ - public static final String DEFAULT_JMX_DOMAIN = "amx"; - - /** Default domain support */ - public static final AMXGlassfish DEFAULT = new AMXGlassfish(DEFAULT_JMX_DOMAIN); - - private final String mJMXDomain; - private final ObjectName mDomainRoot; - - /** Anything other than {@link #DEFAULT} is not supported in Glassfish V3 */ - public AMXGlassfish(final String jmxDomain) - { - mJMXDomain = jmxDomain; - mDomainRoot = newObjectName("", "domain-root", null); - } - - /** Return a version string, or null if not running in Glassfish */ - public static String getGlassfishVersion() - { - // must all exist as a check to verify that it's Glassfish V3 - final String version = System.getProperty( "glassfish.version" ); - return version; - } - - - /** JMX domain used by AMX MBeans. - *

- * All MBeans in this domain must be AMX-compliant, see http://tinyurl.com/nryoqp = - https://glassfish.dev.java.net/nonav/v3/admin/planning/V3Changes/V3_AMX_SPI.html - */ - public String amxJMXDomain() - { - return mJMXDomain; - } - - /** JMX domain used by AMX support MBeans. Private use only */ - public String amxSupportDomain() - { - return amxJMXDomain() + "-support"; - } - - /** name of the Domain Admin Server (DAS) as found in an ObjectName */ - public String dasName() - { - return "server"; - } - - /** name of the Domain Admin Server (DAS) <config> */ - public String dasConfig() - { - return dasName() + "-config"; - } - - /** return the ObjectName of the AMX DomainRoot MBean */ - public ObjectName domainRoot() - { - return mDomainRoot; - } - - /** ObjectName for top-level monitoring MBean (parent of those for each server) */ - public ObjectName monitoringRoot() - { - return newObjectName("/", "mon", null); - } - - /** ObjectName for top-level monitoring MBean for specified server */ - public ObjectName serverMon(final String serverName) - { - return newObjectName("/mon", "server-mon", serverName); - } - - /** ObjectName for top-level monitoring MBean for the DAS. */ - public ObjectName serverMonForDAS() { - return serverMon( "server" ) ; - } - - /** Make a new AMX ObjectName with unchecked exception. - * name must be null to create a singleton ObjectName. - * Note that the arguments must not contain the characters - * @param pp The parent part - * @param type The ObjectName type - * @param name The ObjectName name - * @return The objectname with pp, type, and (optionally) name. - */ - public ObjectName newObjectName( - final String pp, - final String type, - final String name) - { - String props = prop(AMX.PARENT_PATH_KEY, pp) + "," + prop(AMX.TYPE_KEY, type); - if (name != null) { - props = props + "," + prop(AMX.NAME_KEY, name); - } - - return newObjectName( props); - } - - /** Make a new ObjectName for AMX domain with unchecked exception */ - public ObjectName newObjectName(final String s) - { - String name = s; - if ( ! name.startsWith( amxJMXDomain() ) ) { - name = amxJMXDomain() + ":" + name; - } - - return AMXUtil.newObjectName( name ); - } - - private static String prop(final String key, final String value) - { - return key + "=" + value; - } - - /** - ObjectName for {@link BootAMXMBean} - */ - public ObjectName getBootAMXMBeanObjectName() - { - return AMXUtil.newObjectName( amxSupportDomain() + ":type=boot-amx" ); - } - - /** - Invoke the bootAMX() method on {@link BootAMXMBean}. Upon return, - AMX continues to load. - A cilent should call {@link invokeWaitAMXReady} prior to use. - */ - public void invokeBootAMX(final MBeanServerConnection conn) - { - // start AMX and wait for it to be ready - try - { - conn.invoke( getBootAMXMBeanObjectName(), BootAMXMBean.BOOT_AMX_OPERATION_NAME, null, null); - } - catch (final Exception e) - { - e.printStackTrace(); - throw new RuntimeException(e); - } - } - - /** - Invoke the waitAMXReady() method on the DomainRoot MBean, which must already be loaded. - */ - private static void invokeWaitAMXReady(final MBeanServerConnection conn, final ObjectName objectName) - { - try - { - conn.invoke( objectName, "waitAMXReady", null, null ); - } - catch( final Exception e ) - { - throw new RuntimeException(e); - } - } - - /** - Listen for the registration of AMX DomainRoot - Listening starts automatically. - */ - public MBeanListener listenForDomainRoot( - final MBeanServerConnection server, - final T callback) - { - final MBeanListener listener = new MBeanListener( server, domainRoot(), callback); - listener.startListening(); - return listener; - } - - private static final class WaitForDomainRootListenerCallback extends MBeanListener.CallbackImpl { - private final MBeanServerConnection mConn; - - public WaitForDomainRootListenerCallback( final MBeanServerConnection conn ) { - mConn = conn; - } - - @Override - public void mbeanRegistered(final ObjectName objectName, final MBeanListener listener) { - super.mbeanRegistered(objectName,listener); - invokeWaitAMXReady(mConn, objectName); - mLatch.countDown(); - } - } - - /** - Wait until AMX has loaded and is ready for use. -

- This will not cause AMX to load; it will block forever until AMX is ready. In other words, - don't call this method unless it's a convenient thread that can wait forever. - */ - public ObjectName waitAMXReady( final MBeanServerConnection server) - { - final WaitForDomainRootListenerCallback callback = new WaitForDomainRootListenerCallback(server); - listenForDomainRoot( server, callback ); - callback.await(); - return callback.getRegistered(); - } - - /** - Listen for the registration of the {@link BootAMXMBean}. - Listening starts automatically. See {@link AMXBooter#BootAMXCallback}. - */ - public MBeanListener listenForBootAMX( - final MBeanServerConnection server, - final T callback) - { - final MBeanListener listener = new MBeanListener( server, getBootAMXMBeanObjectName(), callback); - listener.startListening(); - return listener; - } - - /** - Callback for {@link MBeanListener} that waits for the BootAMXMBean to appear; - it always will load early in server startup. Once it has loaded, AMX can be booted - via {@link #bootAMX}. A client should normally just call {@link #bootAMX}, but - this callback may be suclassed if desired, and used as a trigger to - boot AMX and then take other dependent actions. - */ - public static class BootAMXCallback extends MBeanListener.CallbackImpl - { - private final MBeanServerConnection mConn; - public BootAMXCallback(final MBeanServerConnection conn) - { - mConn = conn; - } - - @Override - public void mbeanRegistered(final ObjectName objectName, final MBeanListener listener) - { - super.mbeanRegistered(objectName, listener); - mLatch.countDown(); - } - } - - /** - Ensure that AMX is loaded and ready to use. This method returns only when all - AMX subsystems have been loaded. - It can be called more than once without ill effect, subsequent calls are ignored. - @param conn connection to the MBeanServer - @return the ObjectName of the domain-root MBean - */ - public ObjectName bootAMX(final MBeanServerConnection conn) - throws IOException - { - final ObjectName domainRoot = domainRoot(); - - if ( !conn.isRegistered( domainRoot ) ) - { - // wait for the BootAMXMBean to be available (loads at startup) - final BootAMXCallback callback = new BootAMXCallback(conn); - listenForBootAMX(conn, callback); - callback.await(); // block until the MBean appears - - invokeBootAMX(conn); - - final WaitForDomainRootListenerCallback drCallback = new WaitForDomainRootListenerCallback(conn); - listenForDomainRoot(conn, drCallback); - drCallback.await(); - - invokeWaitAMXReady(conn, domainRoot); - } - else - { - invokeWaitAMXReady(conn, domainRoot ); - } - return domainRoot; - } - - public ObjectName bootAMX(final MBeanServer server) - { - try - { - return bootAMX( (MBeanServerConnection)server); - } - catch( final IOException e ) - { - throw new RuntimeException(e); - } - } -} --- old/src/java.xml.ws/share/classes/com/sun/org/glassfish/external/amx/AMXUtil.java 2018-01-30 20:41:18.000000000 -0500 +++ /dev/null 2018-01-30 20:41:19.000000000 -0500 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2009, 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.org.glassfish.external.amx; - -import javax.management.MBeanServerConnection; -import javax.management.ObjectName; - -/** - Small utilities for AMXBooter and related. - */ -@com.sun.org.glassfish.external.arc.Taxonomy(stability = com.sun.org.glassfish.external.arc.Stability.UNCOMMITTED) -public final class AMXUtil -{ - private AMXUtil() {} - - /** - Make a new ObjectName (unchecked exception). - */ - public static ObjectName newObjectName(final String s) - { - try - { - return new ObjectName( s ); - } - catch( final Exception e ) - { - throw new RuntimeException("bad ObjectName", e); - } - } - - /** - Make a new ObjectName (unchecked exception). - @param domain - @param props - */ - public static ObjectName newObjectName( - final String domain, - final String props) - { - return newObjectName(domain + ":" + props); - } - - /** - Get the ObjectName of the MBeanServerDelegateObjectName. - */ - public static ObjectName getMBeanServerDelegateObjectName() - { - return newObjectName( "JMImplementation:type=MBeanServerDelegate" ); - } - - public static String prop(final String key, final String value) - { - return key + "=" + value; - } -} --- old/src/java.xml.ws/share/classes/com/sun/org/glassfish/external/amx/BootAMXMBean.java 2018-01-30 20:41:19.000000000 -0500 +++ /dev/null 2018-01-30 20:41:19.000000000 -0500 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2009, 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.org.glassfish.external.amx; - -import javax.management.ObjectName; -import javax.management.remote.JMXServiceURL; - -/** - MBean responsible for booting the AMX system. - To get its ObjectName, use {@link AMXGlassfish#getBootAMXMBeanObjectName}. - */ -@com.sun.org.glassfish.external.arc.Taxonomy(stability = com.sun.org.glassfish.external.arc.Stability.UNCOMMITTED) -public interface BootAMXMBean -{ - /** - Start AMX and return the ObjectName of DomainRoot. - */ - public ObjectName bootAMX(); - - /** same as method above */ - public static final String BOOT_AMX_OPERATION_NAME = "bootAMX"; - - public JMXServiceURL[] getJMXServiceURLs(); -} --- old/src/java.xml.ws/share/classes/com/sun/org/glassfish/external/amx/MBeanListener.java 2018-01-30 20:41:20.000000000 -0500 +++ /dev/null 2018-01-30 20:41:20.000000000 -0500 @@ -1,330 +0,0 @@ -/* - * Copyright (c) 2009, 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.org.glassfish.external.amx; - -import java.util.Set; -import javax.management.MBeanServer; -import javax.management.MBeanServerConnection; -import javax.management.MBeanServerNotification; -import javax.management.Notification; -import javax.management.NotificationListener; -import javax.management.ObjectName; -import java.util.concurrent.CountDownLatch; - -import static com.sun.org.glassfish.external.amx.AMX.*; - -/** - * Listens for registration of MBeans of various types. - * Intended usage is for subsystems to lazy-load only when the Parent - * MBean is registered. - */ -@com.sun.org.glassfish.external.arc.Taxonomy(stability = com.sun.org.glassfish.external.arc.Stability.UNCOMMITTED) -public class MBeanListener implements NotificationListener -{ - private static void debug(final Object o) { System.out.println( "" + o ); } - - /** listen for MBeans in a given domain of a given type[name] - OR an ObjectName (below) */ - private final String mJMXDomain; - private final String mType; - private final String mName; - - /** mType and mName should be null if mObjectName is non-null, and vice versa */ - private final ObjectName mObjectName; - - private final MBeanServerConnection mMBeanServer; - - private final T mCallback; - - public String toString() - { - return "MBeanListener: ObjectName=" + mObjectName + ", type=" + mType + ", name=" + mName; - } - - public String getType() - { - return mType; - } - - public String getName() - { - return mName; - } - - public MBeanServerConnection getMBeanServer() - { - return mMBeanServer; - } - - /** Callback interface. */ - public interface Callback - { - public void mbeanRegistered(final ObjectName objectName, final MBeanListener listener); - public void mbeanUnregistered(final ObjectName objectName, final MBeanListener listener); - } - - /** - Default callback implementation, can be subclassed if needed - Remembers only the last MBean that was seen. - */ - public static class CallbackImpl implements MBeanListener.Callback - { - private volatile ObjectName mRegistered = null; - private volatile ObjectName mUnregistered = null; - private final boolean mStopAtFirst; - - public CallbackImpl() { - this(true); - } - - public CallbackImpl(final boolean stopAtFirst) - { - mStopAtFirst = stopAtFirst; - } - - public ObjectName getRegistered() { return mRegistered; } - public ObjectName getUnregistered() { return mUnregistered; } - - protected final CountDownLatch mLatch = new CountDownLatch(1); - - /** Optional: wait for the CountDownLatch to fire - If used, the subclass should countDown() the latch when the - appropriate event happens - */ - public void await() - { - try - { - mLatch.await(); // wait until BootAMXMBean is ready - } - catch (InterruptedException e) - { - throw new RuntimeException(e); - } - } - - public void mbeanRegistered(final ObjectName objectName, final MBeanListener listener) - { - mRegistered = objectName; - if ( mStopAtFirst ) - { - listener.stopListening(); - } - } - public void mbeanUnregistered(final ObjectName objectName, final MBeanListener listener) - { - mUnregistered = objectName; - if ( mStopAtFirst ) - { - listener.stopListening(); - } - } - } - - public T getCallback() - { - return mCallback; - } - - /** - * Listener for a specific MBean. - * Caller must call {@link #start} to start listening. - * @param server - * @param objectName - * @param callback - */ - public MBeanListener( - final MBeanServerConnection server, - final ObjectName objectName, - final T callback) - { - mMBeanServer = server; - mObjectName = objectName; - mJMXDomain = null; - mType = null; - mName = null; - mCallback = callback; - } - - /** - * Listener for all MBeans of specified type, with or without a name. - * Caller must call {@link #start} to start listening. - * @param server - * @param type type of the MBean (as found in the ObjectName) - * @param callback - */ - public MBeanListener( - final MBeanServerConnection server, - final String domain, - final String type, - final T callback) - { - this(server, domain, type, null, callback); - } - - /** - * Listener for MBeans of specified type, with specified name (or any name - * if null is passed for the name). - * Caller must call {@link #start} to start listening. - * @param server - * @param type type of the MBean (as found in the ObjectName) - * @param name name of the MBean, or null if none - * @param callback - */ - public MBeanListener( - final MBeanServerConnection server, - final String domain, - final String type, - final String name, - final T callback) - { - mMBeanServer = server; - mJMXDomain = domain; - mType = type; - mName = name; - mObjectName = null; - mCallback = callback; - } - - - private boolean isRegistered( final MBeanServerConnection conn, final ObjectName objectName ) - { - try - { - return conn.isRegistered(objectName); - } - catch (final Exception e) - { - throw new RuntimeException(e); - } - } - - /** - Start listening. If the required MBean(s) are already present, the callback - will be synchronously made before returning. It is also possible that the - callback could happen twice for the same MBean. - */ - public void startListening() - { - // race condition: must listen *before* looking for existing MBeans - try - { - mMBeanServer.addNotificationListener( AMXUtil.getMBeanServerDelegateObjectName(), this, null, this); - } - catch (final Exception e) - { - throw new RuntimeException("Can't add NotificationListener", e); - } - - if ( mObjectName != null ) - { - if ( isRegistered(mMBeanServer, mObjectName) ) - { - mCallback.mbeanRegistered(mObjectName, this); - } - } - else - { - // query for AMX MBeans of the requisite type - String props = TYPE_KEY + "=" + mType; - if (mName != null) - { - props = props + "," + NAME_KEY + mName; - } - - final ObjectName pattern = AMXUtil.newObjectName(mJMXDomain + ":" +props); - try - { - final Set matched = mMBeanServer.queryNames(pattern, null); - for (final ObjectName objectName : matched) - { - mCallback.mbeanRegistered(objectName, this); - } - } - catch( final Exception e ) - { - throw new RuntimeException(e); - } - } - } - - - /** unregister the listener */ - public void stopListening() - { - try - { - mMBeanServer.removeNotificationListener( AMXUtil.getMBeanServerDelegateObjectName(), this); - } - catch (final Exception e) - { - throw new RuntimeException("Can't remove NotificationListener " + this, e); - } - } - - public void handleNotification( - final Notification notifIn, - final Object handback) - { - if (notifIn instanceof MBeanServerNotification) - { - final MBeanServerNotification notif = (MBeanServerNotification) notifIn; - final ObjectName objectName = notif.getMBeanName(); - - boolean match = false; - if ( mObjectName != null && mObjectName.equals(objectName) ) - { - match = true; - } - else if ( objectName.getDomain().equals( mJMXDomain ) ) - { - if ( mType != null && mType.equals(objectName.getKeyProperty(TYPE_KEY)) ) - { - final String mbeanName = objectName.getKeyProperty(NAME_KEY); - if (mName != null && mName.equals(mbeanName)) - { - match = true; - } - } - } - - if ( match ) - { - final String notifType = notif.getType(); - if (MBeanServerNotification.REGISTRATION_NOTIFICATION.equals(notifType)) - { - mCallback.mbeanRegistered(objectName, this); - } - else if (MBeanServerNotification.UNREGISTRATION_NOTIFICATION.equals(notifType)) - { - mCallback.mbeanUnregistered(objectName, this); - } - } - } - } - -} --- old/src/java.xml.ws/share/classes/com/sun/org/glassfish/external/arc/Stability.java 2018-01-30 20:41:21.000000000 -0500 +++ /dev/null 2018-01-30 20:41:21.000000000 -0500 @@ -1,329 +0,0 @@ -/* - * Copyright (c) 2009, 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.org.glassfish.external.arc; - -/** - Taxonomy values. - See http://opensolaris.org/os/community/arc/policies/interface-taxonomy/ -

-

Policy

-
    -
  • Applies to All software produced by SMI
  • -
  • Authority SAC
  • -
  • Approval SAC
  • -
  • Effective April, 1992
  • -
  • Policy
  • -
    • All software interfaces must be classified according to this taxonomy. - Interfaces are defined as APIs, files and directory structures, file formats, protocols, - (sometimes) even performance and reliability behaviors, and any other attribute upon - which another component might reasonably depend.
    • - -
    • An ARC must review, approve and archive the specification for all interfaces - other than Project Private and Internal. Unreviewed, unapproved interfaces are assumed - to be Internal. An adequate specification, suitable for archiving must exist for all - interfaces submitted for review. Often Project Private interfaces are also reviewed if - the presentation of them aids the understanding of the entire project or it is expected - they will be promoted to a broader classification in the future.
    • - -
    • Adequate customer documentation must exist for all Public interfaces. - It is strongly preferred that manual pages exist for all Public interfaces - (supported on Solaris), even if only significant content of those pages are SYNOPSIS - and ATTRIBUTES sections and a textual pointer to other documentation. - Independent of the form of documentation delivery, the interface taxonomy commitment - level must be presented to the consumer.
    • - -
    • In cases where the organization delivering the interface implementation does not - control the interface specification, the controlling body must be be clearly cited - in the documentation. In the case where a well-defined, versioned document is the - specification, both the name and precise version must be be cited.
    • -
    -
- @author llc - */ -public enum Stability { - /** -
-    +----------------------------------------------------------------------------+
-    | Committed (formerly Stable, Public; encompasses Standard, Evolving)        |
-    |----------------------------------------------------------------------------|
-    |   | Specification       | Open                                             |
-    |   |---------------------+--------------------------------------------------|
-    |   | Incompatible Change | major release (X.0)                              |
-    |   |---------------------+--------------------------------------------------|
-    |   | ARC review of Specs | Yes                                              |
-    |   |---------------------+--------------------------------------------------|
-    |   | Examples            | Compiler command line options,                   |
-    |   |                     | hardware  (SBus, PCI, USB), RPC, POSIX utilities |
-    +----------------------------------------------------------------------------+
-    
- We publish the specification of these interfaces, typically as manual pages or other product documentation. - We also tell customers we will remain compatible with them. (Scott McNealy's principle that "Compatibility is a - constraint, not a goal") The intention of a Committed interface is to enable arbitrary third parties to develop - applications to these interfaces, release them, and have confidence that they will run on all releases of the product - after the one in which the interface was introduced, and within the same Major release. Even at a Major release, - incompatible changes are expected to be rare, and to have strong justifications. -

- Committed interfaces are often proposed to be industry standards, as was the case with RPC. - Also, interfaces defined and controlled as industry standards are most often treated as Committed interfaces. -

- These are interfaces whose specification is often under the provider's control or which are specified by a - clearly versioned document controlled by a well-defined organization. If the interface specification is not - under the implementation provider's control, the provider must be willing to fork from the interface specification - if required to maintain compatibility. In the case of interface specifications controlled by a standards body, - the commitment must be to a clearly identified version of the specification, minimizing the likelihood of an - incompatible change (but it can happen through formal spec interpretations). -

- Also, if the interface specification is not under the control of the interface implementation provider, - then the controlling body and/or public, versioned document must be be noted in the documentation. - This is particularly important for specifications controlled by recognized standards organizations. -

- Although a truely exceptional event, incompatible changes are possible in any release if - the associated defect is serious enough as outlined in the EXEMPTIONS section of this document or - in a Minor release by following the End of Feature process. - */ - COMMITTED( "Committed" ), - -/** -

-    +--------------------------------------------------------------------------+
-    | Uncommitted (formerly Unstable)                                          |
-    |--------------------------------------------------------------------------|
-    |   | Specification       | Open                                           |
-    |   |---------------------+------------------------------------------------|
-    |   | Incompatible Change | minor release (x.Y) with impact assessment     |
-    |   |---------------------+------------------------------------------------|
-    |   | ARC review of Specs | Yes                                            |
-    |   |---------------------+------------------------------------------------|
-    |   | Examples            | SUNW* package abbreviations, some config utils |
-    +--------------------------------------------------------------------------+
-    
- No guarantees are made about either source or binary compatibility of these interfaces - from one Minor release to the next. The most drastic incompatible change of removal of - the interface in a Minor release is allowed. Uncommitted interfaces are generally not - appropriate for use by release-independent products. -

- Uncommitted is not a license for gratuitous change. Any incompatible changes to the - interface should be motivated by true improvement to the interface which may include - justifiable ease of use considerations. The general expectation is that Uncommitted - interfaces are not likely to change incompatibly and if such changes occur they will be - small in impact and should often have a mitigation plan. -

- Uncommitted interfaces generally fall into one of the following subcategories: -

-