Merge
This commit is contained in:
commit
1f5fdd011c
1
.hgtags
1
.hgtags
@ -313,3 +313,4 @@ ff3fc75f3214ad7e03595be1b0d0f38d887b6f0e jdk9-b66
|
||||
5b500c93ce4822d47061cd518ff3f72d9d8cb5b5 jdk9-b68
|
||||
d69c968463f0ae5d0b45de3fc14fe65171b23948 jdk9-b69
|
||||
43d0179ee9de3bfffae3417f09e07eb6d8efc963 jdk9-b70
|
||||
f66c185284727f6e6ffd27e9c45ed2dd9da0a691 jdk9-b71
|
||||
|
@ -313,3 +313,4 @@ f546760134eb861fcfecd4ce611b0040b0d25a6a jdk9-b67
|
||||
70e4272790b6199e9ca89df2758ff9cb58ec4125 jdk9-b68
|
||||
1bcfd6b8726582cff5a42dbfc75903e36f9dd4fe jdk9-b69
|
||||
eed77fcd77711fcdba05f18fc22f37d86efb243c jdk9-b70
|
||||
c706ef5ea5da00078dc5e4334660315f7d99c15b jdk9-b71
|
||||
|
@ -4364,7 +4364,7 @@ VS_SDK_PLATFORM_NAME_2013=
|
||||
#CUSTOM_AUTOCONF_INCLUDE
|
||||
|
||||
# Do not change or remove the following line, it is needed for consistency checks:
|
||||
DATE_WHEN_GENERATED=1434614912
|
||||
DATE_WHEN_GENERATED=1435822080
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
@ -42961,7 +42961,7 @@ $as_echo "$as_me: WARNING: X11 is not used, so --with-x is ignored" >&2;}
|
||||
if test "x$x_libraries" = xNONE; then
|
||||
if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/X11R6/lib"
|
||||
elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
x_libraries="$SYSROOT/usr/lib64"
|
||||
elif test -f "$SYSROOT/usr/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/lib"
|
||||
|
@ -113,7 +113,7 @@ AC_DEFUN_ONCE([LIB_SETUP_X11],
|
||||
if test "x$x_libraries" = xNONE; then
|
||||
if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/X11R6/lib"
|
||||
elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
elif test -f "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then
|
||||
x_libraries="$SYSROOT/usr/lib64"
|
||||
elif test -f "$SYSROOT/usr/lib/libX11.so"; then
|
||||
x_libraries="$SYSROOT/usr/lib"
|
||||
|
@ -1188,28 +1188,11 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
|
||||
OTHER_JDK="$OTHER/install/jdk"
|
||||
OTHER_JRE="$OTHER/install/jre"
|
||||
echo "Selecting install images for compare"
|
||||
elif [ -d "$THIS/deploy/jdk" -o -d "$THIS/deploy/images/jdk" ] \
|
||||
&& [ -d "$OTHER/deploy/jdk" -o -d "$OTHER/deploy/images/jdk" ]; then
|
||||
if [ -d "$THIS/deploy/images/jdk" ]; then
|
||||
THIS_JDK="$THIS/deploy/images/jdk"
|
||||
THIS_JRE="$THIS/deploy/images/jre"
|
||||
else
|
||||
THIS_JDK="$THIS/deploy/jdk"
|
||||
THIS_JRE="$THIS/deploy/jre"
|
||||
fi
|
||||
if [ -d "$OTHER/deploy/images/jdk" ]; then
|
||||
OTHER_JDK="$OTHER/deploy/images/jdk"
|
||||
OTHER_JRE="$OTHER/deploy/images/jre"
|
||||
else
|
||||
OTHER_JDK="$OTHER/deploy/jdk"
|
||||
OTHER_JRE="$OTHER/deploy/jre"
|
||||
fi
|
||||
echo "Selecting deploy images for compare"
|
||||
elif [ -d "$THIS/deploy/images/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then
|
||||
THIS_JDK="$THIS/deploy/jdk"
|
||||
THIS_JRE="$THIS/deploy/jre"
|
||||
OTHER_JDK="$OTHER/deploy/jdk"
|
||||
OTHER_JRE="$OTHER/deploy/jre"
|
||||
elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/deploy/images/jdk" ]; then
|
||||
THIS_JDK="$THIS/images/jdk"
|
||||
THIS_JRE="$THIS/images/jre"
|
||||
OTHER_JDK="$OTHER/deploy/images/jdk"
|
||||
OTHER_JRE="$OTHER/deploy/images/jre"
|
||||
echo "Selecting deploy images for compare"
|
||||
elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then
|
||||
THIS_JDK="$THIS/images/jdk"
|
||||
@ -1221,30 +1204,28 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
|
||||
echo "No common images found."
|
||||
exit 1
|
||||
fi
|
||||
echo " $THIS_JDK"
|
||||
echo " $OTHER_JDK"
|
||||
|
||||
if [ -d "$THIS/deploy/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \
|
||||
&& [ -d "$OTHER/deploy/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then
|
||||
if [ -d "$THIS/images/jdk-bundle" -o -d "$THIS/deploy/images/jdk-bundle" ] \
|
||||
&& [ -d "$OTHER/images/jdk-bundle" -o -d "$OTHER/deploy/images/jdk-bundle" ]; then
|
||||
if [ -d "$THIS/deploy/images/jdk-bundle" ]; then
|
||||
THIS_JDK_BUNDLE="$THIS/deploy/images/jdk-bundle"
|
||||
THIS_JRE_BUNDLE="$THIS/deploy/images/jre-bundle"
|
||||
else
|
||||
THIS_JDK_BUNDLE="$THIS/deploy/jdk-bundle"
|
||||
THIS_JRE_BUNDLE="$THIS/deploy/jre-bundle"
|
||||
THIS_JDK_BUNDLE="$THIS/images/jdk-bundle"
|
||||
THIS_JRE_BUNDLE="$THIS/images/jre-bundle"
|
||||
fi
|
||||
if [ -d "$OTHER/deploy/images/jdk-bundle" ]; then
|
||||
OTHER_JDK_BUNDLE="$OTHER/deploy/images/jdk-bundle"
|
||||
OTHER_JRE_BUNDLE="$OTHER/deploy/images/jre-bundle"
|
||||
else
|
||||
OTHER_JDK_BUNDLE="$OTHER/deploy/jdk-bundle"
|
||||
OTHER_JRE_BUNDLE="$OTHER/deploy/jre-bundle"
|
||||
OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle"
|
||||
OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle"
|
||||
fi
|
||||
echo "Also comparing deploy macosx bundles"
|
||||
elif [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
|
||||
THIS_JDK_BUNDLE="$THIS/images/jdk-bundle"
|
||||
THIS_JRE_BUNDLE="$THIS/images/jre-bundle"
|
||||
OTHER_JDK_BUNDLE="$OTHER/images/jdk-bundle"
|
||||
OTHER_JRE_BUNDLE="$OTHER/images/jre-bundle"
|
||||
echo "Also comparing macosx bundles"
|
||||
echo " $THIS_JDK_BUNDLE"
|
||||
echo " $OTHER_JDK_BUNDLE"
|
||||
fi
|
||||
|
||||
if [ -d "$THIS/deploy/bundles" -o -d "$THIS/deploy/images/bundles" ] \
|
||||
@ -1262,19 +1243,21 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
|
||||
echo "Also comparing deploy javadoc bundles"
|
||||
fi
|
||||
|
||||
if [ -d "$THIS/deploy/JavaAppletPlugin.plugin" -o -d "$THIS/deploy/images/JavaAppletPlugin.plugin" ] \
|
||||
&& [ -d "$OTHER/deploy/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then
|
||||
if [ -d "$THIS/deploy/images/bundles" ]; then
|
||||
if [ -d "$THIS/images/JavaAppletPlugin.plugin" ] \
|
||||
&& [ -d "$OTHER/images/JavaAppletPlugin.plugin" -o -d "$OTHER/deploy/images/JavaAppletPlugin.plugin" ]; then
|
||||
if [ -d "$THIS/images/JavaAppletPlugin.plugin" ]; then
|
||||
THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/images/JavaAppletPlugin.plugin"
|
||||
else
|
||||
THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/images/JavaAppletPlugin.plugin"
|
||||
else
|
||||
THIS_DEPLOY_APPLET_PLUGIN_DIR="$THIS/deploy/JavaAppletPlugin.plugin"
|
||||
fi
|
||||
if [ -d "$OTHER/deploy/images/bundles" ]; then
|
||||
OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/images/JavaAppletPlugin.plugin"
|
||||
if [ -d "$OTHER/images/JavaAppletPlugin.plugin" ]; then
|
||||
OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/images/JavaAppletPlugin.plugin"
|
||||
else
|
||||
OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/JavaAppletPlugin.plugin"
|
||||
OTHER_DEPLOY_APPLET_PLUGIN_DIR="$OTHER/deploy/images/JavaAppletPlugin.plugin"
|
||||
fi
|
||||
echo "Also comparing deploy applet image"
|
||||
echo " $THIS_DEPLOY_APPLET_PLUGIN_DIR"
|
||||
echo " $OTHER_DEPLOY_APPLET_PLUGIN_DIR"
|
||||
fi
|
||||
|
||||
if [ -d "$OTHER/images" ]; then
|
||||
|
@ -313,3 +313,4 @@ afc1e295c4bf83f9a5dd539c29914edd4a754a3f jdk9-b65
|
||||
8efad64f40eb8cd4df376c0a5275892eeb396bbd jdk9-b68
|
||||
de8acedcb5b5870f1dc54cba575aaa5d33897ea2 jdk9-b69
|
||||
e7cf01990ed366bd493080663259281e91ce223b jdk9-b70
|
||||
cd39ed501fb0504554a7f58ac6cf3dd2b64afec0 jdk9-b71
|
||||
|
@ -65,7 +65,7 @@ import org.omg.CORBA.ValueMember;
|
||||
import sun.corba.Bridge;
|
||||
|
||||
/**
|
||||
* A ObjectStreamClass describes a class that can be serialized to a stream
|
||||
* 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.
|
||||
* <br>
|
||||
@ -788,9 +788,9 @@ public class ObjectStreamClass implements java.io.Serializable {
|
||||
/* Compare the base class names of streamName and localName.
|
||||
*
|
||||
* @return Return true iff the base class name compare.
|
||||
* @parameter streamName Fully qualified class name.
|
||||
* @parameter localName Fully qualified class name.
|
||||
* @parameter pkgSeparator class names use either '.' or '/'.
|
||||
* @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.
|
||||
*/
|
||||
|
@ -656,9 +656,9 @@ public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
|
||||
/* Compare the base class names of streamName and localName.
|
||||
*
|
||||
* @return Return true iff the base class name compare.
|
||||
* @parameter streamName Fully qualified class name.
|
||||
* @parameter localName Fully qualified class name.
|
||||
* @parameter pkgSeparator class names use either '.' or '/'.
|
||||
* @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.
|
||||
*/
|
||||
|
@ -27,10 +27,10 @@ package org.omg.CORBA;
|
||||
|
||||
|
||||
/**
|
||||
* This Helper class is used to facilitate the marshalling of <tt>Bounds</tt>.
|
||||
* This Helper class is used to facilitate the marshalling of {@code Bounds}.
|
||||
* For more information on Helper files, see
|
||||
* <a href="doc-files/generatedfiles.html#helper">
|
||||
* "Generated Files: Helper Files"</a>.<P>
|
||||
* "Generated Files: Helper Files"</a>.
|
||||
*/
|
||||
|
||||
abstract public class BoundsHelper
|
||||
|
@ -28,10 +28,10 @@ package org.omg.CORBA.ORBPackage;
|
||||
|
||||
/**
|
||||
* This Helper class is used to facilitate the marshalling of
|
||||
* <tt>ORBPackage/InvalidName</tt>.
|
||||
* {@code ORBPackage/InvalidName}.
|
||||
* For more information on Helper files, see
|
||||
* <a href="doc-files/generatedfiles.html#helper">
|
||||
* "Generated Files: Helper Files"</a>.<P>
|
||||
* "Generated Files: Helper Files"</a>.
|
||||
*/
|
||||
|
||||
abstract public class InvalidNameHelper
|
||||
|
@ -28,10 +28,10 @@ package org.omg.CORBA.TypeCodePackage;
|
||||
|
||||
/**
|
||||
* This Helper class is used to facilitate the marshalling of
|
||||
* <tt>TypeCodePackage/BadKind</tt>.
|
||||
* {@code TypeCodePackage/BadKind}.
|
||||
* For more information on Helper files, see
|
||||
* <a href="doc-files/generatedfiles.html#helper">
|
||||
* "Generated Files: Helper Files"</a>.<P>
|
||||
* "Generated Files: Helper Files"</a>.
|
||||
*/
|
||||
|
||||
abstract public class BadKindHelper
|
||||
|
@ -28,10 +28,10 @@ package org.omg.CORBA.TypeCodePackage;
|
||||
|
||||
/**
|
||||
* This Helper class is used to facilitate the marshalling of
|
||||
* <tt>TypeCodePackage/Bounds</tt>.
|
||||
* {@code TypeCodePackage/Bounds}.
|
||||
* For more information on Helper files, see
|
||||
* <a href="doc-files/generatedfiles.html#helper">
|
||||
* "Generated Files: Helper Files"</a>.<P>
|
||||
* "Generated Files: Helper Files"</a>.
|
||||
*/
|
||||
|
||||
abstract public class BoundsHelper
|
||||
|
@ -473,3 +473,4 @@ d47dfabd16d48eb96a451edd1b61194a39ee0eb5 jdk9-b67
|
||||
11af3990d56c97b40318bc1f20608e86f051a3f7 jdk9-b68
|
||||
ff0929a59ced0e144201aa05819ae2e47d6f2c61 jdk9-b69
|
||||
8672e9264db30c21504063932dbc374eabc287a1 jdk9-b70
|
||||
07c6b035d68b0c41b1dcd442157b50b41a2551e9 jdk9-b71
|
||||
|
@ -313,3 +313,4 @@ d5963ccce28d7a3e96ee3e2dc8a8676e61699b70 jdk9-b66
|
||||
82aae947938ec9b0119fdd78a616d0b7263072ee jdk9-b68
|
||||
f844a908d3308f47d73cf64e87c98d37d5d76ce8 jdk9-b69
|
||||
42180703e0a362c1de7cdbf61d2cbc6609e678c4 jdk9-b70
|
||||
a3200b88f259f904876b9ab13fd4c4ec2726f8ba jdk9-b71
|
||||
|
@ -1,154 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
package com.sun.org.apache.bcel.internal.util;
|
||||
|
||||
/* ====================================================================
|
||||
* The Apache Software License, Version 1.1
|
||||
*
|
||||
* Copyright (c) 2001 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 "Apache" and "Apache Software Foundation" and
|
||||
* "Apache BCEL" 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",
|
||||
* "Apache BCEL", 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. For more
|
||||
* information on the Apache Software Foundation, please see
|
||||
* <http://www.apache.org/>.
|
||||
*/
|
||||
|
||||
import java.lang.reflect.*;
|
||||
|
||||
/**
|
||||
* Java interpreter replacement, i.e., wrapper that uses its own ClassLoader
|
||||
* to modify/generate classes as they're requested. You can take this as a template
|
||||
* for your own applications.<br>
|
||||
* Call this wrapper with
|
||||
* <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper <real.class.name> [arguments]</pre>
|
||||
* <p>
|
||||
* To use your own class loader you can set the "bcel.classloader" system property
|
||||
* which defaults to "com.sun.org.apache.bcel.internal.util.ClassLoader", e.g., with
|
||||
* <pre>java com.sun.org.apache.bcel.internal.util.JavaWrapper -Dbcel.classloader=foo.MyLoader <real.class.name> [arguments]</pre>
|
||||
* </p>
|
||||
*
|
||||
* @author <A HREF="mailto:markus.dahm@berlin.de">M. Dahm</A>
|
||||
* @see ClassLoader
|
||||
*/
|
||||
public class JavaWrapper {
|
||||
private java.lang.ClassLoader loader;
|
||||
|
||||
private static java.lang.ClassLoader getClassLoader() {
|
||||
String s = SecuritySupport.getSystemProperty("bcel.classloader");
|
||||
|
||||
if((s == null) || "".equals(s))
|
||||
s = "com.sun.org.apache.bcel.internal.util.ClassLoader";
|
||||
|
||||
try {
|
||||
return (java.lang.ClassLoader)Class.forName(s).newInstance();
|
||||
} catch(Exception e) {
|
||||
throw new RuntimeException(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public JavaWrapper(java.lang.ClassLoader loader) {
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
public JavaWrapper() {
|
||||
this(getClassLoader());
|
||||
}
|
||||
|
||||
/** Runs the _main method of the given class with the arguments passed in argv
|
||||
*
|
||||
* @param class_name the fully qualified class name
|
||||
* @param argv the arguments just as you would pass them directly
|
||||
*/
|
||||
public void runMain(String class_name, String[] argv) throws ClassNotFoundException
|
||||
{
|
||||
Class cl = loader.loadClass(class_name);
|
||||
Method method = null;
|
||||
|
||||
try {
|
||||
method = cl.getMethod("_main", new Class[] { argv.getClass() });
|
||||
|
||||
/* Method _main is sane ?
|
||||
*/
|
||||
int m = method.getModifiers();
|
||||
Class r = method.getReturnType();
|
||||
|
||||
if(!(Modifier.isPublic(m) && Modifier.isStatic(m)) ||
|
||||
Modifier.isAbstract(m) || (r != Void.TYPE))
|
||||
throw new NoSuchMethodException();
|
||||
} catch(NoSuchMethodException no) {
|
||||
System.out.println("In class " + class_name +
|
||||
": public static void _main(String[] argv) is not defined");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
method.invoke(null, new Object[] { argv });
|
||||
} catch(Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/** Default _main method used as wrapper, expects the fully qualified class name
|
||||
* of the real class as the first argument.
|
||||
*/
|
||||
public static void _main(String[] argv) throws Exception {
|
||||
/* Expects class name as first argument, other arguments are by-passed.
|
||||
*/
|
||||
if(argv.length == 0) {
|
||||
System.out.println("Missing class name.");
|
||||
return;
|
||||
}
|
||||
|
||||
String class_name = argv[0];
|
||||
String[] new_argv = new String[argv.length - 1];
|
||||
System.arraycopy(argv, 1, new_argv, 0, new_argv.length);
|
||||
|
||||
JavaWrapper wrapper = new JavaWrapper();
|
||||
wrapper.runMain(class_name, new_argv);
|
||||
}
|
||||
}
|
@ -22,20 +22,16 @@
|
||||
*/
|
||||
package com.sun.org.apache.xalan.internal.lib;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.extensions.ExpressionContext;
|
||||
import com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck;
|
||||
import com.sun.org.apache.xpath.internal.NodeSet;
|
||||
import com.sun.org.apache.xpath.internal.objects.XBoolean;
|
||||
import com.sun.org.apache.xpath.internal.objects.XNumber;
|
||||
import com.sun.org.apache.xpath.internal.objects.XObject;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentFragment;
|
||||
@ -275,102 +271,6 @@ public class Extensions
|
||||
return tokenize(toTokenize, " \t\n\r");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a Node of basic debugging information from the
|
||||
* EnvironmentCheck utility about the Java environment.
|
||||
*
|
||||
* <p>Simply calls the {@link com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck}
|
||||
* utility to grab info about the Java environment and CLASSPATH,
|
||||
* etc., and then returns the resulting Node. Stylesheets can
|
||||
* then maniuplate this data or simply xsl:copy-of the Node. Note
|
||||
* that we first attempt to load the more advanced
|
||||
* org.apache.env.Which utility by reflection; only if that fails
|
||||
* to we still use the internal version. Which is available from
|
||||
* <a href="http://xml.apache.org/commons/">http://xml.apache.org/commons/</a>.</p>
|
||||
*
|
||||
* <p>We throw a WrappedRuntimeException in the unlikely case
|
||||
* that reading information from the environment throws us an
|
||||
* exception. (Is this really the best thing to do?)</p>
|
||||
*
|
||||
* @param myContext an <code>ExpressionContext</code> passed in by the
|
||||
* extension mechanism. This must be an XPathContext.
|
||||
* @return a Node as described above.
|
||||
*/
|
||||
public static Node checkEnvironment(ExpressionContext myContext)
|
||||
{
|
||||
|
||||
Document factoryDocument = getDocument();
|
||||
|
||||
Node resultNode = null;
|
||||
try
|
||||
{
|
||||
// First use reflection to try to load Which, which is a
|
||||
// better version of EnvironmentCheck
|
||||
resultNode = checkEnvironmentUsingWhich(myContext, factoryDocument);
|
||||
|
||||
if (null != resultNode)
|
||||
return resultNode;
|
||||
|
||||
// If reflection failed, fallback to our internal EnvironmentCheck
|
||||
EnvironmentCheck envChecker = new EnvironmentCheck();
|
||||
Hashtable h = envChecker.getEnvironmentHash();
|
||||
resultNode = factoryDocument.createElement("checkEnvironmentExtension");
|
||||
envChecker.appendEnvironmentReport(resultNode, factoryDocument, h);
|
||||
envChecker = null;
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
throw new com.sun.org.apache.xml.internal.utils.WrappedRuntimeException(e);
|
||||
}
|
||||
|
||||
return resultNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Private worker method to attempt to use org.apache.env.Which.
|
||||
*
|
||||
* @param myContext an <code>ExpressionContext</code> passed in by the
|
||||
* extension mechanism. This must be an XPathContext.
|
||||
* @param factoryDocument providing createElement services, etc.
|
||||
* @return a Node with environment info; null if any error
|
||||
*/
|
||||
private static Node checkEnvironmentUsingWhich(ExpressionContext myContext,
|
||||
Document factoryDocument)
|
||||
{
|
||||
final String WHICH_CLASSNAME = "org.apache.env.Which";
|
||||
final String WHICH_METHODNAME = "which";
|
||||
final Class WHICH_METHOD_ARGS[] = { java.util.Hashtable.class,
|
||||
java.lang.String.class,
|
||||
java.lang.String.class };
|
||||
try
|
||||
{
|
||||
// Use reflection to try to find xml-commons utility 'Which'
|
||||
Class clazz = ObjectFactory.findProviderClass(WHICH_CLASSNAME, true);
|
||||
if (null == clazz)
|
||||
return null;
|
||||
|
||||
// Fully qualify names since this is the only method they're used in
|
||||
java.lang.reflect.Method method = clazz.getMethod(WHICH_METHODNAME, WHICH_METHOD_ARGS);
|
||||
Hashtable report = new Hashtable();
|
||||
|
||||
// Call the method with our Hashtable, common options, and ignore return value
|
||||
Object[] methodArgs = { report, "XmlCommons;Xalan;Xerces;Crimson;Ant", "" };
|
||||
Object returnValue = method.invoke(null, methodArgs);
|
||||
|
||||
// Create a parent to hold the report and append hash to it
|
||||
Node resultNode = factoryDocument.createElement("checkEnvironmentExtension");
|
||||
com.sun.org.apache.xml.internal.utils.Hashtree2Node.appendHashToNode(report, "whichReport",
|
||||
resultNode, factoryDocument);
|
||||
|
||||
return resultNode;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
// Simply return null; no need to report error
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return an instance of DOM Document
|
||||
*/
|
||||
|
@ -121,22 +121,7 @@ public class ObjectFactory {
|
||||
public static Object newInstance(String className, boolean doFallback)
|
||||
throws ConfigurationError
|
||||
{
|
||||
if (System.getSecurityManager()!=null) {
|
||||
return newInstance(className, null, doFallback);
|
||||
} else {
|
||||
return newInstance(className,
|
||||
findClassLoader (), doFallback);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an instance of a class using the specified ClassLoader
|
||||
*/
|
||||
static Object newInstance(String className, ClassLoader cl,
|
||||
boolean doFallback)
|
||||
throws ConfigurationError
|
||||
{
|
||||
// assert(className != null);
|
||||
ClassLoader cl = System.getSecurityManager()!=null ? null : findClassLoader();
|
||||
try{
|
||||
Class providerClass = findProviderClass(className, cl, doFallback);
|
||||
Object instance = providerClass.newInstance();
|
||||
|
@ -1,455 +0,0 @@
|
||||
/*
|
||||
* reserved comment block
|
||||
* DO NOT REMOVE OR ALTER!
|
||||
*/
|
||||
/*
|
||||
* Copyright 2001-2004 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
/*
|
||||
* $Id: SmartTransformerFactoryImpl.java,v 1.2.4.1 2005/09/14 09:57:13 pvedula Exp $
|
||||
*/
|
||||
|
||||
|
||||
package com.sun.org.apache.xalan.internal.xsltc.trax;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.transform.ErrorListener;
|
||||
import javax.xml.transform.Source;
|
||||
import javax.xml.transform.Templates;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerConfigurationException;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.URIResolver;
|
||||
import javax.xml.transform.dom.DOMResult;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.sax.SAXResult;
|
||||
import javax.xml.transform.sax.SAXSource;
|
||||
import javax.xml.transform.sax.SAXTransformerFactory;
|
||||
import javax.xml.transform.sax.TemplatesHandler;
|
||||
import javax.xml.transform.sax.TransformerHandler;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
import javax.xml.transform.stream.StreamSource;
|
||||
|
||||
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg;
|
||||
import com.sun.org.apache.xalan.internal.utils.ObjectFactory;
|
||||
import org.xml.sax.XMLFilter;
|
||||
|
||||
/**
|
||||
* Implementation of a transformer factory that uses an XSLTC
|
||||
* transformer factory for the creation of Templates objects
|
||||
* and uses the Xalan processor transformer factory for the
|
||||
* creation of Transformer objects.
|
||||
* @author G. Todd Miller
|
||||
*/
|
||||
public class SmartTransformerFactoryImpl extends SAXTransformerFactory
|
||||
{
|
||||
/**
|
||||
* <p>Name of class as a constant to use for debugging.</p>
|
||||
*/
|
||||
private static final String CLASS_NAME = "SmartTransformerFactoryImpl";
|
||||
|
||||
private SAXTransformerFactory _xsltcFactory = null;
|
||||
private SAXTransformerFactory _xalanFactory = null;
|
||||
private SAXTransformerFactory _currFactory = null;
|
||||
private ErrorListener _errorlistener = null;
|
||||
private URIResolver _uriresolver = null;
|
||||
|
||||
/**
|
||||
* <p>State of secure processing feature.</p>
|
||||
*/
|
||||
private boolean featureSecureProcessing = false;
|
||||
|
||||
/**
|
||||
* implementation of the SmartTransformerFactory. This factory
|
||||
* uses com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory
|
||||
* to return Templates objects; and uses
|
||||
* com.sun.org.apache.xalan.internal.processor.TransformerFactory
|
||||
* to return Transformer objects.
|
||||
*/
|
||||
public SmartTransformerFactoryImpl() { }
|
||||
|
||||
private void createXSLTCTransformerFactory() {
|
||||
_xsltcFactory = new TransformerFactoryImpl();
|
||||
_currFactory = _xsltcFactory;
|
||||
}
|
||||
|
||||
private void createXalanTransformerFactory() {
|
||||
final String xalanMessage =
|
||||
"com.sun.org.apache.xalan.internal.xsltc.trax.SmartTransformerFactoryImpl "+
|
||||
"could not create an "+
|
||||
"com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl.";
|
||||
// try to create instance of Xalan factory...
|
||||
try {
|
||||
Class xalanFactClass = ObjectFactory.findProviderClass(
|
||||
"com.sun.org.apache.xalan.internal.processor.TransformerFactoryImpl",
|
||||
true);
|
||||
_xalanFactory = (SAXTransformerFactory)
|
||||
xalanFactClass.newInstance();
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
System.err.println(xalanMessage);
|
||||
}
|
||||
catch (InstantiationException e) {
|
||||
System.err.println(xalanMessage);
|
||||
}
|
||||
catch (IllegalAccessException e) {
|
||||
System.err.println(xalanMessage);
|
||||
}
|
||||
_currFactory = _xalanFactory;
|
||||
}
|
||||
|
||||
public void setErrorListener(ErrorListener listener)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
_errorlistener = listener;
|
||||
}
|
||||
|
||||
public ErrorListener getErrorListener() {
|
||||
return _errorlistener;
|
||||
}
|
||||
|
||||
public Object getAttribute(String name)
|
||||
throws IllegalArgumentException
|
||||
{
|
||||
// GTM: NB: 'debug' should change to something more unique...
|
||||
if ((name.equals("translet-name")) || (name.equals("debug"))) {
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
return _xsltcFactory.getAttribute(name);
|
||||
}
|
||||
else {
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
return _xalanFactory.getAttribute(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void setAttribute(String name, Object value)
|
||||
throws IllegalArgumentException {
|
||||
// GTM: NB: 'debug' should change to something more unique...
|
||||
if ((name.equals("translet-name")) || (name.equals("debug"))) {
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
_xsltcFactory.setAttribute(name, value);
|
||||
}
|
||||
else {
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
_xalanFactory.setAttribute(name, value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Set a feature for this <code>SmartTransformerFactory</code> and <code>Transformer</code>s
|
||||
* or <code>Template</code>s created by this factory.</p>
|
||||
*
|
||||
* <p>
|
||||
* Feature names are fully qualified {@link java.net.URI}s.
|
||||
* Implementations may define their own features.
|
||||
* An {@link TransformerConfigurationException} is thrown if this <code>TransformerFactory</code> or the
|
||||
* <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature.
|
||||
* It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state.
|
||||
* </p>
|
||||
*
|
||||
* <p>See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.</p>
|
||||
*
|
||||
* @param name Feature name.
|
||||
* @param value Is feature state <code>true</code> or <code>false</code>.
|
||||
*
|
||||
* @throws TransformerConfigurationException if this <code>TransformerFactory</code>
|
||||
* or the <code>Transformer</code>s or <code>Template</code>s it creates cannot support this feature.
|
||||
* @throws NullPointerException If the <code>name</code> parameter is null.
|
||||
*/
|
||||
public void setFeature(String name, boolean value)
|
||||
throws TransformerConfigurationException {
|
||||
|
||||
// feature name cannot be null
|
||||
if (name == null) {
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME);
|
||||
throw new NullPointerException(err.toString());
|
||||
}
|
||||
// secure processing?
|
||||
else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
|
||||
featureSecureProcessing = value;
|
||||
// all done processing feature
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// unknown feature
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
|
||||
throw new TransformerConfigurationException(err.toString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* javax.xml.transform.sax.TransformerFactory implementation.
|
||||
* Look up the value of a feature (to see if it is supported).
|
||||
* This method must be updated as the various methods and features of this
|
||||
* class are implemented.
|
||||
*
|
||||
* @param name The feature name
|
||||
* @return 'true' if feature is supported, 'false' if not
|
||||
*/
|
||||
public boolean getFeature(String name) {
|
||||
// All supported features should be listed here
|
||||
String[] features = {
|
||||
DOMSource.FEATURE,
|
||||
DOMResult.FEATURE,
|
||||
SAXSource.FEATURE,
|
||||
SAXResult.FEATURE,
|
||||
StreamSource.FEATURE,
|
||||
StreamResult.FEATURE
|
||||
};
|
||||
|
||||
// feature name cannot be null
|
||||
if (name == null) {
|
||||
ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
|
||||
throw new NullPointerException(err.toString());
|
||||
}
|
||||
|
||||
// Inefficient, but it really does not matter in a function like this
|
||||
for (int i = 0; i < features.length; i++) {
|
||||
if (name.equals(features[i]))
|
||||
return true;
|
||||
}
|
||||
|
||||
// secure processing?
|
||||
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
|
||||
return featureSecureProcessing;
|
||||
}
|
||||
|
||||
// unknown feature
|
||||
return false;
|
||||
}
|
||||
|
||||
public URIResolver getURIResolver() {
|
||||
return _uriresolver;
|
||||
}
|
||||
|
||||
public void setURIResolver(URIResolver resolver) {
|
||||
_uriresolver = resolver;
|
||||
}
|
||||
|
||||
public Source getAssociatedStylesheet(Source source, String media,
|
||||
String title, String charset)
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_currFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
return _currFactory.getAssociatedStylesheet(source, media,
|
||||
title, charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Transformer object that copies the input document to the
|
||||
* result. Uses the com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
||||
* @return A Transformer object.
|
||||
*/
|
||||
public Transformer newTransformer()
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xalanFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xalanFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
_currFactory = _xalanFactory;
|
||||
return _currFactory.newTransformer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Transformer object that from the input stylesheet
|
||||
* Uses the com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
||||
* @param source the stylesheet.
|
||||
* @return A Transformer object.
|
||||
*/
|
||||
public Transformer newTransformer(Source source) throws
|
||||
TransformerConfigurationException
|
||||
{
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xalanFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xalanFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
_currFactory = _xalanFactory;
|
||||
return _currFactory.newTransformer(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Templates object that from the input stylesheet
|
||||
* Uses the com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
* @param source the stylesheet.
|
||||
* @return A Templates object.
|
||||
*/
|
||||
public Templates newTemplates(Source source)
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xsltcFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xsltcFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
_currFactory = _xsltcFactory;
|
||||
return _currFactory.newTemplates(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a TemplatesHandler object that can process SAX ContentHandler
|
||||
* events into a Templates object. Uses the
|
||||
* com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
*/
|
||||
public TemplatesHandler newTemplatesHandler()
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xsltcFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xsltcFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
return _xsltcFactory.newTemplatesHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a TransformerHandler object that can process SAX ContentHandler
|
||||
* events based on a copy transformer.
|
||||
* Uses com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
||||
*/
|
||||
public TransformerHandler newTransformerHandler()
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xalanFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xalanFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
return _xalanFactory.newTransformerHandler();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a TransformerHandler object that can process SAX ContentHandler
|
||||
* events based on a transformer specified by the stylesheet Source.
|
||||
* Uses com.sun.org.apache.xalan.internal.processor.TransformerFactory.
|
||||
*/
|
||||
public TransformerHandler newTransformerHandler(Source src)
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xalanFactory == null) {
|
||||
createXalanTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xalanFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xalanFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
return _xalanFactory.newTransformerHandler(src);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a TransformerHandler object that can process SAX ContentHandler
|
||||
* events based on a transformer specified by the stylesheet Source.
|
||||
* Uses com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
*/
|
||||
public TransformerHandler newTransformerHandler(Templates templates)
|
||||
throws TransformerConfigurationException
|
||||
{
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xsltcFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xsltcFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
return _xsltcFactory.newTransformerHandler(templates);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create an XMLFilter that uses the given source as the
|
||||
* transformation instructions. Uses
|
||||
* com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
*/
|
||||
public XMLFilter newXMLFilter(Source src)
|
||||
throws TransformerConfigurationException {
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
if (_errorlistener != null) {
|
||||
_xsltcFactory.setErrorListener(_errorlistener);
|
||||
}
|
||||
if (_uriresolver != null) {
|
||||
_xsltcFactory.setURIResolver(_uriresolver);
|
||||
}
|
||||
Templates templates = _xsltcFactory.newTemplates(src);
|
||||
if (templates == null ) return null;
|
||||
return newXMLFilter(templates);
|
||||
}
|
||||
|
||||
/*
|
||||
* Create an XMLFilter that uses the given source as the
|
||||
* transformation instructions. Uses
|
||||
* com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactory.
|
||||
*/
|
||||
public XMLFilter newXMLFilter(Templates templates)
|
||||
throws TransformerConfigurationException {
|
||||
try {
|
||||
return new com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter(templates);
|
||||
}
|
||||
catch(TransformerConfigurationException e1) {
|
||||
if (_xsltcFactory == null) {
|
||||
createXSLTCTransformerFactory();
|
||||
}
|
||||
ErrorListener errorListener = _xsltcFactory.getErrorListener();
|
||||
if(errorListener != null) {
|
||||
try {
|
||||
errorListener.fatalError(e1);
|
||||
return null;
|
||||
}
|
||||
catch( TransformerException e2) {
|
||||
new TransformerConfigurationException(e2);
|
||||
}
|
||||
}
|
||||
throw e1;
|
||||
}
|
||||
}
|
||||
}
|
@ -371,11 +371,7 @@ public class CoreDOMImplementationImpl
|
||||
// to restrict the number of validation handlers being
|
||||
// requested
|
||||
if(freeValidatorIndex < 0) {
|
||||
return (RevalidationHandler) (ObjectFactory
|
||||
.newInstance(
|
||||
"com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator",
|
||||
ObjectFactory.findClassLoader(),
|
||||
true));
|
||||
return new com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator();
|
||||
}
|
||||
// return first available validator
|
||||
RevalidationHandler val = validators[freeValidatorIndex];
|
||||
@ -384,11 +380,7 @@ public class CoreDOMImplementationImpl
|
||||
}
|
||||
else if(schemaType == XMLGrammarDescription.XML_DTD) {
|
||||
if(freeDTDValidatorIndex < 0) {
|
||||
return (RevalidationHandler) (ObjectFactory
|
||||
.newInstance(
|
||||
"com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator",
|
||||
ObjectFactory.findClassLoader(),
|
||||
true));
|
||||
return new com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator();
|
||||
}
|
||||
// return first available validator
|
||||
RevalidationHandler val = dtdValidators[freeDTDValidatorIndex];
|
||||
|
@ -638,7 +638,7 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
// set preference for redirection
|
||||
followRedirects = httpInputSource.getFollowHTTPRedirects();
|
||||
if (!followRedirects) {
|
||||
setInstanceFollowRedirects(urlConnection, followRedirects);
|
||||
urlConnection.setInstanceFollowRedirects(followRedirects);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2192,20 +2192,6 @@ public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
|
||||
|
||||
} // expandSystemIdStrictOn(String,String):String
|
||||
|
||||
/**
|
||||
* Attempt to set whether redirects will be followed for an <code>HttpURLConnection</code>.
|
||||
* This may fail on earlier JDKs which do not support setting this preference.
|
||||
*/
|
||||
public static void setInstanceFollowRedirects(HttpURLConnection urlCon, boolean followRedirects) {
|
||||
try {
|
||||
Method method = HttpURLConnection.class.getMethod("setInstanceFollowRedirects", new Class[] {Boolean.TYPE});
|
||||
method.invoke(urlCon, new Object[] {followRedirects ? Boolean.TRUE : Boolean.FALSE});
|
||||
}
|
||||
// setInstanceFollowRedirects doesn't exist.
|
||||
catch (Exception exc) {}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Helper method for expandSystemId(String,String,boolean):String
|
||||
*/
|
||||
|
@ -845,13 +845,7 @@ public class DOMUtil {
|
||||
*/
|
||||
public static DOMException createDOMException(short code, Throwable cause) {
|
||||
DOMException de = new DOMException(code, cause != null ? cause.getMessage() : null);
|
||||
if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
|
||||
try {
|
||||
ThrowableMethods.fgThrowableInitCauseMethod.invoke(de, new Object [] {cause});
|
||||
}
|
||||
// Something went wrong. There's not much we can do about it.
|
||||
catch (Exception e) {}
|
||||
}
|
||||
if (cause != null) de.initCause(cause);
|
||||
return de;
|
||||
}
|
||||
|
||||
@ -860,42 +854,8 @@ public class DOMUtil {
|
||||
*/
|
||||
public static LSException createLSException(short code, Throwable cause) {
|
||||
LSException lse = new LSException(code, cause != null ? cause.getMessage() : null);
|
||||
if (cause != null && ThrowableMethods.fgThrowableMethodsAvailable) {
|
||||
try {
|
||||
ThrowableMethods.fgThrowableInitCauseMethod.invoke(lse, new Object [] {cause});
|
||||
}
|
||||
// Something went wrong. There's not much we can do about it.
|
||||
catch (Exception e) {}
|
||||
}
|
||||
if (cause != null) lse.initCause(cause);
|
||||
return lse;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder of methods from java.lang.Throwable.
|
||||
*/
|
||||
static class ThrowableMethods {
|
||||
|
||||
// Method: java.lang.Throwable.initCause(java.lang.Throwable)
|
||||
private static java.lang.reflect.Method fgThrowableInitCauseMethod = null;
|
||||
|
||||
// Flag indicating whether or not Throwable methods available.
|
||||
private static boolean fgThrowableMethodsAvailable = false;
|
||||
|
||||
private ThrowableMethods() {}
|
||||
|
||||
// Attempt to get methods for java.lang.Throwable on class initialization.
|
||||
static {
|
||||
try {
|
||||
fgThrowableInitCauseMethod = Throwable.class.getMethod("initCause", new Class [] {Throwable.class});
|
||||
fgThrowableMethodsAvailable = true;
|
||||
}
|
||||
// ClassNotFoundException, NoSuchMethodException or SecurityException
|
||||
// Whatever the case, we cannot use java.lang.Throwable.initCause(java.lang.Throwable).
|
||||
catch (Exception exc) {
|
||||
fgThrowableInitCauseMethod = null;
|
||||
fgThrowableMethodsAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // class DOMUtil
|
||||
|
@ -140,7 +140,7 @@ public class XIncludeTextReader {
|
||||
// set preference for redirection
|
||||
boolean followRedirects = httpInputSource.getFollowHTTPRedirects();
|
||||
if (!followRedirects) {
|
||||
XMLEntityManager.setInstanceFollowRedirects(urlConnection, followRedirects);
|
||||
urlConnection.setInstanceFollowRedirects(followRedirects);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -323,63 +323,5 @@ public class DTMException extends RuntimeException {
|
||||
super.printStackTrace(s);
|
||||
} catch (Throwable e) {}
|
||||
|
||||
boolean isJdk14OrHigher = false;
|
||||
try {
|
||||
Throwable.class.getMethod("getCause", (Class[]) null);
|
||||
isJdk14OrHigher = true;
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
// The printStackTrace method of the Throwable class in jdk 1.4
|
||||
// and higher will include the cause when printing the backtrace.
|
||||
// The following code is only required when using jdk 1.3 or lower
|
||||
if (!isJdk14OrHigher) {
|
||||
Throwable exception = getException();
|
||||
|
||||
for (int i = 0; (i < 10) && (null != exception); i++) {
|
||||
s.println("---------");
|
||||
|
||||
try {
|
||||
if (exception instanceof DTMException) {
|
||||
String locInfo =
|
||||
((DTMException) exception)
|
||||
.getLocationAsString();
|
||||
|
||||
if (null != locInfo) {
|
||||
s.println(locInfo);
|
||||
}
|
||||
}
|
||||
|
||||
exception.printStackTrace(s);
|
||||
} catch (Throwable e) {
|
||||
s.println("Could not print stack trace...");
|
||||
}
|
||||
|
||||
try {
|
||||
Method meth =
|
||||
((Object) exception).getClass().getMethod("getException",
|
||||
(Class[]) null);
|
||||
|
||||
if (null != meth) {
|
||||
Throwable prev = exception;
|
||||
|
||||
exception = (Throwable) meth.invoke(exception, (Object[]) null);
|
||||
|
||||
if (prev == exception) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
exception = null;
|
||||
}
|
||||
} catch (InvocationTargetException ite) {
|
||||
exception = null;
|
||||
} catch (IllegalAccessException iae) {
|
||||
exception = null;
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
exception = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -348,8 +348,7 @@ public class DTMManagerDefault extends DTMManager
|
||||
if (haveXercesParser) {
|
||||
// IncrementalSAXSource_Xerces to avoid threading.
|
||||
try {
|
||||
coParser =(IncrementalSAXSource)
|
||||
Class.forName("com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Xerces").newInstance();
|
||||
coParser = new com.sun.org.apache.xml.internal.dtm.ref.IncrementalSAXSource_Xerces();
|
||||
} catch( Exception ex ) {
|
||||
ex.printStackTrace();
|
||||
coParser=null;
|
||||
|
@ -87,6 +87,9 @@ public class IncrementalSAXSource_Xerces
|
||||
{
|
||||
try
|
||||
{
|
||||
// This should be cleaned up and the use of reflection
|
||||
// removed - see JDK-8129880
|
||||
|
||||
// Xerces-2 incremental parsing support (as of Beta 3)
|
||||
// ContentHandlers still get set on fIncrementalParser (to get
|
||||
// conversion from XNI events to SAX events), but
|
||||
|
@ -233,7 +233,13 @@ public class SAXCatalogReader implements CatalogReader, ContentHandler, Document
|
||||
}
|
||||
parser.parse(new InputSource(is), spHandler);
|
||||
} else {
|
||||
Parser parser = (Parser) ReflectUtil.forName(parserClass).newInstance();
|
||||
Class<?> c = ReflectUtil.forName(parserClass);
|
||||
if (!Parser.class.isAssignableFrom(c)) {
|
||||
throw new ClassCastException(parserClass
|
||||
+ " cannot be cast to "
|
||||
+ Parser.class.getName());
|
||||
}
|
||||
Parser parser = (Parser) c.newInstance();
|
||||
parser.setDocumentHandler(this);
|
||||
if (bResolver != null) {
|
||||
parser.setEntityResolver(bResolver);
|
||||
|
@ -1220,37 +1220,13 @@ public abstract class BaseMarkupSerializer
|
||||
if ( internal != null && internal.length() > 0 )
|
||||
_printer.printText( internal );
|
||||
endDTD();
|
||||
}
|
||||
// DOM Level 1 -- does implementation have methods?
|
||||
catch (NoSuchMethodError nsme) {
|
||||
Class docTypeClass = docType.getClass();
|
||||
|
||||
String docTypePublicId = null;
|
||||
String docTypeSystemId = null;
|
||||
try {
|
||||
java.lang.reflect.Method getPublicId = docTypeClass.getMethod("getPublicId", (Class[]) null);
|
||||
if (getPublicId.getReturnType().equals(String.class)) {
|
||||
docTypePublicId = (String)getPublicId.invoke(docType, (Object[]) null);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
try {
|
||||
java.lang.reflect.Method getSystemId = docTypeClass.getMethod("getSystemId", (Class[]) null);
|
||||
if (getSystemId.getReturnType().equals(String.class)) {
|
||||
docTypeSystemId = (String)getSystemId.invoke(docType, (Object[]) null);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
_printer.enterDTD();
|
||||
_docTypePublicId = docTypePublicId;
|
||||
_docTypeSystemId = docTypeSystemId;
|
||||
_docTypePublicId = null;
|
||||
_docTypeSystemId = null;
|
||||
endDTD();
|
||||
}
|
||||
|
||||
serializeDTD(docType.getName());
|
||||
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ import org.w3c.dom.Element;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.ProcessingInstruction;
|
||||
import org.w3c.dom.Text;
|
||||
import org.w3c.dom.ls.LSException;
|
||||
import org.w3c.dom.ls.LSOutput;
|
||||
import org.w3c.dom.ls.LSSerializer;
|
||||
@ -1030,15 +1029,12 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||
private String _getXmlVersion(Node node) {
|
||||
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
||||
? (Document) node : node.getOwnerDocument();
|
||||
if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
|
||||
if (doc != null) {
|
||||
try {
|
||||
return (String) DocumentMethods.fgDocumentGetXmlVersionMethod.invoke(doc, (Object[]) null);
|
||||
return doc.getXmlVersion();
|
||||
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
||||
catch (VirtualMachineError vme) {
|
||||
catch (VirtualMachineError | ThreadDeath vme) {
|
||||
throw vme;
|
||||
} // ThreadDeath should always be re-thrown
|
||||
catch (ThreadDeath td) {
|
||||
throw td;
|
||||
} // Ignore all other exceptions and errors
|
||||
catch (Throwable t) {
|
||||
}
|
||||
@ -1049,15 +1045,12 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||
private String _getInputEncoding(Node node) {
|
||||
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
||||
? (Document) node : node.getOwnerDocument();
|
||||
if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
|
||||
if (doc != null) {
|
||||
try {
|
||||
return (String) DocumentMethods.fgDocumentGetInputEncodingMethod.invoke(doc, (Object[]) null);
|
||||
return doc.getInputEncoding();
|
||||
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
||||
catch (VirtualMachineError vme) {
|
||||
catch (VirtualMachineError | ThreadDeath vme) {
|
||||
throw vme;
|
||||
} // ThreadDeath should always be re-thrown
|
||||
catch (ThreadDeath td) {
|
||||
throw td;
|
||||
} // Ignore all other exceptions and errors
|
||||
catch (Throwable t) {
|
||||
}
|
||||
@ -1068,15 +1061,12 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||
private String _getXmlEncoding(Node node) {
|
||||
Document doc = (node.getNodeType() == Node.DOCUMENT_NODE)
|
||||
? (Document) node : node.getOwnerDocument();
|
||||
if (doc != null && DocumentMethods.fgDocumentMethodsAvailable) {
|
||||
if (doc != null) {
|
||||
try {
|
||||
return (String) DocumentMethods.fgDocumentGetXmlEncodingMethod.invoke(doc, (Object[]) null);
|
||||
return doc.getXmlEncoding();
|
||||
} // The VM ran out of memory or there was some other serious problem. Re-throw.
|
||||
catch (VirtualMachineError vme) {
|
||||
catch (VirtualMachineError | ThreadDeath vme) {
|
||||
throw vme;
|
||||
} // ThreadDeath should always be re-thrown
|
||||
catch (ThreadDeath td) {
|
||||
throw td;
|
||||
} // Ignore all other exceptions and errors
|
||||
catch (Throwable t) {
|
||||
}
|
||||
@ -1084,42 +1074,4 @@ public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder of DOM Level 3 methods from org.w3c.dom.Document.
|
||||
*/
|
||||
static class DocumentMethods {
|
||||
|
||||
// Method: org.w3c.dom.Document.getXmlVersion()
|
||||
private static java.lang.reflect.Method fgDocumentGetXmlVersionMethod = null;
|
||||
|
||||
// Method: org.w3c.dom.Document.getInputEncoding()
|
||||
private static java.lang.reflect.Method fgDocumentGetInputEncodingMethod = null;
|
||||
|
||||
// Method: org.w3c.dom.Document.getXmlEncoding()
|
||||
private static java.lang.reflect.Method fgDocumentGetXmlEncodingMethod = null;
|
||||
|
||||
// Flag indicating whether or not Document methods are available.
|
||||
private static boolean fgDocumentMethodsAvailable = false;
|
||||
|
||||
private DocumentMethods() {
|
||||
}
|
||||
|
||||
// Attempt to get methods for org.w3c.dom.Document on class initialization.
|
||||
static {
|
||||
try {
|
||||
fgDocumentGetXmlVersionMethod = Document.class.getMethod("getXmlVersion", new Class[]{});
|
||||
fgDocumentGetInputEncodingMethod = Document.class.getMethod("getInputEncoding", new Class[]{});
|
||||
fgDocumentGetXmlEncodingMethod = Document.class.getMethod("getXmlEncoding", new Class[]{});
|
||||
fgDocumentMethodsAvailable = true;
|
||||
} // ClassNotFoundException, NoSuchMethodException or SecurityException
|
||||
// Whatever the case, we cannot retrieve the methods.
|
||||
catch (Exception exc) {
|
||||
fgDocumentGetXmlVersionMethod = null;
|
||||
fgDocumentGetInputEncodingMethod = null;
|
||||
fgDocumentGetXmlEncodingMethod = null;
|
||||
fgDocumentMethodsAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} //DOMSerializerImpl
|
||||
|
@ -26,6 +26,8 @@ import java.io.OutputStreamWriter;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.io.Writer;
|
||||
import com.sun.org.apache.xerces.internal.util.EncodingMap;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
/**
|
||||
* This class represents an encoding.
|
||||
@ -37,9 +39,6 @@ import com.sun.org.apache.xerces.internal.util.EncodingMap;
|
||||
*/
|
||||
public class EncodingInfo {
|
||||
|
||||
// An array to hold the argument for a method of Charset, CharsetEncoder or CharToByteConverter.
|
||||
private Object [] fArgsForMethod = null;
|
||||
|
||||
// name of encoding as registered with IANA;
|
||||
// preferably a MIME name, but aliases are fine too.
|
||||
String ianaName;
|
||||
@ -47,15 +46,7 @@ public class EncodingInfo {
|
||||
int lastPrintable;
|
||||
|
||||
// The CharsetEncoder with which we test unusual characters.
|
||||
Object fCharsetEncoder = null;
|
||||
|
||||
// The CharToByteConverter with which we test unusual characters.
|
||||
Object fCharToByteConverter = null;
|
||||
|
||||
// Is the converter null because it can't be instantiated
|
||||
// for some reason (perhaps we're running with insufficient authority as
|
||||
// an applet?
|
||||
boolean fHaveTriedCToB = false;
|
||||
CharsetEncoder fCharsetEncoder = null;
|
||||
|
||||
// Is the charset encoder usable or available.
|
||||
boolean fHaveTriedCharsetEncoder = false;
|
||||
@ -118,16 +109,12 @@ public class EncodingInfo {
|
||||
private boolean isPrintable0(char ch) {
|
||||
|
||||
// Attempt to get a CharsetEncoder for this encoding.
|
||||
if (fCharsetEncoder == null && CharsetMethods.fgNIOCharsetAvailable && !fHaveTriedCharsetEncoder) {
|
||||
if (fArgsForMethod == null) {
|
||||
fArgsForMethod = new Object [1];
|
||||
}
|
||||
if (fCharsetEncoder == null && !fHaveTriedCharsetEncoder) {
|
||||
// try and create the CharsetEncoder
|
||||
try {
|
||||
fArgsForMethod[0] = javaName;
|
||||
Object charset = CharsetMethods.fgCharsetForNameMethod.invoke(null, fArgsForMethod);
|
||||
if (((Boolean) CharsetMethods.fgCharsetCanEncodeMethod.invoke(charset, (Object[]) null)).booleanValue()) {
|
||||
fCharsetEncoder = CharsetMethods.fgCharsetNewEncoderMethod.invoke(charset, (Object[]) null);
|
||||
Charset charset = java.nio.charset.Charset.forName(javaName);
|
||||
if (charset.canEncode()) {
|
||||
fCharsetEncoder = charset.newEncoder();
|
||||
}
|
||||
// This charset cannot be used for encoding, don't try it again...
|
||||
else {
|
||||
@ -142,8 +129,7 @@ public class EncodingInfo {
|
||||
// Attempt to use the CharsetEncoder to determine whether the character is printable.
|
||||
if (fCharsetEncoder != null) {
|
||||
try {
|
||||
fArgsForMethod[0] = new Character(ch);
|
||||
return ((Boolean) CharsetMethods.fgCharsetEncoderCanEncodeMethod.invoke(fCharsetEncoder, fArgsForMethod)).booleanValue();
|
||||
return fCharsetEncoder.canEncode(ch);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// obviously can't use this charset encoder; possibly a JDK bug
|
||||
@ -152,39 +138,7 @@ public class EncodingInfo {
|
||||
}
|
||||
}
|
||||
|
||||
// As a last resort try to use a sun.io.CharToByteConverter to
|
||||
// determine whether this character is printable. We will always
|
||||
// reach here on JDK 1.3 or below.
|
||||
if (fCharToByteConverter == null) {
|
||||
if (fHaveTriedCToB || !CharToByteConverterMethods.fgConvertersAvailable) {
|
||||
// forget it; nothing we can do...
|
||||
return false;
|
||||
}
|
||||
if (fArgsForMethod == null) {
|
||||
fArgsForMethod = new Object [1];
|
||||
}
|
||||
// try and create the CharToByteConverter
|
||||
try {
|
||||
fArgsForMethod[0] = javaName;
|
||||
fCharToByteConverter = CharToByteConverterMethods.fgGetConverterMethod.invoke(null, fArgsForMethod);
|
||||
}
|
||||
catch (Exception e) {
|
||||
// don't try it again...
|
||||
fHaveTriedCToB = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
try {
|
||||
fArgsForMethod[0] = new Character(ch);
|
||||
return ((Boolean) CharToByteConverterMethods.fgCanConvertMethod.invoke(fCharToByteConverter, fArgsForMethod)).booleanValue();
|
||||
}
|
||||
catch (Exception e) {
|
||||
// obviously can't use this converter; probably some kind of
|
||||
// security restriction
|
||||
fCharToByteConverter = null;
|
||||
fHaveTriedCToB = false;
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// is this an encoding name recognized by this JDK?
|
||||
@ -194,82 +148,4 @@ public class EncodingInfo {
|
||||
String s = new String(bTest, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder of methods from java.nio.charset.Charset and java.nio.charset.CharsetEncoder.
|
||||
*/
|
||||
static class CharsetMethods {
|
||||
|
||||
// Method: java.nio.charset.Charset.forName(java.lang.String)
|
||||
private static java.lang.reflect.Method fgCharsetForNameMethod = null;
|
||||
|
||||
// Method: java.nio.charset.Charset.canEncode()
|
||||
private static java.lang.reflect.Method fgCharsetCanEncodeMethod = null;
|
||||
|
||||
// Method: java.nio.charset.Charset.newEncoder()
|
||||
private static java.lang.reflect.Method fgCharsetNewEncoderMethod = null;
|
||||
|
||||
// Method: java.nio.charset.CharsetEncoder.canEncode(char)
|
||||
private static java.lang.reflect.Method fgCharsetEncoderCanEncodeMethod = null;
|
||||
|
||||
// Flag indicating whether or not java.nio.charset.* is available.
|
||||
private static boolean fgNIOCharsetAvailable = false;
|
||||
|
||||
private CharsetMethods() {}
|
||||
|
||||
// Attempt to get methods for Charset and CharsetEncoder on class initialization.
|
||||
static {
|
||||
try {
|
||||
Class charsetClass = Class.forName("java.nio.charset.Charset");
|
||||
Class charsetEncoderClass = Class.forName("java.nio.charset.CharsetEncoder");
|
||||
fgCharsetForNameMethod = charsetClass.getMethod("forName", new Class [] {String.class});
|
||||
fgCharsetCanEncodeMethod = charsetClass.getMethod("canEncode", new Class [] {});
|
||||
fgCharsetNewEncoderMethod = charsetClass.getMethod("newEncoder", new Class [] {});
|
||||
fgCharsetEncoderCanEncodeMethod = charsetEncoderClass.getMethod("canEncode", new Class [] {Character.TYPE});
|
||||
fgNIOCharsetAvailable = true;
|
||||
}
|
||||
// ClassNotFoundException, NoSuchMethodException or SecurityException
|
||||
// Whatever the case, we cannot use java.nio.charset.*.
|
||||
catch (Exception exc) {
|
||||
fgCharsetForNameMethod = null;
|
||||
fgCharsetCanEncodeMethod = null;
|
||||
fgCharsetEncoderCanEncodeMethod = null;
|
||||
fgCharsetNewEncoderMethod = null;
|
||||
fgNIOCharsetAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Holder of methods from sun.io.CharToByteConverter.
|
||||
*/
|
||||
static class CharToByteConverterMethods {
|
||||
|
||||
// Method: sun.io.CharToByteConverter.getConverter(java.lang.String)
|
||||
private static java.lang.reflect.Method fgGetConverterMethod = null;
|
||||
|
||||
// Method: sun.io.CharToByteConverter.canConvert(char)
|
||||
private static java.lang.reflect.Method fgCanConvertMethod = null;
|
||||
|
||||
// Flag indicating whether or not sun.io.CharToByteConverter is available.
|
||||
private static boolean fgConvertersAvailable = false;
|
||||
|
||||
private CharToByteConverterMethods() {}
|
||||
|
||||
// Attempt to get methods for char to byte converter on class initialization.
|
||||
static {
|
||||
try {
|
||||
Class clazz = Class.forName("sun.io.CharToByteConverter");
|
||||
fgGetConverterMethod = clazz.getMethod("getConverter", new Class [] {String.class});
|
||||
fgCanConvertMethod = clazz.getMethod("canConvert", new Class [] {Character.TYPE});
|
||||
fgConvertersAvailable = true;
|
||||
}
|
||||
// ClassNotFoundException, NoSuchMethodException or SecurityException
|
||||
// Whatever the case, we cannot use sun.io.CharToByteConverter.
|
||||
catch (Exception exc) {
|
||||
fgGetConverterMethod = null;
|
||||
fgCanConvertMethod = null;
|
||||
fgConvertersAvailable = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -378,6 +378,12 @@ public class FunctionTable
|
||||
int funcIndex;
|
||||
Object funcIndexObj = getFunctionID(name);
|
||||
|
||||
if (func != null && !Function.class.isAssignableFrom(func)) {
|
||||
throw new ClassCastException(func.getName()
|
||||
+ " cannot be cast to "
|
||||
+ Function.class.getName());
|
||||
}
|
||||
|
||||
if (null != funcIndexObj)
|
||||
{
|
||||
funcIndex = ((Integer) funcIndexObj).intValue();
|
||||
|
@ -64,7 +64,6 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
private Node currentNode = null;
|
||||
private Node node = null;
|
||||
private NamespaceSupport namespaceContext = null;
|
||||
private Method mXmlVersion = null;
|
||||
private boolean [] needContextPop = null;
|
||||
private StringBuffer stringBuffer = null;
|
||||
private int resizeValue = 20;
|
||||
@ -83,25 +82,11 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
ownerDoc = node.getOwnerDocument();
|
||||
currentNode = node;
|
||||
}
|
||||
getDLThreeMethods();
|
||||
stringBuffer = new StringBuffer();
|
||||
needContextPop = new boolean[resizeValue];
|
||||
namespaceContext = new NamespaceSupport();
|
||||
}
|
||||
|
||||
private void getDLThreeMethods(){
|
||||
try{
|
||||
mXmlVersion = ownerDoc.getClass().getMethod("setXmlVersion",new Class[] {String.class});
|
||||
}catch(NoSuchMethodException mex){
|
||||
//log these errors at fine level.
|
||||
mXmlVersion = null;
|
||||
}catch(SecurityException se){
|
||||
//log these errors at fine level.
|
||||
mXmlVersion = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This method has no effect when called.
|
||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||
@ -557,15 +542,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||
*/
|
||||
public void writeStartDocument() throws XMLStreamException {
|
||||
try{
|
||||
if(mXmlVersion != null){
|
||||
mXmlVersion.invoke(ownerDoc, new Object[] {"1.0"});
|
||||
}
|
||||
}catch(IllegalAccessException iae){
|
||||
throw new XMLStreamException(iae);
|
||||
}catch(InvocationTargetException ite){
|
||||
throw new XMLStreamException(ite);
|
||||
}
|
||||
ownerDoc.setXmlVersion("1.0");
|
||||
}
|
||||
|
||||
/**
|
||||
@ -575,15 +552,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||
*/
|
||||
public void writeStartDocument(String version) throws XMLStreamException {
|
||||
try{
|
||||
if(mXmlVersion != null){
|
||||
mXmlVersion.invoke(ownerDoc, new Object[] {version});
|
||||
}
|
||||
}catch(IllegalAccessException iae){
|
||||
throw new XMLStreamException(iae);
|
||||
}catch(InvocationTargetException ite){
|
||||
throw new XMLStreamException(ite);
|
||||
}
|
||||
ownerDoc.setXmlVersion(version);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -594,15 +563,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriter {
|
||||
* @throws javax.xml.stream.XMLStreamException {@inheritDoc}
|
||||
*/
|
||||
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
|
||||
try{
|
||||
if(mXmlVersion != null){
|
||||
mXmlVersion.invoke(ownerDoc, new Object[] {version});
|
||||
}
|
||||
}catch(IllegalAccessException iae){
|
||||
throw new XMLStreamException(iae);
|
||||
}catch(InvocationTargetException ite){
|
||||
throw new XMLStreamException(ite);
|
||||
}
|
||||
ownerDoc.setXmlVersion(version);
|
||||
//TODO: What to do with encoding.-Venu
|
||||
}
|
||||
|
||||
|
@ -110,6 +110,12 @@ public class TransformerException extends Exception {
|
||||
*/
|
||||
public synchronized Throwable initCause(Throwable cause) {
|
||||
|
||||
// TransformerException doesn't set its cause (probably
|
||||
// because it predates initCause()) - and we may not want
|
||||
// to change this since Exceptions are serializable...
|
||||
// But this also leads to the broken code in printStackTrace
|
||||
// below...
|
||||
|
||||
if (this.containedException != null) {
|
||||
throw new IllegalStateException("Can't overwrite cause");
|
||||
}
|
||||
@ -312,61 +318,57 @@ public class TransformerException extends Exception {
|
||||
}
|
||||
|
||||
try {
|
||||
String locInfo = getLocationAsString();
|
||||
|
||||
if (null != locInfo) {
|
||||
s.println(locInfo);
|
||||
}
|
||||
|
||||
super.printStackTrace(s);
|
||||
} catch (Throwable e) {}
|
||||
|
||||
Throwable exception = getException();
|
||||
|
||||
for (int i = 0; (i < 10) && (null != exception); i++) {
|
||||
s.println("---------");
|
||||
|
||||
try {
|
||||
if (exception instanceof TransformerException) {
|
||||
String locInfo =
|
||||
((TransformerException) exception)
|
||||
.getLocationAsString();
|
||||
String locInfo = getLocationAsString();
|
||||
|
||||
if (null != locInfo) {
|
||||
s.println(locInfo);
|
||||
}
|
||||
if (null != locInfo) {
|
||||
s.println(locInfo);
|
||||
}
|
||||
|
||||
exception.printStackTrace(s);
|
||||
} catch (Throwable e) {
|
||||
s.println("Could not print stack trace...");
|
||||
}
|
||||
super.printStackTrace(s);
|
||||
} catch (Throwable e) {}
|
||||
|
||||
try {
|
||||
Method meth =
|
||||
((Object) exception).getClass().getMethod("getException",
|
||||
(Class[]) null);
|
||||
Throwable exception = getException();
|
||||
|
||||
if (null != meth) {
|
||||
Throwable prev = exception;
|
||||
for (int i = 0; (i < 10) && (null != exception); i++) {
|
||||
s.println("---------");
|
||||
|
||||
exception = (Throwable) meth.invoke(exception, (Object[]) null);
|
||||
try {
|
||||
exception.printStackTrace(s);
|
||||
// if exception is a TransformerException it will print
|
||||
// its contained exception, so we don't need to redo it here,
|
||||
// and we can exit the loop now.
|
||||
if (exception instanceof TransformerException) break;
|
||||
} catch (Throwable e) {
|
||||
s.println("Could not print stack trace...");
|
||||
}
|
||||
|
||||
if (prev == exception) {
|
||||
break;
|
||||
try {
|
||||
// Is this still needed?
|
||||
Method meth = exception.getClass().getMethod("getException");
|
||||
|
||||
if (null != meth) {
|
||||
Throwable prev = exception;
|
||||
|
||||
exception = (Throwable) meth.invoke(exception, (Object[]) null);
|
||||
|
||||
if (prev == exception) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
exception = null;
|
||||
}
|
||||
} else {
|
||||
} catch (InvocationTargetException ite) {
|
||||
exception = null;
|
||||
} catch (IllegalAccessException iae) {
|
||||
exception = null;
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
exception = null;
|
||||
}
|
||||
} catch (InvocationTargetException ite) {
|
||||
exception = null;
|
||||
} catch (IllegalAccessException iae) {
|
||||
exception = null;
|
||||
} catch (NoSuchMethodException nsme) {
|
||||
exception = null;
|
||||
}
|
||||
} finally {
|
||||
// ensure output is written
|
||||
s.flush();
|
||||
}
|
||||
// insure output is written
|
||||
s.flush();
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ package javax.xml.validation;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
@ -41,13 +41,10 @@ class SecuritySupport {
|
||||
|
||||
ClassLoader getContextClassLoader() {
|
||||
return
|
||||
AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public ClassLoader run() {
|
||||
ClassLoader cl = null;
|
||||
//try {
|
||||
cl = Thread.currentThread().getContextClassLoader();
|
||||
//} catch (SecurityException ex) { }
|
||||
ClassLoader cl = Thread.currentThread().getContextClassLoader();
|
||||
if (cl == null)
|
||||
cl = ClassLoader.getSystemClassLoader();
|
||||
return cl;
|
||||
@ -56,7 +53,7 @@ class SecuritySupport {
|
||||
}
|
||||
|
||||
String getSystemProperty(final String propName) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty(propName);
|
||||
@ -69,7 +66,7 @@ class SecuritySupport {
|
||||
{
|
||||
try {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<FileInputStream>() {
|
||||
new PrivilegedExceptionAction<>() {
|
||||
@Override
|
||||
public FileInputStream run() throws FileNotFoundException {
|
||||
return new FileInputStream(file);
|
||||
@ -82,7 +79,7 @@ class SecuritySupport {
|
||||
|
||||
// Used for debugging purposes
|
||||
String getClassSource(Class<?> cls) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
CodeSource cs = cls.getProtectionDomain().getCodeSource();
|
||||
@ -97,7 +94,7 @@ class SecuritySupport {
|
||||
}
|
||||
|
||||
boolean doesFileExist(final File f) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Boolean run() {
|
||||
return f.exists();
|
||||
|
@ -40,7 +40,7 @@ class SecuritySupport {
|
||||
|
||||
|
||||
ClassLoader getContextClassLoader() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public ClassLoader run() {
|
||||
ClassLoader cl = null;
|
||||
@ -53,7 +53,7 @@ class SecuritySupport {
|
||||
}
|
||||
|
||||
String getSystemProperty(final String propName) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty(propName);
|
||||
@ -66,7 +66,7 @@ class SecuritySupport {
|
||||
{
|
||||
try {
|
||||
return AccessController.doPrivileged(
|
||||
new PrivilegedExceptionAction<FileInputStream>() {
|
||||
new PrivilegedExceptionAction<>() {
|
||||
@Override
|
||||
public FileInputStream run() throws FileNotFoundException {
|
||||
return new FileInputStream(file);
|
||||
@ -79,7 +79,7 @@ class SecuritySupport {
|
||||
|
||||
// Used for debugging purposes
|
||||
String getClassSource(Class<?> cls) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<String>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
CodeSource cs = cls.getProtectionDomain().getCodeSource();
|
||||
@ -94,7 +94,7 @@ class SecuritySupport {
|
||||
}
|
||||
|
||||
boolean doesFileExist(final File f) {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Boolean run() {
|
||||
return f.exists();
|
||||
|
@ -28,7 +28,6 @@ package javax.xml.xpath;
|
||||
import java.io.File;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.security.AccessControlContext;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
@ -333,59 +333,36 @@ public final class DOMImplementationRegistry {
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple JRE (Java Runtime Environment) 1.1 test
|
||||
*
|
||||
* @return <code>true</code> if JRE 1.1
|
||||
*/
|
||||
private static boolean isJRE11() {
|
||||
try {
|
||||
Class c = Class.forName("java.security.AccessController");
|
||||
// java.security.AccessController existed since 1.2 so, if no
|
||||
// exception was thrown, the DOM application is running in a JRE
|
||||
// 1.2 or higher
|
||||
return false;
|
||||
} catch (Exception ex) {
|
||||
// ignore
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the ContextClassLoader or <code>null</code> if
|
||||
* running in a JRE 1.1
|
||||
* This method returns the ContextClassLoader.
|
||||
*
|
||||
* @return The Context Classloader
|
||||
*/
|
||||
private static ClassLoader getContextClassLoader() {
|
||||
return isJRE11()
|
||||
? null
|
||||
: (ClassLoader)
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
ClassLoader classLoader = null;
|
||||
try {
|
||||
classLoader =
|
||||
Thread.currentThread().getContextClassLoader();
|
||||
} catch (SecurityException ex) {
|
||||
}
|
||||
return classLoader;
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public ClassLoader run() {
|
||||
ClassLoader classLoader = null;
|
||||
try {
|
||||
classLoader =
|
||||
Thread.currentThread().getContextClassLoader();
|
||||
} catch (SecurityException ex) {
|
||||
}
|
||||
});
|
||||
return classLoader;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the system property indicated by the specified name
|
||||
* after checking access control privileges. For a JRE 1.1, this check is
|
||||
* not done.
|
||||
* after checking access control privileges.
|
||||
*
|
||||
* @param name the name of the system property
|
||||
* @return the system property
|
||||
*/
|
||||
private static String getSystemProperty(final String name) {
|
||||
return isJRE11()
|
||||
? (String) System.getProperty(name)
|
||||
: (String) AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public String run() {
|
||||
return System.getProperty(name);
|
||||
}
|
||||
});
|
||||
@ -394,7 +371,7 @@ public final class DOMImplementationRegistry {
|
||||
/**
|
||||
* This method returns an Inputstream for the reading resource
|
||||
* META_INF/services/org.w3c.dom.DOMImplementationSourceList after checking
|
||||
* access control privileges. For a JRE 1.1, this check is not done.
|
||||
* access control privileges.
|
||||
*
|
||||
* @param classLoader classLoader
|
||||
* @param name the resource
|
||||
@ -402,28 +379,18 @@ public final class DOMImplementationRegistry {
|
||||
*/
|
||||
private static InputStream getResourceAsStream(final ClassLoader classLoader,
|
||||
final String name) {
|
||||
if (isJRE11()) {
|
||||
InputStream ris;
|
||||
if (classLoader == null) {
|
||||
ris = ClassLoader.getSystemResourceAsStream(name);
|
||||
} else {
|
||||
ris = classLoader.getResourceAsStream(name);
|
||||
}
|
||||
return ris;
|
||||
} else {
|
||||
return (InputStream)
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
public Object run() {
|
||||
InputStream ris;
|
||||
if (classLoader == null) {
|
||||
ris =
|
||||
ClassLoader.getSystemResourceAsStream(name);
|
||||
} else {
|
||||
ris = classLoader.getResourceAsStream(name);
|
||||
}
|
||||
return ris;
|
||||
}
|
||||
});
|
||||
}
|
||||
return AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public InputStream run() {
|
||||
InputStream ris;
|
||||
if (classLoader == null) {
|
||||
ris =
|
||||
ClassLoader.getSystemResourceAsStream(name);
|
||||
} else {
|
||||
ris = classLoader.getResourceAsStream(name);
|
||||
}
|
||||
return ris;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -316,3 +316,4 @@ c9785bc8ade98a16a050d7520b70c68363857e00 jdk9-b67
|
||||
b5878b03d1b2e105917d959fbfa3c57c22495803 jdk9-b68
|
||||
f5911c6155c29ac24b6f9068273207e5ebd3a3df jdk9-b69
|
||||
94084caa27a3c8a09a7510aef596ebd64e97c569 jdk9-b70
|
||||
61caeb7061bbf8cc74a767997e5d17cc00712629 jdk9-b71
|
||||
|
@ -42,7 +42,7 @@ public class MailcapTokenizer {
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @parameter inputString the string to tokenize
|
||||
* @param inputString the string to tokenize
|
||||
*/
|
||||
public MailcapTokenizer(String inputString) {
|
||||
data = inputString;
|
||||
@ -73,7 +73,7 @@ public class MailcapTokenizer {
|
||||
/**
|
||||
* Retrieve current token.
|
||||
*
|
||||
* @returns The current token value
|
||||
* @return The current token value
|
||||
*/
|
||||
public int getCurrentToken() {
|
||||
return currentToken;
|
||||
@ -115,7 +115,7 @@ public class MailcapTokenizer {
|
||||
/*
|
||||
* Retrieve current token value.
|
||||
*
|
||||
* @returns A String containing the current token value
|
||||
* @return A String containing the current token value
|
||||
*/
|
||||
public String getCurrentTokenValue() {
|
||||
return currentTokenValue;
|
||||
@ -123,7 +123,7 @@ public class MailcapTokenizer {
|
||||
/*
|
||||
* Process the next token.
|
||||
*
|
||||
* @returns the next token
|
||||
* @return the next token
|
||||
*/
|
||||
public int nextToken() {
|
||||
if (dataIndex < dataLength) {
|
||||
|
@ -34,8 +34,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* The <tt>JAXBContext</tt> class provides the client's entry point to the
|
||||
* 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.
|
||||
@ -62,16 +61,16 @@ import java.io.InputStream;
|
||||
* <p><i>
|
||||
* 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 <tt>jaxb.properties</tt> file in
|
||||
* 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 <tt>javax.xml.bind.context.factory</tt> whose
|
||||
* value is the name of the class that implements the <tt>createContext</tt>
|
||||
* contain a property named {@code javax.xml.bind.context.factory} whose
|
||||
* value is the name of the class that implements the {@code createContext}
|
||||
* APIs.</i>
|
||||
*
|
||||
* <p><i>
|
||||
* The class supplied by the provider does not have to be assignable to
|
||||
* <tt>javax.xml.bind.JAXBContext</tt>, it simply has to provide a class that
|
||||
* implements the <tt>createContext</tt> APIs.</i>
|
||||
* {@code javax.xml.bind.JAXBContext}, it simply has to provide a class that
|
||||
* implements the {@code createContext} APIs.</i>
|
||||
*
|
||||
* <p><i>
|
||||
* In addition, the provider must call the
|
||||
@ -91,13 +90,13 @@ import java.io.InputStream;
|
||||
* 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 <tt>JAXBContext</tt> object
|
||||
* The {@code JAXBContext} object
|
||||
* allows the merging of global elements and type definitions across a set of schemas (listed
|
||||
* in the <tt>contextPath</tt>). Since each schema in the schema set can belong
|
||||
* in the {@code contextPath}). Since each schema in the schema set can belong
|
||||
* to distinct namespaces, the unification of schemas to an unmarshalling
|
||||
* context should 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 <tt>contextPath</tt>. For example:
|
||||
* any of the schemas listed in the {@code contextPath}. For example:
|
||||
*
|
||||
* <pre>
|
||||
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo:com.acme.bar" );
|
||||
@ -114,12 +113,12 @@ import java.io.InputStream;
|
||||
* 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 <tt> ObjectFactory</tt> classes that exist in each of
|
||||
* java packages contained in the <tt>contextPath</tt>. For each schema
|
||||
* 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 <tt>com.acme.foo</tt>
|
||||
* that contains a schema derived interface named <tt>PurchaseOrder</tt>. In
|
||||
* 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:
|
||||
*
|
||||
@ -133,25 +132,25 @@ import java.io.InputStream;
|
||||
* it can use the mutator methods to set content on it.
|
||||
*
|
||||
* <p>
|
||||
* For more information on the generated <tt>ObjectFactory</tt> classes, see
|
||||
* For more information on the generated {@code ObjectFactory} classes, see
|
||||
* Section 4.2 <i>Java Package</i> of the specification.
|
||||
*
|
||||
* <p>
|
||||
* <i>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
|
||||
* <tt>newInstance( javaContentInterface )</tt> method</i>
|
||||
* {@code newInstance( javaContentInterface )} method</i>
|
||||
*
|
||||
* <h3>Marshalling</h3>
|
||||
* <p>
|
||||
* 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 <tt>unmarshal
|
||||
* </tt> operation. Clients can marshal a java content tree back to XML data
|
||||
* to a <tt>java.io.OutputStream</tt> or a <tt>java.io.Writer</tt>. The
|
||||
* 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 <tt>ContentHandler</tt> or produce a DOM Node object.
|
||||
* 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.
|
||||
@ -178,7 +177,7 @@ import java.io.InputStream;
|
||||
* 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 <tt>Validator</tt>
|
||||
* 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
|
||||
@ -192,8 +191,8 @@ import java.io.InputStream;
|
||||
* 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 (<tt>JAXBContext,
|
||||
* Marshaller</tt>, etc. ) from different providers. This does not
|
||||
* 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.
|
||||
@ -201,14 +200,14 @@ import java.io.InputStream;
|
||||
*
|
||||
* <h3>Discovery of JAXB implementation</h3>
|
||||
* <p>
|
||||
* When one of the <tt>newInstance</tt> methods is called, a JAXB implementation is discovered
|
||||
* When one of the {@code newInstance} methods is called, a JAXB implementation is discovered
|
||||
* by the following steps.
|
||||
*
|
||||
* <ol>
|
||||
*
|
||||
* <li>
|
||||
* For each package/class explicitly passed in to the {@link #newInstance} method, in the order they are specified,
|
||||
* <tt>jaxb.properties</tt> file is looked up in its package, by using the associated classloader —
|
||||
* {@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}.
|
||||
*
|
||||
@ -269,8 +268,6 @@ import java.io.InputStream;
|
||||
* {@link javax.xml.bind.JAXBContextFactory#createContext(Class[], java.util.Map)} is invoked
|
||||
* to create a {@link JAXBContext}.
|
||||
*
|
||||
* <p/>
|
||||
*
|
||||
* @apiNote
|
||||
* <p>Service discovery method using file /META-INF/services/javax.xml.bind.JAXBContext (described in step 4)
|
||||
* and leveraging provider's static methods is supported only to allow backwards compatibility, but it is strongly
|
||||
@ -294,7 +291,7 @@ public abstract class JAXBContext {
|
||||
|
||||
/**
|
||||
* The name of the property that contains the name of the class capable
|
||||
* of creating new <tt>JAXBContext</tt> objects.
|
||||
* of creating new {@code JAXBContext} objects.
|
||||
*/
|
||||
public static final String JAXB_CONTEXT_FACTORY = "javax.xml.bind.JAXBContextFactory";
|
||||
|
||||
@ -303,8 +300,7 @@ public abstract class JAXBContext {
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* This is a convenience method to invoke the
|
||||
@ -312,7 +308,7 @@ public abstract class JAXBContext {
|
||||
* the context class loader of the current thread.
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt> such as
|
||||
* {@code JAXBContext} such as
|
||||
* <ol>
|
||||
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
@ -328,8 +324,7 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* The client application must supply a context path which is a list of
|
||||
@ -340,7 +335,7 @@ public abstract class JAXBContext {
|
||||
* ObjectFactory.class generated per package.
|
||||
* Alternatively than being listed in the context path, programmer
|
||||
* annotated JAXB mapped classes can be listed in a
|
||||
* <tt>jaxb.index</tt> resource file, format described below.
|
||||
* {@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,
|
||||
@ -349,7 +344,7 @@ public abstract class JAXBContext {
|
||||
*
|
||||
* <p>
|
||||
* Every package listed on the contextPath must meet <b>one or both</b> of the
|
||||
* following conditions otherwise a <tt>JAXBException</tt> will be thrown:
|
||||
* following conditions otherwise a {@code JAXBException} will be thrown:
|
||||
* </p>
|
||||
* <ol>
|
||||
* <li>it must contain ObjectFactory.class</li>
|
||||
@ -367,12 +362,12 @@ public abstract class JAXBContext {
|
||||
* are reachable, as defined in {@link #newInstance(Class...)}, from the
|
||||
* listed classes are also registered with JAXBContext.
|
||||
* <p>
|
||||
* Constraints on class name occuring in a <tt>jaxb.index</tt> file are:
|
||||
* Constraints on class name occuring in a {@code jaxb.index} file are:
|
||||
* <ul>
|
||||
* <li>Must not end with ".class".</li>
|
||||
* <li>Class names are resolved relative to package containing
|
||||
* <tt>jaxb.index</tt> file. Only classes occuring directly in package
|
||||
* containing <tt>jaxb.index</tt> file are allowed.</li>
|
||||
* {@code jaxb.index} file. Only classes occuring directly in package
|
||||
* containing {@code jaxb.index} file are allowed.</li>
|
||||
* <li>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.</li>
|
||||
@ -381,21 +376,21 @@ public abstract class JAXBContext {
|
||||
* <p>
|
||||
* To maintain compatibility with JAXB 1.0 schema to java
|
||||
* interface/implementation binding, enabled by schema customization
|
||||
* <tt>{@literal <jaxb:globalBindings valueClass="false">}</tt>,
|
||||
* {@code <jaxb:globalBindings valueClass="false">},
|
||||
* the JAXB provider will ensure that each package on the context path
|
||||
* has a <tt>jaxb.properties</tt> file which contains a value for the
|
||||
* <tt>javax.xml.bind.context.factory</tt> property and that all values
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* If there are any global XML element name collisions across the various
|
||||
* packages listed on the <tt>contextPath</tt>, a <tt>JAXBException</tt>
|
||||
* packages listed on the {@code contextPath}, a {@code JAXBException}
|
||||
* will be thrown.
|
||||
*
|
||||
* <p>
|
||||
* Mixing generated interface/impl bindings from multiple JAXB Providers
|
||||
* in the same context path may result in a <tt>JAXBException</tt>
|
||||
* in the same context path may result in a {@code JAXBException}
|
||||
* being thrown.
|
||||
*
|
||||
* <p>
|
||||
@ -408,9 +403,9 @@ public abstract class JAXBContext {
|
||||
* This class loader will be used to locate the implementation
|
||||
* classes.
|
||||
*
|
||||
* @return a new instance of a <tt>JAXBContext</tt>
|
||||
* @return a new instance of a {@code JAXBContext}
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt> such as
|
||||
* {@code JAXBContext} such as
|
||||
* <ol>
|
||||
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
@ -424,8 +419,7 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* This is mostly the same as {@link JAXBContext#newInstance(String, ClassLoader)},
|
||||
@ -434,7 +428,7 @@ public abstract class JAXBContext {
|
||||
*
|
||||
* <p>
|
||||
* The interpretation of properties is up to implementations. Implementations should
|
||||
* throw <tt>JAXBException</tt> if it finds properties that it doesn't understand.
|
||||
* throw {@code JAXBException} if it finds properties that it doesn't understand.
|
||||
*
|
||||
* @param contextPath list of java package names that contain schema derived classes
|
||||
* @param classLoader
|
||||
@ -443,9 +437,9 @@ public abstract class JAXBContext {
|
||||
* provider-specific properties. Can be null, which means the same thing as passing
|
||||
* in an empty map.
|
||||
*
|
||||
* @return a new instance of a <tt>JAXBContext</tt>
|
||||
* @return a new instance of a {@code JAXBContext}
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt> such as
|
||||
* {@code JAXBContext} such as
|
||||
* <ol>
|
||||
* <li>failure to locate either ObjectFactory.class or jaxb.index in the packages</li>
|
||||
* <li>an ambiguity among global elements contained in the contextPath</li>
|
||||
@ -472,8 +466,7 @@ public abstract class JAXBContext {
|
||||
|
||||
// TODO: resurrect this once we introduce external annotations
|
||||
// /**
|
||||
// * <p>
|
||||
// * Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
// * Create a new instance of a {@code JAXBContext} class.
|
||||
// *
|
||||
// * <p>
|
||||
// * The client application must supply a list of classes that the new
|
||||
@ -484,8 +477,8 @@ public abstract class JAXBContext {
|
||||
// * referenced statically from the specified classes.
|
||||
// *
|
||||
// * For example, in the following Java code, if you do
|
||||
// * <tt>newInstance(Foo.class)</tt>, the newly created {@link JAXBContext}
|
||||
// * will recognize both <tt>Foo</tt> and <tt>Bar</tt>, but not <tt>Zot</tt>:
|
||||
// * {@code newInstance(Foo.class)}, the newly created {@link JAXBContext}
|
||||
// * will recognize both {@code Foo} and {@code Bar}, but not {@code Zot}:
|
||||
// * <pre>
|
||||
// * class Foo {
|
||||
// * Bar b;
|
||||
@ -509,11 +502,11 @@ public abstract class JAXBContext {
|
||||
// * spec-defined classes will be returned.
|
||||
// *
|
||||
// * @return
|
||||
// * A new instance of a <tt>JAXBContext</tt>.
|
||||
// * A new instance of a {@code JAXBContext}.
|
||||
// *
|
||||
// * @throws JAXBException
|
||||
// * if an error was encountered while creating the
|
||||
// * <tt>JAXBContext</tt>, such as (but not limited to):
|
||||
// * {@code JAXBContext}, such as (but not limited to):
|
||||
// * <ol>
|
||||
// * <li>No JAXB implementation was discovered
|
||||
// * <li>Classes use JAXB annotations incorrectly
|
||||
@ -546,8 +539,7 @@ public abstract class JAXBContext {
|
||||
// }
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* The client application must supply a list of classes that the new
|
||||
@ -556,12 +548,12 @@ public abstract class JAXBContext {
|
||||
* 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 <tt>@XmlTransient</tt> referenced classes
|
||||
* referenced classes nor {@code @XmlTransient} referenced classes
|
||||
* are not registered with JAXBContext.
|
||||
*
|
||||
* For example, in the following Java code, if you do
|
||||
* <tt>newInstance(Foo.class)</tt>, the newly created {@link JAXBContext}
|
||||
* will recognize both <tt>Foo</tt> and <tt>Bar</tt>, but not <tt>Zot</tt> or <tt>FooBar</tt>:
|
||||
* {@code newInstance(Foo.class)}, the newly created {@link JAXBContext}
|
||||
* will recognize both {@code Foo} and {@code Bar}, but not {@code Zot} or {@code FooBar}:
|
||||
* <pre>
|
||||
* class Foo {
|
||||
* @XmlTransient FooBar c;
|
||||
@ -589,11 +581,11 @@ public abstract class JAXBContext {
|
||||
* spec-defined classes will be returned.
|
||||
*
|
||||
* @return
|
||||
* A new instance of a <tt>JAXBContext</tt>.
|
||||
* A new instance of a {@code JAXBContext}.
|
||||
*
|
||||
* @throws JAXBException
|
||||
* if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt>, such as (but not limited to):
|
||||
* {@code JAXBContext}, such as (but not limited to):
|
||||
* <ol>
|
||||
* <li>No JAXB implementation was discovered
|
||||
* <li>Classes use JAXB annotations incorrectly
|
||||
@ -615,8 +607,7 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Create a new instance of a <tt>JAXBContext</tt> class.
|
||||
* Create a new instance of a {@code JAXBContext} class.
|
||||
*
|
||||
* <p>
|
||||
* An overloading of {@link JAXBContext#newInstance(Class...)}
|
||||
@ -624,7 +615,7 @@ public abstract class JAXBContext {
|
||||
*
|
||||
* <p>
|
||||
* The interpretation of properties is up to implementations. Implementations should
|
||||
* throw <tt>JAXBException</tt> if it finds properties that it doesn't understand.
|
||||
* 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}.
|
||||
@ -635,11 +626,11 @@ public abstract class JAXBContext {
|
||||
* in an empty map.
|
||||
*
|
||||
* @return
|
||||
* A new instance of a <tt>JAXBContext</tt>.
|
||||
* A new instance of a {@code JAXBContext}.
|
||||
*
|
||||
* @throws JAXBException
|
||||
* if an error was encountered while creating the
|
||||
* <tt>JAXBContext</tt>, such as (but not limited to):
|
||||
* {@code JAXBContext}, such as (but not limited to):
|
||||
* <ol>
|
||||
* <li>No JAXB implementation was discovered
|
||||
* <li>Classes use JAXB annotations incorrectly
|
||||
@ -672,25 +663,25 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an <tt>Unmarshaller</tt> object that can be used to convert XML
|
||||
* Create an {@code Unmarshaller} object that can be used to convert XML
|
||||
* data into a java content tree.
|
||||
*
|
||||
* @return an <tt>Unmarshaller</tt> object
|
||||
* @return an {@code Unmarshaller} object
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>Unmarshaller</tt> object
|
||||
* {@code Unmarshaller} object
|
||||
*/
|
||||
public abstract Unmarshaller createUnmarshaller() throws JAXBException;
|
||||
|
||||
|
||||
/**
|
||||
* Create a <tt>Marshaller</tt> object that can be used to convert a
|
||||
* Create a {@code Marshaller} object that can be used to convert a
|
||||
* java content tree into XML data.
|
||||
*
|
||||
* @return a <tt>Marshaller</tt> object
|
||||
* @return a {@code Marshaller} object
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>Marshaller</tt> object
|
||||
* {@code Marshaller} object
|
||||
*/
|
||||
public abstract Marshaller createMarshaller() throws JAXBException;
|
||||
|
||||
@ -699,27 +690,27 @@ public abstract class JAXBContext {
|
||||
* {@link Validator} has been made optional and deprecated in JAXB 2.0. Please
|
||||
* refer to the javadoc for {@link Validator} for more detail.
|
||||
* <p>
|
||||
* Create a <tt>Validator</tt> object that can be used to validate a
|
||||
* Create a {@code Validator} object that can be used to validate a
|
||||
* java content tree against its source schema.
|
||||
*
|
||||
* @return a <tt>Validator</tt> object
|
||||
* @return a {@code Validator} object
|
||||
*
|
||||
* @throws JAXBException if an error was encountered while creating the
|
||||
* <tt>Validator</tt> object
|
||||
* {@code Validator} object
|
||||
* @deprecated since JAXB2.0
|
||||
*/
|
||||
public abstract Validator createValidator() throws JAXBException;
|
||||
|
||||
/**
|
||||
* Creates a <tt>Binder</tt> object that can be used for
|
||||
* 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 <tt>Binder</tt> object.
|
||||
* @return always a new valid {@code Binder} object.
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* if DOM API corresponding to <tt>domType</tt> is not supported by
|
||||
* if DOM API corresponding to {@code domType} is not supported by
|
||||
* the implementation.
|
||||
*
|
||||
* @since 1.6, JAXB 2.0
|
||||
@ -731,9 +722,9 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <tt>Binder</tt> for W3C DOM.
|
||||
* Creates a {@code Binder} for W3C DOM.
|
||||
*
|
||||
* @return always a new valid <tt>Binder</tt> object.
|
||||
* @return always a new valid {@code Binder} object.
|
||||
*
|
||||
* @since 1.6, JAXB 2.0
|
||||
*/
|
||||
@ -742,11 +733,11 @@ public abstract class JAXBContext {
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a <tt>JAXBIntrospector</tt> object that can be used to
|
||||
* Creates a {@code JAXBIntrospector} object that can be used to
|
||||
* introspect JAXB objects.
|
||||
*
|
||||
* @return
|
||||
* always return a non-null valid <tt>JAXBIntrospector</tt> object.
|
||||
* always return a non-null valid {@code JAXBIntrospector} object.
|
||||
*
|
||||
* @throws UnsupportedOperationException
|
||||
* Calling this method on JAXB 1.0 implementations will throw
|
||||
|
@ -239,7 +239,7 @@
|
||||
<ul>
|
||||
<li> For a property, a given annotation can be applied to
|
||||
either read or write property but not both. </li>
|
||||
|
||||
|
||||
<li> A property name must be different from any other
|
||||
property name in any of the super classes of the
|
||||
class being mapped. </li>
|
||||
@ -250,8 +250,8 @@
|
||||
<h3>Notations</h3>
|
||||
<b>Namespace prefixes</b>
|
||||
<p>The following namespace prefixes are used in the XML Schema
|
||||
fragments in this package.<p>
|
||||
|
||||
fragments in this package.
|
||||
|
||||
<table border="1" cellpadding="4" cellspacing="3">
|
||||
<tbody>
|
||||
<tr>
|
||||
|
@ -313,3 +313,4 @@ ed94f3e7ba6bbfec0772de6d24e39543e13f6d88 jdk9-b65
|
||||
046fd17bb9a0cdf6681124866df9626d17b0516a jdk9-b68
|
||||
551323004d0ce2f1d4b0e99552f7e0cdcebc6fca jdk9-b69
|
||||
a7f731125b7fb0e4b0186172f85a21e2d5139f7e jdk9-b70
|
||||
e47d3bfbc61accc3fbd372a674fdce2933b54f31 jdk9-b71
|
||||
|
@ -28,7 +28,7 @@ default: all
|
||||
include $(SPEC)
|
||||
include MakeBase.gmk
|
||||
|
||||
SAMPLE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/sample
|
||||
SAMPLE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/sample/image
|
||||
SAMPLE_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/share
|
||||
SAMPLE_CLOSED_SOURCE_DIR := $(JDK_TOPDIR)/src/closed/sample/share
|
||||
SAMPLE_SOLARIS_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/solaris
|
||||
|
@ -31,17 +31,12 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
|
||||
TARGETS += $(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCallbacks.h \
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.h \
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgePackages.h \
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.c \
|
||||
$(CONF_DST_DIR)/accessibility.properties
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/AccessBridgeCalls.c
|
||||
|
||||
$(INCLUDE_DST_OS_DIR)/bridge/%: \
|
||||
$(JDK_TOPDIR)/src/jdk.accessibility/windows/native/include/bridge/%
|
||||
$(install-file)
|
||||
|
||||
$(CONF_DST_DIR)/accessibility.properties: \
|
||||
$(JDK_TOPDIR)/src/jdk.accessibility/windows/conf/accessibility.properties
|
||||
$(install-file)
|
||||
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
@ -21,4 +21,4 @@
|
||||
# or visit www.oracle.com if you need additional information or have any
|
||||
# questions.
|
||||
#
|
||||
tzdata2015d
|
||||
tzdata2015e
|
||||
|
@ -361,9 +361,10 @@ Rule Egypt 2007 only - Sep Thu>=1 24:00 0 -
|
||||
# time this summer, and carry out studies on the possibility of canceling the
|
||||
# practice altogether in future years."
|
||||
#
|
||||
# From Paul Eggert (2015-04-20):
|
||||
# For now, assume DST will be canceled. Any resumption would likely
|
||||
# use different rules anyway.
|
||||
# From Paul Eggert (2015-04-24):
|
||||
# Yesterday the office of Egyptian President El-Sisi announced his
|
||||
# decision to abandon DST permanently. See Ahram Online 2015-04-24.
|
||||
# http://english.ahram.org.eg/NewsContent/1/64/128509/Egypt/Politics-/Sisi-cancels-daylight-saving-time-in-Egypt.aspx
|
||||
|
||||
Rule Egypt 2008 only - Aug lastThu 24:00 0 -
|
||||
Rule Egypt 2009 only - Aug 20 24:00 0 -
|
||||
@ -810,20 +811,41 @@ Zone Indian/Mauritius 3:50:00 - LMT 1907 # Port Louis
|
||||
# will resume again at 02:00 on Saturday, August 2, 2014....
|
||||
# http://www.mmsp.gov.ma/fr/actualites.aspx?id=586
|
||||
|
||||
# From Paul Eggert (2014-06-05):
|
||||
# For now, guess that later spring and fall transitions will use 2014's rules,
|
||||
# From Milamber (2015-06-08):
|
||||
# (Google Translation) The hour will thus be delayed 60 minutes
|
||||
# Sunday, June 14 at 3:00, the ministry said in a statement, adding
|
||||
# that the time will be advanced again 60 minutes Sunday, July 19,
|
||||
# 2015 at 2:00. The move comes under 2.12.126 Decree of 26 Jumada I
|
||||
# 1433 (18 April 2012) and the decision of the Head of Government of
|
||||
# 16 N. 3-29-15 Chaaban 1435 (4 June 2015).
|
||||
# Source (french):
|
||||
# http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/
|
||||
#
|
||||
# From Milamber (2015-06-09):
|
||||
# http://www.mmsp.gov.ma/fr/actualites.aspx?id=863
|
||||
#
|
||||
# From Michael Deckers (2015-06-09):
|
||||
# [The gov.ma announcement] would (probably) make the switch on 2015-07-19 go
|
||||
# from 03:00 to 04:00 rather than from 02:00 to 03:00, as in the patch....
|
||||
# I think the patch is correct and the quoted text is wrong; the text in
|
||||
# <http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/> agrees
|
||||
# with the patch.
|
||||
|
||||
# From Paul Eggert (2015-06-08):
|
||||
# For now, guess that later spring and fall transitions will use 2015's rules,
|
||||
# and guess that Morocco will switch to standard time at 03:00 the last
|
||||
# Saturday before Ramadan, and back to DST at 02:00 the first Saturday after
|
||||
# Ramadan. To implement this, transition dates for 2015 through 2037 were
|
||||
# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after
|
||||
# Ramadan. To implement this, transition dates for 2016 through 2037 were
|
||||
# determined by running the following program under GNU Emacs 24.3, with the
|
||||
# results integrated by hand into the table below.
|
||||
# (let ((islamic-year 1436))
|
||||
# (let ((islamic-year 1437))
|
||||
# (require 'cal-islam)
|
||||
# (while (< islamic-year 1460)
|
||||
# (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
|
||||
# (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
|
||||
# (saturday 6))
|
||||
# (while (/= saturday (mod (setq a (1- a)) 7)))
|
||||
# (while (/= saturday (mod b 7))
|
||||
# (sunday 0))
|
||||
# (while (/= sunday (mod (setq a (1- a)) 7)))
|
||||
# (while (/= sunday (mod b 7))
|
||||
# (setq b (1+ b)))
|
||||
# (setq a (calendar-gregorian-from-absolute a))
|
||||
# (setq b (calendar-gregorian-from-absolute b))
|
||||
@ -867,32 +889,30 @@ Rule Morocco 2012 only - Aug 20 2:00 1:00 S
|
||||
Rule Morocco 2013 only - Jul 7 3:00 0 -
|
||||
Rule Morocco 2013 only - Aug 10 2:00 1:00 S
|
||||
Rule Morocco 2013 max - Oct lastSun 3:00 0 -
|
||||
Rule Morocco 2014 2022 - Mar lastSun 2:00 1:00 S
|
||||
Rule Morocco 2014 2021 - Mar lastSun 2:00 1:00 S
|
||||
Rule Morocco 2014 only - Jun 28 3:00 0 -
|
||||
Rule Morocco 2014 only - Aug 2 2:00 1:00 S
|
||||
Rule Morocco 2015 only - Jun 13 3:00 0 -
|
||||
Rule Morocco 2015 only - Jul 18 2:00 1:00 S
|
||||
Rule Morocco 2016 only - Jun 4 3:00 0 -
|
||||
Rule Morocco 2016 only - Jul 9 2:00 1:00 S
|
||||
Rule Morocco 2017 only - May 20 3:00 0 -
|
||||
Rule Morocco 2017 only - Jul 1 2:00 1:00 S
|
||||
Rule Morocco 2018 only - May 12 3:00 0 -
|
||||
Rule Morocco 2018 only - Jun 16 2:00 1:00 S
|
||||
Rule Morocco 2019 only - May 4 3:00 0 -
|
||||
Rule Morocco 2019 only - Jun 8 2:00 1:00 S
|
||||
Rule Morocco 2020 only - Apr 18 3:00 0 -
|
||||
Rule Morocco 2020 only - May 30 2:00 1:00 S
|
||||
Rule Morocco 2021 only - Apr 10 3:00 0 -
|
||||
Rule Morocco 2021 only - May 15 2:00 1:00 S
|
||||
Rule Morocco 2022 only - Apr 2 3:00 0 -
|
||||
Rule Morocco 2022 only - May 7 2:00 1:00 S
|
||||
Rule Morocco 2023 only - Apr 22 2:00 1:00 S
|
||||
Rule Morocco 2024 only - Apr 13 2:00 1:00 S
|
||||
Rule Morocco 2025 only - Apr 5 2:00 1:00 S
|
||||
Rule Morocco 2015 only - Jun 14 3:00 0 -
|
||||
Rule Morocco 2015 only - Jul 19 2:00 1:00 S
|
||||
Rule Morocco 2016 only - Jun 5 3:00 0 -
|
||||
Rule Morocco 2016 only - Jul 10 2:00 1:00 S
|
||||
Rule Morocco 2017 only - May 21 3:00 0 -
|
||||
Rule Morocco 2017 only - Jul 2 2:00 1:00 S
|
||||
Rule Morocco 2018 only - May 13 3:00 0 -
|
||||
Rule Morocco 2018 only - Jun 17 2:00 1:00 S
|
||||
Rule Morocco 2019 only - May 5 3:00 0 -
|
||||
Rule Morocco 2019 only - Jun 9 2:00 1:00 S
|
||||
Rule Morocco 2020 only - Apr 19 3:00 0 -
|
||||
Rule Morocco 2020 only - May 24 2:00 1:00 S
|
||||
Rule Morocco 2021 only - Apr 11 3:00 0 -
|
||||
Rule Morocco 2021 only - May 16 2:00 1:00 S
|
||||
Rule Morocco 2022 only - May 8 2:00 1:00 S
|
||||
Rule Morocco 2023 only - Apr 23 2:00 1:00 S
|
||||
Rule Morocco 2024 only - Apr 14 2:00 1:00 S
|
||||
Rule Morocco 2025 only - Apr 6 2:00 1:00 S
|
||||
Rule Morocco 2026 max - Mar lastSun 2:00 1:00 S
|
||||
Rule Morocco 2035 only - Oct 27 3:00 0 -
|
||||
Rule Morocco 2036 only - Oct 18 3:00 0 -
|
||||
Rule Morocco 2037 only - Oct 10 3:00 0 -
|
||||
Rule Morocco 2036 only - Oct 19 3:00 0 -
|
||||
Rule Morocco 2037 only - Oct 4 3:00 0 -
|
||||
|
||||
# Zone NAME GMTOFF RULES FORMAT [UNTIL]
|
||||
Zone Africa/Casablanca -0:30:20 - LMT 1913 Oct 26
|
||||
|
@ -26,11 +26,10 @@
|
||||
# This file is in the public domain, so clarified as of
|
||||
# 2009-05-17 by Arthur David Olson.
|
||||
#
|
||||
# From Paul Eggert (2014-07-18):
|
||||
# From Paul Eggert (2015-05-02):
|
||||
# This file contains a table of two-letter country codes. Columns are
|
||||
# separated by a single tab. Lines beginning with '#' are comments.
|
||||
# Although all text currently uses ASCII encoding, this is planned to
|
||||
# change to UTF-8 soon. The columns of the table are as follows:
|
||||
# All text uses UTF-8 encoding. The columns of the table are as follows:
|
||||
#
|
||||
# 1. ISO 3166-1 alpha-2 country code, current as of
|
||||
# ISO 3166-1 Newsletter VI-16 (2013-07-11). See: Updates on ISO 3166
|
||||
@ -61,7 +60,7 @@ AS Samoa (American)
|
||||
AT Austria
|
||||
AU Australia
|
||||
AW Aruba
|
||||
AX Aaland Islands
|
||||
AX Åland Islands
|
||||
AZ Azerbaijan
|
||||
BA Bosnia & Herzegovina
|
||||
BB Barbados
|
||||
@ -90,7 +89,7 @@ CD Congo (Dem. Rep.)
|
||||
CF Central African Rep.
|
||||
CG Congo (Rep.)
|
||||
CH Switzerland
|
||||
CI Cote d'Ivoire
|
||||
CI Côte d'Ivoire
|
||||
CK Cook Islands
|
||||
CL Chile
|
||||
CM Cameroon
|
||||
@ -234,7 +233,7 @@ PT Portugal
|
||||
PW Palau
|
||||
PY Paraguay
|
||||
QA Qatar
|
||||
RE Reunion
|
||||
RE Réunion
|
||||
RO Romania
|
||||
RS Serbia
|
||||
RU Russia
|
||||
|
@ -2684,7 +2684,17 @@ Zone Atlantic/Bermuda -4:19:18 - LMT 1930 Jan 1 2:00 # Hamilton
|
||||
-4:00 US A%sT
|
||||
|
||||
# Cayman Is
|
||||
# See America/Panama.
|
||||
|
||||
# From Paul Eggert (2015-05-15):
|
||||
# The Cayman government has decided to introduce DST in 2016, the idea being
|
||||
# to keep in sync with New York. The legislation hasn't passed but the change
|
||||
# seems quite likely. See: Meade B. Cayman 27.
|
||||
# http://www.cayman27.com.ky/2015/05/15/clock-ticks-toward-daylight-saving-time-in-cayman
|
||||
|
||||
Zone America/Cayman -5:25:32 - LMT 1890 # Georgetown
|
||||
-5:07:11 - KMT 1912 Feb # Kingston Mean Time
|
||||
-5:00 - EST 2016
|
||||
-5:00 US E%sT
|
||||
|
||||
# Costa Rica
|
||||
|
||||
@ -3207,7 +3217,6 @@ Zone America/Managua -5:45:08 - LMT 1890
|
||||
Zone America/Panama -5:18:08 - LMT 1890
|
||||
-5:19:36 - CMT 1908 Apr 22 # Colón Mean Time
|
||||
-5:00 - EST
|
||||
Link America/Panama America/Cayman
|
||||
|
||||
# Puerto Rico
|
||||
# There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'.
|
||||
|
@ -53,7 +53,7 @@
|
||||
# I suggest the use of _Summer time_ instead of the more cumbersome
|
||||
# _daylight-saving time_. _Summer time_ seems to be in general use
|
||||
# in Europe and South America.
|
||||
# -- E O Cutler, _New York Times_ (1937-02-14), quoted in
|
||||
# -- E O Cutler, _New York Times_ (1937-02-14), quoted in
|
||||
# H L Mencken, _The American Language: Supplement I_ (1960), p 466
|
||||
#
|
||||
# Earlier editions of these tables also used the North American style
|
||||
|
@ -29,7 +29,7 @@ CLDRSRCDIR := $(JDK_TOPDIR)/src/jdk.localedata/share/classes/sun/util/cldr/resou
|
||||
GENSRC_BASEDIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base
|
||||
GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata
|
||||
|
||||
CLDR_BASEMETAINFO_FILE := $(GENSRC_DIR)/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java
|
||||
CLDR_BASEMETAINFO_FILE := $(GENSRC_BASEDIR)/sun/util/cldr/CLDRBaseLocaleDataMetaInfo.java
|
||||
CLDR_METAINFO_FILE := $(GENSRC_DIR)/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo_jdk_localedata.java
|
||||
|
||||
CLDR_BASE_LOCALES := "en-US"
|
||||
|
@ -59,17 +59,6 @@ FindSrcDirsForLib = \
|
||||
$(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
|
||||
$(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
|
||||
|
||||
################################################################################
|
||||
# Find lib dir for module
|
||||
# Param 1 - module name
|
||||
ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
|
||||
FindLibDirForModule = \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)$(OPENJDK_TARGET_CPU_LIBDIR)
|
||||
else
|
||||
FindLibDirForModule = \
|
||||
$(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
# Find a library
|
||||
# Param 1 - module name
|
||||
|
@ -81,7 +81,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
|
||||
LDFLAGS_SUFFIX_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
|
||||
$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib \
|
||||
advapi32.lib, \
|
||||
LDFLAGS_SUFFIX_macosx := -ljava -lnet -pthread -framework CoreFoundation, \
|
||||
LDFLAGS_SUFFIX_macosx := -ljava -lnet -pthread \
|
||||
-framework CoreFoundation -framework CoreServices, \
|
||||
LDFLAGS_SUFFIX :=, \
|
||||
VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
|
||||
RC_FLAGS := $(RC_FLAGS) \
|
||||
|
@ -228,7 +228,8 @@ public class ModuleArchive implements Archive {
|
||||
private static String nativeDir(String filename) {
|
||||
if (System.getProperty("os.name").startsWith("Windows")) {
|
||||
if (filename.endsWith(".dll") || filename.endsWith(".diz")
|
||||
|| filename.endsWith(".pdb") || filename.endsWith(".map")) {
|
||||
|| filename.endsWith(".pdb") || filename.endsWith(".map")
|
||||
|| filename.endsWith(".cpl")) {
|
||||
return "bin";
|
||||
} else {
|
||||
return "lib";
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 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
|
||||
@ -49,6 +49,8 @@ public class MacOSXFileSystemProvider extends BsdFileSystemProvider {
|
||||
FileTypeDetector getFileTypeDetector() {
|
||||
Path userMimeTypes = Paths.get(AccessController.doPrivileged(
|
||||
new GetPropertyAction("user.home")), ".mime.types");
|
||||
return new MimeTypesFileTypeDetector(userMimeTypes);
|
||||
|
||||
return chain(new MimeTypesFileTypeDetector(userMimeTypes),
|
||||
new UTIFileTypeDetector());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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 sun.nio.fs;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
/**
|
||||
* File type detector that uses a file extension to look up its MIME type
|
||||
* via the Apple Uniform Type Identifier interfaces.
|
||||
*/
|
||||
class UTIFileTypeDetector extends AbstractFileTypeDetector {
|
||||
UTIFileTypeDetector() {
|
||||
super();
|
||||
}
|
||||
|
||||
private native String probe0(String fileExtension) throws IOException;
|
||||
|
||||
@Override
|
||||
protected String implProbeContentType(Path path) throws IOException {
|
||||
Path fn = path.getFileName();
|
||||
if (fn == null)
|
||||
return null; // no file name
|
||||
|
||||
String ext = getExtension(fn.toString());
|
||||
if (ext.isEmpty())
|
||||
return null; // no extension
|
||||
|
||||
return probe0(ext);
|
||||
}
|
||||
|
||||
static {
|
||||
AccessController.doPrivileged(new PrivilegedAction<>() {
|
||||
@Override
|
||||
public Void run() {
|
||||
System.loadLibrary("nio");
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
127
jdk/src/java.base/macosx/native/libnio/fs/UTIFileTypeDetector.c
Normal file
127
jdk/src/java.base/macosx/native/libnio/fs/UTIFileTypeDetector.c
Normal file
@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "jni.h"
|
||||
#include "jni_util.h"
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
|
||||
/**
|
||||
* Creates a CF string from the given Java string.
|
||||
* If javaString is NULL, NULL is returned.
|
||||
* If a memory error occurs, and OutOfMemoryError is thrown and
|
||||
* NULL is returned.
|
||||
*/
|
||||
static CFStringRef toCFString(JNIEnv *env, jstring javaString)
|
||||
{
|
||||
if (javaString == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
CFStringRef result = NULL;
|
||||
jsize length = (*env)->GetStringLength(env, javaString);
|
||||
const jchar *chars = (*env)->GetStringChars(env, javaString, NULL);
|
||||
if (chars == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "toCFString failed");
|
||||
return NULL;
|
||||
}
|
||||
result = CFStringCreateWithCharacters(NULL, (const UniChar *)chars,
|
||||
length);
|
||||
(*env)->ReleaseStringChars(env, javaString, chars);
|
||||
if (result == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "toCFString failed");
|
||||
return NULL;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Java string from the given CF string.
|
||||
* If cfString is NULL, NULL is returned.
|
||||
* If a memory error occurs, and OutOfMemoryError is thrown and
|
||||
* NULL is returned.
|
||||
*/
|
||||
static jstring toJavaString(JNIEnv *env, CFStringRef cfString)
|
||||
{
|
||||
if (cfString == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
jstring javaString = NULL;
|
||||
|
||||
CFIndex length = CFStringGetLength(cfString);
|
||||
const UniChar *constchars = CFStringGetCharactersPtr(cfString);
|
||||
if (constchars) {
|
||||
javaString = (*env)->NewString(env, constchars, length);
|
||||
} else {
|
||||
UniChar *chars = malloc(length * sizeof(UniChar));
|
||||
if (chars == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, "toJavaString failed");
|
||||
return NULL;
|
||||
}
|
||||
CFStringGetCharacters(cfString, CFRangeMake(0, length), chars);
|
||||
javaString = (*env)->NewString(env, chars, length);
|
||||
free(chars);
|
||||
}
|
||||
return javaString;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the content type corresponding to the supplied file extension.
|
||||
* The mapping is determined using Uniform Type Identifiers (UTIs). If
|
||||
* the file extension parameter is NULL, a CFString cannot be created
|
||||
* from the file extension parameter, there is no UTI corresponding to
|
||||
* the file extension, the UTI cannot supply a MIME type for the file
|
||||
* extension, or a Java string cannot be created, then NULL is returned;
|
||||
* otherwise the MIME type string is returned.
|
||||
*/
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_sun_nio_fs_UTIFileTypeDetector_probe0(JNIEnv* env, jobject ftd,
|
||||
jstring ext)
|
||||
{
|
||||
jstring result = NULL;
|
||||
|
||||
CFStringRef extension = toCFString(env, ext);
|
||||
if (extension != NULL) {
|
||||
CFStringRef uti =
|
||||
UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension,
|
||||
extension, NULL);
|
||||
CFRelease(extension);
|
||||
|
||||
if (uti != NULL) {
|
||||
CFStringRef mimeType =
|
||||
UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType);
|
||||
CFRelease(uti);
|
||||
|
||||
if (mimeType != NULL) {
|
||||
result = toJavaString(env, mimeType);
|
||||
CFRelease(mimeType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2015 Red Hat, Inc.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -62,14 +62,16 @@ final class GHASH {
|
||||
|
||||
private static final int AES_BLOCK_SIZE = 16;
|
||||
|
||||
// Multiplies state0, state1 by V0, V1.
|
||||
private void blockMult(long V0, long V1) {
|
||||
// Multiplies state[0], state[1] by subkeyH[0], subkeyH[1].
|
||||
private static void blockMult(long[] st, long[] subH) {
|
||||
long Z0 = 0;
|
||||
long Z1 = 0;
|
||||
long V0 = subH[0];
|
||||
long V1 = subH[1];
|
||||
long X;
|
||||
|
||||
// Separate loops for processing state0 and state1.
|
||||
X = state0;
|
||||
// Separate loops for processing state[0] and state[1].
|
||||
X = st[0];
|
||||
for (int i = 0; i < 64; i++) {
|
||||
// Zi+1 = Zi if bit i of x is 0
|
||||
long mask = X >> 63;
|
||||
@ -89,7 +91,7 @@ final class GHASH {
|
||||
X <<= 1;
|
||||
}
|
||||
|
||||
X = state1;
|
||||
X = st[1];
|
||||
for (int i = 64; i < 127; i++) {
|
||||
// Zi+1 = Zi if bit i of x is 0
|
||||
long mask = X >> 63;
|
||||
@ -115,15 +117,18 @@ final class GHASH {
|
||||
Z1 ^= V1 & mask;
|
||||
|
||||
// Save result.
|
||||
state0 = Z0;
|
||||
state1 = Z1;
|
||||
st[0] = Z0;
|
||||
st[1] = Z1;
|
||||
|
||||
}
|
||||
|
||||
/* subkeyH and state are stored in long[] for GHASH intrinsic use */
|
||||
|
||||
// hash subkey H; should not change after the object has been constructed
|
||||
private final long subkeyH0, subkeyH1;
|
||||
private final long[] subkeyH;
|
||||
|
||||
// buffer for storing hash
|
||||
private long state0, state1;
|
||||
private final long[] state;
|
||||
|
||||
// variables for save/restore calls
|
||||
private long stateSave0, stateSave1;
|
||||
@ -141,8 +146,10 @@ final class GHASH {
|
||||
if ((subkeyH == null) || subkeyH.length != AES_BLOCK_SIZE) {
|
||||
throw new ProviderException("Internal error");
|
||||
}
|
||||
this.subkeyH0 = getLong(subkeyH, 0);
|
||||
this.subkeyH1 = getLong(subkeyH, 8);
|
||||
state = new long[2];
|
||||
this.subkeyH = new long[2];
|
||||
this.subkeyH[0] = getLong(subkeyH, 0);
|
||||
this.subkeyH[1] = getLong(subkeyH, 8);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -151,33 +158,30 @@ final class GHASH {
|
||||
* this object for different data w/ the same H.
|
||||
*/
|
||||
void reset() {
|
||||
state0 = 0;
|
||||
state1 = 0;
|
||||
state[0] = 0;
|
||||
state[1] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Save the current snapshot of this GHASH object.
|
||||
*/
|
||||
void save() {
|
||||
stateSave0 = state0;
|
||||
stateSave1 = state1;
|
||||
stateSave0 = state[0];
|
||||
stateSave1 = state[1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Restores this object using the saved snapshot.
|
||||
*/
|
||||
void restore() {
|
||||
state0 = stateSave0;
|
||||
state1 = stateSave1;
|
||||
state[0] = stateSave0;
|
||||
state[1] = stateSave1;
|
||||
}
|
||||
|
||||
private void processBlock(byte[] data, int ofs) {
|
||||
if (data.length - ofs < AES_BLOCK_SIZE) {
|
||||
throw new RuntimeException("need complete block");
|
||||
}
|
||||
state0 ^= getLong(data, ofs);
|
||||
state1 ^= getLong(data, ofs + 8);
|
||||
blockMult(subkeyH0, subkeyH1);
|
||||
private static void processBlock(byte[] data, int ofs, long[] st, long[] subH) {
|
||||
st[0] ^= getLong(data, ofs);
|
||||
st[1] ^= getLong(data, ofs + 8);
|
||||
blockMult(st, subH);
|
||||
}
|
||||
|
||||
void update(byte[] in) {
|
||||
@ -185,22 +189,57 @@ final class GHASH {
|
||||
}
|
||||
|
||||
void update(byte[] in, int inOfs, int inLen) {
|
||||
if (inLen - inOfs > in.length) {
|
||||
throw new RuntimeException("input length out of bound");
|
||||
if (inLen == 0) {
|
||||
return;
|
||||
}
|
||||
ghashRangeCheck(in, inOfs, inLen, state, subkeyH);
|
||||
processBlocks(in, inOfs, inLen/AES_BLOCK_SIZE, state, subkeyH);
|
||||
}
|
||||
|
||||
private static void ghashRangeCheck(byte[] in, int inOfs, int inLen, long[] st, long[] subH) {
|
||||
if (inLen < 0) {
|
||||
throw new RuntimeException("invalid input length: " + inLen);
|
||||
}
|
||||
if (inOfs < 0) {
|
||||
throw new RuntimeException("invalid offset: " + inOfs);
|
||||
}
|
||||
if (inLen > in.length - inOfs) {
|
||||
throw new RuntimeException("input length out of bound: " +
|
||||
inLen + " > " + (in.length - inOfs));
|
||||
}
|
||||
if (inLen % AES_BLOCK_SIZE != 0) {
|
||||
throw new RuntimeException("input length unsupported");
|
||||
throw new RuntimeException("input length/block size mismatch: " +
|
||||
inLen);
|
||||
}
|
||||
|
||||
for (int i = inOfs; i < (inOfs + inLen); i += AES_BLOCK_SIZE) {
|
||||
processBlock(in, i);
|
||||
// These two checks are for C2 checking
|
||||
if (st.length != 2) {
|
||||
throw new RuntimeException("internal state has invalid length: " +
|
||||
st.length);
|
||||
}
|
||||
if (subH.length != 2) {
|
||||
throw new RuntimeException("internal subkeyH has invalid length: " +
|
||||
subH.length);
|
||||
}
|
||||
}
|
||||
/*
|
||||
* This is an intrinsified method. The method's argument list must match
|
||||
* the hotspot signature. This method and methods called by it, cannot
|
||||
* throw exceptions or allocate arrays as it will breaking intrinsics
|
||||
*/
|
||||
private static void processBlocks(byte[] data, int inOfs, int blocks, long[] st, long[] subH) {
|
||||
int offset = inOfs;
|
||||
while (blocks > 0) {
|
||||
processBlock(data, offset, st, subH);
|
||||
blocks--;
|
||||
offset += AES_BLOCK_SIZE;
|
||||
}
|
||||
}
|
||||
|
||||
byte[] digest() {
|
||||
byte[] result = new byte[AES_BLOCK_SIZE];
|
||||
putLong(result, 0, state0);
|
||||
putLong(result, 8, state1);
|
||||
putLong(result, 0, state[0]);
|
||||
putLong(result, 8, state[1]);
|
||||
reset();
|
||||
return result;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -121,7 +121,7 @@ public final class OAEPParameters extends AlgorithmParametersSpi {
|
||||
} else if (data.isContextSpecific((byte) 0x01)) {
|
||||
// mgf algid
|
||||
AlgorithmId val = AlgorithmId.parse(data.data.getDerValue());
|
||||
if (!val.getOID().equals((Object) OID_MGF1)) {
|
||||
if (!val.getOID().equals(OID_MGF1)) {
|
||||
throw new IOException("Only MGF1 mgf is supported");
|
||||
}
|
||||
AlgorithmId params = AlgorithmId.parse(
|
||||
@ -144,7 +144,7 @@ public final class OAEPParameters extends AlgorithmParametersSpi {
|
||||
} else if (data.isContextSpecific((byte) 0x02)) {
|
||||
// pSource algid
|
||||
AlgorithmId val = AlgorithmId.parse(data.data.getDerValue());
|
||||
if (!val.getOID().equals((Object) OID_PSpecified)) {
|
||||
if (!val.getOID().equals(OID_PSpecified)) {
|
||||
throw new IOException("Wrong OID for pSpecified");
|
||||
}
|
||||
DerInputStream dis = new DerInputStream(val.getEncodedParams());
|
||||
|
@ -1235,7 +1235,7 @@ class Attribute implements Comparable<Attribute> {
|
||||
int sofar = 0; // how far have we processed the layout?
|
||||
for (;;) {
|
||||
// for each dash, collect everything up to the dash
|
||||
result.append(layout.substring(sofar, dash));
|
||||
result.append(layout, sofar, dash);
|
||||
sofar = dash+1; // skip the dash
|
||||
// then collect intermediate values
|
||||
int value0 = parseIntBefore(layout, dash);
|
||||
@ -1249,7 +1249,7 @@ class Attribute implements Comparable<Attribute> {
|
||||
dash = findCaseDash(layout, sofar);
|
||||
if (dash < 0) break;
|
||||
}
|
||||
result.append(layout.substring(sofar)); // collect the rest
|
||||
result.append(layout, sofar, layout.length()); // collect the rest
|
||||
return result.toString();
|
||||
}
|
||||
static {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
@ -34,8 +34,7 @@ package java.io;
|
||||
* @author Arthur van Hoff
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class BufferedOutputStream extends FilterOutputStream {
|
||||
public class BufferedOutputStream extends FilterOutputStream {
|
||||
/**
|
||||
* The internal buffer where data is stored.
|
||||
*/
|
||||
@ -90,6 +89,7 @@ class BufferedOutputStream extends FilterOutputStream {
|
||||
* @param b the byte to be written.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public synchronized void write(int b) throws IOException {
|
||||
if (count >= buf.length) {
|
||||
flushBuffer();
|
||||
@ -113,6 +113,7 @@ class BufferedOutputStream extends FilterOutputStream {
|
||||
* @param len the number of bytes to write.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public synchronized void write(byte b[], int off, int len) throws IOException {
|
||||
if (len >= buf.length) {
|
||||
/* If the request length exceeds the size of the output buffer,
|
||||
@ -136,6 +137,7 @@ class BufferedOutputStream extends FilterOutputStream {
|
||||
* @exception IOException if an I/O error occurs.
|
||||
* @see java.io.FilterOutputStream#out
|
||||
*/
|
||||
@Override
|
||||
public synchronized void flush() throws IOException {
|
||||
flushBuffer();
|
||||
out.flush();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1994, 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
|
||||
@ -41,13 +41,15 @@ package java.io;
|
||||
* @author Jonathan Payne
|
||||
* @since 1.0
|
||||
*/
|
||||
public
|
||||
class FilterOutputStream extends OutputStream {
|
||||
public class FilterOutputStream extends OutputStream {
|
||||
/**
|
||||
* The underlying output stream to be filtered.
|
||||
*/
|
||||
protected OutputStream out;
|
||||
|
||||
/**
|
||||
* Whether the stream is closed; implicitly initialized to false.
|
||||
*/
|
||||
private boolean closed;
|
||||
|
||||
/**
|
||||
@ -75,6 +77,7 @@ class FilterOutputStream extends OutputStream {
|
||||
* @param b the <code>byte</code>.
|
||||
* @exception IOException if an I/O error occurs.
|
||||
*/
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
out.write(b);
|
||||
}
|
||||
@ -95,6 +98,7 @@ class FilterOutputStream extends OutputStream {
|
||||
* @exception IOException if an I/O error occurs.
|
||||
* @see java.io.FilterOutputStream#write(byte[], int, int)
|
||||
*/
|
||||
@Override
|
||||
public void write(byte b[]) throws IOException {
|
||||
write(b, 0, b.length);
|
||||
}
|
||||
@ -119,6 +123,7 @@ class FilterOutputStream extends OutputStream {
|
||||
* @exception IOException if an I/O error occurs.
|
||||
* @see java.io.FilterOutputStream#write(int)
|
||||
*/
|
||||
@Override
|
||||
public void write(byte b[], int off, int len) throws IOException {
|
||||
if ((off | len | (b.length - (len + off)) | (off + len)) < 0)
|
||||
throw new IndexOutOfBoundsException();
|
||||
@ -138,6 +143,7 @@ class FilterOutputStream extends OutputStream {
|
||||
* @exception IOException if an I/O error occurs.
|
||||
* @see java.io.FilterOutputStream#out
|
||||
*/
|
||||
@Override
|
||||
public void flush() throws IOException {
|
||||
out.flush();
|
||||
}
|
||||
@ -154,13 +160,40 @@ class FilterOutputStream extends OutputStream {
|
||||
* @see java.io.FilterOutputStream#flush()
|
||||
* @see java.io.FilterOutputStream#out
|
||||
*/
|
||||
@SuppressWarnings("try")
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
if (closed)
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
closed = true;
|
||||
try (OutputStream ostream = out) {
|
||||
|
||||
Throwable flushException = null;
|
||||
try {
|
||||
flush();
|
||||
} catch (Throwable e) {
|
||||
flushException = e;
|
||||
throw e;
|
||||
} finally {
|
||||
if (flushException == null) {
|
||||
out.close();
|
||||
} else {
|
||||
try {
|
||||
out.close();
|
||||
} catch (Throwable closeException) {
|
||||
// evaluate possible precedence of flushException over closeException
|
||||
if ((flushException instanceof ThreadDeath) &&
|
||||
!(closeException instanceof ThreadDeath)) {
|
||||
flushException.addSuppressed(closeException);
|
||||
throw (ThreadDeath) flushException;
|
||||
}
|
||||
|
||||
if (flushException != closeException) {
|
||||
closeException.addSuppressed(flushException);
|
||||
}
|
||||
|
||||
throw closeException;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class StringWriter extends Writer {
|
||||
* @param len Number of characters to write
|
||||
*/
|
||||
public void write(String str, int off, int len) {
|
||||
buf.append(str.substring(off, off + len));
|
||||
buf.append(str, off, off + len);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -515,8 +515,12 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
|
||||
+ s.length());
|
||||
int len = end - start;
|
||||
ensureCapacityInternal(count + len);
|
||||
for (int i = start, j = count; i < end; i++, j++)
|
||||
value[j] = s.charAt(i);
|
||||
if (s instanceof String) {
|
||||
((String)s).getChars(start, end, value, count);
|
||||
} else {
|
||||
for (int i = start, j = count; i < end; i++, j++)
|
||||
value[j] = s.charAt(i);
|
||||
}
|
||||
count += len;
|
||||
return this;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -25,10 +25,14 @@
|
||||
|
||||
package java.net;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Enumeration;
|
||||
import java.util.NoSuchElementException;
|
||||
import sun.security.action.*;
|
||||
import java.security.AccessController;
|
||||
import java.util.Spliterator;
|
||||
import java.util.Spliterators;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
/**
|
||||
* This class represents a Network Interface made up of a name,
|
||||
@ -95,8 +99,8 @@ public final class NetworkInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience method to return an Enumeration with all or a
|
||||
* subset of the InetAddresses bound to this network interface.
|
||||
* Get an Enumeration with all or a subset of the InetAddresses bound to
|
||||
* this network interface.
|
||||
* <p>
|
||||
* If there is a security manager, its {@code checkConnect}
|
||||
* method is called for each InetAddress. Only InetAddresses where
|
||||
@ -104,53 +108,56 @@ public final class NetworkInterface {
|
||||
* will be returned in the Enumeration. However, if the caller has the
|
||||
* {@link NetPermission}("getNetworkInformation") permission, then all
|
||||
* InetAddresses are returned.
|
||||
*
|
||||
* @return an Enumeration object with all or a subset of the InetAddresses
|
||||
* bound to this network interface
|
||||
* @see #inetAddresses()
|
||||
*/
|
||||
public Enumeration<InetAddress> getInetAddresses() {
|
||||
return enumerationFromArray(getCheckedInetAddresses());
|
||||
}
|
||||
|
||||
class checkedAddresses implements Enumeration<InetAddress> {
|
||||
/**
|
||||
* Get a Stream of all or a subset of the InetAddresses bound to this
|
||||
* network interface.
|
||||
* <p>
|
||||
* If there is a security manager, its {@code checkConnect}
|
||||
* method is called for each InetAddress. Only InetAddresses where
|
||||
* the {@code checkConnect} doesn't throw a SecurityException will be
|
||||
* returned in the Stream. However, if the caller has the
|
||||
* {@link NetPermission}("getNetworkInformation") permission, then all
|
||||
* InetAddresses are returned.
|
||||
*
|
||||
* @return a Stream object with all or a subset of the InetAddresses
|
||||
* bound to this network interface
|
||||
* @since 1.9
|
||||
*/
|
||||
public Stream<InetAddress> inetAddresses() {
|
||||
return streamFromArray(getCheckedInetAddresses());
|
||||
}
|
||||
|
||||
private int i=0, count=0;
|
||||
private InetAddress local_addrs[];
|
||||
private InetAddress[] getCheckedInetAddresses() {
|
||||
InetAddress[] local_addrs = new InetAddress[addrs.length];
|
||||
boolean trusted = true;
|
||||
|
||||
checkedAddresses() {
|
||||
local_addrs = new InetAddress[addrs.length];
|
||||
boolean trusted = true;
|
||||
|
||||
SecurityManager sec = System.getSecurityManager();
|
||||
if (sec != null) {
|
||||
try {
|
||||
sec.checkPermission(new NetPermission("getNetworkInformation"));
|
||||
} catch (SecurityException e) {
|
||||
trusted = false;
|
||||
}
|
||||
}
|
||||
for (int j=0; j<addrs.length; j++) {
|
||||
try {
|
||||
if (sec != null && !trusted) {
|
||||
sec.checkConnect(addrs[j].getHostAddress(), -1);
|
||||
}
|
||||
local_addrs[count++] = addrs[j];
|
||||
} catch (SecurityException e) { }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public InetAddress nextElement() {
|
||||
if (i < count) {
|
||||
return local_addrs[i++];
|
||||
} else {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasMoreElements() {
|
||||
return (i < count);
|
||||
SecurityManager sec = System.getSecurityManager();
|
||||
if (sec != null) {
|
||||
try {
|
||||
sec.checkPermission(new NetPermission("getNetworkInformation"));
|
||||
} catch (SecurityException e) {
|
||||
trusted = false;
|
||||
}
|
||||
}
|
||||
return new checkedAddresses();
|
||||
|
||||
int i = 0;
|
||||
for (int j = 0; j < addrs.length; j++) {
|
||||
try {
|
||||
if (!trusted) {
|
||||
sec.checkConnect(addrs[j].getHostAddress(), -1);
|
||||
}
|
||||
local_addrs[i++] = addrs[j];
|
||||
} catch (SecurityException e) { }
|
||||
}
|
||||
return Arrays.copyOf(local_addrs, i);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,30 +195,23 @@ public final class NetworkInterface {
|
||||
*
|
||||
* @return an Enumeration object with all of the subinterfaces
|
||||
* of this network interface
|
||||
* @see #subInterfaces()
|
||||
* @since 1.6
|
||||
*/
|
||||
public Enumeration<NetworkInterface> getSubInterfaces() {
|
||||
class subIFs implements Enumeration<NetworkInterface> {
|
||||
|
||||
private int i=0;
|
||||
|
||||
subIFs() {
|
||||
}
|
||||
|
||||
public NetworkInterface nextElement() {
|
||||
if (i < childs.length) {
|
||||
return childs[i++];
|
||||
} else {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasMoreElements() {
|
||||
return (i < childs.length);
|
||||
}
|
||||
}
|
||||
return new subIFs();
|
||||
return enumerationFromArray(childs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Stream of all subinterfaces (also known as virtual
|
||||
* interfaces) attached to this network interface.
|
||||
*
|
||||
* @return a Stream object with all of the subinterfaces
|
||||
* of this network interface
|
||||
* @since 1.9
|
||||
*/
|
||||
public Stream<NetworkInterface> subInterfaces() {
|
||||
return streamFromArray(childs);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -326,43 +326,80 @@ public final class NetworkInterface {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all the interfaces on this machine. The {@code Enumeration}
|
||||
* contains at least one element, possibly representing a loopback
|
||||
* interface that only supports communication between entities on
|
||||
* Returns an {@code Enumeration} of all the interfaces on this machine. The
|
||||
* {@code Enumeration} contains at least one element, possibly representing
|
||||
* a loopback interface that only supports communication between entities on
|
||||
* this machine.
|
||||
*
|
||||
* NOTE: can use getNetworkInterfaces()+getInetAddresses()
|
||||
* to obtain all IP addresses for this node
|
||||
* @apiNote this method can be used in combination with
|
||||
* {@link #getInetAddresses()} to obtain all IP addresses for this node
|
||||
*
|
||||
* @return an Enumeration of NetworkInterfaces found on this machine
|
||||
* @exception SocketException if an I/O error occurs.
|
||||
* @see #networkInterfaces()
|
||||
*/
|
||||
|
||||
public static Enumeration<NetworkInterface> getNetworkInterfaces()
|
||||
throws SocketException {
|
||||
final NetworkInterface[] netifs = getAll();
|
||||
NetworkInterface[] netifs = getAll();
|
||||
assert netifs != null && netifs.length > 0;
|
||||
|
||||
// specified to return null if no network interfaces
|
||||
if (netifs == null)
|
||||
return null;
|
||||
return enumerationFromArray(netifs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code Stream} of all the interfaces on this machine. The
|
||||
* {@code Stream} contains at least one interface, possibly representing a
|
||||
* loopback interface that only supports communication between entities on
|
||||
* this machine.
|
||||
*
|
||||
* @apiNote this method can be used in combination with
|
||||
* {@link #inetAddresses()}} to obtain a stream of all IP addresses for
|
||||
* this node, for example:
|
||||
* <pre> {@code
|
||||
* Stream<InetAddress> addrs = NetworkInterface.networkInterfaces()
|
||||
* .flatMap(NetworkInterface::inetAddresses);
|
||||
* }</pre>
|
||||
*
|
||||
* @return a Stream of NetworkInterfaces found on this machine
|
||||
* @exception SocketException if an I/O error occurs.
|
||||
* @since 1.9
|
||||
*/
|
||||
public static Stream<NetworkInterface> networkInterfaces()
|
||||
throws SocketException {
|
||||
NetworkInterface[] netifs = getAll();
|
||||
assert netifs != null && netifs.length > 0;
|
||||
|
||||
return streamFromArray(netifs);
|
||||
}
|
||||
|
||||
private static <T> Enumeration<T> enumerationFromArray(T[] a) {
|
||||
return new Enumeration<>() {
|
||||
private int i = 0;
|
||||
public NetworkInterface nextElement() {
|
||||
if (netifs != null && i < netifs.length) {
|
||||
NetworkInterface netif = netifs[i++];
|
||||
return netif;
|
||||
int i = 0;
|
||||
|
||||
@Override
|
||||
public T nextElement() {
|
||||
if (i < a.length) {
|
||||
return a[i++];
|
||||
} else {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMoreElements() {
|
||||
return (netifs != null && i < netifs.length);
|
||||
return i < a.length;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static <T> Stream<T> streamFromArray(T[] a) {
|
||||
return StreamSupport.stream(
|
||||
Spliterators.spliterator(
|
||||
a,
|
||||
Spliterator.DISTINCT | Spliterator.IMMUTABLE | Spliterator.NONNULL),
|
||||
false);
|
||||
}
|
||||
|
||||
private native static NetworkInterface[] getAll()
|
||||
throws SocketException;
|
||||
|
||||
|
@ -2018,7 +2018,7 @@ public final class URI
|
||||
StringBuilder sb = new StringBuilder(base.length() + cn);
|
||||
// 5.2 (6a)
|
||||
if (i >= 0)
|
||||
sb.append(base.substring(0, i + 1));
|
||||
sb.append(base, 0, i + 1);
|
||||
// 5.2 (6b)
|
||||
sb.append(child);
|
||||
path = sb.toString();
|
||||
@ -2686,7 +2686,7 @@ public final class URI
|
||||
if (!match(c, lowMask, highMask)) {
|
||||
if (sb == null) {
|
||||
sb = new StringBuffer();
|
||||
sb.append(s.substring(0, i));
|
||||
sb.append(s, 0, i);
|
||||
}
|
||||
appendEscape(sb, (byte)c);
|
||||
} else {
|
||||
@ -2698,7 +2698,7 @@ public final class URI
|
||||
|| Character.isISOControl(c))) {
|
||||
if (sb == null) {
|
||||
sb = new StringBuffer();
|
||||
sb.append(s.substring(0, i));
|
||||
sb.append(s, 0, i);
|
||||
}
|
||||
appendEncoded(sb, c);
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -26,6 +26,8 @@
|
||||
package java.security;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
/**
|
||||
* Abstract class representing a collection of Permission objects.
|
||||
@ -126,9 +128,34 @@ public abstract class PermissionCollection implements java.io.Serializable {
|
||||
* Returns an enumeration of all the Permission objects in the collection.
|
||||
*
|
||||
* @return an enumeration of all the Permissions.
|
||||
* @see #elementsAsStream()
|
||||
*/
|
||||
public abstract Enumeration<Permission> elements();
|
||||
|
||||
/**
|
||||
* Returns a stream of all the Permission objects in the collection.
|
||||
*
|
||||
* <p> The collection should not be modified (see {@link #add}) during the
|
||||
* execution of the terminal stream operation. Otherwise, the result of the
|
||||
* terminal stream operation is undefined.
|
||||
*
|
||||
* @implSpec
|
||||
* The default implementation creates a stream whose source is derived from
|
||||
* the enumeration returned from a call to {@link #elements()}.
|
||||
*
|
||||
* @return a stream of all the Permissions.
|
||||
* @since 1.9
|
||||
*/
|
||||
public Stream<Permission> elementsAsStream() {
|
||||
int characteristics = isReadOnly()
|
||||
? Spliterator.NONNULL | Spliterator.IMMUTABLE
|
||||
: Spliterator.NONNULL;
|
||||
return StreamSupport.stream(
|
||||
Spliterators.spliteratorUnknownSize(
|
||||
elements().asIterator(), characteristics),
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks this PermissionCollection object as "readonly". After
|
||||
* a PermissionCollection object
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -2238,7 +2238,7 @@ public class X509CertSelector implements CertSelector {
|
||||
+ subjectPublicKeyAlgID + ", xcert subjectPublicKeyAlgID = "
|
||||
+ algID.getOID());
|
||||
}
|
||||
if (!subjectPublicKeyAlgID.equals((Object)algID.getOID())) {
|
||||
if (!subjectPublicKeyAlgID.equals(algID.getOID())) {
|
||||
if (debug != null) {
|
||||
debug.println("X509CertSelector.match: "
|
||||
+ "subject public key alg IDs don't match");
|
||||
|
@ -329,8 +329,8 @@ final class MergeCollation {
|
||||
PatternEntry e = patterns.get(i);
|
||||
if (e.chars.regionMatches(0,entry.chars,0,
|
||||
e.chars.length())) {
|
||||
excessChars.append(entry.chars.substring(e.chars.length(),
|
||||
entry.chars.length()));
|
||||
excessChars.append(entry.chars, e.chars.length(),
|
||||
entry.chars.length());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1239,7 +1239,7 @@ public class MessageFormat extends Format {
|
||||
int lastOffset = 0;
|
||||
int last = result.length();
|
||||
for (int i = 0; i <= maxOffset; ++i) {
|
||||
result.append(pattern.substring(lastOffset, offsets[i]));
|
||||
result.append(pattern, lastOffset, offsets[i]);
|
||||
lastOffset = offsets[i];
|
||||
int argumentNumber = argumentNumbers[i];
|
||||
if (arguments == null || argumentNumber >= arguments.length) {
|
||||
@ -1332,7 +1332,7 @@ public class MessageFormat extends Format {
|
||||
}
|
||||
}
|
||||
}
|
||||
result.append(pattern.substring(lastOffset, pattern.length()));
|
||||
result.append(pattern, lastOffset, pattern.length());
|
||||
if (characterIterators != null && last != result.length()) {
|
||||
characterIterators.add(createAttributedCharacterIterator(
|
||||
result.substring(last)));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -4268,6 +4268,7 @@ public class Collections {
|
||||
|
||||
public boolean hasMoreElements() { return false; }
|
||||
public E nextElement() { throw new NoSuchElementException(); }
|
||||
public Iterator<E> asIterator() { return emptyIterator(); }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -5199,6 +5200,11 @@ public class Collections {
|
||||
* interoperability with legacy APIs that require an enumeration
|
||||
* as input.
|
||||
*
|
||||
* <p>The iterator returned from a call to {@link Enumeration#asIterator()}
|
||||
* does not support removal of elements from the specified collection. This
|
||||
* is necessary to avoid unintentionally increasing the capabilities of the
|
||||
* returned enumeration.
|
||||
*
|
||||
* @param <T> the class of the objects in the collection
|
||||
* @param c the collection for which an enumeration is to be returned.
|
||||
* @return an enumeration over the specified collection.
|
||||
|
@ -88,18 +88,22 @@ public class LinkedList<E>
|
||||
|
||||
/**
|
||||
* Pointer to first node.
|
||||
* Invariant: (first == null && last == null) ||
|
||||
* (first.prev == null && first.item != null)
|
||||
*/
|
||||
transient Node<E> first;
|
||||
|
||||
/**
|
||||
* Pointer to last node.
|
||||
* Invariant: (first == null && last == null) ||
|
||||
* (last.next == null && last.item != null)
|
||||
*/
|
||||
transient Node<E> last;
|
||||
|
||||
/*
|
||||
void dataStructureInvariants() {
|
||||
assert (size == 0)
|
||||
? (first == null && last == null)
|
||||
: (first.prev == null && last.next == null);
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Constructs an empty list.
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -265,6 +265,10 @@ class JarFile extends ZipFile {
|
||||
public JarEntry nextElement() {
|
||||
return next();
|
||||
}
|
||||
|
||||
public Iterator<JarEntry> asIterator() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -526,6 +526,10 @@ class ZipFile implements ZipConstants, Closeable {
|
||||
return ze;
|
||||
}
|
||||
}
|
||||
|
||||
public Iterator<ZipEntry> asIterator() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -511,7 +511,7 @@ public class BytecodeName {
|
||||
if (s.charAt(0) != ESCAPE_C && i > 0)
|
||||
sb.append(NULL_ESCAPE);
|
||||
// append the string so far, which is unremarkable:
|
||||
sb.append(s.substring(0, i));
|
||||
sb.append(s, 0, i);
|
||||
}
|
||||
|
||||
// rewrite \ to \-, / to \|, etc.
|
||||
@ -544,7 +544,7 @@ public class BytecodeName {
|
||||
if (sb == null) {
|
||||
sb = new StringBuilder(s.length());
|
||||
// append the string so far, which is unremarkable:
|
||||
sb.append(s.substring(stringStart, i));
|
||||
sb.append(s, stringStart, i);
|
||||
}
|
||||
++i; // skip both characters
|
||||
c = oc;
|
||||
|
@ -451,7 +451,7 @@ public class ParseUtil {
|
||||
if (!match(c, lowMask, highMask) && !isEscaped(s, i)) {
|
||||
if (sb == null) {
|
||||
sb = new StringBuffer();
|
||||
sb.append(s.substring(0, i));
|
||||
sb.append(s, 0, i);
|
||||
}
|
||||
appendEscape(sb, (byte)c);
|
||||
} else {
|
||||
@ -463,7 +463,7 @@ public class ParseUtil {
|
||||
|| Character.isISOControl(c))) {
|
||||
if (sb == null) {
|
||||
sb = new StringBuffer();
|
||||
sb.append(s.substring(0, i));
|
||||
sb.append(s, 0, i);
|
||||
}
|
||||
appendEncoded(sb, c);
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 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
|
||||
@ -41,6 +41,27 @@ public abstract class AbstractFileTypeDetector
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the extension of a file name, specifically the portion of the
|
||||
* parameter string after the first dot. If the parameter is {@code null},
|
||||
* empty, does not contain a dot, or the dot is the last character, then an
|
||||
* empty string is returned, otherwise the characters after the dot are
|
||||
* returned.
|
||||
*
|
||||
* @param name A file name
|
||||
* @return The characters after the first dot or an empty string.
|
||||
*/
|
||||
protected final String getExtension(String name) {
|
||||
String ext = "";
|
||||
if (name != null && !name.isEmpty()) {
|
||||
int dot = name.indexOf('.');
|
||||
if ((dot >= 0) && (dot < name.length() - 1)) {
|
||||
ext = name.substring(dot + 1);
|
||||
}
|
||||
}
|
||||
return ext;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invokes the appropriate probe method to guess a file's content type,
|
||||
* and checks that the content type's syntax is valid.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -163,9 +163,9 @@ public class ContentInfo {
|
||||
}
|
||||
|
||||
public byte[] getData() throws IOException {
|
||||
if (contentType.equals((Object)DATA_OID) ||
|
||||
contentType.equals((Object)OLD_DATA_OID) ||
|
||||
contentType.equals((Object)TIMESTAMP_TOKEN_INFO_OID)) {
|
||||
if (contentType.equals(DATA_OID) ||
|
||||
contentType.equals(OLD_DATA_OID) ||
|
||||
contentType.equals(TIMESTAMP_TOKEN_INFO_OID)) {
|
||||
if (content == null)
|
||||
return null;
|
||||
else
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -182,13 +182,12 @@ public class PKCS7 {
|
||||
contentType = contentInfo.contentType;
|
||||
DerValue content = contentInfo.getContent();
|
||||
|
||||
if (contentType.equals((Object)ContentInfo.SIGNED_DATA_OID)) {
|
||||
if (contentType.equals(ContentInfo.SIGNED_DATA_OID)) {
|
||||
parseSignedData(content);
|
||||
} else if (contentType.equals((Object)ContentInfo.OLD_SIGNED_DATA_OID)) {
|
||||
} else if (contentType.equals(ContentInfo.OLD_SIGNED_DATA_OID)) {
|
||||
// This is for backwards compatibility with JDK 1.1.x
|
||||
parseOldSignedData(content);
|
||||
} else if (contentType.equals((Object)
|
||||
ContentInfo.NETSCAPE_CERT_SEQUENCE_OID)){
|
||||
} else if (contentType.equals(ContentInfo.NETSCAPE_CERT_SEQUENCE_OID)){
|
||||
parseNetscapeCertChain(content);
|
||||
} else {
|
||||
throw new ParsingException("content type " + contentType +
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -307,7 +307,7 @@ public class SignerInfo implements DerEncoder {
|
||||
authenticatedAttributes.getAttributeValue(
|
||||
PKCS9Attribute.CONTENT_TYPE_OID);
|
||||
if (contentType == null ||
|
||||
!contentType.equals((Object)content.contentType))
|
||||
!contentType.equals(content.contentType))
|
||||
return null; // contentType does not match, bad SignerInfo
|
||||
|
||||
// now, check message digest
|
||||
|
@ -789,7 +789,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
|
||||
}
|
||||
}
|
||||
if (params != null) {
|
||||
if (algorithm.equals((Object)pbes2_OID)) {
|
||||
if (algorithm.equals(pbes2_OID)) {
|
||||
algParams = AlgorithmParameters.getInstance("PBES2");
|
||||
} else {
|
||||
algParams = AlgorithmParameters.getInstance("PBE");
|
||||
@ -926,7 +926,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
|
||||
private static String mapPBEParamsToAlgorithm(ObjectIdentifier algorithm,
|
||||
AlgorithmParameters algParams) throws NoSuchAlgorithmException {
|
||||
// Check for PBES2 algorithms
|
||||
if (algorithm.equals((Object)pbes2_OID) && algParams != null) {
|
||||
if (algorithm.equals(pbes2_OID) && algParams != null) {
|
||||
return algParams.toString();
|
||||
}
|
||||
return algorithm.toString();
|
||||
@ -1937,7 +1937,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
|
||||
ContentInfo authSafe = new ContentInfo(s);
|
||||
ObjectIdentifier contentType = authSafe.getContentType();
|
||||
|
||||
if (contentType.equals((Object)ContentInfo.DATA_OID)) {
|
||||
if (contentType.equals(ContentInfo.DATA_OID)) {
|
||||
authSafeData = authSafe.getData();
|
||||
} else /* signed data */ {
|
||||
throw new IOException("public key protected PKCS12 not supported");
|
||||
@ -1965,14 +1965,14 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
|
||||
safeContents = new ContentInfo(sci);
|
||||
contentType = safeContents.getContentType();
|
||||
safeContentsData = null;
|
||||
if (contentType.equals((Object)ContentInfo.DATA_OID)) {
|
||||
if (contentType.equals(ContentInfo.DATA_OID)) {
|
||||
|
||||
if (debug != null) {
|
||||
debug.println("Loading PKCS#7 data content-type");
|
||||
}
|
||||
|
||||
safeContentsData = safeContents.getData();
|
||||
} else if (contentType.equals((Object)ContentInfo.ENCRYPTED_DATA_OID)) {
|
||||
} else if (contentType.equals(ContentInfo.ENCRYPTED_DATA_OID)) {
|
||||
if (password == null) {
|
||||
|
||||
if (debug != null) {
|
||||
@ -2178,12 +2178,12 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
|
||||
+ bagValue.tag);
|
||||
}
|
||||
bagValue = bagValue.data.getDerValue();
|
||||
if (bagId.equals((Object)PKCS8ShroudedKeyBag_OID)) {
|
||||
if (bagId.equals(PKCS8ShroudedKeyBag_OID)) {
|
||||
PrivateKeyEntry kEntry = new PrivateKeyEntry();
|
||||
kEntry.protectedPrivKey = bagValue.toByteArray();
|
||||
bagItem = kEntry;
|
||||
privateKeyCount++;
|
||||
} else if (bagId.equals((Object)CertBag_OID)) {
|
||||
} else if (bagId.equals(CertBag_OID)) {
|
||||
DerInputStream cs = new DerInputStream(bagValue.toByteArray());
|
||||
DerValue[] certValues = cs.getSequence(2);
|
||||
ObjectIdentifier certId = certValues[0].getOID();
|
||||
@ -2198,7 +2198,7 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
|
||||
(new ByteArrayInputStream(certValue.getOctetString()));
|
||||
bagItem = cert;
|
||||
certificateCount++;
|
||||
} else if (bagId.equals((Object)SecretBag_OID)) {
|
||||
} else if (bagId.equals(SecretBag_OID)) {
|
||||
DerInputStream ss = new DerInputStream(bagValue.toByteArray());
|
||||
DerValue[] secretValues = ss.getSequence(2);
|
||||
ObjectIdentifier secretId = secretValues[0].getOID();
|
||||
@ -2249,12 +2249,12 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
|
||||
throw new IOException("Attribute " + attrId +
|
||||
" should have a value " + e.getMessage());
|
||||
}
|
||||
if (attrId.equals((Object)PKCS9FriendlyName_OID)) {
|
||||
if (attrId.equals(PKCS9FriendlyName_OID)) {
|
||||
alias = valSet[0].getBMPString();
|
||||
} else if (attrId.equals((Object)PKCS9LocalKeyId_OID)) {
|
||||
} else if (attrId.equals(PKCS9LocalKeyId_OID)) {
|
||||
keyId = valSet[0].getOctetString();
|
||||
} else if
|
||||
(attrId.equals((Object)TrustedKeyUsage_OID)) {
|
||||
(attrId.equals(TrustedKeyUsage_OID)) {
|
||||
trustedKeyUsage = new ObjectIdentifier[valSet.length];
|
||||
for (int k = 0; k < valSet.length; k++) {
|
||||
trustedKeyUsage[k] = valSet[k].getOID();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 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
|
||||
@ -322,7 +322,7 @@ public final class OCSP {
|
||||
|
||||
List<AccessDescription> descriptions = aia.getAccessDescriptions();
|
||||
for (AccessDescription description : descriptions) {
|
||||
if (description.getAccessMethod().equals((Object)
|
||||
if (description.getAccessMethod().equals(
|
||||
AccessDescription.Ad_OCSP_Id)) {
|
||||
|
||||
GeneralName generalName = description.getAccessLocation();
|
||||
|
@ -239,7 +239,7 @@ public final class OCSPResponse {
|
||||
// responseType
|
||||
derIn = tmp.data;
|
||||
ObjectIdentifier responseType = derIn.getOID();
|
||||
if (responseType.equals((Object)OCSP_BASIC_RESPONSE_OID)) {
|
||||
if (responseType.equals(OCSP_BASIC_RESPONSE_OID)) {
|
||||
if (debug != null) {
|
||||
debug.println("OCSP response type: basic");
|
||||
}
|
||||
@ -338,8 +338,7 @@ public final class OCSPResponse {
|
||||
debug.println("OCSP extension: " + ext);
|
||||
}
|
||||
// Only the NONCE extension is recognized
|
||||
if (ext.getExtensionId().equals((Object)
|
||||
OCSP.NONCE_EXTENSION_OID))
|
||||
if (ext.getExtensionId().equals(OCSP.NONCE_EXTENSION_OID))
|
||||
{
|
||||
nonce = ext.getExtensionValue();
|
||||
} else if (ext.isCritical()) {
|
||||
|
@ -202,7 +202,7 @@ class URICertStore extends CertStoreSpi {
|
||||
* object of a certificate's Authority Information Access Extension.
|
||||
*/
|
||||
static CertStore getInstance(AccessDescription ad) {
|
||||
if (!ad.getAccessMethod().equals((Object)
|
||||
if (!ad.getAccessMethod().equals(
|
||||
AccessDescription.Ad_CAISSUERS_Id)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -232,7 +232,7 @@ public abstract class RSASignature extends SignatureSpi {
|
||||
throw new IOException("SEQUENCE length error");
|
||||
}
|
||||
AlgorithmId algId = AlgorithmId.parse(values[0]);
|
||||
if (algId.getOID().equals((Object)oid) == false) {
|
||||
if (algId.getOID().equals(oid) == false) {
|
||||
throw new IOException("ObjectIdentifier mismatch: "
|
||||
+ algId.getOID());
|
||||
}
|
||||
|
@ -1280,7 +1280,7 @@ public final class Main {
|
||||
Iterator<PKCS10Attribute> attrs = req.getAttributes().getAttributes().iterator();
|
||||
while (attrs.hasNext()) {
|
||||
PKCS10Attribute attr = attrs.next();
|
||||
if (attr.getAttributeId().equals((Object)PKCS9Attribute.EXTENSION_REQUEST_OID)) {
|
||||
if (attr.getAttributeId().equals(PKCS9Attribute.EXTENSION_REQUEST_OID)) {
|
||||
reqex = (CertificateExtensions)attr.getAttributeValue();
|
||||
}
|
||||
}
|
||||
@ -2338,7 +2338,7 @@ public final class Main {
|
||||
req.getSubjectName(), pkey.getFormat(), pkey.getAlgorithm());
|
||||
for (PKCS10Attribute attr: req.getAttributes().getAttributes()) {
|
||||
ObjectIdentifier oid = attr.getAttributeId();
|
||||
if (oid.equals((Object)PKCS9Attribute.EXTENSION_REQUEST_OID)) {
|
||||
if (oid.equals(PKCS9Attribute.EXTENSION_REQUEST_OID)) {
|
||||
CertificateExtensions exts = (CertificateExtensions)attr.getAttributeValue();
|
||||
if (exts != null) {
|
||||
printExtensions(rb.getString("Extension.Request."), exts, out);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -318,14 +318,6 @@ class ObjectIdentifier implements Serializable
|
||||
out.write (DerValue.tag_ObjectId, encoding);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use equals((Object)oid)
|
||||
*/
|
||||
@Deprecated
|
||||
public boolean equals(ObjectIdentifier other) {
|
||||
return equals((Object)other);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this identifier with another, for equality.
|
||||
*
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -364,8 +364,8 @@ public class AVA implements DerEncoder {
|
||||
|
||||
// encode as PrintableString unless value contains
|
||||
// non-PrintableString chars
|
||||
if (this.oid.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID) ||
|
||||
(this.oid.equals((Object)X500Name.DOMAIN_COMPONENT_OID) &&
|
||||
if (this.oid.equals(PKCS9Attribute.EMAIL_ADDRESS_OID) ||
|
||||
(this.oid.equals(X500Name.DOMAIN_COMPONENT_OID) &&
|
||||
PRESERVE_OLD_DC_ENCODING == false)) {
|
||||
// EmailAddress and DomainComponent must be IA5String
|
||||
return new DerValue(DerValue.tag_IA5String,
|
||||
@ -495,8 +495,8 @@ public class AVA implements DerEncoder {
|
||||
|
||||
// encode as PrintableString unless value contains
|
||||
// non-PrintableString chars
|
||||
if (this.oid.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID) ||
|
||||
(this.oid.equals((Object)X500Name.DOMAIN_COMPONENT_OID) &&
|
||||
if (this.oid.equals(PKCS9Attribute.EMAIL_ADDRESS_OID) ||
|
||||
(this.oid.equals(X500Name.DOMAIN_COMPONENT_OID) &&
|
||||
PRESERVE_OLD_DC_ENCODING == false)) {
|
||||
// EmailAddress and DomainComponent must be IA5String
|
||||
return new DerValue(DerValue.tag_IA5String, temp.toString());
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -95,19 +95,19 @@ public final class AccessDescription {
|
||||
if (this == that) {
|
||||
return true;
|
||||
}
|
||||
return (accessMethod.equals((Object)that.getAccessMethod()) &&
|
||||
return (accessMethod.equals(that.getAccessMethod()) &&
|
||||
accessLocation.equals(that.getAccessLocation()));
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
String method = null;
|
||||
if (accessMethod.equals((Object)Ad_CAISSUERS_Id)) {
|
||||
if (accessMethod.equals(Ad_CAISSUERS_Id)) {
|
||||
method = "caIssuers";
|
||||
} else if (accessMethod.equals((Object)Ad_CAREPOSITORY_Id)) {
|
||||
} else if (accessMethod.equals(Ad_CAREPOSITORY_Id)) {
|
||||
method = "caRepository";
|
||||
} else if (accessMethod.equals((Object)Ad_TIMESTAMPING_Id)) {
|
||||
} else if (accessMethod.equals(Ad_TIMESTAMPING_Id)) {
|
||||
method = "timeStamping";
|
||||
} else if (accessMethod.equals((Object)Ad_OCSP_Id)) {
|
||||
} else if (accessMethod.equals(Ad_OCSP_Id)) {
|
||||
method = "ocsp";
|
||||
} else {
|
||||
method = accessMethod.toString();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -241,7 +241,7 @@ public class CertificateExtensions implements CertAttrSet<Extension> {
|
||||
|
||||
public String getNameByOid(ObjectIdentifier oid) throws IOException {
|
||||
for (String name: map.keySet()) {
|
||||
if (map.get(name).getExtensionId().equals((Object)oid)) {
|
||||
if (map.get(name).getExtensionId().equals(oid)) {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -93,8 +93,7 @@ public class CertificatePolicyId {
|
||||
*/
|
||||
public boolean equals(Object other) {
|
||||
if (other instanceof CertificatePolicyId)
|
||||
return id.equals((Object)
|
||||
((CertificatePolicyId) other).getIdentifier());
|
||||
return id.equals(((CertificatePolicyId) other).getIdentifier());
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -264,7 +264,7 @@ public class Extension implements java.security.cert.Extension {
|
||||
Extension otherExt = (Extension) other;
|
||||
if (critical != otherExt.critical)
|
||||
return false;
|
||||
if (!extensionId.equals((Object)otherExt.extensionId))
|
||||
if (!extensionId.equals(otherExt.extensionId))
|
||||
return false;
|
||||
return Arrays.equals(extensionValue, otherExt.extensionValue);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -579,7 +579,7 @@ implements CertAttrSet<String>, Cloneable {
|
||||
public boolean verifyRFC822SpecialCase(X500Name subject) throws IOException {
|
||||
for (AVA ava : subject.allAvas()) {
|
||||
ObjectIdentifier attrOID = ava.getObjectIdentifier();
|
||||
if (attrOID.equals((Object)PKCS9Attribute.EMAIL_ADDRESS_OID)) {
|
||||
if (attrOID.equals(PKCS9Attribute.EMAIL_ADDRESS_OID)) {
|
||||
String attrValue = ava.getValueString();
|
||||
if (attrValue != null) {
|
||||
RFC822Name emailName;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -120,7 +120,7 @@ public class OIDName implements GeneralNameInterface {
|
||||
|
||||
OIDName other = (OIDName)obj;
|
||||
|
||||
return oid.equals((Object)other.oid);
|
||||
return oid.equals(other.oid);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -176,7 +176,7 @@ public class OtherName implements GeneralNameInterface {
|
||||
return false;
|
||||
}
|
||||
OtherName otherOther = (OtherName)other;
|
||||
if (!(otherOther.oid.equals((Object)oid))) {
|
||||
if (!(otherOther.oid.equals(oid))) {
|
||||
return false;
|
||||
}
|
||||
GeneralNameInterface otherGNI = null;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -321,7 +321,7 @@ public class RDN {
|
||||
*/
|
||||
DerValue findAttribute(ObjectIdentifier oid) {
|
||||
for (int i = 0; i < assertion.length; i++) {
|
||||
if (assertion[i].oid.equals((Object)oid)) {
|
||||
if (assertion[i].oid.equals(oid)) {
|
||||
return assertion[i].value;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -414,7 +414,7 @@ public class X509CRLEntryImpl extends X509CRLEntry
|
||||
e.hasMoreElements();) {
|
||||
ex = e.nextElement();
|
||||
inCertOID = ex.getExtensionId();
|
||||
if (inCertOID.equals((Object)findOID)) {
|
||||
if (inCertOID.equals(findOID)) {
|
||||
crlExt = ex;
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -1039,7 +1039,7 @@ public class X509CRLImpl extends X509CRL implements DerEncoder {
|
||||
e.hasMoreElements();) {
|
||||
ex = e.nextElement();
|
||||
inCertOID = ex.getExtensionId();
|
||||
if (inCertOID.equals((Object)findOID)) {
|
||||
if (inCertOID.equals(findOID)) {
|
||||
crlExt = ex;
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
* 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
|
||||
@ -1339,7 +1339,7 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
|
||||
return ex;
|
||||
}
|
||||
for (Extension ex2: extensions.getAllExtensions()) {
|
||||
if (ex2.getExtensionId().equals((Object)oid)) {
|
||||
if (ex2.getExtensionId().equals(oid)) {
|
||||
//XXXX May want to consider cloning this
|
||||
return ex2;
|
||||
}
|
||||
@ -1395,7 +1395,7 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
|
||||
|
||||
for (Extension ex : exts.getAllExtensions()) {
|
||||
ObjectIdentifier inCertOID = ex.getExtensionId();
|
||||
if (inCertOID.equals((Object)findOID)) {
|
||||
if (inCertOID.equals(findOID)) {
|
||||
certExt = ex;
|
||||
break;
|
||||
}
|
||||
|
@ -1850,7 +1850,7 @@ public class UnicodeSet implements UnicodeMatcher {
|
||||
syntaxError(chars, "Invalid property pattern");
|
||||
}
|
||||
chars.jumpahead(pos.getIndex());
|
||||
rebuiltPat.append(patStr.substring(0, pos.getIndex()));
|
||||
rebuiltPat.append(patStr, 0, pos.getIndex());
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------
|
||||
|
@ -242,12 +242,13 @@ public class BuddhistCalendar extends GregorianCalendar {
|
||||
return s;
|
||||
}
|
||||
p += yearField.length();
|
||||
StringBuilder sb = new StringBuilder(s.substring(0, p));
|
||||
StringBuilder sb = new StringBuilder(s.length() + 10);
|
||||
sb.append(s, 0, p);
|
||||
// Skip the year number
|
||||
while (Character.isDigit(s.charAt(p++)))
|
||||
;
|
||||
int year = internalGet(YEAR) + BUDDHIST_YEAR_OFFSET;
|
||||
sb.append(year).append(s.substring(p - 1));
|
||||
sb.append(year).append(s, p - 1, s.length());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user